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

108 lines
2.1 KiB
NASM

; Tries to commit a file bigger than the room it reserved.
;
; osFileStart sets aside an extent and osFileWrite refuses a block index outside it, so the
; obvious way to reach a neighbouring file - writing off the end - is already barred. This
; is the other way to the same place: reserve one block, write the one block, and then tell
; osFileDone the file came to two.
;
; NOTHING WOULD SAY SO IF THAT WERE ALLOWED. A directory entry is the only record of what a
; file owns, so an entry claiming a block it was never given simply owns it, and whatever
; owned it before owns it too. Both files then look perfectly well formed.
;
; Correct behaviour is a refusal, and the file left as it was. The reservation is one block
; and a tail of ten, so:
;
; two blocks and no tail more than was reserved refused
; one block and a tail exactly what was reserved allowed
;
; Written by Anachronaut
#Include services.asm
#Program
#Base 0x5000
start:
; One block, and ten bytes after it.
SETD.0 Name
SETD.3 0x00 0x01
INIA 0d10
SWI osFileStart
BNQ noStart
SETD.1 Block
RSTA
RSTB
SWI osFileWrite
BNQ noWrite
SETD.1 Block
RSTA
INIB 0d1
SWI osFileWrite
BNQ noWrite
; Two whole blocks, which is more than one block and a tail.
SETD.3 0x00 0x02
RSTA
SWI osFileDone
BNQ refused
SETD.0 Allowed
SWI osPrintString
RSTA
SWI osExit
refused:
SETD.0 Refused
SWI osPrintString
; And the honest size, which is what was reserved.
SETD.3 0x00 0x01
INIA 0d10
SWI osFileDone
BNQ noHonest
SETD.0 Honest
SWI osPrintString
RSTA
SWI osExit
noHonest:
SETD.0 NoHonest
SWI osPrintString
INIA 0d1
SWI osExit
noStart:
SETD.0 NoStart
SWI osPrintString
INIA 0d1
SWI osExit
noWrite:
SETD.0 NoWrite
SWI osPrintString
INIA 0d1
SWI osExit
#Data
#Base 0x3000
Name:
"claim.dat"
Block:
#Reserve 0d256
Allowed:
"claiming more than was reserved was ALLOWED
"
Refused:
"claiming more than was reserved was refused
"
Honest:
"and the size it really came to was taken
"
NoHonest:
"the honest size was refused too
"
NoStart:
"no start
"
NoWrite:
"no write
"