コード例 #1
0
ファイル: BUS.cs プロジェクト: aybe/ProjectPSX
        public unsafe uint load32(uint address)
        {
            uint i    = address >> 29;
            uint addr = address & RegionMask[i];

            if (addr < 0x1F00_0000)
            {
                return(load <uint>(addr & 0x1F_FFFF, ramPtr));
            }
            else if (addr < 0x1F80_0000)
            {
                return(load <uint>(addr & 0x7_FFFF, ex1Ptr));
            }
            else if (addr < 0x1f80_0400)
            {
                return(load <uint>(addr & 0x3FF, scrathpadPtr));
            }
            else if (addr < 0x1F80_1040)
            {
                return(load <uint>(addr & 0xF, memoryControl1));
            }
            else if (addr < 0x1F80_1050)
            {
                return(joypad.load(addr));
            }
            else if (addr < 0x1F80_1060)
            {
                Console.WriteLine($"[BUS] Read Unsupported to SIO address: {addr:x8}");
                return(load <uint>(addr & 0xF, sio));
            }
            else if (addr < 0x1F80_1070)
            {
                return(load <uint>(addr & 0xF, memoryControl2));
            }
            else if (addr < 0x1F80_1080)
            {
                return(interruptController.load(addr));
            }
            else if (addr < 0x1F80_1100)
            {
                return(dma.load(addr));
            }
            else if (addr < 0x1F80_1140)
            {
                return(timers.load(addr));
            }
            else if (addr <= 0x1F80_1803)
            {
                return(cdrom.load(addr));
            }
            else if (addr == 0x1F80_1810)
            {
                return(gpu.loadGPUREAD());
            }
            else if (addr == 0x1F80_1814)
            {
                return(gpu.loadGPUSTAT());
            }
            else if (addr == 0x1F80_1820)
            {
                return(mdec.readMDEC0_Data());
            }
            else if (addr == 0x1F80_1824)
            {
                return(mdec.readMDEC1_Status());
            }
            else if (addr < 0x1F80_2000)
            {
                return(spu.load(addr));
            }
            else if (addr < 0x1F80_4000)
            {
                Console.WriteLine($"[BUS] Read Unsupported to EXP2 address: {addr:x8}");
                return(0xFFFF_FFFF);
            }
            else if (addr < 0x1FC8_0000)
            {
                return(load <uint>(addr & 0x7_FFFF, biosPtr));
            }
            else if (addr == 0xFFFE0130)
            {
                return(memoryCache);
            }
            else
            {
                Console.WriteLine("[BUS] Load32 Unsupported: " + addr.ToString("x8"));
                return(0xFFFF_FFFF);
            }
        }