680x0:Condition codes

From Amiga Coding
Jump to: navigation, search

Condition codes are used in branch instructions Bcc and DBcc.
Replace the cc with any of the code you see in the list.


Example

If you like to branch/goto another place in the code if a signed number is greater or equal to 8 use:

  CMP.B #8,D0
  BGE   ItsGreaterOrEqual

ItsGreaterOrEqual:


Signed/unsigned

Unsigned numbers can only be positive, while in signed numbers the highest bit is used to tell if the number is negative. As assembler programmer it's up to you to conciously choose the correct condition code for signed/unsigned numbers.

ccmathematicalmeaningbitcodesignedcomment
NEb<>aNot equal0110
EQb==aEqual0111
HIb>aHIgher0010unsigned
LOb<aLOwerunsigned
HSb>=aHigher or Sameunsigned
LSb<=aLower or same0011unsigned
GTb>aGreater Then1110signed
LTb<aLess Then1101signed
GEb>=aGreater then or Equal1100signed
LEb<=aLess then or Equal1111signed
MIb<0Minus1011
PLb>0Plus1010
CCCarry clear0100
CSCarry set0101
VCNo overflow1000
VSOverflow1001

(the next 2 are not known by all assemblers, because they aren't really usefull) (Seka does know them)
TTrue0000allways branch, same as bra
FFalse0001never branch