A word the monitor does not know goes to the disk, not into the weeds

There was nothing at the end of the monitor's command list. An unrecognised word
fell off it and straight into sayPrompt - which is a ROUTINE, so its RET had
nothing of its own to return to and went wherever the Stack happened to be
pointing.

The user found it by typing a program's name at the monitor prompt, which is an
entirely reasonable thing to do: the monitor is a mode of the shell, so
everything the shell does is meant to work in it. What they got was a fault, and
before that a second prompt printed on top of the first - which is sayPrompt
doing exactly what it is for on its way past, and the tell that it had been
entered rather than called.

WHERE THAT RET WENT DECIDED HOW BAD IT WAS. Usually 0x0003, in the middle of
newLine, and the machine stopped on a byte that is not an instruction. Once it
was inside sbfsFormat, and the machine formatted the disk it had booted from -
the user's would not start again, and neither would mine, which is how I came to
have a reproduction before I had a diagnosis.

Pre-existing, and not recent: it is there at 2a29ceb and every revision I
checked back through.

The fix is one branch. cosmosMonitorRun covers all three cases the monitor now
has to handle - a program started by name, a program that faults, and a word
that is nothing at all - because the first of those is what the user did and the
last is what used to be fatal.

Worth naming as a shape: a run of tests falling through into a subroutine. The
symptom is not at the site, the failure depends on the Stack, and the damage is
whatever the return address happens to land on. SplitLint has no rule for it and
could have one.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E2JrLzFvuFX9fgi1LDRjrW
This commit is contained in:
Anachronaut
2026-09-01 15:30:04 -04:00
co-authored by Claude Opus 5
parent fd9c4c75f8
commit 66be42d7bb
6 changed files with 79 additions and 1 deletions
+10
View File
@@ -340,6 +340,16 @@ cosmosFault | CosmOS/Source/cosmos.asm | run | cosmosFau
# monitor by jumping into the unwritten space above CosmOS and below where programs load,
# which is zeroes - so it faults at once and corrupts nothing on the way.
cosmosFaultSystem | CosmOS/Source/cosmos.asm | run | cosmosFaultSys.in | - | disks/cosmos.img
# A word the MONITOR does not know. There was nothing at the end of its command list, so an
# unrecognised word fell through into sayPrompt - a routine, whose RET then had nothing of its
# own to return to and went wherever the Stack happened to point. That was 0x0003 in the
# middle of newLine one time and inside sbfsFormat another, which formatted the disk the
# machine had booted from.
#
# So all three cases are here: a program run by name, a program that faults, and a word that
# is nothing at all. The monitor is a mode of the shell and everything the shell does is
# meant to work in it.
cosmosMonitorRun | CosmOS/Source/cosmos.asm | run | cosmosMonitorRun.in | - | disks/cosmos.img
# The shell editing the line it is being given, which is the whole reason the keys were
# made to arrive. Every line here is typed wrong and then corrected with a different key, and
# every one of them comes out as the same command - so the recording says both what the