Show HN: A simple way to write standalone C programs for i386
github.com
github.com
https://git.qemu.org/?p=qemu.git;a=blob;f=pc-bios/optionrom/...
I've been wanting to try Hermitcore [1] for a while.
So it's not for i386, it's for XT by the sounds of it.
(this incompatibility bit me a bit many years ago when i was writing a small real mode OS in assembly - i used a bunch of instructions i thought were available in 8086 but when i tried the OS on a real XT machine it would lock up :-P)
[0] https://monotech.fwscart.com/NuXT_-_MicroATX_Turbo_XT_-_955M...
[1] https://monotech.fwscart.com/Nano_8088_-_Turbo_XT_SBC_Compac...
OWv2 is also available as a Linux binary so you could use it for crosscompiling in a similar way to GCC.
DOSBox can be easily installed on any system, you can save the entire C: in a git repo and it'll probably keep working in any number of years from now :)
Meanwhile, OWC doesn't have packages in popular Linux distros, only a custom binary installer, and on MacOS it doesn't even have that.
16 vs 32 bit It is possible to use 32-bit instructions in the real-address mode, they just need to be marked with address-size and operand-size prefixes. The -m16 option for clang/gcc, and .code16 directive in GNU assembler, do exactly that. The resulting code is 32-bit, only marked everywhere with those prefixes. It's not compatible with actual 16-bit CPUs.
"Unfortunately the 32-bit addresses still cannot exceed the boundary of the segment (65535), otherwise they'll trigger an exception. QEMU doesn't emulate this behaviour, so it's useful to occasionally test with Bochs."
Presumably it would work just fine in the "Unreal mode"[1] - one which is very similar to real, with the added benefit of being 32bit address space, and 32bit instructions by default
In this case the design goal was to show the easiest way to jump into C and start building the actual application, so I just tried to avoid any trickery (even enabling the A20 line)
;)
An actual Bill Gates quote