fn execute(self, ctx: &mut impl CpuContext) {
        match self {
            Self::Nop => {}
            Self::Stop => panic!("STOP is bizarre and complicated and not implemented."),
            Self::JumpRelative(cond) => jump_relative(ctx, cond),
            Self::Inc8(operand) => inc8(ctx, operand),
            Self::Dec8(operand) => dec8(ctx, operand),
            Self::Load8 { dest, source } => load8(ctx, dest, source),
            Self::Inc16(operand) => inc16(ctx, operand),
            Self::Dec16(operand) => dec16(ctx, operand),
            Self::Load16 { dest, source } => load16(ctx, dest, source),
            Self::Add16(operand) => add16(ctx, operand),
            Self::Halt => halt(ctx),
            Self::AluOp { operand, op } => alu_op(ctx, operand, op),
            Self::AluUnary(op) => op.exec(ctx),
            Self::Call(cond) => call(ctx, cond),
            Self::Jump(cond) => jump(ctx, cond),
            Self::Ret(cond) => ret(ctx, cond),
            Self::Push(operand) => push(ctx, operand),
            Self::Pop(operand) => pop(ctx, operand),
            Self::PrefixCB => CBOpcode::load_and_execute(ctx),
            Self::DisableInterrupts => disable_interrupts(ctx),
            Self::EnableInterrupts => enable_interrupts(ctx),
            Self::RetInterrupt => interrupt_return(ctx),
            Self::OffsetSp => offset_sp(ctx),
            Self::AddressOfOffsetSp => address_of_offset_sp(ctx),
            Self::JumpHL => jump_hl(ctx),
            Self::Reset(dest) => reset(ctx, dest),
            // A brief note on this doc page:
            // https://gbdev.io/pandocs/CPU_Comparison_with_Z80.html
            // says that the unused opcodes will lock up the CPU, rather than behave as a
            // no-op.
            Self::MissingInstruction(opcode) => {
                warn!(
                    "Missing instruction {:#04X} encountered. Treating as NOP instead of locking.",
                    opcode
                );
            }
        }
    }
/// Execute this opcode on the given context.
Execute this opcode on the given context.
Execute this opcode on the given context .
fn execute(self, ctx: &mut impl CpuContext) {
        match self {
            Self::Nop => {}
            Self::Stop => panic!("STOP is bizarre and complicated and not implemented."),
            Self::JumpRelative(cond) => jump_relative(ctx, cond),
            Self::Inc8(operand) => inc8(ctx, operand),
            Self::Dec8(operand) => dec8(ctx, operand),
            Self::Load8 { dest, source } => load8(ctx, dest, source),
            Self::Inc16(operand) => inc16(ctx, operand),
            Self::Dec16(operand) => dec16(ctx, operand),
            Self::Load16 { dest, source } => load16(ctx, dest, source),
            Self::Add16(operand) => add16(ctx, operand),
            Self::Halt => halt(ctx),
            Self::AluOp { operand, op } => alu_op(ctx, operand, op),
            Self::AluUnary(op) => op.exec(ctx),
            Self::Call(cond) => call(ctx, cond),
            Self::Jump(cond) => jump(ctx, cond),
            Self::Ret(cond) => ret(ctx, cond),
            Self::Push(operand) => push(ctx, operand),
            Self::Pop(operand) => pop(ctx, operand),
            Self::PrefixCB => CBOpcode::load_and_execute(ctx),
            Self::DisableInterrupts => disable_interrupts(ctx),
            Self::EnableInterrupts => enable_interrupts(ctx),
            Self::RetInterrupt => interrupt_return(ctx),
            Self::OffsetSp => offset_sp(ctx),
            Self::AddressOfOffsetSp => address_of_offset_sp(ctx),
            Self::JumpHL => jump_hl(ctx),
            Self::Reset(dest) => reset(ctx, dest),
            // A brief note on this doc page:
            // https://gbdev.io/pandocs/CPU_Comparison_with_Z80.html
            // says that the unused opcodes will lock up the CPU, rather than behave as a
            // no-op.
            Self::MissingInstruction(opcode) => {
                warn!(
                    "Missing instruction {:#04X} encountered. Treating as NOP instead of locking.",
                    opcode
                );
            }
        }
    }
fn execute ( self , ctx : & mut impl CpuContext ) { match self { Self :: Nop => { } Self :: Stop => panic ! ( " " ) , Self :: JumpRelative ( cond ) => jump_relative ( ctx , cond ) , Self :: Inc8 ( operand ) => inc8 ( ctx , operand ) , Self :: Dec8 ( operand ) => dec8 ( ctx , operand ) , Self :: Load8 { dest , source } => load8 ( ctx , dest , source ) , Self :: Inc16 ( operand ) => inc16 ( ctx , operand ) , Self :: Dec16 ( operand ) => dec16 ( ctx , operand ) , Self :: Load16 { dest , source } => load16 ( ctx , dest , source ) , Self :: Add16 ( operand ) => add16 ( ctx , operand ) , Self :: Halt => halt ( ctx ) , Self :: AluOp { operand , op } => alu_op ( ctx , operand , op ) , Self :: AluUnary ( op ) => op . exec ( ctx ) , Self :: Call ( cond ) => call ( ctx , cond ) , Self :: Jump ( cond ) => jump ( ctx , cond ) , Self :: Ret ( cond ) => ret ( ctx , cond ) , Self :: Push ( operand ) => push ( ctx , operand ) , Self :: Pop ( operand ) => pop ( ctx , operand ) , Self :: PrefixCB => CBOpcode :: load_and_execute ( ctx ) , Self :: DisableInterrupts => disable_interrupts ( ctx ) , Self :: EnableInterrupts => enable_interrupts ( ctx ) , Self :: RetInterrupt => interrupt_return ( ctx ) , Self :: OffsetSp => offset_sp ( ctx ) , Self :: AddressOfOffsetSp => address_of_offset_sp ( ctx ) , Self :: JumpHL => jump_hl ( ctx ) , Self :: Reset ( dest ) => reset ( ctx , dest ) , // A brief note on this doc page: // https://gbdev.io/pandocs/CPU_Comparison_with_Z80.html // says that the unused opcodes will lock up the CPU, rather than behave as a // no-op. Self :: MissingInstruction ( opcode ) => { warn ! ( " " opcode ) ; } } }
Execute this opcode on the given context.
Execute this opcode on the given context .
self
ctx
&mut impl CpuContext
self
ctx
&mut impl CpuContext