|
|
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.12! root 29: busdata ReadPort(uint32 offset);
! 30: busdata WritePort(uint32 offset, uint32 data);
1.1.1.3 root 31: protected:
1.1.1.12! root 32: busdata PeekPort(uint32 offset);
1.1 root 33:
1.1.1.8 root 34: void Tx(int ch, uint32 data) override;
1.1.1.9 root 35: uint GetHighestInt() const override;
1.1.1.8 root 36:
1.1 root 37: private:
1.1.1.9 root 38: // 指定のレジスタ名を返す
1.1.1.12! root 39: const char *CRName(const MPSCCChan&, uint n) const override;
! 40: const char *SRName(const MPSCCChan&, uint n) const override;
1.1.1.9 root 41: // 現在のレジスタ名を返す
42: const char *CRName(const MPSCCChan& chan) const {
43: return CRName(chan, chan.ptr);
44: }
45: const char *SRName(const MPSCCChan& chan) const {
46: return SRName(chan, chan.ptr);
47: }
48:
49: void ResetChannel(MPSCCChan&);
50:
51: uint8 ReadCtrl(MPSCCChan&);
52: void WriteCtrl(MPSCCChan&, uint32 data);
53: uint8 PeekCtrl(const MPSCCChan&) const;
54:
55: uint8 GetCR1(const MPSCCChan&) const;
56: uint8 GetCR2A() const;
57: uint8 GetCR2B() const;
58: uint8 GetSR0(const MPSCCChan&) const;
59:
60: void WriteCR0(MPSCCChan&, uint32 data);
61: void WriteCR1(MPSCCChan&, uint32 data);
62: void WriteCR2(MPSCCChan&, uint32 data);
63:
64: // VIS モードを更新
65: void SetVIS();
66:
67: DECLARE_MONITOR_CALLBACK(MonitorUpdate);
68: void MonitorUpdateCh(TextScreen&, int ch, int xbase, int ybase);
69:
1.1.1.10 root 70: Keyboard *keyboard {};
71:
1.1.1.9 root 72: static const char * const crnames[16];
73: static const char * const srnames[16];
1.1 root 74: };
75:
1.1.1.10 root 76: static inline SIODevice *GetSIODevice() {
77: return Object::GetObject<SIODevice>(OBJ_MPSCC);
78: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.