pub fn alu_dec_8bit(d8: u8, flags: Flags) -> (u8, Flags) {
    let mut new_flags = flags;
    new_flags.set(Flags::SUBTRACT, true);
    new_flags.set(Flags::HALF_CARRY, d8 & 0x0F == 0x00);

    let decremented = d8.wrapping_sub(1);

    new_flags.set(Flags::ZERO, decremented == 0);

    (decremented, new_flags)
}
/// Decrement 8-bit value
///
/// Update flags:
///
/// ## Flags::ZERO
///
/// Set if the result equals zero.
///
/// ## Flags::SUBTRACT
///
/// Always unset
///
/// ## Flags::HALF_CARRY
///
/// Set if the lower nibble of the value was zero and would underflow
///
/// ## Flags::CARRY
///
/// Unchanged
///
Decrement 8-bit value
Update flags.
Decrement 8 - bit value Update flags .
pub fn alu_dec_8bit(d8: u8, flags: Flags) -> (u8, Flags) {
    let mut new_flags = flags;
    new_flags.set(Flags::SUBTRACT, true);
    new_flags.set(Flags::HALF_CARRY, d8 & 0x0F == 0x00);
    let decremented = d8.wrapping_sub(1);
    new_flags.set(Flags::ZERO, decremented == 0);
    (decremented, new_flags)
}
pub fn alu_dec_8bit ( d8 : u8 , flags : Flags ) -> ( u8 , Flags ) { let mut new_flags = flags ; new_flags . set ( Flags :: SUBTRACT , true ) ; new_flags . set ( Flags :: HALF_CARRY , d8 & 0x0F == 0x00 ) ; let decremented = d8 . wrapping_sub ( 1 ) ; new_flags . set ( Flags :: ZERO , decremented == 0 ) ; ( decremented , new_flags ) }
Decrement 8-bit value
Update flags:
Decrement 8 - bit value Update flags :
d8
u8
flags
Flags
d8
u8
flags
Flags
flags::zero
Set if the result equals zero.
Set if the result equals zero .
flags::subtract
None
flags::half_carry
Set if the lower nibble of the value was zero and would underflow
Set if the lower nibble of the value was zero and would underflow
flags::carry
None