openMSX
RomFSA1FM.hh
Go to the documentation of this file.
1 #ifndef ROMFSA1FM1_HH
2 #define ROMFSA1FM1_HH
3 
4 #include "MSXRom.hh"
5 #include "RomBlocks.hh"
6 #include "FirmwareSwitch.hh"
7 
8 namespace openmsx {
9 
10 class SRAM;
11 
12 class RomFSA1FM1 final : public MSXRom
13 {
14 public:
15  RomFSA1FM1(const DeviceConfig& config, Rom&& rom);
16 
17  void reset(EmuTime::param time) override;
18  byte peekMem(word address, EmuTime::param time) const override;
19  byte readMem(word address, EmuTime::param time) override;
20  const byte* getReadCacheLine(word address) const override;
21  void writeMem(word address, byte value,
22  EmuTime::param time) override;
23  byte* getWriteCacheLine(word address) const override;
24 
25  template<typename Archive>
26  void serialize(Archive& ar, unsigned version);
27 
28 private:
29  std::shared_ptr<SRAM> fsSram;
30  FirmwareSwitch firmwareSwitch;
31 };
32 
33 class RomFSA1FM2 final : public Rom8kBBlocks
34 {
35 public:
36  RomFSA1FM2(const DeviceConfig& config, Rom&& rom);
37 
38  void reset(EmuTime::param time) override;
39  byte peekMem(word address, EmuTime::param time) const override;
40  byte readMem(word address, EmuTime::param time) override;
41  const byte* getReadCacheLine(word address) const override;
42  void writeMem(word address, byte value,
43  EmuTime::param time) override;
44  byte* getWriteCacheLine(word address) const override;
45 
46  template<typename Archive>
47  void serialize(Archive& ar, unsigned version);
48 
49 private:
50  void changeBank(byte region, byte bank);
51 
52  std::shared_ptr<SRAM> fsSram;
53  byte bankSelect[8];
54  bool isRam[8];
55  bool isEmpty[8];
56  byte control;
57 };
58 
59 } // namespace openmsx
60 
61 #endif
byte peekMem(word address, EmuTime::param time) const override
Read a byte from a given memory location.
Definition: RomFSA1FM.cc:75
RomFSA1FM1(const DeviceConfig &config, Rom &&rom)
Definition: RomFSA1FM.cc:57
uint8_t byte
8 bit unsigned integer
Definition: openmsx.hh:26
void reset(EmuTime::param time) override
This method is called on reset.
Definition: RomFSA1FM.cc:70
byte * getWriteCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing...
Definition: RomFSA1FM.cc:134
byte readMem(word address, EmuTime::param time) override
Read a byte from a location at a certain time from this device.
Definition: RomFSA1FM.cc:99
SRAM
Definition: SRAM.cc:150
const byte * getReadCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading...
Definition: RomFSA1FM.cc:104
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29
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: RomFSA1FM.cc:121
void serialize(Archive &ar, unsigned version)
Definition: RomFSA1FM.cc:148