Subtracts source from destination and updates the flags but does not save result. Flags can subsequently be checked for conditions.
Usage:
CMP dest,src
Modifies flags:
CF PF AF ZF SF OF
Clocks | Size | |||||
---|---|---|---|---|---|---|
Operands | 808x | 286 | 386 | 486 | Bytes | |
reg,reg | 3 | 2 | 2 | 1 | 2 | |
mem,reg | 9+EA | 7 | 5 | 2 | 2-4 | (W88=13+EA) |
reg,mem | 9+EA | 6 | 6 | 2 | 2-4 | (W88=13+EA) |
reg,immed | 4 | 3 | 2 | 1 | 3-4 | |
mem,immed | 10+EA | 6 | 5 | 2 | 3-6 | (W88=14+EA) |
accum,immed | 4 | 3 | 2 | 1 | 2-3 |
Subtracts destination value from source without saving results. Updates flags based on the subtraction and the index registers (E)SI and (E)DI are incremented or decremented depending on the state of the Direction Flag. CMPSB inc/decrements the index registers by 1, CMPSW inc/decrements by 2, while CMPSD increments or decrements by 4. The REP prefixes can be used to process entire data items.
Usage:
CMPS dest,src CMPSB dest,src CMPSW dest,src CMPSD dest,src ; 386+ only
Modifies flags:
CF PF AF ZF SF OF
Clocks | Size | |||||
---|---|---|---|---|---|---|
Operands | 808x | 286 | 386 | 486 | Bytes | |
dest,src | 22 | 8 | 10 | 8 | 2 | (W88=30) |
Compares the accumulator (8-32 bits) with “dest”. If equal the “dest” is loaded with “src”, otherwise the accumulator is loaded with “dest”.
Usage:
CMPXCHG dest,src ; 486+ only
Modifies flags:
CF PF AF ZF SF OF
Clocks | Size | |||||
---|---|---|---|---|---|---|
Operands | 808x | 286 | 386 | 486 | Bytes | |
reg,reg | - | - | - | 6 | 2 | |
reg,reg | - | - | - | 7 | 2 |