[2006-03-23] Assembly Language

saju's first post made me recall some of the things I miss in C which were so simple in x86 assembly language. For example, while doing fixed-point arithmetic with 32-bit operands, it was immensely useful that the CPU could hold the result of a multiplication (using MUL) in the EDX:EAX 64-bit register combination without overflow and that the same register combination could be used in a following division (using DIV), neatly separating the quotient and the remainder. The ADC ("Add with Carry") instruction was similarly useful for neatly handling overflows in addition. I don't know if you can achieve this in C without resorting to inline assembly. Readers of Michael Abrash's "Graphics Programming Black Book" and Oldskool PC coders will immediately realise what I'm talking about.

(Originally posted on Advogato.)

Other Posts from 2006