mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2026-01-23 04:16:02 +00:00
Share i8080 and Z80 I/O implementations.
Signed-off-by: Adrian.Conlon <adrian.conlon@gmail.com>
This commit is contained in:
38
src/InputOutput.cpp
Normal file
38
src/InputOutput.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
#include "stdafx.h"
|
||||
#include "InputOutput.h"
|
||||
|
||||
EightBit::InputOutput::InputOutput() {
|
||||
}
|
||||
|
||||
uint8_t EightBit::InputOutput::readInputPort(uint8_t port) {
|
||||
OnReadingPort(port);
|
||||
auto value = input[port];
|
||||
OnReadPort(port);
|
||||
return value;
|
||||
}
|
||||
|
||||
void EightBit::InputOutput::writeOutputPort(uint8_t port, uint8_t value) {
|
||||
OnWritingPort(port);
|
||||
output[port] = value;
|
||||
OnWrittenPort(port);
|
||||
}
|
||||
|
||||
void EightBit::InputOutput::OnReadingPort(uint8_t port) {
|
||||
PortEventArgs event(port);
|
||||
ReadingPort.fire(event);
|
||||
}
|
||||
|
||||
void EightBit::InputOutput::OnReadPort(uint8_t port) {
|
||||
PortEventArgs event(port);
|
||||
ReadPort.fire(event);
|
||||
}
|
||||
|
||||
void EightBit::InputOutput::OnWritingPort(uint8_t port) {
|
||||
PortEventArgs event(port);
|
||||
WritingPort.fire(event);
|
||||
}
|
||||
|
||||
void EightBit::InputOutput::OnWrittenPort(uint8_t port) {
|
||||
PortEventArgs event(port);
|
||||
WrittenPort.fire(event);
|
||||
}
|
||||
Reference in New Issue
Block a user