Four pages of tiles, in bits that were already there

A tile number is a byte and a byte reaches 256, which is not many once a
font has taken 135 of them and a game wants a character, a background and
a wall. Bits 4 and 5 of the attribute now say which page of 256 the
number is in - bits already written on every cell and every sprite, and
reserved for this since the attribute was defined.

Four pages of 16K is 64K, which is the whole atlas, so THE FOURTH PAGE IS
THE MEMORY THE SPRITE TABLE AND THE PALETTE ARE IN. That is not a hole in
the design; it is the answer shared video memory has always given, and it
is checked rather than forbidden. The atlas is 1024 tiles, and what a
program spends on sprites and colours comes out of them: no sprites means
page 3 is art, and sprites means 768 tiles and a reason.

The page is a property of the CELL and not a mode, so one screen shows
tiles from all four at once and nothing has to decide which page it is in.

Both places a tile is drawn from now ask one function where the art is.
They would otherwise drift: the sprite pass was written days after the map
pass and neither is where the other is looked at.

Nothing in CosmOS changes. The shell draws from page 0, which the screen
save covers; a tile left in another page is invisible unless a map cell
names that page, and the map is given back or cleared.

Both breaks were tried and both failed the checks - and the second had to
be tried twice, because the constant it needed lives in video.h and the
harness was only editing video.c. That is the same silent no-op as
yesterday's uncompiled break, in a different disguise.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E2JrLzFvuFX9fgi1LDRjrW
This commit is contained in:
Anachronaut
2026-09-02 12:59:02 -04:00
co-authored by Claude Opus 5
parent a916103a7f
commit 9eed23120f
5 changed files with 132 additions and 14 deletions
+5
View File
@@ -1205,6 +1205,11 @@ before quietly answers to nothing.
| 5 | The screen's map, for the same. |
| 6 and up | Free for a program to use. |
**Tile pages 1 to 3 are not saved either**, and need not be: the shell's own text is drawn
from page 0, which is, and a tile left in another page is invisible unless a map cell names
that page - and the map is given back or cleared. What a program puts in page 1 is its own
and nobody is looking at it afterwards.
**The sprite table is cleared at exit, not saved and restored.** It lives in the atlas at
0xC000, and the pages the screen save walks run to the end of the map and pick up again at the
palette, with the sprites in the gap between. That is deliberate: nothing the shell draws is a