#pragma once #include #include #include "Signal.h" namespace EightBit { class InputOutput { public: uint8_t read(uint8_t port) { return readInputPort(port); } void write(uint8_t port, uint8_t value) { return writeOutputPort(port, value); } uint8_t readInputPort(uint8_t port); void writeInputPort(uint8_t port, uint8_t value) { input[port] = value; } uint8_t readOutputPort(uint8_t port) { return output[port]; } void writeOutputPort(uint8_t port, uint8_t value); Signal ReadingPort; Signal ReadPort; Signal WritingPort; Signal WrittenPort; protected: void OnReadingPort(uint8_t port); void OnReadPort(uint8_t port); void OnWritingPort(uint8_t port); void OnWrittenPort(uint8_t port); private: std::array input; std::array output; }; }