Tell the person where it hurts
A fault stopped the machine and printed a line to standard error. On a terminal that is a diagnosis. Behind a window it is a frozen picture and no reason at all, because the message went somewhere nobody was looking - the machine looked hung and was not. It had stopped, and said so invisibly. CosmOS catches all five faults now and says what happened on the screen, with the address, in red. A FAULT ENDS THE PROGRAM, NOT THE MACHINE. That is the answer to "carry on or start again", and it is not a compromise: a bare RETI from most of these meets the instruction that failed and fails again, so carrying on was never on offer. But the machine is almost never what is broken. Everything the shell puts back when a program exits - the Stack, its vectors, the drive, the working directory, the console, the screen - is exactly what wants putting back after one dies, so the handler sets a status and joins handleExit. You are back at the prompt, and the program is recorded as having STOPPED rather than finished, because saying "finished" under a red fault message would be the shell contradicting itself. A fault below where programs load is the system's own, and there is nothing to go back to. That one says so and stops. THE SCREEN GOES BACK TO A MODE TEXT CAN BE SEEN IN, and that is the part that matters rather than the part that is prettiest. A program that faulted in bitmap mode left the console with no text rows, so it draws nothing at all: the message would be perfectly correct and completely invisible, which is the one thing it must never be. Two palette entries go back for the same reason, since a program that wrote its own colours can leave every ink the same as every paper. Only the two the message needs, so the rest of what the program chose is left alone. Both halves are checked by looking at the PICTURE, because the serial line was never where the problem was. Crash blind ruins the palette and drops into bitmap mode before it faults; without the mode the screen comes back 320 by 200 with nothing on it, and without the palette it is the right size with the message present and unreadable. Each break loses the red on its own. Crash is also a program worth having: it breaks in whichever of the five ways you name, so a fault screen can be looked at without having written a bug first. Two things found on the way: The native assembler keeps its OWN copy of the reserved vector names, so it did not know NoHandler or NoDevice and built a cosmos.bin that differed from the host assembler's. Caught by native.sh, which is exactly the drift that test exists for. And cosmosMonitor had dead input. It assembles code into 0x8000 and runs it, and that code faults - which used to kill the machine, so everything after it in the file had never run. It runs now, and the recording grew by sixty lines of monitor session that had been unreachable since the day the fault was put there. 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
000a6d39cb
commit
fd9c4c75f8
@@ -22,6 +22,7 @@ Break.sbx 149
|
||||
Grid.sbx 559
|
||||
Press.sbx 872
|
||||
Mode.sbx 48
|
||||
Crash.sbx 632
|
||||
notes.txt 21
|
||||
Apps <dir>
|
||||
hi.script 121
|
||||
@@ -33,7 +34,7 @@ outer.script 376
|
||||
inner.script 44
|
||||
loop.script 35
|
||||
crossed.txt 560
|
||||
20 files, 1 directory
|
||||
21 files, 1 directory
|
||||
> exit
|
||||
halted
|
||||
Execution halted.
|
||||
|
||||
@@ -12,6 +12,7 @@ Break.sbx 149
|
||||
Grid.sbx 559
|
||||
Press.sbx 872
|
||||
Mode.sbx 48
|
||||
Crash.sbx 632
|
||||
notes.txt 21
|
||||
Apps <dir>
|
||||
hi.script 121
|
||||
@@ -22,7 +23,7 @@ nonl.script 38
|
||||
outer.script 376
|
||||
inner.script 44
|
||||
loop.script 35
|
||||
19 files, 1 directory
|
||||
20 files, 1 directory
|
||||
> drive 1
|
||||
> dir
|
||||
other.txt 28
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
CosmOS
|
||||
> Crash opcode
|
||||
that byte is not an instruction, at 4081
|
||||
A 00 B 0F Q 00
|
||||
the program was stopped
|
||||
> Crash service
|
||||
nothing is installed at service 28, at 4084
|
||||
A 00 B 0F Q 00
|
||||
the program was stopped
|
||||
> Crash bank
|
||||
a bank that is not there, or an address past its end, at 409E
|
||||
A 01 B 0F Q 00
|
||||
the program was stopped
|
||||
> Crash device
|
||||
nothing is installed for the device on port 00, at 40A5
|
||||
A 02 B 0F Q 00
|
||||
the program was stopped
|
||||
> Crash sideways
|
||||
Crash opcode | service | bank | device | blind
|
||||
finished
|
||||
> dir
|
||||
greet.sbx 211
|
||||
hello.sbx 53
|
||||
Life.sbx 1396
|
||||
Snake.sbx 2164
|
||||
Keys.sbx 664
|
||||
Say.sbx 156
|
||||
Break.sbx 149
|
||||
Grid.sbx 559
|
||||
Press.sbx 872
|
||||
Mode.sbx 48
|
||||
Crash.sbx 632
|
||||
notes.txt 21
|
||||
Apps <dir>
|
||||
hi.script 121
|
||||
bad.script 45
|
||||
plain.script 24
|
||||
cross.script 280
|
||||
nonl.script 38
|
||||
outer.script 376
|
||||
inner.script 44
|
||||
loop.script 35
|
||||
20 files, 1 directory
|
||||
> exit
|
||||
halted
|
||||
Execution halted.
|
||||
[exit 0]
|
||||
@@ -0,0 +1,9 @@
|
||||
CosmOS
|
||||
> monitor
|
||||
x examine, d disassemble, a assemble, s set, b bank, g go, exit leaves
|
||||
* g 3F00
|
||||
that byte is not an instruction, at 3F00
|
||||
A 01 B 7F Q 00
|
||||
that was the system itself, so there is nowhere to carry on from. Start the machine again.
|
||||
Execution halted.
|
||||
[exit 0]
|
||||
@@ -19,6 +19,7 @@ Break.sbx 149
|
||||
Grid.sbx 559
|
||||
Press.sbx 872
|
||||
Mode.sbx 48
|
||||
Crash.sbx 632
|
||||
notes.txt 21
|
||||
Apps <dir>
|
||||
hi.script 121
|
||||
@@ -29,7 +30,7 @@ nonl.script 38
|
||||
outer.script 376
|
||||
inner.script 44
|
||||
loop.script 35
|
||||
19 files, 1 directory
|
||||
20 files, 1 directory
|
||||
> exit
|
||||
halted
|
||||
Execution halted.
|
||||
|
||||
@@ -51,8 +51,73 @@ bank 00
|
||||
8009 12 AND
|
||||
800A 00 ?
|
||||
800B 00 ?
|
||||
* g 8000Fault: 0x00 at Program Address 0x800A is not an instruction.
|
||||
|
||||
* g 8000
|
||||
H
|
||||
that byte is not an instruction, at 800A
|
||||
A 85 B 3F Q 05
|
||||
the program was stopped
|
||||
* d 8000
|
||||
8000 26 48 INIA 48
|
||||
8002 D1 00 OUTA 00
|
||||
8004 26 0A INIA 0A
|
||||
8006 D1 00 OUTA 00
|
||||
8008 18 SHR
|
||||
8009 12 AND
|
||||
800A 00 ?
|
||||
800B 00 ?
|
||||
* b data
|
||||
bank 01
|
||||
* s 8100 68 65 6C 6C 6F 2C 20 74 79 70 65 64 0A 00
|
||||
* b program
|
||||
bank 00
|
||||
* a 8200
|
||||
8200: SETD.0 8100
|
||||
8204: SWI 10
|
||||
8206: lda.2
|
||||
8208: LDD.0.1
|
||||
820B: frobnicate
|
||||
no such instruction
|
||||
820B: INIA
|
||||
that one needs a value after it
|
||||
820B: SWI 12
|
||||
820D: .
|
||||
* d 8200
|
||||
8200 47 00 81 00 SETD.0 8100
|
||||
8204 72 10 SWI 10
|
||||
8206 42 02 LDA.2
|
||||
8208 4A 00 01 LDD.0.1
|
||||
820B 72 12 SWI 12
|
||||
820D 00 ?
|
||||
820E 00 ?
|
||||
820F 00 ?
|
||||
* g 8200
|
||||
hello, typed
|
||||
finished
|
||||
* exit
|
||||
> dir
|
||||
greet.sbx 211
|
||||
hello.sbx 53
|
||||
Life.sbx 1396
|
||||
Snake.sbx 2164
|
||||
Keys.sbx 664
|
||||
Say.sbx 156
|
||||
Break.sbx 149
|
||||
Grid.sbx 559
|
||||
Press.sbx 872
|
||||
Mode.sbx 48
|
||||
Crash.sbx 632
|
||||
notes.txt 21
|
||||
Apps <dir>
|
||||
hi.script 121
|
||||
bad.script 45
|
||||
plain.script 24
|
||||
cross.script 280
|
||||
nonl.script 38
|
||||
outer.script 376
|
||||
inner.script 44
|
||||
loop.script 35
|
||||
20 files, 1 directory
|
||||
> exit
|
||||
halted
|
||||
Execution halted.
|
||||
[exit 1]
|
||||
[exit 0]
|
||||
|
||||
@@ -12,6 +12,7 @@ Break.sbx 149
|
||||
Grid.sbx 559
|
||||
Press.sbx 872
|
||||
Mode.sbx 48
|
||||
Crash.sbx 632
|
||||
notes.txt 21
|
||||
Apps <dir>
|
||||
hi.script 121
|
||||
@@ -22,7 +23,7 @@ nonl.script 38
|
||||
outer.script 376
|
||||
inner.script 44
|
||||
loop.script 35
|
||||
19 files, 1 directory
|
||||
20 files, 1 directory
|
||||
> load
|
||||
load what?
|
||||
> load nosuch.sbx
|
||||
|
||||
@@ -10,6 +10,7 @@ Break.sbx 149
|
||||
Grid.sbx 559
|
||||
Press.sbx 872
|
||||
Mode.sbx 48
|
||||
Crash.sbx 632
|
||||
notes.txt 21
|
||||
Apps <dir>
|
||||
hi.script 121
|
||||
@@ -20,7 +21,7 @@ nonl.script 38
|
||||
outer.script 376
|
||||
inner.script 44
|
||||
loop.script 35
|
||||
19 files, 1 directory
|
||||
20 files, 1 directory
|
||||
> load Say.sbx
|
||||
loaded, starting at 4000
|
||||
> run the disk took its time
|
||||
|
||||
Reference in New Issue
Block a user