On Sat, 27 Apr 2024, Fred Cisin via cctalk wrote:
How many know that AAM is a two byte instruction, with
te second byte beint
0Ah?
Changing the second byte to 8 gave division by 8, etc.
It's the kind of a question you can't really answer, but the feature has
been known since forever. Myself I've found this out in early 1990s, soon
after I switched from the Z80 to x86. And now it's a documented feature:
Opcode Instruction Op/ 64-bit Compat/ Description
En Mode Leg Mode
D5 0A AAD A Invalid Valid ASCII adjust AX before
division.
D5 ib (No mnemonic) A Invalid Valid Adjust AX before division to
number base imm8.
Opcode Instruction Op/ 64-bit Compat/ Description
En Mode Leg Mode
D4 0A AAM A Invalid Valid ASCII adjust AX after
multiply.
D4 ib (No mnemonic) A Invalid Valid Adjust AX after multiply to
number base imm8.
(from "Intel 64 and IA-32 Architectures Software Developer's Manual"). I
did use these instructions in a bunch of my programs; by 1990s it hardly
mattered that some early x86 clones did not support these encodings (and
I think it was indeed the way to tell NEC V20 and other x86 chips apart:
good if you wanted to make seamless use of the 8080 emulation mode).
FWIW,
Maciej