Make the screen come back on the machine people actually run

Found by running it: Grid exits and the shell prints its prompt into the
grid, with the view up to seven pixels out of alignment. Three faults, and
the first is the one that made the other two visible.

MAKE RUN-VOYAGER HAD NO SCRATCH DRIVE. It gives drive 1 to Disks/personal.img,
which is a file and not volatile, so there was nowhere to keep a screen -
osTakeScreen answered no and the whole feature silently did not happen. It
was tested with --ram-disk and shipped without one, which is as good a
description of testing the wrong machine as I can write. There is now a RAM
disk in drive 2, after the personal disk so that drive 1 stays the one that
is yours.

A PROGRAM TOLD NO MUST COPE. A refusal is not a fault, it means doing what
the program did before there was anywhere to save a screen. Grid deleted
its own tidying up when it started asking, so being refused left the grid
on screen with a prompt written into it. It clears up again when refused,
and only then.

AND THE SYSTEM ALWAYS LEAVES THE SCREEN USABLE. The fine scroll registers
go back to zero at every program exit, whether or not the picture could be
saved: the console draws in whole cells, so a view three pixels into one
puts every character three pixels out for ever. That is not part of saving
a screen and should never have depended on it.

Both paths are checked now. With a scratch drive the screen comes back cell
for cell; without one, no grid is left behind. Breaking either fails one of
them and not the other.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E2JrLzFvuFX9fgi1LDRjrW
This commit is contained in:
Anachronaut
2026-08-31 20:31:26 -04:00
co-authored by Claude Opus 5
parent ab72443b99
commit 2a29cebc6b
10 changed files with 123 additions and 11 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ Snake.sbx 2164
Keys.sbx 664
Say.sbx 156
Break.sbx 149
Grid.sbx 479
Grid.sbx 559
notes.txt 21
Apps <dir>
hi.script 121
+1 -1
View File
@@ -7,7 +7,7 @@ Snake.sbx 2164
Keys.sbx 664
Say.sbx 156
Break.sbx 149
Grid.sbx 479
Grid.sbx 559
notes.txt 21
Apps <dir>
hi.script 121
+2 -2
View File
@@ -1,7 +1,7 @@
CosmOS
> it says: before Grid
finished
> finished
> finished
> > it says: after Grid
finished
> greet.sbx 211
@@ -11,7 +11,7 @@ Snake.sbx 2164
Keys.sbx 664
Say.sbx 156
Break.sbx 149
Grid.sbx 479
Grid.sbx 559
notes.txt 21
Apps <dir>
hi.script 121
+1 -1
View File
@@ -7,7 +7,7 @@ Snake.sbx 2164
Keys.sbx 664
Say.sbx 156
Break.sbx 149
Grid.sbx 479
Grid.sbx 559
notes.txt 21
Apps <dir>
hi.script 121
+1 -1
View File
@@ -6,7 +6,7 @@ Snake.sbx 2164
Keys.sbx 664
Say.sbx 156
Break.sbx 149
Grid.sbx 479
Grid.sbx 559
notes.txt 21
Apps <dir>
hi.script 121
+14
View File
@@ -860,6 +860,20 @@ SAME="$(python3 "$ROOT/Tests/samescreen.py" "$BUILD/before.ppm" "$BUILD/after.pp
&& result ok "a program gives the screen back" "every row it did not write on is as it was" \
|| result no "a program gives the screen back" "$SAME"
# ---- And when there is nowhere to put it ----
#
# The same program on a machine with no volatile drive. osTakeScreen answers no, and a program
# told no does what it did before there was anywhere to save a screen: it clears up after
# itself. What must NOT happen is the shell printing its prompt into somebody's grid, which is
# what happened the day the run targets had no scratch drive and this check did not exist.
timeout 30 "$EMU" --fast --cycles 200000000 --keyboard "$BUILD/after.keys" \
--screen "$BUILD/noscratch.ppm" --disk "$ROOT/Tests/build/disks/cosmos.img" \
"$BUILD/cosmos.bin" > "$BUILD/noscratch.out" 2>&1 || true
LEFT="$(python3 "$ROOT/Tests/periodic.py" "$BUILD/noscratch.ppm" grid)"
[ "$LEFT" != "yes" ] \
&& result ok "and clears up when it cannot be kept" "no grid left on the screen" \
|| result no "and clears up when it cannot be kept" "the grid is still there"
# ---- Clearing puts the cursor back at the top ----
#
# A screen with nothing on it and a cursor half way down it is not a cleared screen. This