Cooperative multitasking and fourteen apps on one 1.44 MB floppy: real hardware as the only judge
There is a moment in every operating-system project where the thing stops being a demo and starts being a system, and for UnoDOS 3 on the x86 that moment has a build number. It is Build 137, February 13, and it is the commit where two programs ran at once.
This essay is about the five weeks that followed, February 13 to March 16, in which a cooperative scheduler and fourteen applications were squeezed onto a single 1.44 MB floppy, and about the machine that judged every one of those builds. Not QEMU. A 1994 HP Omnibook 600C with a 486DX4 and a DSTN screen, and, later, whatever the nearest laptop with a USB port happened to be. The pattern that emerges from the commit log is simple and a little humbling: the emulator said yes, over and over, and the hardware kept saying no, and the hardware was right.
Two programs at once
2d16dedb, February 13, 04:50: "Cooperative multitasking and overlapping window redraw (Build 137)." The body is two paragraphs, and the first one is the whole scheduler:
Build 136: Round-robin cooperative scheduler with context switching via app_yield (API 34), non-blocking app_start (API 35), task exit handler (API 36). Launcher stays running while user apps execute concurrently.
That is the entire design. There is no timer interrupt pre-empting anything. An app calls app_yield and the kernel swaps stacks to the next task; if an app never yields, nothing else runs. The next day, 099e00f1 ("Multi-app concurrent execution: 6 user app segments (Build 149)") gave it a pool: "Add dynamic segment pool (0x3000-0x8000) so up to 6 apps can run simultaneously." Each app gets a 64 KB real-mode segment and the launcher keeps its own. Seven tasks, total, in 640 KB.
It took three more days and three separate commits to get the context switch right, and the sequence is worth reading because each fix created the next bug. 9f8ed1bc (Build 197, February 16): the Music app "played one constant note" because app_yield_stub did not save/restore general-purpose registers during context switches. When the music app kept note duration in CX and yielded, the scheduler switched to the launcher which clobbered CX." Fix: pusha/popa around the switch. Fifteen minutes later, 22748131 (Build 198): "Build 197 added pusha/popa to app_yield_stub for register preservation across context switches, but app_start_stub's initial stack frame didn't include the 8-word pusha frame. When the scheduler first switched to a new task, popa consumed the return addresses and crashed." Thirty minutes after that, 93641381` (Build 201), whose title is the one I remember: "Fix broken initial context switch — launcher never ran." The launcher's own first entry "still did bare 'ret' without 'popa' first," so the machine jumped "to 0x1000:0000 (kernel entry) in an infinite loop: boot → draw version → load launcher → ret to kernel → repeat."
Three commits, one hour, one invariant: every path that enters a task must agree with every path that leaves one about what is on the stack. It is the same class of bug the FAT12 essay showed, and it is the last time I will point at it, because from here the interesting failures stop being arithmetic and start being physics.
What the floppy carried
By 64ec9504 (March 16, "Add Pac-Man game (Build 398)"), the 1.44 MB image in the repo held fourteen binaries: the launcher, SysInfo, Clock, the file Browser, a mouse test, Music, MkBoot, Settings, Dostris in CGA and in VGA, Notepad, OutLast in CGA and in VGA, and Pac-Man. I counted them by reading the FAT12 root directory of the committed image; the README of the same day agrees: "The entire OS, including a 45KB kernel with 105 system calls, a window manager, two filesystems, cooperative multitasking, and 14 applications, fits on a single 1.44MB floppy disk." The biggest of them, Pac-Man, is 6,102 bytes. The kernel was 45,056.
The plan for this essay had "19 apps" in the title. Nineteen is the number of app source files in the x86 tree at v3.34.0, and three of those never ship on the floppy. Fourteen is what the disk held in March. I would rather under-claim by five than have the count be the thing a reader checks first.
The judge
UnoDOS had been booting on the Omnibook since January. 3b7aa151 (January 22) moved the clock and a text demo "within confirmed visible area on HP Omnibook 600C"; b5967ff2 the same morning slowed the animations down so they "Should be visible on slow DSTN displays with ghosting." QEMU does not have overscan and its display does not ghost. Those are the first two things the hardware taught the project, and neither is a bug in the OS.
The ones that matter start in February, when the boot chain grew a hard disk path and a USB path, and every one of them was green in the emulator.
Build 153, 5faa6b74, February 14: "Add floppy read retry logic for reliable loading on real hardware." A real floppy drive returns transient errors. QEMU's never does. The fix is a shared helper "with 3-attempt retry and drive reset between failures" applied to every FAT12 read path.
Builds 162 through 170, February 14 and 15, the USB-boot SMI sequence. Booting from a USB stick on a modern BIOS means the BIOS emulates a floppy or disk, and it also emulates a PS/2 keyboard controller for any software that talks to port 0x60 and 0x64, using System Management Mode to intercept the I/O. The emulator does not do this. 135bef2a (Build 163) found that "each I/O port read to the 8042 status register triggers a BIOS SMI (~50-100us)," so the mouse init's 65,536-iteration timeouts "took 30-60 seconds appearing as a hang." Four builds later the agent had stopped shortening timeouts, because e7afa83d (Build 167) had established something timeouts cannot fix: "Even a single in al, 0x64 hangs forever on the test hardware — the BIOS SMI handler triggered by port 0x64 access deadlocks. No amount of timeout reduction helps when the instruction itself never returns." And f56825a4 (Build 170): "Root cause found: our INT 9 handler reads port 0x60 directly, which triggers a BIOS SMI deadlock on USB-booted systems. USB legacy keyboard emulation only allows the BIOS's own INT 9 handler to access port 0x60." The fix was to stop pretending: on any boot drive numbered 0x80 or higher, the kernel installs no keyboard handler and polls the BIOS instead.
Along the way, d106cb15 (Build 164) did the best engineering in the stretch: "before any KBC I/O, probe the BIOS timer tick at 0040:006C. If it doesn't advance after a brief busy-wait, skip ALL mouse initialization (no I/O whatsoever)." Rather than guess which machines are hostile, ask the machine whether time is passing.
Build 179, 66af7205: the disk address packet moved "from stack/kernel segment to fixed low-memory address 0x0000:0x0600. USB BIOSes require the DAP to be below 64KB linear." Found by the boot failing, not by reading.
Builds 228 and 229, February 17, back on the Omnibook, now booting from a PCMCIA CompactFlash card. 594308a9: "Root cause: MBR used [ORG 0x7C00] so all data/code lived at 0x7C00. When VBR was loaded to 0x7C00, it overwrote boot_drive, error strings, and the halt loop, causing unpredictable behavior (reboot loop showing endless 'M' on Omnibook 600C)." Every MBR in the world relocates itself before loading the volume boot record; this one had not, and QEMU's BIOS happened to tolerate it. Then 5db5c6ef, twenty-eight minutes later: "stack-built DAP caused AH=42h to return success with garbage data on Omnibook 600C, so root directory search never found KERNEL.BIN despite the file being present in the image." Read that once more. The BIOS call returned success. The data was garbage. No emulator models a firmware that lies to you politely.
Build 283, e074c768, February 20, a USB flash drive on a newer machine: "On USB flash drives, the INT 10h mode switch between the two mounts disrupts BIOS USB disk emulation state, causing the second mount to fail." Setting a video mode broke the disk. You do not reason your way to that from a manual; you learn it by watching a boot stop.
And the inverse case, which keeps the story honest. cdb66c9c, March 3, "Add QEMU TCG workaround for Settings app freeze (Build 393)": "The QEMU TCG translation cache produces incorrect code for the cooperative scheduler context-switch path when int_80_handler falls at certain code offsets… Not a real hardware bug — only affects QEMU's TCG code generator." I do not know whether that diagnosis is right. I do know that a freeze in the emulator that does not reproduce on metal is the one kind of bug this method lets you route around. The same day's 0e552301 (Build 392) fixed a real one in the scheduler, a round-robin scan that "wraps around and finds the calling task before other running tasks, starving them of CPU time." That one showed on both.
The three days the hardware would not say why
I want to include a failure, because the series is not honest without them, and this one ran from February 24 to February 27.
Apps began freezing on the test machine after a window opened. The agent bisected the way you would bisect a compiler: 2f5b66e4 (Build 320) rebuilt the previous known-good from clean, to test "whether the crash is pre-existing or caused by diag changes"; 1a556a12 (Build 323) drew letters A through O on screen, one per API call, so "Last visible letter before crash shows where it failed"; 01b5a9c7 (Build 326) shipped "Identical code to working Build 322" padded with NOPs "to 600 bytes to force 2 FAT12 clusters." Then it went down into the hardware: PIC masks OR-accumulated across a 50,000-iteration loop (fd6fcf33, Build 346), an INT 9 hook counting IRQ1 fires (5187f548, Build 347), and by 7dd2bd9c (Build 348) a sharp statement of what was known: "Build 347: I9=0 (IRQ1 never fires), timer works, PIC fine. Keyboard IRQ1 specifically dead despite being unmasked."
Then 0c2b3857 (Build 350, February 27): "Rewrite sysinfo as proper system info app… standard APIs only… No direct port I/O." The diagnostics are deleted in that commit and the root cause is never named; the TODO and CLAUDE.md of that week do not mention it, and work moved on to resizable windows the next day. Either the rewrite sidestepped the condition or the machine stopped showing it; the log does not say which, and I will not pretend to know. Thirty builds of instrumentation, each a good experiment, and no verdict. Hardware does that.
The Chromebook
The other half of the arc's title is literal. On February 20 the agent wrote tools/write.sh (8247b5c4), a Linux port of the Windows image writer. The next machine to run it was a Chromebook, under Crostini, and three commits in the next four hours are the Chromebook explaining bash to the agent. 1192b171: "(( VAR++ )) when VAR=0 evaluates to 0, which returns exit code 1 in bash. Combined with set -euo pipefail, this kills the script immediately after the TUI launches." e26baeae: grep -oP becomes grep -oE "for portability on minimal Linux installs." 07a2c958: "Crostini USB passthrough fails with bs=512K ("No space left on device" on first write). bs=4K works reliably." None of that is operating-system work. All of it is the same lesson one layer up: the script was correct on the machine it was written on, and the machine it was for was not that machine.
The guide that eventually documented all of this, docs/RUN-X86-REAL-HARDWARE.md, was not written until June 16 (f59e7249). It lists four ways to boot the floppy image and ranks them: a Gotek floppy emulator "is the most reliable real-hardware path today"; USB boot carries the caveat February earned, that UEFI-only machines "won't boot a real-mode floppy"; QEMU is option D, "to reproduce the verification, no hardware needed." That ordering is the February experience written down.
The lesson
Every bug in this essay except one was invisible in QEMU. Floppy read errors, SMI deadlocks on port 0x64, a disk address packet that has to live below 64 KB, an MBR that never relocated, a firmware that returned success with garbage, a video mode switch that broke the USB disk, a keyboard interrupt that stopped firing for reasons nobody found. An agent with a green emulator run for each of these would have, quite reasonably, moved on. An emulator can tell you your code is wrong; only the real target can tell you it is right. The emulator finds the bugs you can describe. The hardware is the only judge of the ones you cannot, and its rulings come without reasons.
The transferable version is about what you let count as evidence. Later in this project that became a rule with a name, "emulator verified" and "runs on the real machine" recorded as different claims for every platform, but it was earned here, on a 486 laptop and a Chromebook, long before anyone wrote it down. Then, in March, the commits stop for three months, and the next essay is about what the agent found when it came back and audited its own work.
Sources: https://github.com/hmofet/unodos, commits 2d16dedb, 099e00f1, 9f8ed1bc, 22748131, 93641381 (February 13-16); 5faa6b74, 135bef2a, d106cb15, e7afa83d, f56825a4, 66af7205 (February 14-15); 594308a9, 5db5c6ef (February 17); 8247b5c4, 45f747d4, e074c768, 1192b171, e26baeae, 07a2c958 (February 20-21); 2f5b66e4, 1a556a12, 01b5a9c7, fd6fcf33, 5187f548, 7dd2bd9c, 0c2b3857 (February 24-27); 0e552301, cdb66c9c (March 3); 64ec9504 and the README of the same commit (March 16); 3b7aa151, b5967ff2 (January 22); f59e7249 and docs/RUN-X86-REAL-HARDWARE.md; CHANGELOG.md sections 3.1.3 through 3.19.0; the FAT12 root directory of build/unodos-144.img at 64ec9504 and at 82a7fe90.