rev: 36672d96716a39021e03f5e2f3a5e14be5b7d004 map/resources/msx_io_ports.php -rw-r--r-- 35.8 KiB View raw Log this file
36672d96716aLaurens Holst msx_io_ports: Add MIDI-PAC. 5 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
<?php include $_SERVER['DOCUMENT_ROOT'].'/scripts/functions.php'; addHTTPHeader(); ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
  <title>MSX I/O ports overview</title>
  <?php addStyles(); ?>
</head>
<body>
<?php addHeader(); ?>



<h1>MSX I/O ports overview</h1>

<p>Here’s an overview of I/O ports on the MSX. Some entries will link to a
description on how to use those ports.</p>

<p><em>Note that this list, though comprehensive, is most certainly incomplete.
If you have additions or see an error, please let us know.</em></p>

<table>
<tr>
<th>Port range</th>
<th>Description</th>
</tr>
<tr>
  <td>#00-#01</td>
  <td>Music Module MIDI, output ports (mirrored on ports #08-#09, #10-#11, #18-#19)</td>
</tr>
<tr>
  <td>#00-#01</td>
  <td>Sensor Kid</td>
</tr>
<tr>
  <td>#00-#03</td>
  <td><a href="/resources/midi/jvc-midi.php">JVC MSX MIDI interface</a> (MC6850, mirrored on ports #08-#0B)</td>
</tr>
<tr>
  <td>#02-#03</td>
  <td>FAC MIDI interface (i8251, mirrored on ports #00-#07)</td>
</tr>
<tr>
  <td>#04-#05</td>
  <td>Music Module MIDI, input ports (mirrored on ports #0C-#0D, #14-#15, #1C-#1D)</td>
</tr>
<tr>
  <td>#0A</td>
  <td>Music Module DAC (enable with Y8950 IO0) (mirrored on ports #08-#0F, #18-#1F)</td>
</tr>
<tr>
  <td>#0F</td>
  <td><a href="#zemina-memory">Zemina memory extensions</a></td>
</tr>
<tr>
  <td>#10-#12</td>
  <td>Second AY-3-8910 PSG: MegaFlashROM SCC+ (write-only), Manbow 2 v2, Best of Hamaraja Night</td>
</tr>
<tr>
  <td>#14-#17</td>
  <td>YM2608 OPNA cartridge (in development)</td>
</tr>
<tr>
  <td>#18-#19</td>
  <td>Philips Barcode Reader NMS1170/20</td>
</tr>
<tr>
  <td>#20-#28</td>
  <td>Philips NMS1251 modem second setting</td>
</tr>
<tr>
  <td>#20-#28</td>
  <td>Miniware M4000 modem second setting</td>
</tr>
<tr>
  <td>#21-#27</td>
  <td><a href="/resources/sound/mp3player.pdf">Sunrise MP3 Player</a></td>
</tr>
<tr>
  <td>#27-#2F</td>
  <td><a href="/resources/serial/philips_nms1210.pdf">Philips NMS1210/1211/1212 RS232 Serial Interface</a> second setting (hardware switch)</td>
</tr>
<tr>
  <td>#27-#2F</td>
  <td>Philips NMS1255 MSX interface/modem second setting (hardware switch) (see <a href="/resources/serial/philips_nms1210.pdf">NMS121x</a>)</td>
</tr>
<tr>
  <td>#28-#29</td>
  <td>DenYoNet Ethernet Interface, mapper / status</td>
</tr>
<tr>
  <td>#2A-#2B</td>
  <td>PlaySoniq SID chip / settings</td>
</tr>
<tr>
  <td>#2C</td>
  <td>PlaySoniq 8-bit DAC</td>
</tr>
<tr>
  <td>#2D</td>
  <td>PlaySoniq joypad / temporary data</td>
</tr>
<tr>
  <td>#2E-#2F</td>
  <td>openMSX debug device (default address)</td>
</tr>
<tr>
  <td>#30-#38</td>
  <td>Philips NMS1251 modem</td>
</tr>
<tr>
  <td>#30-#38</td>
  <td>Miniware M4000 modem</td>
</tr>
<tr>
  <td>#30-#38</td>
  <td>GREEN/MAK SCSI-interface</td>
</tr>
<tr>
  <td>#30-#38</td>
  <td>CD-ROM interface</td>
</tr>
<tr>
  <td>#37-#3F</td>
  <td><a href="/resources/serial/philips_nms1210.pdf">Philips NMS1210/1211/1212 RS232 Serial Interface</a></td>
</tr>
<tr>
  <td>#37-#3F</td>
  <td>Philips NMS1255 MSX interface/modem (see <a href="/resources/serial/philips_nms1210.pdf">NMS121x</a>)</td>
</tr>
<tr>
  <td>#3C</td>
  <td>Musical Memory Mapper control</td>
</tr>
<tr>
  <td>#3F</td>
  <td>Musical Memory Mapper SN76489 DCSG (when enabled)</td>
</tr>
<tr>
  <td>#40-#4F</td>
  <td><a href="#expanded_io">Expanded I/O ports</a> (a.k.a. switched I/O)</td>
</tr>
<tr>
  <td>#48-#49</td>
  <td>Franky SN76489 DCSG / VDP H/V counters</td>
</tr>
<tr>
  <td>#56-#5D</td>
  <td><a href="#msxpi">MSXPi interface</a></td>
</tr>
<tr>
  <td>#5C-#5D</td>
  <td>PAC-V mirror</td>
</tr>
<tr>
  <td>#5E-#5F</td>
  <td><a href="/resources/#gr8net">GR8NET Ethernet Interface</a></td>
</tr>
<tr>
  <td>#60-#6F</td>
  <td><a href="#gfx9000">Graphics9000 / V9990</a></td>
</tr>
<tr>
  <td>#70-#73</td>
  <td>MIDI Saurus</td>
</tr>
<tr>
  <td>#7C-#7D</td>
  <td>MSX-MUSIC / FM-PAC / OPLL</td>
</tr>
<tr>
  <td>#7C-#7D</td>
  <td><a href="#midipac">MIDI-PAC</a></td>
</tr>
<tr>
  <td>#7C-#7D</td>
  <td>PAC-V</td>
</tr>
<tr>
  <td>#7E-#7F</td>
  <td>MSX 2 key cartridge <em>(what is it?)</em></td>
</tr>
<tr>
  <td>#7E-#7F</td>
  <td>MoonSound / OPL4 - Wave</td>
</tr>
<tr>
  <td>#80-#83</td>
  <td><a href="#rs232">RS232C UART / 8251</a> <em>(Spectravideo, and Sony (if
      enabled))</em></td>
</tr>
<tr>
  <td>#84-#87</td>
  <td><a href="#rs232">RS232C programmable timer / 8253</a> <em>(Spectravideo,
      and Sony (if enabled))</em></td>
</tr>
<tr>
  <td>#88-#8B</td>
  <td>Alternate VDP v9938 ports for MSX1 to MSX2 adapter</td>
</tr>
<tr>
  <td>#88-#89</td>
  <td>Franky VDP (315-5124 / 315-5246)</td>
</tr>
<tr>
  <td>#8C-#8D</td>
  <td>Sony MSX Modem <em>(HBI-1200?)</em></td>
</tr>
<tr>
  <td>#8E-#8F</td>
  <td>MegaRAM / MegaRAM Disk</td>
</tr>
<tr>
  <td>#90-#91</td>
  <td>Printer port interface</td>
</tr>
<tr>
  <td>#93</td>
  <td>Printer port bus direction <em>(does it exist?)</em></td>
</tr>
<tr>
  <td>#98-#9B</td>
  <td><a href="#vdp">VDP / Video Display Processor / TMS9918A / V9938 /
      V9958</a></td>
</tr>
<tr>
  <td>#A0-#A3</td>
  <td><a href="#psg">PSG / AY-3-8910 / YM2149</a><br />
      <a href="#psgioports">PSG GPIO ports A &amp; B</a></td>
</tr>
<tr>
  <td>#A0-#A1</td>
  <td><a href="#midipac">MIDI-PAC2</a></td>
</tr>
<tr>
  <td>#A4-#A5</td>
  <td>PCM controller (turboR)</td>
</tr>
<tr>
  <td>#A7</td>
  <td><a href="#pausetr">Pause / R800 info</a> (turboR)</td>
</tr>
<tr>
  <td>#A8-#AB</td>
  <td><a href="#ppi">PPI / Programmable Peripheral Interface / 8255</a></td>
</tr>
<tr>
  <td>#AC-#AF</td>
  <td><a href="/resources/#msxengine">MSX-ENGINE</a> (1-chip MSX I/O)</td>
</tr>
<tr>
  <td>#B0-#B3</td>
  <td><a href="/resources/hbi55.php">Sony HBI-55 Data Cartridge / Yamaha UDC-01
      Data Memory</a> (4kB SRAM) (8255 i/f)</td>
</tr>
<tr>
  <td>#B4-#B5</td>
  <td>Clock chip / RP-5C01</td>
</tr>
<tr>
  <td>#B6</td>
  <td>CIEL ExpertTurbo / Expert3 turbo switch (bit 7: 1 = turbo on)</td>
</tr>
<tr>
  <td>#B8-#BB</td>
  <td>Card Reader <em>(which?)</em></td>
</tr>
<tr>
  <td>#B8-#BB</td>
  <td>Sanyo lightpen interface</td>
</tr>
<tr>
  <td>#BC-#BF</td>
  <td>JVC VHD video controller (8255 i/f)</td>
</tr>
<tr>
  <td>#C0-#C1</td>
  <td>MSX-AUDIO / Music Module</td>
</tr>
<tr>
  <td>#C0-#C3</td>
  <td>MoonSound / OPL4 - FM alternate addressing mode</td>
</tr>
<tr>
  <td>#C2-#C3</td>
  <td>MSX-AUDIO / Music Module - 2nd cartridge</td>
</tr>
<tr>
  <td>#C4-#C7</td>
  <td>MoonSound / OPL4 - FM</td>
</tr>
<tr>
  <td>#C8-#CF</td>
  <td>MSX INTERFACE (asynchronous serial communication interface)</td>
</tr>
<tr>
  <td>#D0-#D7</td>
  <td><a href="/resources/#diskcontrollers">FDC / Floppy Disk Controller</a>
      (WD2793 Microsol)</td>
</tr>
<tr>
  <td>#D8-#D9</td>
  <td>Kanji ROM, JIS 1</td>
</tr>
<tr>
  <td>#DA-#DB</td>
  <td>Kanji ROM, JIS 2</td>
</tr>
<tr>
  <td>#DC-#DD</td>
  <td>Kanji ROM, 24-dots</td>
</tr>
<tr>
  <td>#E0-#E2</td>
  <td>External MSX-MIDI interface (µ·pack)</td>
</tr>
<tr>
  <td>#E4-#E7</td>
  <td><a href="#s1990">S1990 controller</a> (turboR)</td>
</tr>
<tr>
  <td>#E8-#EF</td>
  <td>Internal MSX-MIDI interface (turboR GT)</td>
</tr>
<tr>
  <td>#F3</td>
  <td><a href="#vdpdisplaymode">VDP display mode</a> (MSX2+)</td>
</tr>
<tr>
  <td>#F4</td>
  <td><a href="#sysflags">System flags</a></td>
</tr>
<tr>
  <td>#F5</td>
  <td><a href="#systemcontrol">System control</a></td>
</tr>
<tr>
  <td>#F6</td>
  <td>Color bus I/O</td>
</tr>
<tr>
  <td>#F7</td>
  <td><a href="#avcontrol">A/V control</a></td>
</tr>
<tr>
  <td>#F8</td>
  <td>Optional A/V control for PAL version</td>
</tr>
<tr>
  <td>#F8-#FB</td>
  <td>Memory Mapper segment selection MSB in 16-bit mappers
      (PlaySoniq, disabled by default)</td>
</tr>
<tr>
  <td>#FC-#FF</td>
  <td><a href="#mmapper">Memory Mapper registers</a></td>
</tr>
</table>

<p>Here are also some memory-mapped I/O areas:</p>

<table>
<tr>
  <th>Address Range</th>
  <th>Description</th>
</tr>
<tr>
  <td>#7FC0-#7FCF</td>
  <td><a href="#a1fm-modem">Panasonic FS-A1FM Modem ROM</a></td>
</tr>
<tr>
  <td>#FFFF</td>
  <td><a href="#subslot">Secondary slot select register</a></td>
</tr>
</table>


<p><i>Information collected from various sources. Special thanks go to Alex
Wulms for the nice overview published in MCCM 75.</i></p>


<h2 id="zemina-memory">Zemina memory extensions</h2>

<p>Port #0F is used for the Zemina Golden Box (ZMB-1024, 1Mbit / 128K), Black
Box (1Mbit / 128K), Deluxe Box (ZMB-2048, 2Mbit / 256K) and Deluxe IV (4Mbit /
512K) memory extensions.</p>

<p>It uses I/O port #0F for device settings, and address #4000 for page select
if the device is in RAM SELECT mode.</p>

<table>
<tr>
  <th>Port</th>
  <th>Description</th>
</tr>
<tr>
  <td rowspan="2">#0F</td>
  <td>Page size select<br />
      bit 7, 6: 8K (1, 0) or 16K (0, 1)</td>
</tr>
<tr>
  <td>Function of writing to address range #4000-#BFFF<br />
      bit 5, 4: RAM SELECT (1, 0) or WRITE (0, 1)</td>
</tr>
</table>

<p>For a 128K extension, with a page size of 8K there are 16 pages, with a page
size of 16K there are 8 pages.</p>

<p>Following are some examples, that assume the Zemina memory extension slot is
selected for address range #4000-#7FFF.</p>

<p>To switch RAM page 5 to address #4000-#5FFF (8K page size):</p>

<pre>    ld a,10100000B
    out (0FH),a
    ld a,5
    ld (4000H),a
</pre>

<p>To copy the contents of the MSX main RAM address range #A000-#BFFF to RAM
page 3 (8K page size):</p>

<pre>    ld a,10100000B
    out (0FH),a
    ld a,3
    ld (4000H),a
    ld a,10010000B
    out (0FH),a
    ld hl,0A000H
    ld de,4000H
    ld bc,2000H
    ldir
</pre>

<p>See the <a href="http://www.hqunix.com/wordpress/?page_id=554">scanned
manual</a> with partial translation for more info.</p>


<h2 id="expanded_io">Expanded I/O ports <span id="switch_io">(a.k.a. switched I/O)</span></h2>

<p>According to the MSX2 Hardware Specification, ports #40-#4F are forming the
so-called ‘expanded I/O ports’. With these the limitation of a maximum number of
256 I/O ports can be overcome, although it does require some additional logic on
the hardware’s behalf. The port numbers #41-#4F are the actual switched ports,
and the device addressed via those ports is determined by the device ID written
to port #40. When port #40 is read the currently selected device returns the
complement of the current device ID, if present.</p>

<table>
<tr>
  <th>Port range</th>
  <th>Description</th>
</tr>
<tr>
  <td>#40</td>
  <td>Device ID register</td>
</tr>
<tr>
  <td>#41-#4F</td>
  <td>Switched I/O ports</td>
</tr>
</table>

<p>ID numbers between 1 and 127 are manufacturer ID numbers, and ID numbers 128
to 254 are device IDs. Built-in devices should use the manufacturer’s company
ID, while periperhal devices which can be used on all MSX computers should use a
device ID number.</p>

<p>As the Z80 has a 16-bit I/O addressing space, for those IDs which might be
expanded in the future, it is recommended to use 16-bit access by decoding the
upper 8 bits. Particularly for devices connected by manufacturer ID, with 16-bit
access the address space for each ID can be expanded 256 times, which will help
to support future expansion.</p>

<p>List of BIOS extension device ID’s:</p>
<table>
<tr><th>ID</th><th>Maker/device</th></tr>
<tr><td>1</td><td>ASCII/Microsoft</td></tr>
<tr><td>2</td><td>Canon</td></tr>
<tr><td>3</td><td>Casio</td></tr>
<tr><td>4</td><td>Fujitsu</td></tr>
<tr><td>5</td><td>General</td></tr>
<tr><td>6</td><td>Hitachi</td></tr>
<tr><td>7</td><td>Kyocera</td></tr>
<tr><td>8</td><td>Matsushita (Panasonic)</td></tr>
<tr><td>9</td><td>Mitsubishi</td></tr>
<tr><td>10</td><td>NEC</td></tr>
<tr><td>11</td><td>Nippon Gakki (Yamaha)</td></tr>
<tr><td>12</td><td>JVC</td></tr>
<tr><td>13</td><td>Philips</td></tr>
<tr><td>14</td><td>Pioneer</td></tr>
<tr><td>15</td><td>Sanyo</td></tr>
<tr><td>16</td><td>Sharp</td></tr>
<tr><td>17</td><td>SONY</td></tr>
<tr><td>18</td><td>Spectravideo</td></tr>
<tr><td>19</td><td>Toshiba</td></tr>
<tr><td>20</td><td>Mitsumi</td></tr>
<tr><td>21</td><td>Telematica</td></tr>
<tr><td>22</td><td>Gradiente</td></tr>
<tr><td>23</td><td>Sharp Brazil</td></tr>
<tr><td>24</td><td>GoldStar (LG)</td></tr>
<tr><td>25</td><td>Daewoo</td></tr>
<tr><td>26</td><td>Samsung</td></tr>
<tr><td>128</td><td>Image Scanner (Matsushita)</td></tr>
<tr><td>165</td><td>WORP3</td></tr>
<tr><td>170</td><td>Darky (SuperSoniqs)</td></tr>
<tr><td>171</td><td>Darky (SuperSoniqs) second setting</td></tr>
<tr><td>212</td><td>1chipMSX / Zemmix Neo (KdL firmware)</td></tr>
<tr><td>254</td><td>MPS2 (ASCII)</td></tr>
</table>

<p>Some example code, this enables the 6MHz mode on Panasonic FS-A1WX/WSX/FX
computers:</p>

<table>
<tr><th>Port</th><th>Panasonic extensions</th></tr>
<tr>
  <td>#40</td>
  <td>= 8 (Panasonic manufacturer ID)</td>
</tr>
<tr>
  <td>#41</td>
  <td><i>Available on FS-A1FX/WX/WSX only:</i><br />
      bit 0: CPU speed mode (0=5.37MHz, 1=3.57MHz)<br />
      bit 7: Firmware switch status (0=on, 1=off) <em>(read-only)</em></td>
</tr>
</table>


<pre>    in a,(40H)
    cpl
    push af
    ld a,8
    out (40H),a  ;out the manufacturer code 8 (Panasonic) to I/O port 40h
    in a,(40H)   ;read the value you have just written
    cpl          ;complement all bits of the value
    cp 8         ;if it does not match the value you originally wrote,
    jr nz,NotWX  ;it is not a WX/WSX/FX.
    xor a        ;write 0 to I/O port 41h
    out (41H),a  ;and the mode changes to high-speed clock
NotWX:
    pop af
    out (40H),a
</pre>

<p>So you can check if certain extensions are available and ready to be accessed
by reading back the value you just wrote to the device ID register. If that
value is not the complement of what you wrote, then the extensions are not
present.</p>

<p>Note that this example restores the previous switched I/O bank after use.
For the sake of software interoperability, any
<abbr title="Operating System">OS</abbr> routines and
<abbr title="Interrupt Service Routine">ISR</abbr>s,
<abbr title="Terminate and Stay Resident program">TSR</abbr>s or hooks should do
this. This so that software does not need to disable interrupts during expanded
I/O port access, and can invoke OS routines freely.</p>

<p>See also <a href="/resources/system/msx-expansion-io-port-manual.pdf">MSX
Expansion I/O Port manual</a> and <a href="https://archive.org/download/MSXDatapackVolume2/MSX-Datapack_Volume2_1991.pdf"
hreflang="ja">MSX Datapack Vol. 2</a> appendix A.5.</p>


<h2 id="msxpi">MSXPi interface</h2>

<p>The <a href="http://retro-cpu.run/wiki/index.php?title=MSXPI:Specs:EN">MSXPi
interface</a> interfaces the MSX to a Raspberry Pi.</p>

<table>
<tr><th>Port range</th><th>Description</th></tr>
<tr><td>#56</td><td>Control port 1</td></tr>
<tr><td>#57</td><td>Control port 2 (future use)</td></tr>
<tr><td>#58</td><td>Programming port 1 (future use)</td></tr>
<tr><td>#59</td><td>Programming port 2 (future use)</td></tr>
<tr><td>#5A</td><td>Data I/O port 1</td></tr>
<tr><td>#5B</td><td>Data I/O port 2</td></tr>
<tr><td>#5C</td><td>Data I/O port 3 (future use)</td></tr>
<tr><td>#5D</td><td>Data I/O port 4 (future use)</td></tr>
</table>


<h2 id="gfx9000">Graphics9000 / V9990</h2>

<p>The V9990 has 16 registers in total, covering the range #60-#6F. Only the
first eight are used in the Graphics9000, ports #68-#6B are used in combination
with an optional Kanji ROM extension, and the rest is left as reserve. In the
Graphics9000, port #6F is mapped to the V7040 superimpose chip.</p>

<table>
<tr><th>Port range</th><th>Description</th></tr>
<tr><td>#60</td><td>VRAM data port</td></tr>
<tr><td>#61</td><td>Palette data port</td></tr>
<tr><td>#62</td><td>Command data port</td></tr>
<tr><td>#63</td><td>Register data port</td></tr>
<tr><td>#64</td><td>Register select port <em>(write only)</em></td></tr>
<tr><td>#65</td><td>Status port <em>(read only)</em></td></tr>
<tr><td>#66</td><td>Interrupt flag port</td></tr>
<tr><td>#67</td><td>System control port <em>(write only)</em></td></tr>
<tr><td>#68-#69</td><td>Primary standard Kanji ROM address port
                        <em>(write only) (not used in Gfx9000)</em></td></tr>
<tr><td>#69</td><td>Primary standard Kanji ROM data port
                    <em>(read only) (not used in Gfx9000)</em></td></tr>
<tr><td>#6A-#6B</td><td>Secondary standard Kanji ROM address port
                        <em>(write only) (not used in Gfx9000)</em></td></tr>
<tr><td>#6B</td><td>Secondary standard Kanji ROM data port
                    <em>(read only) (not used in Gfx9000)</em></td></tr>
<tr><td>#6C-#6E</td><td>Reserved</td></tr>
<tr><td>#6F</td><td>v7040 superimpose chip
                    <em>(write only) (both Gfx9000 and Video9000)</em></td></tr>
</table>

<p><em>Important note:</em> for correct behaviour, all Gfx9000 applications
should initialize by writing 0 to port #6F (the v7040 superimpose chip), and
then wait a frame before accessing the Gfx9000 again. Not ensuring this
register has the value 0 written to it will cause the Gfx9000 output to be
blurred occasionally. On exit, Gfx9000 applications should write #10 to port #6F
as a courtesy to Video9000 owners.</p>

<p>Refer to the <a href="/resources/#v9990">Video9000 manual</a>, page 13, for
more (Video9000-specific) details about the v7040 chip.</p>


<h2 id="midipac">MIDI-PAC</h2>

<p>The MIDI-PAC is an extension which translates MSX-MUSIC I/O to MIDI commands.
The MIDI-PAC2 also supports the PSG. It is developed by
<a href="https://www.worp3.com/">WORP3</a> and published by
<a href="https://supersoniqs.com/">SuperSoniqs</a>.</p>

<table>
<tr><th>Port</th><th>Read/Write</th><th>Description</th></tr>
<tr><td>#7C</td><td>Read</td><td>MIDI-PAC readback register</td></tr>
<tr><td>#7C</td><td>Write</td><td>YM2413 interface register address</td></tr>
<tr><td>#7D</td><td>Write</td><td>YM2413 interface register data</td></tr>
<tr><td>#A0</td><td>Write</td><td>AY-3-8910 interface register address (MIDI-PAC2)</td></tr>
<tr><td>#A1</td><td>Write</td><td>AY-3-8910 interface register data (MIDI-PAC2)</td></tr>
</table>

<table>
<caption>Readback register (#7C)</caption>
<tr><th>Bit</th><th>Description</th></tr>
<tr><td>0</td><td>Readback</td></tr>
<tr><td>1</td><td>Handshake</td></tr>
<tr><td>2</td><td>Change on #7C</td></tr>
<tr><td>3</td><td>Change on #7D</td></tr>
<tr><td>4</td><td rowspan="3">CPLD version bit</td></tr>
<tr><td>5</td></tr>
<tr><td>6</td></tr>
<tr><td>7</td><td>Change on #A1</td></tr>
</table>


<h2 id="rs232">RS232C UART (8251) / timer (8253)</h2>

<p>These are the functions of the I/O registers:</p>
<table>
  <tr>
    <th>Port</th>
    <th>Description</th>
  </tr>
  <tr>
    <td>#80</td>
    <td>i-8251 data transmission</td>
  </tr>
  <tr>
    <td>#81</td>
    <td>i-8251 command / status register</td>
  </tr>
  <tr>
    <td>#82 (read)</td>
    <td>i-8251 connection state</td>
  </tr>
  <tr>
    <td>#83 (write)</td>
    <td>i-8251 interrupt mask</td>
  </tr>
  <tr>
    <td>#84</td>
    <td>i-8253 counter 0</td>
  </tr>
  <tr>
    <td>#85</td>
    <td>i-8253 counter 1</td>
  </tr>
  <tr>
    <td>#86</td>
    <td>i-8253 counter 2</td>
  </tr>
  <tr>
    <td>#87 (write)</td>
    <td>i-8253 control register</td>
  </tr>
</table>

<h2 id="vdp">VDP / Video Display Processor / TMS9918A / v9938 / v9958</h2>

<p>These are the I/O registers for accessing the standard MSX VDPs:</p>
<table>
  <tr>
    <th>Port range</th>
    <th>Description</th>
  </tr>
  <tr>
    <td>#98</td>
    <td>VRAM data read/write port</td>
  </tr>
  <tr>
    <td>#99 (write)</td>
    <td>VDP register write port (bit 7=1 in second write)<br />
      VRAM address register (bit 7=0 in second write, bit 6: read/write access
      (0=read))</td>
  </tr>
  <tr>
    <td>#99 (read)</td>
    <td>Status register read port</td>
  </tr>
  <tr>
    <td>#9A</td>
    <td>Palette access port <em>(only v9938/v9958)</em></td>
  </tr>
  <tr>
    <td>#9B</td>
    <td>Indirect register access port <em>(only v9938/v9958)</em></td>
  </tr>
</table>

<p>See the <a href="/resources/#video">TMS9918, v9938 and v9958 application
manuals</a> for more details.</p>


<h2 id="psg">PSG / AY-3-8910 / YM2149</h2>

<p>These are the I/O registers for accessing the MSX PSG (Programmable Sound
Generator):</p>

<table>
  <tr>
    <th>Port range</th>
    <th>Description</th>
  </tr>
  <tr>
    <td>#A0 (write)</td>
    <td>Register write port</td>
  </tr>
  <tr>
    <td>#A1 (write)</td>
    <td>Value write port</td>
  </tr>
  <tr>
    <td>#A2 (read)</td>
    <td>Value read port</td>
  </tr>
</table>

<p>The following table describes the registers of the PSG:</p>

<table>
  <tr>
    <th>Register(s)</th>
    <th>Description</th>
  </tr>
  <tr>
    <td>0-5</td>
    <td>Tone generator control</td>
  </tr>
  <tr>
    <td>6</td>
    <td>Noise generator control</td>
  </tr>
  <tr>
    <td>7</td>
    <td>Mixer control-I/O enable<br />
      <em>Important note:</em> bit 6 <strong>must</strong> be 0, and bit 7
      <strong>must</strong> be 1. Setting different values can cause damage on
      some systems. Safest approach is to just not touch them and read them
      first before writing a new value.
    </td>
  </tr>
  <tr>
    <td>8-10</td>
    <td>Amplitude control</td>
  </tr>
  <tr>
    <td>11-13</td>
    <td>Envelope generator control</td>
  </tr>
  <tr>
    <td>14-15</td>
    <td>I/O ports A &amp; B</td>
  </tr>
</table>

<p>See the <a href="/resources/#psg">AY-3-8910 and YM2149 application
manuals</a> for more details.</p>

<h3 id="psgioports">Additional PSG GPIO ports A &amp; B</h3>

<p>The PSG has two general-purpose I/O ports in registers 14 and 15. They are used by
the MSX standard for several device I/O related tasks, comparable with the PPI
and working more or less in conjunction with it. These are the functions:</p>

<table>
  <caption>PSG I/O port A (r#14) – <em>read-only</em></caption>
  <tr>
    <th>Bit</th>
    <th>Description</th>
  <th>Comment</th>
  </tr>
  <tr>
    <td>0</td>
    <td>Input joystick pin 1</td>
  <td>0 = up</td>
  </tr>
  <tr>
    <td>1</td>
    <td>Input joystick pin 2</td>
  <td>0 = down</td>
  </tr>
  <tr>
    <td>2</td>
    <td>Input joystick pin 3</td>
  <td>0 = left</td>
  </tr>
  <tr>
    <td>3</td>
    <td>Input joystick pin 4</td>
  <td>0 = right</td>
  </tr>
  <tr>
    <td>4</td>
    <td>Input joystick pin 6</td>
  <td>0 = trigger A</td>
  </tr>
  <tr>
    <td>5</td>
    <td>Input joystick pin 7</td>
  <td>0 = trigger B</td>
  </tr>
  <tr>
    <td>6</td>
    <td>Japanese keyboard layout bit</td>
  <td>1 = JIS, 0 = ANSI/AIUEO/50on</td>
  </tr>
  <tr>
    <td>7</td>
    <td>Cassette input signal</td>
  <td></td>
  </tr>
</table>

<table>
  <caption>PSG I/O port B (r#15) – <em>write/read</em></caption>
  <tr>
    <th>Bit</th>
    <th>Description</th>
  <th>Comment</th>
  </tr>
  <tr>
    <td>0</td>
    <td>Output joystick port 1, pin 6</td>
  <td>Set to 1 to allow input</td>
  </tr>
  <tr>
    <td>1</td>
    <td>Output joystick port 1, pin 7</td>
  <td>Set to 1 to allow input</td>
  </tr>
  <tr>
    <td>2</td>
    <td>Output joystick port 2, pin 6</td>
  <td>Set to 1 to allow input</td>
  </tr>
  <tr>
    <td>3</td>
    <td>Output joystick port 2, pin 7</td>
  <td>Set to 1 to allow input</td>
  </tr>
  <tr>
    <td>4</td>
    <td>Output joystick port 1, pin 8</td>
  <td></td>
  </tr>
  <tr>
    <td>5</td>
    <td>Output joystick port 2, pin 8</td>
  <td></td>
  </tr>
  <tr>
    <td>6</td>
    <td>Joystick input selection, for r#14 inputs</td>
  <td>1 = port 2</td>
  </tr>
  <tr>
    <td>7</td>
    <td>Kana led control</td>
  <td>1 = off</td>
  </tr>
</table>


<h2 id="pausetr">Pause / R800 info (turboR)</h2>

<p>This I/O register is only present on MSX turboR computers. Its function
differs depending on whether you are reading or writing.</p>

<table>
<tr>
  <th>Port range</th>
  <th>Description</th>
</tr>
<tr>
  <td>#A7 (read)</td>
  <td>bit 0: pause switch (1=on)<br />
      Works only in R800 mode (connected to WAIT of Z80)</td>
</tr>
<tr>
  <td>#A7 (write)</td>
  <td>bit 0: pause LED (1=on)<br />
      bit 7: R800 LED (1=on)<br />
      Mirror address is #FCB1 in the system RAM.</td>
</tr>
</table>



<h2 id="ppi">PPI / Programmable Peripheral Interface / 8255</h2>

<p>The PPI controls a number of things in the MSX system, ranging from slot
selection through cassette output to interfacing with the keyboard.</p>

<table>
<tr>
  <th>Port range</th>
  <th>Description</th>
</tr>
<tr>
	<td>#A8</td>
	<td>PPI-register A<br />
	Primary slot select register.</td>
</tr>
<tr>
	<td>#A9 (read)</td>
	<td>PPI-register B<br />
	Keyboard matrix row input register.</td>
</tr>
<tr>
	<td>#AA</td>
	<td>PPI-register C<br />
	Keyboard and cassette interface.</td>
</tr>
<tr>
	<td>#AB (write)</td>
	<td>Command register.</td>
</tr>
</table>

<p>Below, we will describe the registers in more detail.</p>

<h3 id="ppi-a">Primary slot select register</h3>

<p>The 64k of MSX main memory is divided into four blocks of 16k, referred to as
<dfn>pages</dfn>. This register controls which primary slot will be mapped to
each page of memory.</p>

<table>
	<caption>PPI-register A (#A8)</caption>
	<tr>
		<th>Bits</th>
		<th>Description</th>
	</tr>
	<tr>
		<td>0-1</td>
		<td>Slot for page 0 (#0000-#3FFF)</td>
	</tr>
	<tr>
		<td>2-3</td>
		<td>Slot for page 1 (#4000-#7FFF)</td>
	</tr>
	<tr>
		<td>4-5</td>
		<td>Slot for page 2 (#8000-#BFFF)</td>
	</tr>
	<tr>
		<td>6-7</td>
		<td>Slot for page 3 (#C000-#FFFF)</td>
	</tr>
</table>

<p>This register can both be written and be read.</p>

<p>Additionally, each primary slot can and often will be expanded into four
secondary slots, also known as <dfn>subslots</dfn>. The subslot select register
can be found at memory address #FFFF. For more details, go to the
<a href="#subslot">secondary slot select register</a>.</p>


<h3 id="ppi-bc">Misc PPI controls</h3>

<p>With PPI register C you can access the keyboard (including CAPS LED and key
click), and control the cassette interface. The precise function of each bit is
described in the table below:</p>

<table>
	<caption>PPI-register C (#AA)</caption>
	<tr>
		<th>Bits</th>
		<th>Description</th>
	</tr>
	<tr>
		<td>0-3</td>
		<td>Keyboard matrix row select register. <br />
		Matrix row can be read from PPI-register B (#A9).</td>
	</tr>
	<tr>
		<td>4</td>
		<td>Cassette motor control. 1 = off.</td>
	</tr>
	<tr>
		<td>5</td>
		<td>Cassette write signal. 1 = high.</td>
	</tr>
	<tr>
		<td>6</td>
		<td>Keyboard CAPS LED. 1 = off.</td>
	</tr>
	<tr>
		<td>7</td>
		<td>1-bit key click sound output. 1 = high.</td>
	</tr>
</table>

<p>More information about keyboard matrices can be found in the
<a href="/articles/keymatrix.php">keyboard matrices</a> article.</p>


<h3 id="ppi-cmd">PPI command register</h3>

<p>With this write-only register you can set or reset individual bits in
PPI-register C. This is the recommended (fastest) method to use when you want to
modify bits 4-7.</p>

<table>
	<caption>PPI command register (#AB)</caption>
	<tr>
		<th>Bits</th>
		<th>Description</th>
	</tr>
	<tr>
		<td>0</td>
		<td>Value to set.</td>
	</tr>
	<tr>
		<td>1-3</td>
		<td>Bit no. within PPI-register C.</td>
	</tr>
	<tr>
		<td>4-6</td>
		<td>Not used.</td>
	</tr>
	<tr>
		<td>7</td>
		<td>Must be 0.</td>
	</tr>
</table>





<h2 id="s1990">S1990 controller (turboR)</h2>

<p>Through these ports you can access the turboR’s S1990 bus controller.</p>

<table>
<tr>
  <th>Port range</th>
  <th>Description</th>
</tr>
<tr>
  <td>#E4</td>
  <td>Register select port</td>
</tr>
<tr>
  <td>#E5</td>
  <td>Register access port</td>
</tr>
<tr>
  <td>#E6-#E7 (read)</td>
  <td>16-bit counter, little endian, running at 255682 Hz</td>
</tr>
<tr>
  <td>#E6 (write)</td>
  <td>16-bit counter reset (write to reset)</td>
</tr>
</table>

<p></p>

<table>
  <caption>S1990 registers</caption>
<tr>
  <th>Register</th>
  <th>Description</th>
</tr>
<tr>
  <td>5</td>
  <td>bit 6: Switch (0=right, 1=left)</td>
</tr>
<tr>
  <td>6</td>
  <td>bit 5: Processor mode (0=R800, 1=Z80)<br />
      bit 6: ROM mode (0=DRAM, 1=ROM)</td>
</tr>
<tr>
  <td>14</td>
  <td>Contains last but one byte written to memory</td>
</tr>
<tr>
  <td>15</td>
  <td>Contains last byte written to memory</td>
</tr>
</table>


<h2 id="vdpdisplaymode">VDP display mode (MSX2+)</h2>

<table>
<tr>
  <th>Port</th>
  <th>Bit</th>
  <th>Description</th>
</tr>
<tr><td rowspan="8">#F3</td>
    <td>0</td><td>M3</td></tr>
<tr><td>1</td><td>M4</td></tr>
<tr><td>2</td><td>M5</td></tr>
<tr><td>3</td><td>M2</td></tr>
<tr><td>4</td><td>M1</td></tr>
<tr><td>5</td><td>TP</td></tr>
<tr><td>6</td><td>YUV</td></tr>
<tr><td>7</td><td>YAE</td></tr>
</table>


<h2 id="sysflags">System flags</h2>

<p>This register is used on MSX2+ computers and up to help the BIOS distinguish
between a cold and a warm boot. A cold boot (power on / reset button) resets
the register, whereas a warm boot (jump to BIOS entry
<a href="http://map.grauw.nl/resources/msxbios.php#CHKRAM">CHKRAM</a> at address
0) preserves it. On the Turbo R it also indicates to the BIOS whether the R800
has booted up.</p>

<p>During a warm boot, the MSX2+ and up do not show the start-up logo sequence
and do not initialise the RAM (which clears “AB” cartridge headers).</p>

<p>Use BIOS entries
<a href="http://map.grauw.nl/resources/msxbios.php#RDRES">RDRES</a> (017AH) to
read the register, and
<a href="http://map.grauw.nl/resources/msxbios.php#WRRES">WRRES</a> (017DH) to
write.</p>

<p>Note that on some MSX models the register is inverted and the initial value
is 0FFH rather than 00H. This is the case on the Panasonic and Sanyo MSX2+
models, but not on the Sony MSX2+ and the Panasonic MSX Turbo R models. If this
is the case the
<a href="http://map.grauw.nl/resources/msxbios.php#RDRES">RDRES</a> and
<a href="http://map.grauw.nl/resources/msxbios.php#WRRES">WRRES</a> BIOS
routines compensate for this by complementing the value, therefore their use is
recommended.</p>

<table>
  <tr>
    <th>Port</th>
    <th>Bit</th>
    <th>Description</th>
  </tr>
  <tr>
    <td rowspan="2">#F4</td>
    <td>5</td><td>R800 booted (1=yes)</td>
  </tr>
  <tr>
    <td>7</td><td>Boot method (1=warm boot)</td>
  </tr>
</table>


<h2 id="systemcontrol">System control</h2>

<p>Bits to avoid the collision of internal I/O devices with external cartridges.
These let the built-in devices be disabled. During the BIOS initialisation, the
internal device should be enabled if there is no external device. Applications
should not read or set these values.</p>

<p>Write a 1 to enable.</p>

<table>
<tr>
  <th>Port</th>
  <th>Bit</th>
  <th>Description</th>
</tr>
<tr><td rowspan="8">#F5 (write)</td>
    <td>0</td><td>Kanji ROM, JIS 1 (see also
    <a href="/resources/engine/yamaha_s1985.pdf">S1985 MSX-ENGINE</a>)</td></tr>
<tr><td>1</td><td>Kanji ROM, JIS 2</td></tr>
<tr><td>2</td><td>MSX-AUDIO</td></tr>
<tr><td>3</td><td>Super impose</td></tr>
<tr><td>4</td><td>MSX INTERFACE</td></tr>
<tr><td>5</td><td>RS-232C</td></tr>
<tr><td>6</td><td>Light pen</td></tr>
<tr><td>7</td><td>CLOCK-IC (MSX2, MSX2+ only implementation)</td></tr>
</table>

<p>See MSX turboR Tech Handbook section 2.2.7 &amp; MSX Datapack appendix A.6.</p>


<h2 id="avcontrol">A/V control</h2>

<table>
<tr>
  <th>Port</th>
  <th>Bit</th>
  <th colspan="3">Description</th>
</tr>
<tr><td rowspan="9">#F7</td>
    <td>0</td><td>Audio R</td><td>Mixing on</td><td>(Write)</td></tr>
<tr><td>1</td><td>Audio L</td><td>Mixing off</td><td>(Write)</td></tr>
<tr><td>2</td><td>Video input selection</td><td>21-pin RGB</td><td>(Write)</td></tr>
<tr><td>3</td><td>Synchronous mode switch</td><td></td><td>(Write)</td></tr>
<tr><td>3</td><td>Video input detection</td><td>No input</td><td>(Read)</td></tr>
<tr><td>4</td><td>AV control</td><td>0: TV</td><td>(Write)</td></tr>
<tr><td>5</td><td>Ym control</td><td>0: TV</td><td>(Write)</td></tr>
<tr><td>6</td><td>Ys control</td><td>0: Super</td><td>(Write)</td></tr>
<tr><td>7</td><td>Video select</td><td>0: TV</td><td>(Write)</td></tr>
</table>

<p>See MSX Datapack appendix A.6 and MSX Technical Data Book section 1.7.9.</p>


<h2 id="mmapper">Memory Mapper registers</h2>

<p>The Z80 used in the MSX has 64k of addressable memory. To be able to use more
memory, memory mappers are used in MSX2 computers and above. A memory mapper
divides the 64k of RAM into four 16k blocks called <dfn>pages</dfn>, into which
up to 256 different memory <dfn>segments</dfn> can be mapped. Note that these
segments are shared – it is possible to map a segment used in page 0 into page 1
as well.</p>

<table>
<tr>
  <th>Port range</th>
  <th>Description</th>
</tr>
<tr>
  <td>#FC (write)</td>
  <td>Mapper segment for page 0 (#0000-#3FFF)</td>
</tr>
<tr>
  <td>#FD (write)</td>
  <td>Mapper segment for page 1 (#4000-#7FFF)</td>
</tr>
<tr>
  <td>#FE (write)</td>
  <td>Mapper segment for page 2 (#8000-#BFFF)</td>
</tr>
<tr>
  <td>#FF (write)</td>
  <td>Mapper segment for page 3 (#C000-#FFFF)</td>
</tr>
</table>

<p>Note that reading those registers is <strong>not</strong> reliable, and
should not be done.</p>

<p>Detecting the amount of available memory can be done by writing a unique
value into all mapper pages and iterating through them until you see repetition.
If the repetition e.g. occurs after 8 pages, there is 128k of RAM available.
Usually, you will want to do this with interrupts disabled and also want to
restore the original values.</p>

<p>Note about DOS2: MSX-DOS2 provides a set of
<a href="/resources/dos2_environment.php#c5">convenient memory management
routines</a>. In a DOS2 environment, you should <strong>not</strong> access the
mapper registers directly, as this will cause various problems. The routines
DOS2 offers are very fast, and there should be no reason not to use them.</p>



<h2 id="a1fm-modem">Panasonic FS-A1FM Modem ROM</h2>

<p>The Panasonic FS-A1FM computer has a built-in modem with firmware. On the
back of the computer, there is a switch to enable the modem software. This
firmware, including a memory-mapped I/O area in the #7FC0-#7FFF range, is
located in slot 3-1. I do not know if there is a detection method.</p>

<table>
<tr>
  <th>Address range</th>
  <th>Description</th>
</tr>
<tr>
  <td>#7FC4</td>
  <td>bits 0-3: mapper for #4000-#5FFF area (uses slot 3-3 ROM pages #00-#0F)<br/>
      bits 4-7: mapper for #6000-#7FFF area (RAM, don’t know how much)</td>
</tr>
<tr>
  <td>#7FC6</td>
  <td>bit 2: modem switch on back of case setting</td>
</tr>
<tr>
  <td>#7FF9</td>
  <td>bit 2: set activates ports 7FF0-7FF7</td>
</tr>
</table>



<h2 id="subslot">Secondary slot select register</h2>

<p>Each <a href="#ppi-a">primary slot</a> can and often will be expanded into
four secondary slots, also known as <dfn>subslots</dfn>. Just like a primary
slot, a subslot can also be mapped to one of the four pages in main memory.</p>

<p>The subslot select register can be found at memory address #FFFF, and looks
as follows:</p>

<table>
	<tr>
		<th>Bits</th>
		<th>Description</th>
	</tr>
	<tr>
		<td>0-1</td>
		<td>Subslot for page 0 (#0000-#3FFF)</td>
	</tr>
	<tr>
		<td>2-3</td>
		<td>Subslot for page 1 (#4000-#7FFF)</td>
	</tr>
	<tr>
		<td>4-5</td>
		<td>Subslot for page 2 (#8000-#BFFF)</td>
	</tr>
	<tr>
		<td>6-7</td>
		<td>Subslot for page 3 (#C000-#FFFF)</td>
	</tr>
</table>

<p>When this register is read, it returns the complement of the previous value
written.</p>

<p>It is important to note that the subslot register <strong>only</strong>
affects the primary slot which is selected in page 3 (which the #FFFF address is
in). This makes selecting a different subslot in e.g. page 1 a little less than
trivial when page 1 doesn’t have the same primary slot as page 3. This involves
switching page 1’s slot into page 3, selecting the desired subslot, and
switching back the original slot into page 3. All this must be done with
interrupts disabled and, logically, from an address not in the #C000-#FFFF
range. Don’t forget to take care of the stack as well.</p>

<p>Usually it will be easier to use the BIOS-provided slot select routines
(e.g. <a href="/resources/msxbios.php#ENASLT">ENASLT</a> or its
<a href="/resources/dos2_environment.php#c2_3">DOS equivalent</a>). While on the
subject of the BIOS, the easiest method to determine whether a slot is expanded
is to read out the <a href="/resources/msxsystemvars.php#EXPTBL">EXPTBL</a>
system variables. Also, the BIOS maintains a mirror of the value of each primary
slot’s subslot register in the
<a href="/resources/msxsystemvars.php#SLTTBL">SLTTBL</a> system variables.</p>



<p class="signed">Grauw</p>




<?php addFooter(); ?>
</body>
</html>