Tiles and colours are written when a program loads; the map is written whenever anything moves. Sharing one 64K bank made them compete for room neither needed all of, and had a worse consequence than being cramped: a bitmap covers the whole bank, so entering bitmap mode destroyed the font. A program could not draw a picture and then say anything about it. Split, each gets a whole bank. The atlas holds the tiles and the palette, the screen holds the map or a bitmap, and a picture now costs the map and nothing else. It also leaves 48K free in the atlas, which is where the sprite table and a second page of tiles are going. No new mechanism was needed. A bank is registered by naming the port that owns it, so a device with two banks needs two ports that own memory: the base port keeps the atlas, since tiles have been at 0x0000 since there was a screen at all, and 0x3A owns the screen. The registry now answers honestly about which ports in the block bring memory, where it used to say all sixteen did. CosmOS never addresses video memory except in one place - the screen save, which walks 196 pages of it. The page number already says which bank a page is in, so screenBankFor works it out rather than keeping a second list beside screenPageFor. Grid and picture.asm register both banks; colours.asm only touches the palette and needed none of it. Tests/video.sh names the memory every write is for, because an address cannot: tile 5 and bitmap pixel 5 are both 0x0005, and a helper that guessed would be right for the tiles and silently wrong for a picture. And picture.asm gained a check, because this change broke it and nothing noticed - registering the second bank leaves DestBank pointing at it, so the palette went into the wrong one and the picture came out black. It was the only thing here found by looking rather than by a test. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E2JrLzFvuFX9fgi1LDRjrW
53 lines
1.2 KiB
Plaintext
53 lines
1.2 KiB
Plaintext
CosmOS
|
|
> run
|
|
nothing is loaded
|
|
> dir
|
|
greet.sbx 211
|
|
hello.sbx 53
|
|
Life.sbx 1396
|
|
Snake.sbx 2164
|
|
Keys.sbx 664
|
|
Say.sbx 156
|
|
Break.sbx 149
|
|
Grid.sbx 571
|
|
Press.sbx 872
|
|
Mode.sbx 48
|
|
Crash.sbx 632
|
|
vars.script 50
|
|
blocks.script 343
|
|
loops.script 272
|
|
tune.sbx 306
|
|
notes.txt 21
|
|
Apps <dir>
|
|
hi.script 121
|
|
bad.script 45
|
|
plain.script 24
|
|
cross.script 280
|
|
nonl.script 38
|
|
outer.script 376
|
|
inner.script 44
|
|
loop.script 35
|
|
24 files, 1 directory
|
|
> load
|
|
load what?
|
|
> load nosuch.sbx
|
|
no such file
|
|
> load notes.txt
|
|
not a program
|
|
> load greet.sbx
|
|
loaded, starting at 5000
|
|
> run
|
|
a program, loaded off a disk, running on the system that loaded it
|
|
what should I call you? Anachronaut
|
|
hello, Anachronaut. that is all I do.
|
|
finished
|
|
> run
|
|
a program, loaded off a disk, running on the system that loaded it
|
|
what should I call you? Claude
|
|
hello, Claude. that is all I do.
|
|
finished
|
|
> exit
|
|
halted
|
|
Execution halted.
|
|
[exit 0]
|