Home » Archimedes archive » Zipped Apps » 6502em » !6502Em/src/Sound6
!6502Em/src/Sound6
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 » Zipped Apps » 6502em |
| Filename: | !6502Em/src/Sound6 |
| Read OK: | ✔ |
| File size: | 5697 bytes |
| Load address: | 0000 |
| Exec address: | 0000 |
File contents
10REM > Sound5
20REM
30REM BBC Sound and Speech emulation library
40REM For Mike Borcherds BBC emulator
50REM This file by Dominic Symes
60
70REM Set up global defaults
80DEF PROCsound_define
90REM Size of circular buffer for each channel
100sound_buf_size_log%=10
110sound_buf_size%=(1<<sound_buf_size_log%)
120ENDPROC
130
140REM Call to set up sound tables
150DEF PROCsound_init
160LOCAL a,f%
170PROCsound_define
180REMvolume%=127
190DIM sound_buffer% (4*sound_buf_size%)
200DIM sound_vol_table% &40
210DIM sound_sample% &200
220DIM sound_stack% &80
230FOR f%=0 TO &3FF
240?(sound_buffer%+f%)=f%*10
250NEXT
260SYS "Sound_Volume",127 TO sc_vol
270REM Set up sound sample for pitch channels - half way between
280REM a sine wave and square wave gives best likeness.
290FOR f%=0 TO &7F
300SYS "6502_Sound",f%,A%
310a=SIN((f%/128)*PI)
320IF a<>0 THEN a=a^.2
330SYS "Sound_SoundLog",&7FFFFFFF*a TO a
340?(sound_sample%+f%)=a
350?(sound_sample%+&80+f%)=a+1
360NEXT
370REM Set up the sound sample for the pulse generator
380FOR f%=0 TO &3F
390?(sound_sample%+&100+f%)=?(sound_sample%+f%*(8/4))
400NEXT
410FOR f%=0 TO &BF
420?(sound_sample%+&110+f%)=?(sound_sample%+&80+f%*(8/12))
430NEXT
440SYS "Sound_Volume",sc_vol
450sound_voice%=code+!(code+22*4)
460!(sound_voice%+0)=sound_buffer%
470!(sound_voice%+4)=sound_vol_table%
480!(sound_voice%+8)=sound_sample%
490!(sound_voice%+12)=sound_stack%+&40
500sound_voice%+=16
510ENDPROC
520
530DEFPROCsound_reinit
540sound_voice%=code+!(code+22*4)
550!(sound_voice%+0)=sound_buffer%
560!(sound_voice%+4)=sound_vol_table%
570!(sound_voice%+8)=sound_sample%
580!(sound_voice%+12)=sound_stack%+&40
590sound_voice%+=16
600ENDPROC
610
620REM Call just before starting the emulator
630DEF PROCsound_setup
640LOCAL f%,a%
650SYS "Sound_InstallVoice",sound_voice%,0 TO ,sound_voice_slot%
660SYS "Sound_Configure",4,208,48,0,0 TO sc_0,sc_1,sc_2,sc_3,sc_4
670SYS "Sound_AttachVoice",1,1 TO ,sv_1
680SYS "Sound_AttachVoice",2,1 TO ,sv_2
690SYS "Sound_AttachVoice",3,1 TO ,sv_3
700SYS "Sound_AttachVoice",4,1 TO ,sv_4
710SYS "Sound_AttachNamedVoice",1,"6502Emulator"
720SYS "Sound_AttachNamedVoice",2,"6502Emulator"
730SYS "Sound_AttachNamedVoice",3,"6502Emulator"
740SYS "Sound_AttachNamedVoice",4,"6502Emulator"
750REM Start infinite duration notes on each of the channels
760SYS "Sound_Volume",volume% TO sc_vol
770REM Set up the linear to log volume conversion
780FOR f%=0 TO &F
790a%=f%+(f%<<4)
800a%=a%+(a%<<8)
810a%=a%+(a%<<16)
820SYS "Sound_SoundLog",(a%>>>1) TO a%
830REMPRINT a%
840?(sound_vol_table%+f%)=a%
850NEXT
860SOUND 1,-1,1,255
870SOUND 2,-1,1,255
880SOUND 3,-1,1,255
890SOUND 4,-1,1,255
900ENDPROC
910
920REM Call after exiting the emulator
930DEF PROCsound_restore
940SYS "Sound_Volume",sc_vol
950SYS "Sound_Configure",sc_0,sc_1,sc_2,sc_3,sc_4
960SYS "Sound_AttachVoice",1,sv_1
970SYS "Sound_AttachVoice",2,sv_2
980SYS "Sound_AttachVoice",3,sv_3
990SYS "Sound_AttachVoice",4,sv_4
1000SYS "Sound_RemoveVoice",0,sound_voice_slot%
1010ENDPROC
1020
1030REM Code to interpret writes to the sound chip
1040REM mem=3 A=4 X=5 Y=6 F=7 SP=8 time=9 zpc=10 table=11
1050REM p=pass
1060DEF FNsound_latch
1070PROCsound_define
1080[OPT p
1090
1100; the following byte should be written by regb_4f and should
1110; hold a copy of what's on the slow data bus
1120
1130.sound_data EQUD 0
1140
1150; Notes:
1160; Clock is 2Mhz. One buffer fill every 48 micro secs = 96 cycles.
1170; Pitch phase increment = &60000 / (10 bit BBC sound chip freq)
1180; Cleary greatest sensible pitch increment is &4000, so very
1190; small BBC frequencies are conventionally meaningless.
1200; A BBC frequency of 1 is assumed to be an
1210; attempt to modulate the amplitude manually (eg Superior
1220; Software speech) and is handled accordingly.
1230
1240;E Called when latch writes to sound generator
1250; sound_data contains a copy of the byte written to the slow
1260; data bus
1270; R0=value written to latch (b0-b2=0)
1280; R3=BBC memory address (mem)
1290; R9=time in cycles until next clock interrupt
1300;X R0-R2,R13 corrupted
1310; Exits via MOV PC,R14
1320
1330.sound_latch
1340STR mem,memstore
1350TST R0,#1<<3
1360MOVNE PC,R14 ; active low
1370LDR R13,(sound_buffs_addr+12)
1380STMFD R13!,{R3,R14}
1390LDRB R0,sound_data ; get the byte written
1400TST R0,#1<<7
1410BEQ sound_update ; update the frequency
1420MOV R1,R0,LSR#5
1430AND R1,R1,#3 ; channel number (0=tone3 3=noise)
1440TST R0,#1<<4
1450AND R0,R0,#&0F ; data is in b0-b3
1460BNE sound_volume ; volume control
1470TEQ R1,#3 ; noise channel?
1480STRNE R1,sound_channel ; if not set current channel
1490ADR R14,sound_freq0
1500LDR R3,[R14,R1,LSL#2] ; get the current frequency
1510BIC R2,R3,#&0F ; clear bottom 4 bits
1520ORR R2,R2,R0 ; new frequency
1530STR R2,[R14,R1,LSL#2] ; new frequency
1540B sound_frequency
1550.sound_update ; update frequency
1560LDR R1,sound_channel ; current channel
1570ADR R14,sound_freq0
1580LDR R3,[R14,R1,LSL#2] ; get the current frequency
1590AND R2,R3,#&0F ; loose the top bits
1600AND R0,R0,#&3F ; b4-b9 of frequency
1610ORR R2,R2,R0,LSL#4 ; add new high order bits
1620STR R2,[R14,R1,LSL#2] ; new frequency
1630B sound_frequency
1640;NB not sure whether you should update sound_channel here?
1650.sound_volume ; R0=volume (15 off-0 max)
1660RSB R0,R0,#15 ; new vol 0=off 15=max now!
1670ADR R14,sound_amp0
1680LDRB R2,[R14,R1] ; old volume
1690TEQ R0,R2
1700;BEQ sound_latch_end ; volume hasn't changed
1710STRB R0,[R14,R1] ; write the new volume
1720TEQ R1,#3
1730BEQ sound_latch_end ; ignore noise channel
1740ADR R14,sound_freq0
1750LDR R0,[R14,R1,LSL#2] ; get frequency setting
1760TEQ R0,#1
1770BLEQ make_sound ; it's speech
1780B sound_latch_end
1790.sound_frequency ; R1=channel R2=new freq (10 bit)
1800TEQ R1,#3 ; R3=old freq (10 bit)
1810BLEQ sound_noisefreq ; Convert R2 to 10 bit format
1820TEQ R2,#1 ; check for speach
1830BEQ sound_speach_start
1840TEQ R3,#1
1850BLEQ sound_speach_stop
1860MOV R0,#&60000
1870STMFD R13!,{R1} ; save channel number
1880MOV R1,R2 ; denomenator
1890BL div_mod ; R0=pitch accumulator inc corr R3
1900LDMFD R13!,{R1} ; restore channel number
1910CMP R0,#0
1920MOVLE R0,#0
1930CMP R0,#&4000
1940MOVGE R0,#&4000 ; R0=new pitch increment
1950ADR R14,sound_pitch0
1960LDR R2,[R14,R1,LSL#2]
1970MOV R2,R2,LSR#16
1980ORR R2,R0,R2,LSL#16 ; install new pitch increment
1990STR R2,[R14,R1,LSL#2]
2000TEQ R1,#2 ; is it pitch channel 1
2010BNE sound_latch_end ; no
2020LDR R0,sound_freq3 ; 3 bit freq setting of noise chan
2030AND R0,R0,#3
2040TEQ R0,#3 ; is it based on channel 1?
2050BNE sound_latch_end ; no
2060;BL sound_debug
2070MOV R1,#3 ; channel 0
2080LDR R2,sound_freq3 ; channel 0 10-bit frequency
2090B sound_frequency ; update frequency for channel 0
2100.sound_latch_end ; EXIT
2110;BL sound_debug ; print up debug data
2120LDMFD R13!,{R3,PC} ; EXIT
2130.sound_speach_start
2140TEQ R3,#1
2150BEQ sound_latch_end ; already started
2160BL sound_get_time
2170ADR R0,sound_time0
2180STR R2,[R0,R1,LSL#2] ; time this channel last updated
2190TEQ R1,#0
2200;BLEQ log_start
2210B sound_latch_end
2220
2230;E Called when speach stops
2240;X Corrupts R0
2250
2260.sound_speach_stop
2270TEQ R1,#0
2280;BEQ log_end
2290MOV PC,R14
2300
2310.memstore
2320EQUD 0
2330
2340;E R9=Emulator time 'till next event
2350;X R2=current time on the sound decrementing 2MHz clock
2360; R0 corrupted
2370
2380.sound_get_time
2390LDR R0,memstore
2400LDR R2,[R0,#min]
2410SUB R2,R2,R9 ; time passed since last event
2420LDR R0,[R0,#sound_timer]
2430SUB R2,R0,R2 ; current time (dec at 2Mhz)
2440MOV PC,R14
2450
2460;E Volume changed (not just been set to the same value!!!)
2470; This channel in speech mode.
2480; R2=the old volume before the change
2490; R1=BBC channel number (0-3) R9=time
2500;X Buffer filled for manual amplitude modulation
2510; R0 corrupted
2520
2530.make_sound
2540STMFD R13!,{R1-R5,R14}
2550; TEQ R1,#0
2560; LDMNEFD R13!,{R1-R5,PC}
2570; LDRB R0,[mem,#&67]
2580; LDRB R14,[mem,#&68]
2590; ADD R0,R0,R14,LSL#8
2600; LDRB R14,[R0,Y,LSR#24]
2610; ADD R0,R0,Y
2620; ADD R0,R0,R14,LSL#16
2630; LDR R0,[mem,#&60]
2640; BL log_word
2650; MOV R0,R2
2660; BL log_word
2670MOV R4,R2,LSL#1 ; amplitude 0-30
2680SUBS R4,R4,#15 ; amplitude -15 to 15
2690MOVPL R0,#0
2700MOVMI R0,#1 ; sign bit
2710RSBMI R4,R4,#0 ; now +ve (1-15)
2720LDR R14,(sound_buffs_addr+4) ; log amp table
2730LDRB R4,[R14,R4] ; VIDC amp
2740EOR R4,R4,R0 ; bung in sign to get sample
2750BL sound_get_time ; R2=current time
2760ADR R14,sound_time0
2770LDR R3,[R14,R1,LSL#2] ; time this channel last updated
2780SUBS R0,R3,R2 ; time passed since last update
2790MOVMI R3,R2 ; clip if gone negative
2800CMP R0,#&C000 ; greater than one buffer fill?
2810ADDGE R3,R2,#&C000 ; clip if so
2820; BL log_word
2830ADR R14,sound_filled0
2840LDR R5,[R14,R1,LSL#2] ; current offset in the buffer
2850.make_sound_1
2860ADR R14,sound_read0
2870LDR R0,[R14,R1,LSL#2] ; amount read to
2880SUBS R0,R5,R0
2890ADDMI R0,R0,#sound_buf_size% ; amount in the buffer
2900CMP R0,#512
2910BGT make_sound_1 ; wait for output to catch up
2920LDR R0,sound_buffs_addr
2930ADD R0,R0,R1,LSL#sound_buf_size_log% ; address of buffer
2940.make_sound_2
2950SUB R3,R3,#96 ; try and do another byte
2960CMP R3,R2
2970BLT make_sound_3 ; can't
2980STRB R4,[R0,R5] ; write out a byte
2990; STMFD R13!,{R0}
3000; MOV R0,R4
3010; BL log_word
3020; LDMFD R13!,{R0}
3030ADD R5,R5,#1
3040CMP R5,#sound_buf_size%
3050MOVGE R5,#0 ; wrap buffer offset
3060B make_sound_2
3070.make_sound_3
3080ADD R3,R3,#96
3090ADR R14,sound_filled0
3100STR R5,[R14,R1,LSL#2] ; new buffer offset
3110ADR R14,sound_time0
3120STR R3,[R14,R1,LSL#2] ; new time last updated
3130LDMFD R13!,{R1-R5,PC}
3140
3150;E R2=noise channel frequency (bbc format)
3160;X R2=noise channel frequnecy (10 bit)
3170; Corrupts R0
3180; Don't need to clip since pitch inc can go up to &60000
3190
3200.sound_noisefreq
3210AND R0,R2,#3
3220TEQ R0,#3
3230BEQ sound_usefreq2
3240AND R0,R2,#7 ; FB NF1 NF0
3250ADR R2,sound_noisetab
3260LDR R2,[R2,R0,LSL#2]
3270MOV PC,R14
3280.sound_usefreq2
3290TST R2,#4
3300LDR R2,sound_freq2 ; use tone generator 1 frequency
3310;MOVEQ R2,R2,LSL#4 ; multiply if pulse channel
3320;MOVNE R2,R2,LSR#2 ; divide if noise channel
3321
3322MOV R2,R2,LSL#4 ; changed 11/96 MRB
3323
3370MOV PC,R14
3380.sound_noisetab
3390EQUD &F1 ; pulse high
3400EQUD &1D5 ; pulse med
3410EQUD &3C6 ; pulse low
3420EQUD 0
3430EQUD &1F ; noise high
3440EQUD &A3 ; noise med
3450EQUD &100 ; noise low
3460EQUD 0
3470
3480.sound_channel EQUD 0 ; current note channel (0-2)
3490.sound_freq0 EQUD 0 ; frequency of channel 3 (10 bit)
3500.sound_freq1 EQUD 0 ; frequency of channel 2
3510.sound_freq2 EQUD 0 ; frequency of channel 1
3520.sound_freq3 EQUD 0 ; frequency of channel 0 X FB NF1,0
3530.sound_amp0 EQUB 0 ; amplitude of channel 3 0-15
3540.sound_amp1 EQUB 0 ; amplitude of channel 2
3550.sound_amp2 EQUB 0 ; amplitude of channel 1
3560.sound_amp3 EQUB 0 ; amplitude of channel 0
3570.sound_read0 EQUD 0 ; offset in buffer of start of
3580.sound_read1 EQUD 0 ; unread data
3590.sound_read2 EQUD 0 ; channels 0-3
3600.sound_read3 EQUD 0 ;
3610.sound_filled0 EQUD 0 ; offset in buf filled to chann 0
3620.sound_filled1 EQUD 0 ; offset in buf filled to chann 1
3630.sound_filled2 EQUD 0 ; offset in buf filled to chann 2
3640.sound_filled3 EQUD 0 ; offset in buf filled to chann 3
3650.sound_pitch0 EQUD 0 ; phase pitch channel 0
3660.sound_pitch1 EQUD 0 ; phase pitch channel 1
3670.sound_pitch2 EQUD 0 ; phase pitch channel 2
3680.sound_pitch3 EQUD 0 ; phase pitch channel 3
3690.sound_time0 EQUD 0 ; last time (R9) channel updated
3700.sound_time1 EQUD 0 ; channel 1 (decrements as time
3710.sound_time2 EQUD 0 ; channel 2 goes on)
3720.sound_time3 EQUD 0 ; channel 3
3730
3740;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3750; Fill sound buffer ;
3760;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3770
3780;E R0=number of bytes to fill in buffer
3790; R5=bbc channel number
3800; R14 not usable (in IRQ mode)
3810; Return address on stack
3820
3830.sound_fillto
3840STMFD R13!,{R1-R4,R11-R12}
3850ADDS R3,R0,#0 ; number of bytes to do
3860LDMLEFD R13!,{R1-R4,R11-R12,PC} ; none
3870ADR R4,sound_filled0
3880LDR R1,[R4,R5,LSL#2] ; current offset filled to
3890LDR R11,sound_buffs_addr
3900ADD R11,R11,R5,LSL#sound_buf_size_log% ; address of the buffer
3910ADD R12,R11,#sound_buf_size% ; end of the buffer
3920ADD R11,R11,R1 ; address at which to start filling
3930ADR R4,sound_pitch0
3940LDR R1,[R4,R5,LSL#2] ; get phase pitch inc
3950ADR R4,sound_amp0
3960LDRB R4,[R4,R5] ; get BBC amp for this channel
3970LDR R0,(sound_buffs_addr+4) ; volume scaling table
3980LDRB R4,[R0,R4] ; scale volume to VIDC format
3990RSB R4,R4,#(127<<1) ; attenuation
4000TEQ R5,#3 ; noise channel?
4010BEQ sound_fillto_noise
4020ADR R0,sound_freq0
4030LDR R0,[R0,R5,LSL#2]
4040TEQ R0,#1
4050BEQ sound_fillto_speach
4060LDR R2,(sound_buffs_addr+8) ; standard sample
4070.sound_fillto_loop
4080ADD R1,R1,R1,LSL#16 ; advance waveform
4090LDRB R0,[R2,R1,LSR#24]
4100SUBS R0,R0,R4
4110MOVMI R0,#0
4120STRB R0,[R11],#1 ; write next byte
4130CMP R11,R12
4140SUBGE R11,R12,#sound_buf_size% ; wrap the pointer
4150SUBS R3,R3,#1
4160BHI sound_fillto_loop
4170ADR R4,sound_pitch0
4180STR R1,[R4,R5,LSL#2] ; save new pitch inc
4190.sound_fillto_end
4200SUB R12,R12,#sound_buf_size%
4210SUB R11,R11,R12 ; offset in buffer filled to
4220ADR R12,sound_filled0
4230STR R11,[R12,R5,LSL#2]
4240LDMFD R13!,{R1-R4,R11-R12,PC}
4250.sound_fillto_noise
4260LDR R2,sound_freq3
4270TST R2,#1<<2 ; look at FB
4280LDREQ R2,(sound_buffs_addr+8)
4290ADDEQ R2,R2,#&100 ; pulse sample
4300BEQ sound_fillto_loop ; periodic noise
4310STMFD R13!,{R6-R7} ; need two more registers
4320LDR R2,sound_noiseseed ; white noise seed
4330RSB R4,R4,#(127<<1) ; recover amplitude
4340EOR R0,R4,#1 ; other sign
4350LDR R6,sound_noiseeor ; eor
4360.sfn_loop ; white noise loop
4370MOV R7,R1
4380ADD R1,R1,R1,LSL#16
4390EOR R7,R7,R1
4400TST R7,#&40000000
4410BEQ sfn_skip ; bit hasn't changed so don't adv
4420MOVS R2,R2,LSR#1
4430EORCS R2,R2,R6
4440BICCC R1,R1,#&40000000
4450ORRCS R1,R1,#&40000000
4460.sfn_skip
4470TST R1,#&40000000
4480STREQB R0,[R11],#1
4490STRNEB R4,[R11],#1
4500CMP R11,R12
4510SUBGE R11,R12,#sound_buf_size% ; wrap the pointer
4520SUBS R3,R3,#1
4530BHI sfn_loop
4540LDMFD R13!,{R6-R7}
4550STR R2,sound_noiseseed
4560STR R1,sound_pitch3
4570B sound_fillto_end
4580.sound_fillto_speach ; direct amp modification
4590ADR R4,sound_amp0
4600LDRB R4,[R4,R5] ; get BBC amp for this channel
4610MOV R4,R4,LSL#1 ; 0-30
4620SUBS R4,R4,#15 ; amplitude -15 to 15
4630MOVPL R0,#0
4640MOVMI R0,#1 ; sign bit
4650RSBMI R4,R4,#0 ; now +ve (1-15)
4660LDR R1,(sound_buffs_addr+4) ; log amp table
4670LDRB R4,[R1,R4] ; VIDC amp
4680EOR R4,R4,R0 ; bung in sign to get sample
4690ADR R2,sound_time0
4700LDR R0,[R2,R5,LSL#2] ; get time last updated
4710.sound_fillto_speach_1
4720STRB R4,[R11],#1
4730SUB R0,R0,#96
4740CMP R11,R12
4750SUBGE R11,R12,#sound_buf_size% ; wrap the pointer
4760SUBS R3,R3,#1
4770BHI sound_fillto_speach_1
4780;STR R0,[R2,R5,LSL#2]
4790B sound_fillto_end
4800.sound_noiseseed EQUD &446D6954 ; white noise seed (R2)
4810.sound_noiseeor EQUD &82D4E1B8 ; white noise eor (R6)
4820
4830;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4840; Voice generator ;
4850;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4860
4870.sound_buffs_addr
4880EQUD 0 ; address of buffer
4890EQUD 0 ; volume table
4900EQUD 0 ; sample address
4910EQUD 0 ; stack address
4920
4930; SCCB
4940; #0 b0-b7 Arc volume (R1)
4950; #4 phase accumulator (b0-b15=inc) (R2)
4960; #8 -
4970; #12 number of buffer fills left to do (R4)
4980; #16 bbc channel number (0-3) (R5)
4990; #20 Volume scaled log amp table (R6)
5000
5010.sound_voiceheader
5020B sound_vfill
5030B sound_vfill
5040B sound_vfill
5050B sound_vgateoff
5060B sound_vinstantiate
5070LDMFD R13!,{PC}
5080LDMFD R13!,{PC}
5090EQUD sound_voicename-sound_voiceheader
5100.sound_voicename
5110EQUS "6502Emulator"+CHR$0
5120ALIGN
5130
5140;E Return address on stack
5150; R14 not usable (in IRQ mode)
5160
5170.sound_vfill
5180LDMFD R9,{R1-R6} ; R5=bbc channel number
5190ADR R1,sound_read0
5200LDR R2,[R1,R5,LSL#2] ; offset of unread data
5210ADR R1,sound_filled0
5220LDR R0,[R1,R5,LSL#2] ; offset buffer filled to
5230SUBS R0,R0,R2
5240ADDMI R0,R0,#sound_buf_size% ; amount in the buffer
5250RSBS R0,R0,#208 ; amount extra needed
5260BLE sound_fill_ret
5270ADR R1,sound_fill_ret
5280STMFD R13!,{R1} ; put return address on stack
5290B sound_fillto ; ensure the buffer full enough
5300.sound_fill_ret
5310ADR R1,sound_read0
5320LDR R0,[R1,R5,LSL#2] ; off of unread data
5330ADD R2,R0,#208 ; new offset after we've finished
5340CMP R2,#sound_buf_size%
5350SUBGE R2,R2,#sound_buf_size% ; wrap it
5360STR R2,[R1,R5,LSL#2]
5370LDR R2,sound_buffs_addr
5380ADD R2,R2,R5,LSL#sound_buf_size_log% ; address of buffer
5390ADD R3,R2,#sound_buf_size% ; end of buffer
5400ADD R2,R2,R0 ; current address
5410.sound_fill_loop ; NB Amp already scaled
5420LDRB R0,[R2],#1 ; get next byte
5430STRB R0,[R12],R11
5440CMP R2,R3
5450SUBGE R2,R3,#sound_buf_size%
5460LDRB R0,[R2],#1 ; get next byte
5470STRB R0,[R12],R11
5480CMP R2,R3
5490SUBGE R2,R3,#sound_buf_size%
5500LDRB R0,[R2],#1 ; get next byte
5510STRB R0,[R12],R11
5520CMP R2,R3
5530SUBGE R2,R3,#sound_buf_size%
5540LDRB R0,[R2],#1 ; get next byte
5550STRB R0,[R12],R11
5560CMP R2,R3
5570SUBGE R2,R3,#sound_buf_size%
5580CMP R12,R10
5590BLT sound_fill_loop
5600MOV R0,#8 ; voice still active
5610LDMFD R13!,{PC}
5620
5630;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5640; print out debug data - current channel settings ;
5650;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5660
5670;X R1=channel being changed
5680
5690.sound_debug
5700STMFD R13!,{R0-R1,R14}
5710SWI &11F
5720SWI &100
5730MOV R0,R1
5740SWI "XOS_WriteC" ; jump to row n
5750MOV R0,R1
5760BL sound_debug2 ; channel
5770ADR R14,sound_freq0
5780LDR R0,[R14,R1,LSL#2]
5790BL sound_debug2 ; freq
5800ADR R14,sound_amp0
5810LDRB R0,[R14,R1]
5820BL sound_debug2 ; amp
5830LDMFD R13!,{R0-R1,PC}
5840
5850]
5860=""
5870
5880REM MISC STUFF
5890
5900DEF FNsound_misc
5910[OPT p
5920
5930;E R0=number to print
5940;X Number printed
5950
5960.sound_debug2 ; output number in R0 to debug
5970STMFD R13!,{R0-R2,R14}
5980ADR R1,sound_debug_buf
5990MOV R2,#16
6000SWI "XOS_ConvertHex8"
6010SWI "XOS_Write0"
6020SWI &120
6030LDMFD R13!,{R0-R2,PC}
6040.sound_debug_buf
6050FNsound_mem(16)
6060
6070;E R0=channel number-1 (0-7)
6080; Return address on top of stack
6090
6100.sound_vinstantiate
6110STMFD R13!,{R0-R5}
6120MOV R5,R0 ; save channel number
6130MOV R0,#0
6140MOV R1,#0
6150MOV R2,#0
6160MOV R3,#0
6170MOV R4,#0
6180SWI "XSound_Configure"
6190ADD R0,R5,#1 ; channel number
6200MOV R1,#20
6210LDR R2,[R3,#12]
6220SWI "XSound_WriteControlBlock" ; volume scaled log amp
6230ADD R0,R5,#1
6240MOV R1,#16
6250MOV R2,R5 ; bbc channel number
6260CMP R2,#4
6270MOVCS R2,#0 ; clip
6280SWI "XSound_WriteControlBlock"
6290LDMFD R13!,{R0-R5,PC}
6300
6310.sound_vgateoff
6320MOV R0,#0
6330.sound_gateoff_loop
6340STRB R0,[R12],R11
6350STRB R0,[R12],R11
6360STRB R0,[R12],R11
6370STRB R0,[R12],R11
6380CMP R12,R10
6390BLT sound_gateoff_loop
6400MOV R0,#1
6410LDMFD R13!,{PC}
6420
6430;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6440; Divide routine ;
6450;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6460
6470\E R0=numerator R1=denominator
6480\X R0=R0 Div R1 R2=R0 Mod R1 R0-R3 corrupted |
6490
6500.div_mod
6510MOV R2,#0 \ clear remainder
6520ADDS R0,R0,R0 \ double numerator
6530RSB R1,R1,#0 \ negate denom
6540MOV R3,#32
6550.div_mod_1
6560ADCS R2,R1,R2,LSL#1:SUBCC R2,R2,R1:ADCS R0,R0,R0
6570ADCS R2,R1,R2,LSL#1:SUBCC R2,R2,R1:ADCS R0,R0,R0
6580ADCS R2,R1,R2,LSL#1:SUBCC R2,R2,R1:ADCS R0,R0,R0
6590ADCS R2,R1,R2,LSL#1:SUBCC R2,R2,R1:ADCS R0,R0,R0
6600SUB R3,R3,#4
6610TEQ R3,#0
6620BNE div_mod_1 \ DO NOT CORRUPT CARRY
6630MOVS PC,R14
6640
6650.log_start
6660STMFD R13!,{R0-R2,R14}
6670MOV R0,#&88
6680ADR R1,log_fname
6690SWI "OS_Find"
6700STR R0,log_handle
6710LDMFD R13!,{R0-R2,PC}
6720.log_fname EQUS "$.TMP.LogFile"+CHR$0
6730ALIGN
6740.log_handle EQUD 0
6750.log_temp EQUD 0
6760
6770.log_end
6780STMFD R13!,{R0-R2,R14}
6790MOV R0,#0
6800LDR R1,log_handle
6810SWI "OS_Find"
6820LDMFD R13!,{R0-R2,PC}
6830
6840; R0=word to log
6850
6860.log_word
6870STMFD R13!,{R0-R5,R14}
6880STR R0,log_temp
6890MOV R0,#2
6900LDR R1,log_handle
6910ADR R2,log_temp
6920MOV R3,#4
6930SWI "OS_GBPB"
6940LDMFD R13!,{R0-R5,PC}
6950
6960]
6970=""
6980
6990DEF FNsound_mem(a%)
7000P%+=a%:O%+=a%
7010=""
� > Sound5
�
,� BBC Sound and Speech emulation library
(%� For Mike Borcherds BBC emulator
2 � This file by Dominic Symes
<
F� Set up global defaults
P� �sound_define
Z.� Size of circular buffer for each channel
dsound_buf_size_log%=10
n,sound_buf_size%=(1<<sound_buf_size_log%)
x�
�
�!� Call to set up sound tables
�� �sound_init
�
� a,f%
��sound_define
��volume%=127
�'� sound_buffer% (4*sound_buf_size%)
�� sound_vol_table% &40
�� sound_sample% &200
�� sound_stack% &80
�� f%=0 � &3FF
�?(sound_buffer%+f%)=f%*10
��
"ș "Sound_Volume",127 � sc_vol
?� Set up sound sample for pitch channels - half way between
6� a sine wave and square wave gives best likeness.
"� f%=0 � &7F
,ș "6502_Sound",f%,A%
6a=�((f%/128)*�)
@� a<>0 � a=a^.2
J'ș "Sound_SoundLog",&7FFFFFFF*a � a
T?(sound_sample%+f%)=a
^?(sound_sample%+&80+f%)=a+1
h�
r5� Set up the sound sample for the pulse generator
|� f%=0 � &3F
�6?(sound_sample%+&100+f%)=?(sound_sample%+f%*(8/4))
��
�� f%=0 � &BF
�;?(sound_sample%+&110+f%)=?(sound_sample%+&80+f%*(8/12))
��
�ș "Sound_Volume",sc_vol
�"sound_voice%=code+!(code+22*4)
�#!(sound_voice%+0)=sound_buffer%
�&!(sound_voice%+4)=sound_vol_table%
�#!(sound_voice%+8)=sound_sample%
�'!(sound_voice%+12)=sound_stack%+&40
�sound_voice%+=16
��
��sound_reinit
"sound_voice%=code+!(code+22*4)
&#!(sound_voice%+0)=sound_buffer%
0&!(sound_voice%+4)=sound_vol_table%
:#!(sound_voice%+8)=sound_sample%
D'!(sound_voice%+12)=sound_stack%+&40
Nsound_voice%+=16
X�
b
l,� Call just before starting the emulator
v� �sound_setup
�� f%,a%
�?ș "Sound_InstallVoice",sound_voice%,0 � ,sound_voice_slot%
�@ș "Sound_Configure",4,208,48,0,0 � sc_0,sc_1,sc_2,sc_3,sc_4
�&ș "Sound_AttachVoice",1,1 � ,sv_1
�&ș "Sound_AttachVoice",2,1 � ,sv_2
�&ș "Sound_AttachVoice",3,1 � ,sv_3
�&ș "Sound_AttachVoice",4,1 � ,sv_4
�0ș "Sound_AttachNamedVoice",1,"6502Emulator"
�0ș "Sound_AttachNamedVoice",2,"6502Emulator"
�0ș "Sound_AttachNamedVoice",3,"6502Emulator"
�0ș "Sound_AttachNamedVoice",4,"6502Emulator"
�;� Start infinite duration notes on each of the channels
�&ș "Sound_Volume",volume% � sc_vol
0� Set up the linear to log volume conversion
� f%=0 � &F
a%=f%+(f%<<4)
a%=a%+(a%<<8)
*a%=a%+(a%<<16)
4%ș "Sound_SoundLog",(a%>>>1) � a%
>
�PRINT a%
H?(sound_vol_table%+f%)=a%
R�
\� 1,-1,1,255
f� 2,-1,1,255
p� 3,-1,1,255
z� 4,-1,1,255
��
�
�%� Call after exiting the emulator
�� �sound_restore
�ș "Sound_Volume",sc_vol
�1ș "Sound_Configure",sc_0,sc_1,sc_2,sc_3,sc_4
�!ș "Sound_AttachVoice",1,sv_1
�!ș "Sound_AttachVoice",2,sv_2
�!ș "Sound_AttachVoice",3,sv_3
�!ș "Sound_AttachVoice",4,sv_4
�.ș "Sound_RemoveVoice",0,sound_voice_slot%
��
�
0� Code to interpret writes to the sound chip
7� mem=3 A=4 X=5 Y=6 F=7 SP=8 time=9 zpc=10 table=11
� p=pass
$� �sound_latch
.�sound_define
8
[OPT p
B
L@; the following byte should be written by regb_4f and should
V0; hold a copy of what's on the slow data bus
`
j.sound_data EQUD 0
t
~; Notes:
�E; Clock is 2Mhz. One buffer fill every 48 micro secs = 96 cycles.
�C; Pitch phase increment = &60000 / (10 bit BBC sound chip freq)
�@; Cleary greatest sensible pitch increment is &4000, so very
�;; small BBC frequencies are conventionally meaningless.
�.; A BBC frequency of 1 is assumed to be an
�=; attempt to modulate the amplitude manually (eg Superior
�2; Software speech) and is handled accordingly.
�
�2;E Called when latch writes to sound generator
�A; sound_data contains a copy of the byte written to the slow
�; data bus
�*; R0=value written to latch (b0-b2=0)
"; R3=BBC memory address (mem)
3; R9=time in cycles until next clock interrupt
;X R0-R2,R13 corrupted
; Exits via MOV PC,R14
(
2.sound_latch
<STR mem,memstore
FTST R0,#1<<3
P.MOVNE PC,R14 ; active low
Z!LDR R13,(sound_buffs_addr+12)
dSTMFD R13!,{R3,R14}
n8LDRB R0,sound_data ; get the byte written
xTST R0,#1<<7
�8BEQ sound_update ; update the frequency
�MOV R1,R0,LSR#5
�B� R1,R1,#3 ; channel number (0=tone3 3=noise)
�TST R0,#1<<4
�2� R0,R0,#&0F ; data is in b0-b3
�2BNE sound_volume ; volume control
�2TEQ R1,#3 ; noise channel?
�>STRNE R1,sound_channel ; if not set current channel
�ADR R14,sound_freq0
�=LDR R3,[R14,R1,LSL#2] ; get the current frequency
�7BIC R2,R3,#&0F ; clear bottom 4 bits
�0�R R2,R2,R0 ; new frequency
�1STR R2,[R14,R1,LSL#2] ; new frequency
B sound_frequency
4.sound_update ; update frequency
3LDR R1,sound_channel ; current channel
"ADR R14,sound_freq0
,=LDR R3,[R14,R1,LSL#2] ; get the current frequency
64� R2,R3,#&0F ; loose the top bits
@4� R0,R0,#&3F ; b4-b9 of frequency
J:�R R2,R2,R0,LSL#4 ; add new high order bits
T1STR R2,[R14,R1,LSL#2] ; new frequency
^B sound_frequency
h>;NB not sure whether you should update sound_channel here?
r<.sound_volume ; R0=volume (15 off-0 max)
|=RSB R0,R0,#15 ; new vol 0=off 15=max now!
�ADR R14,sound_amp0
�.LDRB R2,[R14,R1] ; old volume
�
TEQ R0,R2
�:;BEQ sound_latch_end ; volume hasn't changed
�8STRB R0,[R14,R1] ; write the new volume
�
TEQ R1,#3
�8BEQ sound_latch_end ; ignore noise channel
�ADR R14,sound_freq0
�9LDR R0,[R14,R1,LSL#2] ; get frequency setting
�
TEQ R0,#1
�/BLEQ make_sound ; it's speech
�B sound_latch_end
�C.sound_frequency ; R1=channel R2=new freq (10 bit)
8TEQ R1,#3 ; R3=old freq (10 bit)
?BLEQ sound_noisefreq ; Convert R2 to 10 bit format
4TEQ R2,#1 ; check for speach
&BEQ sound_speach_start
0
TEQ R3,#1
:BLEQ sound_speach_stop
DMOV R0,#&60000
N7STMFD R13!,{R1} ; save channel number
X/MOV R1,R2 ; denomenator
bDBL div_mod ; R0=pitch accumulator inc corr R3
l:LDMFD R13!,{R1} ; restore channel number
v
CMP R0,#0
�MOVLE R0,#0
�CMP R0,#&4000
�:MOVGE R0,#&4000 ; R0=new pitch increment
�ADR R14,sound_pitch0
�LDR R2,[R14,R1,LSL#2]
�MOV R2,R2,LSR#16
�>�R R2,R0,R2,LSL#16 ; install new pitch increment
�STR R2,[R14,R1,LSL#2]
�9TEQ R1,#2 ; is it pitch channel 1
�&BNE sound_latch_end ; no
�DLDR R0,sound_freq3 ; 3 bit freq setting of noise chan
�� R0,R0,#3
�=TEQ R0,#3 ; is it based on channel 1?
&BNE sound_latch_end ; no
;BL sound_debug
-MOV R1,#3 ; channel 0
>LDR R2,sound_freq3 ; channel 0 10-bit frequency
*BB sound_frequency ; update frequency for channel 0
4(.sound_latch_end ; EXIT
>8;BL sound_debug ; print up debug data
H(LDMFD R13!,{R3,PC} ; EXIT
R.sound_speach_start
\
TEQ R3,#1
f3BEQ sound_latch_end ; already started
pBL sound_get_time
zADR R0,sound_time0
�BSTR R2,[R0,R1,LSL#2] ; time this channel last updated
�
TEQ R1,#0
�;BLEQ log_start
�B sound_latch_end
�
�;E Called when speach stops
�;X Corrupts R0
�
�.sound_speach_stop
�
TEQ R1,#0
�;BEQ log_end
�MOV PC,R14
�
.memstore
EQUD 0
$(;E R9=Emulator time 'till next event
.;;X R2=current time on the sound decrementing 2MHz clock
8; R0 corrupted
B
L.sound_get_time
VLDR R0,memstore
`LDR R2,[R0,#min]
j@SUB R2,R2,R9 ; time passed since last event
tLDR R0,[R0,#sound_timer]
~>SUB R2,R0,R2 ; current time (dec at 2Mhz)
�MOV PC,R14
�
�>;E Volume changed (not just been set to the same value!!!)
�#; This channel in speech mode.
�*; R2=the old volume before the change
�*; R1=BBC channel number (0-3) R9=time
�4;X Buffer filled for manual amplitude modulation
�; R0 corrupted
�
�.make_sound
�STMFD R13!,{R1-R5,R14}
�; TEQ R1,#0
; LDMNEFD R13!,{R1-R5,PC}
; LDRB R0,[mem,#&67]
; LDRB R14,[mem,#&68]
; ADD R0,R0,R14,LSL#8
(; LDRB R14,[R0,Y,LSR#24]
2; ADD R0,R0,Y
<; ADD R0,R0,R14,LSL#16
F; LDR R0,[mem,#&60]
P; BL log_word
Z; MOV R0,R2
d; BL log_word
n2MOV R4,R2,LSL#1 ; amplitude 0-30
x7SUBS R4,R4,#15 ; amplitude -15 to 15
�MOVPL R0,#0
�,MOVMI R0,#1 ; sign bit
�2RSBMI R4,R4,#0 ; now +ve (1-15)
�1LDR R14,(sound_buffs_addr+4) ; log amp table
�,LDRB R4,[R14,R4] ; VIDC amp
�<� R4,R4,R0 ; bung in sign to get sample
�3BL sound_get_time ; R2=current time
�ADR R14,sound_time0
�BLDR R3,[R14,R1,LSL#2] ; time this channel last updated
�ASUBS R0,R3,R2 ; time passed since last update
�9MOVMI R3,R2 ; clip if gone negative
�ACMP R0,#&C000 ; greater than one buffer fill?
�.ADDGE R3,R2,#&C000 ; clip if so
; BL log_word
ADR R14,sound_filled0
@LDR R5,[R14,R1,LSL#2] ; current offset in the buffer
".make_sound_1
,ADR R14,sound_read0
62LDR R0,[R14,R1,LSL#2] ; amount read to
@SUBS R0,R5,R0
J8ADDMI R0,R0,#sound_buf_size% ; amount in the buffer
TCMP R0,#512
^?BGT make_sound_1 ; wait for output to catch up
hLDR R0,sound_buffs_addr
r<ADD R0,R0,R1,LSL#sound_buf_size_log% ; address of buffer
|.make_sound_2
�;SUB R3,R3,#96 ; try and do another byte
�
CMP R3,R2
�)BLT make_sound_3 ; can't
�4STRB R4,[R0,R5] ; write out a byte
�; STMFD R13!,{R0}
�; MOV R0,R4
�; BL log_word
�; LDMFD R13!,{R0}
�ADD R5,R5,#1
�CMP R5,#sound_buf_size%
�6MOVGE R5,#0 ; wrap buffer offset
�B make_sound_2
�.make_sound_3
ADD R3,R3,#96
ADR R14,sound_filled0
5STR R5,[R14,R1,LSL#2] ; new buffer offset
&ADR R14,sound_time0
09STR R3,[R14,R1,LSL#2] ; new time last updated
:LDMFD R13!,{R1-R5,PC}
D
N.;E R2=noise channel frequency (bbc format)
X*;X R2=noise channel frequnecy (10 bit)
b; Corrupts R0
l=; Don't need to clip since pitch inc can go up to &60000
v
�.sound_noisefreq
�� R0,R2,#3
�
TEQ R0,#3
�BEQ sound_usefreq2
�,� R0,R2,#7 ; FB NF1 NF0
�ADR R2,sound_noisetab
�LDR R2,[R2,R0,LSL#2]
�MOV PC,R14
�.sound_usefreq2
�
TST R2,#4
�BLDR R2,sound_freq2 ; use tone generator 1 frequency
�;;�Q R2,R2,LSL#4 ; multiply if pulse channel
�<;MOVNE R2,R2,LSR#2 ; divide if noise channel
�
�4MOV R2,R2,LSL#4 ; changed 11/96 MRB
�
*MOV PC,R14
4.sound_noisetab
>.EQUD &F1 ; pulse high
H-EQUD &1D5 ; pulse med
R-EQUD &3C6 ; pulse low
\
EQUD 0
f.EQUD &1F ; noise high
p-EQUD &A3 ; noise med
z-EQUD &100 ; noise low
�
EQUD 0
�
�>.sound_channel EQUD 0 ; current note channel (0-2)
�C.sound_freq0 EQUD 0 ; frequency of channel 3 (10 bit)
�:.sound_freq1 EQUD 0 ; frequency of channel 2
�:.sound_freq2 EQUD 0 ; frequency of channel 1
�E.sound_freq3 EQUD 0 ; frequency of channel 0 X FB NF1,0
�?.sound_amp0 EQUB 0 ; amplitude of channel 3 0-15
�:.sound_amp1 EQUB 0 ; amplitude of channel 2
�:.sound_amp2 EQUB 0 ; amplitude of channel 1
�:.sound_amp3 EQUB 0 ; amplitude of channel 0
�@.sound_read0 EQUD 0 ; offset in buffer of start of
�/.sound_read1 EQUD 0 ; unread data
0.sound_read2 EQUD 0 ; channels 0-3
#.sound_read3 EQUD 0 ;
C.sound_filled0 EQUD 0 ; offset in buf filled to chann 0
$C.sound_filled1 EQUD 0 ; offset in buf filled to chann 1
.C.sound_filled2 EQUD 0 ; offset in buf filled to chann 2
8C.sound_filled3 EQUD 0 ; offset in buf filled to chann 3
B9.sound_pitch0 EQUD 0 ; phase pitch channel 0
L9.sound_pitch1 EQUD 0 ; phase pitch channel 1
V9.sound_pitch2 EQUD 0 ; phase pitch channel 2
`9.sound_pitch3 EQUD 0 ; phase pitch channel 3
jB.sound_time0 EQUD 0 ; last time (R9) channel updated
tA.sound_time1 EQUD 0 ; channel 1 (decrements as time
~7.sound_time2 EQUD 0 ; channel 2 goes on)
�-.sound_time3 EQUD 0 ; channel 3
�
�7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
�7; Fill sound buffer ;
�7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
�
�+;E R0=number of bytes to fill in buffer
�; R5=bbc channel number
�#; R14 not usable (in IRQ mode)
�; Return address on stack
�
�.sound_fillto
STMFD R13!,{R1-R4,R11-R12}
9ADDS R3,R0,#0 ; number of bytes to do
*LDMLEFD R13!,{R1-R4,R11-R12,PC} ; none
ADR R4,sound_filled0
(<LDR R1,[R4,R5,LSL#2] ; current offset filled to
2LDR R11,sound_buffs_addr
<BADD R11,R11,R5,LSL#sound_buf_size_log% ; address of the buffer
F5ADD R12,R11,#sound_buf_size% ; end of the buffer
PEADD R11,R11,R1 ; address at which to start filling
ZADR R4,sound_pitch0
d7LDR R1,[R4,R5,LSL#2] ; get phase pitch inc
nADR R4,sound_amp0
x@LDRB R4,[R4,R5] ; get BBC amp for this channel
�8LDR R0,(sound_buffs_addr+4) ; volume scaling table
�?LDRB R4,[R0,R4] ; scale volume to VIDC format
�/RSB R4,R4,#(127<<1) ; attenuation
�2TEQ R5,#3 ; noise channel?
�BEQ sound_fillto_noise
�ADR R0,sound_freq0
�LDR R0,[R0,R5,LSL#2]
�
TEQ R0,#1
�BEQ sound_fillto_speach
�3LDR R2,(sound_buffs_addr+8) ; standard sample
�.sound_fillto_loop
�4ADD R1,R1,R1,LSL#16 ; advance waveform
�LDRB R0,[R2,R1,LSR#24]
SUBS R0,R0,R4
MOVMI R0,#0
3STRB R0,[R11],#1 ; write next byte
"CMP R11,R12
,5SUBGE R11,R12,#sound_buf_size% ; wrap the pointer
6SUBS R3,R3,#1
@BHI sound_fillto_loop
JADR R4,sound_pitch0
T6STR R1,[R4,R5,LSL#2] ; save new pitch inc
^.sound_fillto_end
h SUB R12,R12,#sound_buf_size%
r>SUB R11,R11,R12 ; offset in buffer filled to
|ADR R12,sound_filled0
�STR R11,[R12,R5,LSL#2]
�!LDMFD R13!,{R1-R4,R11-R12,PC}
�.sound_fillto_noise
�LDR R2,sound_freq3
�.TST R2,#1<<2 ; look at FB
�!LDREQ R2,(sound_buffs_addr+8)
�0ADDEQ R2,R2,#&100 ; pulse sample
�2BEQ sound_fillto_loop ; periodic noise
�;STMFD R13!,{R6-R7} ; need two more registers
�4LDR R2,sound_noiseseed ; white noise seed
�5RSB R4,R4,#(127<<1) ; recover amplitude
�,� R0,R4,#1 ; other sign
�'LDR R6,sound_noiseeor ; eor
4.sfn_loop ; white noise loop
MOV R7,R1
ADD R1,R1,R1,LSL#16
&� R7,R7,R1
0TST R7,#&40000000
:CBEQ sfn_skip ; bit hasn't changed so don't adv
DMOVS R2,R2,LSR#1
N�CS R2,R2,R6
XBICCC R1,R1,#&40000000
b�RCS R1,R1,#&40000000
l
.sfn_skip
vTST R1,#&40000000
�STREQB R0,[R11],#1
�STRNEB R4,[R11],#1
�CMP R11,R12
�5SUBGE R11,R12,#sound_buf_size% ; wrap the pointer
�SUBS R3,R3,#1
�BHI sfn_loop
�LDMFD R13!,{R6-R7}
�STR R2,sound_noiseseed
�STR R1,sound_pitch3
�B sound_fillto_end
�;.sound_fillto_speach ; direct amp modification
�ADR R4,sound_amp0
�@LDRB R4,[R4,R5] ; get BBC amp for this channel
(MOV R4,R4,LSL#1 ; 0-30
7SUBS R4,R4,#15 ; amplitude -15 to 15
MOVPL R0,#0
,MOVMI R0,#1 ; sign bit
*2RSBMI R4,R4,#0 ; now +ve (1-15)
41LDR R1,(sound_buffs_addr+4) ; log amp table
>,LDRB R4,[R1,R4] ; VIDC amp
H<� R4,R4,R0 ; bung in sign to get sample
RADR R2,sound_time0
\9LDR R0,[R2,R5,LSL#2] ; get time last updated
f.sound_fillto_speach_1
pSTRB R4,[R11],#1
zSUB R0,R0,#96
�CMP R11,R12
�5SUBGE R11,R12,#sound_buf_size% ; wrap the pointer
�SUBS R3,R3,#1
�BHI sound_fillto_speach_1
�;STR R0,[R2,R5,LSL#2]
�B sound_fillto_end
�;.sound_noiseseed EQUD &446D6954 ; white noise seed (R2)
�:.sound_noiseeor EQUD &82D4E1B8 ; white noise eor (R6)
�
�7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
�7; Voice generator ;
�7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
�
.sound_buffs_addr
5EQUD 0 ; address of buffer
0EQUD 0 ; volume table
$2EQUD 0 ; sample address
.1EQUD 0 ; stack address
8
B
; SCCB
L; #0 b0-b7 Arc volume (R1)
V,; #4 phase accumulator (b0-b15=inc) (R2)
`
; #8 -
j0; #12 number of buffer fills left to do (R4)
t'; #16 bbc channel number (0-3) (R5)
~*; #20 Volume scaled log amp table (R6)
�
�.sound_voiceheader
�B sound_vfill
�B sound_vfill
�B sound_vfill
�B sound_vgateoff
�B sound_vinstantiate
�LDMFD R13!,{PC}
�LDMFD R13!,{PC}
�*EQUD sound_voicename-sound_voiceheader
�.sound_voicename
�EQUS "6502Emulator"+�0
ALIGN
;E Return address on stack
#; R14 not usable (in IRQ mode)
(
2.sound_vfill
<9LDMFD R9,{R1-R6} ; R5=bbc channel number
FADR R1,sound_read0
P9LDR R2,[R1,R5,LSL#2] ; offset of unread data
ZADR R1,sound_filled0
d;LDR R0,[R1,R5,LSL#2] ; offset buffer filled to
nSUBS R0,R0,R2
x8ADDMI R0,R0,#sound_buf_size% ; amount in the buffer
�7RSBS R0,R0,#208 ; amount extra needed
�BLE sound_fill_ret
�ADR R1,sound_fill_ret
�?STMFD R13!,{R1} ; put return address on stack
�AB sound_fillto ; ensure the buffer full enough
�.sound_fill_ret
�ADR R1,sound_read0
�6LDR R0,[R1,R5,LSL#2] ; off of unread data
�CADD R2,R0,#208 ; new offset after we've finished
�CMP R2,#sound_buf_size%
�+SUBGE R2,R2,#sound_buf_size% ; wrap it
�STR R2,[R1,R5,LSL#2]
�LDR R2,sound_buffs_addr
<ADD R2,R2,R5,LSL#sound_buf_size_log% ; address of buffer
1ADD R3,R2,#sound_buf_size% ; end of buffer
3ADD R2,R2,R0 ; current address
"9.sound_fill_loop ; NB Amp already scaled
,1LDRB R0,[R2],#1 ; get next byte
6STRB R0,[R12],R11
@
CMP R2,R3
J SUBGE R2,R3,#sound_buf_size%
T1LDRB R0,[R2],#1 ; get next byte
^STRB R0,[R12],R11
h
CMP R2,R3
r SUBGE R2,R3,#sound_buf_size%
|1LDRB R0,[R2],#1 ; get next byte
�STRB R0,[R12],R11
�
CMP R2,R3
� SUBGE R2,R3,#sound_buf_size%
�1LDRB R0,[R2],#1 ; get next byte
�STRB R0,[R12],R11
�
CMP R2,R3
� SUBGE R2,R3,#sound_buf_size%
�CMP R12,R10
�BLT sound_fill_loop
�6MOV R0,#8 ; voice still active
�LDMFD R13!,{PC}
�
�7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7; print out debug data - current channel settings ;
7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
&;X R1=channel being changed
0
:.sound_debug
DSTMFD R13!,{R0-R1,R14}
NSWI &11F
XSWI &100
b
MOV R0,R1
l1SWI "XOS_WriteC" ; jump to row n
v
MOV R0,R1
�+BL sound_debug2 ; channel
�ADR R14,sound_freq0
�LDR R0,[R14,R1,LSL#2]
�(BL sound_debug2 ; freq
�ADR R14,sound_amp0
�LDRB R0,[R14,R1]
�'BL sound_debug2 ; amp
�LDMFD R13!,{R0-R1,PC}
�
�]
�=""
�
�� MISC STUFF
� �sound_misc
[OPT p
*;E R0=number to print
4;X Number printed
>
H6.sound_debug2 ; output number in R0 to debug
RSTMFD R13!,{R0-R2,R14}
\ADR R1,sound_debug_buf
fMOV R2,#16
pSWI "XOS_ConvertHex8"
zSWI "XOS_Write0"
�SWI &120
�LDMFD R13!,{R0-R2,PC}
�.sound_debug_buf
��sound_mem(16)
�
� ;E R0=channel number-1 (0-7)
�%; Return address on top of stack
�
�.sound_vinstantiate
�STMFD R13!,{R0-R5}
�7MOV R5,R0 ; save channel number
�
MOV R0,#0
�
MOV R1,#0
MOV R2,#0
MOV R3,#0
MOV R4,#0
$SWI "XSound_Configure"
.2ADD R0,R5,#1 ; channel number
8MOV R1,#20
BLDR R2,[R3,#12]
LCSWI "XSound_WriteControlBlock" ; volume scaled log amp
VADD R0,R5,#1
`MOV R1,#16
j6MOV R2,R5 ; bbc channel number
t
CMP R2,#4
~(MOVCS R2,#0 ; clip
�"SWI "XSound_WriteControlBlock"
�LDMFD R13!,{R0-R5,PC}
�
�.sound_vgateoff
�
MOV R0,#0
�.sound_gateoff_loop
�STRB R0,[R12],R11
�STRB R0,[R12],R11
�STRB R0,[R12],R11
�STRB R0,[R12],R11
�CMP R12,R10
�BLT sound_gateoff_loop
MOV R0,#1
LDMFD R13!,{PC}
7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(7; Divide routine ;
27;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
<
F$\E R0=numerator R1=denominator
P7\X R0=R0 Div R1 R2=R0 Mod R1 R0-R3 corrupted |
Z
d.div_mod
n3MOV R2,#0 \ clear remainder
x4ADDS R0,R0,R0 \ double numerator
�0RSB R1,R1,#0 \ negate denom
�MOV R3,#32
�.div_mod_1
�4ADCS R2,R1,R2,LSL#1:SUBCC R2,R2,R1:ADCS R0,R0,R0
�4ADCS R2,R1,R2,LSL#1:SUBCC R2,R2,R1:ADCS R0,R0,R0
�4ADCS R2,R1,R2,LSL#1:SUBCC R2,R2,R1:ADCS R0,R0,R0
�4ADCS R2,R1,R2,LSL#1:SUBCC R2,R2,R1:ADCS R0,R0,R0
�SUB R3,R3,#4
�
TEQ R3,#0
�6BNE div_mod_1 \ DO � CORRUPT CARRY
�MOVS PC,R14
�
�.log_start
STMFD R13!,{R0-R2,R14}
MOV R0,#&88
ADR R1,log_fname
"SWI "OS_Find"
,STR R0,log_handle
6LDMFD R13!,{R0-R2,PC}
@&.log_fname EQUS "$.TMP.LogFile"+�0
J ALIGN
T.log_handle EQUD 0
^.log_temp EQUD 0
h
r.log_end
|STMFD R13!,{R0-R2,R14}
�
MOV R0,#0
�LDR R1,log_handle
�SWI "OS_Find"
�LDMFD R13!,{R0-R2,PC}
�
�; R0=word to log
�
�
.log_word
�STMFD R13!,{R0-R5,R14}
�STR R0,log_temp
�
MOV R0,#2
�LDR R1,log_handle
�ADR R2,log_temp
MOV R3,#4
SWI "OS_GBPB"
LDMFD R13!,{R0-R5,PC}
&
0]
:=""
D
N� �sound_mem(a%)
XP%+=a%:O%+=a%
b=""
� 00000000 0d 00 0a 0e f4 20 3e 20 53 6f 75 6e 64 35 0d 00 |..... > Sound5..|
00000010 14 05 f4 0d 00 1e 2c f4 20 42 42 43 20 53 6f 75 |......,. BBC Sou|
00000020 6e 64 20 61 6e 64 20 53 70 65 65 63 68 20 65 6d |nd and Speech em|
00000030 75 6c 61 74 69 6f 6e 20 6c 69 62 72 61 72 79 0d |ulation library.|
00000040 00 28 25 f4 20 46 6f 72 20 4d 69 6b 65 20 42 6f |.(%. For Mike Bo|
00000050 72 63 68 65 72 64 73 20 42 42 43 20 65 6d 75 6c |rcherds BBC emul|
00000060 61 74 6f 72 0d 00 32 20 f4 20 54 68 69 73 20 66 |ator..2 . This f|
00000070 69 6c 65 20 62 79 20 44 6f 6d 69 6e 69 63 20 53 |ile by Dominic S|
00000080 79 6d 65 73 0d 00 3c 04 0d 00 46 1c f4 20 53 65 |ymes..<...F.. Se|
00000090 74 20 75 70 20 67 6c 6f 62 61 6c 20 64 65 66 61 |t up global defa|
000000a0 75 6c 74 73 0d 00 50 13 dd 20 f2 73 6f 75 6e 64 |ults..P.. .sound|
000000b0 5f 64 65 66 69 6e 65 0d 00 5a 2e f4 20 53 69 7a |_define..Z.. Siz|
000000c0 65 20 6f 66 20 63 69 72 63 75 6c 61 72 20 62 75 |e of circular bu|
000000d0 66 66 65 72 20 66 6f 72 20 65 61 63 68 20 63 68 |ffer for each ch|
000000e0 61 6e 6e 65 6c 0d 00 64 1a 73 6f 75 6e 64 5f 62 |annel..d.sound_b|
000000f0 75 66 5f 73 69 7a 65 5f 6c 6f 67 25 3d 31 30 0d |uf_size_log%=10.|
00000100 00 6e 2c 73 6f 75 6e 64 5f 62 75 66 5f 73 69 7a |.n,sound_buf_siz|
00000110 65 25 3d 28 31 3c 3c 73 6f 75 6e 64 5f 62 75 66 |e%=(1<<sound_buf|
00000120 5f 73 69 7a 65 5f 6c 6f 67 25 29 0d 00 78 05 e1 |_size_log%)..x..|
00000130 0d 00 82 04 0d 00 8c 21 f4 20 43 61 6c 6c 20 74 |.......!. Call t|
00000140 6f 20 73 65 74 20 75 70 20 73 6f 75 6e 64 20 74 |o set up sound t|
00000150 61 62 6c 65 73 0d 00 96 11 dd 20 f2 73 6f 75 6e |ables..... .soun|
00000160 64 5f 69 6e 69 74 0d 00 a0 0a ea 20 61 2c 66 25 |d_init..... a,f%|
00000170 0d 00 aa 11 f2 73 6f 75 6e 64 5f 64 65 66 69 6e |.....sound_defin|
00000180 65 0d 00 b4 10 f4 76 6f 6c 75 6d 65 25 3d 31 32 |e.....volume%=12|
00000190 37 0d 00 be 27 de 20 73 6f 75 6e 64 5f 62 75 66 |7...'. sound_buf|
000001a0 66 65 72 25 20 28 34 2a 73 6f 75 6e 64 5f 62 75 |fer% (4*sound_bu|
000001b0 66 5f 73 69 7a 65 25 29 0d 00 c8 1a de 20 73 6f |f_size%)..... so|
000001c0 75 6e 64 5f 76 6f 6c 5f 74 61 62 6c 65 25 20 26 |und_vol_table% &|
000001d0 34 30 0d 00 d2 18 de 20 73 6f 75 6e 64 5f 73 61 |40..... sound_sa|
000001e0 6d 70 6c 65 25 20 26 32 30 30 0d 00 dc 16 de 20 |mple% &200..... |
000001f0 73 6f 75 6e 64 5f 73 74 61 63 6b 25 20 26 38 30 |sound_stack% &80|
00000200 0d 00 e6 11 e3 20 66 25 3d 30 20 b8 20 26 33 46 |..... f%=0 . &3F|
00000210 46 0d 00 f0 1d 3f 28 73 6f 75 6e 64 5f 62 75 66 |F....?(sound_buf|
00000220 66 65 72 25 2b 66 25 29 3d 66 25 2a 31 30 0d 00 |fer%+f%)=f%*10..|
00000230 fa 05 ed 0d 01 04 22 c8 99 20 22 53 6f 75 6e 64 |......".. "Sound|
00000240 5f 56 6f 6c 75 6d 65 22 2c 31 32 37 20 b8 20 73 |_Volume",127 . s|
00000250 63 5f 76 6f 6c 0d 01 0e 3f f4 20 53 65 74 20 75 |c_vol...?. Set u|
00000260 70 20 73 6f 75 6e 64 20 73 61 6d 70 6c 65 20 66 |p sound sample f|
00000270 6f 72 20 70 69 74 63 68 20 63 68 61 6e 6e 65 6c |or pitch channel|
00000280 73 20 2d 20 68 61 6c 66 20 77 61 79 20 62 65 74 |s - half way bet|
00000290 77 65 65 6e 0d 01 18 36 f4 20 61 20 73 69 6e 65 |ween...6. a sine|
000002a0 20 77 61 76 65 20 61 6e 64 20 73 71 75 61 72 65 | wave and square|
000002b0 20 77 61 76 65 20 67 69 76 65 73 20 62 65 73 74 | wave gives best|
000002c0 20 6c 69 6b 65 6e 65 73 73 2e 0d 01 22 10 e3 20 | likeness...".. |
000002d0 66 25 3d 30 20 b8 20 26 37 46 0d 01 2c 19 c8 99 |f%=0 . &7F..,...|
000002e0 20 22 36 35 30 32 5f 53 6f 75 6e 64 22 2c 66 25 | "6502_Sound",f%|
000002f0 2c 41 25 0d 01 36 13 61 3d b5 28 28 66 25 2f 31 |,A%..6.a=.((f%/1|
00000300 32 38 29 2a af 29 0d 01 40 13 e7 20 61 3c 3e 30 |28)*.)..@.. a<>0|
00000310 20 8c 20 61 3d 61 5e 2e 32 0d 01 4a 27 c8 99 20 | . a=a^.2..J'.. |
00000320 22 53 6f 75 6e 64 5f 53 6f 75 6e 64 4c 6f 67 22 |"Sound_SoundLog"|
00000330 2c 26 37 46 46 46 46 46 46 46 2a 61 20 b8 20 61 |,&7FFFFFFF*a . a|
00000340 0d 01 54 19 3f 28 73 6f 75 6e 64 5f 73 61 6d 70 |..T.?(sound_samp|
00000350 6c 65 25 2b 66 25 29 3d 61 0d 01 5e 1f 3f 28 73 |le%+f%)=a..^.?(s|
00000360 6f 75 6e 64 5f 73 61 6d 70 6c 65 25 2b 26 38 30 |ound_sample%+&80|
00000370 2b 66 25 29 3d 61 2b 31 0d 01 68 05 ed 0d 01 72 |+f%)=a+1..h....r|
00000380 35 f4 20 53 65 74 20 75 70 20 74 68 65 20 73 6f |5. Set up the so|
00000390 75 6e 64 20 73 61 6d 70 6c 65 20 66 6f 72 20 74 |und sample for t|
000003a0 68 65 20 70 75 6c 73 65 20 67 65 6e 65 72 61 74 |he pulse generat|
000003b0 6f 72 0d 01 7c 10 e3 20 66 25 3d 30 20 b8 20 26 |or..|.. f%=0 . &|
000003c0 33 46 0d 01 86 36 3f 28 73 6f 75 6e 64 5f 73 61 |3F...6?(sound_sa|
000003d0 6d 70 6c 65 25 2b 26 31 30 30 2b 66 25 29 3d 3f |mple%+&100+f%)=?|
000003e0 28 73 6f 75 6e 64 5f 73 61 6d 70 6c 65 25 2b 66 |(sound_sample%+f|
000003f0 25 2a 28 38 2f 34 29 29 0d 01 90 05 ed 0d 01 9a |%*(8/4))........|
00000400 10 e3 20 66 25 3d 30 20 b8 20 26 42 46 0d 01 a4 |.. f%=0 . &BF...|
00000410 3b 3f 28 73 6f 75 6e 64 5f 73 61 6d 70 6c 65 25 |;?(sound_sample%|
00000420 2b 26 31 31 30 2b 66 25 29 3d 3f 28 73 6f 75 6e |+&110+f%)=?(soun|
00000430 64 5f 73 61 6d 70 6c 65 25 2b 26 38 30 2b 66 25 |d_sample%+&80+f%|
00000440 2a 28 38 2f 31 32 29 29 0d 01 ae 05 ed 0d 01 b8 |*(8/12))........|
00000450 1c c8 99 20 22 53 6f 75 6e 64 5f 56 6f 6c 75 6d |... "Sound_Volum|
00000460 65 22 2c 73 63 5f 76 6f 6c 0d 01 c2 22 73 6f 75 |e",sc_vol..."sou|
00000470 6e 64 5f 76 6f 69 63 65 25 3d 63 6f 64 65 2b 21 |nd_voice%=code+!|
00000480 28 63 6f 64 65 2b 32 32 2a 34 29 0d 01 cc 23 21 |(code+22*4)...#!|
00000490 28 73 6f 75 6e 64 5f 76 6f 69 63 65 25 2b 30 29 |(sound_voice%+0)|
000004a0 3d 73 6f 75 6e 64 5f 62 75 66 66 65 72 25 0d 01 |=sound_buffer%..|
000004b0 d6 26 21 28 73 6f 75 6e 64 5f 76 6f 69 63 65 25 |.&!(sound_voice%|
000004c0 2b 34 29 3d 73 6f 75 6e 64 5f 76 6f 6c 5f 74 61 |+4)=sound_vol_ta|
000004d0 62 6c 65 25 0d 01 e0 23 21 28 73 6f 75 6e 64 5f |ble%...#!(sound_|
000004e0 76 6f 69 63 65 25 2b 38 29 3d 73 6f 75 6e 64 5f |voice%+8)=sound_|
000004f0 73 61 6d 70 6c 65 25 0d 01 ea 27 21 28 73 6f 75 |sample%...'!(sou|
00000500 6e 64 5f 76 6f 69 63 65 25 2b 31 32 29 3d 73 6f |nd_voice%+12)=so|
00000510 75 6e 64 5f 73 74 61 63 6b 25 2b 26 34 30 0d 01 |und_stack%+&40..|
00000520 f4 14 73 6f 75 6e 64 5f 76 6f 69 63 65 25 2b 3d |..sound_voice%+=|
00000530 31 36 0d 01 fe 05 e1 0d 02 08 04 0d 02 12 12 dd |16..............|
00000540 f2 73 6f 75 6e 64 5f 72 65 69 6e 69 74 0d 02 1c |.sound_reinit...|
00000550 22 73 6f 75 6e 64 5f 76 6f 69 63 65 25 3d 63 6f |"sound_voice%=co|
00000560 64 65 2b 21 28 63 6f 64 65 2b 32 32 2a 34 29 0d |de+!(code+22*4).|
00000570 02 26 23 21 28 73 6f 75 6e 64 5f 76 6f 69 63 65 |.&#!(sound_voice|
00000580 25 2b 30 29 3d 73 6f 75 6e 64 5f 62 75 66 66 65 |%+0)=sound_buffe|
00000590 72 25 0d 02 30 26 21 28 73 6f 75 6e 64 5f 76 6f |r%..0&!(sound_vo|
000005a0 69 63 65 25 2b 34 29 3d 73 6f 75 6e 64 5f 76 6f |ice%+4)=sound_vo|
000005b0 6c 5f 74 61 62 6c 65 25 0d 02 3a 23 21 28 73 6f |l_table%..:#!(so|
000005c0 75 6e 64 5f 76 6f 69 63 65 25 2b 38 29 3d 73 6f |und_voice%+8)=so|
000005d0 75 6e 64 5f 73 61 6d 70 6c 65 25 0d 02 44 27 21 |und_sample%..D'!|
000005e0 28 73 6f 75 6e 64 5f 76 6f 69 63 65 25 2b 31 32 |(sound_voice%+12|
000005f0 29 3d 73 6f 75 6e 64 5f 73 74 61 63 6b 25 2b 26 |)=sound_stack%+&|
00000600 34 30 0d 02 4e 14 73 6f 75 6e 64 5f 76 6f 69 63 |40..N.sound_voic|
00000610 65 25 2b 3d 31 36 0d 02 58 05 e1 0d 02 62 04 0d |e%+=16..X....b..|
00000620 02 6c 2c f4 20 43 61 6c 6c 20 6a 75 73 74 20 62 |.l,. Call just b|
00000630 65 66 6f 72 65 20 73 74 61 72 74 69 6e 67 20 74 |efore starting t|
00000640 68 65 20 65 6d 75 6c 61 74 6f 72 0d 02 76 12 dd |he emulator..v..|
00000650 20 f2 73 6f 75 6e 64 5f 73 65 74 75 70 0d 02 80 | .sound_setup...|
00000660 0b ea 20 66 25 2c 61 25 0d 02 8a 3f c8 99 20 22 |.. f%,a%...?.. "|
00000670 53 6f 75 6e 64 5f 49 6e 73 74 61 6c 6c 56 6f 69 |Sound_InstallVoi|
00000680 63 65 22 2c 73 6f 75 6e 64 5f 76 6f 69 63 65 25 |ce",sound_voice%|
00000690 2c 30 20 b8 20 2c 73 6f 75 6e 64 5f 76 6f 69 63 |,0 . ,sound_voic|
000006a0 65 5f 73 6c 6f 74 25 0d 02 94 40 c8 99 20 22 53 |e_slot%...@.. "S|
000006b0 6f 75 6e 64 5f 43 6f 6e 66 69 67 75 72 65 22 2c |ound_Configure",|
000006c0 34 2c 32 30 38 2c 34 38 2c 30 2c 30 20 b8 20 73 |4,208,48,0,0 . s|
000006d0 63 5f 30 2c 73 63 5f 31 2c 73 63 5f 32 2c 73 63 |c_0,sc_1,sc_2,sc|
000006e0 5f 33 2c 73 63 5f 34 0d 02 9e 26 c8 99 20 22 53 |_3,sc_4...&.. "S|
000006f0 6f 75 6e 64 5f 41 74 74 61 63 68 56 6f 69 63 65 |ound_AttachVoice|
00000700 22 2c 31 2c 31 20 b8 20 2c 73 76 5f 31 0d 02 a8 |",1,1 . ,sv_1...|
00000710 26 c8 99 20 22 53 6f 75 6e 64 5f 41 74 74 61 63 |&.. "Sound_Attac|
00000720 68 56 6f 69 63 65 22 2c 32 2c 31 20 b8 20 2c 73 |hVoice",2,1 . ,s|
00000730 76 5f 32 0d 02 b2 26 c8 99 20 22 53 6f 75 6e 64 |v_2...&.. "Sound|
00000740 5f 41 74 74 61 63 68 56 6f 69 63 65 22 2c 33 2c |_AttachVoice",3,|
00000750 31 20 b8 20 2c 73 76 5f 33 0d 02 bc 26 c8 99 20 |1 . ,sv_3...&.. |
00000760 22 53 6f 75 6e 64 5f 41 74 74 61 63 68 56 6f 69 |"Sound_AttachVoi|
00000770 63 65 22 2c 34 2c 31 20 b8 20 2c 73 76 5f 34 0d |ce",4,1 . ,sv_4.|
00000780 02 c6 30 c8 99 20 22 53 6f 75 6e 64 5f 41 74 74 |..0.. "Sound_Att|
00000790 61 63 68 4e 61 6d 65 64 56 6f 69 63 65 22 2c 31 |achNamedVoice",1|
000007a0 2c 22 36 35 30 32 45 6d 75 6c 61 74 6f 72 22 0d |,"6502Emulator".|
000007b0 02 d0 30 c8 99 20 22 53 6f 75 6e 64 5f 41 74 74 |..0.. "Sound_Att|
000007c0 61 63 68 4e 61 6d 65 64 56 6f 69 63 65 22 2c 32 |achNamedVoice",2|
000007d0 2c 22 36 35 30 32 45 6d 75 6c 61 74 6f 72 22 0d |,"6502Emulator".|
000007e0 02 da 30 c8 99 20 22 53 6f 75 6e 64 5f 41 74 74 |..0.. "Sound_Att|
000007f0 61 63 68 4e 61 6d 65 64 56 6f 69 63 65 22 2c 33 |achNamedVoice",3|
00000800 2c 22 36 35 30 32 45 6d 75 6c 61 74 6f 72 22 0d |,"6502Emulator".|
00000810 02 e4 30 c8 99 20 22 53 6f 75 6e 64 5f 41 74 74 |..0.. "Sound_Att|
00000820 61 63 68 4e 61 6d 65 64 56 6f 69 63 65 22 2c 34 |achNamedVoice",4|
00000830 2c 22 36 35 30 32 45 6d 75 6c 61 74 6f 72 22 0d |,"6502Emulator".|
00000840 02 ee 3b f4 20 53 74 61 72 74 20 69 6e 66 69 6e |..;. Start infin|
00000850 69 74 65 20 64 75 72 61 74 69 6f 6e 20 6e 6f 74 |ite duration not|
00000860 65 73 20 6f 6e 20 65 61 63 68 20 6f 66 20 74 68 |es on each of th|
00000870 65 20 63 68 61 6e 6e 65 6c 73 0d 02 f8 26 c8 99 |e channels...&..|
00000880 20 22 53 6f 75 6e 64 5f 56 6f 6c 75 6d 65 22 2c | "Sound_Volume",|
00000890 76 6f 6c 75 6d 65 25 20 b8 20 73 63 5f 76 6f 6c |volume% . sc_vol|
000008a0 0d 03 02 30 f4 20 53 65 74 20 75 70 20 74 68 65 |...0. Set up the|
000008b0 20 6c 69 6e 65 61 72 20 74 6f 20 6c 6f 67 20 76 | linear to log v|
000008c0 6f 6c 75 6d 65 20 63 6f 6e 76 65 72 73 69 6f 6e |olume conversion|
000008d0 0d 03 0c 0f e3 20 66 25 3d 30 20 b8 20 26 46 0d |..... f%=0 . &F.|
000008e0 03 16 11 61 25 3d 66 25 2b 28 66 25 3c 3c 34 29 |...a%=f%+(f%<<4)|
000008f0 0d 03 20 11 61 25 3d 61 25 2b 28 61 25 3c 3c 38 |.. .a%=a%+(a%<<8|
00000900 29 0d 03 2a 12 61 25 3d 61 25 2b 28 61 25 3c 3c |)..*.a%=a%+(a%<<|
00000910 31 36 29 0d 03 34 25 c8 99 20 22 53 6f 75 6e 64 |16)..4%.. "Sound|
00000920 5f 53 6f 75 6e 64 4c 6f 67 22 2c 28 61 25 3e 3e |_SoundLog",(a%>>|
00000930 3e 31 29 20 b8 20 61 25 0d 03 3e 0d f4 50 52 49 |>1) . a%..>..PRI|
00000940 4e 54 20 61 25 0d 03 48 1d 3f 28 73 6f 75 6e 64 |NT a%..H.?(sound|
00000950 5f 76 6f 6c 5f 74 61 62 6c 65 25 2b 66 25 29 3d |_vol_table%+f%)=|
00000960 61 25 0d 03 52 05 ed 0d 03 5c 10 d4 20 31 2c 2d |a%..R....\.. 1,-|
00000970 31 2c 31 2c 32 35 35 0d 03 66 10 d4 20 32 2c 2d |1,1,255..f.. 2,-|
00000980 31 2c 31 2c 32 35 35 0d 03 70 10 d4 20 33 2c 2d |1,1,255..p.. 3,-|
00000990 31 2c 31 2c 32 35 35 0d 03 7a 10 d4 20 34 2c 2d |1,1,255..z.. 4,-|
000009a0 31 2c 31 2c 32 35 35 0d 03 84 05 e1 0d 03 8e 04 |1,1,255.........|
000009b0 0d 03 98 25 f4 20 43 61 6c 6c 20 61 66 74 65 72 |...%. Call after|
000009c0 20 65 78 69 74 69 6e 67 20 74 68 65 20 65 6d 75 | exiting the emu|
000009d0 6c 61 74 6f 72 0d 03 a2 14 dd 20 f2 73 6f 75 6e |lator..... .soun|
000009e0 64 5f 72 65 73 74 6f 72 65 0d 03 ac 1c c8 99 20 |d_restore...... |
000009f0 22 53 6f 75 6e 64 5f 56 6f 6c 75 6d 65 22 2c 73 |"Sound_Volume",s|
00000a00 63 5f 76 6f 6c 0d 03 b6 31 c8 99 20 22 53 6f 75 |c_vol...1.. "Sou|
00000a10 6e 64 5f 43 6f 6e 66 69 67 75 72 65 22 2c 73 63 |nd_Configure",sc|
00000a20 5f 30 2c 73 63 5f 31 2c 73 63 5f 32 2c 73 63 5f |_0,sc_1,sc_2,sc_|
00000a30 33 2c 73 63 5f 34 0d 03 c0 21 c8 99 20 22 53 6f |3,sc_4...!.. "So|
00000a40 75 6e 64 5f 41 74 74 61 63 68 56 6f 69 63 65 22 |und_AttachVoice"|
00000a50 2c 31 2c 73 76 5f 31 0d 03 ca 21 c8 99 20 22 53 |,1,sv_1...!.. "S|
00000a60 6f 75 6e 64 5f 41 74 74 61 63 68 56 6f 69 63 65 |ound_AttachVoice|
00000a70 22 2c 32 2c 73 76 5f 32 0d 03 d4 21 c8 99 20 22 |",2,sv_2...!.. "|
00000a80 53 6f 75 6e 64 5f 41 74 74 61 63 68 56 6f 69 63 |Sound_AttachVoic|
00000a90 65 22 2c 33 2c 73 76 5f 33 0d 03 de 21 c8 99 20 |e",3,sv_3...!.. |
00000aa0 22 53 6f 75 6e 64 5f 41 74 74 61 63 68 56 6f 69 |"Sound_AttachVoi|
00000ab0 63 65 22 2c 34 2c 73 76 5f 34 0d 03 e8 2e c8 99 |ce",4,sv_4......|
00000ac0 20 22 53 6f 75 6e 64 5f 52 65 6d 6f 76 65 56 6f | "Sound_RemoveVo|
00000ad0 69 63 65 22 2c 30 2c 73 6f 75 6e 64 5f 76 6f 69 |ice",0,sound_voi|
00000ae0 63 65 5f 73 6c 6f 74 25 0d 03 f2 05 e1 0d 03 fc |ce_slot%........|
00000af0 04 0d 04 06 30 f4 20 43 6f 64 65 20 74 6f 20 69 |....0. Code to i|
00000b00 6e 74 65 72 70 72 65 74 20 77 72 69 74 65 73 20 |nterpret writes |
00000b10 74 6f 20 74 68 65 20 73 6f 75 6e 64 20 63 68 69 |to the sound chi|
00000b20 70 0d 04 10 37 f4 20 6d 65 6d 3d 33 20 41 3d 34 |p...7. mem=3 A=4|
00000b30 20 58 3d 35 20 59 3d 36 20 46 3d 37 20 53 50 3d | X=5 Y=6 F=7 SP=|
00000b40 38 20 74 69 6d 65 3d 39 20 7a 70 63 3d 31 30 20 |8 time=9 zpc=10 |
00000b50 74 61 62 6c 65 3d 31 31 0d 04 1a 0c f4 20 70 3d |table=11..... p=|
00000b60 70 61 73 73 0d 04 24 12 dd 20 a4 73 6f 75 6e 64 |pass..$.. .sound|
00000b70 5f 6c 61 74 63 68 0d 04 2e 11 f2 73 6f 75 6e 64 |_latch.....sound|
00000b80 5f 64 65 66 69 6e 65 0d 04 38 0a 5b 4f 50 54 20 |_define..8.[OPT |
00000b90 70 0d 04 42 04 0d 04 4c 40 3b 20 74 68 65 20 66 |p..B...L@; the f|
00000ba0 6f 6c 6c 6f 77 69 6e 67 20 62 79 74 65 20 73 68 |ollowing byte sh|
00000bb0 6f 75 6c 64 20 62 65 20 77 72 69 74 74 65 6e 20 |ould be written |
00000bc0 62 79 20 72 65 67 62 5f 34 66 20 61 6e 64 20 73 |by regb_4f and s|
00000bd0 68 6f 75 6c 64 0d 04 56 30 3b 20 68 6f 6c 64 20 |hould..V0; hold |
00000be0 61 20 63 6f 70 79 20 6f 66 20 77 68 61 74 27 73 |a copy of what's|
00000bf0 20 6f 6e 20 74 68 65 20 73 6c 6f 77 20 64 61 74 | on the slow dat|
00000c00 61 20 62 75 73 0d 04 60 04 0d 04 6a 16 2e 73 6f |a bus..`...j..so|
00000c10 75 6e 64 5f 64 61 74 61 20 45 51 55 44 20 30 0d |und_data EQUD 0.|
00000c20 04 74 04 0d 04 7e 0c 3b 20 4e 6f 74 65 73 3a 0d |.t...~.; Notes:.|
00000c30 04 88 45 3b 20 43 6c 6f 63 6b 20 69 73 20 32 4d |..E; Clock is 2M|
00000c40 68 7a 2e 20 4f 6e 65 20 62 75 66 66 65 72 20 66 |hz. One buffer f|
00000c50 69 6c 6c 20 65 76 65 72 79 20 34 38 20 6d 69 63 |ill every 48 mic|
00000c60 72 6f 20 73 65 63 73 20 3d 20 39 36 20 63 79 63 |ro secs = 96 cyc|
00000c70 6c 65 73 2e 0d 04 92 43 3b 20 50 69 74 63 68 20 |les....C; Pitch |
00000c80 70 68 61 73 65 20 69 6e 63 72 65 6d 65 6e 74 20 |phase increment |
00000c90 3d 20 26 36 30 30 30 30 20 2f 20 28 31 30 20 62 |= &60000 / (10 b|
00000ca0 69 74 20 42 42 43 20 73 6f 75 6e 64 20 63 68 69 |it BBC sound chi|
00000cb0 70 20 66 72 65 71 29 0d 04 9c 40 3b 20 43 6c 65 |p freq)...@; Cle|
00000cc0 61 72 79 20 67 72 65 61 74 65 73 74 20 73 65 6e |ary greatest sen|
00000cd0 73 69 62 6c 65 20 70 69 74 63 68 20 69 6e 63 72 |sible pitch incr|
00000ce0 65 6d 65 6e 74 20 69 73 20 26 34 30 30 30 2c 20 |ement is &4000, |
00000cf0 73 6f 20 76 65 72 79 0d 04 a6 3b 3b 20 73 6d 61 |so very...;; sma|
00000d00 6c 6c 20 42 42 43 20 66 72 65 71 75 65 6e 63 69 |ll BBC frequenci|
00000d10 65 73 20 61 72 65 20 63 6f 6e 76 65 6e 74 69 6f |es are conventio|
00000d20 6e 61 6c 6c 79 20 6d 65 61 6e 69 6e 67 6c 65 73 |nally meaningles|
00000d30 73 2e 0d 04 b0 2e 3b 20 41 20 42 42 43 20 66 72 |s.....; A BBC fr|
00000d40 65 71 75 65 6e 63 79 20 6f 66 20 31 20 69 73 20 |equency of 1 is |
00000d50 61 73 73 75 6d 65 64 20 74 6f 20 62 65 20 61 6e |assumed to be an|
00000d60 0d 04 ba 3d 3b 20 61 74 74 65 6d 70 74 20 74 6f |...=; attempt to|
00000d70 20 6d 6f 64 75 6c 61 74 65 20 74 68 65 20 61 6d | modulate the am|
00000d80 70 6c 69 74 75 64 65 20 6d 61 6e 75 61 6c 6c 79 |plitude manually|
00000d90 20 28 65 67 20 53 75 70 65 72 69 6f 72 0d 04 c4 | (eg Superior...|
00000da0 32 3b 20 53 6f 66 74 77 61 72 65 20 73 70 65 65 |2; Software spee|
00000db0 63 68 29 20 61 6e 64 20 69 73 20 68 61 6e 64 6c |ch) and is handl|
00000dc0 65 64 20 61 63 63 6f 72 64 69 6e 67 6c 79 2e 0d |ed accordingly..|
00000dd0 04 ce 04 0d 04 d8 32 3b 45 20 43 61 6c 6c 65 64 |......2;E Called|
00000de0 20 77 68 65 6e 20 6c 61 74 63 68 20 77 72 69 74 | when latch writ|
00000df0 65 73 20 74 6f 20 73 6f 75 6e 64 20 67 65 6e 65 |es to sound gene|
00000e00 72 61 74 6f 72 0d 04 e2 41 3b 20 20 73 6f 75 6e |rator...A; soun|
00000e10 64 5f 64 61 74 61 20 63 6f 6e 74 61 69 6e 73 20 |d_data contains |
00000e20 61 20 63 6f 70 79 20 6f 66 20 74 68 65 20 62 79 |a copy of the by|
00000e30 74 65 20 77 72 69 74 74 65 6e 20 74 6f 20 74 68 |te written to th|
00000e40 65 20 73 6c 6f 77 0d 04 ec 0f 3b 20 20 64 61 74 |e slow....; dat|
00000e50 61 20 62 75 73 0d 04 f6 2a 3b 20 20 52 30 3d 76 |a bus...*; R0=v|
00000e60 61 6c 75 65 20 77 72 69 74 74 65 6e 20 74 6f 20 |alue written to |
00000e70 6c 61 74 63 68 20 28 62 30 2d 62 32 3d 30 29 0d |latch (b0-b2=0).|
00000e80 05 00 22 3b 20 20 52 33 3d 42 42 43 20 6d 65 6d |.."; R3=BBC mem|
00000e90 6f 72 79 20 61 64 64 72 65 73 73 20 28 6d 65 6d |ory address (mem|
00000ea0 29 0d 05 0a 33 3b 20 20 52 39 3d 74 69 6d 65 20 |)...3; R9=time |
00000eb0 69 6e 20 63 79 63 6c 65 73 20 75 6e 74 69 6c 20 |in cycles until |
00000ec0 6e 65 78 74 20 63 6c 6f 63 6b 20 69 6e 74 65 72 |next clock inter|
00000ed0 72 75 70 74 0d 05 14 1a 3b 58 20 52 30 2d 52 32 |rupt....;X R0-R2|
00000ee0 2c 52 31 33 20 63 6f 72 72 75 70 74 65 64 0d 05 |,R13 corrupted..|
00000ef0 1e 1b 3b 20 20 45 78 69 74 73 20 76 69 61 20 4d |..; Exits via M|
00000f00 4f 56 20 50 43 2c 52 31 34 0d 05 28 04 0d 05 32 |OV PC,R14..(...2|
00000f10 10 2e 73 6f 75 6e 64 5f 6c 61 74 63 68 0d 05 3c |..sound_latch..<|
00000f20 14 53 54 52 20 6d 65 6d 2c 6d 65 6d 73 74 6f 72 |.STR mem,memstor|
00000f30 65 0d 05 46 10 54 53 54 20 52 30 2c 23 31 3c 3c |e..F.TST R0,#1<<|
00000f40 33 0d 05 50 2e 4d 4f 56 4e 45 20 50 43 2c 52 31 |3..P.MOVNE PC,R1|
00000f50 34 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |4 |
00000f60 20 20 20 3b 20 61 63 74 69 76 65 20 6c 6f 77 0d | ; active low.|
00000f70 05 5a 21 4c 44 52 20 52 31 33 2c 28 73 6f 75 6e |.Z!LDR R13,(soun|
00000f80 64 5f 62 75 66 66 73 5f 61 64 64 72 2b 31 32 29 |d_buffs_addr+12)|
00000f90 0d 05 64 17 53 54 4d 46 44 20 52 31 33 21 2c 7b |..d.STMFD R13!,{|
00000fa0 52 33 2c 52 31 34 7d 0d 05 6e 38 4c 44 52 42 20 |R3,R14}..n8LDRB |
00000fb0 52 30 2c 73 6f 75 6e 64 5f 64 61 74 61 20 20 20 |R0,sound_data |
00000fc0 20 20 20 20 20 20 20 20 20 3b 20 67 65 74 20 74 | ; get t|
00000fd0 68 65 20 62 79 74 65 20 77 72 69 74 74 65 6e 0d |he byte written.|
00000fe0 05 78 10 54 53 54 20 52 30 2c 23 31 3c 3c 37 0d |.x.TST R0,#1<<7.|
00000ff0 05 82 38 42 45 51 20 73 6f 75 6e 64 5f 75 70 64 |..8BEQ sound_upd|
00001000 61 74 65 20 20 20 20 20 20 20 20 20 20 20 20 20 |ate |
00001010 20 3b 20 75 70 64 61 74 65 20 74 68 65 20 66 72 | ; update the fr|
00001020 65 71 75 65 6e 63 79 0d 05 8c 13 4d 4f 56 20 52 |equency....MOV R|
00001030 31 2c 52 30 2c 4c 53 52 23 35 0d 05 96 42 80 20 |1,R0,LSR#5...B. |
00001040 52 31 2c 52 31 2c 23 33 20 20 20 20 20 20 20 20 |R1,R1,#3 |
00001050 20 20 20 20 20 20 20 20 20 20 3b 20 63 68 61 6e | ; chan|
00001060 6e 65 6c 20 6e 75 6d 62 65 72 20 28 30 3d 74 6f |nel number (0=to|
00001070 6e 65 33 20 33 3d 6e 6f 69 73 65 29 0d 05 a0 10 |ne3 3=noise)....|
00001080 54 53 54 20 52 30 2c 23 31 3c 3c 34 0d 05 aa 32 |TST R0,#1<<4...2|
00001090 80 20 52 30 2c 52 30 2c 23 26 30 46 20 20 20 20 |. R0,R0,#&0F |
000010a0 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 64 61 | ; da|
000010b0 74 61 20 69 73 20 69 6e 20 62 30 2d 62 33 0d 05 |ta is in b0-b3..|
000010c0 b4 32 42 4e 45 20 73 6f 75 6e 64 5f 76 6f 6c 75 |.2BNE sound_volu|
000010d0 6d 65 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |me |
000010e0 3b 20 76 6f 6c 75 6d 65 20 63 6f 6e 74 72 6f 6c |; volume control|
000010f0 0d 05 be 32 54 45 51 20 52 31 2c 23 33 20 20 20 |...2TEQ R1,#3 |
00001100 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |
00001110 20 20 3b 20 6e 6f 69 73 65 20 63 68 61 6e 6e 65 | ; noise channe|
00001120 6c 3f 0d 05 c8 3e 53 54 52 4e 45 20 52 31 2c 73 |l?...>STRNE R1,s|
00001130 6f 75 6e 64 5f 63 68 61 6e 6e 65 6c 20 20 20 20 |ound_channel |
00001140 20 20 20 20 3b 20 69 66 20 6e 6f 74 20 73 65 74 | ; if not set|
00001150 20 63 75 72 72 65 6e 74 20 63 68 61 6e 6e 65 6c | current channel|
00001160 0d 05 d2 17 41 44 52 20 52 31 34 2c 73 6f 75 6e |....ADR R14,soun|
00001170 64 5f 66 72 65 71 30 0d 05 dc 3d 4c 44 52 20 52 |d_freq0...=LDR R|
00001180 33 2c 5b 52 31 34 2c 52 31 2c 4c 53 4c 23 32 5d |3,[R14,R1,LSL#2]|
00001190 20 20 20 20 20 20 20 20 20 3b 20 67 65 74 20 74 | ; get t|
000011a0 68 65 20 63 75 72 72 65 6e 74 20 66 72 65 71 75 |he current frequ|
000011b0 65 6e 63 79 0d 05 e6 37 42 49 43 20 52 32 2c 52 |ency...7BIC R2,R|
000011c0 33 2c 23 26 30 46 20 20 20 20 20 20 20 20 20 20 |3,#&0F |
000011d0 20 20 20 20 20 20 3b 20 63 6c 65 61 72 20 62 6f | ; clear bo|
000011e0 74 74 6f 6d 20 34 20 62 69 74 73 0d 05 f0 30 84 |ttom 4 bits...0.|
000011f0 52 20 52 32 2c 52 32 2c 52 30 20 20 20 20 20 20 |R R2,R2,R0 |
00001200 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 6e 65 | ; ne|
00001210 77 20 66 72 65 71 75 65 6e 63 79 0d 05 fa 31 53 |w frequency...1S|
00001220 54 52 20 52 32 2c 5b 52 31 34 2c 52 31 2c 4c 53 |TR R2,[R14,R1,LS|
00001230 4c 23 32 5d 20 20 20 20 20 20 20 20 20 3b 20 6e |L#2] ; n|
00001240 65 77 20 66 72 65 71 75 65 6e 63 79 0d 06 04 15 |ew frequency....|
00001250 42 20 73 6f 75 6e 64 5f 66 72 65 71 75 65 6e 63 |B sound_frequenc|
00001260 79 0d 06 0e 34 2e 73 6f 75 6e 64 5f 75 70 64 61 |y...4.sound_upda|
00001270 74 65 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |te |
00001280 20 20 20 3b 20 75 70 64 61 74 65 20 66 72 65 71 | ; update freq|
00001290 75 65 6e 63 79 0d 06 18 33 4c 44 52 20 52 31 2c |uency...3LDR R1,|
000012a0 73 6f 75 6e 64 5f 63 68 61 6e 6e 65 6c 20 20 20 |sound_channel |
000012b0 20 20 20 20 20 20 20 3b 20 63 75 72 72 65 6e 74 | ; current|
000012c0 20 63 68 61 6e 6e 65 6c 0d 06 22 17 41 44 52 20 | channel..".ADR |
000012d0 52 31 34 2c 73 6f 75 6e 64 5f 66 72 65 71 30 0d |R14,sound_freq0.|
000012e0 06 2c 3d 4c 44 52 20 52 33 2c 5b 52 31 34 2c 52 |.,=LDR R3,[R14,R|
000012f0 31 2c 4c 53 4c 23 32 5d 20 20 20 20 20 20 20 20 |1,LSL#2] |
00001300 20 3b 20 67 65 74 20 74 68 65 20 63 75 72 72 65 | ; get the curre|
00001310 6e 74 20 66 72 65 71 75 65 6e 63 79 0d 06 36 34 |nt frequency..64|
00001320 80 20 52 32 2c 52 33 2c 23 26 30 46 20 20 20 20 |. R2,R3,#&0F |
00001330 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 6c 6f | ; lo|
00001340 6f 73 65 20 74 68 65 20 74 6f 70 20 62 69 74 73 |ose the top bits|
00001350 0d 06 40 34 80 20 52 30 2c 52 30 2c 23 26 33 46 |..@4. R0,R0,#&3F|
00001360 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |
00001370 3b 20 62 34 2d 62 39 20 6f 66 20 66 72 65 71 75 |; b4-b9 of frequ|
00001380 65 6e 63 79 0d 06 4a 3a 84 52 20 52 32 2c 52 32 |ency..J:.R R2,R2|
00001390 2c 52 30 2c 4c 53 4c 23 34 20 20 20 20 20 20 20 |,R0,LSL#4 |
000013a0 20 20 20 20 20 3b 20 61 64 64 20 6e 65 77 20 68 | ; add new h|
000013b0 69 67 68 20 6f 72 64 65 72 20 62 69 74 73 0d 06 |igh order bits..|
000013c0 54 31 53 54 52 20 52 32 2c 5b 52 31 34 2c 52 31 |T1STR R2,[R14,R1|
000013d0 2c 4c 53 4c 23 32 5d 20 20 20 20 20 20 20 20 20 |,LSL#2] |
000013e0 3b 20 6e 65 77 20 66 72 65 71 75 65 6e 63 79 0d |; new frequency.|
000013f0 06 5e 15 42 20 73 6f 75 6e 64 5f 66 72 65 71 75 |.^.B sound_frequ|
00001400 65 6e 63 79 0d 06 68 3e 3b 4e 42 20 6e 6f 74 20 |ency..h>;NB not |
00001410 73 75 72 65 20 77 68 65 74 68 65 72 20 79 6f 75 |sure whether you|
00001420 20 73 68 6f 75 6c 64 20 75 70 64 61 74 65 20 73 | should update s|
00001430 6f 75 6e 64 5f 63 68 61 6e 6e 65 6c 20 68 65 72 |ound_channel her|
00001440 65 3f 0d 06 72 3c 2e 73 6f 75 6e 64 5f 76 6f 6c |e?..r<.sound_vol|
00001450 75 6d 65 20 20 20 20 20 20 20 20 20 20 20 20 20 |ume |
00001460 20 20 20 20 3b 20 52 30 3d 76 6f 6c 75 6d 65 20 | ; R0=volume |
00001470 28 31 35 20 6f 66 66 2d 30 20 6d 61 78 29 0d 06 |(15 off-0 max)..|
00001480 7c 3d 52 53 42 20 52 30 2c 52 30 2c 23 31 35 20 ||=RSB R0,R0,#15 |
00001490 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |
000014a0 3b 20 6e 65 77 20 76 6f 6c 20 30 3d 6f 66 66 20 |; new vol 0=off |
000014b0 31 35 3d 6d 61 78 20 6e 6f 77 21 0d 06 86 16 41 |15=max now!....A|
000014c0 44 52 20 52 31 34 2c 73 6f 75 6e 64 5f 61 6d 70 |DR R14,sound_amp|
000014d0 30 0d 06 90 2e 4c 44 52 42 20 52 32 2c 5b 52 31 |0....LDRB R2,[R1|
000014e0 34 2c 52 31 5d 20 20 20 20 20 20 20 20 20 20 20 |4,R1] |
000014f0 20 20 20 3b 20 6f 6c 64 20 76 6f 6c 75 6d 65 0d | ; old volume.|
00001500 06 9a 0d 54 45 51 20 52 30 2c 52 32 0d 06 a4 3a |...TEQ R0,R2...:|
00001510 3b 42 45 51 20 73 6f 75 6e 64 5f 6c 61 74 63 68 |;BEQ sound_latch|
00001520 5f 65 6e 64 20 20 20 20 20 20 20 20 20 20 20 3b |_end ;|
00001530 20 76 6f 6c 75 6d 65 20 68 61 73 6e 27 74 20 63 | volume hasn't c|
00001540 68 61 6e 67 65 64 0d 06 ae 38 53 54 52 42 20 52 |hanged...8STRB R|
00001550 30 2c 5b 52 31 34 2c 52 31 5d 20 20 20 20 20 20 |0,[R14,R1] |
00001560 20 20 20 20 20 20 20 20 3b 20 77 72 69 74 65 20 | ; write |
00001570 74 68 65 20 6e 65 77 20 76 6f 6c 75 6d 65 0d 06 |the new volume..|
00001580 b8 0d 54 45 51 20 52 31 2c 23 33 0d 06 c2 38 42 |..TEQ R1,#3...8B|
00001590 45 51 20 73 6f 75 6e 64 5f 6c 61 74 63 68 5f 65 |EQ sound_latch_e|
000015a0 6e 64 20 20 20 20 20 20 20 20 20 20 20 3b 20 69 |nd ; i|
000015b0 67 6e 6f 72 65 20 6e 6f 69 73 65 20 63 68 61 6e |gnore noise chan|
000015c0 6e 65 6c 0d 06 cc 17 41 44 52 20 52 31 34 2c 73 |nel....ADR R14,s|
000015d0 6f 75 6e 64 5f 66 72 65 71 30 0d 06 d6 39 4c 44 |ound_freq0...9LD|
000015e0 52 20 52 30 2c 5b 52 31 34 2c 52 31 2c 4c 53 4c |R R0,[R14,R1,LSL|
000015f0 23 32 5d 20 20 20 20 20 20 20 20 20 3b 20 67 65 |#2] ; ge|
00001600 74 20 66 72 65 71 75 65 6e 63 79 20 73 65 74 74 |t frequency sett|
00001610 69 6e 67 0d 06 e0 0d 54 45 51 20 52 30 2c 23 31 |ing....TEQ R0,#1|
00001620 0d 06 ea 2f 42 4c 45 51 20 6d 61 6b 65 5f 73 6f |.../BLEQ make_so|
00001630 75 6e 64 20 20 20 20 20 20 20 20 20 20 20 20 20 |und |
00001640 20 20 3b 20 69 74 27 73 20 73 70 65 65 63 68 0d | ; it's speech.|
00001650 06 f4 15 42 20 73 6f 75 6e 64 5f 6c 61 74 63 68 |...B sound_latch|
00001660 5f 65 6e 64 0d 06 fe 43 2e 73 6f 75 6e 64 5f 66 |_end...C.sound_f|
00001670 72 65 71 75 65 6e 63 79 20 20 20 20 20 20 20 20 |requency |
00001680 20 20 20 20 20 20 3b 20 52 31 3d 63 68 61 6e 6e | ; R1=chann|
00001690 65 6c 20 52 32 3d 6e 65 77 20 66 72 65 71 20 28 |el R2=new freq (|
000016a0 31 30 20 62 69 74 29 0d 07 08 38 54 45 51 20 52 |10 bit)...8TEQ R|
000016b0 31 2c 23 33 20 20 20 20 20 20 20 20 20 20 20 20 |1,#3 |
000016c0 20 20 20 20 20 20 20 20 20 3b 20 52 33 3d 6f 6c | ; R3=ol|
000016d0 64 20 66 72 65 71 20 28 31 30 20 62 69 74 29 0d |d freq (10 bit).|
000016e0 07 12 3f 42 4c 45 51 20 73 6f 75 6e 64 5f 6e 6f |..?BLEQ sound_no|
000016f0 69 73 65 66 72 65 71 20 20 20 20 20 20 20 20 20 |isefreq |
00001700 20 3b 20 43 6f 6e 76 65 72 74 20 52 32 20 74 6f | ; Convert R2 to|
00001710 20 31 30 20 62 69 74 20 66 6f 72 6d 61 74 0d 07 | 10 bit format..|
00001720 1c 34 54 45 51 20 52 32 2c 23 31 20 20 20 20 20 |.4TEQ R2,#1 |
00001730 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |
00001740 3b 20 63 68 65 63 6b 20 66 6f 72 20 73 70 65 61 |; check for spea|
00001750 63 68 0d 07 26 1a 42 45 51 20 73 6f 75 6e 64 5f |ch..&.BEQ sound_|
00001760 73 70 65 61 63 68 5f 73 74 61 72 74 0d 07 30 0d |speach_start..0.|
00001770 54 45 51 20 52 33 2c 23 31 0d 07 3a 1a 42 4c 45 |TEQ R3,#1..:.BLE|
00001780 51 20 73 6f 75 6e 64 5f 73 70 65 61 63 68 5f 73 |Q sound_speach_s|
00001790 74 6f 70 0d 07 44 12 4d 4f 56 20 52 30 2c 23 26 |top..D.MOV R0,#&|
000017a0 36 30 30 30 30 0d 07 4e 37 53 54 4d 46 44 20 52 |60000..N7STMFD R|
000017b0 31 33 21 2c 7b 52 31 7d 20 20 20 20 20 20 20 20 |13!,{R1} |
000017c0 20 20 20 20 20 20 20 3b 20 73 61 76 65 20 63 68 | ; save ch|
000017d0 61 6e 6e 65 6c 20 6e 75 6d 62 65 72 0d 07 58 2f |annel number..X/|
000017e0 4d 4f 56 20 52 31 2c 52 32 20 20 20 20 20 20 20 |MOV R1,R2 |
000017f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 | ; |
00001800 64 65 6e 6f 6d 65 6e 61 74 6f 72 0d 07 62 44 42 |denomenator..bDB|
00001810 4c 20 64 69 76 5f 6d 6f 64 20 20 20 20 20 20 20 |L div_mod |
00001820 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 52 | ; R|
00001830 30 3d 70 69 74 63 68 20 61 63 63 75 6d 75 6c 61 |0=pitch accumula|
00001840 74 6f 72 20 69 6e 63 20 63 6f 72 72 20 52 33 0d |tor inc corr R3.|
00001850 07 6c 3a 4c 44 4d 46 44 20 52 31 33 21 2c 7b 52 |.l:LDMFD R13!,{R|
00001860 31 7d 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |1} |
00001870 20 3b 20 72 65 73 74 6f 72 65 20 63 68 61 6e 6e | ; restore chann|
00001880 65 6c 20 6e 75 6d 62 65 72 0d 07 76 0d 43 4d 50 |el number..v.CMP|
00001890 20 52 30 2c 23 30 0d 07 80 0f 4d 4f 56 4c 45 20 | R0,#0....MOVLE |
000018a0 52 30 2c 23 30 0d 07 8a 11 43 4d 50 20 52 30 2c |R0,#0....CMP R0,|
000018b0 23 26 34 30 30 30 0d 07 94 3a 4d 4f 56 47 45 20 |#&4000...:MOVGE |
000018c0 52 30 2c 23 26 34 30 30 30 20 20 20 20 20 20 20 |R0,#&4000 |
000018d0 20 20 20 20 20 20 20 20 3b 20 52 30 3d 6e 65 77 | ; R0=new|
000018e0 20 70 69 74 63 68 20 69 6e 63 72 65 6d 65 6e 74 | pitch increment|
000018f0 0d 07 9e 18 41 44 52 20 52 31 34 2c 73 6f 75 6e |....ADR R14,soun|
00001900 64 5f 70 69 74 63 68 30 0d 07 a8 19 4c 44 52 20 |d_pitch0....LDR |
00001910 52 32 2c 5b 52 31 34 2c 52 31 2c 4c 53 4c 23 32 |R2,[R14,R1,LSL#2|
00001920 5d 0d 07 b2 14 4d 4f 56 20 52 32 2c 52 32 2c 4c |]....MOV R2,R2,L|
00001930 53 52 23 31 36 0d 07 bc 3e 84 52 20 52 32 2c 52 |SR#16...>.R R2,R|
00001940 30 2c 52 32 2c 4c 53 4c 23 31 36 20 20 20 20 20 |0,R2,LSL#16 |
00001950 20 20 20 20 20 20 3b 20 69 6e 73 74 61 6c 6c 20 | ; install |
00001960 6e 65 77 20 70 69 74 63 68 20 69 6e 63 72 65 6d |new pitch increm|
00001970 65 6e 74 0d 07 c6 19 53 54 52 20 52 32 2c 5b 52 |ent....STR R2,[R|
00001980 31 34 2c 52 31 2c 4c 53 4c 23 32 5d 0d 07 d0 39 |14,R1,LSL#2]...9|
00001990 54 45 51 20 52 31 2c 23 32 20 20 20 20 20 20 20 |TEQ R1,#2 |
000019a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 | ; |
000019b0 69 73 20 69 74 20 70 69 74 63 68 20 63 68 61 6e |is it pitch chan|
000019c0 6e 65 6c 20 31 0d 07 da 26 42 4e 45 20 73 6f 75 |nel 1...&BNE sou|
000019d0 6e 64 5f 6c 61 74 63 68 5f 65 6e 64 20 20 20 20 |nd_latch_end |
000019e0 20 20 20 20 20 20 20 3b 20 6e 6f 0d 07 e4 44 4c | ; no...DL|
000019f0 44 52 20 52 30 2c 73 6f 75 6e 64 5f 66 72 65 71 |DR R0,sound_freq|
00001a00 33 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 33 |3 ; 3|
00001a10 20 62 69 74 20 66 72 65 71 20 73 65 74 74 69 6e | bit freq settin|
00001a20 67 20 6f 66 20 6e 6f 69 73 65 20 63 68 61 6e 0d |g of noise chan.|
00001a30 07 ee 0e 80 20 52 30 2c 52 30 2c 23 33 0d 07 f8 |.... R0,R0,#3...|
00001a40 3d 54 45 51 20 52 30 2c 23 33 20 20 20 20 20 20 |=TEQ R0,#3 |
00001a50 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b | ;|
00001a60 20 69 73 20 69 74 20 62 61 73 65 64 20 6f 6e 20 | is it based on |
00001a70 63 68 61 6e 6e 65 6c 20 31 3f 0d 08 02 26 42 4e |channel 1?...&BN|
00001a80 45 20 73 6f 75 6e 64 5f 6c 61 74 63 68 5f 65 6e |E sound_latch_en|
00001a90 64 20 20 20 20 20 20 20 20 20 20 20 3b 20 6e 6f |d ; no|
00001aa0 0d 08 0c 13 3b 42 4c 20 73 6f 75 6e 64 5f 64 65 |....;BL sound_de|
00001ab0 62 75 67 0d 08 16 2d 4d 4f 56 20 52 31 2c 23 33 |bug...-MOV R1,#3|
00001ac0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |
00001ad0 20 20 20 20 20 3b 20 63 68 61 6e 6e 65 6c 20 30 | ; channel 0|
00001ae0 0d 08 20 3e 4c 44 52 20 52 32 2c 73 6f 75 6e 64 |.. >LDR R2,sound|
00001af0 5f 66 72 65 71 33 20 20 20 20 20 20 20 20 20 20 |_freq3 |
00001b00 20 20 3b 20 63 68 61 6e 6e 65 6c 20 30 20 31 30 | ; channel 0 10|
00001b10 2d 62 69 74 20 66 72 65 71 75 65 6e 63 79 0d 08 |-bit frequency..|
00001b20 2a 42 42 20 73 6f 75 6e 64 5f 66 72 65 71 75 65 |*BB sound_freque|
00001b30 6e 63 79 20 20 20 20 20 20 20 20 20 20 20 20 20 |ncy |
00001b40 3b 20 75 70 64 61 74 65 20 66 72 65 71 75 65 6e |; update frequen|
00001b50 63 79 20 66 6f 72 20 63 68 61 6e 6e 65 6c 20 30 |cy for channel 0|
00001b60 0d 08 34 28 2e 73 6f 75 6e 64 5f 6c 61 74 63 68 |..4(.sound_latch|
00001b70 5f 65 6e 64 20 20 20 20 20 20 20 20 20 20 20 20 |_end |
00001b80 20 20 3b 20 45 58 49 54 0d 08 3e 38 3b 42 4c 20 | ; EXIT..>8;BL |
00001b90 73 6f 75 6e 64 5f 64 65 62 75 67 20 20 20 20 20 |sound_debug |
00001ba0 20 20 20 20 20 20 20 20 20 20 20 3b 20 70 72 69 | ; pri|
00001bb0 6e 74 20 75 70 20 64 65 62 75 67 20 64 61 74 61 |nt up debug data|
00001bc0 0d 08 48 28 4c 44 4d 46 44 20 52 31 33 21 2c 7b |..H(LDMFD R13!,{|
00001bd0 52 33 2c 50 43 7d 20 20 20 20 20 20 20 20 20 20 |R3,PC} |
00001be0 20 20 3b 20 45 58 49 54 0d 08 52 17 2e 73 6f 75 | ; EXIT..R..sou|
00001bf0 6e 64 5f 73 70 65 61 63 68 5f 73 74 61 72 74 0d |nd_speach_start.|
00001c00 08 5c 0d 54 45 51 20 52 33 2c 23 31 0d 08 66 33 |.\.TEQ R3,#1..f3|
00001c10 42 45 51 20 73 6f 75 6e 64 5f 6c 61 74 63 68 5f |BEQ sound_latch_|
00001c20 65 6e 64 20 20 20 20 20 20 20 20 20 20 20 3b 20 |end ; |
00001c30 61 6c 72 65 61 64 79 20 73 74 61 72 74 65 64 0d |already started.|
00001c40 08 70 15 42 4c 20 73 6f 75 6e 64 5f 67 65 74 5f |.p.BL sound_get_|
00001c50 74 69 6d 65 0d 08 7a 16 41 44 52 20 52 30 2c 73 |time..z.ADR R0,s|
00001c60 6f 75 6e 64 5f 74 69 6d 65 30 0d 08 84 42 53 54 |ound_time0...BST|
00001c70 52 20 52 32 2c 5b 52 30 2c 52 31 2c 4c 53 4c 23 |R R2,[R0,R1,LSL#|
00001c80 32 5d 20 20 20 20 20 20 20 20 20 20 3b 20 74 69 |2] ; ti|
00001c90 6d 65 20 74 68 69 73 20 63 68 61 6e 6e 65 6c 20 |me this channel |
00001ca0 6c 61 73 74 20 75 70 64 61 74 65 64 0d 08 8e 0d |last updated....|
00001cb0 54 45 51 20 52 31 2c 23 30 0d 08 98 13 3b 42 4c |TEQ R1,#0....;BL|
00001cc0 45 51 20 6c 6f 67 5f 73 74 61 72 74 0d 08 a2 15 |EQ log_start....|
00001cd0 42 20 73 6f 75 6e 64 5f 6c 61 74 63 68 5f 65 6e |B sound_latch_en|
00001ce0 64 0d 08 ac 04 0d 08 b6 1f 3b 45 20 43 61 6c 6c |d........;E Call|
00001cf0 65 64 20 77 68 65 6e 20 73 70 65 61 63 68 20 73 |ed when speach s|
00001d00 74 6f 70 73 0d 08 c0 12 3b 58 20 43 6f 72 72 75 |tops....;X Corru|
00001d10 70 74 73 20 52 30 0d 08 ca 04 0d 08 d4 16 2e 73 |pts R0.........s|
00001d20 6f 75 6e 64 5f 73 70 65 61 63 68 5f 73 74 6f 70 |ound_speach_stop|
00001d30 0d 08 de 0d 54 45 51 20 52 31 2c 23 30 0d 08 e8 |....TEQ R1,#0...|
00001d40 10 3b 42 45 51 20 6c 6f 67 5f 65 6e 64 0d 08 f2 |.;BEQ log_end...|
00001d50 0e 4d 4f 56 20 50 43 2c 52 31 34 0d 08 fc 04 0d |.MOV PC,R14.....|
00001d60 09 06 0d 2e 6d 65 6d 73 74 6f 72 65 0d 09 10 0a |....memstore....|
00001d70 45 51 55 44 20 30 0d 09 1a 04 0d 09 24 28 3b 45 |EQUD 0......$(;E|
00001d80 20 52 39 3d 45 6d 75 6c 61 74 6f 72 20 74 69 6d | R9=Emulator tim|
00001d90 65 20 27 74 69 6c 6c 20 6e 65 78 74 20 65 76 65 |e 'till next eve|
00001da0 6e 74 0d 09 2e 3b 3b 58 20 52 32 3d 63 75 72 72 |nt...;;X R2=curr|
00001db0 65 6e 74 20 74 69 6d 65 20 6f 6e 20 74 68 65 20 |ent time on the |
00001dc0 73 6f 75 6e 64 20 64 65 63 72 65 6d 65 6e 74 69 |sound decrementi|
00001dd0 6e 67 20 32 4d 48 7a 20 63 6c 6f 63 6b 0d 09 38 |ng 2MHz clock..8|
00001de0 13 3b 20 20 52 30 20 63 6f 72 72 75 70 74 65 64 |.; R0 corrupted|
00001df0 0d 09 42 04 0d 09 4c 13 2e 73 6f 75 6e 64 5f 67 |..B...L..sound_g|
00001e00 65 74 5f 74 69 6d 65 0d 09 56 13 4c 44 52 20 52 |et_time..V.LDR R|
00001e10 30 2c 6d 65 6d 73 74 6f 72 65 0d 09 60 14 4c 44 |0,memstore..`.LD|
00001e20 52 20 52 32 2c 5b 52 30 2c 23 6d 69 6e 5d 0d 09 |R R2,[R0,#min]..|
00001e30 6a 40 53 55 42 20 52 32 2c 52 32 2c 52 39 20 20 |j@SUB R2,R2,R9 |
00001e40 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |
00001e50 3b 20 74 69 6d 65 20 70 61 73 73 65 64 20 73 69 |; time passed si|
00001e60 6e 63 65 20 6c 61 73 74 20 65 76 65 6e 74 0d 09 |nce last event..|
00001e70 74 1c 4c 44 52 20 52 30 2c 5b 52 30 2c 23 73 6f |t.LDR R0,[R0,#so|
00001e80 75 6e 64 5f 74 69 6d 65 72 5d 0d 09 7e 3e 53 55 |und_timer]..~>SU|
00001e90 42 20 52 32 2c 52 30 2c 52 32 20 20 20 20 20 20 |B R2,R0,R2 |
00001ea0 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 63 75 | ; cu|
00001eb0 72 72 65 6e 74 20 74 69 6d 65 20 28 64 65 63 20 |rrent time (dec |
00001ec0 61 74 20 32 4d 68 7a 29 0d 09 88 0e 4d 4f 56 20 |at 2Mhz)....MOV |
00001ed0 50 43 2c 52 31 34 0d 09 92 04 0d 09 9c 3e 3b 45 |PC,R14.......>;E|
00001ee0 20 56 6f 6c 75 6d 65 20 63 68 61 6e 67 65 64 20 | Volume changed |
00001ef0 28 6e 6f 74 20 6a 75 73 74 20 62 65 65 6e 20 73 |(not just been s|
00001f00 65 74 20 74 6f 20 74 68 65 20 73 61 6d 65 20 76 |et to the same v|
00001f10 61 6c 75 65 21 21 21 29 0d 09 a6 23 3b 20 20 54 |alue!!!)...#; T|
00001f20 68 69 73 20 63 68 61 6e 6e 65 6c 20 69 6e 20 73 |his channel in s|
00001f30 70 65 65 63 68 20 6d 6f 64 65 2e 0d 09 b0 2a 3b |peech mode....*;|
00001f40 20 20 52 32 3d 74 68 65 20 6f 6c 64 20 76 6f 6c | R2=the old vol|
00001f50 75 6d 65 20 62 65 66 6f 72 65 20 74 68 65 20 63 |ume before the c|
00001f60 68 61 6e 67 65 0d 09 ba 2a 3b 20 20 52 31 3d 42 |hange...*; R1=B|
00001f70 42 43 20 63 68 61 6e 6e 65 6c 20 6e 75 6d 62 65 |BC channel numbe|
00001f80 72 20 28 30 2d 33 29 20 52 39 3d 74 69 6d 65 0d |r (0-3) R9=time.|
00001f90 09 c4 34 3b 58 20 42 75 66 66 65 72 20 66 69 6c |..4;X Buffer fil|
00001fa0 6c 65 64 20 66 6f 72 20 6d 61 6e 75 61 6c 20 61 |led for manual a|
00001fb0 6d 70 6c 69 74 75 64 65 20 6d 6f 64 75 6c 61 74 |mplitude modulat|
00001fc0 69 6f 6e 0d 09 ce 13 3b 20 20 52 30 20 63 6f 72 |ion....; R0 cor|
00001fd0 72 75 70 74 65 64 0d 09 d8 04 0d 09 e2 0f 2e 6d |rupted.........m|
00001fe0 61 6b 65 5f 73 6f 75 6e 64 0d 09 ec 1a 53 54 4d |ake_sound....STM|
00001ff0 46 44 20 52 31 33 21 2c 7b 52 31 2d 52 35 2c 52 |FD R13!,{R1-R5,R|
00002000 31 34 7d 0d 09 f6 0f 3b 20 54 45 51 20 52 31 2c |14}....; TEQ R1,|
00002010 23 30 0d 0a 00 1d 3b 20 4c 44 4d 4e 45 46 44 20 |#0....; LDMNEFD |
00002020 52 31 33 21 2c 7b 52 31 2d 52 35 2c 50 43 7d 0d |R13!,{R1-R5,PC}.|
00002030 0a 0a 18 3b 20 4c 44 52 42 20 52 30 2c 5b 6d 65 |...; LDRB R0,[me|
00002040 6d 2c 23 26 36 37 5d 0d 0a 14 19 3b 20 4c 44 52 |m,#&67]....; LDR|
00002050 42 20 52 31 34 2c 5b 6d 65 6d 2c 23 26 36 38 5d |B R14,[mem,#&68]|
00002060 0d 0a 1e 19 3b 20 41 44 44 20 52 30 2c 52 30 2c |....; ADD R0,R0,|
00002070 52 31 34 2c 4c 53 4c 23 38 0d 0a 28 1c 3b 20 4c |R14,LSL#8..(.; L|
00002080 44 52 42 20 52 31 34 2c 5b 52 30 2c 59 2c 4c 53 |DRB R14,[R0,Y,LS|
00002090 52 23 32 34 5d 0d 0a 32 11 3b 20 41 44 44 20 52 |R#24]..2.; ADD R|
000020a0 30 2c 52 30 2c 59 0d 0a 3c 1a 3b 20 41 44 44 20 |0,R0,Y..<.; ADD |
000020b0 52 30 2c 52 30 2c 52 31 34 2c 4c 53 4c 23 31 36 |R0,R0,R14,LSL#16|
000020c0 0d 0a 46 17 3b 20 4c 44 52 20 52 30 2c 5b 6d 65 |..F.; LDR R0,[me|
000020d0 6d 2c 23 26 36 30 5d 0d 0a 50 11 3b 20 42 4c 20 |m,#&60]..P.; BL |
000020e0 6c 6f 67 5f 77 6f 72 64 0d 0a 5a 0f 3b 20 4d 4f |log_word..Z.; MO|
000020f0 56 20 52 30 2c 52 32 0d 0a 64 11 3b 20 42 4c 20 |V R0,R2..d.; BL |
00002100 6c 6f 67 5f 77 6f 72 64 0d 0a 6e 32 4d 4f 56 20 |log_word..n2MOV |
00002110 52 34 2c 52 32 2c 4c 53 4c 23 31 20 20 20 20 20 |R4,R2,LSL#1 |
00002120 20 20 20 20 20 20 20 20 20 20 3b 20 61 6d 70 6c | ; ampl|
00002130 69 74 75 64 65 20 30 2d 33 30 0d 0a 78 37 53 55 |itude 0-30..x7SU|
00002140 42 53 20 52 34 2c 52 34 2c 23 31 35 20 20 20 20 |BS R4,R4,#15 |
00002150 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 61 6d | ; am|
00002160 70 6c 69 74 75 64 65 20 2d 31 35 20 74 6f 20 31 |plitude -15 to 1|
00002170 35 0d 0a 82 0f 4d 4f 56 50 4c 20 52 30 2c 23 30 |5....MOVPL R0,#0|
00002180 0d 0a 8c 2c 4d 4f 56 4d 49 20 52 30 2c 23 31 20 |...,MOVMI R0,#1 |
00002190 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |
000021a0 20 20 3b 20 73 69 67 6e 20 62 69 74 0d 0a 96 32 | ; sign bit...2|
000021b0 52 53 42 4d 49 20 52 34 2c 52 34 2c 23 30 20 20 |RSBMI R4,R4,#0 |
000021c0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 | ; |
000021d0 6e 6f 77 20 2b 76 65 20 28 31 2d 31 35 29 0d 0a |now +ve (1-15)..|
000021e0 a0 31 4c 44 52 20 52 31 34 2c 28 73 6f 75 6e 64 |.1LDR R14,(sound|
000021f0 5f 62 75 66 66 73 5f 61 64 64 72 2b 34 29 20 20 |_buffs_addr+4) |
00002200 3b 20 6c 6f 67 20 61 6d 70 20 74 61 62 6c 65 0d |; log amp table.|
00002210 0a aa 2c 4c 44 52 42 20 52 34 2c 5b 52 31 34 2c |..,LDRB R4,[R14,|
00002220 52 34 5d 20 20 20 20 20 20 20 20 20 20 20 20 20 |R4] |
00002230 20 3b 20 56 49 44 43 20 61 6d 70 0d 0a b4 3c 82 | ; VIDC amp...<.|
00002240 20 52 34 2c 52 34 2c 52 30 20 20 20 20 20 20 20 | R4,R4,R0 |
00002250 20 20 20 20 20 20 20 20 20 20 20 3b 20 62 75 6e | ; bun|
00002260 67 20 69 6e 20 73 69 67 6e 20 74 6f 20 67 65 74 |g in sign to get|
00002270 20 73 61 6d 70 6c 65 0d 0a be 33 42 4c 20 73 6f | sample...3BL so|
00002280 75 6e 64 5f 67 65 74 5f 74 69 6d 65 20 20 20 20 |und_get_time |
00002290 20 20 20 20 20 20 20 20 20 3b 20 52 32 3d 63 75 | ; R2=cu|
000022a0 72 72 65 6e 74 20 74 69 6d 65 0d 0a c8 17 41 44 |rrent time....AD|
000022b0 52 20 52 31 34 2c 73 6f 75 6e 64 5f 74 69 6d 65 |R R14,sound_time|
000022c0 30 0d 0a d2 42 4c 44 52 20 52 33 2c 5b 52 31 34 |0...BLDR R3,[R14|
000022d0 2c 52 31 2c 4c 53 4c 23 32 5d 20 20 20 20 20 20 |,R1,LSL#2] |
000022e0 20 20 20 3b 20 74 69 6d 65 20 74 68 69 73 20 63 | ; time this c|
000022f0 68 61 6e 6e 65 6c 20 6c 61 73 74 20 75 70 64 61 |hannel last upda|
00002300 74 65 64 0d 0a dc 41 53 55 42 53 20 52 30 2c 52 |ted...ASUBS R0,R|
00002310 33 2c 52 32 20 20 20 20 20 20 20 20 20 20 20 20 |3,R2 |
00002320 20 20 20 20 20 3b 20 74 69 6d 65 20 70 61 73 73 | ; time pass|
00002330 65 64 20 73 69 6e 63 65 20 6c 61 73 74 20 75 70 |ed since last up|
00002340 64 61 74 65 0d 0a e6 39 4d 4f 56 4d 49 20 52 33 |date...9MOVMI R3|
00002350 2c 52 32 20 20 20 20 20 20 20 20 20 20 20 20 20 |,R2 |
00002360 20 20 20 20 20 20 3b 20 63 6c 69 70 20 69 66 20 | ; clip if |
00002370 67 6f 6e 65 20 6e 65 67 61 74 69 76 65 0d 0a f0 |gone negative...|
00002380 41 43 4d 50 20 52 30 2c 23 26 43 30 30 30 20 20 |ACMP R0,#&C000 |
00002390 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b | ;|
000023a0 20 67 72 65 61 74 65 72 20 74 68 61 6e 20 6f 6e | greater than on|
000023b0 65 20 62 75 66 66 65 72 20 66 69 6c 6c 3f 0d 0a |e buffer fill?..|
000023c0 fa 2e 41 44 44 47 45 20 52 33 2c 52 32 2c 23 26 |..ADDGE R3,R2,#&|
000023d0 43 30 30 30 20 20 20 20 20 20 20 20 20 20 20 20 |C000 |
000023e0 3b 20 63 6c 69 70 20 69 66 20 73 6f 0d 0b 04 11 |; clip if so....|
000023f0 3b 20 42 4c 20 6c 6f 67 5f 77 6f 72 64 0d 0b 0e |; BL log_word...|
00002400 19 41 44 52 20 52 31 34 2c 73 6f 75 6e 64 5f 66 |.ADR R14,sound_f|
00002410 69 6c 6c 65 64 30 0d 0b 18 40 4c 44 52 20 52 35 |illed0...@LDR R5|
00002420 2c 5b 52 31 34 2c 52 31 2c 4c 53 4c 23 32 5d 20 |,[R14,R1,LSL#2] |
00002430 20 20 20 20 20 20 20 20 3b 20 63 75 72 72 65 6e | ; curren|
00002440 74 20 6f 66 66 73 65 74 20 69 6e 20 74 68 65 20 |t offset in the |
00002450 62 75 66 66 65 72 0d 0b 22 11 2e 6d 61 6b 65 5f |buffer.."..make_|
00002460 73 6f 75 6e 64 5f 31 0d 0b 2c 17 41 44 52 20 52 |sound_1..,.ADR R|
00002470 31 34 2c 73 6f 75 6e 64 5f 72 65 61 64 30 0d 0b |14,sound_read0..|
00002480 36 32 4c 44 52 20 52 30 2c 5b 52 31 34 2c 52 31 |62LDR R0,[R14,R1|
00002490 2c 4c 53 4c 23 32 5d 20 20 20 20 20 20 20 20 20 |,LSL#2] |
000024a0 3b 20 61 6d 6f 75 6e 74 20 72 65 61 64 20 74 6f |; amount read to|
000024b0 0d 0b 40 11 53 55 42 53 20 52 30 2c 52 35 2c 52 |..@.SUBS R0,R5,R|
000024c0 30 0d 0b 4a 38 41 44 44 4d 49 20 52 30 2c 52 30 |0..J8ADDMI R0,R0|
000024d0 2c 23 73 6f 75 6e 64 5f 62 75 66 5f 73 69 7a 65 |,#sound_buf_size|
000024e0 25 20 20 3b 20 61 6d 6f 75 6e 74 20 69 6e 20 74 |% ; amount in t|
000024f0 68 65 20 62 75 66 66 65 72 0d 0b 54 0f 43 4d 50 |he buffer..T.CMP|
00002500 20 52 30 2c 23 35 31 32 0d 0b 5e 3f 42 47 54 20 | R0,#512..^?BGT |
00002510 6d 61 6b 65 5f 73 6f 75 6e 64 5f 31 20 20 20 20 |make_sound_1 |
00002520 20 20 20 20 20 20 20 20 20 20 3b 20 77 61 69 74 | ; wait|
00002530 20 66 6f 72 20 6f 75 74 70 75 74 20 74 6f 20 63 | for output to c|
00002540 61 74 63 68 20 75 70 0d 0b 68 1b 4c 44 52 20 52 |atch up..h.LDR R|
00002550 30 2c 73 6f 75 6e 64 5f 62 75 66 66 73 5f 61 64 |0,sound_buffs_ad|
00002560 64 72 0d 0b 72 3c 41 44 44 20 52 30 2c 52 30 2c |dr..r<ADD R0,R0,|
00002570 52 31 2c 4c 53 4c 23 73 6f 75 6e 64 5f 62 75 66 |R1,LSL#sound_buf|
00002580 5f 73 69 7a 65 5f 6c 6f 67 25 20 3b 20 61 64 64 |_size_log% ; add|
00002590 72 65 73 73 20 6f 66 20 62 75 66 66 65 72 0d 0b |ress of buffer..|
000025a0 7c 11 2e 6d 61 6b 65 5f 73 6f 75 6e 64 5f 32 0d ||..make_sound_2.|
000025b0 0b 86 3b 53 55 42 20 52 33 2c 52 33 2c 23 39 36 |..;SUB R3,R3,#96|
000025c0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |
000025d0 20 3b 20 74 72 79 20 61 6e 64 20 64 6f 20 61 6e | ; try and do an|
000025e0 6f 74 68 65 72 20 62 79 74 65 0d 0b 90 0d 43 4d |other byte....CM|
000025f0 50 20 52 33 2c 52 32 0d 0b 9a 29 42 4c 54 20 6d |P R3,R2...)BLT m|
00002600 61 6b 65 5f 73 6f 75 6e 64 5f 33 20 20 20 20 20 |ake_sound_3 |
00002610 20 20 20 20 20 20 20 20 20 3b 20 63 61 6e 27 74 | ; can't|
00002620 0d 0b a4 34 53 54 52 42 20 52 34 2c 5b 52 30 2c |...4STRB R4,[R0,|
00002630 52 35 5d 20 20 20 20 20 20 20 20 20 20 20 20 20 |R5] |
00002640 20 20 3b 20 77 72 69 74 65 20 6f 75 74 20 61 20 | ; write out a |
00002650 62 79 74 65 0d 0b ae 15 3b 20 53 54 4d 46 44 20 |byte....; STMFD |
00002660 52 31 33 21 2c 7b 52 30 7d 0d 0b b8 0f 3b 20 4d |R13!,{R0}....; M|
00002670 4f 56 20 52 30 2c 52 34 0d 0b c2 11 3b 20 42 4c |OV R0,R4....; BL|
00002680 20 6c 6f 67 5f 77 6f 72 64 0d 0b cc 15 3b 20 4c | log_word....; L|
00002690 44 4d 46 44 20 52 31 33 21 2c 7b 52 30 7d 0d 0b |DMFD R13!,{R0}..|
000026a0 d6 10 41 44 44 20 52 35 2c 52 35 2c 23 31 0d 0b |..ADD R5,R5,#1..|
000026b0 e0 1b 43 4d 50 20 52 35 2c 23 73 6f 75 6e 64 5f |..CMP R5,#sound_|
000026c0 62 75 66 5f 73 69 7a 65 25 0d 0b ea 36 4d 4f 56 |buf_size%...6MOV|
000026d0 47 45 20 52 35 2c 23 30 20 20 20 20 20 20 20 20 |GE R5,#0 |
000026e0 20 20 20 20 20 20 20 20 20 20 20 3b 20 77 72 61 | ; wra|
000026f0 70 20 62 75 66 66 65 72 20 6f 66 66 73 65 74 0d |p buffer offset.|
00002700 0b f4 12 42 20 6d 61 6b 65 5f 73 6f 75 6e 64 5f |...B make_sound_|
00002710 32 0d 0b fe 11 2e 6d 61 6b 65 5f 73 6f 75 6e 64 |2.....make_sound|
00002720 5f 33 0d 0c 08 11 41 44 44 20 52 33 2c 52 33 2c |_3....ADD R3,R3,|
00002730 23 39 36 0d 0c 12 19 41 44 52 20 52 31 34 2c 73 |#96....ADR R14,s|
00002740 6f 75 6e 64 5f 66 69 6c 6c 65 64 30 0d 0c 1c 35 |ound_filled0...5|
00002750 53 54 52 20 52 35 2c 5b 52 31 34 2c 52 31 2c 4c |STR R5,[R14,R1,L|
00002760 53 4c 23 32 5d 20 20 20 20 20 20 20 20 20 3b 20 |SL#2] ; |
00002770 6e 65 77 20 62 75 66 66 65 72 20 6f 66 66 73 65 |new buffer offse|
00002780 74 0d 0c 26 17 41 44 52 20 52 31 34 2c 73 6f 75 |t..&.ADR R14,sou|
00002790 6e 64 5f 74 69 6d 65 30 0d 0c 30 39 53 54 52 20 |nd_time0..09STR |
000027a0 52 33 2c 5b 52 31 34 2c 52 31 2c 4c 53 4c 23 32 |R3,[R14,R1,LSL#2|
000027b0 5d 20 20 20 20 20 20 20 20 20 3b 20 6e 65 77 20 |] ; new |
000027c0 74 69 6d 65 20 6c 61 73 74 20 75 70 64 61 74 65 |time last update|
000027d0 64 0d 0c 3a 19 4c 44 4d 46 44 20 52 31 33 21 2c |d..:.LDMFD R13!,|
000027e0 7b 52 31 2d 52 35 2c 50 43 7d 0d 0c 44 04 0d 0c |{R1-R5,PC}..D...|
000027f0 4e 2e 3b 45 20 52 32 3d 6e 6f 69 73 65 20 63 68 |N.;E R2=noise ch|
00002800 61 6e 6e 65 6c 20 66 72 65 71 75 65 6e 63 79 20 |annel frequency |
00002810 28 62 62 63 20 66 6f 72 6d 61 74 29 0d 0c 58 2a |(bbc format)..X*|
00002820 3b 58 20 52 32 3d 6e 6f 69 73 65 20 63 68 61 6e |;X R2=noise chan|
00002830 6e 65 6c 20 66 72 65 71 75 6e 65 63 79 20 28 31 |nel frequnecy (1|
00002840 30 20 62 69 74 29 0d 0c 62 12 3b 20 20 43 6f 72 |0 bit)..b.; Cor|
00002850 72 75 70 74 73 20 52 30 0d 0c 6c 3d 3b 20 20 44 |rupts R0..l=; D|
00002860 6f 6e 27 74 20 6e 65 65 64 20 74 6f 20 63 6c 69 |on't need to cli|
00002870 70 20 73 69 6e 63 65 20 70 69 74 63 68 20 69 6e |p since pitch in|
00002880 63 20 63 61 6e 20 67 6f 20 75 70 20 74 6f 20 26 |c can go up to &|
00002890 36 30 30 30 30 0d 0c 76 04 0d 0c 80 14 2e 73 6f |60000..v......so|
000028a0 75 6e 64 5f 6e 6f 69 73 65 66 72 65 71 0d 0c 8a |und_noisefreq...|
000028b0 0e 80 20 52 30 2c 52 32 2c 23 33 0d 0c 94 0d 54 |.. R0,R2,#3....T|
000028c0 45 51 20 52 30 2c 23 33 0d 0c 9e 16 42 45 51 20 |EQ R0,#3....BEQ |
000028d0 73 6f 75 6e 64 5f 75 73 65 66 72 65 71 32 0d 0c |sound_usefreq2..|
000028e0 a8 2c 80 20 52 30 2c 52 32 2c 23 37 20 20 20 20 |.,. R0,R2,#7 |
000028f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 | ; |
00002900 46 42 20 4e 46 31 20 4e 46 30 0d 0c b2 19 41 44 |FB NF1 NF0....AD|
00002910 52 20 52 32 2c 73 6f 75 6e 64 5f 6e 6f 69 73 65 |R R2,sound_noise|
00002920 74 61 62 0d 0c bc 18 4c 44 52 20 52 32 2c 5b 52 |tab....LDR R2,[R|
00002930 32 2c 52 30 2c 4c 53 4c 23 32 5d 0d 0c c6 0e 4d |2,R0,LSL#2]....M|
00002940 4f 56 20 50 43 2c 52 31 34 0d 0c d0 13 2e 73 6f |OV PC,R14.....so|
00002950 75 6e 64 5f 75 73 65 66 72 65 71 32 0d 0c da 0d |und_usefreq2....|
00002960 54 53 54 20 52 32 2c 23 34 0d 0c e4 42 4c 44 52 |TST R2,#4...BLDR|
00002970 20 52 32 2c 73 6f 75 6e 64 5f 66 72 65 71 32 20 | R2,sound_freq2 |
00002980 20 20 20 20 20 20 20 20 20 20 20 3b 20 75 73 65 | ; use|
00002990 20 74 6f 6e 65 20 67 65 6e 65 72 61 74 6f 72 20 | tone generator |
000029a0 31 20 66 72 65 71 75 65 6e 63 79 0d 0c ee 3b 3b |1 frequency...;;|
000029b0 ec 51 20 52 32 2c 52 32 2c 4c 53 4c 23 34 20 20 |.Q R2,R2,LSL#4 |
000029c0 20 20 20 20 20 20 20 20 20 20 20 3b 20 6d 75 6c | ; mul|
000029d0 74 69 70 6c 79 20 69 66 20 70 75 6c 73 65 20 63 |tiply if pulse c|
000029e0 68 61 6e 6e 65 6c 0d 0c f8 3c 3b 4d 4f 56 4e 45 |hannel...<;MOVNE|
000029f0 20 52 32 2c 52 32 2c 4c 53 52 23 32 20 20 20 20 | R2,R2,LSR#2 |
00002a00 20 20 20 20 20 20 20 20 20 3b 20 64 69 76 69 64 | ; divid|
00002a10 65 20 69 66 20 6e 6f 69 73 65 20 63 68 61 6e 6e |e if noise chann|
00002a20 65 6c 0d 0c f9 04 0d 0c fa 34 4d 4f 56 20 52 32 |el.......4MOV R2|
00002a30 2c 52 32 2c 4c 53 4c 23 34 20 20 20 20 20 20 20 |,R2,LSL#4 |
00002a40 20 20 20 20 20 20 20 3b 20 63 68 61 6e 67 65 64 | ; changed|
00002a50 20 31 31 2f 39 36 20 4d 52 42 0d 0c fb 04 0d 0d | 11/96 MRB......|
00002a60 2a 0e 4d 4f 56 20 50 43 2c 52 31 34 0d 0d 34 13 |*.MOV PC,R14..4.|
00002a70 2e 73 6f 75 6e 64 5f 6e 6f 69 73 65 74 61 62 0d |.sound_noisetab.|
00002a80 0d 3e 2e 45 51 55 44 20 26 46 31 20 20 20 20 20 |.>.EQUD &F1 |
00002a90 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |
00002aa0 20 3b 20 70 75 6c 73 65 20 68 69 67 68 0d 0d 48 | ; pulse high..H|
00002ab0 2d 45 51 55 44 20 26 31 44 35 20 20 20 20 20 20 |-EQUD &1D5 |
00002ac0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b | ;|
00002ad0 20 70 75 6c 73 65 20 6d 65 64 0d 0d 52 2d 45 51 | pulse med..R-EQ|
00002ae0 55 44 20 26 33 43 36 20 20 20 20 20 20 20 20 20 |UD &3C6 |
00002af0 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 70 75 | ; pu|
00002b00 6c 73 65 20 6c 6f 77 0d 0d 5c 0a 45 51 55 44 20 |lse low..\.EQUD |
00002b10 30 0d 0d 66 2e 45 51 55 44 20 26 31 46 20 20 20 |0..f.EQUD &1F |
00002b20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |
00002b30 20 20 20 3b 20 6e 6f 69 73 65 20 68 69 67 68 0d | ; noise high.|
00002b40 0d 70 2d 45 51 55 44 20 26 41 33 20 20 20 20 20 |.p-EQUD &A3 |
00002b50 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |
00002b60 20 3b 20 6e 6f 69 73 65 20 6d 65 64 0d 0d 7a 2d | ; noise med..z-|
00002b70 45 51 55 44 20 26 31 30 30 20 20 20 20 20 20 20 |EQUD &100 |
00002b80 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 | ; |
00002b90 6e 6f 69 73 65 20 6c 6f 77 0d 0d 84 0a 45 51 55 |noise low....EQU|
00002ba0 44 20 30 0d 0d 8e 04 0d 0d 98 3e 2e 73 6f 75 6e |D 0.......>.soun|
00002bb0 64 5f 63 68 61 6e 6e 65 6c 20 20 20 20 20 20 45 |d_channel E|
00002bc0 51 55 44 20 30 20 20 20 20 3b 20 63 75 72 72 65 |QUD 0 ; curre|
00002bd0 6e 74 20 6e 6f 74 65 20 63 68 61 6e 6e 65 6c 20 |nt note channel |
00002be0 28 30 2d 32 29 0d 0d a2 43 2e 73 6f 75 6e 64 5f |(0-2)...C.sound_|
00002bf0 66 72 65 71 30 20 20 20 20 20 20 20 20 45 51 55 |freq0 EQU|
00002c00 44 20 30 20 20 20 20 3b 20 66 72 65 71 75 65 6e |D 0 ; frequen|
00002c10 63 79 20 6f 66 20 63 68 61 6e 6e 65 6c 20 33 20 |cy of channel 3 |
00002c20 28 31 30 20 62 69 74 29 0d 0d ac 3a 2e 73 6f 75 |(10 bit)...:.sou|
00002c30 6e 64 5f 66 72 65 71 31 20 20 20 20 20 20 20 20 |nd_freq1 |
00002c40 45 51 55 44 20 30 20 20 20 20 3b 20 66 72 65 71 |EQUD 0 ; freq|
00002c50 75 65 6e 63 79 20 6f 66 20 63 68 61 6e 6e 65 6c |uency of channel|
00002c60 20 32 0d 0d b6 3a 2e 73 6f 75 6e 64 5f 66 72 65 | 2...:.sound_fre|
00002c70 71 32 20 20 20 20 20 20 20 20 45 51 55 44 20 30 |q2 EQUD 0|
00002c80 20 20 20 20 3b 20 66 72 65 71 75 65 6e 63 79 20 | ; frequency |
00002c90 6f 66 20 63 68 61 6e 6e 65 6c 20 31 0d 0d c0 45 |of channel 1...E|
00002ca0 2e 73 6f 75 6e 64 5f 66 72 65 71 33 20 20 20 20 |.sound_freq3 |
00002cb0 20 20 20 20 45 51 55 44 20 30 20 20 20 20 3b 20 | EQUD 0 ; |
00002cc0 66 72 65 71 75 65 6e 63 79 20 6f 66 20 63 68 61 |frequency of cha|
00002cd0 6e 6e 65 6c 20 30 20 58 20 46 42 20 4e 46 31 2c |nnel 0 X FB NF1,|
00002ce0 30 0d 0d ca 3f 2e 73 6f 75 6e 64 5f 61 6d 70 30 |0...?.sound_amp0|
00002cf0 20 20 20 20 20 20 20 20 20 45 51 55 42 20 30 20 | EQUB 0 |
00002d00 20 20 20 3b 20 61 6d 70 6c 69 74 75 64 65 20 6f | ; amplitude o|
00002d10 66 20 63 68 61 6e 6e 65 6c 20 33 20 30 2d 31 35 |f channel 3 0-15|
00002d20 0d 0d d4 3a 2e 73 6f 75 6e 64 5f 61 6d 70 31 20 |...:.sound_amp1 |
00002d30 20 20 20 20 20 20 20 20 45 51 55 42 20 30 20 20 | EQUB 0 |
00002d40 20 20 3b 20 61 6d 70 6c 69 74 75 64 65 20 6f 66 | ; amplitude of|
00002d50 20 63 68 61 6e 6e 65 6c 20 32 0d 0d de 3a 2e 73 | channel 2...:.s|
00002d60 6f 75 6e 64 5f 61 6d 70 32 20 20 20 20 20 20 20 |ound_amp2 |
00002d70 20 20 45 51 55 42 20 30 20 20 20 20 3b 20 61 6d | EQUB 0 ; am|
00002d80 70 6c 69 74 75 64 65 20 6f 66 20 63 68 61 6e 6e |plitude of chann|
00002d90 65 6c 20 31 0d 0d e8 3a 2e 73 6f 75 6e 64 5f 61 |el 1...:.sound_a|
00002da0 6d 70 33 20 20 20 20 20 20 20 20 20 45 51 55 42 |mp3 EQUB|
00002db0 20 30 20 20 20 20 3b 20 61 6d 70 6c 69 74 75 64 | 0 ; amplitud|
00002dc0 65 20 6f 66 20 63 68 61 6e 6e 65 6c 20 30 0d 0d |e of channel 0..|
00002dd0 f2 40 2e 73 6f 75 6e 64 5f 72 65 61 64 30 20 20 |.@.sound_read0 |
00002de0 20 20 20 20 20 20 45 51 55 44 20 30 20 20 20 20 | EQUD 0 |
00002df0 3b 20 6f 66 66 73 65 74 20 69 6e 20 62 75 66 66 |; offset in buff|
00002e00 65 72 20 6f 66 20 73 74 61 72 74 20 6f 66 0d 0d |er of start of..|
00002e10 fc 2f 2e 73 6f 75 6e 64 5f 72 65 61 64 31 20 20 |./.sound_read1 |
00002e20 20 20 20 20 20 20 45 51 55 44 20 30 20 20 20 20 | EQUD 0 |
00002e30 3b 20 75 6e 72 65 61 64 20 64 61 74 61 0d 0e 06 |; unread data...|
00002e40 30 2e 73 6f 75 6e 64 5f 72 65 61 64 32 20 20 20 |0.sound_read2 |
00002e50 20 20 20 20 20 45 51 55 44 20 30 20 20 20 20 3b | EQUD 0 ;|
00002e60 20 63 68 61 6e 6e 65 6c 73 20 30 2d 33 0d 0e 10 | channels 0-3...|
00002e70 23 2e 73 6f 75 6e 64 5f 72 65 61 64 33 20 20 20 |#.sound_read3 |
00002e80 20 20 20 20 20 45 51 55 44 20 30 20 20 20 20 3b | EQUD 0 ;|
00002e90 0d 0e 1a 43 2e 73 6f 75 6e 64 5f 66 69 6c 6c 65 |...C.sound_fille|
00002ea0 64 30 20 20 20 20 20 20 45 51 55 44 20 30 20 20 |d0 EQUD 0 |
00002eb0 20 20 3b 20 6f 66 66 73 65 74 20 69 6e 20 62 75 | ; offset in bu|
00002ec0 66 20 66 69 6c 6c 65 64 20 74 6f 20 63 68 61 6e |f filled to chan|
00002ed0 6e 20 30 0d 0e 24 43 2e 73 6f 75 6e 64 5f 66 69 |n 0..$C.sound_fi|
00002ee0 6c 6c 65 64 31 20 20 20 20 20 20 45 51 55 44 20 |lled1 EQUD |
00002ef0 30 20 20 20 20 3b 20 6f 66 66 73 65 74 20 69 6e |0 ; offset in|
00002f00 20 62 75 66 20 66 69 6c 6c 65 64 20 74 6f 20 63 | buf filled to c|
00002f10 68 61 6e 6e 20 31 0d 0e 2e 43 2e 73 6f 75 6e 64 |hann 1...C.sound|
00002f20 5f 66 69 6c 6c 65 64 32 20 20 20 20 20 20 45 51 |_filled2 EQ|
00002f30 55 44 20 30 20 20 20 20 3b 20 6f 66 66 73 65 74 |UD 0 ; offset|
00002f40 20 69 6e 20 62 75 66 20 66 69 6c 6c 65 64 20 74 | in buf filled t|
00002f50 6f 20 63 68 61 6e 6e 20 32 0d 0e 38 43 2e 73 6f |o chann 2..8C.so|
00002f60 75 6e 64 5f 66 69 6c 6c 65 64 33 20 20 20 20 20 |und_filled3 |
00002f70 20 45 51 55 44 20 30 20 20 20 20 3b 20 6f 66 66 | EQUD 0 ; off|
00002f80 73 65 74 20 69 6e 20 62 75 66 20 66 69 6c 6c 65 |set in buf fille|
00002f90 64 20 74 6f 20 63 68 61 6e 6e 20 33 0d 0e 42 39 |d to chann 3..B9|
00002fa0 2e 73 6f 75 6e 64 5f 70 69 74 63 68 30 20 20 20 |.sound_pitch0 |
00002fb0 20 20 20 20 45 51 55 44 20 30 20 20 20 20 3b 20 | EQUD 0 ; |
00002fc0 70 68 61 73 65 20 70 69 74 63 68 20 63 68 61 6e |phase pitch chan|
00002fd0 6e 65 6c 20 30 0d 0e 4c 39 2e 73 6f 75 6e 64 5f |nel 0..L9.sound_|
00002fe0 70 69 74 63 68 31 20 20 20 20 20 20 20 45 51 55 |pitch1 EQU|
00002ff0 44 20 30 20 20 20 20 3b 20 70 68 61 73 65 20 70 |D 0 ; phase p|
00003000 69 74 63 68 20 63 68 61 6e 6e 65 6c 20 31 0d 0e |itch channel 1..|
00003010 56 39 2e 73 6f 75 6e 64 5f 70 69 74 63 68 32 20 |V9.sound_pitch2 |
00003020 20 20 20 20 20 20 45 51 55 44 20 30 20 20 20 20 | EQUD 0 |
00003030 3b 20 70 68 61 73 65 20 70 69 74 63 68 20 63 68 |; phase pitch ch|
00003040 61 6e 6e 65 6c 20 32 0d 0e 60 39 2e 73 6f 75 6e |annel 2..`9.soun|
00003050 64 5f 70 69 74 63 68 33 20 20 20 20 20 20 20 45 |d_pitch3 E|
00003060 51 55 44 20 30 20 20 20 20 3b 20 70 68 61 73 65 |QUD 0 ; phase|
00003070 20 70 69 74 63 68 20 63 68 61 6e 6e 65 6c 20 33 | pitch channel 3|
00003080 0d 0e 6a 42 2e 73 6f 75 6e 64 5f 74 69 6d 65 30 |..jB.sound_time0|
00003090 20 20 20 20 20 20 20 20 45 51 55 44 20 30 20 20 | EQUD 0 |
000030a0 20 20 3b 20 6c 61 73 74 20 74 69 6d 65 20 28 52 | ; last time (R|
000030b0 39 29 20 63 68 61 6e 6e 65 6c 20 75 70 64 61 74 |9) channel updat|
000030c0 65 64 0d 0e 74 41 2e 73 6f 75 6e 64 5f 74 69 6d |ed..tA.sound_tim|
000030d0 65 31 20 20 20 20 20 20 20 20 45 51 55 44 20 30 |e1 EQUD 0|
000030e0 20 20 20 20 3b 20 63 68 61 6e 6e 65 6c 20 31 20 | ; channel 1 |
000030f0 28 64 65 63 72 65 6d 65 6e 74 73 20 61 73 20 74 |(decrements as t|
00003100 69 6d 65 0d 0e 7e 37 2e 73 6f 75 6e 64 5f 74 69 |ime..~7.sound_ti|
00003110 6d 65 32 20 20 20 20 20 20 20 20 45 51 55 44 20 |me2 EQUD |
00003120 30 20 20 20 20 3b 20 63 68 61 6e 6e 65 6c 20 32 |0 ; channel 2|
00003130 20 20 67 6f 65 73 20 6f 6e 29 0d 0e 88 2d 2e 73 | goes on)...-.s|
00003140 6f 75 6e 64 5f 74 69 6d 65 33 20 20 20 20 20 20 |ound_time3 |
00003150 20 20 45 51 55 44 20 30 20 20 20 20 3b 20 63 68 | EQUD 0 ; ch|
00003160 61 6e 6e 65 6c 20 33 0d 0e 92 04 0d 0e 9c 37 3b |annel 3.......7;|
00003170 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b |;;;;;;;;;;;;;;;;|
*
000031a0 3b 3b 0d 0e a6 37 3b 20 46 69 6c 6c 20 73 6f 75 |;;...7; Fill sou|
000031b0 6e 64 20 20 62 75 66 66 65 72 20 20 20 20 20 20 |nd buffer |
000031c0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |
000031d0 20 20 20 20 20 20 20 20 3b 0d 0e b0 37 3b 3b 3b | ;...7;;;|
000031e0 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b |;;;;;;;;;;;;;;;;|
*
00003210 0d 0e ba 04 0d 0e c4 2b 3b 45 20 52 30 3d 6e 75 |.......+;E R0=nu|
00003220 6d 62 65 72 20 6f 66 20 62 79 74 65 73 20 74 6f |mber of bytes to|
00003230 20 66 69 6c 6c 20 69 6e 20 62 75 66 66 65 72 0d | fill in buffer.|
00003240 0e ce 1c 3b 20 20 52 35 3d 62 62 63 20 63 68 61 |...; R5=bbc cha|
00003250 6e 6e 65 6c 20 6e 75 6d 62 65 72 0d 0e d8 23 3b |nnel number...#;|
00003260 20 20 52 31 34 20 6e 6f 74 20 75 73 61 62 6c 65 | R14 not usable|
00003270 20 28 69 6e 20 49 52 51 20 6d 6f 64 65 29 0d 0e | (in IRQ mode)..|
00003280 e2 1e 3b 20 20 52 65 74 75 72 6e 20 61 64 64 72 |..; Return addr|
00003290 65 73 73 20 6f 6e 20 73 74 61 63 6b 0d 0e ec 04 |ess on stack....|
000032a0 0d 0e f6 11 2e 73 6f 75 6e 64 5f 66 69 6c 6c 74 |.....sound_fillt|
000032b0 6f 0d 0f 00 1e 53 54 4d 46 44 20 52 31 33 21 2c |o....STMFD R13!,|
000032c0 7b 52 31 2d 52 34 2c 52 31 31 2d 52 31 32 7d 0d |{R1-R4,R11-R12}.|
000032d0 0f 0a 39 41 44 44 53 20 52 33 2c 52 30 2c 23 30 |..9ADDS R3,R0,#0|
000032e0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |
000032f0 20 3b 20 6e 75 6d 62 65 72 20 6f 66 20 62 79 74 | ; number of byt|
00003300 65 73 20 74 6f 20 64 6f 0d 0f 14 2a 4c 44 4d 4c |es to do...*LDML|
00003310 45 46 44 20 52 31 33 21 2c 7b 52 31 2d 52 34 2c |EFD R13!,{R1-R4,|
00003320 52 31 31 2d 52 31 32 2c 50 43 7d 20 3b 20 6e 6f |R11-R12,PC} ; no|
00003330 6e 65 0d 0f 1e 18 41 44 52 20 52 34 2c 73 6f 75 |ne....ADR R4,sou|
00003340 6e 64 5f 66 69 6c 6c 65 64 30 0d 0f 28 3c 4c 44 |nd_filled0..(<LD|
00003350 52 20 52 31 2c 5b 52 34 2c 52 35 2c 4c 53 4c 23 |R R1,[R4,R5,LSL#|
00003360 32 5d 20 20 20 20 20 20 20 20 20 20 3b 20 63 75 |2] ; cu|
00003370 72 72 65 6e 74 20 6f 66 66 73 65 74 20 66 69 6c |rrent offset fil|
00003380 6c 65 64 20 74 6f 0d 0f 32 1c 4c 44 52 20 52 31 |led to..2.LDR R1|
00003390 31 2c 73 6f 75 6e 64 5f 62 75 66 66 73 5f 61 64 |1,sound_buffs_ad|
000033a0 64 72 0d 0f 3c 42 41 44 44 20 52 31 31 2c 52 31 |dr..<BADD R11,R1|
000033b0 31 2c 52 35 2c 4c 53 4c 23 73 6f 75 6e 64 5f 62 |1,R5,LSL#sound_b|
000033c0 75 66 5f 73 69 7a 65 5f 6c 6f 67 25 20 3b 20 61 |uf_size_log% ; a|
000033d0 64 64 72 65 73 73 20 6f 66 20 74 68 65 20 62 75 |ddress of the bu|
000033e0 66 66 65 72 0d 0f 46 35 41 44 44 20 52 31 32 2c |ffer..F5ADD R12,|
000033f0 52 31 31 2c 23 73 6f 75 6e 64 5f 62 75 66 5f 73 |R11,#sound_buf_s|
00003400 69 7a 65 25 20 20 3b 20 65 6e 64 20 6f 66 20 74 |ize% ; end of t|
00003410 68 65 20 62 75 66 66 65 72 0d 0f 50 45 41 44 44 |he buffer..PEADD|
00003420 20 52 31 31 2c 52 31 31 2c 52 31 20 20 20 20 20 | R11,R11,R1 |
00003430 20 20 20 20 20 20 20 20 20 20 20 3b 20 61 64 64 | ; add|
00003440 72 65 73 73 20 61 74 20 77 68 69 63 68 20 74 6f |ress at which to|
00003450 20 73 74 61 72 74 20 66 69 6c 6c 69 6e 67 0d 0f | start filling..|
00003460 5a 17 41 44 52 20 52 34 2c 73 6f 75 6e 64 5f 70 |Z.ADR R4,sound_p|
00003470 69 74 63 68 30 0d 0f 64 37 4c 44 52 20 52 31 2c |itch0..d7LDR R1,|
00003480 5b 52 34 2c 52 35 2c 4c 53 4c 23 32 5d 20 20 20 |[R4,R5,LSL#2] |
00003490 20 20 20 20 20 20 20 3b 20 67 65 74 20 70 68 61 | ; get pha|
000034a0 73 65 20 70 69 74 63 68 20 69 6e 63 0d 0f 6e 15 |se pitch inc..n.|
000034b0 41 44 52 20 52 34 2c 73 6f 75 6e 64 5f 61 6d 70 |ADR R4,sound_amp|
000034c0 30 0d 0f 78 40 4c 44 52 42 20 52 34 2c 5b 52 34 |0..x@LDRB R4,[R4|
000034d0 2c 52 35 5d 20 20 20 20 20 20 20 20 20 20 20 20 |,R5] |
000034e0 20 20 20 3b 20 67 65 74 20 42 42 43 20 61 6d 70 | ; get BBC amp|
000034f0 20 66 6f 72 20 74 68 69 73 20 63 68 61 6e 6e 65 | for this channe|
00003500 6c 0d 0f 82 38 4c 44 52 20 52 30 2c 28 73 6f 75 |l...8LDR R0,(sou|
00003510 6e 64 5f 62 75 66 66 73 5f 61 64 64 72 2b 34 29 |nd_buffs_addr+4)|
00003520 20 20 20 3b 20 76 6f 6c 75 6d 65 20 73 63 61 6c | ; volume scal|
00003530 69 6e 67 20 74 61 62 6c 65 0d 0f 8c 3f 4c 44 52 |ing table...?LDR|
00003540 42 20 52 34 2c 5b 52 30 2c 52 34 5d 20 20 20 20 |B R4,[R0,R4] |
00003550 20 20 20 20 20 20 20 20 20 20 20 3b 20 73 63 61 | ; sca|
00003560 6c 65 20 76 6f 6c 75 6d 65 20 74 6f 20 56 49 44 |le volume to VID|
00003570 43 20 66 6f 72 6d 61 74 0d 0f 96 2f 52 53 42 20 |C format.../RSB |
00003580 52 34 2c 52 34 2c 23 28 31 32 37 3c 3c 31 29 20 |R4,R4,#(127<<1) |
00003590 20 20 20 20 20 20 20 20 20 20 3b 20 61 74 74 65 | ; atte|
000035a0 6e 75 61 74 69 6f 6e 0d 0f a0 32 54 45 51 20 52 |nuation...2TEQ R|
000035b0 35 2c 23 33 20 20 20 20 20 20 20 20 20 20 20 20 |5,#3 |
000035c0 20 20 20 20 20 20 20 20 20 3b 20 6e 6f 69 73 65 | ; noise|
000035d0 20 63 68 61 6e 6e 65 6c 3f 0d 0f aa 1a 42 45 51 | channel?....BEQ|
000035e0 20 73 6f 75 6e 64 5f 66 69 6c 6c 74 6f 5f 6e 6f | sound_fillto_no|
000035f0 69 73 65 0d 0f b4 16 41 44 52 20 52 30 2c 73 6f |ise....ADR R0,so|
00003600 75 6e 64 5f 66 72 65 71 30 0d 0f be 18 4c 44 52 |und_freq0....LDR|
00003610 20 52 30 2c 5b 52 30 2c 52 35 2c 4c 53 4c 23 32 | R0,[R0,R5,LSL#2|
00003620 5d 0d 0f c8 0d 54 45 51 20 52 30 2c 23 31 0d 0f |]....TEQ R0,#1..|
00003630 d2 1b 42 45 51 20 73 6f 75 6e 64 5f 66 69 6c 6c |..BEQ sound_fill|
00003640 74 6f 5f 73 70 65 61 63 68 0d 0f dc 33 4c 44 52 |to_speach...3LDR|
00003650 20 52 32 2c 28 73 6f 75 6e 64 5f 62 75 66 66 73 | R2,(sound_buffs|
00003660 5f 61 64 64 72 2b 38 29 20 20 20 3b 20 73 74 61 |_addr+8) ; sta|
00003670 6e 64 61 72 64 20 73 61 6d 70 6c 65 0d 0f e6 16 |ndard sample....|
00003680 2e 73 6f 75 6e 64 5f 66 69 6c 6c 74 6f 5f 6c 6f |.sound_fillto_lo|
00003690 6f 70 0d 0f f0 34 41 44 44 20 52 31 2c 52 31 2c |op...4ADD R1,R1,|
000036a0 52 31 2c 4c 53 4c 23 31 36 20 20 20 20 20 20 20 |R1,LSL#16 |
000036b0 20 20 20 20 3b 20 61 64 76 61 6e 63 65 20 77 61 | ; advance wa|
000036c0 76 65 66 6f 72 6d 0d 0f fa 1a 4c 44 52 42 20 52 |veform....LDRB R|
000036d0 30 2c 5b 52 32 2c 52 31 2c 4c 53 52 23 32 34 5d |0,[R2,R1,LSR#24]|
000036e0 0d 10 04 11 53 55 42 53 20 52 30 2c 52 30 2c 52 |....SUBS R0,R0,R|
000036f0 34 0d 10 0e 0f 4d 4f 56 4d 49 20 52 30 2c 23 30 |4....MOVMI R0,#0|
00003700 0d 10 18 33 53 54 52 42 20 52 30 2c 5b 52 31 31 |...3STRB R0,[R11|
00003710 5d 2c 23 31 20 20 20 20 20 20 20 20 20 20 20 20 |],#1 |
00003720 20 20 3b 20 77 72 69 74 65 20 6e 65 78 74 20 62 | ; write next b|
00003730 79 74 65 0d 10 22 0f 43 4d 50 20 52 31 31 2c 52 |yte..".CMP R11,R|
00003740 31 32 0d 10 2c 35 53 55 42 47 45 20 52 31 31 2c |12..,5SUBGE R11,|
00003750 52 31 32 2c 23 73 6f 75 6e 64 5f 62 75 66 5f 73 |R12,#sound_buf_s|
00003760 69 7a 65 25 20 3b 20 77 72 61 70 20 74 68 65 20 |ize% ; wrap the |
00003770 70 6f 69 6e 74 65 72 0d 10 36 11 53 55 42 53 20 |pointer..6.SUBS |
00003780 52 33 2c 52 33 2c 23 31 0d 10 40 19 42 48 49 20 |R3,R3,#1..@.BHI |
00003790 73 6f 75 6e 64 5f 66 69 6c 6c 74 6f 5f 6c 6f 6f |sound_fillto_loo|
000037a0 70 0d 10 4a 17 41 44 52 20 52 34 2c 73 6f 75 6e |p..J.ADR R4,soun|
000037b0 64 5f 70 69 74 63 68 30 0d 10 54 36 53 54 52 20 |d_pitch0..T6STR |
000037c0 52 31 2c 5b 52 34 2c 52 35 2c 4c 53 4c 23 32 5d |R1,[R4,R5,LSL#2]|
000037d0 20 20 20 20 20 20 20 20 20 20 3b 20 73 61 76 65 | ; save|
000037e0 20 6e 65 77 20 70 69 74 63 68 20 69 6e 63 0d 10 | new pitch inc..|
000037f0 5e 15 2e 73 6f 75 6e 64 5f 66 69 6c 6c 74 6f 5f |^..sound_fillto_|
00003800 65 6e 64 0d 10 68 20 53 55 42 20 52 31 32 2c 52 |end..h SUB R12,R|
00003810 31 32 2c 23 73 6f 75 6e 64 5f 62 75 66 5f 73 69 |12,#sound_buf_si|
00003820 7a 65 25 0d 10 72 3e 53 55 42 20 52 31 31 2c 52 |ze%..r>SUB R11,R|
00003830 31 31 2c 52 31 32 20 20 20 20 20 20 20 20 20 20 |11,R12 |
00003840 20 20 20 20 20 3b 20 6f 66 66 73 65 74 20 69 6e | ; offset in|
00003850 20 62 75 66 66 65 72 20 66 69 6c 6c 65 64 20 74 | buffer filled t|
00003860 6f 0d 10 7c 19 41 44 52 20 52 31 32 2c 73 6f 75 |o..|.ADR R12,sou|
00003870 6e 64 5f 66 69 6c 6c 65 64 30 0d 10 86 1a 53 54 |nd_filled0....ST|
00003880 52 20 52 31 31 2c 5b 52 31 32 2c 52 35 2c 4c 53 |R R11,[R12,R5,LS|
00003890 4c 23 32 5d 0d 10 90 21 4c 44 4d 46 44 20 52 31 |L#2]...!LDMFD R1|
000038a0 33 21 2c 7b 52 31 2d 52 34 2c 52 31 31 2d 52 31 |3!,{R1-R4,R11-R1|
000038b0 32 2c 50 43 7d 0d 10 9a 17 2e 73 6f 75 6e 64 5f |2,PC}.....sound_|
000038c0 66 69 6c 6c 74 6f 5f 6e 6f 69 73 65 0d 10 a4 16 |fillto_noise....|
000038d0 4c 44 52 20 52 32 2c 73 6f 75 6e 64 5f 66 72 65 |LDR R2,sound_fre|
000038e0 71 33 0d 10 ae 2e 54 53 54 20 52 32 2c 23 31 3c |q3....TST R2,#1<|
000038f0 3c 32 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |<2 |
00003900 20 20 20 20 3b 20 6c 6f 6f 6b 20 61 74 20 46 42 | ; look at FB|
00003910 0d 10 b8 21 4c 44 52 45 51 20 52 32 2c 28 73 6f |...!LDREQ R2,(so|
00003920 75 6e 64 5f 62 75 66 66 73 5f 61 64 64 72 2b 38 |und_buffs_addr+8|
00003930 29 0d 10 c2 30 41 44 44 45 51 20 52 32 2c 52 32 |)...0ADDEQ R2,R2|
00003940 2c 23 26 31 30 30 20 20 20 20 20 20 20 20 20 20 |,#&100 |
00003950 20 20 20 3b 20 70 75 6c 73 65 20 73 61 6d 70 6c | ; pulse sampl|
00003960 65 0d 10 cc 32 42 45 51 20 73 6f 75 6e 64 5f 66 |e...2BEQ sound_f|
00003970 69 6c 6c 74 6f 5f 6c 6f 6f 70 20 20 20 20 20 20 |illto_loop |
00003980 20 20 20 3b 20 70 65 72 69 6f 64 69 63 20 6e 6f | ; periodic no|
00003990 69 73 65 0d 10 d6 3b 53 54 4d 46 44 20 52 31 33 |ise...;STMFD R13|
000039a0 21 2c 7b 52 36 2d 52 37 7d 20 20 20 20 20 20 20 |!,{R6-R7} |
000039b0 20 20 20 20 20 3b 20 6e 65 65 64 20 74 77 6f 20 | ; need two |
000039c0 6d 6f 72 65 20 72 65 67 69 73 74 65 72 73 0d 10 |more registers..|
000039d0 e0 34 4c 44 52 20 52 32 2c 73 6f 75 6e 64 5f 6e |.4LDR R2,sound_n|
000039e0 6f 69 73 65 73 65 65 64 20 20 20 20 20 20 20 20 |oiseseed |
000039f0 3b 20 77 68 69 74 65 20 6e 6f 69 73 65 20 73 65 |; white noise se|
00003a00 65 64 0d 10 ea 35 52 53 42 20 52 34 2c 52 34 2c |ed...5RSB R4,R4,|
00003a10 23 28 31 32 37 3c 3c 31 29 20 20 20 20 20 20 20 |#(127<<1) |
00003a20 20 20 20 20 3b 20 72 65 63 6f 76 65 72 20 61 6d | ; recover am|
00003a30 70 6c 69 74 75 64 65 0d 10 f4 2c 82 20 52 30 2c |plitude...,. R0,|
00003a40 52 34 2c 23 31 20 20 20 20 20 20 20 20 20 20 20 |R4,#1 |
00003a50 20 20 20 20 20 20 20 3b 20 6f 74 68 65 72 20 73 | ; other s|
00003a60 69 67 6e 0d 10 fe 27 4c 44 52 20 52 36 2c 73 6f |ign...'LDR R6,so|
00003a70 75 6e 64 5f 6e 6f 69 73 65 65 6f 72 20 20 20 20 |und_noiseeor |
00003a80 20 20 20 20 20 3b 20 65 6f 72 0d 11 08 34 2e 73 | ; eor...4.s|
00003a90 66 6e 5f 6c 6f 6f 70 20 20 20 20 20 20 20 20 20 |fn_loop |
00003aa0 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 77 68 | ; wh|
00003ab0 69 74 65 20 6e 6f 69 73 65 20 6c 6f 6f 70 0d 11 |ite noise loop..|
00003ac0 12 0d 4d 4f 56 20 52 37 2c 52 31 0d 11 1c 17 41 |..MOV R7,R1....A|
00003ad0 44 44 20 52 31 2c 52 31 2c 52 31 2c 4c 53 4c 23 |DD R1,R1,R1,LSL#|
00003ae0 31 36 0d 11 26 0e 82 20 52 37 2c 52 37 2c 52 31 |16..&.. R7,R7,R1|
00003af0 0d 11 30 15 54 53 54 20 52 37 2c 23 26 34 30 30 |..0.TST R7,#&400|
00003b00 30 30 30 30 30 0d 11 3a 43 42 45 51 20 73 66 6e |00000..:CBEQ sfn|
00003b10 5f 73 6b 69 70 20 20 20 20 20 20 20 20 20 20 20 |_skip |
00003b20 20 20 20 20 20 20 20 3b 20 62 69 74 20 68 61 73 | ; bit has|
00003b30 6e 27 74 20 63 68 61 6e 67 65 64 20 73 6f 20 64 |n't changed so d|
00003b40 6f 6e 27 74 20 61 64 76 0d 11 44 14 4d 4f 56 53 |on't adv..D.MOVS|
00003b50 20 52 32 2c 52 32 2c 4c 53 52 23 31 0d 11 4e 10 | R2,R2,LSR#1..N.|
00003b60 82 43 53 20 52 32 2c 52 32 2c 52 36 0d 11 58 1a |.CS R2,R2,R6..X.|
00003b70 42 49 43 43 43 20 52 31 2c 52 31 2c 23 26 34 30 |BICCC R1,R1,#&40|
00003b80 30 30 30 30 30 30 0d 11 62 19 84 52 43 53 20 52 |000000..b..RCS R|
00003b90 31 2c 52 31 2c 23 26 34 30 30 30 30 30 30 30 0d |1,R1,#&40000000.|
00003ba0 11 6c 0d 2e 73 66 6e 5f 73 6b 69 70 0d 11 76 15 |.l..sfn_skip..v.|
00003bb0 54 53 54 20 52 31 2c 23 26 34 30 30 30 30 30 30 |TST R1,#&4000000|
00003bc0 30 0d 11 80 16 53 54 52 45 51 42 20 52 30 2c 5b |0....STREQB R0,[|
00003bd0 52 31 31 5d 2c 23 31 0d 11 8a 16 53 54 52 4e 45 |R11],#1....STRNE|
00003be0 42 20 52 34 2c 5b 52 31 31 5d 2c 23 31 0d 11 94 |B R4,[R11],#1...|
00003bf0 0f 43 4d 50 20 52 31 31 2c 52 31 32 0d 11 9e 35 |.CMP R11,R12...5|
00003c00 53 55 42 47 45 20 52 31 31 2c 52 31 32 2c 23 73 |SUBGE R11,R12,#s|
00003c10 6f 75 6e 64 5f 62 75 66 5f 73 69 7a 65 25 20 3b |ound_buf_size% ;|
00003c20 20 77 72 61 70 20 74 68 65 20 70 6f 69 6e 74 65 | wrap the pointe|
00003c30 72 0d 11 a8 11 53 55 42 53 20 52 33 2c 52 33 2c |r....SUBS R3,R3,|
00003c40 23 31 0d 11 b2 10 42 48 49 20 73 66 6e 5f 6c 6f |#1....BHI sfn_lo|
00003c50 6f 70 0d 11 bc 16 4c 44 4d 46 44 20 52 31 33 21 |op....LDMFD R13!|
00003c60 2c 7b 52 36 2d 52 37 7d 0d 11 c6 1a 53 54 52 20 |,{R6-R7}....STR |
00003c70 52 32 2c 73 6f 75 6e 64 5f 6e 6f 69 73 65 73 65 |R2,sound_noisese|
00003c80 65 64 0d 11 d0 17 53 54 52 20 52 31 2c 73 6f 75 |ed....STR R1,sou|
00003c90 6e 64 5f 70 69 74 63 68 33 0d 11 da 16 42 20 73 |nd_pitch3....B s|
00003ca0 6f 75 6e 64 5f 66 69 6c 6c 74 6f 5f 65 6e 64 0d |ound_fillto_end.|
00003cb0 11 e4 3b 2e 73 6f 75 6e 64 5f 66 69 6c 6c 74 6f |..;.sound_fillto|
00003cc0 5f 73 70 65 61 63 68 20 20 20 20 20 20 20 20 20 |_speach |
00003cd0 20 3b 20 64 69 72 65 63 74 20 61 6d 70 20 6d 6f | ; direct amp mo|
00003ce0 64 69 66 69 63 61 74 69 6f 6e 0d 11 ee 15 41 44 |dification....AD|
00003cf0 52 20 52 34 2c 73 6f 75 6e 64 5f 61 6d 70 30 0d |R R4,sound_amp0.|
00003d00 11 f8 40 4c 44 52 42 20 52 34 2c 5b 52 34 2c 52 |..@LDRB R4,[R4,R|
00003d10 35 5d 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |5] |
00003d20 20 3b 20 67 65 74 20 42 42 43 20 61 6d 70 20 66 | ; get BBC amp f|
00003d30 6f 72 20 74 68 69 73 20 63 68 61 6e 6e 65 6c 0d |or this channel.|
00003d40 12 02 28 4d 4f 56 20 52 34 2c 52 34 2c 4c 53 4c |..(MOV R4,R4,LSL|
00003d50 23 31 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |#1 |
00003d60 20 3b 20 30 2d 33 30 0d 12 0c 37 53 55 42 53 20 | ; 0-30...7SUBS |
00003d70 52 34 2c 52 34 2c 23 31 35 20 20 20 20 20 20 20 |R4,R4,#15 |
00003d80 20 20 20 20 20 20 20 20 20 3b 20 61 6d 70 6c 69 | ; ampli|
00003d90 74 75 64 65 20 2d 31 35 20 74 6f 20 31 35 0d 12 |tude -15 to 15..|
00003da0 16 0f 4d 4f 56 50 4c 20 52 30 2c 23 30 0d 12 20 |..MOVPL R0,#0.. |
00003db0 2c 4d 4f 56 4d 49 20 52 30 2c 23 31 20 20 20 20 |,MOVMI R0,#1 |
00003dc0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b | ;|
00003dd0 20 73 69 67 6e 20 62 69 74 0d 12 2a 32 52 53 42 | sign bit..*2RSB|
00003de0 4d 49 20 52 34 2c 52 34 2c 23 30 20 20 20 20 20 |MI R4,R4,#0 |
00003df0 20 20 20 20 20 20 20 20 20 20 20 3b 20 6e 6f 77 | ; now|
00003e00 20 2b 76 65 20 28 31 2d 31 35 29 0d 12 34 31 4c | +ve (1-15)..41L|
00003e10 44 52 20 52 31 2c 28 73 6f 75 6e 64 5f 62 75 66 |DR R1,(sound_buf|
00003e20 66 73 5f 61 64 64 72 2b 34 29 20 20 20 3b 20 6c |fs_addr+4) ; l|
00003e30 6f 67 20 61 6d 70 20 74 61 62 6c 65 0d 12 3e 2c |og amp table..>,|
00003e40 4c 44 52 42 20 52 34 2c 5b 52 31 2c 52 34 5d 20 |LDRB R4,[R1,R4] |
00003e50 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 | ; |
00003e60 56 49 44 43 20 61 6d 70 0d 12 48 3c 82 20 52 34 |VIDC amp..H<. R4|
00003e70 2c 52 34 2c 52 30 20 20 20 20 20 20 20 20 20 20 |,R4,R0 |
00003e80 20 20 20 20 20 20 20 20 3b 20 62 75 6e 67 20 69 | ; bung i|
00003e90 6e 20 73 69 67 6e 20 74 6f 20 67 65 74 20 73 61 |n sign to get sa|
00003ea0 6d 70 6c 65 0d 12 52 16 41 44 52 20 52 32 2c 73 |mple..R.ADR R2,s|
00003eb0 6f 75 6e 64 5f 74 69 6d 65 30 0d 12 5c 39 4c 44 |ound_time0..\9LD|
00003ec0 52 20 52 30 2c 5b 52 32 2c 52 35 2c 4c 53 4c 23 |R R0,[R2,R5,LSL#|
00003ed0 32 5d 20 20 20 20 20 20 20 20 20 20 3b 20 67 65 |2] ; ge|
00003ee0 74 20 74 69 6d 65 20 6c 61 73 74 20 75 70 64 61 |t time last upda|
00003ef0 74 65 64 0d 12 66 1a 2e 73 6f 75 6e 64 5f 66 69 |ted..f..sound_fi|
00003f00 6c 6c 74 6f 5f 73 70 65 61 63 68 5f 31 0d 12 70 |llto_speach_1..p|
00003f10 14 53 54 52 42 20 52 34 2c 5b 52 31 31 5d 2c 23 |.STRB R4,[R11],#|
00003f20 31 0d 12 7a 11 53 55 42 20 52 30 2c 52 30 2c 23 |1..z.SUB R0,R0,#|
00003f30 39 36 0d 12 84 0f 43 4d 50 20 52 31 31 2c 52 31 |96....CMP R11,R1|
00003f40 32 0d 12 8e 35 53 55 42 47 45 20 52 31 31 2c 52 |2...5SUBGE R11,R|
00003f50 31 32 2c 23 73 6f 75 6e 64 5f 62 75 66 5f 73 69 |12,#sound_buf_si|
00003f60 7a 65 25 20 3b 20 77 72 61 70 20 74 68 65 20 70 |ze% ; wrap the p|
00003f70 6f 69 6e 74 65 72 0d 12 98 11 53 55 42 53 20 52 |ointer....SUBS R|
00003f80 33 2c 52 33 2c 23 31 0d 12 a2 1d 42 48 49 20 73 |3,R3,#1....BHI s|
00003f90 6f 75 6e 64 5f 66 69 6c 6c 74 6f 5f 73 70 65 61 |ound_fillto_spea|
00003fa0 63 68 5f 31 0d 12 ac 19 3b 53 54 52 20 52 30 2c |ch_1....;STR R0,|
00003fb0 5b 52 32 2c 52 35 2c 4c 53 4c 23 32 5d 0d 12 b6 |[R2,R5,LSL#2]...|
00003fc0 16 42 20 73 6f 75 6e 64 5f 66 69 6c 6c 74 6f 5f |.B sound_fillto_|
00003fd0 65 6e 64 0d 12 c0 3b 2e 73 6f 75 6e 64 5f 6e 6f |end...;.sound_no|
00003fe0 69 73 65 73 65 65 64 20 45 51 55 44 20 26 34 34 |iseseed EQUD &44|
00003ff0 36 44 36 39 35 34 20 3b 20 77 68 69 74 65 20 6e |6D6954 ; white n|
00004000 6f 69 73 65 20 73 65 65 64 20 28 52 32 29 0d 12 |oise seed (R2)..|
00004010 ca 3a 2e 73 6f 75 6e 64 5f 6e 6f 69 73 65 65 6f |.:.sound_noiseeo|
00004020 72 20 20 45 51 55 44 20 26 38 32 44 34 45 31 42 |r EQUD &82D4E1B|
00004030 38 20 3b 20 77 68 69 74 65 20 6e 6f 69 73 65 20 |8 ; white noise |
00004040 65 6f 72 20 28 52 36 29 0d 12 d4 04 0d 12 de 37 |eor (R6).......7|
00004050 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b |;;;;;;;;;;;;;;;;|
*
00004080 3b 3b 3b 0d 12 e8 37 3b 20 56 6f 69 63 65 20 67 |;;;...7; Voice g|
00004090 65 6e 65 72 61 74 6f 72 20 20 20 20 20 20 20 20 |enerator |
000040a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |
000040b0 20 20 20 20 20 20 20 20 20 3b 0d 12 f2 37 3b 3b | ;...7;;|
000040c0 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b |;;;;;;;;;;;;;;;;|
*
000040f0 3b 0d 12 fc 04 0d 13 06 15 2e 73 6f 75 6e 64 5f |;.........sound_|
00004100 62 75 66 66 73 5f 61 64 64 72 0d 13 10 35 45 51 |buffs_addr...5EQ|
00004110 55 44 20 30 20 20 20 20 20 20 20 20 20 20 20 20 |UD 0 |
00004120 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 61 64 | ; ad|
00004130 64 72 65 73 73 20 6f 66 20 62 75 66 66 65 72 0d |dress of buffer.|
00004140 13 1a 30 45 51 55 44 20 30 20 20 20 20 20 20 20 |..0EQUD 0 |
00004150 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |
00004160 20 3b 20 76 6f 6c 75 6d 65 20 74 61 62 6c 65 0d | ; volume table.|
00004170 13 24 32 45 51 55 44 20 30 20 20 20 20 20 20 20 |.$2EQUD 0 |
00004180 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |
00004190 20 3b 20 73 61 6d 70 6c 65 20 61 64 64 72 65 73 | ; sample addres|
000041a0 73 0d 13 2e 31 45 51 55 44 20 30 20 20 20 20 20 |s...1EQUD 0 |
000041b0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |
000041c0 20 20 20 3b 20 73 74 61 63 6b 20 61 64 64 72 65 | ; stack addre|
000041d0 73 73 0d 13 38 04 0d 13 42 0a 3b 20 53 43 43 42 |ss..8...B.; SCCB|
000041e0 0d 13 4c 1e 3b 20 23 30 20 62 30 2d 62 37 20 41 |..L.; #0 b0-b7 A|
000041f0 72 63 20 76 6f 6c 75 6d 65 20 28 52 31 29 0d 13 |rc volume (R1)..|
00004200 56 2c 3b 20 23 34 20 70 68 61 73 65 20 61 63 63 |V,; #4 phase acc|
00004210 75 6d 75 6c 61 74 6f 72 20 28 62 30 2d 62 31 35 |umulator (b0-b15|
00004220 3d 69 6e 63 29 20 28 52 32 29 0d 13 60 0a 3b 20 |=inc) (R2)..`.; |
00004230 23 38 20 2d 0d 13 6a 30 3b 20 23 31 32 20 6e 75 |#8 -..j0; #12 nu|
00004240 6d 62 65 72 20 6f 66 20 62 75 66 66 65 72 20 66 |mber of buffer f|
00004250 69 6c 6c 73 20 6c 65 66 74 20 74 6f 20 64 6f 20 |ills left to do |
00004260 28 52 34 29 0d 13 74 27 3b 20 23 31 36 20 62 62 |(R4)..t'; #16 bb|
00004270 63 20 63 68 61 6e 6e 65 6c 20 6e 75 6d 62 65 72 |c channel number|
00004280 20 28 30 2d 33 29 20 28 52 35 29 0d 13 7e 2a 3b | (0-3) (R5)..~*;|
00004290 20 23 32 30 20 56 6f 6c 75 6d 65 20 73 63 61 6c | #20 Volume scal|
000042a0 65 64 20 6c 6f 67 20 61 6d 70 20 74 61 62 6c 65 |ed log amp table|
000042b0 20 28 52 36 29 0d 13 88 04 0d 13 92 16 2e 73 6f | (R6).........so|
000042c0 75 6e 64 5f 76 6f 69 63 65 68 65 61 64 65 72 0d |und_voiceheader.|
000042d0 13 9c 11 42 20 73 6f 75 6e 64 5f 76 66 69 6c 6c |...B sound_vfill|
000042e0 0d 13 a6 11 42 20 73 6f 75 6e 64 5f 76 66 69 6c |....B sound_vfil|
000042f0 6c 0d 13 b0 11 42 20 73 6f 75 6e 64 5f 76 66 69 |l....B sound_vfi|
00004300 6c 6c 0d 13 ba 14 42 20 73 6f 75 6e 64 5f 76 67 |ll....B sound_vg|
00004310 61 74 65 6f 66 66 0d 13 c4 18 42 20 73 6f 75 6e |ateoff....B soun|
00004320 64 5f 76 69 6e 73 74 61 6e 74 69 61 74 65 0d 13 |d_vinstantiate..|
00004330 ce 13 4c 44 4d 46 44 20 52 31 33 21 2c 7b 50 43 |..LDMFD R13!,{PC|
00004340 7d 0d 13 d8 13 4c 44 4d 46 44 20 52 31 33 21 2c |}....LDMFD R13!,|
00004350 7b 50 43 7d 0d 13 e2 2a 45 51 55 44 20 73 6f 75 |{PC}...*EQUD sou|
00004360 6e 64 5f 76 6f 69 63 65 6e 61 6d 65 2d 73 6f 75 |nd_voicename-sou|
00004370 6e 64 5f 76 6f 69 63 65 68 65 61 64 65 72 0d 13 |nd_voiceheader..|
00004380 ec 14 2e 73 6f 75 6e 64 5f 76 6f 69 63 65 6e 61 |...sound_voicena|
00004390 6d 65 0d 13 f6 1a 45 51 55 53 20 22 36 35 30 32 |me....EQUS "6502|
000043a0 45 6d 75 6c 61 74 6f 72 22 2b bd 30 0d 14 00 09 |Emulator"+.0....|
000043b0 41 4c 49 47 4e 0d 14 0a 04 0d 14 14 1e 3b 45 20 |ALIGN........;E |
000043c0 52 65 74 75 72 6e 20 61 64 64 72 65 73 73 20 6f |Return address o|
000043d0 6e 20 73 74 61 63 6b 0d 14 1e 23 3b 20 20 52 31 |n stack...#; R1|
000043e0 34 20 6e 6f 74 20 75 73 61 62 6c 65 20 28 69 6e |4 not usable (in|
000043f0 20 49 52 51 20 6d 6f 64 65 29 0d 14 28 04 0d 14 | IRQ mode)..(...|
00004400 32 10 2e 73 6f 75 6e 64 5f 76 66 69 6c 6c 0d 14 |2..sound_vfill..|
00004410 3c 39 4c 44 4d 46 44 20 52 39 2c 7b 52 31 2d 52 |<9LDMFD R9,{R1-R|
00004420 36 7d 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |6} |
00004430 3b 20 52 35 3d 62 62 63 20 63 68 61 6e 6e 65 6c |; R5=bbc channel|
00004440 20 6e 75 6d 62 65 72 0d 14 46 16 41 44 52 20 52 | number..F.ADR R|
00004450 31 2c 73 6f 75 6e 64 5f 72 65 61 64 30 0d 14 50 |1,sound_read0..P|
00004460 39 4c 44 52 20 52 32 2c 5b 52 31 2c 52 35 2c 4c |9LDR R2,[R1,R5,L|
00004470 53 4c 23 32 5d 20 20 20 20 20 20 20 20 20 20 3b |SL#2] ;|
00004480 20 6f 66 66 73 65 74 20 6f 66 20 75 6e 72 65 61 | offset of unrea|
00004490 64 20 64 61 74 61 0d 14 5a 18 41 44 52 20 52 31 |d data..Z.ADR R1|
000044a0 2c 73 6f 75 6e 64 5f 66 69 6c 6c 65 64 30 0d 14 |,sound_filled0..|
000044b0 64 3b 4c 44 52 20 52 30 2c 5b 52 31 2c 52 35 2c |d;LDR R0,[R1,R5,|
000044c0 4c 53 4c 23 32 5d 20 20 20 20 20 20 20 20 20 20 |LSL#2] |
000044d0 3b 20 6f 66 66 73 65 74 20 62 75 66 66 65 72 20 |; offset buffer |
000044e0 66 69 6c 6c 65 64 20 74 6f 0d 14 6e 11 53 55 42 |filled to..n.SUB|
000044f0 53 20 52 30 2c 52 30 2c 52 32 0d 14 78 38 41 44 |S R0,R0,R2..x8AD|
00004500 44 4d 49 20 52 30 2c 52 30 2c 23 73 6f 75 6e 64 |DMI R0,R0,#sound|
00004510 5f 62 75 66 5f 73 69 7a 65 25 20 20 3b 20 61 6d |_buf_size% ; am|
00004520 6f 75 6e 74 20 69 6e 20 74 68 65 20 62 75 66 66 |ount in the buff|
00004530 65 72 0d 14 82 37 52 53 42 53 20 52 30 2c 52 30 |er...7RSBS R0,R0|
00004540 2c 23 32 30 38 20 20 20 20 20 20 20 20 20 20 20 |,#208 |
00004550 20 20 20 20 3b 20 61 6d 6f 75 6e 74 20 65 78 74 | ; amount ext|
00004560 72 61 20 6e 65 65 64 65 64 0d 14 8c 16 42 4c 45 |ra needed....BLE|
00004570 20 73 6f 75 6e 64 5f 66 69 6c 6c 5f 72 65 74 0d | sound_fill_ret.|
00004580 14 96 19 41 44 52 20 52 31 2c 73 6f 75 6e 64 5f |...ADR R1,sound_|
00004590 66 69 6c 6c 5f 72 65 74 0d 14 a0 3f 53 54 4d 46 |fill_ret...?STMF|
000045a0 44 20 52 31 33 21 2c 7b 52 31 7d 20 20 20 20 20 |D R13!,{R1} |
000045b0 20 20 20 20 20 20 20 20 20 20 3b 20 70 75 74 20 | ; put |
000045c0 72 65 74 75 72 6e 20 61 64 64 72 65 73 73 20 6f |return address o|
000045d0 6e 20 73 74 61 63 6b 0d 14 aa 41 42 20 73 6f 75 |n stack...AB sou|
000045e0 6e 64 5f 66 69 6c 6c 74 6f 20 20 20 20 20 20 20 |nd_fillto |
000045f0 20 20 20 20 20 20 20 20 20 3b 20 65 6e 73 75 72 | ; ensur|
00004600 65 20 74 68 65 20 62 75 66 66 65 72 20 66 75 6c |e the buffer ful|
00004610 6c 20 65 6e 6f 75 67 68 0d 14 b4 13 2e 73 6f 75 |l enough.....sou|
00004620 6e 64 5f 66 69 6c 6c 5f 72 65 74 0d 14 be 16 41 |nd_fill_ret....A|
00004630 44 52 20 52 31 2c 73 6f 75 6e 64 5f 72 65 61 64 |DR R1,sound_read|
00004640 30 0d 14 c8 36 4c 44 52 20 52 30 2c 5b 52 31 2c |0...6LDR R0,[R1,|
00004650 52 35 2c 4c 53 4c 23 32 5d 20 20 20 20 20 20 20 |R5,LSL#2] |
00004660 20 20 20 3b 20 6f 66 66 20 6f 66 20 75 6e 72 65 | ; off of unre|
00004670 61 64 20 64 61 74 61 0d 14 d2 43 41 44 44 20 52 |ad data...CADD R|
00004680 32 2c 52 30 2c 23 32 30 38 20 20 20 20 20 20 20 |2,R0,#208 |
00004690 20 20 20 20 20 20 20 20 20 3b 20 6e 65 77 20 6f | ; new o|
000046a0 66 66 73 65 74 20 61 66 74 65 72 20 77 65 27 76 |ffset after we'v|
000046b0 65 20 66 69 6e 69 73 68 65 64 0d 14 dc 1b 43 4d |e finished....CM|
000046c0 50 20 52 32 2c 23 73 6f 75 6e 64 5f 62 75 66 5f |P R2,#sound_buf_|
000046d0 73 69 7a 65 25 0d 14 e6 2b 53 55 42 47 45 20 52 |size%...+SUBGE R|
000046e0 32 2c 52 32 2c 23 73 6f 75 6e 64 5f 62 75 66 5f |2,R2,#sound_buf_|
000046f0 73 69 7a 65 25 20 20 3b 20 77 72 61 70 20 69 74 |size% ; wrap it|
00004700 0d 14 f0 18 53 54 52 20 52 32 2c 5b 52 31 2c 52 |....STR R2,[R1,R|
00004710 35 2c 4c 53 4c 23 32 5d 0d 14 fa 1b 4c 44 52 20 |5,LSL#2]....LDR |
00004720 52 32 2c 73 6f 75 6e 64 5f 62 75 66 66 73 5f 61 |R2,sound_buffs_a|
00004730 64 64 72 0d 15 04 3c 41 44 44 20 52 32 2c 52 32 |ddr...<ADD R2,R2|
00004740 2c 52 35 2c 4c 53 4c 23 73 6f 75 6e 64 5f 62 75 |,R5,LSL#sound_bu|
00004750 66 5f 73 69 7a 65 5f 6c 6f 67 25 20 3b 20 61 64 |f_size_log% ; ad|
00004760 64 72 65 73 73 20 6f 66 20 62 75 66 66 65 72 0d |dress of buffer.|
00004770 15 0e 31 41 44 44 20 52 33 2c 52 32 2c 23 73 6f |..1ADD R3,R2,#so|
00004780 75 6e 64 5f 62 75 66 5f 73 69 7a 65 25 20 20 20 |und_buf_size% |
00004790 20 3b 20 65 6e 64 20 6f 66 20 62 75 66 66 65 72 | ; end of buffer|
000047a0 0d 15 18 33 41 44 44 20 52 32 2c 52 32 2c 52 30 |...3ADD R2,R2,R0|
000047b0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |
000047c0 20 20 3b 20 63 75 72 72 65 6e 74 20 61 64 64 72 | ; current addr|
000047d0 65 73 73 0d 15 22 39 2e 73 6f 75 6e 64 5f 66 69 |ess.."9.sound_fi|
000047e0 6c 6c 5f 6c 6f 6f 70 20 20 20 20 20 20 20 20 20 |ll_loop |
000047f0 20 20 20 20 20 3b 20 4e 42 20 41 6d 70 20 61 6c | ; NB Amp al|
00004800 72 65 61 64 79 20 73 63 61 6c 65 64 0d 15 2c 31 |ready scaled..,1|
00004810 4c 44 52 42 20 52 30 2c 5b 52 32 5d 2c 23 31 20 |LDRB R0,[R2],#1 |
00004820 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 | ; |
00004830 67 65 74 20 6e 65 78 74 20 62 79 74 65 0d 15 36 |get next byte..6|
00004840 15 53 54 52 42 20 52 30 2c 5b 52 31 32 5d 2c 52 |.STRB R0,[R12],R|
00004850 31 31 0d 15 40 0d 43 4d 50 20 52 32 2c 52 33 0d |11..@.CMP R2,R3.|
00004860 15 4a 20 53 55 42 47 45 20 52 32 2c 52 33 2c 23 |.J SUBGE R2,R3,#|
00004870 73 6f 75 6e 64 5f 62 75 66 5f 73 69 7a 65 25 0d |sound_buf_size%.|
00004880 15 54 31 4c 44 52 42 20 52 30 2c 5b 52 32 5d 2c |.T1LDRB R0,[R2],|
00004890 23 31 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |#1 |
000048a0 20 3b 20 67 65 74 20 6e 65 78 74 20 62 79 74 65 | ; get next byte|
000048b0 0d 15 5e 15 53 54 52 42 20 52 30 2c 5b 52 31 32 |..^.STRB R0,[R12|
000048c0 5d 2c 52 31 31 0d 15 68 0d 43 4d 50 20 52 32 2c |],R11..h.CMP R2,|
000048d0 52 33 0d 15 72 20 53 55 42 47 45 20 52 32 2c 52 |R3..r SUBGE R2,R|
000048e0 33 2c 23 73 6f 75 6e 64 5f 62 75 66 5f 73 69 7a |3,#sound_buf_siz|
000048f0 65 25 0d 15 7c 31 4c 44 52 42 20 52 30 2c 5b 52 |e%..|1LDRB R0,[R|
00004900 32 5d 2c 23 31 20 20 20 20 20 20 20 20 20 20 20 |2],#1 |
00004910 20 20 20 20 3b 20 67 65 74 20 6e 65 78 74 20 62 | ; get next b|
00004920 79 74 65 0d 15 86 15 53 54 52 42 20 52 30 2c 5b |yte....STRB R0,[|
00004930 52 31 32 5d 2c 52 31 31 0d 15 90 0d 43 4d 50 20 |R12],R11....CMP |
00004940 52 32 2c 52 33 0d 15 9a 20 53 55 42 47 45 20 52 |R2,R3... SUBGE R|
00004950 32 2c 52 33 2c 23 73 6f 75 6e 64 5f 62 75 66 5f |2,R3,#sound_buf_|
00004960 73 69 7a 65 25 0d 15 a4 31 4c 44 52 42 20 52 30 |size%...1LDRB R0|
00004970 2c 5b 52 32 5d 2c 23 31 20 20 20 20 20 20 20 20 |,[R2],#1 |
00004980 20 20 20 20 20 20 20 3b 20 67 65 74 20 6e 65 78 | ; get nex|
00004990 74 20 62 79 74 65 0d 15 ae 15 53 54 52 42 20 52 |t byte....STRB R|
000049a0 30 2c 5b 52 31 32 5d 2c 52 31 31 0d 15 b8 0d 43 |0,[R12],R11....C|
000049b0 4d 50 20 52 32 2c 52 33 0d 15 c2 20 53 55 42 47 |MP R2,R3... SUBG|
000049c0 45 20 52 32 2c 52 33 2c 23 73 6f 75 6e 64 5f 62 |E R2,R3,#sound_b|
000049d0 75 66 5f 73 69 7a 65 25 0d 15 cc 0f 43 4d 50 20 |uf_size%....CMP |
000049e0 52 31 32 2c 52 31 30 0d 15 d6 17 42 4c 54 20 73 |R12,R10....BLT s|
000049f0 6f 75 6e 64 5f 66 69 6c 6c 5f 6c 6f 6f 70 0d 15 |ound_fill_loop..|
00004a00 e0 36 4d 4f 56 20 52 30 2c 23 38 20 20 20 20 20 |.6MOV R0,#8 |
00004a10 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |
00004a20 3b 20 76 6f 69 63 65 20 73 74 69 6c 6c 20 61 63 |; voice still ac|
00004a30 74 69 76 65 0d 15 ea 13 4c 44 4d 46 44 20 52 31 |tive....LDMFD R1|
00004a40 33 21 2c 7b 50 43 7d 0d 15 f4 04 0d 15 fe 37 3b |3!,{PC}.......7;|
00004a50 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b |;;;;;;;;;;;;;;;;|
*
00004a80 3b 3b 0d 16 08 37 3b 20 70 72 69 6e 74 20 6f 75 |;;...7; print ou|
00004a90 74 20 64 65 62 75 67 20 64 61 74 61 20 2d 20 63 |t debug data - c|
00004aa0 75 72 72 65 6e 74 20 63 68 61 6e 6e 65 6c 20 73 |urrent channel s|
00004ab0 65 74 74 69 6e 67 73 20 3b 0d 16 12 37 3b 3b 3b |ettings ;...7;;;|
00004ac0 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b |;;;;;;;;;;;;;;;;|
*
00004af0 0d 16 1c 04 0d 16 26 1f 3b 58 20 52 31 3d 63 68 |......&.;X R1=ch|
00004b00 61 6e 6e 65 6c 20 62 65 69 6e 67 20 63 68 61 6e |annel being chan|
00004b10 67 65 64 0d 16 30 04 0d 16 3a 10 2e 73 6f 75 6e |ged..0...:..soun|
00004b20 64 5f 64 65 62 75 67 0d 16 44 1a 53 54 4d 46 44 |d_debug..D.STMFD|
00004b30 20 52 31 33 21 2c 7b 52 30 2d 52 31 2c 52 31 34 | R13!,{R0-R1,R14|
00004b40 7d 0d 16 4e 0c 53 57 49 20 26 31 31 46 0d 16 58 |}..N.SWI &11F..X|
00004b50 0c 53 57 49 20 26 31 30 30 0d 16 62 0d 4d 4f 56 |.SWI &100..b.MOV|
00004b60 20 52 30 2c 52 31 0d 16 6c 31 53 57 49 20 22 58 | R0,R1..l1SWI "X|
00004b70 4f 53 5f 57 72 69 74 65 43 22 20 20 20 20 20 20 |OS_WriteC" |
00004b80 20 20 20 20 20 20 20 20 3b 20 6a 75 6d 70 20 74 | ; jump t|
00004b90 6f 20 72 6f 77 20 6e 0d 16 76 0d 4d 4f 56 20 52 |o row n..v.MOV R|
00004ba0 30 2c 52 31 0d 16 80 2b 42 4c 20 73 6f 75 6e 64 |0,R1...+BL sound|
00004bb0 5f 64 65 62 75 67 32 20 20 20 20 20 20 20 20 20 |_debug2 |
00004bc0 20 20 20 20 20 20 3b 20 63 68 61 6e 6e 65 6c 0d | ; channel.|
00004bd0 16 8a 17 41 44 52 20 52 31 34 2c 73 6f 75 6e 64 |...ADR R14,sound|
00004be0 5f 66 72 65 71 30 0d 16 94 19 4c 44 52 20 52 30 |_freq0....LDR R0|
00004bf0 2c 5b 52 31 34 2c 52 31 2c 4c 53 4c 23 32 5d 0d |,[R14,R1,LSL#2].|
00004c00 16 9e 28 42 4c 20 73 6f 75 6e 64 5f 64 65 62 75 |..(BL sound_debu|
00004c10 67 32 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |g2 |
00004c20 20 3b 20 66 72 65 71 0d 16 a8 16 41 44 52 20 52 | ; freq....ADR R|
00004c30 31 34 2c 73 6f 75 6e 64 5f 61 6d 70 30 0d 16 b2 |14,sound_amp0...|
00004c40 14 4c 44 52 42 20 52 30 2c 5b 52 31 34 2c 52 31 |.LDRB R0,[R14,R1|
00004c50 5d 0d 16 bc 27 42 4c 20 73 6f 75 6e 64 5f 64 65 |]...'BL sound_de|
00004c60 62 75 67 32 20 20 20 20 20 20 20 20 20 20 20 20 |bug2 |
00004c70 20 20 20 3b 20 61 6d 70 0d 16 c6 19 4c 44 4d 46 | ; amp....LDMF|
00004c80 44 20 52 31 33 21 2c 7b 52 30 2d 52 31 2c 50 43 |D R13!,{R0-R1,PC|
00004c90 7d 0d 16 d0 04 0d 16 da 05 5d 0d 16 e4 07 3d 22 |}........]....="|
00004ca0 22 0d 16 ee 04 0d 16 f8 10 f4 20 4d 49 53 43 20 |"......... MISC |
00004cb0 53 54 55 46 46 0d 17 02 04 0d 17 0c 11 dd 20 a4 |STUFF......... .|
00004cc0 73 6f 75 6e 64 5f 6d 69 73 63 0d 17 16 0a 5b 4f |sound_misc....[O|
00004cd0 50 54 20 70 0d 17 20 04 0d 17 2a 19 3b 45 20 52 |PT p.. ...*.;E R|
00004ce0 30 3d 6e 75 6d 62 65 72 20 74 6f 20 70 72 69 6e |0=number to prin|
00004cf0 74 0d 17 34 15 3b 58 20 4e 75 6d 62 65 72 20 70 |t..4.;X Number p|
00004d00 72 69 6e 74 65 64 0d 17 3e 04 0d 17 48 36 2e 73 |rinted..>...H6.s|
00004d10 6f 75 6e 64 5f 64 65 62 75 67 32 20 20 20 20 20 |ound_debug2 |
00004d20 20 20 3b 20 6f 75 74 70 75 74 20 6e 75 6d 62 65 | ; output numbe|
00004d30 72 20 69 6e 20 52 30 20 74 6f 20 64 65 62 75 67 |r in R0 to debug|
00004d40 0d 17 52 1a 53 54 4d 46 44 20 52 31 33 21 2c 7b |..R.STMFD R13!,{|
00004d50 52 30 2d 52 32 2c 52 31 34 7d 0d 17 5c 1a 41 44 |R0-R2,R14}..\.AD|
00004d60 52 20 52 31 2c 73 6f 75 6e 64 5f 64 65 62 75 67 |R R1,sound_debug|
00004d70 5f 62 75 66 0d 17 66 0e 4d 4f 56 20 52 32 2c 23 |_buf..f.MOV R2,#|
00004d80 31 36 0d 17 70 19 53 57 49 20 22 58 4f 53 5f 43 |16..p.SWI "XOS_C|
00004d90 6f 6e 76 65 72 74 48 65 78 38 22 0d 17 7a 14 53 |onvertHex8"..z.S|
00004da0 57 49 20 22 58 4f 53 5f 57 72 69 74 65 30 22 0d |WI "XOS_Write0".|
00004db0 17 84 0c 53 57 49 20 26 31 32 30 0d 17 8e 19 4c |...SWI &120....L|
00004dc0 44 4d 46 44 20 52 31 33 21 2c 7b 52 30 2d 52 32 |DMFD R13!,{R0-R2|
00004dd0 2c 50 43 7d 0d 17 98 14 2e 73 6f 75 6e 64 5f 64 |,PC}.....sound_d|
00004de0 65 62 75 67 5f 62 75 66 0d 17 a2 12 a4 73 6f 75 |ebug_buf.....sou|
00004df0 6e 64 5f 6d 65 6d 28 31 36 29 0d 17 ac 04 0d 17 |nd_mem(16)......|
00004e00 b6 20 3b 45 20 52 30 3d 63 68 61 6e 6e 65 6c 20 |. ;E R0=channel |
00004e10 6e 75 6d 62 65 72 2d 31 20 28 30 2d 37 29 0d 17 |number-1 (0-7)..|
00004e20 c0 25 3b 20 20 52 65 74 75 72 6e 20 61 64 64 72 |.%; Return addr|
00004e30 65 73 73 20 6f 6e 20 74 6f 70 20 6f 66 20 73 74 |ess on top of st|
00004e40 61 63 6b 0d 17 ca 04 0d 17 d4 17 2e 73 6f 75 6e |ack.........soun|
00004e50 64 5f 76 69 6e 73 74 61 6e 74 69 61 74 65 0d 17 |d_vinstantiate..|
00004e60 de 16 53 54 4d 46 44 20 52 31 33 21 2c 7b 52 30 |..STMFD R13!,{R0|
00004e70 2d 52 35 7d 0d 17 e8 37 4d 4f 56 20 52 35 2c 52 |-R5}...7MOV R5,R|
00004e80 30 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |0 |
00004e90 20 20 20 20 20 20 3b 20 73 61 76 65 20 63 68 61 | ; save cha|
00004ea0 6e 6e 65 6c 20 6e 75 6d 62 65 72 0d 17 f2 0d 4d |nnel number....M|
00004eb0 4f 56 20 52 30 2c 23 30 0d 17 fc 0d 4d 4f 56 20 |OV R0,#0....MOV |
00004ec0 52 31 2c 23 30 0d 18 06 0d 4d 4f 56 20 52 32 2c |R1,#0....MOV R2,|
00004ed0 23 30 0d 18 10 0d 4d 4f 56 20 52 33 2c 23 30 0d |#0....MOV R3,#0.|
00004ee0 18 1a 0d 4d 4f 56 20 52 34 2c 23 30 0d 18 24 1a |...MOV R4,#0..$.|
00004ef0 53 57 49 20 22 58 53 6f 75 6e 64 5f 43 6f 6e 66 |SWI "XSound_Conf|
00004f00 69 67 75 72 65 22 0d 18 2e 32 41 44 44 20 52 30 |igure"...2ADD R0|
00004f10 2c 52 35 2c 23 31 20 20 20 20 20 20 20 20 20 20 |,R5,#1 |
00004f20 20 20 20 20 20 20 20 20 3b 20 63 68 61 6e 6e 65 | ; channe|
00004f30 6c 20 6e 75 6d 62 65 72 0d 18 38 0e 4d 4f 56 20 |l number..8.MOV |
00004f40 52 31 2c 23 32 30 0d 18 42 13 4c 44 52 20 52 32 |R1,#20..B.LDR R2|
00004f50 2c 5b 52 33 2c 23 31 32 5d 0d 18 4c 43 53 57 49 |,[R3,#12]..LCSWI|
00004f60 20 22 58 53 6f 75 6e 64 5f 57 72 69 74 65 43 6f | "XSound_WriteCo|
00004f70 6e 74 72 6f 6c 42 6c 6f 63 6b 22 20 20 20 20 20 |ntrolBlock" |
00004f80 20 20 20 20 20 3b 20 76 6f 6c 75 6d 65 20 73 63 | ; volume sc|
00004f90 61 6c 65 64 20 6c 6f 67 20 61 6d 70 0d 18 56 10 |aled log amp..V.|
00004fa0 41 44 44 20 52 30 2c 52 35 2c 23 31 0d 18 60 0e |ADD R0,R5,#1..`.|
00004fb0 4d 4f 56 20 52 31 2c 23 31 36 0d 18 6a 36 4d 4f |MOV R1,#16..j6MO|
00004fc0 56 20 52 32 2c 52 35 20 20 20 20 20 20 20 20 20 |V R2,R5 |
00004fd0 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 62 62 | ; bb|
00004fe0 63 20 63 68 61 6e 6e 65 6c 20 6e 75 6d 62 65 72 |c channel number|
00004ff0 0d 18 74 0d 43 4d 50 20 52 32 2c 23 34 0d 18 7e |..t.CMP R2,#4..~|
00005000 28 4d 4f 56 43 53 20 52 32 2c 23 30 20 20 20 20 |(MOVCS R2,#0 |
00005010 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b | ;|
00005020 20 63 6c 69 70 0d 18 88 22 53 57 49 20 22 58 53 | clip..."SWI "XS|
00005030 6f 75 6e 64 5f 57 72 69 74 65 43 6f 6e 74 72 6f |ound_WriteContro|
00005040 6c 42 6c 6f 63 6b 22 0d 18 92 19 4c 44 4d 46 44 |lBlock"....LDMFD|
00005050 20 52 31 33 21 2c 7b 52 30 2d 52 35 2c 50 43 7d | R13!,{R0-R5,PC}|
00005060 0d 18 9c 04 0d 18 a6 13 2e 73 6f 75 6e 64 5f 76 |.........sound_v|
00005070 67 61 74 65 6f 66 66 0d 18 b0 0d 4d 4f 56 20 52 |gateoff....MOV R|
00005080 30 2c 23 30 0d 18 ba 17 2e 73 6f 75 6e 64 5f 67 |0,#0.....sound_g|
00005090 61 74 65 6f 66 66 5f 6c 6f 6f 70 0d 18 c4 15 53 |ateoff_loop....S|
000050a0 54 52 42 20 52 30 2c 5b 52 31 32 5d 2c 52 31 31 |TRB R0,[R12],R11|
000050b0 0d 18 ce 16 53 54 52 42 20 52 30 2c 5b 52 31 32 |....STRB R0,[R12|
000050c0 5d 2c 52 31 31 20 0d 18 d8 15 53 54 52 42 20 52 |],R11 ....STRB R|
000050d0 30 2c 5b 52 31 32 5d 2c 52 31 31 0d 18 e2 15 53 |0,[R12],R11....S|
000050e0 54 52 42 20 52 30 2c 5b 52 31 32 5d 2c 52 31 31 |TRB R0,[R12],R11|
000050f0 0d 18 ec 0f 43 4d 50 20 52 31 32 2c 52 31 30 0d |....CMP R12,R10.|
00005100 18 f6 1a 42 4c 54 20 73 6f 75 6e 64 5f 67 61 74 |...BLT sound_gat|
00005110 65 6f 66 66 5f 6c 6f 6f 70 0d 19 00 0d 4d 4f 56 |eoff_loop....MOV|
00005120 20 52 30 2c 23 31 0d 19 0a 13 4c 44 4d 46 44 20 | R0,#1....LDMFD |
00005130 52 31 33 21 2c 7b 50 43 7d 0d 19 14 04 0d 19 1e |R13!,{PC}.......|
00005140 37 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b |7;;;;;;;;;;;;;;;|
00005150 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b |;;;;;;;;;;;;;;;;|
*
00005170 3b 3b 3b 3b 0d 19 28 37 3b 20 44 69 76 69 64 65 |;;;;..(7; Divide|
00005180 20 72 6f 75 74 69 6e 65 20 20 20 20 20 20 20 20 | routine |
00005190 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |
000051a0 20 20 20 20 20 20 20 20 20 20 3b 0d 19 32 37 3b | ;..27;|
000051b0 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b 3b |;;;;;;;;;;;;;;;;|
*
000051e0 3b 3b 0d 19 3c 04 0d 19 46 24 5c 45 20 52 30 3d |;;..<...F$\E R0=|
000051f0 6e 75 6d 65 72 61 74 6f 72 20 20 20 52 31 3d 64 |numerator R1=d|
00005200 65 6e 6f 6d 69 6e 61 74 6f 72 0d 19 50 37 5c 58 |enominator..P7\X|
00005210 20 52 30 3d 52 30 20 44 69 76 20 52 31 20 20 20 | R0=R0 Div R1 |
00005220 52 32 3d 52 30 20 4d 6f 64 20 52 31 20 20 20 20 |R2=R0 Mod R1 |
00005230 52 30 2d 52 33 20 63 6f 72 72 75 70 74 65 64 20 |R0-R3 corrupted |
00005240 7c 0d 19 5a 04 0d 19 64 0c 2e 64 69 76 5f 6d 6f ||..Z...d..div_mo|
00005250 64 0d 19 6e 33 4d 4f 56 20 52 32 2c 23 30 20 20 |d..n3MOV R2,#0 |
00005260 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |
00005270 20 20 20 5c 20 63 6c 65 61 72 20 72 65 6d 61 69 | \ clear remai|
00005280 6e 64 65 72 0d 19 78 34 41 44 44 53 20 52 30 2c |nder..x4ADDS R0,|
00005290 52 30 2c 52 30 20 20 20 20 20 20 20 20 20 20 20 |R0,R0 |
000052a0 20 20 20 20 20 20 5c 20 64 6f 75 62 6c 65 20 6e | \ double n|
000052b0 75 6d 65 72 61 74 6f 72 0d 19 82 30 52 53 42 20 |umerator...0RSB |
000052c0 52 31 2c 52 31 2c 23 30 20 20 20 20 20 20 20 20 |R1,R1,#0 |
000052d0 20 20 20 20 20 20 20 20 20 20 5c 20 6e 65 67 61 | \ nega|
000052e0 74 65 20 64 65 6e 6f 6d 0d 19 8c 0e 4d 4f 56 20 |te denom....MOV |
000052f0 52 33 2c 23 33 32 0d 19 96 0e 2e 64 69 76 5f 6d |R3,#32.....div_m|
00005300 6f 64 5f 31 0d 19 a0 34 41 44 43 53 20 52 32 2c |od_1...4ADCS R2,|
00005310 52 31 2c 52 32 2c 4c 53 4c 23 31 3a 53 55 42 43 |R1,R2,LSL#1:SUBC|
00005320 43 20 52 32 2c 52 32 2c 52 31 3a 41 44 43 53 20 |C R2,R2,R1:ADCS |
00005330 52 30 2c 52 30 2c 52 30 0d 19 aa 34 41 44 43 53 |R0,R0,R0...4ADCS|
00005340 20 52 32 2c 52 31 2c 52 32 2c 4c 53 4c 23 31 3a | R2,R1,R2,LSL#1:|
00005350 53 55 42 43 43 20 52 32 2c 52 32 2c 52 31 3a 41 |SUBCC R2,R2,R1:A|
00005360 44 43 53 20 52 30 2c 52 30 2c 52 30 0d 19 b4 34 |DCS R0,R0,R0...4|
00005370 41 44 43 53 20 52 32 2c 52 31 2c 52 32 2c 4c 53 |ADCS R2,R1,R2,LS|
00005380 4c 23 31 3a 53 55 42 43 43 20 52 32 2c 52 32 2c |L#1:SUBCC R2,R2,|
00005390 52 31 3a 41 44 43 53 20 52 30 2c 52 30 2c 52 30 |R1:ADCS R0,R0,R0|
000053a0 0d 19 be 34 41 44 43 53 20 52 32 2c 52 31 2c 52 |...4ADCS R2,R1,R|
000053b0 32 2c 4c 53 4c 23 31 3a 53 55 42 43 43 20 52 32 |2,LSL#1:SUBCC R2|
000053c0 2c 52 32 2c 52 31 3a 41 44 43 53 20 52 30 2c 52 |,R2,R1:ADCS R0,R|
000053d0 30 2c 52 30 0d 19 c8 10 53 55 42 20 52 33 2c 52 |0,R0....SUB R3,R|
000053e0 33 2c 23 34 0d 19 d2 0d 54 45 51 20 52 33 2c 23 |3,#4....TEQ R3,#|
000053f0 30 0d 19 dc 36 42 4e 45 20 64 69 76 5f 6d 6f 64 |0...6BNE div_mod|
00005400 5f 31 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |_1 |
00005410 20 20 20 5c 20 44 4f 20 ac 20 43 4f 52 52 55 50 | \ DO . CORRUP|
00005420 54 20 43 41 52 52 59 0d 19 e6 0f 4d 4f 56 53 20 |T CARRY....MOVS |
00005430 50 43 2c 52 31 34 0d 19 f0 04 0d 19 fa 0e 2e 6c |PC,R14.........l|
00005440 6f 67 5f 73 74 61 72 74 0d 1a 04 1a 53 54 4d 46 |og_start....STMF|
00005450 44 20 52 31 33 21 2c 7b 52 30 2d 52 32 2c 52 31 |D R13!,{R0-R2,R1|
00005460 34 7d 0d 1a 0e 0f 4d 4f 56 20 52 30 2c 23 26 38 |4}....MOV R0,#&8|
00005470 38 0d 1a 18 14 41 44 52 20 52 31 2c 6c 6f 67 5f |8....ADR R1,log_|
00005480 66 6e 61 6d 65 0d 1a 22 11 53 57 49 20 22 4f 53 |fname..".SWI "OS|
00005490 5f 46 69 6e 64 22 0d 1a 2c 15 53 54 52 20 52 30 |_Find"..,.STR R0|
000054a0 2c 6c 6f 67 5f 68 61 6e 64 6c 65 0d 1a 36 19 4c |,log_handle..6.L|
000054b0 44 4d 46 44 20 52 31 33 21 2c 7b 52 30 2d 52 32 |DMFD R13!,{R0-R2|
000054c0 2c 50 43 7d 0d 1a 40 26 2e 6c 6f 67 5f 66 6e 61 |,PC}..@&.log_fna|
000054d0 6d 65 20 45 51 55 53 20 22 24 2e 54 4d 50 2e 4c |me EQUS "$.TMP.L|
000054e0 6f 67 46 69 6c 65 22 2b bd 30 0d 1a 4a 09 41 4c |ogFile"+.0..J.AL|
000054f0 49 47 4e 0d 1a 54 16 2e 6c 6f 67 5f 68 61 6e 64 |IGN..T..log_hand|
00005500 6c 65 20 45 51 55 44 20 30 0d 1a 5e 14 2e 6c 6f |le EQUD 0..^..lo|
00005510 67 5f 74 65 6d 70 20 45 51 55 44 20 30 0d 1a 68 |g_temp EQUD 0..h|
00005520 04 0d 1a 72 0c 2e 6c 6f 67 5f 65 6e 64 0d 1a 7c |...r..log_end..||
00005530 1a 53 54 4d 46 44 20 52 31 33 21 2c 7b 52 30 2d |.STMFD R13!,{R0-|
00005540 52 32 2c 52 31 34 7d 0d 1a 86 0d 4d 4f 56 20 52 |R2,R14}....MOV R|
00005550 30 2c 23 30 0d 1a 90 15 4c 44 52 20 52 31 2c 6c |0,#0....LDR R1,l|
00005560 6f 67 5f 68 61 6e 64 6c 65 0d 1a 9a 11 53 57 49 |og_handle....SWI|
00005570 20 22 4f 53 5f 46 69 6e 64 22 0d 1a a4 19 4c 44 | "OS_Find"....LD|
00005580 4d 46 44 20 52 31 33 21 2c 7b 52 30 2d 52 32 2c |MFD R13!,{R0-R2,|
00005590 50 43 7d 0d 1a ae 04 0d 1a b8 14 3b 20 52 30 3d |PC}........; R0=|
000055a0 77 6f 72 64 20 74 6f 20 6c 6f 67 0d 1a c2 04 0d |word to log.....|
000055b0 1a cc 0d 2e 6c 6f 67 5f 77 6f 72 64 0d 1a d6 1a |....log_word....|
000055c0 53 54 4d 46 44 20 52 31 33 21 2c 7b 52 30 2d 52 |STMFD R13!,{R0-R|
000055d0 35 2c 52 31 34 7d 0d 1a e0 13 53 54 52 20 52 30 |5,R14}....STR R0|
000055e0 2c 6c 6f 67 5f 74 65 6d 70 0d 1a ea 0d 4d 4f 56 |,log_temp....MOV|
000055f0 20 52 30 2c 23 32 0d 1a f4 15 4c 44 52 20 52 31 | R0,#2....LDR R1|
00005600 2c 6c 6f 67 5f 68 61 6e 64 6c 65 0d 1a fe 13 41 |,log_handle....A|
00005610 44 52 20 52 32 2c 6c 6f 67 5f 74 65 6d 70 0d 1b |DR R2,log_temp..|
00005620 08 0d 4d 4f 56 20 52 33 2c 23 34 0d 1b 12 11 53 |..MOV R3,#4....S|
00005630 57 49 20 22 4f 53 5f 47 42 50 42 22 0d 1b 1c 19 |WI "OS_GBPB"....|
00005640 4c 44 4d 46 44 20 52 31 33 21 2c 7b 52 30 2d 52 |LDMFD R13!,{R0-R|
00005650 35 2c 50 43 7d 0d 1b 26 04 0d 1b 30 05 5d 0d 1b |5,PC}..&...0.]..|
00005660 3a 07 3d 22 22 0d 1b 44 04 0d 1b 4e 14 dd 20 a4 |:.=""..D...N.. .|
00005670 73 6f 75 6e 64 5f 6d 65 6d 28 61 25 29 0d 1b 58 |sound_mem(a%)..X|
00005680 11 50 25 2b 3d 61 25 3a 4f 25 2b 3d 61 25 0d 1b |.P%+=a%:O%+=a%..|
00005690 62 07 3d 22 22 0d ff |b.=""..|
00005697
.