feat: pass arm.gba

This commit is contained in:
Rekai Nyangadzayi Musuka 2022-02-06 05:06:25 -04:00
parent fcde905ae1
commit 225c0f7d55
1 changed files with 11 additions and 4 deletions

View File

@ -48,10 +48,17 @@ pub fn blockDataTransfer(comptime P: bool, comptime U: bool, comptime S: bool, c
var address = start; var address = start;
if (rlist == 0) { if (rlist == 0) {
if (L) { var pc_addr = cpu.r[rn];
cpu.r[15] = bus.read32(address); if (U) {
pc_addr += if (P) 4 else 0;
} else { } else {
bus.write32(address, cpu.r[15] + 8); pc_addr -= 0x40 - if (!P) 4 else 0;
}
if (L) {
cpu.r[15] = bus.read32(pc_addr);
} else {
bus.write32(pc_addr, cpu.r[15] + 8);
} }
cpu.r[rn] = if (U) cpu.r[rn] + 0x40 else cpu.r[rn] - 0x40; cpu.r[rn] = if (U) cpu.r[rn] + 0x40 else cpu.r[rn] - 0x40;
@ -71,7 +78,7 @@ pub fn blockDataTransfer(comptime P: bool, comptime U: bool, comptime S: bool, c
} }
} }
if (W and L and opcode >> rn & 1 == 0) cpu.r[rn] = new_base; if (W and L and rlist >> rn & 1 == 0) cpu.r[rn] = new_base;
} }
fn transfer(cpu: *Arm7tdmi, bus: *Bus, r15_present: bool, i: u5, address: u32) void { fn transfer(cpu: *Arm7tdmi, bus: *Bus, r15_present: bool, i: u5, address: u32) void {