| 1 |
#ifndef ROMFSA1FM1_HH |
| 2 |
#define ROMFSA1FM1_HH |
| 3 |
|
| 4 |
#include "MSXRom.hh" |
| 5 |
#include "RomBlocks.hh" |
| 6 |
|
| 7 |
#include "FirmwareSwitch.hh" |
| 8 |
|
| 9 |
#include <array> |
| 10 |
|
| 11 |
namespace openmsx { |
| 12 |
|
| 13 |
class SRAM; |
| 14 |
|
| 15 |
class RomFSA1FM1 final : public MSXRom |
| 16 |
{ |
| 17 |
public: |
| 18 |
RomFSA1FM1(const DeviceConfig& config, Rom&& rom); |
| 19 |
|
| 20 |
void reset(EmuTime time) override; |
| 21 |
[[nodiscard]] byte peekMem(uint16_t address, EmuTime time) const override; |
| 22 |
[[nodiscard]] byte readMem(uint16_t address, EmuTime time) override; |
| 23 |
[[nodiscard]] const byte* getReadCacheLine(uint16_t address) const override; |
| 24 |
void writeMem(uint16_t address, byte value, EmuTime time) override; |
| 25 |
[[nodiscard]] byte* getWriteCacheLine(uint16_t address) override; |
| 26 |
|
| 27 |
template<typename Archive> |
| 28 |
void serialize(Archive& ar, unsigned version); |
| 29 |
|
| 30 |
private: |
| 31 |
std::shared_ptr<SRAM> fsSram; |
| 32 |
FirmwareSwitch firmwareSwitch; |
| 33 |
}; |
| 34 |
|
| 35 |
class RomFSA1FM2 final : public Rom8kBBlocks |
| 36 |
{ |
| 37 |
public: |
| 38 |
RomFSA1FM2(const DeviceConfig& config, Rom&& rom); |
| 39 |
|
| 40 |
void reset(EmuTime time) override; |
| 41 |
[[nodiscard]] byte peekMem(uint16_t address, EmuTime time) const override; |
| 42 |
[[nodiscard]] byte readMem(uint16_t address, EmuTime time) override; |
| 43 |
[[nodiscard]] const byte* getReadCacheLine(uint16_t address) const override; |
| 44 |
void writeMem(uint16_t address, byte value, EmuTime time) override; |
| 45 |
[[nodiscard]] byte* getWriteCacheLine(uint16_t address) override; |
| 46 |
|
| 47 |
template<typename Archive> |
| 48 |
void serialize(Archive& ar, unsigned version); |
| 49 |
|
| 50 |
private: |
| 51 |
void changeBank(unsigned region, byte bank); |
| 52 |
|
| 53 |
private: |
| 54 |
std::shared_ptr<SRAM> fsSram; |
| 55 |
std::array<byte, 8> bankSelect; |
| 56 |
std::array<bool, 8> isRam; |
| 57 |
std::array<bool, 8> isEmpty; |
| 58 |
byte control; |
| 59 |
}; |
| 60 |
|
| 61 |
} |
| 62 |
|
| 63 |
#endif |