22 explicit CPURegs(
bool r800) : Rmask(r800 ? 0xff : 0x7f) {}
23 [[nodiscard]]
inline byte getA()
const {
return AF_.
b.h; }
24 [[nodiscard]]
inline byte getF()
const {
return AF_.
b.l; }
25 [[nodiscard]]
inline byte getB()
const {
return BC_.
b.h; }
26 [[nodiscard]]
inline byte getC()
const {
return BC_.
b.l; }
27 [[nodiscard]]
inline byte getD()
const {
return DE_.
b.h; }
28 [[nodiscard]]
inline byte getE()
const {
return DE_.
b.l; }
29 [[nodiscard]]
inline byte getH()
const {
return HL_.
b.h; }
30 [[nodiscard]]
inline byte getL()
const {
return HL_.
b.l; }
31 [[nodiscard]]
inline byte getA2()
const {
return AF2_.
b.h; }
32 [[nodiscard]]
inline byte getF2()
const {
return AF2_.
b.l; }
33 [[nodiscard]]
inline byte getB2()
const {
return BC2_.
b.h; }
34 [[nodiscard]]
inline byte getC2()
const {
return BC2_.
b.l; }
35 [[nodiscard]]
inline byte getD2()
const {
return DE2_.
b.h; }
36 [[nodiscard]]
inline byte getE2()
const {
return DE2_.
b.l; }
37 [[nodiscard]]
inline byte getH2()
const {
return HL2_.
b.h; }
38 [[nodiscard]]
inline byte getL2()
const {
return HL2_.
b.l; }
39 [[nodiscard]]
inline byte getIXh()
const {
return IX_.
b.h; }
40 [[nodiscard]]
inline byte getIXl()
const {
return IX_.
b.l; }
41 [[nodiscard]]
inline byte getIYh()
const {
return IY_.
b.h; }
42 [[nodiscard]]
inline byte getIYl()
const {
return IY_.
b.l; }
43 [[nodiscard]]
inline byte getPCh()
const {
return PC_.
b.h; }
44 [[nodiscard]]
inline byte getPCl()
const {
return PC_.
b.l; }
45 [[nodiscard]]
inline byte getSPh()
const {
return SP_.
b.h; }
46 [[nodiscard]]
inline byte getSPl()
const {
return SP_.
b.l; }
48 [[nodiscard]]
inline word getAF()
const {
return AF_.
w; }
49 [[nodiscard]]
inline word getBC()
const {
return BC_.
w; }
50 [[nodiscard]]
inline word getDE()
const {
return DE_.
w; }
51 [[nodiscard]]
inline word getHL()
const {
return HL_.
w; }
56 [[nodiscard]]
inline word getIX()
const {
return IX_.
w; }
57 [[nodiscard]]
inline word getIY()
const {
return IY_.
w; }
58 [[nodiscard]]
inline word getPC()
const {
return PC_.
w; }
59 [[nodiscard]]
inline word getSP()
const {
return SP_.
w; }
61 [[nodiscard]]
inline byte getIM()
const {
return IM_; }
62 [[nodiscard]]
inline byte getI()
const {
return I_; }
63 [[nodiscard]]
inline byte getR()
const {
return (R_ & Rmask) | (R2_ & ~Rmask); }
64 [[nodiscard]]
inline bool getIFF1()
const {
return IFF1_; }
65 [[nodiscard]]
inline bool getIFF2()
const {
return IFF2_; }
66 [[nodiscard]]
inline byte getHALT()
const {
return HALT_; }
68 inline void setA(
byte x) { AF_.
b.h = x; }
69 inline void setF(
byte x) { AF_.
b.l = x; }
70 inline void setB(
byte x) { BC_.
b.h = x; }
71 inline void setC(
byte x) { BC_.
b.l = x; }
72 inline void setD(
byte x) { DE_.
b.h = x; }
73 inline void setE(
byte x) { DE_.
b.l = x; }
74 inline void setH(
byte x) { HL_.
b.h = x; }
75 inline void setL(
byte x) { HL_.
b.l = x; }
76 inline void setA2(
byte x) { AF2_.
b.h = x; }
77 inline void setF2(
byte x) { AF2_.
b.l = x; }
78 inline void setB2(
byte x) { BC2_.
b.h = x; }
79 inline void setC2(
byte x) { BC2_.
b.l = x; }
80 inline void setD2(
byte x) { DE2_.
b.h = x; }
81 inline void setE2(
byte x) { DE2_.
b.l = x; }
82 inline void setH2(
byte x) { HL2_.
b.h = x; }
83 inline void setL2(
byte x) { HL2_.
b.l = x; }
84 inline void setIXh(
byte x) { IX_.
b.h = x; }
85 inline void setIXl(
byte x) { IX_.
b.l = x; }
86 inline void setIYh(
byte x) { IY_.
b.h = x; }
87 inline void setIYl(
byte x) { IY_.
b.l = x; }
88 inline void setPCh(
byte x) { PC_.
b.h = x; }
89 inline void setPCl(
byte x) { PC_.
b.l = x; }
90 inline void setSPh(
byte x) { SP_.
b.h = x; }
91 inline void setSPl(
byte x) { SP_.
b.l = x; }
106 inline void setIM(
byte x) { IM_ = x; }
107 inline void setI(
byte x) { I_ = x; }
108 inline void setR(
byte x) { R_ = x; R2_ = x; }
111 inline void setHALT(
bool x) { HALT_ = (HALT_ & ~1) | (x ? 1 : 0); }
112 inline void setExtHALT(
bool x) { HALT_ = (HALT_ & ~2) | (x ? 2 : 0); }
114 inline void incR(
byte x) { R_ += x; }
158 return (prev_ & (1 << 8)) != 0;
162 return (prev_ & (2 << 8)) != 0;
166 return (prev_ & (4 << (2 * 8))) != 0;
170 return (prev_ & (8 << 8)) != 0;
189 assert((prev_ & 0xF7) == 0);
193 template<
typename Archive>
194 void serialize(Archive& ar,
unsigned version);
220 [[nodiscard]]
inline byte getA()
const {
return AF >> 8; }
221 [[nodiscard]]
inline byte getF()
const {
return AF & 255; }
222 [[nodiscard]]
inline byte getB()
const {
return BC >> 8; }
223 [[nodiscard]]
inline byte getC()
const {
return BC & 255; }
224 [[nodiscard]]
inline byte getD()
const {
return DE >> 8; }
225 [[nodiscard]]
inline byte getE()
const {
return DE & 255; }
226 [[nodiscard]]
inline byte getH()
const {
return HL >> 8; }
227 [[nodiscard]]
inline byte getL()
const {
return HL & 255; }
228 [[nodiscard]]
inline byte getA2()
const {
return AF2 >> 8; }
229 [[nodiscard]]
inline byte getF2()
const {
return AF2 & 255; }
230 [[nodiscard]]
inline byte getB2()
const {
return BC2 >> 8; }
231 [[nodiscard]]
inline byte getC2()
const {
return BC2 & 255; }
232 [[nodiscard]]
inline byte getD2()
const {
return DE2 >> 8; }
233 [[nodiscard]]
inline byte getE2()
const {
return DE2 & 255; }
234 [[nodiscard]]
inline byte getH2()
const {
return HL2 >> 8; }
235 [[nodiscard]]
inline byte getL2()
const {
return HL2 & 255; }
236 [[nodiscard]]
inline byte getIXh()
const {
return IX >> 8; }
237 [[nodiscard]]
inline byte getIXl()
const {
return IX & 255; }
238 [[nodiscard]]
inline byte getIYh()
const {
return IY >> 8; }
239 [[nodiscard]]
inline byte getIYl()
const {
return IY & 255; }
240 [[nodiscard]]
inline byte getPCh()
const {
return PC >> 8; }
241 [[nodiscard]]
inline byte getPCl()
const {
return PC & 255; }
242 [[nodiscard]]
inline byte getSPh()
const {
return SP >> 8; }
243 [[nodiscard]]
inline byte getSPl()
const {
return SP & 255; }
244 [[nodiscard]]
inline word getAF()
const {
return AF; }
245 [[nodiscard]]
inline word getBC()
const {
return BC; }
246 [[nodiscard]]
inline word getDE()
const {
return DE; }
247 [[nodiscard]]
inline word getHL()
const {
return HL; }
248 [[nodiscard]]
inline word getAF2()
const {
return AF2; }
249 [[nodiscard]]
inline word getBC2()
const {
return BC2; }
250 [[nodiscard]]
inline word getDE2()
const {
return DE2; }
251 [[nodiscard]]
inline word getHL2()
const {
return HL2; }
252 [[nodiscard]]
inline word getIX()
const {
return IX; }
253 [[nodiscard]]
inline word getIY()
const {
return IY; }
254 [[nodiscard]]
inline word getPC()
const {
return PC; }
255 [[nodiscard]]
inline word getSP()
const {
return SP; }
256 [[nodiscard]]
inline byte getIM()
const {
return IM; }
257 [[nodiscard]]
inline byte getI()
const {
return I; }
258 [[nodiscard]]
inline byte getR()
const {
return (
R & 0x7F) | (R2 & 0x80); }
259 [[nodiscard]]
inline bool getIFF1()
const {
return IFF1; }
260 [[nodiscard]]
inline bool getIFF2()
const {
return IFF2; }
261 [[nodiscard]]
inline bool getHALT()
const {
return HALT; }
263 inline void setA(
byte x) {
AF = (
AF & 0x00FF) | (x << 8); }
264 inline void setF(
byte x) {
AF = (
AF & 0xFF00) | x; }
265 inline void setB(
byte x) {
BC = (
BC & 0x00FF) | (x << 8); }
266 inline void setC(
byte x) {
BC = (
BC & 0xFF00) | x; }
267 inline void setD(
byte x) {
DE = (
DE & 0x00FF) | (x << 8); }
268 inline void setE(
byte x) {
DE = (
DE & 0xFF00) | x; }
269 inline void setH(
byte x) {
HL = (
HL & 0x00FF) | (x << 8); }
270 inline void setL(
byte x) {
HL = (
HL & 0xFF00) | x; }
271 inline void setA2(
byte x) { AF2 = (AF2 & 0x00FF) | (x << 8); }
272 inline void setF2(
byte x) { AF2 = (AF2 & 0xFF00) | x; }
273 inline void setB2(
byte x) { BC2 = (BC2 & 0x00FF) | (x << 8); }
274 inline void setC2(
byte x) { BC2 = (BC2 & 0xFF00) | x; }
275 inline void setD2(
byte x) { DE2 = (DE2 & 0x00FF) | (x << 8); }
276 inline void setE2(
byte x) { DE2 = (DE2 & 0xFF00) | x; }
277 inline void setH2(
byte x) { HL2 = (HL2 & 0x00FF) | (x << 8); }
278 inline void setL2(
byte x) { HL2 = (HL2 & 0xFF00) | x; }
279 inline void setIXh(
byte x) {
IX = (
IX & 0x00FF) | (x << 8); }
280 inline void setIXl(
byte x) {
IX = (
IX & 0xFF00) | x; }
281 inline void setIYh(
byte x) {
IY = (
IY & 0x00FF) | (x << 8); }
282 inline void setIYl(
byte x) {
IY = (
IY & 0xFF00) | x; }
283 inline void setPCh(
byte x) { PC = (PC & 0x00FF) | (x << 8); }
284 inline void setPCl(
byte x) { PC = (PC & 0xFF00) | x; }
285 inline void setSPh(
byte x) {
SP = (
SP & 0x00FF) | (x << 8); }
286 inline void setSPl(
byte x) {
SP = (
SP & 0xFF00) | x; }
299 inline void setIM(
byte x) { IM = x; }
300 inline void setI(
byte x) { I = x; }
301 inline void setR(
byte x) {
R = x; R2 = x; }
302 inline void setIFF1(
bool x) { IFF1 = x; }
303 inline void setIFF2(
bool x) { IFF2 = x; }
304 inline void setHALT(
bool x) { HALT = x; }
306 inline void incR(
byte x) {
R += x; }
310 word AF2, BC2, DE2, HL2;
312 bool IFF1, IFF2, HALT;
void serialize(Archive &ar, unsigned version)
bool prevWasPopRet() const
bool prev2WasCall() const
void checkNoCurrentFlags() const
This file implemented 3 utility functions:
uint16_t word
16 bit unsigned integer
z80regPair_8bit< std::endian::native > b