// return value indicated whether a vblank has happened
// true -> vblank has happened, render the frame buffer
// false -> no vblank, continue stepping
return value indicated whether a vblank has happened
true -> vblank has happened, render the frame buffer
false -> no vblank, continue stepping
return value indicated whether a vblank has happened true - > vblank has happened render the frame buffer false - > no vblank continue stepping
pub fn step(
        &mut self,
        cycles: i32,
        memory: &mut Memory,
        pixel_mapper: &mut impl PixelMapper,
    ) -> bool {
        let mut vblank = false;
        memory.gpu_cycles.cycles_counter += cycles;
        if !memory.screen_disabled {
            match memory.lcd_status_mode {
                HBLANK => vblank = self.step_hblank(memory),
                VBLANK => self.step_vblank(memory, cycles),
                OAM_SCAN => self.step_oam_scan(memory),
                LCD_TRANSFER => self.step_lcd_transfer(memory, cycles, pixel_mapper),
                _ => unreachable!(),
            }
        } else if memory.gpu_cycles.screen_enable_delay_cycles > 0 {
            memory.gpu_cycles.screen_enable_delay_cycles -= cycles;
            if memory.gpu_cycles.screen_enable_delay_cycles <= 0 {
                self.hide_frames = 3;
                self.vblank_line = 0;
                self.tile_cycles_counter = 0;
                memory.screen_disabled = false;
                memory.lcd_status_mode = 0;
                memory.scan_line = 0;
                memory.irq48_signal = 0;
                memory.gpu_cycles.screen_enable_delay_cycles = 0;
                memory.gpu_cycles.cycles_counter = 0;
                memory.gpu_cycles.aux_cycles_counter = 0;
                memory.gpu_cycles.window_line = 0;
                memory.gpu_cycles.pixel_counter = 0;
                let stat = memory.load(mmu::LCD_INDEX);
                if bit_utils::is_set(stat, 5) {
                    memory.request_interrupt(Interrupt::Lcd);
                    memory.irq48_signal = bit_utils::set_bit(memory.irq48_signal, 2);
                }
                memory.compare_ly_to_lyc();
            }
        } else if memory.gpu_cycles.cycles_counter >= 70224 {
            memory.gpu_cycles.cycles_counter -= 70224;
            vblank = true;
        }
        vblank
    }
pub fn step ( & mut self , cycles : i32 , memory : & mut Memory , pixel_mapper : & mut impl PixelMapper , ) -> bool { let mut vblank = false ; memory . gpu_cycles . cycles_counter += cycles ; if ! memory . screen_disabled { match memory . lcd_status_mode { HBLANK => vblank = self . step_hblank ( memory ) , VBLANK => self . step_vblank ( memory , cycles ) , OAM_SCAN => self . step_oam_scan ( memory ) , LCD_TRANSFER => self . step_lcd_transfer ( memory , cycles , pixel_mapper ) , _ => unreachable ! ( ) , } } else if memory . gpu_cycles . screen_enable_delay_cycles > 0 { memory . gpu_cycles . screen_enable_delay_cycles -= cycles ; if memory . gpu_cycles . screen_enable_delay_cycles <= 0 { self . hide_frames = 3 ; self . vblank_line = 0 ; self . tile_cycles_counter = 0 ; memory . screen_disabled = false ; memory . lcd_status_mode = 0 ; memory . scan_line = 0 ; memory . irq48_signal = 0 ; memory . gpu_cycles . screen_enable_delay_cycles = 0 ; memory . gpu_cycles . cycles_counter = 0 ; memory . gpu_cycles . aux_cycles_counter = 0 ; memory . gpu_cycles . window_line = 0 ; memory . gpu_cycles . pixel_counter = 0 ; let stat = memory . load ( mmu :: LCD_INDEX ) ; if bit_utils :: is_set ( stat , 5 ) { memory . request_interrupt ( Interrupt :: Lcd ) ; memory . irq48_signal = bit_utils :: set_bit ( memory . irq48_signal , 2 ) ; } memory . compare_ly_to_lyc ( ) ; } } else if memory . gpu_cycles . cycles_counter >= 70224 { memory . gpu_cycles . cycles_counter -= 70224 ; vblank = true ; } vblank }
return value indicated whether a vblank has happened
true -> vblank has happened, render the frame buffer
false -> no vblank, continue stepping
return value indicated whether a vblank has happened true - > vblank has happened render the frame buffer false - > no vblank continue stepping
&mut self
cycles
i32
memory
&mut Memory
pixel_mapper
&mut impl PixelMapper