bizhawk_read32
Read an unsigned 32-bit little-endian value from emulator memory at a given address. Use for 32-bit fields like timestamps, pointers, or RGBA colors.
Instructions
PURPOSE: Read an unsigned 32-bit little-endian value from emulator memory at the given address. USAGE: Use for 32-bit fields (timestamps, large counters, pointers on 32-bit systems, RGBA colors). For 8/16-bit reads use bizhawk_read8/read16; for big-endian or unaligned multi-word reads use bizhawk_read_range and decode yourself. BEHAVIOR: No side effects — pure read. Reads four consecutive bytes starting at address and combines them as little-endian (LSB at address, MSB at address+3). Returns an error if the domain doesn't exist, address+4 exceeds the domain, or the core lacks memory.read_u32_le. RETURNS: Single line 'ADDR_HEX: VAL_DEC (0xVAL_HEX)'.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| address | Yes | Byte offset within the chosen memory domain. Per-domain offsets are 0-based and INDEPENDENT of system bus addresses (e.g. SNES WRAM uses 0x09C6, NOT 0x7E09C6). Reads 4 consecutive bytes starting here. Returns an error if address < 0 or address + 4 exceeds the domain's size. | |
| domain | No | Optional case-sensitive memory domain name. Omit to use BizHawk's currently selected domain (see bizhawk_get_info → current_memory_domain). Discover available names with bizhawk_list_memory_domains; they vary per system (WRAM on SNES, RAM on NES, RDRAM on N64, 68K RAM on Genesis, MainRAM on PSX, EWRAM/IWRAM on GBA). Returns an error if the name doesn't match any domain on the loaded core. |
Implementation Reference
- src/tools.ts:115-131 (registration)Tool definition/registration for bizhawk_read32 in the TOOLS array, including its description, purpose, usage guidance, behavior notes, and input schema (address required, domain optional).
{ name: "bizhawk_read32", description: "PURPOSE: Read an unsigned 32-bit little-endian value from emulator memory at the given address. " + "USAGE: Use for 32-bit fields (timestamps, large counters, pointers on 32-bit systems, RGBA colors). For 8/16-bit reads use bizhawk_read8/read16; for big-endian or unaligned multi-word reads use bizhawk_read_range and decode yourself. " + "BEHAVIOR: No side effects — pure read. Reads four consecutive bytes starting at `address` and combines them as little-endian (LSB at `address`, MSB at `address+3`). Returns an error if the domain doesn't exist, address+4 exceeds the domain, or the core lacks memory.read_u32_le. " + "RETURNS: Single line 'ADDR_HEX: VAL_DEC (0xVAL_HEX)'.", inputSchema: { type: "object", required: ["address"], properties: { address: { type: "integer", minimum: 0, description: ADDRESS_PARAM_DESC(4) }, domain: { type: "string", description: DOMAIN_PARAM_DESC }, }, additionalProperties: false, }, }, - src/tools.ts:122-131 (schema)Input schema for bizhawk_read32: requires 'address' (integer ≥0, reading 4 bytes), optional 'domain' string.
inputSchema: { type: "object", required: ["address"], properties: { address: { type: "integer", minimum: 0, description: ADDRESS_PARAM_DESC(4) }, domain: { type: "string", description: DOMAIN_PARAM_DESC }, }, additionalProperties: false, }, }, - src/tools.ts:539-539 (handler)Handler in the CallToolRequestSchema switch: calls bh.call('read32', { address, domain? }) via BizhawkServer's RPC bridge, then formats result as 'ADDR_HEX: VAL_DEC (0xVAL_HEX)'.
case "bizhawk_read32": return ok(`${addrHex(a())}: ${fmtHex(await bh.call<number>("read32", { address: a(), ...dom() }))}`);