hn.today

A graphical desktop for the ZX Spectrum

github.com111 points88 comments
Screenshot of A graphical desktop for the ZX Spectrum

A compact graphical desktop for the ZX Spectrum 48K, written in Z80 assembly, implements overlapping z-ordered windows, a permanent menu bar with pull-downs, movable/resizable title bars, a heap-based allocator, a 16-slot event queue, and support for Kempston mouse, Kempston joystick and full keyboard input. It includes ready applications - notepad, clock, calendar, a two-pane commander and a settings panel - persistent settings storage, pluggable storage backends (RAM, tape, 128K bank disk, esxDOS), and a script-driven mode for reproducible interactions. The whole system fits within 48K of RAM, runs on real hardware (not just emulators), and can drag a window within a single 69,888 T-state frame; design choices were driven by empirical timing measurements rather than speculation.

Construction is bottom-up and highly performance-aware: a device layer abstracts screen operations, the main loop enforces strict frame discipline around the ULA beam, and input is read last so scheduler costs before the beam wait remain constant. Key internals include a hit-testing scheme rebuilt from z-order before each query, four transient surface slots, swapped-in window records to avoid stale copies, a storage backend registry implemented as patched JP targets for minimal dispatch cost, and controls modeled as panel rows. Memory is carefully mapped to avoid contended regions (slow code below $8000), with an 8,112-byte heap and explicit regions for live state, RAM disk and transient surfaces. Build requires pasmo and emulator/esxDOS tools; an emulator quirk with mouse dragging is documented and worked around.

Read on github.com88 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Hardware

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.