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

1.1       root        1: //
                      2: // nono
                      3: // Copyright (C) 2020 nono project
                      4: // Licensed under nono-license.txt
                      5: //
                      6: 
1.1.1.2 ! root        7: //
        !             8: // LUNA ビットマッププレーン
        !             9: //
        !            10: 
1.1       root       11: #pragma once
                     12: 
1.1.1.2 ! root       13: #include "planevram.h"
1.1       root       14: #include "monitor.h"
                     15: 
1.1.1.2 ! root       16: // VRAM の ROP (定数)
        !            17: struct ROP {
        !            18:        static const uint ZERO  = 0;    // 0
        !            19:        static const uint AND1  = 1;    // vram & data
        !            20:        static const uint AND2  = 2;    // vram & ~data
        !            21:        static const uint cmd   = 3;
        !            22:        static const uint AND3  = 4;    // ~vram & data
        !            23:        static const uint THRU  = 5;    // data
        !            24:        static const uint EOR   = 6;    // vram ^ data
        !            25:        static const uint OR1   = 7;    // vram | data
        !            26:        static const uint NOR   = 8;    // ~vram | ~data
        !            27:        static const uint ENOR  = 9;    // (vram & data) | (~vram & ~data)
        !            28:        static const uint INV1  = 10;   // ~data
        !            29:        static const uint OR2   = 11;   // vram | ~data
        !            30:        static const uint INV2  = 12;   // ~vram
        !            31:        static const uint OR3   = 13;   // ~vram | data
        !            32:        static const uint NAND  = 14;   // ~vram | ~data
        !            33:        static const uint ONE   = 15;   // 1
        !            34: };
        !            35: 
        !            36: class LunafbDevice : public PlaneVRAMDevice
1.1       root       37: {
1.1.1.2 ! root       38:        using inherited = PlaneVRAMDevice;
1.1       root       39: 
                     40:        static const uint32 plane0base = 0xb10c0000;
                     41:        static const uint32 plane7end  = 0xb12c0000;
                     42:        static const uint32 fcset0base = 0xb1300000;
                     43:        static const uint32 fcset7end  = 0xb1500000;
1.1.1.2 ! root       44: 
        !            45:        // プレーン数の上限
        !            46:        static const int MAX_PLANES = 8;
        !            47: 
1.1       root       48:  public:
                     49:        LunafbDevice();
                     50:        virtual ~LunafbDevice() override;
                     51: 
                     52:        bool Init() override;
1.1.1.2 ! root       53:        void ResetHard(bool poweron) override;
1.1       root       54: 
                     55:        uint64 Read8(uint32 addr) override;
                     56:        uint64 Read16(uint32 addr) override;
                     57:        uint64 Read32(uint32 addr) override;
                     58:        uint64 Write8(uint32 addr, uint32 data) override;
                     59:        uint64 Write16(uint32 addr, uint32 data) override;
                     60:        uint64 Write32(uint32 addr, uint32 data) override;
                     61:        uint64 Peek8(uint32 addr) override;
                     62: 
                     63:        // エミュレータによる出力
1.1.1.2 ! root       64:        void EmuInitScreen();
        !            65:        void EmuFill(uint x, uint y, uint w, uint h, uint32 data);
        !            66:        void EmuPutc(uint x, uint y, uint c);
        !            67:        void EmuPutc(uint x, uint y, uint c, int rop);
        !            68:        void EmuScrollY(uint dy, uint sy, uint h);
1.1       root       69: 
                     70:  private:
1.1.1.2 ! root       71:        // offset の VRAM が変更されたことを記録する
        !            72:        inline void SetDirty(uint32 offset);
        !            73: 
1.1       root       74:        void WriteRFCNT(uint32);
                     75:        void WriteCommonBitmap8(uint32, uint32);
                     76:        void WriteCommonBitmap16(uint32, uint32);
                     77:        void WriteCommonBitmap32(uint32, uint32);
1.1.1.2 ! root       78:        void WriteCommonFCSet(uint rop, uint32 data);
1.1       root       79:        void WritePlane8(uint, uint32, uint32);
                     80:        void WritePlane16(uint, uint32, uint32);
                     81:        void WritePlane32(uint, uint32, uint32);
                     82: 
                     83:        DECLARE_MONITOR_CALLBACK(MonitorUpdate);
                     84: 
1.1.1.2 ! root       85:        // 演算
        !            86:        static uint32 RasterOp(uint rop, uint32 vram, uint32 data);
        !            87: 
1.1       root       88:        // ROP 文字列を返す
                     89:        static const char *RopStr(uint rop);
                     90: 
                     91:        // 現在のプレーン数でのプレーンの終了アドレス
                     92:        uint32 plane_end {};
                     93: 
                     94:        // RFCNT
1.1.1.2 ! root       95:        //
        !            96:        //    3                   2                   1                   0
        !            97:        //  1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
        !            98:        // +---------------+---------------+-----------+---+---------------+
        !            99:        // |      無効     |  水平カウンタ |    無効   |  ラスタカウンタ   |
        !           100:        // +---------------+---------------+-----------+---+---------------+
1.1       root      101:        uint32 rfcnt {};
1.1.1.2 ! root      102:        // 親クラスにある
        !           103:        // int xscroll {};
        !           104:        // int yscroll {};
1.1       root      105: 
                    106:        // プレーンセレクタ
1.1.1.2 ! root      107:        //
        !           108:        //    3                   2                   1                   0
        !           109:        //  1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
        !           110:        // +---------------+---------------+---------------+-------+-+-+-+-+
        !           111:        // |                           無効                        |3|2|1|0|
        !           112:        // +---------------+---------------+---------------+-------+-+-+-+-+
        !           113:        //                                                          | | | |
        !           114:        //  プレーンN (%1 = 同時設定/書き込み有効、%0=無効) --------+-+-+-+
1.1       root      115: 
1.1.1.2 ! root      116:        uint32 bmsel {};
1.1       root      117: 
                    118:        // ファンクションセットとアクセスマスク
1.1.1.2 ! root      119:        uint fcset[MAX_PLANES] {};
        !           120:        uint32 fcmask[MAX_PLANES] {};
1.1       root      121: 
                    122:        Monitor monitor { this };
                    123: };
                    124: 
1.1.1.2 ! root      125: #define gLunafb        (dynamic_cast<LunafbDevice *>(gPlaneVRAM))

unix.superglobalmegacorp.com

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