Annotation of nono/vm/vm.h, revision 1.1.1.10

1.1       root        1: //
                      2: // nono
1.1.1.3   root        3: // Copyright (C) 2020 nono project
                      4: // Licensed under nono-license.txt
1.1       root        5: //
                      6: 
1.1.1.9   root        7: //
                      8: // VM (基本クラス)
                      9: //
                     10: 
1.1       root       11: #pragma once
                     12: 
                     13: #include "device.h"
1.1.1.2   root       14: 
1.1.1.9   root       15: // ヘッダの依存関係を減らすための細工。
                     16: // o pNAME はメンバ変数としてヘッダで宣言してあるが、vm*.h で各デバイスヘッダ
                     17: //   を include したくないので、派生型ではなく Device* の unique_ptr にしたい。
                     18: // o gNAME は各デバイスヘッダが持つ派生型のグローバルポインタ。
                     19: //   ベース型ではなく派生型で参照したい。また使いたい人が使いたいヘッダだけを
                     20: //   include すれば済むよう、vm*.h とは切り離したい。
                     21: #define NEWDV(NAME, NEW_CTOR)  do {    \
                     22:        __CONCAT(p,NAME).reset(NEW_CTOR);       \
                     23:        __CONCAT(g,NAME) = \
                     24:                (decltype(__CONCAT(g,NAME)))(__CONCAT(p,NAME).get());   \
                     25: } while (0)
                     26: 
1.1       root       27: class VM
                     28: {
                     29:  public:
1.1.1.2   root       30:        VM();
1.1       root       31:        virtual ~VM();
                     32: 
1.1.1.3   root       33:        // 明示的な後始末
                     34:        void Dispose();
                     35: 
1.1       root       36:        // 動的なコンストラクション
                     37:        bool Create();
                     38: 
                     39:        // 初期化
1.1.1.6   root       40:        virtual bool Init();
1.1       root       41: 
1.1.1.9   root       42:        // スレッド開始
                     43:        bool StartThread();
                     44: 
1.1       root       45:        // 設定の適用
                     46:        bool Apply();
                     47: 
1.1.1.8   root       48:        // ブートページを ROM に切り替える
                     49:        void SwitchBootPageToROM(Device *parent) { SwitchBootPage(parent, true); }
                     50:        // ブートページを RAM に切り替える
                     51:        void SwitchBootPageToRAM(Device *parent) { SwitchBootPage(parent, false); }
1.1       root       52: 
1.1.1.7   root       53:        // MPU の RESET 命令によるリセット (機種ごとに異なるため)
1.1.1.9   root       54:        virtual void ResetByMPU();
1.1.1.8   root       55: 
                     56:  protected:
                     57:        // ブートページを切り替える (内部用)
                     58:        virtual void SwitchBootPage(Device *parent, bool isrom);
1.1.1.9   root       59: 
                     60:        std::unique_ptr<Device> pBusErr {};
                     61:        std::unique_ptr<Device> pDebugger {};
                     62:        std::unique_ptr<Device> pInterrupt {};
                     63:        std::unique_ptr<Device> pKeyboard {};
                     64:        std::unique_ptr<Device> pMPU {};
                     65:        std::unique_ptr<Device> pNMI {};
                     66:        std::unique_ptr<Device> pPower {};
                     67:        std::unique_ptr<Device> pRenderer {};
                     68:        std::unique_ptr<Device> pRAM {};
                     69:        std::unique_ptr<Device> pScheduler {};
                     70:        std::unique_ptr<Device> pSignalThread {};
                     71:        std::unique_ptr<Device> pSync {};
1.1       root       72: };
                     73: 
1.1.1.9   root       74: extern VM *gVM;

unix.superglobalmegacorp.com

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