ppsspp_read8
Read an unsigned 8-bit byte from PSP memory at a specified physical address without side effects. Use for status flags, counters, and single-byte fields.
Instructions
PURPOSE: Read an unsigned 8-bit byte from PSP memory at the given physical address. USAGE: Use for single-byte status flags, counters, and 8-bit fields. For 16/32-bit values use ppsspp_read16/read32 (one call instead of multi-byte assembly); for spans use ppsspp_read_range. BEHAVIOR: No side effects — pure read. Returns an error if the address isn't a valid PSP memory address (PPSSPP validates against the PSP's mapped regions). RETURNS: Single line 'ADDR_HEX: VAL_DEC (0xVAL_HEX)'.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| address | Yes | PSP physical address. PSP memory layout: user RAM starts at 0x08800000 (or 0x08000000 — varies by firmware allocation), kernel RAM at 0x08000000-0x087FFFFF, VRAM at 0x04000000-0x041FFFFF, scratchpad at 0x00010000-0x00013FFF, hardware regs at 0xBC000000+. Most game state lives in user RAM. Note PPSSPP may also accept 0x88xxxxxx kernel-mode mirrors of the same physical memory. |
Implementation Reference
- src/tools.ts:434-437 (handler)The handler case for 'ppsspp_read8' in the CallToolRequestSchema switch. It calls pp.call('memory.read_u8', ...) to read a single unsigned byte from PPSSPP's memory and returns the formatted result as 'ADDR_HEX: VAL_DEC (0xVAL_HEX)'.
case "ppsspp_read8": { const r = await pp.call<{ value: number }>("memory.read_u8", { address: a() }); return ok(`${addrHex(a())}: ${fmtHex(r.value)}`); } - src/tools.ts:62-77 (schema)The tool definition (schema, name, description) for 'ppsspp_read8' in the TOOLS array. It declares the input schema requiring an 'address' integer parameter and provides a detailed description about its purpose, usage, behavior, and return format.
{ name: "ppsspp_read8", description: "PURPOSE: Read an unsigned 8-bit byte from PSP memory at the given physical address. " + "USAGE: Use for single-byte status flags, counters, and 8-bit fields. For 16/32-bit values use ppsspp_read16/read32 (one call instead of multi-byte assembly); for spans use ppsspp_read_range. " + "BEHAVIOR: No side effects — pure read. Returns an error if the address isn't a valid PSP memory address (PPSSPP validates against the PSP's mapped regions). " + "RETURNS: Single line 'ADDR_HEX: VAL_DEC (0xVAL_HEX)'.", inputSchema: { type: "object", required: ["address"], properties: { address: { type: "integer", minimum: 0, description: ADDRESS_PARAM_DESC }, }, additionalProperties: false, }, }, - src/tools.ts:405-407 (registration)The registerTools function that registers all tools (including ppsspp_read8) with the MCP server via setRequestHandler for both ListToolsRequestSchema (returns the TOOLS array) and CallToolRequestSchema (routes to the switch case).
export function registerTools(server: Server, pp: PpssppClient): void { server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS })); - src/tools.ts:397-400 (helper)Helper function fmtHex() used by the read8 handler to format the numeric value as 'DEC (0xHEX)'.
function fmtHex(n: unknown): string { if (typeof n !== "number") return String(n); return `${n} (0x${n.toString(16).toUpperCase()})`; } - src/tools.ts:401-403 (helper)Helper function addrHex() used by the read8 handler to format the address as a zero-padded 8-digit uppercase hex string.
function addrHex(n: number): string { return `0x${n.toString(16).toUpperCase().padStart(8, "0")}`; }