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

!AWMay91/Goodies/SoundTrack/!STracker/PlayModA

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/PlayModA
Read OK:
File size: 3EEF bytes
Load address: 0000
Exec address: 0000
Duplicates

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

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

� >PlayModA
�
K� .-------------------------------------------------------------------.
(K� |                                                                   |
2K� | System Interrupt SoundTrackermodule playroutine      Version 2.04 |
<K� |                                                                   |
FK� | (c)1989/1990 Hugo Fiennes (0749)  72234 evenings      28-Mar-1990 |
PK� |                   (0749) 679794 data (300-2400 baud, 1 line)      |
ZK� |                   (0749) 670030 data (300-HST/V32, 2 lines)       |
dK� `-------------------------------------------------------------------'
n�
xF� 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!
��
G� This version will play almost any 'ripped' module or module saved
!� MasterSoundTracker v1 - v2.
�
"� 0
,:
6"� Reserve space for the module
@� code 500000
J
T*.
^�'"ModuleName:"song$
h
r*� 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
�M;------------------------------------------------------------------------
�K; Soundtracker playroutine           v2.2 With portamento,speed change,
�J;                                         volume control,pattern break
�M;------------------------------------------------------------------------

	.Fill
ADR   R8,ourinf
&ADD   R8,R8,R7,LSL#5
0LDMIA R8,{R1-R6}
:
.FillLoop
D]
N� sle%=1 � 10
X
[OPT C
b-LDRB  R0,[R5,R1,LSR#16] ; Get sample byte
l*SUBS  R0,R0,R6          ; Scale volume
vMOVMI 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
�1CMP   R12,R10           ; End of buffer fill?
�2BLT   FillLoop          ; Nope, fill some more
�GADR   R0,newdata        ; So we don't lost notes/voices by new note
:                        ; interrupting buffer filling.
LDRB  R4,[R0,R7]
CMP   R4,#0
 -STMEQIA R8,{R1-R2}      ; Save regs again
*MOVNE R4,#0
4STRNEB R4,[R0,R7]
>
H*MOV   R0,#%00001000     ; voice active
R4LDMFD R13!,{PC}         ; ..and return to Level1
\
f.ourinf
p;EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0:EQUD 0
z;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
�
�.newdata
�
EQUD 0
�
�.channelnote
�EQUD 0:EQUD 0:EQUD 0:EQUD 0
�
�.effecttype
�EQUD 0:EQUD 0:EQUD 0:EQUD 0
�
�	.info
#EQUD  0              ; Position
)EQUD  0              ; Pattern length
(EQUD  0              ; Sequence posn
$
..seqbase
8(EQUD  &1D8           ; Sequence base
B
L.trkbase
V/EQUD  &258           ; Pattern base address
`
j.current
t.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
�)BL    doeffect       ; Do any effects
�,LDR   R2,speed       ; Current playspeed
�*ADD   R1,R1,#1       ; Increment count
)CMP   R1,R2          ; Ready to play?

�Q R1,#0          ; Yes
(STR   R1,counti      ; Restore count
>BLEQ  playnote       ; If so, zero counter and play a note
(LDMFD R13!,{R0-R12,PC}
2
<
.playnote
FSTMFD R13!,{R14}
P-ADR   R0,info        ; Load sequence info
ZLDMIA R0,{R7-R9}
d
.andagain
nSTMFD R13!,{R9}
xBL    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
�
�(MOV   R5,#3          ; Do 4 channels
�.dochannel
�ADD   R11,R12,R5,LSL#2
0LDRB  R6,[R11,#2]    ; Get instrument number
"MOVS  R6,R6,LSR#4    ; Shuffle
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?
6*BEQ   nextchannel    ; Do next channel
@<SUB   R6,R6,#1       ; Correct R6 for calculations below
J$MOV   R0,R11         ; Get pitch
T)BL    gethilo        ; (bloody 68000)
^,MOVS  R4,R0          ; R4=standard pitch
hEBEQ   nextchannel    ; But is it zero? If so, don't play anything
rCADR   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]
�$STR   R4,[R2,#4]     ; Set pitch
�9ADR   R3,sampleloc   ; Address of sample lookup table
�4LDR   R3,[R3,R6,LSL#2] ; R3=Actual sample offset
�3ADD   R3,R3,R10      ; R3=Actual sample address
�1STR   R3,[R2,#16]    ; Set instrument address
�FADR   R0,newdata     ; So we don't lost notes if we play on VSYNC!
�MOV   R1,#1
STRB  R1,[R0,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
0,ADD   R0,R3,#&1C     ; Get repeat length
:BL    gethilo
D&CMP   R0,#1          ; No repeats?
N1BEQ   norep          ; Branch to the next bit
X/MOV   R1,R0,LSL#1    ; x2 for repeat length
b2ADD   R0,R3,#&1A     ; Get repeat start offset
lBL    gethilo
v<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
�ADD   R0,R3,#&16
�7BL    gethilo        ; Get the length of the sample
�'MOV   R0,R0,LSL#1    ; x2 of course
�%STR   R0,[R2,#12]    ; and set it
�ADD   R0,R3,#&1A
�0BL    gethilo        ; Get start repeat posn
#STR   R0,[R2,#8]     ; Store it
6.next                ; Before we go, do the volume
ADD   R0,R3,#&18
 %BL    gethilo        ; Get volume
* CMP   R0,#64         ; Over?
4"MOVGE R0,#63         ; Correct
>'ADR   R1,voltab      ; Volume table
H)LDRB  R0,[R1,R0]     ; Get new volume
R#STR   R0,[R2,#20]    ; Store it
\.nextchannel
f5ADR   R3,effecttype  ; Cancel any current effects
pMOV   R4,#0          ;
zSTR   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
�)MOVNE R0,#0          ; Reset the flag
�STRNE R0,jumpflag    ;
�4ADD   R9,R9,#1       ; Increment sequence number
�-CMP   R9,#64         ; Finished sequence?
�CBNE   vend           ; If not, don't go onto next pattern entry
�MOV   R9,#0
	1ADD   R7,R7,#1       ; Increment pattern posn
	'CMP   R7,R8          ; End of song?
	/MOVGT R7,#0          ; ...and again, folks!
	$	.vend
	.ADR   R0,info
	8+STMIA R0,{R7-R9}     ; Store new values
	B%LDMFD R13!,{PC}      ; And return
	L
	V1.gethilo             ; Gets Hi-Lo stored info
	`-STMFD R13!,{R1}      ; R0=address of info
	j(LDRB  R1,[R0,#0]     ; Get high byte
	t&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
	��   R4,R4,#&F      ;
	�)CMP   R4,#&C         ; Volume change?
	�BNE   eff            ; No
	� CMP   R6,#64         ; Over?
	�"MOVGE R6,#63         ; Correct
	�ADR   R1,voltab      ;
*LDRB  R0,[R1,R6]     ; Get right units

-ADR   R1,ourinf      ; Find table address
ADD   R1,R1,R5,LSL#5 ;
+STR   R0,[R1,#20]    ; Store new volume
(MOV   PC,R14
2.eff
<)CMP   R4,#&D         ; Pattern break?
F1STREQ R4,jumpflag    ; Jump to end of pattern
P�Q PC,R14         ;
Z(CMP   R4,#&F         ; Change speed?
dBNE   eff1           ; No
n'�   R6,R6,#&F      ; Mask new speed
x#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
�"ADR   R3,effecttype  ; Save it
�STR   R6,[R3,R5,LSL#2] ;
�!MOV   PC,R14         ; Return
�	.eff2
�!MOV   PC,R14         ; Return
�
L.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
6.doeff1
@GADR   R8,ourinf      ; Calculate address offset of voice-info table
JADD   R8,R8,R5,LSL#5 ;
T.LDR   R0,[R3,R5,LSL#2] ; Any effect to do?
^CMP   R0,#0          ;
hBEQ   doeffnext      ; Nope
r'�   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
�$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
�
�	.doe1
�+CMP   R6,#&200       ; Portamento down?
BNE   doe2           ; No
-LDR   R6,[R2,R5,LSL#2] ; Get current tone
%SUB   R0,R0,#1       ; Slide down
&ADD   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	.doe2
b.doeffnext
l'SUBS  R5,R5,#1       ; Next channel
vBPL   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
�
�2.sampleloc           ; Table of sample offsets
�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



/.voltab              ; 64-byte volume table

]:P%+=64:[OPT C

 

*).installsound        ; Install voices

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

>2ADR   R0,VoiceBase   ; Make TrackerVox a voice

HMOV   R1,#0

RSWI   "Sound_InstallVoice"

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

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

p.mutelp

zMOV   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

�MOV   R0,R10

�ADR   R1,VoiceName

�"SWI   "Sound_AttachNamedVoice"

�ADD   R10,R10,#1

�CMP   R10,#5

�BNE   attlp

:MOV   R0,#1          ; Slight right bias for channel 1
MOV   R1,#16
$SWI   "Sound_Stereo"
.9MOV   R0,#2          ; Slight left bias for channel 2
8MVN   R1,#15
BSWI   "Sound_Stereo"
L>MOV   R0,#3          ; and for channel 3 (Amiga goes RLLR)
VMVN   R1,#15
`SWI   "Sound_Stereo"
j8MOV   R0,#4          ; And right cgain for channel 4
tMOV   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
�SWI   "Sound_Configure"
�
�DMOV   R0,#1          ; Sound all 4 voices, parameters are really
�%MVN   R1,#14         ; immaterial
�MOV   R2,#100
�MOV   R3,#255
SWI   "Sound_Control"

MOV   R0,#2
SWI   "Sound_Control"
MOV   R0,#3
(SWI   "Sound_Control"
2MOV   R0,#4
<SWI   "Sound_Control"
F%LDMFD R13!,{R0-R10,PC} ; & Return
P
Z0                     ; Voice parameter block
d|.VoiceBase B Fill:B Fill:B Fill:LDMFD R13!,{PC}:LDMFD R13!,{PC}:LDMFD R13!,{PC}:LDMFD R13!,{PC}:EQUD VoiceName-VoiceBase
n,.VoiceName EQUS"TrackerVox":EQUB 0:ALIGN
x
�&.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
�.ksl
�MOV R0,R10
�
MOV R1,#0
�SWI "Sound_AttachVoice"
�ADD R10,R10,#1
�CMP R10,#5
BNE ksl
#LDMFD R13!,{R0-R10,PC} ; Return

".inversetable
,';EQUD 1:             ; Dummy value!
6]:P%+=4096:[OPT C
@4.trackadr            ; Get address of track base
JADR R10,track
TMOV PC,R14
^%.track               ; Track base
h(]:P%+=tlen%:[OPT C   ; Is tlen% long
r
|	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
�LDMFD R13!,{R0-R4}
�MOV PC,R14
�.ltable
�0]:P%+=256:[OPT C     ; 256 byte lookup table
�
�..endcode             ; The endcode pointer
�]
�

*�"Building sample conversion table..."
&#� Setup sample conversion table
0� A%=0 � 255
:<  B%=A%-128:B%=B%<<24:ș "Sound_SoundLog",B% � ltable?A%
D�
N
X�"Building volume table..."
b� Setup volume table
l� A%=0 � 63
v!  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
��
�
��
�"�"Code length = ";endcode-code
�
�� Soundtracker datafile
��"Loading module...(";
 �("LOAD "+song$+" "+�~track)
track$="":B%=0
�
 1  � (track?B%)<>0 � track$+=�(track?B%):B%+=1
*�(track?B%)=0
4�;track$;")"
>
H:� Find length of tune data by looking through patterns
Rhigh%=0
\� A%=0 � 127
f5  � track?(&1D8+A%)>high% � high%=track?(&1D8+A%)
p�
zhigh%+=1
�
�� Convert samples
�A%=track+&258+(high%*1024)
�B%=track+tlen%-A%
�&�"Converting ";~(A%-track);"+";~B%
�
� convert
�
�samplei=track+&14
�spoint=A%:samples=track
�
�.�'"Nr Name                 Length  Volume"
�-�"-- -------------------- ------- ------"
�� A%=0 � 14
  sampleo=samplei+(A%*&1E)
  name$="":B%=0
  �
$4    � (sampleo?B%)<>0 name$+=�(sampleo?B%):B%+=1
.  �(sampleo?B%)=0 � B%=20
8  � name$<>"" �
B.    len%=2*((sampleo?22)*256+(sampleo?23))
L*    vol%=(sampleo?24)*256+(sampleo?25)
V2    �0);~(A%+1);�3);name$;�24);len%;�32);vol%
`'    sampleloc!(A%*4)=spoint-samples
j    spoint+=len%
t  �
~�
�&�"                        -------"
�B�"                        ";(spoint-samples-&258-(high%*1024))
�
�� Store length of tune
�info!4=track?&1D6-1
�
��"Tune length = ";info!4+1
�
�� � �killsound:�:�
�� Get things in motion!
�� installsound
� �"<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"
�
(�
2�
<  Ȗ:� intr
F-  �9,25);info!8;"   ";�38,25);!info;"  "
P  � A%=0 � 3
Zi    �25,27+A%);~current?A%;�34,27+A%);~ourinf!(32*A%+4);"   ";�48,27+A%);(effecttype!(A%*4))>>8;"  "
d  �
n��(0)=32
x�
�� killsound
��
��
�
00000000  0d 00 0a 0f f4 20 3e 50  6c 61 79 4d 6f 64 41 0d  |..... >PlayModA.|
00000010  00 14 05 f4 0d 00 1e 4b  f4 20 2e 2d 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 2e 0d  |--------------..|
00000060  00 28 4b f4 20 7c 20 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 7c 0d 00 32 4b f4 20  |         |..2K. |
000000b0  7c 20 53 79 73 74 65 6d  20 49 6e 74 65 72 72 75  || System Interru|
000000c0  70 74 20 53 6f 75 6e 64  54 72 61 63 6b 65 72 6d  |pt SoundTrackerm|
000000d0  6f 64 75 6c 65 20 70 6c  61 79 72 6f 75 74 69 6e  |odule playroutin|
000000e0  65 20 20 20 20 20 20 56  65 72 73 69 6f 6e 20 32  |e      Version 2|
000000f0  2e 30 34 20 7c 0d 00 3c  4b f4 20 7c 20 20 20 20  |.04 |..<K. |    |
00000100  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00000130  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 7c  |               ||
00000140  0d 00 46 4b f4 20 7c 20  28 63 29 31 39 38 39 2f  |..FK. | (c)1989/|
00000150  31 39 39 30 20 48 75 67  6f 20 46 69 65 6e 6e 65  |1990 Hugo Fienne|
00000160  73 20 28 30 37 34 39 29  20 20 37 32 32 33 34 20  |s (0749)  72234 |
00000170  65 76 65 6e 69 6e 67 73  20 20 20 20 20 20 32 38  |evenings      28|
00000180  2d 4d 61 72 2d 31 39 39  30 20 7c 0d 00 50 4b f4  |-Mar-1990 |..PK.|
00000190  20 7c 20 20 20 20 20 20  20 20 20 20 20 20 20 20  | |              |
000001a0  20 20 20 20 20 28 30 37  34 39 29 20 36 37 39 37  |     (0749) 6797|
000001b0  39 34 20 64 61 74 61 20  28 33 30 30 2d 32 34 30  |94 data (300-240|
000001c0  30 20 62 61 75 64 2c 20  31 20 6c 69 6e 65 29 20  |0 baud, 1 line) |
000001d0  20 20 20 20 20 7c 0d 00  5a 4b f4 20 7c 20 20 20  |     |..ZK. |   |
000001e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000001f0  28 30 37 34 39 29 20 36  37 30 30 33 30 20 64 61  |(0749) 670030 da|
00000200  74 61 20 28 33 30 30 2d  48 53 54 2f 56 33 32 2c  |ta (300-HST/V32,|
00000210  20 32 20 6c 69 6e 65 73  29 20 20 20 20 20 20 20  | 2 lines)       |
00000220  7c 0d 00 64 4b f4 20 60  2d 2d 2d 2d 2d 2d 2d 2d  ||..dK. `--------|
00000230  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000260  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 27 0d 00 6e 05  |-----------'..n.|
00000270  f4 0d 00 78 46 f4 20 53  6e 61 69 6c 6d 61 69 6c  |...xF. Snailmail|
00000280  3a 20 48 75 67 6f 20 46  69 65 6e 6e 65 73 2c 20  |: Hugo Fiennes, |
00000290  42 75 72 63 6f 74 74 20  4d 61 6e 6f 72 2c 20 57  |Burcott Manor, W|
000002a0  65 6c 6c 73 2c 20 53 6f  6d 65 72 73 65 74 2c 20  |ells, Somerset, |
000002b0  42 41 35 20 31 4e 48 0d  00 82 05 f4 0d 00 8c 4a  |BA5 1NH........J|
000002c0  f4 20 50 72 65 73 74 65  6c 20 20 3a 20 30 34 35  |. Prestel  : 045|
000002d0  38 34 37 36 30 38 20 20  20 20 20 20 20 43 69 78  |847608       Cix|
000002e0  3a 20 61 6c 74 6d 61 6e  20 20 20 20 20 20 20 20  |: altman        |
000002f0  20 20 53 49 44 3a 20 31  30 31 32 20 28 43 6f 6d  |  SID: 1012 (Com|
00000300  6d 62 61 73 65 29 0d 00  96 3f f4 20 20 20 20 20  |mbase)...?.     |
00000310  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00000340  26 31 31 30 30 0d 00 a0  47 f4 20 54 68 69 73 20  |&1100...G. This |
00000350  63 6f 64 65 20 69 73 20  70 75 62 6c 69 63 20 64  |code is public d|
00000360  6f 6d 61 69 6e 20 61 6e  64 20 4d 41 59 20 4e 4f  |omain and MAY NO|
00000370  54 20 42 45 20 53 4f 4c  44 20 4f 52 20 49 4e 43  |T BE SOLD OR INC|
00000380  4c 55 44 45 44 20 49 4e  20 41 4e 59 0d 00 aa 42  |LUDED IN ANY...B|
00000390  f4 20 50 52 4f 44 55 43  54 20 54 48 41 54 20 57  |. PRODUCT THAT W|
000003a0  49 4c 4c 20 42 45 20 53  4f 4c 44 20 57 49 54 48  |ILL BE SOLD WITH|
000003b0  4f 55 54 20 50 52 49 4f  52 20 50 45 52 4d 49 53  |OUT PRIOR PERMIS|
000003c0  53 49 4f 4e 20 46 52 4f  4d 20 4d 4f 49 21 0d 00  |SION FROM MOI!..|
000003d0  b4 05 f4 0d 00 be 47 f4  20 59 6f 75 20 6d 61 79  |......G. You may|
000003e0  20 63 6f 70 79 20 61 6e  64 20 64 69 73 74 72 69  | copy and distri|
000003f0  62 75 74 65 20 74 68 69  73 20 63 6f 64 65 20 61  |bute this code a|
00000400  73 20 6c 6f 6e 67 20 61  73 20 79 6f 75 20 64 6f  |s long as you do|
00000410  6e 27 74 20 6d 6f 64 69  66 79 0d 00 c8 45 f4 20  |n't modify...E. |
00000420  74 68 65 20 63 6f 70 79  20 79 6f 75 20 70 61 73  |the copy you pas|
00000430  73 20 6f 6e 3a 20 61 6e  79 20 69 6d 70 72 6f 76  |s on: any improv|
00000440  65 6d 65 6e 74 73 2c 20  65 74 63 20 73 68 6f 75  |ements, etc shou|
00000450  6c 64 20 62 65 20 73 65  6e 74 20 62 61 63 6b 0d  |ld be sent back.|
00000460  00 d2 2c f4 20 74 6f 20  6d 65 20 73 6f 20 49 20  |..,. to me so I |
00000470  63 61 6e 20 6d 6f 64 69  66 79 20 74 68 65 20 6d  |can modify the m|
00000480  61 73 74 65 72 20 63 6f  70 79 2e 0d 00 dc 05 f4  |aster copy......|
00000490  0d 00 e6 47 f4 20 49 66  20 79 6f 75 20 64 6f 20  |...G. If you do |
000004a0  77 72 69 74 65 20 61 6e  79 20 64 65 6d 6f 73 2c  |write any demos,|
000004b0  20 6f 72 20 6f 74 68 65  72 20 70 2e 64 2e 20 73  | or other p.d. s|
000004c0  2f 77 20 74 68 61 74 20  75 73 65 73 20 74 68 69  |/w that uses thi|
000004d0  73 20 63 6f 64 65 2c 0d  00 f0 1c f4 20 70 6c 65  |s code,..... ple|
000004e0  61 73 65 20 73 65 6e 64  20 6d 65 20 61 20 63 6f  |ase send me a co|
000004f0  70 79 21 0d 00 fa 05 f4  0d 01 04 47 f4 20 54 68  |py!........G. Th|
00000500  69 73 20 76 65 72 73 69  6f 6e 20 77 69 6c 6c 20  |is version will |
00000510  70 6c 61 79 20 61 6c 6d  6f 73 74 20 61 6e 79 20  |play almost any |
00000520  27 72 69 70 70 65 64 27  20 6d 6f 64 75 6c 65 20  |'ripped' module |
00000530  6f 72 20 6d 6f 64 75 6c  65 20 73 61 76 65 64 0d  |or module saved.|
00000540  01 0e 21 f4 20 4d 61 73  74 65 72 53 6f 75 6e 64  |..!. MasterSound|
00000550  54 72 61 63 6b 65 72 20  76 31 20 2d 20 76 32 2e  |Tracker v1 - v2.|
00000560  0d 01 18 05 f4 0d 01 22  07 eb 20 30 0d 01 2c 05  |.......".. 0..,.|
00000570  3a 0d 01 36 22 f4 20 52  65 73 65 72 76 65 20 73  |:..6". Reserve s|
00000580  70 61 63 65 20 66 6f 72  20 74 68 65 20 6d 6f 64  |pace for the mod|
00000590  75 6c 65 0d 01 40 11 de  20 63 6f 64 65 20 35 30  |ule..@.. code 50|
000005a0  30 30 30 30 0d 01 4a 04  0d 01 54 06 2a 2e 0d 01  |0000..J...T.*...|
000005b0  5e 18 e8 27 22 4d 6f 64  75 6c 65 4e 61 6d 65 3a  |^..'"ModuleName:|
000005c0  22 73 6f 6e 67 24 0d 01  68 04 0d 01 72 2a f4 20  |"song$..h...r*. |
000005d0  54 6f 74 61 6c 20 6c 65  6e 67 74 68 20 66 6f 72  |Total length for|
000005e0  20 73 6f 75 6e 64 74 72  61 63 6b 65 72 20 6d 6f  | soundtracker mo|
000005f0  64 75 6c 65 0d 01 7c 1d  41 25 3d 8e 73 6f 6e 67  |dule..|.A%=.song|
00000600  24 3a 74 6c 65 6e 25 3d  a2 23 41 25 3a d9 23 41  |$:tlen%=.#A%:.#A|
00000610  25 0d 01 86 04 0d 01 90  48 f4 20 4e 75 6d 62 65  |%.......H. Numbe|
00000620  72 20 6f 66 20 75 73 20  62 65 74 77 65 65 6e 20  |r of us between |
00000630  73 61 6d 70 6c 65 73 2e  20 50 72 6f 67 72 61 6d  |samples. Program|
00000640  20 66 61 6c 6c 73 20 6f  76 65 72 20 61 74 20 64  | falls over at d|
00000650  65 6c 61 79 73 20 6f 66  20 6c 65 73 73 0d 01 9a  |elays of less...|
00000660  21 f4 20 74 68 65 6e 20  31 30 75 73 20 28 31 30  |!. then 10us (10|
00000670  30 6b 48 7a 2f 63 68 61  6e 6e 65 6c 29 2e 0d 01  |0kHz/channel)...|
00000680  a4 09 75 73 3d 33 34 0d  01 ae 04 0d 01 b8 1a f1  |..us=34.........|
00000690  27 22 41 73 73 65 6d 62  6c 69 6e 67 20 63 6f 64  |'"Assembling cod|
000006a0  65 2e 2e 2e 22 0d 01 c2  0c e3 43 3d 30 b8 32 88  |e...".....C=0.2.|
000006b0  32 0d 01 cc 0b 50 25 3d  63 6f 64 65 0d 01 d6 09  |2....P%=code....|
000006c0  5b 4f 50 54 43 0d 01 e0  4d 3b 2d 2d 2d 2d 2d 2d  |[OPTC...M;------|
000006d0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000710  2d 2d 0d 01 ea 4b 3b 20  53 6f 75 6e 64 74 72 61  |--...K; Soundtra|
00000720  63 6b 65 72 20 70 6c 61  79 72 6f 75 74 69 6e 65  |cker playroutine|
00000730  20 20 20 20 20 20 20 20  20 20 20 76 32 2e 32 20  |           v2.2 |
00000740  57 69 74 68 20 70 6f 72  74 61 6d 65 6e 74 6f 2c  |With portamento,|
00000750  73 70 65 65 64 20 63 68  61 6e 67 65 2c 0d 01 f4  |speed change,...|
00000760  4a 3b 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |J;              |
00000770  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000780  20 20 20 20 20 20 20 20  20 20 20 76 6f 6c 75 6d  |           volum|
00000790  65 20 63 6f 6e 74 72 6f  6c 2c 70 61 74 74 65 72  |e control,patter|
000007a0  6e 20 62 72 65 61 6b 0d  01 fe 4d 3b 2d 2d 2d 2d  |n break...M;----|
000007b0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000007f0  2d 2d 2d 2d 0d 02 08 04  0d 02 12 09 2e 46 69 6c  |----.........Fil|
00000800  6c 0d 02 1c 13 41 44 52  20 20 20 52 38 2c 6f 75  |l....ADR   R8,ou|
00000810  72 69 6e 66 0d 02 26 18  41 44 44 20 20 20 52 38  |rinf..&.ADD   R8|
00000820  2c 52 38 2c 52 37 2c 4c  53 4c 23 35 0d 02 30 14  |,R8,R7,LSL#5..0.|
00000830  4c 44 4d 49 41 20 52 38  2c 7b 52 31 2d 52 36 7d  |LDMIA R8,{R1-R6}|
00000840  0d 02 3a 0d 2e 46 69 6c  6c 4c 6f 6f 70 0d 02 44  |..:..FillLoop..D|
00000850  05 5d 0d 02 4e 11 e3 20  73 6c 65 25 3d 31 20 b8  |.]..N.. sle%=1 .|
00000860  20 31 30 0d 02 58 0a 5b  4f 50 54 20 43 0d 02 62  | 10..X.[OPT C..b|
00000870  2d 4c 44 52 42 20 20 52  30 2c 5b 52 35 2c 52 31  |-LDRB  R0,[R5,R1|
00000880  2c 4c 53 52 23 31 36 5d  20 3b 20 47 65 74 20 73  |,LSR#16] ; Get s|
00000890  61 6d 70 6c 65 20 62 79  74 65 0d 02 6c 2a 53 55  |ample byte..l*SU|
000008a0  42 53 20 20 52 30 2c 52  30 2c 52 36 20 20 20 20  |BS  R0,R0,R6    |
000008b0  20 20 20 20 20 20 3b 20  53 63 61 6c 65 20 76 6f  |      ; Scale vo|
000008c0  6c 75 6d 65 0d 02 76 0f  4d 4f 56 4d 49 20 52 30  |lume..v.MOVMI R0|
000008d0  2c 23 30 0d 02 80 2e 53  54 52 42 20 20 52 30 2c  |,#0....STRB  R0,|
000008e0  5b 52 31 32 5d 2c 52 31  31 20 20 20 20 20 20 3b  |[R12],R11      ;|
000008f0  20 50 75 74 20 69 6e 20  69 6e 20 62 75 66 66 65  | Put in in buffe|
00000900  72 0d 02 8a 28 41 44 44  20 20 20 52 31 2c 52 31  |r...(ADD   R1,R1|
00000910  2c 52 32 20 20 20 20 20  20 20 20 20 20 3b 20 41  |,R2          ; A|
00000920  64 64 20 6f 66 66 73 65  74 0d 02 94 05 5d 0d 02  |dd offset....]..|
00000930  9e 05 ed 0d 02 a8 0a 5b  4f 50 54 20 43 0d 02 b2  |.......[OPT C...|
00000940  2a 43 4d 50 20 20 20 52  34 2c 52 31 2c 4c 53 52  |*CMP   R4,R1,LSR|
00000950  23 31 36 20 20 20 20 20  20 3b 20 45 6e 64 20 6f  |#16      ; End o|
00000960  66 20 6e 6f 74 65 3f 0d  02 bc 0d 42 47 54 20 20  |f note?....BGT  |
00000970  20 63 62 66 0d 02 c6 2c  4d 4f 56 53 20 20 52 31  | cbf...,MOVS  R1|
00000980  2c 52 33 20 20 20 20 20  20 20 20 20 20 20 20 20  |,R3             |
00000990  3b 20 59 65 73 2c 20 6c  6f 6f 70 20 62 61 63 6b  |; Yes, loop back|
000009a0  0d 02 d0 35 ec 51 20 52  32 2c 23 30 20 20 20 20  |...5.Q R2,#0    |
000009b0  20 20 20 20 20 20 20 20  20 3b 20 49 66 20 6e 6f  |         ; If no|
000009c0  20 6c 6f 6f 70 69 6e 67  2c 20 6b 65 65 70 20 71  | looping, keep q|
000009d0  75 69 65 74 21 0d 02 da  08 2e 63 62 66 0d 02 e4  |uiet!.....cbf...|
000009e0  31 43 4d 50 20 20 20 52  31 32 2c 52 31 30 20 20  |1CMP   R12,R10  |
000009f0  20 20 20 20 20 20 20 20  20 3b 20 45 6e 64 20 6f  |         ; End o|
00000a00  66 20 62 75 66 66 65 72  20 66 69 6c 6c 3f 0d 02  |f buffer fill?..|
00000a10  ee 32 42 4c 54 20 20 20  46 69 6c 6c 4c 6f 6f 70  |.2BLT   FillLoop|
00000a20  20 20 20 20 20 20 20 20  20 20 3b 20 4e 6f 70 65  |          ; Nope|
00000a30  2c 20 66 69 6c 6c 20 73  6f 6d 65 20 6d 6f 72 65  |, fill some more|
00000a40  0d 02 f8 47 41 44 52 20  20 20 52 30 2c 6e 65 77  |...GADR   R0,new|
00000a50  64 61 74 61 20 20 20 20  20 20 20 20 3b 20 53 6f  |data        ; So|
00000a60  20 77 65 20 64 6f 6e 27  74 20 6c 6f 73 74 20 6e  | we don't lost n|
00000a70  6f 74 65 73 2f 76 6f 69  63 65 73 20 62 79 20 6e  |otes/voices by n|
00000a80  65 77 20 6e 6f 74 65 0d  03 02 3a 20 20 20 20 20  |ew note...:     |
00000a90  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000aa0  20 20 20 3b 20 69 6e 74  65 72 72 75 70 74 69 6e  |   ; interruptin|
00000ab0  67 20 62 75 66 66 65 72  20 66 69 6c 6c 69 6e 67  |g buffer filling|
00000ac0  2e 0d 03 0c 14 4c 44 52  42 20 20 52 34 2c 5b 52  |.....LDRB  R4,[R|
00000ad0  30 2c 52 37 5d 0d 03 16  0f 43 4d 50 20 20 20 52  |0,R7]....CMP   R|
00000ae0  34 2c 23 30 0d 03 20 2d  53 54 4d 45 51 49 41 20  |4,#0.. -STMEQIA |
00000af0  52 38 2c 7b 52 31 2d 52  32 7d 20 20 20 20 20 20  |R8,{R1-R2}      |
00000b00  3b 20 53 61 76 65 20 72  65 67 73 20 61 67 61 69  |; Save regs agai|
00000b10  6e 0d 03 2a 0f 4d 4f 56  4e 45 20 52 34 2c 23 30  |n..*.MOVNE R4,#0|
00000b20  0d 03 34 15 53 54 52 4e  45 42 20 52 34 2c 5b 52  |..4.STRNEB R4,[R|
00000b30  30 2c 52 37 5d 0d 03 3e  04 0d 03 48 2a 4d 4f 56  |0,R7]..>...H*MOV|
00000b40  20 20 20 52 30 2c 23 25  30 30 30 30 31 30 30 30  |   R0,#%00001000|
00000b50  20 20 20 20 20 3b 20 76  6f 69 63 65 20 61 63 74  |     ; voice act|
00000b60  69 76 65 0d 03 52 34 4c  44 4d 46 44 20 52 31 33  |ive..R4LDMFD R13|
00000b70  21 2c 7b 50 43 7d 20 20  20 20 20 20 20 20 20 3b  |!,{PC}         ;|
00000b80  20 2e 2e 61 6e 64 20 72  65 74 75 72 6e 20 74 6f  | ..and return to|
00000b90  20 4c 65 76 65 6c 31 0d  03 5c 04 0d 03 66 0b 2e  | Level1..\...f..|
00000ba0  6f 75 72 69 6e 66 0d 03  70 3b 45 51 55 44 20 30  |ourinf..p;EQUD 0|
00000bb0  3a 45 51 55 44 20 30 3a  45 51 55 44 20 30 3a 45  |:EQUD 0:EQUD 0:E|
00000bc0  51 55 44 20 30 3a 45 51  55 44 20 30 3a 45 51 55  |QUD 0:EQUD 0:EQU|
00000bd0  44 20 30 3a 45 51 55 44  20 30 3a 45 51 55 44 20  |D 0:EQUD 0:EQUD |
00000be0  30 0d 03 7a 3b 45 51 55  44 20 30 3a 45 51 55 44  |0..z;EQUD 0:EQUD|
00000bf0  20 30 3a 45 51 55 44 20  30 3a 45 51 55 44 20 30  | 0:EQUD 0:EQUD 0|
00000c00  3a 45 51 55 44 20 30 3a  45 51 55 44 20 30 3a 45  |:EQUD 0:EQUD 0:E|
00000c10  51 55 44 20 30 3a 45 51  55 44 20 30 0d 03 84 3b  |QUD 0:EQUD 0...;|
00000c20  45 51 55 44 20 30 3a 45  51 55 44 20 30 3a 45 51  |EQUD 0:EQUD 0:EQ|
00000c30  55 44 20 30 3a 45 51 55  44 20 30 3a 45 51 55 44  |UD 0:EQUD 0:EQUD|
00000c40  20 30 3a 45 51 55 44 20  30 3a 45 51 55 44 20 30  | 0:EQUD 0:EQUD 0|
00000c50  3a 45 51 55 44 20 30 0d  03 8e 3b 45 51 55 44 20  |:EQUD 0...;EQUD |
00000c60  30 3a 45 51 55 44 20 30  3a 45 51 55 44 20 30 3a  |0:EQUD 0:EQUD 0:|
00000c70  45 51 55 44 20 30 3a 45  51 55 44 20 30 3a 45 51  |EQUD 0:EQUD 0:EQ|
00000c80  55 44 20 30 3a 45 51 55  44 20 30 3a 45 51 55 44  |UD 0:EQUD 0:EQUD|
00000c90  20 30 0d 03 98 04 0d 03  a2 0c 2e 6e 65 77 64 61  | 0.........newda|
00000ca0  74 61 0d 03 ac 0a 45 51  55 44 20 30 0d 03 b6 04  |ta....EQUD 0....|
00000cb0  0d 03 c0 10 2e 63 68 61  6e 6e 65 6c 6e 6f 74 65  |.....channelnote|
00000cc0  0d 03 ca 1f 45 51 55 44  20 30 3a 45 51 55 44 20  |....EQUD 0:EQUD |
00000cd0  30 3a 45 51 55 44 20 30  3a 45 51 55 44 20 30 0d  |0:EQUD 0:EQUD 0.|
00000ce0  03 d4 04 0d 03 de 0f 2e  65 66 66 65 63 74 74 79  |........effectty|
00000cf0  70 65 0d 03 e8 1f 45 51  55 44 20 30 3a 45 51 55  |pe....EQUD 0:EQU|
00000d00  44 20 30 3a 45 51 55 44  20 30 3a 45 51 55 44 20  |D 0:EQUD 0:EQUD |
00000d10  30 0d 03 f2 04 0d 03 fc  09 2e 69 6e 66 6f 0d 04  |0.........info..|
00000d20  06 23 45 51 55 44 20 20  30 20 20 20 20 20 20 20  |.#EQUD  0       |
00000d30  20 20 20 20 20 20 20 3b  20 50 6f 73 69 74 69 6f  |       ; Positio|
00000d40  6e 0d 04 10 29 45 51 55  44 20 20 30 20 20 20 20  |n...)EQUD  0    |
00000d50  20 20 20 20 20 20 20 20  20 20 3b 20 50 61 74 74  |          ; Patt|
00000d60  65 72 6e 20 6c 65 6e 67  74 68 0d 04 1a 28 45 51  |ern length...(EQ|
00000d70  55 44 20 20 30 20 20 20  20 20 20 20 20 20 20 20  |UD  0           |
00000d80  20 20 20 3b 20 53 65 71  75 65 6e 63 65 20 70 6f  |   ; Sequence po|
00000d90  73 6e 0d 04 24 04 0d 04  2e 0c 2e 73 65 71 62 61  |sn..$......seqba|
00000da0  73 65 0d 04 38 28 45 51  55 44 20 20 26 31 44 38  |se..8(EQUD  &1D8|
00000db0  20 20 20 20 20 20 20 20  20 20 20 3b 20 53 65 71  |           ; Seq|
00000dc0  75 65 6e 63 65 20 62 61  73 65 0d 04 42 04 0d 04  |uence base..B...|
00000dd0  4c 0c 2e 74 72 6b 62 61  73 65 0d 04 56 2f 45 51  |L..trkbase..V/EQ|
00000de0  55 44 20 20 26 32 35 38  20 20 20 20 20 20 20 20  |UD  &258        |
00000df0  20 20 20 3b 20 50 61 74  74 65 72 6e 20 62 61 73  |   ; Pattern bas|
00000e00  65 20 61 64 64 72 65 73  73 0d 04 60 04 0d 04 6a  |e address..`...j|
00000e10  0c 2e 63 75 72 72 65 6e  74 0d 04 74 2e 45 51 55  |..current..t.EQU|
00000e20  44 20 30 20 20 20 20 20  20 20 20 20 20 20 20 20  |D 0             |
00000e30  20 20 3b 20 43 75 72 72  65 6e 74 20 69 6e 73 74  |  ; Current inst|
00000e40  72 75 6d 65 6e 74 73 0d  04 7e 04 0d 04 88 0b 2e  |ruments..~......|
00000e50  63 6f 75 6e 74 69 0d 04  92 28 45 51 55 44 20 30  |counti...(EQUD 0|
00000e60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00000e70  20 56 73 79 6e 63 20 63  6f 75 6e 74 65 72 0d 04  | Vsync counter..|
00000e80  9c 04 0d 04 a6 0a 2e 73  70 65 65 64 0d 04 b0 34  |.......speed...4|
00000e90  45 51 55 44 20 36 20 20  20 20 20 20 20 20 20 20  |EQUD 6          |
00000ea0  20 20 20 20 20 3b 20 53  70 65 65 64 20 63 6f 75  |     ; Speed cou|
00000eb0  6e 74 65 72 20 28 64 65  66 61 75 6c 74 3d 36 29  |nter (default=6)|
00000ec0  0d 04 ba 04 0d 04 c4 2d  2e 69 6e 74 72 20 20 20  |.......-.intr   |
00000ed0  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 43  |             ; C|
00000ee0  61 6c 6c 65 64 20 65 76  65 72 79 20 56 53 59 4e  |alled every VSYN|
00000ef0  43 0d 04 ce 1b 53 54 4d  46 44 20 52 31 33 21 2c  |C....STMFD R13!,|
00000f00  7b 52 30 2d 52 31 32 2c  52 31 34 7d 0d 04 d8 25  |{R0-R12,R14}...%|
00000f10  4c 44 52 20 20 20 52 31  2c 63 6f 75 6e 74 69 20  |LDR   R1,counti |
00000f20  20 20 20 20 20 3b 20 4c  6f 61 64 20 63 6f 75 6e  |     ; Load coun|
00000f30  74 0d 04 e2 29 42 4c 20  20 20 20 64 6f 65 66 66  |t...)BL    doeff|
00000f40  65 63 74 20 20 20 20 20  20 20 3b 20 44 6f 20 61  |ect       ; Do a|
00000f50  6e 79 20 65 66 66 65 63  74 73 0d 04 ec 2c 4c 44  |ny effects...,LD|
00000f60  52 20 20 20 52 32 2c 73  70 65 65 64 20 20 20 20  |R   R2,speed    |
00000f70  20 20 20 3b 20 43 75 72  72 65 6e 74 20 70 6c 61  |   ; Current pla|
00000f80  79 73 70 65 65 64 0d 04  f6 2a 41 44 44 20 20 20  |yspeed...*ADD   |
00000f90  52 31 2c 52 31 2c 23 31  20 20 20 20 20 20 20 3b  |R1,R1,#1       ;|
00000fa0  20 49 6e 63 72 65 6d 65  6e 74 20 63 6f 75 6e 74  | Increment count|
00000fb0  0d 05 00 29 43 4d 50 20  20 20 52 31 2c 52 32 20  |...)CMP   R1,R2 |
00000fc0  20 20 20 20 20 20 20 20  20 3b 20 52 65 61 64 79  |         ; Ready|
00000fd0  20 74 6f 20 70 6c 61 79  3f 0d 05 0a 1b ec 51 20  | to play?.....Q |
00000fe0  52 31 2c 23 30 20 20 20  20 20 20 20 20 20 20 3b  |R1,#0          ;|
00000ff0  20 59 65 73 0d 05 14 28  53 54 52 20 20 20 52 31  | Yes...(STR   R1|
00001000  2c 63 6f 75 6e 74 69 20  20 20 20 20 20 3b 20 52  |,counti      ; R|
00001010  65 73 74 6f 72 65 20 63  6f 75 6e 74 0d 05 1e 3e  |estore count...>|
00001020  42 4c 45 51 20 20 70 6c  61 79 6e 6f 74 65 20 20  |BLEQ  playnote  |
00001030  20 20 20 20 20 3b 20 49  66 20 73 6f 2c 20 7a 65  |     ; If so, ze|
00001040  72 6f 20 63 6f 75 6e 74  65 72 20 61 6e 64 20 70  |ro counter and p|
00001050  6c 61 79 20 61 20 6e 6f  74 65 0d 05 28 1a 4c 44  |lay a note..(.LD|
00001060  4d 46 44 20 52 31 33 21  2c 7b 52 30 2d 52 31 32  |MFD R13!,{R0-R12|
00001070  2c 50 43 7d 0d 05 32 04  0d 05 3c 0d 2e 70 6c 61  |,PC}..2...<..pla|
00001080  79 6e 6f 74 65 0d 05 46  14 53 54 4d 46 44 20 52  |ynote..F.STMFD R|
00001090  31 33 21 2c 7b 52 31 34  7d 0d 05 50 2d 41 44 52  |13!,{R14}..P-ADR|
000010a0  20 20 20 52 30 2c 69 6e  66 6f 20 20 20 20 20 20  |   R0,info      |
000010b0  20 20 3b 20 4c 6f 61 64  20 73 65 71 75 65 6e 63  |  ; Load sequenc|
000010c0  65 20 69 6e 66 6f 0d 05  5a 14 4c 44 4d 49 41 20  |e info..Z.LDMIA |
000010d0  52 30 2c 7b 52 37 2d 52  39 7d 0d 05 64 0d 2e 61  |R0,{R7-R9}..d..a|
000010e0  6e 64 61 67 61 69 6e 0d  05 6e 13 53 54 4d 46 44  |ndagain..n.STMFD|
000010f0  20 52 31 33 21 2c 7b 52  39 7d 0d 05 78 12 42 4c  | R13!,{R9}..x.BL|
00001100  20 20 20 20 74 72 61 63  6b 61 64 72 0d 05 82 14  |    trackadr....|
00001110  4c 44 52 20 20 20 52 30  2c 73 65 71 62 61 73 65  |LDR   R0,seqbase|
00001120  0d 05 8c 32 41 44 44 20  20 20 52 31 31 2c 52 30  |...2ADD   R11,R0|
00001130  2c 52 31 30 20 20 20 20  20 3b 20 52 31 31 3d 61  |,R10     ; R11=a|
00001140  64 64 72 65 73 73 20 6f  66 20 73 65 71 75 65 6e  |ddress of sequen|
00001150  63 65 0d 05 96 14 4c 44  52 20 20 20 52 30 2c 74  |ce....LDR   R0,t|
00001160  72 6b 62 61 73 65 0d 05  a0 2f 41 44 44 20 20 20  |rkbase.../ADD   |
00001170  52 31 32 2c 52 30 2c 52  31 30 20 20 20 20 20 3b  |R12,R0,R10     ;|
00001180  20 52 31 32 3d 61 64 64  72 65 73 73 20 6f 66 20  | R12=address of |
00001190  74 72 61 63 6b 0d 05 aa  04 0d 05 b4 2f 4c 44 52  |track......./LDR|
000011a0  42 20 20 52 36 2c 5b 52  31 31 2c 52 37 5d 20 20  |B  R6,[R11,R7]  |
000011b0  20 20 3b 20 47 65 74 20  61 64 64 72 65 73 73 20  |  ; Get address |
000011c0  6f 66 20 6e 6f 74 65 73  0d 05 be 1b 41 44 44 20  |of notes....ADD |
000011d0  20 20 52 31 32 2c 52 31  32 2c 52 36 2c 4c 53 4c  |  R12,R12,R6,LSL|
000011e0  23 31 30 0d 05 c8 1a 41  44 44 20 20 20 52 31 32  |#10....ADD   R12|
000011f0  2c 52 31 32 2c 52 39 2c  4c 53 4c 23 34 0d 05 d2  |,R12,R9,LSL#4...|
00001200  14 41 44 52 20 20 20 52  39 2c 63 75 72 72 65 6e  |.ADR   R9,curren|
00001210  74 0d 05 dc 04 0d 05 e6  28 4d 4f 56 20 20 20 52  |t.......(MOV   R|
00001220  35 2c 23 33 20 20 20 20  20 20 20 20 20 20 3b 20  |5,#3          ; |
00001230  44 6f 20 34 20 63 68 61  6e 6e 65 6c 73 0d 05 f0  |Do 4 channels...|
00001240  0e 2e 64 6f 63 68 61 6e  6e 65 6c 0d 05 fa 1a 41  |..dochannel....A|
00001250  44 44 20 20 20 52 31 31  2c 52 31 32 2c 52 35 2c  |DD   R11,R12,R5,|
00001260  4c 53 4c 23 32 0d 06 04  30 4c 44 52 42 20 20 52  |LSL#2...0LDRB  R|
00001270  36 2c 5b 52 31 31 2c 23  32 5d 20 20 20 20 3b 20  |6,[R11,#2]    ; |
00001280  47 65 74 20 69 6e 73 74  72 75 6d 65 6e 74 20 6e  |Get instrument n|
00001290  75 6d 62 65 72 0d 06 0e  22 4d 4f 56 53 20 20 52  |umber..."MOVS  R|
000012a0  36 2c 52 36 2c 4c 53 52  23 34 20 20 20 20 3b 20  |6,R6,LSR#4    ; |
000012b0  53 68 75 66 66 6c 65 0d  06 18 49 53 54 52 4e 45  |Shuffle...ISTRNE|
000012c0  42 20 52 36 2c 5b 52 39  2c 52 35 5d 20 20 20 20  |B R6,[R9,R5]    |
000012d0  3b 20 49 66 20 69 74 27  73 20 7a 65 72 6f 2c 20  |; If it's zero, |
000012e0  6c 6f 61 64 20 6c 61 73  74 20 69 6e 73 74 72 75  |load last instru|
000012f0  6d 65 6e 74 2c 20 65 6c  73 65 20 73 74 6f 72 65  |ment, else store|
00001300  0d 06 22 24 4c 44 52 45  51 42 20 52 36 2c 5b 52  |.."$LDREQB R6,[R|
00001310  39 2c 52 35 5d 20 20 20  20 3b 20 74 68 69 73 20  |9,R5]    ; this |
00001320  6f 6e 65 2e 0d 06 2c 33  43 4d 50 20 20 20 52 36  |one...,3CMP   R6|
00001330  2c 23 30 20 20 20 20 20  20 20 20 20 20 3b 20 41  |,#0          ; A|
00001340  6e 79 20 69 6e 73 74 72  75 6d 65 6e 74 20 73 65  |ny instrument se|
00001350  6c 65 63 74 65 64 3f 0d  06 36 2a 42 45 51 20 20  |lected?..6*BEQ  |
00001360  20 6e 65 78 74 63 68 61  6e 6e 65 6c 20 20 20 20  | nextchannel    |
00001370  3b 20 44 6f 20 6e 65 78  74 20 63 68 61 6e 6e 65  |; Do next channe|
00001380  6c 0d 06 40 3c 53 55 42  20 20 20 52 36 2c 52 36  |l..@<SUB   R6,R6|
00001390  2c 23 31 20 20 20 20 20  20 20 3b 20 43 6f 72 72  |,#1       ; Corr|
000013a0  65 63 74 20 52 36 20 66  6f 72 20 63 61 6c 63 75  |ect R6 for calcu|
000013b0  6c 61 74 69 6f 6e 73 20  62 65 6c 6f 77 0d 06 4a  |lations below..J|
000013c0  24 4d 4f 56 20 20 20 52  30 2c 52 31 31 20 20 20  |$MOV   R0,R11   |
000013d0  20 20 20 20 20 20 3b 20  47 65 74 20 70 69 74 63  |      ; Get pitc|
000013e0  68 0d 06 54 29 42 4c 20  20 20 20 67 65 74 68 69  |h..T)BL    gethi|
000013f0  6c 6f 20 20 20 20 20 20  20 20 3b 20 28 62 6c 6f  |lo        ; (blo|
00001400  6f 64 79 20 36 38 30 30  30 29 0d 06 5e 2c 4d 4f  |ody 68000)..^,MO|
00001410  56 53 20 20 52 34 2c 52  30 20 20 20 20 20 20 20  |VS  R4,R0       |
00001420  20 20 20 3b 20 52 34 3d  73 74 61 6e 64 61 72 64  |   ; R4=standard|
00001430  20 70 69 74 63 68 0d 06  68 45 42 45 51 20 20 20  | pitch..hEBEQ   |
00001440  6e 65 78 74 63 68 61 6e  6e 65 6c 20 20 20 20 3b  |nextchannel    ;|
00001450  20 42 75 74 20 69 73 20  69 74 20 7a 65 72 6f 3f  | But is it zero?|
00001460  20 49 66 20 73 6f 2c 20  64 6f 6e 27 74 20 70 6c  | If so, don't pl|
00001470  61 79 20 61 6e 79 74 68  69 6e 67 0d 06 72 43 41  |ay anything..rCA|
00001480  44 52 20 20 20 52 33 2c  63 68 61 6e 6e 65 6c 6e  |DR   R3,channeln|
00001490  6f 74 65 20 3b 20 53 61  76 65 20 70 69 74 63 68  |ote ; Save pitch|
000014a0  20 66 6f 72 20 61 72 70  65 67 67 69 6f 2c 20 70  | for arpeggio, p|
000014b0  6f 72 74 61 6d 65 6e 74  6f 2c 20 65 74 63 0d 06  |ortamento, etc..|
000014c0  7c 1a 53 54 52 20 20 20  52 34 2c 5b 52 33 2c 52  ||.STR   R4,[R3,R|
000014d0  35 2c 4c 53 4c 23 32 5d  0d 06 86 3b 41 44 52 20  |5,LSL#2]...;ADR |
000014e0  20 20 52 33 2c 69 6e 76  65 72 73 65 74 61 62 6c  |  R3,inversetabl|
000014f0  65 20 3b 20 53 63 61 6c  65 20 70 69 74 63 68 20  |e ; Scale pitch |
00001500  75 73 69 6e 67 20 69 6e  76 65 72 73 65 20 74 61  |using inverse ta|
00001510  62 6c 65 0d 06 90 1a 4c  44 52 20 20 20 52 34 2c  |ble....LDR   R4,|
00001520  5b 52 33 2c 52 34 2c 4c  53 4c 23 32 5d 0d 06 9a  |[R3,R4,LSL#2]...|
00001530  13 41 44 52 20 20 20 52  32 2c 6f 75 72 69 6e 66  |.ADR   R2,ourinf|
00001540  0d 06 a4 3c 41 44 44 20  20 20 52 32 2c 52 32 2c  |...<ADD   R2,R2,|
00001550  52 35 2c 4c 53 4c 23 35  20 3b 20 47 65 74 20 61  |R5,LSL#5 ; Get a|
00001560  64 64 72 65 73 73 20 6f  66 20 66 69 6c 6c 20 63  |ddress of fill c|
00001570  6f 6e 74 72 6f 6c 20 62  6c 6f 63 6b 0d 06 ae 43  |ontrol block...C|
00001580  4d 4f 56 20 20 20 52 31  2c 23 30 20 20 20 20 20  |MOV   R1,#0     |
00001590  20 20 20 20 20 3b 20 53  65 74 20 66 69 6c 6c 20  |     ; Set fill |
000015a0  74 6f 20 73 74 61 72 74  20 66 69 6c 6c 69 6e 67  |to start filling|
000015b0  20 61 74 20 7a 65 72 6f  20 6f 66 66 73 65 74 0d  | at zero offset.|
000015c0  06 b8 14 53 54 52 20 20  20 52 31 2c 5b 52 32 2c  |...STR   R1,[R2,|
000015d0  23 30 5d 0d 06 c2 24 53  54 52 20 20 20 52 34 2c  |#0]...$STR   R4,|
000015e0  5b 52 32 2c 23 34 5d 20  20 20 20 20 3b 20 53 65  |[R2,#4]     ; Se|
000015f0  74 20 70 69 74 63 68 0d  06 cc 39 41 44 52 20 20  |t pitch...9ADR  |
00001600  20 52 33 2c 73 61 6d 70  6c 65 6c 6f 63 20 20 20  | R3,sampleloc   |
00001610  3b 20 41 64 64 72 65 73  73 20 6f 66 20 73 61 6d  |; Address of sam|
00001620  70 6c 65 20 6c 6f 6f 6b  75 70 20 74 61 62 6c 65  |ple lookup table|
00001630  0d 06 d6 34 4c 44 52 20  20 20 52 33 2c 5b 52 33  |...4LDR   R3,[R3|
00001640  2c 52 36 2c 4c 53 4c 23  32 5d 20 3b 20 52 33 3d  |,R6,LSL#2] ; R3=|
00001650  41 63 74 75 61 6c 20 73  61 6d 70 6c 65 20 6f 66  |Actual sample of|
00001660  66 73 65 74 0d 06 e0 33  41 44 44 20 20 20 52 33  |fset...3ADD   R3|
00001670  2c 52 33 2c 52 31 30 20  20 20 20 20 20 3b 20 52  |,R3,R10      ; R|
00001680  33 3d 41 63 74 75 61 6c  20 73 61 6d 70 6c 65 20  |3=Actual sample |
00001690  61 64 64 72 65 73 73 0d  06 ea 31 53 54 52 20 20  |address...1STR  |
000016a0  20 52 33 2c 5b 52 32 2c  23 31 36 5d 20 20 20 20  | R3,[R2,#16]    |
000016b0  3b 20 53 65 74 20 69 6e  73 74 72 75 6d 65 6e 74  |; Set instrument|
000016c0  20 61 64 64 72 65 73 73  0d 06 f4 46 41 44 52 20  | address...FADR |
000016d0  20 20 52 30 2c 6e 65 77  64 61 74 61 20 20 20 20  |  R0,newdata    |
000016e0  20 3b 20 53 6f 20 77 65  20 64 6f 6e 27 74 20 6c  | ; So we don't l|
000016f0  6f 73 74 20 6e 6f 74 65  73 20 69 66 20 77 65 20  |ost notes if we |
00001700  70 6c 61 79 20 6f 6e 20  56 53 59 4e 43 21 0d 06  |play on VSYNC!..|
00001710  fe 0f 4d 4f 56 20 20 20  52 31 2c 23 31 0d 07 08  |..MOV   R1,#1...|
00001720  14 53 54 52 42 20 20 52  31 2c 5b 52 30 2c 52 35  |.STRB  R1,[R0,R5|
00001730  5d 0d 07 12 3f 41 44 44  20 20 20 52 33 2c 52 31  |]...?ADD   R3,R1|
00001740  30 2c 23 26 31 34 20 20  20 20 3b 20 4f 66 66 73  |0,#&14    ; Offs|
00001750  65 74 20 6f 66 20 73 61  6d 70 6c 65 20 70 6c 61  |et of sample pla|
00001760  79 20 64 61 74 61 20 66  72 6f 6d 20 62 61 73 65  |y data from base|
00001770  0d 07 1c 33 4d 4f 56 20  20 20 52 31 2c 23 26 31  |...3MOV   R1,#&1|
00001780  45 20 20 20 20 20 20 20  20 3b 20 28 73 61 6d 70  |E        ; (samp|
00001790  6c 65 20 64 61 74 61 20  6d 75 6c 74 69 70 6c 69  |le data multipli|
000017a0  65 72 29 0d 07 26 37 4d  4c 41 20 20 20 52 33 2c  |er)..&7MLA   R3,|
000017b0  52 36 2c 52 31 2c 52 33  20 20 20 20 3b 20 52 33  |R6,R1,R3    ; R3|
000017c0  3d 69 6e 73 74 72 75 6d  65 6e 74 20 70 6c 61 79  |=instrument play|
000017d0  20 64 61 74 61 20 62 61  73 65 0d 07 30 2c 41 44  | data base..0,AD|
000017e0  44 20 20 20 52 30 2c 52  33 2c 23 26 31 43 20 20  |D   R0,R3,#&1C  |
000017f0  20 20 20 3b 20 47 65 74  20 72 65 70 65 61 74 20  |   ; Get repeat |
00001800  6c 65 6e 67 74 68 0d 07  3a 11 42 4c 20 20 20 20  |length..:.BL    |
00001810  67 65 74 68 69 6c 6f 0d  07 44 26 43 4d 50 20 20  |gethilo..D&CMP  |
00001820  20 52 30 2c 23 31 20 20  20 20 20 20 20 20 20 20  | R0,#1          |
00001830  3b 20 4e 6f 20 72 65 70  65 61 74 73 3f 0d 07 4e  |; No repeats?..N|
00001840  31 42 45 51 20 20 20 6e  6f 72 65 70 20 20 20 20  |1BEQ   norep    |
00001850  20 20 20 20 20 20 3b 20  42 72 61 6e 63 68 20 74  |      ; Branch t|
00001860  6f 20 74 68 65 20 6e 65  78 74 20 62 69 74 0d 07  |o the next bit..|
00001870  58 2f 4d 4f 56 20 20 20  52 31 2c 52 30 2c 4c 53  |X/MOV   R1,R0,LS|
00001880  4c 23 31 20 20 20 20 3b  20 78 32 20 66 6f 72 20  |L#1    ; x2 for |
00001890  72 65 70 65 61 74 20 6c  65 6e 67 74 68 0d 07 62  |repeat length..b|
000018a0  32 41 44 44 20 20 20 52  30 2c 52 33 2c 23 26 31  |2ADD   R0,R3,#&1|
000018b0  41 20 20 20 20 20 3b 20  47 65 74 20 72 65 70 65  |A     ; Get repe|
000018c0  61 74 20 73 74 61 72 74  20 6f 66 66 73 65 74 0d  |at start offset.|
000018d0  07 6c 11 42 4c 20 20 20  20 67 65 74 68 69 6c 6f  |.l.BL    gethilo|
000018e0  0d 07 76 3c 41 44 44 20  20 20 52 30 2c 52 30 2c  |..v<ADD   R0,R0,|
000018f0  52 31 20 20 20 20 20 20  20 3b 20 4d 61 6b 65 20  |R1       ; Make |
00001900  6e 65 77 20 6c 65 6e 67  74 68 20 62 79 20 61 64  |new length by ad|
00001910  64 69 6e 67 20 74 68 65  20 74 77 6f 0d 07 80 25  |ding the two...%|
00001920  53 54 52 20 20 20 52 30  2c 5b 52 32 2c 23 31 32  |STR   R0,[R2,#12|
00001930  5d 20 20 20 20 3b 20 61  6e 64 20 73 65 74 20 69  |]    ; and set i|
00001940  74 0d 07 8a 14 41 44 44  20 20 20 52 30 2c 52 33  |t....ADD   R0,R3|
00001950  2c 23 26 31 41 0d 07 94  30 42 4c 20 20 20 20 67  |,#&1A...0BL    g|
00001960  65 74 68 69 6c 6f 20 20  20 20 20 20 20 20 3b 20  |ethilo        ; |
00001970  47 65 74 20 73 74 61 72  74 20 72 65 70 65 61 74  |Get start repeat|
00001980  20 70 6f 73 6e 0d 07 9e  28 41 44 44 20 20 20 52  | posn...(ADD   R|
00001990  30 2c 52 30 2c 23 31 20  20 20 20 20 20 20 3b 20  |0,R0,#1       ; |
000019a0  6d 61 6b 65 20 6e 6f 6e  2d 7a 65 72 6f 0d 07 a8  |make non-zero...|
000019b0  23 53 54 52 20 20 20 52  30 2c 5b 52 32 2c 23 38  |#STR   R0,[R2,#8|
000019c0  5d 20 20 20 20 20 3b 20  53 74 6f 72 65 20 69 74  |]     ; Store it|
000019d0  0d 07 b2 2f 42 20 20 20  20 20 6e 65 78 74 20 20  |.../B     next  |
000019e0  20 20 20 20 20 20 20 20  20 3b 20 62 72 61 6e 63  |         ; branc|
000019f0  68 20 6f 76 65 72 20 6e  65 78 74 20 62 69 74 0d  |h over next bit.|
00001a00  07 bc 0a 2e 6e 6f 72 65  70 0d 07 c6 14 41 44 44  |....norep....ADD|
00001a10  20 20 20 52 30 2c 52 33  2c 23 26 31 36 0d 07 d0  |   R0,R3,#&16...|
00001a20  37 42 4c 20 20 20 20 67  65 74 68 69 6c 6f 20 20  |7BL    gethilo  |
00001a30  20 20 20 20 20 20 3b 20  47 65 74 20 74 68 65 20  |      ; Get the |
00001a40  6c 65 6e 67 74 68 20 6f  66 20 74 68 65 20 73 61  |length of the sa|
00001a50  6d 70 6c 65 0d 07 da 27  4d 4f 56 20 20 20 52 30  |mple...'MOV   R0|
00001a60  2c 52 30 2c 4c 53 4c 23  31 20 20 20 20 3b 20 78  |,R0,LSL#1    ; x|
00001a70  32 20 6f 66 20 63 6f 75  72 73 65 0d 07 e4 25 53  |2 of course...%S|
00001a80  54 52 20 20 20 52 30 2c  5b 52 32 2c 23 31 32 5d  |TR   R0,[R2,#12]|
00001a90  20 20 20 20 3b 20 61 6e  64 20 73 65 74 20 69 74  |    ; and set it|
00001aa0  0d 07 ee 14 41 44 44 20  20 20 52 30 2c 52 33 2c  |....ADD   R0,R3,|
00001ab0  23 26 31 41 0d 07 f8 30  42 4c 20 20 20 20 67 65  |#&1A...0BL    ge|
00001ac0  74 68 69 6c 6f 20 20 20  20 20 20 20 20 3b 20 47  |thilo        ; G|
00001ad0  65 74 20 73 74 61 72 74  20 72 65 70 65 61 74 20  |et start repeat |
00001ae0  70 6f 73 6e 0d 08 02 23  53 54 52 20 20 20 52 30  |posn...#STR   R0|
00001af0  2c 5b 52 32 2c 23 38 5d  20 20 20 20 20 3b 20 53  |,[R2,#8]     ; S|
00001b00  74 6f 72 65 20 69 74 0d  08 0c 36 2e 6e 65 78 74  |tore it...6.next|
00001b10  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001b20  3b 20 42 65 66 6f 72 65  20 77 65 20 67 6f 2c 20  |; Before we go, |
00001b30  64 6f 20 74 68 65 20 76  6f 6c 75 6d 65 0d 08 16  |do the volume...|
00001b40  14 41 44 44 20 20 20 52  30 2c 52 33 2c 23 26 31  |.ADD   R0,R3,#&1|
00001b50  38 0d 08 20 25 42 4c 20  20 20 20 67 65 74 68 69  |8.. %BL    gethi|
00001b60  6c 6f 20 20 20 20 20 20  20 20 3b 20 47 65 74 20  |lo        ; Get |
00001b70  76 6f 6c 75 6d 65 0d 08  2a 20 43 4d 50 20 20 20  |volume..* CMP   |
00001b80  52 30 2c 23 36 34 20 20  20 20 20 20 20 20 20 3b  |R0,#64         ;|
00001b90  20 4f 76 65 72 3f 0d 08  34 22 4d 4f 56 47 45 20  | Over?..4"MOVGE |
00001ba0  52 30 2c 23 36 33 20 20  20 20 20 20 20 20 20 3b  |R0,#63         ;|
00001bb0  20 43 6f 72 72 65 63 74  0d 08 3e 27 41 44 52 20  | Correct..>'ADR |
00001bc0  20 20 52 31 2c 76 6f 6c  74 61 62 20 20 20 20 20  |  R1,voltab     |
00001bd0  20 3b 20 56 6f 6c 75 6d  65 20 74 61 62 6c 65 0d  | ; Volume table.|
00001be0  08 48 29 4c 44 52 42 20  20 52 30 2c 5b 52 31 2c  |.H)LDRB  R0,[R1,|
00001bf0  52 30 5d 20 20 20 20 20  3b 20 47 65 74 20 6e 65  |R0]     ; Get ne|
00001c00  77 20 76 6f 6c 75 6d 65  0d 08 52 23 53 54 52 20  |w volume..R#STR |
00001c10  20 20 52 30 2c 5b 52 32  2c 23 32 30 5d 20 20 20  |  R0,[R2,#20]   |
00001c20  20 3b 20 53 74 6f 72 65  20 69 74 0d 08 5c 10 2e  | ; Store it..\..|
00001c30  6e 65 78 74 63 68 61 6e  6e 65 6c 0d 08 66 35 41  |nextchannel..f5A|
00001c40  44 52 20 20 20 52 33 2c  65 66 66 65 63 74 74 79  |DR   R3,effectty|
00001c50  70 65 20 20 3b 20 43 61  6e 63 65 6c 20 61 6e 79  |pe  ; Cancel any|
00001c60  20 63 75 72 72 65 6e 74  20 65 66 66 65 63 74 73  | current effects|
00001c70  0d 08 70 1a 4d 4f 56 20  20 20 52 34 2c 23 30 20  |..p.MOV   R4,#0 |
00001c80  20 20 20 20 20 20 20 20  20 3b 0d 08 7a 1c 53 54  |         ;..z.ST|
00001c90  52 20 20 20 52 34 2c 5b  52 33 2c 52 35 2c 4c 53  |R   R4,[R3,R5,LS|
00001ca0  4c 23 32 5d 20 3b 0d 08  84 2c 42 4c 20 20 20 20  |L#2] ;...,BL    |
00001cb0  65 66 66 65 63 74 63 68  65 63 6b 20 20 20 20 3b  |effectcheck    ;|
00001cc0  20 43 68 65 63 6b 20 66  6f 72 20 65 66 66 65 63  | Check for effec|
00001cd0  74 73 0d 08 8e 33 53 55  42 53 20 20 52 35 2c 52  |ts...3SUBS  R5,R|
00001ce0  35 2c 23 31 20 20 20 20  20 20 20 3b 20 44 65 63  |5,#1       ; Dec|
00001cf0  72 65 6d 65 6e 74 20 63  68 61 6e 6e 65 6c 20 6e  |rement channel n|
00001d00  75 6d 62 65 72 0d 08 98  33 42 50 4c 20 20 20 64  |umber...3BPL   d|
00001d10  6f 63 68 61 6e 6e 65 6c  20 20 20 20 20 20 3b 20  |ochannel      ; |
00001d20  4e 6f 70 65 2c 20 64 6f  20 61 6e 6f 74 68 65 72  |Nope, do another|
00001d30  20 63 68 61 6e 6e 65 6c  0d 08 a2 2b 4c 44 4d 46  | channel...+LDMF|
00001d40  44 20 52 31 33 21 2c 7b  52 39 7d 20 20 20 20 20  |D R13!,{R9}     |
00001d50  20 3b 20 47 65 74 20 6f  75 72 20 52 39 20 62 61  | ; Get our R9 ba|
00001d60  63 6b 21 0d 08 ac 30 4c  44 52 20 20 20 52 30 2c  |ck!...0LDR   R0,|
00001d70  6a 75 6d 70 66 6c 61 67  20 20 20 20 3b 20 53 6b  |jumpflag    ; Sk|
00001d80  69 70 20 72 65 73 74 20  6f 66 20 70 61 74 74 65  |ip rest of patte|
00001d90  72 6e 3f 0d 08 b6 1a 43  4d 50 20 20 20 52 30 2c  |rn?....CMP   R0,|
00001da0  23 30 20 20 20 20 20 20  20 20 20 20 3b 0d 08 c0  |#0          ;...|
00001db0  1e 4d 4f 56 4e 45 20 52  39 2c 23 36 33 20 20 20  |.MOVNE R9,#63   |
00001dc0  20 20 20 20 20 20 3b 20  59 65 70 0d 08 ca 29 4d  |      ; Yep...)M|
00001dd0  4f 56 4e 45 20 52 30 2c  23 30 20 20 20 20 20 20  |OVNE R0,#0      |
00001de0  20 20 20 20 3b 20 52 65  73 65 74 20 74 68 65 20  |    ; Reset the |
00001df0  66 6c 61 67 0d 08 d4 1a  53 54 52 4e 45 20 52 30  |flag....STRNE R0|
00001e00  2c 6a 75 6d 70 66 6c 61  67 20 20 20 20 3b 0d 08  |,jumpflag    ;..|
00001e10  de 34 41 44 44 20 20 20  52 39 2c 52 39 2c 23 31  |.4ADD   R9,R9,#1|
00001e20  20 20 20 20 20 20 20 3b  20 49 6e 63 72 65 6d 65  |       ; Increme|
00001e30  6e 74 20 73 65 71 75 65  6e 63 65 20 6e 75 6d 62  |nt sequence numb|
00001e40  65 72 0d 08 e8 2d 43 4d  50 20 20 20 52 39 2c 23  |er...-CMP   R9,#|
00001e50  36 34 20 20 20 20 20 20  20 20 20 3b 20 46 69 6e  |64         ; Fin|
00001e60  69 73 68 65 64 20 73 65  71 75 65 6e 63 65 3f 0d  |ished sequence?.|
00001e70  08 f2 43 42 4e 45 20 20  20 76 65 6e 64 20 20 20  |..CBNE   vend   |
00001e80  20 20 20 20 20 20 20 20  3b 20 49 66 20 6e 6f 74  |        ; If not|
00001e90  2c 20 64 6f 6e 27 74 20  67 6f 20 6f 6e 74 6f 20  |, don't go onto |
00001ea0  6e 65 78 74 20 70 61 74  74 65 72 6e 20 65 6e 74  |next pattern ent|
00001eb0  72 79 0d 08 fc 0f 4d 4f  56 20 20 20 52 39 2c 23  |ry....MOV   R9,#|
00001ec0  30 0d 09 06 31 41 44 44  20 20 20 52 37 2c 52 37  |0...1ADD   R7,R7|
00001ed0  2c 23 31 20 20 20 20 20  20 20 3b 20 49 6e 63 72  |,#1       ; Incr|
00001ee0  65 6d 65 6e 74 20 70 61  74 74 65 72 6e 20 70 6f  |ement pattern po|
00001ef0  73 6e 0d 09 10 27 43 4d  50 20 20 20 52 37 2c 52  |sn...'CMP   R7,R|
00001f00  38 20 20 20 20 20 20 20  20 20 20 3b 20 45 6e 64  |8          ; End|
00001f10  20 6f 66 20 73 6f 6e 67  3f 0d 09 1a 2f 4d 4f 56  | of song?.../MOV|
00001f20  47 54 20 52 37 2c 23 30  20 20 20 20 20 20 20 20  |GT R7,#0        |
00001f30  20 20 3b 20 2e 2e 2e 61  6e 64 20 61 67 61 69 6e  |  ; ...and again|
00001f40  2c 20 66 6f 6c 6b 73 21  0d 09 24 09 2e 76 65 6e  |, folks!..$..ven|
00001f50  64 0d 09 2e 11 41 44 52  20 20 20 52 30 2c 69 6e  |d....ADR   R0,in|
00001f60  66 6f 0d 09 38 2b 53 54  4d 49 41 20 52 30 2c 7b  |fo..8+STMIA R0,{|
00001f70  52 37 2d 52 39 7d 20 20  20 20 20 3b 20 53 74 6f  |R7-R9}     ; Sto|
00001f80  72 65 20 6e 65 77 20 76  61 6c 75 65 73 0d 09 42  |re new values..B|
00001f90  25 4c 44 4d 46 44 20 52  31 33 21 2c 7b 50 43 7d  |%LDMFD R13!,{PC}|
00001fa0  20 20 20 20 20 20 3b 20  41 6e 64 20 72 65 74 75  |      ; And retu|
00001fb0  72 6e 0d 09 4c 04 0d 09  56 31 2e 67 65 74 68 69  |rn..L...V1.gethi|
00001fc0  6c 6f 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |lo             ;|
00001fd0  20 47 65 74 73 20 48 69  2d 4c 6f 20 73 74 6f 72  | Gets Hi-Lo stor|
00001fe0  65 64 20 69 6e 66 6f 0d  09 60 2d 53 54 4d 46 44  |ed info..`-STMFD|
00001ff0  20 52 31 33 21 2c 7b 52  31 7d 20 20 20 20 20 20  | R13!,{R1}      |
00002000  3b 20 52 30 3d 61 64 64  72 65 73 73 20 6f 66 20  |; R0=address of |
00002010  69 6e 66 6f 0d 09 6a 28  4c 44 52 42 20 20 52 31  |info..j(LDRB  R1|
00002020  2c 5b 52 30 2c 23 30 5d  20 20 20 20 20 3b 20 47  |,[R0,#0]     ; G|
00002030  65 74 20 68 69 67 68 20  62 79 74 65 0d 09 74 26  |et high byte..t&|
00002040  4c 44 52 42 20 20 52 30  2c 5b 52 30 2c 23 31 5d  |LDRB  R0,[R0,#1]|
00002050  20 20 20 20 20 3b 20 47  65 74 20 6c 6f 20 62 79  |     ; Get lo by|
00002060  74 65 0d 09 7e 23 84 52  20 20 20 52 30 2c 52 30  |te..~#.R   R0,R0|
00002070  2c 52 31 2c 4c 53 4c 23  38 20 3b 20 4d 69 78 20  |,R1,LSL#8 ; Mix |
00002080  74 68 65 20 32 0d 09 88  25 4c 44 4d 46 44 20 52  |the 2...%LDMFD R|
00002090  31 33 21 2c 7b 52 31 7d  20 20 20 20 20 20 3b 20  |13!,{R1}      ; |
000020a0  72 65 73 74 6f 72 65 20  52 31 0d 09 92 21 4d 4f  |restore R1...!MO|
000020b0  56 20 20 20 50 43 2c 52  31 34 20 20 20 20 20 20  |V   PC,R14      |
000020c0  20 20 20 3b 20 72 65 74  75 72 6e 0d 09 9c 04 0d  |   ; return.....|
000020d0  09 a6 30 2e 65 66 66 65  63 74 63 68 65 63 6b 20  |..0.effectcheck |
000020e0  20 20 20 20 20 20 20 20  3b 20 43 68 65 63 6b 20  |        ; Check |
000020f0  66 6f 72 20 61 6e 79 20  65 66 66 65 63 74 73 0d  |for any effects.|
00002100  09 b0 23 4c 44 52 42 20  20 52 36 2c 5b 52 31 31  |..#LDRB  R6,[R11|
00002110  2c 23 33 5d 20 20 20 20  3b 20 47 65 74 20 69 6e  |,#3]    ; Get in|
00002120  66 6f 0d 09 ba 2c 4c 44  52 42 20 20 52 34 2c 5b  |fo...,LDRB  R4,[|
00002130  52 31 31 2c 23 32 5d 20  20 20 20 3b 20 47 65 74  |R11,#2]    ; Get|
00002140  20 65 66 66 65 63 74 20  6e 75 6e 62 65 72 0d 09  | effect nunber..|
00002150  c4 18 80 20 20 20 52 34  2c 52 34 2c 23 26 46 20  |...   R4,R4,#&F |
00002160  20 20 20 20 20 3b 0d 09  ce 29 43 4d 50 20 20 20  |     ;...)CMP   |
00002170  52 34 2c 23 26 43 20 20  20 20 20 20 20 20 20 3b  |R4,#&C         ;|
00002180  20 56 6f 6c 75 6d 65 20  63 68 61 6e 67 65 3f 0d  | Volume change?.|
00002190  09 d8 1d 42 4e 45 20 20  20 65 66 66 20 20 20 20  |...BNE   eff    |
000021a0  20 20 20 20 20 20 20 20  3b 20 4e 6f 0d 09 e2 20  |        ; No... |
000021b0  43 4d 50 20 20 20 52 36  2c 23 36 34 20 20 20 20  |CMP   R6,#64    |
000021c0  20 20 20 20 20 3b 20 4f  76 65 72 3f 0d 09 ec 22  |     ; Over?..."|
000021d0  4d 4f 56 47 45 20 52 36  2c 23 36 33 20 20 20 20  |MOVGE R6,#63    |
000021e0  20 20 20 20 20 3b 20 43  6f 72 72 65 63 74 0d 09  |     ; Correct..|
000021f0  f6 1a 41 44 52 20 20 20  52 31 2c 76 6f 6c 74 61  |..ADR   R1,volta|
00002200  62 20 20 20 20 20 20 3b  0d 0a 00 2a 4c 44 52 42  |b      ;...*LDRB|
00002210  20 20 52 30 2c 5b 52 31  2c 52 36 5d 20 20 20 20  |  R0,[R1,R6]    |
00002220  20 3b 20 47 65 74 20 72  69 67 68 74 20 75 6e 69  | ; Get right uni|
00002230  74 73 0d 0a 0a 2d 41 44  52 20 20 20 52 31 2c 6f  |ts...-ADR   R1,o|
00002240  75 72 69 6e 66 20 20 20  20 20 20 3b 20 46 69 6e  |urinf      ; Fin|
00002250  64 20 74 61 62 6c 65 20  61 64 64 72 65 73 73 0d  |d table address.|
00002260  0a 14 1a 41 44 44 20 20  20 52 31 2c 52 31 2c 52  |...ADD   R1,R1,R|
00002270  35 2c 4c 53 4c 23 35 20  3b 0d 0a 1e 2b 53 54 52  |5,LSL#5 ;...+STR|
00002280  20 20 20 52 30 2c 5b 52  31 2c 23 32 30 5d 20 20  |   R0,[R1,#20]  |
00002290  20 20 3b 20 53 74 6f 72  65 20 6e 65 77 20 76 6f  |  ; Store new vo|
000022a0  6c 75 6d 65 0d 0a 28 10  4d 4f 56 20 20 20 50 43  |lume..(.MOV   PC|
000022b0  2c 52 31 34 0d 0a 32 08  2e 65 66 66 0d 0a 3c 29  |,R14..2..eff..<)|
000022c0  43 4d 50 20 20 20 52 34  2c 23 26 44 20 20 20 20  |CMP   R4,#&D    |
000022d0  20 20 20 20 20 3b 20 50  61 74 74 65 72 6e 20 62  |     ; Pattern b|
000022e0  72 65 61 6b 3f 0d 0a 46  31 53 54 52 45 51 20 52  |reak?..F1STREQ R|
000022f0  34 2c 6a 75 6d 70 66 6c  61 67 20 20 20 20 3b 20  |4,jumpflag    ; |
00002300  4a 75 6d 70 20 74 6f 20  65 6e 64 20 6f 66 20 70  |Jump to end of p|
00002310  61 74 74 65 72 6e 0d 0a  50 17 ec 51 20 50 43 2c  |attern..P..Q PC,|
00002320  52 31 34 20 20 20 20 20  20 20 20 20 3b 0d 0a 5a  |R14         ;..Z|
00002330  28 43 4d 50 20 20 20 52  34 2c 23 26 46 20 20 20  |(CMP   R4,#&F   |
00002340  20 20 20 20 20 20 3b 20  43 68 61 6e 67 65 20 73  |      ; Change s|
00002350  70 65 65 64 3f 0d 0a 64  1d 42 4e 45 20 20 20 65  |peed?..d.BNE   e|
00002360  66 66 31 20 20 20 20 20  20 20 20 20 20 20 3b 20  |ff1           ; |
00002370  4e 6f 0d 0a 6e 27 80 20  20 20 52 36 2c 52 36 2c  |No..n'.   R6,R6,|
00002380  23 26 46 20 20 20 20 20  20 3b 20 4d 61 73 6b 20  |#&F      ; Mask |
00002390  6e 65 77 20 73 70 65 65  64 0d 0a 78 23 53 54 52  |new speed..x#STR|
000023a0  20 20 20 52 36 2c 73 70  65 65 64 20 20 20 20 20  |   R6,speed     |
000023b0  20 20 3b 20 53 74 6f 72  65 20 69 74 0d 0a 82 21  |  ; Store it...!|
000023c0  4d 4f 56 20 20 20 50 43  2c 52 31 34 20 20 20 20  |MOV   PC,R14    |
000023d0  20 20 20 20 20 3b 20 52  65 74 75 72 6e 0d 0a 8c  |     ; Return...|
000023e0  09 2e 65 66 66 31 0d 0a  96 29 43 4d 50 20 20 20  |..eff1...)CMP   |
000023f0  52 34 2c 23 31 20 20 20  20 20 20 20 20 20 20 3b  |R4,#1          ;|
00002400  20 50 6f 72 74 61 6d 65  6e 74 6f 20 75 70 3f 0d  | Portamento up?.|
00002410  0a a0 1f 42 4c 54 20 20  20 65 66 66 32 20 20 20  |...BLT   eff2   |
00002420  20 20 20 20 20 20 20 20  3b 20 4e 6f 70 65 0d 0a  |        ; Nope..|
00002430  aa 23 43 4d 50 20 20 20  52 34 2c 23 32 20 20 20  |.#CMP   R4,#2   |
00002440  20 20 20 20 20 20 20 3b  20 4f 72 20 64 6f 77 6e  |       ; Or down|
00002450  3f 0d 0a b4 1f 42 47 54  20 20 20 65 66 66 32 20  |?....BGT   eff2 |
00002460  20 20 20 20 20 20 20 20  20 20 3b 20 4e 6f 70 65  |          ; Nope|
00002470  0d 0a be 27 84 52 20 20  20 52 36 2c 52 36 2c 52  |...'.R   R6,R6,R|
00002480  34 2c 4c 53 4c 23 38 20  3b 20 4d 61 6b 65 20 6e  |4,LSL#8 ; Make n|
00002490  65 77 20 77 6f 72 64 0d  0a c8 22 41 44 52 20 20  |ew word..."ADR  |
000024a0  20 52 33 2c 65 66 66 65  63 74 74 79 70 65 20 20  | R3,effecttype  |
000024b0  3b 20 53 61 76 65 20 69  74 0d 0a d2 1c 53 54 52  |; Save it....STR|
000024c0  20 20 20 52 36 2c 5b 52  33 2c 52 35 2c 4c 53 4c  |   R6,[R3,R5,LSL|
000024d0  23 32 5d 20 3b 0d 0a dc  21 4d 4f 56 20 20 20 50  |#2] ;...!MOV   P|
000024e0  43 2c 52 31 34 20 20 20  20 20 20 20 20 20 3b 20  |C,R14         ; |
000024f0  52 65 74 75 72 6e 0d 0a  e6 09 2e 65 66 66 32 0d  |Return.....eff2.|
00002500  0a f0 21 4d 4f 56 20 20  20 50 43 2c 52 31 34 20  |..!MOV   PC,R14 |
00002510  20 20 20 20 20 20 20 20  3b 20 52 65 74 75 72 6e  |        ; Return|
00002520  0d 0a fa 04 0d 0b 04 4c  2e 64 6f 65 66 66 65 63  |.......L.doeffec|
00002530  74 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 44  |t            ; D|
00002540  6f 20 65 66 66 65 63 74  20 64 65 74 61 69 6c 65  |o effect detaile|
00002550  64 20 69 6e 20 27 65 66  66 65 63 74 74 79 70 65  |d in 'effecttype|
00002560  27 20 28 52 31 3d 73 75  62 6e 6f 74 65 20 23 29  |' (R1=subnote #)|
00002570  0d 0b 0e 25 4d 4f 56 20  20 20 52 35 2c 23 33 20  |...%MOV   R5,#3 |
00002580  20 20 20 20 20 20 20 20  20 3b 20 34 20 63 68 61  |         ; 4 cha|
00002590  6e 6e 65 6c 73 0d 0b 18  25 41 44 52 20 20 20 52  |nnels...%ADR   R|
000025a0  32 2c 63 68 61 6e 6e 65  6c 6e 6f 74 65 20 3b 20  |2,channelnote ; |
000025b0  41 6d 69 67 61 2d 6e 6f  74 65 0d 0b 22 2e 41 44  |Amiga-note..".AD|
000025c0  52 20 20 20 52 33 2c 65  66 66 65 63 74 74 79 70  |R   R3,effecttyp|
000025d0  65 20 20 3b 20 52 33 3d  65 66 66 65 63 74 74 79  |e  ; R3=effectty|
000025e0  70 65 20 74 61 62 6c 65  0d 0b 2c 39 41 44 52 20  |pe table..,9ADR |
000025f0  20 20 52 34 2c 69 6e 76  65 72 73 65 74 61 62 6c  |  R4,inversetabl|
00002600  65 20 3b 20 52 34 3d 69  6e 76 65 72 73 65 20 70  |e ; R4=inverse p|
00002610  69 74 63 68 20 6c 6f 6f  6b 75 70 20 74 61 62 6c  |itch lookup tabl|
00002620  65 0d 0b 36 0b 2e 64 6f  65 66 66 31 0d 0b 40 47  |e..6..doeff1..@G|
00002630  41 44 52 20 20 20 52 38  2c 6f 75 72 69 6e 66 20  |ADR   R8,ourinf |
00002640  20 20 20 20 20 3b 20 43  61 6c 63 75 6c 61 74 65  |     ; Calculate|
00002650  20 61 64 64 72 65 73 73  20 6f 66 66 73 65 74 20  | address offset |
00002660  6f 66 20 76 6f 69 63 65  2d 69 6e 66 6f 20 74 61  |of voice-info ta|
00002670  62 6c 65 0d 0b 4a 1a 41  44 44 20 20 20 52 38 2c  |ble..J.ADD   R8,|
00002680  52 38 2c 52 35 2c 4c 53  4c 23 35 20 3b 0d 0b 54  |R8,R5,LSL#5 ;..T|
00002690  2e 4c 44 52 20 20 20 52  30 2c 5b 52 33 2c 52 35  |.LDR   R0,[R3,R5|
000026a0  2c 4c 53 4c 23 32 5d 20  3b 20 41 6e 79 20 65 66  |,LSL#2] ; Any ef|
000026b0  66 65 63 74 20 74 6f 20  64 6f 3f 0d 0b 5e 1a 43  |fect to do?..^.C|
000026c0  4d 50 20 20 20 52 30 2c  23 30 20 20 20 20 20 20  |MP   R0,#0      |
000026d0  20 20 20 20 3b 0d 0b 68  1f 42 45 51 20 20 20 64  |    ;..h.BEQ   d|
000026e0  6f 65 66 66 6e 65 78 74  20 20 20 20 20 20 3b 20  |oeffnext      ; |
000026f0  4e 6f 70 65 0d 0b 72 27  80 20 20 20 52 36 2c 52  |Nope..r'.   R6,R|
00002700  30 2c 23 26 46 30 30 20  20 20 20 3b 20 52 36 3d  |0,#&F00    ; R6=|
00002710  65 66 66 65 63 74 20 74  79 70 65 0d 0b 7c 27 80  |effect type..|'.|
00002720  20 20 20 52 30 2c 52 30  2c 23 26 46 46 20 20 20  |   R0,R0,#&FF   |
00002730  20 20 3b 20 52 30 3d 65  66 66 65 63 74 20 64 61  |  ; R0=effect da|
00002740  74 61 0d 0b 86 04 0d 0b  90 29 43 4d 50 20 20 20  |ta.......)CMP   |
00002750  52 36 2c 23 26 31 30 30  20 20 20 20 20 20 20 3b  |R6,#&100       ;|
00002760  20 50 6f 72 74 61 6d 65  6e 74 6f 20 75 70 3f 0d  | Portamento up?.|
00002770  0b 9a 1d 42 4e 45 20 20  20 64 6f 65 31 20 20 20  |...BNE   doe1   |
00002780  20 20 20 20 20 20 20 20  3b 20 4e 6f 0d 0b a4 2d  |        ; No...-|
00002790  4c 44 52 20 20 20 52 36  2c 5b 52 32 2c 52 35 2c  |LDR   R6,[R2,R5,|
000027a0  4c 53 4c 23 32 5d 20 3b  20 47 65 74 20 63 75 72  |LSL#2] ; Get cur|
000027b0  72 65 6e 74 20 74 6f 6e  65 0d 0b ae 23 53 55 42  |rent tone...#SUB|
000027c0  20 20 20 52 30 2c 52 30  2c 23 31 20 20 20 20 20  |   R0,R0,#1     |
000027d0  20 20 3b 20 53 6c 69 64  65 20 75 70 0d 0b b8 12  |  ; Slide up....|
000027e0  53 55 42 20 20 20 52 36  2c 52 36 2c 52 30 0d 0b  |SUB   R6,R6,R0..|
000027f0  c2 24 53 54 52 20 20 20  52 36 2c 5b 52 32 2c 52  |.$STR   R6,[R2,R|
00002800  35 2c 4c 53 4c 23 32 5d  20 3b 20 52 65 2d 73 61  |5,LSL#2] ; Re-sa|
00002810  76 65 0d 0b cc 35 4c 44  52 20 20 20 52 36 2c 5b  |ve...5LDR   R6,[|
00002820  52 34 2c 52 36 2c 4c 53  4c 23 32 5d 20 3b 20 47  |R4,R6,LSL#2] ; G|
00002830  65 74 20 61 72 63 68 69  6d 65 64 65 73 2d 66 72  |et archimedes-fr|
00002840  65 71 75 65 6e 63 79 0d  0b d6 31 53 54 52 20 20  |equency...1STR  |
00002850  20 52 36 2c 5b 52 38 2c  23 34 5d 20 20 20 20 20  | R6,[R8,#4]     |
00002860  3b 20 50 75 74 20 69 6e  20 70 61 72 61 6d 65 74  |; Put in paramet|
00002870  65 72 20 62 6c 6f 63 6b  0d 0b e0 13 42 20 20 20  |er block....B   |
00002880  20 20 64 6f 65 66 66 6e  65 78 74 0d 0b ea 04 0d  |  doeffnext.....|
00002890  0b f4 09 2e 64 6f 65 31  0d 0b fe 2b 43 4d 50 20  |....doe1...+CMP |
000028a0  20 20 52 36 2c 23 26 32  30 30 20 20 20 20 20 20  |  R6,#&200      |
000028b0  20 3b 20 50 6f 72 74 61  6d 65 6e 74 6f 20 64 6f  | ; Portamento do|
000028c0  77 6e 3f 0d 0c 08 1d 42  4e 45 20 20 20 64 6f 65  |wn?....BNE   doe|
000028d0  32 20 20 20 20 20 20 20  20 20 20 20 3b 20 4e 6f  |2           ; No|
000028e0  0d 0c 12 2d 4c 44 52 20  20 20 52 36 2c 5b 52 32  |...-LDR   R6,[R2|
000028f0  2c 52 35 2c 4c 53 4c 23  32 5d 20 3b 20 47 65 74  |,R5,LSL#2] ; Get|
00002900  20 63 75 72 72 65 6e 74  20 74 6f 6e 65 0d 0c 1c  | current tone...|
00002910  25 53 55 42 20 20 20 52  30 2c 52 30 2c 23 31 20  |%SUB   R0,R0,#1 |
00002920  20 20 20 20 20 20 3b 20  53 6c 69 64 65 20 64 6f  |      ; Slide do|
00002930  77 6e 0d 0c 26 12 41 44  44 20 20 20 52 36 2c 52  |wn..&.ADD   R6,R|
00002940  36 2c 52 30 0d 0c 30 24  53 54 52 20 20 20 52 36  |6,R0..0$STR   R6|
00002950  2c 5b 52 32 2c 52 35 2c  4c 53 4c 23 32 5d 20 3b  |,[R2,R5,LSL#2] ;|
00002960  20 52 65 2d 73 61 76 65  0d 0c 3a 35 4c 44 52 20  | Re-save..:5LDR |
00002970  20 20 52 36 2c 5b 52 34  2c 52 36 2c 4c 53 4c 23  |  R6,[R4,R6,LSL#|
00002980  32 5d 20 3b 20 47 65 74  20 61 72 63 68 69 6d 65  |2] ; Get archime|
00002990  64 65 73 2d 66 72 65 71  75 65 6e 63 79 0d 0c 44  |des-frequency..D|
000029a0  31 53 54 52 20 20 20 52  36 2c 5b 52 38 2c 23 34  |1STR   R6,[R8,#4|
000029b0  5d 20 20 20 20 20 3b 20  50 75 74 20 69 6e 20 70  |]     ; Put in p|
000029c0  61 72 61 6d 65 74 65 72  20 62 6c 6f 63 6b 0d 0c  |arameter block..|
000029d0  4e 13 42 20 20 20 20 20  64 6f 65 66 66 6e 65 78  |N.B     doeffnex|
000029e0  74 0d 0c 58 09 2e 64 6f  65 32 0d 0c 62 0e 2e 64  |t..X..doe2..b..d|
000029f0  6f 65 66 66 6e 65 78 74  0d 0c 6c 27 53 55 42 53  |oeffnext..l'SUBS|
00002a00  20 20 52 35 2c 52 35 2c  23 31 20 20 20 20 20 20  |  R5,R5,#1      |
00002a10  20 3b 20 4e 65 78 74 20  63 68 61 6e 6e 65 6c 0d  | ; Next channel.|
00002a20  0c 76 1a 42 50 4c 20 20  20 64 6f 65 66 66 31 20  |.v.BPL   doeff1 |
00002a30  20 20 20 20 20 20 20 20  3b 0d 0c 80 2a 4d 4f 56  |        ;...*MOV|
00002a40  20 20 20 50 43 2c 52 31  34 20 20 20 20 20 20 20  |   PC,R14       |
00002a50  20 20 3b 20 4e 6f 20 6d  6f 72 65 2c 20 72 65 74  |  ; No more, ret|
00002a60  75 72 6e 0d 0c 8a 04 0d  0c 94 0d 2e 6a 75 6d 70  |urn.........jump|
00002a70  66 6c 61 67 0d 0c 9e 3d  45 51 55 44 20 30 20 20  |flag...=EQUD 0  |
00002a80  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 3c  |             ; <|
00002a90  3e 30 20 69 66 20 70 61  74 74 65 72 6e 20 69 73  |>0 if pattern is|
00002aa0  20 74 6f 20 62 65 20 74  65 72 6d 69 6e 61 74 65  | to be terminate|
00002ab0  64 0d 0c a8 04 0d 0c b2  0b 2e 6f 6c 64 76 6f 78  |d.........oldvox|
00002ac0  0d 0c bc 33 45 51 55 44  20 30 20 20 20 20 20 20  |...3EQUD 0      |
00002ad0  20 20 20 20 20 20 20 20  20 3b 20 53 6f 20 77 65  |         ; So we|
00002ae0  20 63 61 6e 20 6b 69 6c  6c 20 74 68 65 20 76 6f  | can kill the vo|
00002af0  69 63 65 0d 0c c6 04 0d  0c d0 32 2e 73 61 6d 70  |ice.......2.samp|
00002b00  6c 65 6c 6f 63 20 20 20  20 20 20 20 20 20 20 20  |leloc           |
00002b10  3b 20 54 61 62 6c 65 20  6f 66 20 73 61 6d 70 6c  |; Table of sampl|
00002b20  65 20 6f 66 66 73 65 74  73 0d 0c da 1f 45 51 55  |e offsets....EQU|
00002b30  44 20 30 3a 45 51 55 44  20 30 3a 45 51 55 44 20  |D 0:EQUD 0:EQUD |
00002b40  30 3a 45 51 55 44 20 30  0d 0c e4 1f 45 51 55 44  |0:EQUD 0....EQUD|
00002b50  20 30 3a 45 51 55 44 20  30 3a 45 51 55 44 20 30  | 0:EQUD 0:EQUD 0|
00002b60  3a 45 51 55 44 20 30 0d  0c ee 1f 45 51 55 44 20  |:EQUD 0....EQUD |
00002b70  30 3a 45 51 55 44 20 30  3a 45 51 55 44 20 30 3a  |0:EQUD 0:EQUD 0:|
00002b80  45 51 55 44 20 30 0d 0c  f8 1f 45 51 55 44 20 30  |EQUD 0....EQUD 0|
00002b90  3a 45 51 55 44 20 30 3a  45 51 55 44 20 30 3a 45  |:EQUD 0:EQUD 0:E|
00002ba0  51 55 44 20 30 0d 0d 02  04 0d 0d 0c 2f 2e 76 6f  |QUD 0......./.vo|
00002bb0  6c 74 61 62 20 20 20 20  20 20 20 20 20 20 20 20  |ltab            |
00002bc0  20 20 3b 20 36 34 2d 62  79 74 65 20 76 6f 6c 75  |  ; 64-byte volu|
00002bd0  6d 65 20 74 61 62 6c 65  0d 0d 16 13 5d 3a 50 25  |me table....]:P%|
00002be0  2b 3d 36 34 3a 5b 4f 50  54 20 43 0d 0d 20 04 0d  |+=64:[OPT C.. ..|
00002bf0  0d 2a 29 2e 69 6e 73 74  61 6c 6c 73 6f 75 6e 64  |.*).installsound|
00002c00  20 20 20 20 20 20 20 20  3b 20 49 6e 73 74 61 6c  |        ; Instal|
00002c10  6c 20 76 6f 69 63 65 73  0d 0d 34 1b 53 54 4d 46  |l voices..4.STMF|
00002c20  44 20 52 31 33 21 2c 7b  52 30 2d 52 31 30 2c 52  |D R13!,{R0-R10,R|
00002c30  31 34 7d 0d 0d 3e 32 41  44 52 20 20 20 52 30 2c  |14}..>2ADR   R0,|
00002c40  56 6f 69 63 65 42 61 73  65 20 20 20 3b 20 4d 61  |VoiceBase   ; Ma|
00002c50  6b 65 20 54 72 61 63 6b  65 72 56 6f 78 20 61 20  |ke TrackerVox a |
00002c60  76 6f 69 63 65 0d 0d 48  0f 4d 4f 56 20 20 20 52  |voice..H.MOV   R|
00002c70  31 2c 23 30 0d 0d 52 1e  53 57 49 20 20 20 22 53  |1,#0..R.SWI   "S|
00002c80  6f 75 6e 64 5f 49 6e 73  74 61 6c 6c 56 6f 69 63  |ound_InstallVoic|
00002c90  65 22 0d 0d 5c 2c 53 54  52 20 20 20 52 31 2c 6f  |e"..\,STR   R1,o|
00002ca0  6c 64 76 6f 78 20 20 20  20 20 20 3b 20 53 6f 20  |ldvox      ; So |
00002cb0  77 65 20 63 61 6e 20 6b  69 6c 6c 20 69 74 0d 0d  |we can kill it..|
00002cc0  66 2a 4d 4f 56 20 20 20  52 31 30 2c 23 31 20 20  |f*MOV   R10,#1  |
00002cd0  20 20 20 20 20 20 20 3b  20 4d 75 74 65 20 76 6f  |       ; Mute vo|
00002ce0  69 63 65 73 20 31 2d 38  0d 0d 70 0b 2e 6d 75 74  |ices 1-8..p..mut|
00002cf0  65 6c 70 0d 0d 7a 10 4d  4f 56 20 20 20 52 30 2c  |elp..z.MOV   R0,|
00002d00  52 31 30 0d 0d 84 0f 4d  4f 56 20 20 20 52 31 2c  |R10....MOV   R1,|
00002d10  23 30 0d 0d 8e 1d 53 57  49 20 20 20 22 53 6f 75  |#0....SWI   "Sou|
00002d20  6e 64 5f 41 74 74 61 63  68 56 6f 69 63 65 22 0d  |nd_AttachVoice".|
00002d30  0d 98 14 41 44 44 20 20  20 52 31 30 2c 52 31 30  |...ADD   R10,R10|
00002d40  2c 23 31 0d 0d a2 10 43  4d 50 20 20 20 52 31 30  |,#1....CMP   R10|
00002d50  2c 23 39 0d 0d ac 10 42  4e 45 20 20 20 6d 75 74  |,#9....BNE   mut|
00002d60  65 6c 70 0d 0d b6 10 4d  4f 56 20 20 20 52 31 30  |elp....MOV   R10|
00002d70  2c 23 31 0d 0d c0 3a 2e  61 74 74 6c 70 20 20 20  |,#1...:.attlp   |
00002d80  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 41 74  |            ; At|
00002d90  74 61 63 68 20 76 6f 69  63 65 73 20 31 2d 34 20  |tach voices 1-4 |
00002da0  74 6f 20 54 72 61 63 6b  65 72 56 6f 78 0d 0d ca  |to TrackerVox...|
00002db0  10 4d 4f 56 20 20 20 52  30 2c 52 31 30 0d 0d d4  |.MOV   R0,R10...|
00002dc0  16 41 44 52 20 20 20 52  31 2c 56 6f 69 63 65 4e  |.ADR   R1,VoiceN|
00002dd0  61 6d 65 0d 0d de 22 53  57 49 20 20 20 22 53 6f  |ame..."SWI   "So|
00002de0  75 6e 64 5f 41 74 74 61  63 68 4e 61 6d 65 64 56  |und_AttachNamedV|
00002df0  6f 69 63 65 22 0d 0d e8  14 41 44 44 20 20 20 52  |oice"....ADD   R|
00002e00  31 30 2c 52 31 30 2c 23  31 0d 0d f2 10 43 4d 50  |10,R10,#1....CMP|
00002e10  20 20 20 52 31 30 2c 23  35 0d 0d fc 0f 42 4e 45  |   R10,#5....BNE|
00002e20  20 20 20 61 74 74 6c 70  0d 0e 06 04 0d 0e 10 3a  |   attlp.......:|
00002e30  4d 4f 56 20 20 20 52 30  2c 23 31 20 20 20 20 20  |MOV   R0,#1     |
00002e40  20 20 20 20 20 3b 20 53  6c 69 67 68 74 20 72 69  |     ; Slight ri|
00002e50  67 68 74 20 62 69 61 73  20 66 6f 72 20 63 68 61  |ght bias for cha|
00002e60  6e 6e 65 6c 20 31 0d 0e  1a 10 4d 4f 56 20 20 20  |nnel 1....MOV   |
00002e70  52 31 2c 23 31 36 0d 0e  24 18 53 57 49 20 20 20  |R1,#16..$.SWI   |
00002e80  22 53 6f 75 6e 64 5f 53  74 65 72 65 6f 22 0d 0e  |"Sound_Stereo"..|
00002e90  2e 39 4d 4f 56 20 20 20  52 30 2c 23 32 20 20 20  |.9MOV   R0,#2   |
00002ea0  20 20 20 20 20 20 20 3b  20 53 6c 69 67 68 74 20  |       ; Slight |
00002eb0  6c 65 66 74 20 62 69 61  73 20 66 6f 72 20 63 68  |left bias for ch|
00002ec0  61 6e 6e 65 6c 20 32 0d  0e 38 10 4d 56 4e 20 20  |annel 2..8.MVN  |
00002ed0  20 52 31 2c 23 31 35 0d  0e 42 18 53 57 49 20 20  | R1,#15..B.SWI  |
00002ee0  20 22 53 6f 75 6e 64 5f  53 74 65 72 65 6f 22 0d  | "Sound_Stereo".|
00002ef0  0e 4c 3e 4d 4f 56 20 20  20 52 30 2c 23 33 20 20  |.L>MOV   R0,#3  |
00002f00  20 20 20 20 20 20 20 20  3b 20 61 6e 64 20 66 6f  |        ; and fo|
00002f10  72 20 63 68 61 6e 6e 65  6c 20 33 20 28 41 6d 69  |r channel 3 (Ami|
00002f20  67 61 20 67 6f 65 73 20  52 4c 4c 52 29 0d 0e 56  |ga goes RLLR)..V|
00002f30  10 4d 56 4e 20 20 20 52  31 2c 23 31 35 0d 0e 60  |.MVN   R1,#15..`|
00002f40  18 53 57 49 20 20 20 22  53 6f 75 6e 64 5f 53 74  |.SWI   "Sound_St|
00002f50  65 72 65 6f 22 0d 0e 6a  38 4d 4f 56 20 20 20 52  |ereo"..j8MOV   R|
00002f60  30 2c 23 34 20 20 20 20  20 20 20 20 20 20 3b 20  |0,#4          ; |
00002f70  41 6e 64 20 72 69 67 68  74 20 63 67 61 69 6e 20  |And right cgain |
00002f80  66 6f 72 20 63 68 61 6e  6e 65 6c 20 34 0d 0e 74  |for channel 4..t|
00002f90  10 4d 4f 56 20 20 20 52  31 2c 23 31 36 0d 0e 7e  |.MOV   R1,#16..~|
00002fa0  18 53 57 49 20 20 20 22  53 6f 75 6e 64 5f 53 74  |.SWI   "Sound_St|
00002fb0  65 72 65 6f 22 0d 0e 88  04 0d 0e 92 28 4d 4f 56  |ereo".......(MOV|
00002fc0  20 20 20 52 30 2c 23 34  20 20 20 20 20 20 20 20  |   R0,#4        |
00002fd0  20 20 3b 20 50 6c 61 79  20 34 20 76 6f 69 63 65  |  ; Play 4 voice|
00002fe0  73 0d 0e 9c 2e 4d 4f 56  20 20 20 52 31 2c 23 32  |s....MOV   R1,#2|
00002ff0  30 38 20 20 20 20 20 20  20 20 3b 20 42 75 66 66  |08        ; Buff|
00003000  65 72 20 6c 65 6e 67 74  68 20 3d 20 32 30 30 0d  |er length = 200.|
00003010  0e a6 35 4d 4f 56 20 20  20 52 32 2c 23 75 73 20  |..5MOV   R2,#us |
00003020  20 20 20 20 20 20 20 20  3b 20 46 6f 72 20 74 68  |        ; For th|
00003030  69 73 20 6d 61 6e 79 20  6d 69 63 72 6f 73 65 63  |is many microsec|
00003040  6f 6e 64 73 0d 0e b0 32  4d 4f 56 20 20 20 52 33  |onds...2MOV   R3|
00003050  2c 23 30 20 20 20 20 20  20 20 20 20 20 3b 20 4c  |,#0          ; L|
00003060  65 61 76 65 20 74 68 65  73 65 20 32 20 75 6e 63  |eave these 2 unc|
00003070  68 61 6e 67 65 64 0d 0e  ba 0f 4d 4f 56 20 20 20  |hanged....MOV   |
00003080  52 34 2c 23 30 0d 0e c4  1b 53 57 49 20 20 20 22  |R4,#0....SWI   "|
00003090  53 6f 75 6e 64 5f 43 6f  6e 66 69 67 75 72 65 22  |Sound_Configure"|
000030a0  0d 0e ce 04 0d 0e d8 44  4d 4f 56 20 20 20 52 30  |.......DMOV   R0|
000030b0  2c 23 31 20 20 20 20 20  20 20 20 20 20 3b 20 53  |,#1          ; S|
000030c0  6f 75 6e 64 20 61 6c 6c  20 34 20 76 6f 69 63 65  |ound all 4 voice|
000030d0  73 2c 20 70 61 72 61 6d  65 74 65 72 73 20 61 72  |s, parameters ar|
000030e0  65 20 72 65 61 6c 6c 79  0d 0e e2 25 4d 56 4e 20  |e really...%MVN |
000030f0  20 20 52 31 2c 23 31 34  20 20 20 20 20 20 20 20  |  R1,#14        |
00003100  20 3b 20 69 6d 6d 61 74  65 72 69 61 6c 0d 0e ec  | ; immaterial...|
00003110  11 4d 4f 56 20 20 20 52  32 2c 23 31 30 30 0d 0e  |.MOV   R2,#100..|
00003120  f6 11 4d 4f 56 20 20 20  52 33 2c 23 32 35 35 0d  |..MOV   R3,#255.|
00003130  0f 00 19 53 57 49 20 20  20 22 53 6f 75 6e 64 5f  |...SWI   "Sound_|
00003140  43 6f 6e 74 72 6f 6c 22  0d 0f 0a 0f 4d 4f 56 20  |Control"....MOV |
00003150  20 20 52 30 2c 23 32 0d  0f 14 19 53 57 49 20 20  |  R0,#2....SWI  |
00003160  20 22 53 6f 75 6e 64 5f  43 6f 6e 74 72 6f 6c 22  | "Sound_Control"|
00003170  0d 0f 1e 0f 4d 4f 56 20  20 20 52 30 2c 23 33 0d  |....MOV   R0,#3.|
00003180  0f 28 19 53 57 49 20 20  20 22 53 6f 75 6e 64 5f  |.(.SWI   "Sound_|
00003190  43 6f 6e 74 72 6f 6c 22  0d 0f 32 0f 4d 4f 56 20  |Control"..2.MOV |
000031a0  20 20 52 30 2c 23 34 0d  0f 3c 19 53 57 49 20 20  |  R0,#4..<.SWI  |
000031b0  20 22 53 6f 75 6e 64 5f  43 6f 6e 74 72 6f 6c 22  | "Sound_Control"|
000031c0  0d 0f 46 25 4c 44 4d 46  44 20 52 31 33 21 2c 7b  |..F%LDMFD R13!,{|
000031d0  52 30 2d 52 31 30 2c 50  43 7d 20 3b 20 26 20 52  |R0-R10,PC} ; & R|
000031e0  65 74 75 72 6e 0d 0f 50  04 0d 0f 5a 30 20 20 20  |eturn..P...Z0   |
000031f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003200  20 20 3b 20 56 6f 69 63  65 20 70 61 72 61 6d 65  |  ; Voice parame|
00003210  74 65 72 20 62 6c 6f 63  6b 0d 0f 64 7c 2e 56 6f  |ter block..d|.Vo|
00003220  69 63 65 42 61 73 65 20  42 20 46 69 6c 6c 3a 42  |iceBase B Fill:B|
00003230  20 46 69 6c 6c 3a 42 20  46 69 6c 6c 3a 4c 44 4d  | Fill:B Fill:LDM|
00003240  46 44 20 52 31 33 21 2c  7b 50 43 7d 3a 4c 44 4d  |FD R13!,{PC}:LDM|
*
00003270  46 44 20 52 31 33 21 2c  7b 50 43 7d 3a 45 51 55  |FD R13!,{PC}:EQU|
00003280  44 20 56 6f 69 63 65 4e  61 6d 65 2d 56 6f 69 63  |D VoiceName-Voic|
00003290  65 42 61 73 65 0d 0f 6e  2c 2e 56 6f 69 63 65 4e  |eBase..n,.VoiceN|
000032a0  61 6d 65 20 45 51 55 53  22 54 72 61 63 6b 65 72  |ame EQUS"Tracker|
000032b0  56 6f 78 22 3a 45 51 55  42 20 30 3a 41 4c 49 47  |Vox":EQUB 0:ALIG|
000032c0  4e 0d 0f 78 04 0d 0f 82  26 2e 6b 69 6c 6c 73 6f  |N..x....&.killso|
000032d0  75 6e 64 20 20 20 20 20  20 20 20 20 20 20 3b 20  |und           ; |
000032e0  4b 69 6c 6c 20 76 6f 69  63 65 73 0d 0f 8c 1b 53  |Kill voices....S|
000032f0  54 4d 46 44 20 52 31 33  21 2c 7b 52 30 2d 52 31  |TMFD R13!,{R0-R1|
00003300  30 2c 52 31 34 7d 0d 0f  96 30 4d 4f 56 20 52 30  |0,R14}...0MOV R0|
00003310  2c 23 30 20 20 20 20 20  20 20 20 20 20 20 20 3b  |,#0            ;|
00003320  20 44 65 2d 69 6e 73 74  61 6c 6c 20 54 72 61 63  | De-install Trac|
00003330  6b 65 72 56 6f 78 0d 0f  a0 11 4c 44 52 20 52 31  |kerVox....LDR R1|
00003340  2c 6f 6c 64 76 6f 78 0d  0f aa 1b 53 57 49 20 22  |,oldvox....SWI "|
00003350  53 6f 75 6e 64 5f 52 65  6d 6f 76 65 56 6f 69 63  |Sound_RemoveVoic|
00003360  65 22 0d 0f b4 04 0d 0f  be 2c 4d 4f 56 20 52 31  |e".......,MOV R1|
00003370  30 2c 23 31 20 20 20 20  20 20 20 20 20 20 20 3b  |0,#1           ;|
00003380  20 4b 69 6c 6c 20 74 68  65 20 34 20 76 6f 69 63  | Kill the 4 voic|
00003390  65 73 0d 0f c8 08 2e 6b  73 6c 0d 0f d2 0e 4d 4f  |es.....ksl....MO|
000033a0  56 20 52 30 2c 52 31 30  0d 0f dc 0d 4d 4f 56 20  |V R0,R10....MOV |
000033b0  52 31 2c 23 30 0d 0f e6  1b 53 57 49 20 22 53 6f  |R1,#0....SWI "So|
000033c0  75 6e 64 5f 41 74 74 61  63 68 56 6f 69 63 65 22  |und_AttachVoice"|
000033d0  0d 0f f0 12 41 44 44 20  52 31 30 2c 52 31 30 2c  |....ADD R10,R10,|
000033e0  23 31 0d 0f fa 0e 43 4d  50 20 52 31 30 2c 23 35  |#1....CMP R10,#5|
000033f0  0d 10 04 0b 42 4e 45 20  6b 73 6c 0d 10 0e 23 4c  |....BNE ksl...#L|
00003400  44 4d 46 44 20 52 31 33  21 2c 7b 52 30 2d 52 31  |DMFD R13!,{R0-R1|
00003410  30 2c 50 43 7d 20 3b 20  52 65 74 75 72 6e 0d 10  |0,PC} ; Return..|
00003420  18 04 0d 10 22 11 2e 69  6e 76 65 72 73 65 74 61  |...."..inverseta|
00003430  62 6c 65 0d 10 2c 27 3b  45 51 55 44 20 31 3a 20  |ble..,';EQUD 1: |
00003440  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 44 75  |            ; Du|
00003450  6d 6d 79 20 76 61 6c 75  65 21 0d 10 36 15 5d 3a  |mmy value!..6.]:|
00003460  50 25 2b 3d 34 30 39 36  3a 5b 4f 50 54 20 43 0d  |P%+=4096:[OPT C.|
00003470  10 40 34 2e 74 72 61 63  6b 61 64 72 20 20 20 20  |.@4.trackadr    |
00003480  20 20 20 20 20 20 20 20  3b 20 47 65 74 20 61 64  |        ; Get ad|
00003490  64 72 65 73 73 20 6f 66  20 74 72 61 63 6b 20 62  |dress of track b|
000034a0  61 73 65 0d 10 4a 11 41  44 52 20 52 31 30 2c 74  |ase..J.ADR R10,t|
000034b0  72 61 63 6b 0d 10 54 0e  4d 4f 56 20 50 43 2c 52  |rack..T.MOV PC,R|
000034c0  31 34 0d 10 5e 25 2e 74  72 61 63 6b 20 20 20 20  |14..^%.track    |
000034d0  20 20 20 20 20 20 20 20  20 20 20 3b 20 54 72 61  |           ; Tra|
000034e0  63 6b 20 62 61 73 65 0d  10 68 28 5d 3a 50 25 2b  |ck base..h(]:P%+|
000034f0  3d 74 6c 65 6e 25 3a 5b  4f 50 54 20 43 20 20 20  |=tlen%:[OPT C   |
00003500  3b 20 49 73 20 74 6c 65  6e 25 20 6c 6f 6e 67 0d  |; Is tlen% long.|
00003510  10 72 04 0d 10 7c 09 41  4c 49 47 4e 0d 10 86 0c  |.r...|.ALIGN....|
00003520  2e 63 6f 6e 76 65 72 74  0d 10 90 16 53 54 4d 46  |.convert....STMF|
00003530  44 20 52 31 33 21 2c 7b  52 30 2d 52 34 7d 0d 10  |D R13!,{R0-R4}..|
00003540  9a 1b 41 44 52 20 52 32  2c 6c 74 61 62 6c 65 3a  |..ADR R2,ltable:|
00003550  4d 4f 56 20 52 33 2c 23  30 0d 10 a4 09 2e 6c 6f  |MOV R3,#0.....lo|
00003560  6f 70 0d 10 ae 40 4c 44  52 42 20 52 34 2c 5b 52  |op...@LDRB R4,[R|
00003570  30 2c 52 33 5d 3a 82 20  52 34 2c 52 34 2c 23 31  |0,R3]:. R4,R4,#1|
00003580  32 38 3a 4c 44 52 42 20  52 34 2c 5b 52 32 2c 52  |28:LDRB R4,[R2,R|
00003590  34 5d 3a 53 54 52 42 20  52 34 2c 5b 52 30 2c 52  |4]:STRB R4,[R0,R|
000035a0  33 5d 0d 10 b8 23 41 44  44 20 52 33 2c 52 33 2c  |3]...#ADD R3,R3,|
000035b0  23 31 3a 43 4d 50 20 52  33 2c 52 31 3a 42 4c 45  |#1:CMP R3,R1:BLE|
000035c0  20 6c 6f 6f 70 0d 10 c2  16 4c 44 4d 46 44 20 52  | loop....LDMFD R|
000035d0  31 33 21 2c 7b 52 30 2d  52 34 7d 0d 10 cc 0e 4d  |13!,{R0-R4}....M|
000035e0  4f 56 20 50 43 2c 52 31  34 0d 10 d6 0b 2e 6c 74  |OV PC,R14.....lt|
000035f0  61 62 6c 65 0d 10 e0 30  5d 3a 50 25 2b 3d 32 35  |able...0]:P%+=25|
00003600  36 3a 5b 4f 50 54 20 43  20 20 20 20 20 3b 20 32  |6:[OPT C     ; 2|
00003610  35 36 20 62 79 74 65 20  6c 6f 6f 6b 75 70 20 74  |56 byte lookup t|
00003620  61 62 6c 65 0d 10 ea 04  0d 10 f4 2e 2e 65 6e 64  |able.........end|
00003630  63 6f 64 65 20 20 20 20  20 20 20 20 20 20 20 20  |code            |
00003640  20 3b 20 54 68 65 20 65  6e 64 63 6f 64 65 20 70  | ; The endcode p|
00003650  6f 69 6e 74 65 72 0d 10  fe 05 5d 0d 11 08 05 ed  |ointer....].....|
00003660  0d 11 12 04 0d 11 1c 2a  f1 22 42 75 69 6c 64 69  |.......*."Buildi|
00003670  6e 67 20 73 61 6d 70 6c  65 20 63 6f 6e 76 65 72  |ng sample conver|
00003680  73 69 6f 6e 20 74 61 62  6c 65 2e 2e 2e 22 0d 11  |sion table..."..|
00003690  26 23 f4 20 53 65 74 75  70 20 73 61 6d 70 6c 65  |&#. Setup sample|
000036a0  20 63 6f 6e 76 65 72 73  69 6f 6e 20 74 61 62 6c  | conversion tabl|
000036b0  65 0d 11 30 10 e3 20 41  25 3d 30 20 b8 20 32 35  |e..0.. A%=0 . 25|
000036c0  35 0d 11 3a 3c 20 20 42  25 3d 41 25 2d 31 32 38  |5..:<  B%=A%-128|
000036d0  3a 42 25 3d 42 25 3c 3c  32 34 3a c8 99 20 22 53  |:B%=B%<<24:.. "S|
000036e0  6f 75 6e 64 5f 53 6f 75  6e 64 4c 6f 67 22 2c 42  |ound_SoundLog",B|
000036f0  25 20 b8 20 6c 74 61 62  6c 65 3f 41 25 0d 11 44  |% . ltable?A%..D|
00003700  05 ed 0d 11 4e 04 0d 11  58 1f f1 22 42 75 69 6c  |....N...X.."Buil|
00003710  64 69 6e 67 20 76 6f 6c  75 6d 65 20 74 61 62 6c  |ding volume tabl|
00003720  65 2e 2e 2e 22 0d 11 62  18 f4 20 53 65 74 75 70  |e..."..b.. Setup|
00003730  20 76 6f 6c 75 6d 65 20  74 61 62 6c 65 0d 11 6c  | volume table..l|
00003740  0f e3 20 41 25 3d 30 20  b8 20 36 33 0d 11 76 21  |.. A%=0 . 63..v!|
00003750  20 20 76 6f 6c 74 61 62  3f 41 25 3d 32 35 35 2d  |  voltab?A%=255-|
00003760  28 28 41 25 2f 33 2b 34  32 29 2a 34 29 0d 11 80  |((A%/3+42)*4)...|
00003770  05 ed 0d 11 8a 04 0d 11  94 1e f1 22 42 75 69 6c  |..........."Buil|
00003780  64 69 6e 67 20 70 69 74  63 68 20 74 61 62 6c 65  |ding pitch table|
00003790  2e 2e 2e 22 0d 11 9e 1f  f4 20 53 65 74 75 70 20  |..."..... Setup |
000037a0  69 6e 76 65 72 73 65 20  70 69 74 63 68 20 74 61  |inverse pitch ta|
000037b0  62 6c 65 0d 11 a8 11 e3  20 41 25 3d 31 20 b8 20  |ble..... A%=1 . |
000037c0  31 30 32 33 0d 11 b2 3d  20 20 61 3d 33 35 37 35  |1023...=  a=3575|
000037d0  38 37 32 2f 41 25 3a 69  6e 76 65 72 73 65 74 61  |872/A%:inverseta|
000037e0  62 6c 65 21 28 41 25 2a  34 29 3d 28 61 2f 28 31  |ble!(A%*4)=(a/(1|
000037f0  30 30 30 30 30 30 2f 75  73 29 29 2a 36 30 30 30  |000000/us))*6000|
00003800  30 0d 11 bc 05 ed 0d 11  c6 04 0d 11 d0 05 db 0d  |0...............|
00003810  11 da 22 f1 22 43 6f 64  65 20 6c 65 6e 67 74 68  |.."."Code length|
00003820  20 3d 20 22 3b 65 6e 64  63 6f 64 65 2d 63 6f 64  | = ";endcode-cod|
00003830  65 0d 11 e4 04 0d 11 ee  1b f4 20 53 6f 75 6e 64  |e......... Sound|
00003840  74 72 61 63 6b 65 72 20  64 61 74 61 66 69 6c 65  |tracker datafile|
00003850  0d 11 f8 1a f1 22 4c 6f  61 64 69 6e 67 20 6d 6f  |....."Loading mo|
00003860  64 75 6c 65 2e 2e 2e 28  22 3b 0d 12 02 20 ff 28  |dule...(";... .(|
00003870  22 4c 4f 41 44 20 22 2b  73 6f 6e 67 24 2b 22 20  |"LOAD "+song$+" |
00003880  22 2b c3 7e 74 72 61 63  6b 29 0d 12 0c 12 74 72  |"+.~track)....tr|
00003890  61 63 6b 24 3d 22 22 3a  42 25 3d 30 0d 12 16 05  |ack$="":B%=0....|
000038a0  f5 0d 12 20 31 20 20 e7  20 28 74 72 61 63 6b 3f  |... 1  . (track?|
000038b0  42 25 29 3c 3e 30 20 8c  20 74 72 61 63 6b 24 2b  |B%)<>0 . track$+|
000038c0  3d bd 28 74 72 61 63 6b  3f 42 25 29 3a 42 25 2b  |=.(track?B%):B%+|
000038d0  3d 31 0d 12 2a 11 fd 28  74 72 61 63 6b 3f 42 25  |=1..*..(track?B%|
000038e0  29 3d 30 0d 12 34 10 f1  3b 74 72 61 63 6b 24 3b  |)=0..4..;track$;|
000038f0  22 29 22 0d 12 3e 04 0d  12 48 3a f4 20 46 69 6e  |")"..>...H:. Fin|
00003900  64 20 6c 65 6e 67 74 68  20 6f 66 20 74 75 6e 65  |d length of tune|
00003910  20 64 61 74 61 20 62 79  20 6c 6f 6f 6b 69 6e 67  | data by looking|
00003920  20 74 68 72 6f 75 67 68  20 70 61 74 74 65 72 6e  | through pattern|
00003930  73 0d 12 52 0b 68 69 67  68 25 3d 30 0d 12 5c 10  |s..R.high%=0..\.|
00003940  e3 20 41 25 3d 30 20 b8  20 31 32 37 0d 12 66 35  |. A%=0 . 127..f5|
00003950  20 20 e7 20 74 72 61 63  6b 3f 28 26 31 44 38 2b  |  . track?(&1D8+|
00003960  41 25 29 3e 68 69 67 68  25 20 8c 20 68 69 67 68  |A%)>high% . high|
00003970  25 3d 74 72 61 63 6b 3f  28 26 31 44 38 2b 41 25  |%=track?(&1D8+A%|
00003980  29 0d 12 70 05 ed 0d 12  7a 0c 68 69 67 68 25 2b  |)..p....z.high%+|
00003990  3d 31 0d 12 84 04 0d 12  8e 15 f4 20 43 6f 6e 76  |=1......... Conv|
000039a0  65 72 74 20 73 61 6d 70  6c 65 73 0d 12 98 1e 41  |ert samples....A|
000039b0  25 3d 74 72 61 63 6b 2b  26 32 35 38 2b 28 68 69  |%=track+&258+(hi|
000039c0  67 68 25 2a 31 30 32 34  29 0d 12 a2 15 42 25 3d  |gh%*1024)....B%=|
000039d0  74 72 61 63 6b 2b 74 6c  65 6e 25 2d 41 25 0d 12  |track+tlen%-A%..|
000039e0  ac 26 f1 22 43 6f 6e 76  65 72 74 69 6e 67 20 22  |.&."Converting "|
000039f0  3b 7e 28 41 25 2d 74 72  61 63 6b 29 3b 22 2b 22  |;~(A%-track);"+"|
00003a00  3b 7e 42 25 0d 12 b6 0d  d6 20 63 6f 6e 76 65 72  |;~B%..... conver|
00003a10  74 0d 12 c0 04 0d 12 ca  15 73 61 6d 70 6c 65 69  |t........samplei|
00003a20  3d 74 72 61 63 6b 2b 26  31 34 0d 12 d4 1b 73 70  |=track+&14....sp|
00003a30  6f 69 6e 74 3d 41 25 3a  73 61 6d 70 6c 65 73 3d  |oint=A%:samples=|
00003a40  74 72 61 63 6b 0d 12 de  04 0d 12 e8 2e f1 27 22  |track.........'"|
00003a50  4e 72 20 4e 61 6d 65 20  20 20 20 20 20 20 20 20  |Nr Name         |
00003a60  20 20 20 20 20 20 20 20  4c 65 6e 67 74 68 20 20  |        Length  |
00003a70  56 6f 6c 75 6d 65 22 0d  12 f2 2d f1 22 2d 2d 20  |Volume"...-."-- |
00003a80  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00003a90  2d 2d 2d 2d 20 2d 2d 2d  2d 2d 2d 2d 20 2d 2d 2d  |---- ------- ---|
00003aa0  2d 2d 2d 22 0d 12 fc 0f  e3 20 41 25 3d 30 20 b8  |---"..... A%=0 .|
00003ab0  20 31 34 0d 13 06 1e 20  20 73 61 6d 70 6c 65 6f  | 14....  sampleo|
00003ac0  3d 73 61 6d 70 6c 65 69  2b 28 41 25 2a 26 31 45  |=samplei+(A%*&1E|
00003ad0  29 0d 13 10 13 20 20 6e  61 6d 65 24 3d 22 22 3a  |)....  name$="":|
00003ae0  42 25 3d 30 0d 13 1a 07  20 20 f5 0d 13 24 34 20  |B%=0....  ...$4 |
00003af0  20 20 20 e7 20 28 73 61  6d 70 6c 65 6f 3f 42 25  |   . (sampleo?B%|
00003b00  29 3c 3e 30 20 6e 61 6d  65 24 2b 3d bd 28 73 61  |)<>0 name$+=.(sa|
00003b10  6d 70 6c 65 6f 3f 42 25  29 3a 42 25 2b 3d 31 0d  |mpleo?B%):B%+=1.|
00003b20  13 2e 1d 20 20 fd 28 73  61 6d 70 6c 65 6f 3f 42  |...  .(sampleo?B|
00003b30  25 29 3d 30 20 84 20 42  25 3d 32 30 0d 13 38 13  |%)=0 . B%=20..8.|
00003b40  20 20 e7 20 6e 61 6d 65  24 3c 3e 22 22 20 8c 0d  |  . name$<>"" ..|
00003b50  13 42 2e 20 20 20 20 6c  65 6e 25 3d 32 2a 28 28  |.B.    len%=2*((|
00003b60  73 61 6d 70 6c 65 6f 3f  32 32 29 2a 32 35 36 2b  |sampleo?22)*256+|
00003b70  28 73 61 6d 70 6c 65 6f  3f 32 33 29 29 0d 13 4c  |(sampleo?23))..L|
00003b80  2a 20 20 20 20 76 6f 6c  25 3d 28 73 61 6d 70 6c  |*    vol%=(sampl|
00003b90  65 6f 3f 32 34 29 2a 32  35 36 2b 28 73 61 6d 70  |eo?24)*256+(samp|
00003ba0  6c 65 6f 3f 32 35 29 0d  13 56 32 20 20 20 20 f1  |leo?25)..V2    .|
00003bb0  8a 30 29 3b 7e 28 41 25  2b 31 29 3b 8a 33 29 3b  |.0);~(A%+1);.3);|
00003bc0  6e 61 6d 65 24 3b 8a 32  34 29 3b 6c 65 6e 25 3b  |name$;.24);len%;|
00003bd0  8a 33 32 29 3b 76 6f 6c  25 0d 13 60 27 20 20 20  |.32);vol%..`'   |
00003be0  20 73 61 6d 70 6c 65 6c  6f 63 21 28 41 25 2a 34  | sampleloc!(A%*4|
00003bf0  29 3d 73 70 6f 69 6e 74  2d 73 61 6d 70 6c 65 73  |)=spoint-samples|
00003c00  0d 13 6a 14 20 20 20 20  73 70 6f 69 6e 74 2b 3d  |..j.    spoint+=|
00003c10  6c 65 6e 25 0d 13 74 07  20 20 cd 0d 13 7e 05 ed  |len%..t.  ...~..|
00003c20  0d 13 88 26 f1 22 20 20  20 20 20 20 20 20 20 20  |...&."          |
00003c30  20 20 20 20 20 20 20 20  20 20 20 20 20 20 2d 2d  |              --|
00003c40  2d 2d 2d 2d 2d 22 0d 13  92 42 f1 22 20 20 20 20  |-----"...B."    |
00003c50  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003c60  20 20 20 20 22 3b 28 73  70 6f 69 6e 74 2d 73 61  |    ";(spoint-sa|
00003c70  6d 70 6c 65 73 2d 26 32  35 38 2d 28 68 69 67 68  |mples-&258-(high|
00003c80  25 2a 31 30 32 34 29 29  0d 13 9c 04 0d 13 a6 1a  |%*1024))........|
00003c90  f4 20 53 74 6f 72 65 20  6c 65 6e 67 74 68 20 6f  |. Store length o|
00003ca0  66 20 74 75 6e 65 0d 13  b0 17 69 6e 66 6f 21 34  |f tune....info!4|
00003cb0  3d 74 72 61 63 6b 3f 26  31 44 36 2d 31 0d 13 ba  |=track?&1D6-1...|
00003cc0  04 0d 13 c4 1e f1 22 54  75 6e 65 20 6c 65 6e 67  |......"Tune leng|
00003cd0  74 68 20 3d 20 22 3b 69  6e 66 6f 21 34 2b 31 0d  |th = ";info!4+1.|
00003ce0  13 ce 04 0d 13 d8 16 ee  20 85 20 d6 6b 69 6c 6c  |........ . .kill|
00003cf0  73 6f 75 6e 64 3a f6 3a  e0 0d 13 e2 1b f4 20 47  |sound:.:...... G|
00003d00  65 74 20 74 68 69 6e 67  73 20 69 6e 20 6d 6f 74  |et things in mot|
00003d10  69 6f 6e 21 0d 13 ec 12  d6 20 69 6e 73 74 61 6c  |ion!..... instal|
00003d20  6c 73 6f 75 6e 64 0d 13  f6 20 f1 22 3c 53 70 61  |lsound... ."<Spa|
00003d30  63 65 3e 20 74 6f 20 72  65 73 65 6c 65 63 74 20  |ce> to reselect |
00003d40  74 75 6e 65 22 27 0d 14  00 39 f1 8a 30 2c 32 35  |tune"'...9..0,25|
00003d50  29 3b 22 50 6f 73 69 74  69 6f 6e 3a 30 30 22 3b  |);"Position:00";|
00003d60  69 6e 66 6f 21 38 3b 8a  33 30 2c 32 35 29 3b 22  |info!8;.30,25);"|
00003d70  50 61 74 74 65 72 6e 3a  22 3b 21 69 6e 66 6f 0d  |Pattern:";!info.|
00003d80  14 0a 0e e3 20 41 25 3d  30 20 b8 20 33 0d 14 14  |.... A%=0 . 3...|
00003d90  6b 20 20 f1 8a 30 2c 32  37 2b 41 25 29 3b 22 56  |k  ..0,27+A%);"V|
00003da0  6f 69 63 65 3a 22 3b 41  25 3b 22 20 20 4c 61 73  |oice:";A%;"  Las|
00003db0  74 20 69 6e 73 74 72 75  6d 65 6e 74 3a 22 3b 7e  |t instrument:";~|
00003dc0  63 75 72 72 65 6e 74 3f  41 25 3b 22 20 20 50 69  |current?A%;"  Pi|
00003dd0  74 63 68 3a 30 30 30 30  22 3b 7e 6f 75 72 69 6e  |tch:0000";~ourin|
00003de0  66 21 28 33 32 2a 41 25  2b 34 29 3b 22 20 20 45  |f!(32*A%+4);"  E|
00003df0  66 66 65 63 74 3a 30 22  0d 14 1e 05 ed 0d 14 28  |ffect:0".......(|
00003e00  05 87 0d 14 32 05 f5 0d  14 3c 0f 20 20 c8 96 3a  |....2....<.  ..:|
00003e10  d6 20 69 6e 74 72 0d 14  46 2d 20 20 f1 8a 39 2c  |. intr..F-  ..9,|
00003e20  32 35 29 3b 69 6e 66 6f  21 38 3b 22 20 20 20 22  |25);info!8;"   "|
00003e30  3b 8a 33 38 2c 32 35 29  3b 21 69 6e 66 6f 3b 22  |;.38,25);!info;"|
00003e40  20 20 22 0d 14 50 10 20  20 e3 20 41 25 3d 30 20  |  "..P.  . A%=0 |
00003e50  b8 20 33 0d 14 5a 69 20  20 20 20 f1 8a 32 35 2c  |. 3..Zi    ..25,|
00003e60  32 37 2b 41 25 29 3b 7e  63 75 72 72 65 6e 74 3f  |27+A%);~current?|
00003e70  41 25 3b 8a 33 34 2c 32  37 2b 41 25 29 3b 7e 6f  |A%;.34,27+A%);~o|
00003e80  75 72 69 6e 66 21 28 33  32 2a 41 25 2b 34 29 3b  |urinf!(32*A%+4);|
00003e90  22 20 20 20 22 3b 8a 34  38 2c 32 37 2b 41 25 29  |"   ";.48,27+A%)|
00003ea0  3b 28 65 66 66 65 63 74  74 79 70 65 21 28 41 25  |;(effecttype!(A%|
00003eb0  2a 34 29 29 3e 3e 38 3b  22 20 20 22 0d 14 64 07  |*4))>>8;"  "..d.|
00003ec0  20 20 ed 0d 14 6e 0c fd  a6 28 30 29 3d 33 32 0d  |  ...n...(0)=32.|
00003ed0  14 78 05 ee 0d 14 82 0f  d6 20 6b 69 6c 6c 73 6f  |.x....... killso|
00003ee0  75 6e 64 0d 14 8c 05 f1  0d 14 96 05 f9 0d ff     |und............|
00003eef