why do I keep hacking 16bit DOS games? do I hate myself?
32bit programs are SO MUCH EASIER to RE, because when you see an address, you know what it means. 0x12345678 always means 0x12345678!
why do I keep hacking 16bit DOS games? do I hate myself?
32bit programs are SO MUCH EASIER to RE, because when you see an address, you know what it means. 0x12345678 always means 0x12345678!
not to mention that there's more than one way to address a given part of memory.
in 32bit and 64bit code, if you see 0x12345678, you know that some code that writes to 0x12335662 doesn't change it.
not so in 16bit games. you have plenty of ways to refer to the same address.
16bit x86 does this as well. 16bits of ram is only 64kb, and that's just not enough. So you expand it to 24bits or 32bits, for "long addresses", right? same as you use in 8bit computers?
NOPE
segmented addressing, the solution they use, is not as simple as just adding some more bits. a 16bit segment and a 16bit offset.
so that's just a weird way of explaining a 32bit number, right?
NOPE
no, you combine 16bits and 16bits and get... 20 bits.
it's a 20bit address.
so what, they ignore all but the bottom 4 bits of the segment?
NO THAT WOULD MAKE SENSE
So it's the TOP 4 bits that are important, not the bottom 4.
Okay that's fine, but wait, I said adding. Not "replacing".
Yes, all 16bits are used. So the address 0000:0000 is (linear) 0x0, and 0001:0000 is (linear) 0x10
which also means that 0001:0000 and 0000:0010 are both linear 0x10.
So you can get pointer aliasing even though both pointers HAVE DIFFERENT VALUES
@root42 @foone Fair point about the unavailability of 8086-specific companion chips.
I still maintain that the DMA controller's limitations have nothing to do with x86's segmentation or vice-versa.
Sure, a DMA page could be accessed quite conveniently by setting a segment register to a multiple of 0x1000, but that would have been just as easy with any other CPU-side memory model. It's really the DMA itself that's the limiting factor here, and no amount of CPU quirks would have amended that.