chore: account for empty rlist in THUMB LDM/STM
This commit is contained in:
parent
f63ae76931
commit
bf42d3ae2f
|
@ -51,12 +51,18 @@ pub fn format15(comptime L: bool, comptime rb: u3) InstrFn {
|
||||||
return struct {
|
return struct {
|
||||||
fn inner(cpu: *Arm7tdmi, bus: *Bus, opcode: u16) void {
|
fn inner(cpu: *Arm7tdmi, bus: *Bus, opcode: u16) void {
|
||||||
const base = cpu.r[rb];
|
const base = cpu.r[rb];
|
||||||
|
var address = base;
|
||||||
|
|
||||||
var address: u32 = base;
|
if (opcode & 0xFF == 0) {
|
||||||
|
// List is Empty
|
||||||
|
if (L) cpu.r[15] = bus.read32(address) else bus.write32(address, cpu.r[15]);
|
||||||
|
cpu.r[rb] += 0x40;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var i: usize = 0;
|
var i: u4 = 0;
|
||||||
while (i < 8) : (i += 1) {
|
while (i < 8) : (i += 1) {
|
||||||
if ((opcode >> @truncate(u3, i)) & 1 == 1) {
|
if (opcode >> i & 1 == 1) {
|
||||||
if (L) {
|
if (L) {
|
||||||
cpu.r[i] = bus.read32(address);
|
cpu.r[i] = bus.read32(address);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue