@nataliapc/mcp-openmsx 1.1.14 → 1.2.2

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 (196) hide show
  1. package/README.md +37 -12
  2. package/dist/server.js +198 -69
  3. package/dist/utils.js +54 -7
  4. package/dist/vectordb.js +60 -0
  5. package/package.json +10 -3
  6. package/resources/audio/MGSC111.txt +669 -0
  7. package/resources/audio/msx-midi.md +872 -0
  8. package/resources/audio/opl4tech.txt +688 -0
  9. package/resources/audio/psg_registers.md +281 -0
  10. package/resources/audio/sound_cartridge_scc.md +123 -0
  11. package/resources/audio/sound_cartridge_scci.md +250 -0
  12. package/resources/audio/toc.json +18 -7
  13. package/resources/book--msx2-technical-handbook/toc.json +1 -1
  14. package/resources/msx-unapi/toc.json +2 -2
  15. package/resources/processors/toc.json +4 -4
  16. package/resources/processors/z80_detailed_instruction_set.md +80 -68
  17. package/resources/programming/basic_wiki/ABS().md +36 -0
  18. package/resources/programming/basic_wiki/AND.md +71 -0
  19. package/resources/programming/basic_wiki/ASC().md +38 -0
  20. package/resources/programming/basic_wiki/ATN().md +36 -0
  21. package/resources/programming/basic_wiki/AUTO.md +39 -0
  22. package/resources/programming/basic_wiki/BASE().md +147 -0
  23. package/resources/programming/basic_wiki/BEEP.md +27 -0
  24. package/resources/programming/basic_wiki/BIN$().md +36 -0
  25. package/resources/programming/basic_wiki/BLOAD.md +63 -0
  26. package/resources/programming/basic_wiki/BSAVE.md +61 -0
  27. package/resources/programming/basic_wiki/CALL.md +391 -0
  28. package/resources/programming/basic_wiki/CALL_ADJUST.md +40 -0
  29. package/resources/programming/basic_wiki/CALL_IMPOSE.md +28 -0
  30. package/resources/programming/basic_wiki/CALL_OPTIONS.md +26 -0
  31. package/resources/programming/basic_wiki/CALL_PAUSE.md +119 -0
  32. package/resources/programming/basic_wiki/CALL_PCMPLAY.md +60 -0
  33. package/resources/programming/basic_wiki/CALL_PCMREC.md +70 -0
  34. package/resources/programming/basic_wiki/CDBL().md +36 -0
  35. package/resources/programming/basic_wiki/CHR$().md +51 -0
  36. package/resources/programming/basic_wiki/CINT().md +36 -0
  37. package/resources/programming/basic_wiki/CIRCLE.md +51 -0
  38. package/resources/programming/basic_wiki/CLEAR.md +39 -0
  39. package/resources/programming/basic_wiki/CLOAD.md +27 -0
  40. package/resources/programming/basic_wiki/CLOAD?.md +31 -0
  41. package/resources/programming/basic_wiki/CLOSE.md +44 -0
  42. package/resources/programming/basic_wiki/CLS.md +51 -0
  43. package/resources/programming/basic_wiki/COLOR.md +143 -0
  44. package/resources/programming/basic_wiki/COLOR=.md +93 -0
  45. package/resources/programming/basic_wiki/COLOR_SPRITE$().md +83 -0
  46. package/resources/programming/basic_wiki/COLOR_SPRITE().md +85 -0
  47. package/resources/programming/basic_wiki/CONT.md +23 -0
  48. package/resources/programming/basic_wiki/COPY.md +215 -0
  49. package/resources/programming/basic_wiki/COPY_SCREEN.md +61 -0
  50. package/resources/programming/basic_wiki/COS().md +37 -0
  51. package/resources/programming/basic_wiki/CSAVE.md +35 -0
  52. package/resources/programming/basic_wiki/CSNG().md +36 -0
  53. package/resources/programming/basic_wiki/CSRLIN.md +33 -0
  54. package/resources/programming/basic_wiki/DATA.md +47 -0
  55. package/resources/programming/basic_wiki/DEFDBL.md +40 -0
  56. package/resources/programming/basic_wiki/DEFINT.md +40 -0
  57. package/resources/programming/basic_wiki/DEFSNG.md +40 -0
  58. package/resources/programming/basic_wiki/DEFSTR.md +40 -0
  59. package/resources/programming/basic_wiki/DEF_FN.md +49 -0
  60. package/resources/programming/basic_wiki/DEF_USR.md +33 -0
  61. package/resources/programming/basic_wiki/DELETE.md +49 -0
  62. package/resources/programming/basic_wiki/DIM.md +59 -0
  63. package/resources/programming/basic_wiki/DRAW.md +77 -0
  64. package/resources/programming/basic_wiki/ELSE.md +45 -0
  65. package/resources/programming/basic_wiki/END.md +32 -0
  66. package/resources/programming/basic_wiki/EOF().md +36 -0
  67. package/resources/programming/basic_wiki/EQV.md +76 -0
  68. package/resources/programming/basic_wiki/ERASE.md +35 -0
  69. package/resources/programming/basic_wiki/ERL.md +34 -0
  70. package/resources/programming/basic_wiki/ERR.md +143 -0
  71. package/resources/programming/basic_wiki/ERROR.md +145 -0
  72. package/resources/programming/basic_wiki/EXP().md +38 -0
  73. package/resources/programming/basic_wiki/FIELD.md +48 -0
  74. package/resources/programming/basic_wiki/FIX().md +44 -0
  75. package/resources/programming/basic_wiki/FN.md +61 -0
  76. package/resources/programming/basic_wiki/FOR...NEXT.md +80 -0
  77. package/resources/programming/basic_wiki/FRE().md +66 -0
  78. package/resources/programming/basic_wiki/GET_DATE.md +60 -0
  79. package/resources/programming/basic_wiki/GET_TIME.md +34 -0
  80. package/resources/programming/basic_wiki/GOSUB.md +41 -0
  81. package/resources/programming/basic_wiki/GOTO.md +41 -0
  82. package/resources/programming/basic_wiki/HEX$().md +36 -0
  83. package/resources/programming/basic_wiki/IF...GOTO...ELSE.md +55 -0
  84. package/resources/programming/basic_wiki/IF...THEN...ELSE.md +50 -0
  85. package/resources/programming/basic_wiki/IMP.md +83 -0
  86. package/resources/programming/basic_wiki/INKEY$.md +65 -0
  87. package/resources/programming/basic_wiki/INP().md +33 -0
  88. package/resources/programming/basic_wiki/INPUT$().md +51 -0
  89. package/resources/programming/basic_wiki/INPUT.md +93 -0
  90. package/resources/programming/basic_wiki/INSTR().md +44 -0
  91. package/resources/programming/basic_wiki/INT().md +44 -0
  92. package/resources/programming/basic_wiki/INTERVAL.md +57 -0
  93. package/resources/programming/basic_wiki/KEY().md +51 -0
  94. package/resources/programming/basic_wiki/KEY.md +254 -0
  95. package/resources/programming/basic_wiki/LEFT$().md +39 -0
  96. package/resources/programming/basic_wiki/LEN().md +36 -0
  97. package/resources/programming/basic_wiki/LET.md +68 -0
  98. package/resources/programming/basic_wiki/LINE.md +74 -0
  99. package/resources/programming/basic_wiki/LINE_INPUT.md +79 -0
  100. package/resources/programming/basic_wiki/LIST.md +58 -0
  101. package/resources/programming/basic_wiki/LLIST.md +43 -0
  102. package/resources/programming/basic_wiki/LOAD.md +56 -0
  103. package/resources/programming/basic_wiki/LOCATE.md +67 -0
  104. package/resources/programming/basic_wiki/LOG().md +36 -0
  105. package/resources/programming/basic_wiki/LPOS().md +31 -0
  106. package/resources/programming/basic_wiki/LPRINT.md +46 -0
  107. package/resources/programming/basic_wiki/MAXFILES.md +39 -0
  108. package/resources/programming/basic_wiki/MERGE.md +54 -0
  109. package/resources/programming/basic_wiki/MID$().md +72 -0
  110. package/resources/programming/basic_wiki/MOD.md +39 -0
  111. package/resources/programming/basic_wiki/MOTOR.md +46 -0
  112. package/resources/programming/basic_wiki/NEW.md +27 -0
  113. package/resources/programming/basic_wiki/NOT.md +61 -0
  114. package/resources/programming/basic_wiki/OCT$().md +36 -0
  115. package/resources/programming/basic_wiki/ON...GOSUB.md +45 -0
  116. package/resources/programming/basic_wiki/ON...GOTO.md +42 -0
  117. package/resources/programming/basic_wiki/ON_ERROR_GOTO.md +61 -0
  118. package/resources/programming/basic_wiki/ON_INTERVAL_GOSUB.md +54 -0
  119. package/resources/programming/basic_wiki/ON_KEY_GOSUB.md +56 -0
  120. package/resources/programming/basic_wiki/ON_SPRITE_GOSUB.md +41 -0
  121. package/resources/programming/basic_wiki/ON_STOP_GOSUB.md +56 -0
  122. package/resources/programming/basic_wiki/ON_STRIG_GOSUB.md +70 -0
  123. package/resources/programming/basic_wiki/OPEN.md +103 -0
  124. package/resources/programming/basic_wiki/OR.md +75 -0
  125. package/resources/programming/basic_wiki/OUT.md +35 -0
  126. package/resources/programming/basic_wiki/PAD().md +110 -0
  127. package/resources/programming/basic_wiki/PAINT.md +66 -0
  128. package/resources/programming/basic_wiki/PDL().md +53 -0
  129. package/resources/programming/basic_wiki/PEEK().md +44 -0
  130. package/resources/programming/basic_wiki/PLAY().md +58 -0
  131. package/resources/programming/basic_wiki/PLAY.md +196 -0
  132. package/resources/programming/basic_wiki/POINT.md +52 -0
  133. package/resources/programming/basic_wiki/POKE.md +51 -0
  134. package/resources/programming/basic_wiki/POS().md +36 -0
  135. package/resources/programming/basic_wiki/PRESET.md +61 -0
  136. package/resources/programming/basic_wiki/PRINT.md +179 -0
  137. package/resources/programming/basic_wiki/PSET.md +82 -0
  138. package/resources/programming/basic_wiki/PUT_KANJI.md +93 -0
  139. package/resources/programming/basic_wiki/PUT_SPRITE.md +143 -0
  140. package/resources/programming/basic_wiki/READ.md +45 -0
  141. package/resources/programming/basic_wiki/REM.md +42 -0
  142. package/resources/programming/basic_wiki/RENUM.md +78 -0
  143. package/resources/programming/basic_wiki/RESTORE.md +52 -0
  144. package/resources/programming/basic_wiki/RESUME.md +45 -0
  145. package/resources/programming/basic_wiki/RETURN.md +47 -0
  146. package/resources/programming/basic_wiki/RIGHT$().md +39 -0
  147. package/resources/programming/basic_wiki/RND().md +51 -0
  148. package/resources/programming/basic_wiki/RUN.md +56 -0
  149. package/resources/programming/basic_wiki/SAVE.md +65 -0
  150. package/resources/programming/basic_wiki/SCREEN.md +164 -0
  151. package/resources/programming/basic_wiki/SET_ADJUST.md +66 -0
  152. package/resources/programming/basic_wiki/SET_BEEP.md +76 -0
  153. package/resources/programming/basic_wiki/SET_DATE.md +103 -0
  154. package/resources/programming/basic_wiki/SET_PAGE.md +52 -0
  155. package/resources/programming/basic_wiki/SET_PASSWORD.md +75 -0
  156. package/resources/programming/basic_wiki/SET_PROMPT.md +61 -0
  157. package/resources/programming/basic_wiki/SET_SCREEN.md +100 -0
  158. package/resources/programming/basic_wiki/SET_SCROLL.md +55 -0
  159. package/resources/programming/basic_wiki/SET_TIME.md +83 -0
  160. package/resources/programming/basic_wiki/SET_TITLE.md +87 -0
  161. package/resources/programming/basic_wiki/SET_VIDEO.md +49 -0
  162. package/resources/programming/basic_wiki/SGN().md +38 -0
  163. package/resources/programming/basic_wiki/SIN().md +36 -0
  164. package/resources/programming/basic_wiki/SOUND.md +188 -0
  165. package/resources/programming/basic_wiki/SPACE$().md +38 -0
  166. package/resources/programming/basic_wiki/SPC().md +34 -0
  167. package/resources/programming/basic_wiki/SPRITE$().md +50 -0
  168. package/resources/programming/basic_wiki/SPRITE.md +31 -0
  169. package/resources/programming/basic_wiki/SQR().md +32 -0
  170. package/resources/programming/basic_wiki/STICK().md +70 -0
  171. package/resources/programming/basic_wiki/STOP.md +70 -0
  172. package/resources/programming/basic_wiki/STR$().md +37 -0
  173. package/resources/programming/basic_wiki/STRIG().md +82 -0
  174. package/resources/programming/basic_wiki/STRING$().md +42 -0
  175. package/resources/programming/basic_wiki/SWAP.md +62 -0
  176. package/resources/programming/basic_wiki/TAB().md +38 -0
  177. package/resources/programming/basic_wiki/TAN().md +36 -0
  178. package/resources/programming/basic_wiki/TIME.md +59 -0
  179. package/resources/programming/basic_wiki/TROFF.md +21 -0
  180. package/resources/programming/basic_wiki/TRON.md +39 -0
  181. package/resources/programming/basic_wiki/USR().md +66 -0
  182. package/resources/programming/basic_wiki/VAL().md +36 -0
  183. package/resources/programming/basic_wiki/VARPTR().md +50 -0
  184. package/resources/programming/basic_wiki/VDP().md +103 -0
  185. package/resources/programming/basic_wiki/VPEEK().md +46 -0
  186. package/resources/programming/basic_wiki/VPOKE.md +48 -0
  187. package/resources/programming/basic_wiki/WAIT.md +38 -0
  188. package/resources/programming/basic_wiki/WIDTH.md +76 -0
  189. package/resources/programming/basic_wiki/XOR.md +72 -0
  190. package/resources/programming/basic_wiki/_toc.json +871 -0
  191. package/resources/sdcc/sdccman.lyx +81574 -0
  192. package/resources/sdcc/toc.json +77 -0
  193. package/vector-db/index.json +1 -0
  194. /package/resources/msx-unapi/{Ethernet_UNAPI_specification_1.1.md → Ethernet_UNAPI_specification_1_1.md} +0 -0
  195. /package/resources/msx-unapi/{MSX_UNAPI_specification_1.1.md → MSX_UNAPI_specification_1_1.md} +0 -0
  196. /package/resources/processors/{Z80_R800_instruction_set.md → z80_r800_instruction_set.md} +0 -0
@@ -0,0 +1,36 @@
1
+ # OCT$()
2
+
3
+ ## Effect
4
+
5
+ Returns a string with the octal representation of a value.
6
+
7
+ ## Syntax
8
+
9
+ `OCT$(<Value>)`
10
+
11
+ ## Parameter
12
+
13
+ `<Value>` must be an expression, a numeric variable or a value between -32768 and 65535. A single or double precision value can be used but digits after the decimal point will be ignored.
14
+
15
+ ## Example
16
+
17
+ ```basic
18
+ 10 PRINT "The octal representation of 8 is ";OCT$(8)
19
+ 20 PRINT "The octal representation of 127 is ";OCT$(127)
20
+  
21
+ RUN
22
+ The octal representation of 8 is 10
23
+ The octal representation of 127 is 177
24
+ ```
25
+
26
+ ## Related to
27
+
28
+ `BIN$`, `HEX$`
29
+
30
+ ## Compatibility
31
+
32
+ MSX-BASIC 1.0 or higher
33
+
34
+ ## Source
35
+
36
+ Retrieved from "https://www.msx.org/wiki/OCT$()"
@@ -0,0 +1,45 @@
1
+ # ON...GOSUB
2
+
3
+ ## Effect
4
+
5
+ Calls a subroutine located on the specified line number, that varies according the value of a variable, used as condition.
6
+
7
+ ## Syntax
8
+
9
+ `ON <ConditionExpression> GOSUB <LineNumber>,<LineNumber>,...`
10
+
11
+ _Note: Parameters can not end with a comma alone._
12
+
13
+ ## Parameters
14
+
15
+ `<ConditionExpression>` is an expression that can result to value between 0-255.
16
+
17
+ `<LineNumber>` is a program line number of a subroutine. Each number needs to be separated by a comma. If `<ConditionExpression>` equals 1 the program execution will go to the first specified line number, if it equals 2 the execution will go to the 2nd specified line number, and so on up to 255. If there is no matching line number no `GOSUB` will be made.
18
+
19
+ The subroutine must be terminated with the `RETURN` instruction.
20
+
21
+ ## Example
22
+
23
+ ```basic
24
+ 10 CLS
25
+ 20 LOCATE 0,0
26
+ 30 ON STICK(0) GOSUB 60,50,90,50,70,50,80
27
+ 40 GOSUB 50:GOTO 20
28
+ 50 PRINT " ":RETURN
29
+ 60 PRINT "UP ":RETURN
30
+ 70 PRINT "DOWN ":RETURN
31
+ 80 PRINT "LEFT ":RETURN
32
+ 90 PRINT "RIGHT":RETURN
33
+ ```
34
+
35
+ ## Related to
36
+
37
+ `GOSUB`, `IF...GOTO...ELSE`, `IF...THEN...ELSE`, `ON...GOTO`, `RETURN`
38
+
39
+ ## Compatibility
40
+
41
+ MSX-BASIC 1.0 or higher
42
+
43
+ ## Source
44
+
45
+ Retrieved from "https://www.msx.org/wiki/ON...GOSUB"
@@ -0,0 +1,42 @@
1
+ # ON...GOTO
2
+
3
+ ## Effect
4
+
5
+ Jumps to a specified line number that varies according the value of a variable, used as condition, and executes the instructions from there.
6
+
7
+ ## Syntax
8
+
9
+ `ON <ConditionExpression> GOTO <LineNumber>,<LineNumber>,...`
10
+
11
+ _Note: Parameters can not end with a comma alone._
12
+
13
+ ## Parameters
14
+
15
+ `<ConditionExpression>` is an expression that can result to value between 0-255.
16
+
17
+ `<LineNumber>` is a program line number. Each number needs to be separated by a comma. If `<ConditionExpression>` equals 1 the program execution will go to the first specified line number, if it equals 2 the execution will go to the 2nd specified line number, and so on up to 255. The number of next line is taken by default.
18
+
19
+ ## Example
20
+
21
+ ```basic
22
+ 10 CLS
23
+ 20 LOCATE 1,1
24
+ 30 ON STICK(0) GOTO 50,,80,,60,,70
25
+ 40 PRINT " ":GOTO 20
26
+ 50 PRINT "UP ":GOTO 20
27
+ 60 PRINT "DOWN ":GOTO 20
28
+ 70 PRINT "LEFT ":GOTO 20
29
+ 80 PRINT "RIGHT":GOTO 20
30
+ ```
31
+
32
+ ## Related to
33
+
34
+ `GOTO`, `IF...GOTO...ELSE`, `IF...THEN...ELSE`, `ON...GOSUB`
35
+
36
+ ## Compatibility
37
+
38
+ MSX-BASIC 1.0 or higher
39
+
40
+ ## Source
41
+
42
+ Retrieved from "https://www.msx.org/wiki/ON...GOTO"
@@ -0,0 +1,61 @@
1
+ # ON ERROR GOTO
2
+
3
+ ## Effect
4
+
5
+ Jumps to a specified line of an error handling routine, whenever an eror occurs.
6
+
7
+ It's useful in the following situations:
8
+ - for defined errors in MSX-BASIC and Disk Basic, you want to avoid the display of the error messages.
9
+ - for non-defined errors, you decide to define them and to handle them directly in your program.
10
+
11
+ ## Syntax
12
+
13
+ `ON ERROR GOTO <LineNumber>`
14
+
15
+ ## Parameter
16
+
17
+ `<LineNumber>` is a program line number of your error handling routine. The subroutine must be terminated with the `RESUME` instruction.
18
+
19
+ If you execute `ON ERROR GOTO` with 0 as line number, it cancels the effect of the `ON ERROR GOTO` executed previously, stops the execution of the program and displays the error in progress. Placed alone in the last line of your program, this will have the effect of disabling the error handling routine of your program when execution is interrupted.
20
+
21
+ _Note:_
22
+ Take care to handle errors properly otherwise your program will behave weirdly. Error handling is not disabled when the program execution is ended or stopped except if you put `ON ERROR GOTO 0` alone in the last line of your program. `CLEAR`, `NEW` and `RUN` also disables the effect of the `ON ERROR GOTO` executed previously.
23
+
24
+ ## Examples
25
+
26
+ If you create the file named "MYDISK" for example with `BSAVE"MYDISK",0,0,S` the following program will be able to detect if this is your disk that is inserted or not.
27
+
28
+ ```basic
29
+ 10 ON ERROR GOTO 1000
30
+ 20 BLOAD"MYDISK",S
31
+ 30 PRINT"This is the right disk. :)"
32
+ 40 END
33
+ 1000 IF ERL<>20 THEN ON ERROR GOTO 0
34
+ 1010 IF ERR=70 THEN PRINT"Insert a disk!"
35
+ 1020 IF ERR=53 THEN PRINT"This disk is not the right one!"
36
+ 1030 RESUME 40
37
+ ```
38
+ Alternate code with the same effect:
39
+ ```basic
40
+ 10 ON ERROR GOTO 1000
41
+ 20 BLOAD"MYDISK",S
42
+ 30 PRINT"This is the right disk. :)"
43
+ 40 END
44
+ 1000 IF ERL<>20 THEN 1040
45
+ 1010 IF ERR=70 THEN PRINT"Insert a disk!"
46
+ 1020 IF ERR=53 THEN PRINT"This disk is not the right one!"
47
+ 1030 RESUME 40
48
+ 1040 ON ERROR GOTO 0
49
+ ```
50
+
51
+ ## Related to
52
+
53
+ `ERL`, `ERR`, `ERROR`, `RESUME`
54
+
55
+ ## Compatibility
56
+
57
+ MSX-BASIC 1.0 or higher
58
+
59
+ ## Source
60
+
61
+ Retrieved from "https://www.msx.org/wiki/ON_ERROR_GOTO"
@@ -0,0 +1,54 @@
1
+ # ON INTERVAL GOSUB
2
+
3
+ ## Effect
4
+
5
+ Calls a subroutine after the specified timeout has been elapsed.
6
+
7
+ ## Syntax
8
+
9
+ `ON INTERVAL=<TimeoutNumber> GOSUB<LineNumber>`
10
+
11
+ ## Parameters
12
+
13
+ `<TimeoutNumber>` is a number to specify the timeout, which is equal to number*1/60 (or number*1/50) seconds.
14
+
15
+ `<LineNumber>` is a program line number of your subroutine. The subroutine must be terminated with the `RETURN` instruction.
16
+
17
+ ## Examples
18
+
19
+ ```basic
20
+ 10 ' Interrupt once every second on all MSX models
21
+ 15 ON INTERVAL=60-10*(PEEK(&H2B)\128) GOSUB 50
22
+ 20 INTERVAL ON
23
+ 30 X=X+1:IF INKEY$="" THEN 30
24
+ 40 END
25
+ 50 PRINT X:RETURN
26
+ ```
27
+
28
+ ```basic
29
+ 10 ON INTERVAL=300 GOSUB 60
30
+ 20 INTERVAL ON
31
+ 30 FOR I=1 TO 10000:NEXT I
32
+ 40 INTERVAL OFF
33
+ 50 END
34
+ 60 K=K+6:PRINT K;"seconds"
35
+ 70 RETURN
36
+  
37
+ RUN
38
+ 6 seconds
39
+ 12 seconds
40
+ 18 seconds
41
+ 24 seconds
42
+ ```
43
+
44
+ ## Related to
45
+
46
+ `INTERVAL`, `RETURN`, `TIME`
47
+
48
+ ## Compatibility
49
+
50
+ MSX-BASIC 1.0 or higher
51
+
52
+ ## Source
53
+
54
+ Retrieved from "https://www.msx.org/wiki/ON_INTERVAL_GOSUB"
@@ -0,0 +1,56 @@
1
+ # ON KEY GOSUB
2
+
3
+ ## Effect
4
+
5
+ Defines a subroutine to execute when a function key is pressed down.
6
+
7
+ This 'rule' is activated only when the function key is enabled.
8
+
9
+ ## Syntax
10
+
11
+ `ON KEY GOSUB <LineNumber>,<LineNumber>,<LineNumber>...`
12
+
13
+ _Note: Each parameter is optional except the last specified. Do not put a comma after this parameter._
14
+
15
+ ## Parameters
16
+
17
+ `<LineNumber>` is a program line number of subroutine that will be called when the corresponding function key is pressed. We can put until 10 line numbers behind `GOSUB` (one per function key). If there is no matching line number no `GOSUB` will be made.
18
+ The subroutines must be terminated with the `RETURN` instruction.
19
+
20
+ ## Example
21
+
22
+ ```basic
23
+ 10 FOR I=1 TO 3: KEY(I) STOP: NEXT ' F1 to F3 are stopped
24
+ 20 FOR I=4 TO 10: KEY(I) OFF: NEXT ' F4 to F10 are disabled
25
+ 30 ON KEY GOSUB 170,180,190 ' Subroutine will only be active from line 130
26
+ 40 CLS
27
+ 50 PRINT"TEST 1: No effect"
28
+ 60 PRINT
29
+ 70 PRINT"Press a function key or ESC key"
30
+ 80 A$=INPUT$(1)
31
+ 90 IF A$=CHR$(27) THEN 100 ELSE 80
32
+ 100 CLS
33
+ 110 PRINT"TEST 2"
34
+ 120 PRINT"Press a function key"
35
+ 130 KEY(1)ON: KEY(2)ON: KEY(3)ON ' F1 to F3 and the subroutine in line 30 are enabled
36
+ 140 GOTO 160
37
+ 150 PRINT:PRINT a$+" pressed"
38
+ 160 GOTO 160
39
+ 170 A$="F1": RETURN 150
40
+ 180 A$="F2": RETURN 150
41
+ 190 A$="F3": RETURN 150
42
+ ```
43
+
44
+ Each line number after `ON KEY GOSUB` refers to a specific function key according its position in the instruction.
45
+
46
+ ## Related to
47
+
48
+ `KEY`, `KEY()`, `RETURN`
49
+
50
+ ## Compatibility
51
+
52
+ MSX-BASIC 1.0 or higher
53
+
54
+ ## Source
55
+
56
+ Retrieved from "https://www.msx.org/wiki/ON_KEY_GOSUB"
@@ -0,0 +1,41 @@
1
+ # ON SPRITE GOSUB
2
+
3
+ ## Effect
4
+
5
+ Defines a subroutine to execute when two or more sprites have collided on screen.
6
+
7
+ This 'rule' is activated only when the handling is enabled with `SPRITE` instruction.
8
+
9
+ ## Syntax
10
+
11
+ `ON SPRITE GOSUB <LineNumber>`
12
+
13
+ ## Parameter
14
+
15
+ `<LineNumber>` is a program line number of your subroutine. The subroutine must be terminated with the `RETURN` or `END` instruction.
16
+
17
+ ## Example
18
+
19
+ ```basic
20
+ 10 SCREEN5
21
+ 15 ON SPRITE GOSUB 80: SPRITE ON 'Enable colision for all sprites
22
+ 20 SPRITE$(0)=STRING$(8,255)
23
+ 30 PUTSPRITE 0,(50,50),10,0
24
+ 40 PUTSPRITE 1,(54,54),38,0 ' 38 is color 6 + &B0100000 to disable collision for sprite 1
25
+ 50 IF NOT STRIG(0) GOTO 50 'Press Space to enable OR operator
26
+ 60 COLOR SPRITE(1)=79 ' 79 is color 15 + &B1000000 to enable OR operation
27
+ 70 GOTO 70
28
+ 80 SCREEN 0: PRINT"Sprite collision OK": BEEP: END
29
+ ```
30
+
31
+ ## Related to
32
+
33
+ `END`, `PUT SPRITE`, `RETURN`, `SPRITE`, `SPRITE$()`
34
+
35
+ ## Compatibility
36
+
37
+ MSX-BASIC 1.0 or higher
38
+
39
+ ## Source
40
+
41
+ Retrieved from "https://www.msx.org/wiki/ON_SPRITE_GOSUB"
@@ -0,0 +1,56 @@
1
+ # ON STOP GOSUB
2
+
3
+ ## Effect
4
+
5
+ Defines a subroutine to execute when CTRL+STOP is pressed down.
6
+
7
+ This 'rule' is activated only when the checking of the simultaneous pressing of `CTRL`+`STOP` is enabled.
8
+
9
+ ## Syntax
10
+
11
+ `ON STOP GOSUB <LineNumber>`
12
+
13
+ ## Parameter
14
+
15
+ `<LineNumber>` is a program line number of your subroutine. The subroutine must be terminated with the `RETURN` instruction.
16
+
17
+ ## Examples
18
+
19
+ ```basic
20
+ 10 ON STOP GOSUB 100 : STOP ON
21
+ 20 CLS: PRINT "ON STOP ENABLED"
22
+ 30 FOR I = 1 TO 2000 : NEXT
23
+ 40 STOP OFF
24
+ 50 PRINT: PRINT "ON STOP DISABLED"
25
+ 60 FOR I = 1 TO 2000 : NEXT
26
+ 70 STOP ON : GOTO 20
27
+ 80 PRINT: INPUT A$
28
+ 90 IF A$="END" THEN STOP OFF:END ELSE 80
29
+ 100 PRINT "Enter END and press Return":RETURN 80
30
+ ```
31
+ ```basic
32
+ 10 ON STOP GOSUB 100 : STOP ON
33
+
34
+ 30 CLS
35
+
36
+ 90 GOTO 30
37
+ 100 RETURN
38
+ ```
39
+
40
+ ## Using
41
+
42
+ This instruction can be useful for inserting surprises in a program or for testing when developing the program.
43
+
44
+ With `ON STOP GOSUB`, `STOP ON` and `RETURN`, as in the second example, it is possible to prevent the exit from the program with `CTRL`+`STOP`. However, if you have enabled a Debug warm start with `POKE &HFBB0,1` (using system variable ENSTOP for example in line 20), the user will be able to re-start MSX-BASIC by pressing simultaneously `CTRL`+`SHIFT`+`GRAPH`+`CODE`/`KANA`.
45
+
46
+ ## Related to
47
+
48
+ `RETURN`, `STOP`
49
+
50
+ ## Compatibility
51
+
52
+ MSX-BASIC 1.0 or higher
53
+
54
+ ## Source
55
+
56
+ Retrieved from "https://www.msx.org/wiki/ON_STOP_GOSUB"
@@ -0,0 +1,70 @@
1
+ # ON STRIG GOSUB
2
+
3
+ ## Effect
4
+
5
+ Defines a subroutine to execute when the space key or a joystick/mouse button is pressed down.
6
+
7
+ This 'rule' is activated only when the checking of the space key or the joystick/mouse button is enabled.
8
+
9
+ ## Syntax
10
+
11
+ `ON STRIG GOSUB <LineNumber>,<LineNumber>,<LineNumber>...`
12
+
13
+ Each parameter is optional.
14
+
15
+ ## Parameters
16
+
17
+ `<LineNumber>` is a program line number of your subroutine. Each line number after `ON STRIG GOSUB` refers to a number according the triggers status. Triggers can be the space key or a joystick button/mouse (see table below).
18
+
19
+ |STRIG number|Description|
20
+ |---|---|
21
+ |0|Space key|
22
+ |1|Button 1 of joystick/mouse in port 1|
23
+ |2|Button 1 of joystick/mouse in port 2|
24
+ |3|Button 2 of joystick/mouse in port 1|
25
+ |4|Button 2 of joystick/mouse 2 in port 2|
26
+
27
+ The subroutines must be terminated with the `RETURN` instruction.
28
+
29
+ ## Examples
30
+
31
+ ```basic
32
+ 10 ON STRIG GOSUB 80 : STRIG(0) ON
33
+ 20 CLS: PRINT "SPACEBAR ROUTINE ENABLED"
34
+ 30 FOR I = 1 TO 2000 : NEXT
35
+ 40 STRIG(0) OFF
36
+ 50 PRINT: PRINT "SPACEBAR ROUTINE DISABLED"
37
+ 60 FOR I = 1 TO 2000 : NEXT
38
+ 70 STRIG(0) ON : GOTO 20
39
+ 80 PRINT: PRINT "SPACEBAR PRESSED DOWN"
40
+ 90 FOR I = 1 TO 2000 : NEXT
41
+ 100 RETURN 70
42
+ ```
43
+
44
+ ```basic
45
+ 10 FOR I = 0 TO 4: STRIG(I) ON: NEXT
46
+ 20 ON STRIG GOSUB 90, 100, 110, 120, 130
47
+ 30 CLS
48
+ 40 PRINT"Press spacebar or a button joystick"
49
+ 50 PRINT
50
+ 60 GOTO 80
51
+ 70 PRINT " pressed"
52
+ 80 GOTO 80
53
+ 90 PRINT "Spacebar";:RETURN 70
54
+ 100 PRINT "Button 1 of joystick 1";:RETURN 70
55
+ 110 PRINT "Button 1 of joystick 2";:RETURN 70
56
+ 120 PRINT "Button 2 of joystick 1";:RETURN 70
57
+ 130 PRINT "Button 2 of joystick 2";:RETURN 70
58
+ ```
59
+
60
+ ## Related to
61
+
62
+ `PAD()`, `RETURN`, `STRIG()`
63
+
64
+ ## Compatibility
65
+
66
+ MSX-BASIC 1.0 or higher
67
+
68
+ ## Source
69
+
70
+ Retrieved from "https://www.msx.org/wiki/ON_STRIG_GOSUB"
@@ -0,0 +1,103 @@
1
+ # OPEN
2
+
3
+ ## Effect
4
+
5
+ Opens a file for a specific direction in a specified device.
6
+
7
+ ## Syntax
8
+
9
+ `OPEN "<Device>:\<Path>\<Filename>" FOR <Direction> AS #<FileNumber> LEN=<RecordLength>`
10
+
11
+ _Notes:_
12
+ - Character backslash `\` serves as a separator between the folders and the file name in MSX-DOS2. You don't have to put it after the colon of the device name.
13
+ - Character backslash is replaced by the character yen `¥` on Japanese MSX or the character won `₩` on Korean MSX.
14
+ - Parameters can not end with a comma alone.
15
+
16
+ ## Parameters
17
+
18
+ `<Device>` specifies the used device. By default, the device will be the standard data recorder on a system without any disk drive, the current active drive (generally drive A) in the other cases.
19
+
20
+ Here are the useful devices for OPEN and the different types of access for these devices:
21
+
22
+ |Device type|Device name<br>followed by:|Remark|Sequential<br>OUTPUT|Sequential<br>INPUT|Sequential<br>APPEND|Random|
23
+ |---|---|---|:-:|:-:|:-:|:-:|
24
+ |Disk drive|A:, B:, C:, D:, E:, F:, G:, H:||X|X|X|X|
25
+ |Data recorder|CAS:|Not available on MSX turbo R|X|X|-|-|
26
+ |Serial device|COM[n]:|Requires RS-232C interface|X|X|-|-|
27
+ |Text screen|CRT:|Filename and direction not required|X|-|-|-|
28
+ |Data cartridge (Yamaha)|DC:|Requires Yamaha UDC-01 + YRM-104 or YRM-504|X|X|-|-|
29
+ |Graphic screen|GRP:|Filename and direction not required|X|-|-|-|
30
+ |High Graphic screen<sup>(*)</sup>|HIGRP:<sup>(**)</sup>|Filename and direction not required|X|-|-|-|
31
+ |Printer|LPT:|Filename and direction not required|X|-|-|-|
32
+ |Memory disk|MEM:|Created with CALL MEMINI|X|X|X|-|
33
+ |Quick Disk drive|QD[n]:|n=0 by default Can vary between 0 and 7|X|X|-|-|
34
+ |Device controlled by Pioneer UC-V102|RS[n]:|Requires Pioneer UK-V104 RS-232C board|X|X|-|-|
35
+ |Stringy Floppy Drive (special data recorder)|S:|Requires Spectravideo SVI-777 Not available on MSX turbo R|X|X|-|-|
36
+
37
+ |Device type|Device name<br>not followed by:|Remark|Sequential<br>OUTPUT|Sequential<br>INPUT|Sequential<br>APPEND|Random|
38
+ |---|---|---|:-:|:-:|:-:|:-:|
39
+ |Auxiliary device|AUX||X|X|X|X|
40
+ |Console|CON|Filename and direction not required|X|X|X|X|
41
+ |Printer|LST|Filename and direction not required|X|X|X|X|
42
+ |Bit heaven|NUL|Filename and direction not required|X|X|X|X|
43
+ |Printer|PRN|Filename and direction not required|X|X|X|X|
44
+
45
+ <sup>(\*)</sup> only on screen 6, after installation of HI-GRAPhics, written by Arjen Schrijvers (see Interlacing Demo).
46
+ <sup>(\*\*)</sup> it must be `OPEN "HIGRP:NTSC"` or `OPEN "HIGRP:PAL"`.
47
+
48
+ `<Path>` is used to specify the location in folders of file to load. Each folder name in path are separate by a backslash `\`. This parameter is only available in version 2 of Disk BASIC.
49
+
50
+ `<Filename>` is the name of the file to be opened. This parameter is not required for text screen, graphic screen and printer.
51
+
52
+ The format of file name is limited to 6 characters without extension, when using cassette. If another device is used, then the format is 8 characters followed by a point and an extension with 3 characters.
53
+
54
+ `<Direction>` must be preceded by `FOR` to be used. It is one of the 3 types of sequential access:
55
+ - OUTPUT = sequential write.
56
+ - INPUT = sequential read.
57
+ - APPEND = sequential write to the end of an existing file.
58
+
59
+ This parameter is not required for text screen, graphic screen and printer, but the listing is more easy to read when you use it. To open a file with random access on disk, you need to skip the `FOR <direction>` parameter.
60
+
61
+ `<FileNumber>` is a number that you must assign to open the file. It can vary between 1 and 15, but can't exceed the maximum number of files eventually defined with `MAXFILES`. The `#` in front can be omitted.
62
+
63
+ `<RecordLength>` must be preceded by `LEN` to be used. It is an optional parameter to use only if you choose to open a file in random access on disk. It must be an integer. The default value is 256. In case `FIELD` definitions exceed record length _"Field overflow"_ error is generated. Reading/writing is always done whole record at a time.
64
+
65
+ ## Examples
66
+
67
+ ```basic
68
+ 10 SCREEN 2:COLOR 15,4,7
69
+ 20 OPEN "GRP:" FOR OUTPUT AS #1
70
+ 30 LINE (32,32)-(120,120),6,B
71
+ 40 CIRCLE (120,120),56,1
72
+ 50 PRESET (40,8)
73
+ 60 PRINT #1,"Text in graphic screen"
74
+ 70 FOR I=1 TO 2000: NEXT I
75
+ 80 END
76
+ ```
77
+
78
+ ```basic
79
+ 5 'Open a random file on disk with 512 as length
80
+ 10 OPEN "A:RECORD.DAT" AS #1 LEN 512
81
+ 10 ' Create a text file
82
+ 20 OPEN"hello!.txt" FOR OUTPUT AS #1
83
+ 30 PRINT#1,"Hello world!"+CHR$(10)+CHR$(13)+"I'm the saved text from"
84
+ 40 PRINT#1,"the file HELLO!.TXT"
85
+ 50 CLOSE
86
+ 60 ' Print a text file
87
+ 70 OPEN"hello!.txt" FOR INPUT AS #1
88
+ 80 INPUT#1,A$:PRINT A$
89
+ 90 IF NOT EOF(1) THEN 80
90
+ 100 CLOSE
91
+ ```
92
+
93
+ ## Related to
94
+
95
+ `CALL MEMINI`, `CLOSE`, `EOF()`, `FIELD`, `INPUT`, `MAXFILES`, `PRINT`
96
+
97
+ ## Compatibility
98
+
99
+ MSX-BASIC 1.0 or higher
100
+
101
+ ## Source
102
+
103
+ Retrieved from "https://www.msx.org/wiki/OPEN"
@@ -0,0 +1,75 @@
1
+ # OR - MSX Wiki
2
+
3
+
4
+ ## Effect
5
+
6
+ Performs a bitwise `OR`-operation (logical inclusive or) between two expressions.
7
+
8
+ The bit is set if either one of the bits is set. For each bit, the results are:
9
+ ```
10
+ 0 OR 0 = 0
11
+ 0 OR 1 = 1
12
+ 1 OR 0 = 1
13
+ 1 OR 1 = 1
14
+ ```
15
+
16
+ ## Syntax
17
+
18
+ `<Value> OR <Value>`
19
+
20
+ ## Parameter
21
+
22
+ `<Value>` is a value between -32768 and 32767. It can also be a numeric variable, a mathematical expression or expression from a condition.
23
+
24
+ _Notes:_
25
+ - If you use binary expressions, it is best to put the first expression in parenthesis to avoid the bug in interpreter that causes a syntax error. This problem does not happen with decimal, hexadecimal or octal expressions.
26
+ - When the expression is performed in a condition (`IF...THEN...ELSE` or `IF...GOTO...ELSE`), if the result of the whole expression is zero the value is taken as false, otherwise it's taken as true.
27
+
28
+ ## Examples
29
+
30
+ ```basic
31
+ PRINT 15 OR 11
32
+ 15
33
+ ```
34
+ Binary explanation:
35
+ ```
36
+ 1111
37
+ 1011 OR
38
+ ----
39
+ 1111
40
+ ```
41
+
42
+ ---
43
+ ```basic
44
+ PRINT 5 OR 13
45
+ 5
46
+ ```
47
+ Binary explanation:
48
+ ```
49
+ 0101
50
+ 1101 OR
51
+ ----
52
+ 1101
53
+ ```
54
+ ---
55
+ ```basic
56
+ PRINT &B00001111 OR &B11110001
57
+ Syntax error
58
+ Ok
59
+ ```
60
+ ```basic
61
+ PRINT (&B00001111) OR &B11110001
62
+ 255
63
+ ```
64
+
65
+ ## Related to
66
+
67
+ `AND`, `EQV`, `IMP`, `MOD`, `NOT`, `XOR`
68
+
69
+ ## Compatibility
70
+
71
+ MSX-BASIC 1.0 or higher
72
+
73
+ ## Source
74
+
75
+ Retrieved from "https://www.msx.org/wiki/OR"
@@ -0,0 +1,35 @@
1
+ # OUT
2
+
3
+ ## Effect
4
+
5
+ Writes a value to an output port.
6
+
7
+ ## Syntax
8
+
9
+ `OUT <PortNumber>,<Value>`
10
+
11
+ ## Parameters
12
+
13
+ `<PortNumber>` is the I/O port number to write. It needs to be between 0 and 255.
14
+
15
+ `<Value>` is a value between 0 and 255 to write at port.
16
+
17
+ ## Example
18
+
19
+ Example to modify color 7 on MSX2 and higher with the following RGB values: R=4, G=3, B=5. Binary value of R is 100, of G is 011 and of B is 101, first binary value for OUT is 01000101 = 69, second binary value for OUT is 00000011 = 3.
20
+
21
+ ```basic
22
+ VDP(17)=7: OUT &H9A,69: OUT &H9A,3
23
+ ```
24
+
25
+ ## Related to
26
+
27
+ `INP()`, `SOUND`, `VDP()`, `WAIT`
28
+
29
+ ## Compatibility
30
+
31
+ MSX-BASIC 1.0 or higher
32
+
33
+ ## Source
34
+
35
+ Retrieved from "https://www.msx.org/wiki/OUT"