Beispiel #1
0
        public Memory(Timers timers, Ppu ppu, Joypad joypad, Cartridge cartridge)
        {
            this.timers    = timers;
            this.ppu       = ppu;
            this.joypad    = joypad;
            this.cartridge = cartridge;

            Mem = new byte[0x10000];

            try
            {
                BootRomEnabled = true;
                bootRom        = File.ReadAllBytes("DMG_ROM.bin");
            }
            catch (FileNotFoundException)
            {
                BootRomEnabled = false;
            }
        }
Beispiel #2
0
        public Cpu(Memory mem, Ppu ppu, Timers timers)
        {
            this.mem    = mem;
            this.timers = timers;
            this.ppu    = ppu;

            if (!mem.BootRomEnabled)
            {
                AF = 0x01b0;
                BC = 0x0013;
                DE = 0x00d8;
                HL = 0x014d;
                PC = 0x0100;
                SP = 0xfffe;

                ppu.Lcdc = 0x91;
                ppu.Bgp  = 0xfc;
                ppu.Obp0 = 0xff;
                ppu.Obp1 = 0xff;
            }
        }