Comprehensive protocol fix from official VICE docs
Audited all codes against https://vice-emu.sourceforge.io/vice_13.html Command code fixes: - Added ExecuteUntilReturn (0x73) - Fixed BanksAvailable (0x82, was 0x83) - Added RegistersAvailable (0x83) - Added ViceInfo (0x85) - Added PaletteGet (0x91) - Added JoyportSet (0xa2), UserportSet (0xb2) - Use Exit (0xaa) for continue/resume Response type fixes: - Added JAM (0x61) async event - Clarified which responses are command echoes vs async events 🤖 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
c00cd9e3da
commit
a985c074a4
2 changed files with 35 additions and 24 deletions
|
|
@ -475,7 +475,8 @@ export class ViceClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
async continue(): Promise<void> {
|
async continue(): Promise<void> {
|
||||||
await this.sendCommand(Command.Continue);
|
// Exit command (0xaa) resumes execution
|
||||||
|
await this.sendCommand(Command.Exit);
|
||||||
this.state.running = true;
|
this.state.running = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
export const STX = 0x02;
|
export const STX = 0x02;
|
||||||
export const API_VERSION = 0x01; // VICE 3.x uses API v1
|
export const API_VERSION = 0x01; // VICE 3.x uses API v1
|
||||||
|
|
||||||
// Command codes (per official VICE manual)
|
// Command codes (per official VICE manual: https://vice-emu.sourceforge.io/vice_13.html)
|
||||||
export enum Command {
|
export enum Command {
|
||||||
// Memory operations
|
// Memory operations
|
||||||
MemoryGet = 0x01,
|
MemoryGet = 0x01,
|
||||||
|
|
@ -32,24 +32,28 @@ export enum Command {
|
||||||
ResourceGet = 0x51,
|
ResourceGet = 0x51,
|
||||||
ResourceSet = 0x52,
|
ResourceSet = 0x52,
|
||||||
|
|
||||||
// Advance instructions
|
// Advance/step instructions
|
||||||
AdvanceInstructions = 0x71,
|
AdvanceInstructions = 0x71,
|
||||||
KeyboardFeed = 0x72,
|
KeyboardFeed = 0x72,
|
||||||
|
ExecuteUntilReturn = 0x73,
|
||||||
|
|
||||||
|
// Info/query commands
|
||||||
|
Ping = 0x81,
|
||||||
|
BanksAvailable = 0x82,
|
||||||
|
RegistersAvailable = 0x83,
|
||||||
|
DisplayGet = 0x84,
|
||||||
|
ViceInfo = 0x85,
|
||||||
|
|
||||||
|
// Palette
|
||||||
|
PaletteGet = 0x91,
|
||||||
|
|
||||||
|
// Joyport/Userport
|
||||||
|
JoyportSet = 0xa2,
|
||||||
|
UserportSet = 0xb2,
|
||||||
|
|
||||||
// Execution control
|
// Execution control
|
||||||
Step = 0x81,
|
Exit = 0xaa, // Resumes execution (continue)
|
||||||
Continue = 0x82, // Also called "Exit" - resumes execution
|
Quit = 0xbb, // Terminates VICE
|
||||||
Ping = 0x81, // Same as step with count=0
|
|
||||||
|
|
||||||
// Display
|
|
||||||
DisplayGet = 0x84,
|
|
||||||
|
|
||||||
// Banks
|
|
||||||
BanksAvailable = 0x83,
|
|
||||||
|
|
||||||
// Exit/Quit
|
|
||||||
Exit = 0xaa,
|
|
||||||
Quit = 0xbb,
|
|
||||||
|
|
||||||
// Reset
|
// Reset
|
||||||
Reset = 0xcc,
|
Reset = 0xcc,
|
||||||
|
|
@ -58,20 +62,26 @@ export enum Command {
|
||||||
AutoStart = 0xdd,
|
AutoStart = 0xdd,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Response types (per official VICE manual)
|
// Response types (per official VICE manual: https://vice-emu.sourceforge.io/vice_13.html)
|
||||||
|
// Note: Most commands echo back with the same response code as the command
|
||||||
|
// These are the ASYNC event response types that VICE sends unprompted:
|
||||||
export enum ResponseType {
|
export enum ResponseType {
|
||||||
Invalid = 0x00,
|
Invalid = 0x00,
|
||||||
MemoryGet = 0x01, // Memory read response
|
|
||||||
MemorySet = 0x02, // Memory write response
|
// Command response codes (echoed from command)
|
||||||
CheckpointResponse = 0x11, // Checkpoint set/get/delete response
|
MemoryGet = 0x01,
|
||||||
CheckpointInfo = 0x12, // Checkpoint info
|
MemorySet = 0x02,
|
||||||
RegisterInfo = 0x31, // Register info (async event when stopped)
|
CheckpointInfo = 0x11,
|
||||||
|
RegisterInfo = 0x31,
|
||||||
Dump = 0x41,
|
Dump = 0x41,
|
||||||
Undump = 0x42,
|
Undump = 0x42,
|
||||||
ResourceGet = 0x51,
|
ResourceGet = 0x51,
|
||||||
ResourceSet = 0x52,
|
ResourceSet = 0x52,
|
||||||
Stopped = 0x62, // Stopped event (async)
|
|
||||||
Resumed = 0x63, // Resumed event (async)
|
// Async event codes (sent by VICE unprompted)
|
||||||
|
JAM = 0x61, // CPU jam event
|
||||||
|
Stopped = 0x62, // Execution stopped
|
||||||
|
Resumed = 0x63, // Execution resumed
|
||||||
}
|
}
|
||||||
|
|
||||||
// Memory spaces
|
// Memory spaces
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue