Compare commits
No commits in common. "c9f0e1632c49b2a7a779c775291e99ef75384194" and "dee0e113d8398d89f06dbc51bcaab2b86e3eb7b8" have entirely different histories.
c9f0e1632c
...
dee0e113d8
|
@ -29,7 +29,7 @@ pub const Io = struct {
|
||||||
|
|
||||||
pub fn write16(self: *@This(), addr: u32, halfword: u16) void {
|
pub fn write16(self: *@This(), addr: u32, halfword: u16) void {
|
||||||
switch (addr) {
|
switch (addr) {
|
||||||
0x0400_0000 => self.dispcnt.val = halfword,
|
0x0400_000 => self.dispcnt.val = halfword,
|
||||||
else => std.debug.panic("[I/O:16] tried to write 0x{X:} to 0x{X:}", .{ halfword, addr }),
|
else => std.debug.panic("[I/O:16] tried to write 0x{X:} to 0x{X:}", .{ halfword, addr }),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,10 @@ pub fn comptimeHalfSignedDataTransfer(comptime P: bool, comptime U: bool, compti
|
||||||
} else {
|
} else {
|
||||||
if (opcode >> 5 & 0x01 == 0x01) {
|
if (opcode >> 5 & 0x01 == 0x01) {
|
||||||
// STRH
|
// STRH
|
||||||
bus.write16(address, @truncate(u16, cpu.r[rd]));
|
const src = @truncate(u16, cpu.r[rd]);
|
||||||
|
|
||||||
|
bus.write16(address + 2, src);
|
||||||
|
bus.write16(address, src);
|
||||||
} else {
|
} else {
|
||||||
std.debug.panic("[CPU] TODO: Figure out if this is also SWP", .{});
|
std.debug.panic("[CPU] TODO: Figure out if this is also SWP", .{});
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,11 +31,19 @@ pub fn comptimeSingleDataTransfer(comptime I: bool, comptime P: bool, comptime U
|
||||||
} else {
|
} else {
|
||||||
if (B) {
|
if (B) {
|
||||||
// STRB
|
// STRB
|
||||||
bus.write8(address, @truncate(u8, cpu.r[rd]));
|
const src = @truncate(u8, cpu.r[rd]);
|
||||||
|
|
||||||
|
bus.write8(address + 3, src);
|
||||||
|
bus.write8(address + 2, src);
|
||||||
|
bus.write8(address + 1, src);
|
||||||
|
bus.write8(address, src);
|
||||||
} else {
|
} else {
|
||||||
// STR
|
// STR
|
||||||
const force_aligned = address & 0xFFFF_FFFC;
|
|
||||||
bus.write32(force_aligned, cpu.r[rd]);
|
// FIXME: Is this right?
|
||||||
|
const src = cpu.r[rd];
|
||||||
|
const aligned_addr = address - (address % 4);
|
||||||
|
bus.write32(aligned_addr, src);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue