Simplify I/O port event handling.

Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
Adrian Conlon 2017-10-22 21:31:20 +01:00
parent 156cb66904
commit fa03e8dc55
5 changed files with 8 additions and 35 deletions

View File

@ -4,7 +4,6 @@
#include <array>
#include "Signal.h"
#include "PortEventArgs.h"
namespace EightBit {
class InputOutput {
@ -18,11 +17,11 @@ namespace EightBit {
uint8_t readOutputPort(uint8_t port) { return output[port]; }
void writeOutputPort(uint8_t port, uint8_t value);
Signal<PortEventArgs> ReadingPort;
Signal<PortEventArgs> ReadPort;
Signal<uint8_t> ReadingPort;
Signal<uint8_t> ReadPort;
Signal<PortEventArgs> WritingPort;
Signal<PortEventArgs> WrittenPort;
Signal<uint8_t> WritingPort;
Signal<uint8_t> WrittenPort;
protected:
void OnReadingPort(uint8_t port);

View File

@ -1,18 +0,0 @@
#pragma once
#include <cstdint>
namespace EightBit {
class PortEventArgs {
public:
PortEventArgs(uint8_t port)
: m_port(port) {}
uint8_t getPort() const {
return m_port;
}
private:
uint8_t m_port;
};
}

View File

@ -143,7 +143,6 @@
<ClInclude Include="..\inc\InputOutput.h" />
<ClInclude Include="..\inc\IntelProcessor.h" />
<ClInclude Include="..\inc\Memory.h" />
<ClInclude Include="..\inc\PortEventArgs.h" />
<ClInclude Include="..\inc\Processor.h" />
<ClInclude Include="..\inc\Ram.h" />
<ClInclude Include="..\inc\Register.h" />

View File

@ -35,9 +35,6 @@
<ClInclude Include="..\inc\InputOutput.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\inc\PortEventArgs.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\inc\Bus.h">
<Filter>Header Files</Filter>
</ClInclude>

View File

@ -15,21 +15,17 @@ void EightBit::InputOutput::writeOutputPort(uint8_t port, uint8_t value) {
}
void EightBit::InputOutput::OnReadingPort(uint8_t port) {
PortEventArgs event(port);
ReadingPort.fire(event);
ReadingPort.fire(port);
}
void EightBit::InputOutput::OnReadPort(uint8_t port) {
PortEventArgs event(port);
ReadPort.fire(event);
ReadPort.fire(port);
}
void EightBit::InputOutput::OnWritingPort(uint8_t port) {
PortEventArgs event(port);
WritingPort.fire(event);
WritingPort.fire(port);
}
void EightBit::InputOutput::OnWrittenPort(uint8_t port) {
PortEventArgs event(port);
WrittenPort.fire(event);
WrittenPort.fire(port);
}