|
|
1.1 root 1: //
2: // nono
3: // Copyright (C) 2022 nono project
4: // Licensed under nono-license.txt
5: //
6:
7: //
8: // XP プロセッサの物理バス
9: //
10:
11: #pragma once
12:
1.1.1.2 root 13: #include "mainbus.h"
1.1 root 14: #include <array>
15:
1.1.1.5 root 16: class NopIODevice;
1.1.1.3 root 17: class SubRAMDevice;
1.1 root 18: class SubRAM2Device;
19: class XPRAMDevice;
20:
1.1.1.4 root 21: // XP 物理バス
1.1.1.2 root 22: class XPbusDevice : public IODevice
1.1 root 23: {
1.1.1.2 root 24: using inherited = IODevice;
1.1 root 25: public:
26: XPbusDevice();
27: ~XPbusDevice() override;
28:
29: bool Init() override;
30: void ResetHard(bool poweron) override;
31:
1.1.1.3 root 32: busdata Read1(uint32 addr) override;
33: busdata Write1(uint32 addr, uint32 data) override;
34: busdata Peek1(uint32 addr) override;
35: bool Poke1(uint32 addr, uint32 data) override;
1.1 root 36:
37: // RAM Control Register (RMCR) を設定/取得
38: uint32 GetRMCR() const;
39: void SetRMCR(uint32);
40: // 内蔵 RAM の先頭番地を取得 (モニタ用)
41: uint32 GetXPRAMAddr() const { return ram_addr; }
42:
43: private:
44: inline IODevice *SearchDevice(uint32 addr) const;
45:
46: // 3port RAM (非共有部)
47: std::unique_ptr<SubRAM2Device> pSubRAM2 /*{}*/;
48: // XP 内蔵 512 バイト RAM
49: std::unique_ptr<XPRAMDevice> pXPRAM /*{}*/;
50:
51: // XP 内蔵 512 バイト RAM の位置
52: uint32 ram_addr {};
53:
1.1.1.3 root 54: SubRAMDevice *subram {}; // 共有 SRAM
55: NopIODevice *nopio {};
1.1 root 56: };
57:
58: // XP 内蔵 RAM
59: class XPRAMDevice : public IODevice
60: {
61: using inherited = IODevice;
62: public:
63: XPRAMDevice();
64: ~XPRAMDevice() override;
65:
1.1.1.3 root 66: busdata Read1(uint32 addr) override;
67: busdata Write1(uint32 addr, uint32 data) override;
68: busdata Peek1(uint32 addr) override;
69: bool Poke1(uint32 addr, uint32 data) override;
1.1 root 70:
71: private:
72: std::array<uint8, 512> ram {};
73: };
74:
1.1.1.6 ! root 75: inline XPbusDevice *GetXPbusDevice() {
1.1 root 76: return Object::GetObject<XPbusDevice>(OBJ_XPBUS);
77: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.