site banner

Friday Fun Thread for September 09, 2022

We don't have the bot, so let me step in: this thread is not for serious in depth discussion of weighty topics, this thread is not for anything Culture War related. This thread is for Fun. You got jokes? Share 'em. You got silly questions? Ask 'em.

8
Jump in the discussion.

No email address required.

The a-d registers, to the best of my knowledge, are named generic because it's in contrast to the other registers with very specific functions. For example, sp and ip aren't something you'd ever store data in just for funsies, so ax is very generic by comparison (even if it does have some special uses for certain instructions).

I imagine that the special uses come from the need to reduce binary size back in the day. If you needed to specify "mul rax, rcx" instead of just "mul rcx" that's extra encoding which would add up over time. Nowadays not such a big deal, but at the time the instruction set was designed it would've been quite a big deal.

For what it's worth, in long mode you get 8 extra generic registers (r8-r15), and those really are generic if the OG generic registers aren't generic enough for your taste. 😉

Although the 80386 Programmer's Manual lists eax, ebx, ecx, and edx as "general-purpose registers", you sometimes see them referred to as "accumulator", "base", "counter", and "data". Example: the rep instruction works on cx or ecx as a loop counter and you don't have any choice in the matter. Not sure whether that's documented intent or folklore.