My Hello Program (New Owners Column, Lesson 1)
- Type
- Graphics
- Category
- Beginner's graphics and sound demo
- Author
- David Plotkin
- Published in
- Antic, March 1986 (Vol. 4, No. 11), New Owners Column, Lesson One
- Year
- 1986
- Language
- Atari BASIC
- Requirements
- Any Atari 8-bit, Atari BASIC
About the program
In March 1986 Antic started a series for "readers who want to learn how to program their brand-new Atari 800XL or 130XE computers", and for those who had only ever run commercial software. David Plotkin, a chemical engineer and long-time Antic author, began the New Owners Column from scratch: SAVE and LOAD, filenames, the special keys, editing on screen and error messages. As a first taste, the issue's software pages carried "My Hello Program". Plotkin told readers to type it carefully, SAVE it, and RUN it even if they didn't yet understand how it works.
Typing it in
The listing is plain text, which suits a first program. The column suggested not using the TYPO II checker yet, and simply LISTing the program to compare it with the magazine (CTRL-1 pauses the listing). Remember to press RETURN at the end of every numbered line, and SAVE the program to disk before you RUN it.
What it does
The screen fills with a starburst of lines in several colours, a scatter of coloured dots, the letters H-E-L-L-O down the left edge and two banks of striped bars on the right. Then everything starts to flicker and ripple through the colours while two voices hum a slowly rising tone. Press BREAK to stop.
How it works
GRAPHICS 23is GRAPHICS 7 (160 × 96, four colours) without a text window, andDEGmakesSINandCOSwork in degrees.- The starburst (lines 160–220): for seven circles, shrinking from radius 45 by 5 each time, the program steps the angle by 15 degrees, draws to the point on the circle and back to the centre (
X0+R*COS(I),Y0+R*SIN(I)). It goes round one and a half times, and each smaller circle uses the next colour. - HELLO (lines 360–400) is drawn with
PLOTandDRAWTOas straight-line letters, and the bars (lines 420–450) are horizontal lines in alternating colours. - The animation doesn't redraw anything. Line 310 swaps the contents of colour registers 708, 709 and 710 round in a circle, so every pixel changes colour at once. Lines 320–330 use the system clock at location 20 to wait 7 frames between swaps, and line 340 raises the pitch of two
SOUNDvoices each time.POKE 77,0keeps the attract mode from taking over.
Variations to try
- Change
A=15in line 150 to 5 for a much denser starburst. - Change the 7 in line 330 to 2 for a frantic flicker, or 30 for a slow pulse.
Listing
10 REM THE NEW OWNERS COLUMN
20 REM DEMO PROGRAM NUMBER ONE
30 REM BY DAVID PLOTKIN
40 REM (c) 1985, ANTIC PUBLISHING
100 GRAPHICS 23:DEG :DIM C(3):TONE=0
110 SETCOLOR 2,4,4:SETCOLOR 1,6,6
120 R=45:COLOR 1:C=1
130 X0=79:Y0=47
140 FOR K=0 TO 3:C(K)=K+1*2:NEXT K
150 A=15
160 FOR K=1 TO 7
170 X=X0+R*COS(360):Y=Y0:PLOT X,Y
180 FOR I=0 TO 1.5*360 STEP A
190 X=X0+R*COS(I):Y=Y0+R*SIN(I)
200 DRAWTO X,Y:DRAWTO X0,Y0
210 NEXT I:R=R-5:C=C+1:COLOR C
220 NEXT K
230 ZZ=1
240 FOR LOOP=1 TO 50
250 COLOR ZZ
260 XX=INT(RND(0)*159)+1
270 YY=INT(RND(0)*93)+1
280 PLOT XX,YY
290 ZZ=ZZ+1:IF ZZ=4 THEN ZZ=1
300 NEXT LOOP:GOSUB 360
310 HOLD=PEEK(708):POKE 708,PEEK(709):POKE 709,PEEK(710):POKE 710,HOLD
320 POKE 20,0
330 IF PEEK(20)<7 THEN 330
340 POKE 77,0:SOUND 0,TONE,10,2:SOUND 1,TONE+10,10,2:TONE=TONE+1:IF TONE=245 THEN TONE=0
345 GOTO 310
350 REM PRINT HELLO ON THE SCREEN.
360 COLOR 1:PLOT 0,0:DRAWTO 0,16:PLOT 10,0:DRAWTO 10,16:PLOT 0,8:DRAWTO 10,8
370 COLOR 2:PLOT 0,20:DRAWTO 0,36:PLOT 0,20:DRAWTO 10,20:PLOT 0,28:DRAWTO 10,28:PLOT 0,36:DRAWTO 10,36
380 COLOR 3:PLOT 0,40:DRAWTO 0,56:DRAWTO 10,56
390 COLOR 3:PLOT 0,60:DRAWTO 0,76:DRAWTO 10,76
400 COLOR 1:PLOT 0,80:DRAWTO 0,93:DRAWTO 10,93:DRAWTO 10,80:DRAWTO 0,80
410 ZZ=1
420 FOR YYY=0 TO 46:COLOR ZZ
430 PLOT 145,YYY:DRAWTO 159,YYY:COLOR 4-ZZ:PLOT 145,YYY+47:DRAWTO 159,YYY+47
440 ZZ=ZZ+1:IF ZZ=4 THEN ZZ=1
450 NEXT YYY:RETURN
Download
The original program from the Antic disk, to LOAD or ENTER instead of typing it: MYHELLO.BAS.
Credits
- Program listing: My Hello Program (New Owners Column, Lesson 1) — program listing (Antic, March 1986 (Vol. 4, No. 11), New Owners Column, Lesson One) — David Plotkin
- Picture: My Hello Program: the sunburst, the HELLO letters and the striped bars, with the colours cycling. — David Plotkin (program); screenshot by the site
- Antic, March 1986 - Vol. 4 No. 11: scan of the printed magazine, New Owners Column, Lesson One, by David Plotkin, pp. 48-49 (listing p. 91) — Internet Archive, 1986
- Antic disk, March 1986 - Vol. 4 No. 11: MYHELLO.BAS (detokenized listing) — David Plotkin, 1986
