Why are early x86 processors so few registers?

Questions from readers

When reading my previous article on calling conventions on 16-bit systems, some readers have this question: Why are there so few registers available on the early x86 processors?

The 8086 is a 16-bit microprocessor, and the 8080 is earlier. It has 6 8-bit registers named: A, B, C, D, E, H and L. Through pairwise combination, we can use them to generate 16-bit virtual registers, such as: BC, DE and HL.
In addition, you can even put a 16-bit address into the HL register and use another virtual register "M" to dereference it.
So, for example, you can write "MOV B, M" like this, which means: load the 8-bit value pointed to by the HL register into the B register.

The 8086 processor follows the register design of the 8080 processor and uses the following methods to map them:
> A => AL
> H => BH, L => BL; HL => BX; M => [BX ]
> B => CH, C => CL; BC => CX
> D => DH, E => DL; DE => DX

This is why the 8086 instruction set can only be dereferenced through [BX] instead of [CX] or [DX], in order to migrate the old 8-bit code to the new 16-bit processor. Even the MS-DOS operating system calls are designed in this similar way, and the machine-level conversion of the code has been implemented.

What about SI and DI registers?

I guess that their introduction may be inspired by the IX and IY registers on the Z-80. Z-80 is a competing product of the 8080 processor. It uses the 8080 instruction set and uses more registers to expand the instruction set. On the Z-80 processor, you can use [IX] and [IY] to dereference, and on the 8086, you can also use [SI] and [DI] to dereference.

What about the BP register?

I guess again that it was introduced to enable stack-based parameter passing. Please note that the BP register is the only default SS segment register on the 8086 processor, which can be used to directly access the memory.

Why can't we add more registers like modern processors have 16 or even 128 registers at every turn?
Why are there only 8 registers (AX, BX, CX, DX, SI, DI, BP, SP) reserved on the 8086 processor?
Simply put, it's historical reasons. At the time of 8086, most processors did not have many registers.
Another processor, 68000, is designed with up to 16 registers, but if you take a closer look at its design documents, only half of these registers can be used for general calculations, and the other half can only be used for memory access.

to sum up

History (the number of registers of the processor), written by the winner (Intel).

At last

Raymond Chen's "The Old New Thing" is one of my favorite blogs. It contains a lot of little knowledge about Windows, which is really helpful for the majority of Windows platform developers.
This article is from: "Why does the x86 have so few registers?"

Guess you like

Origin blog.csdn.net/mmxida/article/details/108805380