pub fn call_conditional_d16(cpu: &mut CPU, opcode: u8) -> u8 {
    // Read 16-bit jump target address
    let jump_target = cpu.fetch16();

    if opcode_flag_test(opcode, cpu.registers.f) {
        // Push current PC to the stack
        let current_pc = cpu.registers.pc;
        push_stack_d16(cpu, current_pc);

        // Jump PC to the target address
        cpu.registers.pc = jump_target;

        24
    } else {
        12
    }
}
/// Jump to a different address using 16-bit data as an address after first pushing the current PC
/// to the stack if a given flag status condition matches.
///
/// Takes 24 cycles if condition matches, 12 cycles if it doesn't match.
///
/// # Examples
///
/// ```asm
/// CALL NZ $0150 ; IF !Flags::RegisterFlags::ZERO { STACK <<- PC; PC <- 0x0150 }
/// ```
Jump to a different address using 16-bit data as an address after first pushing the current PC
to the stack if a given flag status condition matches.

Takes 24 cycles if condition matches, 12 cycles if it doesn't match.
Jump to a different address using 16 - bit data as an address after first pushing the current PC to the stack if a given flag status condition matches . Takes 24 cycles if condition matches 12 cycles if it doesn ' t match .
pub fn call_conditional_d16(cpu: &mut CPU, opcode: u8) -> u8 {
    // Read 16-bit jump target address
    let jump_target = cpu.fetch16();
    if opcode_flag_test(opcode, cpu.registers.f) {
        // Push current PC to the stack
        let current_pc = cpu.registers.pc;
        push_stack_d16(cpu, current_pc);
        // Jump PC to the target address
        cpu.registers.pc = jump_target;
        24
    } else {
        12
    }
}
pub fn call_conditional_d16 ( cpu : & mut CPU , opcode : u8 ) -> u8 { // Read 16-bit jump target address let jump_target = cpu . fetch16 ( ) ; if opcode_flag_test ( opcode , cpu . registers . f ) { // Push current PC to the stack let current_pc = cpu . registers . pc ; push_stack_d16 ( cpu , current_pc ) ; // Jump PC to the target address cpu . registers . pc = jump_target ; 24 } else { 12 } }
Jump to a different address using 16-bit data as an address after first pushing the current PC
to the stack if a given flag status condition matches.
Jump to a different address using 16 - bit data as an address after first pushing the current PC to the stack if a given flag status condition matches .
cpu
&mut CPU
opcode
u8
cpu
&mut CPU
opcode
u8
examples
None