Cart binary format
.sprite carts are TLV-structured binary blobs. Total cart size is capped at 32 KB. Source code, when present, ships in a separate SRC section that sits outside the cap.
Header (80 bytes)
offset size field
------ ---- ----------
0 4 magic = "SPRT"
4 2 version (u16 LE; v1 today)
6 1 machine_id (u8; today only M8 = 0x01)
7 1 palette_id (u8; 0=PICO-8, 1=DB16, 2=Sweetie 16)
8 2 flags (u16 LE; reserved, 0 in v1)
10 2 reserved_1 (all zero)
12 32 title (NUL-padded UTF-8)
44 32 author (NUL-padded UTF-8)
76 4 reserved_2 (all zero)
magic— fixed bytes"SPRT".version— cart format version (u16 LE; currently 1).machine_id— target machine; today onlyM8(0x01).palette_id— 0 = PICO-8, 1 = DB16, 2 = Sweetie 16. Wasreserved_0pre-P3.6.flags— u16 LE; reserved, all zero in v1.title,author— 32 bytes each, NUL-padded UTF-8.reserved_1,reserved_2— all zero; reserved for future header growth without bumping the format version.
TLV sections
Each section: 4-byte tag + 4-byte LE length + payload.
| Tag | Cap | Contents |
|---|---|---|
CODE | 16 KB | Compiled bytecode (Op stream + word table). |
SPRT | 8 KB | Sprite sheet — up to 256 tiles × 8×8 × 4-bit indices. |
SOND | 8 KB | Tracker data — instruments + 32×5 patterns + tempo. |
META | — | JSON metadata — title, author, update word address. No per-section cap; bounded only by the 32 KB aggregate. |
RAMI | 8 KB | RAM-init bytes for s"" string literals (P2.4). |
SRC | unbounded | Original Forth source — outside the 32 KB cap. Used by /studio's Load .sprite. |
Total size budget
32,768-byte hard cap covers header + all capped TLV sections (CODE, SPRT, SOND, META, RAMI). SRC sits outside this cap and may grow arbitrarily.