Product specifications
It can be seen that bits 7 and 6 MUST be set to 1 and 0 respectively. These are the
active control bits in this byte and tell the VDP that the previously transmitted data
byte is to be directed into one of the write-only registers. Bits 5,4,3 MUST be set to
zeroes. The number of the destination register is indicated by bits 2,1,0.
Both data transfers and control bytes directed to the VDP write-only registers must be
output via port 2.
Example 1.
Assuming we are in text mode, the foreground and background colour is determined
by write-only register 7. To alter the foreground colour to black and the background
colour to white we could use either one of the two sections of code listed below.
The way in which VDP register 7 works is described in section 2.3 register 7.
In BASIC.
100 COLOUR 1,1 : COLOUR 2,15
Which will perform the same job as the assembler code listed below.
LD DE,£071F ;Register D = Write only reg
;destination ie integer X
; 0 =< X =< 7
;Register E = Data byte
CALL VOUTRG ;Output data byte to write only register
;
;VOUTRO-OUTPUT A DATA BYTE TO A SPECIFIED REGISTER
; REGISTER DESTINATION HELD IN D
; DATA BYTE HELD IN E
; DE MUST HOLD VALID CONTENTS ON ENTRY
; NO REGISTERS AFFECTED ON EXIT
VOUTRG: PUSH AF ;Save Acc and flags
LD A,E ;Get data byte
OUT (2),A ;Output data byte
LD AA ;Get control byte
AND 7 ;Set up correct control bits
OR 128 ;Set bits 6,5,4,3 to zero
OUT (2),A ;Output control byte
POP AF ;Get old acc and Flags
RET ; Return to calling routine
How BASIC initialises the
2.3
When the MTX is switched on and the VDP write-only registers are set-up for the first
time, it is necessary to set and reset write-only register 0 to 'wake up' the VDP chip
and then to set up all of the other registers correctly.