Home » Archimedes archive » Archimedes World » AW-1991-05.adf » May91 » !AWMay91/Goodies/SoundTrack/!STracker/PlayModA2

!AWMay91/Goodies/SoundTrack/!STracker/PlayModA2

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Archimedes World » AW-1991-05.adf » May91
Filename: !AWMay91/Goodies/SoundTrack/!STracker/PlayModA2
Read OK:
File size: 4294 bytes
Load address: 0000
Exec address: 0000
Duplicates

There is 1 duplicate copy of this file in the archive:

File contents
   10REM >PlayModA2
   20REM
   30REM .-------------------------------------------------------------------.
   40REM |                                                                   |
   50REM | System Interrupt SoundTrackermodule playroutine      Version 2.10 |
   60REM |                                                    (32 inst only) |
   70REM | (c)1990 Hugo Fiennes (0749)  72234                    28-Mar-1990 |
   80REM |                      (0749) 679794 data (300-2400)                |
   90REM |                      (0749) 670030 data (300-HST/V32 2 lines)     |
  100REM |                                                                   |
  110REM `-------------------------------------------------------------------'
  120REM
  130REM Snailmail: Hugo Fiennes, Burcott Manor, Wells, Somerset, BA5 1NH
  140REM
  150REM Prestel  : 045847608       Cix: altman          SID: 1012 (Commbase)
  160REM                                                     &1100
  170REM This code is public domain and MAY NOT BE SOLD OR INCLUDED IN ANY
  180REM PRODUCT THAT WILL BE SOLD WITHOUT PRIOR PERMISSION FROM MOI!
  190REM
  200REM You may copy and distribute this code as long as you don't modify
  210REM the copy you pass on: any improvements, etc should be sent back
  220REM to me so I can modify the master copy.
  230REM
  240REM If you do write any demos, or other p.d. s/w that uses this code,
  250REM please send me a copy!
  260REM
  270REM Note: this version has the code that helps to stop the player losing
  280REM       notes when called on VSYNC/other 50Hz interrupts (problem was
  290REM       new note generation interrupting sound buffer filling).
  300REM
  310REM vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
  320REM This version will play almost any 'ripped' module or module saved
  330REM MasterSoundTracker v2.3-> (31 instrument versions ONLY, ie not v2.4!)
  340REM ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  350REM
  360REM For 15 instrument playing, get PlaymodA from your local pd supplier!
  370REM
  380:
  390REM Reserve space for the module
  400DIM code 500000
  410
  420*.
  430INPUT'"ModuleName:"song$
  440
  450REM Total length for soundtracker module
  460A%=OPENINsong$:tlen%=EXT#A%:CLOSE#A%
  470
  480REM Number of us between samples. Program falls over at delays of less
  490REM then 10us (100kHz/channel).
  500us=34
  510
  520PRINT'"Assembling code..."
  530FORC=0TO2STEP2
  540P%=code
  550[OPTC
  560;------------------------------------------------------------------------
  570; Soundtracker playroutine             v2.3 With portamento,speed change,
  580;                         volume control,pattern break, & 32 intstruments
  590;------------------------------------------------------------------------
  600
  610.Fill
  620ADR   R8,ourinf
  630ADD   R8,R8,R7,LSL#5
  640LDMIA R8,{R1-R6}
  650.FillLoop
  660]
  670FOR sle%=1 TO 10
  680[OPT C
  690LDRB  R0,[R5,R1,LSR#16] ; Get sample byte
  700SUBS  R0,R0,R6          ; Scale volume
  710MOVMI R0,#0
  720STRB  R0,[R12],R11      ; Put in in buffer
  730ADD   R1,R1,R2          ; Add offset
  740]
  750NEXT
  760[OPT C
  770CMP   R4,R1,LSR#16      ; End of note?
  780BGT   cbf
  790MOVS  R1,R3             ; Yes, loop back
  800MOVEQ R2,#0             ; If no looping, keep quiet!
  810.cbf
  820CMP   R12,R10           ; End of buffer fill?
  830BLT   FillLoop          ; Nope, fill some more
  840
  850ADR   R0,newdata        ; So we don't lose notes
  860LDRB  R4,[R0,R7]        ; Has voice been updated whilst we've been
  870CMP   R4,#0             ; filling?
  880STMEQIA R8,{R1-R2}      ; No, re-store info
  890MOVNE R4,#0             ;
  900STRNEB R4,[R0,R7]       ; Else zero the flag
  910
  920MOV   R0,#%00001000     ; voice active
  930LDMFD R13!,{PC}         ; ..and return to Level1
  940
  950.newdata
  960EQUD 0
  970
  980.ourinf
  990EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0
 1000EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0
 1010EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0
 1020EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0
 1030
 1040.channelnote
 1050EQUD 0:EQUD 0:EQUD 0:EQUD 0
 1060
 1070.effecttype
 1080EQUD 0:EQUD 0:EQUD 0:EQUD 0
 1090
 1100.info
 1110EQUD  0              ; Position
 1120EQUD  0              ; Pattern length
 1130EQUD  0              ; Sequence posn
 1140
 1150.seqbase
 1160EQUD  &3B8           ; Sequence base
 1170
 1180.trkbase
 1190EQUD  &43C           ; Pattern base address
 1200
 1210.current
 1220EQUD 0               ; Current instruments
 1230
 1240.counti
 1250EQUD 0               ; Vsync counter
 1260
 1270.speed
 1280EQUD 6               ; Speed counter (default=6)
 1290
 1300.intr                ; Called every VSYNC
 1310STMFD R13!,{R0-R12,R14}
 1320LDR   R1,counti      ; Load count
 1330BL    doeffect       ; Do any effects
 1340LDR   R2,speed       ; Current playspeed
 1350ADD   R1,R1,#1       ; Increment count
 1360CMP   R1,R2          ; Ready to play?
 1370MOVGE R1,#0          ; Yes
 1380STR   R1,counti      ; Restore count
 1390BLGE  playnote       ; If so, zero counter and play a note
 1400LDMFD R13!,{R0-R12,PC}
 1410
 1420.playnote
 1430STMFD R13!,{R14}
 1440ADR   R0,info        ; Load sequence info
 1450LDMIA R0,{R7-R9}
 1460.andagain
 1470STMFD R13!,{R9}
 1480BL    trackadr
 1490LDR   R0,seqbase
 1500ADD   R11,R0,R10     ; R11=address of sequence
 1510LDR   R0,trkbase
 1520ADD   R12,R0,R10     ; R12=address of track
 1530
 1540LDRB  R6,[R11,R7]    ; Get address of notes
 1550ADD   R12,R12,R6,LSL#10
 1560ADD   R12,R12,R9,LSL#4
 1570ADR   R9,current
 1580
 1590MOV   R5,#3          ; Do 4 channels
 1600.dochannel
 1610ADD   R11,R12,R5,LSL#2
 1620LDRB  R6,[R11,#2]    ; Get instrument number
 1630MOV   R6,R6,LSR#4    ; Shuffle
 1640LDRB  R0,[R11,#0]    ; Get extra bit from pitch to make 32 instruments
 1650AND   R0,R0,#&80
 1660ORRS  R6,R6,R0,LSR#3 ;
 1670STRNEB R6,[R9,R5]    ; If it's zero, load last instrument, else store
 1680LDREQB R6,[R9,R5]    ; this one.
 1690CMP   R6,#0          ; Any instrument selected?
 1700BEQ   nextchannel    ; Do next channel
 1710SUB   R6,R6,#1       ; Correct R6 for calculations below
 1720MOV   R0,R11         ; Get pitch
 1730BL    gethilo        ; (bloody 68000)
 1740BICS  R4,R0,#&8000   ; R4=standard pitch
 1750BEQ   nextchannel    ; But is it zero? If so, don't play anything
 1760ADR   R3,channelnote ; Save pitch for arpeggio, portamento, etc
 1770STR   R4,[R3,R5,LSL#2]
 1780ADR   R3,inversetable ; Scale pitch using inverse table
 1790LDR   R4,[R3,R4,LSL#2]
 1800ADR   R2,ourinf
 1810ADD   R2,R2,R5,LSL#5 ; Get address of fill control block
 1820MOV   R1,#0          ; Set fill to start filling at zero offset
 1830STR   R1,[R2,#0]
 1840STR   R4,[R2,#4]     ; Set pitch
 1850ADR   R3,sampleloc   ; Address of sample lookup table
 1860LDR   R3,[R3,R6,LSL#2] ; R3=Actual sample offset
 1870ADD   R3,R3,R10      ; R3=Actual sample address
 1880STR   R3,[R2,#16]    ; Set instrument address
 1890MOV   R0,#1          ; Tell voice generator about new instrument
 1900ADR   R1,newdata     ; so we don't lose notes/voices on interrupts.
 1910STRB  R0,[R1,R5]
 1920ADD   R3,R10,#&14    ; Offset of sample play data from base
 1930MOV   R1,#&1E        ; (sample data multiplier)
 1940MLA   R3,R6,R1,R3    ; R3=instrument play data base
 1950ADD   R0,R3,#&1C     ; Get repeat length
 1960BL    gethilo
 1970CMP   R0,#1          ; No repeats?
 1980BEQ   norep          ; Branch to the next bit
 1990MOV   R1,R0,LSL#1    ; x2 for repeat length
 2000ADD   R0,R3,#&1A     ; Get repeat start offset
 2010BL    gethilo
 2020ADD   R0,R0,R1       ; Make new length by adding the two
 2030STR   R0,[R2,#12]    ; and set it
 2040ADD   R0,R3,#&1A
 2050BL    gethilo        ; Get start repeat posn
 2060ADD   R0,R0,#1       ; make non-zero
 2070STR   R0,[R2,#8]     ; Store it
 2080B     next           ; branch over next bit
 2090.norep
 2100ADD   R0,R3,#&16
 2110BL    gethilo        ; Get the length of the sample
 2120MOV   R0,R0,LSL#1    ; x2 of course
 2130STR   R0,[R2,#12]    ; and set it
 2140ADD   R0,R3,#&1A
 2150BL    gethilo        ; Get start repeat posn
 2160STR   R0,[R2,#8]     ; Store it
 2170.next                ; Before we go, do the volume
 2180ADD   R0,R3,#&18
 2190BL    gethilo        ; Get volume
 2200CMP   R0,#64         ; Over?
 2210MOVGE R0,#63         ; Correct
 2220ADR   R1,voltab      ; Volume table
 2230LDRB  R0,[R1,R0]     ; Get new volume
 2240STR   R0,[R2,#20]    ; Store it
 2250.nextchannel
 2260ADR   R3,effecttype  ; Cancel any current effects
 2270MOV   R4,#0          ;
 2280STR   R4,[R3,R5,LSL#2] ;
 2290BL    effectcheck    ; Check for effects
 2300SUBS  R5,R5,#1       ; Decrement channel number
 2310BPL   dochannel      ; Nope, do another channel
 2320LDMFD R13!,{R9}      ; Get our R9 back!
 2330LDR   R0,jumpflag    ; Skip rest of pattern?
 2340CMP   R0,#0          ;
 2350MOVNE R9,#63         ; Yep
 2360MOVNE R0,#0          ; Reset the flag
 2370STRNE R0,jumpflag    ;
 2380ADD   R9,R9,#1       ; Increment sequence number
 2390CMP   R9,#64         ; Finished sequence?
 2400BNE   vend           ; If not, don't go onto next pattern entry
 2410MOV   R9,#0
 2420ADD   R7,R7,#1       ; Increment pattern posn
 2430CMP   R7,R8          ; End of song?
 2440MOVGT R7,#0          ; ...and again, folks!
 2450.vend
 2460ADR   R0,info
 2470STMIA R0,{R7-R9}     ; Store new values
 2480LDMFD R13!,{PC}      ; And return
 2490
 2500.gethilo             ; Gets Hi-Lo stored info
 2510STMFD R13!,{R1}      ; R0=address of info
 2520LDRB  R1,[R0,#0]     ; Get high byte
 2530LDRB  R0,[R0,#1]     ; Get lo byte
 2540ORR   R0,R0,R1,LSL#8 ; Mix the 2
 2550LDMFD R13!,{R1}      ; restore R1
 2560MOV   PC,R14         ; return
 2570
 2580.effectcheck         ; Check for any effects
 2590LDRB  R6,[R11,#3]    ; Get info
 2600LDRB  R4,[R11,#2]    ; Get effect nunber
 2610AND   R4,R4,#&F      ;
 2620CMP   R4,#&C         ; Volume change?
 2630BNE   eff            ; No
 2640CMP   R6,#64         ; Over?
 2650MOVGE R6,#63         ; Correct
 2660ADR   R1,voltab      ;
 2670LDRB  R0,[R1,R6]     ; Get right units
 2680ADR   R1,ourinf      ; Find table address
 2690ADD   R1,R1,R5,LSL#5 ;
 2700STR   R0,[R1,#20]    ; Store new volume
 2710MOV   PC,R14
 2720.eff
 2730CMP   R4,#&D         ; Pattern break?
 2740STREQ R4,jumpflag    ; Jump to end of pattern
 2750MOVEQ PC,R14         ;
 2760CMP   R4,#&F         ; Change speed?
 2770BNE   eff1           ; No
 2780AND   R6,R6,#&F      ; Mask new speed
 2790STR   R6,speed       ; Store it
 2800MOV   PC,R14         ; Return
 2810.eff1
 2820CMP   R4,#1          ; Portamento up?
 2830BLT   eff2           ; Nope
 2840CMP   R4,#2          ; Or down?
 2850BGT   eff2           ; Nope
 2860ORR   R6,R6,R4,LSL#8 ; Make new word
 2870ADR   R3,effecttype  ; Save it
 2880STR   R6,[R3,R5,LSL#2] ;
 2890MOV   PC,R14         ; Return
 2900.eff2
 2910MOV   PC,R14         ; Return
 2920
 2930.doeffect            ; Do effect detailed in 'effecttype' (R1=subnote #)
 2940MOV   R5,#3          ; 4 channels
 2950ADR   R2,channelnote ; Amiga-note
 2960ADR   R3,effecttype  ; R3=effecttype table
 2970ADR   R4,inversetable ; R4=inverse pitch lookup table
 2980.doeff1
 2990ADR   R8,ourinf      ; Calculate address offset of voice-info table
 3000ADD   R8,R8,R5,LSL#5 ;
 3010LDR   R0,[R3,R5,LSL#2] ; Any effect to do?
 3020CMP   R0,#0          ;
 3030BEQ   doeffnext      ; Nope
 3040AND   R6,R0,#&F00    ; R6=effect type
 3050AND   R0,R0,#&FF     ; R0=effect data
 3060
 3070CMP   R6,#&100       ; Portamento up?
 3080BNE   doe1           ; No
 3090LDR   R6,[R2,R5,LSL#2] ; Get current tone
 3100SUB   R0,R0,#1       ; Slide up
 3110SUB   R6,R6,R0
 3120STR   R6,[R2,R5,LSL#2] ; Re-save
 3130LDR   R6,[R4,R6,LSL#2] ; Get archimedes-frequency
 3140STR   R6,[R8,#4]     ; Put in parameter block
 3150B     doeffnext
 3160
 3170.doe1
 3180CMP   R6,#&200       ; Portamento down?
 3190BNE   doe2           ; No
 3200LDR   R6,[R2,R5,LSL#2] ; Get current tone
 3210SUB   R0,R0,#1       ; Slide down
 3220ADD   R6,R6,R0
 3230STR   R6,[R2,R5,LSL#2] ; Re-save
 3240LDR   R6,[R4,R6,LSL#2] ; Get archimedes-frequency
 3250STR   R6,[R8,#4]     ; Put in parameter block
 3260B     doeffnext
 3270.doe2
 3280.doeffnext
 3290SUBS  R5,R5,#1       ; Next channel
 3300BPL   doeff1         ;
 3310MOV   PC,R14         ; No more, return
 3320
 3330.jumpflag
 3340EQUD 0               ; <>0 if pattern is to be terminated
 3350
 3360.oldvox
 3370EQUD 0               ; So we can kill the voice
 3380
 3390.sampleloc           ; Table of sample offsets
 3400EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0
 3410EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0
 3420EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0
 3430EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0
 3440
 3450.voltab              ; 64-byte volume table
 3460]:P%+=64:[OPT C
 3470
 3480.installsound        ; Install voices
 3490STMFD R13!,{R0-R10,R14}
 3500ADR   R0,VoiceBase   ; Make TrackerVox a voice
 3510MOV   R1,#0
 3520SWI   "Sound_InstallVoice"
 3530STR   R1,oldvox      ; So we can kill it
 3540MOV   R10,#1         ; Mute voices 1-8
 3550.mutelp
 3560MOV   R0,R10
 3570MOV   R1,#0
 3580SWI   "Sound_AttachVoice"
 3590ADD   R10,R10,#1
 3600CMP   R10,#9
 3610BNE   mutelp
 3620MOV   R10,#1
 3630.attlp               ; Attach voices 1-4 to TrackerVox
 3640MOV   R0,R10
 3650ADR   R1,VoiceName
 3660SWI   "Sound_AttachNamedVoice"
 3670ADD   R10,R10,#1
 3680CMP   R10,#5
 3690BNE   attlp
 3700
 3710MOV   R0,#1          ; Slight right bias for channel 1
 3720MOV   R1,#16
 3730SWI   "Sound_Stereo"
 3740MOV   R0,#2          ; Slight left bias for channel 2
 3750MVN   R1,#15
 3760SWI   "Sound_Stereo"
 3770MOV   R0,#3          ; and for channel 3 (Amiga goes RLLR)
 3780MVN   R1,#15
 3790SWI   "Sound_Stereo"
 3800MOV   R0,#4          ; And right cgain for channel 4
 3810MOV   R1,#16
 3820SWI   "Sound_Stereo"
 3830
 3840MOV   R0,#4          ; Play 4 voices
 3850MOV   R1,#208        ; Buffer length = 200
 3860MOV   R2,#us         ; For this many microseconds
 3870MOV   R3,#0          ; Leave these 2 unchanged
 3880MOV   R4,#0
 3890SWI   "Sound_Configure"
 3900
 3910MOV   R0,#1          ; Sound all 4 voices, parameters are really
 3920MVN   R1,#14         ; immaterial
 3930MOV   R2,#100
 3940MOV   R3,#255
 3950SWI   "Sound_Control"
 3960MOV   R0,#2
 3970SWI   "Sound_Control"
 3980MOV   R0,#3
 3990SWI   "Sound_Control"
 4000MOV   R0,#4
 4010SWI   "Sound_Control"
 4020LDMFD R13!,{R0-R10,PC} ; & Return
 4030
 4040                     ; Voice parameter block
 4050.VoiceBase B Fill:B Fill:B Fill:LDMFD R13!,{PC}:LDMFD R13!,{PC}:LDMFD R13!,{PC}:LDMFD R13!,{PC}:EQUD VoiceName-VoiceBase
 4060.VoiceName EQUS"TrackerVox":EQUB 0:ALIGN
 4070
 4080.killsound           ; Kill voices
 4090STMFD R13!,{R0-R10,R14}
 4100MOV R0,#0            ; De-install TrackerVox
 4110LDR R1,oldvox
 4120SWI "Sound_RemoveVoice"
 4130
 4140MOV R10,#1           ; Kill the 4 voices
 4150.ksl
 4160MOV R0,R10
 4170MOV R1,#0
 4180SWI "Sound_AttachVoice"
 4190ADD R10,R10,#1
 4200CMP R10,#5
 4210BNE ksl
 4220LDMFD R13!,{R0-R10,PC} ; Return
 4230
 4240.inversetable
 4250;EQUD 1:             ; Dummy value!
 4260]:P%+=4096:[OPT C
 4270.trackadr            ; Get address of track base
 4280ADR R10,track
 4290MOV PC,R14
 4300.track               ; Track base
 4310]:P%+=tlen%:[OPT C   ; Is tlen% long
 4320
 4330ALIGN
 4340.convert
 4350STMFD R13!,{R0-R4}
 4360ADR R2,ltable:MOV R3,#0
 4370.loop
 4380LDRB R4,[R0,R3]:EOR R4,R4,#128:LDRB R4,[R2,R4]:STRB R4,[R0,R3]
 4390ADD R3,R3,#1:CMP R3,R1:BLE loop
 4400LDMFD R13!,{R0-R4}
 4410MOV PC,R14
 4420.ltable
 4430]:P%+=256:[OPT C     ; 256 byte lookup table
 4440
 4450.endcode             ; The endcode pointer
 4460]
 4470NEXT
 4480
 4490PRINT"Building sample conversion table..."
 4500REM Setup sample conversion table
 4510FOR A%=0 TO 255
 4520  B%=A%-128:B%=B%<<24:SYS "Sound_SoundLog",B% TO ltable?A%
 4530NEXT
 4540
 4550PRINT"Building volume table..."
 4560REM Setup volume table
 4570FOR A%=0 TO 63
 4580  voltab?A%=255-((A%/3+42)*4)
 4590NEXT
 4600
 4610PRINT"Building pitch table..."
 4620REM Setup inverse pitch table
 4630FOR A%=1 TO 1023
 4640  a=3575872/A%:inversetable!(A%*4)=(a/(1000000/us))*60000
 4650NEXT
 4660
 4670CLS
 4680PRINT"Code length = ";endcode-code
 4690
 4700REM Soundtracker datafile
 4710PRINT"Loading module...(";
 4720OSCLI("LOAD "+song$+" "+STR$~track)
 4730track$="":B%=0
 4740REPEAT
 4750  IF (track?B%)<>0 THEN track$+=CHR$(track?B%):B%+=1
 4760UNTIL(track?B%)=0
 4770PRINT;track$;")"
 4780
 4790REM Find length of tune data by looking through patterns
 4800high%=0
 4810FOR A%=0 TO 127
 4820  IF track?(&3B8+A%)>high% THEN high%=track?(&3B8+A%)
 4830NEXT
 4840high%+=1
 4850
 4860REM Convert samples
 4870A%=track+&43C+(high%*1024)
 4880B%=track+tlen%-A%
 4890PRINT"Converting ";~(A%-track);"+";~B%
 4900CALL convert
 4910
 4920samplei=track+&14
 4930spoint=A%:samples=track
 4940
 4950PRINT'"Nr Name                 Length  Volume"
 4960PRINT"-- -------------------- ------- ------"
 4970FOR A%=0 TO 30
 4980  sampleo=samplei+(A%*&1E)
 4990  name$="":B%=0
 5000  REPEAT
 5010    IF (sampleo?B%)<>0 name$+=CHR$(sampleo?B%):B%+=1
 5020  UNTIL(sampleo?B%)=0 OR B%=20
 5030  IF name$<>"" THEN
 5040    len%=2*((sampleo?22)*256+(sampleo?23))
 5050    vol%=(sampleo?24)*256+(sampleo?25)
 5060    PRINTTAB(0);~(A%+1);TAB(3);name$;TAB(24);len%;TAB(32);vol%
 5070    sampleloc!(A%*4)=spoint-samples
 5080    spoint+=len%
 5090  ENDIF
 5100NEXT
 5110PRINT"                        -------"
 5120PRINT"                        ";(spoint-samples-&258-(high%*1024))
 5130
 5140REM Store length of tune
 5150info!4=track?&3B6-1
 5160
 5170PRINT"Tune length = ";info!4+1
 5180
 5190ON ERROR CALLkillsound:REPORT:END
 5200REM Get things in motion!
 5210CALL installsound
 5220STEREO 0,0
 5230STEREO 1,0
 5240STEREO 2,0
 5250STEREO 3,0
 5260PRINT"<Space> to reselect tune"'
 5270PRINTTAB(0,25);"Position:00";info!8;TAB(30,25);"Pattern:";!info
 5280FOR A%=0 TO 3
 5290  PRINTTAB(0,27+A%);"Voice:";A%;"  Last instrument:";~current?A%;"  Pitch:0000";~ourinf!(32*A%+4);"  Effect:0"
 5300NEXT
 5310OFF
 5320REPEAT
 5330  WAIT:CALL intr
 5340  PRINTTAB(9,25);info!8;"   ";TAB(38,25);!info;"  "
 5350  FOR A%=0 TO 3
 5360    PRINTTAB(25,27+A%);~current?A%;TAB(34,27+A%);~ourinf!(32*A%+4);"   ";TAB(48,27+A%);(effecttype!(A%*4))>>8;"  "
 5370  NEXT
 5380UNTILINKEY(0)=32
 5390ON
 5400CALL killsound
 5410PRINT
 5420RUN

� >PlayModA2
�
K� .-------------------------------------------------------------------.
(K� |                                                                   |
2K� | System Interrupt SoundTrackermodule playroutine      Version 2.10 |
<K� |                                                    (32 inst only) |
FK� | (c)1990 Hugo Fiennes (0749)  72234                    28-Mar-1990 |
PK� |                      (0749) 679794 data (300-2400)                |
ZK� |                      (0749) 670030 data (300-HST/V32 2 lines)     |
dK� |                                                                   |
nK� `-------------------------------------------------------------------'
x�
�F� Snailmail: Hugo Fiennes, Burcott Manor, Wells, Somerset, BA5 1NH
��
�J� Prestel  : 045847608       Cix: altman          SID: 1012 (Commbase)
�?�                                                     &1100
�G� This code is public domain and MAY NOT BE SOLD OR INCLUDED IN ANY
�B� PRODUCT THAT WILL BE SOLD WITHOUT PRIOR PERMISSION FROM MOI!
��
�G� You may copy and distribute this code as long as you don't modify
�E� the copy you pass on: any improvements, etc should be sent back
�,� to me so I can modify the master copy.
��
�G� If you do write any demos, or other p.d. s/w that uses this code,
�� please send me a copy!
�
J� Note: this version has the code that helps to stop the player losing
I�       notes when called on VSYNC/other 50Hz interrupts (problem was
"C�       new note generation interrupting sound buffer filling).
,�
6K� vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
@G� This version will play almost any 'ripped' module or module saved
JK� MasterSoundTracker v2.3-> (31 instrument versions ONLY, ie not v2.4!)
TK� ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^�
hJ� For 15 instrument playing, get PlaymodA from your local pd supplier!
r�
|:
�"� Reserve space for the module
�� code 500000
�
�*.
��'"ModuleName:"song$
�
�*� Total length for soundtracker module
�A%=�song$:tlen%=�#A%:�#A%
�
�H� Number of us between samples. Program falls over at delays of less
�!� then 10us (100kHz/channel).
�	us=34
�
�'"Assembling code..."
�C=0�2�2
P%=code
&	[OPTC
0M;------------------------------------------------------------------------
:M; Soundtracker playroutine             v2.3 With portamento,speed change,
DM;                         volume control,pattern break, & 32 intstruments
NM;------------------------------------------------------------------------
X
b	.Fill
lADR   R8,ourinf
vADD   R8,R8,R7,LSL#5
�LDMIA R8,{R1-R6}
�
.FillLoop
�]
�� sle%=1 � 10
�
[OPT C
�-LDRB  R0,[R5,R1,LSR#16] ; Get sample byte
�*SUBS  R0,R0,R6          ; Scale volume
�MOVMI R0,#0
�.STRB  R0,[R12],R11      ; Put in in buffer
�(ADD   R1,R1,R2          ; Add offset
�]
��
�
[OPT C
*CMP   R4,R1,LSR#16      ; End of note?

BGT   cbf
,MOVS  R1,R3             ; Yes, loop back
 5�Q R2,#0             ; If no looping, keep quiet!
*.cbf
41CMP   R12,R10           ; End of buffer fill?
>2BLT   FillLoop          ; Nope, fill some more
H
R4ADR   R0,newdata        ; So we don't lose notes
\FLDRB  R4,[R0,R7]        ; Has voice been updated whilst we've been
f&CMP   R4,#0             ; filling?
p/STMEQIA R8,{R1-R2}      ; No, re-store info
zMOVNE R4,#0             ;
�0STRNEB R4,[R0,R7]       ; Else zero the flag
�
�*MOV   R0,#%00001000     ; voice active
�4LDMFD R13!,{PC}         ; ..and return to Level1
�
�.newdata
�
EQUD 0
�
�.ourinf
�;EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0
�;EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0
�;EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0
�;EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0

.channelnote
EQUD 0:EQUD 0:EQUD 0:EQUD 0
$
..effecttype
8EQUD 0:EQUD 0:EQUD 0:EQUD 0
B
L	.info
V#EQUD  0              ; Position
`)EQUD  0              ; Pattern length
j(EQUD  0              ; Sequence posn
t
~.seqbase
�(EQUD  &3B8           ; Sequence base
�
�.trkbase
�/EQUD  &43C           ; Pattern base address
�
�.current
�.EQUD 0               ; Current instruments
�
�.counti
�(EQUD 0               ; Vsync counter
�
�
.speed
4EQUD 6               ; Speed counter (default=6)


-.intr                ; Called every VSYNC
STMFD R13!,{R0-R12,R14}
(%LDR   R1,counti      ; Load count
2)BL    doeffect       ; Do any effects
<,LDR   R2,speed       ; Current playspeed
F*ADD   R1,R1,#1       ; Increment count
P)CMP   R1,R2          ; Ready to play?
ZMOVGE R1,#0          ; Yes
d(STR   R1,counti      ; Restore count
n>BLGE  playnote       ; If so, zero counter and play a note
xLDMFD R13!,{R0-R12,PC}
�
�
.playnote
�STMFD R13!,{R14}
�-ADR   R0,info        ; Load sequence info
�LDMIA R0,{R7-R9}
�
.andagain
�STMFD R13!,{R9}
�BL    trackadr
�LDR   R0,seqbase
�2ADD   R11,R0,R10     ; R11=address of sequence
�LDR   R0,trkbase
�/ADD   R12,R0,R10     ; R12=address of track
�
/LDRB  R6,[R11,R7]    ; Get address of notes
ADD   R12,R12,R6,LSL#10
ADD   R12,R12,R9,LSL#4
"ADR   R9,current
,
6(MOV   R5,#3          ; Do 4 channels
@.dochannel
JADD   R11,R12,R5,LSL#2
T0LDRB  R6,[R11,#2]    ; Get instrument number
^"MOV   R6,R6,LSR#4    ; Shuffle
hJLDRB  R0,[R11,#0]    ; Get extra bit from pitch to make 32 instruments
r�   R0,R0,#&80
|�RS  R6,R6,R0,LSR#3 ;
�ISTRNEB R6,[R9,R5]    ; If it's zero, load last instrument, else store
�$LDREQB R6,[R9,R5]    ; this one.
�3CMP   R6,#0          ; Any instrument selected?
�*BEQ   nextchannel    ; Do next channel
�<SUB   R6,R6,#1       ; Correct R6 for calculations below
�$MOV   R0,R11         ; Get pitch
�)BL    gethilo        ; (bloody 68000)
�,BICS  R4,R0,#&8000   ; R4=standard pitch
�EBEQ   nextchannel    ; But is it zero? If so, don't play anything
�CADR   R3,channelnote ; Save pitch for arpeggio, portamento, etc
�STR   R4,[R3,R5,LSL#2]
�;ADR   R3,inversetable ; Scale pitch using inverse table
�LDR   R4,[R3,R4,LSL#2]
ADR   R2,ourinf
<ADD   R2,R2,R5,LSL#5 ; Get address of fill control block
CMOV   R1,#0          ; Set fill to start filling at zero offset
&STR   R1,[R2,#0]
0$STR   R4,[R2,#4]     ; Set pitch
:9ADR   R3,sampleloc   ; Address of sample lookup table
D4LDR   R3,[R3,R6,LSL#2] ; R3=Actual sample offset
N3ADD   R3,R3,R10      ; R3=Actual sample address
X1STR   R3,[R2,#16]    ; Set instrument address
bDMOV   R0,#1          ; Tell voice generator about new instrument
lGADR   R1,newdata     ; so we don't lose notes/voices on interrupts.
vSTRB  R0,[R1,R5]
�?ADD   R3,R10,#&14    ; Offset of sample play data from base
�3MOV   R1,#&1E        ; (sample data multiplier)
�7MLA   R3,R6,R1,R3    ; R3=instrument play data base
�,ADD   R0,R3,#&1C     ; Get repeat length
�BL    gethilo
�&CMP   R0,#1          ; No repeats?
�1BEQ   norep          ; Branch to the next bit
�/MOV   R1,R0,LSL#1    ; x2 for repeat length
�2ADD   R0,R3,#&1A     ; Get repeat start offset
�BL    gethilo
�<ADD   R0,R0,R1       ; Make new length by adding the two
�%STR   R0,[R2,#12]    ; and set it
�ADD   R0,R3,#&1A
0BL    gethilo        ; Get start repeat posn
(ADD   R0,R0,#1       ; make non-zero
#STR   R0,[R2,#8]     ; Store it
 /B     next           ; branch over next bit
*
.norep
4ADD   R0,R3,#&16
>7BL    gethilo        ; Get the length of the sample
H'MOV   R0,R0,LSL#1    ; x2 of course
R%STR   R0,[R2,#12]    ; and set it
\ADD   R0,R3,#&1A
f0BL    gethilo        ; Get start repeat posn
p#STR   R0,[R2,#8]     ; Store it
z6.next                ; Before we go, do the volume
�ADD   R0,R3,#&18
�%BL    gethilo        ; Get volume
� CMP   R0,#64         ; Over?
�"MOVGE R0,#63         ; Correct
�'ADR   R1,voltab      ; Volume table
�)LDRB  R0,[R1,R0]     ; Get new volume
�#STR   R0,[R2,#20]    ; Store it
�.nextchannel
�5ADR   R3,effecttype  ; Cancel any current effects
�MOV   R4,#0          ;
�STR   R4,[R3,R5,LSL#2] ;
�,BL    effectcheck    ; Check for effects
�3SUBS  R5,R5,#1       ; Decrement channel number
	3BPL   dochannel      ; Nope, do another channel
	+LDMFD R13!,{R9}      ; Get our R9 back!
	0LDR   R0,jumpflag    ; Skip rest of pattern?
	$CMP   R0,#0          ;
	.MOVNE R9,#63         ; Yep
	8)MOVNE R0,#0          ; Reset the flag
	BSTRNE R0,jumpflag    ;
	L4ADD   R9,R9,#1       ; Increment sequence number
	V-CMP   R9,#64         ; Finished sequence?
	`CBNE   vend           ; If not, don't go onto next pattern entry
	jMOV   R9,#0
	t1ADD   R7,R7,#1       ; Increment pattern posn
	~'CMP   R7,R8          ; End of song?
	�/MOVGT R7,#0          ; ...and again, folks!
	�	.vend
	�ADR   R0,info
	�+STMIA R0,{R7-R9}     ; Store new values
	�%LDMFD R13!,{PC}      ; And return
	�
	�1.gethilo             ; Gets Hi-Lo stored info
	�-STMFD R13!,{R1}      ; R0=address of info
	�(LDRB  R1,[R0,#0]     ; Get high byte
	�&LDRB  R0,[R0,#1]     ; Get lo byte
	�#�R   R0,R0,R1,LSL#8 ; Mix the 2
	�%LDMFD R13!,{R1}      ; restore R1
!MOV   PC,R14         ; return


0.effectcheck         ; Check for any effects
#LDRB  R6,[R11,#3]    ; Get info
(,LDRB  R4,[R11,#2]    ; Get effect nunber
2�   R4,R4,#&F      ;
<)CMP   R4,#&C         ; Volume change?
FBNE   eff            ; No
P CMP   R6,#64         ; Over?
Z"MOVGE R6,#63         ; Correct
dADR   R1,voltab      ;
n*LDRB  R0,[R1,R6]     ; Get right units
x-ADR   R1,ourinf      ; Find table address
�ADD   R1,R1,R5,LSL#5 ;
�+STR   R0,[R1,#20]    ; Store new volume
�MOV   PC,R14
�.eff
�)CMP   R4,#&D         ; Pattern break?
�1STREQ R4,jumpflag    ; Jump to end of pattern
��Q PC,R14         ;
�(CMP   R4,#&F         ; Change speed?
�BNE   eff1           ; No
�'�   R6,R6,#&F      ; Mask new speed
�#STR   R6,speed       ; Store it
�!MOV   PC,R14         ; Return
�	.eff1
)CMP   R4,#1          ; Portamento up?
BLT   eff2           ; Nope
#CMP   R4,#2          ; Or down?
"BGT   eff2           ; Nope
,'�R   R6,R6,R4,LSL#8 ; Make new word
6"ADR   R3,effecttype  ; Save it
@STR   R6,[R3,R5,LSL#2] ;
J!MOV   PC,R14         ; Return
T	.eff2
^!MOV   PC,R14         ; Return
h
rL.doeffect            ; Do effect detailed in 'effecttype' (R1=subnote #)
|%MOV   R5,#3          ; 4 channels
�%ADR   R2,channelnote ; Amiga-note
�.ADR   R3,effecttype  ; R3=effecttype table
�9ADR   R4,inversetable ; R4=inverse pitch lookup table
�.doeff1
�GADR   R8,ourinf      ; Calculate address offset of voice-info table
�ADD   R8,R8,R5,LSL#5 ;
�.LDR   R0,[R3,R5,LSL#2] ; Any effect to do?
�CMP   R0,#0          ;
�BEQ   doeffnext      ; Nope
�'�   R6,R0,#&F00    ; R6=effect type
�'�   R0,R0,#&FF     ; R0=effect data
�
�)CMP   R6,#&100       ; Portamento up?
BNE   doe1           ; No
-LDR   R6,[R2,R5,LSL#2] ; Get current tone
#SUB   R0,R0,#1       ; Slide up
&SUB   R6,R6,R0
0$STR   R6,[R2,R5,LSL#2] ; Re-save
:5LDR   R6,[R4,R6,LSL#2] ; Get archimedes-frequency
D1STR   R6,[R8,#4]     ; Put in parameter block
NB     doeffnext
X
b	.doe1
l+CMP   R6,#&200       ; Portamento down?
vBNE   doe2           ; No
�-LDR   R6,[R2,R5,LSL#2] ; Get current tone
�%SUB   R0,R0,#1       ; Slide down
�ADD   R6,R6,R0
�$STR   R6,[R2,R5,LSL#2] ; Re-save
�5LDR   R6,[R4,R6,LSL#2] ; Get archimedes-frequency
�1STR   R6,[R8,#4]     ; Put in parameter block
�B     doeffnext
�	.doe2
�.doeffnext
�'SUBS  R5,R5,#1       ; Next channel
�BPL   doeff1         ;
�*MOV   PC,R14         ; No more, return
�


.jumpflag

=EQUD 0               ; <>0 if pattern is to be terminated



 .oldvox

*3EQUD 0               ; So we can kill the voice

4

>2.sampleloc           ; Table of sample offsets

H;EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0

R;EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0

\;EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0

f;EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0

p

z/.voltab              ; 64-byte volume table

�]:P%+=64:[OPT C

�

�).installsound        ; Install voices

�STMFD R13!,{R0-R10,R14}

�2ADR   R0,VoiceBase   ; Make TrackerVox a voice

�MOV   R1,#0

�SWI   "Sound_InstallVoice"

�,STR   R1,oldvox      ; So we can kill it

�*MOV   R10,#1         ; Mute voices 1-8

�.mutelp

�MOV   R0,R10

�MOV   R1,#0

�SWI   "Sound_AttachVoice"
ADD   R10,R10,#1
CMP   R10,#9
BNE   mutelp
$MOV   R10,#1
.:.attlp               ; Attach voices 1-4 to TrackerVox
8MOV   R0,R10
BADR   R1,VoiceName
L"SWI   "Sound_AttachNamedVoice"
VADD   R10,R10,#1
`CMP   R10,#5
jBNE   attlp
t
~:MOV   R0,#1          ; Slight right bias for channel 1
�MOV   R1,#16
�SWI   "Sound_Stereo"
�9MOV   R0,#2          ; Slight left bias for channel 2
�MVN   R1,#15
�SWI   "Sound_Stereo"
�>MOV   R0,#3          ; and for channel 3 (Amiga goes RLLR)
�MVN   R1,#15
�SWI   "Sound_Stereo"
�8MOV   R0,#4          ; And right cgain for channel 4
�MOV   R1,#16
�SWI   "Sound_Stereo"
�
(MOV   R0,#4          ; Play 4 voices

.MOV   R1,#208        ; Buffer length = 200
5MOV   R2,#us         ; For this many microseconds
2MOV   R3,#0          ; Leave these 2 unchanged
(MOV   R4,#0
2SWI   "Sound_Configure"
<
FDMOV   R0,#1          ; Sound all 4 voices, parameters are really
P%MVN   R1,#14         ; immaterial
ZMOV   R2,#100
dMOV   R3,#255
nSWI   "Sound_Control"
xMOV   R0,#2
�SWI   "Sound_Control"
�MOV   R0,#3
�SWI   "Sound_Control"
�MOV   R0,#4
�SWI   "Sound_Control"
�%LDMFD R13!,{R0-R10,PC} ; & Return
�
�0                     ; Voice parameter block
�|.VoiceBase B Fill:B Fill:B Fill:LDMFD R13!,{PC}:LDMFD R13!,{PC}:LDMFD R13!,{PC}:LDMFD R13!,{PC}:EQUD VoiceName-VoiceBase
�,.VoiceName EQUS"TrackerVox":EQUB 0:ALIGN
�
�&.killsound           ; Kill voices
�STMFD R13!,{R0-R10,R14}
0MOV R0,#0            ; De-install TrackerVox
LDR R1,oldvox
SWI "Sound_RemoveVoice"
"
,,MOV R10,#1           ; Kill the 4 voices
6.ksl
@MOV R0,R10
J
MOV R1,#0
TSWI "Sound_AttachVoice"
^ADD R10,R10,#1
hCMP R10,#5
rBNE ksl
|#LDMFD R13!,{R0-R10,PC} ; Return
�
�.inversetable
�';EQUD 1:             ; Dummy value!
�]:P%+=4096:[OPT C
�4.trackadr            ; Get address of track base
�ADR R10,track
�MOV PC,R14
�%.track               ; Track base
�(]:P%+=tlen%:[OPT C   ; Is tlen% long
�
�	ALIGN
�.convert
�STMFD R13!,{R0-R4}
ADR R2,ltable:MOV R3,#0
	.loop
@LDRB R4,[R0,R3]:� R4,R4,#128:LDRB R4,[R2,R4]:STRB R4,[R0,R3]
&#ADD R3,R3,#1:CMP R3,R1:BLE loop
0LDMFD R13!,{R0-R4}
:MOV PC,R14
D.ltable
N0]:P%+=256:[OPT C     ; 256 byte lookup table
X
b..endcode             ; The endcode pointer
l]
v�
�
�*�"Building sample conversion table..."
�#� Setup sample conversion table
�� A%=0 � 255
�<  B%=A%-128:B%=B%<<24:ș "Sound_SoundLog",B% � ltable?A%
��
�
��"Building volume table..."
�� Setup volume table
�� A%=0 � 63
�!  voltab?A%=255-((A%/3+42)*4)
��
�
�"Building pitch table..."
� Setup inverse pitch table
� A%=1 � 1023
 =  a=3575872/A%:inversetable!(A%*4)=(a/(1000000/us))*60000
*�
4
>�
H"�"Code length = ";endcode-code
R
\� Soundtracker datafile
f�"Loading module...(";
p �("LOAD "+song$+" "+�~track)
ztrack$="":B%=0
��
�1  � (track?B%)<>0 � track$+=�(track?B%):B%+=1
��(track?B%)=0
��;track$;")"
�
�:� Find length of tune data by looking through patterns
�high%=0
�� A%=0 � 127
�5  � track?(&3B8+A%)>high% � high%=track?(&3B8+A%)
��
�high%+=1
�
�� Convert samples
A%=track+&43C+(high%*1024)
B%=track+tlen%-A%
&�"Converting ";~(A%-track);"+";~B%
$
� convert
.
8samplei=track+&14
Bspoint=A%:samples=track
L
V.�'"Nr Name                 Length  Volume"
`-�"-- -------------------- ------- ------"
j� A%=0 � 30
t  sampleo=samplei+(A%*&1E)
~  name$="":B%=0
�  �
�4    � (sampleo?B%)<>0 name$+=�(sampleo?B%):B%+=1
�  �(sampleo?B%)=0 � B%=20
�  � name$<>"" �
�.    len%=2*((sampleo?22)*256+(sampleo?23))
�*    vol%=(sampleo?24)*256+(sampleo?25)
�2    �0);~(A%+1);�3);name$;�24);len%;�32);vol%
�'    sampleloc!(A%*4)=spoint-samples
�    spoint+=len%
�  �
��
�&�"                        -------"
B�"                        ";(spoint-samples-&258-(high%*1024))


� Store length of tune
info!4=track?&3B6-1
(
2�"Tune length = ";info!4+1
<
F� � �killsound:�:�
P� Get things in motion!
Z� installsound
d
Ȣ 0,0
n
Ȣ 1,0
x
Ȣ 2,0
�
Ȣ 3,0
� �"<Space> to reselect tune"'
�9�0,25);"Position:00";info!8;�30,25);"Pattern:";!info
�� A%=0 � 3
�k  �0,27+A%);"Voice:";A%;"  Last instrument:";~current?A%;"  Pitch:0000";~ourinf!(32*A%+4);"  Effect:0"
��
��
��
�  Ȗ:� intr
�-  �9,25);info!8;"   ";�38,25);!info;"  "
�  � A%=0 � 3
�i    �25,27+A%);~current?A%;�34,27+A%);~ourinf!(32*A%+4);"   ";�48,27+A%);(effecttype!(A%*4))>>8;"  "
�  �
��(0)=32
�
� killsound
"�
,�
�
00000000  0d 00 0a 10 f4 20 3e 50  6c 61 79 4d 6f 64 41 32  |..... >PlayModA2|
00000010  0d 00 14 05 f4 0d 00 1e  4b f4 20 2e 2d 2d 2d 2d  |........K. .----|
00000020  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000050  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2e  |---------------.|
00000060  0d 00 28 4b f4 20 7c 20  20 20 20 20 20 20 20 20  |..(K. |         |
00000070  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
000000a0  20 20 20 20 20 20 20 20  20 20 7c 0d 00 32 4b f4  |          |..2K.|
000000b0  20 7c 20 53 79 73 74 65  6d 20 49 6e 74 65 72 72  | | System Interr|
000000c0  75 70 74 20 53 6f 75 6e  64 54 72 61 63 6b 65 72  |upt SoundTracker|
000000d0  6d 6f 64 75 6c 65 20 70  6c 61 79 72 6f 75 74 69  |module playrouti|
000000e0  6e 65 20 20 20 20 20 20  56 65 72 73 69 6f 6e 20  |ne      Version |
000000f0  32 2e 31 30 20 7c 0d 00  3c 4b f4 20 7c 20 20 20  |2.10 |..<K. |   |
00000100  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00000130  20 28 33 32 20 69 6e 73  74 20 6f 6e 6c 79 29 20  | (32 inst only) |
00000140  7c 0d 00 46 4b f4 20 7c  20 28 63 29 31 39 39 30  ||..FK. | (c)1990|
00000150  20 48 75 67 6f 20 46 69  65 6e 6e 65 73 20 28 30  | Hugo Fiennes (0|
00000160  37 34 39 29 20 20 37 32  32 33 34 20 20 20 20 20  |749)  72234     |
00000170  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 32  |               2|
00000180  38 2d 4d 61 72 2d 31 39  39 30 20 7c 0d 00 50 4b  |8-Mar-1990 |..PK|
00000190  f4 20 7c 20 20 20 20 20  20 20 20 20 20 20 20 20  |. |             |
000001a0  20 20 20 20 20 20 20 20  20 28 30 37 34 39 29 20  |         (0749) |
000001b0  36 37 39 37 39 34 20 64  61 74 61 20 28 33 30 30  |679794 data (300|
000001c0  2d 32 34 30 30 29 20 20  20 20 20 20 20 20 20 20  |-2400)          |
000001d0  20 20 20 20 20 20 7c 0d  00 5a 4b f4 20 7c 20 20  |      |..ZK. |  |
000001e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000001f0  20 20 20 20 28 30 37 34  39 29 20 36 37 30 30 33  |    (0749) 67003|
00000200  30 20 64 61 74 61 20 28  33 30 30 2d 48 53 54 2f  |0 data (300-HST/|
00000210  56 33 32 20 32 20 6c 69  6e 65 73 29 20 20 20 20  |V32 2 lines)    |
00000220  20 7c 0d 00 64 4b f4 20  7c 20 20 20 20 20 20 20  | |..dK. |       |
00000230  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00000260  20 20 20 20 20 20 20 20  20 20 20 20 7c 0d 00 6e  |            |..n|
00000270  4b f4 20 60 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |K. `------------|
00000280  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000002b0  2d 2d 2d 2d 2d 2d 2d 27  0d 00 78 05 f4 0d 00 82  |-------'..x.....|
000002c0  46 f4 20 53 6e 61 69 6c  6d 61 69 6c 3a 20 48 75  |F. Snailmail: Hu|
000002d0  67 6f 20 46 69 65 6e 6e  65 73 2c 20 42 75 72 63  |go Fiennes, Burc|
000002e0  6f 74 74 20 4d 61 6e 6f  72 2c 20 57 65 6c 6c 73  |ott Manor, Wells|
000002f0  2c 20 53 6f 6d 65 72 73  65 74 2c 20 42 41 35 20  |, Somerset, BA5 |
00000300  31 4e 48 0d 00 8c 05 f4  0d 00 96 4a f4 20 50 72  |1NH........J. Pr|
00000310  65 73 74 65 6c 20 20 3a  20 30 34 35 38 34 37 36  |estel  : 0458476|
00000320  30 38 20 20 20 20 20 20  20 43 69 78 3a 20 61 6c  |08       Cix: al|
00000330  74 6d 61 6e 20 20 20 20  20 20 20 20 20 20 53 49  |tman          SI|
00000340  44 3a 20 31 30 31 32 20  28 43 6f 6d 6d 62 61 73  |D: 1012 (Commbas|
00000350  65 29 0d 00 a0 3f f4 20  20 20 20 20 20 20 20 20  |e)...?.         |
00000360  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00000380  20 20 20 20 20 20 20 20  20 20 20 20 26 31 31 30  |            &110|
00000390  30 0d 00 aa 47 f4 20 54  68 69 73 20 63 6f 64 65  |0...G. This code|
000003a0  20 69 73 20 70 75 62 6c  69 63 20 64 6f 6d 61 69  | is public domai|
000003b0  6e 20 61 6e 64 20 4d 41  59 20 4e 4f 54 20 42 45  |n and MAY NOT BE|
000003c0  20 53 4f 4c 44 20 4f 52  20 49 4e 43 4c 55 44 45  | SOLD OR INCLUDE|
000003d0  44 20 49 4e 20 41 4e 59  0d 00 b4 42 f4 20 50 52  |D IN ANY...B. PR|
000003e0  4f 44 55 43 54 20 54 48  41 54 20 57 49 4c 4c 20  |ODUCT THAT WILL |
000003f0  42 45 20 53 4f 4c 44 20  57 49 54 48 4f 55 54 20  |BE SOLD WITHOUT |
00000400  50 52 49 4f 52 20 50 45  52 4d 49 53 53 49 4f 4e  |PRIOR PERMISSION|
00000410  20 46 52 4f 4d 20 4d 4f  49 21 0d 00 be 05 f4 0d  | FROM MOI!......|
00000420  00 c8 47 f4 20 59 6f 75  20 6d 61 79 20 63 6f 70  |..G. You may cop|
00000430  79 20 61 6e 64 20 64 69  73 74 72 69 62 75 74 65  |y and distribute|
00000440  20 74 68 69 73 20 63 6f  64 65 20 61 73 20 6c 6f  | this code as lo|
00000450  6e 67 20 61 73 20 79 6f  75 20 64 6f 6e 27 74 20  |ng as you don't |
00000460  6d 6f 64 69 66 79 0d 00  d2 45 f4 20 74 68 65 20  |modify...E. the |
00000470  63 6f 70 79 20 79 6f 75  20 70 61 73 73 20 6f 6e  |copy you pass on|
00000480  3a 20 61 6e 79 20 69 6d  70 72 6f 76 65 6d 65 6e  |: any improvemen|
00000490  74 73 2c 20 65 74 63 20  73 68 6f 75 6c 64 20 62  |ts, etc should b|
000004a0  65 20 73 65 6e 74 20 62  61 63 6b 0d 00 dc 2c f4  |e sent back...,.|
000004b0  20 74 6f 20 6d 65 20 73  6f 20 49 20 63 61 6e 20  | to me so I can |
000004c0  6d 6f 64 69 66 79 20 74  68 65 20 6d 61 73 74 65  |modify the maste|
000004d0  72 20 63 6f 70 79 2e 0d  00 e6 05 f4 0d 00 f0 47  |r copy.........G|
000004e0  f4 20 49 66 20 79 6f 75  20 64 6f 20 77 72 69 74  |. If you do writ|
000004f0  65 20 61 6e 79 20 64 65  6d 6f 73 2c 20 6f 72 20  |e any demos, or |
00000500  6f 74 68 65 72 20 70 2e  64 2e 20 73 2f 77 20 74  |other p.d. s/w t|
00000510  68 61 74 20 75 73 65 73  20 74 68 69 73 20 63 6f  |hat uses this co|
00000520  64 65 2c 0d 00 fa 1c f4  20 70 6c 65 61 73 65 20  |de,..... please |
00000530  73 65 6e 64 20 6d 65 20  61 20 63 6f 70 79 21 0d  |send me a copy!.|
00000540  01 04 05 f4 0d 01 0e 4a  f4 20 4e 6f 74 65 3a 20  |.......J. Note: |
00000550  74 68 69 73 20 76 65 72  73 69 6f 6e 20 68 61 73  |this version has|
00000560  20 74 68 65 20 63 6f 64  65 20 74 68 61 74 20 68  | the code that h|
00000570  65 6c 70 73 20 74 6f 20  73 74 6f 70 20 74 68 65  |elps to stop the|
00000580  20 70 6c 61 79 65 72 20  6c 6f 73 69 6e 67 0d 01  | player losing..|
00000590  18 49 f4 20 20 20 20 20  20 20 6e 6f 74 65 73 20  |.I.       notes |
000005a0  77 68 65 6e 20 63 61 6c  6c 65 64 20 6f 6e 20 56  |when called on V|
000005b0  53 59 4e 43 2f 6f 74 68  65 72 20 35 30 48 7a 20  |SYNC/other 50Hz |
000005c0  69 6e 74 65 72 72 75 70  74 73 20 28 70 72 6f 62  |interrupts (prob|
000005d0  6c 65 6d 20 77 61 73 0d  01 22 43 f4 20 20 20 20  |lem was.."C.    |
000005e0  20 20 20 6e 65 77 20 6e  6f 74 65 20 67 65 6e 65  |   new note gene|
000005f0  72 61 74 69 6f 6e 20 69  6e 74 65 72 72 75 70 74  |ration interrupt|
00000600  69 6e 67 20 73 6f 75 6e  64 20 62 75 66 66 65 72  |ing sound buffer|
00000610  20 66 69 6c 6c 69 6e 67  29 2e 0d 01 2c 05 f4 0d  | filling)...,...|
00000620  01 36 4b f4 20 76 76 76  76 76 76 76 76 76 76 76  |.6K. vvvvvvvvvvv|
00000630  76 76 76 76 76 76 76 76  76 76 76 76 76 76 76 76  |vvvvvvvvvvvvvvvv|
*
00000660  76 76 76 76 76 76 76 76  76 76 0d 01 40 47 f4 20  |vvvvvvvvvv..@G. |
00000670  54 68 69 73 20 76 65 72  73 69 6f 6e 20 77 69 6c  |This version wil|
00000680  6c 20 70 6c 61 79 20 61  6c 6d 6f 73 74 20 61 6e  |l play almost an|
00000690  79 20 27 72 69 70 70 65  64 27 20 6d 6f 64 75 6c  |y 'ripped' modul|
000006a0  65 20 6f 72 20 6d 6f 64  75 6c 65 20 73 61 76 65  |e or module save|
000006b0  64 0d 01 4a 4b f4 20 4d  61 73 74 65 72 53 6f 75  |d..JK. MasterSou|
000006c0  6e 64 54 72 61 63 6b 65  72 20 76 32 2e 33 2d 3e  |ndTracker v2.3->|
000006d0  20 28 33 31 20 69 6e 73  74 72 75 6d 65 6e 74 20  | (31 instrument |
000006e0  76 65 72 73 69 6f 6e 73  20 4f 4e 4c 59 2c 20 69  |versions ONLY, i|
000006f0  65 20 6e 6f 74 20 76 32  2e 34 21 29 0d 01 54 4b  |e not v2.4!)..TK|
00000700  f4 20 5e 5e 5e 5e 5e 5e  5e 5e 5e 5e 5e 5e 5e 5e  |. ^^^^^^^^^^^^^^|
00000710  5e 5e 5e 5e 5e 5e 5e 5e  5e 5e 5e 5e 5e 5e 5e 5e  |^^^^^^^^^^^^^^^^|
*
00000740  5e 5e 5e 5e 5e 5e 5e 0d  01 5e 05 f4 0d 01 68 4a  |^^^^^^^..^....hJ|
00000750  f4 20 46 6f 72 20 31 35  20 69 6e 73 74 72 75 6d  |. For 15 instrum|
00000760  65 6e 74 20 70 6c 61 79  69 6e 67 2c 20 67 65 74  |ent playing, get|
00000770  20 50 6c 61 79 6d 6f 64  41 20 66 72 6f 6d 20 79  | PlaymodA from y|
00000780  6f 75 72 20 6c 6f 63 61  6c 20 70 64 20 73 75 70  |our local pd sup|
00000790  70 6c 69 65 72 21 0d 01  72 05 f4 0d 01 7c 05 3a  |plier!..r....|.:|
000007a0  0d 01 86 22 f4 20 52 65  73 65 72 76 65 20 73 70  |...". Reserve sp|
000007b0  61 63 65 20 66 6f 72 20  74 68 65 20 6d 6f 64 75  |ace for the modu|
000007c0  6c 65 0d 01 90 11 de 20  63 6f 64 65 20 35 30 30  |le..... code 500|
000007d0  30 30 30 0d 01 9a 04 0d  01 a4 06 2a 2e 0d 01 ae  |000........*....|
000007e0  18 e8 27 22 4d 6f 64 75  6c 65 4e 61 6d 65 3a 22  |..'"ModuleName:"|
000007f0  73 6f 6e 67 24 0d 01 b8  04 0d 01 c2 2a f4 20 54  |song$.......*. T|
00000800  6f 74 61 6c 20 6c 65 6e  67 74 68 20 66 6f 72 20  |otal length for |
00000810  73 6f 75 6e 64 74 72 61  63 6b 65 72 20 6d 6f 64  |soundtracker mod|
00000820  75 6c 65 0d 01 cc 1d 41  25 3d 8e 73 6f 6e 67 24  |ule....A%=.song$|
00000830  3a 74 6c 65 6e 25 3d a2  23 41 25 3a d9 23 41 25  |:tlen%=.#A%:.#A%|
00000840  0d 01 d6 04 0d 01 e0 48  f4 20 4e 75 6d 62 65 72  |.......H. Number|
00000850  20 6f 66 20 75 73 20 62  65 74 77 65 65 6e 20 73  | of us between s|
00000860  61 6d 70 6c 65 73 2e 20  50 72 6f 67 72 61 6d 20  |amples. Program |
00000870  66 61 6c 6c 73 20 6f 76  65 72 20 61 74 20 64 65  |falls over at de|
00000880  6c 61 79 73 20 6f 66 20  6c 65 73 73 0d 01 ea 21  |lays of less...!|
00000890  f4 20 74 68 65 6e 20 31  30 75 73 20 28 31 30 30  |. then 10us (100|
000008a0  6b 48 7a 2f 63 68 61 6e  6e 65 6c 29 2e 0d 01 f4  |kHz/channel)....|
000008b0  09 75 73 3d 33 34 0d 01  fe 04 0d 02 08 1a f1 27  |.us=34.........'|
000008c0  22 41 73 73 65 6d 62 6c  69 6e 67 20 63 6f 64 65  |"Assembling code|
000008d0  2e 2e 2e 22 0d 02 12 0c  e3 43 3d 30 b8 32 88 32  |...".....C=0.2.2|
000008e0  0d 02 1c 0b 50 25 3d 63  6f 64 65 0d 02 26 09 5b  |....P%=code..&.[|
000008f0  4f 50 54 43 0d 02 30 4d  3b 2d 2d 2d 2d 2d 2d 2d  |OPTC..0M;-------|
00000900  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000940  2d 0d 02 3a 4d 3b 20 53  6f 75 6e 64 74 72 61 63  |-..:M; Soundtrac|
00000950  6b 65 72 20 70 6c 61 79  72 6f 75 74 69 6e 65 20  |ker playroutine |
00000960  20 20 20 20 20 20 20 20  20 20 20 20 76 32 2e 33  |            v2.3|
00000970  20 57 69 74 68 20 70 6f  72 74 61 6d 65 6e 74 6f  | With portamento|
00000980  2c 73 70 65 65 64 20 63  68 61 6e 67 65 2c 0d 02  |,speed change,..|
00000990  44 4d 3b 20 20 20 20 20  20 20 20 20 20 20 20 20  |DM;             |
000009a0  20 20 20 20 20 20 20 20  20 20 20 20 76 6f 6c 75  |            volu|
000009b0  6d 65 20 63 6f 6e 74 72  6f 6c 2c 70 61 74 74 65  |me control,patte|
000009c0  72 6e 20 62 72 65 61 6b  2c 20 26 20 33 32 20 69  |rn break, & 32 i|
000009d0  6e 74 73 74 72 75 6d 65  6e 74 73 0d 02 4e 4d 3b  |ntstruments..NM;|
000009e0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000a20  2d 2d 2d 2d 2d 2d 2d 2d  0d 02 58 04 0d 02 62 09  |--------..X...b.|
00000a30  2e 46 69 6c 6c 0d 02 6c  13 41 44 52 20 20 20 52  |.Fill..l.ADR   R|
00000a40  38 2c 6f 75 72 69 6e 66  0d 02 76 18 41 44 44 20  |8,ourinf..v.ADD |
00000a50  20 20 52 38 2c 52 38 2c  52 37 2c 4c 53 4c 23 35  |  R8,R8,R7,LSL#5|
00000a60  0d 02 80 14 4c 44 4d 49  41 20 52 38 2c 7b 52 31  |....LDMIA R8,{R1|
00000a70  2d 52 36 7d 0d 02 8a 0d  2e 46 69 6c 6c 4c 6f 6f  |-R6}.....FillLoo|
00000a80  70 0d 02 94 05 5d 0d 02  9e 11 e3 20 73 6c 65 25  |p....]..... sle%|
00000a90  3d 31 20 b8 20 31 30 0d  02 a8 0a 5b 4f 50 54 20  |=1 . 10....[OPT |
00000aa0  43 0d 02 b2 2d 4c 44 52  42 20 20 52 30 2c 5b 52  |C...-LDRB  R0,[R|
00000ab0  35 2c 52 31 2c 4c 53 52  23 31 36 5d 20 3b 20 47  |5,R1,LSR#16] ; G|
00000ac0  65 74 20 73 61 6d 70 6c  65 20 62 79 74 65 0d 02  |et sample byte..|
00000ad0  bc 2a 53 55 42 53 20 20  52 30 2c 52 30 2c 52 36  |.*SUBS  R0,R0,R6|
00000ae0  20 20 20 20 20 20 20 20  20 20 3b 20 53 63 61 6c  |          ; Scal|
00000af0  65 20 76 6f 6c 75 6d 65  0d 02 c6 0f 4d 4f 56 4d  |e volume....MOVM|
00000b00  49 20 52 30 2c 23 30 0d  02 d0 2e 53 54 52 42 20  |I R0,#0....STRB |
00000b10  20 52 30 2c 5b 52 31 32  5d 2c 52 31 31 20 20 20  | R0,[R12],R11   |
00000b20  20 20 20 3b 20 50 75 74  20 69 6e 20 69 6e 20 62  |   ; Put in in b|
00000b30  75 66 66 65 72 0d 02 da  28 41 44 44 20 20 20 52  |uffer...(ADD   R|
00000b40  31 2c 52 31 2c 52 32 20  20 20 20 20 20 20 20 20  |1,R1,R2         |
00000b50  20 3b 20 41 64 64 20 6f  66 66 73 65 74 0d 02 e4  | ; Add offset...|
00000b60  05 5d 0d 02 ee 05 ed 0d  02 f8 0a 5b 4f 50 54 20  |.].........[OPT |
00000b70  43 0d 03 02 2a 43 4d 50  20 20 20 52 34 2c 52 31  |C...*CMP   R4,R1|
00000b80  2c 4c 53 52 23 31 36 20  20 20 20 20 20 3b 20 45  |,LSR#16      ; E|
00000b90  6e 64 20 6f 66 20 6e 6f  74 65 3f 0d 03 0c 0d 42  |nd of note?....B|
00000ba0  47 54 20 20 20 63 62 66  0d 03 16 2c 4d 4f 56 53  |GT   cbf...,MOVS|
00000bb0  20 20 52 31 2c 52 33 20  20 20 20 20 20 20 20 20  |  R1,R3         |
00000bc0  20 20 20 20 3b 20 59 65  73 2c 20 6c 6f 6f 70 20  |    ; Yes, loop |
00000bd0  62 61 63 6b 0d 03 20 35  ec 51 20 52 32 2c 23 30  |back.. 5.Q R2,#0|
00000be0  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 49  |             ; I|
00000bf0  66 20 6e 6f 20 6c 6f 6f  70 69 6e 67 2c 20 6b 65  |f no looping, ke|
00000c00  65 70 20 71 75 69 65 74  21 0d 03 2a 08 2e 63 62  |ep quiet!..*..cb|
00000c10  66 0d 03 34 31 43 4d 50  20 20 20 52 31 32 2c 52  |f..41CMP   R12,R|
00000c20  31 30 20 20 20 20 20 20  20 20 20 20 20 3b 20 45  |10           ; E|
00000c30  6e 64 20 6f 66 20 62 75  66 66 65 72 20 66 69 6c  |nd of buffer fil|
00000c40  6c 3f 0d 03 3e 32 42 4c  54 20 20 20 46 69 6c 6c  |l?..>2BLT   Fill|
00000c50  4c 6f 6f 70 20 20 20 20  20 20 20 20 20 20 3b 20  |Loop          ; |
00000c60  4e 6f 70 65 2c 20 66 69  6c 6c 20 73 6f 6d 65 20  |Nope, fill some |
00000c70  6d 6f 72 65 0d 03 48 04  0d 03 52 34 41 44 52 20  |more..H...R4ADR |
00000c80  20 20 52 30 2c 6e 65 77  64 61 74 61 20 20 20 20  |  R0,newdata    |
00000c90  20 20 20 20 3b 20 53 6f  20 77 65 20 64 6f 6e 27  |    ; So we don'|
00000ca0  74 20 6c 6f 73 65 20 6e  6f 74 65 73 0d 03 5c 46  |t lose notes..\F|
00000cb0  4c 44 52 42 20 20 52 34  2c 5b 52 30 2c 52 37 5d  |LDRB  R4,[R0,R7]|
00000cc0  20 20 20 20 20 20 20 20  3b 20 48 61 73 20 76 6f  |        ; Has vo|
00000cd0  69 63 65 20 62 65 65 6e  20 75 70 64 61 74 65 64  |ice been updated|
00000ce0  20 77 68 69 6c 73 74 20  77 65 27 76 65 20 62 65  | whilst we've be|
00000cf0  65 6e 0d 03 66 26 43 4d  50 20 20 20 52 34 2c 23  |en..f&CMP   R4,#|
00000d00  30 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |0             ; |
00000d10  66 69 6c 6c 69 6e 67 3f  0d 03 70 2f 53 54 4d 45  |filling?..p/STME|
00000d20  51 49 41 20 52 38 2c 7b  52 31 2d 52 32 7d 20 20  |QIA R8,{R1-R2}  |
00000d30  20 20 20 20 3b 20 4e 6f  2c 20 72 65 2d 73 74 6f  |    ; No, re-sto|
00000d40  72 65 20 69 6e 66 6f 0d  03 7a 1d 4d 4f 56 4e 45  |re info..z.MOVNE|
00000d50  20 52 34 2c 23 30 20 20  20 20 20 20 20 20 20 20  | R4,#0          |
00000d60  20 20 20 3b 0d 03 84 30  53 54 52 4e 45 42 20 52  |   ;...0STRNEB R|
00000d70  34 2c 5b 52 30 2c 52 37  5d 20 20 20 20 20 20 20  |4,[R0,R7]       |
00000d80  3b 20 45 6c 73 65 20 7a  65 72 6f 20 74 68 65 20  |; Else zero the |
00000d90  66 6c 61 67 0d 03 8e 04  0d 03 98 2a 4d 4f 56 20  |flag.......*MOV |
00000da0  20 20 52 30 2c 23 25 30  30 30 30 31 30 30 30 20  |  R0,#%00001000 |
00000db0  20 20 20 20 3b 20 76 6f  69 63 65 20 61 63 74 69  |    ; voice acti|
00000dc0  76 65 0d 03 a2 34 4c 44  4d 46 44 20 52 31 33 21  |ve...4LDMFD R13!|
00000dd0  2c 7b 50 43 7d 20 20 20  20 20 20 20 20 20 3b 20  |,{PC}         ; |
00000de0  2e 2e 61 6e 64 20 72 65  74 75 72 6e 20 74 6f 20  |..and return to |
00000df0  4c 65 76 65 6c 31 0d 03  ac 04 0d 03 b6 0c 2e 6e  |Level1.........n|
00000e00  65 77 64 61 74 61 0d 03  c0 0a 45 51 55 44 20 30  |ewdata....EQUD 0|
00000e10  0d 03 ca 04 0d 03 d4 0b  2e 6f 75 72 69 6e 66 0d  |.........ourinf.|
00000e20  03 de 3b 45 51 55 44 20  30 3a 45 51 55 44 20 30  |..;EQUD 0:EQUD 0|
00000e30  3a 45 51 55 44 20 30 3a  45 51 55 44 20 30 3a 45  |:EQUD 0:EQUD 0:E|
00000e40  51 55 44 20 30 3a 45 51  55 44 20 30 3a 45 51 55  |QUD 0:EQUD 0:EQU|
00000e50  44 20 30 3a 45 51 55 44  20 30 0d 03 e8 3b 45 51  |D 0:EQUD 0...;EQ|
00000e60  55 44 20 30 3a 45 51 55  44 20 30 3a 45 51 55 44  |UD 0:EQUD 0:EQUD|
00000e70  20 30 3a 45 51 55 44 20  30 3a 45 51 55 44 20 30  | 0:EQUD 0:EQUD 0|
00000e80  3a 45 51 55 44 20 30 3a  45 51 55 44 20 30 3a 45  |:EQUD 0:EQUD 0:E|
00000e90  51 55 44 20 30 0d 03 f2  3b 45 51 55 44 20 30 3a  |QUD 0...;EQUD 0:|
00000ea0  45 51 55 44 20 30 3a 45  51 55 44 20 30 3a 45 51  |EQUD 0:EQUD 0:EQ|
00000eb0  55 44 20 30 3a 45 51 55  44 20 30 3a 45 51 55 44  |UD 0:EQUD 0:EQUD|
00000ec0  20 30 3a 45 51 55 44 20  30 3a 45 51 55 44 20 30  | 0:EQUD 0:EQUD 0|
00000ed0  0d 03 fc 3b 45 51 55 44  20 30 3a 45 51 55 44 20  |...;EQUD 0:EQUD |
00000ee0  30 3a 45 51 55 44 20 30  3a 45 51 55 44 20 30 3a  |0:EQUD 0:EQUD 0:|
00000ef0  45 51 55 44 20 30 3a 45  51 55 44 20 30 3a 45 51  |EQUD 0:EQUD 0:EQ|
00000f00  55 44 20 30 3a 45 51 55  44 20 30 0d 04 06 04 0d  |UD 0:EQUD 0.....|
00000f10  04 10 10 2e 63 68 61 6e  6e 65 6c 6e 6f 74 65 0d  |....channelnote.|
00000f20  04 1a 1f 45 51 55 44 20  30 3a 45 51 55 44 20 30  |...EQUD 0:EQUD 0|
00000f30  3a 45 51 55 44 20 30 3a  45 51 55 44 20 30 0d 04  |:EQUD 0:EQUD 0..|
00000f40  24 04 0d 04 2e 0f 2e 65  66 66 65 63 74 74 79 70  |$......effecttyp|
00000f50  65 0d 04 38 1f 45 51 55  44 20 30 3a 45 51 55 44  |e..8.EQUD 0:EQUD|
00000f60  20 30 3a 45 51 55 44 20  30 3a 45 51 55 44 20 30  | 0:EQUD 0:EQUD 0|
00000f70  0d 04 42 04 0d 04 4c 09  2e 69 6e 66 6f 0d 04 56  |..B...L..info..V|
00000f80  23 45 51 55 44 20 20 30  20 20 20 20 20 20 20 20  |#EQUD  0        |
00000f90  20 20 20 20 20 20 3b 20  50 6f 73 69 74 69 6f 6e  |      ; Position|
00000fa0  0d 04 60 29 45 51 55 44  20 20 30 20 20 20 20 20  |..`)EQUD  0     |
00000fb0  20 20 20 20 20 20 20 20  20 3b 20 50 61 74 74 65  |         ; Patte|
00000fc0  72 6e 20 6c 65 6e 67 74  68 0d 04 6a 28 45 51 55  |rn length..j(EQU|
00000fd0  44 20 20 30 20 20 20 20  20 20 20 20 20 20 20 20  |D  0            |
00000fe0  20 20 3b 20 53 65 71 75  65 6e 63 65 20 70 6f 73  |  ; Sequence pos|
00000ff0  6e 0d 04 74 04 0d 04 7e  0c 2e 73 65 71 62 61 73  |n..t...~..seqbas|
00001000  65 0d 04 88 28 45 51 55  44 20 20 26 33 42 38 20  |e...(EQUD  &3B8 |
00001010  20 20 20 20 20 20 20 20  20 20 3b 20 53 65 71 75  |          ; Sequ|
00001020  65 6e 63 65 20 62 61 73  65 0d 04 92 04 0d 04 9c  |ence base.......|
00001030  0c 2e 74 72 6b 62 61 73  65 0d 04 a6 2f 45 51 55  |..trkbase.../EQU|
00001040  44 20 20 26 34 33 43 20  20 20 20 20 20 20 20 20  |D  &43C         |
00001050  20 20 3b 20 50 61 74 74  65 72 6e 20 62 61 73 65  |  ; Pattern base|
00001060  20 61 64 64 72 65 73 73  0d 04 b0 04 0d 04 ba 0c  | address........|
00001070  2e 63 75 72 72 65 6e 74  0d 04 c4 2e 45 51 55 44  |.current....EQUD|
00001080  20 30 20 20 20 20 20 20  20 20 20 20 20 20 20 20  | 0              |
00001090  20 3b 20 43 75 72 72 65  6e 74 20 69 6e 73 74 72  | ; Current instr|
000010a0  75 6d 65 6e 74 73 0d 04  ce 04 0d 04 d8 0b 2e 63  |uments.........c|
000010b0  6f 75 6e 74 69 0d 04 e2  28 45 51 55 44 20 30 20  |ounti...(EQUD 0 |
000010c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
000010d0  56 73 79 6e 63 20 63 6f  75 6e 74 65 72 0d 04 ec  |Vsync counter...|
000010e0  04 0d 04 f6 0a 2e 73 70  65 65 64 0d 05 00 34 45  |......speed...4E|
000010f0  51 55 44 20 36 20 20 20  20 20 20 20 20 20 20 20  |QUD 6           |
00001100  20 20 20 20 3b 20 53 70  65 65 64 20 63 6f 75 6e  |    ; Speed coun|
00001110  74 65 72 20 28 64 65 66  61 75 6c 74 3d 36 29 0d  |ter (default=6).|
00001120  05 0a 04 0d 05 14 2d 2e  69 6e 74 72 20 20 20 20  |......-.intr    |
00001130  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 43 61  |            ; Ca|
00001140  6c 6c 65 64 20 65 76 65  72 79 20 56 53 59 4e 43  |lled every VSYNC|
00001150  0d 05 1e 1b 53 54 4d 46  44 20 52 31 33 21 2c 7b  |....STMFD R13!,{|
00001160  52 30 2d 52 31 32 2c 52  31 34 7d 0d 05 28 25 4c  |R0-R12,R14}..(%L|
00001170  44 52 20 20 20 52 31 2c  63 6f 75 6e 74 69 20 20  |DR   R1,counti  |
00001180  20 20 20 20 3b 20 4c 6f  61 64 20 63 6f 75 6e 74  |    ; Load count|
00001190  0d 05 32 29 42 4c 20 20  20 20 64 6f 65 66 66 65  |..2)BL    doeffe|
000011a0  63 74 20 20 20 20 20 20  20 3b 20 44 6f 20 61 6e  |ct       ; Do an|
000011b0  79 20 65 66 66 65 63 74  73 0d 05 3c 2c 4c 44 52  |y effects..<,LDR|
000011c0  20 20 20 52 32 2c 73 70  65 65 64 20 20 20 20 20  |   R2,speed     |
000011d0  20 20 3b 20 43 75 72 72  65 6e 74 20 70 6c 61 79  |  ; Current play|
000011e0  73 70 65 65 64 0d 05 46  2a 41 44 44 20 20 20 52  |speed..F*ADD   R|
000011f0  31 2c 52 31 2c 23 31 20  20 20 20 20 20 20 3b 20  |1,R1,#1       ; |
00001200  49 6e 63 72 65 6d 65 6e  74 20 63 6f 75 6e 74 0d  |Increment count.|
00001210  05 50 29 43 4d 50 20 20  20 52 31 2c 52 32 20 20  |.P)CMP   R1,R2  |
00001220  20 20 20 20 20 20 20 20  3b 20 52 65 61 64 79 20  |        ; Ready |
00001230  74 6f 20 70 6c 61 79 3f  0d 05 5a 1e 4d 4f 56 47  |to play?..Z.MOVG|
00001240  45 20 52 31 2c 23 30 20  20 20 20 20 20 20 20 20  |E R1,#0         |
00001250  20 3b 20 59 65 73 0d 05  64 28 53 54 52 20 20 20  | ; Yes..d(STR   |
00001260  52 31 2c 63 6f 75 6e 74  69 20 20 20 20 20 20 3b  |R1,counti      ;|
00001270  20 52 65 73 74 6f 72 65  20 63 6f 75 6e 74 0d 05  | Restore count..|
00001280  6e 3e 42 4c 47 45 20 20  70 6c 61 79 6e 6f 74 65  |n>BLGE  playnote|
00001290  20 20 20 20 20 20 20 3b  20 49 66 20 73 6f 2c 20  |       ; If so, |
000012a0  7a 65 72 6f 20 63 6f 75  6e 74 65 72 20 61 6e 64  |zero counter and|
000012b0  20 70 6c 61 79 20 61 20  6e 6f 74 65 0d 05 78 1a  | play a note..x.|
000012c0  4c 44 4d 46 44 20 52 31  33 21 2c 7b 52 30 2d 52  |LDMFD R13!,{R0-R|
000012d0  31 32 2c 50 43 7d 0d 05  82 04 0d 05 8c 0d 2e 70  |12,PC}.........p|
000012e0  6c 61 79 6e 6f 74 65 0d  05 96 14 53 54 4d 46 44  |laynote....STMFD|
000012f0  20 52 31 33 21 2c 7b 52  31 34 7d 0d 05 a0 2d 41  | R13!,{R14}...-A|
00001300  44 52 20 20 20 52 30 2c  69 6e 66 6f 20 20 20 20  |DR   R0,info    |
00001310  20 20 20 20 3b 20 4c 6f  61 64 20 73 65 71 75 65  |    ; Load seque|
00001320  6e 63 65 20 69 6e 66 6f  0d 05 aa 14 4c 44 4d 49  |nce info....LDMI|
00001330  41 20 52 30 2c 7b 52 37  2d 52 39 7d 0d 05 b4 0d  |A R0,{R7-R9}....|
00001340  2e 61 6e 64 61 67 61 69  6e 0d 05 be 13 53 54 4d  |.andagain....STM|
00001350  46 44 20 52 31 33 21 2c  7b 52 39 7d 0d 05 c8 12  |FD R13!,{R9}....|
00001360  42 4c 20 20 20 20 74 72  61 63 6b 61 64 72 0d 05  |BL    trackadr..|
00001370  d2 14 4c 44 52 20 20 20  52 30 2c 73 65 71 62 61  |..LDR   R0,seqba|
00001380  73 65 0d 05 dc 32 41 44  44 20 20 20 52 31 31 2c  |se...2ADD   R11,|
00001390  52 30 2c 52 31 30 20 20  20 20 20 3b 20 52 31 31  |R0,R10     ; R11|
000013a0  3d 61 64 64 72 65 73 73  20 6f 66 20 73 65 71 75  |=address of sequ|
000013b0  65 6e 63 65 0d 05 e6 14  4c 44 52 20 20 20 52 30  |ence....LDR   R0|
000013c0  2c 74 72 6b 62 61 73 65  0d 05 f0 2f 41 44 44 20  |,trkbase.../ADD |
000013d0  20 20 52 31 32 2c 52 30  2c 52 31 30 20 20 20 20  |  R12,R0,R10    |
000013e0  20 3b 20 52 31 32 3d 61  64 64 72 65 73 73 20 6f  | ; R12=address o|
000013f0  66 20 74 72 61 63 6b 0d  05 fa 04 0d 06 04 2f 4c  |f track......./L|
00001400  44 52 42 20 20 52 36 2c  5b 52 31 31 2c 52 37 5d  |DRB  R6,[R11,R7]|
00001410  20 20 20 20 3b 20 47 65  74 20 61 64 64 72 65 73  |    ; Get addres|
00001420  73 20 6f 66 20 6e 6f 74  65 73 0d 06 0e 1b 41 44  |s of notes....AD|
00001430  44 20 20 20 52 31 32 2c  52 31 32 2c 52 36 2c 4c  |D   R12,R12,R6,L|
00001440  53 4c 23 31 30 0d 06 18  1a 41 44 44 20 20 20 52  |SL#10....ADD   R|
00001450  31 32 2c 52 31 32 2c 52  39 2c 4c 53 4c 23 34 0d  |12,R12,R9,LSL#4.|
00001460  06 22 14 41 44 52 20 20  20 52 39 2c 63 75 72 72  |.".ADR   R9,curr|
00001470  65 6e 74 0d 06 2c 04 0d  06 36 28 4d 4f 56 20 20  |ent..,...6(MOV  |
00001480  20 52 35 2c 23 33 20 20  20 20 20 20 20 20 20 20  | R5,#3          |
00001490  3b 20 44 6f 20 34 20 63  68 61 6e 6e 65 6c 73 0d  |; Do 4 channels.|
000014a0  06 40 0e 2e 64 6f 63 68  61 6e 6e 65 6c 0d 06 4a  |.@..dochannel..J|
000014b0  1a 41 44 44 20 20 20 52  31 31 2c 52 31 32 2c 52  |.ADD   R11,R12,R|
000014c0  35 2c 4c 53 4c 23 32 0d  06 54 30 4c 44 52 42 20  |5,LSL#2..T0LDRB |
000014d0  20 52 36 2c 5b 52 31 31  2c 23 32 5d 20 20 20 20  | R6,[R11,#2]    |
000014e0  3b 20 47 65 74 20 69 6e  73 74 72 75 6d 65 6e 74  |; Get instrument|
000014f0  20 6e 75 6d 62 65 72 0d  06 5e 22 4d 4f 56 20 20  | number..^"MOV  |
00001500  20 52 36 2c 52 36 2c 4c  53 52 23 34 20 20 20 20  | R6,R6,LSR#4    |
00001510  3b 20 53 68 75 66 66 6c  65 0d 06 68 4a 4c 44 52  |; Shuffle..hJLDR|
00001520  42 20 20 52 30 2c 5b 52  31 31 2c 23 30 5d 20 20  |B  R0,[R11,#0]  |
00001530  20 20 3b 20 47 65 74 20  65 78 74 72 61 20 62 69  |  ; Get extra bi|
00001540  74 20 66 72 6f 6d 20 70  69 74 63 68 20 74 6f 20  |t from pitch to |
00001550  6d 61 6b 65 20 33 32 20  69 6e 73 74 72 75 6d 65  |make 32 instrume|
00001560  6e 74 73 0d 06 72 12 80  20 20 20 52 30 2c 52 30  |nts..r..   R0,R0|
00001570  2c 23 26 38 30 0d 06 7c  19 84 52 53 20 20 52 36  |,#&80..|..RS  R6|
00001580  2c 52 36 2c 52 30 2c 4c  53 52 23 33 20 3b 0d 06  |,R6,R0,LSR#3 ;..|
00001590  86 49 53 54 52 4e 45 42  20 52 36 2c 5b 52 39 2c  |.ISTRNEB R6,[R9,|
000015a0  52 35 5d 20 20 20 20 3b  20 49 66 20 69 74 27 73  |R5]    ; If it's|
000015b0  20 7a 65 72 6f 2c 20 6c  6f 61 64 20 6c 61 73 74  | zero, load last|
000015c0  20 69 6e 73 74 72 75 6d  65 6e 74 2c 20 65 6c 73  | instrument, els|
000015d0  65 20 73 74 6f 72 65 0d  06 90 24 4c 44 52 45 51  |e store...$LDREQ|
000015e0  42 20 52 36 2c 5b 52 39  2c 52 35 5d 20 20 20 20  |B R6,[R9,R5]    |
000015f0  3b 20 74 68 69 73 20 6f  6e 65 2e 0d 06 9a 33 43  |; this one....3C|
00001600  4d 50 20 20 20 52 36 2c  23 30 20 20 20 20 20 20  |MP   R6,#0      |
00001610  20 20 20 20 3b 20 41 6e  79 20 69 6e 73 74 72 75  |    ; Any instru|
00001620  6d 65 6e 74 20 73 65 6c  65 63 74 65 64 3f 0d 06  |ment selected?..|
00001630  a4 2a 42 45 51 20 20 20  6e 65 78 74 63 68 61 6e  |.*BEQ   nextchan|
00001640  6e 65 6c 20 20 20 20 3b  20 44 6f 20 6e 65 78 74  |nel    ; Do next|
00001650  20 63 68 61 6e 6e 65 6c  0d 06 ae 3c 53 55 42 20  | channel...<SUB |
00001660  20 20 52 36 2c 52 36 2c  23 31 20 20 20 20 20 20  |  R6,R6,#1      |
00001670  20 3b 20 43 6f 72 72 65  63 74 20 52 36 20 66 6f  | ; Correct R6 fo|
00001680  72 20 63 61 6c 63 75 6c  61 74 69 6f 6e 73 20 62  |r calculations b|
00001690  65 6c 6f 77 0d 06 b8 24  4d 4f 56 20 20 20 52 30  |elow...$MOV   R0|
000016a0  2c 52 31 31 20 20 20 20  20 20 20 20 20 3b 20 47  |,R11         ; G|
000016b0  65 74 20 70 69 74 63 68  0d 06 c2 29 42 4c 20 20  |et pitch...)BL  |
000016c0  20 20 67 65 74 68 69 6c  6f 20 20 20 20 20 20 20  |  gethilo       |
000016d0  20 3b 20 28 62 6c 6f 6f  64 79 20 36 38 30 30 30  | ; (bloody 68000|
000016e0  29 0d 06 cc 2c 42 49 43  53 20 20 52 34 2c 52 30  |)...,BICS  R4,R0|
000016f0  2c 23 26 38 30 30 30 20  20 20 3b 20 52 34 3d 73  |,#&8000   ; R4=s|
00001700  74 61 6e 64 61 72 64 20  70 69 74 63 68 0d 06 d6  |tandard pitch...|
00001710  45 42 45 51 20 20 20 6e  65 78 74 63 68 61 6e 6e  |EBEQ   nextchann|
00001720  65 6c 20 20 20 20 3b 20  42 75 74 20 69 73 20 69  |el    ; But is i|
00001730  74 20 7a 65 72 6f 3f 20  49 66 20 73 6f 2c 20 64  |t zero? If so, d|
00001740  6f 6e 27 74 20 70 6c 61  79 20 61 6e 79 74 68 69  |on't play anythi|
00001750  6e 67 0d 06 e0 43 41 44  52 20 20 20 52 33 2c 63  |ng...CADR   R3,c|
00001760  68 61 6e 6e 65 6c 6e 6f  74 65 20 3b 20 53 61 76  |hannelnote ; Sav|
00001770  65 20 70 69 74 63 68 20  66 6f 72 20 61 72 70 65  |e pitch for arpe|
00001780  67 67 69 6f 2c 20 70 6f  72 74 61 6d 65 6e 74 6f  |ggio, portamento|
00001790  2c 20 65 74 63 0d 06 ea  1a 53 54 52 20 20 20 52  |, etc....STR   R|
000017a0  34 2c 5b 52 33 2c 52 35  2c 4c 53 4c 23 32 5d 0d  |4,[R3,R5,LSL#2].|
000017b0  06 f4 3b 41 44 52 20 20  20 52 33 2c 69 6e 76 65  |..;ADR   R3,inve|
000017c0  72 73 65 74 61 62 6c 65  20 3b 20 53 63 61 6c 65  |rsetable ; Scale|
000017d0  20 70 69 74 63 68 20 75  73 69 6e 67 20 69 6e 76  | pitch using inv|
000017e0  65 72 73 65 20 74 61 62  6c 65 0d 06 fe 1a 4c 44  |erse table....LD|
000017f0  52 20 20 20 52 34 2c 5b  52 33 2c 52 34 2c 4c 53  |R   R4,[R3,R4,LS|
00001800  4c 23 32 5d 0d 07 08 13  41 44 52 20 20 20 52 32  |L#2]....ADR   R2|
00001810  2c 6f 75 72 69 6e 66 0d  07 12 3c 41 44 44 20 20  |,ourinf...<ADD  |
00001820  20 52 32 2c 52 32 2c 52  35 2c 4c 53 4c 23 35 20  | R2,R2,R5,LSL#5 |
00001830  3b 20 47 65 74 20 61 64  64 72 65 73 73 20 6f 66  |; Get address of|
00001840  20 66 69 6c 6c 20 63 6f  6e 74 72 6f 6c 20 62 6c  | fill control bl|
00001850  6f 63 6b 0d 07 1c 43 4d  4f 56 20 20 20 52 31 2c  |ock...CMOV   R1,|
00001860  23 30 20 20 20 20 20 20  20 20 20 20 3b 20 53 65  |#0          ; Se|
00001870  74 20 66 69 6c 6c 20 74  6f 20 73 74 61 72 74 20  |t fill to start |
00001880  66 69 6c 6c 69 6e 67 20  61 74 20 7a 65 72 6f 20  |filling at zero |
00001890  6f 66 66 73 65 74 0d 07  26 14 53 54 52 20 20 20  |offset..&.STR   |
000018a0  52 31 2c 5b 52 32 2c 23  30 5d 0d 07 30 24 53 54  |R1,[R2,#0]..0$ST|
000018b0  52 20 20 20 52 34 2c 5b  52 32 2c 23 34 5d 20 20  |R   R4,[R2,#4]  |
000018c0  20 20 20 3b 20 53 65 74  20 70 69 74 63 68 0d 07  |   ; Set pitch..|
000018d0  3a 39 41 44 52 20 20 20  52 33 2c 73 61 6d 70 6c  |:9ADR   R3,sampl|
000018e0  65 6c 6f 63 20 20 20 3b  20 41 64 64 72 65 73 73  |eloc   ; Address|
000018f0  20 6f 66 20 73 61 6d 70  6c 65 20 6c 6f 6f 6b 75  | of sample looku|
00001900  70 20 74 61 62 6c 65 0d  07 44 34 4c 44 52 20 20  |p table..D4LDR  |
00001910  20 52 33 2c 5b 52 33 2c  52 36 2c 4c 53 4c 23 32  | R3,[R3,R6,LSL#2|
00001920  5d 20 3b 20 52 33 3d 41  63 74 75 61 6c 20 73 61  |] ; R3=Actual sa|
00001930  6d 70 6c 65 20 6f 66 66  73 65 74 0d 07 4e 33 41  |mple offset..N3A|
00001940  44 44 20 20 20 52 33 2c  52 33 2c 52 31 30 20 20  |DD   R3,R3,R10  |
00001950  20 20 20 20 3b 20 52 33  3d 41 63 74 75 61 6c 20  |    ; R3=Actual |
00001960  73 61 6d 70 6c 65 20 61  64 64 72 65 73 73 0d 07  |sample address..|
00001970  58 31 53 54 52 20 20 20  52 33 2c 5b 52 32 2c 23  |X1STR   R3,[R2,#|
00001980  31 36 5d 20 20 20 20 3b  20 53 65 74 20 69 6e 73  |16]    ; Set ins|
00001990  74 72 75 6d 65 6e 74 20  61 64 64 72 65 73 73 0d  |trument address.|
000019a0  07 62 44 4d 4f 56 20 20  20 52 30 2c 23 31 20 20  |.bDMOV   R0,#1  |
000019b0  20 20 20 20 20 20 20 20  3b 20 54 65 6c 6c 20 76  |        ; Tell v|
000019c0  6f 69 63 65 20 67 65 6e  65 72 61 74 6f 72 20 61  |oice generator a|
000019d0  62 6f 75 74 20 6e 65 77  20 69 6e 73 74 72 75 6d  |bout new instrum|
000019e0  65 6e 74 0d 07 6c 47 41  44 52 20 20 20 52 31 2c  |ent..lGADR   R1,|
000019f0  6e 65 77 64 61 74 61 20  20 20 20 20 3b 20 73 6f  |newdata     ; so|
00001a00  20 77 65 20 64 6f 6e 27  74 20 6c 6f 73 65 20 6e  | we don't lose n|
00001a10  6f 74 65 73 2f 76 6f 69  63 65 73 20 6f 6e 20 69  |otes/voices on i|
00001a20  6e 74 65 72 72 75 70 74  73 2e 0d 07 76 14 53 54  |nterrupts...v.ST|
00001a30  52 42 20 20 52 30 2c 5b  52 31 2c 52 35 5d 0d 07  |RB  R0,[R1,R5]..|
00001a40  80 3f 41 44 44 20 20 20  52 33 2c 52 31 30 2c 23  |.?ADD   R3,R10,#|
00001a50  26 31 34 20 20 20 20 3b  20 4f 66 66 73 65 74 20  |&14    ; Offset |
00001a60  6f 66 20 73 61 6d 70 6c  65 20 70 6c 61 79 20 64  |of sample play d|
00001a70  61 74 61 20 66 72 6f 6d  20 62 61 73 65 0d 07 8a  |ata from base...|
00001a80  33 4d 4f 56 20 20 20 52  31 2c 23 26 31 45 20 20  |3MOV   R1,#&1E  |
00001a90  20 20 20 20 20 20 3b 20  28 73 61 6d 70 6c 65 20  |      ; (sample |
00001aa0  64 61 74 61 20 6d 75 6c  74 69 70 6c 69 65 72 29  |data multiplier)|
00001ab0  0d 07 94 37 4d 4c 41 20  20 20 52 33 2c 52 36 2c  |...7MLA   R3,R6,|
00001ac0  52 31 2c 52 33 20 20 20  20 3b 20 52 33 3d 69 6e  |R1,R3    ; R3=in|
00001ad0  73 74 72 75 6d 65 6e 74  20 70 6c 61 79 20 64 61  |strument play da|
00001ae0  74 61 20 62 61 73 65 0d  07 9e 2c 41 44 44 20 20  |ta base...,ADD  |
00001af0  20 52 30 2c 52 33 2c 23  26 31 43 20 20 20 20 20  | R0,R3,#&1C     |
00001b00  3b 20 47 65 74 20 72 65  70 65 61 74 20 6c 65 6e  |; Get repeat len|
00001b10  67 74 68 0d 07 a8 11 42  4c 20 20 20 20 67 65 74  |gth....BL    get|
00001b20  68 69 6c 6f 0d 07 b2 26  43 4d 50 20 20 20 52 30  |hilo...&CMP   R0|
00001b30  2c 23 31 20 20 20 20 20  20 20 20 20 20 3b 20 4e  |,#1          ; N|
00001b40  6f 20 72 65 70 65 61 74  73 3f 0d 07 bc 31 42 45  |o repeats?...1BE|
00001b50  51 20 20 20 6e 6f 72 65  70 20 20 20 20 20 20 20  |Q   norep       |
00001b60  20 20 20 3b 20 42 72 61  6e 63 68 20 74 6f 20 74  |   ; Branch to t|
00001b70  68 65 20 6e 65 78 74 20  62 69 74 0d 07 c6 2f 4d  |he next bit.../M|
00001b80  4f 56 20 20 20 52 31 2c  52 30 2c 4c 53 4c 23 31  |OV   R1,R0,LSL#1|
00001b90  20 20 20 20 3b 20 78 32  20 66 6f 72 20 72 65 70  |    ; x2 for rep|
00001ba0  65 61 74 20 6c 65 6e 67  74 68 0d 07 d0 32 41 44  |eat length...2AD|
00001bb0  44 20 20 20 52 30 2c 52  33 2c 23 26 31 41 20 20  |D   R0,R3,#&1A  |
00001bc0  20 20 20 3b 20 47 65 74  20 72 65 70 65 61 74 20  |   ; Get repeat |
00001bd0  73 74 61 72 74 20 6f 66  66 73 65 74 0d 07 da 11  |start offset....|
00001be0  42 4c 20 20 20 20 67 65  74 68 69 6c 6f 0d 07 e4  |BL    gethilo...|
00001bf0  3c 41 44 44 20 20 20 52  30 2c 52 30 2c 52 31 20  |<ADD   R0,R0,R1 |
00001c00  20 20 20 20 20 20 3b 20  4d 61 6b 65 20 6e 65 77  |      ; Make new|
00001c10  20 6c 65 6e 67 74 68 20  62 79 20 61 64 64 69 6e  | length by addin|
00001c20  67 20 74 68 65 20 74 77  6f 0d 07 ee 25 53 54 52  |g the two...%STR|
00001c30  20 20 20 52 30 2c 5b 52  32 2c 23 31 32 5d 20 20  |   R0,[R2,#12]  |
00001c40  20 20 3b 20 61 6e 64 20  73 65 74 20 69 74 0d 07  |  ; and set it..|
00001c50  f8 14 41 44 44 20 20 20  52 30 2c 52 33 2c 23 26  |..ADD   R0,R3,#&|
00001c60  31 41 0d 08 02 30 42 4c  20 20 20 20 67 65 74 68  |1A...0BL    geth|
00001c70  69 6c 6f 20 20 20 20 20  20 20 20 3b 20 47 65 74  |ilo        ; Get|
00001c80  20 73 74 61 72 74 20 72  65 70 65 61 74 20 70 6f  | start repeat po|
00001c90  73 6e 0d 08 0c 28 41 44  44 20 20 20 52 30 2c 52  |sn...(ADD   R0,R|
00001ca0  30 2c 23 31 20 20 20 20  20 20 20 3b 20 6d 61 6b  |0,#1       ; mak|
00001cb0  65 20 6e 6f 6e 2d 7a 65  72 6f 0d 08 16 23 53 54  |e non-zero...#ST|
00001cc0  52 20 20 20 52 30 2c 5b  52 32 2c 23 38 5d 20 20  |R   R0,[R2,#8]  |
00001cd0  20 20 20 3b 20 53 74 6f  72 65 20 69 74 0d 08 20  |   ; Store it.. |
00001ce0  2f 42 20 20 20 20 20 6e  65 78 74 20 20 20 20 20  |/B     next     |
00001cf0  20 20 20 20 20 20 3b 20  62 72 61 6e 63 68 20 6f  |      ; branch o|
00001d00  76 65 72 20 6e 65 78 74  20 62 69 74 0d 08 2a 0a  |ver next bit..*.|
00001d10  2e 6e 6f 72 65 70 0d 08  34 14 41 44 44 20 20 20  |.norep..4.ADD   |
00001d20  52 30 2c 52 33 2c 23 26  31 36 0d 08 3e 37 42 4c  |R0,R3,#&16..>7BL|
00001d30  20 20 20 20 67 65 74 68  69 6c 6f 20 20 20 20 20  |    gethilo     |
00001d40  20 20 20 3b 20 47 65 74  20 74 68 65 20 6c 65 6e  |   ; Get the len|
00001d50  67 74 68 20 6f 66 20 74  68 65 20 73 61 6d 70 6c  |gth of the sampl|
00001d60  65 0d 08 48 27 4d 4f 56  20 20 20 52 30 2c 52 30  |e..H'MOV   R0,R0|
00001d70  2c 4c 53 4c 23 31 20 20  20 20 3b 20 78 32 20 6f  |,LSL#1    ; x2 o|
00001d80  66 20 63 6f 75 72 73 65  0d 08 52 25 53 54 52 20  |f course..R%STR |
00001d90  20 20 52 30 2c 5b 52 32  2c 23 31 32 5d 20 20 20  |  R0,[R2,#12]   |
00001da0  20 3b 20 61 6e 64 20 73  65 74 20 69 74 0d 08 5c  | ; and set it..\|
00001db0  14 41 44 44 20 20 20 52  30 2c 52 33 2c 23 26 31  |.ADD   R0,R3,#&1|
00001dc0  41 0d 08 66 30 42 4c 20  20 20 20 67 65 74 68 69  |A..f0BL    gethi|
00001dd0  6c 6f 20 20 20 20 20 20  20 20 3b 20 47 65 74 20  |lo        ; Get |
00001de0  73 74 61 72 74 20 72 65  70 65 61 74 20 70 6f 73  |start repeat pos|
00001df0  6e 0d 08 70 23 53 54 52  20 20 20 52 30 2c 5b 52  |n..p#STR   R0,[R|
00001e00  32 2c 23 38 5d 20 20 20  20 20 3b 20 53 74 6f 72  |2,#8]     ; Stor|
00001e10  65 20 69 74 0d 08 7a 36  2e 6e 65 78 74 20 20 20  |e it..z6.next   |
00001e20  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 42  |             ; B|
00001e30  65 66 6f 72 65 20 77 65  20 67 6f 2c 20 64 6f 20  |efore we go, do |
00001e40  74 68 65 20 76 6f 6c 75  6d 65 0d 08 84 14 41 44  |the volume....AD|
00001e50  44 20 20 20 52 30 2c 52  33 2c 23 26 31 38 0d 08  |D   R0,R3,#&18..|
00001e60  8e 25 42 4c 20 20 20 20  67 65 74 68 69 6c 6f 20  |.%BL    gethilo |
00001e70  20 20 20 20 20 20 20 3b  20 47 65 74 20 76 6f 6c  |       ; Get vol|
00001e80  75 6d 65 0d 08 98 20 43  4d 50 20 20 20 52 30 2c  |ume... CMP   R0,|
00001e90  23 36 34 20 20 20 20 20  20 20 20 20 3b 20 4f 76  |#64         ; Ov|
00001ea0  65 72 3f 0d 08 a2 22 4d  4f 56 47 45 20 52 30 2c  |er?..."MOVGE R0,|
00001eb0  23 36 33 20 20 20 20 20  20 20 20 20 3b 20 43 6f  |#63         ; Co|
00001ec0  72 72 65 63 74 0d 08 ac  27 41 44 52 20 20 20 52  |rrect...'ADR   R|
00001ed0  31 2c 76 6f 6c 74 61 62  20 20 20 20 20 20 3b 20  |1,voltab      ; |
00001ee0  56 6f 6c 75 6d 65 20 74  61 62 6c 65 0d 08 b6 29  |Volume table...)|
00001ef0  4c 44 52 42 20 20 52 30  2c 5b 52 31 2c 52 30 5d  |LDRB  R0,[R1,R0]|
00001f00  20 20 20 20 20 3b 20 47  65 74 20 6e 65 77 20 76  |     ; Get new v|
00001f10  6f 6c 75 6d 65 0d 08 c0  23 53 54 52 20 20 20 52  |olume...#STR   R|
00001f20  30 2c 5b 52 32 2c 23 32  30 5d 20 20 20 20 3b 20  |0,[R2,#20]    ; |
00001f30  53 74 6f 72 65 20 69 74  0d 08 ca 10 2e 6e 65 78  |Store it.....nex|
00001f40  74 63 68 61 6e 6e 65 6c  0d 08 d4 35 41 44 52 20  |tchannel...5ADR |
00001f50  20 20 52 33 2c 65 66 66  65 63 74 74 79 70 65 20  |  R3,effecttype |
00001f60  20 3b 20 43 61 6e 63 65  6c 20 61 6e 79 20 63 75  | ; Cancel any cu|
00001f70  72 72 65 6e 74 20 65 66  66 65 63 74 73 0d 08 de  |rrent effects...|
00001f80  1a 4d 4f 56 20 20 20 52  34 2c 23 30 20 20 20 20  |.MOV   R4,#0    |
00001f90  20 20 20 20 20 20 3b 0d  08 e8 1c 53 54 52 20 20  |      ;....STR  |
00001fa0  20 52 34 2c 5b 52 33 2c  52 35 2c 4c 53 4c 23 32  | R4,[R3,R5,LSL#2|
00001fb0  5d 20 3b 0d 08 f2 2c 42  4c 20 20 20 20 65 66 66  |] ;...,BL    eff|
00001fc0  65 63 74 63 68 65 63 6b  20 20 20 20 3b 20 43 68  |ectcheck    ; Ch|
00001fd0  65 63 6b 20 66 6f 72 20  65 66 66 65 63 74 73 0d  |eck for effects.|
00001fe0  08 fc 33 53 55 42 53 20  20 52 35 2c 52 35 2c 23  |..3SUBS  R5,R5,#|
00001ff0  31 20 20 20 20 20 20 20  3b 20 44 65 63 72 65 6d  |1       ; Decrem|
00002000  65 6e 74 20 63 68 61 6e  6e 65 6c 20 6e 75 6d 62  |ent channel numb|
00002010  65 72 0d 09 06 33 42 50  4c 20 20 20 64 6f 63 68  |er...3BPL   doch|
00002020  61 6e 6e 65 6c 20 20 20  20 20 20 3b 20 4e 6f 70  |annel      ; Nop|
00002030  65 2c 20 64 6f 20 61 6e  6f 74 68 65 72 20 63 68  |e, do another ch|
00002040  61 6e 6e 65 6c 0d 09 10  2b 4c 44 4d 46 44 20 52  |annel...+LDMFD R|
00002050  31 33 21 2c 7b 52 39 7d  20 20 20 20 20 20 3b 20  |13!,{R9}      ; |
00002060  47 65 74 20 6f 75 72 20  52 39 20 62 61 63 6b 21  |Get our R9 back!|
00002070  0d 09 1a 30 4c 44 52 20  20 20 52 30 2c 6a 75 6d  |...0LDR   R0,jum|
00002080  70 66 6c 61 67 20 20 20  20 3b 20 53 6b 69 70 20  |pflag    ; Skip |
00002090  72 65 73 74 20 6f 66 20  70 61 74 74 65 72 6e 3f  |rest of pattern?|
000020a0  0d 09 24 1a 43 4d 50 20  20 20 52 30 2c 23 30 20  |..$.CMP   R0,#0 |
000020b0  20 20 20 20 20 20 20 20  20 3b 0d 09 2e 1e 4d 4f  |         ;....MO|
000020c0  56 4e 45 20 52 39 2c 23  36 33 20 20 20 20 20 20  |VNE R9,#63      |
000020d0  20 20 20 3b 20 59 65 70  0d 09 38 29 4d 4f 56 4e  |   ; Yep..8)MOVN|
000020e0  45 20 52 30 2c 23 30 20  20 20 20 20 20 20 20 20  |E R0,#0         |
000020f0  20 3b 20 52 65 73 65 74  20 74 68 65 20 66 6c 61  | ; Reset the fla|
00002100  67 0d 09 42 1a 53 54 52  4e 45 20 52 30 2c 6a 75  |g..B.STRNE R0,ju|
00002110  6d 70 66 6c 61 67 20 20  20 20 3b 0d 09 4c 34 41  |mpflag    ;..L4A|
00002120  44 44 20 20 20 52 39 2c  52 39 2c 23 31 20 20 20  |DD   R9,R9,#1   |
00002130  20 20 20 20 3b 20 49 6e  63 72 65 6d 65 6e 74 20  |    ; Increment |
00002140  73 65 71 75 65 6e 63 65  20 6e 75 6d 62 65 72 0d  |sequence number.|
00002150  09 56 2d 43 4d 50 20 20  20 52 39 2c 23 36 34 20  |.V-CMP   R9,#64 |
00002160  20 20 20 20 20 20 20 20  3b 20 46 69 6e 69 73 68  |        ; Finish|
00002170  65 64 20 73 65 71 75 65  6e 63 65 3f 0d 09 60 43  |ed sequence?..`C|
00002180  42 4e 45 20 20 20 76 65  6e 64 20 20 20 20 20 20  |BNE   vend      |
00002190  20 20 20 20 20 3b 20 49  66 20 6e 6f 74 2c 20 64  |     ; If not, d|
000021a0  6f 6e 27 74 20 67 6f 20  6f 6e 74 6f 20 6e 65 78  |on't go onto nex|
000021b0  74 20 70 61 74 74 65 72  6e 20 65 6e 74 72 79 0d  |t pattern entry.|
000021c0  09 6a 0f 4d 4f 56 20 20  20 52 39 2c 23 30 0d 09  |.j.MOV   R9,#0..|
000021d0  74 31 41 44 44 20 20 20  52 37 2c 52 37 2c 23 31  |t1ADD   R7,R7,#1|
000021e0  20 20 20 20 20 20 20 3b  20 49 6e 63 72 65 6d 65  |       ; Increme|
000021f0  6e 74 20 70 61 74 74 65  72 6e 20 70 6f 73 6e 0d  |nt pattern posn.|
00002200  09 7e 27 43 4d 50 20 20  20 52 37 2c 52 38 20 20  |.~'CMP   R7,R8  |
00002210  20 20 20 20 20 20 20 20  3b 20 45 6e 64 20 6f 66  |        ; End of|
00002220  20 73 6f 6e 67 3f 0d 09  88 2f 4d 4f 56 47 54 20  | song?.../MOVGT |
00002230  52 37 2c 23 30 20 20 20  20 20 20 20 20 20 20 3b  |R7,#0          ;|
00002240  20 2e 2e 2e 61 6e 64 20  61 67 61 69 6e 2c 20 66  | ...and again, f|
00002250  6f 6c 6b 73 21 0d 09 92  09 2e 76 65 6e 64 0d 09  |olks!.....vend..|
00002260  9c 11 41 44 52 20 20 20  52 30 2c 69 6e 66 6f 0d  |..ADR   R0,info.|
00002270  09 a6 2b 53 54 4d 49 41  20 52 30 2c 7b 52 37 2d  |..+STMIA R0,{R7-|
00002280  52 39 7d 20 20 20 20 20  3b 20 53 74 6f 72 65 20  |R9}     ; Store |
00002290  6e 65 77 20 76 61 6c 75  65 73 0d 09 b0 25 4c 44  |new values...%LD|
000022a0  4d 46 44 20 52 31 33 21  2c 7b 50 43 7d 20 20 20  |MFD R13!,{PC}   |
000022b0  20 20 20 3b 20 41 6e 64  20 72 65 74 75 72 6e 0d  |   ; And return.|
000022c0  09 ba 04 0d 09 c4 31 2e  67 65 74 68 69 6c 6f 20  |......1.gethilo |
000022d0  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 47 65  |            ; Ge|
000022e0  74 73 20 48 69 2d 4c 6f  20 73 74 6f 72 65 64 20  |ts Hi-Lo stored |
000022f0  69 6e 66 6f 0d 09 ce 2d  53 54 4d 46 44 20 52 31  |info...-STMFD R1|
00002300  33 21 2c 7b 52 31 7d 20  20 20 20 20 20 3b 20 52  |3!,{R1}      ; R|
00002310  30 3d 61 64 64 72 65 73  73 20 6f 66 20 69 6e 66  |0=address of inf|
00002320  6f 0d 09 d8 28 4c 44 52  42 20 20 52 31 2c 5b 52  |o...(LDRB  R1,[R|
00002330  30 2c 23 30 5d 20 20 20  20 20 3b 20 47 65 74 20  |0,#0]     ; Get |
00002340  68 69 67 68 20 62 79 74  65 0d 09 e2 26 4c 44 52  |high byte...&LDR|
00002350  42 20 20 52 30 2c 5b 52  30 2c 23 31 5d 20 20 20  |B  R0,[R0,#1]   |
00002360  20 20 3b 20 47 65 74 20  6c 6f 20 62 79 74 65 0d  |  ; Get lo byte.|
00002370  09 ec 23 84 52 20 20 20  52 30 2c 52 30 2c 52 31  |..#.R   R0,R0,R1|
00002380  2c 4c 53 4c 23 38 20 3b  20 4d 69 78 20 74 68 65  |,LSL#8 ; Mix the|
00002390  20 32 0d 09 f6 25 4c 44  4d 46 44 20 52 31 33 21  | 2...%LDMFD R13!|
000023a0  2c 7b 52 31 7d 20 20 20  20 20 20 3b 20 72 65 73  |,{R1}      ; res|
000023b0  74 6f 72 65 20 52 31 0d  0a 00 21 4d 4f 56 20 20  |tore R1...!MOV  |
000023c0  20 50 43 2c 52 31 34 20  20 20 20 20 20 20 20 20  | PC,R14         |
000023d0  3b 20 72 65 74 75 72 6e  0d 0a 0a 04 0d 0a 14 30  |; return.......0|
000023e0  2e 65 66 66 65 63 74 63  68 65 63 6b 20 20 20 20  |.effectcheck    |
000023f0  20 20 20 20 20 3b 20 43  68 65 63 6b 20 66 6f 72  |     ; Check for|
00002400  20 61 6e 79 20 65 66 66  65 63 74 73 0d 0a 1e 23  | any effects...#|
00002410  4c 44 52 42 20 20 52 36  2c 5b 52 31 31 2c 23 33  |LDRB  R6,[R11,#3|
00002420  5d 20 20 20 20 3b 20 47  65 74 20 69 6e 66 6f 0d  |]    ; Get info.|
00002430  0a 28 2c 4c 44 52 42 20  20 52 34 2c 5b 52 31 31  |.(,LDRB  R4,[R11|
00002440  2c 23 32 5d 20 20 20 20  3b 20 47 65 74 20 65 66  |,#2]    ; Get ef|
00002450  66 65 63 74 20 6e 75 6e  62 65 72 0d 0a 32 18 80  |fect nunber..2..|
00002460  20 20 20 52 34 2c 52 34  2c 23 26 46 20 20 20 20  |   R4,R4,#&F    |
00002470  20 20 3b 0d 0a 3c 29 43  4d 50 20 20 20 52 34 2c  |  ;..<)CMP   R4,|
00002480  23 26 43 20 20 20 20 20  20 20 20 20 3b 20 56 6f  |#&C         ; Vo|
00002490  6c 75 6d 65 20 63 68 61  6e 67 65 3f 0d 0a 46 1d  |lume change?..F.|
000024a0  42 4e 45 20 20 20 65 66  66 20 20 20 20 20 20 20  |BNE   eff       |
000024b0  20 20 20 20 20 3b 20 4e  6f 0d 0a 50 20 43 4d 50  |     ; No..P CMP|
000024c0  20 20 20 52 36 2c 23 36  34 20 20 20 20 20 20 20  |   R6,#64       |
000024d0  20 20 3b 20 4f 76 65 72  3f 0d 0a 5a 22 4d 4f 56  |  ; Over?..Z"MOV|
000024e0  47 45 20 52 36 2c 23 36  33 20 20 20 20 20 20 20  |GE R6,#63       |
000024f0  20 20 3b 20 43 6f 72 72  65 63 74 0d 0a 64 1a 41  |  ; Correct..d.A|
00002500  44 52 20 20 20 52 31 2c  76 6f 6c 74 61 62 20 20  |DR   R1,voltab  |
00002510  20 20 20 20 3b 0d 0a 6e  2a 4c 44 52 42 20 20 52  |    ;..n*LDRB  R|
00002520  30 2c 5b 52 31 2c 52 36  5d 20 20 20 20 20 3b 20  |0,[R1,R6]     ; |
00002530  47 65 74 20 72 69 67 68  74 20 75 6e 69 74 73 0d  |Get right units.|
00002540  0a 78 2d 41 44 52 20 20  20 52 31 2c 6f 75 72 69  |.x-ADR   R1,ouri|
00002550  6e 66 20 20 20 20 20 20  3b 20 46 69 6e 64 20 74  |nf      ; Find t|
00002560  61 62 6c 65 20 61 64 64  72 65 73 73 0d 0a 82 1a  |able address....|
00002570  41 44 44 20 20 20 52 31  2c 52 31 2c 52 35 2c 4c  |ADD   R1,R1,R5,L|
00002580  53 4c 23 35 20 3b 0d 0a  8c 2b 53 54 52 20 20 20  |SL#5 ;...+STR   |
00002590  52 30 2c 5b 52 31 2c 23  32 30 5d 20 20 20 20 3b  |R0,[R1,#20]    ;|
000025a0  20 53 74 6f 72 65 20 6e  65 77 20 76 6f 6c 75 6d  | Store new volum|
000025b0  65 0d 0a 96 10 4d 4f 56  20 20 20 50 43 2c 52 31  |e....MOV   PC,R1|
000025c0  34 0d 0a a0 08 2e 65 66  66 0d 0a aa 29 43 4d 50  |4.....eff...)CMP|
000025d0  20 20 20 52 34 2c 23 26  44 20 20 20 20 20 20 20  |   R4,#&D       |
000025e0  20 20 3b 20 50 61 74 74  65 72 6e 20 62 72 65 61  |  ; Pattern brea|
000025f0  6b 3f 0d 0a b4 31 53 54  52 45 51 20 52 34 2c 6a  |k?...1STREQ R4,j|
00002600  75 6d 70 66 6c 61 67 20  20 20 20 3b 20 4a 75 6d  |umpflag    ; Jum|
00002610  70 20 74 6f 20 65 6e 64  20 6f 66 20 70 61 74 74  |p to end of patt|
00002620  65 72 6e 0d 0a be 17 ec  51 20 50 43 2c 52 31 34  |ern.....Q PC,R14|
00002630  20 20 20 20 20 20 20 20  20 3b 0d 0a c8 28 43 4d  |         ;...(CM|
00002640  50 20 20 20 52 34 2c 23  26 46 20 20 20 20 20 20  |P   R4,#&F      |
00002650  20 20 20 3b 20 43 68 61  6e 67 65 20 73 70 65 65  |   ; Change spee|
00002660  64 3f 0d 0a d2 1d 42 4e  45 20 20 20 65 66 66 31  |d?....BNE   eff1|
00002670  20 20 20 20 20 20 20 20  20 20 20 3b 20 4e 6f 0d  |           ; No.|
00002680  0a dc 27 80 20 20 20 52  36 2c 52 36 2c 23 26 46  |..'.   R6,R6,#&F|
00002690  20 20 20 20 20 20 3b 20  4d 61 73 6b 20 6e 65 77  |      ; Mask new|
000026a0  20 73 70 65 65 64 0d 0a  e6 23 53 54 52 20 20 20  | speed...#STR   |
000026b0  52 36 2c 73 70 65 65 64  20 20 20 20 20 20 20 3b  |R6,speed       ;|
000026c0  20 53 74 6f 72 65 20 69  74 0d 0a f0 21 4d 4f 56  | Store it...!MOV|
000026d0  20 20 20 50 43 2c 52 31  34 20 20 20 20 20 20 20  |   PC,R14       |
000026e0  20 20 3b 20 52 65 74 75  72 6e 0d 0a fa 09 2e 65  |  ; Return.....e|
000026f0  66 66 31 0d 0b 04 29 43  4d 50 20 20 20 52 34 2c  |ff1...)CMP   R4,|
00002700  23 31 20 20 20 20 20 20  20 20 20 20 3b 20 50 6f  |#1          ; Po|
00002710  72 74 61 6d 65 6e 74 6f  20 75 70 3f 0d 0b 0e 1f  |rtamento up?....|
00002720  42 4c 54 20 20 20 65 66  66 32 20 20 20 20 20 20  |BLT   eff2      |
00002730  20 20 20 20 20 3b 20 4e  6f 70 65 0d 0b 18 23 43  |     ; Nope...#C|
00002740  4d 50 20 20 20 52 34 2c  23 32 20 20 20 20 20 20  |MP   R4,#2      |
00002750  20 20 20 20 3b 20 4f 72  20 64 6f 77 6e 3f 0d 0b  |    ; Or down?..|
00002760  22 1f 42 47 54 20 20 20  65 66 66 32 20 20 20 20  |".BGT   eff2    |
00002770  20 20 20 20 20 20 20 3b  20 4e 6f 70 65 0d 0b 2c  |       ; Nope..,|
00002780  27 84 52 20 20 20 52 36  2c 52 36 2c 52 34 2c 4c  |'.R   R6,R6,R4,L|
00002790  53 4c 23 38 20 3b 20 4d  61 6b 65 20 6e 65 77 20  |SL#8 ; Make new |
000027a0  77 6f 72 64 0d 0b 36 22  41 44 52 20 20 20 52 33  |word..6"ADR   R3|
000027b0  2c 65 66 66 65 63 74 74  79 70 65 20 20 3b 20 53  |,effecttype  ; S|
000027c0  61 76 65 20 69 74 0d 0b  40 1c 53 54 52 20 20 20  |ave it..@.STR   |
000027d0  52 36 2c 5b 52 33 2c 52  35 2c 4c 53 4c 23 32 5d  |R6,[R3,R5,LSL#2]|
000027e0  20 3b 0d 0b 4a 21 4d 4f  56 20 20 20 50 43 2c 52  | ;..J!MOV   PC,R|
000027f0  31 34 20 20 20 20 20 20  20 20 20 3b 20 52 65 74  |14         ; Ret|
00002800  75 72 6e 0d 0b 54 09 2e  65 66 66 32 0d 0b 5e 21  |urn..T..eff2..^!|
00002810  4d 4f 56 20 20 20 50 43  2c 52 31 34 20 20 20 20  |MOV   PC,R14    |
00002820  20 20 20 20 20 3b 20 52  65 74 75 72 6e 0d 0b 68  |     ; Return..h|
00002830  04 0d 0b 72 4c 2e 64 6f  65 66 66 65 63 74 20 20  |...rL.doeffect  |
00002840  20 20 20 20 20 20 20 20  20 20 3b 20 44 6f 20 65  |          ; Do e|
00002850  66 66 65 63 74 20 64 65  74 61 69 6c 65 64 20 69  |ffect detailed i|
00002860  6e 20 27 65 66 66 65 63  74 74 79 70 65 27 20 28  |n 'effecttype' (|
00002870  52 31 3d 73 75 62 6e 6f  74 65 20 23 29 0d 0b 7c  |R1=subnote #)..||
00002880  25 4d 4f 56 20 20 20 52  35 2c 23 33 20 20 20 20  |%MOV   R5,#3    |
00002890  20 20 20 20 20 20 3b 20  34 20 63 68 61 6e 6e 65  |      ; 4 channe|
000028a0  6c 73 0d 0b 86 25 41 44  52 20 20 20 52 32 2c 63  |ls...%ADR   R2,c|
000028b0  68 61 6e 6e 65 6c 6e 6f  74 65 20 3b 20 41 6d 69  |hannelnote ; Ami|
000028c0  67 61 2d 6e 6f 74 65 0d  0b 90 2e 41 44 52 20 20  |ga-note....ADR  |
000028d0  20 52 33 2c 65 66 66 65  63 74 74 79 70 65 20 20  | R3,effecttype  |
000028e0  3b 20 52 33 3d 65 66 66  65 63 74 74 79 70 65 20  |; R3=effecttype |
000028f0  74 61 62 6c 65 0d 0b 9a  39 41 44 52 20 20 20 52  |table...9ADR   R|
00002900  34 2c 69 6e 76 65 72 73  65 74 61 62 6c 65 20 3b  |4,inversetable ;|
00002910  20 52 34 3d 69 6e 76 65  72 73 65 20 70 69 74 63  | R4=inverse pitc|
00002920  68 20 6c 6f 6f 6b 75 70  20 74 61 62 6c 65 0d 0b  |h lookup table..|
00002930  a4 0b 2e 64 6f 65 66 66  31 0d 0b ae 47 41 44 52  |...doeff1...GADR|
00002940  20 20 20 52 38 2c 6f 75  72 69 6e 66 20 20 20 20  |   R8,ourinf    |
00002950  20 20 3b 20 43 61 6c 63  75 6c 61 74 65 20 61 64  |  ; Calculate ad|
00002960  64 72 65 73 73 20 6f 66  66 73 65 74 20 6f 66 20  |dress offset of |
00002970  76 6f 69 63 65 2d 69 6e  66 6f 20 74 61 62 6c 65  |voice-info table|
00002980  0d 0b b8 1a 41 44 44 20  20 20 52 38 2c 52 38 2c  |....ADD   R8,R8,|
00002990  52 35 2c 4c 53 4c 23 35  20 3b 0d 0b c2 2e 4c 44  |R5,LSL#5 ;....LD|
000029a0  52 20 20 20 52 30 2c 5b  52 33 2c 52 35 2c 4c 53  |R   R0,[R3,R5,LS|
000029b0  4c 23 32 5d 20 3b 20 41  6e 79 20 65 66 66 65 63  |L#2] ; Any effec|
000029c0  74 20 74 6f 20 64 6f 3f  0d 0b cc 1a 43 4d 50 20  |t to do?....CMP |
000029d0  20 20 52 30 2c 23 30 20  20 20 20 20 20 20 20 20  |  R0,#0         |
000029e0  20 3b 0d 0b d6 1f 42 45  51 20 20 20 64 6f 65 66  | ;....BEQ   doef|
000029f0  66 6e 65 78 74 20 20 20  20 20 20 3b 20 4e 6f 70  |fnext      ; Nop|
00002a00  65 0d 0b e0 27 80 20 20  20 52 36 2c 52 30 2c 23  |e...'.   R6,R0,#|
00002a10  26 46 30 30 20 20 20 20  3b 20 52 36 3d 65 66 66  |&F00    ; R6=eff|
00002a20  65 63 74 20 74 79 70 65  0d 0b ea 27 80 20 20 20  |ect type...'.   |
00002a30  52 30 2c 52 30 2c 23 26  46 46 20 20 20 20 20 3b  |R0,R0,#&FF     ;|
00002a40  20 52 30 3d 65 66 66 65  63 74 20 64 61 74 61 0d  | R0=effect data.|
00002a50  0b f4 04 0d 0b fe 29 43  4d 50 20 20 20 52 36 2c  |......)CMP   R6,|
00002a60  23 26 31 30 30 20 20 20  20 20 20 20 3b 20 50 6f  |#&100       ; Po|
00002a70  72 74 61 6d 65 6e 74 6f  20 75 70 3f 0d 0c 08 1d  |rtamento up?....|
00002a80  42 4e 45 20 20 20 64 6f  65 31 20 20 20 20 20 20  |BNE   doe1      |
00002a90  20 20 20 20 20 3b 20 4e  6f 0d 0c 12 2d 4c 44 52  |     ; No...-LDR|
00002aa0  20 20 20 52 36 2c 5b 52  32 2c 52 35 2c 4c 53 4c  |   R6,[R2,R5,LSL|
00002ab0  23 32 5d 20 3b 20 47 65  74 20 63 75 72 72 65 6e  |#2] ; Get curren|
00002ac0  74 20 74 6f 6e 65 0d 0c  1c 23 53 55 42 20 20 20  |t tone...#SUB   |
00002ad0  52 30 2c 52 30 2c 23 31  20 20 20 20 20 20 20 3b  |R0,R0,#1       ;|
00002ae0  20 53 6c 69 64 65 20 75  70 0d 0c 26 12 53 55 42  | Slide up..&.SUB|
00002af0  20 20 20 52 36 2c 52 36  2c 52 30 0d 0c 30 24 53  |   R6,R6,R0..0$S|
00002b00  54 52 20 20 20 52 36 2c  5b 52 32 2c 52 35 2c 4c  |TR   R6,[R2,R5,L|
00002b10  53 4c 23 32 5d 20 3b 20  52 65 2d 73 61 76 65 0d  |SL#2] ; Re-save.|
00002b20  0c 3a 35 4c 44 52 20 20  20 52 36 2c 5b 52 34 2c  |.:5LDR   R6,[R4,|
00002b30  52 36 2c 4c 53 4c 23 32  5d 20 3b 20 47 65 74 20  |R6,LSL#2] ; Get |
00002b40  61 72 63 68 69 6d 65 64  65 73 2d 66 72 65 71 75  |archimedes-frequ|
00002b50  65 6e 63 79 0d 0c 44 31  53 54 52 20 20 20 52 36  |ency..D1STR   R6|
00002b60  2c 5b 52 38 2c 23 34 5d  20 20 20 20 20 3b 20 50  |,[R8,#4]     ; P|
00002b70  75 74 20 69 6e 20 70 61  72 61 6d 65 74 65 72 20  |ut in parameter |
00002b80  62 6c 6f 63 6b 0d 0c 4e  13 42 20 20 20 20 20 64  |block..N.B     d|
00002b90  6f 65 66 66 6e 65 78 74  0d 0c 58 04 0d 0c 62 09  |oeffnext..X...b.|
00002ba0  2e 64 6f 65 31 0d 0c 6c  2b 43 4d 50 20 20 20 52  |.doe1..l+CMP   R|
00002bb0  36 2c 23 26 32 30 30 20  20 20 20 20 20 20 3b 20  |6,#&200       ; |
00002bc0  50 6f 72 74 61 6d 65 6e  74 6f 20 64 6f 77 6e 3f  |Portamento down?|
00002bd0  0d 0c 76 1d 42 4e 45 20  20 20 64 6f 65 32 20 20  |..v.BNE   doe2  |
00002be0  20 20 20 20 20 20 20 20  20 3b 20 4e 6f 0d 0c 80  |         ; No...|
00002bf0  2d 4c 44 52 20 20 20 52  36 2c 5b 52 32 2c 52 35  |-LDR   R6,[R2,R5|
00002c00  2c 4c 53 4c 23 32 5d 20  3b 20 47 65 74 20 63 75  |,LSL#2] ; Get cu|
00002c10  72 72 65 6e 74 20 74 6f  6e 65 0d 0c 8a 25 53 55  |rrent tone...%SU|
00002c20  42 20 20 20 52 30 2c 52  30 2c 23 31 20 20 20 20  |B   R0,R0,#1    |
00002c30  20 20 20 3b 20 53 6c 69  64 65 20 64 6f 77 6e 0d  |   ; Slide down.|
00002c40  0c 94 12 41 44 44 20 20  20 52 36 2c 52 36 2c 52  |...ADD   R6,R6,R|
00002c50  30 0d 0c 9e 24 53 54 52  20 20 20 52 36 2c 5b 52  |0...$STR   R6,[R|
00002c60  32 2c 52 35 2c 4c 53 4c  23 32 5d 20 3b 20 52 65  |2,R5,LSL#2] ; Re|
00002c70  2d 73 61 76 65 0d 0c a8  35 4c 44 52 20 20 20 52  |-save...5LDR   R|
00002c80  36 2c 5b 52 34 2c 52 36  2c 4c 53 4c 23 32 5d 20  |6,[R4,R6,LSL#2] |
00002c90  3b 20 47 65 74 20 61 72  63 68 69 6d 65 64 65 73  |; Get archimedes|
00002ca0  2d 66 72 65 71 75 65 6e  63 79 0d 0c b2 31 53 54  |-frequency...1ST|
00002cb0  52 20 20 20 52 36 2c 5b  52 38 2c 23 34 5d 20 20  |R   R6,[R8,#4]  |
00002cc0  20 20 20 3b 20 50 75 74  20 69 6e 20 70 61 72 61  |   ; Put in para|
00002cd0  6d 65 74 65 72 20 62 6c  6f 63 6b 0d 0c bc 13 42  |meter block....B|
00002ce0  20 20 20 20 20 64 6f 65  66 66 6e 65 78 74 0d 0c  |     doeffnext..|
00002cf0  c6 09 2e 64 6f 65 32 0d  0c d0 0e 2e 64 6f 65 66  |...doe2.....doef|
00002d00  66 6e 65 78 74 0d 0c da  27 53 55 42 53 20 20 52  |fnext...'SUBS  R|
00002d10  35 2c 52 35 2c 23 31 20  20 20 20 20 20 20 3b 20  |5,R5,#1       ; |
00002d20  4e 65 78 74 20 63 68 61  6e 6e 65 6c 0d 0c e4 1a  |Next channel....|
00002d30  42 50 4c 20 20 20 64 6f  65 66 66 31 20 20 20 20  |BPL   doeff1    |
00002d40  20 20 20 20 20 3b 0d 0c  ee 2a 4d 4f 56 20 20 20  |     ;...*MOV   |
00002d50  50 43 2c 52 31 34 20 20  20 20 20 20 20 20 20 3b  |PC,R14         ;|
00002d60  20 4e 6f 20 6d 6f 72 65  2c 20 72 65 74 75 72 6e  | No more, return|
00002d70  0d 0c f8 04 0d 0d 02 0d  2e 6a 75 6d 70 66 6c 61  |.........jumpfla|
00002d80  67 0d 0d 0c 3d 45 51 55  44 20 30 20 20 20 20 20  |g...=EQUD 0     |
00002d90  20 20 20 20 20 20 20 20  20 20 3b 20 3c 3e 30 20  |          ; <>0 |
00002da0  69 66 20 70 61 74 74 65  72 6e 20 69 73 20 74 6f  |if pattern is to|
00002db0  20 62 65 20 74 65 72 6d  69 6e 61 74 65 64 0d 0d  | be terminated..|
00002dc0  16 04 0d 0d 20 0b 2e 6f  6c 64 76 6f 78 0d 0d 2a  |.... ..oldvox..*|
00002dd0  33 45 51 55 44 20 30 20  20 20 20 20 20 20 20 20  |3EQUD 0         |
00002de0  20 20 20 20 20 20 3b 20  53 6f 20 77 65 20 63 61  |      ; So we ca|
00002df0  6e 20 6b 69 6c 6c 20 74  68 65 20 76 6f 69 63 65  |n kill the voice|
00002e00  0d 0d 34 04 0d 0d 3e 32  2e 73 61 6d 70 6c 65 6c  |..4...>2.samplel|
00002e10  6f 63 20 20 20 20 20 20  20 20 20 20 20 3b 20 54  |oc           ; T|
00002e20  61 62 6c 65 20 6f 66 20  73 61 6d 70 6c 65 20 6f  |able of sample o|
00002e30  66 66 73 65 74 73 0d 0d  48 3b 45 51 55 44 20 30  |ffsets..H;EQUD 0|
00002e40  3a 45 51 55 44 20 30 3a  45 51 55 44 20 30 3a 45  |:EQUD 0:EQUD 0:E|
00002e50  51 55 44 20 30 3a 45 51  55 44 20 30 3a 45 51 55  |QUD 0:EQUD 0:EQU|
00002e60  44 20 30 3a 45 51 55 44  20 30 3a 45 51 55 44 20  |D 0:EQUD 0:EQUD |
00002e70  30 0d 0d 52 3b 45 51 55  44 20 30 3a 45 51 55 44  |0..R;EQUD 0:EQUD|
00002e80  20 30 3a 45 51 55 44 20  30 3a 45 51 55 44 20 30  | 0:EQUD 0:EQUD 0|
00002e90  3a 45 51 55 44 20 30 3a  45 51 55 44 20 30 3a 45  |:EQUD 0:EQUD 0:E|
00002ea0  51 55 44 20 30 3a 45 51  55 44 20 30 0d 0d 5c 3b  |QUD 0:EQUD 0..\;|
00002eb0  45 51 55 44 20 30 3a 45  51 55 44 20 30 3a 45 51  |EQUD 0:EQUD 0:EQ|
00002ec0  55 44 20 30 3a 45 51 55  44 20 30 3a 45 51 55 44  |UD 0:EQUD 0:EQUD|
00002ed0  20 30 3a 45 51 55 44 20  30 3a 45 51 55 44 20 30  | 0:EQUD 0:EQUD 0|
00002ee0  3a 45 51 55 44 20 30 0d  0d 66 3b 45 51 55 44 20  |:EQUD 0..f;EQUD |
00002ef0  30 3a 45 51 55 44 20 30  3a 45 51 55 44 20 30 3a  |0:EQUD 0:EQUD 0:|
00002f00  45 51 55 44 20 30 3a 45  51 55 44 20 30 3a 45 51  |EQUD 0:EQUD 0:EQ|
00002f10  55 44 20 30 3a 45 51 55  44 20 30 3a 45 51 55 44  |UD 0:EQUD 0:EQUD|
00002f20  20 30 0d 0d 70 04 0d 0d  7a 2f 2e 76 6f 6c 74 61  | 0..p...z/.volta|
00002f30  62 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |b              ;|
00002f40  20 36 34 2d 62 79 74 65  20 76 6f 6c 75 6d 65 20  | 64-byte volume |
00002f50  74 61 62 6c 65 0d 0d 84  13 5d 3a 50 25 2b 3d 36  |table....]:P%+=6|
00002f60  34 3a 5b 4f 50 54 20 43  0d 0d 8e 04 0d 0d 98 29  |4:[OPT C.......)|
00002f70  2e 69 6e 73 74 61 6c 6c  73 6f 75 6e 64 20 20 20  |.installsound   |
00002f80  20 20 20 20 20 3b 20 49  6e 73 74 61 6c 6c 20 76  |     ; Install v|
00002f90  6f 69 63 65 73 0d 0d a2  1b 53 54 4d 46 44 20 52  |oices....STMFD R|
00002fa0  31 33 21 2c 7b 52 30 2d  52 31 30 2c 52 31 34 7d  |13!,{R0-R10,R14}|
00002fb0  0d 0d ac 32 41 44 52 20  20 20 52 30 2c 56 6f 69  |...2ADR   R0,Voi|
00002fc0  63 65 42 61 73 65 20 20  20 3b 20 4d 61 6b 65 20  |ceBase   ; Make |
00002fd0  54 72 61 63 6b 65 72 56  6f 78 20 61 20 76 6f 69  |TrackerVox a voi|
00002fe0  63 65 0d 0d b6 0f 4d 4f  56 20 20 20 52 31 2c 23  |ce....MOV   R1,#|
00002ff0  30 0d 0d c0 1e 53 57 49  20 20 20 22 53 6f 75 6e  |0....SWI   "Soun|
00003000  64 5f 49 6e 73 74 61 6c  6c 56 6f 69 63 65 22 0d  |d_InstallVoice".|
00003010  0d ca 2c 53 54 52 20 20  20 52 31 2c 6f 6c 64 76  |..,STR   R1,oldv|
00003020  6f 78 20 20 20 20 20 20  3b 20 53 6f 20 77 65 20  |ox      ; So we |
00003030  63 61 6e 20 6b 69 6c 6c  20 69 74 0d 0d d4 2a 4d  |can kill it...*M|
00003040  4f 56 20 20 20 52 31 30  2c 23 31 20 20 20 20 20  |OV   R10,#1     |
00003050  20 20 20 20 3b 20 4d 75  74 65 20 76 6f 69 63 65  |    ; Mute voice|
00003060  73 20 31 2d 38 0d 0d de  0b 2e 6d 75 74 65 6c 70  |s 1-8.....mutelp|
00003070  0d 0d e8 10 4d 4f 56 20  20 20 52 30 2c 52 31 30  |....MOV   R0,R10|
00003080  0d 0d f2 0f 4d 4f 56 20  20 20 52 31 2c 23 30 0d  |....MOV   R1,#0.|
00003090  0d fc 1d 53 57 49 20 20  20 22 53 6f 75 6e 64 5f  |...SWI   "Sound_|
000030a0  41 74 74 61 63 68 56 6f  69 63 65 22 0d 0e 06 14  |AttachVoice"....|
000030b0  41 44 44 20 20 20 52 31  30 2c 52 31 30 2c 23 31  |ADD   R10,R10,#1|
000030c0  0d 0e 10 10 43 4d 50 20  20 20 52 31 30 2c 23 39  |....CMP   R10,#9|
000030d0  0d 0e 1a 10 42 4e 45 20  20 20 6d 75 74 65 6c 70  |....BNE   mutelp|
000030e0  0d 0e 24 10 4d 4f 56 20  20 20 52 31 30 2c 23 31  |..$.MOV   R10,#1|
000030f0  0d 0e 2e 3a 2e 61 74 74  6c 70 20 20 20 20 20 20  |...:.attlp      |
00003100  20 20 20 20 20 20 20 20  20 3b 20 41 74 74 61 63  |         ; Attac|
00003110  68 20 76 6f 69 63 65 73  20 31 2d 34 20 74 6f 20  |h voices 1-4 to |
00003120  54 72 61 63 6b 65 72 56  6f 78 0d 0e 38 10 4d 4f  |TrackerVox..8.MO|
00003130  56 20 20 20 52 30 2c 52  31 30 0d 0e 42 16 41 44  |V   R0,R10..B.AD|
00003140  52 20 20 20 52 31 2c 56  6f 69 63 65 4e 61 6d 65  |R   R1,VoiceName|
00003150  0d 0e 4c 22 53 57 49 20  20 20 22 53 6f 75 6e 64  |..L"SWI   "Sound|
00003160  5f 41 74 74 61 63 68 4e  61 6d 65 64 56 6f 69 63  |_AttachNamedVoic|
00003170  65 22 0d 0e 56 14 41 44  44 20 20 20 52 31 30 2c  |e"..V.ADD   R10,|
00003180  52 31 30 2c 23 31 0d 0e  60 10 43 4d 50 20 20 20  |R10,#1..`.CMP   |
00003190  52 31 30 2c 23 35 0d 0e  6a 0f 42 4e 45 20 20 20  |R10,#5..j.BNE   |
000031a0  61 74 74 6c 70 0d 0e 74  04 0d 0e 7e 3a 4d 4f 56  |attlp..t...~:MOV|
000031b0  20 20 20 52 30 2c 23 31  20 20 20 20 20 20 20 20  |   R0,#1        |
000031c0  20 20 3b 20 53 6c 69 67  68 74 20 72 69 67 68 74  |  ; Slight right|
000031d0  20 62 69 61 73 20 66 6f  72 20 63 68 61 6e 6e 65  | bias for channe|
000031e0  6c 20 31 0d 0e 88 10 4d  4f 56 20 20 20 52 31 2c  |l 1....MOV   R1,|
000031f0  23 31 36 0d 0e 92 18 53  57 49 20 20 20 22 53 6f  |#16....SWI   "So|
00003200  75 6e 64 5f 53 74 65 72  65 6f 22 0d 0e 9c 39 4d  |und_Stereo"...9M|
00003210  4f 56 20 20 20 52 30 2c  23 32 20 20 20 20 20 20  |OV   R0,#2      |
00003220  20 20 20 20 3b 20 53 6c  69 67 68 74 20 6c 65 66  |    ; Slight lef|
00003230  74 20 62 69 61 73 20 66  6f 72 20 63 68 61 6e 6e  |t bias for chann|
00003240  65 6c 20 32 0d 0e a6 10  4d 56 4e 20 20 20 52 31  |el 2....MVN   R1|
00003250  2c 23 31 35 0d 0e b0 18  53 57 49 20 20 20 22 53  |,#15....SWI   "S|
00003260  6f 75 6e 64 5f 53 74 65  72 65 6f 22 0d 0e ba 3e  |ound_Stereo"...>|
00003270  4d 4f 56 20 20 20 52 30  2c 23 33 20 20 20 20 20  |MOV   R0,#3     |
00003280  20 20 20 20 20 3b 20 61  6e 64 20 66 6f 72 20 63  |     ; and for c|
00003290  68 61 6e 6e 65 6c 20 33  20 28 41 6d 69 67 61 20  |hannel 3 (Amiga |
000032a0  67 6f 65 73 20 52 4c 4c  52 29 0d 0e c4 10 4d 56  |goes RLLR)....MV|
000032b0  4e 20 20 20 52 31 2c 23  31 35 0d 0e ce 18 53 57  |N   R1,#15....SW|
000032c0  49 20 20 20 22 53 6f 75  6e 64 5f 53 74 65 72 65  |I   "Sound_Stere|
000032d0  6f 22 0d 0e d8 38 4d 4f  56 20 20 20 52 30 2c 23  |o"...8MOV   R0,#|
000032e0  34 20 20 20 20 20 20 20  20 20 20 3b 20 41 6e 64  |4          ; And|
000032f0  20 72 69 67 68 74 20 63  67 61 69 6e 20 66 6f 72  | right cgain for|
00003300  20 63 68 61 6e 6e 65 6c  20 34 0d 0e e2 10 4d 4f  | channel 4....MO|
00003310  56 20 20 20 52 31 2c 23  31 36 0d 0e ec 18 53 57  |V   R1,#16....SW|
00003320  49 20 20 20 22 53 6f 75  6e 64 5f 53 74 65 72 65  |I   "Sound_Stere|
00003330  6f 22 0d 0e f6 04 0d 0f  00 28 4d 4f 56 20 20 20  |o".......(MOV   |
00003340  52 30 2c 23 34 20 20 20  20 20 20 20 20 20 20 3b  |R0,#4          ;|
00003350  20 50 6c 61 79 20 34 20  76 6f 69 63 65 73 0d 0f  | Play 4 voices..|
00003360  0a 2e 4d 4f 56 20 20 20  52 31 2c 23 32 30 38 20  |..MOV   R1,#208 |
00003370  20 20 20 20 20 20 20 3b  20 42 75 66 66 65 72 20  |       ; Buffer |
00003380  6c 65 6e 67 74 68 20 3d  20 32 30 30 0d 0f 14 35  |length = 200...5|
00003390  4d 4f 56 20 20 20 52 32  2c 23 75 73 20 20 20 20  |MOV   R2,#us    |
000033a0  20 20 20 20 20 3b 20 46  6f 72 20 74 68 69 73 20  |     ; For this |
000033b0  6d 61 6e 79 20 6d 69 63  72 6f 73 65 63 6f 6e 64  |many microsecond|
000033c0  73 0d 0f 1e 32 4d 4f 56  20 20 20 52 33 2c 23 30  |s...2MOV   R3,#0|
000033d0  20 20 20 20 20 20 20 20  20 20 3b 20 4c 65 61 76  |          ; Leav|
000033e0  65 20 74 68 65 73 65 20  32 20 75 6e 63 68 61 6e  |e these 2 unchan|
000033f0  67 65 64 0d 0f 28 0f 4d  4f 56 20 20 20 52 34 2c  |ged..(.MOV   R4,|
00003400  23 30 0d 0f 32 1b 53 57  49 20 20 20 22 53 6f 75  |#0..2.SWI   "Sou|
00003410  6e 64 5f 43 6f 6e 66 69  67 75 72 65 22 0d 0f 3c  |nd_Configure"..<|
00003420  04 0d 0f 46 44 4d 4f 56  20 20 20 52 30 2c 23 31  |...FDMOV   R0,#1|
00003430  20 20 20 20 20 20 20 20  20 20 3b 20 53 6f 75 6e  |          ; Soun|
00003440  64 20 61 6c 6c 20 34 20  76 6f 69 63 65 73 2c 20  |d all 4 voices, |
00003450  70 61 72 61 6d 65 74 65  72 73 20 61 72 65 20 72  |parameters are r|
00003460  65 61 6c 6c 79 0d 0f 50  25 4d 56 4e 20 20 20 52  |eally..P%MVN   R|
00003470  31 2c 23 31 34 20 20 20  20 20 20 20 20 20 3b 20  |1,#14         ; |
00003480  69 6d 6d 61 74 65 72 69  61 6c 0d 0f 5a 11 4d 4f  |immaterial..Z.MO|
00003490  56 20 20 20 52 32 2c 23  31 30 30 0d 0f 64 11 4d  |V   R2,#100..d.M|
000034a0  4f 56 20 20 20 52 33 2c  23 32 35 35 0d 0f 6e 19  |OV   R3,#255..n.|
000034b0  53 57 49 20 20 20 22 53  6f 75 6e 64 5f 43 6f 6e  |SWI   "Sound_Con|
000034c0  74 72 6f 6c 22 0d 0f 78  0f 4d 4f 56 20 20 20 52  |trol"..x.MOV   R|
000034d0  30 2c 23 32 0d 0f 82 19  53 57 49 20 20 20 22 53  |0,#2....SWI   "S|
000034e0  6f 75 6e 64 5f 43 6f 6e  74 72 6f 6c 22 0d 0f 8c  |ound_Control"...|
000034f0  0f 4d 4f 56 20 20 20 52  30 2c 23 33 0d 0f 96 19  |.MOV   R0,#3....|
00003500  53 57 49 20 20 20 22 53  6f 75 6e 64 5f 43 6f 6e  |SWI   "Sound_Con|
00003510  74 72 6f 6c 22 0d 0f a0  0f 4d 4f 56 20 20 20 52  |trol"....MOV   R|
00003520  30 2c 23 34 0d 0f aa 19  53 57 49 20 20 20 22 53  |0,#4....SWI   "S|
00003530  6f 75 6e 64 5f 43 6f 6e  74 72 6f 6c 22 0d 0f b4  |ound_Control"...|
00003540  25 4c 44 4d 46 44 20 52  31 33 21 2c 7b 52 30 2d  |%LDMFD R13!,{R0-|
00003550  52 31 30 2c 50 43 7d 20  3b 20 26 20 52 65 74 75  |R10,PC} ; & Retu|
00003560  72 6e 0d 0f be 04 0d 0f  c8 30 20 20 20 20 20 20  |rn.......0      |
00003570  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00003580  20 56 6f 69 63 65 20 70  61 72 61 6d 65 74 65 72  | Voice parameter|
00003590  20 62 6c 6f 63 6b 0d 0f  d2 7c 2e 56 6f 69 63 65  | block...|.Voice|
000035a0  42 61 73 65 20 42 20 46  69 6c 6c 3a 42 20 46 69  |Base B Fill:B Fi|
000035b0  6c 6c 3a 42 20 46 69 6c  6c 3a 4c 44 4d 46 44 20  |ll:B Fill:LDMFD |
000035c0  52 31 33 21 2c 7b 50 43  7d 3a 4c 44 4d 46 44 20  |R13!,{PC}:LDMFD |
*
000035f0  52 31 33 21 2c 7b 50 43  7d 3a 45 51 55 44 20 56  |R13!,{PC}:EQUD V|
00003600  6f 69 63 65 4e 61 6d 65  2d 56 6f 69 63 65 42 61  |oiceName-VoiceBa|
00003610  73 65 0d 0f dc 2c 2e 56  6f 69 63 65 4e 61 6d 65  |se...,.VoiceName|
00003620  20 45 51 55 53 22 54 72  61 63 6b 65 72 56 6f 78  | EQUS"TrackerVox|
00003630  22 3a 45 51 55 42 20 30  3a 41 4c 49 47 4e 0d 0f  |":EQUB 0:ALIGN..|
00003640  e6 04 0d 0f f0 26 2e 6b  69 6c 6c 73 6f 75 6e 64  |.....&.killsound|
00003650  20 20 20 20 20 20 20 20  20 20 20 3b 20 4b 69 6c  |           ; Kil|
00003660  6c 20 76 6f 69 63 65 73  0d 0f fa 1b 53 54 4d 46  |l voices....STMF|
00003670  44 20 52 31 33 21 2c 7b  52 30 2d 52 31 30 2c 52  |D R13!,{R0-R10,R|
00003680  31 34 7d 0d 10 04 30 4d  4f 56 20 52 30 2c 23 30  |14}...0MOV R0,#0|
00003690  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 44 65  |            ; De|
000036a0  2d 69 6e 73 74 61 6c 6c  20 54 72 61 63 6b 65 72  |-install Tracker|
000036b0  56 6f 78 0d 10 0e 11 4c  44 52 20 52 31 2c 6f 6c  |Vox....LDR R1,ol|
000036c0  64 76 6f 78 0d 10 18 1b  53 57 49 20 22 53 6f 75  |dvox....SWI "Sou|
000036d0  6e 64 5f 52 65 6d 6f 76  65 56 6f 69 63 65 22 0d  |nd_RemoveVoice".|
000036e0  10 22 04 0d 10 2c 2c 4d  4f 56 20 52 31 30 2c 23  |."...,,MOV R10,#|
000036f0  31 20 20 20 20 20 20 20  20 20 20 20 3b 20 4b 69  |1           ; Ki|
00003700  6c 6c 20 74 68 65 20 34  20 76 6f 69 63 65 73 0d  |ll the 4 voices.|
00003710  10 36 08 2e 6b 73 6c 0d  10 40 0e 4d 4f 56 20 52  |.6..ksl..@.MOV R|
00003720  30 2c 52 31 30 0d 10 4a  0d 4d 4f 56 20 52 31 2c  |0,R10..J.MOV R1,|
00003730  23 30 0d 10 54 1b 53 57  49 20 22 53 6f 75 6e 64  |#0..T.SWI "Sound|
00003740  5f 41 74 74 61 63 68 56  6f 69 63 65 22 0d 10 5e  |_AttachVoice"..^|
00003750  12 41 44 44 20 52 31 30  2c 52 31 30 2c 23 31 0d  |.ADD R10,R10,#1.|
00003760  10 68 0e 43 4d 50 20 52  31 30 2c 23 35 0d 10 72  |.h.CMP R10,#5..r|
00003770  0b 42 4e 45 20 6b 73 6c  0d 10 7c 23 4c 44 4d 46  |.BNE ksl..|#LDMF|
00003780  44 20 52 31 33 21 2c 7b  52 30 2d 52 31 30 2c 50  |D R13!,{R0-R10,P|
00003790  43 7d 20 3b 20 52 65 74  75 72 6e 0d 10 86 04 0d  |C} ; Return.....|
000037a0  10 90 11 2e 69 6e 76 65  72 73 65 74 61 62 6c 65  |....inversetable|
000037b0  0d 10 9a 27 3b 45 51 55  44 20 31 3a 20 20 20 20  |...';EQUD 1:    |
000037c0  20 20 20 20 20 20 20 20  20 3b 20 44 75 6d 6d 79  |         ; Dummy|
000037d0  20 76 61 6c 75 65 21 0d  10 a4 15 5d 3a 50 25 2b  | value!....]:P%+|
000037e0  3d 34 30 39 36 3a 5b 4f  50 54 20 43 0d 10 ae 34  |=4096:[OPT C...4|
000037f0  2e 74 72 61 63 6b 61 64  72 20 20 20 20 20 20 20  |.trackadr       |
00003800  20 20 20 20 20 3b 20 47  65 74 20 61 64 64 72 65  |     ; Get addre|
00003810  73 73 20 6f 66 20 74 72  61 63 6b 20 62 61 73 65  |ss of track base|
00003820  0d 10 b8 11 41 44 52 20  52 31 30 2c 74 72 61 63  |....ADR R10,trac|
00003830  6b 0d 10 c2 0e 4d 4f 56  20 50 43 2c 52 31 34 0d  |k....MOV PC,R14.|
00003840  10 cc 25 2e 74 72 61 63  6b 20 20 20 20 20 20 20  |..%.track       |
00003850  20 20 20 20 20 20 20 20  3b 20 54 72 61 63 6b 20  |        ; Track |
00003860  62 61 73 65 0d 10 d6 28  5d 3a 50 25 2b 3d 74 6c  |base...(]:P%+=tl|
00003870  65 6e 25 3a 5b 4f 50 54  20 43 20 20 20 3b 20 49  |en%:[OPT C   ; I|
00003880  73 20 74 6c 65 6e 25 20  6c 6f 6e 67 0d 10 e0 04  |s tlen% long....|
00003890  0d 10 ea 09 41 4c 49 47  4e 0d 10 f4 0c 2e 63 6f  |....ALIGN.....co|
000038a0  6e 76 65 72 74 0d 10 fe  16 53 54 4d 46 44 20 52  |nvert....STMFD R|
000038b0  31 33 21 2c 7b 52 30 2d  52 34 7d 0d 11 08 1b 41  |13!,{R0-R4}....A|
000038c0  44 52 20 52 32 2c 6c 74  61 62 6c 65 3a 4d 4f 56  |DR R2,ltable:MOV|
000038d0  20 52 33 2c 23 30 0d 11  12 09 2e 6c 6f 6f 70 0d  | R3,#0.....loop.|
000038e0  11 1c 40 4c 44 52 42 20  52 34 2c 5b 52 30 2c 52  |..@LDRB R4,[R0,R|
000038f0  33 5d 3a 82 20 52 34 2c  52 34 2c 23 31 32 38 3a  |3]:. R4,R4,#128:|
00003900  4c 44 52 42 20 52 34 2c  5b 52 32 2c 52 34 5d 3a  |LDRB R4,[R2,R4]:|
00003910  53 54 52 42 20 52 34 2c  5b 52 30 2c 52 33 5d 0d  |STRB R4,[R0,R3].|
00003920  11 26 23 41 44 44 20 52  33 2c 52 33 2c 23 31 3a  |.&#ADD R3,R3,#1:|
00003930  43 4d 50 20 52 33 2c 52  31 3a 42 4c 45 20 6c 6f  |CMP R3,R1:BLE lo|
00003940  6f 70 0d 11 30 16 4c 44  4d 46 44 20 52 31 33 21  |op..0.LDMFD R13!|
00003950  2c 7b 52 30 2d 52 34 7d  0d 11 3a 0e 4d 4f 56 20  |,{R0-R4}..:.MOV |
00003960  50 43 2c 52 31 34 0d 11  44 0b 2e 6c 74 61 62 6c  |PC,R14..D..ltabl|
00003970  65 0d 11 4e 30 5d 3a 50  25 2b 3d 32 35 36 3a 5b  |e..N0]:P%+=256:[|
00003980  4f 50 54 20 43 20 20 20  20 20 3b 20 32 35 36 20  |OPT C     ; 256 |
00003990  62 79 74 65 20 6c 6f 6f  6b 75 70 20 74 61 62 6c  |byte lookup tabl|
000039a0  65 0d 11 58 04 0d 11 62  2e 2e 65 6e 64 63 6f 64  |e..X...b..endcod|
000039b0  65 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |e             ; |
000039c0  54 68 65 20 65 6e 64 63  6f 64 65 20 70 6f 69 6e  |The endcode poin|
000039d0  74 65 72 0d 11 6c 05 5d  0d 11 76 05 ed 0d 11 80  |ter..l.]..v.....|
000039e0  04 0d 11 8a 2a f1 22 42  75 69 6c 64 69 6e 67 20  |....*."Building |
000039f0  73 61 6d 70 6c 65 20 63  6f 6e 76 65 72 73 69 6f  |sample conversio|
00003a00  6e 20 74 61 62 6c 65 2e  2e 2e 22 0d 11 94 23 f4  |n table..."...#.|
00003a10  20 53 65 74 75 70 20 73  61 6d 70 6c 65 20 63 6f  | Setup sample co|
00003a20  6e 76 65 72 73 69 6f 6e  20 74 61 62 6c 65 0d 11  |nversion table..|
00003a30  9e 10 e3 20 41 25 3d 30  20 b8 20 32 35 35 0d 11  |... A%=0 . 255..|
00003a40  a8 3c 20 20 42 25 3d 41  25 2d 31 32 38 3a 42 25  |.<  B%=A%-128:B%|
00003a50  3d 42 25 3c 3c 32 34 3a  c8 99 20 22 53 6f 75 6e  |=B%<<24:.. "Soun|
00003a60  64 5f 53 6f 75 6e 64 4c  6f 67 22 2c 42 25 20 b8  |d_SoundLog",B% .|
00003a70  20 6c 74 61 62 6c 65 3f  41 25 0d 11 b2 05 ed 0d  | ltable?A%......|
00003a80  11 bc 04 0d 11 c6 1f f1  22 42 75 69 6c 64 69 6e  |........"Buildin|
00003a90  67 20 76 6f 6c 75 6d 65  20 74 61 62 6c 65 2e 2e  |g volume table..|
00003aa0  2e 22 0d 11 d0 18 f4 20  53 65 74 75 70 20 76 6f  |."..... Setup vo|
00003ab0  6c 75 6d 65 20 74 61 62  6c 65 0d 11 da 0f e3 20  |lume table..... |
00003ac0  41 25 3d 30 20 b8 20 36  33 0d 11 e4 21 20 20 76  |A%=0 . 63...!  v|
00003ad0  6f 6c 74 61 62 3f 41 25  3d 32 35 35 2d 28 28 41  |oltab?A%=255-((A|
00003ae0  25 2f 33 2b 34 32 29 2a  34 29 0d 11 ee 05 ed 0d  |%/3+42)*4)......|
00003af0  11 f8 04 0d 12 02 1e f1  22 42 75 69 6c 64 69 6e  |........"Buildin|
00003b00  67 20 70 69 74 63 68 20  74 61 62 6c 65 2e 2e 2e  |g pitch table...|
00003b10  22 0d 12 0c 1f f4 20 53  65 74 75 70 20 69 6e 76  |"..... Setup inv|
00003b20  65 72 73 65 20 70 69 74  63 68 20 74 61 62 6c 65  |erse pitch table|
00003b30  0d 12 16 11 e3 20 41 25  3d 31 20 b8 20 31 30 32  |..... A%=1 . 102|
00003b40  33 0d 12 20 3d 20 20 61  3d 33 35 37 35 38 37 32  |3.. =  a=3575872|
00003b50  2f 41 25 3a 69 6e 76 65  72 73 65 74 61 62 6c 65  |/A%:inversetable|
00003b60  21 28 41 25 2a 34 29 3d  28 61 2f 28 31 30 30 30  |!(A%*4)=(a/(1000|
00003b70  30 30 30 2f 75 73 29 29  2a 36 30 30 30 30 0d 12  |000/us))*60000..|
00003b80  2a 05 ed 0d 12 34 04 0d  12 3e 05 db 0d 12 48 22  |*....4...>....H"|
00003b90  f1 22 43 6f 64 65 20 6c  65 6e 67 74 68 20 3d 20  |."Code length = |
00003ba0  22 3b 65 6e 64 63 6f 64  65 2d 63 6f 64 65 0d 12  |";endcode-code..|
00003bb0  52 04 0d 12 5c 1b f4 20  53 6f 75 6e 64 74 72 61  |R...\.. Soundtra|
00003bc0  63 6b 65 72 20 64 61 74  61 66 69 6c 65 0d 12 66  |cker datafile..f|
00003bd0  1a f1 22 4c 6f 61 64 69  6e 67 20 6d 6f 64 75 6c  |.."Loading modul|
00003be0  65 2e 2e 2e 28 22 3b 0d  12 70 20 ff 28 22 4c 4f  |e...(";..p .("LO|
00003bf0  41 44 20 22 2b 73 6f 6e  67 24 2b 22 20 22 2b c3  |AD "+song$+" "+.|
00003c00  7e 74 72 61 63 6b 29 0d  12 7a 12 74 72 61 63 6b  |~track)..z.track|
00003c10  24 3d 22 22 3a 42 25 3d  30 0d 12 84 05 f5 0d 12  |$="":B%=0.......|
00003c20  8e 31 20 20 e7 20 28 74  72 61 63 6b 3f 42 25 29  |.1  . (track?B%)|
00003c30  3c 3e 30 20 8c 20 74 72  61 63 6b 24 2b 3d bd 28  |<>0 . track$+=.(|
00003c40  74 72 61 63 6b 3f 42 25  29 3a 42 25 2b 3d 31 0d  |track?B%):B%+=1.|
00003c50  12 98 11 fd 28 74 72 61  63 6b 3f 42 25 29 3d 30  |....(track?B%)=0|
00003c60  0d 12 a2 10 f1 3b 74 72  61 63 6b 24 3b 22 29 22  |.....;track$;")"|
00003c70  0d 12 ac 04 0d 12 b6 3a  f4 20 46 69 6e 64 20 6c  |.......:. Find l|
00003c80  65 6e 67 74 68 20 6f 66  20 74 75 6e 65 20 64 61  |ength of tune da|
00003c90  74 61 20 62 79 20 6c 6f  6f 6b 69 6e 67 20 74 68  |ta by looking th|
00003ca0  72 6f 75 67 68 20 70 61  74 74 65 72 6e 73 0d 12  |rough patterns..|
00003cb0  c0 0b 68 69 67 68 25 3d  30 0d 12 ca 10 e3 20 41  |..high%=0..... A|
00003cc0  25 3d 30 20 b8 20 31 32  37 0d 12 d4 35 20 20 e7  |%=0 . 127...5  .|
00003cd0  20 74 72 61 63 6b 3f 28  26 33 42 38 2b 41 25 29  | track?(&3B8+A%)|
00003ce0  3e 68 69 67 68 25 20 8c  20 68 69 67 68 25 3d 74  |>high% . high%=t|
00003cf0  72 61 63 6b 3f 28 26 33  42 38 2b 41 25 29 0d 12  |rack?(&3B8+A%)..|
00003d00  de 05 ed 0d 12 e8 0c 68  69 67 68 25 2b 3d 31 0d  |.......high%+=1.|
00003d10  12 f2 04 0d 12 fc 15 f4  20 43 6f 6e 76 65 72 74  |........ Convert|
00003d20  20 73 61 6d 70 6c 65 73  0d 13 06 1e 41 25 3d 74  | samples....A%=t|
00003d30  72 61 63 6b 2b 26 34 33  43 2b 28 68 69 67 68 25  |rack+&43C+(high%|
00003d40  2a 31 30 32 34 29 0d 13  10 15 42 25 3d 74 72 61  |*1024)....B%=tra|
00003d50  63 6b 2b 74 6c 65 6e 25  2d 41 25 0d 13 1a 26 f1  |ck+tlen%-A%...&.|
00003d60  22 43 6f 6e 76 65 72 74  69 6e 67 20 22 3b 7e 28  |"Converting ";~(|
00003d70  41 25 2d 74 72 61 63 6b  29 3b 22 2b 22 3b 7e 42  |A%-track);"+";~B|
00003d80  25 0d 13 24 0d d6 20 63  6f 6e 76 65 72 74 0d 13  |%..$.. convert..|
00003d90  2e 04 0d 13 38 15 73 61  6d 70 6c 65 69 3d 74 72  |....8.samplei=tr|
00003da0  61 63 6b 2b 26 31 34 0d  13 42 1b 73 70 6f 69 6e  |ack+&14..B.spoin|
00003db0  74 3d 41 25 3a 73 61 6d  70 6c 65 73 3d 74 72 61  |t=A%:samples=tra|
00003dc0  63 6b 0d 13 4c 04 0d 13  56 2e f1 27 22 4e 72 20  |ck..L...V..'"Nr |
00003dd0  4e 61 6d 65 20 20 20 20  20 20 20 20 20 20 20 20  |Name            |
00003de0  20 20 20 20 20 4c 65 6e  67 74 68 20 20 56 6f 6c  |     Length  Vol|
00003df0  75 6d 65 22 0d 13 60 2d  f1 22 2d 2d 20 2d 2d 2d  |ume"..`-."-- ---|
00003e00  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00003e10  2d 20 2d 2d 2d 2d 2d 2d  2d 20 2d 2d 2d 2d 2d 2d  |- ------- ------|
00003e20  22 0d 13 6a 0f e3 20 41  25 3d 30 20 b8 20 33 30  |"..j.. A%=0 . 30|
00003e30  0d 13 74 1e 20 20 73 61  6d 70 6c 65 6f 3d 73 61  |..t.  sampleo=sa|
00003e40  6d 70 6c 65 69 2b 28 41  25 2a 26 31 45 29 0d 13  |mplei+(A%*&1E)..|
00003e50  7e 13 20 20 6e 61 6d 65  24 3d 22 22 3a 42 25 3d  |~.  name$="":B%=|
00003e60  30 0d 13 88 07 20 20 f5  0d 13 92 34 20 20 20 20  |0....  ....4    |
00003e70  e7 20 28 73 61 6d 70 6c  65 6f 3f 42 25 29 3c 3e  |. (sampleo?B%)<>|
00003e80  30 20 6e 61 6d 65 24 2b  3d bd 28 73 61 6d 70 6c  |0 name$+=.(sampl|
00003e90  65 6f 3f 42 25 29 3a 42  25 2b 3d 31 0d 13 9c 1d  |eo?B%):B%+=1....|
00003ea0  20 20 fd 28 73 61 6d 70  6c 65 6f 3f 42 25 29 3d  |  .(sampleo?B%)=|
00003eb0  30 20 84 20 42 25 3d 32  30 0d 13 a6 13 20 20 e7  |0 . B%=20....  .|
00003ec0  20 6e 61 6d 65 24 3c 3e  22 22 20 8c 0d 13 b0 2e  | name$<>"" .....|
00003ed0  20 20 20 20 6c 65 6e 25  3d 32 2a 28 28 73 61 6d  |    len%=2*((sam|
00003ee0  70 6c 65 6f 3f 32 32 29  2a 32 35 36 2b 28 73 61  |pleo?22)*256+(sa|
00003ef0  6d 70 6c 65 6f 3f 32 33  29 29 0d 13 ba 2a 20 20  |mpleo?23))...*  |
00003f00  20 20 76 6f 6c 25 3d 28  73 61 6d 70 6c 65 6f 3f  |  vol%=(sampleo?|
00003f10  32 34 29 2a 32 35 36 2b  28 73 61 6d 70 6c 65 6f  |24)*256+(sampleo|
00003f20  3f 32 35 29 0d 13 c4 32  20 20 20 20 f1 8a 30 29  |?25)...2    ..0)|
00003f30  3b 7e 28 41 25 2b 31 29  3b 8a 33 29 3b 6e 61 6d  |;~(A%+1);.3);nam|
00003f40  65 24 3b 8a 32 34 29 3b  6c 65 6e 25 3b 8a 33 32  |e$;.24);len%;.32|
00003f50  29 3b 76 6f 6c 25 0d 13  ce 27 20 20 20 20 73 61  |);vol%...'    sa|
00003f60  6d 70 6c 65 6c 6f 63 21  28 41 25 2a 34 29 3d 73  |mpleloc!(A%*4)=s|
00003f70  70 6f 69 6e 74 2d 73 61  6d 70 6c 65 73 0d 13 d8  |point-samples...|
00003f80  14 20 20 20 20 73 70 6f  69 6e 74 2b 3d 6c 65 6e  |.    spoint+=len|
00003f90  25 0d 13 e2 07 20 20 cd  0d 13 ec 05 ed 0d 13 f6  |%....  .........|
00003fa0  26 f1 22 20 20 20 20 20  20 20 20 20 20 20 20 20  |&."             |
00003fb0  20 20 20 20 20 20 20 20  20 20 20 2d 2d 2d 2d 2d  |           -----|
00003fc0  2d 2d 22 0d 14 00 42 f1  22 20 20 20 20 20 20 20  |--"...B."       |
00003fd0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003fe0  20 22 3b 28 73 70 6f 69  6e 74 2d 73 61 6d 70 6c  | ";(spoint-sampl|
00003ff0  65 73 2d 26 32 35 38 2d  28 68 69 67 68 25 2a 31  |es-&258-(high%*1|
00004000  30 32 34 29 29 0d 14 0a  04 0d 14 14 1a f4 20 53  |024))......... S|
00004010  74 6f 72 65 20 6c 65 6e  67 74 68 20 6f 66 20 74  |tore length of t|
00004020  75 6e 65 0d 14 1e 17 69  6e 66 6f 21 34 3d 74 72  |une....info!4=tr|
00004030  61 63 6b 3f 26 33 42 36  2d 31 0d 14 28 04 0d 14  |ack?&3B6-1..(...|
00004040  32 1e f1 22 54 75 6e 65  20 6c 65 6e 67 74 68 20  |2.."Tune length |
00004050  3d 20 22 3b 69 6e 66 6f  21 34 2b 31 0d 14 3c 04  |= ";info!4+1..<.|
00004060  0d 14 46 16 ee 20 85 20  d6 6b 69 6c 6c 73 6f 75  |..F.. . .killsou|
00004070  6e 64 3a f6 3a e0 0d 14  50 1b f4 20 47 65 74 20  |nd:.:...P.. Get |
00004080  74 68 69 6e 67 73 20 69  6e 20 6d 6f 74 69 6f 6e  |things in motion|
00004090  21 0d 14 5a 12 d6 20 69  6e 73 74 61 6c 6c 73 6f  |!..Z.. installso|
000040a0  75 6e 64 0d 14 64 0a c8  a2 20 30 2c 30 0d 14 6e  |und..d... 0,0..n|
000040b0  0a c8 a2 20 31 2c 30 0d  14 78 0a c8 a2 20 32 2c  |... 1,0..x... 2,|
000040c0  30 0d 14 82 0a c8 a2 20  33 2c 30 0d 14 8c 20 f1  |0...... 3,0... .|
000040d0  22 3c 53 70 61 63 65 3e  20 74 6f 20 72 65 73 65  |"<Space> to rese|
000040e0  6c 65 63 74 20 74 75 6e  65 22 27 0d 14 96 39 f1  |lect tune"'...9.|
000040f0  8a 30 2c 32 35 29 3b 22  50 6f 73 69 74 69 6f 6e  |.0,25);"Position|
00004100  3a 30 30 22 3b 69 6e 66  6f 21 38 3b 8a 33 30 2c  |:00";info!8;.30,|
00004110  32 35 29 3b 22 50 61 74  74 65 72 6e 3a 22 3b 21  |25);"Pattern:";!|
00004120  69 6e 66 6f 0d 14 a0 0e  e3 20 41 25 3d 30 20 b8  |info..... A%=0 .|
00004130  20 33 0d 14 aa 6b 20 20  f1 8a 30 2c 32 37 2b 41  | 3...k  ..0,27+A|
00004140  25 29 3b 22 56 6f 69 63  65 3a 22 3b 41 25 3b 22  |%);"Voice:";A%;"|
00004150  20 20 4c 61 73 74 20 69  6e 73 74 72 75 6d 65 6e  |  Last instrumen|
00004160  74 3a 22 3b 7e 63 75 72  72 65 6e 74 3f 41 25 3b  |t:";~current?A%;|
00004170  22 20 20 50 69 74 63 68  3a 30 30 30 30 22 3b 7e  |"  Pitch:0000";~|
00004180  6f 75 72 69 6e 66 21 28  33 32 2a 41 25 2b 34 29  |ourinf!(32*A%+4)|
00004190  3b 22 20 20 45 66 66 65  63 74 3a 30 22 0d 14 b4  |;"  Effect:0"...|
000041a0  05 ed 0d 14 be 05 87 0d  14 c8 05 f5 0d 14 d2 0f  |................|
000041b0  20 20 c8 96 3a d6 20 69  6e 74 72 0d 14 dc 2d 20  |  ..:. intr...- |
000041c0  20 f1 8a 39 2c 32 35 29  3b 69 6e 66 6f 21 38 3b  | ..9,25);info!8;|
000041d0  22 20 20 20 22 3b 8a 33  38 2c 32 35 29 3b 21 69  |"   ";.38,25);!i|
000041e0  6e 66 6f 3b 22 20 20 22  0d 14 e6 10 20 20 e3 20  |nfo;"  "....  . |
000041f0  41 25 3d 30 20 b8 20 33  0d 14 f0 69 20 20 20 20  |A%=0 . 3...i    |
00004200  f1 8a 32 35 2c 32 37 2b  41 25 29 3b 7e 63 75 72  |..25,27+A%);~cur|
00004210  72 65 6e 74 3f 41 25 3b  8a 33 34 2c 32 37 2b 41  |rent?A%;.34,27+A|
00004220  25 29 3b 7e 6f 75 72 69  6e 66 21 28 33 32 2a 41  |%);~ourinf!(32*A|
00004230  25 2b 34 29 3b 22 20 20  20 22 3b 8a 34 38 2c 32  |%+4);"   ";.48,2|
00004240  37 2b 41 25 29 3b 28 65  66 66 65 63 74 74 79 70  |7+A%);(effecttyp|
00004250  65 21 28 41 25 2a 34 29  29 3e 3e 38 3b 22 20 20  |e!(A%*4))>>8;"  |
00004260  22 0d 14 fa 07 20 20 ed  0d 15 04 0c fd a6 28 30  |"....  .......(0|
00004270  29 3d 33 32 0d 15 0e 05  ee 0d 15 18 0f d6 20 6b  |)=32.......... k|
00004280  69 6c 6c 73 6f 75 6e 64  0d 15 22 05 f1 0d 15 2c  |illsound.."....,|
00004290  05 f9 0d ff                                       |....|
00004294