An assembly program is converted to binary code and I ran a simple code in emulator for 8086. I excepted the IP to be 0004, instead it had been 0006.
MOV AX,21H
ADD AX,42H
I think IP should be 0004H, 0000 FOR MOV ,then 0000 to read 21H ,and same for ADD and 42H.
Whereas in emulator it is:
01000: B8 184
01001: 21 003
01002: 00 000 NULL
02003: 05 005
01004: 53 066
01005: 00 000 NULL
why is adding 01002 and 01005 to the code?and what does it mean?
I think it’s because the
axregister is 16 bits, so the constant is actually 16 bits as well (two bytes). It’s just that your constants are so small that you don’t notice that the upper byte is always zero.Try
and see whether that is different.