Outils pour utilisateurs

Outils du site


back2root:ibm-pc-ms-dos:instr:cmp

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
back2root:ibm-pc-ms-dos:instr:cmp [2023/02/24 14:16] – supprimée - modification externe (Unknown date) 127.0.0.1back2root:ibm-pc-ms-dos:instr:cmp [2023/03/03 23:53] (Version actuelle) – modification externe 127.0.0.1
Ligne 1: Ligne 1:
 +====== CMP - CMPS - CMPSB - CMPSD - CMPSW - CMPSCHG ======
 +
 +===== CMP - Compare =====
 +
 +Subtracts source from destination and updates the flags but does not save result. Flags can subsequently be checked for conditions.
 +
 +**Usage:**
 +<code asm>
 + CMP dest,src
 +</code>
 +
 +**Modifies flags:** 
 +
 +<WRAP round box>
 +CF PF AF ZF SF OF 
 +</WRAP>
 +
 +^              ^  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    |              |
 +
 +===== CMPSx - Compare String (Byte,Word, Dword) =====
 +
 +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:**
 +<code asm>
 + CMPS dest,src
 + CMPSB dest,src
 + CMPSW dest,src
 + CMPSD dest,src ; 386+ only
 +</code>
 +
 +**Modifies flags:** 
 +
 +<WRAP round box>
 +CF PF AF ZF SF OF 
 +</WRAP>
 +
 +^            ^  Clocks                       |||^  Size             ^
 +^  Operands  ^  808x    ^  286  ^  386  ^  486  ^  Bytes  ^           ^
 +| dest,src    22      |  8    |  10    8    |  2      | (W88=30)  |
 +
 +===== CMPSXCHG - Compare and Exchange =====
 +
 +Compares the accumulator (8-32 bits) with "dest". If equal the "dest" is loaded with "src", otherwise the accumulator is loaded with "dest".
 +
 +**Usage:**
 +<code asm>
 + CMPXCHG dest,src ; 486+ only
 +</code>
 +
 +**Modifies flags:** 
 +
 +<WRAP round box>
 +CF PF AF ZF SF OF 
 +</WRAP>
 +
 +^            ^  Clocks                       |||^  Size     ^
 +^  Operands  ^  808x    ^  286  ^  386  ^  486  ^  Bytes  ^   ^
 +| reg,reg    |  -        -    |  -    |  6    |  2      |   |
 +| reg,reg    |  -        -    |  -    |  7    |  2      |   |
 +
 +{{page>back2root:ibm-pc-ms-dos:instr:see-footer}}