openMSX
RomArc.cc
Go to the documentation of this file.
1// Parallax' Arc
2
3#include "RomArc.hh"
4#include "MSXCPUInterface.hh"
5#include "serialize.hh"
6
7namespace openmsx {
8
9RomArc::RomArc(const DeviceConfig& config, Rom&& rom_)
10 : Rom16kBBlocks(config, std::move(rom_))
11{
12 setUnmapped(0);
13 setRom(1, 0);
14 setRom(2, 1);
15 setUnmapped(3);
16
17 reset(EmuTime::dummy());
18
20}
21
26
27void RomArc::reset(EmuTime::param /*time*/)
28{
29 offset = 0x00;
30}
31
32void RomArc::writeIO(word /*port*/, byte value, EmuTime::param /*time*/)
33{
34 if (value == 0x35) {
35 ++offset;
36 }
37}
38
39byte RomArc::readIO(word port, EmuTime::param time)
40{
41 return RomArc::peekIO(port, time);
42}
43
44byte RomArc::peekIO(word /*port*/, EmuTime::param /*time*/) const
45{
46 return ((offset & 0x03) == 0x03) ? 0xda : 0xff;
47}
48
49template<typename Archive>
50void RomArc::serialize(Archive& ar, unsigned /*version*/)
51{
52 ar.template serializeBase<Rom16kBBlocks>(*this);
53 ar.serialize("offset", offset);
54}
57
58} // namespace openmsx
#define REGISTER_MSXDEVICE(CLASS, NAME)
Definition MSXDevice.hh:356
void unregister_IO_InOut(byte port, MSXDevice *device)
void register_IO_InOut(byte port, MSXDevice *device)
Convenience methods for {un}register_IO_{In,Out}.
MSXCPUInterface & getCPUInterface() const
Definition MSXDevice.cc:133
RomArc(const DeviceConfig &config, Rom &&rom)
Definition RomArc.cc:9
void serialize(Archive &ar, unsigned version)
Definition RomArc.cc:50
byte readIO(word port, EmuTime::param time) override
Read a byte from an IO port at a certain time from this device.
Definition RomArc.cc:39
byte peekIO(word port, EmuTime::param time) const override
Read a byte from a given IO port.
Definition RomArc.cc:44
~RomArc() override
Definition RomArc.cc:22
void reset(EmuTime::param time) override
This method is called on reset.
Definition RomArc.cc:27
void writeIO(word port, byte value, EmuTime::param time) override
Write a byte to a given IO port at a certain time to this device.
Definition RomArc.cc:32
void setUnmapped(unsigned region)
Select 'unmapped' memory for this region.
Definition RomBlocks.cc:92
void setRom(unsigned region, unsigned block)
Selects a block of the ROM image for reading in a certain region.
Definition RomBlocks.cc:104
This file implemented 3 utility functions:
Definition Autofire.cc:11
uint16_t word
16 bit unsigned integer
Definition openmsx.hh:29
STL namespace.
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)