10
20
30
40
50
60 :
70
80
90
100
110
120
130
140
150 :
160 :
170 ver$="0.10"
180 date$="12 Nov 1992"
190 ON ERROR REPORT:PRINT ERL:END
200 :
210 DIM mcode% &8000, L% -1
220 sp=13:link=14:pc=15
230 FOR opt%=0 TO 1
240 P%=0:O%=mcode%
250 [OPT opt%*3+4
260 EQUD 0:\ Start
270 EQUD Initialise
280 EQUD Finalise
290 EQUD 0:\ Service
300 EQUD TitleStr
310 EQUD HelpStr
320 EQUD 0:\ command table
330 EQUD 0:\ SWI chunk number
340 EQUD 0:\ SWI chunk handler
350 EQUD 0:\ SWI decoding table
360 EQUD 0:\ SWI decoding code
370 :
380 .TitleStr
390 EQUS "SoundSupport":EQUB 0
400 ALIGN
410 .HelpStr
420 EQUS "SoundSupport"+CHR$9+ver$+" ("+date$+") "+CHR$169+" J.G.Harston":EQUB 0
430 ALIGN
440 :
450 .Initialise
460 stmfd (sp)!,{link}
470 mov r0,#7
480 adr r1,MyOsword
490 ldr r2,[r12]
500 swi "OS_Claim" ; Hook into OS_Word
510 :
520 mov r0,#0 ; Read number of channels
530 mov r1,#0
540 mov r2,#0
550 mov r3,#0
560 mov r4,#0
570 swi "Sound_Configure"
580 cmp r0,#8 ; If less than 8 channels
590 movlt r0,#8 ; set to 8 channels
600 swilt "Sound_Configure"
610 :
620 mov r0,#127 ; Ensure full volume
630 swi "Sound_Volume"
640 :
650 ldmfd (sp)!,{pc}
660 :
670 :
680 .Finalise
690 stmfd (sp)!,{link}
700 mov r0,#7 ; OswordVec
710 adr r1,MyOsword
720 ldr r2,[r12]
730 swi "OS_Release" ; Release OS_Word
740 ldmfd (sp)!,{pc}
750 :
760 :
770 .MyOsword
780 cmp r0,#7
790 movnes pc,link ; Not SOUND, pass on
800 :
810 ldrb r0,[r1,#1] ; Get channel high byte
820 cmp r0,#&20 ; channel>=&2000
830 movcs r0,#7
840 ldmcsfd (sp)!,{pc} ; Claim to prevent sound
850 :
860 ldrb r0,[r1,#5] ; Get pitch high byte
870 cmp r0,#&04
880 movcc r0,#0 ; If pitch<&0400 force to &00xx
890 strccb r0,[r1,#5]
900 :
910 ldrb r0,[r1,#0] ; Get channel low byte
920 and r0,r0,#&10 ; Mask Flush nybble
930 cmp r0,#&00 ; Is No-Flush selected
940 movne r0,#7 ; Restore R0
950 movnes pc,link ; Not No-Flush, pass on
960 :
970 \ Needs to wait for current sound to finish
980 :
990 mov r0,#7 ; Restore R0
1000 movs pc,link ; Pass on
1010 :
1020 ]NEXT
1030 OSCLI"SAVE SoundSupp "+STR$~mcode%+" "+STR$~O%
1040 *SetType SoundSupp Module
1050 *Stamp SoundSupp