2012-04-28 06:35:51 +00:00
|
|
|
struct Flags {
|
2015-11-21 07:36:48 +00:00
|
|
|
inline operator uint() {
|
2012-04-28 06:35:51 +00:00
|
|
|
return (n << 7) | (v << 6) | (d << 3) | (i << 2) | (z << 1) | (c << 0);
|
|
|
|
}
|
|
|
|
|
2015-11-21 07:36:48 +00:00
|
|
|
inline auto operator=(uint8 data) -> Flags& {
|
2012-04-28 06:35:51 +00:00
|
|
|
n = data & 0x80; v = data & 0x40;
|
|
|
|
d = data & 0x08; i = data & 0x04; z = data & 0x02; c = data & 0x01;
|
|
|
|
return *this;
|
|
|
|
}
|
2015-11-21 07:36:48 +00:00
|
|
|
|
|
|
|
bool n, v, d, i, z, c;
|
2012-04-28 06:35:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct Registers {
|
|
|
|
uint8 mdr;
|
|
|
|
uint16 pc;
|
|
|
|
uint8 a, x, y, s;
|
|
|
|
Flags p;
|
|
|
|
} regs;
|
|
|
|
|
|
|
|
struct Register16 {
|
|
|
|
union {
|
2016-02-16 09:27:55 +00:00
|
|
|
uint16_t w;
|
|
|
|
struct { uint8_t order_lsb2(l, h); };
|
2012-04-28 06:35:51 +00:00
|
|
|
};
|
|
|
|
} abs, iabs;
|
|
|
|
|
|
|
|
uint8 rd;
|
|
|
|
uint8 zp;
|
|
|
|
uint16 aa;
|