Reputation:
Early on, memory size was little (64 KiB) and it just needed a 16-bit register to address it. But later memory with 1 MiB came. So we need bigger address registers. But in 8086 CPUs instead they used another register and called it offset.
So with 16-bit main register we can address 65536 segments and with 16-bit offset we can address 65536 bytes in those segments so the whole memory that we can address should be 65536 * 65536, that means 4 GiB that we can address.
But on an 8086 we can address 1 MiB with a 32-bit far pointer (16-bit segment + 16-bit offset). Why is that?
Upvotes: 0
Views: 541
Reputation: 2754
As mentioned in the comments by Nate Eldredge, the segments overlap. Each subsequent 86 Mode segment starts 16 bytes after the prior one. So (as mentioned) there are 4096 (4 Ki) ways to address any one byte.
The exception is to do with A20 handling on later x86 CPUs. On those, if A20 is enabled, memory in the first 64 KiB has less aliases pointing to it. An address that would "wrap" on the 8086, starting with 0FFFFh:0010h
, would have pointed into the first 64 KiB (starting with linear address 00_0000h
).
If A20 is enabled, the high addresses do not "wrap" any longer, so that 0FFFFh:0010h
actually refers to the linear address 10_0000h
(exactly at 1 MiB = 1_048_576 Bytes). The highest accessible address in Real or Virtual 86 mode with A20 enabled is 0FFFFh:0FFFFh
, which points to linear 10_FFEFh
(just below 1088 KiB - 16 Bytes), that is 1_114_096 Bytes are addressable using a 16:16 far address.
Upvotes: 1