fn jump_relative(ctx: &mut impl CpuContext, cond: ConditionCode) {
    // Loading the offset also moves the program counter over the next instruction, which is
    // good because the jump is relative to the following instruction.
    let offset = Operand8::Immediate.read(ctx) as i8;
    let base = ctx.cpustate().regs.pc;
    // JR doesn't set any flags.
    let (dest, _) = offset_addr(base, offset);
    if cond.evaluate(ctx) {
        trace!("Relative jump by {} from {} to {}", offset, base, dest);
        ctx.cpustate_mut().regs.pc = dest;
    } else {
        trace!("Skipping jump by {} from {} to {}", offset, base, dest);
    }
}
/// Implements the relative jump instruction.
Implements the relative jump instruction.
Implements the relative jump instruction .
fn jump_relative(ctx: &mut impl CpuContext, cond: ConditionCode) {
    // Loading the offset also moves the program counter over the next instruction, which is
    // good because the jump is relative to the following instruction.
    let offset = Operand8::Immediate.read(ctx) as i8;
    let base = ctx.cpustate().regs.pc;
    // JR doesn't set any flags.
    let (dest, _) = offset_addr(base, offset);
    if cond.evaluate(ctx) {
        trace!("Relative jump by {} from {} to {}", offset, base, dest);
        ctx.cpustate_mut().regs.pc = dest;
    } else {
        trace!("Skipping jump by {} from {} to {}", offset, base, dest);
    }
}
fn jump_relative ( ctx : & mut impl CpuContext , cond : ConditionCode ) { // Loading the offset also moves the program counter over the next instruction, which is // good because the jump is relative to the following instruction. let offset = Operand8 :: Immediate . read ( ctx ) as i8 ; let base = ctx . cpustate ( ) . regs . pc ; // JR doesn't set any flags. let ( dest , _ ) = offset_addr ( base , offset ) ; if cond . evaluate ( ctx ) { trace ! ( " " offset base dest ) ; ctx . cpustate_mut ( ) . regs . pc = dest ; } else { trace ! ( " " offset base dest ) ; } }
Implements the relative jump instruction.
Implements the relative jump instruction .
ctx
&mut impl CpuContext
cond
ConditionCode
ctx
&mut impl CpuContext
cond
ConditionCode