Working with CPU cycles in Gameboy Advance
- by Preston Sexton
I am working on an GBA emulator and stuck at implementing CPU cycles.
I just know the basic knowledge about it, each instruction of ARM and
THUMB mode as each different set of cycles for each instructions.
Currently I am simply saying every ARM instructions cost 4 cycles and
THUMB instructions cost 2 cycles. But how do you implement it like the
CPU documentation says? Does instruction cycles vary depending on which
section of the memory it's currently accessing to?
http://nocash.emubase.de/gbatek.htm#cpuinstructioncycletimes
According to the above specification, it says different memory areas have
different waitstates but I don't know what it exactly mean. Furthermore,
what are Non-sequential cycle, Sequential cycle, Internal Cycle, Coprocessor Cycle for?
I saw in some GBA source code that they are using PC to figure out how many cycles each
instruction takes to complete, but how are they doing it?