Color Wheel for the Atari

Neil Harris

This program shows how easy it is to get "pretty pictures" with a minimum of coding. You might want to try the following changes:
110 GRAPHICS 7+16
145 COLOR INT(RND(1)*3)+1

The Color Wheel program was written to experiment with some of the Atari's color graphic capabilities. The screen clears and a series of lines radiate from the center of the screen in random colors, forming a shape with the outline of an ellipse. As the color bands sweep the screen, the colors shift in intensity and hue, forming a constantly changing set of contrasts and shapes.

The program itself is quite simple, thanks to the easy Atari BASIC graphics commands. Graphics mode 7 features 160 by 80 points of resolution in four colors, which are set up in registers. One of the things that made this program possible was that you can change a color register value, which causes all points on the screen associated with that register to change color instantly.

Line 100 selects degree mode for trigonometric functions, which in this case leads to less messy numbers in the FOR-NEXT loop in line 140. Lines 120 and 130 select values for DX and DY, which determine the shape of the ellipse for that cycle. The STEP in line 140 was added because the smaller ellipses otherwise took the same time to draw as bigger ones. Line 145 randomly selects the color register for the current line (an interesting variation is to move this line to line 135, making each ellipse a solid color). Line 150 plots a point at the center of the screen. The formula in the DRAWTO in line 160 was arrived at by using simple trigonometry to determine the point on the ellipse at any given angle around the center. The SETCOLOR statement in line 180 changes a random color register on the screen to a random hue and intensity, and is selected 30% of the time by line 170. Line 190 completes the loop, and 200 allows the program to select a new ellipse shape and keep drawing. I usually put some PRINT statements between lines 110 and 120 for a message in the text window.

This program allows the Atari to show off its nice range of colors, and the plotting routine has been reduced to its bare essentials.

Listing: Color Wheel

Download (Saved BASIC)
Download / View (Listed BASIC)

Return to Table of Contents | Previous Section | Next Section