예제 #1
0
        public FoenixSystem(Gpu gpu, BoardVersion version, string DefaultKernel)
        {
            this.gpu     = gpu;
            boardVersion = version;

            int          memSize = MemoryMap.RAM_SIZE;
            CodecRAM     codec   = null;
            SDCardDevice sdcard  = null;

            if (boardVersion == BoardVersion.RevC)
            {
                memSize *= 2;
                codec    = new CodecRAM(MemoryMap.CODEC_WR_CTRL_FMX, 2); // This register is only a single byte but we allow writing a word
                sdcard   = new GabeSDController(MemoryMap.GABE_SDC_CTRL_START, MemoryMap.GABE_SDC_CTRL_SIZE);
            }
            else
            {
                codec  = new CodecRAM(MemoryMap.CODEC_WR_CTRL, 2); // This register is only a single byte but we allow writing a word
                sdcard = new CH376SRegister(MemoryMap.SDCARD_DATA, MemoryMap.SDCARD_SIZE);
            }
            MemMgr = new MemoryManager
            {
                RAM     = new MemoryRAM(MemoryMap.RAM_START, memSize),                  // RAM: 2MB Rev B, 4MB Rev C
                VICKY   = new MemoryRAM(MemoryMap.VICKY_START, MemoryMap.VICKY_SIZE),   // 60K
                VIDEO   = new MemoryRAM(MemoryMap.VIDEO_START, MemoryMap.VIDEO_SIZE),   // 4MB Video
                FLASH   = new MemoryRAM(MemoryMap.FLASH_START, MemoryMap.FLASH_SIZE),   // 8MB RAM
                BEATRIX = new GabeRAM(MemoryMap.BEATRIX_START, MemoryMap.BEATRIX_SIZE), // 4K

                // Special devices
                MATH      = new MathCoproRegisters(MemoryMap.MATH_START, MemoryMap.MATH_END - MemoryMap.MATH_START + 1), // 48 bytes
                KEYBOARD  = new KeyboardRegister(MemoryMap.KBD_DATA_BUF, 5),
                SDCARD    = sdcard,
                INTERRUPT = new InterruptController(MemoryMap.INT_PENDING_REG0, 4),
                UART1     = new UART(MemoryMap.UART1_REGISTERS, 8),
                UART2     = new UART(MemoryMap.UART2_REGISTERS, 8),
                OPL2      = new OPL2(MemoryMap.OPL2_S_BASE, 256),
                MPU401    = new MPU401(MemoryMap.MPU401_REGISTERS, 2),
                VDMA      = new VDMA(MemoryMap.VDMA_START, MemoryMap.VDMA_SIZE)
            };
            MemMgr.CODEC = codec;

            // Assign memory variables used by other processes
            CPU = new CPU(MemMgr);
            CPU.SimulatorCommand += CPU_SimulatorCommand;
            gpu.VRAM              = MemMgr.VIDEO;
            gpu.RAM   = MemMgr.RAM;
            gpu.VICKY = MemMgr.VICKY;
            MemMgr.VDMA.setVideoRam(MemMgr.VIDEO);

            // Load the kernel.hex if present
            ResetCPU(true, DefaultKernel);

            // 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);

            // Write bytes $9F in the joystick registers to mean that they are not installed.
            MemMgr.WriteWord(0xAFE800, 0x9F9F);
            MemMgr.WriteWord(0xAFE802, 0x9F9F);
        }
예제 #2
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);
        }
예제 #3
0
        public FoenixSystem(BoardVersion version, string DefaultKernel)
        {
            boardVersion = version;

            int          memSize = MemoryMap.RAM_SIZE;
            CodecRAM     codec   = null;
            SDCardDevice sdcard  = null;

            if (boardVersion == BoardVersion.RevC || boardVersion == BoardVersion.RevU)
            {
                memSize *= 2;
                codec    = new CodecRAM(MemoryMap.CODEC_WR_CTRL_FMX, 2); // This register is only a single byte but we allow writing a word
                sdcard   = new GabeSDController(MemoryMap.GABE_SDC_CTRL_START, MemoryMap.GABE_SDC_CTRL_SIZE);
            }
            else
            {
                codec  = new CodecRAM(MemoryMap.CODEC_WR_CTRL, 2); // This register is only a single byte but we allow writing a word
                sdcard = new CH376SRegister(MemoryMap.SDCARD_DATA, MemoryMap.SDCARD_SIZE);
            }
            MemMgr = new MemoryManager
            {
                RAM     = new MemoryRAM(MemoryMap.RAM_START, memSize),                  // RAM: 2MB Rev B, 4MB Rev C
                VICKY   = new MemoryRAM(MemoryMap.VICKY_START, MemoryMap.VICKY_SIZE),   // 60K
                VIDEO   = new MemoryRAM(MemoryMap.VIDEO_START, MemoryMap.VIDEO_SIZE),   // 4MB Video
                FLASH   = new MemoryRAM(MemoryMap.FLASH_START, MemoryMap.FLASH_SIZE),   // 8MB RAM
                BEATRIX = new GabeRAM(MemoryMap.BEATRIX_START, MemoryMap.BEATRIX_SIZE), // 4K

                // Special devices
                MATH      = new MathCoproRegister(MemoryMap.MATH_START, MemoryMap.MATH_END - MemoryMap.MATH_START + 1), // 48 bytes
                KEYBOARD  = new KeyboardRegister(MemoryMap.KBD_DATA_BUF, 5),
                SDCARD    = sdcard,
                INTERRUPT = new InterruptController(MemoryMap.INT_PENDING_REG0, 4),
                UART1     = new UART(MemoryMap.UART1_REGISTERS, 8),
                UART2     = new UART(MemoryMap.UART2_REGISTERS, 8),
                OPL2      = new OPL2(MemoryMap.OPL2_S_BASE, 256),
                FLOAT     = new MathFloatRegister(MemoryMap.FLOAT_START, MemoryMap.FLOAT_END - MemoryMap.FLOAT_START + 1),
                MPU401    = new MPU401(MemoryMap.MPU401_REGISTERS, 2),
                VDMA      = new VDMA(MemoryMap.VDMA_START, MemoryMap.VDMA_SIZE),
                TIMER0    = new TimerRegister(MemoryMap.TIMER0_CTRL_REG, 8),
                TIMER1    = new TimerRegister(MemoryMap.TIMER1_CTRL_REG, 8),
                TIMER2    = new TimerRegister(MemoryMap.TIMER2_CTRL_REG, 8)
            };
            MemMgr.CODEC = codec;
            MemMgr.KEYBOARD.SetKernel(this);

            // Assign memory variables used by other processes
            CPU = new CPU(MemMgr);

            MemMgr.VDMA.setVideoRam(MemMgr.VIDEO);
            MemMgr.VDMA.setSystemRam(MemMgr.RAM);

            // Load the kernel.hex if present
            ResetCPU(DefaultKernel);

            // Write bytes $9F in the joystick registers to mean that they are not installed.
            MemMgr.WriteWord(0xAFE800, 0x9F9F);
            MemMgr.WriteWord(0xAFE802, 0x9F9F);
            MemMgr.TIMER0.TimerInterruptDelegate += TimerEvent0;
            MemMgr.TIMER1.TimerInterruptDelegate += TimerEvent1;
            MemMgr.TIMER2.TimerInterruptDelegate += TimerEvent2;
        }
예제 #4
0
 public Operations(CPU cPU)
 {
     this.cpu = cPU;
 }
예제 #5
0
 public OpcodeList(Operations operations, CPU CPU)
 {
     Add(new OpCode(0x00, "BRK", 2, AddressModes.Interrupt, new OpCode.ExecuteDelegate(operations.ExecuteInterrupt)));
     Add(new OpCode(0x01, "ORA", 2, CPU.A, AddressModes.DirectPageIndexedIndirectWithX, new OpCode.ExecuteDelegate(operations.ExecuteORA)));
     Add(new OpCode(0x02, "COP", 2, AddressModes.Interrupt, new OpCode.ExecuteDelegate(operations.ExecuteInterrupt)));
     Add(new OpCode(0x03, "ORA", 2, AddressModes.StackRelative, new OpCode.ExecuteDelegate(operations.ExecuteORA)));
     Add(new OpCode(0x04, "TSB", 2, AddressModes.DirectPage, new OpCode.ExecuteDelegate(operations.ExecuteTSBTRB)));
     Add(new OpCode(0x05, "ORA", 2, AddressModes.DirectPage, new OpCode.ExecuteDelegate(operations.ExecuteORA)));
     Add(new OpCode(0x06, "ASL", 2, AddressModes.DirectPage, new OpCode.ExecuteDelegate(operations.ExecuteShift)));
     Add(new OpCode(0x07, "ORA", 2, AddressModes.DirectPageIndirectLong, new OpCode.ExecuteDelegate(operations.ExecuteORA)));
     Add(new OpCode(0x08, "PHP", 1, AddressModes.StackImplied, new OpCode.ExecuteDelegate(operations.ExecuteStack)));
     Add(new OpCode(0x09, "ORA", 2, AddressModes.Immediate, new OpCode.ExecuteDelegate(operations.ExecuteORA)));
     Add(new OpCode(0x0A, "ASL", 1, AddressModes.Accumulator, new OpCode.ExecuteDelegate(operations.ExecuteShift)));
     Add(new OpCode(0x0B, "PHD", 1, AddressModes.StackImplied, new OpCode.ExecuteDelegate(operations.ExecuteStack)));
     Add(new OpCode(0x0C, "TSB", 3, AddressModes.Absolute, new OpCode.ExecuteDelegate(operations.ExecuteTSBTRB)));
     Add(new OpCode(0x0D, "ORA", 3, AddressModes.Absolute, new OpCode.ExecuteDelegate(operations.ExecuteORA)));
     Add(new OpCode(0x0E, "ASL", 3, AddressModes.Absolute, new OpCode.ExecuteDelegate(operations.ExecuteShift)));
     Add(new OpCode(0x0F, "ORA", 4, AddressModes.AbsoluteLong, new OpCode.ExecuteDelegate(operations.ExecuteORA)));
     Add(new OpCode(0x10, "BPL", 2, AddressModes.ProgramCounterRelative, new OpCode.ExecuteDelegate(operations.ExecuteBranch)));
     Add(new OpCode(0x11, "ORA", 2, AddressModes.DirectPageIndirectIndexedWithY, new OpCode.ExecuteDelegate(operations.ExecuteORA)));
     Add(new OpCode(0x12, "ORA", 2, AddressModes.DirectPageIndirect, new OpCode.ExecuteDelegate(operations.ExecuteORA)));
     Add(new OpCode(0x13, "ORA", 2, AddressModes.StackRelativeIndirectIndexedWithY, new OpCode.ExecuteDelegate(operations.ExecuteORA)));
     Add(new OpCode(0x14, "TRB", 2, AddressModes.DirectPage, new OpCode.ExecuteDelegate(operations.ExecuteTSBTRB)));
     Add(new OpCode(0x15, "ORA", 2, AddressModes.DirectPageIndexedWithX, new OpCode.ExecuteDelegate(operations.ExecuteORA)));
     Add(new OpCode(0x16, "ASL", 2, AddressModes.DirectPageIndexedWithX, new OpCode.ExecuteDelegate(operations.ExecuteShift)));
     Add(new OpCode(0x17, "ORA", 2, AddressModes.DirectPageIndirectLongIndexedWithY, new OpCode.ExecuteDelegate(operations.ExecuteORA)));
     Add(new OpCode(0x18, "CLC", 1, AddressModes.Implied, new OpCode.ExecuteDelegate(operations.ExecuteStatusReg)));
     Add(new OpCode(0x19, "ORA", 3, AddressModes.AbsoluteIndexedWithY, new OpCode.ExecuteDelegate(operations.ExecuteORA)));
     Add(new OpCode(0x1A, "INC", 1, AddressModes.Accumulator, new OpCode.ExecuteDelegate(operations.ExecuteINCDEC)));
     Add(new OpCode(0x1B, "TCS", 1, AddressModes.Implied, new OpCode.ExecuteDelegate(operations.ExecuteTransfer)));
     Add(new OpCode(0x1C, "TRB", 3, AddressModes.Absolute, new OpCode.ExecuteDelegate(operations.ExecuteTSBTRB)));
     Add(new OpCode(0x1D, "ORA", 3, AddressModes.AbsoluteIndexedWithX, new OpCode.ExecuteDelegate(operations.ExecuteORA)));
     Add(new OpCode(0x1E, "ASL", 3, AddressModes.AbsoluteIndexedWithX, new OpCode.ExecuteDelegate(operations.ExecuteShift)));
     Add(new OpCode(0x1F, "ORA", 4, AddressModes.AbsoluteLongIndexedWithX, new OpCode.ExecuteDelegate(operations.ExecuteORA)));
     Add(new OpCode(0x20, "JSR", 3, AddressModes.Absolute, new OpCode.ExecuteDelegate(operations.ExecuteJumpReturn)));
     Add(new OpCode(0x21, "AND", 2, AddressModes.DirectPageIndexedIndirectWithX, new OpCode.ExecuteDelegate(operations.ExecuteAND)));
     Add(new OpCode(0x22, "JSR", 4, AddressModes.AbsoluteLong, new OpCode.ExecuteDelegate(operations.ExecuteJumpReturn)));
     Add(new OpCode(0x23, "AND", 2, AddressModes.StackRelative, new OpCode.ExecuteDelegate(operations.ExecuteAND)));
     Add(new OpCode(0x24, "BIT", 2, AddressModes.DirectPage, new OpCode.ExecuteDelegate(operations.ExecuteBIT)));
     Add(new OpCode(0x25, "AND", 2, AddressModes.DirectPage, new OpCode.ExecuteDelegate(operations.ExecuteAND)));
     Add(new OpCode(0x26, "ROL", 2, AddressModes.DirectPage, new OpCode.ExecuteDelegate(operations.ExecuteShift)));
     Add(new OpCode(0x27, "AND", 2, AddressModes.DirectPageIndirectLong, new OpCode.ExecuteDelegate(operations.ExecuteAND)));
     Add(new OpCode(0x28, "PLP", 1, AddressModes.StackImplied, new OpCode.ExecuteDelegate(operations.ExecuteStack)));
     Add(new OpCode(0x29, "AND", 2, CPU.A, AddressModes.Immediate, new OpCode.ExecuteDelegate(operations.ExecuteAND)));
     Add(new OpCode(0x2A, "ROL", 1, AddressModes.Accumulator, new OpCode.ExecuteDelegate(operations.ExecuteShift)));
     Add(new OpCode(0x2B, "PLD", 1, AddressModes.StackImplied, new OpCode.ExecuteDelegate(operations.ExecuteStack)));
     Add(new OpCode(0x2C, "BIT", 3, AddressModes.Absolute, new OpCode.ExecuteDelegate(operations.ExecuteBIT)));
     Add(new OpCode(0x2D, "AND", 3, AddressModes.Absolute, new OpCode.ExecuteDelegate(operations.ExecuteAND)));
     Add(new OpCode(0x2E, "ROL", 3, AddressModes.Absolute, new OpCode.ExecuteDelegate(operations.ExecuteShift)));
     Add(new OpCode(0x2F, "AND", 4, AddressModes.AbsoluteLong, new OpCode.ExecuteDelegate(operations.ExecuteAND)));
     Add(new OpCode(0x30, "BMI", 2, AddressModes.ProgramCounterRelative, new OpCode.ExecuteDelegate(operations.ExecuteBranch)));
     Add(new OpCode(0x31, "AND", 2, AddressModes.DirectPageIndirectIndexedWithY, new OpCode.ExecuteDelegate(operations.ExecuteAND)));
     Add(new OpCode(0x32, "AND", 2, AddressModes.DirectPageIndirect, new OpCode.ExecuteDelegate(operations.ExecuteAND)));
     Add(new OpCode(0x33, "AND", 2, AddressModes.StackRelativeIndirectIndexedWithY, new OpCode.ExecuteDelegate(operations.ExecuteAND)));
     Add(new OpCode(0x34, "BIT", 2, AddressModes.DirectPageIndexedWithX, new OpCode.ExecuteDelegate(operations.ExecuteBIT)));
     Add(new OpCode(0x35, "AND", 2, AddressModes.DirectPageIndexedWithX, new OpCode.ExecuteDelegate(operations.ExecuteAND)));
     Add(new OpCode(0x36, "ROL", 2, AddressModes.DirectPageIndexedWithX, new OpCode.ExecuteDelegate(operations.ExecuteShift)));
     Add(new OpCode(0x37, "AND", 2, AddressModes.DirectPageIndirectLongIndexedWithY, new OpCode.ExecuteDelegate(operations.ExecuteAND)));
     Add(new OpCode(0x38, "SEC", 1, AddressModes.Implied, new OpCode.ExecuteDelegate(operations.ExecuteStatusReg)));
     Add(new OpCode(0x39, "AND", 3, AddressModes.AbsoluteIndexedWithY, new OpCode.ExecuteDelegate(operations.ExecuteAND)));
     Add(new OpCode(0x3A, "DEC", 1, AddressModes.Accumulator, new OpCode.ExecuteDelegate(operations.ExecuteINCDEC)));
     Add(new OpCode(0x3B, "TSC", 1, AddressModes.Implied, new OpCode.ExecuteDelegate(operations.ExecuteTransfer)));
     Add(new OpCode(0x3C, "BIT", 3, AddressModes.AbsoluteIndexedWithX, new OpCode.ExecuteDelegate(operations.ExecuteBIT)));
     Add(new OpCode(0x3D, "AND", 3, AddressModes.AbsoluteIndexedWithX, new OpCode.ExecuteDelegate(operations.ExecuteAND)));
     Add(new OpCode(0x3E, "ROL", 3, AddressModes.AbsoluteIndexedWithX, new OpCode.ExecuteDelegate(operations.ExecuteShift)));
     Add(new OpCode(0x3F, "AND", 4, AddressModes.AbsoluteLongIndexedWithX, new OpCode.ExecuteDelegate(operations.ExecuteAND)));
     Add(new OpCode(0x40, "RTI", 1, AddressModes.StackImplied, new OpCode.ExecuteDelegate(operations.ExecuteJumpReturn)));
     Add(new OpCode(0x41, "EOR", 2, AddressModes.DirectPageIndexedIndirectWithX, new OpCode.ExecuteDelegate(operations.ExecuteEOR)));
     Add(new OpCode(0x42, "WDM", 2, AddressModes.Implied, new OpCode.ExecuteDelegate(operations.ExecuteMisc)));
     Add(new OpCode(0x43, "EOR", 2, AddressModes.StackRelative, new OpCode.ExecuteDelegate(operations.ExecuteEOR)));
     Add(new OpCode(0x44, "MVP", 3, AddressModes.BlockMove, new OpCode.ExecuteDelegate(operations.ExecuteBlockMove)));
     Add(new OpCode(0x45, "EOR", 2, AddressModes.DirectPage, new OpCode.ExecuteDelegate(operations.ExecuteEOR)));
     Add(new OpCode(0x46, "LSR", 2, AddressModes.DirectPage, new OpCode.ExecuteDelegate(operations.ExecuteShift)));
     Add(new OpCode(0x47, "EOR", 2, AddressModes.DirectPageIndirectLong, new OpCode.ExecuteDelegate(operations.ExecuteEOR)));
     Add(new OpCode(0x48, "PHA", 1, AddressModes.StackImplied, new OpCode.ExecuteDelegate(operations.ExecuteStack)));
     Add(new OpCode(0x49, "EOR", 2, CPU.A, AddressModes.Immediate, new OpCode.ExecuteDelegate(operations.ExecuteEOR)));
     Add(new OpCode(0x4A, "LSR", 1, AddressModes.Accumulator, new OpCode.ExecuteDelegate(operations.ExecuteShift)));
     Add(new OpCode(0x4B, "PHK", 1, AddressModes.StackImplied, new OpCode.ExecuteDelegate(operations.ExecuteStack)));
     Add(new OpCode(0x4C, "JMP", 3, AddressModes.Absolute, new OpCode.ExecuteDelegate(operations.ExecuteJumpReturn)));
     Add(new OpCode(0x4D, "EOR", 3, AddressModes.Absolute, new OpCode.ExecuteDelegate(operations.ExecuteEOR)));
     Add(new OpCode(0x4E, "LSR", 3, AddressModes.Absolute, new OpCode.ExecuteDelegate(operations.ExecuteShift)));
     Add(new OpCode(0x4F, "EOR", 4, AddressModes.AbsoluteLong, new OpCode.ExecuteDelegate(operations.ExecuteEOR)));
     Add(new OpCode(0x50, "BVC", 2, AddressModes.ProgramCounterRelative, new OpCode.ExecuteDelegate(operations.ExecuteBranch)));
     Add(new OpCode(0x51, "EOR", 2, AddressModes.DirectPageIndirectIndexedWithY, new OpCode.ExecuteDelegate(operations.ExecuteEOR)));
     Add(new OpCode(0x52, "EOR", 2, AddressModes.DirectPageIndirect, new OpCode.ExecuteDelegate(operations.ExecuteEOR)));
     Add(new OpCode(0x53, "EOR", 2, AddressModes.StackRelativeIndirectIndexedWithY, new OpCode.ExecuteDelegate(operations.ExecuteEOR)));
     Add(new OpCode(0x54, "MVN", 3, AddressModes.BlockMove, new OpCode.ExecuteDelegate(operations.ExecuteBlockMove)));
     Add(new OpCode(0x55, "EOR", 2, AddressModes.DirectPageIndexedWithX, new OpCode.ExecuteDelegate(operations.ExecuteEOR)));
     Add(new OpCode(0x56, "LSR", 2, AddressModes.DirectPageIndexedWithX, new OpCode.ExecuteDelegate(operations.ExecuteShift)));
     Add(new OpCode(0x57, "EOR", 2, AddressModes.DirectPageIndirectLongIndexedWithY, new OpCode.ExecuteDelegate(operations.ExecuteEOR)));
     Add(new OpCode(0x58, "CLI", 1, AddressModes.Implied, new OpCode.ExecuteDelegate(operations.ExecuteStatusReg)));
     Add(new OpCode(0x59, "EOR", 3, AddressModes.AbsoluteIndexedWithY, new OpCode.ExecuteDelegate(operations.ExecuteEOR)));
     Add(new OpCode(0x5A, "PHY", 1, AddressModes.StackImplied, new OpCode.ExecuteDelegate(operations.ExecuteStack)));
     Add(new OpCode(0x5B, "TCD", 1, AddressModes.Implied, new OpCode.ExecuteDelegate(operations.ExecuteTransfer)));
     Add(new OpCode(0x5C, "JMP", 4, AddressModes.AbsoluteLong, new OpCode.ExecuteDelegate(operations.ExecuteJumpReturn)));
     Add(new OpCode(0x5D, "EOR", 3, AddressModes.AbsoluteIndexedWithX, new OpCode.ExecuteDelegate(operations.ExecuteEOR)));
     Add(new OpCode(0x5E, "LSR", 3, AddressModes.AbsoluteIndexedWithX, new OpCode.ExecuteDelegate(operations.ExecuteShift)));
     Add(new OpCode(0x5F, "EOR", 4, AddressModes.AbsoluteLongIndexedWithX, new OpCode.ExecuteDelegate(operations.ExecuteEOR)));
     Add(new OpCode(0x60, "RTS", 1, AddressModes.StackImplied, new OpCode.ExecuteDelegate(operations.ExecuteJumpReturn)));
     Add(new OpCode(0x61, "ADC", 2, AddressModes.DirectPageIndexedIndirectWithX, new OpCode.ExecuteDelegate(operations.ExecuteADC)));
     Add(new OpCode(0x62, "PER", 3, AddressModes.StackProgramCounterRelativeLong, new OpCode.ExecuteDelegate(operations.ExecuteStack)));
     Add(new OpCode(0x63, "ADC", 2, AddressModes.StackRelative, new OpCode.ExecuteDelegate(operations.ExecuteADC)));
     Add(new OpCode(0x64, "STZ", 2, AddressModes.DirectPage, new OpCode.ExecuteDelegate(operations.ExecuteSTZ)));
     Add(new OpCode(0x65, "ADC", 2, AddressModes.DirectPage, new OpCode.ExecuteDelegate(operations.ExecuteADC)));
     Add(new OpCode(0x66, "ROR", 2, AddressModes.DirectPage, new OpCode.ExecuteDelegate(operations.ExecuteShift)));
     Add(new OpCode(0x67, "ADC", 2, AddressModes.DirectPageIndirectLong, new OpCode.ExecuteDelegate(operations.ExecuteADC)));
     Add(new OpCode(0x68, "PLA", 1, AddressModes.StackImplied, new OpCode.ExecuteDelegate(operations.ExecuteStack)));
     Add(new OpCode(0x69, "ADC", 2, CPU.A, AddressModes.Immediate, new OpCode.ExecuteDelegate(operations.ExecuteADC)));
     Add(new OpCode(0x6A, "ROR", 1, AddressModes.Accumulator, new OpCode.ExecuteDelegate(operations.ExecuteShift)));
     Add(new OpCode(0x6B, "RTL", 1, AddressModes.StackImplied, new OpCode.ExecuteDelegate(operations.ExecuteJumpReturn)));
     Add(new OpCode(0x6C, "JMP", 3, AddressModes.JmpAbsoluteIndirect, new OpCode.ExecuteDelegate(operations.ExecuteJumpReturn)));
     Add(new OpCode(0x6D, "ADC", 3, AddressModes.Absolute, new OpCode.ExecuteDelegate(operations.ExecuteADC)));
     Add(new OpCode(0x6E, "ROR", 3, AddressModes.Absolute, new OpCode.ExecuteDelegate(operations.ExecuteShift)));
     Add(new OpCode(0x6F, "ADC", 4, AddressModes.AbsoluteLong, new OpCode.ExecuteDelegate(operations.ExecuteADC)));
     Add(new OpCode(0x70, "BVS", 2, AddressModes.ProgramCounterRelative, new OpCode.ExecuteDelegate(operations.ExecuteBranch)));
     Add(new OpCode(0x71, "ADC", 2, AddressModes.DirectPageIndirectIndexedWithY, new OpCode.ExecuteDelegate(operations.ExecuteADC)));
     Add(new OpCode(0x72, "ADC", 2, AddressModes.DirectPageIndirect, new OpCode.ExecuteDelegate(operations.ExecuteADC)));
     Add(new OpCode(0x73, "ADC", 2, AddressModes.StackRelativeIndirectIndexedWithY, new OpCode.ExecuteDelegate(operations.ExecuteADC)));
     Add(new OpCode(0x74, "STZ", 2, AddressModes.DirectPageIndexedWithX, new OpCode.ExecuteDelegate(operations.ExecuteSTZ)));
     Add(new OpCode(0x75, "ADC", 2, AddressModes.DirectPageIndexedWithX, new OpCode.ExecuteDelegate(operations.ExecuteADC)));
     Add(new OpCode(0x76, "ROR", 2, AddressModes.DirectPageIndexedWithX, new OpCode.ExecuteDelegate(operations.ExecuteShift)));
     Add(new OpCode(0x77, "ADC", 2, AddressModes.DirectPageIndirectLongIndexedWithY, new OpCode.ExecuteDelegate(operations.ExecuteADC)));
     Add(new OpCode(0x78, "SEI", 1, AddressModes.Implied, new OpCode.ExecuteDelegate(operations.ExecuteStatusReg)));
     Add(new OpCode(0x79, "ADC", 3, AddressModes.AbsoluteIndexedWithY, new OpCode.ExecuteDelegate(operations.ExecuteADC)));
     Add(new OpCode(0x7A, "PLY", 1, AddressModes.StackImplied, new OpCode.ExecuteDelegate(operations.ExecuteStack)));
     Add(new OpCode(0x7B, "TDC", 1, AddressModes.Implied, new OpCode.ExecuteDelegate(operations.ExecuteTransfer)));
     Add(new OpCode(0x7C, "JMP", 3, AddressModes.JmpAbsoluteIndexedIndirectWithX, new OpCode.ExecuteDelegate(operations.ExecuteJumpReturn)));
     Add(new OpCode(0x7D, "ADC", 3, AddressModes.AbsoluteIndexedWithX, new OpCode.ExecuteDelegate(operations.ExecuteADC)));
     Add(new OpCode(0x7E, "ROR", 3, AddressModes.AbsoluteIndexedWithX, new OpCode.ExecuteDelegate(operations.ExecuteShift)));
     Add(new OpCode(0x7F, "ADC", 4, AddressModes.AbsoluteLongIndexedWithX, new OpCode.ExecuteDelegate(operations.ExecuteADC)));
     Add(new OpCode(0x80, "BRA", 2, AddressModes.ProgramCounterRelative, new OpCode.ExecuteDelegate(operations.ExecuteBranch)));
     Add(new OpCode(0x81, "STA", 2, AddressModes.DirectPageIndexedIndirectWithX, new OpCode.ExecuteDelegate(operations.ExecuteSTA)));
     Add(new OpCode(0x82, "BRL", 3, AddressModes.ProgramCounterRelativeLong, new OpCode.ExecuteDelegate(operations.ExecuteBranch)));
     Add(new OpCode(0x83, "STA", 2, AddressModes.StackRelative, new OpCode.ExecuteDelegate(operations.ExecuteSTA)));
     Add(new OpCode(0x84, "STY", 2, AddressModes.DirectPage, new OpCode.ExecuteDelegate(operations.ExecuteSTY)));
     Add(new OpCode(0x85, "STA", 2, AddressModes.DirectPage, new OpCode.ExecuteDelegate(operations.ExecuteSTA)));
     Add(new OpCode(0x86, "STX", 2, AddressModes.DirectPage, new OpCode.ExecuteDelegate(operations.ExecuteSTX)));
     Add(new OpCode(0x87, "STA", 2, AddressModes.DirectPageIndirectLong, new OpCode.ExecuteDelegate(operations.ExecuteSTA)));
     Add(new OpCode(0x88, "DEY", 1, AddressModes.Implied, new OpCode.ExecuteDelegate(operations.ExecuteINCDEC)));
     Add(new OpCode(0x89, "BIT", 2, CPU.A, AddressModes.Immediate, new OpCode.ExecuteDelegate(operations.ExecuteBIT)));
     Add(new OpCode(0x8A, "TXA", 1, AddressModes.Implied, new OpCode.ExecuteDelegate(operations.ExecuteTransfer)));
     Add(new OpCode(0x8B, "PHB", 1, AddressModes.StackImplied, new OpCode.ExecuteDelegate(operations.ExecuteStack)));
     Add(new OpCode(0x8C, "STY", 3, AddressModes.Absolute, new OpCode.ExecuteDelegate(operations.ExecuteSTY)));
     Add(new OpCode(0x8D, "STA", 3, AddressModes.Absolute, new OpCode.ExecuteDelegate(operations.ExecuteSTA)));
     Add(new OpCode(0x8E, "STX", 3, AddressModes.Absolute, new OpCode.ExecuteDelegate(operations.ExecuteSTX)));
     Add(new OpCode(0x8F, "STA", 4, AddressModes.AbsoluteLong, new OpCode.ExecuteDelegate(operations.ExecuteSTA)));
     Add(new OpCode(0x90, "BCC", 2, AddressModes.ProgramCounterRelative, new OpCode.ExecuteDelegate(operations.ExecuteBranch)));
     Add(new OpCode(0x91, "STA", 2, AddressModes.DirectPageIndirectIndexedWithY, new OpCode.ExecuteDelegate(operations.ExecuteSTA)));
     Add(new OpCode(0x92, "STA", 2, AddressModes.DirectPageIndirect, new OpCode.ExecuteDelegate(operations.ExecuteSTA)));
     Add(new OpCode(0x93, "STA", 2, AddressModes.StackRelativeIndirectIndexedWithY, new OpCode.ExecuteDelegate(operations.ExecuteSTA)));
     Add(new OpCode(0x94, "STY", 2, AddressModes.DirectPageIndexedWithX, new OpCode.ExecuteDelegate(operations.ExecuteSTY)));
     Add(new OpCode(0x95, "STA", 2, AddressModes.DirectPageIndexedWithX, new OpCode.ExecuteDelegate(operations.ExecuteSTA)));
     Add(new OpCode(0x96, "STX", 2, AddressModes.DirectPageIndexedWithY, new OpCode.ExecuteDelegate(operations.ExecuteSTX)));
     Add(new OpCode(0x97, "STA", 2, AddressModes.DirectPageIndirectLongIndexedWithY, new OpCode.ExecuteDelegate(operations.ExecuteSTA)));
     Add(new OpCode(0x98, "TYA", 1, AddressModes.Implied, new OpCode.ExecuteDelegate(operations.ExecuteTransfer)));
     Add(new OpCode(0x99, "STA", 3, AddressModes.AbsoluteIndexedWithY, new OpCode.ExecuteDelegate(operations.ExecuteSTA)));
     Add(new OpCode(0x9A, "TXS", 1, AddressModes.Implied, new OpCode.ExecuteDelegate(operations.ExecuteTransfer)));
     Add(new OpCode(0x9B, "TXY", 1, AddressModes.Implied, new OpCode.ExecuteDelegate(operations.ExecuteTransfer)));
     Add(new OpCode(0x9C, "STZ", 3, AddressModes.Absolute, new OpCode.ExecuteDelegate(operations.ExecuteSTZ)));
     Add(new OpCode(0x9D, "STA", 3, AddressModes.AbsoluteIndexedWithX, new OpCode.ExecuteDelegate(operations.ExecuteSTA)));
     Add(new OpCode(0x9E, "STZ", 3, AddressModes.AbsoluteIndexedWithX, new OpCode.ExecuteDelegate(operations.ExecuteSTZ)));
     Add(new OpCode(0x9F, "STA", 4, AddressModes.AbsoluteLongIndexedWithX, new OpCode.ExecuteDelegate(operations.ExecuteSTA)));
     Add(new OpCode(0xA0, "LDY", 2, CPU.Y, AddressModes.Immediate, new OpCode.ExecuteDelegate(operations.ExecuteLDY)));
     Add(new OpCode(0xA1, "LDA", 2, AddressModes.DirectPageIndexedIndirectWithX, new OpCode.ExecuteDelegate(operations.ExecuteLDA)));
     Add(new OpCode(0xA2, "LDX", 2, CPU.X, AddressModes.Immediate, new OpCode.ExecuteDelegate(operations.ExecuteLDX)));
     Add(new OpCode(0xA3, "LDA", 2, AddressModes.StackRelative, new OpCode.ExecuteDelegate(operations.ExecuteLDA)));
     Add(new OpCode(0xA4, "LDY", 2, AddressModes.DirectPage, new OpCode.ExecuteDelegate(operations.ExecuteLDY)));
     Add(new OpCode(0xA5, "LDA", 2, AddressModes.DirectPage, new OpCode.ExecuteDelegate(operations.ExecuteLDA)));
     Add(new OpCode(0xA6, "LDX", 2, AddressModes.DirectPage, new OpCode.ExecuteDelegate(operations.ExecuteLDX)));
     Add(new OpCode(0xA7, "LDA", 2, AddressModes.DirectPageIndirectLong, new OpCode.ExecuteDelegate(operations.ExecuteLDA)));
     Add(new OpCode(0xA8, "TAY", 1, AddressModes.Implied, new OpCode.ExecuteDelegate(operations.ExecuteTransfer)));
     Add(new OpCode(0xA9, "LDA", 2, CPU.A, AddressModes.Immediate, new OpCode.ExecuteDelegate(operations.ExecuteLDA)));
     Add(new OpCode(0xAA, "TAX", 1, AddressModes.Implied, new OpCode.ExecuteDelegate(operations.ExecuteTransfer)));
     Add(new OpCode(0xAB, "PLB", 1, AddressModes.StackImplied, new OpCode.ExecuteDelegate(operations.ExecuteStack)));
     Add(new OpCode(0xAC, "LDY", 3, AddressModes.Absolute, new OpCode.ExecuteDelegate(operations.ExecuteLDY)));
     Add(new OpCode(0xAD, "LDA", 3, AddressModes.Absolute, new OpCode.ExecuteDelegate(operations.ExecuteLDA)));
     Add(new OpCode(0xAE, "LDX", 3, AddressModes.Absolute, new OpCode.ExecuteDelegate(operations.ExecuteLDX)));
     Add(new OpCode(0xAF, "LDA", 4, AddressModes.AbsoluteLong, new OpCode.ExecuteDelegate(operations.ExecuteLDA)));
     Add(new OpCode(0xB0, "BCS", 2, AddressModes.ProgramCounterRelative, new OpCode.ExecuteDelegate(operations.ExecuteBranch)));
     Add(new OpCode(0xB1, "LDA", 2, AddressModes.DirectPageIndirectIndexedWithY, new OpCode.ExecuteDelegate(operations.ExecuteLDA)));
     Add(new OpCode(0xB2, "LDA", 2, AddressModes.DirectPageIndirect, new OpCode.ExecuteDelegate(operations.ExecuteLDA)));
     Add(new OpCode(0xB3, "LDA", 2, AddressModes.StackRelativeIndirectIndexedWithY, new OpCode.ExecuteDelegate(operations.ExecuteLDA)));
     Add(new OpCode(0xB4, "LDY", 2, AddressModes.DirectPageIndexedWithX, new OpCode.ExecuteDelegate(operations.ExecuteLDY)));
     Add(new OpCode(0xB5, "LDA", 2, AddressModes.DirectPageIndexedWithX, new OpCode.ExecuteDelegate(operations.ExecuteLDA)));
     Add(new OpCode(0xB6, "LDX", 2, AddressModes.DirectPageIndexedWithY, new OpCode.ExecuteDelegate(operations.ExecuteLDX)));
     Add(new OpCode(0xB7, "LDA", 2, AddressModes.DirectPageIndirectLongIndexedWithY, new OpCode.ExecuteDelegate(operations.ExecuteLDA)));
     Add(new OpCode(0xB8, "CLV", 1, AddressModes.Implied, new OpCode.ExecuteDelegate(operations.ExecuteStatusReg)));
     Add(new OpCode(0xB9, "LDA", 3, AddressModes.AbsoluteIndexedWithY, new OpCode.ExecuteDelegate(operations.ExecuteLDA)));
     Add(new OpCode(0xBA, "TSX", 1, AddressModes.Implied, new OpCode.ExecuteDelegate(operations.ExecuteTransfer)));
     Add(new OpCode(0xBB, "TYX", 1, AddressModes.Implied, new OpCode.ExecuteDelegate(operations.ExecuteTransfer)));
     Add(new OpCode(0xBC, "LDY", 3, AddressModes.AbsoluteIndexedWithX, new OpCode.ExecuteDelegate(operations.ExecuteLDY)));
     Add(new OpCode(0xBD, "LDA", 3, AddressModes.AbsoluteIndexedWithX, new OpCode.ExecuteDelegate(operations.ExecuteLDA)));
     Add(new OpCode(0xBE, "LDX", 3, AddressModes.AbsoluteIndexedWithY, new OpCode.ExecuteDelegate(operations.ExecuteLDX)));
     Add(new OpCode(0xBF, "LDA", 4, AddressModes.AbsoluteLongIndexedWithX, new OpCode.ExecuteDelegate(operations.ExecuteLDA)));
     Add(new OpCode(0xC0, "CPY", 2, CPU.Y, AddressModes.Immediate, new OpCode.ExecuteDelegate(operations.ExecuteCPY)));
     Add(new OpCode(0xC1, "CMP", 2, AddressModes.DirectPageIndexedIndirectWithX, new OpCode.ExecuteDelegate(operations.ExecuteCMP)));
     Add(new OpCode(0xC2, "REP", 2, AddressModes.Immediate, new OpCode.ExecuteDelegate(operations.ExecuteStatusReg)));
     Add(new OpCode(0xC3, "CMP", 2, AddressModes.StackRelative, new OpCode.ExecuteDelegate(operations.ExecuteCMP)));
     Add(new OpCode(0xC4, "CPY", 2, AddressModes.DirectPage, new OpCode.ExecuteDelegate(operations.ExecuteCPY)));
     Add(new OpCode(0xC5, "CMP", 2, AddressModes.DirectPage, new OpCode.ExecuteDelegate(operations.ExecuteCMP)));
     Add(new OpCode(0xC6, "DEC", 2, AddressModes.DirectPage, new OpCode.ExecuteDelegate(operations.ExecuteINCDEC)));
     Add(new OpCode(0xC7, "CMP", 2, AddressModes.DirectPageIndirectLong, new OpCode.ExecuteDelegate(operations.ExecuteCMP)));
     Add(new OpCode(0xC8, "INY", 1, AddressModes.Implied, new OpCode.ExecuteDelegate(operations.ExecuteINCDEC)));
     Add(new OpCode(0xC9, "CMP", 2, CPU.A, AddressModes.Immediate, new OpCode.ExecuteDelegate(operations.ExecuteCMP)));
     Add(new OpCode(0xCA, "DEX", 1, AddressModes.Implied, new OpCode.ExecuteDelegate(operations.ExecuteINCDEC)));
     Add(new OpCode(0xCB, "WAI", 1, AddressModes.Implied, new OpCode.ExecuteDelegate(operations.ExecuteWAI)));
     Add(new OpCode(0xCC, "CPY", 3, AddressModes.Absolute, new OpCode.ExecuteDelegate(operations.ExecuteCPY)));
     Add(new OpCode(0xCD, "CMP", 3, AddressModes.Absolute, new OpCode.ExecuteDelegate(operations.ExecuteCMP)));
     Add(new OpCode(0xCE, "DEC", 3, AddressModes.Absolute, new OpCode.ExecuteDelegate(operations.ExecuteINCDEC)));
     Add(new OpCode(0xCF, "CMP", 4, AddressModes.AbsoluteLong, new OpCode.ExecuteDelegate(operations.ExecuteCMP)));
     Add(new OpCode(0xD0, "BNE", 2, AddressModes.ProgramCounterRelative, new OpCode.ExecuteDelegate(operations.ExecuteBranch)));
     Add(new OpCode(0xD1, "CMP", 2, AddressModes.DirectPageIndirectIndexedWithY, new OpCode.ExecuteDelegate(operations.ExecuteCMP)));
     Add(new OpCode(0xD2, "CMP", 2, AddressModes.DirectPageIndirect, new OpCode.ExecuteDelegate(operations.ExecuteCMP)));
     Add(new OpCode(0xD3, "CMP", 2, AddressModes.StackRelativeIndirectIndexedWithY, new OpCode.ExecuteDelegate(operations.ExecuteCMP)));
     Add(new OpCode(0xD4, "PEI", 2, AddressModes.StackDirectPageIndirect, new OpCode.ExecuteDelegate(operations.ExecuteStack)));
     Add(new OpCode(0xD5, "CMP", 2, AddressModes.DirectPageIndexedWithX, new OpCode.ExecuteDelegate(operations.ExecuteCMP)));
     Add(new OpCode(0xD6, "DEC", 2, AddressModes.DirectPageIndexedWithX, new OpCode.ExecuteDelegate(operations.ExecuteINCDEC)));
     Add(new OpCode(0xD7, "CMP", 2, AddressModes.DirectPageIndirectLongIndexedWithY, new OpCode.ExecuteDelegate(operations.ExecuteCMP)));
     Add(new OpCode(0xD8, "CLD", 1, AddressModes.Implied, new OpCode.ExecuteDelegate(operations.ExecuteStatusReg)));
     Add(new OpCode(0xD9, "CMP", 3, AddressModes.AbsoluteIndexedWithY, new OpCode.ExecuteDelegate(operations.ExecuteCMP)));
     Add(new OpCode(0xDA, "PHX", 1, AddressModes.StackImplied, new OpCode.ExecuteDelegate(operations.ExecuteStack)));
     Add(new OpCode(0xDB, "STP", 1, AddressModes.Implied, new OpCode.ExecuteDelegate(operations.ExecuteMisc)));
     Add(new OpCode(0xDC, "JMP", 3, AddressModes.JmpAbsoluteIndirectLong, new OpCode.ExecuteDelegate(operations.ExecuteJumpReturn)));
     Add(new OpCode(0xDD, "CMP", 3, AddressModes.AbsoluteIndexedWithX, new OpCode.ExecuteDelegate(operations.ExecuteCMP)));
     Add(new OpCode(0xDE, "DEC", 3, AddressModes.AbsoluteIndexedWithX, new OpCode.ExecuteDelegate(operations.ExecuteINCDEC)));
     Add(new OpCode(0xDF, "CMP", 4, AddressModes.AbsoluteLongIndexedWithX, new OpCode.ExecuteDelegate(operations.ExecuteCMP)));
     Add(new OpCode(0xE0, "CPX", 2, CPU.X, AddressModes.Immediate, new OpCode.ExecuteDelegate(operations.ExecuteCPX)));
     Add(new OpCode(0xE1, "SBC", 2, AddressModes.DirectPageIndexedIndirectWithX, new OpCode.ExecuteDelegate(operations.ExecuteSBC)));
     Add(new OpCode(0xE2, "SEP", 2, AddressModes.Immediate, new OpCode.ExecuteDelegate(operations.ExecuteStatusReg)));
     Add(new OpCode(0xE3, "SBC", 2, AddressModes.StackRelative, new OpCode.ExecuteDelegate(operations.ExecuteSBC)));
     Add(new OpCode(0xE4, "CPX", 2, AddressModes.DirectPage, new OpCode.ExecuteDelegate(operations.ExecuteCPX)));
     Add(new OpCode(0xE5, "SBC", 2, AddressModes.DirectPage, new OpCode.ExecuteDelegate(operations.ExecuteSBC)));
     Add(new OpCode(0xE6, "INC", 2, AddressModes.DirectPage, new OpCode.ExecuteDelegate(operations.ExecuteINCDEC)));
     Add(new OpCode(0xE7, "SBC", 2, AddressModes.DirectPageIndirectLong, new OpCode.ExecuteDelegate(operations.ExecuteSBC)));
     Add(new OpCode(0xE8, "INX", 1, AddressModes.Implied, new OpCode.ExecuteDelegate(operations.ExecuteINCDEC)));
     Add(new OpCode(0xE9, "SBC", 2, CPU.A, AddressModes.Immediate, new OpCode.ExecuteDelegate(operations.ExecuteSBC)));
     Add(new OpCode(0xEA, "NOP", 1, AddressModes.Implied, new OpCode.ExecuteDelegate(operations.ExecuteMisc)));
     Add(new OpCode(0xEB, "XBA", 1, AddressModes.Implied, new OpCode.ExecuteDelegate(operations.ExecuteMisc)));
     Add(new OpCode(0xEC, "CPX", 3, AddressModes.Absolute, new OpCode.ExecuteDelegate(operations.ExecuteCPX)));
     Add(new OpCode(0xED, "SBC", 3, AddressModes.Absolute, new OpCode.ExecuteDelegate(operations.ExecuteSBC)));
     Add(new OpCode(0xEE, "INC", 3, AddressModes.Absolute, new OpCode.ExecuteDelegate(operations.ExecuteINCDEC)));
     Add(new OpCode(0xEF, "SBC", 4, AddressModes.AbsoluteLong, new OpCode.ExecuteDelegate(operations.ExecuteSBC)));
     Add(new OpCode(0xF0, "BEQ", 2, AddressModes.ProgramCounterRelative, new OpCode.ExecuteDelegate(operations.ExecuteBranch)));
     Add(new OpCode(0xF1, "SBC", 2, AddressModes.DirectPageIndirectIndexedWithY, new OpCode.ExecuteDelegate(operations.ExecuteSBC)));
     Add(new OpCode(0xF2, "SBC", 2, AddressModes.DirectPageIndirect, new OpCode.ExecuteDelegate(operations.ExecuteSBC)));
     Add(new OpCode(0xF3, "SBC", 2, AddressModes.StackRelativeIndirectIndexedWithY, new OpCode.ExecuteDelegate(operations.ExecuteSBC)));
     Add(new OpCode(0xF4, "PEA", 3, AddressModes.Immediate, new OpCode.ExecuteDelegate(operations.ExecuteStack)));
     Add(new OpCode(0xF5, "SBC", 2, AddressModes.DirectPageIndexedWithX, new OpCode.ExecuteDelegate(operations.ExecuteSBC)));
     Add(new OpCode(0xF6, "INC", 2, AddressModes.DirectPageIndexedWithX, new OpCode.ExecuteDelegate(operations.ExecuteINCDEC)));
     Add(new OpCode(0xF7, "SBC", 2, AddressModes.DirectPageIndirectLongIndexedWithY, new OpCode.ExecuteDelegate(operations.ExecuteSBC)));
     Add(new OpCode(0xF8, "SED", 1, AddressModes.Implied, new OpCode.ExecuteDelegate(operations.ExecuteStatusReg)));
     Add(new OpCode(0xF9, "SBC", 3, AddressModes.AbsoluteIndexedWithY, new OpCode.ExecuteDelegate(operations.ExecuteSBC)));
     Add(new OpCode(0xFA, "PLX", 1, AddressModes.StackImplied, new OpCode.ExecuteDelegate(operations.ExecuteStack)));
     Add(new OpCode(0xFB, "XCE", 1, AddressModes.Implied, new OpCode.ExecuteDelegate(operations.ExecuteStatusReg)));
     Add(new OpCode(0xFC, "JSR", 3, AddressModes.JmpAbsoluteIndexedIndirectWithX, new OpCode.ExecuteDelegate(operations.ExecuteJumpReturn)));
     Add(new OpCode(0xFD, "SBC", 3, AddressModes.AbsoluteIndexedWithX, new OpCode.ExecuteDelegate(operations.ExecuteSBC)));
     Add(new OpCode(0xFE, "INC", 3, AddressModes.AbsoluteIndexedWithX, new OpCode.ExecuteDelegate(operations.ExecuteINCDEC)));
     Add(new OpCode(0xFF, "SBC", 4, AddressModes.AbsoluteLongIndexedWithX, new OpCode.ExecuteDelegate(operations.ExecuteSBC)));
 }
예제 #6
0
        public FoenixSystem(BoardVersion version, string DefaultKernel)
        {
            boardVersion = version;

            int          memSize         = MemoryMap.RAM_SIZE;
            CodecRAM     codec           = null;
            SDCardDevice sdcard          = null;
            byte         SystemStat      = 0;                          // FMX
            int          keyboardAddress = MemoryMap.KBD_DATA_BUF_FMX; // FMX

            switch (boardVersion)
            {
            case BoardVersion.RevB:
                break;

            case BoardVersion.RevC:
                memSize *= 2;
                break;

            case BoardVersion.RevU:
                SystemStat      = 1;
                keyboardAddress = MemoryMap.KBD_DATA_BUF_U;
                break;

            case BoardVersion.RevUPlus:
                memSize        *= 2;
                SystemStat      = 5;
                keyboardAddress = MemoryMap.KBD_DATA_BUF_U;
                break;
            }
            if (boardVersion == BoardVersion.RevB)
            {
                codec  = new CodecRAM(MemoryMap.CODEC_WR_CTRL, 2); // This register is only a single byte but we allow writing a word
                sdcard = new CH376SRegister(MemoryMap.SDCARD_DATA, MemoryMap.SDCARD_SIZE);
            }
            else
            {
                codec  = new CodecRAM(MemoryMap.CODEC_WR_CTRL_FMX, 2); // This register is only a single byte but we allow writing a word
                sdcard = new GabeSDController(MemoryMap.GABE_SDC_CTRL_START, MemoryMap.GABE_SDC_CTRL_SIZE);
            }

            MemMgr = new MemoryManager
            {
                RAM   = new MemoryRAM(MemoryMap.RAM_START, memSize),                // RAM: 2MB Rev B & U, 4MB Rev C & U+
                VICKY = new MemoryRAM(MemoryMap.VICKY_START, MemoryMap.VICKY_SIZE), // 60K
                VIDEO = new MemoryRAM(MemoryMap.VIDEO_START, MemoryMap.VIDEO_SIZE), // 4MB Video
                FLASH = new MemoryRAM(MemoryMap.FLASH_START, MemoryMap.FLASH_SIZE), // 8MB RAM
                GABE  = new GabeRAM(MemoryMap.GABE_START, MemoryMap.GABE_SIZE),     // 4K

                // Special devices
                MATH      = new MathCoproRegister(MemoryMap.MATH_START, MemoryMap.MATH_END - MemoryMap.MATH_START + 1), // 48 bytes
                KEYBOARD  = new KeyboardRegister(keyboardAddress, 5),
                SDCARD    = sdcard,
                INTERRUPT = new InterruptController(MemoryMap.INT_PENDING_REG0, 4),
                UART1     = new UART(MemoryMap.UART1_REGISTERS, 8),
                UART2     = new UART(MemoryMap.UART2_REGISTERS, 8),
                OPL2      = new OPL2(MemoryMap.OPL2_S_BASE, 256),
                FLOAT     = new MathFloatRegister(MemoryMap.FLOAT_START, MemoryMap.FLOAT_END - MemoryMap.FLOAT_START + 1),
                MPU401    = new MPU401(MemoryMap.MPU401_REGISTERS, 2),
                VDMA      = new VDMA(MemoryMap.VDMA_START, MemoryMap.VDMA_SIZE),
                TIMER0    = new TimerRegister(MemoryMap.TIMER0_CTRL_REG, 8),
                TIMER1    = new TimerRegister(MemoryMap.TIMER1_CTRL_REG, 8),
                TIMER2    = new TimerRegister(MemoryMap.TIMER2_CTRL_REG, 8)
            };
            MemMgr.CODEC = codec;
            MemMgr.KEYBOARD.SetKernel(this);

            // Assign memory variables used by other processes
            CPU = new CPU(MemMgr);

            MemMgr.VDMA.setVideoRam(MemMgr.VIDEO);
            MemMgr.VDMA.setSystemRam(MemMgr.RAM);
            MemMgr.VDMA.setVickyRam(MemMgr.VICKY);
            MemMgr.GABE.WriteByte(MemoryMap.GABE_SYS_STAT - MemoryMap.GABE_START, SystemStat);

            // Load the kernel.hex if present
            ResetCPU(DefaultKernel);

            // Write bytes $9F in the joystick registers to mean that they are not installed.
            MemMgr.WriteWord(0xAFE800, 0x9F9F);
            MemMgr.WriteWord(0xAFE802, 0x9F9F);
            MemMgr.TIMER0.TimerInterruptDelegate += TimerEvent0;
            MemMgr.TIMER1.TimerInterruptDelegate += TimerEvent1;
            MemMgr.TIMER2.TimerInterruptDelegate += TimerEvent2;

            // Set the Vicky rev and subrev
            MemMgr.VICKY.WriteWord(0x1C, 0x7654);
            MemMgr.VICKY.WriteWord(0x1E, 0x3456);
            MemMgr.VICKY.WriteByte(MemoryMap.GAMMA_CTRL_REG - MemoryMap.VICKY_BASE_ADDR, 0x11); // Gamma and hi-res are off
            // set the date
            MemMgr.VICKY.WriteByte(MemoryMap.FPGA_DOR - MemoryMap.VICKY_BASE_ADDR, 0x1);
            MemMgr.VICKY.WriteByte(MemoryMap.FPGA_MOR - MemoryMap.VICKY_BASE_ADDR, 0x2);
            MemMgr.VICKY.WriteByte(MemoryMap.FPGA_YOR - MemoryMap.VICKY_BASE_ADDR, 0x21);

            // Set board revision
            MemMgr.GABE.WriteByte(MemoryMap.REVOFPCB_C - MemoryMap.GABE_START, (byte)'E');
            MemMgr.GABE.WriteByte(MemoryMap.REVOFPCB_4 - MemoryMap.GABE_START, (byte)'M');
            MemMgr.GABE.WriteByte(MemoryMap.REVOFPCB_A - MemoryMap.GABE_START, (byte)'U');
            // Set the rev date
        }