Commit 8b6ec705 authored by Ben Avison's avatar Ben Avison
Browse files

Import of version 1.00 of SharedSound from WSS - this is a merge of

  RISC OS Ltd, ESP and Pace sources. I've added the Makefile, Mk* and
  VersionNum files.

Detail (courtesy of WSS):
  * Incorporates fixes made to 0.58c to fix the callbacks on sound
    rate changes.

  * Incorporates RISC OS Ltd changes to response to
    TaskManager_Acknowledgements service.

  * Includes 8 bit Log and PowerWave drivers.

  * Now built with Objasm, not BASIC assembler.

  * SharedSound_HandlerInfo SWI fixed to conform to spec. Also
    extended to accept r0 = 0 on entry, in which case r0 = number of
    first registered handler (or 0 for none) on exit; R1-R5 corrupted.

    Therefore the following code enumerates handlers:

    REM Get first handler number.
    SYS "SharedSound_HandlerInfo",0 TO next% ; flags%
    REM While no errors, and not finished
    WHILE (next% <> 0) AND ((flags% AND 1) = 0)
     SYS"SharedSound_HandlerInfo",next% TO next%,a%,b%,c%,d%,e%
    ENDWHILE

  * Sends Service_Sound (&54) with reason c...
parent b9b79b19
c/** gitlab-language=c linguist-language=c linguist-detectable=true
s/** gitlab-language=armasm linguist-language=armasm linguist-detectable=true
This diff is collapsed.
......@@ -23,76 +23,29 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Makefile for SharedSnd
# Makefile for SharedSound
#
# ***********************************
# *** C h a n g e L i s t ***
# ***********************************
# When Who What
# ---- --- ----
# 28-Jun-2001 BJGA Created
#
# Paths
#
EXP_HDR = <export$dir>
#
# Generic options:
#
MKDIR = cdir
AS = aasm
CP = copy
RM = remove
WIPE = -wipe
CCFLAGS = -c -depend !Depend -IC:
ASFLAGS = -depend !Depend -Stamp -quit -module -To $@ -From
CPFLAGS = ~cfr~v
WFLAGS = ~cfr~v
#
# Program specific options:
#
COMPONENT = SSound
TARGET = ${COMPONENT}
SOURCE = Source
SL = ${SOURCE}.o
SSLIB = ${SL}.Drivers ${SL}.Handler ${SL}.Linear ${SL}.Memory ${SL}.Module \
${SL}.SampleRate ${SL}.SWIS ${SL}.Vars ${SL}.Volume
BASICFILES= o.Debug o.Drivers o.Handler o.Linear o.Memory o.Module o.SampleRate o.SWIS \
o.Vars o.Volume o.SharedSoun o.GetVers
TARGET = SSound
OBJS = Gets.o
#.o.c:
# set tokenisefile $*
# utils.detoken1; BASIC
.c.o:
set tokenisefile $*
utils.token1; BASIC
#
# Generic rules:
#
rom: ${TARGET}
@echo ${COMPONENT}: rom module built
export: ${EXPORTS}
@echo ${COMPONENT}: export complete
install_rom: ${TARGET}
${CP} ${TARGET} ${INSTDIR}.${COMPONENT} ${CPFLAGS}
@echo ${COMPONENT}: rom module installed
install: ${TARGET}
${CP} ${TARGET} ${INSTDIR}.${COMPONENT} ${CPFLAGS}
@echo ${COMPONENT}: installed
include Makefiles:StdTools
include Makefiles:StdRules
include Makefiles:ROMCModule
include Makefiles:RAMCModule
clean:
${RM} ${TARGET}
${WIPE} o.* ~cv
${RM} o.Gets
${WIPE} aof ${WFLAGS}
${WIPE} rm ${WFLAGS}
${WIPE} linked ${WFLAGS}
@echo ${COMPONENT}: cleaned
resources:
@echo ${COMPONENT}: resource files copied
${TARGET}: ${BASICFILES}
Set MakeSSnd$Dir @
Run o.SharedSoun
import: Debug.c Drivers.c Handler.c Linear.c Memory.c Module.c SampleRate.c SWIS.c Vars.c Volume.c SharedSoun.c
echo made text files
# Dynamic dependencies:
......@@ -24,4 +24,5 @@
| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
Dir <Obey$Dir>
amu_machine clean
amu_machine clean %*0
stripdepnd
......@@ -24,4 +24,4 @@
| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
Dir <Obey$Dir>
amu_machine install INSTDIR=<install$dir>.HardDisc4.!Boot.Resources.!ARMovie.MovingLine
amu_machine install INSTDIR=<install$dir>.HardDisc4.!Boot.Resources.!ARMovie.MovingLine %*0
......@@ -24,5 +24,4 @@
| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
Dir <Obey$Dir>
WimpSlot -min 1024k
amu_machine import
amu_machine all THROWBACK=-throwback %*0
......@@ -24,4 +24,4 @@
| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
Dir <Obey$Dir>
amu_machine rom
amu_machine rom %*0
SharedSound module
------------------
This module was written and generally maintained by Andy Pierson of
Expressive Software Projects 'andy@exsoftpr.demon.co.uk'.
The module is built by running the main BASIC program 'SharedSoun' which
loads additional BASIC libraries, assembles the code and saves out the
resulting module. This original distribution is in the Source directory.
To make best use of the CVS revision control the module is build here in a
different way. The files are all stored as text files in the 'c' directory
and are then transferred to the 'o' directoru whilst being converted to BASIC
programs when building.
So to build the module just 'make rom'.
To import new code do the following.
1) Copy the new files in the Source directory.
2) Copy all the BASIC programs (SharedSound and SSLib.*) into the 'o'
directory
3) Change the Makefile - comment out the .c.o rule and uncomment the
.o.c rule.
4) Do 'amu import' (MkImport) which will copy all the files into the 'c'
directory.
5) Restore the makefile .o.c and .c.o rules to how they were.
6) So 'amu clean' (MkClean) to clear the 'o' directory.
7) If there are any new source files add them into the makefile.
8) Edit c.SharedSoun to change the LIBRARY definitions to point to the
files in the 'o' directory.
9) Checkin the changes to CVS.
A change list supplied by ESP is as follows
0.44 8 bit log output version, not supplied to Acorn
0.45 Fix bug in 8 bit code
0.46 CBAI alternative code added
0.47 Fix bug in removing call back handlers
0.48 Fix bug in volume fluctuation when no buffers from call back handler
Simon Middleton
06 Nov 1997
smiddleton@acorn.com
;
; This file is automatically maintained by srccommit, do not edit manually.
;
GBLS Module_MajorVersion
GBLA Module_Version
GBLS Module_MinorVersion
GBLS Module_Date
GBLS Module_FullVersion
GBLS Module_ApplicationDate2
GBLS Module_ApplicationDate4
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "1.00"
Module_Version SETA 100
Module_MinorVersion SETS ""
Module_Date SETS "03 Jun 2001"
Module_ApplicationDate2 SETS "03-Jun-01"
Module_ApplicationDate4 SETS "03-Jun-2001"
Module_ComponentName SETS "SharedSnd"
Module_ComponentPath SETS "RiscOS/Sources/Audio/SharedSnd"
Module_FullVersion SETS "1.00"
Module_HelpVersion SETS "1.00 (03 Jun 2001)"
END
/* (0.49)
/* (1.00)
*
* This file is automatically maintained by srccommit, do not edit manually.
*
*/
#define Module_MajorVersion_CMHG 0.49
#define Module_MajorVersion_CMHG 1.00
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 16 Jan 2001
#define Module_Date_CMHG 03 Jun 2001
#define Module_MajorVersion "0.49"
#define Module_Version 49
#define Module_MajorVersion "1.00"
#define Module_Version 100
#define Module_MinorVersion ""
#define Module_Date "16 Jan 2001"
#define Module_Date "03 Jun 2001"
#define Module_ApplicationDate2 "16-Jan-01"
#define Module_ApplicationDate4 "16-Jan-2001"
#define Module_ApplicationDate2 "03-Jun-01"
#define Module_ApplicationDate4 "03-Jun-2001"
#define Module_ComponentName "SharedSnd"
#define Module_ComponentPath "RiscOS/Sources/Audio/SharedSnd"
#define Module_FullVersion "0.49"
#define Module_HelpVersion "0.49 (16 Jan 2001)"
#define Module_FullVersion "1.00"
#define Module_HelpVersion "1.00 (03 Jun 2001)"
/* Copyright (c) 1995, Expressive Software Projects
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Expressive Software Projects nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL EXPRESSIVE SOFTWARE PROJECTS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
DEFPROCDebug
LOCAL er$
er$="Debug"
PRINT "PROCDebug"
[OPT I%
]
IF debug1% THEN
[OPT I%
\------------------------- Debugging
.printR10
STMFD R13!,{R0-R3,R14}
MOV R0,R10 \ convert R0 to string
ADR R1,textadr
MOV R2,#31 \ max size
SWI "OS_ConvertHex8"
ADR R0,textadr
SWI "OS_Write0"
SWI "OS_NewLine"
LDMFD R13!,{R0-R3,PC}
.printstr
STMFD R13!,{R0-R3,R14}
MOV R0,R10 \ convert R0 to string
ADR R1,textadr
MOV R2,#31 \ max size
SWI "OS_ConvertHex8"
ADR R0,textadr
SWI "OS_Write0"
LDMFD R13!,{R0-R3,PC}
.textadr EQUD 0:EQUD 0:EQUD 0:EQUD 0
]
ENDIF
[OPT I%
]
ENDPROC
/* Copyright (c) 1995, Expressive Software Projects
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Expressive Software Projects nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL EXPRESSIVE SOFTWARE PROJECTS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
The driver will typically be the 16 bit DMA handler with all parameters
set as required, or the log driver for 8 bit support.
If it is the 8 bit driver then there is some conversion required to set the
parameters correctly.
This is indicated by passing a call address in the driver block which would
otherwise be 0.
DEFPROCDrivers
LOCAL er$,debug%
er$="Drivers"
debug%=FALSE
PRINT "PROCDrivers"
[OPT I%
\ -------------------------------- Driver routines ---------------------------
.installDefaultDriver% \ The default driver will either be (in order of preference)
\ Sound_LinearHandler
\ or Sound_ChannelHandler
\ This routine looks to see what is available and installs
\ the appropriate driver.
STMDB R13!,{R14}
\ First see if Sound_LinearHandler exists
\ This relies on the fact that the old SoundDMA module will respond to all
\ SWI's outside its range with a 0
\ but the 16 bit SoundDMA will respond with a 1 if 16 bit is on
MOV R0,#0
SWI Sound_Mode% \ Check configured for 16 Bit support
]
IF debug% THEN
[OPT I%
SWI "XOS_WriteS"
EQUS "Sound mode = "+CHR$(0):ALIGN
MOV R10,R0
BL printR10
]
ENDIF
[OPT I%
CMP R0,#0 \ R0 = 1 If 16 bit support is on
MOVEQ R1,#1 \ Log
MOVNE R1,#2 \ Linear
STR R1,[R12,#work_currentDriver%]
]
IF doLog% THEN
[OPT I%
BNE installDefaultDriverNotLog%
BLEQ installLogDriver%
B installDefaultDriverExit%
.installDefaultDriverNotLog%
]
ENDIF
[OPT I%
BLNE installLinearDriver%
.installDefaultDriverExit%
LDMIA R13!,{PC}
\ -----------
.installDriver% \ Install driver
\ R0 = Pointer to driver table
\ R1 = parameter to pass driver in R12 when called
\ R2 = flags
\ R3 = Driver name
STMDB R13!,{R0-R6,R14}
BL releaseDriver% \ release the currently active driver
ADD R6,R12,#work_driverTable% \ Get pointer to driver table
STR R0,[R6,#driver_Address%] \ Table address
STR R1,[R6,#driver_Parameter%] \ Driver R12 parameter
STR R2,[R6,#driver_Flags%]
STR R3,[R6,#driver_Name%]
MVN R0,#0 \ Initialise driver volume to LR = &FFFF FFFF
STR R0,[R6,#driver_Volume%]
BL driverInitialise% \ Initialise this driver
LDR R0,[R6,#driver_Volume%]
MOV R1,R6 \ Driver table
BL driverVolume% \ Initialise driver volume
LDMIA R13!,{R0-R6,PC}
\
\ -----------
.driverInitialise% \ Initialise a new driver
\ R0 = driver table slot
\ Return with R0 = 0 if failed
STMDB R13!,{R1-R12,R14}
ADD R6,R12,#work_driverTable% \ driver Table slot
LDR R0,[R6,#driver_Address%]
LDR R2,[R0,#driverEntry_Install%] \ R2 = Call address
BL clearCallBackBuffer%
BL getFillR0%
\ ADR R0,fill% \ Main fill call address
LDR R1,[R12,#work_privateWord%] \ R1 = parameter
STMDB R13!,{R12} \ Stack R12
LDR R12,[R6,#driver_Parameter%] \ Called with R12 = parameter
STMDB R13!,{PC} \ Put return address on the stack
MOV PC,R2 \ And call driver install entry
MOV R0,R0
LDMIA R13!,{R12} \ Retrieve R12
CMP R0,#0 \ = 0 if install failed
MOVNE R0,#0
BLNE newSampleRate% \ Get rate and set up sample period & fractions
BL startSound% \ Make sure that sound is active
LDMIA R13!,{R1-R12,PC}
\ ------------
.driverCheck% \ Call initialise to make sure that the current driver is still active
STMDB R13!,{R0-R12,R14}
ADD R6,R12,#work_driverTable% \ driver Table slot
LDR R0,[R6,#driver_Address%]
CMP R0,#0 \ Is there a driver installed?
BEQ driverCheckExit%
LDR R2,[R0,#driverEntry_Install%] \ R2 = Call address
BL getFillR0%
\ ADR R0,fill% \ R0 = Handler address
LDR R1,[R12,#work_privateWord%] \ R1 = parameter
STMDB R13!,{R12} \ Stack R12
LDR R12,[R6,#driver_Parameter%] \ Called with R12 = parameter
STMDB R13!,{PC} \ Put return address on the stack
MOV PC,R2 \ And call driver install entry
MOV R0,R0
LDMIA R13!,{R12} \ Retrieve R12
MOV R0,#0
STR R0,[R12,#work_SoundPause%] \ Clear the pause flag
.driverCheckExit%
CMP PC,PC \ also clears V in 32-bit mode
LDMEQIA R13!,{R0-R12,PC} \ 32-bit SWI exit; NZC corrupted, V clear
LDMIA R13!,{R0-R12,PC}^ \ 26-bit SWI exit; NZC preserved, V clear
\-------------
.releaseDriver%
STMDB R13!,{R0-R12,R14}
BL stopSound%
ADD R0,R12,#work_driverTable% \ driver Table slot
LDR R1,[R0,#driver_Address%]
CMP R1,#0
BEQ releaseDriverExit%
LDR R1,[R1,#driverEntry_Remove%]
STMDB R13!,{R12} \ Stack R12
LDR R12,[R0,#driver_Parameter%] \ Get driver's R12
STMDB R13!,{PC} \ Stack return address
MOV PC,R1 \ Call driver, no other parameters
MOV R0,R0
LDMIA R13!,{R12} \ Retrieve R12
.releaseDriverExit%
LDMIA R13!,{R0-R12,PC}
\ ----------------
.driverSampleRate% \ Call driver sample rate entry
\ On entry:
\ R0 = 0 to read
\ > 0 for sample frequency required
\ On exit:
\ R0 = current frequency
STMDB R13!,{R14}
\ Get or set current frequency
ADD R1,R12,#work_driverTable% \ driver Table slot
LDR R2,[R1,#driver_Address%]
CMP R2,#0 \ Return 0 for failed
MOVEQ R0,#0
BEQ driverSampleRateExit%
LDR R2,[R1,#driver_Address%]
LDR R2,[R2,#driverEntry_SampleRate%]
STMDB R13!,{R12} \ Stack R12
LDR R12,[R1,#driver_Parameter%] \ Get driver's R12
STMDB R13!,{PC} \ Stack return address
MOV PC,R2 \ Call driver, no other parameters
MOV R0,R0
LDMIA R13!,{R12} \ Retrieve R12
\ R0 = current frequency
.driverSampleRateExit%
LDMIA R13!,{PC}
\ ----------
.driverVolume% \ Set the new volume for a driver
\ On entry:
\ R0 = new LR volume
\ R1 = driver table
\ On exit:
\ R0 = volume scaling required by handler to achieve this volume
\ So if driver cannot scale volume then R0 = entry value and handler
\ will have to do all the work
\ If driver can scale then typically it will return &FFFFFFFF to
\ tell handler not to scale volume at all
STMDB R13!,{R1-R12,R14}
\ Get or set current volume
ADD R1,R12,#work_driverTable% \ driver Table slot
LDR R2,[R1,#driver_Address%]
CMP R2,#0
BEQ driverVolumeExit%
LDR R2,[R2,#driverEntry_Volume%] \ There may not be an entry
CMP R2,#0
STR R0,[R1,#driver_Volume%] \ Store it
BEQ driverVolumeStore% \ Return with R0 as set
STMDB R13!,{R1,R12} \ Stack R12
LDR R12,[R1,#driver_Parameter%] \ Get driver's R12
STMDB R13!,{PC} \ Stack return address
MOV PC,R2 \ Call driver, no other parameters
MOV R0,R0
LDMIA R13!,{R1,R12} \ Retrieve R12
.driverVolumeStore%
]
IF debug% THEN
[OPT I%
SWI "XOS_WriteS"
EQUS "Store scaled driver volume: "+CHR$(0):ALIGN
MOV R10,R0
BL printR10
]
ENDIF
[OPT I%
\ R0 = actual volume
STR R0,[R1,#driver_VolumeScaled%] \ The volume to use when scaling handlers
.driverVolumeExit%
LDMIA R13!,{R1-R12,PC}
\ -----------
.driverMixer% \ Call driver's mixer entry
\ On entry:
\ R0 = Function code, 0 = read, 1 = set
\ R1 = mixer number
\ R2 = value if to set
\ R3 = driver pointer
\ On exit:
\ R1 = number of mixers
\ R2 = current value
\ R3 = mixer name
STMDB R13!,{R4-R12,R14}
CMP R3,#0
BEQ driverMixerExit%
LDR R4,[R3,#driver_Address%]
LDR R4,[R4,#driverEntry_Mixer%] \ There may not be an entry
CMP R4,#0
BEQ driverMixerExit% \ No mixer entry
STMDB R13!,{R12} \ Stack R12
LDR R12,[R1,#driver_Parameter%] \ Get driver's R12
STMDB R13!,{PC} \ Stack return address
MOV PC,R4 \ Call driver, no other parameters
MOV R0,R0
LDMIA R13!,{R12} \ Retrieve R12
.driverMixerExit%
LDMIA R13!,{R4-R12,PC}
]
ENDPROC
/* Copyright (c) 1995, Expressive Software Projects
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Expressive Software Projects nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL EXPRESSIVE SOFTWARE PROJECTS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
REM >GetVers
REM © Pace Micro Technology plc
REM Extracts the module help string from a srccommit-style VersionNum file
REM CSD should be the root of the current component
ERROR 0,"This is a BASIC library, you should not run it directly"
DEF FNget_srccommit_version
LOCAL f%,line$
f%=OPENIN("VersionNum")
IF f%=0 THEN ERROR 0,"Could not open VersionNum file"
REPEAT
line$=GET$#f%
UNTIL MID$(line$,9,18)="Module_HelpVersion" OR EOF#f%
CLOSE#f%
IF MID$(line$,9,18)<>"Module_HelpVersion" THEN ERROR 0,"Could not find Module_HelpVersion entry in VersionNum file"
=LEFT$(RIGHT$(line$,19))
/* Copyright (c) 1995, Expressive Software Projects
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Expressive Software Projects nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL EXPRESSIVE SOFTWARE PROJECTS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
The process involves receiving a 'fill this buffer' instruction
from a driver.
The fill code then fills and mixes any available data from
any immediate handlers whith each handler doing it's own mixing.
Then any call back streams are called to give any available data
with the fill code mixing it.
Finally, call back streams are called to make sure that the call
back buffer is full.
At the end of each call back call process handlers can be called.
The same handler code for each stage can be used with flags to
indicate which type of handler is being processed ans with the
data pointers set appropriately.
DEFPROCHandler
LOCAL er$,debug%
er$="Handler"
debug%=FALSE
PRINT "PROCHandler"
CBAIDisableInt%=TRUE
[OPT I%
\-------------------------- Sound Handler Code ------------------------
.stopSound% \ Make sure nothing is happening
STMDB R13!,{R0,R14}
MOV R0,#1
STR R0,[R12,#work_SoundPause%] \ Pause flag for handler routine
\ Now wait until no sound is happening
.stopSoundLoop%
LDR R0,[R12,#work_SoundActive%] \ This will be set to 0 at then end of a fill
CMP R0,#0
BNE stopSoundLoop%
LDMIA R13!,{R0,PC}
\ -----------
.startSound% \ Set handler going again
STMDB R13!,{R0,R14}
MOV R0,#0
STR R0,[R12,#work_SoundPause%] \ Clear the pause flag
\ Should check that there is a current driver and that it is active...
LDMIA R13!,{R0,PC}
\ -------------------------------
.getFillR0%
ADR R0,fill%
MOV PC,R14
\ ----
.fill% \ Main fill call for output driver
\ Can be called by a 16 or 8 bit driver
\ It needs to collect and mix data into the final buffer
\ converting the data if necessary.
\ On entry:
\ R0 = parameter, this should be the SharedSound R12 value
\ R1 = base of buffer
\ R2 = end of buffer
\ R3 = flags
\ R4 = sample frequency or period
\ Added:
\ R5 = sample period
STMDB R13!,{R0-R12,R14}
LDR R12,[R0]
LDR R0,[R12,#work_SoundPause%] \ Are we in pause state
CMP R0,#1
BEQ fillExit%
MOV R0,#1
STR R0,[R12,#work_SoundActive%] \ Flag active
\ If there is data in the buffer then this is shown in R3
MOV R5,R4
LDR R4,[R12,#work_SampleFrequency%] \ Put current rate into R4
CMP R4,R5
BLNE rateChange% \ Set a call back to change values
LDR R5,[R12,#work_SamplePeriod%] \ Use old values for now
\ First call any immediate handlers
LDR R6,[R12,#work_ImmediateHandlers%]
CMP R6,#0
MOVNE R6,#handlerType_Immediate%
BLNE handler%
\ Now get any callBack buffers and mix in
LDR R6,[R12,#work_CallBackHandlers%]
CMP R6,#0
BEQ fillExit%
BL addCallBackBuffer%
\ Finally initiate any callbacks required
BL callBackHandlerProcess%
.fillExit%
MOV R0,#0
STR R0,[R12,#work_SoundActive%] \ Flag finished
LDMIA R13!,{R0-R12,PC}
\ ------------------
.rateChange% \ Issue a call back to change the rate values
STMDB R13!,{R0,R1,R14}
]
IF doCallBack% THEN
[OPT I%
ADR R0,rateChangeCallBack%
LDR R1,[R12,#work_privateWord%]
SWI "OS_AddCallBack"
LDMIA R13!,{R0,R1,PC}
]
ELSE
[OPT I%
MOV R0,R5 \ New frequency
BL newRate%
LDMIA R13!,{R0,R1,PC}
]
ENDIF
[OPT I%
\ ---------
]
IF doCallBack% THEN
[OPT I%
.rateChangeCallBack%
STMDB R13!,{R0-R12,R14}
LDR R12,[R12] \ Get workspace pointer
\ First get current sample frequency and sample period
\ This is provided by the SampleRate routine
MOV R0,#0 \ Function code read
BL newSampleRate%
LDMIA R13!,{R0-R12,PC}
]
ENDIF
[OPT I%
\ ---------------- Handler stuff ---------------
.handler% \ Dummy fill code
\ Used to pass on control to chain of handlers
\ The flags indicate which handlers to call
\ There are three types - immediate, callback and process
\ On entry:
\ R0 = parameter, this should be the SharedSound R12 value
\ R1 = base of buffer
\ R2 = end of buffer
\ R3 = flags
\ R4 = sample frequency
\ R5 = sample period
\ R6 = Handler type
\ Added by SharedSound before calling handlers
\ R6 = fraction step
\ R7 = LR Volume
STMDB R13!,{R0-R2,R4-R12,R14}
\ Now call each handler in turn, if they match the flag type
MOV R11,R6 \ Handler type
ADD R8,R12,#work_handlerTable% \ Address of table
MOV R9,#handlerMax% \ Handler count
.handlerLoop%
LDR R10,[R8,#handler_Type%]
CMP R10,R11
BNE handlerNext%
LDR R10,[R8,#handler_Address%] \ Does this slot contain a handler?
CMP R10,#0
BEQ handlerNext%
STMDB R13!,{R1,R2,R4,R5,R8,R9,R11,R12} \ Will need these preserved
LDR R0,[R8,#handler_Parameter%]
LDR R6,[R8,#handler_Fraction%]
LDR R7,[R8,#handler_VolumeScaled%]
MOV R14,PC
MOV PC,R10 \ Jump to address
\ MOVNV R0,R0
.handlerReturn%
LDMIA R13!,{R1,R2,R4,R5,R8,R9,R11,R12} \ Will need these preserved
.handlerNext%
ADD R8,R8,#handlerTableLen%
SUBS R9,R9,#1
BNE handlerLoop%
.handlerExit%
LDMIA R13!,{R0-R2,R4-R12,PC}
\ ------------------- Call Back Handler routines
.work_CallBack_BufferVal% EQUD work_CallBack_Buffer%
\ ----
.addCallBackBuffer% \ Get pointer to call back buffer if it exists
\ On entry:
\ R1 = base of buffer
\ R2 = end of buffer
\ R3 = flags
\ R4 = sample frequency
\ R5 = sample period
\ On exit:
\ call back data mixed in if there is some
STMDB R13!,{R0-R12,R14}
SUB R6,R2,R1
LDR R7,[R12,#work_CallBack_BufferSize%]
CMP R6,R7
\ If the buffer size has changed then need to make changes...
STR R6,[R12,#work_CallBack_BufferSize%]
LDR R5,[R12,#work_CallBack_BufferFullCount%] \ Are there any full buffers?
CMP R5,#0
BGT addCallBackBuffer_OK%
\ Need to flag an overrun
LDR R5,[R12,#work_callBack_Active%] \ Is the old call back active?
CMP R5,#1
\ If there are no full buffers and the call back is active then we have overrun
LDREQ R7,[R12,#work_callBack_Count%] \ If so then increment count and return
ADDEQ R7,R7,#1
STREQ R7,[R12,#work_callBack_Count%]
\ Need to do a volume shift on the buffer to effectivly mix an empty buffer
\ into the existing data
\ This avoids volume fluctuations
\ R1 = Start of SoundDMA buffer
\ R2 = End of SoundDMA buffer
\ R6 = Length
.addCallBackBuffer_VolumeShiftLoop%
LDMIA R1,{R3-R6}
\ Shift volumes
]
work1%=11:work2%=12
FOR getReg%=3 TO 6
[OPT I%
MOV work1%,getReg%,LSL #16 \ Put right into work1
EOR getReg%,getReg%,work1%,LSR #16 \ and left in getReg
MOV work1%,work1%,ASR #1 \ DIV 2
MOV getReg%,getReg%,ASR #1 \ DIV 2
TST getReg%,#1<<15 \ Remove any low bit
EORNE getReg%,getReg%,#1<<15
ADD getReg%,getReg%,work1%,LSR #16
]
NEXT
[OPT I%
STMIA R1!,{R3-R6}
CMP R1,R2
BLT addCallBackBuffer_VolumeShiftLoop%
B addCallBackBuffer_Exit% \ No data available
.addCallBackBuffer_OK% \ There are buffers available so use one of these
\ R1 = Start of SoundDMA buffer
\ R2 = End of SoundDMA buffer
\ R6 = Length
LDR R5,work_CallBack_BufferVal%
ADD R5,R5,R12
LDR R7,[R12,#work_CallBack_CurrentSoundBuffer%]
MLA R0,R6,R7,R5 \ Buffer position
\ R0 = Source buffer
\ R1 = DMA buffer
\ R2 = DMA buffer end
\ R3 = Fill flags
\ Copy across (mixing??)
TST R3,#1
BNE addCallBackBuffer_Mix%
\ No mixing
.addCallBackBuffer_Loop%
LDMIA R0!,{R3-R6}
STMIA R1!,{R3-R6}
CMP R1,R2
BLT addCallBackBuffer_Loop%
B addCallBackBuffer_Final%
.addCallBackBuffer_Mix%
STMDB R13!,{R12}
.addCallBackBufferMix_Loop%
LDMIA R0!,{R3-R6}
LDMIA R1,{R7-R10}
]
work1%=11:work2%=12
FOR getReg%=3 TO 6
mixReg%=getReg%+4
[OPT I%
MOV work1%,getReg%,LSL #16 \ Put right into work1
EOR getReg%,getReg%,work1%,LSR #16 \ and left in getReg
MOV work1%,work1%,ASR #1 \ DIV 2
MOV getReg%,getReg%,ASR #1 \ DIV 2
TST getReg%,#1<<15 \ Remove any low bit
EORNE getReg%,getReg%,#1<<15
MOV work2%,mixReg%,LSL #16 \ Put right into work2
EOR mixReg%,mixReg%,work2%,LSR #16 \ and left in mixReg
MOV work2%,work2%,ASR #1 \ DIV 2
MOV mixReg%,mixReg%,ASR #1 \ DIV 2
TST mixReg%,#1<<15 \ Remove any low bit
EORNE mixReg%,mixReg%,#1<<15
\ Now mix
ADD getReg%,getReg%,mixReg%
ADD work1%,work1%,work2%
ADD getReg%,getReg%,work1%,LSR #16
]
NEXT
[OPT I%
STMIA R1!,{R3-R6}
CMP R1,R2
BLT addCallBackBufferMix_Loop%
LDMIA R13!,{R12}
.addCallBackBuffer_Final%
\ Increment current SoundDMA buffer
LDR R7,[R12,#work_CallBack_CurrentSoundBuffer%]
LDR R8,[R12,#work_CallBack_numCallBackBuffers%]
ADD R7,R7,#1
CMP R7,R8
MOVGE R7,#0
STR R7,[R12,#work_CallBack_CurrentSoundBuffer%]
\ Decrement full count
LDR R8,[R12,#work_CallBack_BufferFullCount%]
SUBS R8,R8,#1
MOVLT R8,#0
STR R8,[R12,#work_CallBack_BufferFullCount%]
.addCallBackBuffer_Exit%
LDMIA R13!,{R0-R12,PC}
\ -------------------------------
.callBackHandlerProcess%
\ On entry:
\ R1 = base of buffer
\ R2 = end of buffer
\ R3 = flags
\ R4 = sample frequency
\ R5 = sample period
STMDB R13!,{R0-R12,R14}
SUB R6,R2,R1
STR R6,[R12,#work_CallBack_BufferSize%]
STR R3,[R12,#work_CallBack_Flags%]
STR R4,[R12,#work_CallBack_SampleFrequency%]
STR R5,[R12,#work_CallBack_SamplePeriod%]
LDR R5,[R12,#work_callBack_Active%] \ Set the call back active flag
CMP R5,#1
BEQ callBackHandlerProcess_Exit%
MOV R5,#1
STR R5,[R12,#work_callBack_Active%] \ Set the call back active flag
\ Set up new call back
]
IF doCBAI% THEN
[OPT I%
\ Either by CBAI
LDR R0,[R12,#work_CBAIActive%]
CMP R0,#1
ADREQ R0,CBAIRoutine%
STREQ R0,[R12,#work_PollWord%]
BEQ callBackHandlerProcess_Exit%
\ Or by old style Call backs
]
ENDIF
[OPT I%
ADR R0,doHandlerCallBack%
LDR R1,[R12,#work_privateWord%]
TEQ PC,PC
MRSEQ R9,CPSR \ if in 32-bit mode, R9 = CPSR
MOVNE R9,PC \ if in 26-bit mode, R9 = PC+PSR
ORR R8,R9,#SVC_Mode% \ preserves 32-bitness
MSREQ CPSR_c,R8
TEQNEP R8,#0
MOV R0,R0
STMFD R13!,{R14}
SWI "XOS_AddCallBack"
LDMFD R13!,{R14}
TEQ PC,PC
MSREQ CPSR_c,R9
TEQNEP R9,#0
MOV R0,R0
.callBackHandlerProcess_Exit%
LDMIA R13!,{R0-R12,PC}
\ -------
\ ---------------
.doHandlerCallBack% \ Called by call back system
\ Needs to call the handler with the right parameters
STMDB R13!,{R0-R12,R14}
LDR R12,[R12]
]
IF debug% THEN
[OPT I%
\ If you uncomment this, uncomment the switch to SVC mode in CBAIRoutine% too
\ SWI "XOS_WriteS"
\ EQUS "Handler call back"+CHR$(0):ALIGN
\ SWI "XOS_NewLine"
]
ENDIF
[OPT I%
\ From the start and end get the length and offset into the buffer
\ by the current OutBuffer value
LDR R10,[R12,#work_CallBack_BufferSize%]
LDR R0,[R12,#work_privateWord%]
LDR R3,[R12,#work_CallBack_Flags%]
LDR R4,[R12,#work_CallBack_SampleFrequency%]
LDR R5,[R12,#work_CallBack_SamplePeriod%]
.doHandlerCallBack_Loop%
\ R10 = Buffer length
LDR R2,work_CallBack_BufferVal%
ADD R2,R2,R12
LDR R7,[R12,#work_CallBack_CurrentOutBuffer%]
MLA R1,R10,R7,R2 \ Buffer address
ADD R2,R1,R10
MOV R3,#0 \ Buffer invalid
LDR R8,[R12,#work_CallBackHandlers%]
CMP R8,#0
MOVNE R6,#handlerType_CallBack%
BLNE handler%
LDR R8,[R12,#work_ProcessHandlers%]
CMP R8,#0
MOVNE R6,#handlerType_Process%
BLNE handler%
]:IF NOT CBAIDisableInt% THEN
[OPT I%
; disable interrupts
TEQ PC,PC
MRSEQ R8,CPSR
MOVNE R8,PC
ORREQ R9,R8,#I32flag%
ORRNE R9,R8,#Iflag%
MSREQ CPSR_c,R9
TEQNEP R9,#0
]
ENDIF
[OPT I%
\ increment full count
\ Increment out buffer
LDR R7,[R12,#work_CallBack_CurrentOutBuffer%]
LDR R9,[R12,#work_CallBack_numCallBackBuffers%]
ADD R7,R7,#1
CMP R7,R9
MOVGE R7,#0
STR R7,[R12,#work_CallBack_CurrentOutBuffer%]
LDR R7,[R12,#work_CallBack_BufferFullCount%]
ADD R7,R7,#1
CMP R7,R9
MOVGT R7,R9
STR R7,[R12,#work_CallBack_BufferFullCount%]
]:IF NOT CBAIDisableInt% THEN
[OPT I%
; restore interrupt state
TEQ PC,PC
MSREQ CPSR_c,R8
TEQNEP R8,#0
]
ENDIF
[OPT I%
\ Check for full count = max
\ Loop round if not
CMP R7,R9
BLT doHandlerCallBack_Loop%
\ Otherwise we have filled all the buffers and can return
]:IF NOT CBAIDisableInt% THEN
[OPT I%
; disable interrupts
TEQ PC,PC
MRSEQ R8,CPSR
MOVNE R8,PC
ORREQ R9,R8,#I32flag%
ORRNE R9,R8,#Iflag%
MSREQ CPSR_c,R9
TEQNEP R9,#0
]
ENDIF
[OPT I%
MOV R5,#0
STR R5,[R12,#work_callBack_Active%] \ Call back completed
]:IF NOT CBAIDisableInt% THEN
[OPT I%
; restore interrupt state
TEQ PC,PC
MSREQ CPSR_c,R8
TEQNEP R8,#0
]
ENDIF
[OPT I%
LDMIA R13!,{R0-R12,PC}
\ ---------------
.clearCallBackBuffer% \ Initialise the call back buffer to 0
STMDB R13!,{R0-R12,R14}
MOV R0,#0
MOV R1,#0
MOV R2,#0
MOV R3,#0
LDR R4,work_CallBack_BufferVal%
ADD R4,R4,R12
ADD R5,R4,#callBackBufferLen%
.clearCallBackBuffer_Loop%
STMIA R4!,{R0-R3}
CMP R4,R5
BLT clearCallBackBuffer_Loop%
LDMIA R13!,{R0-R12,PC}
\ ---------------
.setHandlerType% \ Set the corresponding bit for this handler's number & type
\ On entry:
\ R0 = Handler number
\ R4 = Type
STMDB R13!,{R0-R4,R14}
MOV R1,#1
MOV R0,R1,LSL R0 \ As a bit
CMP R4,#handlerType_Immediate%
LDREQ R1,[R12,#work_ImmediateHandlers%]
ORREQ R1,R1,R0
STREQ R1,[R12,#work_ImmediateHandlers%]
CMP R4,#handlerType_CallBack%
LDREQ R1,[R12,#work_CallBackHandlers%]
ORREQ R1,R1,R0
STREQ R1,[R12,#work_CallBackHandlers%]
CMP R4,#handlerType_Process%
LDREQ R1,[R12,#work_ProcessHandlers%]
ORREQ R1,R1,R0
STREQ R1,[R12,#work_ProcessHandlers%]
LDMIA R13!,{R0-R4,PC}
\ ---------
.clearHandlerType% \ Clear the corresponding bit for this handler's number & type
\ On entry:
\ R0 = Handler number
\ R4 = Type
STMDB R13!,{R0-R4,R14}
MOV R1,#1
MOV R0,R1,LSL R0 \ As a bit
CMP R4,#handlerType_Immediate%
LDREQ R1,[R12,#work_ImmediateHandlers%]
BICEQ R1,R1,R0
STREQ R1,[R12,#work_ImmediateHandlers%]
CMP R4,#handlerType_CallBack%
LDREQ R1,[R12,#work_CallBackHandlers%]
BICEQ R1,R1,R0
STREQ R1,[R12,#work_CallBackHandlers%]
CMP R4,#handlerType_Process%
LDREQ R1,[R12,#work_ProcessHandlers%]
BICEQ R1,R1,R0
STREQ R1,[R12,#work_ProcessHandlers%]
LDMIA R13!,{R0-R4,PC}
\ -------------------- CBAI -----------------
]
IF doCBAI% THEN
[OPT I%
.InstallCBAI% \ Install the CBAI stuff if module exists
STMDB R13!,{R0-R12,R14}
MOV R0,#0
STR R0,[R12,#work_PollWord%]
MOV R0,#0
ADR R1,CBAIString%
SWI "XOS_SWINumberFromString"
MOVVC R0,#1
MOVVS R0,#0
STR R0,[R12,#work_CBAIActive%]
ADDVC R0,R12,#work_PollWord%
MOVVC R1,#&100000 \ Scheduling class
LDRVC R2,[R12,#work_privateWord%]
SWIVC "XCBAI_RegisterPollWord"
LDMIA R13!,{R0-R12,PC}
\ -----------------
.CBAIString% EQUS "CBAI_RegisterPollWord"
EQUB 0
ALIGN
\ -----------------
.RemoveCBAI% \ De-register the CBAI pollword
STMDB R13!,{R0-R12,R14}
LDR R0,[R12,#work_CBAIActive%]
CMP R0,#1
ADDEQ R0,R12,#work_PollWord%
SWIEQ "XCBAI_DeregisterPollWord"
MOV R0,#0
STR R0,[R12,#work_CBAIActive%]
LDMIA R13!,{R0-R12,PC}
\ -----------------
.CBAIRoutine% \ Call back routine to call call back addresses
STMDB R13!,{R0-R12}
\ TEQ PC,PC
\ MRSEQ R9,CPSR
\ MOVNE R9,PC
\ ORR R8,R9,#SVC_mode%
\ MSREQ CPSR_c,R8
\ TEQNEP R8,#0
\ MOV R0,R0
\ STMFD R13!,{R14}
]:IF CBAIDisableInt% THEN
[OPT I%
; disable interrupts
TEQ PC,PC
MRSEQ R8,CPSR
MOVNE R8,PC
ORREQ R9,R8,#I32flag%
ORRNE R9,R8,#Iflag%
MSREQ CPSR_c,R9
TEQNEP R9,#0
]
ENDIF
[OPT I%
BL doHandlerCallBack%
]:IF CBAIDisableInt% THEN
[OPT I%
; restore interrupt state
TEQ PC,PC
MSREQ CPSR_c,R8
TEQNEP R8,#0
]
ENDIF
[OPT I%
\ LDMFD R13!,{R14}
\ TEQ PC,PC
\ MSREQ CPSR_c,R9
\ TEQNEP R9,#0
\ MOV R0,R0
LDMIA R13!,{R0-R12,PC}
\ -----------------
]
ENDIF
[OPT I%
]
ENDPROC
/* Copyright (c) 1995, Expressive Software Projects
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Expressive Software Projects nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL EXPRESSIVE SOFTWARE PROJECTS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
DEFPROCLinear
LOCAL er$
er$="Linear"
PRINT "PROCLinear"
[OPT I%
\ ------------------------- Linear driver --------------------------
\ ---------
.installLinearDriver% \ Set up the registers and table for
\ Sound_LinearHandler and call installDriver
STMDB R13!,{R14}
ADD R0,R12,#work_DriverEntryTable% \ Get table address
ADR R1,linearDriverInstall% \ Install entry
STR R1,[R0,#driverEntry_Install%]
ADR R1,linearDriverRemove% \ Remove entry
STR R1,[R0,#driverEntry_Remove%]
ADR R1,linearDriverSampleRate% \ Sample rate entry
STR R1,[R0,#driverEntry_SampleRate%]
MOV R1,#0 \ No volume entry
STR R1,[R0,#driverEntry_Volume%]
MOV R1,#0
STR R1,[R0,#driverEntry_Mixer%] \ No mixer entry
LDR R1,[R12,#work_privateWord%] \ Parameter
MOV R2,#0 \ Flags
ADR R3,linearDriverName% \ Driver name
]
IF debug% THEN
[OPT I%
SWI "XOS_WriteS"
EQUS "Install linear driver....."+CHR$(0):ALIGN
SWI "XOS_NewLine"
SWI "XOS_WriteS"
EQUS " Table = "+CHR$(0):ALIGN
MOV R10,R0
BL printR10
SWI "XOS_WriteS"
EQUS " Parameter = "+CHR$(0):ALIGN
MOV R10,R1
BL printR10
SWI "XOS_WriteS"
EQUS " Flags = "+CHR$(0):ALIGN
MOV R10,R2
BL printR10
SWI "XOS_WriteS"
EQUS " Name = "+CHR$(0):ALIGN
MOV R10,R3
BL printR10
]
ENDIF
[OPT I%
BL installDriver%
LDMIA R13!,{PC}
\ ------
.linearDriverInstall% \ Install driver using Sound_LinearHandler
\ R0 = Handler address
\ R1 = Parameter to pass
\ R12 = parameter for driver
\ R14 already on stack
STMDB R13!,{R1-R12}
MOV R5,R0 \ Temorary store R0 and R1
MOV R6,R1
MOV R0,#0 \ Get current handler to see if already installed
SWI XSound_LinearHandler%
CMP R1,R5 \ Same handler?
CMPEQ R2,R6 \ Same parameter?
BEQ linearDriverInstallExit% \ Jump out 'cos already there
\ Now install new driver
MOV R0,#1 \ Function code install
MOV R1,R5 \ Address
MOV R2,R6 \ Parameter
SWI XSound_LinearHandler%
MOV R0,R5 \ Restore R0 if successful
MOVVS R0,#0 \ Or 0 if error
.linearDriverInstallExit%
LDMIA R13!,{R1-R12,PC}
\ -----------
.linearDriverRemove% \ Remove driver using Sound_LinearHandler
\ R14 already on stack
STMDB R13!,{R0-R2}
\ To remove handler set new handler to 0
MOV R0,#1 \ Function code install
MOV R1,#0 \ Null handler
MOV R2,#0
SWI XSound_LinearHandler%
LDMIA R13!,{R0-R2,PC}
\ -----------
.linearDriverSampleRate% \ Choose rate and/or return current rate
\ R0 = 0 to read
\ > 0 to set to R0 = frequency
\ On exit:
\ R0 = current frequency
STMDB R13!,{R1-R12}
CMP R0,#0
BEQ linearDriverSampleRateRead%
\ Set the rate to R0
\ Find the nearest
MOV R4,R0 \ R4 = rate required
MOV R0,#0 \ Read number of rates available
SWI Sound_SampleRate% \ R1 = number of rates available
MOV R5,R1 \ R5 = Upper limit
.linearDriverSampleRateLoop%
MOV R0,#2 \ Convert from index to rate
SWI Sound_SampleRate% \ R2 = rate
CMP R2,R4
BLT linearDriverSampleRateClosest% \ Best rate is between R1 and R5
CMP R1,#1 \ Are there any more rates
MOVNE R5,R1 \ Change upper limit
MOVNE R6,R2 \ Store upper rate
SUBNE R1,R1,#1 \ decrement index
BNE linearDriverSampleRateLoop% \ Try again
.linearDriverSampleRateClosest% \ Check for nearest between R1 and R5
CMP R1,R5 \ No range to check
BEQ linearDriverSampleRateSet%
\ R2 = lower rate, R1 = index
\ R6 = upper rate, R5 = index
SUB R2,R4,R2
SUB R6,R6,R4
CMP R2,R6 \ Who is nearest
MOVGT R1,R5 \ If nearest to R6 then set index to R5
.linearDriverSampleRateSet%
\ Chosen index is R1
MOV R0,#3 \ Select rate from index in R1
SWI Sound_SampleRate%
.linearDriverSampleRateRead%
MOV R0,#1
SWI Sound_SampleRate% \ Frequency returned in R2
MOV R0,R2 \ Return it in R0
LDMIA R13!,{R1-R12,PC}
\ -----------
.linearDriverName% EQUS "Sound Linear Handler"
EQUB 0
ALIGN
]
ENDPROC
/* Copyright (c) 1995, Expressive Software Projects
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Expressive Software Projects nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL EXPRESSIVE SOFTWARE PROJECTS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
DEFPROCMemory
LOCAL er$
er$="Memory"
PRINT "PROCMemory"
[OPT I%
.memoryStartVal% EQUD memoryStart%
\----
.startMem%
STMDB R13!,{R14}
LDR R3,memoryStartVal%
MOV R0,#6
SWI "XOS_Module"
STR R2,[R12]
MOVVS R3,#0 \ Flag an error - and dont's start module
BVS startMemX%
MOV R10,R12 \ Use R10 as tempory private word pointer, for sound installation
MOV R12,R2
STR R3,[R12,#work_memSize%]
STR R10,[R12,#work_privateWord%]
.startMemX%
LDMIA R13!,{PC}
\ -------------------------------- Workspace routines ------------------------
.initWorkspace%
STMDB R13!,{R14}
MOV R0,#0
STR R0,[R12,#work_currentDriver%] \ No driver installed yet
STR R0,[R12,#work_SampleFrequency%]
STR R0,[R12,#work_SamplePeriod%]
STR R0,[R12,#work_SoundActive%] \ No sound currently active
STR R0,[R12,#work_ControlWord%] \ Control word for Replay
STR R0,[R12,#work_ImmediateHandlers%]
STR R0,[R12,#work_CallBackHandlers%]
STR R0,[R12,#work_ProcessHandlers%]
\ .. Initialise handler table by setting handler_Address% entries to 0
ADD R0,R12,#work_handlerTable% \ Position of table
MOV R1,#handlerMax% \ Number in table
MOV R2,#0
.initWorkHandlerTableLoop%
STR R2,[R0,#handler_Address%] \ Store 0 in handler_Address%
ADD R0,R0,#handlerTableLen% \ Increment to next table entry
SUBS R1,R1,#1 \ Decrement count
BNE initWorkHandlerTableLoop% \ Branch to start of loop
\ .. Initialise driver table by setting driver_Address% entries to 0
ADD R0,R12,#work_driverTable% \ Position of table
MOV R1,#driverMax% \ Number in table
MOV R2,#0
.initWorkDriverTableLoop%
STR R2,[R0,#driver_Address%] \ Store 0 in handler_Address%
ADD R0,R0,#driverTableLen% \ Increment to next table entry
SUBS R1,R1,#1 \ Decrement count
BNE initWorkDriverTableLoop% \ Branch to start of loop
MOV R0,#0
STR R0,[R12,#work_callBack_Active%]
STR R0,[R12,#work_callBack_Count%]
STR R0,[R12,#work_CallBack_BufferFullCount%]
STR R0,[R12,#work_CallBack_CurrentSoundBuffer%]
STR R0,[R12,#work_CallBack_CurrentOutBuffer%]
MOV R0,#defaultNumCallBackBuffers%
STR R0,[R12,#work_CallBack_numCallBackBuffers%]
LDMIA R13!,{PC}
]
ENDPROC
/* Copyright (c) 1995, Expressive Software Projects
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Expressive Software Projects nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL EXPRESSIVE SOFTWARE PROJECTS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
DEFPROCModule
LOCAL er$
er$="Module"
PRINT "PROCModule"
[OPT I%
.module% \ Module header
EQUD 0 \ Not an application
EQUD initCode%-module%
EQUD finalCode%-module%
EQUD 0 \ No service calls
EQUD title%-module%
EQUD help%-module%
EQUD commandTable%-module%
.swiBaseNum%
EQUD swiBase% \ SWI Base number
EQUD swiHandler%-module%
EQUD swiTable%-module% \ SWI Decode table
EQUD 0 \ SWI Decode code
EQUD 0 \ No messages file
EQUD flagsword%-module%
.copyr% EQUS copyRight$
.title% EQUS title$+CHR$(0):ALIGN
.help% EQUS "Shared Sound"+CHR$(9)+FNget_srccommit_version+CHR$(0):ALIGN
.flagsword% EQUD 1 \ 32-bit compatible
\
.initCode%
STMDB R13!,{R0-R12,R14}
BL startMem% \ Get memory
BVS initMemError%
\ R10 = private word
\ R12 = memory pointer [R10]
BL initWorkspace% \ Initialise workspace
]
IF doCBAI% THEN
[OPT I%
BL InstallCBAI%
]
ENDIF
[OPT I%
BL installDefaultDriver% \ Preferably Sound_LinearHandler or ChannelHandler
CMP R0,#0 \ Clear V
LDMIA R13!,{R0-R12,PC}
\
.initMemError%
LDMIA R13!,{R0-R12,R14}
ADR R0,initMemErrMesg%
CMP R0,#&80000000
CMNVC R0,#&80000000 \ Set V
MOV PC,R14
\
.initMemErrMesg%
EQUD &1E6
EQUS "Not enough memory for "+title$
EQUB 0
ALIGN
\
\ -------------------------------------------------
.finalCode%
STMDB R13!,{R0-R12,R14}
LDR R12,[R12] \ Get work area
]
IF doCBAI% THEN
[OPT I%
BL RemoveCBAI%
]
ENDIF
[OPT I%
BL releaseDriver%
CMP R0,#0 \ Clear V
LDMIA R13!,{R0-R12,PC}
\
\ -------------------------------------------------
.serviceCode% \ Not used
MOV PC,R14
\ ----------------- * Comands
.commandTable%
EQUD 0 \ No more commands
\ ----------------- SWI'S
.swiTable%
EQUS swiName$
EQUB 0
EQUS "InstallHandler"
EQUB 0
EQUS "RemoveHandler"
EQUB 0
EQUS "HandlerInfo"
EQUB 0
EQUS "HandlerVolume"
EQUB 0
EQUS "HandlerSampleType"
EQUB 0
EQUS "HandlerPause"
EQUB 0
EQUS "SampleRate"
EQUB 0
EQUS "InstallDriver"
EQUB 0
EQUS "RemoveDriver"
EQUB 0
EQUS "DriverInfo"
EQUB 0
EQUS "DriverVolume"
EQUB 0
EQUS "DriverMixer"
EQUB 0
EQUS "CheckDriver"
EQUB 0
EQUS "ControlWord"
EQUB 0
EQUS "HandlerType"
EQUB 0
]
IF debug1% THEN
[OPT I%
EQUS "Test"
EQUB 0
EQUS "Info"
EQUB 0
]
ENDIF
[OPT I%
EQUB 0
ALIGN
\
.swiHandler%
MOV R10,R12
LDR R12,[R12] \ R12 = pointer to RMA data block
CMP R11,#(EndOfJumpTable% - jumpTable%)/4
ADDCC PC,PC,R11,LSL #2
B UnknownSWIerror%
.jumpTable%
B swiInstallHandler% ; OK
B swiRemoveHandler% ; OK
B swiHandlerInfo% ; OK
B swiHandlerVolume% ; OK
B swiHandlerSampleType% ; not in this version
B swiHandlerPause% ; not in this version
B swiSampleRate% ; OK
B swiInstallDriver% ; OK
B swiRemoveDriver% ; OK
B swiDriverInfo% ; OK
B swiDriverVolume% ; OK
B swiDriverMixer% ; OK
B driverCheck% ;
B swiControlWord% ;
B swiHandlerType% ;
]
IF debug1% THEN
[OPT I%
B swiTest% ; For debugging only
B swiInfo% ; For debugging only
]
ENDIF
[OPT I%
.EndOfJumpTable%
.UnknownSWIerror%
ADR R0,errMesg%
CMP R0,#&80000000
CMNVC R0,#&80000000 \ Set V
MOV PC,R14
.errMesg%
EQUD &1E6
EQUS "Unknown module operation"
EQUB 0
ALIGN
]
ENDPROC
This diff is collapsed.
/* Copyright (c) 1995, Expressive Software Projects
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Expressive Software Projects nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL EXPRESSIVE SOFTWARE PROJECTS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
DEFPROCSampleRate
LOCAL er$
er$="Sample Rate"
PRINT "PROCSampleRate"
[OPT I%
\ ------------------------------- Sample rate routines ----------------------
.newRate% \ Used from handler routine to sort out details
\ R0 = New frequency
STMDB R13!,{R0-R12,R14}
\ Need new sample period in R1
LDR R6,rateConst%
MOV R2,R0
BL clockCalc%
MOV R1,R3 \ Return sample period in R1
\ LDR R3,rateConst% \ R3.R2
\ MOV R2,#0
\ MOV R4,R0 \ DIV frequency
\
\ BL div \ R3 = Sample period
\
\ MOV R1,R3
BL newSampleRateSet%
LDMIA R13!,{R0-R12,PC}
\ ------------------
.newSampleRate% \ The sample rate has changed, sort it out
\ On entry R0 = 0 to read, >0 to set new rate = R0
STMDB R13!,{R0-R12,R14}
]
IF debug% THEN
[OPT I%
SWI "XOS_WriteS"
EQUS "New sample rate"+CHR$(0):ALIGN
SWI "XOS_NewLine"
]
ENDIF
[OPT I%
BL sampleRate% \ Returns R0 = frequency, R1 = period
LDR R2,[R12,#work_SampleFrequency%] \ Has the rate changed?
CMP R0,R2
BEQ newSampleRateExit% \ Nothing to do
BL stopSound% \ Stop play and wait for fill to finish
STR R0,[R12,#work_SampleFrequency%] \ Store frequency
STR R1,[R12,#work_SamplePeriod%] \ Store sample period
\ then calculate the fractional step for each handler
ADD R1,R12,#work_handlerTable% \ Get handler table
MOV R6,#handlerMax% \ Count
.newSampleRateLoop%
LDR R0,[R1,#handler_Address%] \ Is there a handler here?
CMP R0,#0
BEQ newSampleRateNext%
LDR R0,[R1,#handler_SampleFrequency%]
CMP R0,#0
BEQ newSampleRateNext% \ No rate stored
BL sampleRateFraction%
STR R0,[R1,#handler_Fraction%]
.newSampleRateNext%
ADD R1,R1,#handlerTableLen%
SUBS R6,R6,#1
BNE newSampleRateLoop%
BL startSound% \ Start sound again
.newSampleRateExit%
LDMIA R13!,{R0-R12,PC}
\ ---------
.newSampleRateSet%
STMDB R13!,{R14}
STR R0,[R12,#work_SampleFrequency%] \ Store frequency
STR R1,[R12,#work_SamplePeriod%] \ Store sample period
\ then calculate the fractional step for each handler
ADD R1,R12,#work_handlerTable% \ Get handler table
MOV R6,#handlerMax% \ Count
.newSampleRateSetLoop%
LDR R0,[R1,#handler_Address%] \ Is there a handler here?
CMP R0,#0
BEQ newSampleRateSetNext%
LDR R0,[R1,#handler_SampleFrequency%]
CMP R0,#0
BEQ newSampleRateSetNext% \ No rate stored
BL sampleRateFraction%
STR R0,[R1,#handler_Fraction%]
.newSampleRateSetNext%
ADD R1,R1,#handlerTableLen%
SUBS R6,R6,#1
BNE newSampleRateSetLoop%
LDMIA R13!,{PC}
\ ---------
.sampleRate% \ Set or read sample rate
\ On entry:
\ R0 = 0 to read
\ > 0 for sample frequency required
\ On exit:
\ R0 = current frequency (provided by driver)
\ R1 = current sample period (calculated by shared sound)
STMDB R13!,{R2-R12,R14}
BL driverSampleRate% \ Get current rate from driver
CMP R0,#0 \ Failed if 0
BEQ sampleRateExit%
\ R0 will return sample frequency.....
\ Now calculate sample period
\ LDR R3,rateConst% \ R3.R2
\ MOV R2,#0
\ MOV R4,R0 \ DIV frequency
\
\ BL div
LDR R6,rateConst%
MOV R2,R0
BL clockCalc%
MOV R1,R3 \ Return sample period in R1
.sampleRateExit%
LDMIA R13!,{R2-R12,PC}
\----------
.sampleRateFraction% \ Get the fractional step required for given rate and current rate
\ On entry:
\ R0 = Frequency required
\ On exit:
\ R0 = Fraction in 8.24
STMDB R13!,{R1-R12,R14}
LDR R2,[R12,#work_SampleFrequency%] \ Current frequency
MOV R6,R0 \ Frequency required
BL clockCalc% \ Returns fraction in R3
MOV R0,R3 \ Return in R0
LDMIA R13!,{R1-R12,PC}
\ ------------------
.rateConst% EQUD &3D090000
\
.clockCalc% \ Calculate fraction count
\ Pass rate in R6, actual rate in R2
STMDB R13!,{R14}
MOV R9,R2 \ Store actual rate
MOV R4,R2 \ actual rate ready for next calculation
MOV R2,#0 \ Calculate whole part
MOV R3,R6
\ R4=actual rate
BL div
MOV R10,R3
\ Calculate fraction
\ R2 = Remainder from above
MOV R3,#0
\ R4=actual rate
MOV R4,R9
BL div
MOV R3,R3,LSR #8 \ 24 Bit fraction
ADD R3,R3,R10,LSL #24 \ 8 Bit whole part
LDMIA R13!,{PC}
\
.div \ Divide R3.R2 by R4 , R3 = result, R2 = remainder
MOV R5,#32 \ Number of bits in divisor
.dloop
MOVS R3,R3,LSL #1
MOV R2,R2,LSL #1
ORRCS R2,R2,#1
CMPS R2,R4
BCC dnext
SBC R2,R2,R4
ADD R3,R3,#1
.dnext
SUBS R5,R5,#1
BNE dloop
MOV PC,R14
\
]
ENDPROC
/* Copyright (c) 1995, Expressive Software Projects
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Expressive Software Projects nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL EXPRESSIVE SOFTWARE PROJECTS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
REM >SharedSnd
REM SharedSound module
REM
REM To new spec from 0.12 onwards
REM 0.46 Uses CBAI if availble
er$="SSnd"
ON ERROR PROCError
doLog%=FALSE
doCallBack%=TRUE
doCBAI%=FALSE
ROMBuild%=TRUE
LIBRARY "<MakeSSnd$Dir>.o.Vars"
LIBRARY "<MakeSSnd$Dir>.o.Debug"
LIBRARY "<MakeSSnd$Dir>.o.Drivers"
LIBRARY "<MakeSSnd$Dir>.o.Handler"
LIBRARY "<MakeSSnd$Dir>.o.Linear"
IF doLog% THEN LIBRARY "<MakeSSnd$Dir>.o.Log"
LIBRARY "<MakeSSnd$Dir>.o.Memory"
LIBRARY "<MakeSSnd$Dir>.o.Module"
LIBRARY "<MakeSSnd$Dir>.o.SampleRate"
LIBRARY "<MakeSSnd$Dir>.o.SWIS"
LIBRARY "<MakeSSnd$Dir>.o.Volume"
LIBRARY "<MakeSSnd$Dir>.o.GetVers"
date$=" (05 Nov 1997)"
version$="0.48"
copyRight$="© Expressive Software Projects, Nottingham."+date$
title$="SharedSound"
swiName$="SharedSound"
REM
PRINT " Making ";title$;" Module"''
PRINT " Version: "version$
PRINT " ";copyRight$
DIM Code% 15000
dir$="<MakeSSnd$Dir>."
debug%=FALSE
debug1%=TRUE
IF ROMBuild% AND doLog% THEN PRINT "Cannot do log in ROM version":STOP
PROCSetStart
PROCAssm
PRINT ''" Code size: &"STR$~(P%-Code%)
PRINT ''" Save as: ";dir$+"SSound (Module)"''
OSCLI("Save "+dir$+"SSound "+STR$~(Code%)+" "+STR$~(P%))
OSCLI("SETTYPE "+dir$+"SSound MODULE")
END
DEFPROCAssm
FOR I%=0 TO 2 STEP 2
P%=Code%
PROCModule
PROCSWIS
PROCMemory
PROCSampleRate
PROCVolume
PROCDrivers
PROCLinear
IF doLog% THEN PROCLog
PROCHandler
IF NOT ROMBuild% THEN PROCDebug
NEXT
IF doLog% THEN OSCLI("LOAD "+dir$+"LogTable "+STR$~(logTable%))
ENDPROC
DEFPROCError
PRINT "Error from "er$
REPORT
PRINT " at line: "STR$(ERL)
END
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment