|Re: [hatari-devel] Falcon raster emulation|
[ Thread Index |
| More lists.tuxfamily.org/hatari-devel Archives
Le 12/12/2013 11:15, Douglas Little a écrit :
We don't want to reach cycle precision as on STF where it's required
to do fullscreen, having a interrupt on every raster should be
enough to improve a lot of things
I agree - the Falcon shouldn't be treated as a constant-time machine as
with the ST, since trying to program it that way would produce
unreliable results in the real world.
However I also think the CPU cycle speed is secondary to the system
clock structure - MFP, Videl and to an extent other bits.
The DSP is currently emulated with 'catchup' behaviour, subservient to
the CPU. I imagine it's not so easy to do this with the CPU itself -
especially if both Falcon and ST emulators are in the same design. But
something like that is probably a better structure for Falcon emulation..
It also more closely approximates what would happen if the CPU is
changed or accelerated.
The model common to all emlated machine is that the CPU clock is the
master clock, then other components' clock are derived from this clock
by applying a ratio.
For example, this would mean that when a CPU instruction take 8 cycles
to run, then you must run the DSP for 16 cycles (16 to 32 MHz ratio)
On the opposite, if the CPU runs for 1000 cycles, you must give the MFP
6.53 cycles (16 to 2.45 MHz ratio)
In the end, this should not give any noticeable difference to have the
cpu clock as the master clock, because in nearly all cases it the cpu
that drives the computer.
So, even on real machine, if one cpu instruction last 20 cycles, you
have no way to know how the corresponding 40 cycles were spent in the
DSP. What really matters it that at the instruction level all components
complete their job in the required time.
If the CPU is changed or accelerated, you need to adjust the ratio, but
note that it would be the same if we had a global 32 MHz master clock.
16 MHz CPU would give a 1/2 ratio, 8 MHZ a 1/4 ratio and so on.
Eventually, you just manage ratio and associate a ratio to each
component (integer ones in most cases, but sometimes not)