@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/dist/utils.js CHANGED
@@ -78,3 +78,46 @@ export function encodeHtmlEntities(text) {
78
78
  return char;
79
79
  });
80
80
  }
81
+ /**
82
+ * Encode a string for BASIC program input, escaping special characters
83
+ * @param text - String to encode
84
+ * @returns string - Encoded string with special characters escaped
85
+ */
86
+ export function encodeTypeText(text) {
87
+ const replacementMap = {
88
+ '\r': '\\r',
89
+ '\t': '\\t',
90
+ '"': '\\"',
91
+ };
92
+ return text.replace(/[\r\t"]/g, (char) => {
93
+ if (replacementMap[char]) {
94
+ return replacementMap[char];
95
+ }
96
+ return char;
97
+ });
98
+ }
99
+ /**
100
+ * Check if a response is an error response
101
+ * @param response - The response string to check
102
+ * @returns boolean - True if the response indicates an error, false otherwise
103
+ */
104
+ export function isErrorResponse(response) {
105
+ return response.startsWith('Error:') || response.startsWith('error:');
106
+ }
107
+ /**
108
+ * Get the content of a response, formatting it as a CallToolResult
109
+ * @param response - Array of strings representing the response lines
110
+ * @param isError - Optional boolean indicating if the response is an error
111
+ * @returns CallToolResult - Formatted response content
112
+ */
113
+ export function getResponseContent(response, isError = false) {
114
+ // Check if any response line starts with "Error:" to automatically set isError to true
115
+ const hasError = isError || response.some(line => isErrorResponse(line));
116
+ return {
117
+ content: response.map(line => ({
118
+ type: "text",
119
+ text: line == '' ? "Ok" : line,
120
+ })),
121
+ isError: hasError
122
+ };
123
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nataliapc/mcp-openmsx",
3
- "version": "1.1.4",
3
+ "version": "1.1.8",
4
4
  "description": "Model context protocol server for openMSX automation and control",
5
5
  "main": "dist/server.js",
6
6
  "type": "module",
@@ -45,12 +45,15 @@
45
45
  "zod": "^3.24.4"
46
46
  },
47
47
  "devDependencies": {
48
+ "@modelcontextprotocol/inspector": "^0.15.0",
49
+ "@types/mime-types": "^3.0.1",
48
50
  "@types/node": "^22.15.27",
49
51
  "shx": "^0.4.0",
50
52
  "typescript": "^5.8.3"
51
53
  },
52
54
  "files": [
53
55
  "dist/**/*",
56
+ "resources/**/*",
54
57
  "README.md",
55
58
  "LICENSE"
56
59
  ],
@@ -0,0 +1,31 @@
1
+ {
2
+ "title": "MSX Technical Audio info for MSX",
3
+ "description": "MSX Technical Audio info for MSX",
4
+ "toc": [
5
+ {
6
+ "title": "PSG Registers",
7
+ "uri": "https://www.msx.org/wiki/PSG_Registers",
8
+ "description": "Complete reference for MSX PSG (Programmable Sound Generator) registers covering all 16 registers including frequency control, white noise control, voice and I/O port control, amplitude and volume control, envelope form and period control, and I/O parallel port registers. Includes BIOS routines WRTPSG, RDPSG, and GICINI for PSG access and initialization."
9
+ },
10
+ {
11
+ "title": "Konami SCC Sound Chip",
12
+ "uri": "http://bifi.msxnet.org/msxnet/tech/scc",
13
+ "description": "Technical documentation for Konami's SCC (Sound Creative Chip) used in MSX cartridges. The SCC provides 5-channel wavetable synthesis with custom waveforms, offering enhanced audio capabilities beyond the standard PSG. Commonly found in Konami game cartridges like Gradius series, providing richer sound effects and music."
14
+ },
15
+ {
16
+ "title": "Konami SCC+ Sound Chip",
17
+ "uri": "http://bifi.msxnet.org/msxnet/tech/soundcartridge",
18
+ "description": "Technical documentation for Konami's enhanced SCC+ (Sound Creative Chip Plus) found in later MSX sound cartridges. Improved version of the original SCC providing enhanced wavetable synthesis capabilities, additional sound channels, and better audio quality. Used in advanced Konami cartridges and dedicated sound cartridges for expanded audio functionality."
19
+ },
20
+ {
21
+ "title": "MSX-MIDI",
22
+ "uri": "https://map.grauw.nl/resources/midi/msx-midi.php",
23
+ "description": "Complete technical documentation for MSX-MIDI interface covering hardware configuration, MIDI data communication using 8251 IC, baud rate generator with 8253/8254 timer IC, I/O port assignments (0E8H, 0E9H), internal vs external cartridge implementations, and BASIC extensions. Available only for MSX turbo R and later systems with 16K ROM containing MIDI functionality."
24
+ },
25
+ {
26
+ "title": "MGSDRV MML 1.1",
27
+ "uri": "https://mus.msx.click/index.php?title=MGSDRV_MML_11",
28
+ "description": "Complete documentation for MGSC MML compiler version 1.11 by Ain (1992-93) that converts MML (Music Macro Language) text files to MGS formatted play data for MGSDRV. Covers control functions, OPLL modes (FM 9 sound/FM 6+rhythm), machine vendor codes (SONY, Panasonic, SANYO), macro definitions, tone definitions, tempo control, and compilation options including real-time playback and debugging features."
29
+ }
30
+ ]
31
+ }
@@ -0,0 +1,75 @@
1
+ # Calling the BIOS from MSX-DOS
2
+
3
+ In the MSX-DOS environment there is no special entry for calling the MSX BIOS, however you can simply use an interslot call to reach it.
4
+
5
+ You can use this method to call the BIOS:
6
+ ```
7
+ CALSLT: EQU #001C
8
+ EXPTBL: EQU #FCC1
9
+
10
+ Call\_Slot: ld iy,(EXPTBL-1) ;BIOS slot in iyh
11
+ ld ix,nnnn ;address of BIOS routine
12
+ call CALSLT ;interslot call
13
+ ```
14
+
15
+ ## The SUBROM
16
+
17
+ You can’t call the SUBROM from MSX-DOS as you would normally, the reason for this is that both `EXTROM` and `CALSLT` use the `IX` register to pass parameters. Calling directly to the SUBROM doesn’t work either, because using an interslot call to call the SUBROM is not allowed per the MSX2 standard. The reason for this, according to _Alex Wulms_ in _MCM 48_, is that some DiskROMs couldn’t handle the the SUBROM being in page 0.
18
+
19
+ The official means to call the SUBROM from MSX-DOS is by using the following routine, provided by ASCII:
20
+ ```
21
+ ; CALSUB
22
+ ;
23
+ ; In: IX = address of routine in MSX2 SUBROM
24
+ ; AF, HL, DE, BC = parameters for the routine
25
+ ;
26
+ ; Out: AF, HL, DE, BC = depending on the routine
27
+ ;
28
+ ; Changes: IX, IY, AF', BC', DE', HL'
29
+ ;
30
+ ; Call MSX2 subrom from MSXDOS. Should work with all versions of MSXDOS.
31
+ ;
32
+ ; Notice: NMI hook will be changed. This should pose no problem as NMI is
33
+ ; not supported on the MSX at all.
34
+ ;
35
+ CALSLT: EQU #001C
36
+ NMI: EQU #0066
37
+ EXTROM: EQU #015f
38
+ EXPTBL: EQU #fcc1
39
+ H\_NMI: EQU #fdd6
40
+ ;
41
+ CALSUB: exx
42
+ ex af,af' ; store all registers
43
+ ld hl,EXTROM
44
+ push hl
45
+ ld hl,#C300
46
+ push hl ; push NOP ; JP EXTROM
47
+ push ix
48
+ ld hl,#21DD
49
+ push hl ; push LD IX,<entry>
50
+ ld hl,#3333
51
+ push hl ; push INC SP; INC SP
52
+ ld hl,0
53
+ add hl,sp ; HL = offset of routine
54
+ ld a,#C3
55
+ ld (H\_NMI),a
56
+ ld (H\_NMI+1),hl ; JP <routine> in NMI hook
57
+ ex af,af'
58
+ exx ; restore all registers
59
+ ld ix,NMI
60
+ ld iy,(EXPTBL-1)
61
+ call CALLSLT ; call NMI-hook via NMI entry in ROMBIOS
62
+ ; NMI-hook will call SUBROM
63
+ exx
64
+ ex af,af' ; store all returned registers
65
+ ld hl,10
66
+ add hl,sp
67
+ ld sp,hl ; remove routine from stack
68
+ ex af,af'
69
+ exx ; restore all returned registers
70
+ ret
71
+ ```
72
+
73
+ ~Grauw
74
+
75
+ © 2025 MSX Assembly Page. MSX is a trademark of MSX Licensing Corporation.