public unsafe void write32(uint address, uint value) { uint i = address >> 29; uint addr = address & RegionMask[i]; if (addr < 0x1F00_0000) { write(addr & 0x1F_FFFF, value, ramPtr); } else if (addr < 0x1F80_0000) { write(addr & 0x7_FFFF, value, ex1Ptr); } else if (addr < 0x1f80_0400) { write(addr & 0x3FF, value, scrathpadPtr); } else if (addr < 0x1F80_1040) { write(addr & 0x3F, value, memoryControl1); } else if (addr < 0x1F80_1050) { joypad.write(addr, value); } else if (addr < 0x1F80_1060) { Console.WriteLine($"[BUS] Write Unsupported to SIO address: {addr:x8} : {value:x8}"); write(addr & 0xF, value, sio); } else if (addr < 0x1F80_1070) { write(addr & 0xF, value, memoryControl2); } else if (addr < 0x1F80_1080) { interruptController.write(addr, value); } else if (addr < 0x1F80_1100) { dma.write(addr, value); } else if (addr < 0x1F80_1140) { timers.write(addr, value); } else if (addr < 0x1F80_1810) { cdrom.write(addr, value); } else if (addr < 0x1F80_1820) { gpu.write(addr, value); } else if (addr < 0x1F80_1830) { mdec.write(addr, value); } else if (addr < 0x1F80_2000) { spu.write(addr, (ushort)value); } else if (addr < 0x1F80_4000) { Console.WriteLine($"[BUS] Write Unsupported to EXP2: {addr:x8} Value: {value:x8}"); } else if (addr == 0xFFFE_0130) { memoryCache = value; } else { Console.WriteLine($"[BUS] Write32 Unsupported: {addr:x8}"); } }