Skip to content

Instantly share code, notes, and snippets.

@paniq
Last active October 5, 2024 06:12
Show Gist options
  • Save paniq/7814560e2b560b76911b to your computer and use it in GitHub Desktop.
Save paniq/7814560e2b560b76911b to your computer and use it in GitHub Desktop.
PICO-8 hacks & secrets
Screen resolutions
------------------
PICO-8 supports different undocumented videomodes that can be activated at runtime,
using poke(0x5F2C, X) where X is one of the following mode numbers:
0: 128x128, 0 pages
1: 64x128, 1 page
2: 128x64, 1 page
3: 64x64, 3 pages
4: ?
5: 64x128, x-mirrored, 1 page
6: 128x64, y-mirrored, 1 page
7: 64x64, xy-mirrored, 3 pages
Stat
----
undocumented parameters for stat(n):
16..19: the sfx currently playing on each channel or -1 for none
20..23: the currently playing row number (0..31) or -1 for none
Audio Data
----------
address range: 0x3100..0x31ff (256 bytes)
64 patterns, each with 4 bytes:
byte 0: 7-bit pattern index + high bit means 'Loop Start'
byte 1: 7-bit pattern index + high bit means 'Loop End'
byte 2: 7-bit pattern index + high bit means 'Stop'
byte 3: 7-bit pattern index + high bit unused
0x3200..0x42ff (4352 bytes)
64 sounds, each with 68 bytes of data:
The first 64 bytes is the 32 notes, each note takes 16 bits:
byte 0 bits 0..5 : note value (0..63) -- 0 means C-1
byte 0 bits 6..7 : low bits of instrument value (encodes 0..3)
byte 1 bit 0 : high bit of instrument value (encodes +4)
byte 1 bits 1..3 : volume (0..7)
byte 1 bits 4..6 : effect (0..7)
Then 4 bytes for:
Editing mode (0 = tracker, 1 = frequency graph) // not relevant during runtime
Sound Speed
Loop Start
Loop End
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment