--- nono/vm/upd7201.h 2026/04/29 17:04:28 1.1.1.1 +++ nono/vm/upd7201.h 2026/04/29 17:04:39 1.1.1.4 @@ -1,6 +1,7 @@ // // nono -// Copyright (C) 2018 isaki@NetBSD.org +// Copyright (C) 2020 nono project +// Licensed under nono-license.txt // #pragma once @@ -213,12 +214,12 @@ struct SIO class uPD7201Device : public IODevice { - typedef IODevice inherited; + using inherited = IODevice; public: uPD7201Device(); - virtual ~uPD7201Device(); + ~uPD7201Device() override; - virtual bool MonitorUpdate(); + void MonitorUpdate(TextScreen&) override; // 受信 bool Rx(int ch, uint32 data); @@ -229,9 +230,11 @@ class uPD7201Device void ResetChannel(struct SIO::channel *chan); virtual uint8 ReadCtrl(struct SIO::channel *chan); - uint8 ReadData(int ch); + uint8 ReadData(struct SIO::channel *chan); virtual void WriteCtrl(struct SIO::channel *chan, uint32 data); void WriteData(struct SIO::channel *chan, uint32 data); + uint8 PeekCtrl(const struct SIO::channel *chan) const; + uint8 PeekData(const struct SIO::channel *chan) const; // 割り込みを上げる (上位デバイスで用意する) virtual void Interrupt() = 0; @@ -241,6 +244,10 @@ class uPD7201Device static const int bits_per_char[4]; private: - void MonitorUpdateCh(int ch, int xbase, int ybase); - void MonitorReg(int, int, uint32 reg, const char * const *names); + uint8 ReadSR0(const struct SIO::channel *chan) const; + uint8 ReadSR1(const struct SIO::channel *chan) const; + + void MonitorUpdateCh(TextScreen&, int ch, int xbase, int ybase); + void MonitorReg(TextScreen&, + int, int, uint32 reg, const char * const *names); };