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