pouët.net

Prorunner v2.0 by Sanity

		     -=* PRORUNNER Version 2.0 *=-
	 -------------------------------------------------
		 * THE ULTIMATE PROTRACKER-REPLAYER *

		       CODED BY COSMOS OF SANITY
		       -------------------------

	        MAINFILE-MUSIC BY MICROFORCE OF SANITY

* USE CURSOR-KEYS TO SCROLL UP/DOWN * PRESS RETURN TO EXIT TO SAVE/PACKMENU *


1. NOTE:
--------

To understand all factors of PRORUNNER perfectly,it is necessary to read
this DOC-file .So if you want to copy the source-text of PRORUNNER on your
pack or compilation or whatever,then please copy the Mainfile on your disk,
because it also contains this documentary and the packer !

2. WHY I WROTE PRORUNNER
------------------------

To tell you the reason of my work,I shall have to take you with me a long
way in time: To the beginning of my career as an AMIGA-demo-coder !
At that time a great soundtool made his way through the AMIGA-scene:
THE SOUNDTRACKER ( Version 2.2 ,I think ). I was fascinated by that great
music you were able to compose and decided to get the replayer-routine in
order to include some funky tunes in my demos.To my own surprise I even got
several replayers,all of them complaining to replay modules from
SOUNDTRACKER V2.2 !! But I was never satisfied with the replay-routine I
built in. Most of them were too slow and the rest was a bit faster,but made
some mistakes, which you could easily hear. It seemed to me,that a fast
replayer outcluded a correct replay. As a demo-coder I first wanted to use
one of the fast replayers to gain some rastertime,but the result was,that
the music sounded terribly.Moreover I recognized the disappointment,which
the musician showed,because he had a lot of work with his tune and this 
work seemed to be minimated by a wrong replay. And that was finally the
reason, why I used the slowest ( and most correct ) replayer !
Later versions of SOUNDTRACKER came up with the same problem and even the
first version of NOISETRACKER couldn't solve it. It still took some time,
until NOISETRACKER V2.0 appeared, which was in my eyes a highlight for every
coder because of its very fast 8-rasterlines-replayer ! Some other tools
came up like : NOISEPACKER V1.0 - V3.0 , NOISERUNNER and some other
replayers from several guys .
NOISETRACKER V2.0 dominated the demo-scene for a long time as suddenly a
new,greater,more powerful soundtool showed up: PROTRACKER V1.0 !!
Much more comfortable and with new effects this tool persuaded ( nearly )
every musician. But PROTRACKER V1.0 and later versions ( V1.0A - V2.2a )
had a 'The minimum are 56 frames' - replay-routine,if you know,what I mean.
Soon some rumours went around about a '10-rasterlines-PROTRACKER-replayer',
but that rumours never turned out to be true and so the scene had to wait...
After a long time AZATOTH of PHENOMENA wrote a PROPACKER,which was able to
shorten the module,replay most of the PROTRACKER-effects and the replay was
mostly done in less than 9 rasterlines. It seemed to be musicians' and
coders' heaven as this great tool was released. But it wasn't !!!
In fact some coders intended to include a soundfading-routine in the
PROPACKER-replayer,but they failed,because the replayer was coded too
complicated,so that only AZATOTH would have been able to code a soundfading-
routine. Another problem was,that PROPACKER seemed to have some problems to
convert some PROTRACKER-modules ( e.g. SILENT ATTACK,MYSTIKAL!-VIBES etc. ).
Moreover PROPACKER made some mistakes in replaying TONE PORTAMENTO ( I'll
explain that later ) and some important effects were missing as many
musicians have discovered FUNK REPEAT to let the chip-tunes appear more
synthetic . And to name the last point : In the case you are coding a demo
and you have tested it for 10000 times and you were listening to that same
song 10000 times,it could be,that this song is a bit boring after 10000 times.
But you are coding at the moment and a new PROPACKER-module means :

1. Quit Assembler
2. Load PROPACKER ( with the exact parameters,otherwise you can type the
   whole line again )
3. Load Assembler again
4. Load Sourcetext

So loading in a new song very often turned out to be a long procedure. And
for me , the owner of a 105MB Harddisk, 1 MB Chipmem and 6MB Fastmem it is
more comfortable just to type in another modulename in order to load another
PROTRACKER-module.
The problem is,that in the final demo/intro/trackmo/dentro/meetro/musicdisk
you don't want to waste any memory and you are surely glad about 10000 gained
bytes.
I mean,on the one hand you maybe like to listen to different PROTRACKER-modules
while you are coding,but in your final production you want to have shortened
songpatterns in order to save a bit memory.Wouldn't it be easy to have now a
replay-routine,which can replay both,the normal and the packed modules ?
Unfortunately such a replayer never existed ...

And remembering the good old times ( SOUNDTRACKER V2.2 ) I didn't want to
wait again until a new replay-routine appears and so I tried to code a
replayer for the PROTRACKER,which is very fast,plays all effects and
corrects all mistakes done by PROPACKER. I hope I didn't fail .....


3. WHY USING PRORUNNER ?
------------------------

Well,I think,the first advantage is,that PRORUNNER really handles ALL
effects,which you are allowed to use in PROTRACKER V2.2a. I don't want to
mention them,because they are listed up at the beginning of the source-
text.
To explain you the second advantage I have to tell you the situation.
Imagine yourself a channel looking like this:

	C-2  1000	; No Effekt
	     0301	; TONE PORTAMENTO
	     0301	; TONE PORTAMENTO

As you can see,the replayer first has to play sample no.1 with the note C-2.
After that he finds neither a note nor a samplenumber,but he shall play
TONE PORTAMENTO. And so do most of the replayers,but they do wrong !!!
Because at the last time,when they played a sample,TONE PORTAMENTO wasn't
included,every following TONE PORTAMENTO ( without any note ) mustn't be
played. And that's a fact PRORUNNER pays attention on.
I admit,that was a very special situation,but if such a situation appears,
you have to replay it as correctly as other situations. I tested PRORUNNER
with lots of modules ( all modules I had on my harddisk ) and some special-
written modules to confrontate the replayer with abnormal situations
( e.g. several loops ( one in another ) on several channels ) and I hope,
that I have removed all bugs now, but who knows ?
The third advantage is ( in my eyes ),that PRORUNNER can replay NORMAL
PROTRACKER-MODULES AND MODULES IN AN OWN PACKFORMAT. That means: If you are
coding and you want to listen to another pt-module,then you just have to type
in another modulename. NO COMPLICATED PROCEDURES TO PACK ANOTHER MODULE ->
JUST ANOTHER MODULENAME !!! Later in the final demo you just have to change
one parameter in the replay-routine,so that it replays own-packed modules.
The fourth advantage is, that in the sourcetext of PRORUNNER a musicfade-
routine is already implemented . I'll explain later how to handle it.
The fifth advantage is, that PRORUNNER runs on ALL TURBOBOARDS and even
gives you the possibility to work with the VBR-register.
The finally last advantage is the fact, that PRORUNNER is the first replayer,
which is coded totally PC-relative ! That means,you can copy PRORUNNER freely
through the whole memory,it will always play the music correctly ( At least
I hope so. I tried it myself and it worked fine. And pay attention: If you
copy PRORUNNER from $30000 to $80000 and you call the Init-Routine at $30000
and the Replay-Routine at $80000, then PRORUNNER obviously can't replay the
music ).

4. HOW TO USE PRORUNNER
-----------------------

I.  Write the address of your module to the label 'pr_module'.To give you an
    example:		move.l	#moduleaddress,pr_module

II. Write the number of the startposition to the label 'pr_startposition'.
    A short example:	move.w	#45,pr_startposition
    If the startposition is 0, you can of course leave that point.If the
    number of the startposition is too high, then it will be automatically
    set to 0 !  I just implemented this option as i saw some modules,which
    were 2 songs in 1.That means,they used the same instruments and the
    patterns of song 1 were followed by the patterns of song 2. To ease the
    coder's attempt to start the second song i implemented that option,maybe
    you can use it.

III.After that you can call the subroutine 'pr_init'. I will later explain
    a bit more to the Init-routine.

IV. Call the subroutine 'pr_music' once in every frame to replay the module.
    Please remark,that PRORUNNER can only replay the samples,when the
    DMA-Mainbit ( Bit No.9 ) is set and the Interrupts are allowed ( that's
    because PRORUNNER works with LEVEL 6-Interrupt ).

V.  To end the song,call the subroutine 'pr_end',which will close all music-
    channels.

REMARK : The PRORUNNER Init-Routine converts the PROTRACKER-module in an
	 own format and replaces the four letters 'M.K.' by 'SNT.' This
	 converting will surely take some time,but it needs max. 1 second.
As I know,that many of the coders read their datas ( gfx,music ) in
MASTERSEKA or ASMOne with '>extern' once to thier addresses and assemble
their code to another part of the memory,I built in the option,that
PRORUNNER recognizes an already converted module ( signed by 'SNT.' ) and
doesn't convert it again,so that these coders don't have to read in the whole
external datas every time they assemble their code.
The packed moduleformat is signed by the four letters 'SNT!' and doesn't have
to be converted, so the Init-routine is a bit faster.


5. HOW TO USE THE MUSIC-FADE-ROUTINE
------------------------------------

This routine works with 4 labels:	FADINGSTEPS
					MAXVOLUME
					pr_musicfadect
					pr_musicfadedirection

FADINGSTEPS:		This gives you the possibility to change the number of
			frames, which PRORUNNER needs to fade the music in/out.
			Possible are values between 0 and 9 ( outcluding 0
			and 9 ).The number of frames is defined by MAXVOLUME.

MAXVOLUME:		As mentioned above this defines the number of frames.
			They are calculated by the following operation:
				number of frames = 2 ^ FADINGSTEPS
			Short example: Set FADINGSTEPS = 8
				    -> MAXVOLUME = 2^8 = 256
			-> After 256 frames ( about 5 seconds ) the music has
			   totally been faded in/out.
			Both, FADINGSTEPS and MAXVOLUME are constants,which are
			defined some lines below the header of PRORUNNER.

pr_musicfadect:		It is the counter to fade the music.It runs from
			0 to MAXVOLUME.Value at the beginning is MAXVOLUME.

pr_musicfadedirection:	This gives you the direction you want to fade your
			music to.Two Possibilities are sensible:

	 1 = Add 1 to pr_musicfadect in every frame
	-1 = Sub 1 from pr_musicfadect in every frame

Higher values would fade the music away too fast.By the way: If the counter
'pr_musicfadect' reaches the values 0 or MAXVOLUME,then pr_musicfadedirection
will be automatically set to 0 !! Anyway. Here are two examples for fading:

a) Start of Demo: Fade Music in.
						; Fadecounter is still MAXVOLUME
	clr.w	pr_musicfadect			; Set Fadecounter to 0
	move.w	#1,pr_musicfadedirection	; Fade Music in

b) End of Demo : Fade Music out.

						; Counter is still MAXVOLUME
	move.w	#-1,pr_musicfadedirection	; Fade Music out

Easy,isn't it ? And the PRORUNNER-Musicfade-routine really fades all
channels correctly, no matter, if a longer sample is played without any
effects or if some volume-effects ( e.g. tremolo,volume-slide etc. ) are
played.


6. HOW TO SWITCH BETWEEN NORMAL/PACKED REPLAY-MODE
--------------------------------------------------

Prorunner gives you the possibility to replay normal and packed PROTRACKER-
MODULES. To show you,how you can switch between these two replay-modes,we'll
have to look at the PRORUNNER-header.It should look like this:

	.					;   \
	.					;    \
	.					;     \ Header of
	.					;     / PRORUNNER
	.					;    /
	.					;   /
YES			EQU	1
NO			EQU	0
INCLUDEFADINGROUTINE	EQU	YES
PACKEDSONGFORMAT	EQU	NO		; play normal format

The last line makes the difference:

PACKEDSONGFORMAT	EQU	NO  ; allows PRORUNNER to play only normal
				    ; PROTRACKER-modules.

PACKEDSONGFORMAT	EQU	YES ; allows PRORUNNER to play only own-packed
				    ; PROTRACKER-modules.


7. WHAT ABOUT THE VBR-REGISTER ?
--------------------------------

The owners of a TURBOBOARD have the possibility to copy the vectorbase into
their fast 32Bit-RAM in order to speed their programs up. The problem is,
that ALL interrupt-vectors have to be handled with a VBR-REGISTER, but
NO replayer gave you the possibility to init its LEVEL6-INTERRUPT based on
a VECTORBASE-POINTER so that it can work with the VBR-option of TURBOBOARDS.

An example:
	VECTORBASE is placed at $8c00000

ALL replayers init their interrupt like this:

	move.l	#sex_int,$78.w

But that would never work,because the processor uses the address $78 as an
offset to the vectorbase,in this case $8c00000. The real address would be
$8c00078. Let me show you how to handle it in the right way:

	lea	sex_int(pc),a0			; to obtain pc-relative code
	move.l	sex_VECTORBASEPOINTER(pc),a1	; the value in a1 is $8c00000
	move.l	a0,$78(a1)			; that's the right way

PRORUNNER goes the same way. It inits its vector with the use of a vectorbase-
label called :
		pr_Vectorbasept

This label normally contains the value 0. Unluckily the PRORUNNER-INIT-ROUTINE
isn't enabled to read the VBR-Register in every case, because you have to use
the operating-system. So it is up to you to read out the VBR-Register and to
write the value in ' pr_Vectorbasept '.

Example:
		bsr.w	readout_vbrreg		; jump to your own routine
						; Value is in a0
		move.l	a0,pr_Vectorbasept
			.
			.
			.

PRORUNNER will now use this new vectorbaseaddress to init its interrupt, so
that you can replay your tunes even on turboboards with VBR-option.

If you have any questions ( how to read out the VBR-Register ? ), then call
me or write to me. My address is given at the end of the DOC-file.


8. HOW FAST IS PRORUNNER ?
--------------------------

Well,it of course depends on the effects you are using. I tested it ( as
mentioned above ) with lots of modules and I have to say,that PRORUNNER
never needed more than 8 RASTERLINES,but many complicated effects together
with FUNK REPEAT can surely push it up to 9 or even 10 RASTERLINES ( e.g.
Using VIBRATO+VOLUME SLIDE together with FUNK REPEAT on all 4 channels could
cost 10 RASTERLINES ). Using the packed songformat could even add one more
rasterline.
A problem in the replayer is the musicfade-routine,because it uses 4 MULUs,
which surely take their rastertime.The problem is,that in most of the demos
no fading of the music is needed. In that case you can remove the musicfade-
routine to gain a bit more rastertime.Normally the source-text should look
like this:

	.					;   \
	.					;    \
	.					;     \ Header of
	.					;     / PRORUNNER
	.					;    /
	.					;   /
YES			EQU	1
NO			EQU	0
INCLUDEFADINGROUTINE	EQU	YES

There you just have to change the last line in:

INCLUDEFADINGROUTINE	EQU	NO

The Assembler now assembles the PRORUNNER-routine automatically without the
musicfade-routine and its labels 'pr_musicfadect' and 'pr_musicfade-
direction'.

Just some words to the speed of PRORUNNER: Some effects ( e.g. ARPEGGIO,
					   GLISSANDO ) I speeded up a lot.
The problem of ARPEGGIO and GLISSANDO was for the replayer,that it had to
look through a periodtable until it found the value it searched for. That
meant : Even PROPACKER ( which is really a fast replayer ) needed up to 19
RASTERLINES ,when you played ARPEGGIO on all channels. PRORUNNER indeed
uses a shorter,but exact(!) method to play ARPEGGIO,so that ARPEGGIO on all
channels ( without FUNKREPEAT ofcourse ) takes not more than 7 RASTERLINES
( 6 RASTERLINES, when you switch the musicfade-routine off ) !!


9. HOW EFFICIENT IS THE PRORUNNER-PACKER ?
------------------------------------------

Until now, 2 kinds of PROTRACKER-packer existed in the AMIGA-scene :

a) PROPACKER V1.0 by AZATOTH of PHENOMENA: Average pack-rate and fast replay.

b) PROPACKER V2.x by THE AMIGA FREELANCERS: Really very good pack-results, but
					    a f...... slow replayer.

PRORUNNER combines now the advantages of both packers :

- A fast replayer like the one AZATOTH wrote.
- A very high pack-efficiency ( by far better than PROPACKER V1.0 and some
  bytes more or less than PROPACKER V2.x )

So it should be the ultimate solution for demo- and game-coders,because
PRORUNNER allows you to save a lot of memory without losing too much time in
decrunching and replaying the module.


10. IMPORTANT
-------------

As I tested PRORUNNER,I also took some older NOISETRACKER-modules, which
have a bit different song-format from PROTRACKER-modules. I heard a
little difference,because PRORUNNER calculated wrong startaddresses for the
samples. I loaded PROTRACKER , read in the module and saved it again. And
as I started PRORUNNER again,it replayed the module in a correct way.
So if you want to replay old NOISETRACKER-modules, then you first have to
save them under PROTRACKER. Otherwise it can be, that PRORUNNER makes
trouble in replaying the module.


11. IMPROVEMENTS
----------------

Version 2.0 :
	- Packer included
	- Now working with a vectorbase-pointer
	- Variable Fadespeed inserted
	- Variable Interrupt-timing inserted
	- No system-crash anymore when initializing PRORUNNER in
	  SUPERVISOR-mode
	- Corrected PatternBreak - command
	- Corrected NoteDelay - command
	- Corrected Loop - command


COMING SOON: PRORUNNER V3.0 WITH CHOOSABLE CIA-PLAYMODE AND A SPECIAL
	     SONGFORMAT FOR GAMES !!!


12. SOME HANDSHAKES
-------------------

Youw. This chapter has been inserted to thank all the people, who called me
or wrote to me in the last time. Handshakes and thankful greets to:

- All guys in SANITY
- MCDEAL of D-TECT
- RENEGADE and DSP of AGNOSTIC FRONT
- MANOWARRIOR of VISDOM
- ORBIT of DUAL CREW
- ADT of ABSOLUTE!
- VEKTOR of ZITE PROD.


13. SOME LAST WORDS
-------------------

Yep. Some last words have to be said. I hope, that for some guys out there
I was able to solve the 'replayer-problem', that I was able to help you.
In the case,that you've found a bug in the replayer or if you want to write
or call me for any reason, here's my address and phonenumber:


			     COSMOS of SANITY

			        MARC HEYL
			  ROBERT-KOCH-STRASSE 4
			    6650 HOMBURG-SAAR
			         GERMANY
			   TEL. 06841 / 65164


It is a pity,that the scene has become so unpersonally. Friendship just seems
to be a word without any meaning. The reason, that made me writing this, is
an anonymous guy, who wrote in his letter, that he'd like to ask me a few
things about PRORUNNER and coding generally, but he admits to be a beginner
and therefore no elite-coder, which was finally the reason for him not to
call me, because he thought, that I'm gonna kick his balls or call him a
bastard of a lamer.
No way, man ! I know the situation to stand at the very beginning and nobody
can help you.  I'll never call anyone a lamer because of asking me some
things about coding or anything, because everyone of us has started at the
beginning. So if you have the intention to call me, then don't hesitate and
ring me up, maybe I can help you. And if I can't, let's just have a nice
chat !!

****************************************************************************