From e30df212d6a5ec5f60a8b1d52e491e32fe6a4572 Mon Sep 17 00:00:00 2001 From: crecher Date: Mon, 12 Oct 2026 04:40:11 +0200 Subject: cpu: add JAM instructions --- cpu/cpu.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'cpu/cpu.go') diff --git a/cpu/cpu.go b/cpu/cpu.go index 79199a2..fb673b7 100644 --- a/cpu/cpu.go +++ b/cpu/cpu.go @@ -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) -- cgit v1.2.3