mirror of
https://github.com/irmen/ksim65.git
synced 2024-11-15 09:05:52 +00:00
cpu jump loop detection added
This commit is contained in:
parent
30351b44ba
commit
c327c59c8b
@ -245,6 +245,10 @@ class C64Machine(title: String) : IVirtualMachine {
|
||||
// this should result in ~1 Mhz cpu speed
|
||||
val timer = java.util.Timer("cpu-cycle", true)
|
||||
timer.scheduleAtFixedRate(0, 1000L/VicII.framerate) {
|
||||
// if(cpu.isLooping) {
|
||||
// // cpu is jump looping, could do some sleeping here perhaps
|
||||
// // but should still consider irqs occurring in the meantime...
|
||||
// }
|
||||
if (!paused) {
|
||||
try {
|
||||
while (vic.vsync) step()
|
||||
|
@ -98,6 +98,11 @@ open class Cpu6502 : BusComponent() {
|
||||
protected set
|
||||
var instrCycles: Int = 0
|
||||
protected set
|
||||
val isLooping: Boolean get() {
|
||||
// jump loop detection
|
||||
return (previousOpcodeAddress == currentOpcodeAddress) && !(pendingNMI || pendingIRQ)
|
||||
}
|
||||
private var previousOpcodeAddress: Address = 0xffff
|
||||
|
||||
lateinit var currentInstruction: Instruction
|
||||
|
||||
@ -263,6 +268,7 @@ open class Cpu6502 : BusComponent() {
|
||||
}
|
||||
|
||||
// no interrupt, fetch next instruction from memory
|
||||
previousOpcodeAddress = currentOpcodeAddress
|
||||
currentOpcodeAddress = regPC
|
||||
currentOpcode = read(regPC)
|
||||
currentInstruction = instructions[currentOpcode]
|
||||
|
Loading…
Reference in New Issue
Block a user