add raw method to instruction.rs
This commit is contained in:
parent
3944ae36a8
commit
6721857320
1 changed files with 6 additions and 1 deletions
|
@ -13,10 +13,15 @@ impl Instruction {
|
||||||
data: (data[0] as u16) << 8u8 | (data[1] as u16),
|
data: (data[0] as u16) << 8u8 | (data[1] as u16),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// raw returns the raw instruction data.
|
||||||
|
pub fn raw(&self) -> u16 {
|
||||||
|
self.data
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Display for Instruction {
|
impl Display for Instruction {
|
||||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||||
f.write_str(&format!(
|
f.write_str(&format!(
|
||||||
"Instruction: [{:02x}, {:02x}]",
|
"Instruction: [{:02x}, {:02x}]",
|
||||||
((self.data & 0xFF00) >> 8u8) as u8,
|
((self.data & 0xFF00) >> 8u8) as u8,
|
||||||
|
|
Loading…
Reference in a new issue