|
|
1.1 root 1: //
2: // nono
3: // Copyright (C) 2020 nono project
4: // Licensed under nono-license.txt
5: //
6:
1.1.1.6 root 7: //
8: // PEDEC
9: //
10:
1.1 root 11: #pragma once
12:
13: #include "device.h"
14: #include "interrupt.h"
15:
1.1.1.7 ! root 16: class FDCDevice;
! 17: class SPCDevice;
! 18:
1.1.1.4 root 19: class PEDECDevice : public InterruptDevice
1.1 root 20: {
21: using inherited = InterruptDevice;
1.1.1.6 root 22:
1.1 root 23: static const int baseaddr = 0xe9c000;
24:
25: public:
1.1.1.5 root 26: // intmap が下位デバイスからの割り込み信号線 (%1 でアサート)。
27: // intmap_enabled がマスク (%1 なら割り込み許可)。
1.1.1.2 root 28: // よって二者を AND とれば上位に割り込みを上げるかどうかが求まる。
1.1.1.5 root 29: // SPC からの割り込みはここでマスク制御しないので intmap_enabled には
1.1.1.2 root 30: // IntmapSPC を常に立てておくこと。
1.1.1.5 root 31: static const uint32 IntmapSPC = 0x0100;
32: static const uint32 IntmapFDC = 0x0080;
33: static const uint32 IntmapFDD = 0x0040;
34: static const uint32 IntmapHDD = 0x0020;
35: static const uint32 IntmapPRT = 0x0010;
1.1.1.2 root 36:
37: public:
1.1 root 38: PEDECDevice();
39: virtual ~PEDECDevice() override;
40:
1.1.1.7 ! root 41: bool Init() override;
1.1.1.6 root 42: void ResetHard(bool poweron) override;
1.1 root 43:
44: // InterruptDevice インタフェース
45: int InterruptAcknowledge(int lv) override;
46:
1.1.1.5 root 47: // 割り込みコントローラからのモニタ表示
48: void MonitorUpdate(TextScreen& screen, uint intr_level, int y);
1.1.1.2 root 49:
1.1 root 50: protected:
51: // BusIO インタフェース
52: static const uint32 NPORT = 8;
1.1.1.3 root 53: uint64 Read(uint32 offset);
54: uint64 Write(uint32 offset, uint32 data);
55: uint64 Peek(uint32 offset);
1.1 root 56:
57: private:
1.1.1.5 root 58: uint32 GetIntmap(Device *source) const override;
59:
1.1 root 60: // 割り込みステータスレジスタの値を取得
61: uint32 GetStat() const;
62:
63: // 割り込み信号線の状態を変える
1.1.1.5 root 64: void ChangeInterrupt() override;
1.1 root 65:
1.1.1.5 root 66: uint32 intmap_enabled {};
1.1 root 67: uint8 vector {};
1.1.1.7 ! root 68:
! 69: FDCDevice *fdc {};
! 70: InterruptDevice *interrupt {};
! 71: SPCDevice *spc {};
1.1 root 72: };
73:
1.1.1.7 ! root 74: static inline PEDECDevice *GetPEDECDevice() {
! 75: return Object::GetObject<PEDECDevice>(OBJ_PEDEC);
! 76: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.