chore(interpreter): impl missing instructions as todo

This commit is contained in:
2025-07-08 11:20:38 +09:00
parent 9ada099d70
commit 20e45679fc
3 changed files with 50 additions and 4 deletions

View File

@@ -712,7 +712,7 @@ impl Disassembler {
};
Mnemonic::POP_M(mem)
}
0x90 => Mnemonic::NOP(),
0x90 => Mnemonic::NOP,
0x91 => Mnemonic::XCHG_AX(Register::CX),
0x92 => Mnemonic::XCHG_AX(Register::DX),

View File

@@ -21,7 +21,7 @@ impl Instruction {
Instruction {
addr: 0,
raw: Vec::new(),
mnemonic: Mnemonic::NOP(),
mnemonic: Mnemonic::NOP,
}
}
}
@@ -58,7 +58,7 @@ impl fmt::Display for Instruction {
// which then add all variants and also create the matching logic for
// src/disasm.rs decode_instructions()
pub enum Mnemonic {
NOP(),
NOP,
// ADD
ADD_FromReg(ModRmTarget, Register), // From Register into either Memory or Register
ADD_ToReg(ModRmTarget, Register), // From either Memory or Register into Reigster

View File

@@ -115,6 +115,7 @@ impl Interpreter {
ModRmTarget::Register(crate::register::Register::AX),
ArithmeticOperand::Immediate(ImmediateOperand::Word(src_word)),
)?,
/*
* PUSH
*/
@@ -260,13 +261,19 @@ impl Interpreter {
ModRmTarget::Register(crate::register::Register::AX),
ArithmeticOperand::Immediate(ImmediateOperand::Word(src_word)),
)?,
/*
* Override
*/
Mnemonic::OVERRIDE(_) => todo!(),
/*
* Decimal Adjust
*/
Mnemonic::DAA => todo!(),
Mnemonic::DAS => todo!(),
Mnemonic::AAA => todo!(),
Mnemonic::AAS => todo!(),
/*
* SUB
@@ -477,6 +484,14 @@ impl Interpreter {
continue;
}
/*
* Loops
*/
Mnemonic::LOOPNZ(_) => todo!(),
Mnemonic::LOOPZ(_) => todo!(),
Mnemonic::LOOP(_) => todo!(),
Mnemonic::JCXZ(_) => todo!(),
/*
* Test
*/
@@ -600,10 +615,24 @@ impl Interpreter {
/*
* Push/Pop Flags
*/
Mnemonic::PUSHF => todo!(),
Mnemonic::POPF => todo!(),
Mnemonic::SAHF => todo!(),
Mnemonic::LAHF => todo!(),
/*
* String Byte Operations
*/
Mnemonic::MOVSB => todo!(),
Mnemonic::MOVSW => todo!(),
Mnemonic::CMPSB => todo!(),
Mnemonic::CMPSW => todo!(),
Mnemonic::STOSB => todo!(),
Mnemonic::STOSW => todo!(),
Mnemonic::LODSB => todo!(),
Mnemonic::LODSW => todo!(),
Mnemonic::SCASB => todo!(),
Mnemonic::SCASW => todo!(),
/*
* RET
@@ -620,6 +649,9 @@ impl Interpreter {
self.computer.regs.sp += w;
continue;
}
Mnemonic::IRET => todo!(),
Mnemonic::RETF => todo!(),
Mnemonic::RETF_Iw(_) => todo!(),
/*
* Load ES/DS Register
@@ -801,15 +833,24 @@ impl Interpreter {
/*
* IN
*/
Mnemonic::IN_AL(_) => todo!(),
Mnemonic::IN_AX(_) => todo!(),
Mnemonic::IN_ALDX => todo!(),
Mnemonic::IN_AXDX => todo!(),
/*
* OUT
*/
Mnemonic::OUT_AL(_) => todo!(),
Mnemonic::OUT_AX(_) => todo!(),
Mnemonic::OUT_ALDX => todo!(),
Mnemonic::OUT_AXDX => todo!(),
/*
* INT
*/
Mnemonic::INT(id) => self.interpret_interrupt(id)?,
Mnemonic::INTO => todo!(),
/*
* Flag manipulation
@@ -825,10 +866,14 @@ impl Interpreter {
/*
* Repeat prefixes
*/
Mnemonic::REPNZ => todo!(),
Mnemonic::REPZ => todo!(),
/*
* Adjust
*/
Mnemonic::AAM(_) => todo!(),
Mnemonic::AAD(_) => todo!(),
/*
* Misc
@@ -837,7 +882,8 @@ impl Interpreter {
log::info!("lock#");
continue;
}
_ => log::info!("no action done"),
Mnemonic::XLAT => todo!(),
Mnemonic::NOP => {}
}
// Go to next instruction