feat(cpu): implement branch and exchange

If I want to continue with armwrestler, I'll have to implement
THUMB instructions now
This commit is contained in:
2022-10-21 05:11:56 -03:00
parent ff70aadfdb
commit 97b933d9ea
2 changed files with 15 additions and 1 deletions

View File

@@ -1,3 +1,4 @@
const std = @import("std");
const util = @import("../util.zig");
const Bus = @import("../Bus.zig");
@@ -16,3 +17,11 @@ pub fn branch(comptime L: bool) InstrFn {
}
}.inner;
}
pub fn branchAndExchange(cpu: *Arm7tdmi, _: *Bus, opcode: u32) void {
const rn = opcode & 0xF;
cpu.cpsr.t.write(cpu.r[rn] & 1 == 1);
// TODO: Is this how I should do it?
cpu.r[15] = cpu.r[rn] & 0xFFFF_FFFE;
}