Product specifications

Allocating 1K bytes for the sprite generator table as BASIC does is a compromise. The
VRAM set up as BASIC creates, it means that to switch from text mode to graphics 2
mode and vice versa it is only necessary to change two VDP write-only registers, a
process which takes a little over 20 micro-seconds (20 1/100 thousandths of a
second).
This is how you can switch from one mode to the other without affecting the integrity of
either screen in any way. The tables are held separately, and when the modes are
switched, are left intact because they have clearly defined separate boundaries within
VRAM.
In graphics 2 mode each byte of the pattern colour table provides a foreground and
background colour for the corresponding byte in the pattern generator table. Byte 0 of
the pattern colour table maps directly onto byte 0 of the pattern generator table. Byte 1
onto byte 1. Byte 2 onto byte 2 and so on. Assuming the pattern generator table is
located at 0K and the pattern colour table at 8K, to discover which pattern generator
byte is coloured in by which colour byte all we need to do is add an offset which is
equal to the distance between the two tables to find the desired VRAM address. In this
case the offset is 8192 Dec (£2000 Hex).
The mapping scheme below shows how the coloured patterns are actually mapped
onto the display screen.
^ (Illus 3 – Diagram of mapping scheme)
In order to access this mapping scheme, the pattern name table needs to be initialised
correctly. In order for the first pattern character block to map onto the first character
cell on the screen and the second pattern character block to map onto the second
character cell on the screen and so on, screen position 0 must contain 0, screen
position 1 must contain 1, up to screen position 255 which must contain 255.
This however only accounts for the top third of the screen, what of the other two
thirds?
Internally the VDP segments the pattern generator, pattern colour and pattern name
tables, into three equal blocks of 2048, 2048 and 256 bytes respectively. Character
labels in the upper third of the screen automatically correspond to the character
patterns in the upper third of the pattern generator table. Labels in the middle third of
the screen correspond to the character patterns in the middle third of the pattern
generator table, and labels in the lower third of the screen correspond to the character
patterns in the lower third of the pattern generator table.
The second and third blocks of the screen are mapped onto the related character
patterns in the pattern generator table on the basis of position, therefore, in order to
fill the second and third parts of the screen with the correct labels we load position 256
with 0 through to 511 with 255, and position 512 with 0 through to 255.
The correct start label values for the second and third block of the screen of 256 and
512 respectively are added by the VDP.
Assuming that we have located our pattern name table at 15K, then the assembler
code routine which will set up the screen correctly is shown below. The routine uses
the VRAM I/0 routines described in section 1.5 and 1.6