Appendix B: Common x86 Instructions


Reading the Tables

The tables of instructions presented in this appendix include:

  • The instruction code

  • The operands used

  • The flags used

  • A brief description of what the instruction does

In the operands section, it will list the type of operands it takes. If it takes more than one operand, each operand will be separated by a comma. Each operand will have a list of codes which tell whether the operand can be an immediate-mode value (I), a register (R), or a memory address (M). For example, the movl instruction is listed as I/R/M, R/M. This means that the first operand can be any kind of value, while the second operand must be a register or memory location. Note, however, that in x86 assembly language you cannot have more than one operand be a memory location.

In the flags section, it lists the flags in the %eflags register affected by the instruction. The following flags are mentioned:

O

  • Overflow flag. This is set to true if the destination operand was not large enough to hold the result of the instruction.

S

  • Sign flag. This is set to the sign of the last result.

Z

  • Zero flag. This flag is set to true if the result of the instruction is zero.

A

  • Auxiliary carry flag. This flag is set for carries and borrows between the third and fourth bit. It is not often used.

P

  • Parity flag. This flag is set to true if the low byte of the last result had an even number of 1 bits.

C

  • Carry flag. Used in arithmetic to say whether or not the result should be carried over to an additional byte. If the carry flag is set, that usually means that the destination register could not hold the full result. It is up to the programmer to decide on what action to take (i.e. - propogate the result to another byte, signal an error, or ignore it entirely).

Other flags exist, but they are much less important.




Programming from the Ground Up
Programming from the Ground Up
ISBN: 0975283847
EAN: 2147483647
Year: 2006
Pages: 137

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net