How DOS was able to use most of the 1 MB address space of the 8086
blogsystem5.substack.com
blogsystem5.substack.com
Consider: It scans for holes in the memory map. It switches to protected mode, then v86 mode, sets up page tables, and is basically more of an OS than DOS, if you look at the CPU. It monitors IO ports and rewrites DMA access from random programs to translate the UMBs to their physical addresses. It implements VCPI to cooperate with e.g. windows and dos4gw. It switches A20 on and off when translation needs to happen.
And all that to gain memory from segments C000,D000,E000, if nothing else sits there. So 192K max.
Looking back, it's insane what contortions we went to, just to keep dos alive.
Windows/386 and the DOS-based Windows up to Me were similarly hypervisors for DOS.
They give linear adresses of the processor's descriptor tables. Code running with paging enabled can't even read these locations, so they are pretty useless for user mode. But they allow user mode to get forbidden info from the kernel, and virtualizing lgdt/lidt/lldt becomes impossible because non-privileged code can see the values given to the cpu changed, and a save state/restore state is impossible under virtualization.
Under newer processors, flag CR4.umip makes them trap, so virtualization becomes possible.
True.
This is why I've suggested an inverse EMM386 to the FreeDOS team: a 32-bit app that has a single purpose -- start 1 DOS VM.
That is the only way I can imagine to create a form of DOS that could be booted on UEFI computers, and without that, soon FreeDOS will be confined to VMs and old kit.
The idea is, start a very very simple 32-bit binary that creates 1 V86-mode VM, maps some DOS resources into it (disk, screen, keyboard, mouse, etc.), then loads the DOS kernel into it.
In DOS a stub EMM386.EXE could create some UMBs and LIM EMS if you want it.
I doubt it will ever be possible to support sound cards, network cards, etc. this way but most modern ones don't work on DOS anyway so nothing of importance is lost.
DESQview, IBM TopView which inspired it, Windows 2 itself, Windows 3 in real mode, DR Concurrent DOS and CDOS 286...
https://www.digitalmars.com/ctg/handle-pointers.html
There was also a VCM system that swapped code to/from disk in a manner that was very much like virtual paging.
So this means you could have multiple programs loaded at once: often done with TSRs (terminate and stay resident programs), but it also allowed things like shell windows in Lugaru Emacs (Epsilon) to exist. Languages like Turbo-C had system().
Also the OS was well decoupled from the application programs (it could be independently updated). This was not true for many of the other home computers of the time, but some pulled it off: all CP/M systems and TRS-80. I think the main exception to this was the video system- many programs made assumptions about the address of the screen buffer.
I remember a debugger that gave you dual screen on a 8086 by using the monochrome for text/debugging whilst the color screen was for the program.
You had developers using it as a power feature.
If I see the man page http://www.manmrk.net/tutorials/DOS/help/emm386.exe.htm the vram segments are not allowed for the FRAME= and Mx options, rang A000-BFFF is forbidden.
a.k.a. Intel, who also designed USB "Full Speed" vs "High Speed"
("Full Speed" was the maximum speed of USB 1.0, 12 Mb/s, which also had "Low Speed", 1.5 Mb/s which is used by keyboards and mice. "High Speed" was introduced in USB 2.0, and is 480 Mb/s)
Joke's aside, I have empathy for the pain of naming in protocols and systems that get extended and remain backwards compatible. Intel was the king at this.
Adjusting your bits. You crashed and they... shifted all outta whack. There.
My other pet peeve about Intel is, why the heck would they make a paragraph just 16 bytes ? Why not 256 ?
https://www.digitalmars.com/ctg/dos32.html
And supported the 286 DOS extender from Rational Systems.
An impressive suite was the stuff from QuarterDeck. Their DOS extender was called QDPMI, and used the QEMM memory manager.
Quarterdeck DESQview, built on QEMM, truly extended DOS by turning it into a kind of multi-tasking system, allowing users to be more productive.
It was known for its high application compatibility.
I used DJGPP in the early 1990's, and the GO32.EXE extender, which did the job.
That company produced a number of excellent DOS survival tools. QEMM memory manager was an absolute must to get games working.
But the rival 386Max is now FOSS, so if you are really really curious you could take it apart and study it.
https://github.com/sudleyplace/386MAX
Closest you will get for now, I fear.
I think I read that Symantec lost or erased all the Quarterdeck source code after the acquisition. :-(
Phar Lap was more ubiquitous throughout the 286 and 386 DOS days. Microsoft distributed a light version of it with their compiler for a while.
I'm still trying to find the first early extenders though from 1987/88 no leads though.
This is why the DOSemu project has been doing a multi-year rewrite: to create a new, full-VM-based DOSemu2 that can run DOS without emulation on x86-64 machines.
It was for an 80286 clone that had a 10MB HDD. His rational for buying this card was "I can make a big RAM drive out of it and run everything from memory"
I can't recall the price of the thing, but I want to say it ran in the thousands. Couldn't run most games on it because of copy protection so we never got to take advantage of it. In fact, I don't think the extra memory was usable at all in most software -- I recall we couldn't run a game on his machine due to having 512MB of onboard memory, but it had no issue in my ancient 8088 with 640K installed (in bizarre CGA colors).
16 colors, technically. But only four at a time, and three of those were selected from two preset palettes, both of which were hideous (one green/red/brown, one cyan/magenta/white).
I remember the palette choices in CGA were downright bizarre; they'd be 4 colors that you couldn't possibly use to make anything look right. At the price of the card and the display, you're like "wait ... that's it?"
[0] Ignoring all of the interesting things coming out of the 8088 demo scene, nothing that I'm aware of from the 80s was capable of anything close to that.
There was the Unreal Mode aka Flat mode. With few lines of assembly code, an memory allocation using HIMEM.SYS, it was possible to access all the memory: the segment limit is 4GB instead of 64KB in this "mode". Of course it was not compatible with Windows, so the unreal mode was more for fun than anything else.
- All these stuff was REimplemented on PC IBM's technology of overlays, created as marketing technology, to widen line of IBM mainframes, as top models have enough RAM to work with programs directly, but cheapest models have to use something like virtual memory and swap on magnetic drum, to use same software.
And sure, when IBM PC achieved wide adoption, people also sought, some things could be done on PC, what before done on mainframes or mini-computers, but much cheaper.
I exactly seen revolution in approx 1993-1994, when prices on RAM dropped and become possible to equip PC with 1M or even more.
Unfortunately I myself believed, to talks of older colleagues, that all these PC tricks are not serious, and IBM is strong and will return with something much more powerful :)
I even not imagined, about current 64-bit PCs and what opportunities they opened.
I didn't use Memmaker, or Quarterdeck Optimise or anything. I did it by hand. I got as much free base memory, with shorter more readable config files, and they were more maintainable.
When I received my first IBM PS/2 in 1989, I hardly knew any of this stuff. I didn't know any x86 assembly, I didn't know how DOS laid out memory or how the INT routines accessed devices. My computer overnight turned into a black box. I didn't program it in BASIC, I just loaded games and applications on it.
This sort of system opacity drove me rather crazy, and soon I was in college studying Unix and systems architecture again. I didn't waste any time deleting DOS/Windows and replacing it with Minix.