'** A demonstration program to show the benefits of the PB-MOD
'** unregistered version with POWER BASIC. Written Mark J Cox April 1992
'** you can use this program for anything - its just a guide on how
'** to use the object file
'** First we have the function definitions - you shouldn't change this bit
DECLARE SUB modinit()
DECLARE SUB moddevice(INTEGER)
DECLARE SUB modvolume(INTEGER,INTEGER,INTEGER,INTEGER)
DECLARE SUB modsetup(INTEGER,INTEGER,INTEGER,INTEGER,INTEGER,STRING)
DECLARE SUB modwhereami(INTEGER,INTEGER,INTEGER,INTEGER)
DECLARE SUB modsetpos(INTEGER,INTEGER)
DECLARE SUB modstop()
DECLARE FUNCTION getinsdetails$(integer,integer)
DECLARE SUB modmemory(LONG,LONG)
DECLARE SUB checkcpu(INTEGER)
DECLARE SUB checkemm(INTEGER)
' ** If an error occurs we *must* stop the module otherwise the system
' could lock up
on error goto stopmod
reserved& = 200000 ' Reserve 200k for MODOBJ (set this to be
MEMSET ENDMEM - reserved& ' the size of the largest mod you want to load
' Note: Must be 2000 bytes bigger than largest mod you want to load
'** First tell Modobj how much memory it has to play with and then
'** initialise and autodetect the output devices
print "MOD-DEMO written by Mark J Cox in June 1992"
if cpu%<2 then print "Sorry, you need a 80286+ to have music.":end
if (cpu%>2) and (emm%=1) then
print "Expanded memory driver (such as QEMM, EMM386) found."
print "Using one of these drivers slows down access to hardware"
print "and you may find the music sounds slow or locks up. If"
print "you have any problems try again after removing the driver"
print "This program is a demonstation of how easy it is to add"
print "background sounds and music into your own BASIC programs"
print "First, you need to select an output device from the list below:"
' Ask the user for a device to play through - returns number in device%
if device%=255 then print: print "Ok then, no sound" : end
if (device%=0) then
print "The PC-Speaker is not a very good output device. Why not"
print "build a resistor-DAC as detailed in the HARDWARE.DOC file"
print "enclosed, the cost of parts only being a couple of pounds"
print "Now select a Module to play from the list below"
print "Input filename (or X to exit) : ";
line input md$
if md$="x" or md$="X" then end
'** Default volume is maximum, mixing speed is 10kHz, Protracker commands
' are on and loop at the end of the module!
vol% = 255: mix%= 10000: pro%= 0: loopy%=4
if stat%=4 then print "Not enough memory to load that module":goto 20
if stat%=1 then print "That file is not a module.":goto 20
print "Module is now playing, your program can do anything it likes"
print "(apart from shelling to DOS) here!"
line input "What is your Name? ",n$
print "Okay ";n$;", when you are bored of this song press return "
line input n$
print "Error - stopping mod!"