Просмотр исходного кода

M4.1: scroll starts from rest on a cell edge again

A held key toward the cell edge made the view wait for a rebuild that never
started: people were drawn into the hidden buffer every frame and the pending
flip blocked the rebuild. People are now drawn in the shown buffer while a step
is wanted. check-scroll gains a 'restart' scenario.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main
Daniel Covington 2 дней назад
Родитель
Сommit
4d1d098dbf
4 измененных файлов: 28 добавлений и 2 удалений
  1. +2
    -0
      docs/manual-tests.md
  2. +6
    -1
      docs/verification-status.md
  3. +3
    -0
      src/people.inc
  4. +17
    -1
      tools/check-scroll.ps1

+ 2
- 0
docs/manual-tests.md Просмотреть файл

@@ -251,6 +251,7 @@ Steps:
3. Tap SPACE five or six times, waiting for each new map, and compare the first views. 3. Tap SPACE five or six times, waiting for each new map, and compare the first views.
4. In one world, scroll along a road that crosses a lake, and watch the dots near water and stone for a minute. 4. In one world, scroll along a road that crosses a lake, and watch the dots near water and stone for a minute.
5. Scroll left, right, up and down across busy terrain. 5. Scroll left, right, up and down across busy terrain.
6. Scroll, stop, then press a cursor key again, many times and in every direction (also straight back the way you came).


Expected: Expected:
- Every view shows a mixture of terrain: open light brown land, green meadows with trees, grey rock - Every view shows a mixture of terrain: open light brown land, green meadows with trees, grey rock
@@ -263,6 +264,7 @@ Expected:
On a bridge a dot stays on the black road and never touches the blue water on either side. On a bridge a dot stays on the black road and never touches the blue water on either side.
- Scrolling stays smooth over textured terrain (no regular stutter at each cell step). A short - Scrolling stays smooth over textured terrain (no regular stutter at each cell step). A short
hesitation when a scroll starts from rest is acceptable, as before. hesitation when a scroll starts from rest is acceptable, as before.
- Every cursor key press from rest moves the view, at once or after a short hesitation; the view never stays stuck while a key is held (except at the world edge in that direction).


Verifies: R1 (R1.2-R1.6), R2.3, R5.1 Verifies: R1 (R1.2-R1.6), R2.3, R5.1




+ 6
- 1
docs/verification-status.md Просмотреть файл

@@ -18,10 +18,15 @@ manual = `pending`, `confirmed by user (<date>)`, `problem reported (<date>): <n
| M3.2 Split screen: raster interrupts switch to text below a 20-row map and back at the top of the frame; status text screen and ROM font copy in both banks; status lines with the people-in-view count. | passed (2026-12-03, `pwsh -File tools/build.ps1`; `pwsh -File tools/smoke.ps1` incl. status text in both banks; `pwsh -File tools/check-world.ps1`; `pwsh -File tools/check-people.ps1`; `pwsh -File tools/check-keys.ps1`; `pwsh -File tools/check-split.ps1`: 955 splits in 955 frames, writes start at 210:55-61, digits right in every frame) | confirmed by user (2026-12-03) | | M3.2 Split screen: raster interrupts switch to text below a 20-row map and back at the top of the frame; status text screen and ROM font copy in both banks; status lines with the people-in-view count. | passed (2026-12-03, `pwsh -File tools/build.ps1`; `pwsh -File tools/smoke.ps1` incl. status text in both banks; `pwsh -File tools/check-world.ps1`; `pwsh -File tools/check-people.ps1`; `pwsh -File tools/check-keys.ps1`; `pwsh -File tools/check-split.ps1`: 955 splits in 955 frames, writes start at 210:55-61, digits right in every frame) | confirmed by user (2026-12-03) |
| M3.3 Fine scroll via $D016/$D011 in the 38-column, 20-row map area; rebuild the hidden buffer from tiles over 8 frames and flip on wrap; stop at world edges; show the view position in the status area; draw people relative to the view (in the shown buffer during vertical blank while a rebuild runs). | passed (2026-12-03, `pwsh -File tools/build.ps1`; `pwsh -File tools/smoke.ps1`; `pwsh -File tools/check-world.ps1`; `pwsh -File tools/check-people.ps1`: 2,127 frames, 0 missed, update done by line 36; `pwsh -File tools/check-keys.ps1`: 8 of 8; `pwsh -File tools/check-split.ps1`: 964 splits in 964 frames, all y-scroll values 0-7, starts 210:55-64, digits right after 240 of 240 status updates; `pwsh -File tools/check-scroll.ps1`: 3 of 3 scenarios, edges reached and held, 1-5 stall frames per scenario, both buffers byte-exact at the end) | confirmed by user (2026-12-03), after the fix for the reported tear ("the top of the screen tears a little when I go left or right") | | M3.3 Fine scroll via $D016/$D011 in the 38-column, 20-row map area; rebuild the hidden buffer from tiles over 8 frames and flip on wrap; stop at world edges; show the view position in the status area; draw people relative to the view (in the shown buffer during vertical blank while a rebuild runs). | passed (2026-12-03, `pwsh -File tools/build.ps1`; `pwsh -File tools/smoke.ps1`; `pwsh -File tools/check-world.ps1`; `pwsh -File tools/check-people.ps1`: 2,127 frames, 0 missed, update done by line 36; `pwsh -File tools/check-keys.ps1`: 8 of 8; `pwsh -File tools/check-split.ps1`: 964 splits in 964 frames, all y-scroll values 0-7, starts 210:55-64, digits right after 240 of 240 status updates; `pwsh -File tools/check-scroll.ps1`: 3 of 3 scenarios, edges reached and held, 1-5 stall frames per scenario, both buffers byte-exact at the end) | confirmed by user (2026-12-03), after the fix for the reported tear ("the top of the screen tears a little when I go left or right") |
| M3.4 Check that people stay aligned with the terrain over long scrolling runs; measure the frame budget with a border-colour timing bar. | passed (2026-12-03, `pwsh -File tools/build.ps1`; `pwsh -File tools/smoke.ps1`; `pwsh -File tools/check-world.ps1`; `pwsh -File tools/check-people.ps1`: 2,130 frames, update done by line 21; `pwsh -File tools/check-keys.ps1`: 8 of 8; `pwsh -File tools/check-split.ps1`: 962 splits, digits 241/241; `pwsh -File tools/check-scroll.ps1 -Long`: 4 of 4, tour 23,195 frames (about 6.4 minutes NTSC) with 21 stops byte-exact, people update done by line 45 at the latest; timing build `--asm-define TIMING_BAR` built and screenshot in VICE) | confirmed by user (2026-12-03), with the light brown background (colour 8, pepto-pal palette); dots visible | | M3.4 Check that people stay aligned with the terrain over long scrolling runs; measure the frame budget with a border-colour timing bar. | passed (2026-12-03, `pwsh -File tools/build.ps1`; `pwsh -File tools/smoke.ps1`; `pwsh -File tools/check-world.ps1`; `pwsh -File tools/check-people.ps1`: 2,130 frames, update done by line 21; `pwsh -File tools/check-keys.ps1`: 8 of 8; `pwsh -File tools/check-split.ps1`: 962 splits, digits 241/241; `pwsh -File tools/check-scroll.ps1 -Long`: 4 of 4, tour 23,195 frames (about 6.4 minutes NTSC) with 21 stops byte-exact, people update done by line 45 at the latest; timing build `--asm-define TIMING_BAR` built and screenshot in VICE) | confirmed by user (2026-12-03), with the light brown background (colour 8, pepto-pal palette); dots visible |
| M4.1 Region generator: each world rolls its own terrain mix; jittered seeds on a grid give every class areas all over the world, shaped by noisy distances, smoothing and removal of thin water; shores from the neighbours; trees on grass. Roads stay a grid of two rows and two columns and become bridges over water. The scroll rebuild skips cells whose tile is already drawn, to keep the 8-frame rebuild with textured terrain everywhere. | passed (2026-12-03, `pwsh -File tools/build.ps1` (4,647 bytes); `pwsh -File tools/smoke.ps1`; `pwsh -File tools/check-world.ps1 -Runs 10`: 10 of 10 worlds, every 40x20 view with 3+ terrain kinds, map ready 7.1-7.3 s after power-on (generation 4.0-4.1 s), mix spread land 14 / grass-trees 8 / water 13 / stone 16 percentage points; `pwsh -File tools/check-people.ps1`: 1,919 frames, 0 missed, update done by line 20; `pwsh -File tools/check-keys.ps1`: 8 of 8; `pwsh -File tools/check-split.ps1`: 734 splits, digits right after 183 of 183 updates; `pwsh -File tools/check-scroll.ps1 -Long`: 4 of 4, tour 22,966 frames with 21 stops byte-exact, 116 stall frames in 15,216 moving frames; fix for walking on bridge water, 2026-12-03: `pwsh -File tools/build.ps1` (4,683 bytes); `pwsh -File tools/smoke.ps1`; `pwsh -File tools/check-world.ps1` and `-Runs 10`: 10 of 10; `pwsh -File tools/check-keys.ps1`: 8 of 8; `pwsh -File tools/check-split.ps1`; `pwsh -File tools/check-scroll.ps1`: 3 of 3; `pwsh -File tools/check-people.ps1 -Cycles 300000000`: 17,119 frames, 1,408 person-frames on bridges, no dot on a blue or grey pixel; the same check fails on the old code (person 9 on a blue pixel of bridge tile 20)) | problem reported (2026-12-03): people walked in the water (the blue pixels of bridge tiles). Fixed; waiting for the user to check again. |
| M4.1 Region generator: each world rolls its own terrain mix; jittered seeds on a grid give every class areas all over the world, shaped by noisy distances, smoothing and removal of thin water; shores from the neighbours; trees on grass. Roads stay a grid of two rows and two columns and become bridges over water. The scroll rebuild skips cells whose tile is already drawn, to keep the 8-frame rebuild with textured terrain everywhere. | passed (2026-12-03, `pwsh -File tools/build.ps1` (4,647 bytes); `pwsh -File tools/smoke.ps1`; `pwsh -File tools/check-world.ps1 -Runs 10`: 10 of 10 worlds, every 40x20 view with 3+ terrain kinds, map ready 7.1-7.3 s after power-on (generation 4.0-4.1 s), mix spread land 14 / grass-trees 8 / water 13 / stone 16 percentage points; `pwsh -File tools/check-people.ps1`: 1,919 frames, 0 missed, update done by line 20; `pwsh -File tools/check-keys.ps1`: 8 of 8; `pwsh -File tools/check-split.ps1`: 734 splits, digits right after 183 of 183 updates; `pwsh -File tools/check-scroll.ps1 -Long`: 4 of 4, tour 22,966 frames with 21 stops byte-exact, 116 stall frames in 15,216 moving frames; fix for walking on bridge water, 2026-12-03: `pwsh -File tools/build.ps1` (4,683 bytes); `pwsh -File tools/smoke.ps1`; `pwsh -File tools/check-world.ps1` and `-Runs 10`: 10 of 10; `pwsh -File tools/check-keys.ps1`: 8 of 8; `pwsh -File tools/check-split.ps1`; `pwsh -File tools/check-scroll.ps1`: 3 of 3; `pwsh -File tools/check-people.ps1 -Cycles 300000000`: 17,119 frames, 1,408 person-frames on bridges, no dot on a blue or grey pixel; the same check fails on the old code (person 9 on a blue pixel of bridge tile 20); fix for the scroll that did not start, 2026-12-03: `pwsh -File tools/build.ps1`; `pwsh -File tools/smoke.ps1`; `pwsh -File tools/check-world.ps1`; `pwsh -File tools/check-keys.ps1`: 8 of 8; `pwsh -File tools/check-split.ps1`; `pwsh -File tools/check-scroll.ps1`: 4 of 4, new restart scenario 12 stall frames over four starts from a cell edge (the same scenario fails on the old code: 1,166 frames held left without moving); `pwsh -File tools/check-people.ps1`: 1,899 frames, 816 person-frames on bridges, pass; `pwsh -File tools/check-scroll.ps1 -Long`: 5 of 5, tour 22,967 frames with 21 stops byte-exact, 111 stall frames in 15,216 moving frames) | problem reported (2026-12-03): people walked in the water (the blue pixels of bridge tiles); fixed, and the user confirmed that people stay on the road. Then reported: the scroll sometimes did not move when a cursor key was pressed. Fixed; waiting for the user to check again. |


## Notes ## Notes


- 2026-12-03 (scroll did not start, problem reported by the user during the M4.1 re-check: "the scroll will not move sometimes when the cursor keys are pressed"):
- Cause (from the M3.3 tear fix, commit a40ea04, not from the bridge fix): with the view resting exactly on a cell edge, a key toward that edge (left at fx 0, up at fy 0) needs the hidden buffer rebuilt before the first step, so the view waits. A waiting view counts as still, so people_vblank drew the people into the hidden buffer and set people_flip_pending; choose_rebuild_target does nothing while a flip is pending, so the rebuild never started. This repeated every frame for as long as the key was held.
- Fix (src/people.inc, people_vblank): when a step is wanted (step_x or step_y nonzero after get_steps) the people are drawn in the shown buffer, so the hidden buffer is free to rebuild. The tear fix stays in place.
- tools/check-scroll.ps1: new scenario 'restart' stops on a cell edge and starts again from rest left, right, up and down. A scenario that never reaches its last phase now fails with a message instead of an exception.

- 2026-12-03 (M4.1 fix, problem reported by the user: "people can walk in the water"): - 2026-12-03 (M4.1 fix, problem reported by the user: "people can walk in the water"):
- Cause: the M4.1 bridge tiles (BRIDGE_H, BRIDGE_V, BRIDGE_X) were walkable as whole tiles, but their %01 pixels are blue water. Dots walked along a bridge's water edge, and place_people could also put a dot there at the start. This broke R2.3. - Cause: the M4.1 bridge tiles (BRIDGE_H, BRIDGE_V, BRIDGE_X) were walkable as whole tiles, but their %01 pixels are blue water. Dots walked along a bridge's water edge, and place_people could also put a dot there at the start. This broke R2.3.
- Fix (src/people.inc): candidate_blocked now checks the pixel. On a bridge tile it reads the tile's pattern byte for row cand_sy and blocks a %01 pixel at cand_sx. place_people picks the pixel position before the check. An assert keeps the bridges as the last tiles. - Fix (src/people.inc): candidate_blocked now checks the pixel. On a bridge tile it reads the tile's pattern byte for row cand_sy and blocks a %01 pixel at cand_sx. place_people picks the pixel position before the check. An assert keeps the bridges as the last tiles.


+ 3
- 0
src/people.inc Просмотреть файл

@@ -219,6 +219,9 @@ candidate_blocked:
people_vblank: people_vblank:
lda view_moved lda view_moved
bne @shown bne @shown
lda step_x ; a step is wanted but waits for the rebuild:
ora step_y ; the hidden buffer must be free to rebuild
bne @shown ; (else the flip and the wait repeat forever)
ldx hidden ldx hidden
lda buf_ready,x lda buf_ready,x
beq @shown beq @shown


+ 17
- 1
tools/check-scroll.ps1 Просмотреть файл

@@ -17,6 +17,9 @@
middle down, then right, then release in the middle of the world middle down, then right, then release in the middle of the world
reverse right, reverse to left in the frame after a cell step, right again; reverse right, reverse to left in the frame after a cell step, right again;
then down, reverse to up right after a cell step; release then down, reverse to up right after a cell step; release
restart stop on a cell edge, then start again from rest in each direction (left,
right, up, down): the view must leave the edge (a held key once never
moved it there)
tour (-Long only) about 5 minutes: six laps over the whole world, alternately tour (-Long only) about 5 minutes: six laps over the whole world, alternately
row by row (right, down, left, ...; then diagonally up-left home) and row by row (right, down, left, ...; then diagonally up-left home) and
column by column (down, right, up, ...), with still stops between legs. column by column (down, right, up, ...), with still stops between legs.
@@ -139,6 +142,19 @@ $scenarios = @(
@{ cursor = $DOWN; lshift = $NONE; until = (View -1 0 6 0) } # just stepped into row 6 @{ cursor = $DOWN; lshift = $NONE; until = (View -1 0 6 0) } # just stepped into row 6
@{ cursor = $DOWN; lshift = $SHIFT; until = (View -1 0 2 1) } @{ cursor = $DOWN; lshift = $SHIFT; until = (View -1 0 2 1) }
@{ cursor = $NONE; lshift = $NONE }) } @{ cursor = $NONE; lshift = $NONE }) }
@{ name = 'restart'; cycles = 30000000; phases = @(
@{ cursor = $NONE; lshift = $NONE; until = (Frame 30) }
@{ cursor = $RIGHTK; lshift = $NONE; until = (View 10 0 -1 0) } # stop on a cell edge
@{ cursor = $NONE; lshift = $NONE; until = (Frame 160) }
@{ cursor = $RIGHTK; lshift = $SHIFT; until = (View 8 0 -1 0) } # left from rest at fx 0
@{ cursor = $NONE; lshift = $NONE; until = (Frame 250) }
@{ cursor = $RIGHTK; lshift = $NONE; until = (View 10 0 -1 0) } # right from rest at fx 0
@{ cursor = $DOWN; lshift = $NONE; until = (View -1 0 6 0) }
@{ cursor = $NONE; lshift = $NONE; until = (Frame 120) }
@{ cursor = $DOWN; lshift = $SHIFT; until = (View -1 0 4 0) } # up from rest at fy 0
@{ cursor = $NONE; lshift = $NONE; until = (Frame 220) }
@{ cursor = $DOWN; lshift = $NONE; until = (View -1 0 6 0) } # down from rest at fy 0
@{ cursor = $NONE; lshift = $NONE }) }
) )
if ($Long) { if ($Long) {
$R = @{ cursor = $RIGHTK; lshift = $NONE }; $Lf = @{ cursor = $RIGHTK; lshift = $SHIFT } $R = @{ cursor = $RIGHTK; lshift = $NONE }; $Lf = @{ cursor = $RIGHTK; lshift = $SHIFT }
@@ -420,7 +436,7 @@ foreach ($sc in $scenarios) {
& $checkBuffer $prefix $at.visible $at $at.people 'shown' & $checkBuffer $prefix $at.visible $at $at.people 'shown'
} }
} }
& $checkFrame '' ($frames.Count - 1)
if (Test-Path -LiteralPath (Join-Path $dir 'bitmap-a.bin')) { & $checkFrame '' ($frames.Count - 1) } else { $failures.Add('the last phase was never reached: no final buffers saved') }
# Snapshots: saved in the hit that ended stop k, which is logged as the first frame of phase k+1. # Snapshots: saved in the hit that ended stop k, which is logged as the first frame of phase k+1.
$snaps = 0 $snaps = 0
for ($ph = 0; $ph -lt $lastPhase; $ph++) { for ($ph = 0; $ph -lt $lastPhase; $ph++) {


Загрузка…
Отмена
Сохранить

Powered by TurnKey Linux.