The register file
li, mv, ABI names, and why x0 is always zero. Guardian: Regina File, the Royal Archivist.
A RISC-V quest in the kingdom of Riscovia
A hundred years ago the starship Hartwell fell from the sky, and a kingdom grew up inside its hull. Tonight its heart-crystal, the HART, is failing. Its spells are written in RISC-V assembly. You know what RISC-V is. You've never written a line of it. Tonight you will.
▶ Click here to playFree. Runs in your browser, on desktop or phone. Nothing to install, nothing compiles: it's all simulated.
double_pulse: addi sp, sp, -16 sd ra, 8(sp) call pulse call pulse ld ra, 8(sp) addi sp, sp, 16 ret # back to main. Probably.
A quest in the style of the late-1980s King's Quest games: walk a kingdom screen by screen, talk to everyone, carry things to the people who need them, and die in silly ways. Riscovia is a fairy-tale kingdom built inside a fallen starship. The sky is the hull, the castle towers are old engines, and the magic is RISC-V.
Everything targets RV64I, the 64-bit base that the RVA23 application profiles are built on: 64-bit registers and addresses, doubleword loads and stores, the W instructions for 32-bit math, and 8-byte stack slots. Instructions are still 32 bits long, and the game makes a point of it.
It's a learning game first. Before any trial, the characters teach you. Mnemo, the spirit of mnemonics who lives in your Codestone, opens with what assembly is and how a processor fetches, decodes and executes. Then each guardian tells the lore of their idea in story: Regina's tower of 32 drawers is the register file, Imelda's 12-bit order slips are immediates, Lou's shelves are byte-addressed memory, Bea's forking river is a branch, the King's herald is the return address. Every lesson has the theory in plain words, a diagram or worked example, and a quick check before you turn the page.
And it teaches the architecture alongside the assembly. Archie Tekt, the ghost of the starship's chief architect, lives in the Codestone too. He explains what an instruction set architecture is, how RISC differs from CISC, why RISC-V is an open standard, and what a hart is. Then he adds a page to every guardian's lesson on why RISC-V is built the way it is: why there are exactly 32 registers, how the instruction formats line up, why there are no condition flags, and why a call keeps its return address in a register. Two optional seminars at his hut cover traps and privilege modes, and pipelines. It's written for a first-year student taking an assembly course and a RISC-V architecture course at the same time.
Each of six guardians then sets a trial, and every trial is a short RISC-V program: a spell. You cast it on your Codestone, a sliver of the ship's heart-crystal, by picking the right line for each blank. Nothing is assembled or run. Every line carries flags, and the Codestone reacts the way a real RV64I chip without misaligned-access support would: a misaligned load traps, a write to x0 vanishes, a loop with no exit spins forever. When a spell fizzles, you learn exactly why. When it holds, you see what each line did, and a page goes into your notebook.
And yes, there's a leaked secret near the end. Someone carved the sky-relay's true name into a public rune stone, and the starship's GitGuardian spirit noticed.
Pick a verb and click something in the scene, or use the row of buttons under the picture. Walk off any edge to reach the next screen. You can also type: talk abby, go east, n, codestone, map.
INSTRUCTION ADDRESS MISALIGNED
You squeeze down the hedge path marked 0x06. Halfway between two stepping stones, the ground simply isn't there. A red light flickers in the hedge: mcause = 0.
Seven ways to die, and each one teaches something. Base RISC-V instructions are 4 bytes long, on RV64 as on RV32, so the program counter moves in steps of 4. Then you try again from the moment before.
Six guardians, six ideas.
li, mv, ABI names, and why x0 is always zero. Guardian: Regina File, the Royal Archivist.
add, sub, addi, the missing subi, and lui for numbers over 2047. Guardian: Imelda Mediate, the Treasurer.
ld and sd on 64-bit doublewords, byte addresses, offset(base), and slli to index a table. Guardian: Lou Ward, the dwarf quartermaster.
Labels, bnez, bge and j: loops that end. Guardian: Bea Nee, the ferrywoman.
jal, ret, a0 to a7, and saving ra in a stack frame. Guardian: King Jay Al.
Memory-mapped I/O, bytes and strings, and a leaked key GitGuardian found in the firmware. Guardian: Gigi, the ship's spirit.
Your progress saves itself in this browser: refresh, or close the tab and come back, and you're where you left off. To move to another device or browser, open the Menu and pick Save code to get a code like X0-XXXX-XXXX-XXXX-XXXX, then enter it on the title screen there. Menu, then Start over, wipes this browser's copy.
Each code is a clean run through that trial, standing where the next one begins. The last one stands you in the starship ruin, ready to wake the HART.
| Progress | Save code |
|---|---|
| Village trial done | X0-9C03-0060-000G-FZT0 |
| Market trial done | X0-CC0F-00Y0-008G-ZZWM |
| Cave trial done | X0-BC1Z-07Y0-008H-ZZYE |
| Falls trial done | X0-AC7Z-0ZY0-008K-ZZR4 |
| Castle trial done | X0-CXZZ-3ZY0-008Q-ZZSS |
| Every trial done | X0-CZZZ-ZZY0-018Z-ZZTS |
Same look, different jobs. In Lossy Inc and Don't Break Prod you clean up leaked secrets with GitGuardian. In The Little Key, a production database key gets copied everywhere. In Where in the World Is Dwayne? you chase a developer advocate across a conference trail.