|
|
1.1 root 1: //
2: // nono
1.1.1.2 root 3: // Copyright (C) 2020 nono project
4: // Licensed under nono-license.txt
1.1 root 5: //
6:
7: #include "vm_x68k.h"
1.1.1.2 root 8: #include "bus.h"
9: #include "config.h"
1.1 root 10: #include "human68k.h"
1.1.1.4 ! root 11: #include "interrupt.h"
1.1.1.2 root 12: #include "mpu680x0.h"
1.1 root 13: #include "renderer.h"
14: #include "rp5c15.h"
15: #include "scheduler.h"
16: #include "x68kkbd.h"
17: #include "xiospace.h"
18:
19: //
20: // X68030 VM
21: //
22:
23: // コンストラクタ
24: VM_X68030::VM_X68030()
25: {
1.1.1.2 root 26: // 機種固有パラメータ
27: // MPU クロックの初期値は機種ごとに異なる。単位は MHz
28: gConfig->SetDefault("mpu-clock", 25);
29: // RAM 初期値は MAX にしておく
30: gConfig->SetDefault("ram-size", 12);
31: // SPC の入力クロック (5MHz = 200ns)
32: gConfig->Add("!spc-tCLF", 200);
33:
1.1.1.3 root 34: // この機種に不要なパラメータはここで削除する
35: // (機種が決まるより前に全機種の設定の和集合を用意してあるため)
36: gConfig->Delete("luna-dipsw1");
37: gConfig->Delete("luna-dipsw2");
38: gConfig->Delete("prom-image");
39:
1.1 root 40: // デバイス (順序に注意)
1.1.1.2 root 41: // BusErrDevice は親コンストラクタで作成済み。
42:
1.1.1.4 ! root 43: gMPU.reset(new MPU680x0Device(0xff0000)); // required by Scheduler
1.1.1.2 root 44: gScheduler.reset(new Scheduler()); // required by *
1.1.1.4 ! root 45: gInterrupt.reset(new X68030Interrupt());
1.1.1.2 root 46: gRAM.reset(new RAMDevice()); // required by XIOSpace
1.1 root 47: xiospace.reset(new XIOSpaceDevice());
48:
49: gKeyboard.reset(new X68030Keyboard());
50: gRenderer.reset(new X68030Renderer());
51:
52: // 割り当て
53: // 今は拡張メモリがないので、今は上位8ビット全領域がミラーになっている。
54: for (int i = 0; i < countof(::devtable); i++) {
55: ::devtable[i] = xiospace.get();
56: }
57: }
58:
59: // デストラクタ
60: VM_X68030::~VM_X68030()
61: {
62: }
63:
1.1.1.2 root 64: // X68030 の電源ボタンを押す。
1.1 root 65: void
66: VM_X68030::PowerButton()
67: {
68: // 電源 ボタン
69: // ON OFF->ON 電源オフ割り込みをネゲート?
70: // ON ON ->OFF 電源オフ割り込みをアサート?
71: // OFF OFF->ON 電源オン
72: // OFF ON ->OFF (通常はあり得ないはず)
73:
74: // ボタンの状態を更新して..
75: power_button = !power_button;
76:
77: // デバイスに指示
78: DevicePowerOn();
79: }
80:
81:
82: //
83: // RXZ .r .x .z human68k console emulator
84: //
85:
86: // コンストラクタ
87: VM_RXZ::VM_RXZ()
88: {
1.1.1.2 root 89: // 機種固有パラメータ
90: // MPU クロックの初期値は機種ごとに異なる。単位は MHz
91: gConfig->SetDefault("mpu-clock", 25);
92: // RAM 初期値は MAX にしておく
93: gConfig->SetDefault("ram-size", 12);
94: // SPC の入力クロック (5MHz = 200ns)
95: gConfig->Add("!spc-tCLF", 200);
96:
1.1.1.3 root 97: // この機種に不要なパラメータはここで削除する
98: // (機種が決まるより前に全機種の設定の和集合を用意してあるため)
99: gConfig->Delete("luna-dipsw1");
100: gConfig->Delete("luna-dipsw2");
101: gConfig->Delete("prom-image");
102:
1.1 root 103: // デバイス (順序に注意)
1.1.1.2 root 104: // BusErrDevice は親コンストラクタで作成済み。
105:
1.1.1.4 ! root 106: gMPU.reset(new MPU680x0Device(0)); // required by Scheduler
1.1.1.2 root 107: gScheduler.reset(new Scheduler()); // required by *
1.1.1.4 ! root 108: gInterrupt.reset(new X68030Interrupt());
1.1.1.2 root 109: gRAM.reset(new RAMDevice()); // required by Human68k
1.1 root 110: gRTC.reset(new RP5C15Device());
111: human68k.reset(new Human68k());
1.1.1.4 ! root 112:
! 113: // 割り当て
! 114: // 全域 RAM に見せる。正しくはない。
! 115: for (int i = 0; i < countof(::devtable); i++) {
! 116: ::devtable[i] = gRAM.get();
! 117: }
1.1 root 118: }
119:
120: // デストラクタ
121: VM_RXZ::~VM_RXZ()
122: {
123: }
124:
125: void
126: VM_RXZ::PowerButton()
127: {
128: // RXZ の電源ボタンは電源オンにしか使わない。
129: //
130: // 電源 ボタン
131: // ON PUSH (何も起きない)
132: // OFF PUSH 電源オン
133:
134: // デバイスに指示
135: DevicePowerOn();
136: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.