pub fn to_u16(&self) -> u16 {
        match *self {
            Instruction::Halt => 0x0000,
            Instruction::Io(IoOp::ReadHex) => 0x1000,
            Instruction::Io(IoOp::ReadChar) => 0x1400,
            Instruction::Io(IoOp::WriteHex) => 0x1800,
            Instruction::Io(IoOp::WriteChar) => 0x1c00,
            Instruction::Shift(ShiftOp::ShiftLeft, n) => 0x2000 | (n & 0xf),
            Instruction::Shift(ShiftOp::ShiftRight, n) => 0x2400 | (n & 0xf),
            Instruction::Shift(ShiftOp::RotateLeft, n) => 0x2800 | (n & 0xf),
            Instruction::Shift(ShiftOp::RotateRight, n) => 0x2c00 | (n & 0xf),
            Instruction::Load(addr) => 0x3000 | (addr & 0xfff),
            Instruction::Store(addr) => 0x4000 | (addr & 0xfff),
            Instruction::Add(addr) => 0x5000 | (addr & 0xfff),
            Instruction::Sub(addr) => 0x6000 | (addr & 0xfff),
            Instruction::And(addr) => 0x7000 | (addr & 0xfff),
            Instruction::Or(addr) => 0x8000 | (addr & 0xfff),
            Instruction::Xor(addr) => 0x9000 | (addr & 0xfff),
            Instruction::Not => 0xa000,
            Instruction::Nop => 0xb000,
            Instruction::Jmp(addr) => 0xc000 | (addr & 0xfff),
            Instruction::Jmpe(addr) => 0xd000 | (addr & 0xfff),
            Instruction::Jmpl(addr) => 0xe000 | (addr & 0xfff),
            Instruction::Brl(addr) => 0xf000 | (addr & 0xfff),
        }
    }
/// Returns the value of the current instruction as a u16.
Returns the value of the current instruction as a u16.
Returns the value of the current instruction as a u16 .
pub fn to_u16(&self) -> u16 {
        match *self {
            Instruction::Halt => 0x0000,
            Instruction::Io(IoOp::ReadHex) => 0x1000,
            Instruction::Io(IoOp::ReadChar) => 0x1400,
            Instruction::Io(IoOp::WriteHex) => 0x1800,
            Instruction::Io(IoOp::WriteChar) => 0x1c00,
            Instruction::Shift(ShiftOp::ShiftLeft, n) => 0x2000 | (n & 0xf),
            Instruction::Shift(ShiftOp::ShiftRight, n) => 0x2400 | (n & 0xf),
            Instruction::Shift(ShiftOp::RotateLeft, n) => 0x2800 | (n & 0xf),
            Instruction::Shift(ShiftOp::RotateRight, n) => 0x2c00 | (n & 0xf),
            Instruction::Load(addr) => 0x3000 | (addr & 0xfff),
            Instruction::Store(addr) => 0x4000 | (addr & 0xfff),
            Instruction::Add(addr) => 0x5000 | (addr & 0xfff),
            Instruction::Sub(addr) => 0x6000 | (addr & 0xfff),
            Instruction::And(addr) => 0x7000 | (addr & 0xfff),
            Instruction::Or(addr) => 0x8000 | (addr & 0xfff),
            Instruction::Xor(addr) => 0x9000 | (addr & 0xfff),
            Instruction::Not => 0xa000,
            Instruction::Nop => 0xb000,
            Instruction::Jmp(addr) => 0xc000 | (addr & 0xfff),
            Instruction::Jmpe(addr) => 0xd000 | (addr & 0xfff),
            Instruction::Jmpl(addr) => 0xe000 | (addr & 0xfff),
            Instruction::Brl(addr) => 0xf000 | (addr & 0xfff),
        }
    }
pub fn to_u16 ( & self ) -> u16 { match * self { Instruction :: Halt => 0x0000 , Instruction :: Io ( IoOp :: ReadHex ) => 0x1000 , Instruction :: Io ( IoOp :: ReadChar ) => 0x1400 , Instruction :: Io ( IoOp :: WriteHex ) => 0x1800 , Instruction :: Io ( IoOp :: WriteChar ) => 0x1c00 , Instruction :: Shift ( ShiftOp :: ShiftLeft , n ) => 0x2000 | ( n & 0xf ) , Instruction :: Shift ( ShiftOp :: ShiftRight , n ) => 0x2400 | ( n & 0xf ) , Instruction :: Shift ( ShiftOp :: RotateLeft , n ) => 0x2800 | ( n & 0xf ) , Instruction :: Shift ( ShiftOp :: RotateRight , n ) => 0x2c00 | ( n & 0xf ) , Instruction :: Load ( addr ) => 0x3000 | ( addr & 0xfff ) , Instruction :: Store ( addr ) => 0x4000 | ( addr & 0xfff ) , Instruction :: Add ( addr ) => 0x5000 | ( addr & 0xfff ) , Instruction :: Sub ( addr ) => 0x6000 | ( addr & 0xfff ) , Instruction :: And ( addr ) => 0x7000 | ( addr & 0xfff ) , Instruction :: Or ( addr ) => 0x8000 | ( addr & 0xfff ) , Instruction :: Xor ( addr ) => 0x9000 | ( addr & 0xfff ) , Instruction :: Not => 0xa000 , Instruction :: Nop => 0xb000 , Instruction :: Jmp ( addr ) => 0xc000 | ( addr & 0xfff ) , Instruction :: Jmpe ( addr ) => 0xd000 | ( addr & 0xfff ) , Instruction :: Jmpl ( addr ) => 0xe000 | ( addr & 0xfff ) , Instruction :: Brl ( addr ) => 0xf000 | ( addr & 0xfff ) , } }
Returns the value of the current instruction as a u16.
Returns the value of the current instruction as a u16 .
&self
&self