Example #1
0
        private FoenixSystem()
        {
            gpu = new Gpu();

            MemoryManager = new MemoryManager();


            //RAM = new BasicMemory("Ram", MemoryMap.RAM_START, MemoryMap.RAM_SIZE);   // 2MB RAM - extensible to 4MB
            //MemoryManager.AddDevice(RAM);
            //VICKY = new BasicMemory("Vicky", MemoryMap.VICKY_START, MemoryMap.VICKY_SIZE);   // 60K
            //MemoryManager.AddDevice(VICKY);
            //VIDEO = new BasicMemory("Video", MemoryMap.VIDEO_START, MemoryMap.VIDEO_SIZE - 1); // 4MB Video
            //MemoryManager.AddDevice(VIDEO);
            FLASH = new BasicMemory("Flash", MemoryMap.FLASH_START, MemoryMap.FLASH_SIZE);         // 8MB RAM
            MemoryManager.AddDevice(FLASH);
            BEATRIX = new BasicMemory("Beatrix", MemoryMap.BEATRIX_START, MemoryMap.BEATRIX_SIZE); // 4K
            MemoryManager.AddDevice(BEATRIX);

            // Special devices
            MATH = new MathCoproRegisters(MemoryMap.MATH_START);
            MemoryManager.AddDevice(MATH); // 47 bytes

            // This register is only a single byte but we allow writing a word
            CODEC = new Codec(MemoryMap.CODEC_START);
            MemoryManager.AddDevice(CODEC);     // 4 bytes
            KEYBOARD = new KeyboardRegister(MemoryMap.KBD_DATA_BUF);
            MemoryManager.AddDevice(KEYBOARD);  // 5 bytes
            SDCARD = new SDCardRegister(MemoryMap.SDCARD_DATA);
            MemoryManager.AddDevice(SDCARD);    // 2 bytes
            INTERRUPT = new InterruptController(MemoryMap.INT_PENDING_REG0);
            MemoryManager.AddDevice(INTERRUPT); // 3 bytes
            UART1 = new UART(1, MemoryMap.UART1_REGISTERS);
            MemoryManager.AddDevice(UART1);     // 8 bytes
            UART2 = new UART(2, MemoryMap.UART2_REGISTERS);
            MemoryManager.AddDevice(UART2);     // 8 bytes
            OPL2 = new OPL2(MemoryMap.OPL2_S_BASE);
            //MemoryManager.AddDevice(OPL2); // 256 bytes
            MPU401 = new MPU401(MemoryMap.MPU401_REGISTERS);
            MemoryManager.AddDevice(MPU401); // 2 bytes

            this.CPU = new CPU(MemoryManager);
            this.CPU.SimulatorCommand += CPU_SimulatorCommand;

            //gpu.VRAM = VIDEO;
            //gpu.RAM = RAM;
            //gpu.VICKY = VICKY;

            // This fontset is loaded just in case the kernel doesn't provide one.
            gpu.LoadFontSet("Foenix", @"Resources\Bm437_PhoenixEGA_8x8.bin", 0, CharacterSet.CharTypeCodes.ASCII_PET, CharacterSet.SizeCodes.Size8x8);
        }