ft: implement CALL and JMP instructions

This commit is contained in:
2025-05-14 11:57:00 +09:00
parent 38a2782cc6
commit 4252986b7e
2 changed files with 20 additions and 2 deletions

View File

@@ -463,7 +463,7 @@ impl Disassembler {
0x98 => Mnemonic::CBW, 0x98 => Mnemonic::CBW,
0x99 => Mnemonic::CWD, 0x99 => Mnemonic::CWD,
0x9A => Mnemonic::CALL(Pointer { 0x9A => Mnemonic::CALL_p(Pointer {
segment: self.parse_word(), segment: self.parse_word(),
offset: self.parse_word(), offset: self.parse_word(),
}), }),
@@ -523,6 +523,17 @@ impl Disassembler {
0xCD => Mnemonic::INT(self.parse_byte()), 0xCD => Mnemonic::INT(self.parse_byte()),
0xE8 => Mnemonic::CALL_v(self.parse_word()),
0xE9 => Mnemonic::JMP_v(self.parse_word()),
0xEA => Mnemonic::JMP_p(Pointer {
segment: self.parse_word(),
offset: self.parse_word(),
}),
0xEB => Mnemonic::JMP_b(self.parse_byte()),
0xF4 => Mnemonic::HLT,
// Group 3 // Group 3
0xF6 => { 0xF6 => {
let (target, reg) = self.parse_modrm_byte(Operand::Word(0)); let (target, reg) = self.parse_modrm_byte(Operand::Word(0));

View File

@@ -199,7 +199,12 @@ pub enum Mnemonic {
CBW, CBW,
CWD, CWD,
// CALL // CALL
CALL(Pointer), CALL_p(Pointer),
CALL_v(Word),
// JUMP
JMP_p(Pointer),
JMP_b(Byte),
JMP_v(Word),
// WAIT // WAIT
WAIT, WAIT,
// Push/Pop Flags // Push/Pop Flags
@@ -234,6 +239,8 @@ pub enum Mnemonic {
// DIV // DIV
DIV(ModRmTarget), DIV(ModRmTarget),
IDIV(ModRmTarget), IDIV(ModRmTarget),
// HALT
HLT,
// INT // INT
INT(Byte), INT(Byte),
} }