|
|
1.1 root 1: //
2: // nono
3: // Copyright (C) 2020 nono project
4: // Licensed under nono-license.txt
5: //
6:
7: //
8: // メインメモリ
9: //
10:
11: #pragma once
12:
13: #include "device.h"
14: #include "bootloader.h"
15:
16: class MainRAMDevice : public IODevice
17: {
18: using inherited = IODevice;
19: public:
20: MainRAMDevice();
1.1.1.2 ! root 21: ~MainRAMDevice() override;
1.1 root 22:
23: bool Init() override;
24: void ResetHard(bool poweron) override;
25:
1.1.1.2 ! root 26: busdata Read8(uint32 addr) override;
! 27: busdata Read16(uint32 addr) override;
! 28: busdata Read32(uint32 addr) override;
! 29: busdata Write8(uint32 addr, uint32 data) override;
! 30: busdata Write16(uint32 addr, uint32 data) override;
! 31: busdata Write32(uint32 addr, uint32 data) override;
! 32: busdata Peek8(uint32 addr) override;
! 33: bool Poke8(uint32 addr, uint32 data) override;
1.1 root 34:
35: // RAM 容量(バイト単位)を取得
36: int GetSize() const { return ram_size; }
37: // RAM 容量(MB単位)を取得
38: int GetSizeMB() const { return (uint)ram_size / 1024 / 1024; }
39:
1.1.1.2 ! root 40: // アクセスウェイト [clock] を設定
1.1 root 41: void SetWait(uint32 wait);
42:
1.1.1.2 ! root 43: // info で指定された実行ファイルをロードする
! 44: bool LoadExec(LoadInfo *);
! 45:
! 46: // info で指定されたデータファイルをロードする
! 47: bool LoadData(LoadInfo *);
1.1 root 48:
49: static std::unique_ptr<uint8[]> mainram;
50:
51: private:
52: // RAM 容量(バイト単位)。ram[] の確保したバイト数
53: int ram_size {};
54:
1.1.1.2 ! root 55: // アクセスウェイト
! 56: busdata read_wait {};
! 57: busdata write_wait {};
1.1 root 58: };
59:
60: static inline MainRAMDevice *GetMainRAMDevice() {
61: return Object::GetObject<MainRAMDevice>(OBJ_MAINRAM);
62: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.