Files
AnachronautandClaude Opus 5 3449405b18 Give the system another page of each memory
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
2026-09-01 16:49:12 -04:00

63 lines
1.6 KiB
NASM

; A program for CosmOS to load and run.
;
; It carries no library of its own and no vector table. Everything it can do it asks the
; system for, by name, through services.asm, which the system includes too. The order of
; the names in that one file is what gives them their numbers, so neither side has a
; number written down anywhere and the two cannot disagree about them.
;
; Compare it with Programs/loadable/hello.asm, which is the same idea one step earlier:
; that one talks to the console port itself and stops with HALT, because when it was
; written there was no system to ask and nowhere to give the machine back to.
;
; It is assembled for where it will live. #Base says so, and that makes the assembler
; write it out as a loadable program rather than as a boot image. Nothing relocates
; anything, so those addresses have to be the ones CosmOS puts it at.
#Include services.asm
#Program
#Base 0x5000 ; Above the system, which keeps below here.
greet:
SETD.0 Opening
SWI osPrintString
SETD.0 Question
SWI osPrintString
SETD.0 Answer
INIB 0d31
SWI osReadLine
SETD.0 Hello
SWI osPrintString
SETD.0 Answer
SWI osPrintString
SETD.0 Ending
SWI osPrintString
; Give the machine back. The system takes its Stack back at this point, so everything
; this program pushed goes with it.
RSTA
SWI osExit
#Data
#Base 0x3000 ; And its data above the system's.
Opening:
"a program, loaded off a disk, running on the system that loaded it
"
Question:
"what should I call you? "
Hello:
"hello, "
Ending:
". that is all I do.
"
; Thirty one characters and the zero byte that ends them.
Answer:
#Reserve 0d32