Files
6soz/src/system/nes/mapper/root.zig
T

148 lines
4.0 KiB
Zig

pub const Nrom = @import("nrom.zig");
pub const Uxrom = @import("uxrom.zig");
pub const Mmc1 = @import("mmc1.zig");
pub const Cnrom = @import("cnrom.zig");
pub const Mmc3 = @import("mmc3.zig");
pub const Mmc4 = @import("mmc4.zig");
pub const Mmc5 = @import("mmc5.zig");
pub const Axrom = @import("axrom.zig");
pub const Gxrom = @import("gxrom.zig");
pub const Mmc2 = @import("mmc2.zig");
pub const ColorDreams = @import("colordreams.zig");
pub const Camerica = @import("camerica.zig");
pub const Mapper13 = @import("mapper13.zig");
pub const Mapper34 = @import("mapper34.zig");
pub const Mapper65 = @import("mapper65.zig");
pub const Mapper68 = @import("mapper68.zig");
pub const Mapper69 = @import("mapper69.zig");
pub const Nina03 = @import("nina03.zig");
pub const Mapper76 = @import("mapper76.zig");
pub const Irem78 = @import("irem78.zig");
pub const Mapper87 = @import("mapper87.zig");
pub const Mapper88 = @import("mapper88.zig");
pub const Mapper89 = @import("mapper89.zig");
pub const Mapper93 = @import("mapper93.zig");
pub const Mapper94 = @import("mapper94.zig");
pub const Mapper118 = @import("mapper118.zig");
pub const Mapper119 = @import("mapper119.zig");
pub const Mapper140 = @import("mapper140.zig");
pub const Mapper180 = @import("mapper180.zig");
pub const Vrc1 = @import("vrc1.zig");
pub const Vrc2 = @import("vrc2.zig");
pub const Mapper232 = @import("mapper232.zig");
pub const Vrc3 = @import("vrc3.zig");
pub const Vrc4 = @import("vrc4.zig");
pub const Vrc6 = @import("vrc6.zig");
pub const Vrc7 = @import("vrc7.zig");
pub const Mapper210 = @import("mapper210.zig");
pub const Mapper206 = @import("mapper206.zig");
const types = @import("types.zig");
pub const Mirroring = types.Mirroring;
pub const Mapper = union(enum) {
nrom: Nrom,
uxrom: Uxrom,
mmc1: Mmc1,
cnrom: Cnrom,
mmc3: Mmc3,
mmc4: Mmc4,
mmc5: Mmc5,
axrom: Axrom,
gxrom: Gxrom,
mmc2: Mmc2,
color_dreams: ColorDreams,
camerica: Camerica,
mapper13: Mapper13,
mapper34: Mapper34,
mapper65: Mapper65,
mapper68: Mapper68,
mapper69: Mapper69,
nina03: Nina03,
mapper76: Mapper76,
irem78: Irem78,
mapper87: Mapper87,
mapper88: Mapper88,
mapper89: Mapper89,
mapper93: Mapper93,
mapper94: Mapper94,
mapper118: Mapper118,
mapper119: Mapper119,
mapper140: Mapper140,
mapper180: Mapper180,
vrc1: Vrc1,
vrc2: Vrc2,
mapper232: Mapper232,
vrc3: Vrc3,
vrc4: Vrc4,
vrc6: Vrc6,
vrc7: Vrc7,
mapper210: Mapper210,
mapper206: Mapper206,
pub fn cpuMapRead(
self: *const Mapper,
address: u16,
) ?usize {
return switch (self.*) {
inline else => |*mapper| mapper.cpuMapRead(address),
};
}
pub fn cpuWrite(
self: *Mapper,
address: u16,
value: u8,
) void {
switch (self.*) {
inline else => |*mapper| mapper.cpuWrite(address, value),
}
}
pub fn ppuMapRead(
self: *Mapper,
address: u16,
) ?usize {
return switch (self.*) {
inline else => |*mapper| mapper.ppuMapRead(address),
};
}
pub fn ppuMapWrite(
self: *const Mapper,
address: u16,
) ?usize {
return switch (self.*) {
inline else => |*mapper| mapper.ppuMapWrite(address),
};
}
pub fn mirroring(
self: *const Mapper,
) Mirroring {
return switch (self.*) {
inline else => |*mapper| mapper.mirroring(),
};
}
pub fn irqAsserted(
self: *const Mapper,
) bool {
return switch (self.*) {
inline else => |*mapper| mapper.irqAsserted(),
};
}
pub fn handleScanline(
self: *Mapper,
) void {
switch (self.*) {
.mmc3 => |*mmc3| mmc3.handleScanline(),
.mmc5 => |*mmc5| mmc5.handleScanline(),
.mapper118 => |*m118| m118.handleScanline(),
.mapper119 => |*m119| m119.handleScanline(),
else => {},
}
}
};