os8088 1.0

The graphical operating system that could have been for the IBM XT

A Macintosh System 1-style desktop for the Intel 8086, written entirely in real-mode assembly and booted from a floppy. Overlapping windows, pull-down menus, a serial mouse, loadable programs -- and pre-emptive multitasking, which the real 1984 Macintosh never had.

640x480 · 16 colors · 256K RAM · 14,376-byte kernel · 12 tasks · 18.2Hz pre-emption

os8088
The os8088 desktop: a menu bar across the top, a Note Pad window with typed text, a Clock reading 00:02:00, a Bounce window, the Control Panel showing a pre-emptive/cooperative choice, and the Task Manager with a CPU history graph -- five programs running at once, with a tile for each in the dock along the bottom.
Five programs at once, on a CPU from 1978. A Note Pad, a ticking Clock, a bouncing ball, the Control Panel and the Task Manager, each a separate instance with its own dock tile. The Task Manager reports the machine at 80% busy and 39K of RAM in use.

What it is

os8088 boots from the first sector of a floppy into a graphical desktop. There is no DOS underneath it and no command line anywhere in it -- the 512-byte boot sector loads a 14KB kernel, the kernel switches the VGA into 640x480, borrows the video card's own 8x8 character set, and puts up a menu bar.

Everything after that is the interface you remember from a 1984 Macintosh: windows you drag by the title bar with a rubber-band outline, menus you pull down and drag through, a close box and a minimize box, icons for each floppy drive, and a dock along the bottom with one tile per running program. Programs load from a second floppy and run as first-class applications, several at a time.

The whole thing fits in 256K of RAM on an Intel 8086 or 8088 -- the processor in the original IBM PC and PC/XT. It is a hobby project, it is finished enough to use, and the source is 11,239 lines of NASM you can read in an afternoon.

By the numbers

Every figure below comes from the build, not from memory.

Verified specifications of os8088
Kernel size14,376 bytesThe scheduler, window manager, VGA driver, mouse driver, file manager, loader, Task Manager and Control Panel, all of it.
Boot sector512 bytesLBA-to-CHS translation and retrying BIOS floppy reads. The build fails if it assembles to anything else.
RAM footprint38,977 bytesCode plus every statically reserved buffer. It must stay under 0xA000, where loaded programs begin -- currently 1,983 bytes of headroom.
Lines of assembly11,239Hand-written real-mode 8086. No C, no linker, no runtime library.
Display640 x 480, 16 colorsVGA mode 12h -- four 1-bit planes, 80 bytes per scanline, drawn straight to the framebuffer.
Back buffernoneAn off-screen copy of the screen is 153,600 bytes, more than half the machine's memory. The 1984 Macintosh drew directly too.
Tasks12 slots, 1,536-byte stacksEach Clock and each Bounce window is its own pre-empted task.
Context switch rate18.2065 HzThe PC's stock timer rate. Every tick the handler saves nine registers, swaps the stack pointer and returns into a different program.
Loadable programs20,480-byte poolRelocatable packages loaded from a second floppy, several resident at once, each freeing its memory when closed.
Mouse1200 baud, 7N1A Microsoft serial mouse on COM1, three bytes per report, decoded in an interrupt handler that also draws the cursor.
Target hardwareIBM PC/XT, 8088 at 4.77MHz256K of RAM, an 8-bit ISA VGA card and a serial mouse. Repaints are slow enough to watch happen.
Instruction set8086 only, enforcedcpu 8086 plus -w+error, so anything newer is a build failure. A 1978 instruction set, mechanically guaranteed.

What it does

Four of the things it is actually good at. There are more on the screenshots page.

Pre-emptive multitasking
Two Clock windows counting up and two Bounce windows with squares moving around inside them, all animating at the same time.
Nothing has to cooperate. Two clocks keep time and two balls keep moving while you type into something else. The timer interrupt fires 18.2 times a second, saves whichever task was running, swaps the stack pointer and returns into the next one -- about thirty instructions. The Macintosh of the period could not do this at all: System 1 ran one application at a time, and when MultiFinder arrived in 1987 it was cooperative.
Rubber-band dragging
A Note Pad window staying still while a one-pixel rectangular outline is dragged across the desktop, then the window jumping to the outline's position.
The window does not move until you let go. A one-pixel XOR outline follows the pointer and the window snaps to it on release -- because redrawing a whole window on every mouse report was out of the question at 4.77MHz, exactly as it was in 1984.
Loadable software
The Disk file manager listing MINES and HELLO, with a Minesweeper window open on top showing a partly revealed 9 by 9 grid with colored numbers and red flags.
Programs come off a second floppy. Double-click a file in the Disk window and it loads, relocates and runs as a real application. Minesweeper is 1,593 bytes including its icon. Several packages -- or several copies of one -- can be resident at the same time.
Task Manager
The Task Manager window showing a CPU percentage, a history graph swept across its full width, a RAM bar reading 39K of 639K, and a list of running instances with their state and CPU share.
It watches itself. A live CPU meter with a scrolling history graph, a RAM readout, and one row per running program. Apps without their own task get their window callbacks timed at the dispatch site and billed to them, so the rows still add up to one total.

All the screenshots

The history it is arguing with

In February 1985 Digital Research shipped GEM 1.0 for the IBM PC: a Macintosh-style desktop with overlapping windows and icons, running on stock XT hardware. Apple sued. The settlement led to GEM Desktop 2.0 in 1986, which removed overlapping windows and desktop icons on the PC -- while the Atari ST version, not covered by the agreement, kept them.

So the PC did briefly have this, and then it did not. os8088 is a rebuild of roughly that idea, from scratch, forty years later, on the same class of machine -- plus the pre-emptive multitasking that neither GEM nor the Macintosh of the period offered.

What it is not

  • It is not DOS and it does not run DOS programs. There is no DOS underneath it; it owns the machine from the boot sector up.
  • It has no memory protection. The 8086 has none to offer -- every program shares one 64K segment with the kernel, which is precisely what makes a context switch cheap enough to be worth doing.
  • There is no file writing. os88fs is read-only; the Note Pad's text lives in RAM and dies with the window.
  • There is no networking, no sound, and no hard disk support.
  • It is a hobby project, not a product. It is also complete enough that you can sit down and use it, which is the whole point.

Try it

The browser demo boots the real floppy image in an emulated PC -- same bytes you would write to a disk. If you would rather run it yourself, the download page has 360K images for period hardware and 86Box, and 1.44MB images for QEMU.