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