feat(cpu): implement format 13

While bugs do exist, at this point all THUMB and ARMv4 instructions
have been implemented! Yay!
This commit is contained in:
Rekai Nyangadzayi Musuka 2022-10-21 05:12:12 -03:00
parent e6a0eab667
commit af10c1b076
1 changed files with 4 additions and 3 deletions

View File

@ -4,10 +4,11 @@ const Bus = @import("../../Bus.zig");
const Arm7tdmi = @import("../../cpu.zig").Arm7tdmi;
const InstrFn = @import("../../cpu.zig").ThumbInstrFn;
pub fn format13(comptime _: bool) InstrFn {
pub fn format13(comptime S: bool) InstrFn {
return struct {
fn inner(cpu: *Arm7tdmi, _: *Bus, _: u16) void {
cpu.panic("[CPU|THUMB|Fmt13] Implement Format 13 THUMB Instructions", .{});
fn inner(cpu: *Arm7tdmi, _: *Bus, opcode: u16) void {
const offset = (opcode & 0x7F) << 2;
cpu.r[13] = if (S) cpu.r[13] - offset else cpu.r[13] + offset;
}
}.inner;
}