From bc2c42f5fb47ac33a9f3129324d46c1b994940ff Mon Sep 17 00:00:00 2001 From: Daniel Covington Date: Thu, 3 Dec 2026 08:30:43 -0500 Subject: [PATCH] M2.2: double-buffered people redraw with per-buffer saved bytes Co-Authored-By: Claude Opus 5.5 --- docs/manual-tests.md | 15 ++++-- docs/toolchain.md | 2 +- docs/verification-status.md | 5 +- src/main.s | 65 ++++++++++++++++------- src/people.inc | 58 +++++++++++++++----- tools/check-people.ps1 | 102 ++++++++++++++++++++++++++++++------ 6 files changed, 189 insertions(+), 58 deletions(-) diff --git a/docs/manual-tests.md b/docs/manual-tests.md index c94ad88..51c0d84 100644 --- a/docs/manual-tests.md +++ b/docs/manual-tests.md @@ -91,7 +91,7 @@ Expected: - Dots move at least once per second (each takes about 7 small steps a second and sometimes changes direction). - No dot enters blue or grey pixels. A dot that reaches water or stone turns away. - After SPACE, dots appear on the new map and keep moving. -- At M2.1 the dots are drawn straight into the visible buffer during vertical blank; small flicker or a missed frame is not a failure until M2.2 adds the buffer flip (MT2.2). +- From M2.2 the dots are drawn into the hidden buffer, which is flipped into view each frame (see MT2.2). Verifies: R2 @@ -101,12 +101,17 @@ Setup: VICE x64sc, NTSC (-ntsc), warp off. Start: `pwsh -File tools/run.ps1 -Target c64` Steps: -1. Let it run for 5 minutes. -2. Inspect the map closely. +1. Run `pwsh -File tools/check-people.ps1` and note the result. +2. Start the program and let it run for 5 minutes at normal speed (warp off). +3. Watch the dots closely during that time, especially where two dots pass close to each other. +4. At the end, inspect the map closely, including the places dots walked over. +5. Tap SPACE, let the new map run for a minute, and inspect it again. Expected: -- No flicker -- No light red trails or damaged terrain +- `tools/check-people.ps1` prints `[PASS]`, with `0 missed` buffer flips. +- Dots step smoothly; they never flicker, blink out, or show doubled or half-drawn. +- The terrain does not flicker or shake (both buffers show the same map). +- No light red trails and no damaged terrain pixels where dots have been. Verifies: R3 diff --git a/docs/toolchain.md b/docs/toolchain.md index 477d16c..4bf5c61 100644 --- a/docs/toolchain.md +++ b/docs/toolchain.md @@ -56,7 +56,7 @@ Starter configurations marked verified were exercised by the Foundry's automated - World generation reached its ready point (`MAP READY`) - 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. -- 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. Output: `build/check-people/`. +- 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 6c0df11..3952aa3 100644 --- a/docs/verification-status.md +++ b/docs/verification-status.md @@ -13,11 +13,14 @@ manual = `pending`, `confirmed by user ()`, `problem reported ():