The Entertainer plays Scott Joplin’s rag on the TS2068. The melody is played with BEEP while the TS2068’s AY sound chip sounds three-note chords under it, so the piece has a simple accompaniment. An animated title drops the name down the screen and raises the credit line, with a flickering border, before the music starts; when the tune ends the program pauses and plays it again. The tempo is set in line 10, which the REM invites you to change.
The REM reads “The Entertainer by Jim Smith 1987”. The program was published in the LISTing newsletter in October 1987.
Program Analysis
Program Structure
- Lines 10–80 set note durations from the tempo (whole, half, quarter, eighth, sixteenth) and name the notes
ctobas semitone numbers, witho=12for the octave above. - Lines 115–190 are chord subroutines from C to B; each loads three tone registers and calls line 190, which sets the mixer, volumes and envelope with one SOUND statement.
- Lines 200–255 store the chord subroutine line numbers in variables (
cc,cf,cg…), so the score can sayGO SUB cf. - Lines 300–445 are the score; line 500 repeats it.
Notable Techniques
- Writing the score with named notes and durations (
BEEP ei,o+e) makes it readable as music. - Volume registers set to 16 hand the chord over to the envelope generator, so each chord decays like a struck note.
- The title routine flickers the border with
OUT 254.
Potential Issues
- The variable
term(line 255) points to a routine at 195 that silences the chip, but nothing calls it. - The title screen spells the name “The Entertainers”.
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 the author’s phone number was removed from the opening REM) and tested in ZEsarUX.
Source Code
1 REM -=The Entertainer=- by Jim Smith 1987
2 PAPER 0: INK 7: BORDER 1: CLS
3 DRAW 255,0: DRAW 0,175: DRAW -255,0: DRAW 0,-175
5 GO SUB 700
6 BORDER 1
9 REM Change line 10 to any desired tempo
10 LET tempo=1.0
15 LET pause=60
20 LET w=tempo: LET wp=pause
25 LET h=tempo/2: LET hp=pause/2
30 LET q=h/2: LET qp=hp/2
35 LET ei=q/2: LET ep=qp/2
40 LET s=ei/2: LET sp=ep/2
45 LET o=12
50 LET c=0: LET cs=1
55 LET d=2: LET ds=3
60 LET e=4
65 LET f=5: LET fs=6
70 LET g=7: LET gs=8
75 LET a=9: LET as=10
80 LET b=11
90 GO SUB 200
95 GO TO 300
100 REM * Chords *
115 REM c=c=e=g
120 LET x=211: LET y=167: LET z=141: GO SUB 190: RETURN
125 REM c#=c#=f=g#
130 LET x=199: LET y=158: LET z=133: GO SUB 190: RETURN
135 REM d=d=f#=a
140 LET x=188: LET y=149: LET z=125: GO SUB 190: RETURN
145 REM d#=d#=g=a#
150 LET x=177: LET y=141: LET z=118: GO SUB 190: RETURN
155 REM f=f=a=c
157 LET x=158: LET y=125: LET z=105: GO SUB 190: RETURN
160 REM F#=F#-A#-C#
162 LET x=149: LET y=118: LET z=99: GO SUB 190: RETURN
165 REM G=G-B-D
167 LET x=141: LET y=112: LET z=94: GO SUB 190: RETURN
170 REM G#=G#-C-D#
172 LET x=133: LET y=105: LET z=89: GO SUB 190: RETURN
175 REM A=A-C#-E
178 LET x=125: LET y=99: LET z=84: GO SUB 190: RETURN
180 REM A#=A#-D-F
182 LET x=118: LET y=94: LET z=79: GO SUB 190: RETURN
185 REM B=B-D#-F#
187 LET x=112: LET y=89: LET z=74: GO SUB 190: RETURN
190 SOUND 0,x;1,0;2,y;3,0;4,z;5,0;7,56;8,16;9,16;10,16;12,120;13,9: RETURN
195 SOUND 8,0;9,0;10,0: RETURN
200 LET cc=115
205 LET ccs=125
210 LET cd=135
215 LET cds=145
220 LET cf=155
225 LET cfs=160
230 LET cg=165
235 LET cgs=170
240 LET ca=175
245 LET cas=180
250 LET cb=185
255 LET term=195
260 RETURN
300 REM * ENTERTAINER *
305 BEEP ei,d: BEEP ei,ds: GO SUB cc: BEEP ei,e: BEEP q,o+c: BEEP ei,e: BEEP q,o+c: BEEP ei,e: GO SUB cf: BEEP h+q,o+c
310 BEEP ei,o+c: BEEP ei,o+d: BEEP ei,o+ds
315 GO SUB cc: BEEP ei,o+e: BEEP ei,o+c: BEEP ei,o+d: GO SUB cg: BEEP q,o+e: BEEP ei,b: BEEP q,o+d
320 GO SUB cc: BEEP h+q,o+c: BEEP ei,d: GO SUB cg: BEEP ei,ds
325 GO SUB cc: BEEP ei,e: BEEP q,o+c: BEEP ei,e: BEEP q,o+c: BEEP ei,e: GO SUB cf: BEEP w-ei,o+c
330 BEEP ei,a: BEEP ei,g: GO SUB cd
335 BEEP ei,fs: BEEP ei,a: BEEP ei,o+c: BEEP q,o+e: BEEP ei,o+d: BEEP ei,o+c: BEEP ei,a: GO SUB cg
340 BEEP h+ei,o+d: BEEP ei,d: BEEP ei,ds: GO SUB cc
345 BEEP ei,e: BEEP q,o+c: BEEP ei,e: BEEP q,o+c: BEEP ei,e: GO SUB cf: BEEP h+q,o+c: BEEP ei,o+c: BEEP ei,o+d: BEEP ei,o+ds
350 GO SUB cc: BEEP ei,o+e: BEEP ei,o+c: BEEP ei,o+d: GO SUB cg: BEEP q,o+e: BEEP ei,b: BEEP q,o+d
355 GO SUB cc: BEEP h+ei,o+c: BEEP ei,o+d
360 BEEP ei,o+e: BEEP ei,o+c: BEEP ei,o+d: GO SUB cas: BEEP q,o+e: BEEP ei,o+c: BEEP ei,o+d: BEEP ei,o+c
365 GO SUB cf: BEEP ei,o+e: BEEP ei,o+c: BEEP ei,o+d: BEEP q,o+e: BEEP ei,o+c: BEEP ei,o+d: BEEP ei,o+c: GO SUB cc
370 BEEP ei,o+e: BEEP ei,o+c: BEEP ei,o+d: GO SUB cg: BEEP q,o+e: BEEP ei,b: BEEP q,o+d: GO SUB cc
375 BEEP h+ei,o+c: BEEP ei,o+c: BEEP ei,o+f: BEEP ei,o+fs: BEEP q,o+g: BEEP ei,o+a: BEEP q,o+g: BEEP ei,o+e: BEEP ei,o+f: BEEP ei,o+fs
380 BEEP q,o+g: BEEP ei,o+a: BEEP q,o+g: BEEP ei,o+e: BEEP ei,o+c: BEEP ei,g: GO SUB cf
385 BEEP ei,a: BEEP ei,b: BEEP ei,o+c: BEEP ei,o+d: BEEP ei,o+e: BEEP ei,o+d: BEEP ei,o+c: BEEP ei,o+d: GO SUB cc
390 BEEP ei,g: BEEP ei,o+e: BEEP ei,o+f: BEEP ei,o+g: BEEP ei,o+a: BEEP ei,o+g: BEEP ei,o+e: BEEP ei,o+f
395 BEEP q,o+g: BEEP ei,o+a: BEEP q,o+g
400 BEEP ei,o+e: BEEP ei,o+f: BEEP ei,o+fs
405 BEEP q,o+g: BEEP ei,o+a: BEEP q,o+g: BEEP ei,o+g: BEEP ei,o+a: BEEP ei,o+as: GO SUB cg
410 BEEP ei,o+b: BEEP q,o+b: GO SUB cd: BEEP q,o+b: BEEP ei,o+a: BEEP ei,fs+o: BEEP ei,o+d
415 GO SUB cg: BEEP h+ei,o+g: BEEP ei,o+e: BEEP ei,o+f: BEEP ei,o+fs: GO SUB cc
420 BEEP q,o+g: BEEP ei,o+a: BEEP q,o+g: BEEP ei,o+e: BEEP ei,o+f: BEEP ei,o+fs: BEEP q,o+g: BEEP ei,o+a: BEEP q,o+g: BEEP ei,o+e: BEEP ei,o+c: BEEP ei,g: GO SUB cf
425 BEEP ei,a: BEEP ei,b: BEEP ei,o+c: BEEP ei,o+d: BEEP ei,o+e: BEEP ei,o+d: BEEP ei,o+c: BEEP ei,o+d: GO SUB cc
430 BEEP h+ei,o+c: GO SUB cg: BEEP ei,g: GO SUB cc: BEEP ei,fs: BEEP ei,g: GO SUB cf
435 BEEP q,o+c: BEEP ei,a: BEEP q,o+c: BEEP ei,a: BEEP ei,o+c: BEEP ei,a: GO SUB cc
440 BEEP ei,g: BEEP ei,o+c: BEEP ei,o+e: BEEP q,o+g: BEEP ei,o+e: BEEP ei,o+c: BEEP ei,g: GO SUB cd
445 BEEP q,a: BEEP q,o+c: GO SUB cg: BEEP ei,o+e: BEEP q,o+d: GO SUB cc: BEEP h+ei,o+c
500 PAUSE 250: GO TO 10
700 FOR i=2 TO 10: PRINT AT i-1,4;" ";AT i,4;"-=-=The Entertainers=-=-": PAUSE 10: BEEP .01,20: NEXT i
715 FOR i=19 TO 13 STEP -1: PAUSE 5: PRINT AT i,5;" ";AT i-1,4;" by Jim Smith 1987": PAUSE 10: PRINT AT i,5;" ": BEEP .01,20: NEXT i
720 FOR i=2 TO 250
750 OUT 254,7: OUT 254,24: NEXT i
780 RETURN
8000 INK 0: PAPER 7: BORDER 7: CLS : STOP
8999 STOP
9000 SAVE "entert.B1" LINE 1Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

