openMSX
cpu
CPURegs.cc
Go to the documentation of this file.
1
#include "
CPURegs.hh
"
2
#include "
serialize.hh
"
3
4
namespace
openmsx
{
5
6
// version 1: Initial version.
7
// version 2: Replaced 'afterEI' boolean with 'after' byte
8
// (holds both afterEI and afterLDAI information).
9
template
<
typename
Archive>
10
void
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);
35
clearPrevious
();
36
if
(afterEI)
setCurrentEI
();
37
endInstruction
();
38
}
else
if
(ar.versionBelow(version, 3)) {
39
byte
after = 0;
40
ar.serialize(
"after"
, after);
41
clearPrevious
();
42
prev_ = after;
// flags still in same position
43
endInstruction
();
44
}
else
{
45
ar.serialize(
"previous"
, prev_);
46
}
47
48
ar.serialize(
"halt"
, HALT_);
49
}
50
INSTANTIATE_SERIALIZE_METHODS
(
CPURegs
);
51
52
}
// namespace openmsx
CPURegs.hh
openmsx::CPURegs
Definition
CPURegs.hh:20
openmsx::CPURegs::serialize
void serialize(Archive &ar, unsigned version)
Definition
CPURegs.cc:10
openmsx::CPURegs::endInstruction
void endInstruction()
Definition
CPURegs.hh:175
openmsx::CPURegs::setR
void setR(byte x)
Definition
CPURegs.hh:108
openmsx::CPURegs::setCurrentEI
void setCurrentEI()
Definition
CPURegs.hh:140
openmsx::CPURegs::clearPrevious
void clearPrevious()
Definition
CPURegs.hh:180
openmsx::CPURegs::getR
byte getR() const
Definition
CPURegs.hh:63
openmsx
This file implemented 3 utility functions:
Definition
Autofire.cc:11
serialize.hh
INSTANTIATE_SERIALIZE_METHODS
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)
Definition
serialize.hh:1007
openmsx::z80regPair::w
word w
Definition
CPURegs.hh:16
Generated on Fri Oct 11 2024 19:13:46 for openMSX by
1.9.8