Annotation of nono/vm/mainram.h, revision 1.1.1.1

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();
                     21:        virtual ~MainRAMDevice() override;
                     22: 
                     23:        bool Init() override;
                     24:        void ResetHard(bool poweron) override;
                     25: 
                     26:        uint64 Read8(uint32 addr) override;
                     27:        uint64 Read16(uint32 addr) override;
                     28:        uint64 Read32(uint32 addr) override;
                     29:        uint64 Write8(uint32 addr, uint32 data) override;
                     30:        uint64 Write16(uint32 addr, uint32 data) override;
                     31:        uint64 Write32(uint32 addr, uint32 data) override;
                     32:        uint64 Peek8(uint32 addr) override;
                     33:        uint64 Poke8(uint32 addr, uint32 data) override;
                     34: 
                     35:        // RAM 容量(バイト単位)を取得
                     36:        int GetSize() const     { return ram_size; }
                     37:        // RAM 容量(MB単位)を取得
                     38:        int GetSizeMB() const { return (uint)ram_size / 1024 / 1024; }
                     39: 
                     40:        // アクセスウェイトを設定
                     41:        void SetWait(uint32 wait);
                     42: 
                     43:        // path で指定されたホストファイルをロードする
                     44:        bool LoadFromFile(LoadInfo *);
                     45:        // data, size で指定されたバッファをロードする
                     46:        bool LoadFromData(LoadInfo *);
                     47: 
                     48:        static std::unique_ptr<uint8[]> mainram;
                     49: 
                     50:  private:
                     51:        // RAM 容量(バイト単位)。ram[] の確保したバイト数
                     52:        int ram_size {};
                     53: 
                     54:        uint32 read_wait {};
                     55:        uint32 write_wait {};
                     56: };
                     57: 
                     58: static inline MainRAMDevice *GetMainRAMDevice() {
                     59:        return Object::GetObject<MainRAMDevice>(OBJ_MAINRAM);
                     60: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.