ASM IF condition synonyms- help
Ron Czapala
Posts: 2,418
Am I correct thinking that these three IF conditions work exactly the same?
IF_NC_AND_NZ
IF_NZ_AND_NC
IF_A
and similarly
IF_C_OR_Z
IF_Z_OR_C
IF_BE
If they are equivalent, why are the other versions necessary?
IF_NC_AND_NZ
IF_NZ_AND_NC
IF_A
and similarly
IF_C_OR_Z
IF_Z_OR_C
IF_BE
If they are equivalent, why are the other versions necessary?
Comments
It make life easier to code when you don't have to type them one and only one way.
Also, IF_A is more readable then IF_NZ_AND_NC.
If I use a flag to do a jmp (or execute another instruction), does it clear the flag?
Yes they are equivalent. IF_A / IF_B are shorthand for if_above / if_below and assume that the previous opcode was the appropriate comparison with wc,wz.
@Nick McClick
The flags will only be changed if the opcode is executed (so the flag comparison is true) and the opcode has wc or wz set. This can be useful:
The duplicate and triplicate instructions threw me but I guess I can see that they might make the code "read easier" depending on the prevoius instructions.