CX is equal to 14 AX is equal to 16
IDIV CX
But somewhy in AL there is 37. There is no mistakes or errors before that line. Where I've made a mistake? Thank you! p.s. writting on Emu8086
CX is equal to 14 AX is equal to 16
IDIV CX
But somewhy in AL there is 37. There is no mistakes or errors before that line. Where I've made a mistake? Thank you! p.s. writting on Emu8086
IDIV CX
divides the 32-bit value DX:AX
by CX
, and stores the quotient in AX
and the remainder in DX
.
Therefore the value of DX
prior to the IDIV
instruction matters, and you should either sign-extend AX
into DX
using the CWD
instruction (before IDIV
), or clear DX
using e.g. XOR DX,DX
(before DIV
).