emu: ROL/ROR operations

This commit is contained in:
2021-03-29 22:56:16 -07:00
parent f5ab9cfad2
commit d8600151d6
4 changed files with 66 additions and 12 deletions

View File

@@ -87,11 +87,22 @@ impl Flags {
OperandWidth::Word => 0x8000,
}
}
// The rotate ops update OF don't touch PF/AF/ZF/SF so we make
// everything eager so they don't get clobbered
pub fn update_of(&mut self, of: bool) {
let mut flags = (*self).into();
flags &= !(1 << OF_BIT); // Mask out old OF Flag
if of { flags |= 1 << OF_BIT; } // Mask in new OF Flag
self.flag_op = FlagOp::Eager;
self.res = flags;
}
}
#[derive(Clone, Copy)]
pub enum FlagOp {
Eager, // precomputed into result, for e.g. POPF? (Anything else?)
Eager, // precomputed into result, for POPF or anything that changes only some flags
DEC,
INC,
SHIFT,