Annotation of nono/vm/ram.h, revision 1.1.1.8

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: 
1.1.1.8 ! root       11: class RAMDevice : public IODevice
1.1       root       12: {
1.1.1.3   root       13:        using inherited = IODevice;
1.1       root       14:  public:
                     15:        RAMDevice();
1.1.1.5   root       16:        virtual ~RAMDevice() override;
1.1       root       17: 
1.1.1.3   root       18:        bool Init() override;
1.1.1.7   root       19:        bool PowerOn() 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.6   root       30:        // RAM 容量(バイト単位)を取得
                     31:        int GetSize() const     { return ram_size; }
                     32:        // RAM 容量(MB単位)を取得
                     33:        int GetSizeMB() const { return (uint)ram_size / 1024 / 1024; }
                     34: 
1.1.1.4   root       35:        // アクセスウェイトを設定
                     36:        void SetWait(uint32 wait);
                     37: 
1.1.1.2   root       38:        // ホストの filepath をロードする
1.1.1.6   root       39:        uint32 LoadFile(const char *filepath);
1.1.1.2   root       40:        // file, filesize で示されるバッファをロードする
1.1.1.6   root       41:        uint32 LoadFile(const char *name, const uint8 *file, size_t filesize);
1.1.1.2   root       42:  private:
1.1.1.6   root       43:        uint32 LoadGzFile(const char *filepath, const uint8 *file, size_t filesize);
                     44:        uint32 Load_aout(const char *name, const uint8 *file, size_t filesize);
                     45:        uint32 Load_elf32(const char *name, const uint8 *file, size_t filesize);
1.1.1.8 ! root       46:        bool Load_elf32_exec(const char *name, const uint8 *file, size_t filesize);
        !            47:        uint32 Load_elf32_rel(const char *name, const uint8 *file, size_t filesize);
1.1.1.6   root       48: 
                     49:        // RAM 容量(バイト単位)。ram[] の確保したバイト数
                     50:        int ram_size {};
1.1.1.4   root       51: 
                     52:        uint32 read_wait {};
                     53:        uint32 write_wait {};
1.1       root       54: };
                     55: 
1.1.1.7   root       56: extern std::unique_ptr<uint8[]> mainram;
1.1.1.2   root       57: extern std::unique_ptr<RAMDevice> gRAM;

unix.superglobalmegacorp.com

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