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
110 lines
1.8 KiB
NASM
110 lines
1.8 KiB
NASM
; Goes somewhere else and reads a file by a bare name once it is there.
|
|
;
|
|
; This exists to prove two things the shell promises and nothing else could test. First
|
|
; that osChangeDir works: the file it prints is named with no path at all, so the only way
|
|
; to reach it is to be standing in the right place. Second that the shell puts the working
|
|
; directory back afterwards: the prompt after this returns says where the shell was, not
|
|
; where this went.
|
|
;
|
|
; Written by Anachronaut
|
|
|
|
#Include services.asm
|
|
#Program
|
|
#Base 0x5000
|
|
|
|
start:
|
|
; Where to go is the argument. Nothing else about this program says a directory name, so
|
|
; running it anywhere else moves it anywhere else.
|
|
SETD.0 Where
|
|
INIB 0d63
|
|
SWI osArgument
|
|
SETD.0 Where
|
|
LDA.0
|
|
BRA noWhere
|
|
|
|
SETD.0 Where
|
|
SWI osChangeDir
|
|
BNQ noSuchPlace
|
|
|
|
SETD.0 Went
|
|
SWI osPrintString
|
|
|
|
; And now a bare name, which means nothing until you are somewhere.
|
|
SETD.0 Bare
|
|
CALL fileStreamOpen
|
|
BNQ noFile
|
|
|
|
wanderBlock:
|
|
CALL fileStreamNext
|
|
BNQ noFile
|
|
PSHD.3
|
|
POPB
|
|
POPA
|
|
SETD.2 Left
|
|
STA.2
|
|
INCD.2
|
|
STB.2
|
|
|
|
SETD.2 Left
|
|
LDA.2
|
|
INCD.2
|
|
LDB.2
|
|
OR
|
|
BRQ wanderDone
|
|
|
|
SETD.0 FileStreamBlock
|
|
SETD.2 Left
|
|
INCD.2
|
|
LDB.2
|
|
wanderByte:
|
|
LDA.0
|
|
OUTA 0x00
|
|
INCD.0
|
|
DECB
|
|
BNB wanderByte
|
|
BRI wanderBlock
|
|
|
|
wanderDone:
|
|
RSTA
|
|
SWI osExit
|
|
|
|
noWhere:
|
|
SETD.0 NoWhereText
|
|
SWI osPrintString
|
|
INIA 0d1
|
|
SWI osExit
|
|
noSuchPlace:
|
|
SETD.0 NoPlaceText
|
|
SWI osPrintString
|
|
INIA 0d1
|
|
SWI osExit
|
|
noFile:
|
|
SETD.0 NoFileText
|
|
SWI osPrintString
|
|
INIA 0d1
|
|
SWI osExit
|
|
|
|
#Data
|
|
#Base 0x3000
|
|
|
|
Where:
|
|
#Reserve 0d64
|
|
Left:
|
|
0x00 0x00
|
|
Went:
|
|
"moved, and reading a bare name from there:
|
|
"
|
|
NoWhereText:
|
|
"wander where?
|
|
"
|
|
NoPlaceText:
|
|
"cannot go there
|
|
"
|
|
NoFileText:
|
|
"nothing of that name here
|
|
"
|
|
Bare:
|
|
"notes.txt"
|
|
|
|
#Include fileStream.asm
|