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