Re: [hatari-devel] Many changes to MFP

[ Thread Index | Date Index | More Archives ]

On 14/03/2013 09:46, Eero Tamminen wrote:

I'm counting the time as: <spent cycles> / MachineClocks.CPU_Freq.

Spent cycles are counted with:
         if (bDspEnabled) {
                 cycles = Cycles_GetCounter(CYCLES_COUNTER_CPU);
         } else {
                 Uint32 newcycles = Cycles_GetCounter(CYCLES_COUNTER_CPU);
                 cycles = newcycles - cpu_profile.prev_cycles;
                 cpu_profile.prev_cycles = newcycles;

Any idea why that could be so wrong for TT emulation?

For now, MachineClocks.CPU_Freq is not really used, it's just informative. You also need to check if cpu freq is 8,16 or 32 (using the >> operator to divide cycles by 2 or 4). No clean solution for now, it can be solved latter as it doesn't impact emulation itself. Add a special case for the TT if you need in your code.

	- Eero

PS. why the cycles counters are ints, instead of unsigned?

Because those counter (as they're used today) will never reach the max of an int, they're usually reset before :) That's historical, I think anyway they should be dropped at some point and use CyclesGlobalClockCounter instead.


Mail converted by MHonArc 2.6.19+