Skip to main content

gb_rt/
builtin.rs

1//! Runtime routines provided by the startup code, exposed as raw symbols.
2//!
3//! The `RST` helpers use a register-based calling convention, so they are meant
4//! to be invoked from inline assembly (for example through the `sym` operand),
5//! not called directly. [`isr_noop`] is an ordinary parameterless routine.
6
7unsafe extern "C" {
8    /// `RST 0x20` indirect call helper: `jp (hl)`, jumping to the address in `HL`.
9    #[link_name = "_call_hl"]
10    pub fn call_hl();
11
12    /// `RST 0x28` small memset: fill `C` bytes at `HL` with `A`.
13    #[link_name = "_MemsetSmall"]
14    pub fn memset_small();
15
16    /// `RST 0x30` small memcpy: copy `C` bytes from `DE` to `HL`.
17    #[link_name = "_MemcpySmall"]
18    pub fn memcpy_small();
19
20    /// Default interrupt handler: returns immediately.
21    pub fn isr_noop();
22}