# RISC-V Documentation

> RV32 and RV64 assembly for the RARS simulator. Covers instructions, directives, registers, syscalls, screen and keyboard access, and using C and C++.

Web page: https://asm-editor.specy.app/documentation/risc-v

This reference covers RV32 and RV64 assembly for the RARS simulator. For a service call, put its number in `a7` and use the listed registers for its arguments and result; see [Syscalls](https://asm-editor.specy.app/documentation/risc-v/syscall.md).

## Chapters

- [Instructions](https://asm-editor.specy.app/documentation/risc-v/instruction.md): Every instruction and pseudo-instruction of RV32 and RV64. (263 entries)
- [Directives](https://asm-editor.specy.app/documentation/risc-v/directive.md): What the assembler does with the lines that start with a dot. (32 entries)
- [Syscalls](https://asm-editor.specy.app/documentation/risc-v/syscall.md): RARS simulator services selected by the number in `a7`, with arguments and results in the registers listed for each service. (51 entries)
- [Registers](https://asm-editor.specy.app/documentation/risc-v/registers.md): The general purpose registers, the FPU and the control and status registers. (34 entries)
- [Screen](https://asm-editor.specy.app/documentation/risc-v/screen.md): The bitmap display, the keyboard and console registers, and program time. (6 entries)
- [Interrupts and the timer](https://asm-editor.specy.app/documentation/risc-v/interrupts.md): Handle timer and keyboard interrupts, and step through an interrupt handler. (9 entries)
- [Synth](https://asm-editor.specy.app/documentation/risc-v/synth.md): Control eight sound channels through memory registers, with waveforms, volume envelopes, programmable wavetables and sample playback. (9 entries)
- [Input controller](https://asm-editor.specy.app/documentation/risc-v/input-controller.md): Read held keys, key presses and releases, mouse buttons, pointer position and wheel events through memory registers. (14 entries)
- [MIDI and sampled audio](https://asm-editor.specy.app/documentation/risc-v/midi-and-audio.md): Play MIDI notes and stream audio samples through memory registers. (13 entries)
- [Runtime library](https://asm-editor.specy.app/documentation/risc-v/runtime-library.md): The C standard library compiled programs use, which hand-written assembly can call too. (185 entries)
- [Using C and C++](https://asm-editor.specy.app/documentation/risc-v/using-c.md): Compile C or C++ for RV32 and RV64, call simulator services through <sim.h>, and debug the generated assembly. (7 entries)

## Optional

- [The whole RISC-V Documentation](https://asm-editor.specy.app/documentation/risc-v/llms-full.txt): every entry of every Chapter in one file, to search through
