Repository navigation
Supported Languages
TIC-80 supports multiple scripting languages, including:
- Fennel (1.5.0)
- Javascript (QuickJS-ng 0.17.0)
- Lua (5.3.6)
- Moonscript (0.5.0)
- YueScript (0.34.3)
- Ruby (mruby 4.0.0)
- Squirrel (3.2)
- Wren (0.4.0)
- Janet (1.42.1)
- Scheme (s7)
- Python (pocketpy)
- MiniScript (MiniScript 2)
- Gravity (0.9.9)
- Forth (lugforth)
The 1.4 release builds left Forth out because pForth gave cartridges raw access to host memory. The sandboxed lugforth runtime replaces it in the 1.5 line; tic80.com does not accept Forth cartridges until that release is live.
TIC-80 also supports compiled languages via our WASM support. If your compiled language of choice can compile to Web Assembly there is a good chance you could use it to develop for TIC-80.
You need to specify the language you use by adding one of the following to the metadata:
| Language | Tag |
|---|---|
| For Fennel | ;; script: fennel |
| For Javascript | // script: js |
| For Lua | -- script: lua |
| For Moonscript | -- script: moon |
| For YueScript | -- script: yue |
| For Ruby | # script: ruby |
| For Squirrel | // script: squirrel |
| For Wren | // script: wren |
| For Janet | # script: janet |
| For Scheme | ;; script: scheme |
| For Python | # script: python |
| For MiniScript | // script: miniscript |
| For Gravity | // script: gravity |
| For Forth | \ script: forth |
| For WASM | -- script: wasm |
Note: If no script tag is added it will be considered as a Lua cart.
- See WASM Support.
To see a demo or start a new project in your scripting language of choice just start up TIC-80 and from the console type new [lang], for example for a Wren project just type:
new wren
Type help new to print arguments for each language.
for some on-screen guidance.
Python integration is based on pocketpy, the list of available modules can be found in the documentation.
You can use this stub file or this more detailed one for vscode's intellisense.
def btn(id: int) -> bool: ...
def btnp(id: int, hold=-1, period=-1) -> bool: ...
def btnr(id: int = -1) -> bool: ...
def circ(x: int, y: int, radius: int, color: int): ...
def circb(x: int, y: int, radius: int, color: int): ...
def clip(x: int | None = None, y: int | None = None, width: int | None = None, height: int | None = None): ...
def cls(color=0): ...
def elli(x: int, y: int, a: int, b: int, color: int): ...
def ellib(x: int, y: int, a: int, b: int, color: int): ...
def exit(): ...
def fget(sprite_id: int, flag: int) -> bool: ...
def fset(sprite_id: int, flag: int, b: bool): ...
def fft(start_freq: int, end_freq=-1) -> float: ...
def ffts(start_freq: int, end_freq=-1) -> float: ...
def fftr(start_freq: int, end_freq=-1) -> float: ...
def fftrs(start_freq: int, end_freq=-1) -> float: ...
def font(text: str, x: int, y: int, chromakey: int, char_width=8, char_height=8, fixed=False, scale=1, alt=False) -> int: ...
def key(code=-1) -> bool: ...
def keyp(code=-1, hold=-1, period=-1) -> bool: ...
def keyr(code=-1) -> bool: ...
def line(x0: int, y0: int, x1: int, y1: int, color: int): ...
def map(x=0, y=0, w=30, h=17, sx=0, sy=0, colorkey=-1, scale=1, remap=None): ...
def memcpy(dest: int, source: int, size: int): ...
def memset(dest: int, value: int, size: int): ...
def mget(x: int, y: int) -> int: ...
def mset(x: int, y: int, tile_id: int): ...
def mouse() -> tuple: ...
def music(track=-1, frame=-1, row=-1, loop=True, sustain=False, tempo=-1, speed=-1): ...
def paint(x: int, y: int, color: int, bordercolor=-1): ...
def peek(addr: int, bits=8) -> int: ...
def peek1(addr: int) -> int: ...
def peek2(addr: int) -> int: ...
def peek4(addr: int) -> int: ...
def pix(x: int, y: int, color: int = None) -> int: ...
def pmem(index: int, value: int = None) -> int: ...
def poke(addr: int, value: int, bits=8): ...
def poke1(addr: int, value: int): ...
def poke2(addr: int, value: int): ...
def poke4(addr: int, value: int): ...
def print(text, x=0, y=0, color=15, fixed=False, scale=1, alt=False) -> int: ...
def rect(x: int, y: int, w: int, h: int, color: int): ...
def rectb(x: int, y: int, w: int, h: int, color: int): ...
def rrect(x: int, y: int, w: int, h: int, color: int, radius=-1, exponent=2): ...
def rrectb(x: int, y: int, w: int, h: int, color: int, radius=-1, exponent=2): ...
def reset(): ...
def sfx(id: int, note=-1, duration=-1, channel=0, volume=15, speed=0): ...
def spr(id: int, x: int, y: int, colorkey=-1, scale=1, flip=0, rotate=0, w=1, h=1): ...
def sync(mask=0, bank=0, tocart=False): ...
def time() -> float: ...
def trace(message, color=15): ...
def tri(x1: float, y1: float, x2: float, y2: float, x3: float, y3: float, color: int): ...
def trib(x1: float, y1: float, x2: float, y2: float, x3: float, y3: float, color: int): ...
def tstamp() -> int: ...
def ttri(x1: float, y1: float, x2: float, y2: float, x3: float, y3: float, u1: float, v1: float, u2: float, v2: float, u3: float, v3: float, texsrc=0, chromakey=-1, z1=0.0, z2=0.0, z3=0.0): ...
def vbank(bank: int = None) -> int: ...
def vqt(bin: int) -> float: ...
def vqts(bin: int) -> float: ...
def vqtr(bin: int) -> float: ...
def vqtrs(bin: int) -> float: ...
def vqtw(bin: int) -> float: ...
def vqtsw(bin: int) -> float: ...
def vqtrw(bin: int) -> float: ...
def vqtrsw(bin: int) -> float: ...Structured edition is an edition mode, available only for lisp-like languages like Scheme and Fennel and with the Emacs mode enabled. It helps the user to keep the program well written by automatically balancing the parenthesis and editing code at an S-Expression level. It will be harder to delete parenthesis until the expression is emptied first, to help keep the balance. Here are some key bindings available in structured edition languages:
| Key Binding | Functionality |
|---|---|
| ctl-down or alt-shift-( | S-Expify (add parenthesis around word or s-expression) |
| ctl-up | Extirp from S-Expression (remove word or s-expression from enclosing s-expression) |
See metadata page.
Scrambier developped a tool to use typescript in TIC-80 that you can find on the external tools page.
TIC-80 tiny computer https://tic80.com | Twitter | Telegram | Terms
Built-in Editors
Console
saveΒ | exportΒ | loadΒ | importΒ | menuΒ | configΒ | surfΒ | shelfΒ | demoΒ | evalΒ
Platform
RAMΒ | VRAMΒ | DisplayΒ | PaletteΒ | Bits per Pixel (BPP)Β |
.ticFormatΒ | Supported Languages
Other
TutorialsΒ | Code SnippetsΒ | LibrariesΒ | External ToolsΒ | FFT
API
Callbacks
Input
Drawing
circΒ | circbΒ | clipΒ | clsΒ | elliΒ | ellibΒ | fontΒ | lineΒ | mapΒ | paintΒ | pixΒ | printΒ | rectΒ | rectbΒ | rrectΒ | rrectbΒ | sprΒ | triΒ | tribΒ | ttriΒ | fill patterns
- textri (deprecated)
Sound
Memory
memcpyΒ | memsetΒ | mgetΒ | msetΒ | peekΒ | pokeΒ | pmemΒ | syncΒ | vbank
System