Expand description
gb: Game Boy hardware abstractions.
§Feature flags
-
bank— Enable ROM banking: thegb::bankmodule and the#[gb::bank]attribute.A banked build needs a cartridge controller, but the code compiles without one, so a crate can carry banked code that a 32 KiB program still links.
-
pak— Enable the Game Pak’s own hardware:gb::pak.Which peripherals a cartridge actually has comes from
header.toml. -
cgb— Enable Game Boy Color hardware features. -
cgb-double-speed— Run in CGB double speed mode.The processor and the timer run twice as fast, while the screen and sound carry on as they were. A cartridge built with this is a Color-only one.
-
critical-section-impl— Register an implementation of thecritical-sectioncrate.IMEis write-only, so the implementation tracks every interrupt state change in a mirror variable, which costs a store in eachgb::interruptcall and at the entry and exit of every handler. Turn it on only to link a driver that requires it; in your own code usefreeor the token a handler is already handed.
Modules§
- apu
- The four sound channels and the mixer.
- bank
bank - Compile-time-safe ROM bank switching for the Game Boy.
- hram
- Typed handles to the Game Boy’s High RAM (HRAM,
0xFF80..=0xFFFE). - interrupt
- Interrupt control: the
IMEmaster switch and theIE/IFmasks. - ir
cgb - The Game Boy Color’s infrared port.
- joypad
- The eight buttons.
- mmio
- Typed, volatile handles to the Game Boy’s hardware registers and memory.
- pak
pak - The Game Pak’s own hardware.
- ppu
- The pixel-processing unit, which draws the screen.
- ram_fn
- Functions whose machine code can be copied into RAM (or HRAM) and run there.
- rt
- Core Game Boy (SM83) runtime.
- serial
- Byte exchange over the link cable.
- timer
- The timer and the free-running divider.
Macros§
- hram
- Declare static HRAM cells and areas, each at a linker-assigned High RAM address.
Functions§
- is_cgb
- Whether the machine has the Game Boy Color’s hardware.
- is_gba
- Whether the machine is a Game Boy Advance running a Game Boy Color cartridge.