fix(cpu): properly decode multiply instructions
This commit is contained in:
parent
a459d4b433
commit
dd632975f8
14
src/cpu.zig
14
src/cpu.zig
|
@ -449,13 +449,6 @@ fn armPopulate() [0x1000]ArmInstrFn {
|
||||||
lut[i] = psrTransfer(I, R, kind);
|
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) {
|
if (i == 0x121) {
|
||||||
lut[i] = branchAndExchange;
|
lut[i] = branchAndExchange;
|
||||||
}
|
}
|
||||||
|
@ -470,6 +463,13 @@ fn armPopulate() [0x1000]ArmInstrFn {
|
||||||
lut[i] = halfAndSignedDataTransfer(P, U, I, W, L);
|
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) {
|
if (i >> 10 & 0x3 == 0b01) {
|
||||||
const I = i >> 9 & 1 == 1;
|
const I = i >> 9 & 1 == 1;
|
||||||
const P = i >> 8 & 1 == 1;
|
const P = i >> 8 & 1 == 1;
|
||||||
|
|
|
@ -58,7 +58,7 @@ pub fn halfAndSignedDataTransfer(comptime P: bool, comptime U: bool, comptime I:
|
||||||
// STRH
|
// STRH
|
||||||
bus.write16(address, @truncate(u16, cpu.r[rd]));
|
bus.write16(address, @truncate(u16, cpu.r[rd]));
|
||||||
} else {
|
} 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});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue