fix(cpu): properly decode multiply instructions

This commit is contained in:
Rekai Nyangadzayi Musuka 2022-10-21 05:12:07 -03:00
parent 0778ee8dd7
commit e1fec48a0e
2 changed files with 8 additions and 8 deletions

View File

@ -449,13 +449,6 @@ fn armPopulate() [0x1000]ArmInstrFn {
lut[i] = psrTransfer(I, R, kind);
}
if (i >> 6 & 0x3F == 0b000000 and i & 0xF == 0b1001) {
const A = i >> 5 & 1 == 1;
const S = i >> 4 & 1 == 1;
lut[i] = multiply(A, S);
}
if (i == 0x121) {
lut[i] = branchAndExchange;
}
@ -470,6 +463,13 @@ fn armPopulate() [0x1000]ArmInstrFn {
lut[i] = halfAndSignedDataTransfer(P, U, I, W, L);
}
if (i >> 6 & 0x3F == 0b000000 and i & 0xF == 0b1001) {
const A = i >> 5 & 1 == 1;
const S = i >> 4 & 1 == 1;
lut[i] = multiply(A, S);
}
if (i >> 10 & 0x3 == 0b01) {
const I = i >> 9 & 1 == 1;
const P = i >> 8 & 1 == 1;

View File

@ -58,7 +58,7 @@ pub fn halfAndSignedDataTransfer(comptime P: bool, comptime U: bool, comptime I:
// STRH
bus.write16(address, @truncate(u16, cpu.r[rd]));
} else {
std.debug.panic("[CPU] TODO: Figure out if this is also SWP", .{});
std.debug.print("[CPU|ARM|SignedDataTransfer] {X:0>8} was improperly decoded", .{opcode});
}
}