chore: whole swoop of enhanced documentation
This commit is contained in:
@@ -7,7 +7,6 @@ use crate::{
|
||||
use core::fmt;
|
||||
|
||||
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||
#[allow(dead_code)]
|
||||
/// A single 'line' of executable ASM is called an Instruction, which
|
||||
/// contains the `Mnemonic` that will be executed, alongside its starting offset
|
||||
/// and the raw parsed bytes
|
||||
@@ -47,7 +46,7 @@ impl fmt::Display for Instruction {
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
#[allow(dead_code, non_camel_case_types)]
|
||||
#[allow(non_camel_case_types)]
|
||||
/// All possible mnemonic variantions.
|
||||
/// These are sorted by type and are not in hex-encoding order.
|
||||
// XXX: convert this copy and paste horror in a proc macro like
|
||||
@@ -296,8 +295,6 @@ pub enum Mnemonic {
|
||||
AAD(Byte),
|
||||
// MISC
|
||||
XLAT,
|
||||
// Not part of 8086:
|
||||
EOT, // End of Text Section
|
||||
}
|
||||
|
||||
impl fmt::Display for Mnemonic {
|
||||
@@ -414,8 +411,8 @@ impl fmt::Display for Mnemonic {
|
||||
Self::MOV_ToReg(target, reg) => write!(f, "mov {reg}, {target}"),
|
||||
Self::MOV_FromSReg(target, reg) => write!(f, "mov {target}, {reg}"),
|
||||
Self::MOV_ToSReg(target, reg) => write!(f, "mov {reg}, {target}"),
|
||||
Self::MOV_Ib(target, byte) => write!(f, "mov byte {target}, {byte:#04x}"),
|
||||
Self::MOV_Iv(target, word) => write!(f, "mov word {target}, {word:#04x}"),
|
||||
Self::MOV_Ib(target, byte) => write!(f, "mov byte ptr {target}, {byte:#04x}"),
|
||||
Self::MOV_Iv(target, word) => write!(f, "mov word ptr {target}, {word:#04x}"),
|
||||
|
||||
Self::MOV_AL0b(byte) => write!(f, "mov {}, {byte:#04x}", Register::AL),
|
||||
Self::MOV_AX0v(word) => write!(f, "mov {}, {word:#04x}", Register::AX),
|
||||
@@ -492,13 +489,13 @@ impl fmt::Display for Mnemonic {
|
||||
|
||||
Self::HLT => write!(f, "hlt"),
|
||||
|
||||
Self::ROL_b(target, byte) => write!(f, "rol byte {target}, {byte:#04x}"),
|
||||
Self::ROR_b(target, byte) => write!(f, "ror byte {target}, {byte:#04x}"),
|
||||
Self::RCL_b(target, byte) => write!(f, "rcl byte {target}, {byte:#04x}"),
|
||||
Self::RCR_b(target, byte) => write!(f, "rcr byte {target}, {byte:#04x}"),
|
||||
Self::SHL_b(target, byte) => write!(f, "shl byte {target}, {byte:#04x}"),
|
||||
Self::SHR_b(target, byte) => write!(f, "shr byte {target}, {byte:#04x}"),
|
||||
Self::SAR_b(target, byte) => write!(f, "sar byte {target}, {byte:#04x}"),
|
||||
Self::ROL_b(target, byte) => write!(f, "rol byte ptr {target}, {byte:#04x}"),
|
||||
Self::ROR_b(target, byte) => write!(f, "ror byte ptr {target}, {byte:#04x}"),
|
||||
Self::RCL_b(target, byte) => write!(f, "rcl byte ptr {target}, {byte:#04x}"),
|
||||
Self::RCR_b(target, byte) => write!(f, "rcr byte ptr {target}, {byte:#04x}"),
|
||||
Self::SHL_b(target, byte) => write!(f, "shl byte ptr {target}, {byte:#04x}"),
|
||||
Self::SHR_b(target, byte) => write!(f, "shr byte ptr {target}, {byte:#04x}"),
|
||||
Self::SAR_b(target, byte) => write!(f, "sar byte ptr {target}, {byte:#04x}"),
|
||||
Self::ROL_fromReg(target, reg) => write!(f, "rol {target}, {reg}"),
|
||||
Self::ROR_fromReg(target, reg) => write!(f, "ror {target}, {reg}"),
|
||||
Self::RCL_fromReg(target, reg) => write!(f, "rcl {target}, {reg}"),
|
||||
@@ -507,13 +504,13 @@ impl fmt::Display for Mnemonic {
|
||||
Self::SHR_fromReg(target, reg) => write!(f, "shr {target}, {reg}"),
|
||||
Self::SAR_fromReg(target, reg) => write!(f, "sar {target}, {reg}"),
|
||||
|
||||
Self::IN_AL(byte) => write!(f, "in byte {}, {byte:#04x}", Register::AL),
|
||||
Self::IN_AX(byte) => write!(f, "in byte {}, {byte:#04x}", Register::AX),
|
||||
Self::IN_AL(byte) => write!(f, "in byte ptr {}, {byte:#04x}", Register::AL),
|
||||
Self::IN_AX(byte) => write!(f, "in byte ptr {}, {byte:#04x}", Register::AX),
|
||||
Self::IN_ALDX => write!(f, "in {}, {}", Register::AL, Register::DX),
|
||||
Self::IN_AXDX => write!(f, "in {}, {}", Register::AX, Register::DX),
|
||||
|
||||
Self::OUT_AL(byte) => write!(f, "out byte {}, {byte:#04x}", Register::AL),
|
||||
Self::OUT_AX(byte) => write!(f, "out byte {}, {byte:#04x}", Register::AX),
|
||||
Self::OUT_AL(byte) => write!(f, "out byte ptr {}, {byte:#04x}", Register::AL),
|
||||
Self::OUT_AX(byte) => write!(f, "out byte ptr {}, {byte:#04x}", Register::AX),
|
||||
Self::OUT_ALDX => write!(f, "out {}, {}", Register::AL, Register::DX),
|
||||
Self::OUT_AXDX => write!(f, "out {}, {}", Register::AX, Register::DX),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user