mgba_read_range
Read a contiguous range of bytes from emulated memory and get a hex dump. Retrieve up to 4096 bytes in one call, avoiding multiple round trips.
Instructions
PURPOSE: Read a contiguous range of bytes from emulated memory and return them as a hex-formatted dump. USAGE: Use whenever you need more than ~4 bytes — one round-trip vs N frame-latency hops compared to looping mgba_read8. Maximum 4096 bytes per call (bridge serialization limit); for larger reads, batch in 4 KiB chunks. The classic two-snapshot RAM-hunt workflow uses this: snapshot before a known change, snapshot after, diff for matching deltas. Also useful for inspecting unknown structures and for 'capture, modify, restore' write_range workflows. This is the same primitive that mgba_read32 routes through internally. BEHAVIOR: No side effects — pure read. Reads length consecutive bytes starting at address. Returns an error if length > 4096, length < 1, the start address is unmapped, or the read crosses an unmapped region. RETURNS: Header line 'ADDR_HEX [N bytes]:' followed by space-separated 2-digit uppercase hex bytes.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| address | Yes | Starting system bus address. Same address-space conventions as the single-width read tools: full 32-bit for GBA (EWRAM 0x02000000, IWRAM 0x03000000, ROM 0x08000000), 16-bit for GB/GBC (WRAM 0xC000, SRAM 0xA000). The N bytes [address, address+length) are read. | |
| length | Yes | Number of consecutive bytes to read (1-4096). Hard cap is the bridge's per-call serialization limit; chunk larger reads yourself. A length that pushes the read across an unmapped region boundary will fail rather than silently zero-fill. |