Files
SplitBit-Emulator/Programs/CosmOS/Apps/Settle.asm
T
Anachronaut 87d819847e A program can say how it went
SWI osExit takes a status in A, and the shell keeps it. Fifty eight exits
across twenty three programs now say deliberately whether they worked: 25
did what they were asked, 24 did not, 9 were asked wrongly. Compare is the
exception and says so - one there means the files differ, which is a result
rather than a failure, the way diff has always had it.

IN A RATHER THAN Q, which is not a departure from the rule that a service
answers in Q. This one takes an ARGUMENT, the way osPrintNumber takes A and
B, and it never returns to answer anything. A is free precisely because a
return would have put it back - and Q is the ALU's output, so a small
number costs four instructions there against one in A.

The shell does not print it. A program that failed has already said so in
words and a number beside that is noise, so osLastStatus hands it back and
Status is the program that shows it. That indirection is the point: the
number exists for the thing that cannot read words.

MARKING THE EXITS FOUND A DEFECT ON THE FIRST RUN. Type and More printed
why they had failed and then fell through into the success exit, reporting
that all was well. Nobody had noticed, because while the only reader was a
person, the person could see both the complaint and the claim.

Two smaller things. Snake sets the console to line mode and then exits with
zero, and the linter flagged the second RSTA as redundant - an exit status
and a console mode, equal by accident, which is the class that must never
be collapsed. And the README still taught answering by writing into the
frame, three months of habit that SRET replaced yesterday; that section is
gone and the one describing SRET stands in its place.
2026-08-27 19:16:21 -04:00

94 lines
2.2 KiB
NASM

; Settle.asm
; Says how the last start went, and tells the machine to stop falling back.
;
; A program rather than a shell command, because the shell is for the things you cannot do
; without it and this is not one of them. It reaches the system through SWI like anything
; else, which means it can be replaced, left off a disk, or called by whatever comes to
; call programs in sequence - and none of that is true of a word built into the shell.
;
; ---- What settling means ----
;
; The loader marks the disk before handing over and the system clears the mark on reaching
; its prompt, so a mark still set is a start that never arrived. After that the loader uses
; the fallback and KEEPS USING IT, because a system known not to start should not be tried
; every other boot for ever.
;
; Settling is how it is told that has changed. It does not fix anything and it does not
; check anything: it says "the situation is different now, try again". Which is why it is a
; deliberate act by somebody who has just changed something, rather than anything automatic.
;
; Written by Anachronaut
#Include services.asm
#Program
#Base 0x4000
start:
SWI osBootState
MVQA
SETD.0 State
STA.0
BRA alreadySettled
INIB 0d2
XOR
BRQ fellBack
; Trying. Nothing has gone wrong yet - this is what the disk looks like while a start is
; still in progress, which from in here means the system that is running has not reached
; its prompt, which it plainly has. So the mark is stale.
SETD.0 WasTrying
SWI osPrintString
BRI doSettle
fellBack:
SETD.0 WasFallen
SWI osPrintString
doSettle:
SWI osBootSettle
MVQA
BNA settleFailed
SETD.0 Settled
SWI osPrintString
RSTA
SWI osExit
settleFailed:
SETD.0 NoDisk
SWI osPrintString
INIA 0d1
SWI osExit
alreadySettled:
SETD.0 Already
SWI osPrintString
RSTA
SWI osExit
#Data
#Base 0x2000
WasTrying:
"the disk says a start is still in progress
"
WasFallen:
"the disk says the last start did not arrive, so this is the fallback
"
Settled:
"settled: the next start will use the configuration again
"
Already:
"already settled: the next start will use the configuration
"
NoDisk:
"nothing to settle: no disk answered
"
State:
0x00