// The SuperGrafx has 32K of RAM and a different port configuration to allow // I/O access to VDC1, VDC2, and the VPC. byte ReadMemorySGX(int addr) { if (addr < 0xFFFFF) // read ROM return RomData[addr % RomLength]; if (addr >= 0x1F0000 && addr < 0x1F8000) // read RAM return Ram[addr & 0x7FFF]; if (addr >= 0x1FE000) // hardware page. { if (addr < 0x1FE400) { addr &= 0x1F; if (addr <= 0x07) return VDC1.ReadVDC(addr); if (addr <= 0x0F) return VPC.ReadVPC(addr); if (addr <= 0x17) return VDC2.ReadVDC(addr); return 0xFF; } if (addr < 0x1FE800) { Cpu.PendingCycles--; return VCE.ReadVCE(addr); } if (addr < 0x1FEC00) return IOBuffer; if (addr < 0x1FF000) { IOBuffer = (byte)(Cpu.ReadTimerValue() | (IOBuffer & 0x80)); return IOBuffer; } if (addr >= 0x1FF000 && addr < 0x1FF400) { IOBuffer = ReadInput(); return IOBuffer; } if ((addr & ~1) == 0x1FF400) return IOBuffer; if (addr == 0x1FF402) { IOBuffer = Cpu.IRQControlByte; return IOBuffer; } if (addr == 0x1FF403) { IOBuffer = (byte)(Cpu.ReadIrqStatus() | (IOBuffer & 0xF8)); return IOBuffer; } } Log.Error("MEM", "UNHANDLED READ: {0:X6}", addr); return 0xFF; }
private byte ReadMemoryPopulous(int addr) { if (addr >= 0x80000 && addr < 0x88000) { return(PopulousRAM[addr & 0x7FFF]); } if (addr < 0xFFFFF) // read ROM { return(RomData[addr % RomLength]); } if (addr >= 0x1F0000 && addr < 0x1F8000) // read RAM { return(Ram[addr & 0x1FFF]); } if (addr >= 0x1FE000) // hardware page. { if (addr < 0x1FE400) { return(VDC1.ReadVDC(addr)); } if (addr < 0x1FE800) { Cpu.PendingCycles--; return(VCE.ReadVCE(addr)); } if (addr < 0x1FEC00) { return(IOBuffer); } if (addr < 0x1FF000) { IOBuffer = (byte)(Cpu.ReadTimerValue() | (IOBuffer & 0x80)); return(IOBuffer); } if (addr >= 0x1FF000 && addr < 0x1FF400) { IOBuffer = ReadInput(); return(IOBuffer); } if ((addr & ~1) == 0x1FF400) { return(IOBuffer); } if (addr == 0x1FF402) { IOBuffer = Cpu.IRQControlByte; return(IOBuffer); } if (addr == 0x1FF403) { IOBuffer = (byte)(Cpu.ReadIrqStatus() | (IOBuffer & 0xF8)); return(IOBuffer); } } Log.Error("MEM", "UNHANDLED READ: {0:X6}", addr); return(0xFF); }
byte ReadMemory(int addr) { if (addr < 0xFFFFF) // read ROM { return(RomData[addr % RomLength]); } if (addr >= 0x1F0000 && addr < 0x1F8000) // read RAM { return(Ram[addr & 0x1FFF]); } if (addr >= 0x1FE000) // hardware page. { if (addr < 0x1FE400) { return(VDC1.ReadVDC(addr)); } if (addr < 0x1FE800) { Cpu.PendingCycles--; return(VCE.ReadVCE(addr)); } if (addr < 0x1FEC00) { return(IOBuffer); } if (addr < 0x1FF000) { IOBuffer = (byte)(Cpu.ReadTimerValue() | (IOBuffer & 0x80)); return(IOBuffer); } if (addr >= 0x1FF000 && addr < 0x1FF400) { IOBuffer = ReadInput(); return(IOBuffer); } if ((addr & ~1) == 0x1FF400) { return(IOBuffer); } if (addr == 0x1FF402) { IOBuffer = Cpu.IRQControlByte; return(IOBuffer); } if (addr == 0x1FF403) { IOBuffer = (byte)(Cpu.ReadIrqStatus() | (IOBuffer & 0xF8)); return(IOBuffer); } if (addr >= 0x1FF800) { return(ReadCD(addr)); } } if (addr >= 0x1EE000 && addr <= 0x1EE7FF) // BRAM { if (BramEnabled && BramLocked == false) { return(BRAM[addr & 0x7FF]); } return(0xFF); } //CoreComm.MemoryCallbackSystem.CallRead((uint)addr); Log.Error("MEM", "UNHANDLED READ: {0:X6}", addr); return(0xFF); }
byte ReadMemoryCD(int addr) { if (addr < 0x80000) // read ROM { return(RomData[addr % RomLength]); } if (addr >= 0x1F0000 && addr < 0x1F8000) // read RAM { return(Ram[addr & 0x1FFF]); } if (addr >= 0x100000 && addr < 0x110000) // read CD RAM { return(CDRam[addr & 0xFFFF]); } if (addr >= 0xD0000 && addr < 0x100000 && SuperRam != null) // Super SysCard RAM { return(SuperRam[addr - 0xD0000]); } if (addr >= 0x1FE000) // hardware page. { if (addr < 0x1FE400) { return(VDC1.ReadVDC(addr)); } if (addr < 0x1FE800) { Cpu.PendingCycles--; return(VCE.ReadVCE(addr)); } if (addr < 0x1FEC00) { return(IOBuffer); } if (addr < 0x1FF000) { IOBuffer = (byte)(Cpu.ReadTimerValue() | (IOBuffer & 0x80)); return(IOBuffer); } if (addr >= 0x1FF000 && addr < 0x1FF400) { IOBuffer = ReadInput(); return(IOBuffer); } if ((addr & ~1) == 0x1FF400) { return(IOBuffer); } if (addr == 0x1FF402) { IOBuffer = Cpu.IRQControlByte; return(IOBuffer); } if (addr == 0x1FF403) { IOBuffer = (byte)(Cpu.ReadIrqStatus() | (IOBuffer & 0xF8)); return(IOBuffer); } if (addr >= 0x1FF800) { return(ReadCD(addr)); } } if (addr >= 0x80000 && addr < 0x88000 && ArcadeCard) { var page = ArcadePage[(addr >> 13) & 3]; byte value = ArcadeRam[page.EffectiveAddress]; page.Increment(); return(value); } if (addr >= 0x1EE000 && addr <= 0x1EE7FF) // BRAM { if (BramEnabled && BramLocked == false) { return(BRAM[addr & 0x7FF]); } return(0xFF); } Log.Error("MEM", "UNHANDLED READ: {0:X6}", addr); return(0xFF); }