VDP Ports
This page was last modified 10:40, 23 June 2020 by Gdx. Based on work by Mars2000you.

Contents

Description

VDP used in MSX computers is depending of the generation.

The number of VDP writing ports varies from 2 (on MSX1) to 4 (on MSX2 and higher).

On all MSX generations, the number of VDP reading ports is always 2.

On MSX1

MSX1s use a TMS9918, TMS9928, TMS9929 or compatible according to the TV standard used in the country.

These VDPs have two writing ports, port #0 for the data and port #1 to the VRAM address and registers set-up.

They have also two ports to read the data and register flags. Reading port #0 is used to read the data and the reading port #1 is to read the flags of the status register.

VDP Function CPU
Writing port #0 Writing Data into the VRAM Writing port #98h
Writing port #1 VRAM address and register set-up Writing port #99h
Reading port #0 Reading Data from the VRAM Reading port #98h
Reading port #1 Reading status Register Reading port #99h


On MSX2 and higher

Other MSX generations use the V9938 (MSX2) or V9958 (MSX2+/MSX Turbo R)

These VDPs have two extra writing ports (ports #2 and #3) located behind the other ports.

VDP Function CPU
Writing port #2 Writing Data in the palette register Writing port #9Ah
Writing port #3 Indirect writing data in a register Writing port #9Bh


Notes:

  • A few MSX1 use the V9938 and you can use all MSX2 functions by direct access only.
  • A few MSX2 use the V9958 and you can use its MSX2+ functions by direct access only.
  • Since MSX2+, the ports of CPU # 98 to # 9B have been standardized. In fact, the ports have never been changed. Only the MSX2 extension and the 80 columns cartridge use different ports (#88h to #8Bh).


How to check the CPU ports - VDP ports connection

To know which CPU ports are connected to the VDP ports, you must read the byte 0006h or 0007h from the Main-ROM. These two bytes indicate which CPU port is connected to the port #0 for reading and writing. The next CPU port is the one connected to the VDP port #1, etc.

In practice, the reading way of these bytes varies according to the environment.

In the BASIC environment, you only need to read the byte at address 0006h or 0007h because the Main-ROM is selected by default.

Under MSX-DOS, you can use the following routines in assembler.

VDP_DW	equ	0007h	; VDP data write port
RDSLT	equ	000Ch	; Read slot routine
 
EXPTBL	equ	0FCC1h	; Extended slot flags table (4 bytes)
 
;Routine to get port of data writing to the VDP for MSX-DOS1/2.
 
;Entry: None
;
;Output: A = CPU port connected to the VDP writing data port #0
 
 
VDPDW:
	ld	hl,VDP_DW	;HL = Address to read
	ld	a,(EXPTBL)	;A = Main-ROM slot
	call	RDSLT
	ret
VDP_DR	equ	0006h	; VDP data read port
RDSLT	equ	000Ch	; Read slot routine
 
EXPTBL	equ	0FCC1h	; Extended slot flags table (4 bytes)
 
;Routine to get the port of data reading from the VDP for MSX-DOS1/2
 
;Entry: None
;
;Output: A = CPU port connected to the VDP reading data port #0
 
 
VDPDR:
	ld	hl,VDP_DR	;HL = Address to read
	ld	a,(EXPTBL)	;A = Main-ROM slot
	call	RDSLT
	ret