| e8555c89 Andy McCall |
1 |
#ifndef YAMANOOTO_HH |
| 2 |
#define YAMANOOTO_HH |
| 3 |
|
| 4 |
#include "AY8910.hh" |
| 5 |
#include "AmdFlash.hh" |
| 6 |
#include "MSXRom.hh" |
| 7 |
#include "RomBlockDebuggable.hh" |
| 8 |
#include "SCC.hh" |
| 9 |
|
| 10 |
#include <array> |
| 11 |
|
| 12 |
namespace openmsx { |
| 13 |
|
| 14 |
class Yamanooto final : public MSXRom |
| 15 |
{ |
| 16 |
public: |
| 17 |
Yamanooto(DeviceConfig& config, Rom&& rom); |
| 18 |
~Yamanooto() override; |
| 19 |
|
| 20 |
void powerUp(EmuTime time) override; |
| 21 |
void reset(EmuTime time) override; |
| 22 |
[[nodiscard]] byte peekMem(uint16_t address, EmuTime time) const override; |
| 23 |
[[nodiscard]] byte readMem(uint16_t address, EmuTime time) override; |
| 24 |
[[nodiscard]] const byte* getReadCacheLine(uint16_t address) const override; |
| 25 |
void writeMem(uint16_t address, byte value, EmuTime time) override; |
| 26 |
[[nodiscard]] byte* getWriteCacheLine(uint16_t address) override; |
| 27 |
|
| 28 |
byte peekIO(uint16_t port, EmuTime time) const override; |
| 29 |
byte readIO(uint16_t port, EmuTime time) override; |
| 30 |
void writeIO(uint16_t port, byte value, EmuTime time) override; |
| 31 |
|
| 32 |
template<typename Archive> |
| 33 |
void serialize(Archive& ar, unsigned version); |
| 34 |
|
| 35 |
private: |
| 36 |
void writeConfigReg(byte value); |
| 37 |
[[nodiscard]] bool isSCCAccess(uint16_t addr) const; |
| 38 |
[[nodiscard]] unsigned getFlashAddr(unsigned addr) const; |
| 39 |
|
| 40 |
private: |
| 41 |
struct Blocks final : RomBlockDebuggableBase { |
| 42 |
explicit Blocks(const Yamanooto& device) |
| 43 |
: RomBlockDebuggableBase(device) {} |
| 44 |
[[nodiscard]] unsigned readExt(unsigned address) override; |
| 45 |
} romBlockDebug; |
| 46 |
|
| 47 |
AmdFlash flash; |
| 48 |
SCC scc; |
| 49 |
AY8910 psg; |
| 50 |
std::array<uint16_t, 4> bankRegs = {}; |
| 51 |
std::array<uint8_t, 4> rawBanks = {}; |
| 52 |
byte enableReg = 0; |
| 53 |
byte offsetReg = 0; |
| 54 |
byte configReg = 0; |
| 55 |
byte sccMode = 0; |
| 56 |
byte psgLatch = 0; |
| 57 |
byte fpgaFsm = 0; |
| 58 |
}; |
| 59 |
SERIALIZE_CLASS_VERSION(Yamanooto, 2); |
| 60 |
|
| 61 |
} |
| 62 |
|
| 63 |
#endif |