From 98c5803208ba2ecb17a3df5fb8b111f4b58804c3 Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Wed, 12 Jan 2022 06:16:16 -0400 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, } },