openMSX
RomArc.cc
Go to the documentation of this file.
1 // Parallax' Arc
2 
3 #include "RomArc.hh"
5 #include "serialize.hh"
6 
7 namespace openmsx {
8 
11 {
12  setUnmapped(0);
13  setRom(1, 0);
14  setRom(2, 1);
15  setUnmapped(3);
16 
17  reset(EmuTime::dummy());
18 
19  getCPUInterface().register_IO_Out(0x7f, this);
20  getCPUInterface().register_IO_In (0x7f, this);
21 }
22 
24 {
25  getCPUInterface().unregister_IO_Out(0x7f, this);
26  getCPUInterface().unregister_IO_In (0x7f, this);
27 }
28 
29 void RomArc::reset(EmuTime::param /*time*/)
30 {
31  offset = 0x00;
32 }
33 
34 void RomArc::writeIO(word /*port*/, byte value, EmuTime::param /*time*/)
35 {
36  if (value == 0x35) {
37  ++offset;
38  }
39 }
40 
42 {
43  return RomArc::peekIO(port, time);
44 }
45 
46 byte RomArc::peekIO(word /*port*/, EmuTime::param /*time*/) const
47 {
48  return ((offset & 0x03) == 0x03) ? 0xda : 0xff;
49 }
50 
51 template<typename Archive>
52 void RomArc::serialize(Archive& ar, unsigned /*version*/)
53 {
54  ar.template serializeBase<Rom16kBBlocks>(*this);
55  ar.serialize("offset", offset);
56 }
58 REGISTER_MSXDEVICE(RomArc, "RomArc");
59 
60 } // namespace openmsx
bool getEnum() const noexcept
Definition: EnumSetting.hh:96
#define REGISTER_MSXDEVICE(CLASS, NAME)
Definition: MSXDevice.hh:307
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)
Definition: serialize.hh:981