PET Metronome
Elizabeth Deal
The Pet can double as the most expensive metronome in the world at no additional cost other than typing seven lines of code. Register 59468 (the same one that controls graphic or lower case mode) is used to produce clicking sounds which are heard through a speaker-amplifier connected to the user port. The usual "music" connection is required via pins M and N of that port.
The instruction for using the gadget are in the REM lines. The program begins clicking at the rate of 120 beats per minute. The rate can be adjusted quickly or slowly by pressing the appropriate keys.
100 J = 3600 : T = 360 : B = 30 : R = 120 : P = 1 : M = 59468 : L = 236 : N = 204 : D = 12 : G = 5 : C = 255 : Q = 64 : H = 10 - P 110 K = 151 : S = 152 : A = 0 : V = 12 : TI$ = "000000" 120 X = TI : PRINT "6" R; TI$ : Z = PEEK(K) : F = PEEK(S) : I = P + F * H : IFZ = QTHENPOKEM, V : END 130 R = R - I * (Z = D) + I* (Z = G) : R = R + (R - T) * (R>T) + (R - B) * (R>B) : IFZ<> CORF <> AGOTO120 140 POKEM, N : POKEM, L : W = J/R 150 IF (TI - X) <WGOTO150 160 GOTO120 170 REM=============================== 180 : PET METRONOME 190 : ELIZABETH DEAL, MALVERN, PA 19355 200 REM=============================== 210 RATE IS SHOWN IN BEATS PER MINUTE 220 < > FOR SLOW CHANGE IN RATE 230 SHIFTED < > FOR FAST CHANGE 240 Q TO QUIT & RESET REGISTER 250 T AND B GIVE RANGE OF RATE, B>0 260 MAX RESOLUTION 7 - 8 JIFFIES 270 MAX ERROR 0.6 JIFFIE/BEAT, I THINK. 280 : (LINE 160 IS NOT TIMED) 290 FOR USE AN ACCURATE LONG TERM 300 COUNTER SET RATE 1% LOWER THAN 310 DESIRED. 320 : REL. 2 PETS - K = 515, S = 516