Category:VDP Registers
This page was last modified 21:50, 1 September 2023 by Mcolom. Based on work by Gdx and Mars2000you.

Here the registers used by MSX VDPs.

Contents

VDP Control Registers

These registers can only be written. Reading is possible in BASIC because the system stores the last value written in system variables. VDP() instruction reads the corresponding system variables to return the requested value.

Register System variable BASIC instruction Function Generation
R#0 REG0SAV (0F3DFh) VDP(0) Screen mode, video output,
interruption line, color bus setting
MSX1~
R#1 REG1SAV (0F3E0h) VDP(1) Screen mode, sprites size, Vblank,
Display, VRAM mode setting
MSX1~
R#2 REG2SAV (0F3E1h) VDP(2) Pattern layout table setting (Foreground) MSX1~
R#3 REG3SAV (0F3E2h) VDP(3) Colors table setting MSX1~
R#4 REG4SAV (0F3E3h) VDP(4) Patterns generator table setting MSX1~
R#5 REG5SAV (0F3E4h) VDP(5) Sprites attribute table setting MSX1~
R#6 REG6SAV (0F3E5h) VDP(6) VDP Table Base Address Registers MSX1~
R#7 REG7SAV (0F3E6h) VDP(7) Text and screen margin color setting MSX1~
R#8 REG8SAV (0FFE7h) VDP(9) Monochrome, sprites display, Vram,
color 0, Korean optical pen setting
MSX2~
R#9 REG9SAV (0FFE8h) VDP(10) 192/212 lines, video source, interlacing,
screen alternance, 50/60Hz setting
MSX2~
R#10 REG10SAV (0FFE9h) VDP(11) Colors table setting MSX2~
R#11 REG11SAV (0FFEAh) VDP(12) Sprites attribute table setting MSX2~
R#12 REG12SAV (0FFEBh) VDP(13) Text and background blink color setting MSX2~
R#13 REG13SAV (0FFECh) VDP(14) Blinking period setting MSX2~
R#14 REG14SAV (0FFEDh) VDP(15) 3 bits most signifiant of current address
of VRAM
MSX2~
R#15 REG15SAV (0FFEEh) VDP(16) Indirect access to VDP Status register MSX2~
R#16 REG16SAV (0FFEFh) VDP(17) Access register to colors palette MSX2~
R#17 REG17SAV (0FFF0h) VDP(18) Indirect access register to VDP register MSX2~
R#18 REG18SAV (0FFF1h) VDP(19) Screen location adjustment register MSX2~
R#19 REG19SAV (0FFF2h) VDP(20) Interruption line register MSX2~
R#20 REG20SAV (0FFF3h) VDP(21) Composite video output register MSX2~
R#21 REG21SAV (0FFF4h) VDP(22) Composite video output register MSX2~
R#22 REG22SAV (0FFF5h) VDP(23) Composite video output register MSX2~
R#23 REG23SAV (0FFF6h) VDP(24) Vertical scrolling register MSX2~
R#25 REG25SAV (0FFFAh) VDP(26) MSX2+ extra setting register MSX2+~
R#26 REG26SAV (0FFFBh) VDP(27) Horizontal scrolling register MSX2+~
R#27 REG27SAV (0FFFCh) VDP(28) Horizontal scrolling register MSX2+~


You can divide these registers into several categories:

How to write directly in a VDP control register

To write in a VDP register you must send two bytes one after the other to the VDP port #1. The first byte must be the data to write and the second the register number with the bit 7 set to indicate that it is an access to a register.

To do it you must know the writing CPU port connected to the VDP port #1. The number of the writing CPU port can be found in the Main-ROM at the address 0007h.

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

Example in assembler:

VDP_DW	equ	0007h	; VDP data write port
 
; Routine to write a byte to a VDP register.
 
; Entry: A = data, B = register number + 80h (to set the bit 7)
;
; Modify: BC 
 
WR2VDPREG:
	push	af
	ld	a,(VDP_DW)	; A = First writing port used to access the internal VDP
	ld	c,a
	inc	c		; C = CPU port connected to the VDP writing port #1
 
	di			; Interrupts must be disabled here
	pop	af
	out	(c),a		; Write the data
	out	(c),b		; Write the register number (with the bit 7 always set)
	ei			; Interrupts can be enabled here
	ret


VDP Command Registers

These registers can only be written.

Register BASIC instruction Function Generation
R#32
R#33
VDP(33)
VDP(34)
Source horizontal coordinate MSX2~
R#34
R#35
VDP(35)
VDP(36)
Source vertical coordinate MSX2~
R#36
R#37
VDP(37)
VDP(38)
Destination horizontal coordinate MSX2~
R#38
R#39
VDP(39)
VDP(40)
Destination vertical coordinate MSX2~
R#40
R#41
VDP(41)
VDP(42)
Horizontal tracing MSX2~
R#42
R#43
VDP(43)
VDP(44)
Vertical tracing MSX2~
R#44 VDP(45) Color of tracing MSX2~
R#45 VDP(46) Command setting MSX2~
R#46 VDP(47) Logical operator and command to execute MSX2~


For details about VDP Command Registers, see here.

VDP Status Registers

These registers can only be read.

Register BASIC instruction Function Generation
R#0 VDP(8) F, 5S, C flags and 5th sprite number on the same line MSX1~
R#1 VDP(-1) FH, LPS, FH flags and VDP ID MSX2~
R#2 VDP(-2) CE, EO, BD, HR and TR flags MSX2~
R#3
R#4
VDP(-3)
VDP(-4)
Sprites collision horizontal coordinate MSX2~
R#5
R#6
VDP(-5)
VDP(-6)
Sprites collision vertical coordinate MSX2~
R#7 VDP(-7) Returned byte by POINT & LMCM commands MSX2~
R#8
R#9
VDP(-8)
VDP(-9)
Horizontal coordinate returned by SRCH command MSX2~


For details about VDP status registers, see here.

Pages in category "VDP Registers"

The following 8 pages are in this category, out of 8 total.

V

V cont.

V cont.