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) Mnemonic::POP_M(mem)
} }
0x90 => Mnemonic::NOP(), 0x90 => Mnemonic::NOP,
0x91 => Mnemonic::XCHG_AX(Register::CX), 0x91 => Mnemonic::XCHG_AX(Register::CX),
0x92 => Mnemonic::XCHG_AX(Register::DX), 0x92 => Mnemonic::XCHG_AX(Register::DX),

View File

@@ -21,7 +21,7 @@ impl Instruction {
Instruction { Instruction {
addr: 0, addr: 0,
raw: Vec::new(), 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 // which then add all variants and also create the matching logic for
// src/disasm.rs decode_instructions() // src/disasm.rs decode_instructions()
pub enum Mnemonic { pub enum Mnemonic {
NOP(), NOP,
// ADD // ADD
ADD_FromReg(ModRmTarget, Register), // From Register into either Memory or Register ADD_FromReg(ModRmTarget, Register), // From Register into either Memory or Register
ADD_ToReg(ModRmTarget, Register), // From either Memory or Register into Reigster 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), ModRmTarget::Register(crate::register::Register::AX),
ArithmeticOperand::Immediate(ImmediateOperand::Word(src_word)), ArithmeticOperand::Immediate(ImmediateOperand::Word(src_word)),
)?, )?,
/* /*
* PUSH * PUSH
*/ */
@@ -260,13 +261,19 @@ impl Interpreter {
ModRmTarget::Register(crate::register::Register::AX), ModRmTarget::Register(crate::register::Register::AX),
ArithmeticOperand::Immediate(ImmediateOperand::Word(src_word)), ArithmeticOperand::Immediate(ImmediateOperand::Word(src_word)),
)?, )?,
/* /*
* Override * Override
*/ */
Mnemonic::OVERRIDE(_) => todo!(),
/* /*
* Decimal Adjust * Decimal Adjust
*/ */
Mnemonic::DAA => todo!(),
Mnemonic::DAS => todo!(),
Mnemonic::AAA => todo!(),
Mnemonic::AAS => todo!(),
/* /*
* SUB * SUB
@@ -477,6 +484,14 @@ impl Interpreter {
continue; continue;
} }
/*
* Loops
*/
Mnemonic::LOOPNZ(_) => todo!(),
Mnemonic::LOOPZ(_) => todo!(),
Mnemonic::LOOP(_) => todo!(),
Mnemonic::JCXZ(_) => todo!(),
/* /*
* Test * Test
*/ */
@@ -600,10 +615,24 @@ impl Interpreter {
/* /*
* Push/Pop Flags * Push/Pop Flags
*/ */
Mnemonic::PUSHF => todo!(),
Mnemonic::POPF => todo!(),
Mnemonic::SAHF => todo!(),
Mnemonic::LAHF => todo!(),
/* /*
* String Byte Operations * 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 * RET
@@ -620,6 +649,9 @@ impl Interpreter {
self.computer.regs.sp += w; self.computer.regs.sp += w;
continue; continue;
} }
Mnemonic::IRET => todo!(),
Mnemonic::RETF => todo!(),
Mnemonic::RETF_Iw(_) => todo!(),
/* /*
* Load ES/DS Register * Load ES/DS Register
@@ -801,15 +833,24 @@ impl Interpreter {
/* /*
* IN * IN
*/ */
Mnemonic::IN_AL(_) => todo!(),
Mnemonic::IN_AX(_) => todo!(),
Mnemonic::IN_ALDX => todo!(),
Mnemonic::IN_AXDX => todo!(),
/* /*
* OUT * OUT
*/ */
Mnemonic::OUT_AL(_) => todo!(),
Mnemonic::OUT_AX(_) => todo!(),
Mnemonic::OUT_ALDX => todo!(),
Mnemonic::OUT_AXDX => todo!(),
/* /*
* INT * INT
*/ */
Mnemonic::INT(id) => self.interpret_interrupt(id)?, Mnemonic::INT(id) => self.interpret_interrupt(id)?,
Mnemonic::INTO => todo!(),
/* /*
* Flag manipulation * Flag manipulation
@@ -825,10 +866,14 @@ impl Interpreter {
/* /*
* Repeat prefixes * Repeat prefixes
*/ */
Mnemonic::REPNZ => todo!(),
Mnemonic::REPZ => todo!(),
/* /*
* Adjust * Adjust
*/ */
Mnemonic::AAM(_) => todo!(),
Mnemonic::AAD(_) => todo!(),
/* /*
* Misc * Misc
@@ -837,7 +882,8 @@ impl Interpreter {
log::info!("lock#"); log::info!("lock#");
continue; continue;
} }
_ => log::info!("no action done"), Mnemonic::XLAT => todo!(),
Mnemonic::NOP => {}
} }
// Go to next instruction // Go to next instruction