{dosplay.txt- the document for dosplay.inc } Turbo Pascal moonblaster/Sound effects dos player routines by Kari Lammassaari 1997. The source of dosplay.mpc needed by this source is originally written by REMCO SCHRIJVER and later improvements are from Maarten ter Huurne alias KRYTEN/MAYHEM . SEE player is originally from SHADOW of FUZZY LOGIC. The modifications I made, were msxdos2 support, better OPLL search (from library of MsxHandbook), mapper support routines and adaptation to operate under DOS + easier hooking to interrupt with ints.inc. REM !!! The DOSPLAY.MPC (MPC = MapperPageCode) is essential for the operation of dosplay.inc. This code is loaded to the allocated mapper page and contains them usic interrupt routine, loader and init code for player code. It's a separate file in purpose to save the conventional program memory for the other purposes. The dosplay.inc contains following constants,variables,procedures and functions: Following constants contain entry adresses of dosplay.mpc loaded at $4000. (User don't need to know them. This is only for Your information) Const StartMusic = $4000; {Entries to player code. Used internally } StopMusic = $4003; PauseMusic = $4006; {Not used, same as StopMusic} ContinueMusic = $4009; SearchChips = $400c; MbkLoad = $400f; {Entry for MModule sample kit loader.} MbmLoad = $4012; {Entry for Moonblaster MBM-file loader} MusicInt = $4015; {Entry for music interrupt} ClearFIB = $4018; {Clear internal FileInfoBlock} MusicFIB = $4033; {Internal fib for loading MBM, MBK and SEE files} Chips = $401b; {0=MsxAudio,1=MsxMusic,2=both} MusicPageNum = $401D; {Contains the music page number} DosErrorFlag = $4073; {Contains recent dos operation result,Not used.} MapperJumpTbl = $4074; {Updated with InitMbmPlayer.} SeePageNum = $50dd; {Contains the SEE data } _InitSEE = $50b7; _RemoveSEE = $50ba; _SetSFX = $50bd; _StopSFX = $50c0; _SEEint = $50c3; {the SEE interrupt code } _SeeLoad = $50c6; {entry to load .see file on annother mapper page} _SeeVolume = $50e1; {doesn't work } IntCode :Array[0..13] Of Byte = ($db,$fd,$f5,$3e,0,$d3,$fd, $cd,$15,$40,$f1,$d3,$fd, $c9); (This code is actual interrupt code to access the mbplayer and seeplayer entries of the edosplay.mpc code , which is allocated on some mapper page in the primary mapper. IntCode is transferred to $2f00 (access mbplayer) and $2f20 (access SEE player) and pathed with right pagenumbers .) The program using dosplay MUST BE COMPILEDWITH START ADDRESS $3000 to preserve free memory for this code and oyher interrupt services. Const PlayerName = 'dosplay.mpc'; {actual player file } Var PlayerPageID :Integer; {player code page } MusicPageID :Integer; {Mb song page} SeePageID :Integer; {Sound effects page } {The page id of player/music page, initialized by InitMbmPlayer. Lo(PageId) = Slot ID of page, Hi(PageId) = page number } MBHook :Array[0..17] Of Byte Absolute $2f00; {Code to access MBplayer} SeeHook :Array[0..17] Of Byte Absolute $2f20; {Code to access SEEplayer} MbIntNbr,SeeIntNbr :Byte ; {Store interrupt numbers returned bi ints.inc } {Use to disable and enabe player interrupts. } Function InitMbmPlayer:Boolean; {True if succeeded ;} You need not to know this, but this is done by InitMbmPlayer: - Checks, that there is player code file 'dosplay.mpc available, if not, halts with error message. So use this code before setting a graphic screen. - Checks, that there is mapper support. - Checks, that there are 3 free pages to allocate on primary mapper. - Allocates 3 pages as system pages for player code, music file and SEE file. - Loads DOSPLAY.MPC into allocated page. - Updates MapperJumpTbl-address in mbplayer code for internal use. - Searches for music chips and updates Chips location in mbplayer code. - Updates MusicPageNum location in dosplay code for music interrupt. - Updates SeePageNum (=SEEMAP) in dosplay code for SEE interrupt. Procedure LoadMBKFile(FileName:StringType); - Loads MusicModule samplekit (created by Moonblaster) into Audio Ram. - The file extension of sample kit is normally .MBK . - Corrupts Music Page, which is used as buffer. Load MBK first, then MBM. - If there is no MusicModule, does nothing. Procedure LoadMBMFile(FileName:StringType); - Loads Moonblaster music file into MusicPage . - Normally file extension is .MBM . Function GetMusicChips:Byte; {0=MsxAudio,1=MsxMusic,2=Both,255 = PSG} - Returns the code for the music chips available. Procedure StartMbmPlay; - Moves IntCode to $2f00 and installs interrupt via SetInterrupt (ints.inc) - Does not check, that there is a valid music file loaded into music page, but plays, what ever there happens to be. System may crash. Procedure StopMbmPlay; - Disables interrupt ... stops playing. Procedure ContinueMbmPlay; - Enables interrupt and starts playing from the position, where the playing was stopped. Function GetErrorCode:Byte; { The codes are normal msxdos2 error codes } - Returns after LoadMBK/MBMFile the result of loading process. - Zero = no errors , $DA = invalid filename, $$D7 = file not found etc. - Does not detect corrupted files ! Procedure InitSeeSFX; - Initialises SEE player. Checks, that there is a valid SEE file loaded on the allocated SEE mapper page. You MUST LOAD SEE FILE BEFORE USING this procedure using LoadSEEFile. - Moves IntCode to $2f20 and patches it with the right SeePageNumeber. - Installs SEE interrupt via SetInterrupt (ints.inc ) Procedure LoadSEEFile(FileName:StringType); - Loads file to the allocated SEE page. Does not check the validity of the file ! Procedure RemoveSeeSFX; - Disables See interrupt. Stop playeng the SFX sound; Procedure ContinueSeeSFX; - Enables See interrupt. To get a new sound ise SetSeeSfxSound. Procedure StopSeeSFX; - Silents Sfx sound. Intrupt is still on . Procedure SetSeeSFXSound(Number,Priority:Byte); - Starts a Sfx sound. In See files there are several sounds numbered 0, 1, 2 ... - If priority is zero, a new Sfx sound can overwrites previous sound. If priority is nonzero, the sound is played first to the end .