PeterX wrote:nexos wrote:
PeterX wrote:Place 3.) using the 16 x factor for real mode segments
Not the real mode segmentation expert, could someone expound on this
?
I mean the segments style where 1:0 means the same as 0:0x10.
Well, it has become so normal, that most people don't notice this anymore and maybe it's not that bad if you consider the 16bit limitation back then.
It's best to think about it visually: Imagine you have a scroll of paper with marked lines hidden under a table, and a window in the table that you can look at part of the scroll through, big enough to show a large number of lines. Then you have a keypad and 7 segment display that you can use to enter a line number, after which the paper will be moved so that that line number selected will be at the top of the window.
Individual characters on the paper correspond to bytes in memory, lines correspond to 16 byte blocks (in DOS parlance often called "paragraphs"), the window corresponds to the 16-bit address space for one segment, the keypad and display correspond to the segment register, and the whole scroll is the 1 MiB real-mode address space.
So 1:0 can be thought of as "line 1, character 0". It gets a bit confusing if you refer to an address with a line number followed by a character number more than one line down the window ("line 1, character 2000"), but you can think of this as "line 1, then the 2000th character in the window". Also, for many DOS applications, memory requirements were low enough that you could just run with the base segment register value that DOS set up for the application and pretend you were on an unsegmented machine with 64k of memory.
-------------------------------------------------------------------------------------------------------
One change I would have made to the 8086, though, would be to add a user/kernel mode bit, and then make all instructions that wrote exact values to segment registers privileged. I then would have added ADDSEG and SUBSEG instructions that would be unprivileged, and the ability in kernel mode to set upper and lower limits for the values each segment register could have in user mode, with attempts to ADDSEG or SUBSEG above/below these limits trapping to kernel mode.
The effect this would have had would have been to allow the 8086 to act as a Turing machine, with each segment being a "head" on the "tape". Some portion of the virtual tape around each head would be stored in memory, and if a program tried to move a head beyond the region stored in memory for that head, there would be a segment limit exception, and the OS would swap some portion of the tape to disk, then swap in the region the head was moving into (or zero-initialize it if that part of the tape hadn't been touched before). This would have allowed applications to have an address space much larger than the address bus width of the processor, limited only by the capabilities of the OS and disk hardware.
But that's not so much "wreckage" as an interesting road not taken.