-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathAtari-8bit.txt
81 lines (72 loc) · 3.29 KB
/
Atari-8bit.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
100 REM BASIC Month 5: Crisps Tunes
110 REM http://reddit.com/r/RetroBattlestations
120 REM written by FozzTexx
200 REM Initialize variables
210 DIM M(7):FOR I = 1 TO 7:READ V:M(I) = V:NEXT I
220 SHFL = 0:RHYTHM = 0:OMAX = 4:DIM A(12 * OMAX):A1=1:A2=12 * OMAX:GOSUB 910
230 DIM S$(80):DIM N$(1):DIM M$(1):DIM MG(12 * OMAX):P = 1
240 READ T:IF T > -1 THEN MG(P) = T:P = P + 1:GOTO 240
300 REM Loop through data and play song
310 READ S$:SL = LEN(S$):IF SL = 0 THEN END
320 FOR I = 1 TO SL
330 OCTAVE = 4:DURATION = 0.05:DVSR = 0:MULT = 0:ACCD = 0
340 IF I > SL THEN NEXT I
350 N$ = S$(I,I)
360 IF N$ = " " THEN NEXT I
370 IF N$ = "|" THEN GOSUB 910:NEXT I
380 IF N$ = "^" THEN ACCD = 1:SHFL = SHFL + 1:I = I + 1:GOTO 340
390 IF N$ = "_" THEN ACCD = 1:SHFL = SHFL - 1:I = I + 1:GOTO 340
400 IF N$ = "=" THEN ACCD = 1:SHFL = 0:I = I + 1:GOTO 340
410 IF N$ >= CHR$(97) AND N$ <= CHR$(103) THEN N$ = CHR$(ASC(N$) - 32):OCTAVE = OCTAVE + 1
420 IF N$ >= "A" AND N$ <= "G" THEN C = ASC(N$):C = C - 64:NT = M(C)
500 REM Keep reading modifier after the note until there's another note
510 I = I + 1:IF I > SL THEN GOTO 610
520 M$ = S$(I,I)
530 IF M$ = ";" THEN OCTAVE = OCTAVE - 1:GOTO 510
540 IF M$ = "'" THEN OCTAVE = OCTAVE + 1:GOTO 510
550 IF M$ >= "0" AND M$ <= "9" THEN C = ASC(M$):MULT = MULT * 10 + C - 48:GOTO 510
560 IF M$ = "/" THEN DVSR = 1:GOTO 510
570 IF M$ = "<" THEN RHYTHM = 1:RMULT = 0.5:GOTO 510
580 IF M$ = ">" THEN RHYTHM = 1:RMULT = 1.5:GOTO 510
590 I = I - 1
600 REM Play note
610 NT = NT + (OCTAVE - 4) * 12
620 IF ACCD THEN AI = NT + 13:A(AI) = SHFL:SHFL = 0
630 IF ACCD AND AI < A1 THEN A1 = AI
640 IF ACCD AND AI > A2 THEN A2 = AI
650 SHFL = A(NT + 13):NT = NT + SHFL
660 IF DVSR AND MULT = 0 THEN MULT = 2
670 IF DVSR THEN MULT = 1/MULT
680 IF MULT = 0 THEN MULT = 1
690 IF RHYTHM THEN MULT = MULT * RMULT
700 DURATION = DURATION * MULT
710 M$ = "":IF SHFL <> 0 THEN M$ = "#":IF SHFL<0 THEN M$ = "$"
720 PRINT N$;M$;OCTAVE;"=";MULT;" ";
730 REM Note (NT) is numeric note, 0 is middle C. Convert to SOUND magic value
740 SOUND 0,MG(NT+13),10, 15
750 FOR W=1 TO DURATION * 180:NEXT W
760 SOUND 0,0,0,0
770 IF RHYTHM THEN RHYTHM = RHYTHM + 1:RMULT = 2 - RMULT:IF RHYTHM = 3 THEN RHYTHM = 0
800 NEXT I
810 GOTO 310
900 REM clear all accidentals
910 FOR AD = A1 TO A2:A(AD) = 0:NEXT AD
920 A1 = 12 * OMAX:A2 = 0
930 RETURN
1000 DATA 9,11,0,2,4,5,7
1010 REM Magic SOUND values (not hertz) that sound nice, starting at B
1020 DATA 255,243,230,217,204,193,182,173,162,153,144,136
1030 DATA 128,121,114,108,102, 96, 91, 85, 81, 76, 72, 68
1040 DATA 64, 60, 57, 53, 50, 47, 45, 42, 40, 37, 35, 33
1050 DATA 31, 29, 28, 26, -1
1490 REM Atari doesn't support quotes or commas in DATA, semicolon subtituted for comma
1500 DATA G;G; | ^G;G; A;A; G;G; | G;G; ^G;G; A;2 | G;^G; A;2 E;2 | E;2 E;2 E;8
1510 DATA | G;G; ^G;G; A;A; | ^G;G; =G;G; ^G;G; | A;2 G;^G; A;2 | F;2 F;2 F;2
1520 DATA | F;8 | F;2 F;2 | F;2 F;2 F;G; | A;B;5 | E;2 A;2 E;2 | A;2 E;F; G;A;5
1530 DATA | D;2 | E;4 ^F;2 | A;2 B;4 | A;_B; =B;2 G;2 | G;2 G;2 G;8
1540 DATA | G;G; ^G;G; A;A; | ^G;G; =G;G; ^G;G; | A;2 G;^G; A;2 | E;2 E;2 E;2
1550 DATA | E;8 | E;E; ^D;D; | E;2 ^F;2 ^G;2 | E;2 ^F;2 ^G;2 | A;2 ^G;2 A;2
1560 DATA | B;4< C4 | B;C D2 | A;2 A;2 A;2 | D2<A;2 A;2 | B;2 C2<G;2
1570 DATA | G;2 A;2 C2<G;2 | G;2 ^G;2 | A;2 ^G;2<A;2 | _B;2 =B;B; B;_B;
1580 DATA | B;2 G;2 C16
1590 DATA