************************************************** ********** MusicMon 2.1 Replay Routine *********** ********** *********** ********** a short HowTo *********** ************************************************** replay.inl is the actual replay routine as known from MM2. Interface is almost the same, only the INIT1 call (Base+4) now expects a so called 'Timer-Use-Mask' by that you can control which timers the routine allocates for playing Digis and SIDs. The specified timers are assigned dynamically to the channels as needed. There are two different ways of using the replay routine: The first one is using the so called "comfort header" which is basically good for integration into high level languages. On using the comfort-header patching of Timer C, ACIA and spurious IRQ as well as restauration work is done for you automatically as well as according clean up on calling the DEINIT function. All parameters are handed over on the stack. The second way is the "foot way" where you have to establish your own interrupt handler from that you are calling te soundroutine frequently. Any patching and restauration work you have to do also explicitely. Fortunately there are some sub-routines supporting you in that (see below). The advantage of this method is to be more flexible. Attention: Do not mix up the two variants! Either you are doing anything via the comfort-header (routbase+32), OR you are doing anything on the footway calling the other routines but not routbase+32! There are two example sources showing both variants: * MODPLAY.GFA shows use of the comfort-header * EXAMPLE.S shows how to do it the footway Note: The replay routine makes use of the reset resident memory space Range from $200 to $21B is reserved! +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Following the jump-in offsets including parameter description: routbase = Address where you loaded replay.inl to. ; ----------------------------------------------------------------------------- ; I. routbase+0 ASK, routine to query the new overall length of a Digi-Module ; after conversion by INIT2 ; IN: A0 = Baseadress of the module ; OUT: A0 = new length or -1 in case of this is no digi-module ; ----------------------------------------------------------------------------- ; II. routbase+4 INIT1, Initialization for all kind of modules ; Can be called multiple times to restart replay ; ; IN: A0 = Baseadress of the module ; D0 = Timer-Use-Mask (SID+DIGI+Sync-Buzzer) ; (Bit 0 = Timer A, Bit 1 = Timer B, Bit 2 = Timer C, Bit 3 = Timer D) ; ------------------------------------------------------------------------------------ ; III. routbase+8 INIT2, Pre-Initialization for digi-modules (call only ; ONCE (before INIT1) !!!) ; IN: A0 = Baseadress of the module ; A1 = Baseadress of the converted module (use this for Input on ; INIT1 then!) ; ------------------------------------------------------------------------------ ; IV. routbase+12 SOUND, actual replay routine for modules without sounds ; with 100 oder 200Hz ; Call with 50Hz !!! ; ------------------------------------------------------------------------------ ; V. routbase+16 SOUND2, also actual replay routine, but for modules ; using sounds with 100 or 200Hz ; Call with 200Hz !!! ; ------------------------------------------------------------------------------ ; VI. routbase+20 FAST-DIGI on/off ; ; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ; !!!!!!!!!!!!!!!!!!!!!!! NOT SUPPORTED IN V 2.1 !!!!!!!!!!!!!!!!!!!! ; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ; ------------------------------------------------------------------------------- ; VII. routbase+24 VOLUME CONTROL ; IN: D0.b = set mastervolume (0-15) or -1, if not to modify ; 0 means maximum volume, 15 means minimum volume! ; D1.b = fade in (pos. values), fade out (neg. values) ; The value determines the fading speed, the ; closer to 0, the faster it is ; In case of D1.b=0, no fading at all! ; ----------------------------------------------------------------------------- ; VIII routbase+28 ASKING FOR MODUL TYPE ; IN: A0 = Baseadress of the module ; OUT: D0.b = Bit 0 - set, if this is a digi module ; Bit 1 - set, if module uses sounds >50HZ ; Bit 2 - set, if module uses SID-Voices ; Bit 3 - set, if module uses Sync Buzzer Voices ; ----------------------------------------------------------------------------- ; IX routbase+32 COMFORT-HEADER ; good for integrating in high level languages since it comes with ; an own interrupt driver (VBL and Timer C) and applies according patches ; to ACIA and Timer C in the context of digis and SIDs ; Also spurious interrupt is already respected ; ; all parameters are handed over on stack, see below for Details ; return-values in D0, if applicable ; ----------------------------------------------------------------------------- ; X routbase+36 Timer-INTERRUPTS OFF ; stops the timers used for Digis, SIDs and Sync Buzzers (according to ; Timer-Use-Mask set on INIT1) ; ; no parameters, no return-value ; ---------------------------------------------------------------------------- ; XI mod.base+40 SOUNDS OFF ; clears any sound output ; ; no parameters, no return-value ; ---------------------------------------------------------------------------- ; XII mod.base+44 PATCH ACIA ; Patches the Acia Interrupt so that it does not distrubr digis, SIDs and Sync-Buzzers ; ; no parameters, no return-value ; ---------------------------------------------------------------------------- ; XIII mod.base+48 UNPATCH ACIA ; Undos ACIA patching ; ; no parameters, no return-value ; ---------------------------------------------------------------------------- ; XIV mod.base+52 PATCH TIMER C ; Patches Timer C Interrupt so that it does not distrubr digis, SIDs and Sync-Buzzers ; ; no parameters, no return-value ; ---------------------------------------------------------------------------- ; XV mod.base+56 UNPATCH TIMER C ; Undos Timer C patching ; ; no parameters, no return-value ; ---------------------------------------------------------------------------- ; XVI mod.base+60 PATCH SPURIOUS INTERRUPT ; Patches Spurious interrupt ; ; no parameters, no return-value ; ---------------------------------------------------------------------------- ; XVII mod.base+64 UNPATCH SPURIOUS INTERRUPT ; Undos Spurious interrupt patching ; ; no parameters, no return-value ; ---------------------------------------------------------------------------- ; *************************************************** ; ***** The Comfort-Header ****** ; *************************************************** ; ***** Parameters on the stack! ****** ; ***** ****** ; ***** +++ ASK FOR MODUL TYPE +++ ****** ; ***** L: Modul Baseadr. ****** ; ***** W: Funct.No. #0 ****** ; ***** Return in D0.b : ****** ; ***** Bit 0 - Digis ****** ; ***** Bit 1 - >50Hz ****** ; ***** Bit 2 - SID ****** ; ***** Bit 3 - Sync-Buzz ****** ; ***** ****** ; ***** +++ ASK FOR NEW LENGTH (DIGI-MODULE) + ****** ; ***** L: Modul Baseadr. ****** ; ***** W: Funct.No #1 ****** ; ***** Return in D0.L : ****** ; ***** new length ****** ; ***** ****** ; ***** +++ INIT 1 (all modules) +++ ****** ; ***** L: Modul Baseadr. ****** ; ***** W: Timer-Use-Mask ****** ; ***** Bit 0 : Timer A ****** ; ***** Bit 1 : Timer B ****** ; ***** Bit 2 : IGNORED ****** ; ***** Bit 3 : Timer D ****** ; ***** ****** ; ***** W: Funct.No #2 ****** ; ***** ****** ; ***** + INIT 2 (only Digi.Modules, ONCE!!!) ****** ; ***** L: Modul Baseadr. ****** ; ***** L: Modul Destinationadr ****** ; ***** W: Funct.No #3 ****** ; ***** ****** ; ***** +++ START INTERRUPT +++ ****** ; ***** W: Integration Method ****** ; ***** ****** ; ***** 0 = VBL-QUEUE ****** ; ***** 1 = VBL direct (System-routine in) ****** ; ***** 2 = VBL direct (" " out) ****** ; ***** 3 = TIMER C (System-routine in) ****** ; ***** 4 = TIMER C (System-routine out) ****** ; ***** ****** ; ***** W: Funct.No #4 ****** ; ***** ****** ; ***** +++ DEINIT +++ ****** ; ***** (stops Timers, stops sound-routine, ****** ; ***** removes patches, etc.) ****** ; ***** ****** ; ***** W: Funct.No. #5 ****** ; ***** ****** ; ***** +++ VOLUME SET / FADER +++ ****** ; ***** ****** ; ***** B: MASTERVOLUME ****** ; ***** 0 = max., 15 = min. ****** ; ***** -1 = no effect ****** ; ***** B: Fadespeed (+ or -) ****** ; ***** + fades in ****** ; ***** - fades out ****** ; ***** W: Funct.No. #6 ****** ; ***** ****** ; ***************************************************