I'm resurrecting a project of a very simple 16bit/realmode OS that I had been running by writing and rebooting a USB flashdrive every time. I want to do development by running in a virtual machine from now on - no more writing and rebooting every time. It does not enter protected mode, and all display is via text mode memory at segment 0xb800. The finished product would likely be installed on and run from a USB flashdrive. It needs to be able run on a modern PC processor.
I am using Ubuntu 18.04 and doing development with command line. I have no experience with VM software though I hear that QEMU might be suited to my project. I suspect some VM software is intended for more sophisticated projects and not easily adaptable to this. Can someone here recommend VM software for this project. Either command line or GUI is good. TIA Bill S.
recommend virtual machine for 16-bit real mode OS developmen
Re: recommend virtual machine for 16-bit real mode OS develo
I would recommend you that you started writing a CPU emulator in real mode during a whole year, with which to emulate the BIOS and log the sequence of ports and known memory addresses (specially those that are 32-bit reads or writes) for example when calling the video BIOS so that you can derive a simple native driver for all CGA/EGA/VGA and VESA Super VGA of your current video card.
You can see my simple emulator at the directory called emu86 in my kernel here: https://sourceforge.net/projects/lowest ... t/download
Also see my more complete JavaScript emulator with around 98% complete emulation of the 8086/8088 CPU (with boilerplate code ready to add which instructions to log, like IN, OUT, MOV): https://sourceforge.net/projects/z86emu ... t/download
The latest Bochs is perfect. You can easily mount its flat hard disk images and write to them normally with OSFMount.
If you follow these instructions, or if you automate enabling/disabling the graphics driver, you have MS-DOS graphics in 32-bit Windows 7: viewtopic.php?t=35245
Then, you have DPMI, disk access, emulated Sound Blaster, long file names, access to some other basic ports, NTFS and FAT drivers, indirect files to control Windows network, API, processes...
Since it's real mode, you could call those services, write a CPU emulator, and then replace with real function when you need to reboot in reality.
You can write a complete OS with GUI if you emulate those things that Windows NT doesn't let you access. If it isn't GUI, or if you do initialization, you could press the Ignore button, investigate how to detect if we need emulation of protected resources or not.
Windows NT and 9x lets a program check the value of CR0 so if you check bit 0 you know that you need to emulate most hardware if the PE bit is 1 (Protection Enabled), meaning that you are running under Windows or probably with DPMI or similar protected mode driver loaded.
You can alter the real mode IDT too.
Once you have written most application code and understand how to emulate the KBC, timer, PIC, CPU, VGA, you can boot in a real machine.
But in the meantime you can write a full real-mode OS under Windows 7 32-bit. If you need disk access, you can open a disk image.
DOSBox can also give you almost the same real mode resources than Windows 7.
You can see my simple emulator at the directory called emu86 in my kernel here: https://sourceforge.net/projects/lowest ... t/download
Also see my more complete JavaScript emulator with around 98% complete emulation of the 8086/8088 CPU (with boilerplate code ready to add which instructions to log, like IN, OUT, MOV): https://sourceforge.net/projects/z86emu ... t/download
The latest Bochs is perfect. You can easily mount its flat hard disk images and write to them normally with OSFMount.
If you follow these instructions, or if you automate enabling/disabling the graphics driver, you have MS-DOS graphics in 32-bit Windows 7: viewtopic.php?t=35245
Then, you have DPMI, disk access, emulated Sound Blaster, long file names, access to some other basic ports, NTFS and FAT drivers, indirect files to control Windows network, API, processes...
Since it's real mode, you could call those services, write a CPU emulator, and then replace with real function when you need to reboot in reality.
You can write a complete OS with GUI if you emulate those things that Windows NT doesn't let you access. If it isn't GUI, or if you do initialization, you could press the Ignore button, investigate how to detect if we need emulation of protected resources or not.
Windows NT and 9x lets a program check the value of CR0 so if you check bit 0 you know that you need to emulate most hardware if the PE bit is 1 (Protection Enabled), meaning that you are running under Windows or probably with DPMI or similar protected mode driver loaded.
You can alter the real mode IDT too.
Once you have written most application code and understand how to emulate the KBC, timer, PIC, CPU, VGA, you can boot in a real machine.
But in the meantime you can write a full real-mode OS under Windows 7 32-bit. If you need disk access, you can open a disk image.
DOSBox can also give you almost the same real mode resources than Windows 7.
Last edited by ~ on Mon Oct 28, 2019 4:49 pm, edited 2 times in total.
YouTube:
http://youtube.com/@AltComp126
My x86 emulator/kernel project and software tools/documentation:
http://master.dl.sourceforge.net/projec ... ip?viasf=1
http://youtube.com/@AltComp126
My x86 emulator/kernel project and software tools/documentation:
http://master.dl.sourceforge.net/projec ... ip?viasf=1
Re: recommend virtual machine for 16-bit real mode OS develo
If your OS is designed to run on any hardware then any VM will do. The fact that they are designed for more sophisticated applications doesn't make them any less suitable for yours.
Personally, I would use qemu for it's easy ability to allow source-code debugging when used in conjunction with gdb.
Personally, I would use qemu for it's easy ability to allow source-code debugging when used in conjunction with gdb.