ft(interpreter): impl all low-hanging fruit instructions
This commit is contained in:
@@ -110,6 +110,20 @@ impl Computer {
|
||||
self.op(op, flag_set, false, dest, src);
|
||||
}
|
||||
|
||||
/// Perform test operation, which acts like [`Self::and()`], but without
|
||||
/// saving the result and only setting [`Self::flags`].
|
||||
pub fn test(&mut self, dest: ModRmTarget, src: Operand) {
|
||||
let op: fn(Lhs, Rhs) -> ArithmeticResult = |lhs, rhs| lhs & rhs;
|
||||
let flag_set: fn(&mut Flags, ArithmeticResult, Lhs, Rhs) = |flags, result, _, _| {
|
||||
flags.cf = false;
|
||||
flags.of = false;
|
||||
flags.zf = result.zero();
|
||||
flags.sf = result.msb();
|
||||
flags.pf = result.parity();
|
||||
};
|
||||
self.op(op, flag_set, false, dest, src);
|
||||
}
|
||||
|
||||
/// Perform `dest` = `dest` + `src` + CF. Sets flags.
|
||||
pub fn adc(&mut self, dest: ModRmTarget, src: Operand) {
|
||||
let cf = self.flags.cf as u8;
|
||||
|
||||
Reference in New Issue
Block a user