gb/mmio.rs
1//! Typed, volatile handles to the Game Boy's hardware registers and memory.
2//!
3//! The Game Boy has no faulting memory, so an accessor is `unsafe` only when it
4//! can make the CPU execute arbitrary bytes (OAM DMA started outside HRAM, or
5//! enabling an interrupt with no handler) or physically damage the panel
6//! (turning the LCD off outside VBlank). Plain VRAM, OAM, and register access is
7//! safe: at worst it draws wrong pixels, which is not undefined behavior.
8//!
9//! Each handle is `VolAddress<T, R, W>` (or `VolBlock`/`VolGrid2d`): `R` and `W`
10//! are the read and write permissions, each `Safe`, `Unsafe`, or `()` (no such
11//! method). Addresses follow the Pan Docs / GBDK `hardware.h` map.
12//!
13//! Registers and their value types are re-exported flat (`mmio::LCDC`).
14
15mod audio;
16mod interrupt;
17mod joypad;
18mod ppu;
19mod serial;
20mod timer;
21
22pub use audio::*;
23pub use interrupt::*;
24pub use joypad::*;
25pub use ppu::*;
26pub use serial::*;
27pub use timer::*;
28
29#[cfg(feature = "cgb")]
30#[cfg_attr(docsrs, doc(cfg(feature = "cgb")))]
31pub mod cgb;