|
|
1.1 root 1: //
2: // nono
3: // Copyright (C) 2023 nono project
4: // Licensed under nono-license.txt
5: //
6:
7: //
8: // X68030 勝手に拡張メモリ
9: //
10:
11: #pragma once
12:
13: #include "device.h"
14:
15: class ExtRAMDevice : public IODevice
16: {
17: using inherited = IODevice;
18: public:
19: ExtRAMDevice();
1.1.1.2 root 20: ~ExtRAMDevice() override;
1.1 root 21:
22: bool Init() override;
23: void ResetHard(bool poweron) override;
24:
1.1.1.3 root 25: busdata Read(busaddr addr) override;
26: busdata Write(busaddr, uint32 data) override;
27: busdata Peek1(uint32 addr) override;
28: bool Poke1(uint32 addr, uint32 data) override;
1.1 root 29:
30: // 拡張メモリ容量(バイト単位)を取得
31: int GetSize() const { return ram_size; }
32: // 拡張メモリ容量(MB単位)を取得
33: int GetSizeMB() const { return ram_size / 1024 / 1024; }
34:
35: private:
36: inline uint32 Decoder(uint32) const;
37:
38: std::unique_ptr<uint8[]> ram {};
39:
40: // 拡張メモリの開始アドレス
41: uint32 ram_addr {};
42:
43: // 拡張メモリ容量(バイト単位)。ram[] の確保したバイト数
44: uint ram_size {};
45: };
46:
1.1.1.4 ! root 47: inline ExtRAMDevice *GetExtRAMDevice() {
1.1 root 48: return Object::GetObject<ExtRAMDevice>(OBJ_EXTRAM);
49: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.