This is a slightly revised version of my old V1.5 mconv routine.
It contains a new f-->T calculator routine written from scratch, that is much shorter than the old routines (~200 bytes), still maintaining speed + accuracy. Now the whole mconv routine occupies 1k ($0400 bytes).
Other logics (ADSR, waveform, multiplex) were left unchanged.
How to use it?
If you ask me, you shouldn't ;-). If you still persist ;-))), then:
-- You can figure out practically everything (init, call, etc.) from the "driver" routine.
If you load the driver routine, the mconv, and a sid music ($1000/$1003 by default), and start the driver routine by G5800, it should give at least some signs of life.
At first, it may sound horrible (honestly, even late after that =-) ). You should fine-tune the mconv's channel multiplexer settings in order to get best results. There are 3 parameters that you can tinker with:
-- Period of multiplexing ($409f; the value here is effectively P-1 ) -- Multiplex line for first TED channel ($4350-$4353) -- Multiplex line for second TED channel ($4354-$4357)
The value at $409f is the operand of an LDX #, and you should set P-1 here (ie. 1 for P=2, 2 for P=3 and so on). This period is effectively in frames (= number of calls of the mconv routine).
The values in the multiplex lines correspond to SID channels (0 for SID1, 7 for SID2, and 0e for SID3, respectively).
Let's see an example.
>409f 01 >4350 00 00 >4354 07 0e
What does this do?...
$409f = 01 --> the period of multiplexing is 2 frames. $4350 00 00 --> the first TED channel will always play the first SID channel $4354 07 0e --> the second TED channel will play the second and third SID channels, multiplexed each frames.
Let's see another example:
>409f 03 >4350 0e 0e 0e 0e >4354 00 00 07 07
Detailed:
$409f = 03 --> the period is 4 frames. $4350 0e 0e 0e 0e --> the first TED channel will play the third SID channel continuously. $4354 00 00 07 07 --> the second TED channel will alternate between the first and second SID channel, by every 2 frames.
You should rather try and experiment with these settings. Everything will be clear, if you actually _hear_ what is written here.
As a rule of thumb, alternating channels by 2 frames used to sound better than alternating by every other frame. (You decide... experiment).
(Yes, you _can_ (and should...) modify these parameters "live", while the music is playing).
Some other (additional, but unimportant) things to know.
The mconv logic will try to figure out if the SID tune is trying to play a noise waveform on the first TED channel (that is impossible). If so, it'll try swapping channels for that frame. If that is not possible, it'll mute the noise sound for that frame.
From the ADSR logic, the mconv will know if a channel is muted for a particular frame. If that is the case, it'll stop multiplexing and play 2 SID channels without alternation, as long as there aren't 3 active SID channels again.
Don't ask for sources... they don't exist... =-) The routine was coded entirely in monitor.
Have a nice experimenting... ;-)
TLC/CNS 2005.03.08 |