↗

Snake on nand2tetris

Written in Jack. Compiled to VM code. Running here.

Play with the arrow keys. Then follow a single turn from your keyboard to the screen.
HACK SCREEN512 × 256 / 1 BIT
Loading Jack VM…
Status: Loading VM assets
Arrow keys to steer · Q to quit

From key to pixel.

One turn, through three layers

Send a right-arrow turn and watch the program read the key, move the snake, and draw its new position.

The game pauses after the move. Every value comes from the running program.
DebuggerInstruction stepping and raw VM state

Stepping skips the game's timing delays.

EXECUTION0 INSTRUCTIONS

Press Start to watch, or step through one instruction at a time.

CURRENT FUNCTIONLoading…
STACK · TOP AT RIGHT
Empty
THIS 0THAT 0KEY 0
CALL STACK

—

Recent input and drawing calls

Jack source

Loading source…
FIG. 01 — A GAME, TAKEN APART

Compiled VM instructions run in a browser emulator, one operation at a time.

Play it. Look inside.

Written in Jack for nand2tetris, compiled to VM code, and running in a browser VM emulator. Jack OS calls are implemented as native browser shims. This demo runs at the VM layer; it does not simulate the CPU or logic gates.