|
|
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 root 20:
1.1.1.3 ! root 21: uint64 Read8(uint32 addr) override;
! 22: uint64 Read16(uint32 addr) override;
! 23: uint64 Read32(uint32 addr) override;
! 24: uint64 Write8(uint32 addr, uint32 data) override;
! 25: uint64 Write16(uint32 addr, uint32 data) override;
! 26: uint64 Write32(uint32 addr, uint32 data) override;
! 27: uint64 Peek8(uint32 addr) override;
1.1.1.2 root 28:
29: // ホストの filepath をロードする
30: uint32 LoadFile(const char *filepath, uint32 mid);
31: // file, filesize で示されるバッファをロードする
32: uint32 LoadFile(const char *name, const uint8 *file, size_t filesize,
33: uint32 mid);
34: private:
35: uint32 LoadGzFile(const char *filepath, const uint8 *file, size_t filesize,
36: uint32 mid);
37: uint32 Load_aout(const char *name, const uint8 *file, size_t filesize,
38: uint32 mid);
39: uint32 Load_elf32(const char *name, const uint8 *file, size_t filesize,
40: uint32 mid);
1.1 root 41: };
42:
1.1.1.2 root 43: extern std::unique_ptr<uint8[]> ram;
1.1 root 44: extern int ram_size;
1.1.1.2 root 45: 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.