The additional VDP registers

Last updated on: August 19, 1999

The MSX 2+ VDP has three additional registers, number 25 to 27. These registers can be accessed from BASIC using VDP(26)-VDP(28). So, to determine the correct VDP number of a register, you need to add one to the register number.

The registers are used as followed:

reg b7  b6  b5  b4  b3  b2  b1  b0
26  -   -   H08 H07 H06 H05 H04 H03
27  -   -   -   -   -   H02 H01 H00

The abbreviations have the following meaning:

CMD: Command function
This bit determines how the VDP commands function. When this bit is reset, the commands only function in screen 5 to 12. In the other case, the commands function in all screen modes. On screen 5 to 12, they behave as usual. On the other screens, the VDP uses the same addressing scheme as if the VDP is in screen 8. Hence, you have to set the coordinates just like when you are working in screen 8.

VDS: VRAM data select
This bit determines the function for VDP pin 8. When VDS is reset, the 3.38MHz clock signal for the CPU will be put on pin 8. Otherwise, the so-called VDS signal is put on pin 8. This signal is low when the VDP accesses the VRAM for screen display. Otherwise, the VDS signal is high.
Since most MSX 2+ computers derive the CPU clock from pin 8, you should always keep this bit to 0.

These are described in the section 'Select MSX 2+ screens in assembly' in the other part of the article.

WTE: Wait function
This bit determines whether the wait function of the VDP is enabled. When WTE is reset, the wait function is disabled. Otherwise, the wait function is enabled. In the latter case, the VDP will generate wait states when the CPU wants to access the VRAM before the VDP is ready for it. Programs using the wait function do not need to explicitly check bit 7 of status register 2 when transferring data to or from VRAM using the VDP commands.

MSK: Mask bit
This bit can enable the mask function of the VDP. When MSK is reset, the mask function is disabled. Otherwise, the mask function is enabled, which means that the eight left most pixels will be masked with the border color. You need to do this when you implement a horizontal scroll using register 26 and 27. The output for the eight left most pixels is not guaranteed when register 27 is not equal to zero. Please note that in screen 6 and 7, sixteen pixels will be masked in stead of eight.

SP2: Screen size bit
This bit sets the screen size for horizontal scroll. When SP2 is reset, the screen will have a size of one page. Everything dissapearing at the left hand of the screen will re-appear at the right hand side. When the bit is set, the screen will have a size of two pages. If the first page dissapears to the left of the screen, the second page will appear at the right hand side. Though, you must have selected an odd page number to use this functionality.

H08-H00: The horizontal scroll value
These bits are used to set the horizontal scroll value. On screen 6 and 7, the VDP scrolls with two pixels per unit. On the other screens, the VDP scrolls with one pixel per unit.
The horizontal scroll value must be split-up into two registers. Bit H08-H03 must be placed in register 26 and determine a shift of the screen to left. Bit H02-H00 must be placed in register 27 and determine a shift of the screen to the right. This makes setting the scroll value a little bit complicated. For example, to scroll the screen N pixels to the left under BASIC, you can use the following commands:

VDP(27)=(N+7)\8: VDP(28)=-N AND 7

This is the same as using the command:


Other programming languages, like assembler, do not have the SET SCROLL command. So, when using these languages you can use the method shown above.