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

This commit is contained in:
Rekai Nyangadzayi Musuka 2022-01-12 06:16:16 -04:00
parent 74abd3df4d
commit 98c5803208
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)) { switch (@truncate(u3, opcode >> 16)) {
0b000 => { 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]; const right = if (I) std.math.rotr(u32, opcode & 0xFF, opcode >> 8 & 0xF) else cpu.r[rm];
if (isSpsr) { if (isSpsr) {
@ -42,6 +35,14 @@ pub fn psrTransfer(comptime I: bool, comptime isSpsr: bool) InstrFn {
cpu.cpsr.v.write(right >> 28 & 1 == 1); 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, else => unreachable,
} }
}, },