Ejemplo n.º 1
0
        void WriteMemorySGX(int addr, byte value)
        {
            if (addr >= 0x1F0000 && addr < 0x1F8000) // write RAM.
                Ram[addr & 0x7FFF] = value;

            else if (addr >= 0x1FE000) // hardware page.
            {
                if (addr < 0x1FE400)
                {
                    addr &= 0x1F;
                    if (addr <= 0x07) VDC1.WriteVDC(addr, value);
                    else if (addr <= 0x0F) VPC.WriteVPC(addr, value);
                    else if (addr <= 0x17) VDC2.WriteVDC(addr, value);
                }
                else if (addr < 0x1FE800) { Cpu.PendingCycles--; VCE.WriteVCE(addr, value); }
                else if (addr < 0x1FEC00) { IOBuffer = value; PSG.WritePSG((byte)addr, value, Cpu.TotalExecutedCycles); }
                else if (addr == 0x1FEC00) { IOBuffer = value; Cpu.WriteTimer(value); }
                else if (addr == 0x1FEC01) { IOBuffer = value; Cpu.WriteTimerEnable(value); }
                else if (addr >= 0x1FF000 &&
                         addr < 0x1FF400) { IOBuffer = value; WriteInput(value); }
                else if (addr == 0x1FF402) { IOBuffer = value; Cpu.WriteIrqControl(value); }
                else if (addr == 0x1FF403) { IOBuffer = value; Cpu.WriteIrqStatus(); }
                else Log.Error("MEM", "unhandled hardware write [{0:X6}] : {1:X2}", addr, value);
            }
            else
                Log.Error("MEM", "UNHANDLED WRITE: {0:X6}:{1:X2}", addr, value);
        }
Ejemplo n.º 2
0
        void WriteMemory(int addr, byte value)
        {
            if (addr >= 0x1F0000 && addr < 0x1F8000)             // write RAM.
            {
                Ram[addr & 0x1FFF] = value;
            }

            else if (addr >= 0x1FE000)             // hardware page.
            {
                if (addr < 0x1FE400)
                {
                    VDC1.WriteVDC(addr, value);
                }
                else if (addr < 0x1FE800)
                {
                    Cpu.PendingCycles--; VCE.WriteVCE(addr, value);
                }
                else if (addr < 0x1FEC00)
                {
                    IOBuffer = value; PSG.WritePSG((byte)addr, value, Cpu.TotalExecutedCycles);
                }
                else if (addr == 0x1FEC00)
                {
                    IOBuffer = value; Cpu.WriteTimer(value);
                }
                else if (addr == 0x1FEC01)
                {
                    IOBuffer = value; Cpu.WriteTimerEnable(value);
                }
                else if (addr >= 0x1FF000 &&
                         addr < 0x1FF400)
                {
                    IOBuffer = value; WriteInput(value);
                }
                else if (addr == 0x1FF402)
                {
                    IOBuffer = value; Cpu.WriteIrqControl(value);
                }
                else if (addr == 0x1FF403)
                {
                    IOBuffer = value; Cpu.WriteIrqStatus();
                }
                else if (addr >= 0x1FF800)
                {
                    WriteCD(addr, value);
                }
                else
                {
                    Log.Error("MEM", "unhandled hardware write [{0:X6}] : {1:X2}", addr, value);
                }
            }

            else if (addr >= 0x1EE000 && addr <= 0x1EE7FF)               // BRAM
            {
                if (BramEnabled && BramLocked == false)
                {
                    BRAM[addr & 0x7FF] = value;
                    SaveRamModified    = true;
                }
            }

            else
            {
                Log.Error("MEM", "UNHANDLED WRITE: {0:X6}:{1:X2}", addr, value);
            }

            //CoreComm.MemoryCallbackSystem.CallWrite((uint)addr);
        }
Ejemplo n.º 3
0
        void WriteMemoryCD(int addr, byte value)
        {
            if (addr >= 0x1F0000 && addr < 0x1F8000)             // write RAM.
            {
                Ram[addr & 0x1FFF] = value;
            }

            else if (addr >= 0x100000 && addr < 0x110000)             // write CD-RAM
            {
                CDRam[addr & 0xFFFF] = value;
            }

            else if (addr >= 0xD0000 && addr < 0x100000 && SuperRam != null)             // Super SysCard RAM
            {
                SuperRam[addr - 0xD0000] = value;
            }

            else if (addr >= 0x1FE000)             // hardware page.
            {
                if (addr < 0x1FE400)
                {
                    VDC1.WriteVDC(addr, value);
                }
                else if (addr < 0x1FE800)
                {
                    Cpu.PendingCycles--; VCE.WriteVCE(addr, value);
                }
                else if (addr < 0x1FEC00)
                {
                    IOBuffer = value; PSG.WritePSG((byte)addr, value, Cpu.TotalExecutedCycles);
                }
                else if (addr == 0x1FEC00)
                {
                    IOBuffer = value; Cpu.WriteTimer(value);
                }
                else if (addr == 0x1FEC01)
                {
                    IOBuffer = value; Cpu.WriteTimerEnable(value);
                }
                else if (addr >= 0x1FF000 &&
                         addr < 0x1FF400)
                {
                    IOBuffer = value; WriteInput(value);
                }
                else if (addr == 0x1FF402)
                {
                    IOBuffer = value; Cpu.WriteIrqControl(value);
                }
                else if (addr == 0x1FF403)
                {
                    IOBuffer = value; Cpu.WriteIrqStatus();
                }
                else if (addr >= 0x1FF800)
                {
                    WriteCD(addr, value);
                }
                else
                {
                    Log.Error("MEM", "unhandled hardware write [{0:X6}] : {1:X2}", addr, value);
                }
            }

            else if (addr >= 0x80000 && addr < 0x88000 && ArcadeCard)             // Arcade Card
            {
                var page = ArcadePage[(addr >> 13) & 3];
                ArcadeRam[page.EffectiveAddress] = value;
                page.Increment();
            }

            else if (addr >= 0x1EE000 && addr <= 0x1EE7FF)               // BRAM
            {
                if (BramEnabled && BramLocked == false)
                {
                    BRAM[addr & 0x7FF] = value;
                    SaveRamModified    = true;
                }
            }

            else
            {
                Log.Error("MEM", "UNHANDLED WRITE: {0:X6}:{1:X2}", addr, value);
            }
        }
Ejemplo n.º 4
0
        private void WriteMemorySF2(int addr, byte value)
        {
            if ((addr & 0x1FFC) == 0x1FF0)
            {
                // Set SF2 pager.
                SF2MapperLatch = (byte)(addr & 0x03);

                if (SF2UpdateCDLMappings)
                {
                    CDLMappingApplyRange(Cpu.Mappings, "ROM", 0x40, 0x80000, (SF2MapperLatch + 1) * 0x80000);
                }

                return;
            }

            if (addr >= 0x1F0000 && addr < 0x1F8000)             // write RAM.
            {
                Ram[addr & 0x1FFF] = value;
            }

            else if (addr >= 0x1FE000)             // hardware page.
            {
                if (addr < 0x1FE400)
                {
                    VDC1.WriteVDC(addr, value);
                }
                else if (addr < 0x1FE800)
                {
                    Cpu.PendingCycles--; VCE.WriteVCE(addr, value);
                }
                else if (addr < 0x1FEC00)
                {
                    IOBuffer = value; PSG.WritePSG((byte)addr, value, Cpu.TotalExecutedCycles);
                }
                else if (addr == 0x1FEC00)
                {
                    IOBuffer = value; Cpu.WriteTimer(value);
                }
                else if (addr == 0x1FEC01)
                {
                    IOBuffer = value; Cpu.WriteTimerEnable(value);
                }
                else if (addr >= 0x1FF000 &&
                         addr < 0x1FF400)
                {
                    IOBuffer = value; WriteInput(value);
                }
                else if (addr == 0x1FF402)
                {
                    IOBuffer = value; Cpu.WriteIrqControl(value);
                }
                else if (addr == 0x1FF403)
                {
                    IOBuffer = value; Cpu.WriteIrqStatus();
                }
                else
                {
                    Log.Error("MEM", "unhandled hardware write [{0:X6}] : {1:X2}", addr, value);
                }
            }
            else
            {
                Log.Error("MEM", "UNHANDLED WRITE: {0:X6}:{1:X2}", addr, value);
            }
        }