Annotation of nono/vm/bankram.h, revision 1.1.1.2

1.1       root        1: //
                      2: // nono
                      3: // Copyright (C) 2023 nono project
                      4: // Licensed under nono-license.txt
                      5: //
                      6: 
                      7: //
                      8: // Nereid バンクメモリ
                      9: //
                     10: 
                     11: #pragma once
                     12: 
                     13: #include "device.h"
1.1.1.2 ! root       14: #include <array>
1.1       root       15: 
                     16: class BankRAMDevice : public IODevice
                     17: {
                     18:        using inherited = IODevice;
                     19:  public:
                     20:        BankRAMDevice(int objid_, int ram_size_MB);
1.1.1.2 ! root       21:        ~BankRAMDevice() 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:        // バンクページ取得・設定
                     36:        uint32 GetPage() const { return page; }
                     37:        void SetPage(uint32 page);
                     38: 
                     39:        // バンクメモリ容量 [MB]を取得 (負数は扱わない)
                     40:        uint GetSize() const { return ram_size / 1024 / 1024; }
                     41: 
1.1.1.2 ! root       42:        // アクセス状況の取得とクリア
        !            43:        void FetchAccStat(uint8 *buf);
        !            44: 
1.1       root       45:  private:
                     46:        // アドレスデコーダ
                     47:        inline uint32 Decoder(uint32 addr) const;
                     48: 
                     49:        std::unique_ptr<uint8[]> ram {};
                     50:        uint ram_size {};
                     51: 
                     52:        // ページ番号 (レジスタ値、マスク前)
                     53:        uint32 page {};
                     54: 
                     55:        // ページ番号をリニアアドレスにした状態で保持。
                     56:        uint32 pageaddr {};
1.1.1.2 ! root       57: 
        !            58:        // アクセス状況
        !            59:        std::array<uint8, 16> accstat_read {};
        !            60:        std::array<uint8, 16> accstat_write {};
1.1       root       61: };
1.1.1.2 ! root       62: 
        !            63: // GetBankRAMDevice() は用意していない。
        !            64: // BankRAMDevice は存在しない場合があるので FindObject() を使うこと。

unix.superglobalmegacorp.com

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