One interesting aspect of a computer’s instruction set is its addressing modes, how the computer determines the address for a memory access. The Intel 8086 (1978) used the ModR/M byte, a special byte following the opcode, to select the addressing mode. The ModR/M byte has persisted into the modern x86 architecture, so it’s interesting to look at its roots and original implementation.
In this post, I look at the hardware and microcode in the 8086 that implements ModR/M and how the 8086 designers fit multiple addressing modes into the 8086’s limited microcode ROM. One technique was a hybrid approach that combined generic microcode with hardware logic that filled in the details for a particular instruction. A second technique was modular microcode, with subroutines for various parts of the task.
This is way above my pay grade, but I know quite a few of you love this kind of writing. Very in-depth.
I love Ken’s articles, he’s doing a whole series of in-depth 8086 dissection. It gives a fascinating look into what makes the 8086 tick.
This actually shows how well designed the x86 instruction set is. They are short, but versatile. Allows many common uses by default, but still covers corner cases.
From the article:
This is talking about two additional bits in the instructions themselves, allowing direction flips (D) so instructions can work with [MEM], REG or REG, [MEM], and width allowing 16 or 8 bit parameters.
And that same mode-register-memory encoding is still being used in modern x86-64 encoding as well:
https://en.wikipedia.org/wiki/VEX_prefix, but extended to allow much more registers (16 base + SIMD).