chore: reimplement bus read/writes
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
const std = @import("std");
|
||||
|
||||
const Allocator = std.mem.Allocator;
|
||||
const log = std.log.scoped(.Bios);
|
||||
const Self = @This();
|
||||
|
||||
buf: ?[]u8,
|
||||
@@ -38,3 +39,8 @@ pub fn read(self: *const Self, comptime T: type, addr: usize) T {
|
||||
|
||||
std.debug.panic("[BIOS] ZBA tried to read {} from 0x{X:0>8} but not BIOS was present", .{ T, addr });
|
||||
}
|
||||
|
||||
pub fn write(_: *Self, comptime T: type, addr: usize, value: T) void {
|
||||
@setCold(true);
|
||||
log.err("Tried to write {} 0x{X:} to 0x{X:0>8} ", .{ T, value, addr });
|
||||
}
|
||||
|
@@ -123,12 +123,12 @@ fn DmaController(comptime id: u2) type {
|
||||
var offset: u32 = 0;
|
||||
if (self.cnt.transfer_type.read()) {
|
||||
offset = @sizeOf(u32); // 32-bit Transfer
|
||||
const word = bus.read32(self._sad);
|
||||
bus.write32(self._dad, word);
|
||||
const word = bus.read(u32, self._sad);
|
||||
bus.write(u32, self._dad, word);
|
||||
} else {
|
||||
offset = @sizeOf(u16); // 16-bit Transfer
|
||||
const halfword = bus.read16(self._sad);
|
||||
bus.write16(self._dad, halfword);
|
||||
const halfword = bus.read(u16, self._sad);
|
||||
bus.write(u16, self._dad, halfword);
|
||||
}
|
||||
|
||||
switch (sad_adj) {
|
||||
|
Reference in New Issue
Block a user