hack emulator

A nand2tetris Hack computer running in the browser.

Interactive demo โ†— jsr

Conway's Game of Life โ€” a cellular automaton where cells live, die, or reproduce based on their neighbours.

The Hack computer is a 16-bit machine designed for the nand2tetris course. It has a CPU, ROM, RAM, a memory-mapped 512ร—256 monochrome screen, and a keyboard. Programs are written in Hack assembly and compiled to binary .hack files โ€” one 16-bit instruction per line. This emulator runs those binaries directly in the browser using a high-performance CPU simulation built with @r2/hack-emulator.

  1. life.hack

    Conway's Game of Life โ€” a cellular automaton where cells live, die, or reproduce based on their neighbours.

    โ†— source
  2. r2.hack

    Draws "R2" in big block letters on the screen by writing pixel data directly to memory-mapped I/O.

    โ†— source
  3. waves.hack

    An infinite animation that spawns random bars at the top of the screen and shifts them downward, creating a waves effect.

    โ†— source
  4. pixel.hack

    Draws a single pixel to the screen โ€” the simplest possible graphical program.

    โ†— source