Module gba::mmio

source · []
Expand description

Contains all the MMIO address definitions for the GBA’s components.

This module contains only the MMIO addresses. The data type definitions for each MMIO control value are stored in the appropriate other modules such as video, interrupts, etc.

In general, the docs for each address are quite short. If you want to understand how a subsystem of the GBA works, you should read the docs for that system’s module, and the data type used by the address.

The GBATEK names (and thus mGBA names) are used for the MMIO addresses by default. However, in some cases (eg: sound) the GBATEK naming is excessively cryptic, and so new names have been created. Whenever a new name is used, the GBATEK name is still listed as a doc alias for that address. If necessary you can just search the GBATEK name in the rustdoc search bar and the search results will show you the new name.

Safety

The MMIO declarations and wrapper types in this module must not be used outside of a GBA. The read and write safety of each address are declared assuming that code is running on a GBA. On any other platform, the declarations are simply incorrect.

Structs

Screenblock address for size 0 affine mode backgrounds (16x16).
Screenblock address for size 1 affine mode backgrounds (32x32).
Screenblock address for size 2 affine mode backgrounds (64x64).
Screenblock address for size 3 affine mode backgrounds (128x128).
Screenblock address for text mode backgrounds (32x32).
Video mode 3 has a single full resolution bitmap
Video mode 4 has two 8bpp indexmaps.
Video mode 5 has two reduced-resolution bitmaps.

Constants

Affine parameters A.
Affine parameters B.
Affine parameters C.
Affine parameters D.
Color that’s shown when no BG or OBJ draws to a pixel
Background 0 Control
Background 0 Horizontal Offset (9-bit, text mode)
Background 0 Vertical Offset (9-bit, text mode)
Background 1 Control
Background 1 Horizontal Offset (9-bit, text mode)
Background 1 Vertical Offset (9-bit, text mode)
Background 2 Control
Background 2 Horizontal Offset (9-bit, text mode)
Background 2 Param A (affine mode)
Background 2 Param B (affine mode)
Background 2 Param C (affine mode)
Background 2 Param D (affine mode)
Background 2 Vertical Offset (9-bit, text mode)
Background 2 X Reference Point (affine/bitmap modes)
Background 2 Y Reference Point (affine/bitmap modes)
Background 3 Control
Background 3 Horizontal Offset (9-bit, text mode)
Background 3 Param A (affine mode)
Background 3 Param B (affine mode)
Background 3 Param C (affine mode)
Background 3 Param D (affine mode)
Background 3 Vertical Offset (9-bit, text mode)
Background 3 X Reference Point (affine/bitmap modes)
Background 3 Y Reference Point (affine/bitmap modes)
Background tile palette entries.
Sets EVA(low) and EVB(high) alpha blend coefficients, allows 0..=16, in 1/16th units
Sets color blend effects
Sets EVY brightness blend coefficient, allows 0..=16, in 1/16th units
Charblock 0, 4bpp view (512 tiles).
Charblock 0, 8bpp view (256 tiles).
Charblock 1, 4bpp view (512 tiles).
Charblock 1, 8bpp view (256 tiles).
Charblock 2, 4bpp view (512 tiles).
Charblock 2, 8bpp view (256 tiles).
Charblock 3, 4bpp view (512 tiles).
Charblock 3, 8bpp view (256 tiles).
Display Control
Display Status
DMA0 Control Bits
DMA0 Transfer Count (14-bit, 0=max)
DMA0 Destination Address (internal memory only)
DMA0 Source Address (internal memory only)
DMA1 Control Bits
DMA1 Transfer Count (14-bit, 0=max)
DMA1 Destination Address (internal memory only)
DMA1 Source Address (non-SRAM memory)
DMA2 Control Bits
DMA2 Transfer Count (14-bit, 0=max)
DMA2 Destination Address (internal memory only)
DMA2 Source Address (non-SRAM memory)
DMA3 Control Bits
DMA3 Transfer Count (16-bit, 0=max)
DMA3 Destination Address (non-SRAM memory)
DMA3 Source Address (non-SRAM memory)
Pushes 4 i8 samples into the Sound A buffer.
Pushes 4 i8 samples into the Sound B buffer.
Interrupts Enabled: sets which interrupts will be accepted when a subsystem fires an interrupt
Interrupts Flagged: reads which interrupts are pending, writing bit(s) will clear a pending interrupt.
Interrupt Master Enable: Allows turning on/off all interrupts with a single access.
Key control to configure the key interrupt.
Key state data.
Left/Right sound control (but GBAs only have one speaker each).
The buffer to put logging messages into.
Allows you to attempt to activate mGBA logging.
Write to this each time you want to reset a message (it also resets the buffer).
Sets the intensity of all mosaic effects
Noise Frequency/Control
Noise Length/Envelope
Object attributes 0.
Object attributes 1.
Object attributes 2.
Object tile palette entries.
Object tiles. In video modes 3, 4, and 5 only indices 512..=1023 are available.
Provides a bias to set the ‘middle point’ of sound output.
Sound active flags (r), as well as the sound primary enable (rw).
Mixes sound sources out to the left and right
Timer 0 control
Timer 0 Count read
Timer 0 Reload write
Timer 1 control
Timer 1 Count read
Timer 1 Reload write
Timer 2 control
Timer 2 Count read
Timer 2 Reload write
Timer 3 control
Timer 3 Count read
Timer 3 Reload write
Tone 1 Frequency/Control
Tone 1 Duty/Len/Envelope
Tone 1 Sweep
Tone 2 Frequency/Control
Tone 2 Duty/Len/Envelope
Vertical Counter
Wait state control for interfacing with the ROM.
Wave banking controls
Wave Frequency/Control
Wave Length/Volume
Wave memory, u4, plays MSB/LSB per byte.
Window 0 Horizontal: high=left, low=(right+1)
Window 0 Vertical: high=top, low=(bottom+1)
Window 1 Horizontal: high=left, low=(right+1)
Window 1 Vertical: high=top, low=(bottom+1)
Controls the inside Windows 0 and 1
Controls inside the object window and outside of windows