|
|
1.1 root 1: //
2: // nono
1.1.1.3 root 3: // Copyright (C) 2020 nono project
4: // Licensed under nono-license.txt
1.1 root 5: //
6:
1.1.1.9 root 7: //
8: // SCC (Z8530)
9: //
10:
1.1 root 11: #pragma once
12:
1.1.1.9 root 13: #include "mpscc.h"
1.1 root 14:
1.1.1.10 root 15: class Keyboard;
16:
1.1.1.9 root 17: class SCCDevice : public MPSCCDevice
1.1 root 18: {
1.1.1.9 root 19: using inherited = MPSCCDevice;
20:
1.1 root 21: public:
22: SCCDevice();
1.1.1.11! root 23: ~SCCDevice() override;
1.1 root 24:
1.1.1.10 root 25: bool Init() override;
1.1.1.9 root 26: void ResetHard(bool poweron) override;
1.1 root 27:
1.1.1.4 root 28: // 割り込みアクノリッジ
1.1.1.11! root 29: busdata InterruptAcknowledge();
1.1.1.2 root 30:
1.1.1.3 root 31: protected:
32: // BusIO インタフェース
33: static const uint32 NPORT = 4;
1.1.1.11! root 34: busdata Read(uint32 offset);
! 35: busdata Write(uint32 offset, uint32 data);
! 36: busdata Peek(uint32 offset);
1.1.1.4 root 37:
1.1.1.8 root 38: void Tx(int ch, uint32 data) override;
1.1.1.9 root 39: uint GetHighestInt() const override;
1.1.1.8 root 40:
1.1.1.9 root 41: private:
1.1.1.8 root 42: // 指定のレジスタ名を返す
1.1.1.9 root 43: const char *CRName(const MPSCCChan&, int n) const override;
44: const char *SRName(const MPSCCChan&, int n) const override;
1.1.1.8 root 45:
46: // WR, RR のほうが通りがいいので結局用意する
1.1.1.9 root 47: const char *WRName(const MPSCCChan& chan, int n) const {
1.1.1.8 root 48: return CRName(chan, n);
49: }
1.1.1.9 root 50: const char *WRName(const MPSCCChan& chan) const {
1.1.1.8 root 51: return inherited::CRName(chan);
52: }
1.1.1.9 root 53: const char *RRName(const MPSCCChan& chan, int n) const {
1.1.1.8 root 54: return SRName(chan, n);
55: }
1.1.1.9 root 56: const char *RRName(const MPSCCChan& chan) const {
1.1.1.8 root 57: return inherited::SRName(chan);
58: }
59:
1.1.1.9 root 60: void ResetChannel(MPSCCChan&);
61:
62: uint8 ReadCtrl(MPSCCChan&);
63: void WriteCtrl(MPSCCChan&, uint32 data);
64: uint8 PeekCtrl(const MPSCCChan&) const;
65:
66: uint8 GetWR1(const MPSCCChan&) const;
67: uint8 GetWR9() const;
68: uint8 GetRR0(const MPSCCChan&) const;
69: uint8 GetRR2B() const;
70: uint8 GetRR3A() const;
71:
72: void WriteWR0(MPSCCChan&, uint32 data);
73: void WriteWR1(MPSCCChan&, uint32 data);
74: void WriteWR2(uint32 data);
75: void WriteWR5(MPSCCChan&, uint32 data);
76: void WriteWR9(uint32 data);
77: void WriteWR10(MPSCCChan&, uint32 data);
78: void WriteWR11(MPSCCChan&, uint32 data);
79: void WriteWR12(MPSCCChan&, uint32 data);
80: void WriteWR13(MPSCCChan&, uint32 data);
81: void WriteWR14(MPSCCChan&, uint32 data);
82: void WriteWR15(MPSCCChan&, uint32 data);
83:
84: void SetXC(MPSCCChan&);
85:
86: DECLARE_MONITOR_CALLBACK(MonitorUpdate);
87: void MonitorUpdateCh(TextScreen&, int ch, int xbase, int ybase);
1.1.1.8 root 88:
1.1.1.10 root 89: // PCLK (入力クロック) の時間表現
90: uint64 pclk_ns {};
91:
92: Keyboard *keyboard {};
93:
1.1.1.8 root 94: static const char * const wrnames[32];
95: static const char * const rrnames[32];
1.1 root 96: };
1.1.1.2 root 97:
1.1.1.10 root 98: static inline SCCDevice *GetSCCDevice() {
99: return Object::GetObject<SCCDevice>(OBJ_MPSCC);
100: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.