Exemple #1
0
        public CPU(Memory memory, PPU ppu, LoadUnit loadUnit, ALU alu, MiscUnit miscUnit, JumpUnit jumpUnit, BitUnit bitUnit)
        {
            this.ppu = ppu;

            this.loadUnit = loadUnit;
            this.alu      = alu;
            this.miscUnit = miscUnit;
            this.jumpUnit = jumpUnit;
            this.bitUnit  = bitUnit;

            this.loadUnit.TickEvent += Tick;
            this.alu.TickEvent      += Tick;
            this.jumpUnit.TickEvent += Tick;
            this.bitUnit.TickEvent  += Tick;

            CreateLoadUnitOpCodes();
            CreateALUOpCodes();
            CreateMiscOpCodes();
            CreateJumpOpCodes();
            CreateBitUnitOpCodes();

            this.memory = memory;
            this.timer  = new Timer(memory);
            this.memory.DivResetEvent += DivResetHandler;

            interruptVector = new Dictionary <Interrupt, ushort>
            {
                { Interrupt.VBlank, 0x40 },
                { Interrupt.LCDStat, 0x48 },
                { Interrupt.Timer, 0x50 },
                { Interrupt.Serial, 0x58 },
                { Interrupt.Joypad, 0x60 }
            };
        }
Exemple #2
0
 public CPU(Memory memory, PPU ppu) :
     this(memory,
          ppu,
          new LoadUnit(memory),
          new ALU(memory),
          new MiscUnit(memory),
          new JumpUnit(memory),
          new BitUnit(memory))
 {
 }