|
|
Atari coding BBS
Re: Lance's 50khz playroutine |
Posted by: ljbk
|
Feb,28.2013-13:24
|
i all !
If you nothing to read to go to sleep and are interested by this subject here is something for you that, despite incomplete, replies to the thread's question.
Enjoy it or not,
Paulo.
;------------------------------------------------------------------------
;
; Hacking Lance
; by Paulo Simoes Feb. 2013
;
; 1 Introduction
; --------------
; The only purpose of this "hacking" is to try to find out a way to have
; a 25 KHz replay at a better % CPU than the existing 50 KHz version.
; I was informed about this routine by Leonard from Oxygene in 2004 but
; as i took a superficial look, i found out that the tricks used were
; really specific and could not be ported to my core program used in
; Hextracker and YM50K that i built in 1991 and 1992.
; So the main hacking was done these last few days.
; The text that follows relects that hacking and my experience with this
; Soundtracker business.
;
; 2 The Sountracker challenge
; ---------------------------
; Soundtracker music was in the old days one of the main arguments for
; Amiga owners to nagg the ST owners.
; Let's face it. The Paula Amiga soundchip is really powerfull.
; So let's see what is the best it can do.
; It uses the Amiga master clock to read the samples in a controlable
; rate by means of a divider that can be set from $000 to $3FF.
; Loops and end of sample data are controlled by the HW.
; Those 8 bit signed samples will be then volumed by a 64 volume register
; which means a signed multiplication giving a 14 bit result.
; Those 4 14-bit values, one per real digital voice, will be mixed into
; two 15 bit values and sent at around 28 KHz(A500) to two DACs that will
; produce the Left and Right stereo analog signals.
; Finally, a low pass filter can be activated to reduce noice sent to the
; speakers.
; All this stuff is done by hardware with plenty of DMA channels to read
; from the memory costing almost 0 to the CPU ...
; And what does the Atari ST have to do this kind of job ?
; Well for the pre-STE models, known mostly as STFs, the Atari ST has
; nothing except SW and an old YM2149 soundchip.
; The Atari STE has a DMA that can read from memory 1 sample in mono or 2
; interleaved samples in stereo that will be sent to 8 bit DACs to
; produce the mono analog signal or the Left and Right stereo analog
; signals at 6.25 KHz, 12.5 KHz, 25 KHz and 50 KHz.
; It is then easy to understand that SW would have to play an important
; part in porting the Soundtracker music to the Atari ST, including the
; Atari STE.
;
; 3 Splitting the challenge in small parts
; ----------------------------------------
; One of the keys to solve any big problem is to divide it in smaller
; problems without loosing the view to the main picture.
; The same applies here.
; Let's start from the end to the beginning with the Paula soundchip
; fetures.
; At the end, we have low pass filters.
; As we have no hardware to do that on Atari ST and as the cost to do
; this in terms of SW is terribly high thinking about KHz rates, this is
; the first feature to be dropped as we assume the ST will not do that.
; Before that, we have the 15 bits DACs in stereo or the DAC in mono.
; Well, on STF, we have no DAC, so we emulate one by using combinations
; of 4 bit volume levels (registers 8, 9 and 10) on the YM2149
; soundchip with or without tones active (register 7) (Quartet method
; and ST Replay method). The quality of table will defined the quality
; of the DAC emulation. That depends on the number of YM2149 voices used
; (1, 2 or 3) and on the selected combinations for each corresponding
; digital level. Stereo is impossible on STF with the base HW so we drop
; the stereo case for STF.
; On STE, we have 8 bit DACs so we should use them and we can do stereo.
; Paula sends data at around 28 KHz(A500) to the DACs.
; The STF has no DMA to send data to its emulated DAC. So that part has
; to be done by SW. Interrupts is the most common solution used to read
; the mixed data and send it via the DAC emulation table to the YM2149.
; One can also do it in a timed way, updating the YM2149 every XXX cycles
; but that is not compatible with better CPUs or better clock speeds.
; The STE has a DMA to do this job. We just have to store the mixed data
; in the way the DMA wants it to be read and sent to the DACs. In case
; of mono this means a single buffer with the set of 8 bit values to be
; sent to the DAC. In case of stereo, we should have a single buffer with
; interleaved data: 8 bit for the Left DAC followed by 8 bit to the Right
; DAC followed by Left, Right, Left and so on ...
; The next part is the mixer ...
; This where the job starts to be nearly identical both for STFs and STEs
; as the job is to mix 4 voices data to a buffer respecting the STE DMA
; read constraints or the self established rules for STF.
; From this moment on, i will forget the general case and focus only on
; Lance's challenge: 50 KHz replay in stereo on STE.
; Stereo means that the mixer SW will do two times the job to mix two
: voices into one 8 bit value that will be interleaved as the STE DMA
; wants.
; Mixing means mainly adding signed values. To get a 8 bit mixing result
; with 2 voices there are 2 solutions: a convertion via a table like any
; size bits previous mixing result is converted into 8 bit or the speedy
; solution: 7 bit + 7 bit = 8 bit ...
; It is easy to guess which on Lance choosed and which one most of the
; ST Sountracker player choose.
; But the first one is much more accurate to emulate Paula: the 15 bit
; mixing result is converted into 8 bit data to send to the DACs.
; We are now at the point where one should discuss the individual voice
; data.
; Before it is mixed, each voice has to volume the sample data respecting
; the volume set to the sample data.
; Again, this is normally achieved via a lookup table where the sample
; data is converted into volumed sample data.
; We then have the variable speed data reading.
; No HW to do that so it has to be done via SW with memory reading when
; needed via specific addressing modes or pointer increments.
; Finally, we have the loop and end of sample controls. This is the easy
; part as SW can "add" data at the end of the sample to emulate the loop
; with the size of that data corresponding to the maximum data that can
; be read before the pointers are check which is normally 1 VBL.
;
; 4 Lance's solutions to each small problem
; -----------------------------------------
; Now we will visit again each problem in the reverse order.
; The first choice is that the BPM feature is not emulated by this
; version. This means that the MOD control is done at every VBL.
; This with a replay rate of 50 KHz, this means that we have to update
; the DMA buffer with 50000 / 50 VBLs = 1000 blocks of Left and Right
; data at every VBL. For 25 KHz we would have only 500.
; The dividers for variable speed reading found in the Protacker tables
; go from 108 to 907 (mt_periodtable).
; Considering the european PAL Amiga clock rate of 7.09379 MHz (and not
; simply 7.09 MHz found in this source), this means reading from memory
; at rates from: 7093790/(2x108) = 32841.6 Hz to 7093790/(2x907) = 3910.6
; Hz. Considering the VBLs, this means reading from 32841.6 / 50 = 656.8
; bytes per VBL down to 3910.6 / 50 = 78.2 bytes per VBL for each voice.
; So we have to produce 1000 8 bit mixing values with a maximum of 657
; reads per VBL for each voice. One can see that the maximum read speed
; compared to the mixing speed is lower than 1: 657 / 1000 = 0.657
; This means that we can use the simplest addressing mode for reading:
; move.b (An)+,... or add.b (An)+,...
; This is where we have the first problem at 25 KHz. As we have only to
; produce 500 mixing results per VBL, we have 657 / 500 = 1.314 which is
; bigger than 1 but lower than 2. This means that for a par[...]
|
[All messages in this thread] [Start new thread]
Topic
|
Posted by
|
Date
|
Lance's 50khz playroutine
|
Bod/STAX
|
Feb,18.2013-17:35
|
Re: Lance's 50khz playroutine
|
gwEm
|
Feb,18.2013-20:42
|
Re: Lance's 50khz playroutine
|
ggn
|
Feb,18.2013-20:53
|
Re: Lance's 50khz playroutine
|
Bod/STAX
|
Feb,18.2013-21:28
|
Re: Lance's 50khz playroutine
|
gwEm
|
Feb,18.2013-23:05
|
Re: Lance's 50khz playroutine
|
gwEm
|
Feb,18.2013-23:16
|
Re: Lance's 50khz playroutine
|
gwEm
|
Feb,19.2013-02:21
|
Re: Lance's 50khz playroutine
|
Bod/STAX
|
Feb,22.2013-17:08
|
Re: Lance's 50khz playroutine
|
gwEm
|
Feb,25.2013-20:36
|
Re: Lance's 50khz playroutine
|
ljbk
|
Feb,25.2013-23:54
|
Re: Lance's 50khz playroutine
|
Bod/STAX
|
Feb,26.2013-11:23
|
Re: Lance's 50khz playroutine
|
evil
|
Feb,26.2013-12:04
|
Re: Lance's 50khz playroutine
|
ljbk
|
Feb,26.2013-14:45
|
Re: Lance's 50khz playroutine
|
ljbk
|
Feb,26.2013-21:46
|
Re: Lance's 50khz playroutine
|
evil
|
Feb,27.2013-17:01
|
Re: Lance's 50khz playroutine
|
ljbk
|
Feb,28.2013-13:24
|
Re: Lance's 50khz playroutine
|
ljbk
|
Feb,28.2013-13:28
|
Re: Lance's 50khz playroutine
|
gwEm
|
Feb,28.2013-14:07
|
Re: Lance's 50khz playroutine
|
Bod/STAX
|
Feb,28.2013-21:41
|
Re: Lance's 50khz playroutine
|
ljbk
|
Feb,28.2013-22:42
|
Sem assunto
|
ljbk
|
Mar,01.2013-13:27
|
Lance's 50 KHz playroutine
|
ljbk
|
Mar,01.2013-15:49
|
Re: Lance's 50 KHz playroutine
|
ljbk
|
Mar,01.2013-17:34
|
Re: Lance's 50 KHz playroutine
|
ljbk
|
Mar,01.2013-17:36
|
Re: Lance's 50 KHz playroutine
|
evil
|
Mar,01.2013-19:03
|
Re: Lance's 50 KHz playroutine
|
ljbk
|
Mar,02.2013-00:18
|
Re: Lance's 50 KHz playroutine
|
ljbk
|
Mar,04.2013-17:39
|
Re: Lance's 50 KHz playroutine
|
ljbk
|
Mar,06.2013-02:21
|
Re: Lance's 50 KHz playroutine
|
gwEm
|
Mar,06.2013-13:23
|
Re: Lance's 50 KHz playroutine
|
ljbk
|
Mar,06.2013-15:57
|
Re: Lance's 50 KHz playroutine
|
evil
|
Mar,06.2013-16:48
|
Re: Lance's 50 KHz playroutine
|
ggn
|
Mar,06.2013-17:31
|
Re: Lance's 50 KHz playroutine
|
evil
|
Mar,06.2013-17:48
|
Re: Lance's 50 KHz playroutine
|
ggn
|
Mar,06.2013-23:54
|
Re: Lance's 50 KHz playroutine
|
ljbk
|
Mar,06.2013-18:18
|
Re: Lance's 50 KHz playroutine
|
ljbk
|
Mar,06.2013-21:51
|
Re: Lance's 50 KHz playroutine
|
ggn
|
Mar,06.2013-23:59
|
Re: Lance's 50 KHz playroutine
|
ljbk
|
Mar,07.2013-02:31
|
Re: Lance's 50 KHz playroutine
|
ggn
|
Mar,07.2013-12:34
|
Re: Lance's 50 KHz playroutine
|
ljbk
|
Mar,07.2013-14:00
|
Re: Lance's 50 KHz playroutine
|
gwEm
|
Mar,07.2013-18:00
|
Re: Lance's 50 KHz playroutine
|
ljbk
|
Mar,07.2013-18:51
|
Re: Lance's 50 KHz playroutine
|
ljbk
|
Mar,08.2013-02:10
|
Re: Lance's 50 KHz playroutine
|
ljbk
|
Mar,08.2013-13:12
|
Re: Lance's 50 KHz playroutine
|
ljbk
|
Mar,09.2013-00:17
|
Re: Lance's 50 KHz playroutine
|
ljbk
|
Mar,06.2013-19:28
|
Re: Lance's 50khz playroutine
|
ljbk
|
Feb,28.2013-15:47
|
Re: Lance's 50khz playroutine
|
ljbk
|
Feb,28.2013-15:51
|
Re: Lance's 50khz playroutine
|
ljbk
|
Feb,28.2013-18:56
|
Re: Lance's 50khz playroutine
|
nativ
|
Mar,24.2013-00:07
|
Re: Lance's 50khz playroutine
|
ljbk
|
Apr,13.2013-01:21
|
Re: Lance's 50khz playroutine
|
ljbk
|
Apr,16.2013-16:12
|
Re: Lance's 50khz playroutine
|
ljbk
|
Apr,19.2013-12:14
|
Re: Lance's 50khz playroutine
|
ljbk
|
Apr,22.2013-14:54
|
Re: Lance's 50khz playroutine
|
ljbk
|
Apr,25.2013-19:03
|
Re: Lance's 50khz playroutine
|
ggn
|
Apr,25.2013-21:03
|
Re: Lance's 50khz playroutine
|
ljbk
|
Apr,26.2013-09:18
|
Re: Lance's 50khz playroutine
|
ggn
|
Apr,26.2013-11:28
|
Re: Lance's 50khz playroutine
|
ljbk
|
Apr,26.2013-12:13
|
Re: Lance's 50khz playroutine
|
ljbk
|
May,01.2013-22:30
|
Re: Lance's 50khz playroutine
|
evil
|
May,02.2013-14:46
|
Re: Lance's 50khz playroutine
|
gwEm
|
May,02.2013-20:00
|
Re: Lance's 50khz playroutine
|
Damo
|
May,02.2013-21:00
|
Re: Lance's 50khz playroutine
|
evil
|
May,03.2013-13:00
|
Re: Lance's 50khz playroutine
|
ljbk
|
May,08.2013-17:50
|
Re: Lance's 50khz playroutine
|
Cyprian
|
May,10.2013-13:01
|
Re: Lance's 50khz playroutine
|
ljbk
|
May,11.2013-00:22
|
Re: Lance's 50khz playroutine
|
ljbk
|
May,11.2013-08:54
|
Re: Lance's 50khz playroutine
|
Cyprian
|
May,11.2013-15:18
|
Re: Lance's 50khz playroutine
|
ljbk
|
May,11.2013-15:35
|
Re: Lance's 50khz playroutine
|
Lance
|
May,23.2013-00:02
|
Re: Lance's 50khz playroutine
|
ljbk
|
May,23.2013-14:44
|
Re: Lance's 50khz playroutine
|
Bod/STAX
|
Jun,06.2013-20:32
|
Re: Lance's 50khz playroutine
|
Bod/STAX
|
Jun,06.2013-20:39
|
Re: Lance's 50khz playroutine
|
ljbk
|
Jun,07.2013-00:09
|
Re: Lance's 50khz playroutine
|
Bod/STAX
|
Jun,07.2013-18:38
|
Re: Lance's 50khz playroutine
|
ljbk
|
Jun,07.2013-21:46
|
What's the anti-troll code? That's your personal code to be able to add comments and messages on the dhs.nu site.
Don't have a code or forgot it? Fix it here.
|
|
|