From df3538caebef85dc26cfda90313a345a8b7dda6a Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Sat, 2 Jul 2022 03:15:26 -0300 Subject: [PATCH] fix: get beeg.gba working again --- src/cpu.zig | 1 + src/cpu/arm/data_processing.zig | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/cpu.zig b/src/cpu.zig index e0e2ed5..5536f87 100644 --- a/src/cpu.zig +++ b/src/cpu.zig @@ -241,6 +241,7 @@ pub const Arm7tdmi = struct { } self.cpsr.mode.write(@enumToInt(next)); + self.pipe.flush(); } pub fn fastBoot(self: *Self) void { diff --git a/src/cpu/arm/data_processing.zig b/src/cpu/arm/data_processing.zig index a2486d9..03480c0 100644 --- a/src/cpu/arm/data_processing.zig +++ b/src/cpu/arm/data_processing.zig @@ -13,6 +13,7 @@ pub fn dataProcessing(comptime I: bool, comptime S: bool, comptime instrKind: u4 const old_carry = @boolToInt(cpu.cpsr.c.read()); // If certain conditions are met, PC is 12 ahead instead of 8 + // TODO: What are these conditions? I can't remember if (!I and opcode >> 4 & 1 == 1) cpu.r[15] += 4; const op1 = if (rn == 0xF) cpu.fakePC() else cpu.r[rn]; @@ -127,6 +128,8 @@ pub fn dataProcessing(comptime I: bool, comptime S: bool, comptime instrKind: u4 setArmLogicOpFlags(S, cpu, rd, result); }, } + + if (rd == 0xF) cpu.pipe.flush(); } }.inner; }