Every failure in this shell abandons a frame. commandFailed is reached with CALL and never returns: it marks the line and branches to the prompt, which is the idiom every command uses and is why a failure needs no unwinding anywhere. What it costs is the frame of that call and of everything between the prompt and it - twenty bytes for a name that was never set, more from somewhere deeper - and nothing ever gave them back. MEASURED BEFORE IT WAS FIXED. Twenty failed lines moved the Stack Pointer from FFFD to FE6D, and it only ever went one way. Nothing had noticed because it takes thousands of failures to reach anything and nobody types thousands of anything. A loop in a script would, which is why this is worth doing before there are loops rather than after. So the loop starts each turn from a known place. SystemStack is NOT that place: it is taken when a program starts, so that the shell's Stack can be given back when the program stops - which means it holds wherever the shell had got to at that moment, the value that needs correcting rather than the one to correct from. ShellStack is taken once, at boot, when nothing is happening. Second use of MVDS in the system, and it earns it for the same reason as the first: a Stack that is right by construction beats one that is right because everybody remembered. Break prints the registers, so the test is two dumps with eight failures between them and a requirement that they agree. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E2JrLzFvuFX9fgi1LDRjrW
48 lines
945 B
Plaintext
48 lines
945 B
Plaintext
CosmOS
|
|
> Break
|
|
two stops, and what the registers were at each
|
|
break at 5016
|
|
A 11 B 22 Q 00 status 00
|
|
DP0 3030 DP1 3000 DP2 3037 DP3 5000 SP FFFF
|
|
press a key
|
|
break at 5034
|
|
A 44 B 55 Q 00 status 00
|
|
DP0 3000 DP1 3037 DP2 3030 DP3 5000 SP FFF5
|
|
press a key
|
|
carried on to the end
|
|
finished
|
|
> ho $nope
|
|
nothing is set called nope
|
|
> echo $nope
|
|
nothing is set called nope
|
|
> echo $nope
|
|
nothing is set called nope
|
|
> echo $nope
|
|
nothing is set called nope
|
|
> echo $nope
|
|
nothing is set called nope
|
|
> echo $nope
|
|
nothing is set called nope
|
|
> echo $nope
|
|
nothing is set called nope
|
|
> echo $nope
|
|
nothing is set called nope
|
|
> Break
|
|
two stops, and what the registers were at each
|
|
break at 5016
|
|
A 11 B 22 Q 00 status 00
|
|
DP0 3030 DP1 3000 DP2 3037 DP3 5000 SP FFFF
|
|
press a key
|
|
break at 5034
|
|
A 44 B 55 Q 00 status 00
|
|
DP0 3000 DP1 3037 DP2 3030 DP3 5000 SP FFF5
|
|
press a key
|
|
carried on to the end
|
|
finished
|
|
> it
|
|
I do not know: it
|
|
>
|
|
halted
|
|
Execution halted.
|
|
[exit 0]
|