In this video, we play a little bit with BASIC programming on the TI-99/4A. We write a program to play a holiday song to demonstrate the concepts of BASIC.
TI BASIC Program in Video: TWELVEDAYS
10 CALL CLEAR
20 DIM GIFT$(12)
30 FOR L=1 TO 12
40 READ GIFT$(L)
50 NEXT L
60 DIM ORD$(12)
70 FOR L=1 TO 12
80 READ ORD$(L)
90 NEXT L
100 LOWG=392
110 LOWA=440
120 LOWB=494
130 HIC=523
140 HID=587
150 HIE=659
160 HIF=698
170 HIFS=740
180 HIG=784
190 HIA=880
200 S=150
210 E=S*2
220 Q=E*2
230 H=Q*2
240 FOR VERSE=1 TO 12
250 PRINT "ON THE ";ORD$(VERSE);
260 CALL SOUND(S,LOWG,0)
270 CALL SOUND(S,LOWG,0)
280 CALL SOUND(E,LOWG,0)
290 PRINT "DAY OF CHRISTMAS,"
300 CALL SOUND(S,HIC,0)
310 CALL SOUND(S,HIC,0)
320 CALL SOUND(E,HIC,0)
330 CALL SOUND(S,LOWB,0)
340 PRINT "MY TRUE LOVE GAVE TO ME,"
350 CALL SOUND(S,HIC,0)
360 CALL SOUND(S,HID,0)
370 CALL SOUND(S,HIE,0)
380 CALL SOUND(S,HIF,0)
390 CALL SOUND(S,HID,0)
400 CALL SOUND(Q,HIE,0)
410 FOR LINE=VERSE TO 1 STEP -1
420 IF VERSE=1 THEN 460
430 IF LINE>1 THEN 460
440 PRINT " AND"
450 CALL SOUND(S,HIE,0)
460 PRINT " ";GIFT$(LINE);
470 IF LINE>1 THEN 500
480 PRINT "."
490 GOTO 510
500 PRINT ","
510 IF VERSE>4 THEN 540
520 ON LINE GOSUB 580,680,680,680
530 GOTO 550
540 ON LINE GOSUB 580,730,790,830,890,950,950,950,950,950,950,950
550 NEXT LINE
560 NEXT VERSE
570 END
580 CALL SOUND(S,HIF,0)
590 CALL SOUND(E,HIG,0)
600 CALL SOUND(S,HIA,0)
610 CALL SOUND(S,HIF,0)
620 CALL SOUND(S,HIE,0)
630 CALL SOUND(S,HIC,0)
640 CALL SOUND(E,HID,0)
650 CALL SOUND(H,HIC,0)
660 CALL SOUND(Q,HIC,30)
670 RETURN
680 CALL SOUND(E,HIG,0)
690 CALL SOUND(S,HID,0)
700 CALL SOUND(S,HIE,0)
710 CALL SOUND(E,HIF,0)
720 RETURN
730 CALL SOUND(S,HID,0)
740 CALL SOUND(S,HIC,0)
750 CALL SOUND(S,LOWB,0)
760 CALL SOUND(S,LOWA,0)
770 CALL SOUND(E,LOWG,0)
780 RETURN
790 CALL SOUND(E,HIF,0)
800 CALL SOUND(E,LOWA,0)
810 CALL SOUND(E,HIC,0)
820 RETURN
830 CALL SOUND(S,HIG,0)
840 CALL SOUND(S,HIF,0)
850 CALL SOUND(S,HIE,0)
860 CALL SOUND(S,HID,0)
870 CALL SOUND(E,HIC,0)
880 RETURN
890 CALL SOUND(Q,HIG,0)
900 CALL SOUND(E,HIA,0)
910 CALL SOUND(E,HIFS,0)
920 CALL SOUND(Q,HIG,0)
930 CALL SOUND(Q,HIG,30)
940 RETURN
950 CALL SOUND(E,HIG,0)
960 CALL SOUND(S,HID,0)
970 CALL SOUND(S,HIE,0)
980 CALL SOUND(S,HIF,0)
990 CALL SOUND(S,HID,0)
1000 RETURN
1010 DATA "A PARTRIDGE IN A PEAR TREE","TWO TURTLE DOVES","THREE FRENCH HENS","FOUR CALLING BIRDS"
1020 DATA "FIVE GOLDEN RINGS","SIX GEESE A-LAYING","SEVEN SWANS A-SWIMMING","EIGHT MAIDS A-MILKING"
1030 DATA "NINE LADIES DANCING","TEN LORDS A-LEAPING","ELEVEN PIPERS PIPING","TWELVE DRUMMERS DRUMMING"
1040 DATA "FIRST","SECOND","THIRD","FOURTH"
1050 DATA "FIFTH","SIXTH","SEVENTH","EIGHTH"
1060 DATA "NINTH","TENTH","ELEVENTH","TWELFTH"
Posted in BASIC on 2018-12-06 12:41:00.
Hits: 2979