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

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 "event.h"
1.1.1.3 ! root       15: #include "textscreen.h"
1.1       root       16: #include <array>
                     17: 
                     18: class DipswDevice;
                     19: class NewsInterrupt;
                     20: 
                     21: class NewsCtlrDevice : public IODevice
                     22: {
                     23:        using inherited = IODevice;
                     24: 
                     25:  public:
                     26:        // LED 種別
                     27:        static const uint LED_GREEN             = 0x01;
                     28:        static const uint LED_ORANGE    = 0x02;
                     29: 
                     30:  public:
                     31:        NewsCtlrDevice();
                     32:        ~NewsCtlrDevice() override;
                     33: 
                     34:        bool Init() override;
                     35:        void ResetHard(bool poweron) override;
                     36: 
1.1.1.3 ! root       37:        busdata Read8(uint32 addr) override;
        !            38:        busdata Write8(uint32 addr, uint32 data) override;
        !            39:        busdata Peek8(uint32 addr) override;
1.1       root       40: 
1.1.1.2   root       41:        uint GetLED() const { return led; }
1.1       root       42: 
1.1.1.3 ! root       43:        void MonitorUpdateNewsCtlr(TextScreen& screen, int y);
        !            44: 
1.1       root       45:  private:
                     46:        uint8 GetIDROM(uint32 addr) const;
                     47:        uint8 GetDIPSW() const;
                     48:        void WriteLED(uint32 data);
                     49:        void WriteTimer(uint32 data);
                     50:        void TimerCallback(Event&);
                     51:        void ChangeInterrupt();
                     52: 
                     53:        // 割り込みコントローラ
                     54:        NewsInterrupt *interrupt {};
                     55: 
                     56:        // 256 x 4bit ROM (ここではデータをバイト単位で保持する)
                     57:        std::array<uint8, 128> oidrom {};
                     58: 
1.1.1.2   root       59:        uint led {};
1.1       root       60:        // タイマー
                     61:        bool timer_intr {};
                     62:        bool timer_enable {};
                     63: 
                     64:        DipswDevice *dipsw {};
                     65: 
                     66:        Event timer_event { this };
                     67: };
                     68: 
                     69: static inline NewsCtlrDevice *GetNewsCtlrDevice() {
                     70:        return Object::GetObject<NewsCtlrDevice>(OBJ_NEWSCTLR);
                     71: }

unix.superglobalmegacorp.com

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