Grid: fill the map, not the window
Scrolling sideways walked off the end of what the program had filled, so the grid went blank for six seconds and then came round again. A map row holds 128 cells - 256 bytes at two a cell, whatever mode the screen is in - and an eighty column screen shows eighty of them, so 48 were empty. This is the third thing this loop has counted and the first right one. It said forty, which filled half the screen. Then it asked the screen how wide it was, which fixed what could be seen and was still wrong. ASKING THE SCREEN IS RIGHT FOR FILLING A SCREEN AND WRONG FOR FILLING A MAP: a program writing one screenful wants the window, and a program that scrolls wants everything the window can be moved over. There is no register for that because it is a property of video memory rather than of the display. The check that should have caught it did not, and that is the more useful half. periodic.py looked at 32 pixels - four cells at the left edge - so it could not see a gap that was on the right, and at the cycle count it samples the origin had moved to column 22 and the gap was off in the middle distance. It reads the whole scanline now and says which column the picture stops repeating at, which is how the two failures above were told apart. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E2JrLzFvuFX9fgi1LDRjrW
This commit is contained in:
co-authored by
Claude Opus 5
parent
bcd42e75ca
commit
1aa45fcfc4
@@ -813,6 +813,20 @@ if [ -f "$BUILD/grid.ppm" ]; then
|
||||
&& result ok "a program drew a grid of its own tile" "the picture repeats every eight pixels" \
|
||||
|| result no "a program drew a grid of its own tile" "not a grid of one tile ($GRIDLIKE)"
|
||||
|
||||
# ---- And still a grid once it has scrolled off the filled part ----
|
||||
#
|
||||
# A map row holds 128 cells and an eighty column screen shows eighty of them, so a
|
||||
# program that fills what the SCREEN is wide leaves 48 columns empty - and scrolling
|
||||
# sideways walks into them. The grid went blank for six seconds and came back. Twenty
|
||||
# million cycles is well past where that happened.
|
||||
timeout 30 "$EMU" --fast --cycles 20000000 --keyboard "$BUILD/grid.keys" \
|
||||
--screen "$BUILD/gridfar.ppm" --disk "$ROOT/Tests/build/disks/cosmos.img" \
|
||||
"$BUILD/cosmos.bin" > "$BUILD/gridfar.out" 2>&1 || true
|
||||
FARGRID="$(python3 "$ROOT/Tests/periodic.py" "$BUILD/gridfar.ppm" grid)"
|
||||
[ "$FARGRID" = "yes" ] \
|
||||
&& result ok "and is still one after scrolling a long way" "no gap where the map ran out" \
|
||||
|| result no "and is still one after scrolling a long way" "$FARGRID"
|
||||
|
||||
# The attribute nibble adds sixteen to every index in the tile, so consecutive map rows
|
||||
# come out in consecutive schemes. Eight pixels apart is one cell row apart whatever the
|
||||
# fine offset is, so this one survives the scrolling too.
|
||||
|
||||
Reference in New Issue
Block a user