CosmOS had 1,161 bytes of Program Memory left before the address applications load at, and Tab completion is not going to fit in that with anything to spare. So the wall moves up one page: the system keeps below 0x4FFF and 0x2FFF, and an application is based at 0x5000 and 0x3000. A PAGE IS A CHEAP THING TO GIVE IT AND AN EXPENSIVE THING TO RUN OUT OF. An application still has 44K of Program Memory before the vector table and the largest one here uses 7.5K, so what was taken from applications is space nothing has ever asked for - while what the system gained is the difference between building the next thing and counting bytes while building it. Not doubling, which was the version that would have cost application space worth minding. One page, and the same again when it is needed. Nothing in the machine knows where the wall is, so this is 34 #Base lines, one threshold in the fault handler, and the table in the CosmOS README that Tests/docs.sh reads its limits out of. The native assembler's scratch map had to move with it, and docs.sh said so before anything ran: its data reached 0x40D6 and its buffers began at 0x4000, so they were sitting on its variables. That file already carries a paragraph about the floor coming up and the map staying where it was. It has happened twice now, and been caught by a check the first time wrote. Twenty three recordings are the same runs a page higher. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E2JrLzFvuFX9fgi1LDRjrW
139 lines
2.6 KiB
NASM
139 lines
2.6 KiB
NASM
; Once.asm
|
|
; Starts something else next time, and only next time.
|
|
;
|
|
; > Once /System/Boot/mine.bin
|
|
; next start: /System/Boot/mine.bin, once
|
|
; > reboot
|
|
;
|
|
; Writes /System/Boot/once.cfg, which the loader reads before boot.cfg and DELETES BEFORE
|
|
; IT JUMPS. So the image runs on the next start and on no other, whatever happens to it -
|
|
; a one shot that hangs cannot hang twice, because the request is gone before it ran.
|
|
;
|
|
; ---- What this is for ----
|
|
;
|
|
; A program that owns the whole machine has nowhere to run. It cannot be started from the
|
|
; shell, because starting it means there is no shell; and pointing boot.cfg at it means a
|
|
; machine that keeps starting it, which is a poor place to find a mistake. This is the
|
|
; missing step: write it, ask for it once, and the system comes back by itself.
|
|
;
|
|
; The file is the same format as boot.cfg because a second format for one setting would be
|
|
; a second format. It says `system` for the same reason.
|
|
;
|
|
; Written by Anachronaut
|
|
|
|
#Include services.asm
|
|
|
|
#Program
|
|
|
|
#Base 0x5000
|
|
|
|
start:
|
|
SETD.0 Wanted
|
|
INIB 0d128
|
|
SWI osArgument
|
|
MVQA
|
|
BNA noName
|
|
|
|
SETD.0 Wanted
|
|
LDA.0
|
|
BRA noName
|
|
|
|
; The line, built as "system " and then the name. One write, because the file is the
|
|
; whole of the request and half of it would be a request for half a thing.
|
|
SETD.0 Prefix
|
|
SETD.1 Line
|
|
RCAL copyString
|
|
SETD.0 Wanted
|
|
RCAL copyString
|
|
INIA 0x0A
|
|
STA.1
|
|
INCD.1
|
|
RSTA
|
|
STA.1
|
|
|
|
; How long it came to, which is what the write is told.
|
|
SETD.0 Line
|
|
RCAL measure
|
|
|
|
SETD.0 OncePath
|
|
SETD.1 Line
|
|
SWI osFileSave
|
|
MVQA
|
|
BNA noWrite
|
|
|
|
SETD.0 DoneText
|
|
SWI osPrintString
|
|
SETD.0 Wanted
|
|
SWI osPrintString
|
|
SETD.0 OnceText
|
|
SWI osPrintString
|
|
RSTA
|
|
SWI osExit
|
|
|
|
noName:
|
|
SETD.0 Usage
|
|
SWI osPrintString
|
|
INIA 0d2
|
|
SWI osExit
|
|
|
|
noWrite:
|
|
SETD.0 NoWriteText
|
|
SWI osPrintString
|
|
INIA 0d1
|
|
SWI osExit
|
|
|
|
; DP0 names a string and DP1 where it goes. DP1 is left on the zero at the end, so one
|
|
; string can be written straight after another.
|
|
copyString:
|
|
LDA.0
|
|
BRA copyDone
|
|
STA.1
|
|
INCD.0
|
|
INCD.1
|
|
BRI copyString
|
|
copyDone:
|
|
RRET
|
|
|
|
; DP0 names the line. osFileSave wants a size, and a file of whole blocks and a tail is
|
|
; that count with the blocks in A and the tail in B - one block is never full here.
|
|
measure:
|
|
RSTB
|
|
measureLoop:
|
|
LDA.0
|
|
BRA measureDone
|
|
INCD.0
|
|
MVQB
|
|
INIA 0d1
|
|
CCF
|
|
ADD
|
|
MVQB
|
|
BRI measureLoop
|
|
measureDone:
|
|
RSTA
|
|
RRET
|
|
|
|
#Data
|
|
|
|
#Base 0x3000
|
|
|
|
Prefix:
|
|
"system "
|
|
Usage:
|
|
"once what? try: Once /System/Boot/something.bin
|
|
"
|
|
DoneText:
|
|
"next start: "
|
|
OnceText:
|
|
", once
|
|
"
|
|
NoWriteText:
|
|
"it would not write
|
|
"
|
|
OncePath:
|
|
"/System/Boot/once.cfg"
|
|
|
|
Wanted:
|
|
#Reserve 0d129
|
|
Line:
|
|
#Reserve 0d160
|