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#include <array>
8
9namespace openmsx {
10
11class SRAM;
12
13class RomFSA1FM1 final : public MSXRom
14{
15public:
16 RomFSA1FM1(const DeviceConfig& config, Rom&& rom);
17
18 void reset(EmuTime::param time) override;
19 [[nodiscard]] byte peekMem(word address, EmuTime::param time) const override;
20 [[nodiscard]] byte readMem(word address, EmuTime::param time) override;
21 [[nodiscard]] const byte* getReadCacheLine(word address) const override;
22 void writeMem(word address, byte value, EmuTime::param time) override;
23 [[nodiscard]] byte* getWriteCacheLine(word address) const override;
24
25 template<typename Archive>
26 void serialize(Archive& ar, unsigned version);
27
28private:
29 std::shared_ptr<SRAM> fsSram;
30 FirmwareSwitch firmwareSwitch;
31};
32
33class RomFSA1FM2 final : public Rom8kBBlocks
34{
35public:
36 RomFSA1FM2(const DeviceConfig& config, Rom&& rom);
37
38 void reset(EmuTime::param time) override;
39 [[nodiscard]] byte peekMem(word address, EmuTime::param time) const override;
40 [[nodiscard]] byte readMem(word address, EmuTime::param time) override;
41 [[nodiscard]] const byte* getReadCacheLine(word address) const override;
42 void writeMem(word address, byte value, EmuTime::param time) override;
43 [[nodiscard]] byte* getWriteCacheLine(word address) const override;
44
45 template<typename Archive>
46 void serialize(Archive& ar, unsigned version);
47
48private:
49 void changeBank(unsigned region, byte bank);
50
51private:
52 std::shared_ptr<SRAM> fsSram;
53 std::array<byte, 8> bankSelect;
54 std::array<bool, 8> isRam;
55 std::array<bool, 8> isEmpty;
56 byte control;
57};
58
59} // namespace openmsx
60
61#endif
void reset(EmuTime::param time) override
This method is called on reset.
Definition RomFSA1FM.cc:72
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:123
byte readMem(word address, EmuTime::param time) override
Read a byte from a location at a certain time from this device.
Definition RomFSA1FM.cc:101
byte * getWriteCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
Definition RomFSA1FM.cc:136
byte peekMem(word address, EmuTime::param time) const override
Read a byte from a given memory location.
Definition RomFSA1FM.cc:77
void serialize(Archive &ar, unsigned version)
Definition RomFSA1FM.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:106
byte readMem(word address, EmuTime::param time) override
Read a byte from a location at a certain time from this device.
Definition RomFSA1FM.cc:197
byte * getWriteCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
Definition RomFSA1FM.cc:256
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:202
void serialize(Archive &ar, unsigned version)
Definition RomFSA1FM.cc:290
void reset(EmuTime::param time) override
This method is called on reset.
Definition RomFSA1FM.cc:169
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:217
byte peekMem(word address, EmuTime::param time) const override
Read a byte from a given memory location.
Definition RomFSA1FM.cc:181
This file implemented 3 utility functions:
Definition Autofire.cc:11
uint16_t word
16 bit unsigned integer
Definition openmsx.hh:29