Graphics:: Display: Sprites: Map: Sound
Graphics:: Display: Sprites: Map: Sound
TIC-80 cls
(color=0)
pix
(x,y[color]) [-> color]
Display: 240x136, 16 colors, Input: 4 pads, 8 buts, kb/mouse circ(x,y,r,color) -
- filled circle
circb(x,y,r,color) -- border circle
Sprites: 256 8x8 fore sprites, 256 8x8 bg tiles rect(x,y,w,h,color) -- filled rect
Map: 240x136 cells, 1920x1088 (240*8, 136*8) rectb(x,y,w,h,color) -- border rect
Sound: 4 channels/envelopes, Code: 64KB (pro 512, 8 banks) line(x0,y0,x1,y1,color)
spr
(id,x,y,colorkey=-1,scale=1,flip=0,
Mem map: rotate=0,w=1,h=1)
00000 SCREEN 16320 240x136=4b/pix -- colorkey: opaque (-1) or color index
03FC0 PALETTE 48 16x24b RGB -- flip: 0,1,2,3 -> no,horiz,vert,both
03FF0 PALETTE MAP 8 16x4b color indexes -- rotate: 0,1,2,3 -> 0, 90, 180, 270
03FF8 BORDER COLOR 1 4b color -- w,h: how many sprites to draw
03FF9 SCREEN OFFSET 2 horz/vert -128+127 tri
(x1,y1,x2,y2,x3,y3,color)
03FFB MOUSE CURSOR 1 index of mouse curs textri(x1,y1,x2,y2,x3,y3,u1,v1,u2,v2,u3,v3,
03FFC ... 4 use_map=false,colorkey=-1)
04000 BG SPRITES 8192 256 8x8 4b 0..255 -- use_map: sprites, tiles -> false, true
06000 FG SPR/TILES 8192 256 8x8 4b 256..512 -- colorkey: opaque (-1) or color index(s)
08000 MAP 32640 8x8 240x136 cells map
(x=0,y=0,w=30,h=17,sx=0,sy=0,colorkey=-1,
0FF80 GAMEPADS 4 state of 4 gpads scale=1,remap=nil)
0FF84 MOUSE 4 mouse X/Y/buttons -- x,y,w,h: rect of map tiles to draw
0FF88 KEYBOARD 4 codes: 4 keys max -- colorkey: opaque (-1) or color index
0FF8C ... 16 -- scale: scaling drawn tiles?
0FF9C SOUND REGS 72 18 byte x 4 ch -- remap: func(tile,x,y)->tile,flip,rot
0FFE4 WAVEFORMS 256 16 wave/ 32x4b each font(text,x,y,colorkey,charwidth,charheight,
100E4 SFX 4224 64 sounds fixed=false,scale=1) -> width
11164 MUSIC PATTERNS 11520 64 rowsx 60 patts -- bmpfont using sprites, fixed=true -> mono
13E64 MUSIC TRACKS 408 8 tracks -- start @ sprite 256 is '0'
13FFC MUSIC POS 4 state of music print(text,x=0,y=0,color=15,fixed=false,
14000 ... 0 scale=1,smallfont=false) -> width
Cart metadata: clip(x,y,w,h)
fget(index,flag:0..7) -> bool -- check spr flag
dofile
("example.lua") fset(index,flag:0..7,set) -- re/set spr flag
-- title: game title
-- author: author Sound:
-- desc: short desc sfx
(id,note,duration=-1,channel=0,volume=15,
-- script: lua (moon/wren/js/fennel) speed=0)
-- input: gamepad (mouse/keyboard) music
(track=-1,frame=-1,row=-1,loop=true)
-- saveid: MyAwesomeGame Input:
btn
(id:0..31) -> pressed
Place "example.lua" in TIC dir to edit using external editor
btnp(id:0..31,[hold],[period]) -> pressed
Callbacks: key
(code) -> pressed --
key statein cur frame
TIC
() -> called once per frame keyp(code,hold=0,period=0)
SCN
(line) -> called once per scanline -- key just pressed, or held after $hold ticks
OVR
() -> called once per frame, overlay layer -- $period is ticks til next true if $hold
mouse() -> x,y,left,middle,right,scrollx,scrolly
Palette:
Memory:
Build palette here then add palette setter, ex pico8:
peek
(addr) -> value
palet="
0000001d2b537e255383769cab5236008751ff004d5f574
fff77a8ffa300c2c3c700e436ffccaa29adffffec27fff1e8"
peek4(addr) -> value -
- 4 bits, (addr*2)+nibble
paladr=0x3fc0;
fori=1,palet:
len
(),2 poke
(addr,value) -> value
do
;
poke
(paladr,
tonumber
("
0x
"..palet:sub
(i,i)..palet:
su poke4(addr,value) -> value -
- 4 bits
b
(i+1,i+1)));paladr=paladr+1;
end pmem
(index:0..255,[value]) [-> value]
-- load/save int from/to persistent mem
Key Codes: memcpy(dest_addr,source_addr,length)
01 A 02 B 03 C 04 D 05 E 06 F 07 G 08 H mget
(x,y) -> id -- get bgspr id at map x,y
mset
(x,y,id) -- change bgspr id at map x,y
09 I 10 J 11 K 12 L 13 M 14 N 15 O 16 P System:
trace(msg,color)
17 Q 18 R 19 S 20 T 21 U 22 V 23 W 24 X time
() -> milliseconds since game start
tstamp() -> current unix timestamp
25 Y 26 Z 27 0 28 1 29 2 30 3 31 4 32 5 exit
()
reset()
-- reset cart
33 6 34 7 35 8 36 9 37 - 38 = 39 ( 40 ) sync
([mask=0],[bank=0],[tocart=false])
-- pro: bank switching any section
41 \ 42 ; 43 ' 44 ` 45 , 46 . 47 /
Tracker
48 49 50 51 52 53 54 55 A: break, SPC: prev note, RET: play/stop frame
SPC TAB RET BKSP DEL INS PGUP PGDN SHFT+RET: play pat @ cursor
Note NNOSSV -> "NN" note[#],"O" octave:1..8,
56 57 58 59 60 61 62 63 "SS" sfx voice:0..63, "V" volume:0..F
HOME END UP DOWN LEFT RGHT CAPS CTRL Editor:
F1: code, F2: sprites, F3: map, F4: sfx, F5: mus
64 65
F6: crt, F7: assign cover img, F8: screenshot
SHFT ALT
F9: GIF record, F11: window mode