For example, the accumulator is named EAX
and, while the instruction pointer is called IP
. I also know that there are bytes called CL
and DH
. I know there must be a convention to all of the names, but what is it?
views:
975answers:
5The C and the D are numbers/types and H for high and L for low parts of the higher register. http://en.wikipedia.org/wiki/X86
Wikipedia explains it very well.
More from the Wikipedia:
- AX/EAX/RAX: accumulator
- BX/EBX/RBX: base
- CX/ECX/RCX: counter
- DX/EDX/RDX: data/general
* EAX - Accumulator Register
* EBX - Base Register
* ECX - Counter Register
* EDX - Data Register
* ESI - Source Index
* EDI - Destination Index
* EBP - Base Pointer
* ESP - Stack Pointer
It's history. The x86 came from the 8086, which came from the 8080, which came from the 8008, which came from the 4004. There were 16-bit registers AX, BX, etc. and for the 80386 they got "extended" to 32 bits.
Added: BTW the Motorola 68K had 32-bit registers from the start, so it was much easier to program for the first couple decades. I worked on projects where Intel was chosen for business reasons, not technical.
older processors have accumulators named A, B, etc (alphabeticaly orderd). When 16 and 32 bytes accumulators were developed, engineers added an X (extended). So its all about history, as the language C is called this way becouse it was developed from B language (Bell labs).
The convention is only internal, to keep up with the names they are alredy familiar with.
Some good answers here: x86 assembly registers — Why do they work the way they do?