GTIA Modes

Phil Griffin

 

Issue 2

Feb/Mar 83

Next Article >>

<< Prev Article

 

 

When the basic Manuals were written the Atari computers were capable of only 9 graphics modes (Modes 0 to 8) available directly from Basic. With the introduction of the GTIA (George's Television Interface Adaptor) chip to replace the old CTIA chip, the computers now have the added facility of Graphics Modes 9, 10 & 11. This fact is reasonably well publicised but there's not a lot of literature around to tell you how to use these modes. The object of this article is to give a brief explanation of what the 3 extra graphics modes are capable of and how to use them.

All 3 modes have a resolution of 80 horizontal points (0 to 79) by 192 vertical points (0 to 191). They all respond to PLOT, DRAWTO and XIO (fill) instructions. Although modes 9 and 11 are relatively straightforward to use, mode 10 is a little more tricky.

GRAPHICS MODE 9

In this mode you are able to plot points in a single 'line' with up to 16 variations in luminance (brightness) which is ideal for 3-D light and shade drawings. The default colour setting for the background Is black and the luminance of the points to be plotted is set with the COLOR command (COLOR 0 to 15) immediately prior to plotting. Plotting in COLOR 0 effectively plots the background colour (black) while COLOR 15 plots in white. Running Program 1 will show the range of luminances available.

Program 2 is a modified version of the 'cylinders' program which appeared in Issue 1 of PAGE 6 and is included as a demonstration of the effects available with mode 9. You will see that the overall colour of the display can be altered by using the SETCOLOR command (SETCOLOR 4, (hue) 0). The 'hue' is selected from the range of 16 colours available and the values to set the 'hue' are shown in Table 1.

Program 1

AtariLister - requires Java

Program 2

AtariLister - requires Java

GRAPHICS MODE 11

In many respects this mode is the opposite of mode 9. You are able to plot points in any of the 16 'hues' but at a single selectable luminance. The colour is set with the COLOR command (COLOR 0 to 15) immediately prior to plotting the points. Substituting 'GRAPHICS 11' for 'GRAPHICS 9' in program 1 will show the range available in default colours (see table 1). Plotting in COLOR 0 again effectively plots in the background colour (black). The luminance of the colours displayed can be altered by using the SETCOLOR command (SETCOLOR 4,0, luminance). The values for the luminance setting are even numbers between 0 and 14.

GRAPHICS MODE 10

This is the tricky one. Graphics mode 10 is capable of producing 9 colours on the screen at the same time, each at a different luminance. Unfortunately not all of these colours can be called directly from Basic by the COLOR and SETCOLOR commands and in order to use the full colour capabilities, you need to be familiar with how the SETCOLOR command works within a color register.

The SETCOLOR statement contains - Specific references to a colour register, a 'hue' and a luminance for that hue. The computer then converts this information into a memory location for the colour register and a single value for the hue and luminance selected. This value is then automatically 'poked' into the colour register memory location. The basis for calculation of the value to be poked is:

POKE value = ('hue' value*16)+ luminance value

Table 1 shows the range of values that the 'POKE' value can have together with the equivalent hue and luminance figures.

COLOR (HUE)

HUE VALUE (SETCOLOR)

LUMINANCE (EVEN VALUES)

POKE (EVEN  VALUES)

 

 

 

 

Black-white

0

014

 014

Gold

1

014

16-38

Orange

2

014

32-46

Red

3

014

48-62

Pink

4

014

64-78

Violet

5

014

80-94

Blue-purple

6

014

96-118

Blue

7

014

112-126

Light-blue

8

014

128-142

Blue-green

9

014

144-158

Aqua

10

014

168-174

Green-blue

11

014

176-198

Green

12

014

192-206

Yellow-green

13

014

208-222

Orange-green

14

014

224-238

Orange

15

014

240-254

TABLE 1: SETCOLOR VALUES AND EQUIVALENT POKE VALUES

The Atari computer uses 5 color registers (0 to 4) within Its operating system and these have default settings as shown in Table 2.

REGISTER NUMBER

SCREEN COLOUR

DEFAULT HUE

VALUES LUM

MEMORY LOC.

 

 

 

 

 

0

Orange

2

8

708

1

Aqua

12

10

709

2

Blue

9

4

710

3

Light red

4

6

711

4

Black

0

0

712

TABLE 2: COLOUR REGISTERS WITH DEFAULT VALUES

Instead of using a SETCOLOR Statement, Its possible to by-pass the Basic commands and POKE a combined colour value directly into the colour register memory location. Some examples of direct 'POKEs' with their SETCOLOR equivalents are shown below.

  POKE           SETCOLOR

  708,34          SE.0,2,2

  710,142        SE.2,8,14

  712,52          SE.4,3,4

You should now have a reasonable idea of how to set the colour within a color register by POKEing a value directly into the register memory location.

If you now substitute 'GRAPHICS 10' for 'GRAPHICS 9' and '8' for '15' in line 20 of program 1 you will find that the screen contains 4 coloured bands. These correspond to COLOR statements 4 to 7 and show their default colours. The program has in fact drawn 9 bands of colour but 5 of them are set to the default colour of black. The position is summarised in Table 3.

You can see from Table 3 that the only way to alter the colours plotted in COLOR statements 0 to 3 is to POKE values directly into the memory locations shown. The other COLOR statements can have their colours changed by using the SETCOLOR command, but its probably better to keep to the POKE instruction throughout.

COLOR

SETCOLOR REGISTER

DEFAULT COLOUR

MEMORY LOC.

 

 

 

 

0

N/A

Black

704

1

N/A

Black

705

2

N/A

Black

706

3

N/A

Black

707

4

0

Orange

708

5

1

Aqua

709

6

2

Blue

710

7

3

Light red

711

8

4

Black

712

Note: Memory location 704 controls the background colour

TABLE 3: COLOR STATEMENTS IN GRAPHICS MODE 10

In summary then, graphics displays using mode 10 require the following steps.

1) The selection of the colours required.

2) The setting (at some stage in the program) of each selected colour to its own COLOR statement by using POKE instructions.

3) The plotting of points using the relevant COLOR statements

That really concludes this introduction to the world of GTIA. The addition of the new graphics modes gives Atari users even greater flexibility in their approach to graphics displays. In particular, Graphics Mode 10 opens up the possibility of high speed colour animation simply by moving colours through the colour registers. Finally, don't be afraid to experiment with these modes. You can't do any harm to the computer if you make mistakes, but you can learn an awful lot. If you come up with some interesting graphics displays using these modes send them in.

Just to give you a starter in the possibilities of animation try making these changes to program 2 - LINE 20 change 'GRAPHICS 9' to 'GRAPHICS 10'. LINE 30 change 'GOTO 10' to 'GOTO 200' and add line 200 :-

200 P=PEEK(708): POKE 708,PEEK(709): POKE 709,PEEK(710):POKE 710,PEEK(711): POKE 711,PEEK(712):POKE 712,P:GOTO 200

top