@nataliapc/mcp-openmsx 1.1.15 → 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 (190) hide show
  1. package/README.md +25 -14
  2. package/dist/server.js +73 -24
  3. package/dist/utils.js +10 -2
  4. package/dist/vectordb.js +60 -0
  5. package/package.json +8 -3
  6. package/resources/audio/msx-midi.md +872 -0
  7. package/resources/audio/psg_registers.md +281 -0
  8. package/resources/audio/sound_cartridge_scc.md +123 -0
  9. package/resources/audio/sound_cartridge_scci.md +250 -0
  10. package/resources/audio/toc.json +8 -4
  11. package/resources/book--msx2-technical-handbook/toc.json +1 -1
  12. package/resources/msx-unapi/toc.json +2 -2
  13. package/resources/programming/basic_wiki/ABS().md +36 -0
  14. package/resources/programming/basic_wiki/AND.md +71 -0
  15. package/resources/programming/basic_wiki/ASC().md +38 -0
  16. package/resources/programming/basic_wiki/ATN().md +36 -0
  17. package/resources/programming/basic_wiki/AUTO.md +39 -0
  18. package/resources/programming/basic_wiki/BASE().md +147 -0
  19. package/resources/programming/basic_wiki/BEEP.md +27 -0
  20. package/resources/programming/basic_wiki/BIN$().md +36 -0
  21. package/resources/programming/basic_wiki/BLOAD.md +63 -0
  22. package/resources/programming/basic_wiki/BSAVE.md +61 -0
  23. package/resources/programming/basic_wiki/CALL.md +391 -0
  24. package/resources/programming/basic_wiki/CALL_ADJUST.md +40 -0
  25. package/resources/programming/basic_wiki/CALL_IMPOSE.md +28 -0
  26. package/resources/programming/basic_wiki/CALL_OPTIONS.md +26 -0
  27. package/resources/programming/basic_wiki/CALL_PAUSE.md +119 -0
  28. package/resources/programming/basic_wiki/CALL_PCMPLAY.md +60 -0
  29. package/resources/programming/basic_wiki/CALL_PCMREC.md +70 -0
  30. package/resources/programming/basic_wiki/CDBL().md +36 -0
  31. package/resources/programming/basic_wiki/CHR$().md +51 -0
  32. package/resources/programming/basic_wiki/CINT().md +36 -0
  33. package/resources/programming/basic_wiki/CIRCLE.md +51 -0
  34. package/resources/programming/basic_wiki/CLEAR.md +39 -0
  35. package/resources/programming/basic_wiki/CLOAD.md +27 -0
  36. package/resources/programming/basic_wiki/CLOAD?.md +31 -0
  37. package/resources/programming/basic_wiki/CLOSE.md +44 -0
  38. package/resources/programming/basic_wiki/CLS.md +51 -0
  39. package/resources/programming/basic_wiki/COLOR.md +143 -0
  40. package/resources/programming/basic_wiki/COLOR=.md +93 -0
  41. package/resources/programming/basic_wiki/COLOR_SPRITE$().md +83 -0
  42. package/resources/programming/basic_wiki/COLOR_SPRITE().md +85 -0
  43. package/resources/programming/basic_wiki/CONT.md +23 -0
  44. package/resources/programming/basic_wiki/COPY.md +215 -0
  45. package/resources/programming/basic_wiki/COPY_SCREEN.md +61 -0
  46. package/resources/programming/basic_wiki/COS().md +37 -0
  47. package/resources/programming/basic_wiki/CSAVE.md +35 -0
  48. package/resources/programming/basic_wiki/CSNG().md +36 -0
  49. package/resources/programming/basic_wiki/CSRLIN.md +33 -0
  50. package/resources/programming/basic_wiki/DATA.md +47 -0
  51. package/resources/programming/basic_wiki/DEFDBL.md +40 -0
  52. package/resources/programming/basic_wiki/DEFINT.md +40 -0
  53. package/resources/programming/basic_wiki/DEFSNG.md +40 -0
  54. package/resources/programming/basic_wiki/DEFSTR.md +40 -0
  55. package/resources/programming/basic_wiki/DEF_FN.md +49 -0
  56. package/resources/programming/basic_wiki/DEF_USR.md +33 -0
  57. package/resources/programming/basic_wiki/DELETE.md +49 -0
  58. package/resources/programming/basic_wiki/DIM.md +59 -0
  59. package/resources/programming/basic_wiki/DRAW.md +77 -0
  60. package/resources/programming/basic_wiki/ELSE.md +45 -0
  61. package/resources/programming/basic_wiki/END.md +32 -0
  62. package/resources/programming/basic_wiki/EOF().md +36 -0
  63. package/resources/programming/basic_wiki/EQV.md +76 -0
  64. package/resources/programming/basic_wiki/ERASE.md +35 -0
  65. package/resources/programming/basic_wiki/ERL.md +34 -0
  66. package/resources/programming/basic_wiki/ERR.md +143 -0
  67. package/resources/programming/basic_wiki/ERROR.md +145 -0
  68. package/resources/programming/basic_wiki/EXP().md +38 -0
  69. package/resources/programming/basic_wiki/FIELD.md +48 -0
  70. package/resources/programming/basic_wiki/FIX().md +44 -0
  71. package/resources/programming/basic_wiki/FN.md +61 -0
  72. package/resources/programming/basic_wiki/FOR...NEXT.md +80 -0
  73. package/resources/programming/basic_wiki/FRE().md +66 -0
  74. package/resources/programming/basic_wiki/GET_DATE.md +60 -0
  75. package/resources/programming/basic_wiki/GET_TIME.md +34 -0
  76. package/resources/programming/basic_wiki/GOSUB.md +41 -0
  77. package/resources/programming/basic_wiki/GOTO.md +41 -0
  78. package/resources/programming/basic_wiki/HEX$().md +36 -0
  79. package/resources/programming/basic_wiki/IF...GOTO...ELSE.md +55 -0
  80. package/resources/programming/basic_wiki/IF...THEN...ELSE.md +50 -0
  81. package/resources/programming/basic_wiki/IMP.md +83 -0
  82. package/resources/programming/basic_wiki/INKEY$.md +65 -0
  83. package/resources/programming/basic_wiki/INP().md +33 -0
  84. package/resources/programming/basic_wiki/INPUT$().md +51 -0
  85. package/resources/programming/basic_wiki/INPUT.md +93 -0
  86. package/resources/programming/basic_wiki/INSTR().md +44 -0
  87. package/resources/programming/basic_wiki/INT().md +44 -0
  88. package/resources/programming/basic_wiki/INTERVAL.md +57 -0
  89. package/resources/programming/basic_wiki/KEY().md +51 -0
  90. package/resources/programming/basic_wiki/KEY.md +254 -0
  91. package/resources/programming/basic_wiki/LEFT$().md +39 -0
  92. package/resources/programming/basic_wiki/LEN().md +36 -0
  93. package/resources/programming/basic_wiki/LET.md +68 -0
  94. package/resources/programming/basic_wiki/LINE.md +74 -0
  95. package/resources/programming/basic_wiki/LINE_INPUT.md +79 -0
  96. package/resources/programming/basic_wiki/LIST.md +58 -0
  97. package/resources/programming/basic_wiki/LLIST.md +43 -0
  98. package/resources/programming/basic_wiki/LOAD.md +56 -0
  99. package/resources/programming/basic_wiki/LOCATE.md +67 -0
  100. package/resources/programming/basic_wiki/LOG().md +36 -0
  101. package/resources/programming/basic_wiki/LPOS().md +31 -0
  102. package/resources/programming/basic_wiki/LPRINT.md +46 -0
  103. package/resources/programming/basic_wiki/MAXFILES.md +39 -0
  104. package/resources/programming/basic_wiki/MERGE.md +54 -0
  105. package/resources/programming/basic_wiki/MID$().md +72 -0
  106. package/resources/programming/basic_wiki/MOD.md +39 -0
  107. package/resources/programming/basic_wiki/MOTOR.md +46 -0
  108. package/resources/programming/basic_wiki/NEW.md +27 -0
  109. package/resources/programming/basic_wiki/NOT.md +61 -0
  110. package/resources/programming/basic_wiki/OCT$().md +36 -0
  111. package/resources/programming/basic_wiki/ON...GOSUB.md +45 -0
  112. package/resources/programming/basic_wiki/ON...GOTO.md +42 -0
  113. package/resources/programming/basic_wiki/ON_ERROR_GOTO.md +61 -0
  114. package/resources/programming/basic_wiki/ON_INTERVAL_GOSUB.md +54 -0
  115. package/resources/programming/basic_wiki/ON_KEY_GOSUB.md +56 -0
  116. package/resources/programming/basic_wiki/ON_SPRITE_GOSUB.md +41 -0
  117. package/resources/programming/basic_wiki/ON_STOP_GOSUB.md +56 -0
  118. package/resources/programming/basic_wiki/ON_STRIG_GOSUB.md +70 -0
  119. package/resources/programming/basic_wiki/OPEN.md +103 -0
  120. package/resources/programming/basic_wiki/OR.md +75 -0
  121. package/resources/programming/basic_wiki/OUT.md +35 -0
  122. package/resources/programming/basic_wiki/PAD().md +110 -0
  123. package/resources/programming/basic_wiki/PAINT.md +66 -0
  124. package/resources/programming/basic_wiki/PDL().md +53 -0
  125. package/resources/programming/basic_wiki/PEEK().md +44 -0
  126. package/resources/programming/basic_wiki/PLAY().md +58 -0
  127. package/resources/programming/basic_wiki/PLAY.md +196 -0
  128. package/resources/programming/basic_wiki/POINT.md +52 -0
  129. package/resources/programming/basic_wiki/POKE.md +51 -0
  130. package/resources/programming/basic_wiki/POS().md +36 -0
  131. package/resources/programming/basic_wiki/PRESET.md +61 -0
  132. package/resources/programming/basic_wiki/PRINT.md +179 -0
  133. package/resources/programming/basic_wiki/PSET.md +82 -0
  134. package/resources/programming/basic_wiki/PUT_KANJI.md +93 -0
  135. package/resources/programming/basic_wiki/PUT_SPRITE.md +143 -0
  136. package/resources/programming/basic_wiki/READ.md +45 -0
  137. package/resources/programming/basic_wiki/REM.md +42 -0
  138. package/resources/programming/basic_wiki/RENUM.md +78 -0
  139. package/resources/programming/basic_wiki/RESTORE.md +52 -0
  140. package/resources/programming/basic_wiki/RESUME.md +45 -0
  141. package/resources/programming/basic_wiki/RETURN.md +47 -0
  142. package/resources/programming/basic_wiki/RIGHT$().md +39 -0
  143. package/resources/programming/basic_wiki/RND().md +51 -0
  144. package/resources/programming/basic_wiki/RUN.md +56 -0
  145. package/resources/programming/basic_wiki/SAVE.md +65 -0
  146. package/resources/programming/basic_wiki/SCREEN.md +164 -0
  147. package/resources/programming/basic_wiki/SET_ADJUST.md +66 -0
  148. package/resources/programming/basic_wiki/SET_BEEP.md +76 -0
  149. package/resources/programming/basic_wiki/SET_DATE.md +103 -0
  150. package/resources/programming/basic_wiki/SET_PAGE.md +52 -0
  151. package/resources/programming/basic_wiki/SET_PASSWORD.md +75 -0
  152. package/resources/programming/basic_wiki/SET_PROMPT.md +61 -0
  153. package/resources/programming/basic_wiki/SET_SCREEN.md +100 -0
  154. package/resources/programming/basic_wiki/SET_SCROLL.md +55 -0
  155. package/resources/programming/basic_wiki/SET_TIME.md +83 -0
  156. package/resources/programming/basic_wiki/SET_TITLE.md +87 -0
  157. package/resources/programming/basic_wiki/SET_VIDEO.md +49 -0
  158. package/resources/programming/basic_wiki/SGN().md +38 -0
  159. package/resources/programming/basic_wiki/SIN().md +36 -0
  160. package/resources/programming/basic_wiki/SOUND.md +188 -0
  161. package/resources/programming/basic_wiki/SPACE$().md +38 -0
  162. package/resources/programming/basic_wiki/SPC().md +34 -0
  163. package/resources/programming/basic_wiki/SPRITE$().md +50 -0
  164. package/resources/programming/basic_wiki/SPRITE.md +31 -0
  165. package/resources/programming/basic_wiki/SQR().md +32 -0
  166. package/resources/programming/basic_wiki/STICK().md +70 -0
  167. package/resources/programming/basic_wiki/STOP.md +70 -0
  168. package/resources/programming/basic_wiki/STR$().md +37 -0
  169. package/resources/programming/basic_wiki/STRIG().md +82 -0
  170. package/resources/programming/basic_wiki/STRING$().md +42 -0
  171. package/resources/programming/basic_wiki/SWAP.md +62 -0
  172. package/resources/programming/basic_wiki/TAB().md +38 -0
  173. package/resources/programming/basic_wiki/TAN().md +36 -0
  174. package/resources/programming/basic_wiki/TIME.md +59 -0
  175. package/resources/programming/basic_wiki/TROFF.md +21 -0
  176. package/resources/programming/basic_wiki/TRON.md +39 -0
  177. package/resources/programming/basic_wiki/USR().md +66 -0
  178. package/resources/programming/basic_wiki/VAL().md +36 -0
  179. package/resources/programming/basic_wiki/VARPTR().md +50 -0
  180. package/resources/programming/basic_wiki/VDP().md +103 -0
  181. package/resources/programming/basic_wiki/VPEEK().md +46 -0
  182. package/resources/programming/basic_wiki/VPOKE.md +48 -0
  183. package/resources/programming/basic_wiki/WAIT.md +38 -0
  184. package/resources/programming/basic_wiki/WIDTH.md +76 -0
  185. package/resources/programming/basic_wiki/XOR.md +72 -0
  186. package/resources/programming/basic_wiki/_toc.json +871 -0
  187. package/resources/sdcc/toc.json +1 -1
  188. package/vector-db/index.json +1 -0
  189. /package/resources/msx-unapi/{Ethernet_UNAPI_specification_1.1.md → Ethernet_UNAPI_specification_1_1.md} +0 -0
  190. /package/resources/msx-unapi/{MSX_UNAPI_specification_1.1.md → MSX_UNAPI_specification_1_1.md} +0 -0
@@ -0,0 +1,82 @@
1
+ # STRIG()
2
+
3
+ ## Effect
4
+
5
+ Returns the state of the space key and the joystick/mouse/trackball buttons or enables/disables/stops the call to the subroutine when pressing of the space keys and the joystick/mouse/trackball buttons.
6
+
7
+ ## Syntaxes
8
+
9
+ `STRIG(<ControllerNumber>)`
10
+
11
+ `STRIG(<ControllerNumber>) ON|OFF|STOP`
12
+
13
+ ## Parameters
14
+
15
+ `<ControllerNumber>` is a number between 0 and 4 to define the controller used.
16
+
17
+ |Controller|Description|
18
+ |---|---|
19
+ |0|Space key|
20
+ |1|Button 1 of joystick/mouse/trackball in port 1|
21
+ |2|Button 1 of joystick/mouse/trackball in port 2|
22
+ |3|Button 2 of joystick/mouse/trackball in port 1|
23
+ |4|Button 2 of joystick/mouse/trackball in port 2|
24
+
25
+ `STRIG(<ControllerNumber>)` used alone returns -1 when the space key or the joystick/mouse button corresponding to the specified controller is pressed down. Otherwhise, the value is 0.
26
+
27
+ `STRIG(<ControllerNumber>)` used with `ON`, `OFF`, `STOP` is always combined with `ON STRIG GOSUB`.
28
+
29
+ With `ON`, the computer will check if the space key or the joystick/mouse button corresponding to the `<sticknumber>` is pressed down and the subroutine specified with `ON STRIG GOSUB` is executed immediately.
30
+
31
+ With `OFF`, this checking is disabled.
32
+
33
+ With `STOP`, the checking is made, but the execution of the subroutine specified with `ON STRIG GOSUB` will happen only when a `STRIG() ON` command is executed later in the program.
34
+
35
+ ## Examples
36
+
37
+ ```basic
38
+ 10 PRINT "Hit the space key"
39
+ 20 P=STRIG(0)
40
+ 30 IF P=-1 THEN BEEP
41
+ 40 GOTO 20
42
+ ```
43
+
44
+ ```basic
45
+ 10 ON STRIG GOSUB 80 : STRIG(0) ON
46
+ 20 CLS: PRINT "SPACEBAR ROUTINE ENABLED"
47
+ 30 FOR I = 1 TO 2000 : NEXT
48
+ 40 STRIG(0) OFF
49
+ 50 PRINT: PRINT "SPACEBAR ROUTINE DISABLED"
50
+ 60 FOR I = 1 TO 2000 : NEXT
51
+ 70 STRIG(0) ON : GOTO 20
52
+ 80 PRINT: PRINT "SPACEBAR PRESSED DOWN"
53
+ 90 FOR I = 1 TO 2000 : NEXT
54
+ 100 RETURN 70
55
+ ```
56
+
57
+ ```basic
58
+ 10 ON STRIG GOSUB 60, 90, 100, 110, 120
59
+ 20 CLS
60
+ 30 FOR I=0 TO 4: STRIG(I) ON: NEXT
61
+ 40 PRINT"Press spacebar or a button joystick"
62
+ 50 GOTO 50
63
+ 60 PRINT"Spacebar";
64
+ 70 PRINT" pressed"
65
+ 80 RETURN
66
+ 90 PRINT"Button 1 of joystick 1";:GOTO 70
67
+ 100 PRINT"Button 1 of joystick 2";:GOTO 70
68
+ 110 PRINT"Button 2 of joystick 1";:GOTO 70
69
+ 120 PRINT"Button 2 of joystick 2";:GOTO 70
70
+ ```
71
+
72
+ ## Related to
73
+
74
+ `INKEY$`, `ON STRIG GOSUB`, `PAD()`, `PDL()`, `STICK()`
75
+
76
+ ## Compatibility
77
+
78
+ MSX-BASIC 1.0 or higher
79
+
80
+ ## Source
81
+
82
+ Retrieved from "https://www.msx.org/wiki/STRIG()"
@@ -0,0 +1,42 @@
1
+ # STRING$()
2
+
3
+ ## Effect
4
+
5
+ Returns a string with a variable length, all containing either the same character, which is defined as an ASCII code or the first character of a string.
6
+
7
+ ## Syntaxes
8
+
9
+ `STRING$(<Length>,<CodeNumber>)`
10
+
11
+ `STRING$(<Length>,"<String>")`
12
+
13
+ ## Parameters
14
+
15
+ `<Length>` It is the length of the string and must be an integer in range between 0 and 255.
16
+
17
+ `<CodeNumber>` must be an ASCII code between 32 and 255.
18
+
19
+ `<String>` is a string of characters between double quotes `"`. It can be replaced by a string variable (also named as alphanumeric variable).
20
+
21
+ ## Example
22
+
23
+ ```basic
24
+ 10 PRINT STRING$(8,65)
25
+ 20 PRINT STRING$(8,"MSX")
26
+  
27
+ RUN
28
+ AAAAAAAA
29
+ MMMMMMMM
30
+ ```
31
+
32
+ ## Related to
33
+
34
+ `ASC()`, `CHR$()`, `SPACE$()`, `SPC()`, `TAB()`
35
+
36
+ ## Compatibility
37
+
38
+ MSX-BASIC 1.0 or higher
39
+
40
+ ## Source
41
+
42
+ Retrieved from "https://www.msx.org/wiki/STRING$()"
@@ -0,0 +1,62 @@
1
+ # SWAP
2
+
3
+ ## Effect
4
+
5
+ Exchanges the contents of two variables.
6
+
7
+ ## Syntax
8
+
9
+ `SWAP <Variable1>, <Variable2>`
10
+
11
+ ## Parameters
12
+
13
+ `<Variable1>` and `<Variable2>` are numeric variables, array variables or string variables.
14
+
15
+ Every type of variable (integer, single precision, double precision, string) can be used. The only restriction is that both variables are of the same type.
16
+
17
+ ## Examples
18
+
19
+ ```basic
20
+ 10 X=3:Y=7
21
+ 20 A$="PIERRE":B$="JEAN"
22
+ 30 CLS
23
+ 40 GOSUB 90
24
+ 50 SWAP X,Y
25
+ 60 SWAP A$,B$
26
+ 70 GOSUB 90
27
+ 80 END
28
+ 90 PRINT "X=";X;"Y=";Y
29
+ 100 PRINT
30
+ 110 PRINT "A$=";A$;" B$=";B$
31
+ 120 PRINT
32
+ 130 RETURN
33
+  
34
+ RUN
35
+ X= 3 Y= 7
36
+
37
+ A$=PIERRE B$=JEAN
38
+
39
+ X= 7 Y= 3
40
+
41
+ A$=JEAN B$=PIERRE
42
+ ```
43
+
44
+ SWAP can be used to swap values inside an array as well...
45
+
46
+ ```basic
47
+ 10 ' Move sprite to 8-directions by using cursor keys (by NYYRIKKI)
48
+ 20 FORI=2TO8:XD(I)=SGN(5-I):YD(8-I)=XD(I):NEXT: SWAP YD(0),YD(8):SCREEN2,1:SPRITE$(0)="0HH0"
49
+ 30 FORI=0TO1:S=STICK(J):I=-STRIG(J):X=X+XD(S):Y=Y+YD(S):PUTSPRITE0,(X,Y),8:NEXT
50
+ ```
51
+
52
+ ## Related to
53
+
54
+ `LET`
55
+
56
+ ## Compatibility
57
+
58
+ MSX-BASIC 1.0 or higher
59
+
60
+ ## Source
61
+
62
+ Retrieved from "https://www.msx.org/wiki/SWAP"
@@ -0,0 +1,38 @@
1
+ # TAB()
2
+
3
+ ## Effect
4
+
5
+ Inserts the amount of spaces needed to reach a variable position in a `PRINT` or `LPRINT` instruction.
6
+
7
+ ## Syntax
8
+
9
+ `TAB(<Number>)`
10
+
11
+ ## Syntax
12
+
13
+ `<Number>` is the position defined by a number between 0 and 255.
14
+
15
+ If the cursor has already reached the specified position on the same line, the function is ignored.
16
+
17
+ ## Example
18
+
19
+ ```basic
20
+ 10 PRINT "MSX";TAB(10);"Forever!"
21
+ 20 PRINT TAB(10);"www.msx.org"
22
+  
23
+ RUN
24
+ MSX Forever!
25
+ www.msx.org
26
+ ```
27
+
28
+ ## Related to
29
+
30
+ `LPRINT`, `PRINT`, `SPACE$()`, `SPC()`, `STRING$()`
31
+
32
+ ## Compatibility
33
+
34
+ MSX-BASIC 1.0 or higher
35
+
36
+ ## Source
37
+
38
+ Retrieved from "https://www.msx.org/wiki/TAB()"
@@ -0,0 +1,36 @@
1
+ # TAN()
2
+
3
+ ## Effect
4
+
5
+ Returns the tangent of a variable.
6
+
7
+ ## Syntax
8
+
9
+ `TAN(<Number>)`
10
+
11
+ ## Parameter
12
+
13
+ `<Number>` can be a value, a numeric variable or an expression in radians.
14
+
15
+ ## Example
16
+
17
+ ```basic
18
+ 10 PRINT "The tangent of 1 is ";TAN(1)
19
+ 20 PRINT "The tangent of -1.23 is ";TAN(-1.23)
20
+  
21
+ RUN
22
+ The tangent of 1 is 1.5574077246549
23
+ The tangent of -1.23 is -2.8198157342686
24
+ ```
25
+
26
+ ## Related to
27
+
28
+ `ATN()`, `COS()`, `SIN()`
29
+
30
+ ## Compatibility
31
+
32
+ MSX-BASIC 1.0 or higher
33
+
34
+ ## Source
35
+
36
+ Retrieved from "https://www.msx.org/wiki/TAN()"
@@ -0,0 +1,59 @@
1
+ # TIME
2
+
3
+ ## Effect
4
+
5
+ This is a timer that is incremented by 1 on each time VDP completes screen draw. Depending of screen refresh rate this happens either 50 or 60 times a second.
6
+
7
+ This special integer value stored in `JIFFY` (0FC9Eh) can be read or write like a normal integer.
8
+
9
+ ## Syntax
10
+
11
+ `TIME`
12
+
13
+ ## Examples
14
+
15
+ ```basic
16
+ 5 ' European machine
17
+ 10 CLS
18
+ 20 LOCATE 10,6
19
+ 30 PRINT "HH:MM:SS START"
20
+ 40 TIME=0
21
+ 50 T=TIME
22
+ 60 H=INT(T/180000)
23
+ 70 T=T-(H*180000)
24
+ 80 M=INT(T/3000)
25
+ 90 T=T-(M*3000)
26
+ 100 S=INT(T/50)
27
+ 110 LOCATE 10,8
28
+ 120 PRINT USING "##:##:##";H;M;S
29
+ 130 GOTO 50
30
+ ```
31
+
32
+ ```basic
33
+ 5 ' Japanese machine
34
+ 10 CLS
35
+ 20 LOCATE 10,6
36
+ 30 PRINT "HH:MM:SS START"
37
+ 40 TIME=0
38
+ 50 T=TIME
39
+ 60 H=INT(T/216000)
40
+ 70 T=T-(H*216000)
41
+ 80 M=INT(T/3600)
42
+ 90 T=T-(M*3600)
43
+ 100 S=INT(T/60)
44
+ 110 LOCATE 10,8
45
+ 120 PRINT USING "##:##:##";H;M;S
46
+ 130 GOTO 50
47
+ ```
48
+
49
+ ## Related to
50
+
51
+ `ON INTERVAL GOSUB`, `RND()`
52
+
53
+ ## Compatibility
54
+
55
+ MSX-BASIC 1.0 or higher
56
+
57
+ ## Source
58
+
59
+ Retrieved from "https://www.msx.org/wiki/TIME"
@@ -0,0 +1,21 @@
1
+ # TROFF
2
+
3
+ ## Effect
4
+
5
+ Debug instruction to stop/disable tracing of MSX-BASIC program execution and return to normal program execution mode. Using the `NEW` instruction will also disable the tracing.
6
+
7
+ ## Syntax
8
+
9
+ `TROFF`
10
+
11
+ ## Related to
12
+
13
+ `NEW`, `TRON`
14
+
15
+ ## Compatibility
16
+
17
+ MSX-BASIC 1.0 or higher
18
+
19
+ ## Source
20
+
21
+ Retrieved from "https://www.msx.org/wiki/TROFF"
@@ -0,0 +1,39 @@
1
+ # TRON
2
+
3
+ ## Effect
4
+
5
+ Debug instruction to start/enable tracing of MSX-BASIC program execution. Once executed the line number will be printed to screen each time execution moves to a new line.
6
+
7
+ ## Syntax
8
+
9
+ `TRON`
10
+
11
+ ## Example
12
+
13
+ ```basic
14
+ 10 FOR I=1 TO 3
15
+ 20 PRINT I
16
+ 30 NEXT
17
+ 40 END
18
+ TRON
19
+ Ok
20
+
21
+ RUN
22
+ [10][20] 1
23
+ [30][20] 2
24
+ [30][20] 3
25
+ [30][40]
26
+ Ok
27
+ ```
28
+
29
+ ## Related to
30
+
31
+ `TROFF`
32
+
33
+ ## Compatibility
34
+
35
+ MSX-BASIC 1.0 or higher
36
+
37
+ ## Source
38
+
39
+ Retrieved from "https://www.msx.org/wiki/TRON"
@@ -0,0 +1,66 @@
1
+ # USR()
2
+
3
+ ## Effect
4
+
5
+ This function calls a subroutine in machine language, passing a value to it. The location of the subroutine has to be defined first, using the `DEF USR` instruction.
6
+
7
+ The value goes into the system variable `DAC` (&HF7F6, 8 bytes), and its type to `VALTYP` (&HF663, 1 byte). The return value of the function is taken from the same variable, so if it's not modified by the machine language subroutine, it returns the same value that it's passed.
8
+
9
+ ## Syntax
10
+
11
+ `USR<Number>(<Value>)`
12
+
13
+ ## Parameters
14
+
15
+ `<Number>` is optional and can range from 0 to 9. When omitted, 0 is assumed.
16
+
17
+ `<Value>` is a value, a variable or a string that can be retrieved by the machine subroutine.
18
+
19
+ ## Example
20
+
21
+ ```basic
22
+ 10 ' Example of USR function usage by NYYRIKKI
23
+ 11 ''''''''''''''''''''''''''''''''''''''''''''''''''''
24
+ 12 ' ML-Program to read PSG (See SOUND-command)
25
+ 13 ''''''''''''''''''''''''''''''''''''''''''''''''''''
26
+ 14 DATA"1E 05 LD E,5  ;Illegal function call
27
+ 15 DATA"3A 63 F6 LD A,(#F663)  ;VALTYP
28
+ 16 DATA"FE 02 CP 2  ;Integer type
29
+ 17 DATA"C2 6F 40 JP NZ,#406F  ;Error handler
30
+ 18 DATA"2A F8 F7 LD HL,(#F7F8) ;Input integer
31
+ 19 DATA"7C LD A,H
32
+ 20 DATA"A7 AND A
33
+ 21 DATA"C2 6F 40 JP NZ,#406F  ;>256 = ERROR
34
+ 22 DATA"7D LD A,L
35
+ 23 DATA"FE 10 CP 16
36
+ 24 DATA"D2 6F 40 JP NC,#406F  ;>15 = Error
37
+ 25 DATA"CD 96 00 CALL #96  ;Read PSG
38
+ 26 DATA"32 F8 F7 LD (#F7F8),A  ;Return value
39
+ 27 DATA"C9 RET
40
+ 28 ''''''''''''''''''''''''''''''''''''''''''''''''''''
41
+ 29 ' Put program to memory
42
+ 30 ''''''''''''''''''''''''''''''''''''''''''''''''''''
43
+ 31 DEFINT A-Z:AD=&HC000
44
+ 32 READ A$:P=1
45
+ 33 B$=MID$(A$,P,2):IF B$=" " THEN 32 ELSE P=P+3
46
+ 34 POKE AD,VAL("&H"+B$):AD=AD+1:IF B$<>"C9" THEN 33
47
+ 35 ''''''''''''''''''''''''''''''''''''''''''''''''''''
48
+ 36 ' Example of how to use USR function
49
+ 37 ''''''''''''''''''''''''''''''''''''''''''''''''''''
50
+ 38 DEFUSR=&HC000 ' This defines USR() start address
51
+ 39 PLAY"CDE"
52
+ 40 X=USR(0)+USR(1)*256:IF OX<>X THEN PRINT X:OX=X
53
+ 41 IF INKEY$="" THEN 40
54
+ ```
55
+
56
+ ## Related to
57
+
58
+ `DEF USR`
59
+
60
+ ## Compatibility
61
+
62
+ MSX-BASIC 1.0 or higher
63
+
64
+ ## Source
65
+
66
+ Retrieved from "https://www.msx.org/wiki/USR()"
@@ -0,0 +1,36 @@
1
+ # VAL()
2
+
3
+ ## Effect
4
+
5
+ Returns the numerical value of the contents of a string, omitting leading spaces, line feeds and tabs
6
+
7
+ ## Syntax
8
+
9
+ `VAL(<String>)`
10
+
11
+ ## Parameter
12
+
13
+ `<String>` is alphanumeric variable or a string that contents a numerical value coded in ASCII code.
14
+
15
+ ## Example
16
+
17
+ ```basic
18
+ 10 X=VAL(" 1.23")
19
+ 20 X=X+1
20
+ 30 PRINT X
21
+  
22
+ RUN
23
+ 2.23
24
+ ```
25
+
26
+ ## Related to
27
+
28
+ `STR$()`
29
+
30
+ ## Compatibility
31
+
32
+ MSX-BASIC 1.0 or higher
33
+
34
+ ## Source
35
+
36
+ Retrieved from "https://www.msx.org/wiki/VAL()"
@@ -0,0 +1,50 @@
1
+ # VARPTR()
2
+
3
+ ## Effect
4
+
5
+ Returns a pointer to either:
6
+ - the beginning of file work area.
7
+ - or the actual memory address of the first byte of the variable passed (in page 2 or 3 of the RAM, starting at &H8000).
8
+
9
+ In case of file number, the first byte of file work area contains information about how the file was opened. (1= input, 2=output, 4=random) In Disk BASIC 1.x the file work area offsets +1 & +2 point to FCB (File Control Block) associated with the specified file number. In Disk BASIC 2.x offset +1 contains number of the opened file handle.
10
+
11
+ In case of variable, the pointed variable is stored on 2, 3, 4 or 8 bytes depending on the variable type: the numbers are coded on 2 bytes for integer, 4 for simple precision or 8 for double precision. In case the variable is string the address of string pointer is returned, this string pointer contains length & address of the string (3 bytes).
12
+
13
+ See [Math-pack routines](https://www.msx.org/wiki/BASIC_Routines_In_Main-ROM#Math-pack_routines) for more info about the format of each type.
14
+
15
+ ## Syntaxes
16
+
17
+ `VARPTR(<VariableName>)`
18
+
19
+ `VARPTR(#<FileNumber>)`
20
+
21
+ ## Parameters
22
+
23
+ `<VariableName>` can be any variable in use.
24
+
25
+ `<FileNumber>` is the number of opened file: 1 up to 15 depending on `MAXFILES` or 0 for the tempory file FCB.
26
+
27
+ ## Example
28
+
29
+ ```basic
30
+ 10 X=5
31
+ 20 V=VARPTR(X)
32
+ 30 PRINT V
33
+ 40 PRINT "&H"+HEX$(V)
34
+  
35
+ RUN
36
+ -32735
37
+ &H802B
38
+ ```
39
+
40
+ ## Related to
41
+
42
+ `CLOSE`, `MAXFILES`, `OPEN`
43
+
44
+ ## Compatibility
45
+
46
+ MSX-BASIC 1.0 or higher
47
+
48
+ ## Source
49
+
50
+ Retrieved from "https://www.msx.org/wiki/VARPTR()"
@@ -0,0 +1,103 @@
1
+ # VDP()
2
+
3
+ ## Effect
4
+
5
+ Reads the content of a VDP register, or writes a value in a VDP register. Reading or writing depends on the use of the instruction in program. Used alone followed by an equal sign (=) and a value implies a write. Otherwise, the instruction will read.
6
+ Note: Some registers can also be combined with `OUT` and/or `INP()` for more possibilities (advanced use).
7
+
8
+ ## Syntaxes
9
+
10
+ `VDP(<Number>)`
11
+
12
+ `VDP(<Number>)=<Value>`
13
+
14
+ The first syntax is used to read, and the next is used to write (except in a condition of course).
15
+
16
+ ## Parameter
17
+
18
+ `<Number>` specifies a VDP register. The number of registers that are directly accessible varies according the MSX generation.
19
+
20
+ |Number|Corresponding VDP register|Modes|Machines|
21
+ |---|---|---|---|
22
+ |0 to 7|Control registers 0 to 7|Read / Write|MSX1 and higher|
23
+ |8|Status register 0|Read|MSX1 and higher|
24
+ |9 to 24|Control registers 8 to 23|Read / Write|MSX2 and higher|
25
+ |26 to 28|Control registers 25 to 27|Read / Write|MSX2+ and higher|
26
+ |33 to 47|Control registers 32 to 46 for graphic commands|Write|MSX2 and higher|
27
+ |-1 to -9|Status registers 1 to 9|Read|MSX2 and higher|
28
+
29
+ _Notes:_
30
+ - Status registers are only readable.
31
+ - Most control register are readable but in fact it is the corresponding value from the system variables that is read. The corresponding system variables are refreshed at each writing with the `VDP()` instruction or when a Bios routine is called.
32
+ - The command registers (32 to 46) can only be written with the `VDP()` instruction. Reading them leads to an _"Illegal function call"_ error message.
33
+ - The Sprite Color register is not numbered, the values are stocked in VRAM in sprite color table whose base address is base address of sprite attribute table minus 512 (200 in hexadecimal). Only `VPEEK()` and `VPOKE` can be useful with this register, similar to the Table Base Address Registers (control registers 2 to 6, 10, 11).
34
+
35
+ `<Value>` can vary between 0 and 255. See `VDP Registers` for detail.
36
+
37
+ ## Combinations
38
+
39
+ The following combinations extend the possibilities of the `VDP()` instruction on MSX2 and higher:
40
+
41
+ |VDP()|OUT|OUT|OUT|INP()|VDP()|Description|
42
+ |---|---|---|---|---|---|---|
43
+ |VDP(15) = three senior bits of VRAM address|OUT &H99, 8 low-bits of VRAM address| OUT &H99, type operation 1 + 6 remaining bits of VRAM address|OUT &H98,value|||Indirect access to write a specific VRAM address|
44
+ |VDP(15) = three senior bits of VRAM address|OUT &H99, 8 low-bits of VRAM address|OUT &H99, type operation 0 + 6 remaining bits of VRAM address||PRINT INP(&H98)||Indirect access to read a specific VRAM address|
45
+ |VDP(16) = number of status register (0-9)||||A = INP(&H99)|VDP(16) = 0: PRINT A|Indirect access to read a status register|
46
+ |VDP(17) = number of color palette register (0-15)|OUT &H9A, red and blue data separated by a 0 bit|OUT &H9A, green data||||Indirect access to write a color palette register|
47
+ |VDP(18) = number of control register (0-23, 25-27, 32-46)|OUT &H9B,value|||||Indirect access to write a control register|
48
+
49
+ ## Examples
50
+
51
+ ```basic
52
+ 10 FOR I=0 TO 8
53
+ 20 A=VDP(I)
54
+ 30 B$="00000000"+BIN$(A)
55
+ 40 PRINT RIGHT$(B$,8)
56
+ 50 NEXT I
57
+ ```
58
+
59
+ 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.
60
+
61
+ ```basic
62
+ VDP(17)=7: OUT &H9A,69: OUT &H9A,3
63
+ ```
64
+
65
+ ```basic
66
+ 5 ' Make a fast copy VRAM to VRAM (HMMC) with VDP instruction
67
+ 10 SCREEN 5
68
+ 20 CIRCLE(63,105),127,7,,,2
69
+ 30 PAINT(0,211),6,7: PAINT(0,0),10,7
70
+ 40 IF VDP(-2) AND 1 THEN 40 ' Wait the end of a graphical command
71
+ 50 VDP(33)=0: VDP(34)=0 ' X coordinate of source (two bytes)
72
+ 60 VDP(35)=0 ' Y coordinate of source
73
+ 70 VDP(40)=0 ' Source page
74
+ 80 VDP(37)=128: VDP(38)=0 ' X coordinate of destination (two bytes)
75
+ 90 VDP(39)=0 ' Y coordinate of destination
76
+ 100 VDP(40)=0 ' Destination page
77
+ 110 VDP(41)=128: VDP(42)=0 ' Width (two bytes)
78
+ 120 VDP(43)=212: VDP(44)=0 ' Height (two bytes)
79
+ 130 VDP(46)=0 ' Directions
80
+ 140 VDP(47)=&HD0 ' value to execute the HMMC command
81
+ 150 IF NOT STRIG(0) THEN 150
82
+ 160 ' Notes:
83
+ 170 ' The line 40 is only required to wait the end of precedent graphic command
84
+ 180 ' The advantage of making a copy with VDP() instructions
85
+ 190 ' is that there is no limit imposed by the Basic on the ordinate
86
+ ```
87
+
88
+ ## References
89
+
90
+ - `VDP Ports`
91
+ - `VDP Registers`
92
+
93
+ ## Related to
94
+
95
+ `BASE()`, `COLOR=`, `INP()`, `OUT`, `SCREEN`, `VPEEK()`, `VPOKE`
96
+
97
+ ## Compatibility
98
+
99
+ MSX-BASIC 1.0 or higher
100
+
101
+ ## Source
102
+
103
+ Retrieved from "https://www.msx.org/wiki/VDP()"
@@ -0,0 +1,46 @@
1
+ # VPEEK()
2
+
3
+ ## Effect
4
+
5
+ Returns the value of a byte within the video memory (VRAM).
6
+
7
+ ## Syntax
8
+
9
+ `VPEEK (<Address>)`
10
+
11
+ ## Parameter
12
+
13
+ `<Address>` must be in the range -32768 to 65535.
14
+
15
+ On MSX1 the usable VRAM area is 0-16383.
16
+
17
+ On MSX2 and up the usable VRAM area is 0-65535. In order to address all of the 128kB VRAM, `SET PAGE` instruction must be used. Please note that VRAM addressing is different (interleaved) in `SCREEN` modes 7, 8, 10, 11 and 12. However this is important to notice only if you switch between these two addressing modes between reading / writing.
18
+
19
+ ## Example
20
+
21
+ ```basic
22
+ 10 SC=PEEK(&HFCAF) ' Current screen mode (= 0/1 for text)
23
+ 20 AD=ASC("0")*8+BASE(SC*5+2) '"0" Font address in VRAM
24
+ 30 'Make empty & "ball"-font to "0" & "1"
25
+ 40 FOR I=0 TO 7:VPOKE AD+I,0:VPOKEAD+I+8,248:NEXTI
26
+ 50 VPOKE AD+8,112:VPOKEAD+14,112:VPOKEAD+15,0
27
+ 60 A$=INPUT$(1):CLS
28
+ 70 IF A$<" " THEN SCREEN SC:END
29
+ 80 ' Display ball picture of font A$
30
+ 90 AD=ASC(A$)*8+BASE(SC*5+2) 'A$ Font address in VRAM
31
+ 100 FOR I=0 TO 7
32
+ 110 PRINT RIGHT$("0000000"+BIN$(VPEEK(AD+I)),8)
33
+ 120 NEXT I:GOTO 60
34
+ ```
35
+
36
+ ## Related to
37
+
38
+ `BASE()`, `SET PAGE`, `SCREEN`, `VDP()`, `VPOKE`
39
+
40
+ ## Compatibility
41
+
42
+ MSX-BASIC 1.0 or higher
43
+
44
+ ## Source
45
+
46
+ Retrieved from "https://www.msx.org/wiki/VPEEK()"