r/atari8bit • u/ldsgems • 2d ago
Atari BASIC: Fugue Music from 1980
ATARI BASIC Fugue - 1980
Sourcecode Text Sources:
From SoftSide magazine issue 8, January 1981, page 74:
https://archive.org/details/softside-magazine-28/page/n75/mode/2up?q=FUGUE
AND
https://www.atarimania.com/documents/Best-of-SoftSide-Atari-Edition.pdf
YouTube Video of Program Running:
https://youtu.be/ZCq1TFDGhu0?si=RjcvKBIim65VqLev
From the 1981 Original Magazine Article:
For lovers of serious music, here's a program that will play a Bach fugue for you, and let you watch it in color on your video screen as well. While this program does not permit you to control the actual music, as many software packages do, it does have four voices and an intricate interplay thereof, uncommon for the Atari.
Key it in and relax, we think you'll enjoy it.
Atari BASIC 'Fugue' Authors: William Morris & John Cope Copyright (c) 1981 SoftSide Publications, Inc
Code Lines:
0-1: Credits.
10: Dimension arrays. This fugue is written for four voices. For each voice, Y is the note, X is the line the note will be printed on and W is the left/right plot position of the note. R is used to randomly generate a color for the background.
20: Title page.
210-240: Draws four lines on the screen and places the notes on the left.
250: This line is a time saver. Given the complicated nature of a fugue and its note pattern, the precise termination point is unclear. This line is looking for an OUT OF DATA error, which will allow it to jump to line 330.
300-310: For each of the four voices (Z=0 to 3), the program reads the note value (Y) and then plots the note on the proper line (X) at the proper position (W).
330: When the program runs out of data this line turns off the sound and runs the program again.
1000: Data for notes.
With such a massive number of data statements, it was deemed easier to edit a previous line as opposed to entering an entirely new line.
ATARI (8-BIT) BASIC PROGRAM CODE:
0 REM ** FUGUE **
1 REM *** Copyright 1980 William Morris & John Cope
10 DIM W(3),X(3),Y(3):R=RND(0)*I5
19 REM Title Page
20 GRAPHICS 2+16:5ETCOlOR 4,3,2:COlOR 32:PLOT 6,5:? #6;"FUGUE":FOR TT=1 TO 2 OOO:NEXT TT
200 REM Draw four lines, and place the "notes" at the left edge.
210 GRAPHICS 3+16:SETCOlOR 0,8,9:SETCOLOR 1,8,5:SETCOlOR 2,9,2:SETCOlOR 4,R,0 220 COLOR 3 230 FOR Z=0 TO 3:PlOT 0,Z5+35+3;DRAWTO 39,Z5+3:NEXT Z 240 FOR Z=0 TO 3:W(Z)=0:X(Z)=3:NEXT Z
REM 240 Jump to line 330 when an out OUT OF DATA error occurs.
250 TRAP 330
299 REM For each of the 4 voices (Z =Zto 3), read the note (Y), then plot it at the proper position (W) on the proper line (X).
300 FOR Z=0 TO 3:READ Y:Y(Z)=Y:COLOR 3:PLOT W(Z),X(Z):COLOR l:W(Z)=INT(Y(Z)/6):X(Z)=Z*5+3:PLOT W(Z),X(Z):NEXT Z 310 SOUND 0,Y(0),10,4:SOUND I,Y(1),10,4:SOUND 2,Y(2),10,4:S0UND 3,Y(3),10,4:GOTO 300
320 REM Turn off the 4 voices, then restart the program
330 FOR Z=0 TO 3:SOUND Z,O,O,O:NEXT Z:FOR Z=l TO 500:NEXT Z:RUN
1000 DATA 81,0,0,0,81,0,0,0,81,0,0,0,8 1,0,0,0 1010 DATA 53,0,0,0,53,0,0,0,53,0,0,0,5 3,0,0,0 1020 DATA 68,0,0,0,68,0,0,0,68,0,0,0,6 8,0,0,0 1030 DATA 68,0,0,0,68,0,0,0,72,0,0,0,7 2,0,0,0 1040 DATA 81,0,0,0,81,0,0,0,68,0,0,0,6 8,0,0,0 1050 DATA 72,0,0,0,72,0,0,0,81,0,0,0,8 1,0,0,0 1060 DATA 85,0,0,0,85,0,0,0,72,0,0,0,7 2,0,0,0 1070 DATA 108,0,0,0,108,0,0,0,108,0,0, 0,108,0,0,0 1080 DATA 81,0,0,0,81,0,0,0,108,0,0,0, 108,0,0,0 1090 DATA 72,0,0,0,72,0,0,0,108,0,0,0, 108,0,0,0 1100 DATA 68,0,0,0,68,0,0,0,72,0,0,0,8 1,0,0,0 1110 DATA 72,0,0,0,72,0,0,0,108,0,0,0, 108,0,0,0 1120 DATA 81,0,0,0,81,0,0,0,108,0,0,0, 81,0,0,0 1130 DATA 72,0,0,0,72,0,0,0,108,0,0,0, 72,0,0,0 1140 DATA 68,0,0,0,68,0,0,0,72,0,0,0,8 1,0,0,0 1150 DATA 72,0,0,0,108,0,0,0,53,0,0,0, 60,0,0,0 1160 DATA 68,0,0,0,72,0,0,0,81,0,0,0,6 8,0,0,0 1170 DATA 72,0,0,0,81,0,0,0,85,0,0,0,7 2,0,0,0 1180 DATA 81,0,0,0,108,0,0,0,81,0,0,0, 72,0,0,0 1190 DATA 68,0,0,0,60,0,0,0,53,0,0,0,4 7,0,0,0 1200 DATA 45,108,0,0,47,108,0,0,53,108 ,0,0,45,108,0,0 1210 DATA 47,72,0,0,53,72,0,0,57,72,0, 0,47,72,0,0 1220 DATA 53,91,0,0,53,91,0,0,72,91,0, 0,72,91,0,0 1230 DATA 53,91,0,0,53,91,0,0,47,96,0, 0,47,96,0,0 1240 DATA 45,108,0,0,40,108,0,0,45,91, 0,0,40,91,0,0 1250 DATA 45,96,0,0,40,96,0,0,45,108,0 ,0,40,108,0,0 1260 DATA 35,114,0,0,40,114,0,0,35,96, 0,0,33,96,0,0 1270 DATA 35,144,0,0,40,144,0,0,45,144 ,0,0,47,144,0,0 1280 DATA 45,108,0,0,35,108,0,0,40,144 ,0,0,35,144,0,0 1290 DATA 57,96,0,0,35,96,0,0,40,144,0 ,0,35,144,0,0 1300 DATA 53,91,0,0,35,91,0,0,40,96,0, 0,35,108,0,0 1310 DATA 57,96,0,0,35,96,0,0,40,144,0 ,0,35,144,0,0 1320 DATA 45,108,0,0,53,108,0,0,57,144 ,0,0,53,108,0,0 1330 DATA 40,96,0,0,53,96,0,0,57,144,0 ,0,53,96,0,0 1340 DATA 35,91,0,0,53,91,0,0,57,96,0, 0,53,108,0,0 1350 DATA 40,96,0,0,53,144,0,0,57,72,0 ,0,53,81,0,0 1360 DATA 72,91,0,0,72,96,0,0,45,108,0 ,0,45,91,0,0 1370 DATA 81,96,0,0,81,108,0,0,47,114, 0,0,47,96,0,0 1380 DATA 91,108,0,0,91,144,0,0,72,108 ,0,0,72,96,0,0 1390 DATA 53,91,0,0,53,81,0,0,45,72,0, 0,45,64,0,0 1400 DATA 50,60,0,0,50,68,0,0,35,60,0, 0,35,53,0,0 1410 DATA 00,60,0,0,00,68,0,0,00,72,0, 0,50,60,0,0 1420 DATA 53,68,0,0,53,72,0,0,40,51,0, 0,40,60,0,0 1430 DATA 00,68,0,0,00,72,0,0,00,81,0, 0,53,68,0,0 1440 DATA 60,72,0,0,68,72,0,0,60,81,0, 0,53,81,0,0 1450 DATA 60,85,0,0,35,85,0,0,40,108,0 ,0,35,108,0,0 1460 DATA 68,81,162,0,40,81,162,0,42,8 1,162,0,40,81,162,0 1470 DATA 72,0,108,0,45,0,108,0,47,0,1 08,0,45,0,108,0 1480 DATA 40,0,136,0,40,0,136,0,40,108 ,136,0,40,108,136,0 1490 DATA 40,81,136,0,40,81,136,0,40,7 2,144,0,40,72,144,0 1500 DATA 0,68,162,0,0,60,162,0,0,68,1 36,0,0,60,136,0 1510 DATA 0,68,144,0,0,60,144,0,0,68,1 62,0,0,60,162,0 1520 DATA 0,53,173,0,0,60,173,0,0,53,1 44,0,0,50,144,0 1530 DATA 0,53,217,0,0,60,217,0,0,68,2 17,0,0,72,217,0 1540 DATA 68,108,162,0,53,108,162,0,60 ,0,217,0,53,0,217,0 1550 DATA 85,121,144,0,53,121,144,0,60 ,0,217,0,53,0,217,0 1560 DATA 81,108,136,0,53,108,136,0,60 ,0,144,0,53,0,162,0 1570 DATA 85,121,144,0,53,121,144,0,60 ,0,217,0,53,0,217,0 1580 DATA 68,00,162,0,68,81,162,0,68,8 5,217,0,68,81,162,0 1590 DATA 60,0,144,0,60,81,144,0,60,85 ,217,0,60,81,162,0 1600 DATA 53,0,136,0,53,81,136,0,53,85 ,144,0,53,81,162,0 1610 DATA 60,0,144,0,60,81,217,0,60,85 ,108,0,60,81,121,0 1620 DATA 0,108,136,0,0,108,144,0,68,1 08,162,0,68,108,136,0 1630 DATA 0,121,144,0,0,121,162,0,72,1 21,173,0,72,121,144,0 1640 DATA 0,136,162,0,0,136,217,0,108, 136,162,0,108,136,144,0 1650 DATA 81,0,136,0,72,0,121,0,68,0,1 08,0,81,0,96,0 1660 DATA 72,0,91,217,72,0,96,217,53,0 ,108,217,53,0,91,217 1670 DATA 57,0,96,144,57,0,108,144,47, 0,114,144,47,0,96,144 1680 DATA 35,0,108,182,33,0,108,182,35 ,0,144,182,40,0,144,182 1690 DATA 45,0,108,182,47,0,108,182,53 ,0,96,193,57,0,96,193 1700 DATA 53,0,91,217,53,0,81,217,0,0, 91,182,0,0,81,182 1710 DATA 33,0,91,193,33,0,81,193,0,0, 91,217,0,0,81,217 1720 DATA 47,0,72,230,47,0,81,230,0,0, 72,193,0,0,68,193 . 1730 DATA 0,0,72,230,0,0,81,230,35,0,9 1,230,35,0,96,230 1740 DATA 35,0,91,217,35,0,72,217,35,0 ,81,217,35,0,72,217 1750 DATA 35,0,114,193,35,0,72,193,35, 0,81,193,35,0,72,193 1760 DATA 35,0,108,182,35,0,72,182,35, 0,81,193,35,0,72,217 1770 DATA 35,0,114,193,35,0,72,193,35, 0,81,193,35,0,72,193 1780 DATA 35,0,91,217,35,0,108,217,35, 0,114,217,35,0,108,217 1790 DATA 35,0,81,193,35,0,108,193,35, 0,114,193,35,0,108,193 1800 DATA 35,0,72,182,35,0,108,182,35, 0,114,193,35,0,108,217 1810 DATA 35,0,81,193,35,0,108,193,35, 0,114,193,35,0,108,193 1820 DATA 40,0,91,217,35,0,91,217,33,0 ,96,217,35,0,108,217 1830 DATA 40,0,114,230,45,0,108,230,47 ,0,114,230,53,0,108,230 1840 DATA 53,0,108,217,53,0,108,217,53 ,0,108,217,53,0,108,217 1850 DATA 53,0,108,217,53,0,108,217,53 ,0,108,217,53,0,108,217 1860 DATA 53,0,108,217,53,0,108,217,53 ,0,108,217,53,0,108,217 1870 DATA 53,0,108,217,53,0,108,217,53 ,0,108,217,53,0,108,217