8086tiny icon indicating copy to clipboard operation
8086tiny copied to clipboard

wrapping word writes (eg. MOV [0FFFFh],AX)

Open thamesynne opened this issue 8 months ago • 1 comments

basically, the problem is that the real 8088 wraps around at the end of a segment, and will read or write the high byte of AX at/to DS:0 at this point (and everything above the 8018x will crash with a segfault). 8086tiny - in fairness, along with just about every other 8086 emulator in the world - doesn't do that; instead it reads or writes the first byte after the current segment.

the same problem occurs when the segment address is > 0F000h; a real 8086 will wrap back around to 0, whereas 8086tiny has an accidental HMA! (and more seriously, a 65520-byte-sized array out-of-bounds error)

as I say, this is stuff that just about every other 8086 emulator misses, so it's forgiveable - but nonetheless, it's not how an 8086 behaves... and anything that relies on 8086 behaviour may potentially cause in-universe - or worse, out-of-universe - memory corruption.

(and of course, LDS and LES require the detection of addresses above 0xFFFD...)

thamesynne avatar Jun 05 '25 13:06 thamesynne

@thamesynne, good point! An emulator should emulate the real system.

PopovMP avatar Jun 30 '25 07:06 PopovMP