Home » Archimedes archive » Archimedes World » AW-1996-07.adf » !AcornAns_AcornAns » Sound/Demo1
Sound/Demo1
This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.
Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.
Tape/disk: | Home » Archimedes archive » Archimedes World » AW-1996-07.adf » !AcornAns_AcornAns |
Filename: | Sound/Demo1 |
Read OK: | ✔ |
File size: | 12F1 bytes |
Load address: | 0000 |
Exec address: | 0000 |
Duplicates
There is 1 duplicate copy of this file in the archive:
- Archimedes archive » Archimedes World » AW-1996-07.adf » !AcornAns_AcornAns » Sound/Demo1
- Archimedes archive » Archimedes World » AW-1996-06-Disc 1.adf » !AcornAns_AcornAns » Sound/Demo1
File contents
10REM >Demo1 20REM 30REM Demo of how to add a new voice generator 40REM Mostly copyright Acorn (see PRM 4.74-4.76) 50REM 60REM NB Strongly recommend you connect the headphone socket 70REM on the computer to a hi-fi amplifier or at the very 80REM least to a pair of headphones. 90REM The computer's own internal speaker/s are poor, quiet 100REM and don't reproduce low frequency sounds well. 110REM 120: 130DIM WaveTable% 255, Code% 4095 140: 150REM First we build our sample at full volume 160SYS "Sound_Volume", 127 TO UserVolume% 170FOR s%=0 TO 255 180 SYS "Sound_SoundLog", &7fffffff*SIN(2*PI*s%/256) TO WaveTable%?s% 190NEXT 200SYS "Sound_Volume", UserVolume% 210: 220FOR pass%=0 TO 2 STEP 2 230P%=Code% 240[ OPT pass% 250 : 260.VoiceBase% 270 B Fill% 280 B Fill% 290 B GateOn% 300 B GateOff% 310 B Instance% 320 LDMFD 13!, {PC} 330 LDMFD 13!, {PC} 340 EQUD VoiceName%-VoiceBase% 350.VoiceName% 360 EQUS "WaveVoice" 370 EQUB 0 380 ALIGN 390 : 400.LogAmpPtr% 410 EQUD 0 420.WaveBase% 430 EQUD WaveTable% 440 : 450 : ;instantiation code - 460 : ;called when voice attached to a channel 470 : ;SVC mode in use 480 : ; r0 is physical channel # - 1 (0-7) 490.Instance% 500 STMFD 13!, {0-4} ;all we do is note where the log amp 510 MOV 0, #0 ;table is for use by buffer fill routines 520 MOV 1, #0 530 MOV 2, #0 540 MOV 3, #0 550 MOV 4, #0 560 SWI "XSound_Configure" 570 LDRVC 0, [3, #12] 580 STRVC 0, LogAmpPtr% ;ptr to volume scaled log amplitude table 590 STRVS 0, [13] ;scaling log channel amp by overall vol 600 LDMFD 13!, {0-4, PC} 610 : 620 : ;buffer fill routines - 630 : ;code must be re-entrant & is called in 640 : ;IRQ mode with interrupts enabled 650 : ;(hence r14 not usable) 660 : ; r0-r8 available 670 : ; r9 is SCCB ptr 680 : ; r10 DMA buffer limit + 1 690 : ; r11 DMA buffer interleaf increment 700 : ; r12 DMA buffer base ptr 710 : ; r13 Sound system stack 720 : 730.GateOn% ;called when a sound is initialised 740 LDR 0, WaveBase% 750 STR 0, [9, #16] ;set up as work reg 5 760 LDR 0, LogAmpPtr% 770 STR 0, [9, #20] ;set up as work reg 6 780 : 790.Fill% ;called during sounding or when starting 800 LDMIA 9, {1-6} ;a new sound smoothly 810 AND 1, 1, #&7f 820 ; r1 log amp (0-127), r2 pitch phase acc 830 ; r3 timbre phase acc, r4 duration 840 ; r5 wavetable base, r6 amp table base 850 ;convert r1 -> VIDC format log amp 860 ;(has sign bit in b0) and then get 870 LDRB 1, [6, 1, LSL #1] ;log amp scaled by overall volume 880 MOV 1, 1, LSR #1 ;now move sign bit back 890 RSB 1, 1, #127 900.FillLoop% 910 ADD 2, 2, 2, LSL #16 ;advance waveform phase 920 LDRB 0, [5, 2, LSR #24] ;get wave sample 930 SUBS 0, 0, 1, LSL #1 ;scale amp by channel & overall vol 940 MOVMI 0, #0 ;correct for underflow 950 STRB 0, [12], 11 ;generate output 960 ADD 2, 2, 2, LSL #16 ;repeat in line once more 970 LDRB 0, [5, 2, LSR #24] 980 SUBS 0, 0, 1, LSL #1 990 MOVMI 0, #0 1000 STRB 0, [12], 11 1010 CMP 12, 10 1020 BLT FillLoop% ;loop if not buffer full 1030 : 1040 SUBS 4, 4, #1 ;decrement centisec count 1050 STMIB 9, {2-5} ;save registers back to SCCB 1060 MOVPL 0, #%00001000 ;voice active if still duration left 1070 MOVMI 0, #%00000010 ;else force flush 1080 LDMFD 13!, {PC} 1090 : 1100.GateOff% ;called to end sounding of a note 1110 MOV 0, #0 1120.FlushLoop% 1130 STRB 0, [12], 11 1140 STRB 0, [12], 11 1150 CMP 12, 10 1160 BLT FlushLoop% 1170 MOV 0, #%00000001 ;set flag to flush one more buffer 1180 LDMFD 13!, {PC} 1190] 1200NEXT 1210: 1220DIM OldVoice%(8) 1230SYS "Sound_InstallVoice", VoiceBase%,0 TO ,Voice% 1240FOR v%=1 TO 8 1250 SYS "Sound_AttachVoice", v%, Voice% TO ,OldVoice%(v%) 1260NEXT 1270: 1280ON ERROR PROCRestoreSound:END 1290: 1300SYS "Sound_Configure", 8 1310*Voices 1320SOUND 1, &17F, 53, 10 1330PRINT''"any key to make a noise, <ESCAPE> to finish" 1340: 1350C%=1 1360REPEAT 1370 K%=INKEY(1) 1380 IF K%>0 THEN 1390 PRINT STR$K%;" "; 1400 SOUND C%, &17F, K%, 100 1410 C%+=1:IF C%>8 C%=1 1420 ENDIF 1430UNTIL 0 1440: 1450DEF PROCRestoreSound 1460 ON ERROR OFF 1470 REPORT:PRINT ERL 1480 SYS "Sound_RemoveVoice",,Voice% 1490 FOR v%=1 TO 8 1500 SYS "Sound_AttachVoice", v%, OldVoice%(v%) 1510 NEXT 1520SYS "Sound_Configure", 1 1530*Voices 1540PRINT'' 1550ENDPROC
� >Demo1 � .� Demo of how to add a new voice generator (0� Mostly copyright Acorn (see PRM 4.74-4.76) 2� <<� NB Strongly recommend you connect the headphone socket F<� on the computer to a hi-fi amplifier or at the very P'� least to a pair of headphones. Z>� The computer's own internal speaker/s are poor, quiet d7� and don't reproduce low frequency sounds well. n� x: � � WaveTable% 255, Code% 4095 �: �.� First we build our sample at full volume �(ș "Sound_Volume", 127 � UserVolume% �� s%=0 � 255 �A ș "Sound_SoundLog", &7fffffff*�(2*�*s%/256) � WaveTable%?s% �� �"ș "Sound_Volume", UserVolume% �: �� pass%=0 � 2 � 2 �P%=Code% �[ OPT pass% � : .VoiceBase% B Fill% B Fill% " B GateOn% , B GateOff% 6 B Instance% @ LDMFD 13!, {PC} J LDMFD 13!, {PC} T# EQUD VoiceName%-VoiceBase% ^.VoiceName% h EQUS "WaveVoice" r EQUB 0 | ALIGN � : �.LogAmpPtr% � EQUD 0 �.WaveBase% � EQUD WaveTable% � : �2 : ;instantiation code - �E : ;called when voice attached to a channel �- : ;SVC mode in use �B : ; r0 is physical channel # - 1 (0-7) �.Instance% �A STMFD 13!, {0-4} ;all we do is note where the log amp �F MOV 0, #0 ;table is for use by buffer fill routines MOV 1, #0 MOV 2, #0 MOV 3, #0 & MOV 4, #0 0 SWI "XSound_Configure" : LDRVC 0, [3, #12] DF STRVC 0, LogAmpPtr% ;ptr to volume scaled log amplitude table ND STRVS 0, [13] ;scaling log channel amp by overall vol X LDMFD 13!, {0-4, PC} b : l4 : ;buffer fill routines - vD : ;code must be re-entrant & is called in �> : ;IRQ mode with interrupts enabled �4 : ;(hence r14 not usable) �. : ; r0-r8 available �. : ; r9 is SCCB ptr �7 : ; r10 DMA buffer limit + 1 �A : ; r11 DMA buffer interleaf increment �6 : ; r12 DMA buffer base ptr �5 : ; r13 Sound system stack � : �@.GateOn% ;called when a sound is initialised � LDR 0, WaveBase% �2 STR 0, [9, #16] ;set up as work reg 5 � LDR 0, LogAmpPtr% 2 STR 0, [9, #20] ;set up as work reg 6 : E.Fill% ;called during sounding or when starting 2 LDMIA 9, {1-6} ;a new sound smoothly * � 1, 1, #&7f 4F ; r1 log amp (0-127), r2 pitch phase acc >? ; r3 timbre phase acc, r4 duration HE ; r5 wavetable base, r6 amp table base RD ;convert r1 -> VIDC format log amp \D ;(has sign bit in b0) and then get fC LDRB 1, [6, 1, LSL #1] ;log amp scaled by overall volume p9 MOV 1, 1, LSR #1 ;now move sign bit back z RSB 1, 1, #127 �.FillLoop% �9 ADD 2, 2, 2, LSL #16 ;advance waveform phase �2 LDRB 0, [5, 2, LSR #24] ;get wave sample �E SUBS 0, 0, 1, LSL #1 ;scale amp by channel & overall vol �8 MOVMI 0, #0 ;correct for underflow �2 STRB 0, [12], 11 ;generate output �; ADD 2, 2, 2, LSL #16 ;repeat in line once more � LDRB 0, [5, 2, LSR #24] � SUBS 0, 0, 1, LSL #1 � MOVMI 0, #0 � STRB 0, [12], 11 � CMP 12, 10 �: BLT FillLoop% ;loop if not buffer full : ; SUBS 4, 4, #1 ;decrement centisec count > STMIB 9, {2-5} ;save registers back to SCCB $F MOVPL 0, #%00001000 ;voice active if still duration left .3 MOVMI 0, #%00000010 ;else force flush 8 LDMFD 13!, {PC} B : LC.GateOff% ;called to end sounding of a note V MOV 0, #0 `.FlushLoop% j STRB 0, [12], 11 t STRB 0, [12], 11 ~ CMP 12, 10 � BLT FlushLoop% �D MOV 0, #%00000001 ;set flag to flush one more buffer � LDMFD 13!, {PC} �] �� �: �� OldVoice%(8) �3ș "Sound_InstallVoice", VoiceBase%,0 � ,Voice% �� v%=1 � 8 �8 ș "Sound_AttachVoice", v%, Voice% � ,OldVoice%(v%) �� �: � � �RestoreSound:� : ș "Sound_Configure", 8 *Voices (� 1, &17F, 53, 10 24�''"any key to make a noise, <ESCAPE> to finish" <: FC%=1 P� Z K%=�(1) d � K%>0 � n � �K%;" "; x � C%, &17F, K%, 100 � C%+=1:� C%>8 C%=1 � � �� 0 �: �� �RestoreSound � � � � � �:� � �# ș "Sound_RemoveVoice",,Voice% � � v%=1 � 8 �/ ș "Sound_AttachVoice", v%, OldVoice%(v%) � � �ș "Sound_Configure", 1 �*Voices �'' � �
00000000 0d 00 0a 0c f4 20 3e 44 65 6d 6f 31 0d 00 14 05 |..... >Demo1....| 00000010 f4 0d 00 1e 2e f4 20 44 65 6d 6f 20 6f 66 20 68 |...... Demo of h| 00000020 6f 77 20 74 6f 20 61 64 64 20 61 20 6e 65 77 20 |ow to add a new | 00000030 76 6f 69 63 65 20 67 65 6e 65 72 61 74 6f 72 0d |voice generator.| 00000040 00 28 30 f4 20 4d 6f 73 74 6c 79 20 63 6f 70 79 |.(0. Mostly copy| 00000050 72 69 67 68 74 20 41 63 6f 72 6e 20 28 73 65 65 |right Acorn (see| 00000060 20 50 52 4d 20 34 2e 37 34 2d 34 2e 37 36 29 0d | PRM 4.74-4.76).| 00000070 00 32 05 f4 0d 00 3c 3c f4 20 4e 42 20 53 74 72 |.2....<<. NB Str| 00000080 6f 6e 67 6c 79 20 72 65 63 6f 6d 6d 65 6e 64 20 |ongly recommend | 00000090 79 6f 75 20 63 6f 6e 6e 65 63 74 20 74 68 65 20 |you connect the | 000000a0 68 65 61 64 70 68 6f 6e 65 20 73 6f 63 6b 65 74 |headphone socket| 000000b0 0d 00 46 3c f4 20 20 20 20 6f 6e 20 74 68 65 20 |..F<. on the | 000000c0 63 6f 6d 70 75 74 65 72 20 74 6f 20 61 20 68 69 |computer to a hi| 000000d0 2d 66 69 20 61 6d 70 6c 69 66 69 65 72 20 6f 72 |-fi amplifier or| 000000e0 20 61 74 20 74 68 65 20 76 65 72 79 0d 00 50 27 | at the very..P'| 000000f0 f4 20 20 20 20 6c 65 61 73 74 20 74 6f 20 61 20 |. least to a | 00000100 70 61 69 72 20 6f 66 20 68 65 61 64 70 68 6f 6e |pair of headphon| 00000110 65 73 2e 0d 00 5a 3e f4 20 20 20 20 54 68 65 20 |es...Z>. The | 00000120 63 6f 6d 70 75 74 65 72 27 73 20 6f 77 6e 20 69 |computer's own i| 00000130 6e 74 65 72 6e 61 6c 20 73 70 65 61 6b 65 72 2f |nternal speaker/| 00000140 73 20 61 72 65 20 70 6f 6f 72 2c 20 71 75 69 65 |s are poor, quie| 00000150 74 0d 00 64 37 f4 20 20 20 20 61 6e 64 20 64 6f |t..d7. and do| 00000160 6e 27 74 20 72 65 70 72 6f 64 75 63 65 20 6c 6f |n't reproduce lo| 00000170 77 20 66 72 65 71 75 65 6e 63 79 20 73 6f 75 6e |w frequency soun| 00000180 64 73 20 77 65 6c 6c 2e 0d 00 6e 05 f4 0d 00 78 |ds well...n....x| 00000190 05 3a 0d 00 82 20 de 20 57 61 76 65 54 61 62 6c |.:... . WaveTabl| 000001a0 65 25 20 32 35 35 2c 20 43 6f 64 65 25 20 34 30 |e% 255, Code% 40| 000001b0 39 35 0d 00 8c 05 3a 0d 00 96 2e f4 20 46 69 72 |95....:..... Fir| 000001c0 73 74 20 77 65 20 62 75 69 6c 64 20 6f 75 72 20 |st we build our | 000001d0 73 61 6d 70 6c 65 20 61 74 20 66 75 6c 6c 20 76 |sample at full v| 000001e0 6f 6c 75 6d 65 0d 00 a0 28 c8 99 20 22 53 6f 75 |olume...(.. "Sou| 000001f0 6e 64 5f 56 6f 6c 75 6d 65 22 2c 20 31 32 37 20 |nd_Volume", 127 | 00000200 b8 20 55 73 65 72 56 6f 6c 75 6d 65 25 0d 00 aa |. UserVolume%...| 00000210 10 e3 20 73 25 3d 30 20 b8 20 32 35 35 0d 00 b4 |.. s%=0 . 255...| 00000220 41 20 c8 99 20 22 53 6f 75 6e 64 5f 53 6f 75 6e |A .. "Sound_Soun| 00000230 64 4c 6f 67 22 2c 20 26 37 66 66 66 66 66 66 66 |dLog", &7fffffff| 00000240 2a b5 28 32 2a af 2a 73 25 2f 32 35 36 29 20 b8 |*.(2*.*s%/256) .| 00000250 20 57 61 76 65 54 61 62 6c 65 25 3f 73 25 0d 00 | WaveTable%?s%..| 00000260 be 05 ed 0d 00 c8 22 c8 99 20 22 53 6f 75 6e 64 |......".. "Sound| 00000270 5f 56 6f 6c 75 6d 65 22 2c 20 55 73 65 72 56 6f |_Volume", UserVo| 00000280 6c 75 6d 65 25 0d 00 d2 05 3a 0d 00 dc 15 e3 20 |lume%....:..... | 00000290 70 61 73 73 25 3d 30 20 b8 20 32 20 88 20 32 0d |pass%=0 . 2 . 2.| 000002a0 00 e6 0c 50 25 3d 43 6f 64 65 25 0d 00 f0 0f 5b |...P%=Code%....[| 000002b0 20 4f 50 54 20 70 61 73 73 25 0d 00 fa 06 20 3a | OPT pass%.... :| 000002c0 0d 01 04 0f 2e 56 6f 69 63 65 42 61 73 65 25 0d |.....VoiceBase%.| 000002d0 01 0e 13 20 42 20 20 20 20 20 20 20 20 46 69 6c |... B Fil| 000002e0 6c 25 0d 01 18 13 20 42 20 20 20 20 20 20 20 20 |l%.... B | 000002f0 46 69 6c 6c 25 0d 01 22 15 20 42 20 20 20 20 20 |Fill%..". B | 00000300 20 20 20 47 61 74 65 4f 6e 25 0d 01 2c 16 20 42 | GateOn%..,. B| 00000310 20 20 20 20 20 20 20 20 47 61 74 65 4f 66 66 25 | GateOff%| 00000320 0d 01 36 17 20 42 20 20 20 20 20 20 20 20 49 6e |..6. B In| 00000330 73 74 61 6e 63 65 25 0d 01 40 17 20 4c 44 4d 46 |stance%..@. LDMF| 00000340 44 20 20 20 20 31 33 21 2c 20 7b 50 43 7d 0d 01 |D 13!, {PC}..| 00000350 4a 17 20 4c 44 4d 46 44 20 20 20 20 31 33 21 2c |J. LDMFD 13!,| 00000360 20 7b 50 43 7d 0d 01 54 23 20 45 51 55 44 20 20 | {PC}..T# EQUD | 00000370 20 20 20 56 6f 69 63 65 4e 61 6d 65 25 2d 56 6f | VoiceName%-Vo| 00000380 69 63 65 42 61 73 65 25 0d 01 5e 0f 2e 56 6f 69 |iceBase%..^..Voi| 00000390 63 65 4e 61 6d 65 25 0d 01 68 15 20 45 51 55 53 |ceName%..h. EQUS| 000003a0 20 22 57 61 76 65 56 6f 69 63 65 22 0d 01 72 0b | "WaveVoice"..r.| 000003b0 20 45 51 55 42 20 30 0d 01 7c 0a 20 41 4c 49 47 | EQUB 0..|. ALIG| 000003c0 4e 0d 01 86 06 20 3a 0d 01 90 0f 2e 4c 6f 67 41 |N.... :.....LogA| 000003d0 6d 70 50 74 72 25 0d 01 9a 0b 20 45 51 55 44 20 |mpPtr%.... EQUD | 000003e0 30 0d 01 a4 0e 2e 57 61 76 65 42 61 73 65 25 0d |0.....WaveBase%.| 000003f0 01 ae 14 20 45 51 55 44 20 57 61 76 65 54 61 62 |... EQUD WaveTab| 00000400 6c 65 25 0d 01 b8 06 20 3a 0d 01 c2 32 20 3a 20 |le%.... :...2 : | 00000410 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000420 20 20 20 20 20 20 3b 69 6e 73 74 61 6e 74 69 61 | ;instantia| 00000430 74 69 6f 6e 20 63 6f 64 65 20 2d 0d 01 cc 45 20 |tion code -...E | 00000440 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |: | 00000450 20 20 20 20 20 20 20 20 3b 63 61 6c 6c 65 64 20 | ;called | 00000460 77 68 65 6e 20 76 6f 69 63 65 20 61 74 74 61 63 |when voice attac| 00000470 68 65 64 20 74 6f 20 61 20 63 68 61 6e 6e 65 6c |hed to a channel| 00000480 0d 01 d6 2d 20 3a 20 20 20 20 20 20 20 20 20 20 |...- : | 00000490 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 53 56 | ;SV| 000004a0 43 20 6d 6f 64 65 20 69 6e 20 75 73 65 0d 01 e0 |C mode in use...| 000004b0 42 20 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 |B : | 000004c0 20 20 20 20 20 20 20 20 20 20 3b 20 72 30 20 20 | ; r0 | 000004d0 69 73 20 70 68 79 73 69 63 61 6c 20 63 68 61 6e |is physical chan| 000004e0 6e 65 6c 20 23 20 2d 20 31 20 28 30 2d 37 29 0d |nel # - 1 (0-7).| 000004f0 01 ea 0e 2e 49 6e 73 74 61 6e 63 65 25 0d 01 f4 |....Instance%...| 00000500 41 20 53 54 4d 46 44 20 20 20 20 31 33 21 2c 20 |A STMFD 13!, | 00000510 7b 30 2d 34 7d 20 20 20 20 20 3b 61 6c 6c 20 77 |{0-4} ;all w| 00000520 65 20 64 6f 20 69 73 20 6e 6f 74 65 20 77 68 65 |e do is note whe| 00000530 72 65 20 74 68 65 20 6c 6f 67 20 61 6d 70 0d 01 |re the log amp..| 00000540 fe 46 20 4d 4f 56 20 20 20 20 20 20 30 2c 20 23 |.F MOV 0, #| 00000550 30 20 20 20 20 20 20 20 20 20 20 3b 74 61 62 6c |0 ;tabl| 00000560 65 20 69 73 20 66 6f 72 20 75 73 65 20 62 79 20 |e is for use by | 00000570 62 75 66 66 65 72 20 66 69 6c 6c 20 72 6f 75 74 |buffer fill rout| 00000580 69 6e 65 73 0d 02 08 13 20 4d 4f 56 20 20 20 20 |ines.... MOV | 00000590 20 20 31 2c 20 23 30 0d 02 12 13 20 4d 4f 56 20 | 1, #0.... MOV | 000005a0 20 20 20 20 20 32 2c 20 23 30 0d 02 1c 13 20 4d | 2, #0.... M| 000005b0 4f 56 20 20 20 20 20 20 33 2c 20 23 30 0d 02 26 |OV 3, #0..&| 000005c0 13 20 4d 4f 56 20 20 20 20 20 20 34 2c 20 23 30 |. MOV 4, #0| 000005d0 0d 02 30 20 20 53 57 49 20 20 20 20 20 20 22 58 |..0 SWI "X| 000005e0 53 6f 75 6e 64 5f 43 6f 6e 66 69 67 75 72 65 22 |Sound_Configure"| 000005f0 0d 02 3a 19 20 4c 44 52 56 43 20 20 20 20 30 2c |..:. LDRVC 0,| 00000600 20 5b 33 2c 20 23 31 32 5d 0d 02 44 46 20 53 54 | [3, #12]..DF ST| 00000610 52 56 43 20 20 20 20 30 2c 20 4c 6f 67 41 6d 70 |RVC 0, LogAmp| 00000620 50 74 72 25 20 20 3b 70 74 72 20 74 6f 20 76 6f |Ptr% ;ptr to vo| 00000630 6c 75 6d 65 20 73 63 61 6c 65 64 20 6c 6f 67 20 |lume scaled log | 00000640 61 6d 70 6c 69 74 75 64 65 20 74 61 62 6c 65 0d |amplitude table.| 00000650 02 4e 44 20 53 54 52 56 53 20 20 20 20 30 2c 20 |.ND STRVS 0, | 00000660 5b 31 33 5d 20 20 20 20 20 20 20 20 3b 73 63 61 |[13] ;sca| 00000670 6c 69 6e 67 20 6c 6f 67 20 63 68 61 6e 6e 65 6c |ling log channel| 00000680 20 61 6d 70 20 62 79 20 6f 76 65 72 61 6c 6c 20 | amp by overall | 00000690 76 6f 6c 0d 02 58 1c 20 4c 44 4d 46 44 20 20 20 |vol..X. LDMFD | 000006a0 20 31 33 21 2c 20 7b 30 2d 34 2c 20 50 43 7d 0d | 13!, {0-4, PC}.| 000006b0 02 62 06 20 3a 0d 02 6c 34 20 3a 20 20 20 20 20 |.b. :..l4 : | 000006c0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 000006d0 20 20 3b 62 75 66 66 65 72 20 66 69 6c 6c 20 72 | ;buffer fill r| 000006e0 6f 75 74 69 6e 65 73 20 2d 0d 02 76 44 20 3a 20 |outines -..vD : | 000006f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000700 20 20 20 20 20 20 3b 63 6f 64 65 20 6d 75 73 74 | ;code must| 00000710 20 62 65 20 72 65 2d 65 6e 74 72 61 6e 74 20 26 | be re-entrant &| 00000720 20 69 73 20 63 61 6c 6c 65 64 20 69 6e 0d 02 80 | is called in...| 00000730 3e 20 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 |> : | 00000740 20 20 20 20 20 20 20 20 20 20 3b 49 52 51 20 6d | ;IRQ m| 00000750 6f 64 65 20 77 69 74 68 20 69 6e 74 65 72 72 75 |ode with interru| 00000760 70 74 73 20 65 6e 61 62 6c 65 64 0d 02 8a 34 20 |pts enabled...4 | 00000770 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |: | 00000780 20 20 20 20 20 20 20 20 3b 28 68 65 6e 63 65 20 | ;(hence | 00000790 72 31 34 20 6e 6f 74 20 75 73 61 62 6c 65 29 0d |r14 not usable).| 000007a0 02 94 2e 20 3a 20 20 20 20 20 20 20 20 20 20 20 |... : | 000007b0 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 72 30 | ; r0| 000007c0 2d 72 38 20 61 76 61 69 6c 61 62 6c 65 0d 02 9e |-r8 available...| 000007d0 2e 20 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 |. : | 000007e0 20 20 20 20 20 20 20 20 20 20 3b 20 72 39 20 20 | ; r9 | 000007f0 69 73 20 53 43 43 42 20 70 74 72 0d 02 a8 37 20 |is SCCB ptr...7 | 00000800 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |: | 00000810 20 20 20 20 20 20 20 20 3b 20 72 31 30 20 44 4d | ; r10 DM| 00000820 41 20 62 75 66 66 65 72 20 6c 69 6d 69 74 20 2b |A buffer limit +| 00000830 20 31 0d 02 b2 41 20 3a 20 20 20 20 20 20 20 20 | 1...A : | 00000840 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b | ;| 00000850 20 72 31 31 20 44 4d 41 20 62 75 66 66 65 72 20 | r11 DMA buffer | 00000860 69 6e 74 65 72 6c 65 61 66 20 69 6e 63 72 65 6d |interleaf increm| 00000870 65 6e 74 0d 02 bc 36 20 3a 20 20 20 20 20 20 20 |ent...6 : | 00000880 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000890 3b 20 72 31 32 20 44 4d 41 20 62 75 66 66 65 72 |; r12 DMA buffer| 000008a0 20 62 61 73 65 20 70 74 72 0d 02 c6 35 20 3a 20 | base ptr...5 : | 000008b0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 000008c0 20 20 20 20 20 20 3b 20 72 31 33 20 53 6f 75 6e | ; r13 Soun| 000008d0 64 20 73 79 73 74 65 6d 20 73 74 61 63 6b 0d 02 |d system stack..| 000008e0 d0 06 20 3a 0d 02 da 40 2e 47 61 74 65 4f 6e 25 |.. :...@.GateOn%| 000008f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000900 20 3b 63 61 6c 6c 65 64 20 77 68 65 6e 20 61 20 | ;called when a | 00000910 73 6f 75 6e 64 20 69 73 20 69 6e 69 74 69 61 6c |sound is initial| 00000920 69 73 65 64 0d 02 e4 1a 20 4c 44 52 20 20 20 20 |ised.... LDR | 00000930 20 20 30 2c 20 57 61 76 65 42 61 73 65 25 0d 02 | 0, WaveBase%..| 00000940 ee 32 20 53 54 52 20 20 20 20 20 20 30 2c 20 5b |.2 STR 0, [| 00000950 39 2c 20 23 31 36 5d 20 20 20 20 3b 73 65 74 20 |9, #16] ;set | 00000960 75 70 20 61 73 20 77 6f 72 6b 20 72 65 67 20 35 |up as work reg 5| 00000970 0d 02 f8 1b 20 4c 44 52 20 20 20 20 20 20 30 2c |.... LDR 0,| 00000980 20 4c 6f 67 41 6d 70 50 74 72 25 0d 03 02 32 20 | LogAmpPtr%...2 | 00000990 53 54 52 20 20 20 20 20 20 30 2c 20 5b 39 2c 20 |STR 0, [9, | 000009a0 23 32 30 5d 20 20 20 20 3b 73 65 74 20 75 70 20 |#20] ;set up | 000009b0 61 73 20 77 6f 72 6b 20 72 65 67 20 36 0d 03 0c |as work reg 6...| 000009c0 06 20 3a 0d 03 16 45 2e 46 69 6c 6c 25 20 20 20 |. :...E.Fill% | 000009d0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 000009e0 3b 63 61 6c 6c 65 64 20 64 75 72 69 6e 67 20 73 |;called during s| 000009f0 6f 75 6e 64 69 6e 67 20 6f 72 20 77 68 65 6e 20 |ounding or when | 00000a00 73 74 61 72 74 69 6e 67 0d 03 20 32 20 4c 44 4d |starting.. 2 LDM| 00000a10 49 41 20 20 20 20 39 2c 20 7b 31 2d 36 7d 20 20 |IA 9, {1-6} | 00000a20 20 20 20 20 20 3b 61 20 6e 65 77 20 73 6f 75 6e | ;a new soun| 00000a30 64 20 73 6d 6f 6f 74 68 6c 79 0d 03 2a 16 20 80 |d smoothly..*. .| 00000a40 20 20 20 20 20 20 31 2c 20 31 2c 20 23 26 37 66 | 1, 1, #&7f| 00000a50 0d 03 34 46 20 20 20 20 20 20 20 20 20 20 20 20 |..4F | 00000a60 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 72 | ; r| 00000a70 31 20 6c 6f 67 20 61 6d 70 20 28 30 2d 31 32 37 |1 log amp (0-127| 00000a80 29 2c 20 20 72 32 20 70 69 74 63 68 20 70 68 61 |), r2 pitch pha| 00000a90 73 65 20 61 63 63 0d 03 3e 3f 20 20 20 20 20 20 |se acc..>? | 00000aa0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000ab0 20 20 20 3b 20 72 33 20 74 69 6d 62 72 65 20 70 | ; r3 timbre p| 00000ac0 68 61 73 65 20 61 63 63 2c 20 72 34 20 64 75 72 |hase acc, r4 dur| 00000ad0 61 74 69 6f 6e 0d 03 48 45 20 20 20 20 20 20 20 |ation..HE | 00000ae0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000af0 20 20 3b 20 72 35 20 77 61 76 65 74 61 62 6c 65 | ; r5 wavetable| 00000b00 20 62 61 73 65 2c 20 20 20 72 36 20 61 6d 70 20 | base, r6 amp | 00000b10 74 61 62 6c 65 20 62 61 73 65 0d 03 52 44 20 20 |table base..RD | 00000b20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000b30 20 20 20 20 20 20 20 20 20 20 20 20 3b 63 6f 6e | ;con| 00000b40 76 65 72 74 20 72 31 20 2d 3e 20 56 49 44 43 20 |vert r1 -> VIDC | 00000b50 66 6f 72 6d 61 74 20 6c 6f 67 20 61 6d 70 0d 03 |format log amp..| 00000b60 5c 44 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |\D | 00000b70 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000b80 3b 28 68 61 73 20 73 69 67 6e 20 62 69 74 20 69 |;(has sign bit i| 00000b90 6e 20 62 30 29 20 61 6e 64 20 74 68 65 6e 20 67 |n b0) and then g| 00000ba0 65 74 0d 03 66 43 20 4c 44 52 42 20 20 20 20 20 |et..fC LDRB | 00000bb0 31 2c 20 5b 36 2c 20 31 2c 20 4c 53 4c 20 23 31 |1, [6, 1, LSL #1| 00000bc0 5d 20 20 20 3b 6c 6f 67 20 61 6d 70 20 73 63 61 |] ;log amp sca| 00000bd0 6c 65 64 20 62 79 20 6f 76 65 72 61 6c 6c 20 76 |led by overall v| 00000be0 6f 6c 75 6d 65 0d 03 70 39 20 4d 4f 56 20 20 20 |olume..p9 MOV | 00000bf0 20 20 20 31 2c 20 31 2c 20 4c 53 52 20 23 31 20 | 1, 1, LSR #1 | 00000c00 20 20 20 20 20 20 20 3b 6e 6f 77 20 6d 6f 76 65 | ;now move| 00000c10 20 73 69 67 6e 20 62 69 74 20 62 61 63 6b 0d 03 | sign bit back..| 00000c20 7a 18 20 52 53 42 20 20 20 20 20 20 31 2c 20 31 |z. RSB 1, 1| 00000c30 2c 20 23 31 32 37 0d 03 84 0e 2e 46 69 6c 6c 4c |, #127.....FillL| 00000c40 6f 6f 70 25 0d 03 8e 39 20 41 44 44 20 20 20 20 |oop%...9 ADD | 00000c50 20 20 32 2c 20 32 2c 20 32 2c 20 4c 53 4c 20 23 | 2, 2, 2, LSL #| 00000c60 31 36 20 20 20 20 3b 61 64 76 61 6e 63 65 20 77 |16 ;advance w| 00000c70 61 76 65 66 6f 72 6d 20 70 68 61 73 65 0d 03 98 |aveform phase...| 00000c80 32 20 4c 44 52 42 20 20 20 20 20 30 2c 20 5b 35 |2 LDRB 0, [5| 00000c90 2c 20 32 2c 20 4c 53 52 20 23 32 34 5d 20 20 3b |, 2, LSR #24] ;| 00000ca0 67 65 74 20 77 61 76 65 20 73 61 6d 70 6c 65 0d |get wave sample.| 00000cb0 03 a2 45 20 53 55 42 53 20 20 20 20 20 30 2c 20 |..E SUBS 0, | 00000cc0 30 2c 20 31 2c 20 4c 53 4c 20 23 31 20 20 20 20 |0, 1, LSL #1 | 00000cd0 20 3b 73 63 61 6c 65 20 61 6d 70 20 62 79 20 63 | ;scale amp by c| 00000ce0 68 61 6e 6e 65 6c 20 26 20 6f 76 65 72 61 6c 6c |hannel & overall| 00000cf0 20 76 6f 6c 0d 03 ac 38 20 4d 4f 56 4d 49 20 20 | vol...8 MOVMI | 00000d00 20 20 30 2c 20 23 30 20 20 20 20 20 20 20 20 20 | 0, #0 | 00000d10 20 20 20 20 20 20 3b 63 6f 72 72 65 63 74 20 66 | ;correct f| 00000d20 6f 72 20 75 6e 64 65 72 66 6c 6f 77 0d 03 b6 32 |or underflow...2| 00000d30 20 53 54 52 42 20 20 20 20 20 30 2c 20 5b 31 32 | STRB 0, [12| 00000d40 5d 2c 20 31 31 20 20 20 20 20 20 20 20 20 3b 67 |], 11 ;g| 00000d50 65 6e 65 72 61 74 65 20 6f 75 74 70 75 74 0d 03 |enerate output..| 00000d60 c0 3b 20 41 44 44 20 20 20 20 20 20 32 2c 20 32 |.; ADD 2, 2| 00000d70 2c 20 32 2c 20 4c 53 4c 20 23 31 36 20 20 20 20 |, 2, LSL #16 | 00000d80 3b 72 65 70 65 61 74 20 69 6e 20 6c 69 6e 65 20 |;repeat in line | 00000d90 6f 6e 63 65 20 6d 6f 72 65 0d 03 ca 20 20 4c 44 |once more... LD| 00000da0 52 42 20 20 20 20 20 30 2c 20 5b 35 2c 20 32 2c |RB 0, [5, 2,| 00000db0 20 4c 53 52 20 23 32 34 5d 0d 03 d4 1d 20 53 55 | LSR #24].... SU| 00000dc0 42 53 20 20 20 20 20 30 2c 20 30 2c 20 31 2c 20 |BS 0, 0, 1, | 00000dd0 4c 53 4c 20 23 31 0d 03 de 13 20 4d 4f 56 4d 49 |LSL #1.... MOVMI| 00000de0 20 20 20 20 30 2c 20 23 30 0d 03 e8 19 20 53 54 | 0, #0.... ST| 00000df0 52 42 20 20 20 20 20 30 2c 20 5b 31 32 5d 2c 20 |RB 0, [12], | 00000e00 31 31 0d 03 f2 14 20 43 4d 50 20 20 20 20 20 20 |11.... CMP | 00000e10 31 32 2c 20 31 30 0d 03 fc 3a 20 42 4c 54 20 20 |12, 10...: BLT | 00000e20 20 20 20 20 46 69 6c 6c 4c 6f 6f 70 25 20 20 20 | FillLoop% | 00000e30 20 20 20 20 20 20 20 20 3b 6c 6f 6f 70 20 69 66 | ;loop if| 00000e40 20 6e 6f 74 20 62 75 66 66 65 72 20 66 75 6c 6c | not buffer full| 00000e50 0d 04 06 06 20 3a 0d 04 10 3b 20 53 55 42 53 20 |.... :...; SUBS | 00000e60 20 20 20 20 34 2c 20 34 2c 20 23 31 20 20 20 20 | 4, 4, #1 | 00000e70 20 20 20 20 20 20 20 20 3b 64 65 63 72 65 6d 65 | ;decreme| 00000e80 6e 74 20 63 65 6e 74 69 73 65 63 20 63 6f 75 6e |nt centisec coun| 00000e90 74 0d 04 1a 3e 20 53 54 4d 49 42 20 20 20 20 39 |t...> STMIB 9| 00000ea0 2c 20 7b 32 2d 35 7d 20 20 20 20 20 20 20 20 20 |, {2-5} | 00000eb0 20 20 20 3b 73 61 76 65 20 72 65 67 69 73 74 65 | ;save registe| 00000ec0 72 73 20 62 61 63 6b 20 74 6f 20 53 43 43 42 0d |rs back to SCCB.| 00000ed0 04 24 46 20 4d 4f 56 50 4c 20 20 20 20 30 2c 20 |.$F MOVPL 0, | 00000ee0 23 25 30 30 30 30 31 30 30 30 20 20 20 20 20 20 |#%00001000 | 00000ef0 20 3b 76 6f 69 63 65 20 61 63 74 69 76 65 20 69 | ;voice active i| 00000f00 66 20 73 74 69 6c 6c 20 64 75 72 61 74 69 6f 6e |f still duration| 00000f10 20 6c 65 66 74 0d 04 2e 33 20 4d 4f 56 4d 49 20 | left...3 MOVMI | 00000f20 20 20 20 30 2c 20 23 25 30 30 30 30 30 30 31 30 | 0, #%00000010| 00000f30 20 20 20 20 20 20 20 3b 65 6c 73 65 20 66 6f 72 | ;else for| 00000f40 63 65 20 66 6c 75 73 68 0d 04 38 17 20 4c 44 4d |ce flush..8. LDM| 00000f50 46 44 20 20 20 20 31 33 21 2c 20 7b 50 43 7d 0d |FD 13!, {PC}.| 00000f60 04 42 06 20 3a 0d 04 4c 43 2e 47 61 74 65 4f 66 |.B. :..LC.GateOf| 00000f70 66 25 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |f% | 00000f80 20 20 20 20 20 20 20 3b 63 61 6c 6c 65 64 20 74 | ;called t| 00000f90 6f 20 65 6e 64 20 73 6f 75 6e 64 69 6e 67 20 6f |o end sounding o| 00000fa0 66 20 61 20 6e 6f 74 65 0d 04 56 13 20 4d 4f 56 |f a note..V. MOV| 00000fb0 20 20 20 20 20 20 30 2c 20 23 30 0d 04 60 0f 2e | 0, #0..`..| 00000fc0 46 6c 75 73 68 4c 6f 6f 70 25 0d 04 6a 19 20 53 |FlushLoop%..j. S| 00000fd0 54 52 42 20 20 20 20 20 30 2c 20 5b 31 32 5d 2c |TRB 0, [12],| 00000fe0 20 31 31 0d 04 74 19 20 53 54 52 42 20 20 20 20 | 11..t. STRB | 00000ff0 20 30 2c 20 5b 31 32 5d 2c 20 31 31 0d 04 7e 14 | 0, [12], 11..~.| 00001000 20 43 4d 50 20 20 20 20 20 20 31 32 2c 20 31 30 | CMP 12, 10| 00001010 0d 04 88 18 20 42 4c 54 20 20 20 20 20 20 46 6c |.... BLT Fl| 00001020 75 73 68 4c 6f 6f 70 25 0d 04 92 44 20 4d 4f 56 |ushLoop%...D MOV| 00001030 20 20 20 20 20 20 30 2c 20 23 25 30 30 30 30 30 | 0, #%00000| 00001040 30 30 31 20 20 20 20 20 20 20 3b 73 65 74 20 66 |001 ;set f| 00001050 6c 61 67 20 74 6f 20 66 6c 75 73 68 20 6f 6e 65 |lag to flush one| 00001060 20 6d 6f 72 65 20 62 75 66 66 65 72 0d 04 9c 17 | more buffer....| 00001070 20 4c 44 4d 46 44 20 20 20 20 31 33 21 2c 20 7b | LDMFD 13!, {| 00001080 50 43 7d 0d 04 a6 05 5d 0d 04 b0 05 ed 0d 04 ba |PC}....]........| 00001090 05 3a 0d 04 c4 12 de 20 4f 6c 64 56 6f 69 63 65 |.:..... OldVoice| 000010a0 25 28 38 29 0d 04 ce 33 c8 99 20 22 53 6f 75 6e |%(8)...3.. "Soun| 000010b0 64 5f 49 6e 73 74 61 6c 6c 56 6f 69 63 65 22 2c |d_InstallVoice",| 000010c0 20 56 6f 69 63 65 42 61 73 65 25 2c 30 20 b8 20 | VoiceBase%,0 . | 000010d0 2c 56 6f 69 63 65 25 0d 04 d8 0e e3 20 76 25 3d |,Voice%..... v%=| 000010e0 31 20 b8 20 38 0d 04 e2 38 20 c8 99 20 22 53 6f |1 . 8...8 .. "So| 000010f0 75 6e 64 5f 41 74 74 61 63 68 56 6f 69 63 65 22 |und_AttachVoice"| 00001100 2c 20 76 25 2c 20 56 6f 69 63 65 25 20 b8 20 2c |, v%, Voice% . ,| 00001110 4f 6c 64 56 6f 69 63 65 25 28 76 25 29 0d 04 ec |OldVoice%(v%)...| 00001120 05 ed 0d 04 f6 05 3a 0d 05 00 17 ee 20 85 20 f2 |......:..... . .| 00001130 52 65 73 74 6f 72 65 53 6f 75 6e 64 3a e0 0d 05 |RestoreSound:...| 00001140 0a 05 3a 0d 05 14 1b c8 99 20 22 53 6f 75 6e 64 |..:...... "Sound| 00001150 5f 43 6f 6e 66 69 67 75 72 65 22 2c 20 38 0d 05 |_Configure", 8..| 00001160 1e 0b 2a 56 6f 69 63 65 73 0d 05 28 15 d4 20 31 |..*Voices..(.. 1| 00001170 2c 20 26 31 37 46 2c 20 35 33 2c 20 31 30 0d 05 |, &17F, 53, 10..| 00001180 32 34 f1 27 27 22 61 6e 79 20 6b 65 79 20 74 6f |24.''"any key to| 00001190 20 6d 61 6b 65 20 61 20 6e 6f 69 73 65 2c 20 3c | make a noise, <| 000011a0 45 53 43 41 50 45 3e 20 74 6f 20 66 69 6e 69 73 |ESCAPE> to finis| 000011b0 68 22 0d 05 3c 05 3a 0d 05 46 08 43 25 3d 31 0d |h"..<.:..F.C%=1.| 000011c0 05 50 05 f5 0d 05 5a 0c 20 4b 25 3d a6 28 31 29 |.P....Z. K%=.(1)| 000011d0 0d 05 64 0d 20 e7 20 4b 25 3e 30 20 8c 0d 05 6e |..d. . K%>0 ...n| 000011e0 10 20 20 f1 20 c3 4b 25 3b 22 20 22 3b 0d 05 78 |. . .K%;" ";..x| 000011f0 19 20 20 d4 20 43 25 2c 20 26 31 37 46 2c 20 4b |. . C%, &17F, K| 00001200 25 2c 20 31 30 30 0d 05 82 17 20 20 43 25 2b 3d |%, 100.... C%+=| 00001210 31 3a e7 20 43 25 3e 38 20 43 25 3d 31 0d 05 8c |1:. C%>8 C%=1...| 00001220 06 20 cd 0d 05 96 07 fd 20 30 0d 05 a0 05 3a 0d |. ...... 0....:.| 00001230 05 aa 13 dd 20 f2 52 65 73 74 6f 72 65 53 6f 75 |.... .RestoreSou| 00001240 6e 64 0d 05 b4 0a 20 ee 20 85 20 87 0d 05 be 0a |nd.... . . .....| 00001250 20 f6 3a f1 20 9e 0d 05 c8 23 20 c8 99 20 22 53 | .:. ....# .. "S| 00001260 6f 75 6e 64 5f 52 65 6d 6f 76 65 56 6f 69 63 65 |ound_RemoveVoice| 00001270 22 2c 2c 56 6f 69 63 65 25 0d 05 d2 0f 20 e3 20 |",,Voice%.... . | 00001280 76 25 3d 31 20 b8 20 38 0d 05 dc 2f 20 20 c8 99 |v%=1 . 8.../ ..| 00001290 20 22 53 6f 75 6e 64 5f 41 74 74 61 63 68 56 6f | "Sound_AttachVo| 000012a0 69 63 65 22 2c 20 76 25 2c 20 4f 6c 64 56 6f 69 |ice", v%, OldVoi| 000012b0 63 65 25 28 76 25 29 0d 05 e6 06 20 ed 0d 05 f0 |ce%(v%).... ....| 000012c0 1b c8 99 20 22 53 6f 75 6e 64 5f 43 6f 6e 66 69 |... "Sound_Confi| 000012d0 67 75 72 65 22 2c 20 31 0d 05 fa 0b 2a 56 6f 69 |gure", 1....*Voi| 000012e0 63 65 73 0d 06 04 07 f1 27 27 0d 06 0e 05 e1 0d |ces.....''......| 000012f0 ff |.| 000012f1