Approved by Daniel Covington on 2026-11-26. Changes to this file follow AGENTS.md section 6.
An original colony-simulation game for the Commodore 64 in the fortress-building genre. The player does not control dwarves directly: they designate tiles to dig and a small crew of dwarves walks over and mines them on their own, revealing a randomly generated underground map. The view is a top-down tile map, drawn with an original custom character set, that scrolls over a world much larger than the screen.
Original idea, as given:
Dwarf Fortress clone
Smallest useful version: One randomly generated 128x128 underground level, three dwarves, a cursor (mouse, joystick or keyboard) to mark rock for digging; dwarves path to marked tiles and mine them, each mined tile yields one stone shown in a counter; the game runs in real time and can be paused.
One randomly generated 128x128 underground level (soft rock, hard rock, a few caverns and a starting cave), shown through a scrolling 40x23 map view drawn with an original custom character set. The player marks rock tiles for digging with a Commodore 1351 mouse (the dig cursor sits under the pointer), a joystick in port 2 or the keyboard. Three autonomous dwarves pick marked tiles within about 32 tiles, walk there, and mine them; each mined tile becomes floor and adds one stone to a counter. Real-time with pause, SID sound effects, same game speed on PAL and NTSC.
| Target | Machine / mode | Display | Video | Artifact | Expected behavior |
|---|---|---|---|---|---|
c64 |
Commodore 64 | VIC-II 40x25 text/graphics screen (C64, or C128 40-column) | pal-ntsc | build/stonehold-64.prg |
Autostarts to the Stonehold screen drawn with the custom character set: title on row 0, a map view on rows 1-23, status line (stone counter, seed, RUN/PAUSED) on row 24. Three dwarves move on their own to mine tiles the player marks with the mouse, joystick or keyboard. |
Single target.
c64: VIC-II 40x25 screen. Screen RAM at $0400 by default.Each criterion is observable. Criteria IDs (for example R1.2) are referenced by milestones and manual tests.
The game switches the VIC-II to an original custom character set: letters, digits and punctuation keep their usual shapes (copied from ROM at start), and new glyphs are defined for soft rock, hard rock, floor, marked rock, dwarf and cursor. Screen layout: row 0 title, rows 1-23 map view, row 24 status line.
Acceptance criteria:
Capabilities: text-ui, custom-charset
At the start of each game a 128x128 map is generated from a 16-bit seed: mostly soft rock, veins of hard rock, several random caverns, and an open starting cave near the centre where the three dwarves start. The same seed always gives the same map. The seed is shown on the status line.
Acceptance criteria:
Capabilities: text-ui
The 40x23 map view shows part of the 128x128 map. Moving the cursor within 2 tiles of a view edge scrolls the view one tile in that direction, stopping at the map borders. The view is redrawn by an assembly routine callable from C.
Acceptance criteria:
Capabilities: text-ui, custom-charset
Cursor keys or W/A/S/D move the dig cursor one tile; RETURN marks or unmarks the rock tile under the cursor. A joystick in port 2 moves the cursor (with key repeat), and fire marks or unmarks. Floor tiles cannot be marked.
Acceptance criteria:
Capabilities: keyboard-input, joystick-input
A 1351 mouse in control port 1 (proportional mode) moves a sprite pointer. The dig cursor is always the map tile under the pointer. The left button marks or unmarks that tile. Holding the pointer at a view edge scrolls the map. The mouse can be used at the same time as the joystick and keyboard.
Acceptance criteria:
Capabilities: mouse-1351, sprites
Three dwarves act on their own. An idle dwarf searches (breadth-first, within about 32 tiles) for the nearest marked tile that has a walkable neighbour, walks there at 2-4 steps per second, and mines it: soft rock takes about 1 second, hard rock about 3 seconds. Two dwarves never claim the same tile. A marked tile no dwarf can reach stays marked.
Acceptance criteria:
Capabilities: text-ui
Each mined tile adds one stone. The total is shown on row 24 as ‘STONE nnn’.
Acceptance criteria:
Capabilities: text-ui
SPACE pauses and resumes the simulation. While paused, dwarves and mining stop, the status line shows ‘PAUSED’, and the player can still scroll and mark tiles.
Acceptance criteria:
Capabilities: keyboard-input
SID effects: a short click when a tile is marked or unmarked, and a pick strike on each mining blow. No music.
Acceptance criteria:
Capabilities: sid-sound
The game detects PAL or NTSC at start and scales its timers so that dwarf speed and mining time are the same in seconds on both.
Acceptance criteria:
Capabilities: text-ui
“Practical default” means the Foundry proposed it and the user accepted it without a specific preference. It can be changed later through AGENTS.md section 6.
| Topic | Decision | Source |
|---|---|---|
| Controls | Commodore 1351 mouse in control port 1 (proportional mode): a sprite pointer, the dig cursor is the tile under the pointer, the left button marks/unmarks, the pointer at a view edge scrolls the map. Joystick in port 2: move the cursor, fire marks/unmarks. Keyboard: cursor keys or W/A/S/D move, RETURN marks/unmarks, SPACE pauses/resumes. All three can be used together. | decided by user |
| Visuals | Character mode with an original custom character set at $3800 (VIC bank 0, screen at $0400): codes 0-127 copied from the lower/upper-case ROM set so conio text (capital letters at screen codes 65-90) stays readable, codes 128+ hold the game's own glyphs (soft rock, hard rock, floor, marked rock, dwarf, cursor). Colours: rock brown, hard rock grey, floor dark grey, marked rock yellow, dwarves orange, cursor white, on a black background. The mouse pointer is hardware sprite 0. | decided by user |
| Sound | SID effects only: a mark/unmark click and a pick strike while mining. No music. | decided by user |
| Persistence (save/load) | None. Nothing is saved in the first release. | not applicable |
| File formats | None. A single PRG. | not applicable |
| Peripherals | Commodore 1351 mouse in control port 1; joystick in control port 2 (optional; keyboard works alone). No disk access after loading. | decided by user |
| Timing and memory budgets | Map 128x128 at one byte per tile (16 KB: tile type plus marked/claimed flags in the same byte). Pathfinding is a breadth-first search limited to a 65x65 window around the dwarf (about 4.2 KB scratch, shared by all dwarves, one search per frame at most). Dwarves move 2-4 steps per second. View redraw (40x23 tiles) in assembly within one frame. Input polled every frame. Program plus data must fit below $D000 with the charset at $3800. | decided by user |
| Map generation | 128x128 tiles from a visible 16-bit seed: mostly soft rock, veins of hard rock, several random caverns, a starting cave near the centre. Hard rock takes about three times as long to mine. | decided by user |
| Language split | C for game logic, map generation and pathfinding; ca65 assembly functions with C prototypes for the speed-critical parts (view redraw, frame wait, later anything profiling shows is too slow). | decided by user |
text-ui: Text screens, menus and status lines (PRINT / conio / KERNAL CHROUT).keyboard-input: Reading keys from the keyboard.joystick-input: Reading a joystick in control port 1 or 2.custom-charset: Redefined character sets.sprites: VIC-II hardware sprites.sid-sound: Sound effects or music through the SID.mouse-1351: Commodore 1351 mouse in proportional mode in control port 1 (cc65 drivers c64_1351_mou / c128_1351_mou, or POT reads in assembly). VICE emulates it on control port 1.| ID | Assumption | Status |
|---|---|---|
| A1 | cc65's statically linked 1351 driver (c64_1351_mou, mouse_install with mouse_def_callbacks) drives sprite 0 as the pointer and works alongside joystick reads on port 2. The Foundry verified (test brief mouse-1351-c) that the driver links and installs in VICE 3.10 with a 1351 on control port 1; pointer movement together with joystick and keyboard input is still to be checked by hand. | unverified |
| A2 | VICE emulates the 1351 on control port 1 with -controlport1device 3 (added to tools/run.ps1 and tools/smoke.ps1 automatically by the mouse-1351 capability). The host mouse must be grabbed with Alt+M (or -mouse) for the pointer to move. | confirmed |
| A3 | Memory map: screen $0400, custom charset $3800-$3FFF in VIC bank 0. Once the program (code, data, BSS including the 16 KB map) grows past $3800, the map or the charset must move (for example map at a fixed address above the program, or a custom ld65 config that reserves $3800-$3FFF and updating tools/build.ps1). The starter checks at run time that its BSS ends below $3800 and shows ‘MEMORY CLASH’ if not. | unverified |
| A4 | A breadth-first search over a 65x65 window, at most one search per frame, is fast enough that dwarves start walking within a second of a tile being marked. | unverified |
| A5 | Video standard is detected at start with get_tv(); timers are counted in frames and scaled for 50 Hz (PAL) and 60 Hz (NTSC). | default |
| A6 | VICE x64sc with default C64 model settings is a faithful reference for timing. | default |
| Date | Change | Approved by |
|---|---|---|
| 2026-11-26 | Charset layout: codes 0-127 from the lower/upper-case ROM set, game glyphs at 128+ (cc65 conio prints capitals at screen codes 65-90). | user |
| 2026-11-26 | R4 and Controls: RETURN marks/unmarks instead of D, because D also moves the cursor right (W/A/S/D). | user |
Powered by TurnKey Linux.