CMP COMPARE
CMP
Encoding:
Memory or Register Operand with Register Operand:
I00111 0 d w Imod reg rIm I
if d = 1 then LSRC = REG, RSRC = EA else LSRC = EA, RSRC = REG
Immediate Operand with Memory or Register Operand:
11 00000 s w I mod 111 rIm I | data | Idata if s:w=o11 |
LSRC= EA, RSRC = data
Immediate Operand with Accumulator:
I00111 1 0 w I | data | I data if w=1 |
if w = 0 then LSRC = AL, RSRC = data else LSRC = AX, RSRC = data
CMP Operands | Clocks* | Transfers | Bytes | CMP Coding Examples |
register, register | 3 | - | 2 | CMP BX, CX |
register, memory | 9(13) + EA | - | CMP OH, ALPHA | |
memory, register | 9(13) +EA | - | CMP [BP + 2], SI | |
register, immediate | rif | - | CMP BL, 02H | |
memory, immediate | 10(14)+ EA | - | CMP [BX].RAOAR [01], | |
|
|
|
| 3420H |
accumulator, immediate | 4 | - | CMP AL, 00010000B |
*b(w): where b denotes the number of clock cycles for byte operands and w denotes the number of clock cycles for word operands.