diff --git a/InstructionSets/x86/Status.hpp b/InstructionSets/x86/Status.hpp index 24797bbab..9e6f77ffc 100644 --- a/InstructionSets/x86/Status.hpp +++ b/InstructionSets/x86/Status.hpp @@ -156,17 +156,17 @@ class Status { // Complete value get and set. void set(uint16_t value) { - carry_ = value & ConditionCode::Carry; - auxiliary_carry_ = value & ConditionCode::AuxiliaryCarry; - sign_ = value & ConditionCode::Sign; - overflow_ = value & ConditionCode::Overflow; - trap_ = value & ConditionCode::Trap; - interrupt_ = value & ConditionCode::Interrupt; - direction_ = (value & ConditionCode::Direction) ? -1 : 1; + set_from(value & ConditionCode::Carry); + set_from(value & ConditionCode::AuxiliaryCarry); + set_from(value & ConditionCode::Overflow); + set_from(value & ConditionCode::Trap); + set_from(value & ConditionCode::Interrupt); + set_from(value & ConditionCode::Direction); - zero_ = (~value) & ConditionCode::Zero; + set_from(value); - parity_ = (~value) & ConditionCode::Parity; + set_from((~value) & ConditionCode::Zero); + set_from((~value) & ConditionCode::Parity); } uint16_t get() const { @@ -182,24 +182,24 @@ class Status { (flag() ? ConditionCode::Direction : 0) | (flag() ? ConditionCode::Zero : 0) | - (not_parity_bit() ? 0 : ConditionCode::Parity); + (flag() ? 0 : ConditionCode::Parity); } std::string to_string() const { std::string result; - if(overflow_) result += "O"; else result += "-"; - if(direction_) result += "D"; else result += "-"; - if(interrupt_) result += "I"; else result += "-"; - if(trap_) result += "T"; else result += "-"; - if(sign_) result += "S"; else result += "-"; - if(!zero_) result += "Z"; else result += "-"; + if(flag()) result += "O"; else result += "-"; + if(flag()) result += "D"; else result += "-"; + if(flag()) result += "I"; else result += "-"; + if(flag()) result += "T"; else result += "-"; + if(flag()) result += "S"; else result += "-"; + if(flag()) result += "Z"; else result += "-"; result += "-"; - if(auxiliary_carry_) result += "A"; else result += "-"; + if(flag()) result += "A"; else result += "-"; result += "-"; - if(!not_parity_bit()) result += "P"; else result += "-"; + if(!flag()) result += "P"; else result += "-"; result += "-"; - if(carry_) result += "C"; else result += "-"; + if(flag()) result += "C"; else result += "-"; return result; }