chore: stub TST

This commit is contained in:
Rekai Nyangadzayi Musuka 2022-10-21 05:11:48 -03:00
parent 44424e0687
commit bff9be03cc
1 changed files with 8 additions and 4 deletions

View File

@ -25,6 +25,10 @@ pub fn comptimeDataProcessing(comptime I: bool, comptime S: bool, comptime instr
if (S) std.debug.panic("[CPU] TODO: implement ADD condition codes", .{}); if (S) std.debug.panic("[CPU] TODO: implement ADD condition codes", .{});
}, },
0x8 => {
// TST
std.debug.panic("[CPU] TODO: implement TST, also figure out barrel shifter flags\n", .{});
},
0xD => { 0xD => {
// MOV // MOV
cpu.r[rd] = op2; cpu.r[rd] = op2;
@ -34,14 +38,14 @@ pub fn comptimeDataProcessing(comptime I: bool, comptime S: bool, comptime instr
0xA => { 0xA => {
// CMP // CMP
const op1_val = cpu.r[op1]; const op1_val = cpu.r[op1];
const v_ctx = (op1_val >> 31 == 0x01) or (op2 >> 31 == 0x01); const v_ctx = (op1_val >> 31 == 1) or (op2 >> 31 == 1);
const result = op1_val -% op2; const result = op1_val -% op2;
cpu.cpsr.n.write(result >> 31 & 0x01 == 0x01); cpu.cpsr.n.write(result >> 31 & 1 == 1);
cpu.cpsr.z.write(result == 0x00); cpu.cpsr.z.write(result == 0);
cpu.cpsr.c.write(op2 <= op1_val); cpu.cpsr.c.write(op2 <= op1_val);
cpu.cpsr.v.write(v_ctx and (result >> 31 & 0x01 == 0x01)); cpu.cpsr.v.write(v_ctx and (result >> 31 & 1== 1));
}, },
else => std.debug.panic("[CPU] TODO: implement data processing type {}", .{instrKind}), else => std.debug.panic("[CPU] TODO: implement data processing type {}", .{instrKind}),
} }