Annotation of nono/vm/rom.h, revision 1.1.1.7

1.1       root        1: //
                      2: // nono
1.1.1.2   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.6   root       11: class ROMDevice : public IODevice
1.1       root       12: {
1.1.1.2   root       13:        using inherited = IODevice;
1.1       root       14:  public:
1.1.1.6   root       15:        ROMDevice(const std::string& objname_);
1.1.1.4   root       16:        virtual ~ROMDevice() override;
1.1       root       17: 
1.1.1.2   root       18:        uint64 Read8(uint32 addr) override;
                     19:        uint64 Read16(uint32 addr) override;
                     20:        uint64 Read32(uint32 addr) override;
                     21:        uint64 Write8(uint32 addr, uint32 data) override;
                     22:        uint64 Write16(uint32 addr, uint32 data) override;
                     23:        uint64 Write32(uint32 addr, uint32 data) override;
                     24:        uint64 Peek8(uint32 addr) override;
1.1       root       25: 
1.1.1.3   root       26:        // アクセスウェイトを設定
                     27:        void SetWait(uint32 wait_) { wait = wait_; }
                     28: 
1.1       root       29:  protected:
                     30:        bool LoadROM(const char *name, int size);
                     31: 
1.1.1.7 ! root       32:        // Read*()/Peek8() がアクセスするメモリ領域をさすポインタ。
        !            33:        uint8 *mem {};
        !            34: 
        !            35:        // アクセスマスク。
        !            36:        // LUNA の PROM のように、この ROM の折り返しミラーが見える構造なら
        !            37:        // このアクセスマスクを設定すること。
        !            38:        // X680x0 の各 ROM などはミラーが不要なのでコンストラクタで初期化される
        !            39:        // 0xffffffff のままでよい。
1.1.1.3   root       40:        uint32 mask {};
1.1       root       41: 
1.1.1.7 ! root       42:        // ファイル名
1.1.1.2   root       43:        std::string filename {};
1.1       root       44: 
1.1.1.7 ! root       45:        // イメージ
        !            46:        // (ファイルから読み込んだ内容、あるいは自分で作ったバッファ)
        !            47:        std::unique_ptr<uint8[]> imagebuf {};
        !            48: 
        !            49:        // ライトアクセス時の動作 (Write*() の戻り値)。
        !            50:        // 派生クラスが指定すること。
        !            51:        uint64 write_op {};
1.1.1.3   root       52: 
                     53:        // アクセスウェイト
                     54:        uint32 wait {};
1.1       root       55: };

unix.superglobalmegacorp.com

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