struct Flags { union { uint8_t data = 0; BooleanBitField n; BooleanBitField v; BooleanBitField p; BooleanBitField b; BooleanBitField h; BooleanBitField i; BooleanBitField z; BooleanBitField c; }; inline operator uint() const { return data; } inline auto& operator =(uint value) { return data = value, *this; } inline auto& operator&=(uint value) { return data &= value, *this; } inline auto& operator|=(uint value) { return data |= value, *this; } inline auto& operator^=(uint value) { return data ^= value, *this; } }; struct Register { union { uint16_t w = 0; NaturalBitField l; NaturalBitField h; }; inline operator uint() const { return w; } inline auto operator=(const Register& value) { w = value.w; } inline auto operator++(int) { uint value = w++; return value; } inline auto operator--(int) { uint value = w--; return value; } inline auto& operator++() { return ++w, *this; } inline auto& operator--() { return --w, *this; } inline auto& operator =(uint value) { return w = value, *this; } inline auto& operator&=(uint value) { return w &= value, *this; } inline auto& operator|=(uint value) { return w |= value, *this; } inline auto& operator^=(uint value) { return w ^= value, *this; } inline auto& operator+=(uint value) { return w += value, *this; } inline auto& operator-=(uint value) { return w -= value, *this; } }; struct Registers { Register pc; union { uint16_t ya; struct { uint8_t order_lsb2(a, y); }; }; uint8_t x, s; Flags p; };