From 19c07883d5f63bf4556350e71c8b14ee2550059d Mon Sep 17 00:00:00 2001 From: Daniel Covington Date: Thu, 3 Dec 2026 15:30:56 -0500 Subject: [PATCH] M3.3: scrolling checks finished; split checked at every y-scroll - tools/check-scroll.ps1: scenarios driven as phases (phase byte at $CFF0, VICE conditional checkpoints); direction, edge, register, timing and stall checks; byte-exact final check of both buffers including dots. - tools/check-split.ps1: "no key" guard, scroll down and up so every y-scroll value 0-7 is split; digits compared with an independent in-view count. - tools/check-keys.ps1: border indicator check removed (indicator gone). - docs: MT3.1/MT3.3 steps, toolchain check descriptions, verification status. Co-Authored-By: Claude Opus 5.5 --- docs/manual-tests.md | 55 +++++----- docs/toolchain.md | 5 +- docs/verification-status.md | 14 +-- tools/check-keys.ps1 | 30 +++--- tools/check-scroll.ps1 | 205 +++++++++++++++++++++++------------- tools/check-split.ps1 | 115 ++++++++++++++------ 6 files changed, 265 insertions(+), 159 deletions(-) diff --git a/docs/manual-tests.md b/docs/manual-tests.md index 74f4bf1..62db527 100644 --- a/docs/manual-tests.md +++ b/docs/manual-tests.md @@ -122,36 +122,33 @@ Verifies: R3 Setup: VICE x64sc, NTSC (-ntsc), warp off. Start: `pwsh -File tools/run.ps1 -Target c64` -At M3.1 (keys only, no scrolling yet): run `pwsh -File tools/check-keys.ps1` and -expect `[PASS] all 8 key scenarios decode correctly`. Then start the program and, -while the map is shown, hold each key below for a second or two and release it. -Until M3.3 the border colour shows the direction that is held: - -| Keys held (VICE PC key) | Border | -|---|---| -| nothing | brown (same as the background) | -| CRSR RIGHT (Right arrow) | light green | -| SHIFT + CRSR RIGHT (Left arrow) | cyan | -| CRSR DOWN (Down arrow) | yellow | -| SHIFT + CRSR DOWN (Up arrow) | white | -| CRSR RIGHT + CRSR DOWN (Right + Down arrows) | orange | -| SHIFT + both (Left + Up arrows) | light blue | - -Expected at M3.1: the colour stays as long as the key is held and returns to -brown on release; both the left and the right SHIFT key work; the dots keep -moving smoothly. Tapping SPACE gives a new map; holding SPACE gives exactly one. -(Right + Up or Left + Down cannot be told apart on a real C64, because SHIFT -reverses both cursor keys; they show grey or one of the colours above.) - -From M3.3: +Automated first: `pwsh -File tools/check-keys.ps1` should print +`[PASS] all 8 key scenarios decode correctly` and `pwsh -File tools/check-scroll.ps1` +should print `[PASS] all 3 scroll scenarios: ...`. + +Keys (VICE maps the PC arrow keys to these): Right arrow = CRSR RIGHT, Down arrow = +CRSR DOWN, Left arrow = SHIFT + CRSR RIGHT, Up arrow = SHIFT + CRSR DOWN. On a real +C64 keyboard hold either SHIFT key with a cursor key to go left or up. Steps: -1. Hold each cursor key (with SHIFT for up and left) until the view stops. +1. Wait for the map. Hold Right until the view stops, then Down until it stops. +2. Hold Left until the view stops, then Up until it stops. +3. Hold Right + Down together for a few seconds, then Left + Up together. +4. Tap Right a few times, then hold Right and switch to Left while still moving. +5. Release all keys and tap SPACE; then scroll again in the new world. Expected: -- Smooth movement, no jumps or tearing -- The view stops at each world edge -- All five terrain colours seen across the world +- The map moves one pixel at a time in the direction held, with no jumps, tearing + or flashes of wrong terrain when it crosses a cell edge; it stops as soon as the + key is released. A very short hesitation right after a scroll starts is acceptable + (the hidden buffer is being prepared); note it if it is noticeable. +- Right stops at VIEW X 42 (the right world edge, column 79, at the right of the map); + 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 + trees, grey stone, blue water, black roads). +- SPACE still generates a new map, and the view starts again at the top-left (0, 0). Verifies: R1, R5 @@ -179,14 +176,16 @@ Steps: 1. Wait for the map view and read the text below the map. 2. Watch the boundary between map and text for 30 seconds while the dots move. 3. Tap SPACE and watch the boundary while the new map is generated and shown. -4. From M3.3: hold each cursor key and watch the text and the boundary while the map scrolls. +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: `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. -- From M3.3: the text never moves while the map scrolls, and the VIEW X/Y values follow the scrolling. +- The text never moves while the map scrolls, and the boundary stays clean at every vertical scroll position. +- VIEW X/Y show the view's top-left cell (X 0-42, Y 0-30) and follow the scrolling. +- The people-in-view number follows dots entering and leaving the map (it updates 15 times a second; a dot cut by the map's edge counts). Verifies: R6 (and the R1 view size) diff --git a/docs/toolchain.md b/docs/toolchain.md index 7e9e691..d7e810d 100644 --- a/docs/toolchain.md +++ b/docs/toolchain.md @@ -57,8 +57,9 @@ Starter configurations marked verified were exercised by the Foundry's automated - Status rows 20, 21, 22 and 24 in buffer A's text screen ($4720) and rows 20 and 24 in buffer B's ($8720) - C64 KERNAL reset vector at $FFFC (machine is in C64 mode) - World check: `pwsh -File tools/check-world.ps1` validates the tile data saved by the smoke test. -- Split check: `pwsh -File tools/check-split.ps1` runs VICE headless for 20,000,000 cycles. It logs the raster line and cycle of the three mode writes at `split_store` (src/status.inc) every frame and requires them to start between line 210 cycle 53 and line 210 cycle 64. That window was measured by building with split delays 6-12 under `+autostart-delay-random`: starts at 210:40-51 damaged the last map line, starts at 211:0-11 damaged the first text line, and 210:50-211:1 were clean; the shipped delay starts at 210:55-61. It also checks that a split happens every frame, that the people-in-view digits match the drawn count, and (coarsely) the screenshot colours at the boundary. Output: `build/check-split/`. -- Key check: `pwsh -File tools/check-keys.ps1` runs eight headless VICE scenarios. VICE's monitor cannot press keys, so tracepoints on the `key_row_*` instructions in `src/keys.inc` replace the port B row bits with those of held keys (`r a = `). It checks `scroll_dx`/`scroll_dy` and the border indicator for no key, right, left (right SHIFT), down, up (left SHIFT), down-right and up-left, and that SPACE held from frame 60 regenerates exactly once. Output: `build/check-keys/`. +- Split check: `pwsh -File tools/check-split.ps1` runs VICE headless for 20,000,000 cycles. It logs the raster line and cycle of the three mode writes at `split_store` (src/status.inc) every frame and requires them to start between line 210 cycle 53 and line 210 cycle 64. That window was measured by building with split delays 6-12 under `+autostart-delay-random`: starts at 210:40-51 damaged the last map line, starts at 211:0-11 damaged the first text line, and 210:50-211:1 were clean; the shipped delay starts at 210:55-61 at y-scroll 3. Tracepoints on the `key_row_*` instructions fake "no key" and then scroll down three cells and back up (phase byte at $CFF0, VICE conditional checkpoints), so every map y-scroll value 0-7 is split and checked against the same window (y-scroll 2, a bad line at line 210, uses a shorter delay; measured 2026-12-03: starts at 210:58-64). It also checks that a split happens every frame, that after each status update the people-in-view digits equal the number of people whose dot is at least partly in the visible window (computed by the script from the people table and view), and (coarsely) the screenshot colours at the boundary. Output: `build/check-split/`. +- Key check: `pwsh -File tools/check-keys.ps1` runs eight headless VICE scenarios. VICE's monitor cannot press keys, so tracepoints on the `key_row_*` instructions in `src/keys.inc` replace the port B row bits with those of held keys (`r a = `). It checks `scroll_dx`/`scroll_dy` for no key, right, left (right SHIFT), down, up (left SHIFT), down-right and up-left, and that SPACE held from frame 60 regenerates exactly once. Output: `build/check-keys/`. +- Scroll check: `pwsh -File tools/check-scroll.ps1` runs three headless VICE scenarios (edges, middle, reverse). Each is a list of phases: fake held keys (as in the key check) until a condition on the program state is met at `people_moved` (a `move_frame` value or a view position). The phase number is kept in free RAM at $CFF0 and moved on by VICE conditional checkpoints (`trace exec $addr if (@cpu:$addr == $nn) && (...)`: the parentheses are needed, and checkpoints at one address run in the order they were defined, so phase changes are defined latest first). Every frame it logs the phase, view, scroll registers, visible buffer, flip state and people table. It checks that the view moves at most one pixel per axis per frame and only in the direction of the keys read the frame before, stays inside 0-336 x 0-244 and stops at the edges, that $D011/$D016 match the fine scroll, that no frame is missed and the people update ends before raster 55, and reports frames where a held key did not move the view (stalls, allowed up to 40). At the end it compares the buffer about to be shown, byte for byte, with a fresh render of the world at the view plus the people's dots (and, when a flip is pending, the shown buffer with the previous frame's dots). Any monitor script error fails the check. Output: `build/check-scroll/`. - People check: `pwsh -File tools/check-people.ps1` runs VICE headless (NTSC, warp) for 40,000,000 cycles, logs the people table at the `people_moved` hook every frame through the monitor, and checks that all 16 people stay inside the world, never stand on a water or stone tile, move at most one pixel per step, all move, and start spread over the four screens. It also saves both bitmap buffers before people are drawn and at the last frame, and checks byte for byte that the hidden buffer is the clean map plus the current dots and the visible buffer is the clean map plus the previous frame's dots (no trails, no damaged terrain). It checks that the main loop never misses a frame (x64sc NTSC frame: 263 lines x 65 = 17,095 cycles) and that each people update ends before raster line 51, the first visible line. Output: `build/check-people/`. ### How the smoke test works diff --git a/docs/verification-status.md b/docs/verification-status.md index e93098f..fb11c59 100644 --- a/docs/verification-status.md +++ b/docs/verification-status.md @@ -16,17 +16,17 @@ manual = `pending`, `confirmed by user ()`, `problem reported ():