@nataliapc/mcp-openmsx 1.1.4 → 1.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/README.md +46 -2
  2. package/dist/openmsx.js +11 -1
  3. package/dist/server.js +343 -123
  4. package/dist/utils.js +43 -0
  5. package/package.json +4 -1
  6. package/resources/audio/toc.json +31 -0
  7. package/resources/bios/Calling_BIOS_from_MSX-DOS.md +75 -0
  8. package/resources/bios/MSX2_SUBROM_BIOS_calls.md +734 -0
  9. package/resources/bios/MSX_BIOS_calls.md +1046 -0
  10. package/resources/bios/toc.json +24 -0
  11. package/resources/book--msx2-technical-handbook/Appendix1__BIOS_Listing.md +1464 -0
  12. package/resources/book--msx2-technical-handbook/Appendix2__Math-Pack.md +427 -0
  13. package/resources/book--msx2-technical-handbook/Appendix3__Bit_Block_Transfer.md +182 -0
  14. package/resources/book--msx2-technical-handbook/Appendix4__Work_Area_Listing.md +1637 -0
  15. package/resources/book--msx2-technical-handbook/Appendix5__VRAM_Map.md +145 -0
  16. package/resources/book--msx2-technical-handbook/Appendix6__IO_Map.md +128 -0
  17. package/resources/book--msx2-technical-handbook/Appendix8_10__Control_Codes_and_Escape_Sequences.md +76 -0
  18. package/resources/book--msx2-technical-handbook/Chapter1__MSX_System_Overview.md +402 -0
  19. package/resources/book--msx2-technical-handbook/Chapter2__BASIC.md +2148 -0
  20. package/resources/book--msx2-technical-handbook/Chapter3__MSX-DOS.md +2577 -0
  21. package/resources/book--msx2-technical-handbook/Chapter4a__VDP_and_Display_Screen.md +2052 -0
  22. package/resources/book--msx2-technical-handbook/Chapter4b__VDP_and_Display_Screen.md +3311 -0
  23. package/resources/book--msx2-technical-handbook/Chapter5a__Access_to_Peripherals_through_BIOS.md +2714 -0
  24. package/resources/book--msx2-technical-handbook/Chapter5b__Access_to_Peripherals_through_BIOS.md +1263 -0
  25. package/resources/book--msx2-technical-handbook/MSX_Kun_BASIC_Compiler.md +220 -0
  26. package/resources/book--msx2-technical-handbook/toc.json +82 -0
  27. package/resources/book--the-msx-red-book/the_msx_red_book.md +10349 -0
  28. package/resources/book--the-msx-red-book/toc.json +12 -0
  29. package/resources/msx-dos/MSX-DOS_2_Function_Specifications.md +1366 -0
  30. package/resources/msx-dos/MSX-DOS_2_Program_Interface_Specification.md +963 -0
  31. package/resources/msx-dos/toc.json +18 -0
  32. package/resources/msx-unapi/Ethernet_UNAPI_specification_1.1.md +369 -0
  33. package/resources/msx-unapi/Introduction_to_MSX-UNAPI.md +132 -0
  34. package/resources/msx-unapi/MSX_UNAPI_specification_1.1.md +679 -0
  35. package/resources/msx-unapi/TCP-IP_UNAPI_specification.md +2361 -0
  36. package/resources/msx-unapi/toc.json +27 -0
  37. package/resources/others/toc.json +11 -0
  38. package/resources/processors/Z80_R800_instruction_set.md +482 -0
  39. package/resources/processors/toc.json +24 -0
  40. package/resources/processors/z80-undocumented.tex +5617 -0
  41. package/resources/processors/z80_detailed_instruction_set.md +2025 -0
  42. package/resources/programming/toc.json +121 -0
  43. package/resources/system/MSX_IO_ports_overview.md +554 -0
  44. package/resources/system/toc.json +18 -0
  45. package/resources/video/V9938_Technical_Data_Book.md +3623 -0
  46. package/resources/video/V9958_Technical_Data_Book.md +417 -0
  47. package/resources/video/V9990_Programmers_Manual_Banzai.html +1582 -0
  48. package/resources/video/VDP_TMS9918A.txt +709 -0
  49. package/resources/video/toc.json +28 -0
package/README.md CHANGED
@@ -12,6 +12,7 @@ This project creates a bridge between modern AI-assisted development (e.g. GitHu
12
12
 
13
13
  - **Emulator Control**: Launch, configure, manage openMSX instances, and replay timelines.
14
14
  - **Media Management**: Handle ROM cartridges, floppy disks, and cassette tapes.
15
+ - **BASIC Programming Support**: Tools to facilitate BASIC language programming and development.
15
16
  - **Debugging Tools**: Full CPU debugging with breakpoints, memory inspection, and step execution.
16
17
  - **Video Control**: VDP register manipulation and screen capture.
17
18
  - **Memory Operations**: Read/write RAM, VRAM, and I/O port access.
@@ -43,11 +44,14 @@ The MCP server translates high-level commands from your Copilot AI into `TCL` co
43
44
 
44
45
  ### Emulator Control Tools
45
46
  - `emu_control`: Controls an openMSX emulator: _`launch`, `close`, `powerOn`, `powerOff`, `reset`, `getEmulatorSpeed`, `setEmulatorSpeed`, `machineList`, `extensionList`, `wait`_.
46
- - `emu_replay`: Controls emulation timeline: _`start`, `strop`, `status`, `goBack`, `absoluteGoto`, `truncate`, `saveReplay`, `loadReplay`_.
47
+ - `emu_replay`: Controls emulation timeline: _`start`, `stop`, `status`, `goBack`, `absoluteGoto`, `truncate`, `saveReplay`, `loadReplay`_.
47
48
  - `emu_info`: Obtain informacion about the current emulated machine: _`getStatus`, `getSlotsMap`, `getIOPortsMap`_.
48
49
  - `emu_media`: Manage ROM, disk, and tape media: _`tapeInsert`, `tapeRewind`, `tapeEject`, `romInsert`, `romEject`, `diskInsert`, `diskInsertFolder`, `diskEject`_.
49
50
  - `emu_vdp`: Manage VDP (Video Display Processor): _`getPalette`, `getRegisters`, `getRegisterValue`, `setRegisterValue`, `screenGetMode`, `screenGetFullText`_.
50
51
 
52
+ ### Programming Tools
53
+ - `basic_programming`: BASIC tools: _`newProgram`, `runProgram`, `setProgram`, `getFullProgram`, `getFullProgramAdvanced`, `listProgramLines`, `deleteProgramLines`_.
54
+
51
55
  ### Debugging Tools
52
56
  - `debug_run`: Control execution: _`break`, `isBreaked`, `continue`, `stepIn`, `stepOut`, `stepOver`, `stepBack`, `runTo`_.
53
57
  - `debug_cpu`: Read/write CPU registers, CPU info, Stack pile, and Disassemble code: _`getCpuRegisters`, `getRegister`, `setRegister`, `getStackPile`, `disassemble`, `getActiveCpu`_.
@@ -59,8 +63,46 @@ The MCP server translates high-level commands from your Copilot AI into `TCL` co
59
63
  - `emu_keyboard`: Send text input to emulator: _`sendText`_.
60
64
  - `emu_savestates`: Save and restore machine states: _`load`, `save`, `list`_.
61
65
  - `screen_shot`: Capture emulator screen: _`as_image`, `to_file`_.
62
- - `screen_dump`: Export screen data as BASIC BSAVE.
66
+ - `screen_dump`: Export screen data as BASIC BSAVE instruction.
67
+
68
+ ## 📚 Available MCP Resources
69
+
70
+ ### What are MCP Resources?
71
+
72
+ MCP resources are structured data sets, documentation, and helper files that extend the capabilities of the MCP server. They provide essential information such as machine definitions, extension lists, media templates, and programming examples, enabling more powerful automation, testing, and development workflows for MSX software within the MCP-openMSX environment.
73
+
74
+ ### Available Resources
75
+
76
+ There are more than 60 resources available, some included directly in the MCP and others accessible via download when queried. They are organized into the following categories:
77
+
78
+ - `Processors` (Z80, R800)
79
+ - `Bios` (Bios ROM, DOS ROM, SUBROM, ...)
80
+ - `System`
81
+ - `Audio`
82
+ - `Video`
83
+ - `Programming` (ASM, BASIC, ...)
84
+ - `MSX-DOS`
85
+ - `MSX-UNAPI`
86
+
87
+ And two books:
88
+
89
+ - `MSX2 Technical Handbook`
90
+ - `The MSX Red Book`
91
+
92
+ ### Resources from:
93
+
94
+ - [Grauw MSX Assembly Page](https://map.grauw.nl/)
95
+ - [Z80 Heaven Wiki](http://z80-heaven.wikidot.com/)
96
+ - [The MSX Red Book](https://github.com/gseidler/The-MSX-Red-Book)
97
+ - [MSX2 Technical Handbook](https://github.com/Konamiman/MSX2-Technical-Handbook)
98
+ - [Konamiman MSX-UNAPI-specification](https://github.com/Konamiman/MSX-UNAPI-specification)
99
+ - [BiFi MSX Net](http://bifi.msxnet.org/msxnet/)
100
+ - [MSX Wiki](https://www.msx.org/wiki/Main_Page)
101
+ - [MSX Banzai!](http://msxbanzai.tni.nl/)
102
+
103
+ Thanks to the authors of these resources, who have made them available under various licenses. This MCP server includes some of these resources to enhance the development experience.
63
104
 
105
+ The rights to these resources belong to their respective authors and are distributed under the licenses they have defined.
64
106
 
65
107
  ## 🚀 Quick Start
66
108
 
@@ -131,6 +173,7 @@ Add to your `claude_desktop_config.json`:
131
173
  | `OPENMSX_SHARE_DIR` | Directory containing openMSX data files (machines, extensions, etc.) | System dependent | `/home/myuser/.openmsx/share` |
132
174
  | `OPENMSX_SCREENSHOT_DIR` | Directory where screenshots will be saved | Default for openmsx | `/myproject/screenshots` |
133
175
  | `OPENMSX_SCREENDUMP_DIR` | Directory where screen dumps will be saved | Default for openmsx | `/myproject/screendumps` |
176
+ | `OPENMSX_REPLAYS_DIR` | Directory where replay files will be saved | Default for openmsx | `/myproject/replays` |
134
177
  | `MCP_TRANSPORT` | Transport mode (`stdio` or `http`) | `stdio` | `http` |
135
178
  | `MCP_HTTP_PORT` | Port number for HTTP transport mode | `3000` | `8080` |
136
179
 
@@ -154,6 +197,7 @@ export OPENMSX_EXECUTABLE="openmsx"
154
197
  export OPENMSX_SHARE_DIR="/usr/share/openmsx"
155
198
  export OPENMSX_SCREENSHOT_DIR="/my_project/screenshots"
156
199
  export OPENMSX_SCREENDUMP_DIR="/my_project/screendumps"
200
+ export OPENMSX_REPLAYS_DIR="/my_project/replays"
157
201
  export MCP_HTTP_PORT=3000
158
202
  ```
159
203
 
package/dist/openmsx.js CHANGED
@@ -12,6 +12,7 @@ import path from 'path';
12
12
  * OpenMSX class for controlling the openMSX emulator via TCL commands over TCP socket
13
13
  */
14
14
  export class OpenMSX {
15
+ lastMachine = null;
15
16
  process = null;
16
17
  isConnected = false;
17
18
  /**
@@ -34,13 +35,14 @@ export class OpenMSX {
34
35
  try {
35
36
  // Check if emulator is already running
36
37
  if (this.process && !this.process.killed) {
37
- safeResolve("Error: openMSX emulator is already running. Close it first before launching a new instance.");
38
+ safeResolve(`Error: openMSX emulator instance is already running (currrent machine: ${this.lastMachine}). Close it first before launching a new one.`);
38
39
  return;
39
40
  }
40
41
  // Build command line arguments
41
42
  const args = ['-control', 'stdio'];
42
43
  // Add machine parameter if specified
43
44
  if (machine) {
45
+ this.lastMachine = machine; // Store last machine for future reference
44
46
  args.push('-machine', machine);
45
47
  }
46
48
  // Add extensions if specified
@@ -86,6 +88,8 @@ export class OpenMSX {
86
88
  if (!resolved) {
87
89
  try {
88
90
  this.writeData('<openmsx-control>\n');
91
+ // Set save settings on exit off
92
+ this.sendCommand('set save_settings_on_exit off');
89
93
  // Set renderer to SDL
90
94
  this.sendCommand('set renderer SDLGL-PP');
91
95
  // set machine on
@@ -148,6 +152,7 @@ export class OpenMSX {
148
152
  return;
149
153
  }
150
154
  this.process.on('exit', () => {
155
+ this.lastMachine = null; // Clear last machine on exit
151
156
  this.isConnected = false;
152
157
  this.process = null;
153
158
  resolve("Ok: Emulator process closed successfully");
@@ -187,10 +192,15 @@ export class OpenMSX {
187
192
  return response;
188
193
  }
189
194
  // Parse machine_info output into key-value pairs
195
+ const skipInfo = ['issubslotted', 'input_port', 'slot', 'isexternalslot', 'output_port'];
190
196
  const parameters = response.trim().split(' ');
191
197
  const machineInfo = {};
192
198
  for (const param of parameters) {
193
199
  const trimmedLine = param.trim();
200
+ // Skip certain parameters that are not useful
201
+ if (skipInfo.includes(trimmedLine)) {
202
+ continue;
203
+ }
194
204
  if (trimmedLine) {
195
205
  const value = await this.sendCommand(`machine_info ${trimmedLine}`);
196
206
  machineInfo[trimmedLine] = value.trim();