chore: add nice debug output

This commit is contained in:
2025-05-25 21:05:54 +09:00
parent f9ae0dc6ee
commit 35207d23f0
3 changed files with 58 additions and 25 deletions

View File

@@ -13,6 +13,9 @@ pub type DWord = u32;
#[derive(Debug, Clone)]
#[allow(dead_code)]
/// Encodes either Byte- or Word-sized operands.
/// Also sometimes used to decide if an instruction is Byte- or Word-sized,
/// which is usually indicated by using a value of 0 and the disregarding
/// the value when read.
pub enum Operand {
Byte(Byte),
Word(Word),
@@ -37,7 +40,7 @@ impl fmt::LowerHex for Operand {
}
#[derive(Debug, Clone)]
/// ModRM byte can either target a memory location or some register
/// ModRM byte can either target a memory location or some register.
pub enum ModRmTarget {
Memory(MemoryIndex),
Register(Register),
@@ -53,11 +56,11 @@ impl std::fmt::Display for ModRmTarget {
}
#[derive(Debug, Clone)]
/// Memory displacements are signed versions of u8 and u16.
/// Memory displacements are signed versions of Byte and Word operands.
/// Encodes either Byte- or Word-sized operands.
pub enum Displacement {
IByte(i8),
IWord(i16),
IByte(IByte),
IWord(IWord),
}
impl fmt::LowerHex for Displacement {