|
|
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 インタフェース
1.1.1.12! root 33: busdata ReadPort(uint32 offset);
! 34: busdata WritePort(uint32 offset, uint32 data);
! 35: busdata PeekPort(uint32 offset);
1.1.1.4 root 36:
1.1.1.8 root 37: void Tx(int ch, uint32 data) override;
1.1.1.9 root 38: uint GetHighestInt() const override;
1.1.1.8 root 39:
1.1.1.9 root 40: private:
1.1.1.8 root 41: // 指定のレジスタ名を返す
1.1.1.12! root 42: const char *CRName(const MPSCCChan&, uint n) const override;
! 43: const char *SRName(const MPSCCChan&, uint n) const override;
1.1.1.8 root 44:
45: // WR, RR のほうが通りがいいので結局用意する
1.1.1.9 root 46: const char *WRName(const MPSCCChan& chan, int n) const {
1.1.1.8 root 47: return CRName(chan, n);
48: }
1.1.1.9 root 49: const char *WRName(const MPSCCChan& chan) const {
1.1.1.8 root 50: return inherited::CRName(chan);
51: }
1.1.1.9 root 52: const char *RRName(const MPSCCChan& chan, int n) const {
1.1.1.8 root 53: return SRName(chan, n);
54: }
1.1.1.9 root 55: const char *RRName(const MPSCCChan& chan) const {
1.1.1.8 root 56: return inherited::SRName(chan);
57: }
58:
1.1.1.9 root 59: void ResetChannel(MPSCCChan&);
60:
61: uint8 ReadCtrl(MPSCCChan&);
62: void WriteCtrl(MPSCCChan&, uint32 data);
63: uint8 PeekCtrl(const MPSCCChan&) const;
64:
65: uint8 GetWR1(const MPSCCChan&) const;
66: uint8 GetWR9() const;
67: uint8 GetRR0(const MPSCCChan&) const;
68: uint8 GetRR2B() const;
69: uint8 GetRR3A() const;
70:
71: void WriteWR0(MPSCCChan&, uint32 data);
72: void WriteWR1(MPSCCChan&, uint32 data);
73: void WriteWR2(uint32 data);
74: void WriteWR5(MPSCCChan&, uint32 data);
75: void WriteWR9(uint32 data);
76: void WriteWR10(MPSCCChan&, uint32 data);
77: void WriteWR11(MPSCCChan&, uint32 data);
78: void WriteWR12(MPSCCChan&, uint32 data);
79: void WriteWR13(MPSCCChan&, uint32 data);
80: void WriteWR14(MPSCCChan&, uint32 data);
81: void WriteWR15(MPSCCChan&, uint32 data);
82:
83: void SetXC(MPSCCChan&);
84:
85: DECLARE_MONITOR_CALLBACK(MonitorUpdate);
86: void MonitorUpdateCh(TextScreen&, int ch, int xbase, int ybase);
1.1.1.8 root 87:
1.1.1.10 root 88: // PCLK (入力クロック) の時間表現
89: uint64 pclk_ns {};
90:
91: Keyboard *keyboard {};
92:
1.1.1.8 root 93: static const char * const wrnames[32];
94: static const char * const rrnames[32];
1.1 root 95: };
1.1.1.2 root 96:
1.1.1.10 root 97: static inline SCCDevice *GetSCCDevice() {
98: return Object::GetObject<SCCDevice>(OBJ_MPSCC);
99: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.