struct Flags { union { uint8_t data = 0; BitField n; BitField v; BitField d; BitField i; BitField z; BitField c; }; inline operator uint() { 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 Registers { uint8 mdr; uint16 pc; uint8 a, x, y, s; Flags p; } regs; struct Register16 { union { uint16_t w; BitField l; BitField h; }; } abs, iabs; uint8 rd; uint8 zp; uint16 aa;