@@ 0,0 1,43 @@
+use sm83;
+
+export type mmu = struct {
+ sm83::mmu,
+ cart: *cart,
+ vram: [0x2000]u8,
+ ram0: [0x1000]u8,
+ ram1: [0x1000]u8,
+ sprites: [0xA0]u8,
+};
+
+// Creates a new DMG MMU.
+export fn new_mmu(cart: *cart) *mmu = {
+ return alloc(mmu {
+ readb = &mmu_readb,
+ readw = &mmu_readw,
+ writeb = &mmu_writeb,
+ writew = &mmu_writew,
+ cart = cart,
+ ...
+ });
+};
+
+// Frees a DMG MMU.
+export fn mmu_free(mmu: *mmu) void = {
+ free(mmu);
+};
+
+fn mmu_readb(mmu: *sm83::mmu, addr: u16) u8 = {
+ abort(); // TODO
+};
+
+fn mmu_readw(mmu: *sm83::mmu, addr: u16) u16 = {
+ abort(); // TODO
+};
+
+fn mmu_writeb(mmu: *sm83::mmu, addr: u16, b: u8) void = {
+ abort(); // TODO
+};
+
+fn mmu_writew(mmu: *sm83::mmu, addr: u16, w: u16) void = {
+ abort(); // TODO
+};