Atari Tree

Type
Sound
Category
Christmas music and graphics demo
Author
Jerry White
Published in
Antic, December 1982 (Vol. 1, No. 5)
Year
1982
Language
Atari BASIC
Requirements
Any Atari 8-bit, Atari BASIC
A green Christmas tree on a white background with a pink star, small coloured ornaments and a brown base, with the words JINGLE BELLS

About the program

Jerry White, Antic's technical consultant, called this program a way to send all the magazine's readers a Christmas card and make Antic pay the postage. It is a singing telegram. A Christmas tree with a star and a tub is drawn in GRAPHICS 7 and hung with coloured ornaments. Then the computer plays Jingle Bells in four-part harmony, showing the words in the text window, while the ornaments change colour with every chord. At the end it wishes you a merry Christmas from Jerry White and Antic. White was rather proud that it did all this without a single USR call or interrupt routine, using only Atari BASIC.

What you need

Any Atari with Atari BASIC. Turn the sound up.

Typing it in

The listing is plain ASCII. The one rule the article insists on: type line 20 first. PM$ has to be the first variable BASIC meets, because line 2090 rewrites its entry in the variable table (see below). The song is the long run of DATA lines from 600 on. Each holds four pitches, a duration, a switch and a lyric (* means "keep the old words"). The listing on the disk has no TYPO codes.

How to use it

Just RUN it. After one pass through the song it starts again, and at the second "DASHING THRU" the greeting appears and the ornaments fade through the colours. To make your own card, change the lyric DATA, or the text in line 9000.

How it works

  • A string on top of player memory. Line 2000 sets PMBASE 32 pages below the top of memory. Lines 2040–2090 then find PM$ in the variable value table (location 134) and overwrite its address so that it points at the player area, 1K above PMBASE, measured from the start of string/array space (location 140). From then on, simple string assignments like PM$(ME+256,ME+260)=PLR$ draw the five-line ornament shapes into the players. The article gives a one-line direct-mode loop for erasing them if you want to design your own.
  • Four voices with POKEs. Line 100 writes the four pitches straight to the POKEY frequency registers (53760, 53762, 53764, 53766), with pure-tone values in the control registers set by line 10009. It also POKEs the same numbers into the four player colour registers, so the ornament colours follow the music.
  • Timing with the clock. Each note is held by setting POKE 20,0 and waiting until PEEK(20) reaches HOLD jiffies.
  • Filled shapes. The tree, tub and star are filled with XIO 18 (the OS fill), with the fill colour POKEd into location 765.

Listing

20 GRAPHICS 7:DIM PM$(2048),PLL$(5),PLR$(5),WORD$(40):GOSUB 2000:GOTO 300
100 POKE 20,0:POKE 53760,V0:POKE 53762,V1:POKE 53764,V2:POKE 53766,V3
101 IF V0=0 THEN 110
102 POKE 704,V0:POKE 705,V1:POKE 706,V2:POKE 707,V3
110 IF PEEK(20)<HOLD THEN 110
120 POKE 53760,0:POKE 53762,0:POKE 53764,0:POKE 53766,0
130 POKE 704,14:POKE 705,14:POKE 706,14:POKE 707,14:RETURN
300 READ V0,V1,V2,V3,HOLD,SWITCH,WORD$
340 IF SWITCH=9 THEN 9500
350 TRAP 360:IF TIMES=1 AND WORD$="DASHING THRU" THEN 9000
360 IF WORD$="*" OR SWITCH=2 THEN 400
380 ? CHR$(125),WORD$:GOSUB 100:GOTO 300
400 GOSUB 100:GOTO 300
600 DATA 47,60,81,96,19,1,JINGLE BELLS
610 DATA 47,60,81,96,19,0,*
620 DATA 47,60,81,96,29,0,*
625 DATA 0,0,0,0,9,2,REST
630 DATA 47,60,81,96,19,1,JINGLE BELLS
640 DATA 47,60,81,96,19,0,*
650 DATA 47,60,81,96,29,0,*
655 DATA 0,0,0,0,9,2,REST
660 DATA 47,60,81,96,19,1,JINGLE
670 DATA 40,47,60,81,19,0,*
680 DATA 60,81,96,121,29,1,ALL THE WAY
690 DATA 53,53,108,108,9,0,*
700 DATA 47,60,81,96,79,0,*
710 DATA 0,0,0,0,9,2,REST
720 DATA 45,60,72,91,19,1,OH WHAT FUN
730 DATA 45,60,72,91,19,0,*
740 DATA 45,60,72,91,29,0,*
750 DATA 45,60,72,91,9,1,IT IS TO RIDE
760 DATA 45,60,72,91,19,0,*
770 DATA 47,60,81,96,19,0,*
780 DATA 47,60,81,96,19,0,*
790 DATA 47,60,81,96,9,0,IN A ONE HORSE
800 DATA 47,60,81,96,9,0,*
810 DATA 47,60,81,96,19,0,*
820 DATA 53,64,81,108,19,0,*
830 DATA 53,64,81,108,19,1,OPEN SLEIGH
840 DATA 47,60,81,96,19,0,*
850 DATA 53,64,81,108,39,0,*
855 DATA 0,0,0,0,4,2,REST
860 DATA 40,47,60,162,39,0,*
870 DATA 0,0,0,0,4,2,REST
900 DATA 47,60,81,96,19,1,JINGLE BELLS
910 DATA 47,60,81,96,19,0,*
920 DATA 47,60,81,96,29,0,*
925 DATA 0,0,0,0,9,2,REST
930 DATA 47,60,81,96,19,1,JINGLE BELLS
940 DATA 47,60,81,96,19,0,*
950 DATA 47,60,81,96,29,0,*
955 DATA 0,0,0,0,9,2,REST
960 DATA 47,60,81,96,19,1,JINGLE
970 DATA 40,47,60,81,19,0,*
980 DATA 60,81,96,121,29,1,ALL THE WAY
990 DATA 53,53,108,108,9,0,*
992 DATA 47,60,81,96,79,0,*
994 DATA 0,0,0,0,9,2,REST
1000 DATA 45,60,72,91,19,1,OH WHAT FUN
1010 DATA 45,60,72,91,19,0,*
1020 DATA 45,60,72,91,29,0,*
1030 DATA 45,60,72,91,9,1,IT IS TO RIDE
1040 DATA 45,60,72,91,19,0,*
1050 DATA 47,60,81,96,19,0,*
1060 DATA 47,60,81,96,19,0,*
1070 DATA 47,60,81,96,9,1,IN A ONE HORSE
1080 DATA 47,60,81,96,9,0,*
1090 DATA 40,53,64,81,19,0,*
1100 DATA 40,53,64,81,19,0,*
1110 DATA 40,53,64,81,19,1,OPEN SLEIGH
1120 DATA 53,64,81,108,19,0,*
1130 DATA 60,81,96,121,79,0,*
1140 DATA 0,0,0,0,9,2,REST
1200 DATA 81,96,121,162,19,1,DASHING THRU
1210 DATA 47,47,96,96,19,0,*
1220 DATA 53,53,108,108,19,0,*
1230 DATA 60,60,121,121,19,1,THE SNOW
1240 DATA 81,96,121,162,59,0,*
1245 DATA 0,0,0,0,9,2,REST
1250 DATA 81,96,121,162,9,1,IN A ONE HORSE
1260 DATA 81,96,121,162,9,0,*
1270 DATA 81,96,121,162,19,0,*
1280 DATA 47,47,96,96,19,0,*
1290 DATA 53,53,108,108,19,1,OPEN SLEIGH
1300 DATA 60,60,121,121,19,0,*
1310 DATA 72,91,121,144,79,0,*
1320 DATA 0,0,0,0,9,2,REST
1330 DATA 72,91,121,144,19,1,OVER THE FIELDS
1340 DATA 45,45,91,91,19,0,*
1350 DATA 47,47,96,96,19,0,*
1360 DATA 53,53,108,108,19,1,WE GO
1370 DATA 64,81,108,128,79,0,*
1380 DATA 0,0,0,0,9,2,REST
1390 DATA 40,47,60,81,19,1,LAUGHING
1400 DATA 40,47,60,81,19,0,*
1410 DATA 45,45,91,91,19,1,ALL THE WAY
1420 DATA 53,53,108,108,19,0,*
1430 DATA 47,60,81,96,79,0,*
1440 DATA 0,0,0,0,9,2,REST
1500 DATA 81,96,121,162,19,1,BELLS ON BOB
1510 DATA 47,47,96,96,19,0,*
1520 DATA 53,53,108,108,19,0,*
1530 DATA 60,60,121,121,19,1,TAILS RING
1540 DATA 81,96,121,162,79,0,*
1545 DATA 0,0,0,0,9,2,REST
1550 DATA 81,96,121,162,19,1,MAKING SPIRITS
1560 DATA 47,47,96,96,19,0,*
1570 DATA 53,53,108,108,19,0,*
1580 DATA 60,60,121,121,19,0,*
1590 DATA 72,91,121,144,79,1,BRIGHT
1600 DATA 0,0,0,0,9,2,REST
1610 DATA 72,91,121,144,9,1,WHAT FUN IT IS
1620 DATA 72,91,121,144,19,0,*
1630 DATA 45,45,91,91,19,0,*
1640 DATA 47,47,96,96,19,0,*
1650 DATA 53,53,108,108,19,1,TO RIDE AND SING
1660 DATA 40,53,64,81,19,0,*
1670 DATA 40,53,64,81,19,0,*
1680 DATA 40,53,64,81,29,0,*
1700 DATA 40,53,64,81,9,1,A SLEIGHING
1710 DATA 35,35,72,72,9,0,*
1720 DATA 40,53,64,81,19,0,*
1730 DATA 45,45,91,91,19,1,SONG TONITE
1740 DATA 53,53,108,108,19,0,*
1750 DATA 60,81,96,121,79,0,*
2000 POKE 752,1:POKE 559,62:I=PEEK(106)-32:POKE 54279,I:POKE 623,33
2040 VTAB=PEEK(134)+PEEK(135)*256
2050 ATAB=PEEK(140)+PEEK(141)*256
2060 OFFS=I*256+1024-ATAB
2070 HI=INT(OFFS/256):LO=OFFS-HI*256
2090 POKE VTAB+2,LO:POKE VTAB+3,HI:GOTO 10000
8000 DATA 0,0,0,0,0,9,END
9000 POKE 201,10:? CHR$(125)," MERRY CHRISTMAS":? ,"from Jerry White":? ,"& ANTIC Magazine"
9200 FOR HOLD=0 TO 231 STEP 0.5:POKE 704,HOLD:POKE 705,HOLD+8:POKE 706,HOLD+16:POKE 707,HOLD+24:NEXT HOLD
9300 GOSUB 20000:POKE 53277,0:GRAPHICS 0:END
9500 TIMES=TIMES+1:FOR HOLD=1 TO 40:NEXT HOLD:RESTORE :GOTO 300
10000 PLL$(1,1)=CHR$(32):PLL$(2,2)=CHR$(112):PLL$(3,3)=CHR$(248):PLL$(4,4)=PLL$(2,2):PLL$(5,5)=PLL$(1,1)
10003 PLR$(1,1)=CHR$(4):PLR$(2,2)=CHR$(14):PLR$(3,3)=CHR$(31):PLR$(4,4)=PLR$(2,2):PLR$(5,5)=PLR$(1,1)
10004 FOR ME=70 TO 150 STEP 20:PM$(ME+256,ME+260)=PLR$:PM$(ME+266,ME+270)=PLL$
10005 PM$(ME+512,ME+516)=PLR$:PM$(ME+522,ME+526)=PLL$:NEXT ME
10006 PM$(114,118)=PLR$:PM$(134,138)=PLR$:PM$(154,158)=PLL$
10007 PM$(882,892)=PLL$:PM$(902,906)=PLL$:PM$(922,926)=PLR$
10008 POKE 708,196:POKE 710,65:POKE 712,14:POKE 709,72:POKE 201,15:POKE 65,0:POKE 82,2:?
10009 SOUND 0,0,0,0:POKE 53761,168:POKE 53763,164:POKE 53765,164:POKE 53767,164
10010 POKE 765,1:FOR X=2 TO 6:A=8*X+80:B=11*X:C=80-8*X
10020 COLOR 1:PLOT 81,9:PLOT A-16,B-13:DRAWTO A,B:PLOT C-1,B+1
10030 POSITION C+16,B-13:XIO 18,#6,12,0,"S:"
10040 COLOR 2:PLOT A,B:DRAWTO A-1,B+1:PLOT C,B:DRAWTO C+1,B+1:DRAWTO C-1,B+1
10042 PLOT A,B+1:DRAWTO A+1,B+1:NEXT X
10050 COLOR 0:PLOT 81,9:COLOR 3:POKE 765,3:PLOT 90,67
10060 DRAWTO 90,79:DRAWTO 70,79:POSITION 70,67:XIO 18,#6,12,0,"S:"
10070 COLOR 2:POKE 765,2:PLOT 80,1:DRAWTO 85,10:DRAWTO 83,9
10080 POSITION 74,4:XIO 18,#6,12,0,"S:":DRAWTO 86,4:DRAWTO 75,10
10090 DRAWTO 80,1:DRAWTO 80,5:DRAWTO 76,9:PLOT 83,5:POKE 201,13:POKE 53277,2
11000 POKE 53248,102:POKE 53249,116:POKE 53250,132:POKE 53251,146:RETURN
20000 FOR ME=53248 TO 53251:POKE ME,0:NEXT ME:RETURN

Download

The original program from the Antic disk, to LOAD or ENTER instead of typing it: ATARTREE.BAS.

Credits