|
|
1.1 root 1: //
2: // nono
1.1.1.4 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: // SIO (uPD7201)
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 SIODevice : public MPSCCDevice
1.1 root 18: {
1.1.1.9 root 19: using inherited = MPSCCDevice;
1.1 root 20: public:
21: SIODevice();
1.1.1.11! root 22: ~SIODevice() override;
1.1 root 23:
1.1.1.10 root 24: bool Init() override;
1.1.1.9 root 25: void ResetHard(bool poweron) override;
26:
1.1.1.6 root 27: // BusIO インタフェース
28: // (内蔵 ROM からのアクセス用に特別に public にしてある)
1.1.1.11! root 29: busdata Read(uint32 offset);
! 30: busdata Write(uint32 offset, uint32 data);
1.1 root 31:
1.1.1.3 root 32: protected:
33: // BusIO インタフェース
34: static const uint32 NPORT = 4;
1.1.1.11! root 35: busdata Peek(uint32 offset);
1.1 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 root 40: private:
1.1.1.9 root 41: // 指定のレジスタ名を返す
42: const char *CRName(const MPSCCChan&, int n) const override;
43: const char *SRName(const MPSCCChan&, int n) const override;
44: // 現在のレジスタ名を返す
45: const char *CRName(const MPSCCChan& chan) const {
46: return CRName(chan, chan.ptr);
47: }
48: const char *SRName(const MPSCCChan& chan) const {
49: return SRName(chan, chan.ptr);
50: }
51:
52: void ResetChannel(MPSCCChan&);
53:
54: uint8 ReadCtrl(MPSCCChan&);
55: void WriteCtrl(MPSCCChan&, uint32 data);
56: uint8 PeekCtrl(const MPSCCChan&) const;
57:
58: uint8 GetCR1(const MPSCCChan&) const;
59: uint8 GetCR2A() const;
60: uint8 GetCR2B() const;
61: uint8 GetSR0(const MPSCCChan&) const;
62:
63: void WriteCR0(MPSCCChan&, uint32 data);
64: void WriteCR1(MPSCCChan&, uint32 data);
65: void WriteCR2(MPSCCChan&, uint32 data);
66:
67: // VIS モードを更新
68: void SetVIS();
69:
70: DECLARE_MONITOR_CALLBACK(MonitorUpdate);
71: void MonitorUpdateCh(TextScreen&, int ch, int xbase, int ybase);
72:
1.1.1.10 root 73: Keyboard *keyboard {};
74:
1.1.1.9 root 75: static const char * const crnames[16];
76: static const char * const srnames[16];
1.1 root 77: };
78:
1.1.1.10 root 79: static inline SIODevice *GetSIODevice() {
80: return Object::GetObject<SIODevice>(OBJ_MPSCC);
81: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.