deniz.in

Markets

Weather

Loading weather

· via Hacker News – Front Page (hnrss.org)

ZX Desk puts overlapping windows and a full desktop on the 48K ZX Spectrum

ZX Desk is a GUI operating system in Z80 assembly that brings overlapping windows, pull-down menus and bundled apps to the 48K ZX Spectrum, completing window drags inside a single video frame.

ZX Desk puts overlapping windows and a full desktop on the 48K ZX Spectrum

A desktop that fits in 48K

A developer publishing as mindbox77 has released ZX Desk, a graphical operating environment for the 48K ZX Spectrum written entirely in Z80 assembly, with the source available on GitHub. The repository reached the Hacker News front page on 19 September 2026. According to the project's readme, the system delivers overlapping, z-ordered windows with focus, a permanent menu bar with pull-down menus, dialogues, a notepad, a clock, a calendar, a two-pane file manager and a settings panel that genuinely changes behaviour — all inside the 48K of a machine released in 1982. The author reports that it runs on real hardware rather than only under emulation, and that a window drag completes within a single video frame of 69,888 T-states.

Where the idea came from

The readme presents the project as an unfinished ambition from the 1980s. The author wanted an Atari ST for GEM — the desktop, the windows, the ever-present menu bar, the sense of a computer as an environment rather than a command line — but could only afford a Spectrum, and began writing pieces of something similar without finishing. ZX Desk is explicitly not a GEM port; it is what that idea becomes when pressed against a 3.5 MHz Z80, 48K of RAM, a one-bit display prone to attribute clash, and a video chip that takes cycles from the CPU while it paints. One methodological claim runs through the write-up: nearly every answer came from measuring the machine rather than reasoning about it, and the numbers are documented so that others targeting this hardware do not have to repeat the work.

What the system provides

Input from a Kempston mouse, a Kempston joystick or the full keyboard matrix is funnelled into a sixteen-slot event ring, and the readme notes that the main loop holds no window-specific code. Storage sits behind a registry of swappable backends exposed through six vectors: RAM, tape loading via the machine's real ROM routines, and the 128K Spectrum's spare banks serving as a RAM disk, with an identifier reserved for esxDOS. Memory management is a real heap — 8,112 bytes with an owner byte — allocating window buffers sized to their windows. Applications such as the notepad, clock, calendar, the two-pane commander file manager and an about screen are descriptors with init, event and paint routines, plus per-instance state swapped in and out. Settings persist to storage with a magic byte and a version number, and are read back at boot.

The engineering underneath

Several choices stand out. The main loop halts on the interrupt, performs pointer work in the top border, waits for the video beam when a window has moved, redraws, and reads input only at the end of the frame — an ordering the author says keeps the work before the beam wait constant, which is what makes the frame scheduler exact. Hit testing walks five-byte rows per control, ordered front-to-back by z-order and regenerated from the model before every search, so no duplicate copy of window positions can drift out of date. Backend dispatch uses hand-laid jump instructions whose operands are patched when a backend is selected; the readme puts the cost at ten T-states without disturbing any registers. Controls are deliberately uniform — a checkbox is a cycle control with a limit of two, a radio group the same control with a limit of N — so the settings panel, the file list and the save box all run one code path. The full memory map is published as well, from the low slow region through the heap at $DF50 to $FEFF, with the top page deliberately left unused.

Building it, and one emulator quirk

The toolchain is deliberately small: the pasmo assembler turns a single assembly source file into a tape image through a build script, with a machine flag for the 128K model and build options for demo captures, synthetic-input runs and a raw mouse diagnostic. The readme documents a notable emulator bug: Fuse 1.9.2 on macOS stops delivering Kempston mouse movement while a button is held, so window drags there use the space bar instead. The author is clear that this is the emulator's fault, demonstrated with a dedicated diagnostic build, and that a real Kempston mouse drags normally. A script-driven mode replays interactions from synthetic input, so an action such as opening a menu and dragging a window across another runs identically every time and can be compared against the previous run rather than watched.

Why it matters

ZX Desk is evidence that the desktop metaphor — overlapping windows, menus, event queues, virtualised storage — does not inherently require modern hardware, only disciplined engineering and honest measurement. For anyone working on Spectrum-class machines, the repository doubles as reference material: frame budgets, contention costs and a memory layout worked out on real silicon rather than assumed. The broader lesson travels beyond retro computing, too. Uniform abstractions, a strict frame schedule and design decisions justified by measurement instead of intuition are precisely the practices that keep much larger and faster systems coherent.

  • #zx-spectrum
  • #retro-computing
  • #z80
  • #assembly
  • #gui