openMSX
MSXSCCPlusCart.hh
Go to the documentation of this file.
1 // Note: this device is actually called SCC-I. But this would take a lot of
2 // renaming, which isn't worth it right now. TODO rename this :)
3 
4 #ifndef MSXSCCPLUSCART_HH
5 #define MSXSCCPLUSCART_HH
6 
7 #include "MSXDevice.hh"
8 #include "SCC.hh"
9 #include "Ram.hh"
10 #include "RomBlockDebuggable.hh"
11 
12 namespace openmsx {
13 
14 class MSXSCCPlusCart final : public MSXDevice
15 {
16 public:
17  explicit MSXSCCPlusCart(const DeviceConfig& config);
18 
19  void powerUp(EmuTime::param time) override;
20  void reset(EmuTime::param time) override;
21  byte readMem(word address, EmuTime::param time) override;
22  byte peekMem(word address, EmuTime::param time) const override;
23  void writeMem(word address, byte value, EmuTime::param time) override;
24  const byte* getReadCacheLine(word start) const override;
25  byte* getWriteCacheLine(word start) const override;
26 
27  template<typename Archive>
28  void serialize(Archive& ar, unsigned version);
29 
30 private:
31  void setMapper(int regio, byte value);
32  void setModeRegister(byte value);
33  void checkEnable();
34 
35  Ram ram;
36  SCC scc;
37  RomBlockDebuggable romBlockDebug;
38  byte* internalMemoryBank[4]; // 4 blocks of 8kB starting at #4000
39  enum SCCEnable {EN_NONE, EN_SCC, EN_SCCPLUS} enable;
40  byte modeRegister;
41  bool isRamSegment[4];
42  bool isMapped[4];
43  byte mapper[4];
44  /*const*/ byte mapperMask;
45  /*const*/ bool lowRAM, highRAM;
46 };
47 
48 } // namespace openmsx
49 
50 #endif
uint8_t byte
8 bit unsigned integer
Definition: openmsx.hh:26
byte readMem(word address, EmuTime::param time) override
Read a byte from a location at a certain time from this device.
MSXSCCPlusCart(const DeviceConfig &config)
void reset(EmuTime::param time) override
This method is called on reset.
void powerUp(EmuTime::param time) override
This method is called when MSX is powered up.
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
const byte * getReadCacheLine(word start) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading...
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX...
Definition: MSXDevice.hh:31
byte peekMem(word address, EmuTime::param time) const override
Read a byte from a given memory location.
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29
byte * getWriteCacheLine(word start) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing...
void serialize(Archive &ar, unsigned version)
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.