// This is a huge can of worms to correct emulate the state of the scanline during emulation.
// I would revisit this later.
This is a huge can of worms to correct emulate the state of the scanline during emulation.
I would revisit this later.
This is a huge can of worms to correct emulate the state of the scanline during emulation . I would revisit this later .
pub fn step(&mut self, flag: &mut u8) {
        match self.mode {
            GpuMode::OAM => self.check_clock(80, |gpu| gpu.mode = GpuMode::VRAM),
            GpuMode::VRAM => self.check_clock(172, |gpu| gpu.mode = GpuMode::HBlank),
            GpuMode::HBlank => self.check_clock(204, |gpu| {
                gpu.scanline += 1;
                if gpu.scanline == END_HBLANK {
                    gpu._vblank_count += 1;
                    *flag |= cpu::VBLANK;
                    gpu.mode = GpuMode::VBlank;
                } else {
                    gpu.mode = GpuMode::OAM;
                }
            }),
            GpuMode::VBlank => self.check_clock(456, |gpu| {
                gpu.scanline += 1;
                if gpu.scanline == END_VBLANK {
                    gpu.mode = GpuMode::OAM;
                    gpu.scanline = 0;
                }
            }),
        }
    }
pub fn step ( & mut self , flag : & mut u8 ) { match self . mode { GpuMode :: OAM => self . check_clock ( 80 , | gpu | gpu . mode = GpuMode :: VRAM ) , GpuMode :: VRAM => self . check_clock ( 172 , | gpu | gpu . mode = GpuMode :: HBlank ) , GpuMode :: HBlank => self . check_clock ( 204 , | gpu | { gpu . scanline += 1 ; if gpu . scanline == END_HBLANK { gpu . _vblank_count += 1 ; * flag |= cpu :: VBLANK ; gpu . mode = GpuMode :: VBlank ; } else { gpu . mode = GpuMode :: OAM ; } } ) , GpuMode :: VBlank => self . check_clock ( 456 , | gpu | { gpu . scanline += 1 ; if gpu . scanline == END_VBLANK { gpu . mode = GpuMode :: OAM ; gpu . scanline = 0 ; } } ) , } }
This is a huge can of worms to correct emulate the state of the scanline during emulation.
This is a huge can of worms to correct emulate the state of the scanline during emulation .
&mut self
flag
&mut u8