Broadly speaking, writing a real-mode OS is like writing a language runtime library for a protected mode OS. Writing a multitasking real-mode OS is like providing a user threads implementation in that runtime library.
SuperLeaf1995 wrote:
I need multitasking to run drivers in the background while my programs dances on ORG 0x100
No you don't. Unless you're writing a microkernel, a driver is more akin to a library in a userspace process than it is to a thread in a userspace process. They aren't tasks. Drivers are generally passive: they wait for something to happen (such as a program making a system call that causes the kernel to ask the driver to do something, or an interrupt from the device that the driver manages). Drivers generally aren't scheduled entities and, on multitasking systems, run on some other task's timeslice.
Quote:
[*]Possibly port the OS to other 8/16-bit plaftorms (C64 with A65?).
In this case, it might actually be better to put the system together for one of those other platforms and then port it to x86. This way you avoid the risk of accidentally writing something that depends on x86 segmentation and then having to kludge around that, or rewrite things entirely, when you port the OS.
Quote:
[*]A20 can give some extra memory.
Not much in real mode. You only add 1/16 of the total that you have available without it. And if you're wanting to be able to run on 8086s, you can't count on A20 even being there. The high-order address line on an 8086 is A19. A20 didn't even exist before the 286. Technically, the A20 mechanism doesn't even *give* you extra memory. Until you tell it to stop doing so, it forces A20 to zero to take away memory that you'd otherwise have on a 286 or better so that it can show software written for an 8086 what it expects to see: wraparound from the top to the bottom of the first megabyte (the only megabyte on an 8086), rather than the end of the first megabyte being followed by the beginning of the second. On non-PC x86 platforms (not that there are many), the A20 kludge doesn't exist: you'll always see all available memory.
And if you want to port your OS to stuff like the C64, you can't count on having more than 64k available anyway.