<<< x86 Opcode Sizes     Index     Encoding x86 Instruction Operands, MOD-REG-R/M Byte >>>

5. x86 ADD Instruction Opcode


  • Bit number zero marked s specifies the size of the operands the ADD instruction operates upon:

    • If s = 0 then the operands are 8-bit registers and memory locations.

    • If s = 1 then the operands are either 16-bits or 32-bits:

      • Under 32-bit operating systems the default is 32-bit operands if s = 1.

      • To specify a 16-bit operand (under Windows or Linux) you must insert a special operand-size prefix byte in front of the instruction (example of this later.)

  • _________________________

  • You'll soon see that this direction bit d creates a problem that results in one instruction have two different possible opcodes.

  • x86 ADD instruction opcode :

      x86 ADD Opcode

  • Bit number one, marked d, specifies the direction of the data transfer:

    • If d = 0 then the destination operand is a memory location, e.g.

              add [ebx], al
      
    • If d = 1 then the destination operand is a register, e.g.

              add al, [ebx]
      

<<< x86 Opcode Sizes     Index     Encoding x86 Instruction Operands, MOD-REG-R/M Byte >>>