Beispiel #1
0
 public LCDController(LCD display, AddressSpace memory)
 {
     this.display = display;
     mem          = memory;
     // perform vBlank at 59.73 Hz or this many Cycles
     vBlankCycleTiming = (int)(Gameboy.clockTimingInHz / 59.73f);
     testFrame         = display.buildRandomSolidColorImage();
     fpsStopWatch.Start();
 }
Beispiel #2
0
        public void tick()
        {
            if (fpsStopWatch.ElapsedMilliseconds > 1000)
            {
                fps          = (frameCounter / (double)((double)fpsStopWatch.ElapsedMilliseconds * .001));
                frameCounter = 0;
                fpsStopWatch.Restart();
            }
            vBlankCycleCount++;
            // Divide Clock to 59.73 Hz (Probably D)

            // perform VBlank at 59.73 HZ or every
            if (vBlankCycleCount >= vBlankCycleTiming)
            {
                mem.requestInterrupt(CPU.InterruptType.VBlank);
                display.setFrameBuffer(display.buildRandomSolidColorImage());
                //display.setFrameBuffer(testFrame);
                display.drawImage();
                vBlankCycleCount = 0;
                frameCounter++;
            }
        }