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

1.1       root        1: //
                      2: // nono
                      3: // Copyright (C) 2022 nono project
                      4: // Licensed under nono-license.txt
                      5: //
                      6: 
                      7: //
                      8: // NEWS の各種制御ポート(?)
                      9: //
                     10: 
                     11: #pragma once
                     12: 
                     13: #include "device.h"
                     14: #include <array>
                     15: 
                     16: class DipswDevice;
                     17: class NewsInterrupt;
1.1.1.4   root       18: class TextScreen;
1.1       root       19: 
                     20: class NewsCtlrDevice : public IODevice
                     21: {
                     22:        using inherited = IODevice;
                     23: 
1.1.1.5   root       24:        // システムタイマーの周期
                     25:        static const uint64 TIMER_PERIOD        = 10_msec;
                     26: 
1.1       root       27:  public:
                     28:        // LED 種別
                     29:        static const uint LED_GREEN             = 0x01;
                     30:        static const uint LED_ORANGE    = 0x02;
                     31: 
                     32:  public:
                     33:        NewsCtlrDevice();
                     34:        ~NewsCtlrDevice() override;
                     35: 
                     36:        bool Init() override;
                     37:        void ResetHard(bool poweron) override;
                     38: 
1.1.1.4   root       39:        busdata Read(busaddr addr) override;
                     40:        busdata Write(busaddr addr, uint32 data) override;
                     41:        busdata Peek1(uint32 addr) override;
1.1       root       42: 
1.1.1.2   root       43:        uint GetLED() const { return led; }
1.1       root       44: 
1.1.1.7 ! root       45:        void MonitorScreenNewsCtlr(TextScreen& screen, int y);
1.1.1.3   root       46: 
1.1       root       47:  private:
                     48:        uint8 GetIDROM(uint32 addr) const;
                     49:        uint8 GetDIPSW() const;
                     50:        void WriteLED(uint32 data);
                     51:        void WriteTimer(uint32 data);
1.1.1.6   root       52:        void TimerCallback(Event *);
1.1       root       53:        void ChangeInterrupt();
                     54: 
                     55:        // 割り込みコントローラ
                     56:        NewsInterrupt *interrupt {};
                     57: 
                     58:        // 256 x 4bit ROM (ここではデータをバイト単位で保持する)
                     59:        std::array<uint8, 128> oidrom {};
                     60: 
1.1.1.2   root       61:        uint led {};
1.1       root       62:        // タイマー
                     63:        bool timer_intr {};
                     64:        bool timer_enable {};
                     65: 
1.1.1.5   root       66:        // システムタイマーが刻んている時刻。
                     67:        uint64 stime {};
                     68: 
                     69:        // システムタイマーを実時間に同期する場合 true
                     70:        bool sync_rt {};
                     71: 
1.1       root       72:        DipswDevice *dipsw {};
                     73: 
1.1.1.6   root       74:        Event *timer_event {};
1.1       root       75: };
                     76: 
1.1.1.7 ! root       77: inline NewsCtlrDevice *GetNewsCtlrDevice() {
1.1       root       78:        return Object::GetObject<NewsCtlrDevice>(OBJ_NEWSCTLR);
                     79: }

unix.superglobalmegacorp.com

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