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