diff --git a/README.md b/README.md index fdbd320..dcd420f 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 (brown land, grey stone, green grass and trees, black roads, blue water) shown as a multicolour bitmap. The cursor keys scroll the view smoothly across the world. 16 people, drawn as light red dots, wander the world but are blocked by water and stone. 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, black roads, blue water) shown as a multicolour bitmap. The cursor keys scroll the view smoothly across the world. 16 people, drawn as light red dots, wander the world but are blocked by water and stone. 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)) @@ -43,7 +43,7 @@ configuration is not touched. Screenshots are saved to `build/smoke//`. pwsh -File tools/run.ps1 -Target c64 ``` -Expected screen: A multicolour bitmap test screen: brown background with vertical bands of grey, green, blue and black, and a row of light red dots. Every second the buffers flip; buffer B shows the bands shifted by one cell, so the picture visibly alternates, proving both buffers and the flip work. Status mirror in the hidden text screen: row 0 "LAND MAP 64", row 2 "STARTER OK". +Expected screen: A multicolour bitmap test screen: light brown background with vertical bands of grey, green, blue and black, and a row of light red dots. Every second the buffers flip; buffer B shows the bands shifted by one cell, so the picture visibly alternates, proving both buffers and the flip work. Status mirror in the hidden text screen: row 0 "LAND MAP 64", row 2 "STARTER OK". ## Start the implementation agent diff --git a/docs/manual-tests.md b/docs/manual-tests.md index 0b33ff0..a250ba3 100644 --- a/docs/manual-tests.md +++ b/docs/manual-tests.md @@ -21,7 +21,7 @@ Steps: Expected: - tools/smoke.ps1 prints `[PASS] c64`; screenshot in build/smoke/c64/. -- A multicolour bitmap test screen: brown background with vertical bands of grey, green, blue and black, and a row of light red dots. Every second the buffers flip; buffer B shows the bands shifted by one cell, so the picture visibly alternates, proving both buffers and the flip work. Status mirror in the hidden text screen: row 0 "LAND MAP 64", row 2 "STARTER OK". +- A multicolour bitmap test screen: light brown background with vertical bands of grey, green, blue and black, and a row of light red dots. Every second the buffers flip; buffer B shows the bands shifted by one cell, so the picture visibly alternates, proving both buffers and the flip work. Status mirror in the hidden text screen: row 0 "LAND MAP 64", row 2 "STARTER OK". ## M1 - World generation and static view @@ -31,7 +31,7 @@ Setup: VICE x64sc, NTSC (-ntsc), warp off. Start: `pwsh -File tools/run.ps1 -Target c64` At M1.1, wait for the static test view and inspect any of the four matching panels. -Each panel shows brown land, green grass and trees, grey stone, and a blue pool +Each panel shows light brown land, green grass and trees, grey stone, and a blue pool with shoreline edges and corners. The black roads meet at crossings and bend around a small loop on the right. Check that roads join without gaps and that the terrain shows only its intended colours. @@ -49,7 +49,7 @@ Steps: 2. Inspect the screen. Expected: -- Brown land, grey stone, green grass and trees, blue water and black roads are visible (some may be off-screen until M3) +- Light brown land, grey stone, green grass and trees, blue water and black roads are visible (some may be off-screen until M3) - Roads are continuous - No colour clash in any cell @@ -66,7 +66,7 @@ Steps: 3. Hold SPACE for about two seconds and release it. Expected: -- Look for brown land, green grass and trees, grey stone, blue water, and black roads with no gaps at crossings or stray colours. +- Look for light brown land, green grass and trees, grey stone, blue water, and black roads with no gaps at crossings or stray colours. - A visibly different map appears after each tap. - Holding SPACE generates one new map. The map stays steady until the next press. @@ -117,6 +117,10 @@ Verifies: R3 ## M3 - Pixel-smooth scrolling +Colours: `tools/run.ps1` starts VICE with the pepto-pal palette, in which the background +(C64 colour 8) is light brown. If you start VICE another way, select that palette +(Settings > Video > Palette) or the background looks salmon-orange. + ### MT3.1: Smooth scrolling (c64) Setup: VICE x64sc, NTSC (-ntsc), warp off. @@ -146,7 +150,7 @@ Expected: Down stops at VIEW Y 30 (row 49 at the bottom); Left and Up stop at 0. Holding a key against an edge does nothing. - Diagonal scrolling moves smoothly on both axes. -- Across the whole world you see all five terrain colours (brown land, green grass and +- Across the whole world you see all five terrain colours (light brown land, green grass and trees, grey stone, blue water, black roads). - SPACE still generates a new map, and the view starts again at the top-left (0, 0). @@ -178,7 +182,7 @@ Verifies: R2, R3, R5 ### MT3.4: Frame budget timing bar (c64, M3.4) -Setup: VICE x64sc, NTSC (-ntsc), warp off. +Setup: VICE x64sc, NTSC (-ntsc), pepto-pal palette (tools/run.ps1 selects it), warp off. Start: `pwsh -File tools/run.ps1 -Target c64 -TimingBar` (a separate build, `build/land-map-64-timing.prg`; the normal program is not changed). @@ -190,17 +194,17 @@ The border colour shows what the CPU is doing during each frame: | yellow | keys, status text, people movement | | cyan | rebuilding the hidden buffer for the next scroll step | | red | raster interrupt (the split to the status area, and the top of the frame) | -| brown | idle, waiting for the next frame | +| light brown | idle, waiting for the next frame | Steps: 1. Leave the view still for a few seconds. 2. Hold a cursor key and watch the border while the map scrolls. Expected: -- View still: the border is mostly brown, with a thin red stripe at the status split +- View still: the border is mostly light brown, with a thin red stripe at the status split (the white and yellow work happens in lines the border mostly does not show). - Scrolling: the border is cyan down to near the bottom of the screen (the rebuild uses - the frame's spare time), with the red stripe at the split and a little brown below. + the frame's spare time), with the red stripe at the split and a little light brown below. - In both cases the border pattern is steady from frame to frame, not rolling or jumping: the program keeps up with every frame. (Small specks at colour changes are normal for a border-colour timing bar.) @@ -219,7 +223,7 @@ Steps: 4. Hold each cursor key (and Right + Down, Left + Up) and watch the text and the boundary while the map scrolls, especially while it scrolls up and down. Expected: -- The map fills the top 20 cell rows; five lines of light red upper-case text on brown sit below it: +- The map fills the top 20 cell rows; five lines of light red 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`. - 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. diff --git a/docs/spec.md b/docs/spec.md index 670b02c..1a41eb2 100644 --- a/docs/spec.md +++ b/docs/spec.md @@ -7,10 +7,11 @@ Changes approved by the user since then: - 2026-12-03: 5-line status area below a 20-row map (R6; R1 and R5 updated; milestone M3 gained the split-screen task). - 2026-12-03: R3 reworded for scrolling: while a scroll rebuild runs, people are drawn in the shown buffer during vertical blank; drawing people relative to the view moved from M3.4 to M3.3. - 2026-12-03: A4 status recorded from the M3.4 measurement as partly met; the user accepted the occasional one-frame scroll pause. +- 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. ## Summary -A C64 program written in 6502 assembly that procedurally generates a 2x2-screen landscape world (brown land, grey stone, green grass and trees, black roads, blue water) shown as a multicolour bitmap. The cursor keys scroll the view smoothly across the world. 16 people, drawn as light red dots, wander the world but are blocked by water and stone. 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, black roads, blue water) shown as a multicolour bitmap. The cursor keys scroll the view smoothly across the world. 16 people, drawn as light red dots, wander the world but are blocked by water and stone. Two bitmap buffers are flipped each update, and only the spots where people move are redrawn. Original idea, as given: @@ -25,7 +26,7 @@ A generated 2x2-screen world in multicolour bitmap mode with pixel-smooth cursor ### In scope - Procedural generation of a 2x2-screen world (80x50 cells of 4x8 multicolour pixels) from a seed -- Terrain colours: brown land (background), grey stone, green grass and trees, blue water, black roads that connect +- Terrain colours: light brown land (background), grey stone, green grass and trees, blue water, black roads that connect - Pixel-smooth scrolling of the view with the cursor keys, using the VIC-II fine-scroll registers and a double-buffered coarse shift - 16 people as light red 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 @@ -49,7 +50,7 @@ A generated 2x2-screen world in multicolour bitmap mode with pixel-smooth cursor | 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): brown land, grey stone, green grass and trees, blue water, black roads, with 5 lines of status text below it. Light red dots move on land and roads. Cursor keys scroll the view smoothly; SPACE generates a new world. | +| `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, black roads, with 5 lines of status text below it. Light red dots move on land and roads. Cursor keys scroll the view smoothly; SPACE generates a new world. | ### Dual-target and mode notes @@ -70,11 +71,11 @@ Each criterion is observable. Criteria IDs (for example R1.2) are referenced by ### R1 - Generated 2x2-screen world (must) -At start-up the program generates a world of 2x2 screens (80x50 cells of 4x8 multicolour pixels) from a seed. The generator decides the layout, shapes and counts of features; every world contains brown land, grey stone, green grass and trees, blue water and black roads that connect to each other. The view shows a 40x20-cell window of it in multicolour bitmap mode, above the status area (R6). +At start-up the program generates a world of 2x2 screens (80x50 cells of 4x8 multicolour pixels) from a seed. The generator decides the layout, shapes and counts of features; every world contains light brown land, grey stone, green grass and trees, blue water and black roads that connect to each other. The view shows a 40x20-cell window of it in multicolour bitmap mode, above the status area (R6). Acceptance criteria: - [R1.1] After autostart in VICE (x64sc, NTSC) the map view appears within 15 seconds -- [R1.2] Scrolling across the whole world shows all five terrain colours: brown, grey, green, blue and black +- [R1.2] Scrolling across the whole world shows all five terrain colours: light brown, grey, green, blue and black - [R1.3] Roads are continuous black lines that connect to each other - [R1.4] No colour clash: every 4x8 cell shows only its intended colours @@ -126,7 +127,7 @@ 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, light red on 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, light red 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. 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 @@ -142,7 +143,7 @@ Capabilities: raster-interrupts | 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. | 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, light red on brown. Brown is the shared background colour; light red 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 black (roads). 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 and roads look natural. | 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, light red 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; light red 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 black (roads). 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 and roads 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 | @@ -163,12 +164,13 @@ Capabilities: raster-interrupts | ID | Assumption | Status | |---|---|---| | A1 | Light red (C64 colour 10) stands in for tan, as the C64 has no tan. | confirmed | -| A2 | The map generator keeps every 4x8 cell to at most two of grey, green, blue and black (besides brown). Where three would meet, for example a road along a shoreline next to grass, it changes the least-represented colour in that cell. | default | +| 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): most rebuilds take 7-8 frames; about 6% take 9-10 when many people are in view, pausing the scroll for one frame (1.7% of scrolling frames); 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 | ## Unresolved decisions diff --git a/docs/toolchain.md b/docs/toolchain.md index e5ee0c9..55cc838 100644 --- a/docs/toolchain.md +++ b/docs/toolchain.md @@ -52,7 +52,7 @@ Starter configurations marked verified were exercised by the Foundry's automated - Status: **verified** starter configuration (cc65, c64/vicii-40, asm-ca65) - Build (what tools/build.ps1 runs): `cl65 -t c64 -g -C c64-asm.cfg -u __EXEHDR__ -D FOUNDRY_TARGET_C64 -I src -o build/land-map-64.prg -Ln build/land-map-64.lbl -m build/land-map-64.map src/*.c src/*.s` -- Emulator: `x64sc -ntsc -autostart build/land-map-64.prg` +- Emulator: `x64sc -ntsc -VICIIextpal -VICIIpalette pepto-pal.vpl -autostart build/land-map-64.prg` (the palette shows the background, C64 colour 8, as light brown; spec A8). The headless checks do not depend on the palette. - Smoke test: `pwsh -File tools/smoke.ps1 -Target c64`. It runs VICE headless for 30000000 cycles, saves memory when the program reaches `smoke_ready`, and checks: - Title in the status mirror - World generation reached its ready point (`MAP READY`) diff --git a/docs/verification-status.md b/docs/verification-status.md index 89cf876..bcd9271 100644 --- a/docs/verification-status.md +++ b/docs/verification-status.md @@ -21,6 +21,8 @@ manual = `pending`, `confirmed by user ()`, `problem reported ():