A.D.A. Amiga Demoscene Archive

        Welcome guest!

  

  

  

log in with SceneID

  

Demos Amiga Demoscene Archive Forum / Coding / Modules playing routines : help would be welcome

 

Author Message
HM Kaiser
Member
#1 - Posted: 25 Jan 2012 14:20
Reply Quote
Hi all !
I have trouble and questions about sound/pro tracker modules replay routines.
I use a routine found on internet, it just says "lea your module (mt_data) to a0 and call mt_init."
Of course, just doing that did not work.
I've looked the routine source, and understood that I had to call mt_music at each vertical blank interval.

So, in a very basic code, I can play modules. Good start.

I thought it would be equally easy to play modules in my intro.Here's the way I do in my intro:
- I include the mod replay routine in the very beginning of my own source "include ptreplay.s" (just after include for custom chip registers addresses).
- I call mt_init just after my intro's inits and just before my main intro loop.
- Then, in my level 3 (vbl) interrupt code, I call mt_music.

-> as soon as I include ptreplay.s, my source assembles correctly, but will not run (quits immediately, with $FFFF in d0), even if I comment all calls to mt_init and mt_music. Really I still don't understand why. The routine is pc relative and my code isn't, but I don't think it is the cause ?
-> did I do that the right way : are the call to mt_init, and mt_music at the right places ?
-> Do I have to enable audio DMA in my main code, or (I think so), the mod replay routine enables it itself ? (in my main code, I save old dmacon, then disable all DMA, then set my needed DMA : master, raster, blitter, copper and sprite)

These may seem basic questions, but I'm really stuck with this issue. Advices anyone ?


PS : my second intro is finished :-) don't know yet if I'll have music for it.
ZEROblue
Member
#2 - Posted: 25 Jan 2012 15:28 - Edited
Reply Quote
If you've included the replayer literally in the very beginning as you say, then it happens because execution starts with the replay routine. It's just as if you had copied and pasted the replayer code in place of the include statement.

I always recommend using proper assembling and linking stages to avoid this and other related problems, but you can solve it by either putting a JMP Demo before including the replayer, or just including it at the very end of your code. Also you should check out The Player 6.1 on Aminet, it's an optimized player for ProTracker mods that uses very little CPU time.
HM Kaiser
Member
#3 - Posted: 25 Jan 2012 16:05
Reply Quote
In my memories, a code included at the beginning of a source was not executed. (I used assemblers a long long time ago and I forgot how linking works I have to admit - time for me to refresh all that forgotten knowledge !)

I've included the mod replay routine in the end of my code, it worked immediately.
So I was right for mt_init, mt_music, and dma :-)
I only forgot mt_end in my exit code.

Once again, a very basic mistake... very often I got it *nearly* right and it does not work because of the *nearly* :-)
Many thanks Zeroblue for taking time to answer to a such basic problem !

 

  Please log in to comment

  

  

  

 

A.D.A. Amiga Demoscene Archive, Version 3.0