Fix response types per official VICE manual
Our KB had wrong response type codes. Corrected per VICE docs: - MemoryGet = 0x01 (was 0x31) - RegisterInfo = 0x31 (was 0x62) - Stopped = 0x62 (was 0x11) - Resumed = 0x63 (was 0x12) This should fix readMemory timeouts. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
067ec7af24
commit
40c2ecd1a5
2 changed files with 17 additions and 12 deletions
|
|
@ -219,7 +219,8 @@ export class ViceClient {
|
||||||
debugLog(`handleResponse: type=0x${response.responseType.toString(16)}, reqId=${response.requestId}`);
|
debugLog(`handleResponse: type=0x${response.responseType.toString(16)}, reqId=${response.requestId}`);
|
||||||
|
|
||||||
// Check for async events (state changes)
|
// Check for async events (state changes)
|
||||||
if (response.responseType === ResponseType.Stopped || response.responseType === ResponseType.CheckpointHit) {
|
// Stopped = 0x62, which VICE sends when emulation stops
|
||||||
|
if (response.responseType === ResponseType.Stopped) {
|
||||||
this.state.running = false;
|
this.state.running = false;
|
||||||
this.onStopped?.(response);
|
this.onStopped?.(response);
|
||||||
// Don't return - this might also be a response to a pending request
|
// Don't return - this might also be a response to a pending request
|
||||||
|
|
@ -386,8 +387,8 @@ export class ViceClient {
|
||||||
body[3] = memspace;
|
body[3] = memspace;
|
||||||
body.writeUInt16LE(endAddress, 4);
|
body.writeUInt16LE(endAddress, 4);
|
||||||
|
|
||||||
// Try without async matching - maybe VICE sends MemoryGet with matched ReqID
|
// VICE sends MemoryGet response with type 0x01
|
||||||
const response = await this.sendCommand(Command.MemoryGet, body);
|
const response = await this.sendCommand(Command.MemoryGet, body, ResponseType.MemoryGet);
|
||||||
|
|
||||||
// Response body: length(2) + data(N)
|
// Response body: length(2) + data(N)
|
||||||
const dataLength = response.body.readUInt16LE(0);
|
const dataLength = response.body.readUInt16LE(0);
|
||||||
|
|
@ -439,7 +440,7 @@ export class ViceClient {
|
||||||
async getRegisters(memspace: MemorySpace = MemorySpace.MainCPU): Promise<ViceResponse> {
|
async getRegisters(memspace: MemorySpace = MemorySpace.MainCPU): Promise<ViceResponse> {
|
||||||
const body = Buffer.alloc(1);
|
const body = Buffer.alloc(1);
|
||||||
body[0] = memspace;
|
body[0] = memspace;
|
||||||
// VICE sends RegisterInfo (0x62) as async event with ReqID=0xff
|
// VICE sends RegisterInfo (0x31) as async event with ReqID=0xff
|
||||||
return this.sendCommand(Command.RegistersGet, body, ResponseType.RegisterInfo);
|
return this.sendCommand(Command.RegistersGet, body, ResponseType.RegisterInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,16 +49,20 @@ export enum Command {
|
||||||
AutoStart = 0xdd,
|
AutoStart = 0xdd,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Response types
|
// Response types (per official VICE manual)
|
||||||
export enum ResponseType {
|
export enum ResponseType {
|
||||||
Invalid = 0x00,
|
Invalid = 0x00,
|
||||||
Ok = 0x01,
|
MemoryGet = 0x01, // Memory read response
|
||||||
Object = 0x02,
|
MemorySet = 0x02, // Memory write response
|
||||||
Stopped = 0x11,
|
CheckpointResponse = 0x11, // Checkpoint set/get/delete response
|
||||||
Resumed = 0x12,
|
CheckpointInfo = 0x12, // Checkpoint info
|
||||||
MemoryGet = 0x31,
|
RegisterInfo = 0x31, // Register info (async event when stopped)
|
||||||
RegisterInfo = 0x62,
|
Dump = 0x41,
|
||||||
CheckpointHit = 0x63,
|
Undump = 0x42,
|
||||||
|
ResourceGet = 0x51,
|
||||||
|
ResourceSet = 0x52,
|
||||||
|
Stopped = 0x62, // Stopped event (async)
|
||||||
|
Resumed = 0x63, // Resumed event (async)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Memory spaces
|
// Memory spaces
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue