Yeah... I know my use of Google will hurt most of you... try to not too much 
overreact please.

Me to Google:
In fact, the real question for me is is it worth to continue my project to run 
HAC ADA compiler for FreeDOS. My current version take sometime 30 mins to run 
Hello World on QEMU KVM, while taking 5 seconds in VirtualBOX. I like the 
small, virtual machine code I think I could understand on HAC. Thinking to had 
Allegro lib access.

In 2026, continuing your project to run the
HAC (Hacker's Ada Compiler) on FreeDOS is a niche but technically sound 
endeavor, particularly if you value understanding the underlying virtual 
machine architecture.

Addressing Performance (QEMU vs. VirtualBox)
The performance gap you are seeing (30 minutes vs. 5 seconds) is likely due to 
how the hypervisors handle 16-bit real-mode code.

VirtualBox is optimized for end-user desktop virtualization and legacy guest 
operating systems like DOS. Its "VT-x" or "AMD-V" implementations often handle 
the transition between protected and real mode more efficiently for DOS guests. 
QEMU with KVM is primarily designed for modern 64-bit server workloads. KVM 
often struggles with VM exits caused by 16-bit instructions or frequent 
hardware interrupts common in DOS, which can lead to the extreme slowdowns you 
experienced.

Solution: If you must use QEMU, ensure you are using -machine type=isapc and 
check if -accel tcg (pure emulation) actually performs better than KVM for this 
specific real-mode task, as KVM isn't always optimized for 16-bit instruction 
sets. 

Is HAC Worth It?

    Educational Value: HAC is a "Hello-world Ada Compiler" designed to be 
small, quick, and fully programmed in Ada itself. Because it compiles to a 
custom bytecode executed by a small virtual machine, it is an excellent "Swiss 
knife" for learning how compilers and VMs interact.
    Simplicity: Unlike the heavy GNAT compiler, HAC's "compilation leaves zero 
files" (it can do everything in memory) and targets a subset of Ada, making it 
manageable for a single developer to port or extend on FreeDOS. 

Allegro Library Integration
    The Compatibility Gap: Modern Allegro 5 does not support DOS. You would 
need to target Allegro 4.2, which was the last version with native DOS support.
    The Binding Challenge: Since HAC compiles to its own VM bytecode rather 
than native machine code, you cannot simply "link" the Allegro C library. You 
would need to:
        Write "primitive" hooks in the HAC VM (the part written in C or Pascal 
that runs on FreeDOS).
        Expose these hooks to the HAC Ada environment so your Ada code can call 
Draw_Sprite or Install_Keyboard.
    Feasibility: This is very feasible because the HAC VM is designed to be 
"hacker-friendly" and extensible. 

Verdict: If your goal is a lightweight, transparent system where you can see 
every moving part, continue the project. Use VirtualBox for development to save 
time, and focus on extending the HAC VM to support Allegro primitives for 
graphics.


_______________________________________________
Freedos-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to