Sikau

Learn Assembly language

Write real RISC-V: registers, memory, the stack and machine code.

Program the CPU directly in RISC-V assembly on a simulated 32-bit machine in your browser. Learn registers and instructions, branches and loops, memory and arrays, the calling convention, recursion on the stack, strings and bit tricks — then compile C by hand, encode machine code, and write a complete program. Every run shows the registers afterwards.

Advanced · 12 lessons · about 8 hours · free

Start Assembly language free: run real code in your browserright here

Continue with Google

What you will learn

Unit 1: Registers and instructions

Your first programs, arithmetic, branches and memory.

  1. Day 1Hello, RISC-VRegisters, your first instructions and asking the system to print.30 min
  2. Day 2Arithmetic and functionsaddi, sub, mul, div and rem — and your first function with arguments in a0.35 min
  3. Day 3Branches and loopsConditional branches, jumps and turning a while loop into assembly.35 min
  4. Day 4Memory: load and storeThe .data section, addresses, lw and sw, and walking through an array.40 min

Unit 2: Functions and the stack

The calling convention, recursion, strings and printing.

  1. Day 5Calling conventioncall and ret, the return address, and which registers a function must preserve.40 min
  2. Day 6The stack and recursionStack frames, why recursion needs them, and Fibonacci in assembly.40 min
  3. Day 7Strings and bytesNull-terminated strings, lb/lbu/sb, and changing text in place.35 min
  4. Day 8Project: Printing numbersTurn a number into decimal digits yourself — what printf does under the hood.40 min

Unit 3: Under the hood

Bits, compiling C by hand, machine code and a full program.

  1. Day 9Bits and masksand, or, xor and shifts — counting bits and spotting powers of two.35 min
  2. Day 10From C to assemblyHow for-loops, ifs, arrays and early returns compile — by translating one yourself.40 min
  3. Day 11Machine codeHow `add` and `addi` become 32-bit numbers — encode and decode them in JavaScript.40 min
  4. Day 12Capstone: Sort and printA full program: main, a bubble sort that swaps in memory, and a printer.55 min

Before you start

These courses make Assembly language easier:

See all courses

Built with ❤️ by dibe.sh