You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With ds = 0, mov word [0xffff], 0xbeef should write bytes 0x0ffff and 0x00000: the offset should wrap around but not propagate its carry. Instead it writes 0x0ffff and 0x10000.
To fix this, I think one needs to change inc_addr to take a segment and offset, instead of just a linear address.
The text was updated successfully, but these errors were encountered:
Hey, it seems correct and incorrect at the same time for me 😅
In some sense, it feels more correct to wrap the offset and not the final address, but in some other it feels correct to do the other way. I tried checking the manual, and can't find the description of addressing modes for this case at the moment. Give me some time to think on this.
Also, if you know a reliable place where the addressing is described properly, can you share that?
Note that this addition process provides for modulo 64k addressing (addresses wrap around from the end of a segment to the beginning of the same segment).
That maybe doesn't directly address wraparound within one instruction, but I'm also looking at the 80386 Programmer's Reference Manual. On page 14-6, discussing differences between 8086 and 80386, it says:
On the 8086, an attempt to access a memory operand that crosses offset 65,535 (e.g., MOV a word to offset 65,535) or offset 0 (e.g., PUSH a word when SP = 1) causes the offset to wrap around modulo 65,536.
With ds = 0,
mov word [0xffff], 0xbeef
should write bytes0x0ffff
and0x00000
: the offset should wrap around but not propagate its carry. Instead it writes0x0ffff
and0x10000
.To fix this, I think one needs to change
inc_addr
to take a segment and offset, instead of just a linear address.The text was updated successfully, but these errors were encountered: