Mask
Mask

Reputation: 34197

What does X mean in EAX,EBX,ECX ... in assembly?

Google doesn't show the result,

Anyone knows?

Upvotes: 31

Views: 36746

Answers (6)

Shehan Hasintha
Shehan Hasintha

Reputation: 1165

The following is a brief explanation of what each of the x86 general-purpose registers stands for:

  • EAX: "Extended Accumulator" - used for arithmetic and logical operations, as well as for storing return values from functions.
  • EBX: "Extended Base" - often used as a pointer to data in the data segment of memory.
  • ECX: "Extended Counter" - often used for loop and string operations, as well as for storing function arguments.
  • EDX: "Extended Data" - often used for I/O operations and for storing function arguments.
  • ESI: "Extended Source Index" - often used as a pointer to a source operand in string operations.
  • EDI: "Extended Destination Index" - often used as a pointer to a destination operand in string operations.
  • EBP: "Extended Base Pointer" - often used as a pointer to the base of the current stack frame.
  • ESP: "Extended Stack Pointer" - often used as a pointer to the top of the current stack frame.

Upvotes: -2

supercat
supercat

Reputation: 81149

On the 8086, the AX register was the combination of AH and AL. Likewise BX was BH and BL, etc. On the 80386, rather than combining 16-bit registers into 32-bit registers, Intel added 16 bits to each register. The name "AL" still refers to bits 0-7 of the first letter-named register, "AH" to bits 8-15, and "AX" to bits 0-15; the name "EAX" now refers to all 32 bits of the register.

It's interesting to note that most other 16- and 32-bit processors do not offer any equivalent means of accessing just the upper or lower parts of a register. The costs of allowing such access, both in hardware complexity and instruction-encoding bits, were significant, and in today's day and age, the ability to add one 8-bit portion of a register to an 8-bit portion of another register is far less useful than many other uses to which such hardware or instruction-encoding space might be put. On the other hand, there are still times when such abilities can be useful when they exist.

Upvotes: 9

I. J. Kennedy
I. J. Kennedy

Reputation: 25819

The X means pair, and goes back to at least the 8080. It had 8-bit registers B,C,D,E,H,L (among others) which could also be used in pairs (BC, DE and HL). The BC and DE pairs were used mostly for 16-bit arithmetic; the HL pair generally held a memory address. Some examples of the usage of X for pair:

LXI  D,12ABH    ; "load pair immediate"
DCX  B          ; "decrement pair"
STAX D          ; "store A (indirect) at pair"

Fast forward to the 8086. It has registers AL,AH,BL,BH,CL,CH,DL,DH, which, similarly to the 8080, can be used in pairs: AX, BX, CX, DX.

As others have pointed out, the E in the 32-bit register names means extended.

Upvotes: 53

thecoshman
thecoshman

Reputation: 8650

One posible reason I can think of, is to denote that it has not 'normal' state. When talking about serial communication in electronics, if one of the data lines can be anything, you might say its state is X as it is neither/both/either 0 or 1.

Upvotes: 0

user257111
user257111

Reputation:

As Mihai says, it is just a naming convention.

However, given that 'X' is often used for "fill in your value" and is commonly used by mathematicians as the first variable name of choice in equations, and that those particular registers are general purpose (as opposed to say ESP which is the extended (32-bit) stack pointer or EIP the extended instruction pointer) that is perhaps why X is chosen as opposed to say 'B'.

Upvotes: 1

Guffa
Guffa

Reputation: 700312

Nothing, as far as I know. It stands for a general purpose register.

The 16 bit AX register can be addressed as AH (high byte) and AL (low byte).

The EAX register is the 32 bit version of the AX register. The E stands for extended.

Upvotes: 10

Related Questions