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

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: 
1.1.1.2   root       15: // VRAM の ROP (定数)
                     16: struct ROP {
                     17:        static const uint ZERO  = 0;    // 0
                     18:        static const uint AND1  = 1;    // vram & data
                     19:        static const uint AND2  = 2;    // vram & ~data
                     20:        static const uint cmd   = 3;
                     21:        static const uint AND3  = 4;    // ~vram & data
                     22:        static const uint THRU  = 5;    // data
                     23:        static const uint EOR   = 6;    // vram ^ data
                     24:        static const uint OR1   = 7;    // vram | data
                     25:        static const uint NOR   = 8;    // ~vram | ~data
                     26:        static const uint ENOR  = 9;    // (vram & data) | (~vram & ~data)
                     27:        static const uint INV1  = 10;   // ~data
                     28:        static const uint OR2   = 11;   // vram | ~data
                     29:        static const uint INV2  = 12;   // ~vram
                     30:        static const uint OR3   = 13;   // ~vram | data
                     31:        static const uint NAND  = 14;   // ~vram | ~data
                     32:        static const uint ONE   = 15;   // 1
                     33: };
                     34: 
                     35: class LunafbDevice : public PlaneVRAMDevice
1.1       root       36: {
1.1.1.2   root       37:        using inherited = PlaneVRAMDevice;
1.1       root       38: 
                     39:        static const uint32 plane0base = 0xb10c0000;
                     40:        static const uint32 plane7end  = 0xb12c0000;
                     41:        static const uint32 fcset0base = 0xb1300000;
                     42:        static const uint32 fcset7end  = 0xb1500000;
1.1.1.2   root       43: 
                     44:        // プレーン数の上限
1.1.1.6   root       45:        static const uint MAX_PLANES = 8;
1.1.1.2   root       46: 
1.1       root       47:  public:
                     48:        LunafbDevice();
1.1.1.5   root       49:        ~LunafbDevice() override;
1.1       root       50: 
                     51:        bool Init() override;
1.1.1.2   root       52:        void ResetHard(bool poweron) override;
1.1       root       53: 
1.1.1.6   root       54:        busdata Read(busaddr addr) override;
                     55:        busdata Write(busaddr addr, uint32 data) override;
                     56:        busdata Peek1(uint32 addr) override;
                     57:        bool Poke1(uint32 addr, uint32 data) override;
1.1.1.4   root       58: 
                     59:        void UpdateInfo(TextScreen&, int x, int y) const override;
1.1       root       60: 
                     61:        // エミュレータによる出力
1.1.1.2   root       62:        void EmuInitScreen();
                     63:        void EmuFill(uint x, uint y, uint w, uint h, uint32 data);
                     64:        void EmuPutc(uint x, uint y, uint c);
1.1.1.6   root       65:        void EmuPutc(uint x, uint y, uint c, uint rop);
1.1.1.2   root       66:        void EmuScrollY(uint dy, uint sy, uint h);
1.1.1.5   root       67:        void SetBMSEL(uint8 bmsel_) { bmsel = bmsel_; }
1.1       root       68: 
                     69:  private:
1.1.1.2   root       70:        // offset の VRAM が変更されたことを記録する
                     71:        inline void SetDirty(uint32 offset);
                     72: 
1.1.1.4   root       73:        // X 方向にはみ出したときに対応する仮想画面の Y 座標を返す。
                     74:        int GetWrapY(int y) const override;
                     75: 
1.1.1.6   root       76:        busdata WriteReg(busaddr addr, uint32 data);
1.1       root       77:        void WriteRFCNT(uint32);
                     78:        void WriteCommonBitmap8(uint32, uint32);
                     79:        void WriteCommonBitmap16(uint32, uint32);
                     80:        void WriteCommonBitmap32(uint32, uint32);
1.1.1.2   root       81:        void WriteCommonFCSet(uint rop, uint32 data);
1.1       root       82:        void WritePlane8(uint, uint32, uint32);
                     83:        void WritePlane16(uint, uint32, uint32);
                     84:        void WritePlane32(uint, uint32, uint32);
                     85: 
                     86:        DECLARE_MONITOR_CALLBACK(MonitorUpdate);
                     87: 
1.1.1.2   root       88:        // 演算
                     89:        static uint32 RasterOp(uint rop, uint32 vram, uint32 data);
                     90: 
1.1       root       91:        // ROP 文字列を返す
                     92:        static const char *RopStr(uint rop);
                     93: 
                     94:        // 現在のプレーン数でのプレーンの終了アドレス
                     95:        uint32 plane_end {};
1.1.1.3   root       96:        // 現在のプレーン数での FCSet の(ブロック単位での)最終アドレス
                     97:        uint32 fcset_end {};
1.1       root       98: 
                     99:        // RFCNT
1.1.1.2   root      100:        //
                    101:        //    3                   2                   1                   0
                    102:        //  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
                    103:        // +---------------+---------------+-----------+---+---------------+
                    104:        // |      無効     |  水平カウンタ |    無効   |  ラスタカウンタ   |
                    105:        // +---------------+---------------+-----------+---+---------------+
1.1       root      106:        uint32 rfcnt {};
1.1.1.2   root      107:        // 親クラスにある
                    108:        // int xscroll {};
                    109:        // int yscroll {};
1.1       root      110: 
                    111:        // プレーンセレクタ
1.1.1.2   root      112:        //
                    113:        //    3                   2                   1                   0
                    114:        //  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
                    115:        // +---------------+---------------+---------------+-------+-+-+-+-+
                    116:        // |                           無効                        |3|2|1|0|
                    117:        // +---------------+---------------+---------------+-------+-+-+-+-+
                    118:        //                                                          | | | |
                    119:        //  プレーンN (%1 = 同時設定/書き込み有効、%0=無効) --------+-+-+-+
1.1       root      120: 
1.1.1.2   root      121:        uint32 bmsel {};
1.1       root      122: 
                    123:        // ファンクションセットとアクセスマスク
1.1.1.2   root      124:        uint fcset[MAX_PLANES] {};
                    125:        uint32 fcmask[MAX_PLANES] {};
1.1       root      126: 
1.1.1.5   root      127:        // ウェイト [nsec]
                    128:        busdata wait {};
                    129: 
1.1.1.7 ! root      130:        Monitor *monitor {};
1.1       root      131: };
                    132: 
1.1.1.4   root      133: static inline LunafbDevice *GetLunafbDevice() {
                    134:        return Object::GetObject<LunafbDevice>(OBJ_PLANEVRAM);
                    135: }

unix.superglobalmegacorp.com

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