AI

ZX Spectrum games built with AI agents: zx-framework

Our founder uses the open-source zx-framework to have AI agents write ZX Spectrum programs in C. It produced a Tetris and an in-development tower defense game, MELTDOWN.

FSM Studio · · 5 min read

Illustration: an 8-bit computer with a keyboard and a small robot beside it, in terracotta and blue

Can an AI coding agent write a program for an 8-bit computer with 48 or 128 KB of memory? Our studio’s founder tests this in three open-source projects: the zx-framework, the zx-tetris game and MELTDOWN, which is still in development. They are personal projects, not FSM products. Here is how they work and what carries over to agent-driven work in general.

What zx-framework contains

zx-framework is a starter framework for ZX Spectrum 48K and 128K programs in C with the z88dk compiler, driven from Claude Code. Everything is containerised; the only host requirement is Docker.

  • Toolchain in Docker: z88dk (C to Z80 to .tap), headless ZEsarUX, z80dasm and Python for integration scenarios.
  • Five-agent pipeline: each task in docs/tasks/ goes through planner, coder, tester, reviewer and documenter with /task <id>.
  • Investigator: drop a foreign .tap, .sna or .rom into imports/, ask a question, and an agent writes a report based on real disassembly.
  • Hardware reference (zx-arch): memory map, screen layout, attributes, keyboard matrix, beeper, AY-3-8912, the 50 Hz interrupt and 128K bank switching, with links to the original sources.
  • /quick-start: interviews you, drafts docs/PROJECT.md, creates the first tasks and checks the toolchain.

How the agent’s work is checked

An agent is only useful if its result can be verified. The smoke service loads the .tap into headless ZEsarUX, checks that the program counter is not 0x0000 and captures the screen. integration runs JSON scenarios over ZRCP. There are also a cycle-accurate trace and two disassemblers.

Each task has acceptance criteria and a Test plan block (skip, smoke-only or a list of scenarios). The reviewer checks every criterion against the diff and the tester’s artefacts. FAIL or REWORK sends the work back to the coder; INFRA_ERROR halts the pipeline.

zx-tetris: a small project with visible engineering decisions

zx-tetris is a classic Tetris for the ZX Spectrum 128K, written in C, compiled to .tap and run in the Fuse emulator. The README calls it a pet project for learning low-level 8-bit programming. It is built from scratch: one cell is one character cell, with direct writes to screen RAM at 0x4000 and the attribute file at 0x5800 and no graphics library.

It has seven tetrominoes, an NES-style level and gravity table, NES scoring, soft and hard drop, a HUD and beeper sound effects. The most useful part of the README is its list of non-obvious decisions:

  • No printf: the default console driver does not interpret positioning bytes, so text is drawn by copying 8-byte glyphs from the ROM font.
  • intrinsic_ei() is needed before every intrinsic_halt(), or the first HALT blocks forever.
  • The sccz80 compiler is strict C89: no inline, locals at the top of the block.
  • In zx_cxy2saddr(x, y) the first argument is the column and the second the row; swapping them gives a transposed picture.

This is why task files and completion notes should record where reality differed from the plan: the next agent does not have to rediscover it.

MELTDOWN: tower defense on zx-framework

MELTDOWN is a sci-fi tower defense game for the ZX Spectrum 128K. It is in development, so this section relies on its original vision document (docs/PROJECT.md), not on a finished game.

You command the automated defences of a deep-space reactor. Between waves there is a build phase, then ENTER releases the next wave. Each intruder that reaches the core raises reactor instability; at zero the reactor melts down and you lose. The first version (MVP) plans one map, 6-8 waves, three turrets (LASER, MISSILE, TESLA) and three intruder types (DRONE, RUNNER, BRUTE).

The document also explains the fit: pure tower defense did not exist in the classic ZX era, and its mechanics suit the platform: a character-cell grid, integer maths, few objects on screen and logic inside a 50 Hz frame loop. Shots are instant and show as a brief flash, which avoids attribute clash.

For graphics the plan is to generate art with Google’s Gemini image model and convert it to ZX formats with a project script. The document expects a direct win only for the loading screen and title art; in-game glyphs will be hand-tuned.

Limits

  • Licence. All three READMEs state MIT, but none of the repositories has a LICENSE file. The zx-tetris README adds that it is a learning project, not for sale.
  • MELTDOWN is not finished. We give no dates.
  • The agent does not guarantee quality alone. The pipeline and tests make the result checkable.
  • This is a niche. ZX Spectrum work is not an FSM service; it is an example of how to structure agent work.

What to take from it

If you plan to give an AI agent real code, take the principles, not the platform: a task with acceptance criteria, separate role steps, automatic verification and a completion note. To set up a process like this in your company, see AI automation, read what AI coding tools are or how an agent can report by voice. All projects are in the open-source section.

If you have a process you want to hand to agents, discuss your project with us.

Sources