fix(cpu): flip two branches in PSR Transfer execution

This commit is contained in:
Rekai Nyangadzayi Musuka 2022-10-21 05:11:55 -03:00
parent b9255bffe7
commit a21f94569f
1 changed files with 8 additions and 7 deletions

View File

@ -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_<current_mode> 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_<current_mode> is unimplemented", .{});
} else {
cpu.cpsr = .{ .raw = cpu.r[rm] };
}
},
else => unreachable,
}
},