Category : BASIC Source Code
Archive   : PB-MOD.ZIP
Filename : MODDEMO.BAS

 
Output of file : MODDEMO.BAS contained in archive : PB-MOD.ZIP
'** BasMod
'** 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

$LINK "pb-mod.obj"
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

call modmemory(endmem-reserved&,reserved&)
call modinit

print "MOD-DEMO written by Mark J Cox in June 1992"
print
call checkcpu(cpu%)
if cpu%<2 then print "Sorry, you need a 80286+ to have music.":end
call checkemm(emm%)
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"
end if
print
print "This program is a demonstation of how easy it is to add"
print "background sounds and music into your own BASIC programs"
print
print "First, you need to select an output device from the list below:"
print
print

' Ask the user for a device to play through - returns number in device%

call moddevice(device%)
if device%=255 then print: print "Ok then, no sound" : end

if (device%=0) then
print
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
end if

print
print "Now select a Module to play from the list below"
print

files "*.mod"

20:
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

call modvolume(vol%,vol%,vol%,vol%)

call modsetup(stat%,device%,mix%,pro%,loopy%,md$)

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
print "Module is now playing, your program can do anything it likes"
print "(apart from shelling to DOS) here!"
print
line input "What is your Name? ",n$
print
print "Okay ";n$;", when you are bored of this song press return "
line input n$
print

call modstop
goto 20

stopmod:
print "Error - stopping mod!"
call modstop
end

  3 Responses to “Category : BASIC Source Code
Archive   : PB-MOD.ZIP
Filename : MODDEMO.BAS

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/