|
|
1.1 root 1: //
2: // nono
3: // Copyright (C) 2024 nono project
4: // Licensed under nono-license.txt
5: //
6:
7: //
8: // メインバス (virt68k)
9: //
10:
11: // IODevice
12: // +-- MainbusBaseDevice (InitMainbus() と FC アクセスを持つ)
13: // | +-- MainbusDevice (これがメインバス、システムに1つ)
14: // | | +-- Mainbus24Device (上位8ビットがテーブルで表せるメインバス)
15: // | | | +-- LunaMainbus
16: // | | | | +-- Luna1Mainbus
17: // | | | | +-- Luna88kMainbus
18: // | | | +-- NewsMainbus
19: // | | | |
20: // | | | | +----------------+
21: // | | | +--| Virt68kMainbus |
22: // | | | +----------------+
23: // | | |
24: // | | +-- X68kMainbus
25: // | +-- X68kIODevice
26: // +-- XPbusDevice
27:
28: #include "mainbus_virt68k.h"
29: #include "interrupt.h"
30: #include "mainapp.h"
31: #include "mainram.h"
32: #include "v68kio.h"
33:
34: // コンストラクタ
35: Virt68kMainbus::Virt68kMainbus()
36: {
37: NEWDV(BusErr, new BusErrDevice());
38: NEWDV(Interrupt, new Virt68kInterrupt());
39: NEWDV(MainRAM, new MainRAMDevice());
40: NEWDV(V68kIO, new V68kIODevice());
41:
42: // $ff'000000 以降がデバイス領域。
43: // メインメモリは Init() で設定する。
44: for (int i = 0; i < devtable.size() - 1; i++) {
45: devtable[i] = pBusErr.get();
46: }
47: devtable[0xff] = pV68kIO.get();
48:
49: // 2MB ずつ 32bit 全域。
50: acc.resize(2048);
51: monitor_accstat.SetSize(80, 2 + 32);
52: }
53:
54: // デストラクタ
55: Virt68kMainbus::~Virt68kMainbus()
56: {
57: }
58:
59: // メインバスの初期化
60: bool
61: Virt68kMainbus::InitMainbus()
62: {
63: // RAM は容量が確定した後のここで配置。
64: // 16MB 単位になっている。
65: auto mainram = dynamic_cast<MainRAMDevice *>(pMainRAM.get());
66: int ramsize_MB = mainram->GetSizeMB();
67: for (int i = 0; i < ramsize_MB / 16; i++) {
68: devtable[i] = mainram;
69: }
70:
71: // アクセス状況用のマップを作成。
72: InitAccStat();
73:
74: return true;
75: }
76:
77: // ブートページを切り替える。
78: void
79: Virt68kMainbus::SwitchBootPage(bool isram)
80: {
81: // まだサポートしていない。
82: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.