Annotation of nono/vm/videoctlr.h, revision 1.1.1.8

1.1       root        1: //
                      2: // nono
                      3: // Copyright (C) 2020 nono project
                      4: // Licensed under nono-license.txt
                      5: //
                      6: 
1.1.1.7   root        7: //
                      8: // ビデオコントローラ
                      9: //
                     10: 
1.1       root       11: #pragma once
                     12: 
                     13: #include "device.h"
1.1.1.7   root       14: #include "color.h"
1.1.1.8 ! root       15: #include <array>
        !            16: 
        !            17: class Renderer;
1.1       root       18: 
1.1.1.6   root       19: class VideoCtlrDevice : public IODevice
1.1       root       20: {
                     21:        using inherited = IODevice;
1.1.1.7   root       22: 
1.1.1.8 ! root       23:        static const uint32 baseaddr = 0xe82000;
1.1       root       24: 
                     25:  public:
                     26:        VideoCtlrDevice();
1.1.1.4   root       27:        virtual ~VideoCtlrDevice() override;
1.1       root       28: 
1.1.1.8 ! root       29:        bool Init() override;
1.1.1.7   root       30:        void ResetHard(bool poweron) override;
1.1.1.3   root       31: 
1.1.1.2   root       32:        // 加工済みテキストパレットの先頭アドレスを取得
                     33:        // レンダラとかからの参照用
1.1.1.8 ! root       34:        const std::vector<ColorXBGR>& GetHostPalette() const { return hostcolor; }
        !            35: 
        !            36:        // 生パレットを uint32 形式にしたものを返す (GUI 用)
        !            37:        const std::vector<uint32> GetIntPalette() const;
1.1       root       38: 
1.1.1.8 ! root       39:        uint64 Read8(uint32 addr) override;
        !            40:        uint64 Read16(uint32 addr) override;
        !            41:        uint64 Write8(uint32 addr, uint32 data) override;
        !            42:        uint64 Write16(uint32 addr, uint32 data) override;
        !            43:        uint64 Peek8(uint32 addr) override;
        !            44:        uint64 Poke8(uint32 addr, uint32 data) override;
1.1       root       45: 
                     46:  private:
1.1.1.8 ! root       47:        inline uint32 Decoder(uint32 addr) const;
        !            48:        inline uint Offset2NR(uint32 offset) const;
        !            49: 
        !            50:        uint32 GetNR(uint reg) const;
        !            51:        void SetNR(uint reg, uint32 data);
1.1.1.2   root       52:        void MakePalette();
1.1       root       53: 
1.1.1.8 ! root       54:        // ワードレジスタ R0, R1, R2 は内部では nr0 .. nr5 というバイトレジスタ
        !            55:        // として扱う。
        !            56:        std::array<uint8, 6> nreg {};
        !            57: 
        !            58:        // メモリを確保する時のサイズ計算のため型を uint8 にしているが、
        !            59:        // 運用はワードでホストバイトオーダー。
        !            60:        std::array<uint8, 1024> palette {};
1.1.1.2   root       61: 
1.1.1.7   root       62:        // ホスト形式のテキストパレット (レンダラ用に加工したもの)
1.1.1.8 ! root       63:        std::vector<ColorXBGR> hostcolor {};
        !            64: 
        !            65:        Renderer *renderer {};
1.1       root       66: };
                     67: 
1.1.1.8 ! root       68: static inline VideoCtlrDevice *GetVideoCtlrDevice() {
        !            69:        return Object::GetObject<VideoCtlrDevice>(OBJ_VIDEOCTLR);
        !            70: }

unix.superglobalmegacorp.com

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