General Purpose Registers - Order

Why are general purpose registers ordered as they are (eax, ecx, edx, ebx)? For example, for the "inc" command, the operation codes are:

inc eax - 40 inc ecx - 41 inc edx - 42 inc ebx - 43 

Is there a reason why they are ordered this way?

+4
source share
2 answers

The odd placement of (E) BX is probably due to the fact that 8086 came from 8080.

The 8080 has a battery (A) and 6 general purpose registers B, C, D, E, H and L, where B / C, D / E and H / L can be used in pairs, and in a specific H / L can be used as an address to access memory. 8086 was designed in such a way that the existing 8080 code could easily be translated into it; I think it would be logical to display the registers in the following order:

 8080 register A -> 8086 internal register 0 B,C -> 1 D,E -> 2 H,L -> 3 SP -> 4 

As noted in another answer, AX, BX, CX and DX in 8086 are not just arbitrary names for 4 general-purpose registers - they have mnemonic values ​​for special functions that have these registers: "battery", "base" " account "and" data ". Given the comparison above, it makes sense to assign a β€œbattery” for internal register 0 and a β€œbase” function for internal register 3. (And 8086 of internal registers 5, 6, and 7 are BP, SI, and DI, which were new features.)

Of course, all this is just a little informed (see here ), speculation - only 8086 designers know for sure ...

+4
source

There are 8 registers, so each of them received a serial number from 0 to 7.

I do not understand the question. "Why are they not ordered in lexicographical order?" This is because the letters a, b, c, d mean battery, base, counter and data, and are not only the first four letters of the alphabet.

0
source

All Articles