|
|
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:
7: #pragma once
8:
9: #include "device.h"
1.1.1.2 root 10:
11: // VM 種別
12: enum vmtype_t {
13: VMTYPE_NONE = 0,
14: VMTYPE_X68030,
1.1.1.3 root 15: VMTYPE_LUNA1,
1.1.1.2 root 16: VMTYPE_RXZ, // Human68k .r .x .z console emulation
17: VMTYPE_LUNA88K,
18: };
1.1.1.3 root 19: // VM 種別 (ビットマスク表現)
20: enum vmf_t {
21: VMF_NONE = 0,
22: VMF_X68030 = (1 << VMTYPE_X68030),
23: VMF_LUNA1 = (1 << VMTYPE_LUNA1),
24: VMF_RXZ = (1 << VMTYPE_RXZ),
25: VMF_LUNA88K = (1 << VMTYPE_LUNA88K),
26:
27: VMF_X68K = VMF_X68030 | VMF_RXZ,
28: VMF_LUNA = VMF_LUNA1 | VMF_LUNA88K,
29: VMF_M68K = VMF_X68K | VMF_LUNA1,
30: VMF_M88K = VMF_LUNA88K,
31: VMF_ALL = 0xffffffff,
32: };
1.1 root 33:
34: class VM
35: {
36: public:
1.1.1.2 root 37: VM();
1.1 root 38: virtual ~VM();
39:
1.1.1.3 root 40: // 明示的な後始末
41: void Dispose();
42:
1.1 root 43: // 動的なコンストラクション
44: bool Create();
45:
46: // 初期化
1.1.1.5 ! root 47: bool Init();
1.1 root 48:
49: // 設定の適用
50: bool Apply();
51:
52: // 電源ボタンを押す。
53: // XXX この辺はもうちょっと検討したほうがいい
54: virtual void PowerButton() = 0;
55:
56: // 電源ボタンの状態を取得する。
57: // モーメンタリスイッチの場合は常に false。
58: virtual bool IsPowerButton() const { return false; }
59:
60: // VM の全デバイスの電源をオフ
61: bool DevicePowerOff();
62:
63: // VM 電源オフ時のコールバックを設定する。(GUI から呼ばれる)
64: void SetPowerOffCallback(void (*callback)());
65:
66: // 外部リセットボタンを押す。
67: void ResetButton() { ResetHard(); }
68:
69: // ハードウェアリセット
70: void ResetHard();
71:
72: // MPU の RESET 命令によるリセット
73: void ResetSoft();
74:
1.1.1.4 root 75: // BusErr デバイスを取得する
76: BusErrDevice *GetBusErrDevice() const { return buserr.get(); }
77:
1.1 root 78: protected:
79: // VM の全デバイスの電源をオン
80: bool DevicePowerOn();
81:
1.1.1.4 root 82: std::unique_ptr<BusErrDevice> buserr {};
83:
84: void (*poweroff_callback)() {};
1.1 root 85: };
86:
1.1.1.2 root 87: extern std::unique_ptr<VM> gVM;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.