|
|
1.1 root 1: //
2: // nono
3: // Copyright (C) 2020 nono project
4: // Licensed under nono-license.txt
5: //
6:
7: //
8: // メインバス
9: //
10:
11: #pragma once
12:
13: #include "device.h"
1.1.1.2 ! root 14: #include "monitor.h"
1.1 root 15: #include <array>
1.1.1.2 ! root 16: #include <utility>
1.1 root 17:
18: class MainbusDevice : public IOContainerDevice
19: {
20: using inherited = IOContainerDevice;
21: public:
22: MainbusDevice();
23: virtual ~MainbusDevice() override;
24:
25: // addr はそれぞれアラインされていること。
26: uint64 Read8(uint32 addr) override;
27: uint64 Read16(uint32 addr) override;
28: uint64 Read32(uint32 addr) override;
29: uint64 Write8(uint32 addr, uint32 data) override;
30: uint64 Write16(uint32 addr, uint32 data) override;
31: uint64 Write32(uint32 addr, uint32 data) override;
32: uint64 Peek8(uint32 addr) override;
33:
34: uint64 Peek32(uint32 addr);
35:
36: // デバイスをセットする
37: static void SetDevice(int idx, IODevice *dev);
38:
39: // デバイステーブルをコピーする
40: static void CopyDevtable(int dst, int src, int len);
41:
1.1.1.2 ! root 42: // モニタ表示用にデバイス名を整形。(X68kIO からも使う)
! 43: static std::pair<std::string, TA> FormatDevName(const Device *dev);
! 44:
1.1 root 45: static std::array<IODevice *, 256> devtable;
46:
47: static int direct_ram_size;
48:
49: protected:
1.1.1.2 ! root 50: // このアドレスを担当する次段の IODevice を返す。
1.1 root 51: IODevice *GetDevice(uint32 addr) const override;
1.1.1.2 ! root 52:
! 53: private:
! 54: DECLARE_MONITOR_CALLBACK(MonitorUpdate);
! 55:
! 56: Monitor monitor { this };
1.1 root 57: };
58:
59: static inline MainbusDevice *GetMainbusDevice() {
60: return Object::GetObject<MainbusDevice>(OBJ_MAINBUS);
61: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.