@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,49 @@
1
+ # SET VIDEO
2
+
3
+ ## Effect
4
+
5
+ Sets superimposition and digitization modes.
6
+
7
+ ## Syntax
8
+
9
+ `SET VIDEO <Mode>,<ScreenLuminance>,<ColorBus>,<Synchro>,<AudioSource>,<VideoOutput>,<A/V>`
10
+
11
+ _Note: Each parameter is optional except the last specified. Do not put a comma after this parameter._
12
+
13
+ ## Parameters
14
+
15
+ `<Mode>` is a value between 0 and 3 to set video mode.
16
+ - 0 for computer screen (internal synchronization).
17
+ - 1 for computer screen - digitize mode (external synchronization).
18
+ - 2 for superimpose (external synchronization).
19
+ - 3 for external video (external synchronization).
20
+
21
+ `<ScreenLuminance>` is 0/1 for normal/half tone.
22
+
23
+ `<ColorBus>` is to set the direction for VDP's color bus. 0 for IN, 1 for OUT.
24
+
25
+ `<Synchro>` is to set the type of synchronisation, 0 for internal, 1 for external.
26
+
27
+ `<AudioSource>` is to set the type of audio source.
28
+ - 0 = only computer.
29
+ - 1 = mix computer + external source only on right side.
30
+ - 2 = mix computer + external source only on left side.
31
+ - 3 = mix computer + external source on both sides.
32
+
33
+ `<VideoOutput>` is to set the type of video output, 0 for RGB, 1 for composite.
34
+
35
+ `<A/V>` is to select or not the RGB output for audio and video, 0 is not selected, 1 is selected.
36
+
37
+ ## Related to
38
+
39
+ `CALL IMPOSE`, `COPY SCREEN`, `SCREEN`
40
+
41
+ ## Compatibility
42
+
43
+ MSX-BASIC 2.0 or higher
44
+
45
+ _Note: This instruction is available on all MSX2 and higher computers. The parameters will be ignored on machines without corresponding option (digitizing unit, superimposition capacity, etc). All parameters are effective with the Panasonic FS-UV1 cartridge._
46
+
47
+ ## Source
48
+
49
+ Retrieved from "https://www.msx.org/wiki/SET_VIDEO"
@@ -0,0 +1,38 @@
1
+ # SGN()
2
+
3
+ ## Effect
4
+
5
+ Returns the sign (positive of negative) of a variable.
6
+
7
+ ## Syntax
8
+
9
+ `SGN (<Expression>)`
10
+
11
+ ## Parameter
12
+
13
+ `<Expression>` can be a value, a numeric variable or an mathematical expression.
14
+
15
+ ## Example
16
+
17
+ ```basic
18
+ 10 PRINT "The sign of -7 is ";SGN(-7)
19
+ 20 PRINT "The sign of 0 is ";SGN(0)
20
+ 30 PRINT "The sign of 7 is ";SGN(7)
21
+  
22
+ RUN
23
+ The sign of -7 is -1
24
+ The sign of 0 is 0
25
+ The sign of 7 is 1
26
+ ```
27
+
28
+ ## Related to
29
+
30
+ `ABS()`, `FIX()`, `INT()`
31
+
32
+ ## Compatibility
33
+
34
+ MSX-BASIC 1.0 or higher
35
+
36
+ ## Source
37
+
38
+ Retrieved from "https://www.msx.org/wiki/SGN()"
@@ -0,0 +1,36 @@
1
+ # SIN()
2
+
3
+ ## Effect
4
+
5
+ Returns the sine of a variable in radians.
6
+
7
+ ## Syntax
8
+
9
+ `SIN(<Number>)`
10
+
11
+ ## Parameter
12
+
13
+ `<Number>` can be a value, a numeric variable or an expression.
14
+
15
+ ## Example
16
+
17
+ ```basic
18
+ 10 D1 = ATN(1)*8/360
19
+ 20 PRINT "The sine of a 45 degree angle is ";SIN(45*D1)
20
+ 30 PRINT "The sine of a 0 degree angle is ";SIN(0)
21
+ RUN
22
+ The sine of a 45 degree angle is .70710678118655
23
+ The sine of a 0 degree angle is 0
24
+ ```
25
+
26
+ ## Related to
27
+
28
+ `ATN()`, `COS()`, `TAN()`
29
+
30
+ ## Compatibility
31
+
32
+ MSX-BASIC 1.0 or higher
33
+
34
+ ## Source
35
+
36
+ Retrieved from "https://www.msx.org/wiki/SIN()"
@@ -0,0 +1,188 @@
1
+ # SOUND
2
+
3
+ ## Effect
4
+
5
+ Writes a value in a specific PSG register.
6
+
7
+ Sound registers 14 and 15 and the two highest bits of register 7 are not accessible with this instruction.
8
+
9
+ ## Syntax
10
+
11
+ `SOUND <PSGregister>,<Value>`
12
+
13
+ ## Parameters
14
+
15
+ `<PSGregister>` is the register number (0-13) to write. It can be a variable or an expression.
16
+
17
+ `<Value>` is a value whose limits depend on the register to write (see Registers Description below). It can be a variable or an expression.
18
+
19
+ _Recommendation for maximum compatibility: when you write register 7 it is good habit to set bit 7 and reset bit 6 although these potentially harmful values should not end up to PSG in any case. That's why only the values 128 to 191 are mentioned below for this register._
20
+
21
+ ## Registers Description
22
+
23
+ |Register|Description|Values|
24
+ |---|---|---|
25
+ |0|Least significant bits of channel A frequency|0~255|
26
+ |1|Most significant bits of channel A frequency|0~15|
27
+ |2|Least significant bits of channel B frequency|0~255|
28
+ |3|Most significant bits of channel B frequency|0~15|
29
+ |4|Least significant bits of channel C frequency|0~255|
30
+ |5|Most significant bits of channel C frequency|0~15|
31
+ |6|Noise generator frequency|0~31|
32
+ |7|Mixer setting|128~191|
33
+ |8|Volume of channel A|0~16|
34
+ |9|Volume of channel B|0~16|
35
+ |10|Volume of channel C|0~16|
36
+ |11|Least significant bits of envelope period|0~255|
37
+ |12|Most significant bits of envelope period|0~255|
38
+ |13|Envelope shape|0~15|
39
+
40
+ ### About registers 0 to 5
41
+
42
+ - The value indicating the frequency to be produced on a channel is 12 bits. It is therefore divided into two registers. The value to be written is obtained using the following expression:
43
+
44
+ `Value = Fi / (16 x Fn)`
45
+
46
+ `Fi` = Internal frequency of PSG (1789772.5 Hz on MSX).
47
+ `Fn` = Frequency of the sound to be produced (varies between 27 and 111.860 Hz).
48
+
49
+ Additional math:
50
+
51
+ `Note + Octave = Note/2`
52
+
53
+ `Note + HalfNote = Note/2^(1/12)`
54
+
55
+ For simplicity, here is ready table of musical notes by octave obtained according to the value indicated in the registers 0~1, 2~3 or 4~5:
56
+
57
+ |Note|O1|O2|O3|O4|O5|O6|O7|O8|
58
+ |---|---|---|---|---|---|---|---|---|
59
+ |C|D5Dh|6AFh|357h|1ACh|0D6h|06Bh|035h|01Bh|
60
+ |C#|C9Ch|64Eh|327h|194h|0CAh|065h|032h|019h|
61
+ |D|BE7h|5F4h|2FAh|17Dh|0BEh|05Fh|030h|018h|
62
+ |D#|B3Ch|59Eh|2CFh|168h|0B4h|05Ah|02Dh|016h|
63
+ |E|A9Bh|54Eh|2A7h|153h|0AAh|055h|02Ah|015h|
64
+ |F|A02h|501h|281h|140h|0A0h|050h|028h|014h|
65
+ |F#|973h|4BAh|25Dh|12Eh|097h|04Ch|026h|013h|
66
+ |G|8EBh|476h|23Bh|11Dh|08Fh|047h|024h|012h|
67
+ |G#|86Bh|436h|21Bh|10Dh|087h|043h|022h|011h|
68
+ |A|7F2h|3F9h|1FDh|0FEh<sup>*</sup>|07Fh|040h|020h|010h|
69
+ |A#|780h|3C0h|1E0h|0F0h|078h|03Ch|01Eh|00Fh|
70
+ |B|714h|38Ah|1C5h|0E3h|071h|039h|01Ch|00Eh|
71
+
72
+ <sup>(*)</sup> 0FEh is the note produced by a tuning fork.
73
+
74
+ ### About register 6
75
+
76
+ The value indicating the frequency of the white noise generator is 5 bits. The value to be written is obtained using the following formula:
77
+
78
+ `Value = Fi / (16 x Fb)`
79
+
80
+ `Fi` = Internal frequency of PSG (1789772.5 Hz on MSX).
81
+ `Fb` = Noise frequency master to be produced (varies between 3.608 and 111.860 Hz).
82
+
83
+ ### About register 7
84
+
85
+ This register is used to activate or deactivate the tone generator as well as the noise generator. The format of the value is as follows:
86
+
87
+ |PSG I/O ports<br>Bit7 - Bit6|Disabling noise<br>Bit5 - Bit4 - Bit3|Disabling tone<br>Bit2 - Bit1 - Bit 0|
88
+ |:-:|:-:|:-:|
89
+ |B=1 - A=0|channelC - channelB - channelA |channelC - channelB - channelA|
90
+
91
+ Bits 7 and 6 serves to specify the direction of PSG I/O ports. Always set bit 7 and reset bit 6. Otherwise some devices connected to the joystick ports may malfunction.
92
+
93
+ ### About register 8 to 10
94
+
95
+ The format of these registers is as follows:
96
+
97
+ |Bit 7|Bit 6|Bit 5|Bit 4|Bit 3 - Bit 2 - Bit 1 - Bit 0|
98
+ |:-:|:-:|:-:|:-:|:-:|
99
+ |-|-|-|V/A|Volume / Amplitude of the channel|
100
+
101
+ Reset bit 4 (V/A) to adjust the volume of the corresponding channel, if set the volume will vary in proportion to the envelope shape defined by register 13.
102
+
103
+ ### About register 11 to 13
104
+
105
+ The registers 11 and 12 control the envelope period. The value is on 16 bits (0~65535). It is calculated with the following expression:
106
+
107
+ `Value = Fi / (256 x T)`
108
+
109
+ `Fi` = Internal frequency of PSG (1789772.5 Hz on MSX).
110
+ `T` = Period of the envelope (in μs)
111
+
112
+ The register 13 defines the envelope shape. Here are the possible shapes:
113
+ - 0~3 \_______
114
+ - 4~7 /_______
115
+ - 8 \\\\\\\\
116
+ - 9 \_______
117
+ - 10 \/\/\/\/
118
+ - 11 \ ̄ ̄ ̄ ̄ ̄ ̄ ̄
119
+ - 12 ////////
120
+ - 13 / ̄ ̄ ̄ ̄ ̄ ̄ ̄
121
+ - 14 /\/\/\/\
122
+ - 15 /_______
123
+
124
+ ## Examples
125
+
126
+ ```basic
127
+ 5 ' Initializes the sound registers of the PSG
128
+ 10 FOR R=0 TO 13
129
+ 20 IF R=7 THEN SOUND R,&B10111111 ELSE SOUND R,0
130
+ 30 NEXT
131
+ 40 ' Plays the note C on channel A with a volume of 12
132
+ 50 SOUND 0,&hAC ' 8 least significant bits of frequency on channel A
133
+ 60 SOUND 1,1 ' 4 most significant bits of frequency on channel A
134
+ 70 SOUND 8,&b1100 ' Sets the volume to 12 on channel A
135
+ 80 SOUND 7,&b10111110 ' Activates the sound generator on channel A
136
+ ```
137
+
138
+ Same example in decimal mode for the values:
139
+ ```basic
140
+ 5 ' Initializes the sound registers of the PSG
141
+ 10 FOR R=0 TO 13
142
+ 20 IF R=7 THEN SOUND R,191 ELSE SOUND R,0
143
+ 30 NEXT
144
+ 40 ' Plays the note C on channel A with a volume of 12
145
+ 50 SOUND 0,172 ' 8 least significant bits of frequency on channel A
146
+ 60 SOUND 1,1 ' 4 most significant bits of frequency on channel A
147
+ 70 SOUND 8,12 ' Sets the volume to 12 on channel A
148
+ 80 SOUND 7,190 ' Activates the sound generator on channel A
149
+ ```
150
+
151
+ Legendary Finnish sauna-effect (_Source: MikroBitti 12/1987_):
152
+ ```basic
153
+ 10 REM SAUNONTA-TEHOSTE
154
+ 20 SOUND 7,&B10110111
155
+ 30 SOUND 8,16
156
+ 40 SOUND 6,2
157
+ 50 SOUND 12,160
158
+ 60 SOUND 13,0
159
+ 70 FOR T=1 TO 3500:NEXT
160
+ 80 KO=INT(RND(1)*7)+2
161
+ 90 SOUND 6,KO
162
+ 100 M=INT(RND(1)*2)+3
163
+ 110 SOUND 12,M
164
+ 120 SOUND 13,4
165
+ 130 AV=INT(RND(1)*50)+250
166
+ 140 FOR T=1 TO AV:NEXT
167
+ 150 N=N+1:IF N<LL THEN 80
168
+ 160 N=0:LL=INT(RND(1)*15)+10
169
+ 170 FOR T=1 TO 1000:NEXT
170
+ 180 GOTO 40
171
+ ```
172
+
173
+ ## Related to
174
+
175
+ `BEEP`, `PLAY`, `PLAY()`
176
+
177
+ ## Compatibility
178
+
179
+ MSX-BASIC 1.0 or higher
180
+
181
+ ## Links
182
+
183
+ - [General Instrument AY-3-8910 application manual](http://map.grauw.nl/resources/sound/generalinstrument_ay-3-8910.pdf)
184
+ - [Yamaha YM2149 SSG application manual](http://map.grauw.nl/resources/sound/yamaha_ym2149.pdf)
185
+
186
+ ## Source
187
+
188
+ Retrieved from "https://www.msx.org/wiki/SOUND"
@@ -0,0 +1,38 @@
1
+ # SPACE$()
2
+
3
+ ## Effect
4
+
5
+ Generates a string with a specified number of spaces.
6
+
7
+ This instruction is equivalent to `STRING$` used with the ASCII code 32.
8
+
9
+ ## Syntax
10
+
11
+ `SPACE$(<Number>)`
12
+
13
+ ## Parameter
14
+
15
+ `<Number>` is the number of spaces, it must be between 0 and 255.
16
+
17
+ ## Example
18
+
19
+ ```basic
20
+ 10 PRINT "A";SPACE$(5);"B"
21
+ 20 PRINT SPACE$(5);"AB"
22
+  
23
+ RUN
24
+ A B
25
+ AB
26
+ ```
27
+
28
+ ## Related to
29
+
30
+ `SPC()`, `STRING$()`, `TAB()`
31
+
32
+ ## Compatibility
33
+
34
+ MSX-BASIC 1.0 or higher
35
+
36
+ ## Source
37
+
38
+ Retrieved from "https://www.msx.org/wiki/SPACE$()"
@@ -0,0 +1,34 @@
1
+ # SPC()
2
+
3
+ ## Effect
4
+
5
+ Inserts a variable amount of spaces in a `PRINT` or `LPRINT` instruction.
6
+
7
+ ## Syntax
8
+
9
+ `SPC(<Number>)`
10
+
11
+ ## Parameter
12
+
13
+ `<Number>` is the number of spaces, it must be between 0 and 255.
14
+
15
+ ## Example
16
+
17
+ ```basic
18
+ 10 PRINT "MSX";SPC(3);"Forever!"
19
+  
20
+ RUN
21
+ MSX Forever!
22
+ ```
23
+
24
+ ## Related to
25
+
26
+ `LPRINT`, `PRINT`, `SPACE$()`, `STRING$()`, `TAB()`
27
+
28
+ ## Compatibility
29
+
30
+ MSX-BASIC 1.0 or higher
31
+
32
+ ## Source
33
+
34
+ Retrieved from "https://www.msx.org/wiki/SPC()"
@@ -0,0 +1,50 @@
1
+ # SPRITE$()
2
+
3
+ ## Effect
4
+
5
+ Defines a sprite's outlook (also known as 'pattern') and works like a regular 1-dimensional string array.
6
+
7
+ It can also be used to return the sprite's pattern data in the form of a string.
8
+
9
+ ## Syntaxes
10
+
11
+ `SPRITE$(<PatternNumber>)=<String>`
12
+
13
+ `SPRITE$(<PatternNumber>)`
14
+
15
+ ## Parameters
16
+
17
+ `<PatternNumber>` is a number ranging from 0 to 63 (for sprite size 16x16) or to 255 (for sprite size 8x8) that specifies the sprite pattern number.
18
+
19
+ `<String>` is a string of 8 or 32 characters according the sprites size (8x8 or 16x16).
20
+
21
+ Each character represents an 8x1 area in the sprite where "1"-bits represent visible dots and "0"-bits represent invisible dots.
22
+
23
+ The characters are given in order from up to down and left to right. Upper left corner in 16x16 sprite is therefore bit 7 of character 1, bottom right corner is bit 7 of character 16, upper right corner is bit 0 of character 17 and bottom right corner is bit 0 of character 32.
24
+
25
+ In case defined the string is shorter than required (8 or 32 characters) the rest of the sprite string is filled with 0.
26
+
27
+ ## Example
28
+
29
+ ```basic
30
+ 10 COLOR 15,1,7: SCREEN 2,0
31
+ 20 B$=""
32
+ 30 FOR I=0 TO 7: READ A: B$=B$+CHR$(A): NEXT
33
+ 40 SPRITE$(0)=B$
34
+ 50 PUT SPRITE 0, (100,100),15,0
35
+ 60 A$=INPUT$(1)
36
+ 70 SCREEN 1: PRINT SPRITE$(0)
37
+ 80 DATA 24,60,126,255,36,36,66,129
38
+ ```
39
+
40
+ ## Related to
41
+
42
+ `CHR$()`, `COLOR SPRITE()`, `COLOR SPRITE$()`, `ON SPRITE GOSUB`, `PUT SPRITE`, `SPRITE`
43
+
44
+ ## Compatibility
45
+
46
+ MSX-BASIC 1.0 or higher
47
+
48
+ ## Source
49
+
50
+ Retrieved from "https://www.msx.org/wiki/SPRITE$()"
@@ -0,0 +1,31 @@
1
+ # SPRITE
2
+
3
+ ## Effect
4
+
5
+ Changes the way BASIC sprite collision interrupts are handled.
6
+
7
+ ## Syntax
8
+
9
+ `SPRITE ON|OFF|STOP`
10
+
11
+ ## Parameters
12
+
13
+ This instruction is always combined with `ON SPRITE GOSUB`.
14
+
15
+ With `SPRITE ON`, the computer will check if two sprites have collided during the last screen draw and if a collision is detected the subroutine specified with `ON SPRITE GOSUB` is executed immediately.
16
+
17
+ With `SPRITE OFF`, this checking is disabled.
18
+
19
+ With `SPRITE STOP`, the checks are done, but the execution of the subroutine specified with `ON SPRITE GOSUB` will be postponed until the `SPRITE ON` instruction is executed later in the program.
20
+
21
+ ## Related to
22
+
23
+ `ON SPRITE GOSUB`, `PUT SPRITE`, `SPRITE$()`
24
+
25
+ ## Compatibility
26
+
27
+ MSX-BASIC 1.0 or higher
28
+
29
+ ## Source
30
+
31
+ Retrieved from "https://www.msx.org/wiki/SPRITE"
@@ -0,0 +1,32 @@
1
+ # SQR()
2
+
3
+ ## Effect
4
+
5
+ Returns the square root of a variable.
6
+
7
+ ## Syntax
8
+
9
+ `SQR(<Variable>)`
10
+
11
+ ## Parameter
12
+
13
+ `<Variable>` must be a numeric variable or a value between 0 and 65535.
14
+
15
+ ## Example
16
+
17
+ ```basic
18
+ 10 PRINT "The square root of 16 is ";SQR(16)
19
+ 20 PRINT "The square root of 64 is ";SQR(64)
20
+  
21
+ RUN
22
+ The square root of 16 is 4
23
+ The square root of 64 is 8
24
+ ```
25
+
26
+ ## Compatibility
27
+
28
+ MSX-BASIC 1.0 or higher
29
+
30
+ ## Source
31
+
32
+ Retrieved from "https://www.msx.org/wiki/SQR()"
@@ -0,0 +1,70 @@
1
+ # STICK()
2
+
3
+ ## Effect
4
+
5
+ Returns the direction of the cursor keys or the joysticks.
6
+
7
+ ## Syntax
8
+
9
+ `STICK(<ControllerNumber>)`
10
+
11
+ ## Parameter
12
+
13
+ `<ControllerNumber>` is a value between 0 and 2 to define the controller used.
14
+
15
+ |Controller|Description|
16
+ |---|---|
17
+ |0|Cursor keys|
18
+ |1|Joystick 1|
19
+ |2|Joystick 2|
20
+
21
+ ## Returned values
22
+
23
+ |Value|Description|
24
+ |---|---|
25
+ |0|Inactive|
26
+ |1|Up|
27
+ |2|Up + Right|
28
+ |3|Right|
29
+ |4|Down + Right|
30
+ |5|Down|
31
+ |6|Down + Left|
32
+ |7|Left|
33
+ |8|Up + Left|
34
+
35
+ ## Examples
36
+
37
+ ```basic
38
+ 10 PRINT "Press the cursor keys"
39
+ 20 PRINT STICK(0)
40
+ 30 FOR I=0 TO 300:NEXT I
41
+ 40 GOTO 20
42
+ ```
43
+
44
+ ```basic
45
+ 10 ' Move sprite to 8-directions by using cursor keys (by NYYRIKKI)
46
+ 20 FORI=2TO8:XD(I)=SGN(5-I):YD(8-I)=XD(I):NEXT: SWAP YD(0),YD(8):SCREEN2,1:SPRITE$(0)="0HH0"
47
+ 30 FORI=0TO1:S=STICK(J):I=-STRIG(J):X=X+XD(S):Y=Y+YD(S):PUTSPRITE0,(X,Y),8:NEXT
48
+ ```
49
+
50
+ ```basic
51
+ 10 ' Move sprite to 8-directions by using cursor keys
52
+ 20 SCREEN2,1: SPRITE$(0)="0HH0": FORS=1TO8: READ X(S),Y(S):NEXT
53
+ 30 S=STICK(0): Y=Y+Y(S): X=X+X(S)
54
+ 40 IF Y<0 THEN Y=0 ELSE IF Y>183 THEN Y=183
55
+ 50 IF X<0 THEN X=0 ELSE IF X>246 THEN X=246
56
+ 60 PUTSPRITE0,(X,Y),8: IF NOTSTRIG(0)GOTO30
57
+ 70 DATA 0,-2,2,-2,2,0,2,2,0,2,-2,2,-2,0,-2,-2
58
+ ```
59
+
60
+ ## Related to
61
+
62
+ `INKEY$`, `ON...GOTO`, `ON...GOSUB`, `PAD()`, `PDL()`, `STRIG()`
63
+
64
+ ## Compatibility
65
+
66
+ MSX-BASIC 1.0 or higher
67
+
68
+ ## Source
69
+
70
+ Retrieved from "https://www.msx.org/wiki/STICK()"
@@ -0,0 +1,70 @@
1
+ # STOP
2
+
3
+ ## Effect
4
+
5
+ Stops the execution of a program.
6
+
7
+ Enables/Disables/Stops calling to a subroutine by simultaneous pressing of `CTRL`+`STOP`.
8
+
9
+ ## Syntaxes
10
+
11
+ `STOP`
12
+
13
+ `STOP ON|OFF|STOP`
14
+
15
+ ## Parameters
16
+
17
+ Used without parameter, `STOP` is not required if the last line of the program has been reached by the BASIC interpreter. If this is not the case, then `STOP` is used as a break in the program and you can enter the `CONT` instruction to continue the program execution on the next line.
18
+
19
+ `STOP` used with `ON`, `OFF`, `STOP` is always combined with `ON STOP GOSUB`.
20
+
21
+ With `STOP ON`, the computer will check if the `CTRL` and `STOP` keys are pressed simultaneously and the subroutine specified with `ON STOP GOSUB` is executed immediately.
22
+
23
+ With `STOP OFF`, this checking is disabled.
24
+
25
+ With `STOP STOP`, the checking is made, but the execution of the subroutine specified with `ON STOP GOSUB` will happen only when a `STOP ON` instruction is executed later in the program.
26
+
27
+ _Remark: With `ON STOP GOSUB`, `STOP ON` and `RETURN` (see the third 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` (for example in line 20), the user will be able to re-start MSX-BASIC by pressing simultaneously `CTRL`+`SHIFT`+`GRAPH`+`CODE`/`KANA`._
28
+
29
+ ## Examples
30
+
31
+ ```basic
32
+ 10 PRINT "Test"
33
+ 20 STOP
34
+ 30 PRINT "CONT was used"
35
+ 40 END
36
+ ```
37
+
38
+ ```basic
39
+ 10 ON STOP GOSUB 100 : STOP ON
40
+ 20 CLS: PRINT "ON STOP ENABLED"
41
+ 30 FOR I = 1 TO 2000 : NEXT
42
+ 40 STOP OFF
43
+ 50 PRINT: PRINT "ON STOP DISABLED"
44
+ 60 FOR I = 1 TO 2000 : NEXT
45
+ 70 STOP ON : GOTO 20
46
+ 80 PRINT: INPUT A$
47
+ 90 IF A$="END" THEN STOP OFF:END ELSE 80
48
+ 100 PRINT "Enter END and press Return":RETURN 80
49
+ ```
50
+
51
+ ```basic
52
+ 10 ON STOP GOSUB 100 : STOP ON
53
+
54
+ 30 CLS
55
+
56
+ 90 GOTO 30
57
+ 100 RETURN
58
+ ```
59
+
60
+ ## Related to
61
+
62
+ `CONT`, `END`, `ON STOP GOSUB`, `RUN`
63
+
64
+ ## Compatibility
65
+
66
+ MSX-BASIC 1.0 or higher
67
+
68
+ ## Source
69
+
70
+ Retrieved from "https://www.msx.org/wiki/STOP"
@@ -0,0 +1,37 @@
1
+ # STR$()
2
+
3
+ ## Effect
4
+
5
+ Returns a string representation of a numeric variable.
6
+
7
+ ## Syntax
8
+
9
+ `STR$(<Value>)`
10
+
11
+ ## Parameter
12
+
13
+ `<Value>` must be an expression, a numeric variable or a value.
14
+
15
+ ## Example
16
+
17
+ ```basic
18
+ 10 A$=STR$(1.23)
19
+ 20 PRINT A$
20
+ 30 PRINT LEFT$(A$,2)
21
+  
22
+ RUN
23
+ 1.23
24
+ 1
25
+ ```
26
+
27
+ ## Related to
28
+
29
+ `VAL`
30
+
31
+ ## Compatibility
32
+
33
+ MSX-BASIC 1.0 or higher
34
+
35
+ ## Source
36
+
37
+ Retrieved from "https://www.msx.org/wiki/STR$()"