cmpa

Compare address

Compares an address register with the first operand and sets the flags, sign extending a word to long.

Sizes .w .l, .w by default

XNZVC –●●●●
  • ● depends on the result
  • – not changed

Forms

Operands

<ea>
An operand using one of the addressing modes listed for this form. The list determines whether it can be a register, memory or an immediate value. With opt p=68020, an allowed d(An,Xn) or d(PC,Xn) mode also permits the corresponding 68020 indexed and memory indirect forms. See 68020 addressing. More
An
An address register, a0 to a7; sp is another name for a7. More
#imm
An immediate value written after #: a number, character or label, such as #10, #$FF or #'a'. It must fit the operation’s size: byte -128 to 255, word -32768 to 65535, or long -2147483648 to 4294967295; signed and unsigned spellings are accepted. More

Neither operand changes. With .w, the first operand is sign-extended to long before the 32-bit comparison. With .l, both operands are read as longs. X is unchanged.

lea $1000, a0
cmpa.l #$1000, a0
seq d0 ; d0 = $FF (equal)

lea $2000, a1
cmpa.l #$1000, a1
sgt d1 ; d1 = $FF ($2000 > $1000)