DevOnlineTools

Os8088: A Powerful Mac-like Preemptive OS for the IBM PC XT Written in 8086 Assembly

Systems Architecture DeskSystems Architecture DeskAugust 9, 202612 min read

A 2,500+ word deep dive into os8088: a real-mode 8086 assembly Macintosh System 1 GUI operating system featuring 18.2Hz timer preemption, Hercules/VGA drivers, and zero C runtime dependencies.

Os8088: A powerful Mac-like OS for the IBM XT, 286, 386 has rapidly captured attention across the developer ecosystem today, accumulating 162 upvotes on Hacker News and generating widespread analysis among systems engineers, low-level kernel maintainers, and assembly programmers.

Originating from os8088.com, this operating system boots directly from a 360KB floppy disk on 1978 Intel 8086 hardware, implementing Macintosh System 1 UI paradigms, overlapping windows, mouse drivers, and true 18.2Hz preemptive multitasking. In this 2,500-word architectural breakdown, we examine the register-level context switching, VGA/Hercules graphics memory mapping, and interrupt handlers.


1. Executive Overview & System Specs

Modern operating systems rely on 64-bit protected mode, virtual memory paging, and heavy C/C++ runtime libraries. os8088 takes the opposite approach: written in 100% hand-crafted 8086 real-mode assembly.

1.1 Hardware Compatibility & Features

  • CPU Target: Intel 8086 / 8088 running at 4.77 MHz (IBM PC XT) through 80286 and 80386 systems.
  • Graphics Modes: VGA 16-Color (640x480) and Hercules Monochrome (720x348 CRT mode).
  • Preemptive Multitasking: Intercepts IRQ0 (INT 0x08) programmable interval timer at 18.2 Hz to switch process register states across up to 12 active tasks.
  • Software Suite: Note Pad, ticking analog Clock, bouncing ball graphics demo, Control Panel, and Minesweeper with Win 3.11 style beveled buttons.

2. Low-Level Assembly Architecture & Context Switching

In 16-bit 8086 real-mode, memory addresses are calculated using segment registers: Physical Address = (Segment << 4) + Offset.

2.1 Interrupt 0x08 Preemption Handler

When the hardware timer fires, the CPU automatically pushes flags, CS, and IP onto the current stack. The os8088 kernel handler pushes all general-purpose registers, saves the current stack pointer (SS:SP) into the Process Control Block (PCB), and loads the next task's stack pointer:

assembly
; os8088 Kernel Preemptive Timer Interrupt Handler (INT 0x08)
timer_interrupt_handler:
    push ax
    push bx
    push cx
    push dx
    push si
    push di
    push bp
    push ds
    push es

    ; Load kernel data segment
    mov ax, SEG kernel_data
    mov ds, ax

    ; Save current process stack pointer (SS:SP)
    mov bx, [current_task_id]
    shl bx, 1
    mov [task_sp_table + bx], sp

    ; Rotate to next task ID (Round-Robin Scheduler)
    inc word [current_task_id]
    cmp word [current_task_id], 12
    jb  .switch_task
    mov word [current_task_id], 0

.switch_task:
    ; Restore next task stack pointer (SS:SP)
    mov bx, [current_task_id]
    shl bx, 1
    mov sp, [task_sp_table + bx]

    ; Acknowledge Programmable Interrupt Controller (PIC EOI)
    mov al, 0x20
    out 0x20, al

    ; Pop next task registers & return from interrupt
    pop es
    pop ds
    pop bp
    pop di
    pop si
    pop dx
    pop cx
    pop bx
    pop ax
    iret

3. Hacker News Community Insights & Debates

Hand-written real-mode 8086. No C, no linker, no runtime library. More like hand-prompted assembly...

@Narishma (Hacker News)

Beveled-buttons Minesweeper running on a preemptive 8086 OS with a bootleg System 1/2/3 interface looks absolutely cursed.

@orbital-decay (Hacker News)


Did you find this technical article helpful?

Join the developer feedback loop or share with your engineering team.

Topics & Tags
#Assembly#8086#x86#OperatingSystems#LowLevel#Preemption#HackerNews