|
|
1.1 root 1: //
2: // nono
1.1.1.3 root 3: // Copyright (C) 2020 nono project
4: // Licensed under nono-license.txt
1.1 root 5: //
6:
7: #pragma once
8:
9: #include "device.h"
1.1.1.3 root 10: #include "mappedfile.h"
1.1 root 11:
12: class SRAMDevice
13: : public IODevice
14: {
1.1.1.3 root 15: using inherited = IODevice;
1.1 root 16: private:
17: static const uint32 baseaddr = 0xed0000;
18:
1.1.1.3 root 19: // Pluto-X によるホストファイル起動アドレス
20: static const uint32 plutoaddr = 0xeac000;
21:
1.1 root 22: public:
23: SRAMDevice();
1.1.1.5 root 24: virtual ~SRAMDevice() override;
1.1 root 25:
1.1.1.3 root 26: bool Init() override;
1.1.1.6 ! root 27: void ResetHard() override;
1.1 root 28:
1.1.1.3 root 29: uint64 Read8(uint32 addr) override;
30: uint64 Read16(uint32 addr) override;
31: uint64 Write8(uint32 addr, uint32 data) override;
32: uint64 Write16(uint32 addr, uint32 data) override;
33: uint64 Peek8(uint32 addr) override;
1.1 root 34:
35: void write_enable(bool value);
36:
37: private:
1.1.1.2 root 38: // アドレスデコーダ
39: uint64 Decoder(uint32 addr) const;
40:
1.1.1.3 root 41: // ファイル
42: std::string filename {};
43: MappedFile file {};
44: uint8 *mem {};
1.1 root 45:
1.1.1.4 root 46: bool writeable {};
1.1.1.3 root 47:
48: // ホストファイル起動用の読み出し値を返す
49: uint32 PeekHostBoot(uint32 offset) const;
1.1 root 50: };
51:
1.1.1.2 root 52: extern std::unique_ptr<SRAMDevice> gSRAM;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.