Classic Computer Magazine Archive HI-RES VOL. 1, NO. 1 / NOVEMBER 1983 / PAGE 37

Graphic Evidence

by Tim McGuinness


Welcome! Welcome to Hi-Res, and to my first column. We'll meet here in each issue to open a new world in computer graphics. Generally, I'll cover various aspects of creating graphics in your Basic programs. I'll take some space to review utilities and tools that can simplify many of the difficult jobs when you create screen images. In addition the column will deal with exceptional games which break new ground in graphic displays.

Some Basic Commands

Atari Basic, unlike other Basics, offers a wide range of commands to make its graphics relatively easy to use. The first of these commands is the Setcolor. This command in a Basic statement allows you to select one of the 256 available colors. It's used in combination with a color register numeral. There are five of these registers available in Basic, and depending upon which Graphic Mode the system is in, it is possible to use from two to five registers to color objects on the screen.

Before we go on, let's look at a Color Register. A color register tells the Atari in which part of the screen or "playfield" the color you selected is to be put.

Let's try something. When the system is first turned on with the Basic cartridge installed, the display is in the Atari Graphics Mode 0. In Mode 0, two color registers are available for use in the playfield, and one for the border. The background is blue, the letters are light-blue and the border black. In Atari Basic, type the following program.

10 FOR I=0 to 255: SETCOLOR 2,I/16,I-I/16:NEXT I

Type RUN. The program is changing the background color, while leaving the letters and borders unchanged. Note also, that you used the Setcolor command.

Now we will change the program to cycle or rotate the colors of the letters displayed on the screen. Change the Setcolor command to the following; SETCOLOR I,I/16,I-I/16. Type RUN, and observe the new program. This time we changed the color of the letters. However, because of the way the Atari uses Mode 0, we only saw the letters change in brightness.

Try one more variation using the border. First, press the System Reset key to return the screen to normal. Now retype the above program, changing the Setcolor command to the following: SETCOLOR 4,I/16,I-I/16. This will rotate the colors of the border. As you see, the color register number selects that area of the screen that the Setcolor command is to change. Here we used registers 1,2, and 4; but in other Modes we could use all five (0 through 4).

In the above program we used two other features of the Setcolor command, color hue and color luminance. These were indicated by I/16 and I-I/16. As stated, the Atari hits 256 colors available. However, when using the Setcolor command, we first have to divide these 256 into 16 hues and 15 luminances, that is, 0 through 15 hues, and 0 through 14 luminances. Type the following to change only the hue of the background:

10 FOR I=O T0 15:SETC0L0R 2,I,8:FOR J=1 TO 100:NEXT J:NEXT I

Here the "I" in the Setcolor command changes only the hue. The "I" is replaced by number from 0 to 15. To change only the luminance, change the command to the following: SETCOLOR 2,8,I. Note the F0R J/NEXT part of the program just adds a delay. To find what registers are available for any given Graphics Mode, refer to the chart below.

The Graphic Mode

I've been talking about Atari's Graphic Modes since the start of the column; it's time I explained them. The Graphics Mode defines what kind of screen we wish to use, that is, a character screen, a large character multi-colored screen, a point-plotting screen, etc. The mode number controls the screen display. In the above chart, we listed the Setcolor command for each mode; now let's look at each mode. The format for this command is as follows:

5 GRAPHICS 4

or

5 GRAPHICS 4+16

Mode 0 (zero) is the standard default mode. That is, when the system is turned on, Mode 0 is set. This mode is a text mode, and can display 24 lines of 40 characters each on the screen. Its default colors are shown in the above chart.

Mode 1 is a split-screen text mode. If you enter the command GRAPHICS 1, the computer displays a small strip at the bottom which is actually a Mode 0 area. The Mode 1 area with a black background is above. This Mode 0 area is called a text window; it's used to type commands. You'll find this window in a number of Graphics Modes, since many modes require special commands or formats in order to enter data into the region above the window.

If you want to eliminate the window, add the value 16 to the number following the Graphics command. GRAPHICS 1 + 16 or GRAPHICS 17 displays only Mode 1 on the screen. In this mode, the system can display characters in any of four colors, with 20 lines, of 20 characters each.

Mode 2 is also a text mode that displays up to four colors of text. In this mode the size of the characters is larger, so fewer fit on the screen. In Mode 2 you can display only 10 lines of 20 characters. The text window appears in this mode as well.

Mode 3 is the first of the true graphics or plot modes. Like Modes 1 and 2, Mode 3 has the text window, but in the area above, instead of characters, you can plot points or draw lines using graphics pixels. Each pixel in this mode is large. There are 20 rows of 40 pixels, a total of 800. Mode 3 allows you to use up to four colors.

Mode 4 also has it text window. In this graphics mode the pixels are smaller than in Mode 3. There are 40 rows of 80 pixels each, a total of 3200 pixels. In this mode only two colors are available. One to Plot and one for the background.

Mode 5 is the same as Mode 4, but has two more colors available (see chart).

Mode 6 contains even smaller pixels, which allow far more detailed drawing of graphics than in the previous modes. There are 80 rows of, 160 pixels each, for a total of 12,800 pixels. Like Mode 4, this is a two-color mode.

Mode 7 produces the same size pixels its Mode 6, but like Mode 5, this is a four-color mode.

Mode 8 is the highest resolution graphics mode. In this mode, your Atari can display its greatest detail. There are 160 rows, of 320 pixels each, for a total of 51,200 pixels. This is only a two-color mode, but, as we will see in future columns, there are ways of giving more color to even a two-color mode.

In the next issue of Hi-Res, we will continue our discussion of the Atari graphics. However, for those beginners interested in some other useful literature, try Understanding Atari Graphics by Michael Boom, Alfred Publishing Co., Your Atari Computer by Ion Poole, Osborne/McGraw-Hill, or Atari Games & Recreations by Kohl, Kahn, Lindsay, and Cleland, Reston Publishing Co., Inc.

Setcolor Command Chart

NORMAL
COLOR
GRAPHICS
MODE
COLOR
REGISTER
PLAYFIELD
RESPONSE

LT. BLUE
BLUE

BLACK
ORANGE
LT.GREEN
BLUE
RED
BLACK
ORANGE
LT.GREEN
BLUE

BLACK
ORANGE



BLACK

LT. BLUE
BLUE

BLACK
MODE 0
MODE 0
MODE 0
MODE 0
MODE 0
MODE 1 & 2
MODE 1 & 2
MODE 1 & 2
MODE 1 & 2
MODE 1 & 2
MODE 3, 5, 7
MODE 3, 5, 7
MODE 3, 5, 7
MODE 3, 5, 7
MODE 3, 5, 7
MODE 4 & 6
MODE 4 & 6
MODE 4 & 6
MODE 4 & 6
MODE 4 & 6
MODE 8
MODE 8
MODE 8
MODE 8
MODE 8
0
1
2
3
4
0
1
2
3
4
0
1
2
3
4
0
1
2
3
4
0
1
2
3
4
NONE
CHARACTER LUMINANCE
BACKGROUND COL/LUM
NONE
BORDER COL/LUM
CHARACTER COL/LUM
CHARACTER COL/LUM
CHARACTER COL/LUM
CHARACTER COL/LUM
BORDER COL/LUM
POINT COL/LUM
POINT COL/LUM
POINT COL/LUM
NONE
BORDER COL/LUM
POINT COL/LUM
NONE
NONE
NONE
POINT/BACKGROUND/BORDER COL/LUM
NONE
POINT LUMINANCE
POINT BACKGROUND/COLOR/LUMINANCE
NONE
BORDER COL/LUM

Tim McGuinness has a number of magazine articles to his credit. He'll be writing a graphics column each month for Hi-Res. He lives in Milpitas, California and is the director of software development at Romox, Inc.