Classic Computer Magazine Archive COMPUTE! ISSUE 50 / JULY 1984 / PAGE 115

Atari Artist

Andrew S. Katz

With this program, you can place shapes of any size, orientation, or color anywhere on the screen. Use the joystick to create the shape, and change its color with the press of a single key.

In spite of its simplicity, "Atari Artist" can be used to draw complex designs as well as realistic scenes. Draw a circle inside a triangle inside a circle, and so on. Piece together a house in the midst of a forest. Then store your art on disk or tape.

Atari Artist comes in two versions. Version 1, a four-color version, has a blue status window and runs in 16K. Version 2, a 16-color GTIA version, has a gray status window and needs 24K to run.

To use this program, you'll need a joystick plugged into port 1. Be sure to have a cassette recorder or disk drive attached if you wish to LOAD and SAVE copies of your designs. When you first RUN the program, the title screen will appear. It will give you information about the keys' uses. At this point, you may wish to select a version. Version 1 is set up by default. If you wish to use Version 2, press and release the joystick button. The number 2 should replace the 1 after the word version. Press the button again to return to Version 1.

Once you've selected the version, move the joystick. If you have selected Version 2 and the message ERROR 147 ON LINE 1000 is on the screen, your Atari does not have enough memory for Version 2. Type RUN again, and this time use Version 1.

Marking The Shape

After several seconds the play screen will appear. All three markers are on top of one another at the top of the screen. Notice the two-line status window at the bottom of the screen.

To move a marker, push the joystick in the direction you want the marker to go. It should respond instantly. The marker you are moving is called the current marker and is indicated by a pinkish tint. The other two markers are white. The markers may move anywhere on the screen, including the hidden area behind the status window. If you try to move it off the screen, the marker will stop at the screen's boundary.

To control the other markers, release the joystick and press the joystick button. Notice that MARKER # lights up in the status window. This is to show you that you are in the process of picking a new current marker. Release the joystick button. MARKER # is no longer lit up, but the number beneath it has changed. It has increased by one, or cycled back from 2 to 0. Also, a different marker now has a pinkish tint. That's the marker that now responds to the joystick. Very soon, you will find the movement of the markers and the switching between them to be quite simple.

Change The Marker Speed

The speed at which the joystick moves the markers across the screen can be changed. Speeds range from 1 to 9. Speed 1 is normal, Speed 2 is twice as fast, and so on up to Speed 9, which is nine times as fast as Speed 1. The higher speeds do not permit you to stop at every point on the screen. These high speeds are used to get across the screen quickly, or to assist in more advanced drawing. To change speed, press the joystick button and move the joystick.

Notice that the highlighted item in the status window changed from MARKER # to SPEED. Move the joystick toward you to decrease speed or away from you to increase speed. You will see the number under SPEED in the status window change as you move the joystick. When you've reached the desired speed, release the joystick button. Now when you use the joystick, it will move the current marker at the speed you set.

To change the color, release the joystick and press the OPTION key. Notice that in the status window COLOR has lit up. This is to show you that you are in the process of choosing the next color in the sequence. When you release the OPTION key, the next color is shown beneath COLOR. To step through the color sequence, repeatedly press and release OPTION. When the color sequence reaches the last color, it starts again from the first color (the one in effect when you first started). Each version has its own color sequence listed in the table. The colors you actually see may vary, depending upon your computer and the tint adjustment on your TV.

Drawing Colors

Version 1:

ORANGE

GREEN

BLUE

BLACK or erase

Version 2:

GOLD

ORANGE

REDORG (red orange)

PINK

PURPLE

VIOLET

STBLUE (steel blue)

BLUE

BYBLUE (baby blue)

TURQUO (turquoise)

GRBLUE (green blue)

GREEN

YELGRE (yellow green)

ORGGRE (orange green)

LTGREN (light green)

BLACK or erase

Two Fundamental Shapes

To change the shape, release the joystick and press the SELECT key. Notice that in the status window SHAPE has lit up. This is to show you that you are in the process of selecting the other fundamental shape. The two fundamental shapes are TRIANGL (triangle) and CIRCLE. Now, release the SELECT key. The shape underneath SHAPE has changed from TRIANGL to CIRCLE, or from CIRCLE to TRIANGL.

To draw a shape, just press START. The program will take control and draw the shape. When the drawing has completed, control over the keys and joystick returns to you. The amount of time it takes to draw a shape will depend upon its size. A circle takes more time than a triangle, and Version 2 is slower than Version 1. The shape shown under SHAPE is drawn and given the color shown under COLOR. If the shape is TRIANGL, the three markers are its corners. If the shape is CIRCLE, it is drawn using the markers as points along its circumference. As the shape is drawn, it covers (or erases) anything that was in its position on the screen.

SAVEing The Screen

To store the screen display on cassette or disk, or to reload a previously stored screen, press the OPTION and SELECT keys at the same time. The status window is then replaced with the first level of prompt. If you press RETURN, you'll get the status window back. You must press L for LOAD or S for SAVE. Other keys will be rejected and a buzz will sound. Do not press BREAK or SYSTEM RESET.

When you press S or L, the second level of prompt will be shown. Now, you must type a filename such as C for cassette or D:ANDY.GRT for disk. You cannot type more than 15 letters for a filename. Any additional letters or invalid keystrokes will be ignored. Mistakes can be corrected with the backspace key. After typing a filename, press RETURN. If no filename is shown, you will get the status window back. If the filename is invalid, you will see ERROR DETECTED TRY AGAIN for several seconds before the status window returns.

If the filename was correct and you have the disk or cassette set up, the SAVE or LOAD should proceed as explained in the tape or disk manual. When the SAVE or LOAD is complete or interrupted, the status window returns.

Keep The Versions Separate

During a LOAD, the second prompt will come with a warning to use files saved under the current version. A Version 2 screen loaded into Version 1 will result in some striped colors and height distortion. A Version 1 screen loaded into Version 2 will result in different colors and height distortion. Also, it will attempt to LOAD past the end of the file. During a LOAD you will see the screen fill from top to bottom.

Feel free to interrupt a LOAD by pressing BREAK. This is a way to merge the top of a SAVEd screen with the bottom of the current screen. However, pressing BREAK or SYSTEM RESET may cause the program to crash. If this happens, press SYSTEM RESET and type RUN.

Before drawing the shape, the program calculates the numbers it needs from the positions of the markers. For the purpose of positioning, the screen is treated as an X-Y grid with X,Y pairs for each separate point or pixel on the screen. The X can be thought of as column and the Y as row. The upper left corner of the screen is assigned 0,0 and the lower right corner is assigned 159, 79 (79, 159 in V2). Then it uses the numbers to draw the shape one row at a time.

Creating A Triangle

Lines 507-540 contain the triangle predrawing section. Line 510 finds the highest (A), middle (B), and lowest (C) markers by comparing the markers' Y coordinates. Line 1550 has the six possibilities for three markers listed out in advance. Lines 530-536 calculate the slopes of the imaginary lines connecting the markers. Lines 11-30 contain the drawing routine. There are two sections divided by a horizontal line at B. In the first section, horizontal lines are drawn from line CA to line BA. In the second section, horizontal lines are drawn from line CA to line CB. The two special cases where AY = BY or BY = CY are also handled.

The circle predrawing section is lines 600-680. The two crucial factors here are the location of the center of the circle (RX,RY), and the radius of the circle (R). The center of the circle is found by using the bisectors rule from geometry. To apply that rule, connect points C and A and points B and A. Then, make lines which pass through the midpoints of lines CA and BA and are perpendicular to CA and BA. We can use the point-slope method to describe these lines. Finally, find where these lines intersect. That is done by solving simultaneous linear equations.

Plotting A Circle

To find the radius, calculate the distance from the center of the circle to point A. In the program, any of the three markers are used as points A, B, and C. The markers are tried in different orders in line 1550 until a center is found.

Notice line 650. The TRAP is there to test for the case where the slopes of the bisectors are equal. This will occur only when the three markers are in a straight line. You can't draw a circle on a straight line. The actual drawing is performed by lines 2-10. It is done by drawing the upper half and the bottom half simultaneously, starting at the equator and going to the poles. X, Y pairs which are outside the screen range are converted to fit on the screen for partial horizontal lines.

Finally, an FT factor is used to make round circles. If you draw circles without using FT, they come out oval. This is because the height of a screen pixel is not equal to its width.

With careful planning, you can construct interesting designs or detailed scenes that have the quality of a watercolor painting. By combining the two fundamental shapes of nature—the circle and the triangle—you can form many other shapes such as rectangles, stars, diamonds, and crescents. The program teaches children drawing composition and the names of the colors.

Drawing A Rectangle

Let's draw a rectangle.

Step 1: Move the markers together until they are exactly on top of one another. This will be the lower left corner of the rectangle.

Step 2: Increase the speed (9 is OK).

Step 3: Move a marker right by tapping the joystick. Count how many taps you make.

Step 4: Do the same thing with another marker but in the up direction.

Step 5: Press START.

Step 6: Move the third marker right and then up the same number of times you counted in steps 3 and 4.

Step 7: Press START and you'll have a rectangle.

Now that you have the general idea, try drawing some shapes on your own.

Here's some advice about circles. Since the markers form the edge of the circle, lining up the markers in a straight line will form a very large circle. In fact, it may not form a circle at all, because you can't draw a curve on a straight line. The computer will buzz at you if you tell it to draw a straight line circle. Move one marker a little and try again. You will see that very large circle. Sometimes circles are partly off and partly on the screen. If the partly off part is drawn first, you may have to wait a few seconds before you see your circle being drawn. Be patient. Soon you will become familiar with how circles are made, so you will know in advance how one will come out before it's drawn.

The Background Comes First

When you draw a scene, remember to do the background first. It is just like painting: The new shape will cover the old. You may notice that certain colors contrast each other and certain colors blend into each other. This and other visual effects can and should be used to your advantage. Remember also that the same color can look different with different backgrounds.

If you see the colors changing after you have been drawing for a while, your Atari is in attract mode. The purpose of attract mode is to protect your TV from permanent burn-in of colors. To get your normal colors back, just press the SPACE bar or a letter key.

There is no specific feature for clearing the screen, but it's easy to start with a clean slate. Just move the markers to three of the corners of the screen and draw a BLACK TRIANGL. Then move a marker to the fourth corner from the corner diagonally opposite and draw again.

You may want to modify the program. One simple modification is to use the 16 shades of the GTIA mode. In this mode, the names of the colors should be reinterpreted as shades of gray. In lines 1525 and 1530, change 623 to 65, 87 to 9, and 712 to 0.

Refer to the "Automatic Proofreader" article before typing this program in.