APPENDIX A. X86 APPENDIX A. X86
For a detailed description, you can read more about the CMPSx (A.6.3 on page 890) and SCASx (A.6.2 on page 888)
instructions.Instructions prefixed by REPE/REPNE are sensitive to the DF flag, which is used to set the direction.A.6.2 Most frequently used instructions
These can be memorized in the first place.
ADC(add with carry) add values,incrementthe result if the CF flag is set. ADC is often used for the addition of large values,
for example, to add two 64-bit values in a 32-bit environment using two ADD and ADC instructions. For example:
; work with 64-bit values: add val1 to val2.
; .lo mean lowest 32 bits, .hi means highest.
ADD val1.lo, val2.lo
ADC val1.hi, val2.hi ; use CF set or cleared at the previous instructionOne more example:24 on page 379.ADDadd two values
ANDlogical “and”
CALLcall another function:PUSH address_after_CALL_instruction; JMP label
CMPcompare values and set flags, the same asSUBbut without writing the result
DECdecrement. The CF flag is not modified.
IMULsigned multiply
INCincrement. The CF flag is not modified.
JCXZ, JECXZ, JRCXZ(M) jump if CX/ECX/RCX=0
JMPjump to another address. The opcode has ajump offset.
Jcc(where cc—condition code)
A lot of these instructions have synonyms (denoted with AKA), this was done for convenience. Synonymous instructions
are translated into the same opcode. The opcode has ajump offset.JAEAKAJNC: jump if above or equal (unsigned): CF=0JAAKAJNBE: jump if greater (unsigned): CF=0 and ZF=0JBEjump if lesser or equal (unsigned): CF=1 or ZF=1
JBAKAJC: jump if below (unsigned): CF=1JCAKAJB: jump if CF=1JEAKAJZ: jump if equal or zero: ZF=1JGEjump if greater or equal (signed): SF=OFJGjump if greater (signed): ZF=0 and SF=OFJLEjump if lesser or equal (signed): ZF=1 or SF≠OFJLjump if lesser (signed): SF≠OFJNAEAKAJC: jump if not above or equal (unsigned) CF=1JNAjump if not above (unsigned) CF=1 and ZF=1JNBEjump if not below or equal (unsigned): CF=0 and ZF=0JNBAKAJNC: jump if not below (unsigned): CF=0JNCAKAJAE: jump CF=0 synonymous to JNB.JNEAKAJNZ: jump if not equal or not zero: ZF=0JNGEjump if not greater or equal (signed): SF≠OFJNGjump if not greater (signed): ZF=1 or SF≠OFJNLEjump if not lesser (signed): ZF=0 and SF=OF
JNLjump if not lesser (signed): SF=OFJNOjump if not overflow: OF=0