Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The order is AX CX DX BX SP BP SI DI


The reason I've heard for this ordering (or why BX is out of alphabetic order) is that in 16-bit x86, it's the only "splittable" (into BH and BL) register that can be used to access memory, so it was grouped together with the last 4 (which can also be used to access memory) in order to simplify the logic.


All the first four registers are splittable and can be used in all addressing modes[1], apart from CISCy instructions like loop and jcx that implicitly use CX (count) register, string operations, xlat, imul etc.

My personal suspicion is that it's something to do with bit ordering. If you reverse the order of bits from LSB to MSB, then BX and CX switch places.

[1] Indexed addressing modes do need to use BX or BP as a base on 8086. Indexed modes are a bit CISCy though, considering they are often used with lea to do non-memory calculations.


What does "order" mean here? Is a register different from any other, except by conventional use?


The bits used to represent each register in 8086 machine code, when sorted as binary numbers, come out in this order.

Where the bits go depend on the instruction and addressing mode. They generally follow this pattern; some addressing modes don't support some registers though.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: