feat(cpu): implement format 18 THUMB instructions
This commit is contained in:
parent
c5681d5d75
commit
46b404ebd5
|
@ -33,6 +33,7 @@ const format13 = @import("cpu/thumb/format13.zig").format13;
|
||||||
const format14 = @import("cpu/thumb/format14.zig").format14;
|
const format14 = @import("cpu/thumb/format14.zig").format14;
|
||||||
const format15 = @import("cpu/thumb/format15.zig").format15;
|
const format15 = @import("cpu/thumb/format15.zig").format15;
|
||||||
const format16 = @import("cpu/thumb/format16.zig").format16;
|
const format16 = @import("cpu/thumb/format16.zig").format16;
|
||||||
|
const format18 = @import("cpu/thumb/format18.zig").format18;
|
||||||
const format19 = @import("cpu/thumb/format19.zig").format19;
|
const format19 = @import("cpu/thumb/format19.zig").format19;
|
||||||
|
|
||||||
pub const ArmInstrFn = fn (*Arm7tdmi, *Bus, u32) void;
|
pub const ArmInstrFn = fn (*Arm7tdmi, *Bus, u32) void;
|
||||||
|
@ -452,6 +453,10 @@ fn thumbPopulate() [0x400]ThumbInstrFn {
|
||||||
lut[i] = format16(cond);
|
lut[i] = format16(cond);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (i >> 5 & 0x1F == 0b11100) {
|
||||||
|
lut[i] = format18();
|
||||||
|
}
|
||||||
|
|
||||||
if (i >> 6 & 0xF == 0b1111) {
|
if (i >> 6 & 0xF == 0b1111) {
|
||||||
const is_low = i >> 5 & 1 == 1;
|
const is_low = i >> 5 & 1 == 1;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
const std = @import("std");
|
||||||
|
|
||||||
|
const Bus = @import("../../Bus.zig");
|
||||||
|
const Arm7tdmi = @import("../../cpu.zig").Arm7tdmi;
|
||||||
|
const InstrFn = @import("../../cpu.zig").ThumbInstrFn;
|
||||||
|
const u32SignExtend = @import("../../util.zig").u32SignExtend;
|
||||||
|
|
||||||
|
pub fn format18() InstrFn {
|
||||||
|
return struct {
|
||||||
|
fn inner(cpu: *Arm7tdmi, _: *Bus, opcode: u16) void {
|
||||||
|
const offset = u32SignExtend(11, opcode & 0x7FF) << 1;
|
||||||
|
cpu.r[15] = (cpu.r[15] + 2) +% offset;
|
||||||
|
}
|
||||||
|
}.inner;
|
||||||
|
}
|
Loading…
Reference in New Issue