From a21f94569f9abc43e7737d704246ca105a62e153 Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Fri, 21 Oct 2022 05:11:55 -0300 Subject: [PATCH] fix(cpu): flip two branches in PSR Transfer execution --- src/cpu/psr_transfer.zig | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/cpu/psr_transfer.zig b/src/cpu/psr_transfer.zig index e080c8d..b080c6c 100644 --- a/src/cpu/psr_transfer.zig +++ b/src/cpu/psr_transfer.zig @@ -24,13 +24,6 @@ pub fn psrTransfer(comptime I: bool, comptime isSpsr: bool) InstrFn { switch (@truncate(u3, opcode >> 16)) { 0b000 => { - if (isSpsr) { - std.debug.panic("[CPU] TODO: MSR on SPSR_ is unimplemented", .{}); - } else { - cpu.cpsr = .{ .raw = cpu.r[rm] }; - } - }, - 0b001 => { const right = if (I) std.math.rotr(u32, opcode & 0xFF, opcode >> 8 & 0xF) else cpu.r[rm]; if (isSpsr) { @@ -42,6 +35,14 @@ pub fn psrTransfer(comptime I: bool, comptime isSpsr: bool) InstrFn { cpu.cpsr.v.write(right >> 28 & 1 == 1); } }, + 0b001 => { + if (isSpsr) { + std.debug.panic("[CPU] TODO: MSR on SPSR_ is unimplemented", .{}); + } else { + cpu.cpsr = .{ .raw = cpu.r[rm] }; + } + }, + else => unreachable, } },