-
Notifications
You must be signed in to change notification settings - Fork 0
Extend VICE support #103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Extend VICE support #103
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements comprehensive VICE emulator support for the MCP server, adding:
- A complete VICE Binary Monitor client with debugger capabilities (checkpoints, registers, stepping)
- Process management and test infrastructure with mock server support
- Platform-aware tool routing with
supportedPlatformsmetadata - Extensive test coverage using a mock BM server for CI environments
Reviewed Changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/vice/viceClient.ts | Core Binary Monitor protocol client with extended debugger ops |
| src/vice/mockServer.ts | Lightweight BM stub for test environments |
| src/vice/process.ts | VICE process lifecycle management with Xvfb support |
| src/vice/readiness.ts | Helpers for polling BASIC READY and screen patterns |
| src/tools/debug.ts | Debugger tool module (checkpoints, registers, stepping) |
| src/tools/vice.ts | VICE-specific tools (display capture, resource access) |
| src/device.ts | ViceBackend implementation with long-lived process support |
| test/* | Comprehensive test coverage with platform-aware harness |
| scripts/run-tests.ts | Test matrix runner supporting multiple platforms/targets |
| doc/* | Updated documentation and rollout tracking |
| const bytes = Buffer.from(text, "ascii"); | ||
| const body = Buffer.concat([Buffer.from([bytes.length & 0xff]), bytes]); | ||
| await this.send(0x72, body); | ||
| } |
Copilot
AI
Nov 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing blank line before new method section. The checkpoint methods start immediately after keyboardFeed without separation, while earlier methods (e.g., before line 195) maintain consistent spacing between functional groups.
| } | |
| } |
src/vice/readiness.ts
Outdated
| async function resumeEmulation(bm: ViceClient): Promise<void> { | ||
| try { | ||
| await bm.exitMonitor(); | ||
| } catch { | ||
| // Ignore errors while resuming; monitor may already be running. | ||
| } | ||
| } |
Copilot
AI
Nov 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function name resumeEmulation is ambiguous. The comment says 'monitor may already be running,' but the function name suggests starting emulation. Consider renaming to exitMonitorIfNeeded or ensureEmulationRunning for clarity.
| 0x0E,0x08, | ||
| 0x0A,0x00, | ||
| 0x99, |
Copilot
AI
Nov 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed inline comments explaining BASIC program structure ($080E pointer, line 10, PRINT token). The original comments improved readability for this low-level byte sequence. Consider restoring them or adding a docstring to buildHelloProgramBody.
| function toolIsAvailable(ctx, toolName) { | ||
| if (typeof ctx.isToolSupported === "function") { | ||
| try { | ||
| return ctx.isToolSupported(toolName); | ||
| } catch { | ||
| return true; | ||
| } | ||
| } | ||
| return true; | ||
| } |
Copilot
AI
Nov 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function returns true on exception (line 53), which contradicts the function name toolIsAvailable. If isToolSupported throws, the tool support status is unknown, not confirmed as available. Consider returning false on exception or logging the error.
src/device.ts
Outdated
| constructor(config: ViceConfig) { | ||
| this.exe = config.exe || which("x64sc") || which("x64") || "x64sc"; | ||
| const envBinary = configuredString(process.env.VICE_BINARY); | ||
| this.exe = configuredString(config.exe) ?? envBinary ?? which("x64sc") ?? which("x64") ?? "x64sc"; |
Copilot
AI
Nov 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The environment variable takes precedence over config file (envBinary is checked before config.exe), but the configuration documentation in README.md suggests config files should override env defaults. This ordering contradicts typical precedence (explicit config > env > defaults).
| this.exe = configuredString(config.exe) ?? envBinary ?? which("x64sc") ?? which("x64") ?? "x64sc"; | |
| this.exe = config.exe !== undefined && config.exe !== null | |
| ? config.exe | |
| : envBinary ?? which("x64sc") ?? which("x64") ?? "x64sc"; |
| const bunRuntime = (globalThis as { Bun?: any }).Bun; | ||
| if (!bunRuntime || typeof bunRuntime.spawn !== "function") { | ||
| throw new Error("[run-tests] Bun runtime is required to execute tests"); | ||
| } | ||
| const child = bunRuntime.spawn({ |
Copilot
AI
Nov 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The script requires Bun runtime (line 108 error message), but the documentation states 'stay on the npm variants if Bun is not installed.' This hard requirement contradicts the documented fallback behavior and will break npm test on Node-only installations.
|
@codex Fix the failing tests against VICE: |
|
Summary
Testing
|
Extend VICE support so that as many of the C64 Bridge tools as possible can leverage VICE instead of a real C64U device.