diff --git a/README.md b/README.md index 9577e4a..acfc432 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Land Map 64 -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. +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. Each person has six D&D-style scores (3d6); P steps through the people, showing their scores below the map and making their dot blink. Two bitmap buffers are flipped each update, and only the spots where people move are redrawn. - Targets: `c64` (details in [docs/spec.md](docs/spec.md)) - Language/toolchain: 6502 assembly (ca65) - Windows cross-development with cc65 (C, ca65 assembly or mixed) and VICE ([docs/toolchain.md](docs/toolchain.md)) diff --git a/docs/manual-tests.md b/docs/manual-tests.md index 83be09e..70a51ef 100644 --- a/docs/manual-tests.md +++ b/docs/manual-tests.md @@ -226,7 +226,8 @@ Steps: Expected: - The map fills the top 20 cell rows; five lines of white upper-case text on light brown sit below it: - `LAND MAP 64`, `VIEW X 00 Y 00`, `PEOPLE IN VIEW nn OF 16`, an empty line, `CRSR SCROLL SPACE NEW WORLD`. + `LAND MAP 64`, `VIEW X 00 Y 00`, `PEOPLE IN VIEW nn OF 16`, the chosen person's scores (since M6, + `P01 STR..`; an empty line before), `CRSR SCROLL SPACE NEW WORLD P PERSON` (before M6 without `P PERSON`). - The people-in-view number equals the number of dots you can count on the map. - The boundary is a clean, steady horizontal line: no flicker, jitter, garbage characters or half-height rows. - The text never moves while the map scrolls, and the boundary stays clean at every vertical scroll position. @@ -324,3 +325,30 @@ Expected: - SPACE gives a new world with no paths. Verifies: R7 + +## M6 - People's attributes + +### MT6.1: People's attributes (c64) + +Setup: VICE x64sc, NTSC (-ntsc), pepto-pal palette (tools/run.ps1 selects it), warp off. +Start: `pwsh -File tools/run.ps1 -Target c64` + +Automated first: `pwsh -File tools/check-keys.ps1` should end with `[PASS]`. + +Steps: +1. Wait for the map and read status line 4 (the line above the key help). +2. Press P a few times, then hold P down for a second. +3. Press P until it shows P16, then once more. +4. Scroll around while a person is chosen; find their dot. +5. Press SPACE. + +Expected: +- Line 4 reads like `P01 STR12 DEX09 CON15 INT10 WIS08 CHA13`; every score is 3-18. +- Each press shows the next person with their own scores; holding P moves on only once. +- After P16 comes P01. +- The chosen person's dot blinks about twice a second when it is in view; the map and the other + dots stay steady, also while scrolling. +- The key help line ends with `P PERSON`. +- SPACE gives a new world with new scores and shows P01. + +Verifies: R8, R6 diff --git a/docs/milestones.md b/docs/milestones.md index 3d4ebc7..d0d1262 100644 --- a/docs/milestones.md +++ b/docs/milestones.md @@ -81,3 +81,15 @@ Requirements: R7, R1, R2, R3, R5 | M5.2 | Worn paths: a walk count per cell (4,000 bytes), +1 when a person steps into a cell, -1 for every cell every 60 seconds (10 cells every 9 frames); at 128 a land, grass or tree cell becomes a path tile (dark brown patch, one per terrain so it can turn back), below 64 it turns back. Changed cells are redrawn in each buffer while it is hidden (people's dots and saved bytes kept), so the shown map never tears; a buffer in the middle of a rebuild restarts it in full. A test build (PATH_TEST: path at 4, back below 2, one count less every 400 frames) makes it checkable. | R7, R2, R3, R5 | Busy cells turn into paths, unused paths fade | `pwsh -File tools/check-paths.ps1`, `tools/check-scroll.ps1 -Long`, `tools/check-scroll.ps1 -Long -PathTest`; manual test MT5.2 | Manual verification: see docs/manual-tests.md section M5. + +## M6 - People's attributes + +Goal: Every person has D&D-style scores that the player can look at one person at a time. + +Requirements: R8, R6, R2, R3 + +| Task | Description | Requirements | Buildable outcome | Completion check | +|---|---|---|---|---| +| M6.1 | Six scores per person (STR, DEX, CON, INT, WIS, CHA; 3d6, one byte each, 96 bytes), rolled with the people for every new world. P (new press only) steps to the next person; status line 4 shows 'Pnn' and the six scores, rewritten only when the person changes, on a frame without the status update. The chosen person's dot is left out of the people draw for 16 of every 32 frames (draw_skip, which the checks read to know which dots to expect). The walk counts move to $C000 to make room below $4000. | R8, R6, R2, R3 | Scores per person, shown with P; the chosen person blinks | `pwsh -File tools/check-keys.ps1` (P held: one step; scores 3-18; status line 4 matches), `tools/check-people.ps1`, `tools/check-scroll.ps1 -Long`; manual test MT6.1 | + +Manual verification: see docs/manual-tests.md section M6. diff --git a/docs/spec.md b/docs/spec.md index 3258b9c..2d47b9b 100644 --- a/docs/spec.md +++ b/docs/spec.md @@ -10,6 +10,7 @@ Changes approved by the user since then: - 2026-12-03: Background (land, border and status area) changed from brown (colour 9) to 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 (new assumption A8). Tree trunks stay colour 9. - 2026-12-03: Terrain all over the world ("the different land spaces need to be all over the map, not just here and there"): R1 reworded; new criteria R1.5 (every view shows at least three terrain kinds) and R1.6 (each world rolls its own random terrain mix). Roads stay a grid and cross water on bridges. New milestone M4. - 2026-12-03: Worn paths instead of roads ("keep track of where the people walk and when the counter hits 128 then it is a path/road but the number can be reduced by one every certain number of cycles"; "remove their creation"): the generator makes no roads (R1 text, R1.2, R1.3); new R7 worn paths (dark brown patches, appear at 128, fade below 64, counts go down by one every 60 seconds, all chosen by the user); new milestone M5. +- 2026-12-03: People's attributes ("now we need to give each person attributes like D&D"): new R8. Each person has six scores (strength, dexterity, constitution, intelligence, wisdom, charisma), rolled 3d6 when a world is made and stored one byte each; shown only, they do not change behaviour. P (a letter key, chosen by the user instead of Tab, which the C64 does not have) steps through the people; status line 4 (the spare line, R6) shows the chosen person's number and scores, and that person's dot blinks on the map. New milestone M6. ## Summary @@ -33,7 +34,8 @@ A generated 2x2-screen world in multicolour bitmap mode with pixel-smooth cursor - 16 people as white dots (one multicolour pixel each), spread over the world, blocked by water and stone; only those in view are drawn - Two bitmap buffers flipped once per update; only the bytes under people are restored and redrawn between scroll steps - SPACE generates a new world -- A 5-line text status area below a 20-row map, using a raster split: title, view position, people in view, a spare line and key help +- A 5-line text status area below a 20-row map, using a raster split: title, view position, people in view, the chosen person's scores and key help +- Six D&D-style scores per person (3d6 each), shown one person at a time; P picks the next person, whose dot blinks - NTSC timing ### Out of scope @@ -41,7 +43,7 @@ A generated 2x2-screen world in multicolour bitmap mode with pixel-smooth cursor - PAL support - Worlds larger than 2x2 screens - Sprites for people -- People with goals, pathfinding or interaction +- People with goals, pathfinding or interaction; scores that change how people behave - Sound and music - Saving worlds or seeds - Joystick @@ -131,10 +133,10 @@ Capabilities: keyboard-input, smooth-animation, raster-interrupts ### R6 - Status area (must) -Below the 20-row map, five rows of 40-column text in the upper-case ROM font, white on light brown, show: the title, the view position (top-left cell of the view), the number of people in view out of 16, a spare line, and key help. A raster split switches the VIC-II from multicolour bitmap to text at the boundary every frame; the text area never scrolls. +Below the 20-row map, five rows of 40-column text in the upper-case ROM font, white on light brown, show: the title, the view position (top-left cell of the view), the number of people in view out of 16, the chosen person's scores (R8; a spare line before M6), and key help. A raster split switches the VIC-II from multicolour bitmap to text at the boundary every frame; the text area never scrolls. Acceptance criteria: -- [R6.1] The five status lines appear below the map whenever the map is shown: title, view position, people in view, a spare line and key help +- [R6.1] The five status lines appear below the map whenever the map is shown: title, view position, people in view, the chosen person's scores (R8) and key help - [R6.2] The status text and the split line between map and text stay steady (no jitter, flicker or tearing) while people move and while the view scrolls - [R6.3] The view position shown matches the view's top-left cell and changes as the view scrolls; the people-in-view count matches the dots visible in the map @@ -153,20 +155,33 @@ Acceptance criteria: Capabilities: smooth-animation +### R8 - People's attributes (must) + +Each of the 16 people has six scores, as in D&D: strength, dexterity, constitution, intelligence, wisdom and charisma. Each 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. Status line 4 shows one person at a time: `P01 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 scores for the new world and shows person 1. + +Acceptance criteria: +- [R8.1] Every person has six scores from 3 to 18, rolled 3d6 when a world is made; SPACE rolls new ones +- [R8.2] Status line 4 shows the chosen person's number (1-16) and six scores, labelled STR, DEX, CON, INT, WIS and CHA; person 1 is shown after a new world +- [R8.3] Each press of P shows the next person, after 16 comes 1; a held P counts once +- [R8.4] The chosen person's dot blinks about twice a second, wherever they are in the view, without disturbing the map or the other dots +- [R8.5] The scores do not change how people move + +Capabilities: keyboard-input + ## Design decisions "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. 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 | +| 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. | 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 | diff --git a/docs/verification-status.md b/docs/verification-status.md index 29b28b3..020a36a 100644 --- a/docs/verification-status.md +++ b/docs/verification-status.md @@ -21,9 +21,16 @@ manual = `pending`, `confirmed by user ()`, `problem reported ():