diff --git a/src/instructions.rs b/src/instructions.rs index e54ba85..fa4c795 100644 --- a/src/instructions.rs +++ b/src/instructions.rs @@ -57,9 +57,18 @@ impl Instruction { impl fmt::Display for Instruction { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{:04x}: ", self.start).unwrap(); - for b in self.raw.iter() { - write!(f, "{:02x}", b).unwrap(); - } + + write!( + f, + "{:<10}", + self.raw + .iter() + .map(|b| format!("{:02x}", b)) + .collect::>() + .join("") + ) + .unwrap(); + write!(f, "\t\t{}", self.opcode) } } @@ -330,14 +339,14 @@ impl std::fmt::Display for Displacement { match self { Self::IByte(b) => { if *b > 0 { - write!(f, " + {}", b) + write!(f, " + {:#x}", b) } else { write!(f, " - {:#x}", b * -1) } } Self::IWord(w) => { if *w > 0 { - write!(f, " + {}", w) + write!(f, " + {:#x}", w) } else { write!(f, " - {:#x}", w * -1) }