Liber VII

The demake

How to fit an abbey into a 1977 console.

It all began with a simple question: will it fit? The reference is the ZX Spectrum 128K version of La Abadía del Crimen (The Abbey of Crime). Its play area measures 256 × 160 pixels in two colors, is built from 256 tiles of 16 × 8, and spreads its 94 screens across the ground floor, the scriptorium and the library.

In size, it fits: an Atari pixel is almost twice as wide as a Spectrum pixel, so 128 pixels on the 2600 take up the same space on the TV as the original screen. What does not fit is the bandwidth. The TIA stores no image. Everything has to be fed to it line by line, as the electron beam passes, and it can cleanly draw only about 48 consecutive high-resolution pixels. That is where the challenge comes from.

For enthusiasts: the technical chapters

How it works inside, topic by topic, for those who know the 2600: the cartridge, bus stuffing, the kernels of each mode, the scoreboards, the special screens, the sound and the performance. Each chapter can be read on its own.

Studying the original

Before drawing anything, the abbey had to be understood from the inside. For that, a minimal Spectrum 128K emulator was written, along with a set of tools that skip the intro, move William from room to room, dump the memory and the sound chip registers, and disassemble the Z80 code. The public analysis of the CPC version by Manuel Abadía, published between 2003 and 2005 with the Z80 code disassembled and commented, was an invaluable help.

The tiles are a good example of how the game was adapted from one machine to another. On the Amstrad CPC, where it was born, each pixel uses one of four inks, which in the entrance room are dark cyan, orange, yellow and black. Transparency is not a fixed color but depends on the tile: the CPC draws them with mask tables that, in tiles 11 to 127, let what is underneath show through where there is yellow, and in tiles 128 to 255, where there is orange. The first eleven are copied whole. That way a tile can have all four inks and holes at the same time. The Spectrum only puts two colors in each block, so its version redrew them with paper, ink and transparent: black and cyan almost always become paper, and orange and yellow become ink. Transparency is preserved: it matches in 98% of the pixels. The demake uses the Spectrum tiles, for obvious reasons: it is the reference version, and one ink on a background is exactly what the TIA can draw on each line. The Atari draws the room 128 pixels wide, half the Spectrum's width, so each tile shrinks to 8 × 8, and each pair of pixels becomes one. There are ten ways to do it (alternating by rows, by columns or in a checkerboard, always keeping one side, giving priority to ink or to gaps), and for each tile the one chosen is whichever best preserves the tone and direction of its lines across the 94 assembled rooms, next to its neighbours.

The game's 256 tiles in groups of three: Amstrad CPC, ZX Spectrum and Atari 2600
Plate I. The 256 tiles of 16 × 8 pixels from which the whole abbey is built, in groups of three: on top, as stored in the Amstrad CPC's memory; in the middle, the same tile in the ZX Spectrum version, which the demake starts from; and below, as the Atari 2600 draws it, with half as many pixels across.
CPC, with the entrance room's inks: dark cyan, orange, yellow, black and transparent (yellow in tiles 11 to 127 and orange in tiles 128 to 255). Spectrum and Atari: paper, ink and transparent.

With the characters it is the other way round: their graphics are identical, byte for byte, on the CPC and the Spectrum, with the same four values. What changes is how they are drawn: the CPC uses three inks and leaves the fourth value transparent, while the Spectrum draws the two light inks in its ink colour and the black one as paper. For the Atari, each graphic is reduced to half its width pair by pair: if both pixels match, that one stays; if one is ink and the other is not, the one that contrasts more with its surroundings wins, so neither the thin strokes nor the gaps between them are lost.

William, Adso, the Abbot, Malachi and Bernardo Gui in CPC colours, as on the Spectrum, and reduced for the Atari 2600
Plate II. William, Adso, the Abbot, Malachi and Bernardo Gui: on top, in the CPC's colours; in the middle, as the Spectrum draws them; below, reduced to half their width for the Atari 2600. The checkerboard is transparency.

Five ways to draw a room

Five ways of presenting the rooms were evaluated. Two were discarded: one halved the vertical resolution and broke the one-pixel diagonals, and the other, with the whole room in playfield, made the architecture unreadable. The other three gave rise to the four modes the game's menu offers today.

The cloister in the original and in several display options
Plate III. The cloister: the Spectrum original compared with the full interlaced room, a single one of its fields, and the 48-pixel window.
Discarded display options
Plate IV. What was tried and discarded, with its flaw in plain view.

The decision was not to choose. A single engine on the ARM always composes the full room, just as the original did in the Spectrum's memory, and the console presents it in any of those four modes: FULL, the whole 128-pixel room in a checkerboard of blocks that swaps on every frame and that the eye blends into one, which is the default; DOUBLE, a 96-pixel window, also in a checkerboard; STRIP+, a sharp 48-pixel window without flicker, with the rest of the room hinted at in dimmed playfield; and STRIP, just the 48-pixel window, which works on any console.

0Color bars

The first milestone only aimed to prove that the toolchain worked: a minimal ELF ROM with moving color bars. The trick is bus stuffing: the ARM places the data directly on the bus and the TIA receives a write every three cycles. With it, the ARM changes the background colour 23 times per line, one every 3 cycles: 9-pixel stripes, 17 of which are visible, because the first ones fall off the screen, in the horizontal blank. Without it, each change (lda # and sta) costs 5 cycles: 13 fit on a line, in 15-pixel stripes, and 10 are visible.

Color bars in Stella with and without bus stuffing
Plate V. Milestone 0 in Stella: with bus stuffing, 17 visible 9-pixel stripes; without it, with the button pressed, 10 of 15 pixels.

IThe screen test

Three real rooms (cloister, entrance and church) and the four display modes, switchable with the difficulty switch. This was the most delicate milestone. For the 48-pixel window, the console's two sprites are repeated three times each. For the full room they have to be repositioned mid-line, on lines of exactly 76 cycles, with a scheduler that places each write in its slot. A tool compares the Stella captures with the expected image, and the match is exact, pixel for pixel.

The cloister in the four display modes
Plate VI. The cloister in the four modes: 48 px without flicker, 96 px interlaced, 128 px interlaced, and window with playfield.
Even fields, odd fields and the blended image
Plate VII. How interlacing works: even field, odd field, and what the eye perceives.

Below the room lives the scoreboard: scrolling phrases in the original typeface, object icons, the day in Roman numerals, the canonical hour and the Obsequium bar. And there is music: a small synthesizer imitates the three channels of the Spectrum's AY chip and writes a 4-bit sample on each screen line, using the TIA's volume as a digital-to-analog converter.

Three scoreboard proposals
Plate VIII. The scoreboard ideas before a decision was made.
The scoreboard in the four modes
Plate IX. The scoreboard in the four modes.

IITaking the abbey apart

The second milestone was one of archaeology: extracting from the Spectrum the tiles, the maps of each floor, the 94 screens, the character sprites, the scoreboard typeface with its 56 phrases, and the intro music, register by register. There are curious details. The monks are assembled from an interchangeable head and body, and the library is drawn in black if William is not carrying the lamp.

Map of the first floor
Plate X. Map of the first floor: the scriptorium, with the code of each screen.

IIIThe drawing engine

The original abbey does not store its rooms as images. It describes them with a list of blocks that run small programs in a bytecode of its own, with registers, loops, subroutines and mirroring. The demake reimplements that interpreter in C: 12 KB of programs and descriptions instead of 180 KB of screens, and all 94 rooms come out identical.

On top of that the characters are drawn with the painter's algorithm, back to front, so that William passes behind columns and arches. All of this happens in the brief respite between one frame and the next, because while the screen is being drawn the ARM cannot be distracted for an instant.

Scenes from the original next to the demake
Plate XI. On the left, the original; in the center, the full interlaced room; on the right, the window with playfield.

IVBringing the abbey to life

The fourth milestone has turned the tests into a game. The final ROM, abadia2600.bin, already runs through the original's full cycle: cover, menu, the intro parchment, the game itself and the final parchment.

All the logic has been translated from Z80 to C and checked against the real game. The scripts, the clock, the days and nights, Obsequium and the dialogues were first verified in a prototype that matches a complete seven-day game in the emulator tick for tick, and were then ported to the ROM. The original's scripts are recompiled into about 2.5 KB of bytecode. Adso follows William with the same pathfinder as the original. Doors open and close according to the permissions of each moment, and objects are picked up on approach and appear on the scoreboard.

The dialogues enter from the right side of the scoreboard letter by letter, with a different beep for each character, as on the Spectrum.

The game in STRIP+ mode, with the Abbot's sentence on the scoreboard
Plate XII. In STRIP+ mode, with the current ROM: the Abbot asks William to follow him, and his sentence scrolls in on the scoreboard. Hour of nones.
The game in FULL mode, with the Abbot's sentence on the Spectrum-style scoreboard
Plate XIII. The same in FULL mode, with the mid-October ROM: the Abbot asks William to follow him, and his sentence scrolls through the frame of the Spectrum scoreboard. The screenshot blends the two interlaced fields, as seen on a TV.

A new cover

Automatically converting the original loading screen left the lettering legible and the rest in smudges, so the cover has been redrawn by hand for the TIA. Each line is a small program of writes to the video chip, with its exact cycle, and a simulator calibrated against Stella guarantees that the console draws it to the pixel. It shows an elderly monk writing at night by the light of three candles, seated in a friar's chair, as on the original covers. It is the same in all four modes and does not need bus stuffing.

When the button is pressed, the lower part of the cover turns into a menu with four settings: the television system (NTSC, PAL 60 or PAL 50), the language, the screen mode and HMOVE (NORMAL or SHORT, for consoles made in China from 1989 on, such as the late Jr. and PAL 7800s, where the HMOVE at the end of the line moves one pixel less). Below the chosen setting its value appears, with arrows that blink towards the sides it can still change to. On the PlusCart and the UnoCart, a fifth row, EXIT, returns to the cartridge's menu; below it, instead of a value, the cartridge's name, which the game works out at startup by checking which ARM port the console's data bus comes out of.

Redrawn cover with the menu in Spanish
Plate XIV. The cover with the menu in Spanish.
Redrawn cover with the menu in English
Plate XV. The same menu in English.

The parchment and the languages

The parchments of the intro and the ending are written as in the original: a quill traces each Gothic letter with the same timing, and the result matches the emulator to the pixel. A single key press skips them, like the space bar on the Spectrum.

The game can be played in Spanish or English. The English texts come from the translation made by the community for the CPC version, with its period tricks: the apostrophe takes the place of the Í, and the W that of the Ñ.

First page of the intro parchment in Spanish
Plate XVI. «Ya al final de mi vida de pecador…» ["Having reached the end of my sinner's life…"]: the intro in Spanish.
First page of the intro parchment in English
Plate XVII. The same page in English.

Sound and performance

The music of the intro and the ending is now stored compressed, with a custom LZ77, and takes up about 10 KB less. Several details of the synthesizer have also been fixed: the intro starts from the real state of the sound chip, and the signal is centered so that the volume does not "pump".

The target cartridge, the Chameleon Cart, carries a modest ARM Cortex-M0+. To make the game run at 60 frames per second in every mode with the processor at 56 MIPS (measured in Stella), the work has been reorganized: the room is built in pieces, the logic is split into two halves, and only what changes is recalculated. The most demanding mode has gone from needing 111 MIPS to 41. It remains to be tested on the real cartridge.

VThe complete abbey

The last stretch has completed the game. The monks are now drawn as in the original, each with his own head on a shared body, and they move around the abbey on their own schedules. Every floor and every hour of the day has its own colors, and new rooms appear with the same spiral wipe as on the Spectrum, from the inside out.

The details that made the original special are there too: the camera that, if William stands still, starts following another character; the dark library, where you only see what the lamp lights; the mirror and its trick; and the "You have solved n percent of the investigation" screen before the final parchment. The inventory icons come from the same graphic used to draw each object in the room, inverted as on the Spectrum.

The Atari has fewer buttons than a keyboard, so the controls are shared between the joystick and the console switches. SELECT opens a pause menu to resume and, if a SaveKey or an AtariVox is plugged into the right port, to save or load the game, which is stored there and can be restored after switching off. The left difficulty switch shows the room's height map, like the ENTER key in the original: the position it is in when the game starts is the normal one, and moving it shows the map. The right one chooses the pace: in the position it is in when the console is switched on, the game runs at the original's nominal pace, and in the other one, somewhat slower, as the Spectrum was played. When it is changed, the scoreboard shows the chosen pace for a couple of seconds.

All of the original's logic is now in the ROM: the seven days, the endings, the camera and the mirror, each part checked against the Spectrum emulator.

Monks in the entrance room
Plate XVIII. The monks are now drawn and walk around the abbey. Full mode.
Pause menu in the scoreboard
Plate XIX. The pause menu, with SELECT: resume, save or load the game.
Height map over the room
Plate XX. The height map, with the left difficulty switch.
Spiral wipe at the start of the game
Plate XXI. The spiral wipe that reveals each room.

The finishing touches

FULL mode still had gaps. The TIA's sprites are 8 pixels wide, but to repeat them along the line they have to be placed again by writing to their RESP0 and RESP1 registers, and each write takes 3 CPU cycles, 9 pixels: two consecutive copies end up 9 pixels apart, with a stray pixel between them. So on every line there were nine one-pixel columns that neither field painted: thin stripes of paper running from the top of the room to the bottom. The first fix was to fill them with a missile, the one-pixel-wide object the TIA offers besides the sprites. The nine columns form three groups 32 pixels apart, just like the three copies the TIA makes of each object, so turning the missile on three times per line covers a whole group. Each frame fills a different group, so each column shows up one frame in three. The kernel is unchanged and the ARM needs only 0.8 MIPS more.

That way the columns show at a third of the tone, dimmer than the rest of the room, which shows at half because each pixel appears in one of the two fields, and with a slow, six-frame flicker. A new mode, FULL+, evened them out: it splits the columns between the two fields like the rest of the room, with missile 0 on two groups, missile 1 on the third and the ball to correct that missile's third copy, so they show at half and alternate every frame. It costs about 46 MIPS in Stella, against 40 for the first one. For a while both were in the menu; in the end the first one was removed and FULL+ took over its name.

Then came the checkerboard, a new way of drawing FULL. Instead of splitting the room into columns between the two fields, each line paints half of the 8-pixel blocks and the next line the other half; on the next frame, the other way round, like the squares of a board. The blocks are whole bytes of the room: there are no stray columns left, the missiles and the ball are not needed, the scoreboard bars appear on every frame and the ARM works less, about 43 MIPS in Stella against 46. DOUBLE paints its 96-pixel window the same way, without bus stuffing. The idea for 128-pixel-wide graphics comes from the bus stuffing demos that Darrell Spice Jr. (SpiceWare) shared on AtariAge.

The result screen, "You have solved n per cent of the investigation", has gone through three versions. At first it was drawn like any other room, split between the two fields: each field showed half the sentence, with letters squeezed to 4 pixels, and nobody could read it. The second version took it out of the interlacing and showed it in the 48-pixel window in every mode, in eleven short lines. The final one is closer to the original again: in FULL it uses the game's own font, with 8-pixel letters, across the room's 128 pixels, like the parchment. In DOUBLE, where the sentence does not fit, it is shown in the 48-pixel window, as in both STRIP modes.

The same part of a room without the fill, with the first fill and with the current one
Plate XXII. The same part of the entrance room without the fill (left), with the first fill, the columns at a third of the tone (centre), and with the current one, at half, like the rest (right).
Result screen: You have solved 42 per cent of the investigation
Plate XXIII. The result screen in FULL, with the game's font. The figure is a test value.

The scoreboard, as on the Spectrum

Until now the scoreboard was a design of its own, compact and shared by every mode. In FULL it is now the Spectrum's whole scoreboard, at half scale, just like the room: "Día" in Gothic lettering with the Roman numeral, the hour on its red bar, the frame the sentences scroll through, the six inventory slots, with the objects inverted as on the Spectrum, and the word "obsequium", hand-drawn in a narrow Gothic face, with its bar. It is drawn with the same kernel as the room, as if it were one more 32-line strip: cyan ink at the top and yellow at the bottom, and the red bars with the playfield and the ball, another of the TIA's objects. To make room for the bars, the inventory slots sit closer together than in the original. DOUBLE has a narrow, 96-pixel version: the inventory and the bars are squeezed together, and "Día" and "obsequium" are shortened to "D." and "ob." so that the sentence fits 14 letters. The two STRIP modes have a scoreboard of their own, also closer to the original and without bus stuffing: the sentence in a cyan box, six slots with the objects in yellow on black, as in the original, joined by double connectors, the day in green on the left, the red obsequium bar on the right and the hour in cyan on another red bar.

The scoreboard is in English too. "Day" comes from the scoreboard of the community's translation of the CPC version, in the same Gothic letters; the hours run from NIGHT to COMPLINE, and "obsequium" stays as it is, as in that English CPC version.

The Spectrum scoreboard and, below, the demake's in FULL, DOUBLE and STRIP modes, in Spanish and in English
Plate XXIV. On top, the Spectrum scoreboard; below, the demake's in FULL mode, the narrow one in DOUBLE and the one in the STRIP modes, each in Spanish and in English. On a TV, the FULL and DOUBLE ones look dimmer, because they are interlaced.

Hands and machines

As is now customary in software development, this demake has been made with artificial intelligence: Claude Code, by Anthropic, mainly with the Opus 5.5 and Sonnet 5.5 models. Every commit of the game carries its signature next to mine. The supporting tools were made with it too: the minimal Spectrum emulator used to study the original, the extractors for tiles, sprites, texts and music, the graphics and script editor, the Stella capture scripts and this very website. Most of the code was written by the machine.

The human hand, mine, has been in what cannot be delegated:

A six-switch Atari with a PlusCart, connected to an LG TV showing the abbey's entrance hall with the Spectrum scoreboard
Plate XXV. The first time the game ran on a real console: my six-switch Atari with the PlusCart, connected through its RF output to the LG TV. Day I, the hour of nones, in the entrance hall. Like many modern TVs, this one takes the console's progressive signal (240p) as if it were interlaced (480i): in the modes that alternate two fields it does not blend them but doubles the lines of each one, and steps appear.
The demake's title screen on the same LG TV, with the menu set to PAL 60, Spanish and COMPLETO+ (FULL+, the name FULL had then)
Plate XXVI. The title screen on the same console and TV, with the menu set to PAL 60, Spanish and COMPLETO+ (FULL+, the name the FULL mode had then). There are no steps here: the title screen is the same in every frame, so doubling the lines does not show.