# RISC-V Interrupts and the timer

[RISC-V Documentation](https://asm-editor.specy.app/documentation/risc-v.md)

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

Handle timer and keyboard interrupts, and step through an interrupt handler.

9 entries, each with its own page of markdown:

- [Interrupts and the timer](https://asm-editor.specy.app/documentation/risc-v/interrupts/interrupts-and-the-timer.md): An interrupt makes the processor run a handler between two program instructions.
- [The handler](https://asm-editor.specy.app/documentation/risc-v/interrupts/handler.md): The processor runs the handler and records what happened in the control and status registers (see Registers).
- [The timer](https://asm-editor.specy.app/documentation/risc-v/interrupts/timer.md): RARS's Timer Tool registers are built in: time at 0xffff0018 and timecmp at 0xffff0020.
- [Waiting with wfi](https://asm-editor.specy.app/documentation/risc-v/interrupts/wfi.md): wfi, wait for interrupt, waits for an enabled source: the timer with uie bit 4 set, or a typed character with uie bit 8 and receiver interrupts enabled.
- [Keyboard interrupts](https://asm-editor.specy.app/documentation/risc-v/interrupts/keyboard.md): Set bit 1 of receiver control to request interrupts while typed characters are waiting.
- [Exceptions](https://asm-editor.specy.app/documentation/risc-v/interrupts/exceptions.md): With a handler installed and UIE set, exceptions also enter the handler.
- [Debugging a handler](https://asm-editor.specy.app/documentation/risc-v/interrupts/debugging.md): Step runs one instruction, and when an interrupt is waiting that instruction is the handler's first: the Step lands on the handler.
- [From C](https://asm-editor.specy.app/documentation/risc-v/interrupts/from-c.md): provides sim_timer_now() to read elapsed run time and sim_timer_set(when) to arm the timer.
- [Compared with RARS](https://asm-editor.specy.app/documentation/risc-v/interrupts/compatibility.md): The Timer Tool's registers are always there; in RARS the tool has to be opened and connected first.
