Skip to content

Instantly share code, notes, and snippets.

@tevino
Forked from paniq/pico8.txt
Created May 27, 2018 11:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tevino/782e5c7e661c27c84e86fd0af03f628e to your computer and use it in GitHub Desktop.
Save tevino/782e5c7e661c27c84e86fd0af03f628e 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