Technical field guide · Graphics engine

How the abbey is drawn

How the game turns a character’s position into a drawn room: first it selects a description, then combines architectural pieces, and finally composites the pixels sent to the screen.

Begin the reconstruction ↓
Plan of the library labyrinth
Geometry, memory, and perspective
01 · The essential idea

The screen takes shape from a description

The game does not store a complete image of every room. It stores a short description of its parts. On entering the room, the game reads that description, draws each part with tiles, and composites the architecture. Characters, doors, and objects are added afterwards.

116entries in the room table; some do not represent reachable places
2,497architectural placements in the reconstructed set
87non-null block definitions
256available graphic tiles
32 × 36coordinates in the logical construction grid
16 × 20cells in the visible architectural buffer
Advanced referenceScope, sources, and limits of the reconstruction

What exactly are we looking at?

The main explanation describes the original Amstrad CPC system and has been checked by reconstructing how it works. The plates show the room’s architecture; characters and objects are added afterwards. Readable algorithm and variable names were created for this explanation.

Technical basis
Room selection, descriptions, recipes, grids, depth, tiles, masks, and palette.
Graphic comparison
The selector shows how other versions reinterpret the architecture; the table below summarises what they share and how they differ.
Graphic versionWhich part of the system it sharesMain difference
Amstrad CPCDescriptions, recipes, two layers, masks, and four-colour palettes.Reference version for the main explanation.
PC CGASame general organisation of rooms, recipes, and two layers.Different pixel encoding and process for copying the image to video.
ZX SpectrumIts conversion also uses descriptions, recipes, and masked tiles.Two visible colours depend on the floor and time of day.
MSXIts conversion also uses descriptions, recipes, and masked tiles.It uses its own tiles and changes colours according to floor and time of day.
VGA remakeIt recovers the architecture and expands its depth.Later reinterpretation with redrawn tiles and 256 colours.
Before we begin

Four words used throughout the guide

They name different parts of the process. This row is a vocabulary, not a sequence.

RoomThe architecture associated with one position in the abbey. Its description lists the parts that must be drawn.
PlacementOne entry in that list: it states which part to use, where to begin, and which parameters to apply.
Block or recipeReusable instructions that draw one architectural part by combining tiles.
TileA rectangular 16 × 8 pixel graphic containing colour and mask data.
Overview

From the world to the screen in seven steps

This time the boxes do form a sequence: read them from left to right.

01CoordinatesCoordinates locate the camera.
02RoomThat position selects a room.
03DescriptionThe room contains a list of parts.
04RecipesEach part is built by combining tiles.
05DepthEach cell retains up to two ordered tiles.
06ColourThe palette and masks produce pixels.
07ScreenThe 256 × 160 pixel result is copied to video.
WHEN THE WORLD CELL OR FLOOR CHANGES:
    floor ← floor corresponding to position.z
    cell  ← (position.x DIV 16, position.y DIV 16)
    room  ← identifier stored in world_map[floor, cell]

    empty both tile layers
    fill the image with the lighting colour
FOR EACH placement in the room description:
    recipe ← definition associated with placement.type
    follow its instructions from placement.position,
                                using placement.parameters
                                and placement.height

FOR EACH visible_cell:
    apply the mask and colour of the lower-depth tile
    apply the mask and colour of the higher-depth tile

The game rebuilds the architecture when the camera enters another world cell or changes floor. While the camera remains there, the game reuses that image and draws the moving elements over it.

02 · From the abbey to a room

Three coordinate spaces

The system uses three different grids: one locates the camera in the abbey, another builds the room from tiles, and the third corresponds to the pixels on screen.

1. The world cell

Characters move in coordinates spanning the entire abbey. The game divides the X and Y coordinates by sixteen to obtain the cell containing the camera. Height selects one of three floors: ground, first, or library.

It then checks whether each cell coordinate is odd or even. The four possible combinations determine the isometric orientation from which the room is shown.

cell_x ← position_x DIV 16
cell_y ← position_y DIV 16

if height is below the first boundary: floor ← GROUND
if height lies between both boundaries: floor ← FIRST
if height exceeds the second boundary: floor ← LIBRARY

x_parity ← cell_x MOD 2
y_parity ← cell_y MOD 2
orientation ← combination of x_parity and y_parity

room ← room_map[floor, cell_x, cell_y]
The table consulted by the gameThe three images represent the ground floor, first floor, and library. Each green square is a 16 × 16 unit world cell. The number inside, written with digits 0–9 and letters A–F, identifies the room that must be drawn. Dark squares contain no valid room.
32 × 3616 × 20
A logical space larger than the imageThe recipe advances through coordinates on a 32 × 36 grid. Only its central window is retained in the visible buffer.

2. The construction grid

Recipes do not draw directly to the screen. They work in the coordinates of a logical grid measuring 32 columns by 36 rows. The part’s origin, parameters, and orientation determine the cells through which the recipe moves and where it emits each tile.

The game does not need to store all 1,152 cells: it clips this coordinate space against a central window. For now, only the path and placement matter; depth is explained later.

FOR EACH tile emitted by a recipe:
    destination_x ← origin_x + offset_x
    destination_y ← origin_y + offset_y

    if the destination lies inside the central window:
        store the tile in the corresponding visible cell

3. The screen window

The central part of the grid corresponds to the visible buffer: 16 columns by 20 rows. Eight-coordinate margins position this window within the construction space.

Because every tile measures 16 × 8 pixels, the architectural result occupies 256 × 160 pixels. We will later see that every cell retains depth information; for now, it is enough to recognise the window that reaches the screen.

FOR row FROM 0 TO 19:
    FOR column FROM 0 TO 15:
        construction_x ← column + margin_x
        construction_y ← row + margin_y
        copy the corresponding visible cell

Amstrad CPC · daytime palette

The architecture exactly fills the visible window of 16 × 20 tiles
03 · How the parts are described

A block is a small drawing program

A room description contains a list of placements. Each placement selects a recipe, states where it must begin, and supplies up to two parameters. Some also include a height used to decide which parts belong in front of others.

Each room uses only the bytes it needs

A simple room has fewer placements than a complex one. Each description therefore stores its own length, contains only the required placements, and ends with an end marker. To find a particular room, the program adds the lengths of the descriptions before it.

Each placement occupies three bytes, storing the block type, two local coordinates, and two small parameters. It uses a fourth byte only when an initial height is required. Storing two complete 16 × 20 maps for all 116 entries would require at least 74,240 bytes; the compact list of all descriptions occupies 9,014.

ROOM DESCRIPTION
    total length
    placement 1
    placement 2
    ...
    end marker

PLACEMENT
    recipe type
    origin_x + parameter_1
    origin_y + parameter_2
    optional height

Amstrad CPC · daytime palette

Basic pieces

256 tiles of 16 × 8 pixels

Details of stone, timber, floors, edges, and shadows are stored in these graphic pieces. Recipes combine several tiles to form a complete architectural element. [source]

All 256 available tiles · select to enlarge
Reusable recipes

Four block examples

A recipe can draw an arcade, a staircase, a row of windows, or a wall. Its parameters change the length, height, or orientation without storing another complete image.

Arcades
Stairs
Windows
Walls

Parameters change the result

At the beginning, a recipe receives the tiles it can use, a starting position, and the placement parameters. It then executes a sequence of simple instructions.

The instructions can place one or more tiles, move the drawing position, repeat a section, save and restore a position, mirror a part horizontally, or call another recipe. One definition can therefore produce walls of different lengths, stairs of several sizes, or arcades facing opposite directions.

CONCEPTUAL EXAMPLE — NOT A TRANSCRIBED RECIPE

RECIPE wall_with_arches(origin, length, height):
    cursor ← origin
    REPEAT length TIMES:
        EMIT pillar_tile AT cursor
        MOVE cursor RIGHT

        REPEAT height TIMES:
            EMIT arch_tile AT cursor
            MOVE cursor UP

        RESTORE cursor TO BASE
        MIRROR vocabulary IF orientation_changes

    END recipe

How to read the example: the cursor marks the cell that will receive the next tile; emit means writing it to the grid; restore the base returns the cursor to the foot of the part; and mirror reverses the horizontal orientation. The algorithm is an explanatory example, not a transcription of a historical recipe. The plates show real executions, although other parameters could change their size or orientation.

Look closerThe recipe interpreter

Each type leads to a definition with two parts: a local list of twelve values—normally tile identifiers and constants—and the instruction sequence. At the start, the two placement parameters, optional height, and two depth coordinates are added: seventeen working values in all, alongside a cursor and a small stack.

The interpreter can emit and move, repeat and restore, calculate, transform coordinates, and invoke another recipe. Tile runs have their own shorthand: an instruction can emit a piece, advance, repeat it, and continue to the next main instruction. Floors, steps, and long walls can therefore be described with very little data.

04 · One room from beginning to end

Let us follow room 17

This example shows how a description becomes a complete room. “17” is its hexadecimal identifier; it is neither a coordinate nor the decimal number seventeen.

Interactive demonstration · CPC and PC CGA

Build the room step by step

“Construction” shows the 32 placements forming the CPC architecture and reports what each recipe changes in the tile grid. “Copy to screen” switches to PC CGA to reproduce the documented traversal of its 320 visible cells.

Initial room-17 background before any architecture is placed
Preparation

The room area receives its background colour

No placement has run yet. This colour is already part of the result: wherever a tile's mask preserves the existing image, this background remains visible.

Advanced details
Room
17 hexadecimal
Placements
0 of 32
0 / 32

The demonstration compares two versions: “Construction” uses the reconstructed CPC description and graphics. “Copy to screen” uses the PC CGA traversal and graphics. Both show architecture only; characters, doors, objects, and the lamp are added afterwards.

All 93 roomsOur demonstration follows a single room. Manuel Pazos’s La Abadía del Crimen Room Viewer lets you explore every room step by step, switch graphics, and discover which rooms are absent from the reduced CPC cassette map.

Look closerWhy the PC CGA copy begins at the centre

In PC CGA, once the grid is full, the program does not copy cells row by row. It begins at position (7, 8), near the centre, and advances in strips down, right, up, and left. The strips grow each circuit until all 16 × 20 visible cells are covered.

This order changes only how the image appears while it is being copied, not the final result. In each cell, the two retained tiles are composited in order. Each tile is decoded as eight rows of sixteen pixels; its mask determines which existing pixels remain.

05 · Depth and composition

Two tiles can occupy the same cell

These are not two complete pictures called “background” and “foreground”. Each visible cell retains up to two tiles with their depth coordinates. When a character is redrawn, its position determines which tiles are mixed before it and which are mixed afterwards.

The crop uses Guillermo and real room-17 tiles to demonstrate the general principle. Select a step to hold it; select it again to resume the animation.

Two values order the tiles

When a placement includes height, the system combines it with the tile’s local position. This calculation produces two depth values for that tile, not a separate depth for every pixel. The recipe can modify the values while it draws.

If several pieces reach the same cell, the program compares their values and retains up to two tiles with their depth data. “Behind” and “in front” are not permanent labels: they are decided by comparing those values with the character’s particular position.

half_height ← height DIV 2

depth_a ← tile_y + half_height + tile_x − 15
depth_b ← tile_y + half_height − tile_x + 16

compare the new tile’s depth
with the two retained slots

A mask controls the shape of each tile

Before a tile is placed, that area already contains the background colour or another tile. The composition mask states which pixels preserve that earlier image and which receive the new tile.

For example, an arch mask preserves the floor around its diagonal edge. A black pixel may also be opaque: black does not mean transparent.

1 · Existing backgroundWhat was already on screen.
2 · Tile maskLight: preserve. Dark: replace.
3 · Tile colourIncludes stone and opaque black.
4 · ResultThe base remains only where the mask permits it.
Look closerFrom an encoded tile to sixteen pixels

Each CPC tile contains eight rows of four bytes: 32 bytes in all. In the graphic mode used here, each byte encodes four pixels; unpacking it yields sixteen pixels per row and four possible colour indices. The upper half of the 256 identifiers selects the second pair of composition tables.

For every fragment, the colour already on screen is read first. One table decides what remains and another what the new tile contributes. Day and night do not alter the mask: they change the colours assigned to the indices.

destination ← (destination AND mask) OR colour
06 · Day, night, and darkness

Night changes colour; a dark room limits visibility

Time determines the colours. The room type determines how much can be seen. A normal room remains fully visible at night; a dark room is visible only within the lamp’s range.

Two questions, in this order

1. Is it day or night? The game assigns a different palette to the same graphic data. This changes colours, not the visible part of the room.

2. Is the room marked as dark? If it is, the game hides the complete architecture. The lamp reveals only an area around Adso.

1 · TIME OF DAY
    choose the daytime or night-time palette

2 · TYPE OF ROOM
    normal → show all the architecture
    dark   → show only the lamp's range
Complete room 17 in the Amstrad CPC daytime palette
1 · Day, normal roomThe complete architecture uses the daytime palette.
The same complete room 17 in the Amstrad CPC night-time palette
2 · Night, normal roomThe colours change; the visible area does not shrink.
Reconstruction of labyrinth room 68 visible only inside the CPC lamp pattern
3 · Library labyrinth, with lampOnly the architecture inside the light pattern is shown.

These three plates do not follow the graphics selector in the header: the comparison is presented exclusively with Amstrad CPC graphics. The third is an explanatory reconstruction, not a historical screenshot: it applies the CPC light pattern preserved in the code to the reconstructed architecture of labyrinth room 68. Artificially extending that pattern to the other versions would not faithfully represent how they work.

07 · Heights for movement

Walkable terrain is built separately

A placement’s height orders architectural tiles. Movement uses different information: a 24 × 24 terrain height field that records ground level around the characters.

One height for every ground position

Each cell stores the height of the ground at that position. A flat area repeats one value. A staircase or slope raises or lowers the value step by step in one direction. The grid covers the 16 × 16 world cell plus a four-position margin on every side, giving 24 × 24 positions.

The game uses these values to decide whether a character can move forward, must go up or down, and whether architecture should appear in front of or behind that character. The architectural recipes remain responsible for drawing the room.

empty height_grid[24, 24]
origin ← current_cell × 16 − margin

FOR EACH shape IN floor_geometry:
    clipped ← part of shape inside local_window

    if shape IS landing:
        fill clipped with initial_height
    if shape IS ramp:
        height ← initial_height
        FOR EACH step ALONG ramp_direction:
            store height in the cell
            height ← height + slope
What we seeThe two flights of stairs and their platforms make visible the level changes represented numerically in the adjacent grid.
What the game consultsSequences 2, 3, 4… follow the steps and show height changing one level at a time. Platforms appear as areas with a constant value.
Look closerFive shapes construct the relief

Each shape carries an initial height, a position, and two dimensions. One of the five classes fills a rectangle at constant height. The other four make ramps: height rises or falls one step at a time along one of the two directions of the plan.

The two dimensions may be packed together or stored separately with one additional unit. Before writing, every shape is clipped against the local window. One continuous floor description can therefore contribute only the portion surrounding the current room.

08 · During play

The whole room is not rebuilt on every frame

We have already seen how depth mixes architecture and characters. One practical question remains: when something moves, the game recomposites only the region of the screen that changed.

Only what changed is recomposited

The complete architecture is rebuilt when the room changes. While the camera remains there, the mixer handles every modified sprite—a character, door, object, reflection, or the lamp's light.

For each one, it defines a rectangle covering both its old and new bounds, expands the rectangle to the edges of the 16 × 8 pixel tiles, and recomposites the architecture and every overlapping sprite within it. The parchment, text, and lower status panel use separate drawing systems.

if room_changes:
    architecture ← build and composite the room tiles
    heights ← build the terrain height field

ON EVERY FRAME:
    update characters, doors, objects, reflections, and light
    order the sprites by depth

    FOR EACH visible sprite that has changed:
        area ← rectangle covering its old and new bounds
        align area to the edges of the 16 × 8 pixel tiles
        recompose the architecture and overlapping sprites within it
Advanced referenceEvidence, boundaries, and terminology

How we know it fits

Figures, formats, and algorithms presented as facts come from coherent structures, complete execution of every description, and visual comparison. The readable names of operations, recipes, and variables are ours: they describe function without attributing historical vocabulary to the programmers.

  • Structural check. All 116 descriptions can be followed to their ends, and the known instructions execute without encountering an unknown operation.
  • Code cross-check. Room selection, the interpreter, depth formulas, two layers, and masks were reconstructed for the CPC. The centre-outward screen-copy order is documented specifically for PC CGA.
  • A catalogue with exceptions. Of the 87 non-null definitions, five are not called by any room description; three of those finish without emitting a tile.
  • Deliberate boundary. This guide explains room architecture and terrain heights. Characters, doors, objects, reflections, restoration, limited lighting, parchment, text, and the status panel are handled by other systems.

These stages are sufficient to reconstruct room architecture independently: read the world map and room descriptions, execute the block recipes, combine the two tile layers with their masks, and copy the result to the screen. Characters, objects, and dynamic lighting can then be implemented as separate systems.