ft(interpreter): impl all low-hanging fruit instructions

This commit is contained in:
2025-06-11 23:29:34 +09:00
parent 4cea76bd1c
commit 5942270f63
4 changed files with 105 additions and 4 deletions

View File

@@ -7,7 +7,7 @@ use crate::register::SegmentRegister;
use crate::{disasm::DisasmError, register::Register};
use core::fmt;
use std::ops::{Add, BitAnd, BitOr, BitXor, Div, Mul, Sub};
use std::ops::{Add, BitAnd, BitOr, BitXor, Div, Mul, Not, Sub};
pub type Byte = u8; // b
pub type IByte = i8; // used for displacements of memory access
@@ -334,6 +334,17 @@ impl BitXor for ImmediateOperand {
}
}
impl Not for ImmediateOperand {
type Output = Self;
fn not(self) -> Self::Output {
match self {
ImmediateOperand::Byte(b) => ImmediateOperand::Byte(!b),
ImmediateOperand::Word(w) => ImmediateOperand::Word(!w),
}
}
}
impl fmt::Display for ImmediateOperand {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {