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