|
|
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 root 27:
1.1.1.3 root 28: uint64 Read8(uint32 addr) override;
29: uint64 Read16(uint32 addr) override;
30: uint64 Write8(uint32 addr, uint32 data) override;
31: uint64 Write16(uint32 addr, uint32 data) override;
32: uint64 Peek8(uint32 addr) override;
1.1 root 33:
34: void write_enable(bool value);
35:
36: private:
1.1.1.2 root 37: // アドレスデコーダ
38: uint64 Decoder(uint32 addr) const;
39:
1.1.1.3 root 40: // ファイル
41: std::string filename {};
42: MappedFile file {};
43: uint8 *mem {};
1.1 root 44:
1.1.1.4 root 45: bool writeable {};
1.1.1.3 root 46:
47: // ホストファイル起動用の読み出し値を返す
48: uint32 PeekHostBoot(uint32 offset) const;
1.1 root 49: };
50:
1.1.1.2 root 51: 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.