O Canada draws the Canadian flag, line by line, in block graphics with a maple leaf made of user-defined graphics, and flashes “THE MAPLE-LEAF FOREVER” above it. It then plays the national anthem while each line of the English lyrics appears beneath the flag. After a pause the tune is played a second time as an instrumental, read from DATA statements.
The REM reads “O CANADA – An original program by NEIL MARAGNO”. The music uses the BEEP command only, not the TS2068’s AY sound chip.
Program Analysis
Program Structure
- Lines 2000–2950: eighteen UDGs (a–r) for the leaf, loaded from DATA by the subroutine at 2900.
- Lines 20–186: the flag, drawn one row at a time with short pauses.
- Lines 300–315 store the lyrics in
b$(); lines 400–416 print each line and play its notes with BEEP. - Lines 3105–3220: the instrumental, read as duration/pitch pairs (
BEEP z/8,y).
Notable Techniques
BEEP .8,69, the highest pitch the command allows, is used as a short near-silent rest between phrases.- The instrumental stores durations in eighths, so the DATA can hold whole numbers.
Potential Issues
- The instrumental loop at 3105–3110 has no end test, so the program stops with “E Out of DATA” after the last note. The music is finished by then, so it does no harm.
This copy comes from a Larken disk, the TTSUC library disk “Music and Sound”. It was converted for tape (the disk command was removed from the save line) and tested in ZEsarUX.
Source Code
1 REM ***********************
2 REM * O CANADA *
3 REM * ******** *
4 REM * An original program *
5 REM * *
6 REM * by NEIL MARAGNO *
7 REM ***********************
10 CLEAR : PAPER 7: INK 0: CLS : BORDER 2: GO SUB 2000
20 LET a$="::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"
25 FOR b=1 TO 22
30 PRINT INK 1;a$
40 NEXT b
50 PRINT AT 4,3; INK 2;":::::::::::::: ::::::::::::::"
55 PAUSE 10
60 PRINT AT 5,3; INK 2;":::::::::::::: ::::::::::::::"
65 PAUSE 10
70 PRINT AT 6,3; INK 2;":::::::::::::: r ::::::::::::::"
75 PAUSE 10
80 PRINT AT 7,3; INK 2;":::::::::::::: efq ::::::::::::::"
85 PAUSE 10
90 PRINT AT 8,3; INK 2;":::::::::::::: :::::: ::::::::::::::"
95 PAUSE 10
100 PRINT AT 9,3; INK 2;":::::::::::::: ...d :::::: c... ::::::::::::::"
105 PAUSE 10
110 PRINT AT 10,3; INK 2;":::::::::::::: :::::d::::::c::::: ::::::::::::::"
115 PAUSE 10
120 PRINT AT 11,3; INK 2;":::::::::::::: b::::::::::::::::::a ::::::::::::::"
125 PAUSE 10
130 PRINT AT 12,3; INK 2;":::::::::::::: b::::::::::::::a ::::::::::::::"
135 PAUSE 10
140 PRINT AT 13,3; INK 2;":::::::::::::: b::::::::::a ::::::::::::::"
145 PAUSE 10
150 PRINT AT 14,3; INK 2;":::::::::::::: ikmonlj ::::::::::::::"
155 PAUSE 10
160 PRINT AT 15,3; INK 2;":::::::::::::: p ::::::::::::::"
165 PAUSE 10
170 PRINT AT 16,3; INK 2;":::::::::::::: ::::::::::::::"
172 PAUSE 10
175 PRINT AT 17,3; INK 2;":::::::::::::: ::::::::::::::"
180 PRINT AT 1,5; INK 2; INVERSE 1; FLASH 1;"THE MAPLE-LEAF FOREVER"
185 PRINT AT 20,3;" "
186 PAUSE 100
300 DIM b$(17,27)
301 LET b$(1)=" O CANADA! "
302 LET b$(2)=" Our home and native land!"
303 LET b$(3)=" True patriot love "
304 LET b$(4)=" in all thy sons command. "
305 LET b$(5)=" With glowing hearts "
306 LET b$(6)=" we see thee rise "
307 LET b$(7)=" The true north, "
308 LET b$(8)=" strong and free; "
309 LET b$(9)=" From far and wide, "
310 LET b$(10)=" O Canada "
311 LET b$(11)="We stand on guard for thee."
312 LET b$(12)=" God keep our land, "
313 LET b$(13)=" Glorious and free! "
314 LET b$(14)="we stand on guard for thee."
315 LET b$(15)="we stand on guard for thee!"
400 PRINT AT 20,3; INK 2;b$(1): BEEP .8,9: BEEP .4,12: BEEP .2,12: BEEP .9,5
401 PRINT AT 20,3; INK 2;b$(2): BEEP .4,7: BEEP .4,9: BEEP .4,10: BEEP .4,12: BEEP .4,14: BEEP 1.2,7: BEEP .8,69
402 PRINT AT 20,3; INK 2;b$(3): BEEP .8,9: BEEP .4,11: BEEP .3,11: BEEP 1.2,12
403 PRINT AT 20,3; INK 2;b$(4): BEEP .4,14: BEEP .4,16: BEEP .4,16: BEEP .4,14: BEEP .4,14: BEEP .8,12: BEEP .8,69
404 PRINT AT 20,3; INK 2;b$(5): BEEP .3,7: BEEP .1,9: BEEP .6,10: BEEP .2,9: BEEP .4,7
405 PRINT AT 20,3; INK 2;b$(6): BEEP .3,9: BEEP .1,10: BEEP .6,12: BEEP .2,10: BEEP .4,9:
406 PRINT AT 20,3; INK 2;b$(7): BEEP .3,10: BEEP .1,12: BEEP .4,14
407 PRINT AT 20,3; INK 2;b$(8): BEEP .4,12: BEEP .4,10: BEEP .4,9: BEEP 1.2,7: BEEP .8,69
408 PRINT AT 20,3; INK 2;b$(9): BEEP .3,7: BEEP .1,9: BEEP .6,10: BEEP .2,9: BEEP .4,7:
409 PRINT AT 20,3; INK 2;b$(10): BEEP .3,9: BEEP .1,10: BEEP .6,12: BEEP .2,10: BEEP .4,9:
410 PRINT AT 20,3; INK 2;b$(11): BEEP .4,9: BEEP .4,7: BEEP .4,12: BEEP .2,12: BEEP .2,11: BEEP .2,9: BEEP .2,11: BEEP 1.2,12: BEEP .8,69
411 PRINT AT 20,3; INK 2;b$(12): BEEP .8,9: BEEP .6,12: BEEP .2,12: BEEP 1.2,5
412 PRINT AT 20,3; INK 2;b$(13): BEEP .8,10: BEEP .6,14: BEEP .2,14: BEEP 1.2,7: BEEP .8,68
413 PRINT AT 20,3; INK 2;b$(10): BEEP .8,12: BEEP .6,13: BEEP .2,13: BEEP .4,14:
414 PRINT AT 20,3; INK 2;b$(14): BEEP .4,10: BEEP .4,9: BEEP .4,7: BEEP .8,5: BEEP .8,7: BEEP 1.13,9: BEEP .8,69
415 PRINT AT 20,3; INK 2;b$(10): BEEP .8,12: BEEP .4,17: BEEP .2,17: BEEP .4,14:
416 PRINT AT 20,3; INK 2;b$(15): BEEP .4,10: BEEP .4,9: BEEP .4,7: BEEP .8,12: BEEP .8,4: BEEP 1.4,5
417 PRINT AT 20,0; INK 1;"::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"
418 PAUSE 100
419 GO TO 3105
2000 DATA 255,254,252,248,240,224,192,128
2100 DATA 255,127,63,31,15,7,3,1
2200 DATA 1,3,7,15,31,63,127,255
2300 DATA 128,192,224,240,248,252,254,255
2400 DATA 0,0,0,1,131,199,239,255
2500 DATA 60,126,255,255,255,255,255,255
2600 DATA 255,127,63,31,31,63,127,255
2700 DATA 255,254,252,248,248,252,254,255
2710 DATA 1,3,7,15,31,63,120,0
2720 DATA 128,192,224,240,248,252,30,0
2730 DATA 255,255,255,254,224,0,0,0
2740 DATA 255,255,255,127,7,0,0,0
2750 DATA 255,254,224,0,0,0,0,0
2760 DATA 255,127,7,0,0,0,0,0
2770 DATA 255,24,24,24,24,24,24,24
2780 DATA 24,24,24,24,24,24,24,24
2790 DATA 0,0,0,128,193,227,247,255
2800 DATA 0,0,0,0,0,0,0,24
2900 RESTORE 2000: FOR a=USR "a" TO USR "r"+7
2950 READ user: POKE a,user: NEXT a: RETURN
3105 READ z,y: LET z=z/8: BEEP z,y
3110 GO TO 3105
3200 DATA 8,9,4,12,2,12,8,5,4,7,4,9,4,10,4,12,4,14,12,7,8,69,8,9,4,11,3,11,12,12,4,14,4,16,4,16,4,14,4,14
3210 DATA 8,12,8,69,3,7,1,9,6,10,2,9,4,7,3,9,1,10,6,12,2,10,4,9,3,10,1,12,4,14,4,12,4,10,4,9,12,7,8,69,3,7,1,9,6,10,2,9,4,7,3,9,1,10
3215 DATA 6,12,2,10,4,9,4,9,4,7,4,12,2,12,2,11,2,9,2,11,16,12,8,69
3220 DATA 8,9,6,12,2,12,16,5,8,69,8,10,6,14,2,14,16,7,8,69,8,12,6,13,2,13,4,14,4,10,4,9,4,7,8,5,8,7,16,9,8,69,8,12,4,17,2,17,4,14,4,10,4,9,4,7,8,12,8,4,16,5
9000 SAVE "canada.B1" LINE 10Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.


