@gimulnautti nice work!
I looked over my holidays how people target retro / old-school stuff, or at least majority of people, to MS-DOS. It was across the board OpenWatcom or even Turbo-C.
So I quickly put together a build pipeline, with custom linker scripts defining binary layout and no crt0 linked to the final binary. So now I can build .COM files with the code written in latest GCC or clang (LLVM) :-)
I've written the currently used arch x86 code in Linux that trampolines to real-mode and back when going into and away of suspend in 2012, so with those learnings of doing this type of custom binaries I also wrote shenanigans to access full 4 gigabytes of flat address space.
And just to refresh a bit I wrote a bit code that initializes so called "Mode-X" i.e. 320x240 planar squarepixel mode. I was able to run my stuff in 86box, which felt good ;-) I loose the C standard libraries as payback I have like the 2024 level development environment.
Might put it fully protected mode later on but BIOS access is nice for now. Protected mode is better than real-mode for performance, especially for data heavy real-time stuff like DSP and texture mapping because 32-bit memory accesses in tweaked unreal mode add a prefix to the opcode, which consumes icache ;-)
Not sure what I'm doing with this yet, probably just add random stuff to it without a plan. Also, MZ EXE bin generation is a target that I pursue.