|
|
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"
14: #include <array>
15:
16: class MainbusDevice : public IOContainerDevice
17: {
18: using inherited = IOContainerDevice;
19: public:
20: MainbusDevice();
21: virtual ~MainbusDevice() override;
22:
23: // addr はそれぞれアラインされていること。
24: uint64 Read8(uint32 addr) override;
25: uint64 Read16(uint32 addr) override;
26: uint64 Read32(uint32 addr) override;
27: uint64 Write8(uint32 addr, uint32 data) override;
28: uint64 Write16(uint32 addr, uint32 data) override;
29: uint64 Write32(uint32 addr, uint32 data) override;
30: uint64 Peek8(uint32 addr) override;
31:
32: uint64 Peek32(uint32 addr);
33:
34: // デバイスをセットする
35: static void SetDevice(int idx, IODevice *dev);
36:
37: // デバイステーブルをコピーする
38: static void CopyDevtable(int dst, int src, int len);
39:
40: static std::array<IODevice *, 256> devtable;
41:
42: static int direct_ram_size;
43:
44: protected:
45: IODevice *GetDevice(uint32 addr) const override;
46: };
47:
48: static inline MainbusDevice *GetMainbusDevice() {
49: return Object::GetObject<MainbusDevice>(OBJ_MAINBUS);
50: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.