14.
PROGRAMMABLE GRAPHICS GENERATOR
Introduction
The programmable video graphics + character system makes use of a scheme of variable length data to give efficient use of memory when creating pictures. A few definitions are necessary before further examination of the scheme.
15.
The picture is defined by a number of lines, one after another down the
screen. Each line is independent of all others and may be in any of the
possible modes.
At the start of each line two bytes are taken from memory which define
the mode for that line, and may update the colour RAM two bytes. These
are called respectively the Control and Colour Control bytes. The rest
of each line is colour or character information, and the number of bytes
used for it is a characteristic of the particular mode. (see example
programs).
The screen can operate at a number of different definitions horizontally
(e.g, blobs/scan). In the highest definition graphics mode there are
352 visible blobs across the screen. The two lower definitions have
respectively 1/2 and 1/4 of this number. There are about 520 scans
visible on a "625 line" television, and the screen hardware can only
draw (at minimum) Z scans per line, due to the interlacing. This gives
a maximum definition of 260 by 352 which is close to the 3:4 ratio of the
screen sides. Thus circles come out round !
Characters are fitted onto this grid by using 8 columns of blobs per
character, the dot positions being defined for each character by a ROM.
This allows 44 characters per line maximum (or 22/11 in lower
definition modes).
A fourth horizontal definition provides for a "high density" character
mode with 66 characters/line.
A total of 16 different colours, including white and black can be displayed
by the system. Whenever a 4 bit code is used to describe a colour, it
selects from this range of possibilities. In some modes (characters +
or four colour graphics) a set of 4 of these colours (not necessarily
distinct) are loaded into a set of "colour registers". Any 2 bit code
describing a colour selects an entry from these registers.
Vertical definition is set by a 4 bit field in the control byte. In graphics
modes this simply allows repetition of the information to fill any even
number at scans from 2 to 32, In character mode it defines the number
of scans occupied by each line of characters; thus the vertical spacing
on the screen can be changed to allow anything between an 8 x 7 (the
sensible minimum) and 8 x 16 character matrix, giving between 35 and
16.
15 lines of characters on the screen.
Arrangement of information in memory
The first byte of information for the screen is located at the top of an 8K or 32K block of memory. Successive bytes follow at descending addresses The screen takes memory and displays a picture on the screen accordingly until the whole screen has been filled. It then starts again at the first byte.
Screen Data Format
At the beginning of the data for each line, two bytes of data represent the lines control word. The control word defines the raster scan depth of the line, the horizontal graphical resolution of the line and selects the display mode of that particular line. Subsequent to this control word a number of data words are stored that represent the colour of pixels,or definition and colour of characters according to the selected display mode.
Control Word Format
Bits 7,6 5,4 3,2,1,0 | | | | | +---- Line Repeat Count | +---- Resolution Control +---- Display Mode Control
17.
Line Repeat Count
The line repeat count controls the number of horizontal raster scans for which the same data will be displayed, Since interlace of the TV scan is ignored a minimum of two raster scans correspond to a line repeat count of zero. Thereafter, each additional repeat adds two scans to the line. The maximum programmable depth of any horizontal display segment is thus 32 scans. (European TV sets will show approximately 520 scans total for a full picture),
Resolution Control
The resolution control bits allow selection of one of four different horizontal definitions for display of data on the TV screen for each individual line.
Code (Bit 5, Bit 4) | Definition (pixels per screen width) |
00 | 88 (Low definition graphics) |
01 | 176 (Medium definition graphics) |
10 | 352 (High definition graphics) |
11 | 528 (Text with 66 characters per line) ( Screendriver uses 60 characters for text). (Could be used for a very high definition graphics mode). |
Mode Control
The mode control bits determine how data will be used to generate the picture for that particular segment.
Code (Bit 7, Bit 6) | Display mode |
00 | Four colour graphics |
01 | Four colour characters |
10 | Sixteen colouz graphics |
11 | Sixteen colour characters |
18.
Low Address Byte (Colour type)
The Low Address control byte is used to store colours into a set of 4 "colour registers" for the four colour mode. Any one of the four colours in the registers can be changed at the beginning of any line of display data, Only the colours in these registers can be displayed in any 4 colour mode. The four colours are freely selectable from the sixteen colours defined in Colour Select Table.
Bits 7 6 5,4 3,2,1,0 | | | | | | | +---- Selection of one of sixteen colours. | | +---- Select one of four colour registers to update. | +---- If unset, force 'unit colour mode' (see 3.2.2.4) +---- Set to enable colour change. If unset, bits 0 to 5 are ignored.
Code | Code |
0 | Black |
1 | Dark blue |
2 | Purple Red |
3 | Red |
4 | Purple Brown |
5 | Emerand Green |
6 | Kakhi Brown |
7 | Mustard Brown |
8 | Grey |
9 | Middle Blue |
10 | Orange |
11 | Pink |
12 | Light Blue |
13 | Light Green |
14 | Light Yellow |
15 | White |
19.
Data Mode
Four Colour Mode
In this mode only two bits of data are required to define the colour of a pixel. These data bits are obtained in parallel from the upper and lower bytes of each data word using the high order bits first. The 2 bytes in a field are considered as 8 pairs of bits, Each pair sets the colour for one spot.
HIGH +----+----+----+----+----+----+----+----+ ADDRESS | B7 | | | | | | | B0 | A1 \ BYTE +----+----+----+----+----+----+----+----+ | +- pairs of bits used | to address colour LOW +----+----+----+----+----+----+----+----+ | RAM. ADDRESS | B7 | | | | | | | B0 | A0 / BYTE +----+----+----+----+----+----+----+----+ ^ ^ Leftmost spot Rightmost spot
The 2 bits for each spot select one of the four colours which have been loaded into the colour RAM by previous Colour Control bytes. So on any line 4 colours are available. On the next line any one of these may be changed for another, and so on.
Sixteen Colour Mode
This graphics mode is designed to allow multi-colour high definition pictures in half the memory requirement of other systems. The basic organization is that the low address byte selects two of the sixteen possible colours.
Bits 0 - 3 "Background" colour. Bits 4 - 7 " Foreground" colour.
20.
The high address byte than defines by each successive bit whether a colour blob should be foreground or background.
NB
The two bytes in the field serve different purposes, one being used to define two available colours for use in the field, and the other to choose one of these for each spot.
HIGH +----+----+----+----+----+----+----+----+ ADDRESS | B7 | | | | | | | B0 | BYTE +----+----+----+----+----+----+----+----+ ^ ^ leftmost 1 bit 0 bit rightmost blob | | blob LOW +----+----+----+----+----+----+----+----+ ADDRESS | B7 | | | | | | | B0 | BYTE +----+----+----+----+----+----+----+----+ "Foreground | "Background colour" colour"
The bit for each spot can select either the "foreground" or the "back- ground" colour. However, what these colours are is totally independent of the preceding or following fields. So any line may use any and all of the total 16 colours. The contents of the colour RAM are irrelevant in this mode.
One additional feature is added to eliminate restrictions of the scheme. After each eight bit field of colour the background is extended into a new area, even if a new background colour is specified, until the new foreground is first used. It is therefore possible to create a required picture by suitable combination of foreground and background.
Character Mode
In this mode, characters are generated using a character generator ROM in conjunction with the four colour registers or using any 2 colours for each in the 16 colour character mode.
21.
The usual character matrix is 6 x 9 bits out of a possible 8 x 16. Therefore the line repeat count should be at least eleven, to guarantee full character display plus line spacing. Four colour characters are produced on the screen in a way similar to the four colour graphics mode, but with the character ASCIV data replacing the high address data byte used for four colours. The result is that characters are displayed using colours from the four colour registers. The data from the character generator ROM control the lower address bit and bits from the low-address byte determine the other. This allows characters on a single horizontal display segment to be in one of two colour combinations of character/background, or even with a vertical striped pattern controlled by the low address byte. However, note that as compared with four colour mode information (but not the low-address byte) is subject to a one character position delay before appearing on the screen.
In character mode the height of the characters is a set number of horizontal scans. The character width is determined by the definition selection in the control byte. A definition of 352 yields 44 characters per line, 528 hields the normal 66 characters per line. Other definitions are possible and they yield wide characters, useful as large capitals in applications such as the power-on message. However, this feature is not supported by the resident BASIC.
Special characters:
CR | Terminates a line of characters and positions the cursor at the first position of next line. If necessary, the screen is "rolled up" to make room. |
FF | Fills the character area with spaces and positions the cursor at the start of the tope line on the screen. |
BS | If the current line has some characters on it, then the cursor is moved back to the previous position and the character there is replaced by a space. |
22.
23,
CHANGING LINE BACKGROUND OR LETTERS COLOR ON ONE LINE
Line 1 Control byte is located at address XFEF and line 1 Color Control byte address at XFEE (X being 1 for 8K machine, 7 for 32K machine, B for 48K machine). The first character byte of line I is located at line 1 Control byte address minus 2, and the character Colour Control byte at line 1 Control byte address minus 3. Each of the 66 positions of the screen is located at line Control byte - (2* position of character on the line) for the character and at line Colour Control byte - (2* position of character on the line) for the Colour Control byte of the character. Remember that there are 66 character positions on the screen but that the first and last three characters are kept blank for the margins. Therefore the Control byte for the next line is located at Control byte of previous line (i, e. XFEF) less 134 bytes (#86. So if the Control byte of line I is a BFEF, the Control byte of line 2 will be at # BFEF - # 86 = # BF69.
+----+----+----+----+----+----+----+----+------------//------------+----+----+ | | | | | | | +----+----+----+----+----+----+----+----+------------//------------+----+----+ Control first (character 66 may not be 2 character fully transmitted by hardware)
Examples:
Control Byte Line 1 | #BFEF | ||
Control Byte Line 5 | #BFEF - (# 86 * 5) | = # BDD7 | |
Colour Control byte Line 5 | = #BDD6 | ||
Character N° 6 on Line 5 | # BDD7 - 6 * 2 | = #BDCC | |
Colour Character 6 of Line 5 | = #BDCB |
(see VIDEO RAM TABLE and examples I and 2)
Use the POKE in your program for changing line background, letter colour, or letter, and Utility 3 for checking the location you intend to POKE (when you return to BASIC the colour changes you made in Utility mode are erased if you enter MODE I, RETURN, MODE 0.
24.
Example COLORT 8 0 5 10 POKE #BA2D,,#DA (Will change colour of latter from black to colour 10 on line 12) POKE#BA2D,#C3 (Will change background frorn 8 to 3) The locations from #x350 to #x35F and #xFF0 to #xFFF z = 1 FOR 8K RAM, x = 2 FOR 12K, x = 7 FOR 32K, x = B FOR 48K control the screen background and forground colours Example COLORT 0 15 7 8 00 00 B8 3F 00 00 A7 3F 00 00 9F 3F 00 00 80 3F 00 00 B8 36 00 00 A7 36 00 00 9F 36 00 00 80 36 *POKE#735A,#90:POKE#7FFA,#90:POKE#735E,#80:POKE#7FFE,#80 You will see the screen black and the letters black the # numbers 90 and 80 can be replaced by any # number from #90 to #9F and #80 to #8f
25.
26.
VIDEO RAM TABLE
Line N° | Start Address of Line (in Hex) |
Line Colour Control byte Address (in Hex) |
1 | XFEF | XFEE |
2 | XF69 | XF68 |
3 | XEE3 | XEEZ |
4 | XE5D | XE5C |
5 | XDD7 | XDD6 |
6 | XD51 | XD50 |
7 | XCCB | XCC4 |
8 | XC45 | XC44 |
9 | XBBF | XBBE |
10 | XB39 | XB38 |
11 | XAB3 | XAB2 |
12 | XA2D | XA2C |
13 | X9A7 | X9A6 |
14 | X921 | X920 |
15 | X89B | X89A |
16 | X815 | X814 |
17 | X78F | X78E |
18 | X709 | X7p8 |
19 | X683 | X682 |
20 | XSFD | X5FC |
21 | X577 | X576 |
22 | X4P1 | X4F0 |
23 | X46B | X46A |
14 | X3E5 | X3E4 |
X=1 FOR 8K MACHINE, X = Z FOR 12K, X = 7 FOR 32K, X=B FOR 48K
27.
Unit colour mode
This mode is available for space saving during uniform scans of the picture. A horizontal band of constant colour (or repeated pattern) can be drawn using only one control word and one data word. The data for this mode should be in high speed format. Using this mode a full screen of data need be no more than 40 bytes of ram.
Video Interface
The television interface is realized such that a separate adaptor module plugs into the fundamental logic to realize normal Black and White interface, standard colour modules of PAL, SECAM or NTSC and video monitors. Other video interfaces are easily realizable by construction of an adaptor that plugs into the video interface connector of the DAI personal computer.