openMSX
CPURegs.cc
Go to the documentation of this file.
1#include "CPURegs.hh"
2#include "serialize.hh"
3
4namespace openmsx {
5
6// version 1: Initial version.
7// version 2: Replaced 'afterEI' boolean with 'after' byte
8// (holds both afterEI and afterLDAI information).
9template<typename Archive>
10void CPURegs::serialize(Archive& ar, unsigned version)
11{
12 ar.serialize("af", AF_.w,
13 "bc", BC_.w,
14 "de", DE_.w,
15 "hl", HL_.w,
16 "af2", AF2_.w,
17 "bc2", BC2_.w,
18 "de2", DE2_.w,
19 "hl2", HL2_.w,
20 "ix", IX_.w,
21 "iy", IY_.w,
22 "pc", PC_.w,
23 "sp", SP_.w,
24 "i", I_);
25 byte r = getR();
26 ar.serialize("r", r); // combined R_ and R2_
27 if constexpr (Archive::IS_LOADER) setR(r);
28 ar.serialize("im", IM_,
29 "iff1", IFF1_,
30 "iff2", IFF2_);
31
32 if (ar.versionBelow(version, 2)) {
33 bool afterEI = false; // initialize to avoid warning
34 ar.serialize("afterEI", afterEI);
36 if (afterEI) setCurrentEI();
38 } else if (ar.versionBelow(version, 3)) {
39 byte after = 0;
40 ar.serialize("after", after);
42 prev_ = after; // flags still in same position
44 } else {
45 ar.serialize("previous", prev_);
46 }
47
48 ar.serialize("halt", HALT_);
49}
51
52} // namespace openmsx
void serialize(Archive &ar, unsigned version)
Definition: CPURegs.cc:10
void endInstruction()
Definition: CPURegs.hh:175
void setR(byte x)
Definition: CPURegs.hh:108
void setCurrentEI()
Definition: CPURegs.hh:140
void clearPrevious()
Definition: CPURegs.hh:180
byte getR() const
Definition: CPURegs.hh:63
This file implemented 3 utility functions:
Definition: Autofire.cc:9
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)
Definition: serialize.hh:1009