Based on AAM using CORD for the division operation will D4 00 generate the same division by zero error as a DIV with a zero divisor? (I can’t think of any reason this would be useful but I do like thinking about edge cases and how things break.)
My transistor-level simulator shows that the 8086 will generate a divide by 0 interrupt if you give the AAM instruction a divisor of 0. But I haven't tried this on a real chip.
With the one exception being the 80186, where 'AAM 00h' will result in AH=FFh. It passes the divisor directly to the ALU engine without checking for zero, most likely rationale being that operands other than 0Ah are undocumented :)
That was fixed (either in microcode or hardware) on all later generations. And the 8086/88 did the check in the CORD subroutine of course, which is used by both DIV and AAM.
Yes, the 186 microcode is remarkably similar to that of the original 8086, except for some encoding differences.
Multiply/divide is now assisted by the ALU, so the microcode mainly has to set up the registers and do the check for zero divisor / overflow. There is also a final adjustment to the result, because the hardware uses a non-restoring algorithm that may underflow. And for signed division, the operands are converted to unsigned first and the result possibly negated at the end, using the F1 flag to store the sign like on the 8086.
The 286's instruction decoder and microcode ROM are entirely different: 1536 words of 35 bits, with the entry point determined by a separate PLA.
Huh. I thought they were identical except for the 286 having more hardware and more microcode for all the protected mode stuff -- and less for not having timer/interrupt controller/DMA/etc.