ft: partially implement Group 5 instructions

This commit is contained in:
2025-05-14 13:41:08 +09:00
parent 4fa789e6bb
commit 1f88db75f5
2 changed files with 17 additions and 1 deletions

View File

@@ -613,7 +613,20 @@ impl Disassembler {
_ => panic!("Illegal Group 4 mnemonic"),
}
}
0xFF => todo!("Group 5"),
0xFF => {
let (target, reg) = self.parse_modrm_byte(Operand::Word(0));
match reg {
0b000 => Mnemonic::INC_Mod(target),
0b001 => Mnemonic::DEC_Mod(target),
0b010 => Mnemonic::CALL_Mod(target),
0b011 => todo!("Implement CALL Mp"),
0b100 => Mnemonic::JMP_Mod(target),
0b101 => todo!("Implement JMP Mp"),
0b110 => Mnemonic::PUSH_Mod(target),
// 0b111 => unused
_ => panic!("Illegal Group 5 mnemonic"),
}
}
_ => {
eprintln!("Encountered unknown instruction '0x{:x}'", opcode);

View File

@@ -77,6 +77,7 @@ pub enum Mnemonic {
// PUSH
PUSH_R(Register),
PUSH_S(SegmentRegister),
PUSH_Mod(ModRmTarget),
// POP
POP_S(SegmentRegister), // POP to Segment Register
POP_R(Register), // POP to Register
@@ -203,10 +204,12 @@ pub enum Mnemonic {
// CALL
CALL_p(Pointer),
CALL_v(Word),
CALL_Mod(ModRmTarget),
// JUMP
JMP_p(Pointer),
JMP_b(Byte),
JMP_v(Word),
JMP_Mod(ModRmTarget),
// WAIT
WAIT,
// Push/Pop Flags