/DECUS 8-152 MUSIC PLAYING PROGRAM / /VERSION ?.? / / / / *0200 PLAY, CLA CLL TAD WORD0 / Reset music pointer DCA WORD TAD NOTE0 / Set up note counter CIA DCA NOTE START, TAD I WORD / Get the current note CLL RTL / Get DAMP bit AND MASKD TAD DAMP0 / Add DAMP offset DCA DAMP / Set DAMP pointer TAD DAMP / Get DAMP pointer IAC / Point to our table IAC DCA DAMP2 / Store table ptr TAD I DAMP2 / Get table entrty DCA DAMP2 / Remember for later TAD I DAMP / Get DAMP value DCA DAMP / ...and remember it TAD DFIX / Get "TAD DAMP" instruction DCA DAMPI / Store it TAD DDFIX / Get "TAD DAMP2" instruction DCA DAMPI2 / Store it TAD I WORD / Get the current note AND MASKF / Extract the frequency info TAD CONSTF / Point into the note table DCA N0 / Store the frequency pointer TAD I N0 / Get the frequency CIA / Negate it DCA N0 / Store the frequency TAD I WORD / Get the current note AND MASKA / Extract the amplitude CLL RAR / Scale it SZA / Is it zero? JMP STAMP / No, just store it TAD CDAM / Yes, get a NOP DCA DAMPI / Store for later TAD DAMPI / Get NOP back DCA DAMPI2 / Store for later STAMP, DCA AMP / Store the amplitude TAD AMP / Get amplitude back DCA AMP2 / Save a copy TAD I WORD / Get the current note AND MASKL / Get the duration RTR CLL RTR RAR TAD CONSTL / Add table offset DCA L0 / Store duration pointer TAD I L0 / Get duration table entry CIA / Negate it DCA L0 / Save as loop counter value TAD L0 / Get it back DCA L / Set up initial loop counter TAD CNTR / Reset tempo counter DCA CNT A, TAD N0 / Get frequency value DCA ONCNT / Store it TAD ONCNT / Get it again DCA OFFNT / Store it again TAD AMP / Get amplitude DAMPI, TAD DAMP / Add DAMP (or not) 6551 / Output it DCA AMP / Store it TAD AMP2 / Get amplitude copy DAMPI2, TAD DAMP2 / Add our table entry (or not) 6552 / Set output amplitude DCA AMP2 / Save the command JMS DELAY / Do the note delay ISZ ONCNT / ...frequency times JMP .-2 6553 / Set output off JMS DELAY / Do the delay again ISZ OFFNT / ...frequency times JMP .-2 JMP A / Go again FIN, ISZ WORD / Note is finished, point to the next / / / / / / / /EDITOR PAGE 2 / / ISZ NOTE / Last note? SKP / No, go get next HLT / Yes, halt JMP START DELAY, 0000 / Magic subroutine ISZ L / Duration expired? JMP DELAYX / No, return ISZ CNT / Yes, bump tempo ounter SKP JMP FIN / Tempo expired, go wrap up TAD L0 / Set up another duration DCA L DELAYX, JMP I DELAY / Return to caller CDAM, NOP / One of these two will be at DAMPI DFIX, TAD DAMP DDFIX, TAD DAMP2 / This or CDAM (NOP) will be at DAMPI2 DAMP2, 0 / Copy of DAMP AMP2, 0 / Copy of AMP / / / /BEGIN NOTREACHED /Filler at start of page *0000 7010 7400 7701 0077 1537 7740 0100 0277 7400 3244 0000 1206 3235 7774 0140 0177 /END NOTREACHED *0020 WORD0, 0000 / Points to the loaded music WORD, 0000 / Points to the current note NOTE0, 0000 / Count of notes this music NOTE, 0000 MASKF, 0037 / Mask for note frequency CONSTF, NOTTBL / Table of notes we can play N0, 0000 ONCNT, 0000 / Count down with note pulse on OFFNT, 0000 / Count down with note pulse off MASKA, 3000 / Mask for note amplitude AMP, 0000 MASKL, 0740 / Mask for note duration CONSTL, DURTBL / Table of durations we can play L0, 0000 / Current note loop counter initial value L, 0000 / Current note loop counter CNTR, 7700 /TEMPO COUNTER CNT, 0000 MASKD, 0001 DAMP0, DAMPP DAMP, 0000 /BEGIN NOTREACHED /Filler in unused gap 0600 0400 0003 0260 0540 0336 4000 0000 0200 0274 0276 7400 0000 7500 0000 0000 0350 0473 0333 0644 0647 0012 7506 1055 1144 7642 1136 2114 /END NOTREACHED / / / / *0170 DAMPP, 7776 7774 /This table parallels DAMPP 6010 6070 /BEGIN NOTREACHED /Filler to end of page 7003 2444 7003 7033 /END NOTREACHED / / / / / / / / /NOTE FREQUENCIES / / *0100 NOTTBL=. / Note table /These are generally scaled by a factor of 1.2X. A1, 456 A1S, 435 A2, 227 A2S, 216 A3, 113 A3S, 106 B1, 417 417 B2, 206 206 B3, 103 C1, 376 C1S, 357 C2, 176 C2S, 167 C3, 77 C3S, 73 D1, 342 D1S, 325 D2, 161 D2S, 152 E1, 311 311 E2, 144 F1, 276 F1S, 263 F2, 136 F2S, 131 G1, 251 G1S, 240 G2, 124 G2S, 117 /BEGIN NOTREACHED /Filler in unused gap 1171 7410 1172 3125 3116 5546 0233 1500 /END NOTREACHED / / /NOTE LENGTHS / / *0150 DURTBL=. / Duration table SCALEF=20 SIXT, 0010^SCALEF SIXT1, 0014^SCALEF EIGHT, 0020^SCALEF EIGHT1, 0030^SCALEF QUART, 0040^SCALEF QUART1, 0060^SCALEF QUARTS, 0050^SCALEF HALF, 0100^SCALEF HALF1, 0140^SCALEF HALFS, 0110^SCALEF HALFE, 0120^SCALEF WHOLE, 0200^SCALEF WHOLE1, 0300^SCALEF WHOLEQ, 0240^SCALEF WHOLHQ, 0340^SCALEF WHOLW, 0400^SCALEF / / / / / / $