From 780c717409cd38f33b55978a0883c69dde34c1d1 Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Fri, 21 Oct 2022 05:11:53 -0300 Subject: [PATCH] feat(cpu): implement TEQ --- src/cpu/data_processing.zig | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/cpu/data_processing.zig b/src/cpu/data_processing.zig index 0624daf..ac1218d 100644 --- a/src/cpu/data_processing.zig +++ b/src/cpu/data_processing.zig @@ -45,6 +45,15 @@ pub fn dataProcessing(comptime I: bool, comptime S: bool, comptime instrKind: u4 // Barrel Shifter should always calc CPSR C in TST if (!S) _ = BarrelShifter.exec(true, cpu, opcode); }, + 0x9 => { + // TEQ + const result = cpu.r[op1] ^ op2; + + cpu.cpsr.n.write(result >> 31 & 1 == 1); + cpu.cpsr.z.write(result == 0); + // Barrel Shifter should always calc CPSR C in TEQ + if (!S) _ = BarrelShifter.exec(true, cpu, opcode); + }, 0xD => { // MOV cpu.r[rd] = op2;