Os8088: A powerful Mac-like OS for the IBM XT, 286, 386

jggonz1 pts1 comments

os8088 -- a Mac-style GUI OS for the IBM PC XT

Skip to content

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<br>real-mode assembly and booted from a floppy. Overlapping windows, pull-down menus, a serial<br>mouse, loadable programs -- and pre-emptive multitasking, which the real 1984 Macintosh<br>never had.

pixels640x480

colors16

of RAM256K

byte kernel52,718

task slots12

pre-emption18.2Hz

Boot it in your browser<br>Download the floppies<br>Screenshots

os8088

Five programs at once, on a CPU from 1978.<br>A Note Pad loaded off the software floppy, a ticking Clock, a bouncing ball, the Control<br>Panel and the Task Manager, each a separate instance with its own dock tile. The Task<br>Manager reports the machine at 70% busy and 147K of RAM in use.

What it is

os8088 boots from the first sector of a floppy into a graphical desktop. There is no DOS<br>underneath it and no command line anywhere in it -- the 512-byte boot sector loads a<br>40KB kernel, the kernel works out which display adapter the machine has and switches it<br>into graphics, 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<br>drag by the title bar with a rubber-band outline, menus you pull down and drag through,<br>a close box and a minimize box, icons for each floppy drive, and a dock along the bottom<br>with one tile per running program. Programs load from a second floppy and run as<br>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<br>original IBM PC and PC/XT. It is a hobby project, it is finished enough to use, and the<br>source is 66,183 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 size52,718 bytesThe scheduler, window manager, VGA driver, mouse driver, sound layer, file manager, loader, Task Manager and Control Panel, all of it.<br>Boot sector512 bytesLBA-to-CHS translation and retrying BIOS floppy reads. The build fails if it assembles to anything else.<br>Segment footprint59,031 bytesCode plus every buffer the kernel reaches through DS. It must fit the 64K segment -- currently 6,505 bytes of headroom. The task stacks, the disk buffers and every loaded program live outside the segment and are not counted here.<br>Lines of assembly66,183Hand-written real-mode 8086. No C, no linker, no runtime library.<br>DisplayVGA, Hercules or CGAProbed at boot. VGA mode 12h is 640x480 in 16 colors -- four 1-bit planes, 80 bytes per scanline; Hercules is 720x348 and CGA 640x200, both monochrome and banked. Drawn straight to the framebuffer on all three.<br>Back bufferoptional, off by defaultAn off-screen copy of the screen is 153,600 bytes, more than half the machine's memory, so a 256K machine always draws straight to the display, as the 1984 Macintosh did. At 500K or more the Control Panel can switch one on.<br>Tasks12 slots, 1,536-byte stacksEach Clock and each Bounce window is its own pre-empted task.<br>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.<br>Loadable programsa segment eachPackages loaded from a second floppy into their own regions of conventional memory -- about 107K of arena on a 512K machine, 233K at 640K -- several resident at once, each freeing its memory when closed.<br>Mouse1200 baud, 7N1A Microsoft serial mouse on COM1, three bytes per report, decoded in an interrupt handler that also draws the cursor.<br>Target hardwareIBM PC/XT, 8088 at 4.77MHz256K of RAM, a serial mouse, and any of a VGA, Hercules or CGA card. Repaints are slow enough to watch happen.<br>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

Nothing has to cooperate.<br>Two clocks keep time and two balls keep moving while you type into something else. The<br>timer interrupt fires 18.2 times a second, saves whichever task was running, swaps the<br>stack pointer and returns into the next one -- about thirty instructions. The Macintosh<br>of the period could not do this at all: System 1 ran one application at a time, and when<br>MultiFinder arrived in 1987 it was cooperative.

Rubber-band dragging

The window does not move until you let go.<br>A one-pixel XOR outline follows the pointer and the window snaps to it on release --<br>because redrawing a whole window on every mouse report was out of the question at<br>4.77MHz, exactly as it was in 1984.

Loadable software

Programs come off a second floppy.<br>Double-click a file in the Disk window and it loads into a segment of its own and runs as<br>a real application. Minesweeper...

from floppy task os8088 window macintosh

Related Articles