# Stonehold 64 - Milestones Work top to bottom, one task at a time (AGENTS.md section 4). Every task must leave all targets building. Requirement IDs refer to docs/spec.md. ## M0 - Starter builds and runs Goal: Prove the toolchain, emulator configuration and smoke test work before any feature work. Requirements: R1 | Task | Description | Requirements | Buildable outcome | Completion check | |---|---|---|---|---| | M0.1 | Run tools/check-prereqs.ps1, then tools/smoke.ps1 for every target. | R1 | Starter artifact(s) built: build/stonehold-64.prg | tools/smoke.ps1 exits 0 (or every target without automation is verified by hand), and the user confirms the M0 manual test. | Manual verification: see docs/manual-tests.md section M0. ## M1 - World and view Goal: A random 128x128 map exists and the player can scroll around it with the keyboard. Requirements: R1, R2, R3, R7 | Task | Description | Requirements | Buildable outcome | Completion check | |---|---|---|---|---| | M1.1 | Settle the memory map (A3): where the 16 KB map, the charset and the program live. Add a check that fails the build or shows an error if they overlap. | R1, R2 | Documented memory map in docs/ and a PRG that still passes the smoke test | build/stonehold-64.map shows no overlap; smoke test passes | | M1.2 | Map generator in C: seeded PRNG, soft rock, hard-rock veins, caverns, starting cave near the centre. Show the seed on row 24. | R2 | PRG that generates a map and shows 'SEED nnnnn' | Manual test MT1.1 | | M1.3 | Assembly view redraw (draw_view(x, y), C prototype) copying a 40x23 window of the map to screen and colour RAM. Each map byte is its own screen code with its colour in the low nibble (changed from a tile-to-glyph/colour table with user approval on 2026-11-26: the table version measured 22,754 PAL / 23,177 NTSC cycles, over one frame). | R3 | PRG with a full-view redraw inside one frame | Border-colour timing bar ends before the bottom of the screen on PAL and NTSC (manual test MT1.3); smoke check view_fast on PAL and NTSC | | M1.4 | Keyboard cursor (cursor keys and W/A/S/D) with edge scrolling and map-border clamping. Status line: 'STONE 000 SEED nnnnn RUN'. | R3, R7 | PRG in which the cursor moves and the view scrolls | Manual test MT1.2 | Manual verification: see docs/manual-tests.md section M1. ## M2 - Designation by keyboard, joystick and mouse Goal: The player can mark and unmark rock tiles with any of the three input devices. Requirements: R4, R5 | Task | Description | Requirements | Buildable outcome | Completion check | |---|---|---|---|---| | M2.1 | Mark/unmark with RETURN on rock tiles only; marked-rock glyph. Joystick port 2 cursor movement with key repeat and fire to mark. | R4 | PRG in which RETURN and fire toggle marks | Manual test MT2.1 | | M2.2 | 1351 mouse via cc65 c64_1351_mou: sprite 0 pointer, dig cursor = tile under the pointer tip, left button marks/unmarks, pointer at a view edge scrolls. Verify A1/A2 and record the exact VICE options in docs/. | R5 | PRG controllable by mouse | Manual test MT2.2 | Manual verification: see docs/manual-tests.md section M2. ## M3 - Dwarves at work Goal: Three dwarves mine marked tiles on their own; the stone counter and pause work, at the same speed on PAL and NTSC. Requirements: R6, R7, R8, R10 | Task | Description | Requirements | Buildable outcome | Completion check | |---|---|---|---|---| | M3.1 | Dwarf job system: idle dwarves claim the nearest reachable marked tile via a windowed breadth-first search (one search per frame at most), walk there, mine for a time that depends on the rock type, turn it into floor. | R6 | PRG in which dwarves mine marked tiles | Manual test MT3.1; timing bar for the search (A4) | | M3.2 | Stone counter increments per mined tile; SPACE pauses and resumes; marking still works while paused. | R7, R8 | PRG with a working counter and pause | Manual test MT3.2 | | M3.3 | Frame-based timers scaled for PAL and NTSC using get_tv(). | R10 | PRG with matching speed on both standards | Manual test MT3.3 | Manual verification: see docs/manual-tests.md section M3. ## M4 - Sound Goal: The game gives audible feedback for marking and mining. Requirements: R9 | Task | Description | Requirements | Buildable outcome | Completion check | |---|---|---|---|---| | M4.1 | SID effects (assembly or C): mark/unmark click on one voice, pick strike on another, silenced while paused. | R9 | PRG with sound effects | Manual test MT4.1 | Manual verification: see docs/manual-tests.md section M4.