Sprites: things that move without the screen moving

Everything drawn on this machine was in a cell. Something between two
cells meant rewriting both; something moving a pixel at a time meant
rewriting them sixty times a second, which is affordable for one thing
and not for twenty. A sprite is put at a pixel and the device draws it
over whatever is behind, so moving it costs two bytes.

MADE OF TILES, which is the decision the rest follows from: m by n taken
in reading order from one index, so there is no second pixel format, no
second kind of memory, and nothing a sprite can show that the map cannot.
A 16 by 16 character is four tiles and the background can name the same
four.

256 entries of 8 bytes at 0xC000 in the atlas - eight so the entry
address is a shift, the same no-multiply argument as the palette's four.
Position is signed and sixteen bits, because 640 by 400 does not fit in a
byte and a sprite has to be able to sit half off the left rather than
appearing whole at the edge.

A PIXEL OF ZERO IS NOT DRAWN, or every sprite is a rectangle. Tested
before the attribute is added, so a hole belongs to the art and not to
the colour scheme. The same rule the other way round is what "behind"
means: drawn only where the background pixel was zero, so a thing walks
behind a pillar and in front of the floor in one frame.

All of them draw, every frame, so they cannot flicker. Real machines
dropped them per scanline because they had a fixed number of shift
registers; this has a loop. The limit is the size of the table, which is
a constant rather than a property of what is on screen.

And the system takes them down at exit. The sprite table sits in the gap
the screen save walks around - to the end of the map, then the palette -
and that is right, because nothing the shell draws is a sprite: there is
nothing to give back, only something to take away. Otherwise a program
that put a ball up and left would leave it over the prompt, in front of
everything, with nothing able to type it away. Sprite.asm deliberately
leaves its own, because a program that faulted could not have cleared it.

Every check here was re-broken and failed: transparency, reading order,
draw order, priority, and size. Size needed breaking twice - the first
attempt did not compile, and a silent build failure had left the old
binary passing.

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 11:42:11 -04:00
co-authored by Claude Opus 5
parent eee95ef0ce
commit a916103a7f
21 changed files with 801 additions and 14 deletions
+2 -1
View File
@@ -23,6 +23,7 @@ Grid.sbx 571
Press.sbx 872
Mode.sbx 48
Flip.sbx 173
Sprite.sbx 442
Crash.sbx 632
vars.script 50
blocks.script 343
@@ -39,7 +40,7 @@ outer.script 376
inner.script 44
loop.script 35
crossed.txt 560
26 files, 1 directory
27 files, 1 directory
> exit
halted
Execution halted.
+2 -1
View File
@@ -13,6 +13,7 @@ Grid.sbx 571
Press.sbx 872
Mode.sbx 48
Flip.sbx 173
Sprite.sbx 442
Crash.sbx 632
vars.script 50
blocks.script 343
@@ -28,7 +29,7 @@ nonl.script 38
outer.script 376
inner.script 44
loop.script 35
25 files, 1 directory
26 files, 1 directory
> drive 1
> dir
other.txt 28
+2 -1
View File
@@ -30,6 +30,7 @@ Grid.sbx 571
Press.sbx 872
Mode.sbx 48
Flip.sbx 173
Sprite.sbx 442
Crash.sbx 632
vars.script 50
blocks.script 343
@@ -45,7 +46,7 @@ nonl.script 38
outer.script 376
inner.script 44
loop.script 35
25 files, 1 directory
26 files, 1 directory
> exit
halted
Execution halted.
+2 -1
View File
@@ -20,6 +20,7 @@ Grid.sbx 571
Press.sbx 872
Mode.sbx 48
Flip.sbx 173
Sprite.sbx 442
Crash.sbx 632
vars.script 50
blocks.script 343
@@ -35,7 +36,7 @@ nonl.script 38
outer.script 376
inner.script 44
loop.script 35
25 files, 1 directory
26 files, 1 directory
> exit
halted
Execution halted.
+2 -1
View File
@@ -20,6 +20,7 @@ Grid.sbx 571
Press.sbx 872
Mode.sbx 48
Flip.sbx 173
Sprite.sbx 442
Crash.sbx 632
vars.script 50
blocks.script 343
@@ -35,7 +36,7 @@ nonl.script 38
outer.script 376
inner.script 44
loop.script 35
25 files, 1 directory
26 files, 1 directory
> exit
halted
Execution halted.
+2 -1
View File
@@ -106,6 +106,7 @@ Grid.sbx 571
Press.sbx 872
Mode.sbx 48
Flip.sbx 173
Sprite.sbx 442
Crash.sbx 632
vars.script 50
blocks.script 343
@@ -121,7 +122,7 @@ nonl.script 38
outer.script 376
inner.script 44
loop.script 35
25 files, 1 directory
26 files, 1 directory
> exit
halted
Execution halted.
+2 -1
View File
@@ -25,6 +25,7 @@ Grid.sbx 571
Press.sbx 872
Mode.sbx 48
Flip.sbx 173
Sprite.sbx 442
Crash.sbx 632
vars.script 50
blocks.script 343
@@ -40,7 +41,7 @@ nonl.script 38
outer.script 376
inner.script 44
loop.script 35
25 files, 1 directory
26 files, 1 directory
> exit
halted
Execution halted.
+2 -1
View File
@@ -13,6 +13,7 @@ Grid.sbx 571
Press.sbx 872
Mode.sbx 48
Flip.sbx 173
Sprite.sbx 442
Crash.sbx 632
vars.script 50
blocks.script 343
@@ -28,7 +29,7 @@ nonl.script 38
outer.script 376
inner.script 44
loop.script 35
25 files, 1 directory
26 files, 1 directory
> load
load what?
> load nosuch.sbx
+2 -1
View File
@@ -11,6 +11,7 @@ Grid.sbx 571
Press.sbx 872
Mode.sbx 48
Flip.sbx 173
Sprite.sbx 442
Crash.sbx 632
vars.script 50
blocks.script 343
@@ -26,7 +27,7 @@ nonl.script 38
outer.script 376
inner.script 44
loop.script 35
25 files, 1 directory
26 files, 1 directory
> load Say.sbx
loaded, starting at 5000
> run the disk took its time
+43
View File
@@ -0,0 +1,43 @@
CosmOS
> Say before Sprite
it says: before Sprite
finished
> Sprite
A ball, over the shell's own words. Nothing underneath is written to. Press a key.
finished
> Say after Sprite
it says: after Sprite
finished
> 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
Flip.sbx 173
Sprite.sbx 442
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
26 files, 1 directory
> exit
halted
Execution halted.
[exit 0]