Some info on the DAI Programmable Graphics Generator

This is a description of the DAI hardware. Not all 
possibilities are implemented in BASIC. 

The part of DAI memory that can be used for graphics
consists of interleaving bytes of the two upper memory banks,
bank B and C in the manual. The Graphics Generator reads
a byte from each bank simultaneously. So the graphics section
effectively has a 16-bit wide access.

Each line (two or more screen scan lines) as defined in the 
DAI graphics memory is preceeded by two control bytes. These
bytes have the following meaning:

Control bytes
-------------

High address byte (Mode byte)

Specify the horizontal and vertical resolution for this line
as wel as the colour depth.

bit  7 6 5 4 3 2 1 0
     | | | | | | | |
     | | | | +-+-+-+-- Line repeat count in scans 
     | | | |           for this line.  0000 = 2, 
     | | | |                           0001 = 4,
     | | | |                             .    .
     | | | |                           1111 = 32
     | | +-+---------- Resolution control in blobs 
     | |               (pixels) 00 =  88,
     | |                        01 = 176,
     | |                        10 = 353,
     | |                        11 = 528 
     | +-------------- Line mode control 
     |                 0 = graphics
     |                 1 = characters
     +---------------- Colour mode control 
                       0 = four colour mode,
                       1 = sixteen colour mode

Low address byte (Colour byte)

Update one of the four colour registers with a new colour or
specify a repeat of the previous line.

bit  7 6 5 4 3 2 1 0
     | | | | | | | |
     | | | | +-+-+-+-- Colour select (see table below)
     | | | |
     | | +-+---------- Register select 00 = background colour
     | |                               01 = foreground colour
     | |                               10 = alternate background colour*
     | |                               11 = alternate foreground colour*
     | +-------------- Line type 0 = 'unit colour mode' (repeat previous line)
     |                           1 = new line definition
     +---------------- Enable colour change 0 = ignore bit 0-5
                                            1 = interpret bit 0-5

 0 Black           8 Grey
 1 Dark Blue       9 Middle Blue
 2 Purple Red     10 Orange
 3 Red            11 Pink
 4 Purple Brown   12 Light Blue
 5 Emerald Green  13 Light Green
 6 Kakhi Brown    14 Light Yellow
 7 Mustard Brown  15 White

*) accessible by POKE and machine language routines, not by BASIC.

Data bytes
----------

Four colour graphics mode

The combination of the two equal numbered bits in the high and low address
byte select one of four colour registers. 

Sixteen colour graphics mode

The high address byte specifies for eight blobs to have the foreground colour
(1) or background colour (0). The upper nibble of the low address byte specifies
the foreground colour, the lower nibble the background colour.

Character mode

For character mode the line repeat count should be at least eleven.

The high address byte contains the ASCII value of the character which is converted
to blobs and lines with a character generator.

The low address byte contains the colour information, not of the corresponding
character, but of the previous character.
In four colour mode this can lead to vertically striped characters, using the
primary foreground and background colours..
In sixteen colour mode the low address byte works as in the graphics mode.

The table below summarizes the effect of CONTROL BYTES. 
Control Display Colours Resolution Bytes to new Data and Visible fields** Used in bytes control byte col. bytes and blobs mode 0x 40 GRAPHICS 4 LOW 24 11 11 - 88 2,2A 1x 40 GRAPHICS 4 MEDIUM 46 22 22 - 176 4,4A 2x 40 GRAPHICS 4 HIGH 90 44 44 - 352 6,6A 3x 40 GRAPHICS 4 SUPER 134 66 66 - 528 8,8A 4x 40 CHAR 4 LOW 26 12 10 - 87 5x 40 CHAR 4 MEDIUM 48 23 21 - 173 6x 40 CHAR 4 HIGH 90 44 43 - 345 7x 40 CHAR 4 SUPER 134 66 64 - 519 8x 40 GRAPHICS 16 LOW 24 11 11 - 88 1,1A 9x 40 GRAPHICS 16 MEDIUM 46 22 22 - 176 3,3A Ax 40 GRAPHICS 16 HIGH 90 44 44 - 352 5,5A Bx 40 GRAPHICS 16 SUPER 134 66 66 - 528 7,7A Cx 40 CHAR 16 LOW 26 12 10 - 87 Dx 40 CHAR 16 MEDIUM 48 23 21 - 173 Ex 40 CHAR 16 HIGH 90 44 43 - 345 Fx 40 CHAR 16 SUPER 134 66 64 - 519 ************************ UNIT COLOUR MODE ***************************************** 0x 00 GRAPHICS 4 LOW 2 1 11 - 88 1x 00 GRAPHICS 4 MEDIUM 2 1 22 - 176 2x 00 GRAPHICS 4 HIGH 4 1 44 - 352 3x 00 GRAPHICS 4 SUPER 4 1 66 - 528 4x 00 CHAR 4 LOW 2 1 11 - 88 5x 00 CHAR 4 MEDIUM 2 1 22 - 176 6x 00 CHAR 4 HIGH 4 1 44 - 352 7x 00 CHAR 4 SUPER 4 1 66 - 528 8x 00 GRAPHICS 16 LOW 2 1 11 - 88 9x 00 GRAPHICS 16 MEDIUM 2 1 22 - 176 Ax 00 GRAPHICS 16 HIGH 4 1 44 - 352 Bx 00 GRAPHICS 16 SUPER 4 1 66 - 528 Cx 00 CHAR 16 LOW 2 1 11 - 88 Dx 00 CHAR 16 MEDIUM 2 1 22 - 176 Ex 00 CHAR 16 HIGH 4 1 44 - 352 Fx 00 CHAR 16 SUPER 4 1 66 - 528 **) a field is the number of blobs controlled by a pair of bytes from memory. In all modes there are 8 blobs in a field.

This article is based on the DAI Personal Computer Reference Manual and an article in DAInamic 13 written by N.P. Looije (english translation in DAInamic 18).