mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2025-01-11 02:29:50 +00:00
Share i8080 and Z80 I/O implementations.
Signed-off-by: Adrian.Conlon <adrian.conlon@gmail.com>
This commit is contained in:
parent
d710a28526
commit
91c8855183
@ -1,34 +0,0 @@
|
||||
#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) {
|
||||
ReadingPort.fire(PortEventArgs(port));
|
||||
}
|
||||
|
||||
void EightBit::InputOutput::OnReadPort(uint8_t port) {
|
||||
ReadPort.fire(PortEventArgs(port));
|
||||
}
|
||||
|
||||
void EightBit::InputOutput::OnWritingPort(uint8_t port) {
|
||||
WritingPort.fire(PortEventArgs(port));
|
||||
}
|
||||
|
||||
void EightBit::InputOutput::OnWrittenPort(uint8_t port) {
|
||||
WrittenPort.fire(PortEventArgs(port));
|
||||
}
|
@ -140,15 +140,12 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\inc\Disassembler.h" />
|
||||
<ClInclude Include="..\inc\InputOutput.h" />
|
||||
<ClInclude Include="..\inc\Intel8080.h" />
|
||||
<ClInclude Include="..\inc\PortEventArgs.h" />
|
||||
<ClInclude Include="..\inc\Profiler.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Disassembler.cpp" />
|
||||
<ClCompile Include="InputOutput.cpp" />
|
||||
<ClCompile Include="Intel8080.cpp" />
|
||||
<ClCompile Include="Profiler.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
|
@ -17,15 +17,9 @@
|
||||
<ClInclude Include="..\inc\Disassembler.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\inc\InputOutput.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\inc\Intel8080.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\inc\PortEventArgs.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\inc\Profiler.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
@ -37,9 +31,6 @@
|
||||
<ClCompile Include="Disassembler.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="InputOutput.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Intel8080.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -1,38 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include "Signal.h"
|
||||
#include "PortEventArgs.h"
|
||||
|
||||
namespace EightBit {
|
||||
class InputOutput {
|
||||
public:
|
||||
InputOutput();
|
||||
|
||||
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<PortEventArgs> ReadingPort;
|
||||
Signal<PortEventArgs> ReadPort;
|
||||
|
||||
Signal<PortEventArgs> WritingPort;
|
||||
Signal<PortEventArgs> 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<uint8_t, 0x100> input;
|
||||
std::array<uint8_t, 0x100> output;
|
||||
};
|
||||
}
|
@ -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;
|
||||
};
|
||||
}
|
@ -139,15 +139,12 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\inc\Disassembler.h" />
|
||||
<ClInclude Include="..\inc\InputOutput.h" />
|
||||
<ClInclude Include="..\inc\PortEventArgs.h" />
|
||||
<ClInclude Include="..\inc\Profiler.h" />
|
||||
<ClInclude Include="..\inc\Z80.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Disassembler.cpp" />
|
||||
<ClCompile Include="InputOutput.cpp" />
|
||||
<ClCompile Include="Profiler.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
|
@ -17,12 +17,6 @@
|
||||
<ClInclude Include="..\inc\Disassembler.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\inc\InputOutput.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\inc\PortEventArgs.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\inc\Profiler.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
@ -37,9 +31,6 @@
|
||||
<ClCompile Include="Disassembler.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="InputOutput.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Profiler.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -140,8 +140,10 @@
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\inc\AddressEventArgs.h" />
|
||||
<ClInclude Include="..\inc\EventArgs.h" />
|
||||
<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\Signal.h" />
|
||||
<ClInclude Include="..\inc\TestHarness.h" />
|
||||
@ -149,6 +151,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="EventArgs.cpp" />
|
||||
<ClCompile Include="InputOutput.cpp" />
|
||||
<ClCompile Include="IntelProcessor.cpp" />
|
||||
<ClCompile Include="Memory.cpp" />
|
||||
<ClCompile Include="Processor.cpp" />
|
||||
|
@ -35,6 +35,12 @@
|
||||
<ClInclude Include="..\inc\AddressEventArgs.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\inc\InputOutput.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\inc\PortEventArgs.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
@ -52,5 +58,8 @@
|
||||
<ClCompile Include="IntelProcessor.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="InputOutput.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
Loading…
x
Reference in New Issue
Block a user