Reputation: 4383
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?
Upvotes: 0
Views: 193
Reputation: 94279
I think it's because the ax
register 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
mov ax, 1234h
and see whether that is different.
Upvotes: 4