|
|
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.11! root 15: // デバイスを作成して代入するマクロ。
! 16: // …だったが今となってはあまり意味がなくなっている。
1.1.1.9 root 17: #define NEWDV(NAME, NEW_CTOR) do { \
18: __CONCAT(p,NAME).reset(NEW_CTOR); \
1.1.1.11! root 19: assert(__CONCAT(p,NAME)); \
1.1.1.9 root 20: } while (0)
21:
1.1 root 22: class VM
23: {
24: public:
1.1.1.2 root 25: VM();
1.1 root 26: virtual ~VM();
27:
1.1.1.3 root 28: // 明示的な後始末
29: void Dispose();
30:
1.1 root 31: // 動的なコンストラクション
32: bool Create();
33:
34: // 初期化
1.1.1.6 root 35: virtual bool Init();
1.1 root 36:
1.1.1.9 root 37: // スレッド開始
38: bool StartThread();
39:
1.1 root 40: // 設定の適用
41: bool Apply();
42:
1.1.1.8 root 43: // ブートページを ROM に切り替える
44: void SwitchBootPageToROM(Device *parent) { SwitchBootPage(parent, true); }
45: // ブートページを RAM に切り替える
46: void SwitchBootPageToRAM(Device *parent) { SwitchBootPage(parent, false); }
1.1 root 47:
1.1.1.7 root 48: // MPU の RESET 命令によるリセット (機種ごとに異なるため)
1.1.1.9 root 49: virtual void ResetByMPU();
1.1.1.8 root 50:
51: protected:
52: // ブートページを切り替える (内部用)
53: virtual void SwitchBootPage(Device *parent, bool isrom);
1.1.1.9 root 54:
1.1.1.11! root 55: std::unique_ptr<IODevice> pBusErr {};
! 56: std::unique_ptr<Device> pDebugger {};
! 57: std::unique_ptr<IODevice> pInterrupt {};
! 58: std::unique_ptr<Device> pKeyboard {};
! 59: std::unique_ptr<IODevice> pMainbus {};
! 60: std::unique_ptr<IODevice> pMainRAM {};
! 61: std::unique_ptr<Device> pMPU {};
! 62: std::unique_ptr<Device> pNMI {};
! 63: std::unique_ptr<Device> pPower {};
! 64: std::unique_ptr<Device> pRenderer {};
! 65: std::unique_ptr<Device> pScheduler {};
! 66: std::unique_ptr<Device> pSignalThread {};
! 67: std::unique_ptr<Device> pSyncer {};
1.1 root 68: };
69:
1.1.1.9 root 70: extern VM *gVM;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.