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
12namespace openmsx {
13
14class MSXSCCPlusCart final : public MSXDevice
15{
16public:
17 struct MapperConfig {
18 unsigned numBlocks; // number of 8kB blocks
19 byte registerMask; // mapper selection bits to ignore
20 byte registerOffset; // first mapped block
21 };
22
23public:
24 explicit MSXSCCPlusCart(const DeviceConfig& config);
25
26 void powerUp(EmuTime::param time) override;
27 void reset(EmuTime::param time) override;
28 [[nodiscard]] byte readMem(word address, EmuTime::param time) override;
29 [[nodiscard]] byte peekMem(word address, EmuTime::param time) const override;
30 void writeMem(word address, byte value, EmuTime::param time) override;
31 [[nodiscard]] const byte* getReadCacheLine(word start) const override;
32 [[nodiscard]] byte* getWriteCacheLine(word start) const override;
33
34 template<typename Archive>
35 void serialize(Archive& ar, unsigned version);
36
37private:
38 void setMapper(int region, byte value);
39 void setModeRegister(byte value);
40 void checkEnable();
41
42private:
43 const MapperConfig mapperConfig;
44 Ram ram;
45 SCC scc;
46 RomBlockDebuggable romBlockDebug;
47 byte* internalMemoryBank[4]; // 4 blocks of 8kB starting at #4000
48 enum SCCEnable {EN_NONE, EN_SCC, EN_SCCPLUS} enable;
49 byte modeRegister;
50 bool isRamSegment[4];
51 bool isMapped[4];
52 byte mapper[4];
53};
54
55} // namespace openmsx
56
57#endif
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
Definition: MSXDevice.hh:33
const byte * getReadCacheLine(word start) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading.
MSXSCCPlusCart(const DeviceConfig &config)
void reset(EmuTime::param time) override
This method is called on reset.
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.
byte peekMem(word address, EmuTime::param time) const override
Read a byte from a given memory location.
byte readMem(word address, EmuTime::param time) override
Read a byte from a location at a certain time from this device.
byte * getWriteCacheLine(word start) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
void powerUp(EmuTime::param time) override
This method is called when MSX is powered up.
This file implemented 3 utility functions:
Definition: Autofire.cc:9
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29