Slide 4.11: Instruction operands
Slide 4.13: Integer constants
Home

General-Purpose Registers


The general-purpose registers are primarily used for arithmetic and data movement. They include 32-bit registers: EAX, EBX, ECX, and EDX.
EAX Register Output
 .code
 mov    eax, 12345678h
 mov    ax,  0ABCDh
 call   WriteHex





Each register can also be addressed as 16-bit value. For example, the 16-bit register for EAX is AX, which can be further addressed as two separate 8-bit values: AH and AL.

32-bit
16-bit 16-bit
  8-bit (high) 8-bit (low)
  AH AL
  AX
EAX
 
32-bit
16-bit 16-bit
  8-bit (high) 8-bit (low)
  BH BL
  BX
EBX
 
32-bit
16-bit 16-bit
  8-bit (high) 8-bit (low)
  CH CL
  CX
ECX
 
32-bit
16-bit 16-bit
  8-bit (high) 8-bit (low)
  DH DL
  DX
EDX

The word “general-purpose” means the registers could be used for many purposes. However, registers used in the following ways will generate more efficient machine code: