pub fn run(&mut self, cycles: usize) {
        self.inside_run = true;
        if self.overshot_cycles > cycles as isize {
            self.overshot_cycles -= cycles as isize;
            return;
        }

        let end_cycle = ((self.cycle + cycles) as isize - self.overshot_cycles) as usize;

        while self.cycle < end_cycle {
            self.tick();
        }
        self.overshot_cycles = self.cycle as isize - end_cycle as isize;

        // Pretend cycle is u16 and let it overflow safely
        while self.cycle > 0xffff {
            self.cycle -= 0xffff;
        }
        self.inside_run = false;
    }
// Run multiple ticks until cycles have been met
// Resets cycle count, so that it won't overflow
Run multiple ticks until cycles have been met
Resets cycle count, so that it won't overflow
Run multiple ticks until cycles have been met Resets cycle count so that it won ' t overflow
pub fn run(&mut self, cycles: usize) {
        self.inside_run = true;
        if self.overshot_cycles > cycles as isize {
            self.overshot_cycles -= cycles as isize;
            return;
        }
        let end_cycle = ((self.cycle + cycles) as isize - self.overshot_cycles) as usize;
        while self.cycle < end_cycle {
            self.tick();
        }
        self.overshot_cycles = self.cycle as isize - end_cycle as isize;
        // Pretend cycle is u16 and let it overflow safely
        while self.cycle > 0xffff {
            self.cycle -= 0xffff;
        }
        self.inside_run = false;
    }
pub fn run ( & mut self , cycles : usize ) { self . inside_run = true ; if self . overshot_cycles > cycles as isize { self . overshot_cycles -= cycles as isize ; return ; } let end_cycle = ( ( self . cycle + cycles ) as isize - self . overshot_cycles ) as usize ; while self . cycle < end_cycle { self . tick ( ) ; } self . overshot_cycles = self . cycle as isize - end_cycle as isize ; // Pretend cycle is u16 and let it overflow safely while self . cycle > 0xffff { self . cycle -= 0xffff ; } self . inside_run = false ; }
Run multiple ticks until cycles have been met
Resets cycle count, so that it won't overflow
Run multiple ticks until cycles have been met Resets cycle count so that it won ' t overflow
&mut self
cycles
usize
&mut self
cycles
usize