Annotation of nono/vm/crtc.h, revision 1.1.1.11

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: 
1.1.1.7   root        7: //
                      8: // CRTC
                      9: //
                     10: 
1.1       root       11: #pragma once
                     12: 
1.1.1.9   root       13: #include "device.h"
1.1.1.7   root       14: #include "event.h"
                     15: #include "monitor.h"
1.1       root       16: 
1.1.1.9   root       17: class MFPDevice;
                     18: class Renderer;
                     19: class TVRAMDevice;
                     20: 
1.1       root       21: struct CRTC
                     22: {
1.1.1.7   root       23:        //      15  14  13  12  11  10   9   8   7   6   5   4   3   2   1   0
                     24:        //     +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
                     25:        // R00 |               -               |         水平トータル          |
                     26:        //     +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
                     27:        // R01 |               -               |       水平同期終了位置        |
                     28:        //     +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
                     29:        // R02 |               -               |       水平表示開始位置        |
                     30:        //     +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
                     31:        // R03 |               -               |       水平表示終了位置        |
                     32:        //     +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
                     33:        //
                     34:        //     +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
                     35:        // R04 |           -           |              垂直トータル             |
                     36:        //     +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
                     37:        // R05 |           -           |            垂直同期終了位置           |
                     38:        //     +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
                     39:        // R06 |           -           |            垂直表示開始位置           |
                     40:        //     +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
                     41:        // R07 |           -           |            垂直表示終了位置           |
                     42:        //     +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
                     43:        //
                     44:        //      15  14  13  12  11  10   9   8   7   6   5   4   3   2   1   0
                     45:        //     +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
                     46:        // R08 |               -               |     外部同期水平アジャスト    |
                     47:        //     +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
                     48:        // R09 |           -           |              ラスタ番号               |
                     49:        //     +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
                     50:        // R10 |           -           |    テキスト画面スクロール X位置       |
                     51:        //     +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
                     52:        // R11 |           -           |    テキスト画面スクロール Y位置       |
                     53:        //     +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
                     54:        //
                     55:        //      15  14  13  12  11  10   9   8   7   6   5   4   3   2   1   0
                     56:        //     +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
                     57:        // R12 |           -           |     グラフィック画面スクロール X0     |
                     58:        //     +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
                     59:        // R13 |           -           |     グラフィック画面スクロール Y0     |
                     60:        //     +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
                     61:        // R14 |               -           |   グラフィック画面スクロール X1   |
                     62:        //     +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
                     63:        // R15 |               -           |   グラフィック画面スクロール Y1   |
                     64:        //     +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
                     65:        // R16 |               -           |   グラフィック画面スクロール X2   |
                     66:        //     +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
                     67:        // R17 |               -           |   グラフィック画面スクロール Y2   |
                     68:        //     +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
                     69:        // R18 |               -           |   グラフィック画面スクロール X3   |
                     70:        //     +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
                     71:        // R19 |               -           |   グラフィック画面スクロール Y3   |
                     72:        //     +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
                     73:        //
                     74:        //      15  14  13  12  11  10   9   8   7   6   5   4   3   2   1   0
                     75:        //     +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
1.1.1.8   root       76:        // R20 |       -       |MEM|SIZ|  COL  |     -     |HF |  VD   |   HD  |
1.1.1.7   root       77:        //     +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
                     78:        // R21 |           -           |MEN|SA |       AP      |       CP      |
                     79:        //     +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
                     80:        // R22 |          ソースラスタ         |   デスティネーションラスタ    |
                     81:        //     +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
                     82:        // R23 |                          マスクパターン                       |
                     83:        //     +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
1.1.1.11! root       84:        //
        !            85:        //      15  14  13  12  11  10   9   8   7   6   5   4   3   2   1   0
        !            86:        //     +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
        !            87:        // OP  |                       -                       |RC | 0 |FC |VI |
1.1.1.7   root       88:        //     +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
                     89: 
1.1       root       90:        uint16 r[24];
                     91:        uint16 op;
                     92: 
                     93:        static const uint32 R00         = 0x00;         // $E80000
                     94:        static const uint32 R01         = 0x01;         // $E80002
                     95:        static const uint32 R02         = 0x02;         // $E80004
                     96:        static const uint32 R03         = 0x03;         // $E80006
                     97:        static const uint32 R04         = 0x04;         // $E80008
                     98:        static const uint32 R05         = 0x05;         // $E8000A
                     99:        static const uint32 R06         = 0x06;         // $E8000C
                    100:        static const uint32 R07         = 0x07;         // $E8000E
                    101:        static const uint32 R08         = 0x08;         // $E80010
                    102:        static const uint32 R09         = 0x09;         // $E80012
                    103:        static const uint32 R10         = 0x0a;         // $E80014
                    104:        static const uint32 R11         = 0x0b;         // $E80016
                    105:        static const uint32 R12         = 0x0c;         // $E80018
                    106:        static const uint32 R13         = 0x0d;         // $E8001A
                    107:        static const uint32 R14         = 0x0e;         // $E8001C
                    108:        static const uint32 R15         = 0x0f;         // $E8001E
                    109:        static const uint32 R16         = 0x10;         // $E80020
                    110:        static const uint32 R17         = 0x11;         // $E80022
                    111:        static const uint32 R18         = 0x12;         // $E80024
                    112:        static const uint32 R19         = 0x13;         // $E80026
                    113:        static const uint32 R20         = 0x14;         // $E80028
                    114:        static const uint32 R21         = 0x15;         // $E8002A
                    115:        static const uint32 R22         = 0x16;         // $E8002C
                    116:        static const uint32 R23         = 0x17;         // $E8002E
                    117:        static const uint32 REG_END     = 0x18;
1.1.1.5   root      118:        static const uint32 REG_OP      = 0x240;        // $E80480
1.1.1.7   root      119: 
1.1.1.8   root      120:        // R20
                    121:        static const uint16 R20_MEM     = 0x0800;
                    122:        static const uint16 R20_SIZ     = 0x0400;
                    123:        static const uint16 R20_COL     = 0x0300;
                    124:        static const uint16 R20_HF      = 0x0010;
                    125:        static const uint16 R20_VD      = 0x000c;
                    126:        static const uint16 R20_HD      = 0x0003;
                    127: 
1.1.1.7   root      128:        // 動作ポート
                    129:        static const uint32 OP_RC       = 0x08;         // ラスターコピー開始(%1)
                    130:        static const uint32 OP_FC       = 0x02;         // 高速クリア開始(%1)
                    131:        static const uint32 OP_VI       = 0x01;         // 画像取り込み開始(%1)
1.1       root      132: };
                    133: 
1.1.1.6   root      134: class CRTCDevice : public IODevice
1.1       root      135: {
1.1.1.2   root      136:        using inherited = IODevice;
1.1       root      137:  public:
                    138:        CRTCDevice();
1.1.1.10  root      139:        ~CRTCDevice() override;
1.1       root      140: 
1.1.1.9   root      141:        bool Init() override;
1.1.1.7   root      142:        void ResetHard(bool poweron) override;
1.1       root      143: 
1.1.1.11! root      144:        busdata Read(busaddr addr) override;
        !           145:        busdata Write(busaddr addr, uint32 data) override;
        !           146:        busdata Peek1(uint32 offset) override;
1.1       root      147: 
                    148:  private:
1.1.1.11! root      149:        static inline uint32 Decoder(uint32 addr);
        !           150: 
1.1.1.10  root      151:        // ワード読み出し
1.1.1.11! root      152:        busdata Peek2(uint32 addr) const;
1.1.1.7   root      153:        // レジスタへの書き込み
1.1.1.2   root      154:        void SetReg(uint32 offset, uint32 data);
1.1.1.7   root      155:        // 動作ポートへの書き込み
                    156:        void WriteOp(uint32 data);
                    157: 
                    158:        // 水平同期信号イベント
                    159:        void HSyncCallback(Event& ev);
1.1       root      160: 
1.1.1.8   root      161:        // ラスターコピー完了イベント
                    162:        void RasterCallback(Event& ev);
                    163: 
1.1       root      164:        // 垂直表示期間イベント
1.1.1.3   root      165:        void VDispCallback(Event& ev);
1.1       root      166: 
1.1.1.7   root      167:        DECLARE_MONITOR_CALLBACK(MonitorUpdate);
                    168: 
1.1       root      169:        struct CRTC crtc {};
                    170: 
1.1.1.8   root      171:        // ラスターコピー指示
                    172:        bool raster_copy {};
                    173: 
1.1.1.9   root      174:        MFPDevice *mfp {};
                    175:        Renderer *renderer {};
                    176:        TVRAMDevice *tvram {};
                    177: 
1.1.1.7   root      178:        Event hsync_event { this };
1.1.1.6   root      179:        Event vdisp_event { this };
1.1.1.8   root      180:        Event raster_event { this };
1.1.1.7   root      181: 
                    182:        Monitor monitor { this };
1.1       root      183: };

unix.superglobalmegacorp.com

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