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
146 lines
3.6 KiB
NASM
146 lines
3.6 KiB
NASM
; Breaks on purpose, in whichever of the four ways it is asked for.
|
|
;
|
|
; Every one of these used to stop the machine and print a line to a standard error that
|
|
; nobody behind a window is looking at, so the machine appeared to hang. The system catches
|
|
; all of them now and says what happened and where, and this is what says so - and what a
|
|
; person can run when they want to see the fault screen without having written a bug first.
|
|
;
|
|
; Crash opcode a byte in the middle of the code that does not decode
|
|
; Crash service a SWI naming a service the system does not implement
|
|
; Crash bank a transfer out of a bank that has nothing registered in it
|
|
; Crash device asking the console to interrupt, with no handler installed
|
|
; Crash blind the same bad byte, but from a screen with nowhere to print at all
|
|
;
|
|
; The last one is the odd one: it is not something this program does wrong, it is something
|
|
; it fails to have done. The interrupt arrives from outside once the console has anything to
|
|
; say, and with no input it is the END of input that arrives.
|
|
;
|
|
; Written by Anachronaut
|
|
|
|
#Include services.asm
|
|
|
|
#Program
|
|
|
|
#Base 0x5000
|
|
|
|
start:
|
|
SETD.0 Argument
|
|
INIB 0d15
|
|
SWI osArgument
|
|
|
|
SETD.0 Argument
|
|
SETD.1 WordOpcode
|
|
CALL textSame
|
|
BRQ crashOpcode
|
|
SETD.0 Argument
|
|
SETD.1 WordService
|
|
CALL textSame
|
|
BRQ crashService
|
|
SETD.0 Argument
|
|
SETD.1 WordBank
|
|
CALL textSame
|
|
BRQ crashBank
|
|
SETD.0 Argument
|
|
SETD.1 WordDevice
|
|
CALL textSame
|
|
BRQ crashDevice
|
|
SETD.0 Argument
|
|
SETD.1 WordBlind
|
|
CALL textSame
|
|
BRQ crashBlind
|
|
|
|
SETD.0 Usage
|
|
SWI osPrintString
|
|
INIA 0x0A
|
|
OUTA 0x00
|
|
INIA 0x01
|
|
SWI osExit
|
|
|
|
; ---- The case the fault screen exists for ----
|
|
;
|
|
; Bitmap mode has no text rows, so the console draws NOTHING there: a program that faults
|
|
; here leaves the system with a message to print and nowhere to print it. Putting the screen
|
|
; back into a mode that has characters in it is the difference between a diagnosis and a
|
|
; machine that appears to have hung.
|
|
crashBlind:
|
|
; ---- And with the colours ruined as well ----
|
|
;
|
|
; A known mode is only half a known screen. This makes the ink of attribute one the same as
|
|
; its paper, which is what a program that wrote its own palette can easily leave behind -
|
|
; and a message printed into that is perfectly present and completely invisible.
|
|
INIA 0d4
|
|
OUTA 0xE3
|
|
INIA 0x30
|
|
OUTA 0xE2
|
|
INIA 0x03
|
|
OUTA 0xE8 ; Video memory as bank four.
|
|
|
|
INIA 0d4
|
|
OUTA 0xE3
|
|
INIA 0xFC
|
|
OUTA 0xE4
|
|
INIA 0x40
|
|
OUTA 0xE5 ; 0xFC40, the two entries attribute one draws from.
|
|
RSTA
|
|
INIB 0d8
|
|
crashBlindWipe:
|
|
OUTA 0xE9
|
|
DECB
|
|
BNB crashBlindWipe ; Both of them black, ink and paper alike.
|
|
|
|
INIA 0x02
|
|
OUTA 0x31
|
|
|
|
crashOpcode:
|
|
0x00 ; Not an instruction, and never will be.
|
|
|
|
crashService:
|
|
SWI 0d40 ; Forty is nobody's.
|
|
|
|
crashBank:
|
|
INIA 0d9 ; Nothing is registered there.
|
|
OUTA 0xE0
|
|
RSTA
|
|
OUTA 0xE1
|
|
OUTA 0xE2
|
|
INIA 0d1
|
|
OUTA 0xE3 ; Into Data Memory.
|
|
RSTA
|
|
OUTA 0xE4
|
|
OUTA 0xE5
|
|
OUTA 0xE6
|
|
INIA 0d16
|
|
OUTA 0xE7
|
|
INIA 0x01
|
|
OUTA 0xE8 ; Blit, from a bank that is not there.
|
|
|
|
crashDevice:
|
|
INIA 0x02 ; Interrupt me when the console has something to say.
|
|
OUTA 0x02
|
|
SIF
|
|
crashWait:
|
|
; Never touches the console, so whatever happens next came from outside.
|
|
BRI crashWait
|
|
|
|
#Data
|
|
|
|
#Base 0x3000
|
|
|
|
WordOpcode:
|
|
"opcode"
|
|
WordService:
|
|
"service"
|
|
WordBank:
|
|
"bank"
|
|
WordDevice:
|
|
"device"
|
|
WordBlind:
|
|
"blind"
|
|
Usage:
|
|
"Crash opcode | service | bank | device | blind"
|
|
|
|
Argument:
|
|
#Reserve 0d16
|
|
|
|
#Include text.asm
|