fn condition(cpu: &Cpu, cond: u8) -> bool {
    match cond {
        0x0 => cpu.zero(), // Equal
        0x1 => !cpu.zero(), // Not equal
        0x2 => cpu.negative(), // Negative
        0x3 => !cpu.negative(), // Not negative
        0x4 => !cpu.negative() && !cpu.zero(), // Positive
        0x5 => cpu.overflow(), // Overflow
        0x6 => !cpu.overflow(), // No overflow
        0x7 => !cpu.carry() && !cpu.zero(), // Above
        0x8 => !cpu.carry(), // Above equal
        0x9 => cpu.carry(), // Below
        0xA => cpu.carry() || cpu.zero(), // Below equal
        0xB => cpu.overflow() == cpu.negative() && !cpu.zero(), // Signed greater than
        0xC => cpu.overflow() == cpu.negative(), // Signed greater than equal
        0xD => cpu.overflow() != cpu.negative(), // Signed less than
        0xE => cpu.overflow() != cpu.negative() || cpu.zero(), // Signed less Than equal
        _ => false
    }
}
/// Test a given condition and return the result
Test a given condition and return the result
Test a given condition and return the result
fn condition(cpu: &Cpu, cond: u8) -> bool {
    match cond {
        0x0 => cpu.zero(), // Equal
        0x1 => !cpu.zero(), // Not equal
        0x2 => cpu.negative(), // Negative
        0x3 => !cpu.negative(), // Not negative
        0x4 => !cpu.negative() && !cpu.zero(), // Positive
        0x5 => cpu.overflow(), // Overflow
        0x6 => !cpu.overflow(), // No overflow
        0x7 => !cpu.carry() && !cpu.zero(), // Above
        0x8 => !cpu.carry(), // Above equal
        0x9 => cpu.carry(), // Below
        0xA => cpu.carry() || cpu.zero(), // Below equal
        0xB => cpu.overflow() == cpu.negative() && !cpu.zero(), // Signed greater than
        0xC => cpu.overflow() == cpu.negative(), // Signed greater than equal
        0xD => cpu.overflow() != cpu.negative(), // Signed less than
        0xE => cpu.overflow() != cpu.negative() || cpu.zero(), // Signed less Than equal
        _ => false
    }
}
fn condition ( cpu : & Cpu , cond : u8 ) -> bool { match cond { 0x0 => cpu . zero ( ) , // Equal 0x1 => ! cpu . zero ( ) , // Not equal 0x2 => cpu . negative ( ) , // Negative 0x3 => ! cpu . negative ( ) , // Not negative 0x4 => ! cpu . negative ( ) && ! cpu . zero ( ) , // Positive 0x5 => cpu . overflow ( ) , // Overflow 0x6 => ! cpu . overflow ( ) , // No overflow 0x7 => ! cpu . carry ( ) && ! cpu . zero ( ) , // Above 0x8 => ! cpu . carry ( ) , // Above equal 0x9 => cpu . carry ( ) , // Below 0xA => cpu . carry ( ) || cpu . zero ( ) , // Below equal 0xB => cpu . overflow ( ) == cpu . negative ( ) && ! cpu . zero ( ) , // Signed greater than 0xC => cpu . overflow ( ) == cpu . negative ( ) , // Signed greater than equal 0xD => cpu . overflow ( ) != cpu . negative ( ) , // Signed less than 0xE => cpu . overflow ( ) != cpu . negative ( ) || cpu . zero ( ) , // Signed less Than equal _ => false } }
Test a given condition and return the result
Test a given condition and return the result
cpu
&Cpu
cond
u8
cpu
&Cpu
cond
u8