A RISC-V quest in the kingdom of Riscovia

x0 Marks the Spot Or: The Heart of the Fallen Starship

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 play

Free. 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.
Fill in the blanks, then cast it on your Codestone.

What is this?

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.

Who it's for

  • Developers who know what RISC-V is and want to read and write its assembly without installing a toolchain.
  • First-year students taking assembly and computer architecture together, who need registers, memory, branches, calls, instruction formats and RISC design to click.
  • Anyone who misses parser quests and doesn't mind a lot of puns about registers.

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.

How it plays

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.

Walkthe kingdom
Lookat anything
Talkto everyone
Useat your peril
  • Everyone is a register. Zero keeps a well that swallows everything. Ray the herald writes down where you came from. Stacy Pointer's tower grows down into the ground.
  • Ten screens, six trials. Paths open as guardians hand you the way through: a market token, a lantern, a ferry bell, a royal summons, a crest key.
  • The Codestone button opens your spells: fourteen of them, each with Mnemo's worked example of the same idea on a different problem.
  • The Lore book keeps every lesson to reread, an instruction reference that grows as you learn, and links to the RISC-V specifications behind every new idea.
  • In a hurry? Skip any lesson, hide the story text, or press Space to finish walking. Every window closes with ✕ or Escape.
  • Points, Sierra style: 10 for a spell that holds on the first cast, 6 if it took a few, plus items, guardians and curiosity. 200 is a perfect quest.

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.

The trials

Six guardians, six ideas.

Village Square

The register file

li, mv, ABI names, and why x0 is always zero. Guardian: Regina File, the Royal Archivist.

Market of Immediates

Arithmetic

add, sub, addi, the missing subi, and lui for numbers over 2047. Guardian: Imelda Mediate, the Treasurer.

Crystal Caves

Memory

ld and sd on 64-bit doublewords, byte addresses, offset(base), and slli to index a table. Guardian: Lou Ward, the dwarf quartermaster.

Loop Falls

Branches and loops

Labels, bnez, bge and j: loops that end. Guardian: Bea Nee, the ferrywoman.

Castle Riscovia

Functions and the stack

jal, ret, a0 to a7, and saving ra in a stack frame. Guardian: King Jay Al.

The Starship Ruin

Hardware and secrets

Memory-mapped I/O, bytes and strings, and a leaked key GitGuardian found in the firmware. Guardian: Gigi, the ship's spirit.

Save codes

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.

Spoilers: codes for facilitators

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.

ProgressSave code
Village trial doneX0-9C03-0060-000G-FZT0
Market trial doneX0-CC0F-00Y0-008G-ZZWM
Cave trial doneX0-BC1Z-07Y0-008H-ZZYE
Falls trial doneX0-AC7Z-0ZY0-008K-ZZR4
Castle trial doneX0-CXZZ-3ZY0-008Q-ZZSS
Every trial doneX0-CZZZ-ZZY0-018Z-ZZTS

More games

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.