|
|
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:
1.1.1.8 root 7: //
8: // VM (X68030)
9: //
10:
1.1 root 11: #include "vm_x68k.h"
1.1.1.2 root 12: #include "bus.h"
13: #include "config.h"
1.1.1.5 root 14: #include "dmac.h"
15: #include "fdc.h"
1.1 root 16: #include "human68k.h"
1.1.1.4 root 17: #include "interrupt.h"
1.1.1.7 root 18: #include "mainapp.h"
1.1.1.5 root 19: #include "mfp.h"
1.1.1.2 root 20: #include "mpu680x0.h"
1.1.1.8 root 21: #include "nmi.h"
1.1.1.5 root 22: #include "pedec.h"
23: #include "pluto.h"
24: #include "pio.h"
1.1.1.8 root 25: #include "power.h"
1.1 root 26: #include "renderer.h"
27: #include "rp5c15.h"
1.1.1.6 root 28: #include "romimg_x68k.h"
1.1 root 29: #include "scheduler.h"
1.1.1.5 root 30: #include "spc.h"
1.1 root 31: #include "x68kkbd.h"
32: #include "xiospace.h"
33:
34: // コンストラクタ
35: VM_X68030::VM_X68030()
36: {
1.1.1.2 root 37: // 機種固有パラメータ
38: // MPU クロックの初期値は機種ごとに異なる。単位は MHz
39: gConfig->SetDefault("mpu-clock", 25);
40: // RAM 初期値は MAX にしておく
41: gConfig->SetDefault("ram-size", 12);
42: // SPC の入力クロック (5MHz = 200ns)
43: gConfig->Add("!spc-tCLF", 200);
44:
1.1 root 45: // デバイス (順序に注意)
1.1.1.2 root 46: // BusErrDevice は親コンストラクタで作成済み。
1.1.1.8 root 47: NEWDV(MPU, new MPU680x0Device());
48: NEWDV(Interrupt, new X68030Interrupt());
49: NEWDV(RAM, new RAMDevice()); // required by XIOSpace
50: NEWDV(XIOSpace, new XIOSpaceDevice());
51: NEWDV(IPLROM0, new IPLROM0Device());
52:
53: NEWDV(NMI, new NMIDevice());
54: NEWDV(Keyboard, new X68030Keyboard());
55: NEWDV(Renderer, new X68030Renderer());
1.1 root 56:
1.1.1.7 root 57: if (gMainApp.human_mode) {
1.1.1.8 root 58: NEWDV(Human68k, new Human68k());
1.1.1.7 root 59: }
60:
1.1 root 61: // 割り当て
62: // 今は拡張メモリがないので、今は上位8ビット全領域がミラーになっている。
63: for (int i = 0; i < countof(::devtable); i++) {
1.1.1.8 root 64: ::devtable[i] = gXIOSpace;
1.1 root 65: }
66: }
67:
68: // デストラクタ
69: VM_X68030::~VM_X68030()
70: {
71: }
72:
1.1.1.6 root 73: // ブートページを切り替える。
74: void
75: VM_X68030::SwitchBootPage(Device *parent, bool isrom)
76: {
1.1.1.7 root 77: if (gMainApp.human_mode) {
78: // Human モードではブートページを RAM に見せる。
79: // 今のところ。
80: return;
81: }
82:
1.1.1.6 root 83: // 共通処理
84: inherited::SwitchBootPage(parent, isrom);
85:
86: // X68030 では XIOSpace が担当している
87: gXIOSpace->SwitchBootPage(isrom);
1.1 root 88: }
89:
1.1.1.5 root 90: // リセットについて
91: //
92: // PWRRESET
93: // 電源オン ----------+--> VIPS
94: // (7505) +--> VideoCtlr
95: // +--> OSCIAN2
96: // |
97: // | +------+
98: // +-->| |
1.1.1.9 ! root 99: // 本体 SWRESET | YUKI |
! 100: // リセット ------------->| |
1.1.1.5 root 101: // スイッチ +------+
1.1.1.9 ! root 102: // | IPLRESET
! 103: // |
! 104: // +--> FPU
1.1.1.5 root 105: // |
106: // ▽
107: // RESET |
108: // |<-> MPU (68030)
1.1.1.9 ! root 109: // +--> PPI (8255)
! 110: // +--> SPC (MB89352)
! 111: // +--> ADPCM (MSM6258)
! 112: // +--> FDC (uPD72065B)
! 113: // +--> MFP (MC68901)
! 114: // |
! 115: // | +-------+
! 116: // +-->| PEDEC |
! 117: // | +-------+
! 118: // | |
! 119: // | +-- OPMIC -----> OPM(YM2151)
! 120: // | +-- SCCRD/WR --> SCC(Z8530)
1.1.1.5 root 121: // |
122: // | EXRESET
123: // +---|>-----------> 外部バス
124: // ▽
125: // SYSRESET |
126: // |<-> SAKI ---+
127: // | | BEC0,BEC1
128: // +--> DMAC <--+
129: // +--> CYNTHIA
130: // リセットされない?
131: // o CACHY
132:
133: // MPU の RESET 命令によるリセット
134: void
135: VM_X68030::ResetByMPU()
136: {
1.1.1.8 root 137: gDMAC->ResetHard(false);
138: gFDC->ResetHard(false);
139: gMFP->ResetHard(false);
140: gPEDEC->ResetHard(false);
141: gPluto->ResetHard(false);
142: gPPI->ResetHard(false);
143: gSPC->ResetHard(false);
1.1.1.5 root 144: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.