I/O Ports List
This page was last modified 10:01, 11 April 2018 by Gdx. Based on work by Mars2000you and Rderooy.

I/O ports allow direct access to the hardware of the MSX. On MSX1, direct access was officially forbidden to ensure compatibility. Then with the MSX2 standard they relaxed this by tolerating access to the PPI and PSG. Then with the MSX2+ standard they even advised to directly access the VDP to gain speed.

In fact, access to the PPI, PSG and VDP do not cause any problem on any MSX generation, provided attention is paid to, for example, some timings that may vary a little depending on the VDP generation. This is especially the case when the CPU has a "turbo mode".

The Z80 can only handle up to 256 I/O ports. The MSX standard reserves all ports from 0 to 63 (03Fh) for users, while those above are meant for manufacturers of official equipment.

The table below contains a non-exhaustive list of devices using I/O ports.

Ports Device
00h~01h Midi port (ouput) of Music Module (don't use it at the same time with Sony Sensor Kid cartridge!)
00h~01h Sony Sensor Kid cartridge (don't use it at the same time with the Music Module!)
02h~03h Midi FAC interface. (mirrored 00h~07h)
04h~05h Midi port (input) of Music Module.
0Ah DAC of Music Module.
0Fh Zemina's MegaRams.
10h~11h PSG emulated from MegaFlashRoms based on an FPGA.
14h~17h YM2608 OPNA cartridge (in development)
18h~19h Philips Barcode reader NMS-1170/20
20h~28h Philips Modem NMS1251 (configurable either on 20h~28h or 30h~38h using jumper)
20h~28h Modem Miniware M4000 (configurable either on 20h~28h or 30h~38h using jumper)
21h~27h Sunrise MP3 Player
27h~2Fh Philips serial interface NMS 1210/1211/1212 (configurable either on 27h~2Fh or 37h~3Fh using jumper)
28h~29h DenYoNet ethernet interface
2Ah~2Bh PlaySoniq cartridge setting registers
30h~38h Philips modem NMS-1251 (configurable either on 20h~28h or 30h~38h using jumper)
30h~38h Modem Miniware M4000 (configurable either on 20h~28h or 30h~38h using jumper)
30h~38h GREEN/MAK SCSI interface
30h~38h Philips CD-ROM interface NMS-0210
37h~3Fh Philips MSX modem/interface NMS-1250/1255
37h~3Fh Philips serial interface NMS-1210/1211/1212 (configurable either on 27h~2Fh or 37h~3Fh using jumper)
3Ch Access to the control register of the Musical Memory Mapper.
3Fh Access to the SN76489 control register of the Musical Memory Mapper.
40h~4Fh Allow to extend I/O ports. Standard method for managing more devices using extra ports.
48h~49h Franky cartridge. (SN76489 and VDP)
50h~6Fh Ports reserved for the system.
5Eh~5Fh GR8NET Ethernet interface.
60h~6Fh Graphics9000 / V9990.
64h~65h Port 064h serves as an identifier and port 065h is used to enable or disable the Z80 turbo mode of the Panasonic MSX2+. If the reading of the port 064h gives the value 247 after writing 8 is that it is a MSX2+ Panasonic.
70h~73h Midi Saurus cartridge. (Bit2)
74h~7Bh Ports reserved for the system.
77h Super Game 90. (It uses a reserved port!)
7Ch~7Dh MSX-Music (OPLL).
7Eh~7Fh MoonSound cartridge (OPL4).
80h~83h RS-232C UART (8251).
  • 80h is the port to send / receive data
  • 81h is the port to send a command or read the status register
  • 82h is the port to read the connection status
  • 83h is the port for interrupt mask
84h~87h RS-232C programmable timer (8253).
  • 84h is the port for counter 0
  • 85h is the port for counter 1
  • 86h is the port for counter 2
  • 87h is the port to access the control register
88h~8Bh Access to registers of an external v9938. (eg: MSX2 or 80 columns upgrade.)
8Ch~8Dh MSX Modem.
8Eh~8Fh MegaRam DDX mapper. (It uses a reserved port!)
8Eh~8Fh Ports reserved for the system.
90h~91h Access to the printer port.
94h Printer port direction control. (Unstandardized option!)
92h~97h Ports reserved for the system.
98h~99h Access to control registers and status register(s) of internal VDP.
9Ah~9Bh Access to internal VDP color palette and data transfer registers (v9938/v9958 only)
9Ch~9Fh Ports reserved for the system.
A0h~A2h Access to PSG (AY-3-8910/YM2149) registers.
A4h~A5h Access to PCM registers of MSX turbo R.
A6h Port reserved for the system.
A7h Access to Pause and R800 LED control register of the MSX turbo R.
  • bit 0 = Pause LED control ; (output)
  • bit 7 = Mode R800 LED control. (output)
  • Content of the register is saved at 0FCB1h by the system.
A8h~ABh Access to registers of PPI (8255/ULA9RA041).
  • A8h is the port to access the primary Slot selection register (use the port A of PPI).
  • A9h is the port to read the specified keyboard matrix row (use the port B of PPI).
  • AAh is the port to access the register that control the keyboard CAP LED, two signals to data recorder and a matrix row (use the port C of PPI).
    • bits 0~3 = Row number of specified keyboard matrix to read via port B
    • bit 4 = Data recorder motor (reset to turn on)
    • bit 5 = Set to write on tape
    • bit 6 = Keyboard LED CAPS (reset to turn on)
    • bit 7 = 1, then 0 shortly thereafter to make a clicking sound (used for the keyboard).
  • ABh is the port to access the ports control register.
    • bit 0 = Bit status to change
    • bit 1~3 = Number of the bit to change at port C of the PPI
    • bit 4~6 = Unused
    • bit 7 = Must be always reset on MSX.
ACh~AFh 1chipMSX control.
B0h~B3h Sony HBI-55 and Yamaha UDC-01 cartridges. (External PPI 8255)
B4h~B5h Access to real-time clock registers. (RP-5C01)
  • Port B4h = 4-bit register number (output) ;
  • Port B5h = Data of 4 bits to read or write.
B6h~B7h Ports reserved for the system.
B8h~BBh Sanyo optical pen interface.
BCh~BFh VHD controller.
C0h~C1h MSX Audio / Music Module.
C0h~C3h Mounsound / OPL4 (alternative ports).
C2h~C3h MSX Audio / Music Module (ports for second cartridge)
C4h~C7h Mounsound / OPL4.
C8h~CCh MSX Interface. (Asynchronous Serial Interface)
D0h~D7h Microsol floppy disk drive controller. (WD2793)
D8h~D9h Kanji Rom level 1.
DAh~DBh Kanji Rom level 2.
DCh Reserved for Kanji Rom extension. (Never used?)
DCh~DDh PlaySoniq cartridge (Sega Gamepad support).
E4h~E5h Access to S1990 setting registers. (MSX turbo R)
E6h~E7h Access to the S1990 timer. This timer is incremented every 3,911 μs.
  • E6h = Least significant 8 bits of the Timer value. A write to this port resets the timer. (ouput/input)
  • E7h = Most significant 8 bits of the Timer value. (input)

Example of use:

; Input: B = Waiting time (B x 3,911 μs).
; Output: Registers A, C and F will be modified.
; Notes: B must be greater than 0.
;        Interrupts must be disabled.

CountLSB	equ	0E6h
CountMSB	equ	0E7h

Wait:
	in	a,(CountLSB)
	ld	c,a
WaitLoop:
	in	a,(CountMSB)
	sub	c
	cp	b
	jr	c, WaitLoop	; Jump if time is not up
	ret
F3h Access to the register that indicates the current screen mode. (MSX2+ only)
  • bit 0 = M3
  • bit 1 = M4
  • bit 2 = M5
  • bit 3 = M2
  • bit 4 = M1
  • bit 5 = TP
  • bit 6 = YUV
  • bit 7 = YAE
F4h Access to status register of the initialization that serves as a flag for the system to initialize properly. (MSX2+ or newer)
  • bit 5 = Fag to indicate that the system has already initialized. (turbo R)
  • bit 7 = Hard/Soft reset flag for the system. This bit is reset when a hard reset is performed.

Note: The read value at port must be reversed on some MSX2+ to obtain right value.

F5h Access to the register of internal I/O ports control. (MSX2)
This register is accessible only in writing. It is used to disable (bit to 0) some hardware built into the MSX. Note that the BIOS disables some hardware during initialization of the MSX.
  • bit 0 = Kanji Rom level 1.
  • bit 1 = Kanji Rom level 2 (MSX2+ only).
  • bit 2 = MSX-Audio. If the value read at port 0C0H is 255, there is none internally.
  • bit 3 = Super impose. Perform a logical AND of bit 3 value read at ports 77h and F7h, to know if the MSX has the Super impose capacity internally.
  • bit 4 = MSX Interface. If the value read at port 0C0H is 255, there is none internally. MSX Interface is a general-purpose communication LSI that is not yet used.
  • bit 5 = RS-232C with mapped I/O ports. If the status register of the i8351 is xx000101b after an internal initialization, then there is an RS-232C internally.
  • bit 6 = Optical pencil. If the value read at port 0BBH is 255, it is because there is none internally.
  • bit 7 = RTC. This bit is reset 0 during initialization and remains so when a cartridge contains a RTC. You can ignore this bit in your programs.
F6h Colors bus.
F7h Access to the A/V control NTSC register. This register is accessible only in writing except bit 4 which is accessible only in reading.
  • bit 0 = Set to mix right and left audio outputs
  • bit 1 = Left audio output
  • bit 2 = 1 to set the video input to the RGB21
  • bit 3 = Flag to know if the video input is off or not
  • bit 4 = AV control (RGB21?)
  • bit 5 = Ym control (RGB21?)
  • bit 6 = Reverse the bit 4 status of register 9 of the VDP
  • bit 7 = Reverse the bit 5 status of register 9 of the VDP
F8h Access to A/V control PAL register. (optional?)
F9h~FBh Ports reserved for the system.
F8h~FBh Access to most significant 8 bits of Memory Mapper 16-bit registers of the PlaySoniq cartridge. (Use a port already used on some MSX but it is disabled by default)
FCh~FFh Access to the Memory Mapper registers.


Links