开发者

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

G开发者_StackOverflowoogle doesn't show the result,

Anyone knows?


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.


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.


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.


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'.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜