openMSX
NowindInterface.hh
Go to the documentation of this file.
1 #ifndef NOWINDINTERFACE_HH
2 #define NOWINDINTERFACE_HH
3 
4 #include "MSXDevice.hh"
5 #include "NowindHost.hh"
6 #include "Rom.hh"
7 #include "AmdFlash.hh"
8 #include <bitset>
9 #include <memory>
10 #include <string>
11 
12 namespace openmsx {
13 
14 class NowindCommand;
15 
16 class NowindInterface final : public MSXDevice
17 {
18 public:
19  explicit NowindInterface(const DeviceConfig& config);
20  ~NowindInterface() override;
21 
22  void reset(EmuTime::param time) override;
23  byte peekMem(word address, EmuTime::param time) const override;
24  byte readMem(word address, EmuTime::param time) override;
25  void writeMem(word address, byte value, EmuTime::param time) override;
26  const byte* getReadCacheLine(word address) const override;
27  byte* getWriteCacheLine(word address) const override;
28 
29  template<typename Archive>
30  void serialize(Archive& ar, unsigned version);
31 
32 private:
33  Rom rom;
34  AmdFlash flash;
35  NowindHost host;
36  std::unique_ptr<NowindCommand> command;
37  NowindHost::Drives drives;
38  std::string basename;
39  byte bank;
40 
41  static constexpr unsigned MAX_NOWINDS = 8; // a-h
42  using NowindsInUse = std::bitset<MAX_NOWINDS>;
43  std::shared_ptr<NowindsInUse> nowindsInUse;
44 
45  friend class NowindCommand;
46 };
47 
48 } // namespace openmsx
49 
50 #endif
openmsx::MSXDevice
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
Definition: MSXDevice.hh:31
openmsx::NowindInterface::peekMem
byte peekMem(word address, EmuTime::param time) const override
Read a byte from a given memory location.
Definition: NowindInterface.cc:64
openmsx::NowindInterface::getWriteCacheLine
byte * getWriteCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
Definition: NowindInterface.cc:121
Rom.hh
openmsx::NowindHost::Drives
std::vector< std::unique_ptr< DiskContainer > > Drives
Definition: NowindHost.hh:20
openmsx::NowindCommand
Definition: NowindCommand.hh:15
openmsx::AmdFlash
Definition: AmdFlash.hh:17
openmsx::DeviceConfig
Definition: DeviceConfig.hh:19
openmsx::NowindInterface::reset
void reset(EmuTime::param time) override
This method is called on reset.
Definition: NowindInterface.cc:54
openmsx::NowindInterface::~NowindInterface
~NowindInterface() override
Definition: NowindInterface.cc:47
openmsx::NowindInterface::NowindInterface
NowindInterface(const DeviceConfig &config)
Definition: NowindInterface.cc:17
openmsx::NowindInterface::writeMem
void writeMem(word address, byte value, EmuTime::param time) override
Write a given byte to a given location at a certain time to this device.
Definition: NowindInterface.cc:104
openmsx::NowindHost
Definition: NowindHost.hh:17
openmsx::NowindInterface::readMem
byte readMem(word address, EmuTime::param time) override
Read a byte from a location at a certain time from this device.
Definition: NowindInterface.cc:77
AmdFlash.hh
openmsx::NowindInterface::serialize
void serialize(Archive &ar, unsigned version)
Definition: NowindInterface.cc:133
MSXDevice.hh
openmsx::NowindInterface
Definition: NowindInterface.hh:16
openmsx::Rom
Definition: Rom.hh:20
openmsx::word
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29
openmsx::NowindInterface::getReadCacheLine
const byte * getReadCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading.
Definition: NowindInterface.cc:90
openmsx
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
NowindHost.hh