|
|
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"
10:
11: class RAMDevice
12: : public IODevice
13: {
1.1.1.3 root 14: using inherited = IODevice;
1.1 root 15: public:
16: RAMDevice();
1.1.1.3 root 17: ~RAMDevice() override;
1.1 root 18:
1.1.1.3 root 19: bool Init() override;
1.1.1.4 ! root 20: void ResetHard() override;
1.1 root 21:
1.1.1.3 root 22: uint64 Read8(uint32 addr) override;
23: uint64 Read16(uint32 addr) override;
24: uint64 Read32(uint32 addr) override;
25: uint64 Write8(uint32 addr, uint32 data) override;
26: uint64 Write16(uint32 addr, uint32 data) override;
27: uint64 Write32(uint32 addr, uint32 data) override;
28: uint64 Peek8(uint32 addr) override;
1.1.1.2 root 29:
1.1.1.4 ! root 30: // アクセスウェイトを設定
! 31: void SetWait(uint32 wait);
! 32:
1.1.1.2 root 33: // ホストの filepath をロードする
34: uint32 LoadFile(const char *filepath, uint32 mid);
35: // file, filesize で示されるバッファをロードする
36: uint32 LoadFile(const char *name, const uint8 *file, size_t filesize,
37: uint32 mid);
38: private:
39: uint32 LoadGzFile(const char *filepath, const uint8 *file, size_t filesize,
40: uint32 mid);
41: uint32 Load_aout(const char *name, const uint8 *file, size_t filesize,
42: uint32 mid);
43: uint32 Load_elf32(const char *name, const uint8 *file, size_t filesize,
44: uint32 mid);
1.1.1.4 ! root 45:
! 46: uint32 read_wait {};
! 47: uint32 write_wait {};
1.1 root 48: };
49:
1.1.1.2 root 50: extern std::unique_ptr<uint8[]> ram;
1.1 root 51: extern int ram_size;
1.1.1.2 root 52: extern std::unique_ptr<RAMDevice> gRAM;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.