Audio vs Amiga

All about ST/STE games

Moderators: simonsunnyboy, Mug UK, ICS, Doctor Bob Gordon, Moderator Team

Zamuel_a
Atari God
Atari God
Posts: 1223
Joined: Wed Dec 19, 2007 8:36 pm
Location: Sweden

Re: Audio vs Amiga

Postby Zamuel_a » Thu Jul 19, 2012 10:30 am

Speed is not the only goal. Accurracy is also important.


I agree if you want to make a player just for listening, but for a game, speed is better, so if a 50khz high quality output runs at 40%, wouldn't a 25khz, not the best quality output be possible to run at 20% ?
ST / STFM / STE / Mega STE / Falcon / TT030 / Portfolio / 2600 / 7800 / Jaguar / 600xl / 130xe

User avatar
ljbk
Atari Super Hero
Atari Super Hero
Posts: 514
Joined: Thu Feb 19, 2004 4:37 pm
Location: Estoril, Portugal

Re: Audio vs Amiga

Postby ljbk » Thu Jul 19, 2012 12:59 pm

Zamuel_a wrote:
Speed is not the only goal. Accurracy is also important.


I agree if you want to make a player just for listening, but for a game, speed is better, so if a 50khz high quality output runs at 40%, wouldn't a 25khz, not the best quality output be possible to run at 20% ?


The answer is simple as i already explained: no (with a standard (normal lenght) MOD and 1MB memory).

At 25 KHz, if you have the worst case pitch on the 4 voices, you will need to access memory for each refresh with addressing mode:
xx(An) or xx(An,Dn). This means an extra 4 or 8 cycles for each voice just to get the sample and emulate diferent pitches (sample speed playing (done via HW on Amiga)). This means 16 or 32 cycles more considering the 4 voices
At 31.x KHz or more, you have direct addressing like (An) or you even can use the previous value which means less CPU time needed. This is also done by Lance keeping the previous value in registers.
At 50 KHz in the worst case you only have to refresh every 31/50 = 62% of the times and that means a lot less CPU time needed especially if when mixing you keep the previous value in the data registers (Lance case) because there is no memory access to read.
For each refresh, you have to emulate the volume on each voice (0..64) done via HW on Amiga.
Either you use a lookup table and that means an extra memory addressing, you precompute every sample for each 65 volumes (huge memory requirements), or you cheat using Microwire like Lance reducing the resolution to 20 units non linear against 65 units linear on Amiga. Again this must be done for every refresh.

So for you to understand, if there was a 31 KHz DMA frequency on STE, the CPU time required would be similar to the one required at 50 KHz: max 40% with Lance routs.
Below 31 KHz, you will get IMEDIATLY an increase in the CPU time needed which will only be balanced by reducing the replay frequency which means reducing the number of refreshes.

25 Khz means 320 cycles to do:
- variable speed memory reading to simulate pitches on 4 voices;
- emulating volume;
- mixing the data to 2 seperate stereo DMA buffers;
If you want to use only 20% of the CPU time, it means 20%*320 = 64 cycles that means 16 cycles per voice !!!!!!
A simple move xx(An),Dn takes 12 cycles
Next a move Dz,(Az) to the DMA buffer takes 8 cycles => 12 + 8 = 20 !
And you had no mixing (adds and no volume control).

Now a new example:
move xx(a0),d0
add xx(a1),d0
move d0,(a4)
move xx(a2),d1
add xx(a3),d1
move d1,(a5)
We have: 12+12+8+12+12+8 = 64 cycles so we are already at the limit.

But there is still a problem: you have to update the offsets (xx) and you still do not have volume control.
The offsets are the biggest problem: self modified code (and that means an extra memory access like move dn to xx(An)) or a huge precomputed code table to have every possible pitch combination on all voices or a special cheating case i will not describe here but that still needs some processor time.

So, again, the answer to your question is no. The CPU clock advantage of the STE can NOT balance the Amiga HW in replaying MODs.

And by the way, a cheated replay at 50 KHz can sound sometimes worse than a 25 KHz or 16.7 KHz accurate replay.

But there is nothing like trying so why don't you try it ?

Paulo.

Zamuel_a
Atari God
Atari God
Posts: 1223
Joined: Wed Dec 19, 2007 8:36 pm
Location: Sweden

Re: Audio vs Amiga

Postby Zamuel_a » Fri Jul 20, 2012 11:32 am

Thanks for the explanation :D I have never programmed anything when it comes to MOD playing or similar so I don't know to much in that area. What could be done if memory isn't a problem? On an STE today you could always count that you have 4Mb of RAM.
ST / STFM / STE / Mega STE / Falcon / TT030 / Portfolio / 2600 / 7800 / Jaguar / 600xl / 130xe

User avatar
Eero Tamminen
Atari God
Atari God
Posts: 1718
Joined: Sun Jul 31, 2011 1:11 pm

Re: Audio vs Amiga

Postby Eero Tamminen » Fri Jul 20, 2012 1:58 pm

galvatron1983 wrote:Again looking at it from a non technical viewpoint, I just prefer how the "real life instrument" style of audio sounds, compared the chip tune style.

Sure a sampled segment of music might sound scratchy and low-res on an Amiga, but to me it still sounds better then the ST....


Some ST games supported MIDI (mostly adventure games that were available also on PC). And I had a synthetizer. MIDI output was much cleaner than some 8 bit samples. :-)

Zamuel_a
Atari God
Atari God
Posts: 1223
Joined: Wed Dec 19, 2007 8:36 pm
Location: Sweden

Re: Audio vs Amiga

Postby Zamuel_a » Fri Jul 20, 2012 2:20 pm

Some ST games supported MIDI (mostly adventure games that were available also on PC). And I had a synthetizer. MIDI output was much cleaner than some 8 bit samples


Yes nothing beats MIDI if you have a good syntheziser, hehe. I saw a clip in youtube once there Jack Tramiel promoted the ST when it came and the main way of it do produce sounds was over MIDI. The YM chip was just there to produce key click sounds and such simple stuff, not to make music.
ST / STFM / STE / Mega STE / Falcon / TT030 / Portfolio / 2600 / 7800 / Jaguar / 600xl / 130xe

User avatar
Stefan jL
Atari God
Atari God
Posts: 1259
Joined: Thu May 09, 2002 3:21 pm
Location: Sweden
Contact:

Re: Audio vs Amiga

Postby Stefan jL » Fri Jul 20, 2012 3:43 pm

Many midi modules are cheap these days :wink:

I did some recordings when i tested midi music on some early Atari ST games form the 1980s (thats when people explored the midi abilty of the ST, since then it is forgotten).
Most early ones had only generic midi support... like one channel (one sound) mono-timbral or 3-part multi-timbral.

Albedo has generic 3-part multi-timbral midi support, as well as specific support for Casio CZ101 synth.

This is how Albedo plays with midi music: http://www.youtube.com/watch?v=yG04A43Ce-U and as my midi module has A/D input so could i add reverb and chorus to the ST soundeffects. I think the result is good even if this was the generic midi option in the game.

I wish for new midi music (demo, games) productions to be released.
What is the biggest reason that prevents new productions to have midi music? the lack of standard midi module to be used? or just knowledge in midi programming on the ST?
Image

User avatar
simonsunnyboy
Moderator
Moderator
Posts: 5006
Joined: Wed Oct 23, 2002 4:36 pm
Location: Friedrichshafen, Germany
Contact:

Re: Audio vs Amiga

Postby simonsunnyboy » Fri Jul 20, 2012 3:47 pm

Probably that most ordinary users had no MIDI equipment at their hands and would not invest into them if they were not planning to become musicians?
Simon Sunnyboy/Paradize - http://paradize.atari.org/

Stay cool, stay Atari!

1x2600jr, 1x1040STFm, 1x1040STE 4MB+TOS2.06+SatanDisk, 1xF030 14MB+FPU+NetUS-Bee

User avatar
Stefan jL
Atari God
Atari God
Posts: 1259
Joined: Thu May 09, 2002 3:21 pm
Location: Sweden
Contact:

Re: Audio vs Amiga

Postby Stefan jL » Fri Jul 20, 2012 4:19 pm

simonsunnyboy wrote:Probably that most ordinary users had no MIDI equipment at their hands and would not invest into them if they were not planning to become musicians?


Was that an answer to the last question in my post?
Midi equipment is much more cheap these days... the older ones that is.
Image

User avatar
ljbk
Atari Super Hero
Atari Super Hero
Posts: 514
Joined: Thu Feb 19, 2004 4:37 pm
Location: Estoril, Portugal

Re: Audio vs Amiga

Postby ljbk » Fri Jul 20, 2012 4:52 pm

Hi !

For the ones that might be interested here is the worst case pitch combination example mod (with 4 voices) to test your favourite module player (or demo screen with it) on STE/F.

Each voice plays a string (loop) type sample with a B note of the 3rd octave.
We could have even some more special effects like volume slide or something else, but these are just some peanuts more.
The Player (using Lance routs) "struggles" with this using something between 40% and 50% CPU.

The best case scenario is a C note of the 1st octave on each of the 4 voices or to have the voices off :) .


Enjoy your tests (not the sound :) ),
Paulo.
You do not have the required permissions to view the files attached to this post.

Zamuel_a
Atari God
Atari God
Posts: 1223
Joined: Wed Dec 19, 2007 8:36 pm
Location: Sweden

Re: Audio vs Amiga

Postby Zamuel_a » Fri Jul 20, 2012 6:03 pm

Would it be possible to make a new "MOD" format just for Atari that could be handled differently and maybe without time consuming effects. Something just for games there you need high speed and maybe not all kinds of effects.
ST / STFM / STE / Mega STE / Falcon / TT030 / Portfolio / 2600 / 7800 / Jaguar / 600xl / 130xe

mc6809e
Captain Atari
Captain Atari
Posts: 159
Joined: Sun Jan 29, 2012 10:22 pm

Re: Audio vs Amiga

Postby mc6809e » Fri Jul 20, 2012 7:46 pm

Zamuel_a wrote:Would it be possible to make a new "MOD" format just for Atari that could be handled differently and maybe without time consuming effects. Something just for games there you need high speed and maybe not all kinds of effects.


Special effects don't consume much time. Reading samples, mixing them, and then storing the result into outputs buffers consumes most of the time and those operations are required at a minimum to produce a reasonable output.

While the ST runs at 8MHz and the Amiga at 7.09 MHz, that still only gives the ST seven extra CPU cycles per sample to do the minimum. Seven cycles isn't even enough to fetch one sample from one waveform, never mind applying effects.

There's no magic code out there, Zamuel.

User avatar
ljbk
Atari Super Hero
Atari Super Hero
Posts: 514
Joined: Thu Feb 19, 2004 4:37 pm
Location: Estoril, Portugal

Re: Audio vs Amiga

Postby ljbk » Fri Jul 20, 2012 7:52 pm

Zamuel_a wrote:Would it be possible to make a new "MOD" format just for Atari that could be handled differently and maybe without time consuming effects. Something just for games there you need high speed and maybe not all kinds of effects.


Most demos and game intros using MOD type music on the STF had their own player and format cutting especially on volume control and number of voices: TCB screens, TLB screens, Baal, Quartet MODs, ...
You can also save time by using more 1st and 2nd octave during music composition and less the 3rd octave or select/compose a MOD with much bass/ low frequency sounds or hard rock instruments instead of high frequency cristal clear instruments so that the whole thing will sound better even if you have to reduce the mixing speed and replay.
But regarding the mod format and effects, volume control is the main problem.
The rest of the effects which mainly act on frequency and flow control are peanuts.

That format handling can also be reduced to almost 0, like it is done in YM50K using a "pre-play" technique which requires a few hundred kilobytes of memory depending on the MOD playing length. This allowed me to push my 100% CPU time consuming player from the 40KHz made in the 90s to YM50K made at the end of 2004: 50 KHz for 95% of the MODs on STF and 47 KHz for all (that part is not included in the player).

Paulo.

Zamuel_a
Atari God
Atari God
Posts: 1223
Joined: Wed Dec 19, 2007 8:36 pm
Location: Sweden

Re: Audio vs Amiga

Postby Zamuel_a » Fri Jul 20, 2012 8:02 pm

would it save alot of time of instead of mixing the samples the normal way by adding them together, just mix them so that the bytes from one sample gets the even bytes and the other sample the odd bytes, so that channel 1 get's even bytes on left , channel 2, odd bytes on left, channel 3, even bytes on right, channel 4, odd bytes on right. You need to run it at 50khz to get 25khz output but if mixing it this way is faster than a normal 25khz routine it had been interessting.
ST / STFM / STE / Mega STE / Falcon / TT030 / Portfolio / 2600 / 7800 / Jaguar / 600xl / 130xe

User avatar
ljbk
Atari Super Hero
Atari Super Hero
Posts: 514
Joined: Thu Feb 19, 2004 4:37 pm
Location: Estoril, Portugal

Re: Audio vs Amiga

Postby ljbk » Fri Jul 20, 2012 10:22 pm

Zamuel_a wrote:would it save alot of time of instead of mixing the samples the normal way by adding them together, just mix them so that the bytes from one sample gets the even bytes and the other sample the odd bytes, so that channel 1 get's even bytes on left , channel 2, odd bytes on left, channel 3, even bytes on right, channel 4, odd bytes on right. You need to run it at 50khz to get 25khz output but if mixing it this way is faster than a normal 25khz routine it had been interessting.


That is called "multiplexing" and that's an old cheating trick even available in Protracker STE but you can "ear" clearly the difference with a non-multiplexed replay and in that case 50 KHz DMA is mandatory.

By the way that interleaved byte DMA buffer used by the STE DMA in stereo does not help at all when storing the mixing results with normal adding: ... left_byte, right_byte, left_byte, right_byte, left_byte, ...

Zamuel_a
Atari God
Atari God
Posts: 1223
Joined: Wed Dec 19, 2007 8:36 pm
Location: Sweden

Re: Audio vs Amiga

Postby Zamuel_a » Fri Jul 20, 2012 11:06 pm

Can you gain speed by multiplex it instead of a regular mixer routine? You would also be able to have 8 bit samples that can be "mixed" directly instead of 7 bits (if you don't want overflow).
ST / STFM / STE / Mega STE / Falcon / TT030 / Portfolio / 2600 / 7800 / Jaguar / 600xl / 130xe

FedePede04
Atari God
Atari God
Posts: 1025
Joined: Fri Feb 04, 2011 12:14 am
Location: Denmark
Contact:

Re: Audio vs Amiga

Postby FedePede04 » Sun Jul 22, 2012 6:33 am

a question ljbk.
you are using a timer interrupt to play the samples on the STFM or are you use an other method.
Atari will rule the world, long after man has disappeared

sometime my English is a little weird, Google translate is my best friend :)

User avatar
ljbk
Atari Super Hero
Atari Super Hero
Posts: 514
Joined: Thu Feb 19, 2004 4:37 pm
Location: Estoril, Portugal

Re: Audio vs Amiga

Postby ljbk » Mon Jul 23, 2012 7:26 am

FedePede04 wrote:a question ljbk.
you are using a timer interrupt to play the samples on the STFM or are you use an other method.


Hi Peter !

The answer is:
- Hextracker mode with variable frequency controled by user => interrupt replay rout "replacing" the DMA and remaining CPU time and registers left to the user(you can check the available replay source in the Hextracker package);
- 100% CPU mode like YM50K => no interrupt => around 64 cycles less per refresh to save and restore context by the CPU: interrupt start + rte;
- STE/Falcon => no interrupt needed;

Bye,
Paulo.

FedePede04
Atari God
Atari God
Posts: 1025
Joined: Fri Feb 04, 2011 12:14 am
Location: Denmark
Contact:

Re: Audio vs Amiga

Postby FedePede04 » Mon Jul 23, 2012 8:47 am

ljbk wrote:
FedePede04 wrote:a question ljbk.
you are using a timer interrupt to play the samples on the STFM or are you use an other method.


Hi Peter !

The answer is:
- Hextracker mode with variable frequency controled by user => interrupt replay rout "replacing" the DMA and remaining CPU time and registers left to the user(you can check the available replay source in the Hextracker package);
- 100% CPU mode like YM50K => no interrupt => around 64 cycles less per refresh to save and restore context by the CPU: interrupt start + rte;
- STE/Falcon => no interrupt needed;

Bye,
Paulo.


Thanks Paulo.
i could not remember how many cycles it took excrute an interrup, (to many years since)


i don't know if it would be possible to use a interrup less player in a game
but if you use one with a timer interrup, and the sample rate 15khz when you will use 19200 cycles each vblank just to start and return from the interrup.

i don't know how many cycles that the ST have at every vblank, but you have to subtract it, from the 10% that the ST is faster that the Amiga. just to make samples.
Atari will rule the world, long after man has disappeared

sometime my English is a little weird, Google translate is my best friend :)

User avatar
ljbk
Atari Super Hero
Atari Super Hero
Posts: 514
Joined: Thu Feb 19, 2004 4:37 pm
Location: Estoril, Portugal

Re: Audio vs Amiga

Postby ljbk » Mon Jul 23, 2012 9:27 am

FedePede04 wrote:
ljbk wrote:
FedePede04 wrote:a question ljbk.
you are using a timer interrupt to play the samples on the STFM or are you use an other method.


Hi Peter !

The answer is:
- Hextracker mode with variable frequency controled by user => interrupt replay rout "replacing" the DMA and remaining CPU time and registers left to the user(you can check the available replay source in the Hextracker package);
- 100% CPU mode like YM50K => no interrupt => around 64 cycles less per refresh to save and restore context by the CPU: interrupt start + rte;
- STE/Falcon => no interrupt needed;

Bye,
Paulo.


Thanks Paulo.
i could not remember how many cycles it took excrute an interrup, (to many years since)


i don't know if it would be possible to use a interrup less player in a game
but if you you one with a timer interrup, and the sample rate 15khz when you will use 19200 cycles each vblank just to start and return from the interrup.

i don't know how many cycles that the ST have at every vblank, but you have to subtract it, from the 10% that the ST is faster that the Amiga. just to make samples.



An interrupt less program for ST MOD replay is a dificult program to build because you have to ensure that every update to the YM soundchip is done in a regular way, which means that you have to count the cycles. If you have an update that takes 72 cycles like mine and you have a 15 KHz replay (every 512 cycles), then you have to ensure that the code between each update is around 440 cycles.
Part of those 440 cycles have to be used for mixing and that will take nearly 30% of CPU time at 15 KHz.
You can also have a screen with part interrupt and part without interrupt (if you have a acreen with no left and no right border for example).
But these are always "special" screens.
As for a game, you would need to prepare ALL the run-time code to be interleaved by YM refreshs. Either you have a simple code or this is a HUGE job.
It is like a game in fullscreen: i only have seen one (breakout type) in a polish demo. But there you still have around 40 scan lines for non-timed code.
So as a resume, one thing is a mad-code demo screen like this one (http://pouet.net/prod.php?which=57266 (YM update every 384 cycles + 6 sync switches every 512 cycles + misc code interleaved) another is a game, where something like a interrupt 10 KHz replay is a more realistic option.

This demo (http://www.pouet.net/prod.php?which=1251) might be possible on STF with Hextracker 10 KHz replay on STF as it runs on STE with Lance routs.
You just have to convince Leonard to do the job :) !


Cheers,
Paulo.

FedePede04
Atari God
Atari God
Posts: 1025
Joined: Fri Feb 04, 2011 12:14 am
Location: Denmark
Contact:

Re: Audio vs Amiga

Postby FedePede04 » Mon Jul 23, 2012 10:22 am

ljbk wrote:An interrupt less program for ST MOD replay is a dificult program to build because you have to ensure that every update to the YM soundchip is done in a regular way, which means that you have to count the cycles. If you have an update that takes 72 cycles like mine and you have a 15 KHz replay (every 512 cycles), then you have to ensure that the code between each update is around 440 cycles.
Part of those 440 cycles have to be used for mixing and that will take nearly 30% of CPU time at 15 KHz.
You can also have a screen with part interrupt and part without interrupt (if you have a acreen with no left and no right border for example).
But these are always "special" screens.
As for a game, you would need to prepare ALL the run-time code to be interleaved by YM refreshs. Either you have a simple code or this is a HUGE job.
It is like a game in fullscreen: i only have seen one (breakout type) in a polish demo. But there you still have around 40 scan lines for non-timed code.
So as a resume, one thing is a mad-code demo screen like this one (http://pouet.net/prod.php?which=57266 (YM update every 384 cycles + 6 sync switches every 512 cycles + misc code interleaved) another is a game, where something like a interrupt 10 KHz replay is a more realistic option.

This demo (http://www.pouet.net/prod.php?which=1251) might be possible on STF with Hextracker 10 KHz replay on STF as it runs on STE with Lance routs.
You just have to convince Leonard to do the job :) !


Cheers,
Paulo.


Hi.
it was also more to illustrate, that the 10% speed advantage the ST have, is gone fast. :)

btw. i ask this in a other post, but no one answer, maybe you know it.
i am playing a little with a sample playing routine.
right now i am pop-pushing 2 addr reg and one data reg to the stack.
do you know if there are some of the data/addr reg that the TOS does not alter, so i can use permanent, and save 3 push/pop

Cheers
Peter
Atari will rule the world, long after man has disappeared

sometime my English is a little weird, Google translate is my best friend :)

User avatar
Chrischzz
Atariator
Atariator
Posts: 25
Joined: Wed Jan 18, 2012 10:33 am

Re: Audio vs Amiga

Postby Chrischzz » Mon Jul 23, 2012 10:40 am

I think the ST sound has always been underestimated. Or misunderstood..

Most games/demo's do have more "charme' because of the chipsound I think.

User avatar
ljbk
Atari Super Hero
Atari Super Hero
Posts: 514
Joined: Thu Feb 19, 2004 4:37 pm
Location: Estoril, Portugal

Re: Audio vs Amiga

Postby ljbk » Mon Jul 23, 2012 12:56 pm

FedePede04 wrote:Hi.
it was also more to illustrate, that the 10% speed advantage the ST have, is gone fast. :)

btw. i ask this in a other post, but no one answer, maybe you know it.
i am playing a little with a sample playing routine.
right now i am pop-pushing 2 addr reg and one data reg to the stack.
do you know if there are some of the data/addr reg that the TOS does not alter, so i can use permanent, and save 3 push/pop

Cheers
Peter


Hi !

I never took such a risk of using registers without saving them for TOS.
First, you have to take care about quite a few different versions of TOS and about a few different parts of the system you might want to allow to be used. Most STF digital players reserved registers for their own usage and the less number they reserve, the slower the rout would be because you need to save and restore them.
Regarding TOS, you have to check the routines of the parts of the system you want to allow:
- 200 Hz system timer (MFP timer C or D as far as i can remember) routine;
- DMA finished timer (MFP timer A) routine;
- System VBL;
- Gemdos calls trap #1;
- Gem calls trap #2;
- Bios calls trap #13;
- Xbios calls trap #14;
- Exceptions handling;
If you start cutting the registers that are used for the cases you want to allow, you will find out quickly what's left :) ...
Registers that i am sure are used:
- A6 => C languange parameter passing for sub-routs with link unlk
- A0/D0 => default work registers
The less used registers are probably: D3..D6 and A3/A4 just by having a look at the bios and xbios code.
It is possible that USP was not used as the TOS would work on Supervisor mode but i would not risk it.

Regarding the ST 10% advantage over the Amiga in CPU speed, i think that our friend meant STE so in that case we need no interrupts.
But the best usage for this in games was to have some palette changing during the frame (that Amiga has from free with Copper) and some timer effects for chip sound like SID or digi-drums. If you consider around 160 cycles per interrupt (to save and restore context, registers and do what is required) which means 1% CPU, you could have about 10 of those per frame a leave around the same CPU power and CPU registers for the game as the Amiga. And this was done for a big part of the well programmed games on ST.


Paulo.

User avatar
Frank B
Atari Super Hero
Atari Super Hero
Posts: 962
Joined: Wed Jan 04, 2006 1:28 am
Location: Boston

Re: Audio vs Amiga

Postby Frank B » Mon Jul 23, 2012 8:37 pm

Is the volume control just a lookup per sample? If it's a lot of sample lookups to boost the volume the blitter could be used with two four bit look up tables and a two pass smudge mode blit per sample. It would be 20 cycles per byte overhead. If it is a lot of data that might speed things up a little.

FedePede04
Atari God
Atari God
Posts: 1025
Joined: Fri Feb 04, 2011 12:14 am
Location: Denmark
Contact:

Re: Audio vs Amiga

Postby FedePede04 » Mon Jul 23, 2012 9:21 pm

ljbk wrote:
FedePede04 wrote:Hi.
it was also more to illustrate, that the 10% speed advantage the ST have, is gone fast. :)

btw. i ask this in a other post, but no one answer, maybe you know it.
i am playing a little with a sample playing routine.
right now i am pop-pushing 2 addr reg and one data reg to the stack.
do you know if there are some of the data/addr reg that the TOS does not alter, so i can use permanent, and save 3 push/pop

Cheers
Peter


Hi !

I never took such a risk of using registers without saving them for TOS.
First, you have to take care about quite a few different versions of TOS and about a few different parts of the system you might want to allow to be used. Most STF digital players reserved registers for their own usage and the less number they reserve, the slower the rout would be because you need to save and restore them.
Regarding TOS, you have to check the routines of the parts of the system you want to allow:
- 200 Hz system timer (MFP timer C or D as far as i can remember) routine;
- DMA finished timer (MFP timer A) routine;
- System VBL;
- Gemdos calls trap #1;
- Gem calls trap #2;
- Bios calls trap #13;
- Xbios calls trap #14;
- Exceptions handling;
If you start cutting the registers that are used for the cases you want to allow, you will find out quickly what's left :) ...
Registers that i am sure are used:
- A6 => C languange parameter passing for sub-routs with link unlk
- A0/D0 => default work registers
The less used registers are probably: D3..D6 and A3/A4 just by having a look at the bios and xbios code.
It is possible that USP was not used as the TOS would work on Supervisor mode but i would not risk it.

Regarding the ST 10% advantage over the Amiga in CPU speed, i think that our friend meant STE so in that case we need no interrupts.
But the best usage for this in games was to have some palette changing during the frame (that Amiga has from free with Copper) and some timer effects for chip sound like SID or digi-drums. If you consider around 160 cycles per interrupt (to save and restore context, registers and do what is required) which means 1% CPU, you could have about 10 of those per frame a leave around the same CPU power and CPU registers for the game as the Amiga. And this was done for a big part of the well programmed games on ST.


Paulo.


hi Paulo.
many thanks for your help.
I thought maybe they had been smart, and not using all the data/addr regs, it could have been so nice, to have some clean registers.
i have and old abacus book (ST Atari Internals) and it have the TOS listed, so i had a look and it look like you are right regarding the registers, the A3/A4 looks pretty unused,
but it was only a brief look, so i will a take closer look when i got some more time.


i did a player way back where i did it with out pushing and poping,

i use d3,d4 and a4,a5 and i work fine, but i also never use any Tos functions, i just and compiled my code and run it,
but i know it can be done, i can always turn the interrupts off (stop the music) before i use the TOS functions, if i want to load a new pieces of music.
i could also have two playing routines, one with push and pop, and one with out. so instead of turning the music off, i could change the routine, and instead stop some gfx output or some other stuff.
but I am willing to sacrifice a couple of registry, to gain the additional clk cycles.

Cheers
Peter
Atari will rule the world, long after man has disappeared

sometime my English is a little weird, Google translate is my best friend :)

User avatar
ljbk
Atari Super Hero
Atari Super Hero
Posts: 514
Joined: Thu Feb 19, 2004 4:37 pm
Location: Estoril, Portugal

Re: Audio vs Amiga

Postby ljbk » Tue Jul 24, 2012 7:25 am

Hi Frank,

Volume control, done the accurate way, is a set of 65 tables, where a entering 8 bit sample byte will be converted into a 8bit result sample volumed byte.
For speed reasons the original samples resolution can be reduced to 7 bits and bit 0 set to 0 to have a word boundary access to those tables and get as a result a word instead of a byte.
Volume is not fixed for each sample and can change on the fly with values from 0 to 64 (HW values from Amiga).
If everything was to be pre-computed, then one would need 64 samples for each original sample (volume 0 could be spared). That would be a huge memory area.

Hi Peter,

The info i gave you about registers usage, was by looking fast at that book you refer (La Bible ST in french).
I forgot to refer Mouse, Keyboard and other device interrupts handling which have to be taken into account if you wish to keep them available.
Something you can do is to build a small program where you set the registers to specific values like $01234567 and after $FEDCBA98, do what you need with TOS/GEM and then you check the registers values to see which have changed and which have not.


Paulo.


Social Media

     

Return to “Games - General”

Who is online

Users browsing this forum: No registered users and 3 guests