Преглед изворни кода

Spec + code: light brown background (colour 8 with VICE pepto-pal palette)

User found the brown background too orange. The C64 has no light brown;
the user chose colour 8 shown with VICE's pepto-pal palette from rendered
comparisons. COL_BACKGROUND = 8 for background, border and status area;
tree trunks stay colour 9. tools/run.ps1 and smoke get the palette via
project.json emulator args. New assumption A8.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main
Daniel Covington пре 2 дана
родитељ
комит
b9b8701693
9 измењених фајлова са 65 додато и 44 уклоњено
  1. +2
    -2
      README.md
  2. +14
    -10
      docs/manual-tests.md
  3. +10
    -8
      docs/spec.md
  4. +1
    -1
      docs/toolchain.md
  5. +2
    -0
      docs/verification-status.md
  6. +24
    -14
      project.json
  7. +6
    -4
      src/main.s
  8. +3
    -2
      src/tiles.inc
  9. +3
    -3
      tools/check-split.ps1

+ 2
- 2
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/<target>/`.
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


+ 14
- 10
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.


+ 10
- 8
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



+ 1
- 1
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`)


+ 2
- 0
docs/verification-status.md Прегледај датотеку

@@ -21,6 +21,8 @@ manual = `pending`, `confirmed by user (<date>)`, `problem reported (<date>): <n

## Notes

- 2026-12-03 (colour change, approved by the user): During M3.4 manual testing the user found the background orange ("should be light brown"). The C64 has no light brown; from rendered VICE comparisons the user chose C64 colour 8 shown with VICE's pepto-pal palette (light brown). src/main.s COL_BACKGROUND = 8 (background, border, status area); tree trunks stay colour 9; project.json emulator args select the palette for tools/run.ps1 and tools/smoke.ps1. Checks after the change: `pwsh -File tools/build.ps1`, `tools/smoke.ps1`, `tools/check-world.ps1`, `tools/check-people.ps1`, `tools/check-keys.ps1`, `tools/check-split.ps1`, `tools/check-scroll.ps1` all exit 0 (2026-12-03); the smoke screenshot shows the light brown background. Observation: the light red dots have less contrast on light brown than on brown. The M3.4 manual tests (MT3.2, MT3.3, MT3.4) stay pending with the new colour.

- 2026-12-03 (M3.4): Frame budget measured with tools/check-scroll.ps1 (CPU clock at frame_start, people_moved, frame_done, interrupt entry/exit, start_rebuild, rebuild_ready), all in VICE x64sc NTSC:
- Frame start to frame start: 16,758-17,109 cycles (17,095 per frame; wait_frame returns anywhere in lines 251-262). No frame was missed in any run.
- Raster interrupts (top of frame and status split, including the split's wait for line 210): 411-416 cycles per frame.


+ 24
- 14
project.json Прегледај датотеку

@@ -12,14 +12,15 @@
"Round 4: cursor keys scroll a bigger world (2x2 screens), pixel-smooth scrolling in the first release (user chose it over block steps), people spread over the world, SPACE = new world. Destination left at the default.",
"Spec approved 2026-12-03 without changes; D1 (stone blocks people) left open at its default.",
"2026-12-03 change (approved): 5-line status area below a 20-row map via a raster split (R6); status readout in upper-case ROM text, light red; split task inserted as M3.2, old M3.2/M3.3 renumbered M3.3/M3.4.",
"2026-12-03 change (approved): R3 reworded so that 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 change (approved): R3 reworded so that 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 change (approved): background (land, border, status area) changed from brown (colour 9) to light brown: C64 colour 8 shown with VICE's pepto-pal palette, which tools/run.ps1 selects (assumption A8). Tree trunks stay colour 9."
]
},
"project": {
"name": "Land Map 64",
"slug": "land-map-64",
"idea": "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",
"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.",
"summary": "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.",
"kind": "demo",
"smallestUsefulVersion": "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 light red people moving over land, grass, trees and roads (not water or stone), flicker-free via two flipped buffers with only the people's spots redrawn, and SPACE for a new world."
},
@@ -29,7 +30,7 @@
"name": "Commodore 64 (NTSC)",
"video": "ntsc",
"id": "c64",
"expectedBehavior": "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.",
"expectedBehavior": "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.",
"platform": "c64"
}
],
@@ -47,7 +48,7 @@
"firstRelease": "A generated 2x2-screen world in multicolour bitmap mode with pixel-smooth cursor-key scrolling, a 5-line status area below the map, 16 moving people blocked by water and stone, double-buffered partial redraw, and SPACE for a new world.",
"inScope": [
"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",
@@ -70,11 +71,11 @@
"requirements": [
{
"title": "Generated 2x2-screen world",
"text": "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).",
"text": "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).",
"priority": "must",
"acceptance": [
"After autostart in VICE (x64sc, NTSC) the map view appears within 15 seconds",
"Scrolling across the whole world shows all five terrain colours: brown, grey, green, blue and black",
"Scrolling across the whole world shows all five terrain colours: light brown, grey, green, blue and black",
"Roads are continuous black lines that connect to each other",
"No colour clash: every 4x8 cell shows only its intended colours"
],
@@ -146,7 +147,7 @@
"id": "R6",
"title": "Status area",
"priority": "must",
"text": "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.",
"text": "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": [
"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",
"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",
@@ -159,7 +160,7 @@
],
"design": {
"visuals": {
"value": "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.",
"value": "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.",
"source": "user"
},
"budgets": {
@@ -216,7 +217,7 @@
"id": "A1"
},
{
"text": "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.",
"text": "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.",
"status": "default",
"id": "A2"
},
@@ -244,6 +245,11 @@
"id": "A7",
"text": "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.",
"status": "unverified"
},
{
"id": "A8",
"text": "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.",
"status": "default"
}
],
"openDecisions": [
@@ -357,7 +363,7 @@
"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"
],
@@ -565,8 +571,8 @@
"Hold a cursor key and watch the border while the map scrolls."
],
"expected": [
"Still: mostly brown border with a thin red stripe at the status split",
"Scrolling: cyan (rebuild) down to near the bottom, red stripe at the split, a little brown below",
"Still: mostly light brown border with a thin red stripe at the status split",
"Scrolling: cyan (rebuild) down to near the bottom, red stripe at the split, a little light brown below",
"The border pattern is steady from frame to frame (no rolling): every frame is kept"
],
"requirements": [
@@ -662,7 +668,7 @@
"video": "ntsc",
"videoSupport": "ntsc",
"artifact": "build/land-map-64.prg",
"expectedBehavior": "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.",
"expectedBehavior": "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.",
"build": {
"kind": "cc65",
"cc65Target": "c64",
@@ -679,7 +685,11 @@
"disk": null,
"emulator": {
"binary": "x64sc",
"args": [],
"args": [
"-VICIIextpal",
"-VICIIpalette",
"pepto-pal.vpl"
],
"autostart": "prg",
"notes": []
},


+ 6
- 4
src/main.s Прегледај датотеку

@@ -3,7 +3,7 @@
;
; Multicolour bitmap palette and VIC bank layout:
; - multicolour bitmap mode with the Land Map 64 colour scheme
; background ($D021) brown (pixel %00)
; background ($D021) light brown (pixel %00): colour 8, see COL_BACKGROUND
; screen RAM high nibble terrain (pixel %01) grey, green, blue or black
; screen RAM low nibble terrain (pixel %10)
; colour RAM light red (pixel %11) people; constant, never flipped
@@ -43,7 +43,9 @@ BANK_TEXT_BITS = %00000011 ; VIC bank 0 ($0000-$3FFF)
BANK_A_BITS = %00000010 ; VIC bank 1 ($4000-$7FFF)
BANK_B_BITS = %00000001 ; VIC bank 2 ($8000-$BFFF)

COL_BROWN = 9
COL_BACKGROUND = 8 ; named orange; light brown in VICE's pepto-pal palette,
; which tools/run.ps1 selects (spec A8). Also the border and
; the status area background.
COL_LIGHT_RED = 10

FLIP_RASTER = 251 ; below the visible area on NTSC and PAL
@@ -55,7 +57,7 @@ BAR_VBLANK = 1 ; white: scroll step, flip, people restore and draw
BAR_KEYS = 7 ; yellow: keys, status text, people movement
BAR_REBUILD = 3 ; cyan: hidden-buffer rebuild
BAR_IRQ = 2 ; red: raster interrupt (status split)
BAR_IDLE = COL_BROWN ; brown: waiting for the next frame
BAR_IDLE = COL_BACKGROUND ; light brown: waiting for the next frame

.macro TIMING_BAR_COLOR colour
.ifdef TIMING_BAR
@@ -130,7 +132,7 @@ space_ready: ; regenerated map is on screen

rebuild_map:
jsr write_generating
lda #COL_BROWN
lda #COL_BACKGROUND
sta VIC_BORDER
sta VIC_BG0
jsr wait_frame ; below the map: stop the split before


+ 3
- 2
src/tiles.inc Прегледај датотеку

@@ -1,5 +1,6 @@
; Tile IDs index matching 8-byte bitmap patterns and screen RAM colour pairs.
; Pixel pairs: 00 brown, 01 high nibble, 10 low nibble, 11 reserved for people.
; Pixel pairs: 00 background (light brown land), 01 high nibble, 10 low nibble,
; 11 reserved for people.
.enum
LAND
GRASS
@@ -28,7 +29,7 @@
tile_patterns:
.byte $00,$00,$00,$00,$00,$00,$00,$00 ; land
.byte $44,$11,$44,$11,$44,$11,$44,$11 ; grass
.byte $00,$14,$55,$55,$55,$14,$08,$08 ; tree, brown trunk in low nibble
.byte $00,$14,$55,$55,$55,$14,$08,$08 ; tree, dark brown trunk (colour 9) in low nibble
.byte $14,$55,$45,$55,$51,$55,$54,$10 ; stone
.byte $55,$55,$55,$55,$55,$55,$55,$55 ; open water
.byte $00,$00,$04,$51,$55,$55,$55,$55 ; north shore


+ 3
- 3
tools/check-split.ps1 Прегледај датотеку

@@ -24,7 +24,7 @@
number of people whose dot is at least partly inside the visible map window
(24-row, 38-column display; buffer pixel rows fy..fy+155 and hires pixel columns
fx..fx+303), counted here from the people table and view of the updating frame;
- in the exit screenshot, the 40 text lines (raster 211-250) contain only brown
- in the exit screenshot, the 40 text lines (raster 211-250) contain only the background colour
and light red, status rows 20, 21, 22 and 24 are lit and row 23 is empty, and
the last map line (raster 210) uses no colour foreign to the map. This is a
coarse check: in the delay sweep it caught damage from writes at 210:40-46 but
@@ -178,10 +178,10 @@ if (-not (Test-Path -LiteralPath $shot)) { $failures.Add('no exit screenshot') }
if ($c -ne $brown) { $textColours[$c] = 1; $textLit[[int][Math]::Floor(($y - 183) / 8)] = 1 }
}
}
if ($textColours.Count -gt 1) { $failures.Add("status area shows $($textColours.Count) colours besides brown (expected light red only)") }
if ($textColours.Count -gt 1) { $failures.Add("status area shows $($textColours.Count) colours besides the background (expected light red only)") }
foreach ($row in 0, 1, 2, 4) { if (-not $textLit.ContainsKey($row)) { $failures.Add("status row $($row + 20) is empty in the screenshot") } }
if ($textLit.ContainsKey(3)) { $failures.Add('the spare status row 23 is not empty') }
# Map colours: brown, light red, grey, green, blue, black as rendered in the map area above.
# Map colours: background, light red, grey, green, blue, black as rendered in the map area above.
$mapColours = @{}
for ($y = 51 - 28; $y -le 209 - 28; $y++) { for ($x = 0; $x -lt $bmp.Width; $x++) { $mapColours[$bmp.GetPixel($x, $y).ToArgb()] = 1 } }
for ($x = 0; $x -lt $bmp.Width; $x++) {


Loading…
Откажи
Сачувај

Powered by TurnKey Linux.