5 ms·
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
by rep_lodsb 3y ago
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.
- peterfirefly 3y agoWas the 186 really different from the 286 in that respect?
- rep_lodsb 3y agoYes, 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.
- peterfirefly 3y agoHuh. 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.