Exemplo n.º 1
0
        public void Init()
        {
            readMemoryAddressAccess = new List <ushort>();
            readMemoryAddress       = new List <byte>();
            writeMemoryAddress      = new List <AddressValueData>();

            cpu = Cpu6809.getInstance(WriteMemoryMock, ReadMemoryMock);
        }
Exemplo n.º 2
0
        public WpcCpuBoard(RomObject romObject)
        {
            ram         = Enumerable.Repeat((byte)0, memoryMapper.MEMORY_ADDR_HARDWARE).ToArray();
            romSizeMBit = romObject.romSizeMBit;
            systemRom   = romObject.systemRom;
            romFileName = romObject.fileName;
            gameRom     = romObject.gameRom;
            memoryPatch = MemoryPatch.getInstance();
            if (romObject.gameIdMemoryLocation != null)
            {
                MemoryPatchGameId.run(memoryPatch, (ushort)romObject.gameIdMemoryLocation);
            }
            if (romObject.skipWpcRomCheck)
            {
                Debug.Print("skipWpcRomCheck TRUE");
                MemoryPatchSkipBootCheck.run(memoryPatch);
            }
            memoryWriteHandler = MemoryHandler.getInstance(romObject.memoryPosition, ram);

            cpu = Cpu6809.getInstance(_write8, _read8);

            InterruptCallbackData interruptCallback = new InterruptCallbackData
            {
                irq         = cpu.irq,
                firqFromDmd = () =>
                {
                    cpu.firq();
                    asic.firqSourceDmd(true);
                },
                reset = cpu.reset
            };

            InitObject initObject = new InitObject
            {
                interruptCallback = interruptCallback,
                romSizeMBit       = romSizeMBit,
                romObject         = romObject,
                ram = ram,
                hasAlphanumericDisplay = romObject.hasAlphanumericDisplay
            };

            hasAlphaNumbericDisplay = romObject.hasAlphanumericDisplay;
            asic         = CpuBoardAsic.getInstance(initObject);
            soundBoard   = SoundBoard.getInstance(initObject);
            displayBoard = DisplayBoard.getInstance(initObject);
            externalIo   = ExternalIo.getInstance();

            ticksIrq = 0;
            protectedMemoryWriteAttempts = 0;
            memoryWrites = 0;
        }