fn interrupt(&mut self, it: Interrupt) {

        // If the CPU was halted it's time to wake it up.
        self.halted = false;
        // Interrupt are disabled when entering an interrupt handler.
        self.disable_interrupts();

        let handler_addr = match it {
            Interrupt::VBlank => 0x40,
            Interrupt::Lcdc   => 0x48,
            Interrupt::Timer  => 0x50,
        };

        // Push current value to stack
        let pc = self.pc();
        self.push_word(pc);

        // Context switching delay
        self.delay(6);

        // Jump to IT handler
        self.set_pc(handler_addr);
    }
/// Execute interrupt handler for `it`
Execute interrupt handler for `it`
Execute interrupt handler for ` it `
fn interrupt(&mut self, it: Interrupt) {
        // If the CPU was halted it's time to wake it up.
        self.halted = false;
        // Interrupt are disabled when entering an interrupt handler.
        self.disable_interrupts();
        let handler_addr = match it {
            Interrupt::VBlank => 0x40,
            Interrupt::Lcdc   => 0x48,
            Interrupt::Timer  => 0x50,
        };
        // Push current value to stack
        let pc = self.pc();
        self.push_word(pc);
        // Context switching delay
        self.delay(6);
        // Jump to IT handler
        self.set_pc(handler_addr);
    }
fn interrupt ( & mut self , it : Interrupt ) { // If the CPU was halted it's time to wake it up. self . halted = false ; // Interrupt are disabled when entering an interrupt handler. self . disable_interrupts ( ) ; let handler_addr = match it { Interrupt :: VBlank => 0x40 , Interrupt :: Lcdc => 0x48 , Interrupt :: Timer => 0x50 , } ; // Push current value to stack let pc = self . pc ( ) ; self . push_word ( pc ) ; // Context switching delay self . delay ( 6 ) ; // Jump to IT handler self . set_pc ( handler_addr ) ; }
Execute interrupt handler for `it`
Execute interrupt handler for ` it `
&mut self
it
Interrupt
&mut self
it
Interrupt