Atari Colors And Sounds With Paddles
The Atari computer has excellent graphics and sound capabilities. With 16 colors and eight levels of brightness we can generate 128 different colors. There are 256 notes available, each with 8 distortion values, totaling 2,048 sounds. Each color or sound can be accessed by a unique combination of numbers used in the SETCOLOR or SOUND statements. If you want to use a specific color or sound in your program, the problem is to find the correct values to use in the Basic statements.
The programs below enable you to see every color and hear almost every sound while also displaying the accompanying values used to generate them. These programs are also instructive in the use of the Atari paddles.
10 REM ATARI COLORS WITH PADDLES 20 GRAPHICS 3 30 POKE 752, 1 40 COLOR 1 50 A = PADDLE (0) 60 B = PADDLE (1) 70 SETCOLOR 4, INT (A/15), 2 * INT (B/30) 80 PRINT "COLOR = " ; INT (A/15), "BRIGHTNESS = " ; 2 * INT (B/30) ; " " 90 PRINT "↑ ↑" 100 GOTO 50
One paddle will change the screen color while the other changes the brightness. The numerical values used in the SETCOLOR statement are shown in the text window.
In the above program, line 30 surpresses the cursor. The two divisions in line 70 break the 228 positions of the paddle into 16 and 8 different positions, thereby using the full range of the paddles to display all 16 colors and 8 levels of brightness. The blank at the end of line 80 holds the space when the value changes from 2 digits to 1. Line 90 uses control characters to print line 80 in the text window only once. They are entered into the program by pressing the ESC key and then the CTRL key and ↑ key simultaneously. The last line sends the program back to line 50 where it waits for a change in the value of the paddle.
10 REM ATARI SOUNDS WITH PADDLES 20 N = INT (1.12 * PADDLE (0)) 30 D = 2 * INT (PADDLE (1)/30) 40 PRINT "NOTE = " ; N ; "DISTORTION = " ; D 50 SOUND 0, N, D, 8 60 IF INT (1.12 * PADDLE (0)) < > N THEN 20 70 IF 2 * INT (PADDLE (1)/30) < > D THEN 20 80 GOTO 60
In the above program, one paddle changes the notes while the other changes the distortion. The numerical values used in the SOUND statement are shown on the screen. The SYSTEM RESET key turns the sound off.
Since there are only 228 paddle positions and 256 notes, we cannot access every note with this method. The 1.12 factor in line 20 allows us to hear the full range of notes while skipping some notes along the way. Line 30 generates even numbers from 0 to 14 for the distortion value. Lines 60 and 70 wait for changes in the paddle values.
These two simple programs can be quite useful in the writing of other programs, and more fun than using trial and error to pick colors and sounds.