|
|
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.1.5 ! root 10: #include "dmac.h"
! 11: #include "fdc.h"
1.1 root 12: #include "human68k.h"
1.1.1.4 root 13: #include "interrupt.h"
1.1.1.5 ! root 14: #include "mfp.h"
1.1.1.2 root 15: #include "mpu680x0.h"
1.1.1.5 ! root 16: #include "pedec.h"
! 17: #include "pluto.h"
! 18: #include "pio.h"
1.1 root 19: #include "renderer.h"
20: #include "rp5c15.h"
21: #include "scheduler.h"
1.1.1.5 ! root 22: #include "spc.h"
1.1 root 23: #include "x68kkbd.h"
24: #include "xiospace.h"
25:
26: //
27: // X68030 VM
28: //
29:
30: // コンストラクタ
31: VM_X68030::VM_X68030()
32: {
1.1.1.2 root 33: // 機種固有パラメータ
34: // MPU クロックの初期値は機種ごとに異なる。単位は MHz
35: gConfig->SetDefault("mpu-clock", 25);
36: // RAM 初期値は MAX にしておく
37: gConfig->SetDefault("ram-size", 12);
38: // SPC の入力クロック (5MHz = 200ns)
39: gConfig->Add("!spc-tCLF", 200);
40:
1.1.1.3 root 41: // この機種に不要なパラメータはここで削除する
42: // (機種が決まるより前に全機種の設定の和集合を用意してあるため)
43: gConfig->Delete("luna-dipsw1");
44: gConfig->Delete("luna-dipsw2");
45: gConfig->Delete("prom-image");
46:
1.1 root 47: // デバイス (順序に注意)
1.1.1.2 root 48: // BusErrDevice は親コンストラクタで作成済み。
49:
1.1.1.4 root 50: gMPU.reset(new MPU680x0Device(0xff0000)); // required by Scheduler
1.1.1.2 root 51: gScheduler.reset(new Scheduler()); // required by *
1.1.1.4 root 52: gInterrupt.reset(new X68030Interrupt());
1.1.1.2 root 53: gRAM.reset(new RAMDevice()); // required by XIOSpace
1.1.1.5 ! root 54: gXIOSpace.reset(new XIOSpaceDevice());
1.1 root 55:
56: gKeyboard.reset(new X68030Keyboard());
57: gRenderer.reset(new X68030Renderer());
58:
59: // 割り当て
60: // 今は拡張メモリがないので、今は上位8ビット全領域がミラーになっている。
61: for (int i = 0; i < countof(::devtable); i++) {
1.1.1.5 ! root 62: ::devtable[i] = gXIOSpace.get();
1.1 root 63: }
64: }
65:
66: // デストラクタ
67: VM_X68030::~VM_X68030()
68: {
69: }
70:
1.1.1.2 root 71: // X68030 の電源ボタンを押す。
1.1 root 72: void
73: VM_X68030::PowerButton()
74: {
75: // 電源 ボタン
76: // ON OFF->ON 電源オフ割り込みをネゲート?
77: // ON ON ->OFF 電源オフ割り込みをアサート?
78: // OFF OFF->ON 電源オン
79: // OFF ON ->OFF (通常はあり得ないはず)
80:
81: // ボタンの状態を更新して..
82: power_button = !power_button;
83:
84: // デバイスに指示
85: DevicePowerOn();
86: }
87:
1.1.1.5 ! root 88: // リセットについて
! 89: //
! 90: // PWRRESET
! 91: // 電源オン ----------+--> VIPS
! 92: // (7505) +--> VideoCtlr
! 93: // +--> OSCIAN2
! 94: // |
! 95: // | +------+
! 96: // +-->| |
! 97: // 本体 SWRESET | YUKI | IPLRESET
! 98: // リセット ------------->| |-----------> FPU
! 99: // スイッチ +------+
! 100: // |
! 101: // ▽
! 102: // RESET |
! 103: // |<-> MPU (68030)
! 104: // +--> PPI
! 105: // +--> PEDEC
! 106: // +--> SPC
! 107: // +--> ADPCM
! 108: // +--> FDC
! 109: // +--> MFP
! 110: // |
! 111: // | EXRESET
! 112: // +---|>-----------> 外部バス
! 113: // ▽
! 114: // SYSRESET |
! 115: // |<-> SAKI ---+
! 116: // | | BEC0,BEC1
! 117: // +--> DMAC <--+
! 118: // +--> CYNTHIA
! 119: // リセットされない?
! 120: // o CACHY
! 121: // o YM2151 (FM音源)
! 122: // o SCC
! 123:
! 124: // MPU の RESET 命令によるリセット
! 125: void
! 126: VM_X68030::ResetByMPU()
! 127: {
! 128: gDMAC->ResetHard();
! 129: gFDC->ResetHard();
! 130: gMFP->ResetHard();
! 131: gPEDEC->ResetHard();
! 132: gPluto->ResetHard();
! 133: gPPI->ResetHard();
! 134: gSPC->ResetHard();
! 135: }
1.1 root 136:
137: //
138: // RXZ .r .x .z human68k console emulator
139: //
140:
141: // コンストラクタ
142: VM_RXZ::VM_RXZ()
143: {
1.1.1.2 root 144: // 機種固有パラメータ
145: // MPU クロックの初期値は機種ごとに異なる。単位は MHz
146: gConfig->SetDefault("mpu-clock", 25);
147: // RAM 初期値は MAX にしておく
148: gConfig->SetDefault("ram-size", 12);
149: // SPC の入力クロック (5MHz = 200ns)
150: gConfig->Add("!spc-tCLF", 200);
151:
1.1.1.3 root 152: // この機種に不要なパラメータはここで削除する
153: // (機種が決まるより前に全機種の設定の和集合を用意してあるため)
154: gConfig->Delete("luna-dipsw1");
155: gConfig->Delete("luna-dipsw2");
156: gConfig->Delete("prom-image");
157:
1.1 root 158: // デバイス (順序に注意)
1.1.1.2 root 159: // BusErrDevice は親コンストラクタで作成済み。
160:
1.1.1.4 root 161: gMPU.reset(new MPU680x0Device(0)); // required by Scheduler
1.1.1.2 root 162: gScheduler.reset(new Scheduler()); // required by *
1.1.1.4 root 163: gInterrupt.reset(new X68030Interrupt());
1.1.1.2 root 164: gRAM.reset(new RAMDevice()); // required by Human68k
1.1 root 165: gRTC.reset(new RP5C15Device());
166: human68k.reset(new Human68k());
1.1.1.4 root 167:
168: // 割り当て
169: // 全域 RAM に見せる。正しくはない。
170: for (int i = 0; i < countof(::devtable); i++) {
171: ::devtable[i] = gRAM.get();
172: }
1.1 root 173: }
174:
175: // デストラクタ
176: VM_RXZ::~VM_RXZ()
177: {
178: }
179:
180: void
181: VM_RXZ::PowerButton()
182: {
183: // RXZ の電源ボタンは電源オンにしか使わない。
184: //
185: // 電源 ボタン
186: // ON PUSH (何も起きない)
187: // OFF PUSH 電源オン
188:
189: // デバイスに指示
190: DevicePowerOn();
191: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.