diff options
Diffstat (limited to 'cpu/cpu.go')
| -rw-r--r-- | cpu/cpu.go | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -16,6 +16,7 @@ type CPU struct { Bus Bus Cycles uint64 + Jammed bool extraCycles int } @@ -65,9 +66,13 @@ func (c *CPU) Reset() { c.Status = FlagU | FlagI c.PC = c.read16(vectorReset) c.Cycles = 7 + c.Jammed = false } func (c *CPU) IRQ() { + if c.Jammed { + return + } if c.flag(FlagI) { return } @@ -76,6 +81,9 @@ func (c *CPU) IRQ() { } func (c *CPU) NMI() { + if c.Jammed { + return + } c.interrupt(vectorNMI, false) c.Cycles += 7 } @@ -94,6 +102,10 @@ func (c *CPU) interrupt(vector uint16, brk bool) { } func (c *CPU) Step() int { + if c.Jammed { + c.Cycles++ + return 1 + } before := c.Cycles opcode := c.read(c.PC) |