|Re: [hatari-devel] Getting cycles used by previous or next instruction without modifying CPU state?|
[ Thread Index |
| More lists.tuxfamily.org/hatari-devel Archives
On 20/02/2012 23:50, Eero Tamminen wrote:
How do I get how many cycles previous instruction used, for
src/debug/profile.c has this code:
Uint32 opcode, cycles;
opcode = get_iword_prefetch (0);
cycles = (*cpufunctbl[opcode])(opcode) + nWaitStateCycles;
But that's bad, calling the opcode table function modifies
the CPU state.
I don't think you can get this easily. Only the current instruction
cycles are available.
Always saving current cycles in previous cycles before executing a new
opcode would be too costy.
If that's just for test purpose, you can add some kind of breakpoint
that would trigger on every instruction and then save the current cycles
in your own variable. But this would certainly slow down emulation a lot.