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
51 lines
1.8 KiB
NASM
51 lines
1.8 KiB
NASM
; Forty columns or eighty, whichever the screen is not in.
|
|
;
|
|
; A machine wakes up in the forty column mode and CosmOS asks for eighty, because that is
|
|
; what its own output was written for. A game is the other way round: Snake on a forty column
|
|
; screen is the same board drawn twice the size, which is what a person sitting in front of
|
|
; it actually wants.
|
|
;
|
|
; ---- The smallest program this system can load ----
|
|
;
|
|
; Ten instructions and NO DATA AT ALL, which is not a curiosity: it is the shape that found
|
|
; a bug in the loader. Every program written for CosmOS until this one had something in its
|
|
; Data Segment, so the loader had never been asked to move a segment of no bytes - and a
|
|
; length of zero asks the memory controller for the whole 64K, which does not fit, which it
|
|
; refused, which stopped the machine in the middle of loading. On a terminal that printed a
|
|
; fault. Behind a window it looked exactly like a hang.
|
|
;
|
|
; So this is kept dataless on purpose. The two digits it prints are put in a register one at
|
|
; a time rather than being a string, which is the only reason it can say anything at all.
|
|
;
|
|
; Written by Anachronaut
|
|
|
|
#Include services.asm
|
|
|
|
#Program
|
|
|
|
#Base 0x5000
|
|
|
|
start:
|
|
INA 0x31 ; Which mode the screen is in now.
|
|
BRA modeWide ; Nought is the forty column one, so go the other way.
|
|
|
|
; Anything else becomes forty, and that deliberately includes bitmap mode. A program that
|
|
; left the screen with no text on it left nowhere to print, so coming back to a mode that
|
|
; has characters in it is more use than refusing.
|
|
RSTA
|
|
OUTA 0x31
|
|
INIA 0x34 ; '4'
|
|
BRI modeSay
|
|
modeWide:
|
|
INIA 0x01
|
|
OUTA 0x31
|
|
INIA 0x38 ; '8'
|
|
modeSay:
|
|
OUTA 0x00
|
|
INIA 0x30 ; '0'
|
|
OUTA 0x00
|
|
INIA 0x0A
|
|
OUTA 0x00
|
|
RSTA
|
|
SWI osExit
|