General-Purpose Registers


The general-purpose registers are primarily used for arithmetic and data movement. They include 32-bit registers: , , , and .

Note that an empty section may cause error.
EAX Register Output
 INCLUDE Irvine32.inc
 .data
  dummy WORD ?
 .code
 main PROC
  mov    eax, 12345678h
  mov    ax,  0ABCDh
  call   WriteHex
  exit
 main ENDP
 END main


 

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

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: