@nataliapc/mcp-openmsx 1.2.9 → 1.2.11
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.
- package/README.md +41 -2
- package/bin/win-x64/mcp-openmsx-sspi-proxy.exe +0 -0
- package/dist/chunker.js +187 -0
- package/dist/embedder.js +250 -0
- package/dist/openmsx.js +113 -248
- package/dist/openmsx_windows.js +316 -0
- package/dist/server.js +6 -1
- package/dist/server_tools.js +6 -5
- package/dist/vectordb.js +94 -35
- package/package.json +16 -18
- package/resources/audio/chipsfmpacpr1_en.md +209 -0
- package/resources/audio/chipsfmpacpr2_en.md +170 -0
- package/resources/audio/toc.json +12 -0
- package/resources/book--msx-top-secret-3/MTS3-Appendix-English-Upd2.pdf +0 -0
- package/resources/book--msx-top-secret-3/MTS3-Complete-English.pdf +0 -0
- package/resources/book--msx2-technical-handbook/toc.json +1 -1
- package/resources/book--the-msx-red-book/Chapter1_Programmable_Peripheral_Interface.md +112 -0
- package/resources/book--the-msx-red-book/Chapter2_Video_Display_Processor.md +308 -0
- package/resources/book--the-msx-red-book/Chapter3_Programmable_Sound_Generator.md +168 -0
- package/resources/book--the-msx-red-book/Chapter4_ROM_BIOS.md +2528 -0
- package/resources/book--the-msx-red-book/Chapter5_ROM_BASIC_Interpreter.md +3975 -0
- package/resources/book--the-msx-red-book/Chapter6_Memory_Map.md +1963 -0
- package/resources/book--the-msx-red-book/Chapter7_Machine_Code_Programs.md +1238 -0
- package/resources/book--the-msx-red-book/Introduction.md +104 -0
- package/resources/book--the-msx-red-book/toc.json +38 -3
- package/resources/processors/toc.json +3 -3
- package/resources/processors/z80-undocumented.md +141 -0
- package/resources/sdcc/1_Introduction.md +199 -0
- package/resources/sdcc/2_Installing_SDCC.md +533 -0
- package/resources/sdcc/3_Using_SDCC.md +1758 -0
- package/resources/sdcc/4_Notes_on_supported_Processors.md +1638 -0
- package/resources/sdcc/5_Debugging.md +210 -0
- package/resources/sdcc/6_Tips_and_Support.md +258 -0
- package/resources/sdcc/7_SDCC_Technical_Data.md +489 -0
- package/resources/sdcc/8_Compiler_internals.md +477 -0
- package/resources/sdcc/toc.json +44 -2
- package/vector-db/msxdocs.lance/_indices/4d3bd360-e3c6-408d-b0ff-a4d6bd9580cb/metadata.lance +0 -0
- package/vector-db/msxdocs.lance/_indices/4d3bd360-e3c6-408d-b0ff-a4d6bd9580cb/part_0_docs.lance +0 -0
- package/vector-db/msxdocs.lance/_indices/4d3bd360-e3c6-408d-b0ff-a4d6bd9580cb/part_0_invert.lance +0 -0
- package/vector-db/msxdocs.lance/_indices/4d3bd360-e3c6-408d-b0ff-a4d6bd9580cb/part_0_tokens.lance +0 -0
- package/vector-db/msxdocs.lance/_transactions/0-6f47c9fc-3657-40f0-9dd4-c7226b2a4805.txn +0 -0
- package/vector-db/msxdocs.lance/_transactions/1-2bb7426e-a4b0-40ea-9a58-00c4985fc6a9.txn +0 -0
- package/vector-db/msxdocs.lance/_versions/18446744073709551613.manifest +0 -0
- package/vector-db/msxdocs.lance/_versions/18446744073709551614.manifest +0 -0
- package/vector-db/msxdocs.lance/_versions/latest_version_hint.json +1 -0
- package/vector-db/msxdocs.lance/data/110001110001011010001000876c134b8296fbc47762d1e1ab.lance +0 -0
- package/resources/book--the-msx-red-book/the_msx_red_book.md +0 -10349
- package/resources/processors/z80-undocumented.tex +0 -5617
- package/resources/sdcc/lyx2md.py +0 -745
- package/resources/sdcc/sdccman.lyx +0 -81574
- package/resources/sdcc/sdccman.md +0 -5557
- package/vector-db/index.json +0 -1
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
# FM-PAC / MSX-MUSIC (Yamaha YM-2413)
|
|
2
|
+
|
|
3
|
+
In this text, only the direct programming of the MSX-MUSIC will be discussed, not the FM-BASIC possibilities, because they finally use direct control.
|
|
4
|
+
|
|
5
|
+
The MSX-MUSIC or the FM-PAC uses two I/O ports for control. Unfortunately, these registers are only used to write from the computer to the FM-PAC, so reading registers from the FM-PAC/MSX-MUSIC is not possible.
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
07Ch - Address port.
|
|
9
|
+
07Dh - Data Port.
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
To control these ports correctly in machine language, it is useful to use the following program:
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
;Reg. D contains register number for FM-PAC.
|
|
16
|
+
;Reg. E contains data for selected register.
|
|
17
|
+
|
|
18
|
+
SET_FM: LD A,D
|
|
19
|
+
OUT (07CH),A
|
|
20
|
+
LD A,E
|
|
21
|
+
OUT (07DH),A
|
|
22
|
+
EX (SP),HL ;These 2 commands only serve as a short
|
|
23
|
+
EX (SP),HL ;pause for the PAC to process the data
|
|
24
|
+
RET ;before sending new data.
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Registers
|
|
28
|
+
|
|
29
|
+
The FM-PAC contains 43 programmable registers for setting frequency, volume, instruments, drums and possibly samples. The latter is rather difficult, since the FM-PAC has no built-in hardware to play this independently like the MUSIC MODULE, a routine must be written in ML code for this, which sends the sample data in the FM-PAC via the necessary registers. so that it puts this sample on the sound output.
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
#0Fh FM.TST
|
|
33
|
+
|
|
34
|
+
7 6 5 4 3 2 1 0
|
|
35
|
+
┌───┬───┬───┬───┬───┬───┬───┬───┐
|
|
36
|
+
│ - │ - │ - │ - │SND│ - │ - │SMP│
|
|
37
|
+
└───┴───┴───┴───┴───┴───┴───┴───┘
|
|
38
|
+
|
|
39
|
+
SND - 1=Sound output of the chip is out.
|
|
40
|
+
SAMP - 1=Sample mode on, a four bit sample can be written to register
|
|
41
|
+
#10h, the 4 highest bit.
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
#10h - #18h LOWFRQ
|
|
46
|
+
|
|
47
|
+
7 6 5 4 3 2 1 0
|
|
48
|
+
┌───┬───┬───┬───┬───┬───┬───┬───┐
|
|
49
|
+
│FQ7│FQ6│FQ5│FQ4│FQ3│FQ2│FQ1│FQ0│
|
|
50
|
+
└───┴───┴───┴───┴───┴───┴───┴───┘
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
#20h - #28h SELECT
|
|
55
|
+
|
|
56
|
+
7 6 5 4 3 2 1 0
|
|
57
|
+
┌───┬───┬───┬───┬───┬───┬───┬───┐
|
|
58
|
+
│ - │ - │SUS│KEY│OC2│OC1│OC0│FQ8│
|
|
59
|
+
└───┴───┴───┴───┴───┴───┴───┴───┘
|
|
60
|
+
|
|
61
|
+
FQ 8/0 - Frequency from channel 1 to 9.
|
|
62
|
+
OC 2/0 - Octave from channel 1 to 9.
|
|
63
|
+
KEY - If a new tone has to be struck it must first be set to 0.
|
|
64
|
+
Then the new data can be loaded (Frequency, Instrument and
|
|
65
|
+
volume), then set this bit back to 1.
|
|
66
|
+
SUS - If this bit is set to 1, the tone will slowly fade after
|
|
67
|
+
the KEY bit is set to 0. If SUS is at 0, the tone will stop
|
|
68
|
+
immediately when the KEY bit is turned off.
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
#30h - #38h VOLINS
|
|
73
|
+
|
|
74
|
+
7 6 5 4 3 2 1 0
|
|
75
|
+
┌───┬───┬───┬───┬───┬───┬───┬───┐
|
|
76
|
+
│IN3│IN2│IN1│IN0│VL3│VL2│VL1│VL0│
|
|
77
|
+
└───┴───┴───┴───┴───┴───┴───┴───┘
|
|
78
|
+
|
|
79
|
+
VL 3/0 - Volume from channel 1 to 9. At binary 0000 the highest
|
|
80
|
+
volume is reached.
|
|
81
|
+
IN 3/0 - Instruments from channels 1 to 9. There are 16 instruments,
|
|
82
|
+
instrument number 0 of which can be programmed via registers
|
|
83
|
+
#00 to #07.
|
|
84
|
+
|
|
85
|
+
NR: Instrument:
|
|
86
|
+
|
|
87
|
+
00 Software Instrument
|
|
88
|
+
01 Violin
|
|
89
|
+
02 Guitar
|
|
90
|
+
03 Piano
|
|
91
|
+
04 Flute
|
|
92
|
+
05 Clarinet
|
|
93
|
+
06 Oboe
|
|
94
|
+
07 Trumpet
|
|
95
|
+
08 Organ
|
|
96
|
+
09 Tube
|
|
97
|
+
10 Synthesizer
|
|
98
|
+
11 Harpsicord
|
|
99
|
+
12 Vibraphone
|
|
100
|
+
13 Synthesizer Bass
|
|
101
|
+
14 Electric Piano 1
|
|
102
|
+
15 Electric Piano 2
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
#03h DRMSEL
|
|
107
|
+
|
|
108
|
+
7 6 5 4 3 2 1 0
|
|
109
|
+
┌───┬───┬───┬───┬───┬───┬───┬───┐
|
|
110
|
+
│ - │ - │SEL│BD │SD │TOM│CIM│HH │
|
|
111
|
+
└───┴───┴───┴───┴───┴───┴───┴───┘
|
|
112
|
+
|
|
113
|
+
SEL - If this is bit 1, channels 7 to 9 will be used for drum
|
|
114
|
+
settings, and bits 4 to 0 can be used to control a drum.
|
|
115
|
+
BD - Bass Drum :1 = Activate, if SEL is set to 1.
|
|
116
|
+
SD - Snare Drum.
|
|
117
|
+
TOM - Tom-Tom.
|
|
118
|
+
CIM - Cimbal.
|
|
119
|
+
HH - Hi Hat.
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
The Drum's frequencies and volumes are divided as follows:
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
Reg: Use:
|
|
126
|
+
#16h Frequency bit 7 to 0 for the BassDrum.
|
|
127
|
+
#17h Frequency bit 7 to 0 for the SnareDrum and the HiHat.
|
|
128
|
+
#18h Frequency bit 7 to 0 for the TomTom and the Cimbal.
|
|
129
|
+
#26h Octave bit 2 to 0 and Frequency bit 8 for BassDrum.
|
|
130
|
+
#27h Octave bit 2 to 0 and Frequency bit 8 for SnareDrum & the HiHat.
|
|
131
|
+
#28h Octave bit 2 to 0 and Frequency bit 8 for Tom-Tom & the Cimbal.
|
|
132
|
+
#36h Low nibble is volume of Bass Drum (0 is the highest volume).
|
|
133
|
+
#37h High nibble is volume from Hi Hat.
|
|
134
|
+
Low nibble is volume from Snare Drum.
|
|
135
|
+
#38h High nibble is volume from Cimbal.
|
|
136
|
+
Low nibble is volume from Tom-Tom.
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Programming the Software Instrument.
|
|
140
|
+
|
|
141
|
+
The FM contains 2 operators for each instrument. The sound is generated via the FM synthesis, which stands for Frequency Modulation. The System works the same as that of the Music-module/MSX-Audio only the maximum values will not always match, but the theory is the same.
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
#00h/01h SET.B / SET.A.
|
|
145
|
+
|
|
146
|
+
7 6 5 4 3 2 1 0
|
|
147
|
+
┌───┬───┬───┬───┬───┬───┬───┬───┐
|
|
148
|
+
│ AM│VBR│S/D│RKS│MS3│MS2│MS1│MS0│
|
|
149
|
+
└───┴───┴───┴───┴───┴───┴───┴───┘
|
|
150
|
+
|
|
151
|
+
#00h for operator B and # 01h for operator A.
|
|
152
|
+
|
|
153
|
+
AM - Amplitude Modulation.
|
|
154
|
+
VBR - Vibrato.
|
|
155
|
+
S/D - 0 = Decay; 1 = Sustain.
|
|
156
|
+
RKS - Rate Key Scale.
|
|
157
|
+
MS3/0 - Multi sample wave selection.
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
#02h KSCMOD
|
|
162
|
+
|
|
163
|
+
7 6 5 4 3 2 1 0
|
|
164
|
+
┌───┬───┬───┬───┬───┬───┬───┬───┐
|
|
165
|
+
│LK1│LK0│MD5│MD4│MD3│MD2│MD1│MD0│
|
|
166
|
+
└───┴───┴───┴───┴───┴───┴───┴───┘
|
|
167
|
+
|
|
168
|
+
LK1/0 - Level Key Scale.
|
|
169
|
+
MD5/0 - Modulation Control.
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
```
|
|
173
|
+
#03h FEED
|
|
174
|
+
|
|
175
|
+
7 6 5 4 3 2 1 0
|
|
176
|
+
┌───┬───┬───┬───┬───┬───┬───┬───┐
|
|
177
|
+
│LK1│LK0│ - │DS2│DS1│FD2│FD1│FD0│
|
|
178
|
+
└───┴───┴───┴───┴───┴───┴───┴───┘
|
|
179
|
+
|
|
180
|
+
LK1/0 - Level Key Scale.
|
|
181
|
+
DS2/1 - Distorted Wave Form.
|
|
182
|
+
FD2/0 - FM-Feedback constant.
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
```
|
|
186
|
+
#04h / #05h CTRL.B / CTRL.A
|
|
187
|
+
|
|
188
|
+
7 6 5 4 3 2 1 0
|
|
189
|
+
┌───┬───┬───┬───┬───┬───┬───┬───┐
|
|
190
|
+
│AT3│AT2│AT1│AT0│DC3│DC2│DC1│DC0│
|
|
191
|
+
└───┴───┴───┴───┴───┴───┴───┴───┘
|
|
192
|
+
|
|
193
|
+
AT3/0 - Attack envelope rate.
|
|
194
|
+
DC3/0 - Decay envelope rate.
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
```
|
|
198
|
+
#06h / #07h IND.B / IND.A
|
|
199
|
+
|
|
200
|
+
7 6 5 4 3 2 1 0
|
|
201
|
+
┌───┬───┬───┬───┬───┬───┬───┬───┐
|
|
202
|
+
│IN3│IN2│IN1│IN0│RL3│RL2│RL1│RL0│
|
|
203
|
+
└───┴───┴───┴───┴───┴───┴───┴───┘
|
|
204
|
+
|
|
205
|
+
IN3/0 - Indication Decay / Sustain level.
|
|
206
|
+
RL3/0 - Release envelope rate.
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
The FM synthesis is quite complicated, especially for the beginner it is just a matter of trying. Fortunately, there are quite a few music programs on the market that handle this themselves.
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# MSX-MUSIC REGISTERS
|
|
2
|
+
|
|
3
|
+
## WRITE ONLY
|
|
4
|
+
|
|
5
|
+
The registers of the MSX-MUSIC system, as found in: FM-Pac, FM-Stereo-Pak, MSX2+ and TurboR computers, are controlled via ports &H7C and &H7D. The control works according to the same principle as with MSX-AUDIO and the PSG. The register is specified in 7C and the data in 7D. Unfortunately, these are Write Only ports, so they cannot be read.
|
|
6
|
+
|
|
7
|
+
## SOUND SETTINGS
|
|
8
|
+
|
|
9
|
+
The OPLL data (original instrument) is specified in registers 0-7. This data corresponds to the data you can retrieve in the SynthSaurus Sound Editor, so you can easily retrieve a homemade instrument and write those values to registers 0-7.
|
|
10
|
+
|
|
11
|
+
The following is the structure of registers 0-7 (OPLL instr)
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
Reg.nr. Bit: Function:
|
|
15
|
+
------------------------------------------------------------
|
|
16
|
+
0,1 0-3 Multi sample waves/harmonic relations
|
|
17
|
+
4 Rate key scale
|
|
18
|
+
5 Latching/sprouting (1=Latch 0=Latch)
|
|
19
|
+
6 Vibration on/off (1=on 0=off)
|
|
20
|
+
7 Amplitude modulation (1=on 0=off)
|
|
21
|
+
|
|
22
|
+
2 0-5 Modulation index
|
|
23
|
+
6-7 Level key scale
|
|
24
|
+
|
|
25
|
+
3 0-2 FM recoil
|
|
26
|
+
3-4 Load-bearing and modulated waveform
|
|
27
|
+
link (FM/AM)
|
|
28
|
+
6-7 Level key scale
|
|
29
|
+
|
|
30
|
+
4,5 0-3 Decay change
|
|
31
|
+
4-7 Attack change (swelling)
|
|
32
|
+
|
|
33
|
+
6,7 0-3 Opening the change control
|
|
34
|
+
4-7 Major of Attack/Decay
|
|
35
|
+
------------------------------------------------------------
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## INSTRUMENT CONTROL
|
|
39
|
+
|
|
40
|
+
The registers printed below are for the instrument selection/frequency/octave/volume and the so-called Sustain.
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
Reg.nr. Bit: Function:
|
|
44
|
+
------------------------------------------------------------
|
|
45
|
+
&H10-&H18 0-7 Note frequency LSB (8 bits)
|
|
46
|
+
|
|
47
|
+
&H20-&H28 0 Note frequency MSB (1 bit)
|
|
48
|
+
1-3 Octave nr. (0-7, 0=octave 1, 7=octave 8)
|
|
49
|
+
4 Key on/off (1=on, 0=off)
|
|
50
|
+
5 Sustain (hold, 1=on, 0=off)
|
|
51
|
+
|
|
52
|
+
&H30-&H38 0-3 Volume (0=vol.15, F=vol.0 !)
|
|
53
|
+
4-7 Instrument select (0=original, <>0=FM
|
|
54
|
+
instrument)
|
|
55
|
+
------------------------------------------------------------
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## FM INSTRUMENTS
|
|
59
|
+
|
|
60
|
+
The MSX-MUSIC system has 15 pre-programmed instruments that can be used independently of each other.
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
0 = Original (custom instrument, see SOUND SETTINGS)
|
|
64
|
+
1 = Violin 9 = Horn
|
|
65
|
+
2 = Guitar A = Synthesizer
|
|
66
|
+
3 = Piano B = Harpsichord
|
|
67
|
+
4 = Flute C = Vibraphone
|
|
68
|
+
5 = Clarinet D = Synthesizer Bass
|
|
69
|
+
6 = Oboe E = ElectrPiano2/Acoust. Bass
|
|
70
|
+
7 = Trumpet F = ElectrPiano1/ElectrGuitar
|
|
71
|
+
8 = Organ
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## RHYTHM
|
|
75
|
+
|
|
76
|
+
Register &H0E contains the drum selection, however bit 5 must be written before a drum can be heard. The drums can also be slightly changed, but rather limited and a bit chaotic. Below is a table of the drum values that can be written in register &H0E:
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
bit 0 = HiHat bit 3 = Snare drum/Field drum
|
|
80
|
+
bit 1 = Cymbal bit 4 = Bass drum
|
|
81
|
+
bit 2 = TomTom bit 5 = selector (1 = Rhythm, 0 = Instrument)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Of course, multiple drums can be controlled simultaneously.
|
|
85
|
+
The rhythm sound is structured as follows:
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
Drum type: Reg. Bit: Function:
|
|
89
|
+
------------------------------------------------------------
|
|
90
|
+
Bass drum &H16 0-7 Frequency LSB (8 bits)
|
|
91
|
+
&H26 0 Frequency MSB (1 bit)
|
|
92
|
+
1-3 Octave (0-7)
|
|
93
|
+
&H36 0-3 Volume Bass drum
|
|
94
|
+
|
|
95
|
+
Snare & &h17 0-7 Frequency LSB (8 bits)
|
|
96
|
+
HiHat &H27 0 Frequency MSB (1 bit)
|
|
97
|
+
1-3 Octave (0-7)
|
|
98
|
+
&H37 0-3 Volume Snare
|
|
99
|
+
4-7 Volume HiHat
|
|
100
|
+
|
|
101
|
+
Cymbal & &H18 0-7 Frequency LSB (8 bits)
|
|
102
|
+
TomTom &H28 0 Frequency MSB (1 bit)
|
|
103
|
+
1-3 Octave (0-7)
|
|
104
|
+
&H38 0-3 Volume Cymbal
|
|
105
|
+
4-7 Volume TomTom
|
|
106
|
+
------------------------------------------------------------
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## BASIC REGISTERS
|
|
110
|
+
|
|
111
|
+
The registers of the MSX-MUSIC system are, under BASIC!, maintained from address &HF9C0 to &HF9C0+&H38. The settings of these registers are filled with the following values after the command CALL MUSIC:
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
Reg.nr. Value:
|
|
115
|
+
------------------------------------------------------------
|
|
116
|
+
Register pair 1: Instruments &H10-&H15 &H56
|
|
117
|
+
Drums &H16 &H20
|
|
118
|
+
&H17 &H50
|
|
119
|
+
&H18 &HC0
|
|
120
|
+
|
|
121
|
+
Register pair 2: Instruments &H20-&H25 &H00
|
|
122
|
+
Drums &H26 &H05
|
|
123
|
+
&H27 &H05
|
|
124
|
+
&H28 &H01
|
|
125
|
+
|
|
126
|
+
Register pair 3: Instruments &H30-&H35 &H30
|
|
127
|
+
Drums &H36 &H01
|
|
128
|
+
&H37 &H11
|
|
129
|
+
&H38 &H11
|
|
130
|
+
------------------------------------------------------------
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## USAGE
|
|
134
|
+
|
|
135
|
+
When using this information in, for example, an interrupt-driven music piece, you must take the following things into account.
|
|
136
|
+
|
|
137
|
+
1) When a new frequency is specified for an instrument, bit 4 of the corresponding register must first be switched off. To clarify: if a new frequency needs to be entered in channel 1, bit 4 of register &H10 must be cleared. After that the frequency is written, and finally bit 4 is set again (reg. &H10). For other channels a different register is used accordingly.
|
|
138
|
+
|
|
139
|
+
2) When an instrument is played that 'fades out' (Release), a short delay is needed in machine code:
|
|
140
|
+
|
|
141
|
+
```z80
|
|
142
|
+
LD B,3 ;approximately 3!
|
|
143
|
+
LOOP: DJNZ LOOP
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
3) The note frequencies are:
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
Note: LSB MSB (bit 0 of reg &H20-&H28)
|
|
150
|
+
---------------------------------------------------------
|
|
151
|
+
C &HAD 0
|
|
152
|
+
C# &HB7 0
|
|
153
|
+
D &HC2 0
|
|
154
|
+
D# &HCD 0
|
|
155
|
+
E &HD9 0
|
|
156
|
+
F &HE6 0
|
|
157
|
+
F# &HF4 0
|
|
158
|
+
G &H03 1
|
|
159
|
+
G# &H12 1
|
|
160
|
+
A &H22 1
|
|
161
|
+
A# &H34 1
|
|
162
|
+
B &H46 1
|
|
163
|
+
---------------------------------------------------------
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
With this information you should now be able to control the MSX-MUSIC system through these registers. Good luck!
|
|
167
|
+
|
|
168
|
+
by R.M.
|
|
169
|
+
|
|
170
|
+
(Just to be clear: I don't know who R.M. is, but it's not me! - RM-FCS)
|
package/resources/audio/toc.json
CHANGED
|
@@ -8,6 +8,18 @@
|
|
|
8
8
|
"external_url": "https://www.msx.org/wiki/PSG_Registers",
|
|
9
9
|
"description": "Complete reference for MSX PSG (Programmable Sound Generator) registers covering all 16 registers including frequency control, white noise control, voice and I/O port control, amplitude and volume control, envelope form and period control, and I/O parallel port registers. Includes BIOS routines WRTPSG, RDPSG, and GICINI for PSG access and initialization."
|
|
10
10
|
},
|
|
11
|
+
{
|
|
12
|
+
"title": "FM-PAC / MSX-MUSIC (Yamaha YM-2413)",
|
|
13
|
+
"uri": "msxdocs://audio/chipsfmpacpr1_en",
|
|
14
|
+
"external_url": "https://gitlab.com/moltsxalats/learning-fusion-c-programs/-/raw/9e9c4a754657db095a39cfdfc5659756cc8797e3/chipsfmpacpr1_en.txt",
|
|
15
|
+
"description": "Direct programming guide for the Yamaha YM-2413 (FM-PAC/MSX-MUSIC) chip via I/O ports 07Ch/07Dh. Covers all 43 write-only registers including frequency, octave, key control, volume, instrument selection, drum channels, and software instrument programming via FM synthesis operators."
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"title": "MSX-MUSIC Registers",
|
|
19
|
+
"uri": "msxdocs://audio/chipsfmpacpr2_en",
|
|
20
|
+
"external_url": "https://gitlab.com/moltsxalats/learning-fusion-c-programs/-/raw/9e9c4a754657db095a39cfdfc5659756cc8797e3/chipsfmpacpr2_en.txt",
|
|
21
|
+
"description": "Register reference for the MSX-MUSIC OPLL chip (FM-PAC, FM-Stereo-Pak, MSX2+, TurboR) accessed via write-only ports &H7C/&H7D. Details OPLL custom instrument registers 0–7, instrument/frequency/octave/volume control registers, 15 preset FM instruments, rhythm/drum register layout, BASIC register defaults, and note frequency tables."
|
|
22
|
+
},
|
|
11
23
|
{
|
|
12
24
|
"title": "Konami SCC Sound Chip",
|
|
13
25
|
"uri": "msxdocs://audio/sound_cartridge_scc",
|
|
Binary file
|
|
Binary file
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
},
|
|
76
76
|
{
|
|
77
77
|
"title": "MSX Kun Basic compiler",
|
|
78
|
-
"uri": "msxdocs://book--msx2-technical-handbook/MSX_Kun_BASIC_Compiler
|
|
78
|
+
"uri": "msxdocs://book--msx2-technical-handbook/MSX_Kun_BASIC_Compiler",
|
|
79
79
|
"description": "The document describes MSX-BASIC-KUN, a BASIC compiler for MSX computers that significantly accelerates program execution (15 to 100 times faster). It compiles most MSX-BASIC statements, supports strings and floating-point numbers, and introduces turbo blocks (_TURBO ON/OFF) for selective compilation. The compiler has limitations, such as unsupported commands (e.g., BLOAD, PRINT#) and restrictions on variable handling within turbo blocks. It adds new features like inline assembly (#I), clipping control (#C), and overflow checks (#N). The compiler operates within RAM and cannot save compiled programs independently. It is ideal for creating high-performance MSX applications without requiring Z80 assembly language expertise."
|
|
80
80
|
}
|
|
81
81
|
]
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# 1. Programmable Peripheral Interface
|
|
2
|
+
|
|
3
|
+
The 8255 PPI is a general purpose parallel interface device configured as three eight bit data ports, called A, B and C, and a mode port. It appears to the Z80 as four I/O ports through which the keyboard, the memory switching hardware, the cassette motor, the cassette output, the Caps Lock LED and the Key Click audio output can be controlled. Once the PPI has been initialized access to a particular piece of hardware just involves writing to or reading the relevant I/O port.
|
|
4
|
+
|
|
5
|
+
## PPI Port A (I/O Port A8H)
|
|
6
|
+
|
|
7
|
+
|7 + 6|5 + 4|3 + 2|1 + 0|
|
|
8
|
+
|:-:|:-:|:-:|:-:|
|
|
9
|
+
| Page 3<br/>PSLOT#<br/>C000-FFFF | Page 1<br/>PSLOT#<br/>8000-BFFF | Page 2<br/>PSLOT#<br/>4000-7FFF | Page 0<br/>PSLOT#<br/>0000-3FFF |
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
**Figure 1:** Primary Slot Register
|
|
13
|
+
|
|
14
|
+
This output port, known as the Primary Slot Register in MSX terminology, is used to control the memory switching hardware. The Z80 Microprocessor can only access 64 KB of memory directly. This limitation is currently regarded as too restrictive and several of the newer personal computers employ methods to overcome it.
|
|
15
|
+
|
|
16
|
+
MSX machines can have multiple memory devices at the same address and the Z80 may switch in any one of them as required. The processor address space is regarded as being duplicated "sideways" into four separate 64 KB areas, called Primary Slots 0 to 3, each of which receives its own slot select signal alongside the normal Z80 bus signals. The contents of the Primary Slot Register determine which slot select signal is active and therefore which Primary Slot is selected.
|
|
17
|
+
|
|
18
|
+
To increase flexibility each 16 KB "page" of the Z80 address space may be selected from a different Primary Slot. As shown in [Figure 1](#figure1) two bits of the Primary Slot Register are required to define the Primary Slot number for each page.
|
|
19
|
+
|
|
20
|
+
The first operation performed by the MSX ROM at power-up is to search through each slot for RAM in pages 2 and 3 (8000H to FFFFH). The Primary Slot Register is then set so that the relevant slots are selected thus making the RAM permanently available. The memory configuration of any MSX machine can be determined by displaying the Primary Slot Register setting with the BASIC statement:
|
|
21
|
+
|
|
22
|
+
`PRINT RIGHT$("0000000"+BIN$(INP(&HA8)),8)`
|
|
23
|
+
|
|
24
|
+
As an example "10100000" would be produced on a Toshiba HX10 where pages 3 and 2 (the RAM) both come from Primary Slot 2 and pages 1 and 0 (the MSX ROM) from Primary Slot 0. The MSX ROM must always be placed in Primary Slot 0 by a manufacturer as this is the slot selected by the hardware at power-up. Other memory devices, RAM and any additional ROM, may be placed in any slot by a manufacturer.
|
|
25
|
+
|
|
26
|
+
A typical UK machine will have one Primary Slot containing the MSX ROM, one containing 64 KB of RAM and two slots brought out to external connectors. Most Japanese machines have a cartridge type connector on each of these external slots but UK machines usually have one cartridge connector and one IDC connector.
|
|
27
|
+
|
|
28
|
+
## Expanders
|
|
29
|
+
|
|
30
|
+
System memory can be increased to a theoretical maximum of sixteen 64 KB areas by using expander interfaces. An expander plugs into any Primary Slot to provide four 64 KB Secondary Slots, numbered 0 to 3, instead of one primary one. Each expander has its own local hardware, called a Secondary Slot Register, to select which of the Secondary Slots should appear in the Primary Slot. As before pages can be selected from different Secondary Slots.
|
|
31
|
+
|
|
32
|
+
|7 + 6|5 + 4|3 + 2|1 + 0|
|
|
33
|
+
|:-:|:-:|:-:|:-:|
|
|
34
|
+
| Page 3<br/>SSLOT# | Page 1<br/>SSLOT# | Page 2<br/>SSLOT# | Page 0<br/>SSLOT# |
|
|
35
|
+
|
|
36
|
+
**Figure 2:** Secondary Slot Register
|
|
37
|
+
|
|
38
|
+
Each Secondary Slot Register, while actually being an eight bit read/write latch, is made to appear as memory location FFFFH of its Primary Slot by the expander hardware. In order to gain access to this location on a particular expander it will usually be necessary to first switch page 3 (C000H to FFFFH) of that Primary Slot into the processor address space. The Secondary Slot Register can then be modified and, if necessary, page 3 restored to its original Primary Slot setting. Accessing memory in expanders can become rather a convoluted process.
|
|
39
|
+
|
|
40
|
+
It is apparent that there must be some way of determining whether a Primary Slot contains ordinary RAM or an expander in order to access it properly. To achieve this the Secondary Slot Registers are designed to invert their contents when read back. During the power-up RAM search memory location FFFFH of each Primary Slot is examined to determine whether it behaves normally or whether the slot contains an expander. The results of these tests are stored in the Workspace Area system resource map [EXPTBL](#exptbl) for later use. This is done at power-up because of the difficulty in performing tests when the Secondary Slot Registers actually contain live settings.
|
|
41
|
+
|
|
42
|
+
Memory switching is obviously an area demanding extra caution, particularly with the hierarchical mechanisms needed to control expanders. Care must be taken to avoid switching out the page in which a program is running or, if it is being used, the page containing the stack. There are a number of standard routines available to the machine code programmer in the BIOS section of the MSX ROM to simplify the process.
|
|
43
|
+
|
|
44
|
+
The BASIC Interpreter itself has four methods of accessing extension ROMs. The first three of these are for use with machine code ROMs placed in page 1 (4000H to 7FFFH), they are:
|
|
45
|
+
|
|
46
|
+
1. Hooks ([Chapter 6](chapter_6)).
|
|
47
|
+
2. The "`CALL`" statement ([Chapter 5](#chapter_5)).
|
|
48
|
+
3. Additional device names ([Chapter 5](#chapter_5)).
|
|
49
|
+
|
|
50
|
+
The BASIC Interpreter can also execute a BASIC program ROM detected in page 2 (8000H to BFFFH) during the power-up ROM search. What the BASIC Interpreter cannot do is use any RAM hidden behind other memory devices. This limitation is a reflection of the difficulty in converting an established program to take advantage of newer, more complex machines. A similar situation exists with the version of Microsoft BASIC available on the IBM PC. Out of a 1 MB memory space only 64 KB can be used for program storage.
|
|
51
|
+
|
|
52
|
+
## PPI Port B (I/O Port A9H)
|
|
53
|
+
|
|
54
|
+
|7 + 6 + 5 + 4 + 3 + 2 + 1 + 0|
|
|
55
|
+
|:-:|
|
|
56
|
+
| Keyboard Column Select |
|
|
57
|
+
|
|
58
|
+
**Figure 3**
|
|
59
|
+
|
|
60
|
+
This input port is used to read the eight bits of column data from the currently selected row of the keyboard. The MSX keyboard is a software scanned eleven row by eight column matrix of normally open switches. Current machines usually only have keys in rows zero to eight. Conversion of key depressions into character codes is performed by the MSX ROM interrupt handler, this process is described in [Chapter 4](chapter_4).
|
|
61
|
+
|
|
62
|
+
## PPI Port C (I/O Port AAH)
|
|
63
|
+
|
|
64
|
+
|7|6|5|4|3 + 2 + 1 + 0|
|
|
65
|
+
|:-:|:-:|:-:|:-:|:-:|
|
|
66
|
+
| Key Click | Cap LED | Cas Out | Cas Motor | Keyboard Row Select |
|
|
67
|
+
|
|
68
|
+
**Figure 4**
|
|
69
|
+
|
|
70
|
+
This output port controls a variety of functions. The four Keyboard Row Select bits select which of the eleven keyboard rows, numbered from 0 to 10, is to be read in by PPI Port B.
|
|
71
|
+
|
|
72
|
+
The Cas Motor bit determines the state of the cassette motor relay: 0=On, 1=Off.
|
|
73
|
+
|
|
74
|
+
The Cas Out bit is filtered and attenuated before being taken to the cassette DIN socket as the MIC signal. All cassette tone generation is performed by software.
|
|
75
|
+
|
|
76
|
+
The Cap LED bit determines the state of the Caps Lock LED: 0=On, 1=Off.
|
|
77
|
+
|
|
78
|
+
The Key Click output is attenuated and mixed with the audio output from the Programmable Sound Generator. To actually generate a sound this bit should be flipped on and off.
|
|
79
|
+
|
|
80
|
+
Note that there are standard routines in the ROM BIOS to access all of the functions available with this port. These should be used in preference to direct manipulation of the hardware if at all possible.
|
|
81
|
+
|
|
82
|
+
## PPI Mode Port (I/O Port ABH)
|
|
83
|
+
|
|
84
|
+
|7|6 + 5|4|3|2|1|0|
|
|
85
|
+
|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
|
|
86
|
+
| 1 | A&C Mode | A Dir | C Dir | B&C Mode | B Dir | C Dir |
|
|
87
|
+
|
|
88
|
+
**Figure 5:** PPI Mode Selection
|
|
89
|
+
|
|
90
|
+
This port is used to set the operating mode of the PPI. As the MSX hardware is designed to work in one particular configuration only this port should not be modified under any circumstances. Details are given for completeness only.
|
|
91
|
+
|
|
92
|
+
Bit 7 must be 1 in order to alter the PPI mode, when it is 0 the PPI performs the single bit set/reset function shown in [Figure 6](#figure6).
|
|
93
|
+
|
|
94
|
+
The A&C Mode bits determine the operating mode of Port A and the upper four bits only of Port C: 00=Normal Mode (MSX), 01=Strobed Mode, 10=Bidirectional Mode
|
|
95
|
+
|
|
96
|
+
The A Dir mode determines the direction of Port A: 0=Output (MSX), 1=Input.
|
|
97
|
+
|
|
98
|
+
The C Dir bit determines the direction of the upper four bits only of Port C: 0=Output (MSX), 1=Input.
|
|
99
|
+
|
|
100
|
+
The B&C Mode bits determine the operating mode of Port B and the lower four bits only of Port C: 0=Normal Mode (MSX), 1=Strobed Mode.
|
|
101
|
+
|
|
102
|
+
The B Dir bit determines the direction of Port B: 0=Output, 1=Input (MSX).
|
|
103
|
+
|
|
104
|
+
The C Dir bit determines the direction of the lower four bits only of Port C: 0=Output (MSX), 1=Input
|
|
105
|
+
|
|
106
|
+
|7|6 + 5 + 4|3 + 2 + 1|0|
|
|
107
|
+
|:-:|:-:|:-:|:-:|
|
|
108
|
+
| 0 | Not used | Not used | Set |
|
|
109
|
+
|
|
110
|
+
**Figure 6:** PPI Bit Set/Reset
|
|
111
|
+
|
|
112
|
+
The PPI Mode Port can be used to directly set or reset any bit of Port C when bit 7 is 0. The Bit Number, from 0 to 7, determines which bit is to be affected. Its new value is determined by the Set/Reset bit: 0=Reset, 1=Set. The advantage of this mode is that a single output can be easily modified. As an example the Caps Lock LED may be turned on with the BASIC statement `OUT &HAB,12` and off with the statement `OUT &HAB,13`.
|