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}`);
|
||||
|
||||
// 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.onStopped?.(response);
|
||||
// Don't return - this might also be a response to a pending request
|
||||
|
|
@ -386,8 +387,8 @@ export class ViceClient {
|
|||
body[3] = memspace;
|
||||
body.writeUInt16LE(endAddress, 4);
|
||||
|
||||
// Try without async matching - maybe VICE sends MemoryGet with matched ReqID
|
||||
const response = await this.sendCommand(Command.MemoryGet, body);
|
||||
// VICE sends MemoryGet response with type 0x01
|
||||
const response = await this.sendCommand(Command.MemoryGet, body, ResponseType.MemoryGet);
|
||||
|
||||
// Response body: length(2) + data(N)
|
||||
const dataLength = response.body.readUInt16LE(0);
|
||||
|
|
@ -439,7 +440,7 @@ export class ViceClient {
|
|||
async getRegisters(memspace: MemorySpace = MemorySpace.MainCPU): Promise<ViceResponse> {
|
||||
const body = Buffer.alloc(1);
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,16 +49,20 @@ export enum Command {
|
|||
AutoStart = 0xdd,
|
||||
}
|
||||
|
||||
// Response types
|
||||
// Response types (per official VICE manual)
|
||||
export enum ResponseType {
|
||||
Invalid = 0x00,
|
||||
Ok = 0x01,
|
||||
Object = 0x02,
|
||||
Stopped = 0x11,
|
||||
Resumed = 0x12,
|
||||
MemoryGet = 0x31,
|
||||
RegisterInfo = 0x62,
|
||||
CheckpointHit = 0x63,
|
||||
MemoryGet = 0x01, // Memory read response
|
||||
MemorySet = 0x02, // Memory write response
|
||||
CheckpointResponse = 0x11, // Checkpoint set/get/delete response
|
||||
CheckpointInfo = 0x12, // Checkpoint info
|
||||
RegisterInfo = 0x31, // Register info (async event when stopped)
|
||||
Dump = 0x41,
|
||||
Undump = 0x42,
|
||||
ResourceGet = 0x51,
|
||||
ResourceSet = 0x52,
|
||||
Stopped = 0x62, // Stopped event (async)
|
||||
Resumed = 0x63, // Resumed event (async)
|
||||
}
|
||||
|
||||
// Memory spaces
|
||||
|
|
|
|||
Loading…
Reference in a new issue