diff --git a/src/core/cpu.zig b/src/core/cpu.zig index bed522e..f2d1793 100644 --- a/src/core/cpu.zig +++ b/src/core/cpu.zig @@ -446,8 +446,7 @@ pub const Arm7tdmi = struct { } } - if (self.pipe.flushed) self.r[15] += if (self.cpsr.t.read()) 2 else @as(u32, 4); - self.r[15] += if (self.cpsr.t.read()) 2 else @as(u32, 4); + if (!self.pipe.flushed) self.r[15] += if (self.cpsr.t.read()) 2 else @as(u32, 4); self.pipe.flushed = false; } @@ -702,6 +701,8 @@ const Pipline = struct { self.stage[0] = cpu.bus.read(T, cpu.r[15]); self.stage[1] = cpu.bus.read(T, cpu.r[15] + if (T == u32) 4 else @as(u32, 2)); + + cpu.r[15] += if (T == u32) 8 else @as(u32, 4); self.flushed = true; } };