ppsspp_write16
Write a 16-bit little-endian value to PSP memory for cheats or pokes. Overwrites two bytes without undo, returns confirmation or error.
Instructions
PURPOSE: Write an unsigned 16-bit little-endian value to PSP memory. USAGE: Use for 16-bit cheats and pokes (HP, score, coordinates). For single bytes use ppsspp_write8; for 32/larger use ppsspp_write32/write_range. BEHAVIOR: DESTRUCTIVE: overwrites two bytes with no undo. PSP is little-endian (low byte at address, high at address+1). Returns an error if address+2 exceeds valid memory or value > 65535. RETURNS: Single line 'Wrote VAL → ADDR_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. | |
| value | Yes | 16-bit value (0-65535). |
Implementation Reference
- src/tools.ts:163-179 (schema)Tool definition and input schema for ppsspp_write16: accepts 'address' (integer >=0) and 'value' (integer 0-65535). Registered in the TOOLS array alongside other tools.
{ name: "ppsspp_write16", description: "PURPOSE: Write an unsigned 16-bit little-endian value to PSP memory. " + "USAGE: Use for 16-bit cheats and pokes (HP, score, coordinates). For single bytes use ppsspp_write8; for 32/larger use ppsspp_write32/write_range. " + "BEHAVIOR: DESTRUCTIVE: overwrites two bytes with no undo. PSP is little-endian (low byte at `address`, high at address+1). Returns an error if address+2 exceeds valid memory or value > 65535. " + "RETURNS: Single line 'Wrote VAL → ADDR_HEX'.", inputSchema: { type: "object", required: ["address", "value"], properties: { address: { type: "integer", minimum: 0, description: ADDRESS_PARAM_DESC }, value: { type: "integer", minimum: 0, maximum: 65535, description: "16-bit value (0-65535)." }, }, additionalProperties: false, }, }, - src/tools.ts:461-464 (handler)Handler case in the CallToolRequestSchema switch: calls pp.call('memory.write_u16', {address, value}) to write a 16-bit value to PSP memory, returns 'Wrote VAL → ADDR_HEX'.
case "ppsspp_write16": { await pp.call("memory.write_u16", { address: a(), value: p.value }); return ok(`Wrote ${fmtHex(p.value)} → ${addrHex(a())}`); } - src/tools.ts:405-406 (registration)The registerTools function is exported and called from src/index.ts. It sets up the ListToolsRequestSchema handler (which returns the TOOLS array including ppsspp_write16) and the CallToolRequestSchema handler (which includes the ppsspp_write16 case).
export function registerTools(server: Server, pp: PpssppClient): void { server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS }));