예제 #1
0
        // 0 - OAM Search
        // 1 - Pixel Transfer
        // 2 - H-Blank
        // 3 - V-Blank

        public PPU(InterruptController interruptController, LCD display)
        {
            vram = new byte[0x2000];
            oam  = new byte[40 * 4];
            // 4 bytes of data for each of 40 sprites
            output = new byte[256 * 256];
            // one color for each pixel

            lcd      = display;
            finished = new DirectBitmap(160, 144);

            // Assign Default Values
            lcdControl         = new DataBus <byte>(0);
            lcdStatus          = new DataBus <byte>(0);
            scrollY            = new DataBus <byte>(0);
            scrollX            = new DataBus <byte>(0);
            scanLine           = new DataBus <byte>(0);
            scanLineCompare    = new DataBus <byte>(0);
            dmaTransferAddress = new DataBus <byte>(0);
            bgPalette          = new DataBus <byte>(0);
            obj0Palette        = new DataBus <byte>(0);
            obj1Palette        = new DataBus <byte>(0);
            windowY            = new DataBus <byte>(0);
            windowX            = new DataBus <byte>(0);

            ppuState = 0;
            ppuClock = 0;
            rendered = false;
        }
예제 #2
0
        private void Setup()
        {
            LCD lcd = new LCD(160 * 4, 144 * 4);

            interruptController = new InterruptController();
            timer     = new Timer(interruptController);
            ppu       = new PPU(interruptController, lcd);
            registers = new Registers(timer.TimerRegisters, ppu.DisplayRegisters);

            stopwatch = new Stopwatch();
            lcd.Start();
        }