pub fn decode(opcode: u8) -> Self {
        let x = (opcode & 0b11000000) >> 6;
        let y = (opcode & 0b00111000) >> 3;
        let z = opcode & 0b00000111;
        let operand = Operand8::from_regcode(z);
        let op = match x {
            0 => match y {
                0 => CBOperation::RotateLeft8,
                1 => CBOperation::RotateRight8,
                2 => CBOperation::RotateLeft9,
                3 => CBOperation::RotateRight9,
                4 => CBOperation::ShiftLeft,
                5 => CBOperation::ShiftRightSignExt,
                6 => CBOperation::Swap,
                7 => CBOperation::ShiftRight,
                _ => unreachable!(),
            },
            1 => CBOperation::TestBit(y),
            2 => CBOperation::ResetBit(y),
            3 => CBOperation::SetBit(y),
            _ => unreachable!(),
        };
        Self { operand, op }
    }
/// Decodes an 8-bit opcode found after a CB prefix into a CBOpcode.
Decodes an 8-bit opcode found after a CB prefix into a CBOpcode.
Decodes an 8 - bit opcode found after a CB prefix into a CBOpcode .
pub fn decode(opcode: u8) -> Self {
        let x = (opcode & 0b11000000) >> 6;
        let y = (opcode & 0b00111000) >> 3;
        let z = opcode & 0b00000111;
        let operand = Operand8::from_regcode(z);
        let op = match x {
            0 => match y {
                0 => CBOperation::RotateLeft8,
                1 => CBOperation::RotateRight8,
                2 => CBOperation::RotateLeft9,
                3 => CBOperation::RotateRight9,
                4 => CBOperation::ShiftLeft,
                5 => CBOperation::ShiftRightSignExt,
                6 => CBOperation::Swap,
                7 => CBOperation::ShiftRight,
                _ => unreachable!(),
            },
            1 => CBOperation::TestBit(y),
            2 => CBOperation::ResetBit(y),
            3 => CBOperation::SetBit(y),
            _ => unreachable!(),
        };
        Self { operand, op }
    }
pub fn decode ( opcode : u8 ) -> Self { let x = ( opcode & 0b11000000 ) >> 6 ; let y = ( opcode & 0b00111000 ) >> 3 ; let z = opcode & 0b00000111 ; let operand = Operand8 :: from_regcode ( z ) ; let op = match x { 0 => match y { 0 => CBOperation :: RotateLeft8 , 1 => CBOperation :: RotateRight8 , 2 => CBOperation :: RotateLeft9 , 3 => CBOperation :: RotateRight9 , 4 => CBOperation :: ShiftLeft , 5 => CBOperation :: ShiftRightSignExt , 6 => CBOperation :: Swap , 7 => CBOperation :: ShiftRight , _ => unreachable ! ( ) , } , 1 => CBOperation :: TestBit ( y ) , 2 => CBOperation :: ResetBit ( y ) , 3 => CBOperation :: SetBit ( y ) , _ => unreachable ! ( ) , } ; Self { operand , op } }
Decodes an 8-bit opcode found after a CB prefix into a CBOpcode.
Decodes an 8 - bit opcode found after a CB prefix into a CBOpcode .
opcode
u8
opcode
u8