Approved by Daniel Covington on 2026-12-03. Changes to this file follow AGENTS.md section 6.
Changes approved by the user since then:
A C64 program written in 6502 assembly that procedurally generates a 2x2-screen landscape world (light brown land, grey stone, green grass and trees, blue water) shown as a multicolour bitmap. The cursor keys scroll the view smoothly across the world. 16 people, drawn as white dots, wander the world but are blocked by water and stone. Where they walk often they wear dark brown paths into the land, which fade again when they are no longer used. Two bitmap buffers are flipped each update, and only the spots where people move are redrawn.
Original idea, as given:
okay I want to start a c64 project in assembly that will procedurally generate a hi res color bitmap of a map of a land with brown land grey stone green grass and trees and black for roads colors. I would like to see if we can add people as tan dots and use buffer fliping to show movent of the people on the map .. you can ask me questions if this is not cleaar
Smallest useful version: A 2x2-screen world generated from a seed at start-up, shown one screen at a time in multicolour bitmap mode, pixel-smooth scrolling with the cursor keys, 16 white people moving over land, grass, trees and paths (not water or stone), flicker-free via two flipped buffers with only the people's spots redrawn, and SPACE for a new world.
A generated 2x2-screen world in multicolour bitmap mode with pixel-smooth cursor-key scrolling, a 5-line status area below the map showing the chosen person, 16 moving people blocked by water and stone, double-buffered partial redraw, and SPACE for a new world.
| Target | Machine / mode | Display | Video | Artifact | Expected behavior |
|---|---|---|---|---|---|
c64 |
Commodore 64 | VIC-II 40x25 text/graphics screen (C64, or C128 40-column) | ntsc | build/land-map-64.prg |
Autostarts, shows a short generating message, then a multicolour bitmap view of the world (20 rows): light brown land, grey stone, green grass and trees, blue water, with the chosen person's name, sex and scores in the text area below it. White dots move on the land and wear paths into it. Cursor keys scroll the view smoothly; SPACE generates a new world. |
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.
At start-up the program generates a world of 2x2 screens (80x50 cells of 4x8 multicolour pixels) from a seed. Terrain covers the whole world: lakes, meadows with trees, rocky outcrops and open light brown land are spread all over it, not gathered in a few places. Each world rolls its own mix of the four terrain kinds (land, grass and trees, water, stone), so one world may be wet and another rocky. No roads are generated: paths appear where the people walk (R7). The view shows a 40x20-cell window of it in multicolour bitmap mode, above the status area (R6).
Acceptance criteria:
Capabilities: smooth-animation
16 people, each a single white multicolour pixel, are spread over the world and move on their own. Water and stone block them: they walk only on land, grass, trees and paths. People inside the view are drawn; others keep moving unseen.
Acceptance criteria:
Capabilities: smooth-animation
While the view is still, people are drawn into the hidden bitmap buffer, which is then flipped into view during vertical blank. While the view scrolls, the hidden buffer is being rebuilt for the next scroll step, so people are restored and drawn in the shown buffer during vertical blank, before the first map line, and the rebuilt buffer is flipped in at the scroll step. Each update restores only the bitmap bytes under people at their previous positions in that buffer and draws them at their new positions; apart from the scroll rebuild, the rest of the map is never redrawn.
Acceptance criteria:
Capabilities: smooth-animation, raster-interrupts
Pressing SPACE generates and shows a different world, with the 16 people placed on it.
Acceptance criteria:
Capabilities: keyboard-input
Holding a cursor key scrolls the view across the world one hires pixel per frame in that direction, using the VIC-II fine-scroll registers ($D016, $D011) in the 20-row map area in 38-column mode. Every 8 pixels the view shifts by one cell: the hidden buffer is rebuilt from the world data over the preceding frames and flipped in at the moment the fine scroll wraps. Scrolling stops at the world edges. The status area below the map does not scroll.
Acceptance criteria:
Capabilities: keyboard-input, smooth-animation, raster-interrupts
Below the 20-row map, five rows of 40-column text in the upper-case ROM font, white on light brown. Since M6.2 they show only the chosen person (R8): line 1 their number, name and sex, line 2 their six scores; lines 3-5 are blank. (Before M6.2 they showed the title, the view position, the number of people in view, the scores and key help; the user removed those.) A raster split switches the VIC-II from multicolour bitmap to text at the boundary every frame; the text area never scrolls.
Acceptance criteria:
Capabilities: raster-interrupts
Every cell of the world keeps a walk count. Each time a person steps into a cell its count goes up by one; every 60 seconds every count goes down by one. A land, grass or tree cell whose count reaches 128 becomes a path: a worn, dark brown patch. A path whose count falls below 64 turns back into the terrain it was. People walk on paths like on land. The counts and paths belong to the world: SPACE starts again with no paths.
Acceptance criteria:
Capabilities: smooth-animation
Each of the 16 people is male or female (at random, 50/50) and has a random name of two or three syllables from a male or female syllable list (up to 10 letters), and six scores, as in D&D: strength, dexterity, constitution, intelligence, wisdom and charisma. Each score is rolled with three six-sided dice (3-18) when a world is made, and stored as one byte. For now the scores are only shown; they do not change how people move. The status lines show one person at a time: P01 ALDRIC M and STR12 DEX09 CON15 INT10 WIS08 CHA13. Each press of P shows the next person (after 16 comes 1); holding P does not repeat. The chosen person's dot blinks on the map (left out for 16 of every 32 frames) so it can be found. SPACE rolls new names, sexes and scores for the new world and shows person 1.
Acceptance criteria:
Capabilities: keyboard-input
“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 | Cursor keys scroll the view. On a real C64 these are CRSR down/right, plus SHIFT for up/left; the keyboard matrix is read directly so a key held down scrolls continuously. VICE maps the PC arrow keys to them. SPACE generates a new world. P shows the next person's scores (R8; a letter key, chosen by the user: the C64 has no Tab key). Known limitation (accepted by the user, 2026-12-03): SHIFT applies to both cursor keys, so only the Right + Down and Left + Up diagonals work; Up + Right and Down + Left come out as Up + Left (VICE sends the PC Up and Left arrows as SHIFT + CRSR). | decided by user |
| Visuals | Multicolour bitmap mode (160x200, double-wide pixels) for a 38-column map area 20 cell rows high, smooth-scrolled; below it a raster split to a fixed 5-row, 40-column text status area in the upper-case ROM font, white on light brown. Light brown (C64 colour 8 (named orange), which VICE's pepto-pal palette (measured from PAL C64s) shows as light brown; tools/run.ps1 starts VICE with that palette) is the shared background colour; white is the colour-RAM colour in every cell, so people can be drawn anywhere without colour clash and colour RAM never needs scrolling. The two screen-RAM colours of each 4x8 cell come from grey (stone), green (grass and trees), blue (water) and dark brown (paths). The world is stored as one tile byte per 4x8 cell; each tile is drawn from a small set of 8-byte pixel patterns (including edge and corner patterns) so shorelines look natural. | decided by user |
| Sound | None in the first release. | practical default |
| Persistence (save/load) | None. Maps and seeds are not saved. | practical default |
| File formats | None. A single PRG. | practical default |
| Peripherals | Keyboard only. No disk access after loading, no joystick. | practical default |
| Timing and memory budgets | NTSC: 60 Hz, 17,095 cycles per frame (263 lines x 65 cycles, the NTSC VIC-II 6567R8 that x64sc emulates). Per frame: fine-scroll update, one slice of the hidden-buffer rebuild (about 7,600 bytes of bitmap and screen RAM, 20 map rows plus one partial row, spread over 8 frames), and restoring and redrawing visible people; together under one frame. World data about 4 KB; two bitmap buffers with their screen RAM about 18 KB. World generation may take several seconds (since M4.1 about 4 seconds, behind the generating message; the map is ready about 7 seconds after power-on). | practical default |
| Memory layout | Buffer A in VIC bank 1 and buffer B in VIC bank 2, each with its own 8 KB bitmap and 1 KB screen RAM; flipping switches bank bits in $DD00 during vertical blank. Each bank also holds a 1 KB status text screen (bank + $0400) and a 2 KB copy of the upper-case ROM font (bank + $0800), at the same offsets so a flip still changes only $DD00. Colour RAM is shared and constant (white), which is also the status text colour. Program, tables and variables (world tiles, people and their scores) lie below $4000; the 4,000 walk counts (R7) use the free RAM at $C000-$CF9F. | practical default |
| Rebuild source | The hidden buffer is rebuilt from the tile world, never copied from the visible buffer, so people's dots are never copied into the new view. Since M4.1 the rebuild first puts back the bytes under the buffer's own people and then skips every cell whose tile is already drawn there (most cells, as terrain comes in areas), so textured terrain everywhere still rebuilds within 8 frames. | practical default |
| Seed | The seed comes from the CIA timer at start-up and at each SPACE press. It is not shown or saved in the first release. | practical default |
keyboard-input: Reading keys from the keyboard.smooth-animation: Several objects updated every frame or every few frames in a steady frame-locked loop.raster-interrupts: Cycle-sensitive raster interrupts, raster splits or stable raster timing.| ID | Assumption | Status |
|---|---|---|
| A1 | People and status text are white (C64 colour 1) so the dots stand out (changed from light red, colour 10, by the user on 2026-12-03). | confirmed |
| A2 | The map generator keeps every 4x8 cell to at most two of grey, green, blue and black (besides the light brown background). Where three would meet, for example a road along a shoreline next to grass, it changes the least-represented colour in that cell. | default |
| A3 | Each buffer has its own bitmap and screen RAM in a separate VIC bank (banks 1 and 2), flipped via $DD00 in vertical blank; colour RAM is shared and constant. | unverified |
| A4 | Rebuilding the hidden buffer from tile patterns (about 7,600 bytes) can be spread over 8 frames alongside the people update within the NTSC frame budget, which allows 1 pixel per frame scrolling. | partly met (measured 2026-12-03 in VICE x64sc NTSC, accepted by the user): since M4.1 the rebuild skips cells already drawn; in the long tour 99% of rebuilds take 6-8 frames, 13 of 1,928 take 9 or more, pausing the scroll for one frame in 0.8% of scrolling frames (M3.4, before terrain everywhere: 1.7%); not noticeable in use |
| A5 | The smoke test cannot read a bitmap. The program writes a status mirror (“LAND MAP 64”, “MAP READY”) into the unused text screen at $0400 once the first view is shown; the smoke test checks that text, and the VICE screenshot shows the map. | default |
| A6 | The catalog has no bitmap-graphics capability. Multicolour bitmap mode and VIC bank switching are documented in Mapping the Commodore 64 (53265 $D011, 53270 $D016, 53272 $D018, 56576 $DD00); a catalog update is proposed separately. | unverified |
| A7 | Switching from the fine-scrolled multicolour bitmap to fixed text (and back at the top of the frame) with raster interrupts gives a steady split in VICE x64sc NTSC with no bad-line glitches at the boundary, whatever the map's vertical fine-scroll value. | unverified |
| A8 | C64 colour 8 looks light brown in VICE with the pepto-pal palette, which tools/run.ps1 selects. With VICE's default NTSC colours it looks salmon-orange, and on real hardware it depends on the machine and TV. | default |
| ID | Question | Default until decided | Status |
|---|---|---|---|
| D1 | Should stone block people as well as water? | Yes: both water and stone block people (agent's reading of “yes block”). | open |
Powered by TurnKey Linux.