Foundry-5 by atticarun

itch.io

2 min read Original article ↗

Foundry-5 is a free browser puzzle game that teaches you real RISC-V (RV32I) assembly language. Not a toy or pseudo-code, the actual 32-bit instruction set. You play by writing bare-metal firmware to bring a dead automated factory back online, one system at a time.

Each puzzle hands you a small machine (an LED, a sensor, a frame buffer, a motor) and asks you to make it work by writing assembly. Your code runs on a built-in RISC-V CPU emulator with a live view of every register, every byte of memory, and every instruction as it executes. Watch the machine think, step by step.

The emulator is also a full RARS-compatible simulator. Programs written for RARS coursework run here unchanged: ecall services, stdin and stdout, breakpoints, step-back, macros, .include, the Bitmap Display and Keyboard MMIO tools, exception handlers and interrupts. Open your own .s files in the Scratchpad and use it as your everyday RISC-V environment.

What you'll learn

- Registers and how data moves through a CPU

- Memory: loads, stores, addressing, and buffers

- Loops, branches, and control flow in assembly

- The calling convention: functions, the stack, recursion

- Bit manipulation: masks, flags, packing and unpacking

- SIMD / vector instructions and real codec kernels

- Floating point: the F and D extensions, conversions, and rounding modes

- Exceptions and interrupts: trap handlers, ucause, timers, and keyboard input

- How computer architecture actually fits together at the lowest level