feat(cpu): stub PSR Transfer instructions

This commit is contained in:
Rekai Nyangadzayi Musuka 2022-01-12 03:40:51 -04:00
parent 1c173eb4b8
commit 7531af7f2b
2 changed files with 22 additions and 0 deletions

View File

@ -8,6 +8,7 @@ const Bitfield = @import("bitfield").Bitfield;
const Scheduler = @import("scheduler.zig").Scheduler; const Scheduler = @import("scheduler.zig").Scheduler;
const dataProcessing = @import("cpu/data_processing.zig").dataProcessing; const dataProcessing = @import("cpu/data_processing.zig").dataProcessing;
const psrTransfer = @import("cpu/psr_transfer.zig").psrTransfer;
const singleDataTransfer = @import("cpu/single_data_transfer.zig").singleDataTransfer; const singleDataTransfer = @import("cpu/single_data_transfer.zig").singleDataTransfer;
const halfAndSignedDataTransfer = @import("cpu/half_signed_data_transfer.zig").halfAndSignedDataTransfer; const halfAndSignedDataTransfer = @import("cpu/half_signed_data_transfer.zig").halfAndSignedDataTransfer;
const blockDataTransfer = @import("cpu/block_data_transfer.zig").blockDataTransfer; const blockDataTransfer = @import("cpu/block_data_transfer.zig").blockDataTransfer;
@ -133,6 +134,14 @@ fn populate() [0x1000]InstrFn {
lut[i] = dataProcessing(I, S, instrKind); lut[i] = dataProcessing(I, S, instrKind);
} }
if (i >> 10 & 0x3 == 0b00 and i >> 7 & 0x3 == 0b10 and i >> 4 & 1 == 0) {
// PSR Transfer
const I = i >> 9 & 1 == 1;
const isSpsr = i >> 6 & 1 == 1;
lut[i] = psrTransfer(I, isSpsr);
}
if (i >> 9 & 0x7 == 0b000 and i >> 3 & 1 == 1 and i & 1 == 1) { if (i >> 9 & 0x7 == 0b000 and i >> 3 & 1 == 1 and i & 1 == 1) {
const P = i >> 8 & 1 == 1; const P = i >> 8 & 1 == 1;
const U = i >> 7 & 1 == 1; const U = i >> 7 & 1 == 1;

13
src/cpu/psr_transfer.zig Normal file
View File

@ -0,0 +1,13 @@
const std = @import("std");
const Bus = @import("../Bus.zig");
const Arm7tdmi = @import("../cpu.zig").Arm7tdmi;
const InstrFn = @import("../cpu.zig").InstrFn;
pub fn psrTransfer(comptime _: bool, comptime _: bool) InstrFn {
return struct {
fn inner(_: *Arm7tdmi, _: *Bus, _: u32) void {
std.debug.panic("[CPU] TODO: Implement PSR Transfer Instructions", .{});
}
}.inner;
}