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

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.3 ! root       14: #include "mainbus.h"
1.1       root       15: 
                     16: class BankRAMDevice : public IODevice
                     17: {
                     18:        using inherited = IODevice;
                     19:  public:
1.1.1.3 ! root       20:        BankRAMDevice(uint 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.3 ! root       26:        busdata Read(busaddr addr) override;
        !            27:        busdata Write(busaddr addr, uint32 data) override;
        !            28:        busdata Peek1(uint32 addr) override;
        !            29:        bool Poke1(uint32 addr, uint32 data) override;
1.1       root       30: 
                     31:        // バンクページ取得・設定
                     32:        uint32 GetPage() const { return page; }
                     33:        void SetPage(uint32 page);
                     34: 
                     35:        // バンクメモリ容量 [MB]を取得 (負数は扱わない)
                     36:        uint GetSize() const { return ram_size / 1024 / 1024; }
                     37: 
1.1.1.2   root       38:        // アクセス状況の取得とクリア
                     39:        void FetchAccStat(uint8 *buf);
                     40: 
1.1       root       41:  private:
                     42:        // アドレスデコーダ
                     43:        inline uint32 Decoder(uint32 addr) const;
                     44: 
                     45:        std::unique_ptr<uint8[]> ram {};
                     46:        uint ram_size {};
                     47: 
                     48:        // ページ番号 (レジスタ値、マスク前)
                     49:        uint32 page {};
                     50: 
                     51:        // ページ番号をリニアアドレスにした状態で保持。
                     52:        uint32 pageaddr {};
1.1.1.2   root       53: 
                     54:        // アクセス状況
1.1.1.3 ! root       55:        alignas(8) uint8 accstat_read[AccStat::BANKLEN] {};
        !            56:        alignas(8) uint8 accstat_write[AccStat::BANKLEN] {};
1.1       root       57: };
1.1.1.2   root       58: 
                     59: // GetBankRAMDevice() は用意していない。
                     60: // BankRAMDevice は存在しない場合があるので FindObject() を使うこと。

unix.superglobalmegacorp.com

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