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

1.1       root        1: //
                      2: // nono
                      3: // Copyright (C) 2018 [email protected]
                      4: //
                      5: 
                      6: #pragma once
                      7: 
                      8: #include <atomic>
                      9: #include "device.h"
                     10: 
                     11: class BitmapDevice
                     12:        : public IODevice
                     13: {
                     14:        typedef IODevice inherited;
                     15: 
                     16:        static const uint32 plane0base = 0xb10c0000;
                     17:        static const uint32 plane7end  = 0xb12c0000;
                     18:        static const uint32 fcset0base = 0xb1300000;
                     19:        static const uint32 fcset7end  = 0xb1500000;
                     20:  public:
                     21:        BitmapDevice();
                     22:        virtual ~BitmapDevice();
                     23: 
                     24:        virtual void ResetHard();
                     25: 
                     26:        virtual uint64 Read8(uint32 addr);
                     27:        virtual uint64 Read16(uint32 addr);
                     28:        virtual uint64 Read32(uint32 addr);
                     29:        virtual uint64 Write8(uint32 addr, uint32 data);
                     30:        virtual uint64 Write16(uint32 addr, uint32 data);
                     31:        virtual uint64 Write32(uint32 addr, uint32 data);
                     32:        virtual uint64 Peek8(uint32 addr);
                     33:        virtual bool MonitorUpdate();
                     34: 
                     35:        // プレーン数を取得
                     36:        int GetPlaneCount() const { return nplane; }
                     37: 
                     38:        // RFCNT によるオフセットを取得 (レンダラ用)
                     39:        void GetRFCNT(int *h, int *v) const {
                     40:                *h = hscroll;
                     41:                *v = vscroll;
                     42:        }
                     43: 
                     44:        // ビットマップのアドレスを取得
1.1.1.2 ! root       45:        const uint8 *GetBuf() const { return mem.get(); }
1.1       root       46: 
                     47:        // 更新フラグのアドレスを取得
                     48:        std::atomic<uint8> *GetDirty() { return atomic_dirty; }
                     49: 
1.1.1.2 ! root       50:        // エミュレータによる出力
        !            51:        void EmuConsoleOpen(TextScreen *t);
        !            52:        void EmuConsoleUpdate();
        !            53:        void EmuConsoleClose();
        !            54: 
1.1       root       55:  private:
                     56:        void Invalidate();
                     57:        void WriteRFCNT(uint32);
                     58:        void WriteCommonBitmap8(uint32, uint32);
                     59:        void WriteCommonBitmap16(uint32, uint32);
                     60:        void WriteCommonBitmap32(uint32, uint32);
                     61:        void WritePlane8(uint, uint32, uint32);
                     62:        void WritePlane16(uint, uint32, uint32);
                     63:        void WritePlane32(uint, uint32, uint32);
                     64: 
                     65:        // ROP 文字列を返す
                     66:        static const char *RopStr(uint rop);
                     67: 
                     68:        // プレーン数の上限
                     69:        static const int MAX_PLANES = 8;
                     70: 
                     71:        // プレーン数 (設定による)
                     72:        int nplane = 0;
                     73: 
                     74:        // RFCNT
                     75:        // b31..b24 b23..b16     b15..b10 b09..b00
                     76:        // 無効     水平カウンタ 無効     ラスタカウンタ
                     77:        uint32 rfcnt = 0;
                     78:        int hscroll = 0;
                     79:        int vscroll = 0;
                     80: 
                     81:        // プレーンセレクタ
                     82:        // b31...b4 b3 b2 b1 b0
                     83:        // <-無効-> |  |  |  +-- プレーン0 (%1=同時設定/書き込み有効、%0=無効)
                     84:        //          |  |  +----- プレーン1
                     85:        //          |  +-------- プレーン2
                     86:        //          +----------- プレーン3
                     87:        uint32 bmsel = 0;
                     88: 
                     89:        // ビットマッププレーン。
                     90:        // ロングワードでホストバイトオーダー。
                     91:        // 1枚が 256KB。1 or 4枚
1.1.1.2 ! root       92:        std::unique_ptr<uint8[]> mem {};
1.1       root       93: 
                     94:        // 更新フラグ。
                     95:        // 更新があったラインは 1、なければ 0。
                     96:        // 1ラインごとなので 1プレーンにつき 1024 エントリ。
                     97:        // XXX 水平の非描画区間は今の所検出していないので描画側で多少無駄足。
                     98:        std::atomic<uint8> atomic_dirty[1024] {};
                     99: 
                    100:        // ファンクションセットとアクセスマスク
                    101:        u_int fcs[MAX_PLANES] {};
                    102:        uint32 mask[MAX_PLANES] {};
1.1.1.2 ! root      103: 
        !           104:        // エミュレータによるコンソール出力
        !           105:        TextScreen *textscr;
        !           106:        std::unique_ptr<uint16[]> prev;
        !           107:        int screen_w;   // 桁数
        !           108:        int screen_h;   // 行数
        !           109:        int origin_x;   // 原点 X [dot]
        !           110:        int origin_y;   // 原点 Y [dot]
        !           111: 
1.1       root      112: };
                    113: 
1.1.1.2 ! root      114: extern std::unique_ptr<BitmapDevice> gBitmap;

unix.superglobalmegacorp.com

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