cmpm

Compare memory

Compares two memory operands that use post-increment addressing and sets the flags.

Sizes .b .w .l, .w by default

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

Forms

  • cmpm ,

Operands

(An)+
Memory at an address register, followed by an increase of 1, 2 or 4 bytes for a byte, word or long access. A byte access through sp increases it by 2 to keep it even. More
* --- Compare two memory blocks byte by byte ---
lea $2000, a0 ; free memory: the program itself is at $1000
lea $2100, a1
move.l #$AABB, (a0)
move.l #$AABB, (a1)

cmpm.b (a0)+, (a1)+ ; compare 1st byte (equal)
seq d0
cmpm.b (a0)+, (a1)+ ; compare 2nd byte (equal)
seq d1
; a0 and a1 are auto-incremented after each cmpm