----- CMPSB -------
ES: [DI] and DS: [Si] Bytes
Comparison method: DS: [Si] - ES: [DI]
Set as follows: OF, SF, ZF, AF, PF, CF
IF DF = 0 THEN SI = Si 1 Di = Di 1 else Si = Si - 1 Di = DI - 1
----- cmpsw -------
ES: [DI] and DS: [Si] Comparison
Algorithm: Compare Words: ES: [DI] from DS: [Si].
Comparison method: DS: [Si] - ES: [DI]
Set as follows: OF, SF, ZF, AF, PF, CF
IF DF = 0 THEN Si = Si 2 Di = Di 2 else Si = Si - 2 Di = Di - 2
----- scaSB -------
Al and ES: [Di] by one byte comparison
Comparison Method: ES: [DI] - Al
Set as follows: OF, SF, ZF, AF, PF, CF
IF DF = 0 THEN DI = DI 1 ELSE DI = Di - 1
----- scASW -------
AX and ES: [Di]
Comparison method: ES: [DI] - AX
Set as follows: OF, SF, ZF, AF, PF, CF
IF DF = 0 THEN DI = DI 2 Else Di = Di - 2
------ REPE ------
ZF = 1 When the CMPSB, CMPSW, SCASB, SCASW, and the number of times the cyclic execution is the value of CX, set the zf flag according to the return result.
Circulation method:
CHECK_CX: IF CX <> 0 Then Do Following Chain Instruction CX = CX - 1 IF ZF = 1 Then: Go Back to Check_CX Else Exit from Repe Cycle Else Exit from Repe Cycle
----- repne -------
When zf = 0 is looped, the CMPSB, CMPSW, SCASB, SCASW, and the number of cyclic executions is the value of CX, set the ZF flag according to the return result.
Circulation method: