Operation

IF (instruction = CMPSD) OR
(instruction has operands of type DWORD)
THEN OperandSize  32;
ELSE OperandSize  16;
FI;
IF AddressSize = 16
THEN
use SI for source-index and DI for destination-index
ELSE (* AddressSize = 32 *)
use ESI for source-index and EDI for destination-index;
FI;
IF byte type of instruction
THEN
set ZF based on
[source-index] - [destination-index]; (* byte comparison *)
IF DF = 0 THEN IncDec  1 ELSE IncDec  -1; FI;
ELSE
IF OperandSize = 16
THEN
set ZF based on
[source-index] - [destination-index]; (* word comparison *)
IF DF = 0 THEN IncDec  2 ELSE IncDec  -2; FI;
ELSE (* OperandSize = 32 *)
set ZF based on
[source-index] - [destination-index]; (* dword comparison *)
IF DF = 0 THEN IncDec  4 ELSE IncDec  -4; FI;
FI;
FI;
source-index = source-index + IncDec;
destination-index = destination-index + IncDec;


[Back: Description]
[Next: Flags Affected]