3 ms·
Funny, I've been reviving an OS I wrote in the 90's as well as the graphics package, window manager and a couple of demo apps that I wrote to go with it. It's b
by jacquesm 1y ago
Funny, I've been reviving an OS I wrote in the 90's as well as the graphics package, window manager and a couple of demo apps that I wrote to go with it. It's been a long and arduous trip down memory lane but after a couple of weeks of work I have it working under Qemu or Virtualbox. The thing that still befuddles me is how to get the COM ports to work, for some reason they really don't emulate those well in either one of those.
Yesterday evening I finally got VGA modes 16 and 18 working, so now I have 640x350 and 640x480 graphics. Major milestone, and lots of fun to get it working this far. The last time it ran was 26/Jan/1994 so it's been mothballed since then and the old hardware is long gone.
As for how it is done: you use the BIOS to switch modes, then you have some basic info about the memory map of the video mode and usually a page register where you can set which part of the memory on the graphics card is exposed in a window starting at A000:0000. Later graphics modes, such as VESA based modes used a slightly different mode switch and tended to have the option to address all of the RAM in a contiguous stretch doing away with the bankswitching, which greatly improved low level performance.
All of the graphics primitives were in software, no HW acceleration at all.
- toast0 1y ago> The thing that still befuddles me is how to get the COM ports to work, for some reason they really don't emulate those well in either one of those. What are you having trouble with for COM ports? Checking status (port + 5) and interrupt identification (port + 2) might help if you're missing interrupts?
- jacquesm 1y agoIt goes further than that: it doesn't work at all. I know quite well how to deal with hardware com ports (I've built firmware for port concentrators), it's just that the emulations do not expose working endpoints and that makes it really hard to get this going. Qemu and Virtualbox both supply similar mechanisms that should expose the com port but I've yet to be able to input or output a single byte through an emulated com port on either. What I'll probably end up doing is first to get a hardware pass through to work and once that is reliable to move back to emulated hardware to see if there are any differences. It's funny, I expected this to be one of the easier devices but so far it has not yielded at all.
- toast0 1y agoHmmmm. I can attest to qemu com ports working for my hobby OS, which does work on hardware com ports as well. For qemu, I use the com port as the primary console. But, I just assume there's a comport at 0x3f8, I don't do detection. I don't remember if I got virtualbox com ports to work, I had a lot of trouble with virtualbox and decided it wasn't on my support list. This is output only, but if you don't have a better way to test if qemu comport works, you can run my kernel with wget https://crazierl.org/crazierl.elf qemu-system-i386 -display none -serial mon:stdio -kernel crazierl.elf You should get a bunch of useless debug output, but it came through the com1. If that's helpful, the relevant code is more or less here https://github.com/russor/crazierl/blob/4e41bfa5c5bbae078a57afa00386e7f59c9fda23/kernel_src/kernel.c#L299 https://github.com/russor/crazierl/blob/4e41bfa5c5bbae078a57... (init starts here, writing characters a smidge later on line 324)
- jacquesm 1y agoThank you, this will definitely help. I suspect that control line emulation is what is causing the problems. Detection seems to work just fine.