GTIA Pixel Averaging (BIRD.BAS)

GTIA Pixel Averaging by Lyn Buchanan, 21

Description

GTIA Pixel Averaging by Lyn Buchanan, 21

From the Antic disk of June 1985 (Vol. 4 No. 2).

From the Antic Software Archive at atarimagazines.com. The program remains the property of its author and publisher.

What is in this file

Atari BASIC program · 2.5 KB

Dialect
Atari BASIC
Lines
60
Variables
Y, X, A, B, C, D, E, F, G, H, I, K
BASIC listing (60 lines)
10 REM GTIA PIXEL AVERAGING
20 REM BY LYN BUCHANAN
30 REM (c) 1985, ANTIC PUBLISHING
40 GOTO 300
100 REM PIXEL AVERAGING ROUTINE
110 REM SET AREA TO BE ENHANCED
111 REM Y-COORDINATE RANGE
112 FOR Y=1 TO 88
113 REM X-COORDINATE RANGE
114 FOR X=1 TO 77
115 REM STOP ATTRACT MODE
116 POKE 77,0
120 REM LOCATE EACH PIXEL AND ASSIGN ITS VALUE TO A VARIABLE
121 LOCATE X-1,Y-1,A
122 LOCATE X-1,Y,B
123 LOCATE X-1,Y+1,C
124 LOCATE X,Y-1,D
125 LOCATE X,Y,E
126 LOCATE X,Y+1,F
127 LOCATE X+1,Y-1,G
128 LOCATE X+1,Y,H
129 LOCATE X+1,Y+1,I
130 REM AVERAGE ALL PIXEL VALUES
131 K=INT((A+B+C+D+E+F+G+H+I)/9)
132 REM LIGHTEN THE BACKGROUND
133 IF K=0 THEN K=8
140 REM REPLOT PIXEL IN NEW COLOR
141 COLOR K:PLOT X,Y+95
150 REM RETURN FOR THE NEXT PIXEL
151 NEXT X:NEXT Y
160 REM LOCK SCREEN IN GR.9 MODE
161 POKE 77,0:SOUND 0,65,14,14:GOTO 161
199 REM
200 REM DRAW STICK FIGURE BIRD
201 GRAPHICS 9:POKE 712,144
210 REM DRAW TAIL
211 FOR X=1 TO 15:COLOR X:PLOT 15+X,75:DRAWTO 3+X/4,71-X/2:NEXT X
220 REM DRAW BODY
221 FOR X=16 TO 4 STEP -1:COLOR X:PLOT 15+X/0.6,74-X:DRAWTO 60-X/1.8,74-X
222 PLOT 15+X/0.6,66+X:DRAWTO 60-X/1.8,66+X:NEXT X
230 REM DRAW WINGS
231 FOR X=1 TO 16:COLOR X:PLOT 4,63:DRAWTO 18+X,10-X/2:DRAWTO X*2+20,66-X/4:DRAWTO X*2+24,66-X/4
232 DRAWTO 46+X,20-X/2:DRAWTO 75,45:NEXT X
240 REM DRAW HEAD
241 COLOR 11:FOR X=1 TO 22:PLOT 48+X/2,60-X/2:DRAWTO 68-X/6,60-X/2:NEXT X
250 REM DRAW BEAK
251 COLOR 15:FOR X=1 TO 5:PLOT 73,67:DRAWTO 48+X,67-X:NEXT X:FOR X=1 TO 15:PLOT 49+X/2,67:DRAWTO 75,55:NEXT X
260 REM DRAW EYE
261 COLOR 0:FOR Y=54 TO 56:PLOT 60,Y:DRAWTO 62,Y:NEXT Y
270 GOTO 100
299 REM
300 GRAPHICS 0:POKE 710,28:POKE 712,28:POKE 709,2
301 ? :? :? ,"GTIA PIXEL AVERAGING":? ,"  by  Lyn Buchanan":?
302 ? "This demo program draws a stick-figurebird using normal PLOT and DRAWTO"
303 ? "commands.  Then the program 'computer enhances' the image by sampling the"
304 ? "color value of each pixel, and":? "averaging it with the values of the   surrounding pixels.":?
305 ? "The BASIC routine is slow (takes about12 minutes), but the results are worththe wait.":?
310 POKE 752,1:POSITION 12,22:? "READY?  PRESS  START ":POKE 53279,8
320 IF PEEK(53279)<>6 THEN 320
330 POKE 53279,8:GOTO 200