Fix MemoryGet command format per official VICE docs

Official format: FX(1) + Start(2) + End(2) + Memspace(1) + BankID(2) = 8 bytes
Our code had: FX(1) + Start(2) + Memspace(1) + End(2) = 6 bytes (wrong order, missing bank)

This was causing error 0x81 "invalid parameter".

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Simen Svale 2025-12-30 03:14:03 +01:00
parent 40c2ecd1a5
commit 148ade15b9

View file

@ -380,12 +380,14 @@ export class ViceClient {
);
}
// Build request: side_effects(1) + start(2) + memspace(1) + end(2)
const body = Buffer.alloc(6);
// Build request per official VICE docs:
// side_effects(1) + start(2) + end(2) + memspace(1) + bankId(2) = 8 bytes
const body = Buffer.alloc(8);
body[0] = 0; // No side effects
body.writeUInt16LE(startAddress, 1);
body[3] = memspace;
body.writeUInt16LE(endAddress, 4);
body.writeUInt16LE(endAddress, 3);
body[5] = memspace;
body.writeUInt16LE(0, 6); // bankId = 0 (default bank)
// VICE sends MemoryGet response with type 0x01
const response = await this.sendCommand(Command.MemoryGet, body, ResponseType.MemoryGet);