openMSX
MegaFlashRomSCCPlus.hh
Go to the documentation of this file.
1#ifndef MEGAFLASHROMSCCPLUS_HH
2#define MEGAFLASHROMSCCPLUS_HH
3
4#include "MSXRom.hh"
5#include "SCC.hh"
6#include "AY8910.hh"
7#include "AmdFlash.hh"
8#include <array>
9
10namespace openmsx {
11
12class MegaFlashRomSCCPlus final : public MSXRom
13{
14public:
15 MegaFlashRomSCCPlus(const DeviceConfig& config, Rom&& rom);
16 ~MegaFlashRomSCCPlus() override;
17
18 void powerUp(EmuTime::param time) override;
19 void reset(EmuTime::param time) override;
20 [[nodiscard]] byte peekMem(word address, EmuTime::param time) const override;
21 [[nodiscard]] byte readMem(word address, EmuTime::param time) override;
22 [[nodiscard]] const byte* getReadCacheLine(word address) const override;
23 void writeMem(word address, byte value, EmuTime::param time) override;
24 [[nodiscard]] byte* getWriteCacheLine(word address) override;
25
26 void writeIO(word port, byte value, EmuTime::param time) override;
27
28 template<typename Archive>
29 void serialize(Archive& ar, unsigned version);
30
31private:
32 [[nodiscard]] byte readMem2(word addr, EmuTime::param time);
33
34 enum SCCEnable { EN_NONE, EN_SCC, EN_SCCPLUS };
35 [[nodiscard]] SCCEnable getSCCEnable() const;
36
37 [[nodiscard]] unsigned getSubslot(unsigned address) const;
38 [[nodiscard]] unsigned getFlashAddr(unsigned addr) const;
39
40private:
41 SCC scc;
42 AY8910 psg;
43 AmdFlash flash;
44
45 byte configReg;
46 byte offsetReg;
47 byte subslotReg;
48 std::array<std::array<byte, 4>, 4> bankRegs;
49 byte psgLatch;
50 byte sccMode;
51 std::array<byte, 4> sccBanks;
52};
53
54} // namespace openmsx
55
56#endif
This class implements the AY-3-8910 sound chip.
Definition AY8910.hh:22
void reset(EmuTime::param time) override
This method is called on reset.
void powerUp(EmuTime::param time) override
This method is called when MSX is powered up.
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.
const byte * getReadCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading.
byte * getWriteCacheLine(word address) override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
byte readMem(word address, EmuTime::param time) override
Read a byte from a location at a certain time from this device.
void serialize(Archive &ar, unsigned version)
void writeIO(word port, byte value, EmuTime::param time) override
Write a byte to a given IO port at a certain time to this device.
byte peekMem(word address, EmuTime::param time) const override
Read a byte from a given memory location.
This file implemented 3 utility functions:
Definition Autofire.cc:11
uint16_t word
16 bit unsigned integer
Definition openmsx.hh:29