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  [[nodiscard]] byte peekMem(word address, EmuTime::param time) const override;
19  [[nodiscard]] byte readMem(word address, EmuTime::param time) override;
20  [[nodiscard]] const byte* getReadCacheLine(word address) const override;
21  void writeMem(word address, byte value, EmuTime::param time) override;
22  [[nodiscard]] byte* getWriteCacheLine(word address) const override;
23 
24  template<typename Archive>
25  void serialize(Archive& ar, unsigned version);
26 
27 private:
28  std::shared_ptr<SRAM> fsSram;
29  FirmwareSwitch firmwareSwitch;
30 };
31 
32 class RomFSA1FM2 final : public Rom8kBBlocks
33 {
34 public:
35  RomFSA1FM2(const DeviceConfig& config, Rom&& rom);
36 
37  void reset(EmuTime::param time) override;
38  [[nodiscard]] byte peekMem(word address, EmuTime::param time) const override;
39  [[nodiscard]] byte readMem(word address, EmuTime::param time) override;
40  [[nodiscard]] const byte* getReadCacheLine(word address) const override;
41  void writeMem(word address, byte value, EmuTime::param time) override;
42  [[nodiscard]] byte* getWriteCacheLine(word address) const override;
43 
44  template<typename Archive>
45  void serialize(Archive& ar, unsigned version);
46 
47 private:
48  void changeBank(byte region, byte bank);
49 
50 private:
51  std::shared_ptr<SRAM> fsSram;
52  byte bankSelect[8];
53  bool isRam[8];
54  bool isEmpty[8];
55  byte control;
56 };
57 
58 } // namespace openmsx
59 
60 #endif
void reset(EmuTime::param time) override
This method is called on reset.
Definition: RomFSA1FM.cc:71
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:122
byte readMem(word address, EmuTime::param time) override
Read a byte from a location at a certain time from this device.
Definition: RomFSA1FM.cc:100
byte * getWriteCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
Definition: RomFSA1FM.cc:135
byte peekMem(word address, EmuTime::param time) const override
Read a byte from a given memory location.
Definition: RomFSA1FM.cc:76
void serialize(Archive &ar, unsigned version)
Definition: RomFSA1FM.cc:149
RomFSA1FM1(const DeviceConfig &config, Rom &&rom)
Definition: RomFSA1FM.cc:59
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:105
byte readMem(word address, EmuTime::param time) override
Read a byte from a location at a certain time from this device.
Definition: RomFSA1FM.cc:196
byte * getWriteCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
Definition: RomFSA1FM.cc:255
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:201
void serialize(Archive &ar, unsigned version)
Definition: RomFSA1FM.cc:289
void reset(EmuTime::param time) override
This method is called on reset.
Definition: RomFSA1FM.cc:168
RomFSA1FM2(const DeviceConfig &config, Rom &&rom)
Definition: RomFSA1FM.cc:161
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:216
byte peekMem(word address, EmuTime::param time) const override
Read a byte from a given memory location.
Definition: RomFSA1FM.cc:180
This file implemented 3 utility functions:
Definition: Autofire.cc:9
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29
SRAM
Definition: SRAM.cc:150