chore: use lower letters for disasm output
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#[macro_export]
|
||||
/// Generate a byte Opcode for 'normal' ModRM instructions with mem access and a reg
|
||||
/// Generate a Mnemonic for an 8-bit Register from a ModRM byte.
|
||||
macro_rules! modrmb {
|
||||
($self:ident, $variant:ident) => {{
|
||||
let (target, reg) = $self.parse_modrm_byte(ImmediateOperand::Byte(0));
|
||||
@@ -8,7 +8,7 @@ macro_rules! modrmb {
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
/// Generate a word Opcode for 'normal' ModRM instructions with mem access and a reg
|
||||
/// Generate a Mnemonic for a 16-bit Register from a ModRM byte.
|
||||
macro_rules! modrmv {
|
||||
($self:ident, $variant:ident) => {{
|
||||
let (target, reg) = $self.parse_modrm_byte(ImmediateOperand::Word(0));
|
||||
@@ -17,7 +17,7 @@ macro_rules! modrmv {
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
/// Generate a word Opcode for 'normal' ModRM instructions with mem access and a segment reg
|
||||
/// Generate a Mnemonic for a 16-bit Segment Register from a ModRM byte.
|
||||
macro_rules! modrms {
|
||||
($self:ident, $variant:ident) => {{
|
||||
let (target, reg) = $self.parse_modrm_byte(ImmediateOperand::Word(0));
|
||||
@@ -26,7 +26,8 @@ macro_rules! modrms {
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
/// Generate a GPR instruction from modrm byte for byte.
|
||||
/// Generate the resulting Mnemonic from a GPR instruction with Byte-sized
|
||||
/// Immediate, encoded in a ModRM byte.
|
||||
/// GPR always has an imm value as second operand.
|
||||
macro_rules! modrmgprb {
|
||||
($self:ident) => {{
|
||||
@@ -37,7 +38,8 @@ macro_rules! modrmgprb {
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
/// Generate a GPR instruction from modrm byte for word
|
||||
/// Generate the resulting Mnemonic from a GPR instruction with Word-sized
|
||||
/// Immediate, encoded in a ModRM byte.
|
||||
/// GPR always has an imm value as second operand.
|
||||
macro_rules! modrmgprv {
|
||||
($self:ident) => {{
|
||||
|
||||
@@ -173,13 +173,13 @@ pub enum Mnemonic {
|
||||
impl fmt::Display for Mnemonic {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self {
|
||||
Self::INT(byte) => write!(f, "INT, {:x}", byte),
|
||||
Self::ADD_FromReg(mem, reg) => write!(f, "ADD {}, {}", mem, reg),
|
||||
Self::ADD_ToReg(mem, reg) => write!(f, "ADD {}, {}", reg, mem),
|
||||
Self::CMP_Iv(mem, imm) => write!(f, "CMP {}, {:04x}", mem, imm),
|
||||
Self::LEA(mem, reg) => write!(f, "LEA {}, {}", reg, mem),
|
||||
Self::MOV_BXIv(word) => write!(f, "MOV BX, {:04x}", word),
|
||||
Self::XOR_FromReg(mem, reg) => write!(f, "XOR {}, {}", mem, reg),
|
||||
Self::INT(byte) => write!(f, "int, {:x}", byte),
|
||||
Self::ADD_FromReg(mem, reg) => write!(f, "add {}, {}", mem, reg),
|
||||
Self::ADD_ToReg(mem, reg) => write!(f, "add {}, {}", reg, mem),
|
||||
Self::CMP_Iv(mem, imm) => write!(f, "cmp {}, {:04x}", mem, imm),
|
||||
Self::LEA(mem, reg) => write!(f, "lea {}, {}", reg, mem),
|
||||
Self::MOV_BXIv(word) => write!(f, "mov bx, {:04x}", word),
|
||||
Self::XOR_FromReg(mem, reg) => write!(f, "xor {}, {}", mem, reg),
|
||||
_ => write!(f, "??? ??, ??"),
|
||||
}
|
||||
}
|
||||
@@ -249,22 +249,22 @@ impl Register {
|
||||
impl fmt::Display for Register {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self {
|
||||
Self::AX => write!(f, "AX"),
|
||||
Self::BX => write!(f, "BX"),
|
||||
Self::CX => write!(f, "CX"),
|
||||
Self::DX => write!(f, "DX"),
|
||||
Self::AH => write!(f, "AH"),
|
||||
Self::AL => write!(f, "AL"),
|
||||
Self::BL => write!(f, "BL"),
|
||||
Self::BH => write!(f, "BH"),
|
||||
Self::CH => write!(f, "CH"),
|
||||
Self::CL => write!(f, "CL"),
|
||||
Self::DH => write!(f, "DH"),
|
||||
Self::DL => write!(f, "DL"),
|
||||
Self::DI => write!(f, "DI"),
|
||||
Self::SI => write!(f, "SI"),
|
||||
Self::BP => write!(f, "BP"),
|
||||
Self::SP => write!(f, "SP"),
|
||||
Self::AX => write!(f, "ax"),
|
||||
Self::BX => write!(f, "bx"),
|
||||
Self::CX => write!(f, "cx"),
|
||||
Self::DX => write!(f, "dx"),
|
||||
Self::AH => write!(f, "ah"),
|
||||
Self::AL => write!(f, "al"),
|
||||
Self::BL => write!(f, "bl"),
|
||||
Self::BH => write!(f, "bh"),
|
||||
Self::CH => write!(f, "ch"),
|
||||
Self::CL => write!(f, "cl"),
|
||||
Self::DH => write!(f, "dh"),
|
||||
Self::DL => write!(f, "dl"),
|
||||
Self::DI => write!(f, "di"),
|
||||
Self::SI => write!(f, "si"),
|
||||
Self::BP => write!(f, "bp"),
|
||||
Self::SP => write!(f, "sp"),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -296,10 +296,10 @@ impl SegmentRegister {
|
||||
impl fmt::Display for SegmentRegister {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self {
|
||||
Self::DS => write!(f, "DS"),
|
||||
Self::ES => write!(f, "ES"),
|
||||
Self::SS => write!(f, "SS"),
|
||||
Self::CS => write!(f, "CS"),
|
||||
Self::DS => write!(f, "ds"),
|
||||
Self::ES => write!(f, "es"),
|
||||
Self::SS => write!(f, "ss"),
|
||||
Self::CS => write!(f, "cs"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user