summaryrefslogtreecommitdiff
path: root/io.hpp
diff options
context:
space:
mode:
authorOxore <oxore@protonmail.com>2023-06-10 13:26:58 +0300
committerOxore <oxore@protonmail.com>2023-06-10 14:50:12 +0300
commitfccfe0e0b4848fa38403b515d77b6aba37570e54 (patch)
treef520df03c9d913ff9edfbd1ea626d9f93e92d625 /io.hpp
parenta8beae02428f4c7762c3621b4a6d23a498b7d394 (diff)
Impl IO class with tracing, add VDP addr regs tracing
Diffstat (limited to 'io.hpp')
-rw-r--r--io.hpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/io.hpp b/io.hpp
new file mode 100644
index 0000000..de2478a
--- /dev/null
+++ b/io.hpp
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: Unlicense
+ */
+
+#pragma once
+
+#include "bus.hpp"
+
+class IO {
+public:
+ constexpr IO(const uint32_t base_address_a): base_address(base_address_a) {}
+ uint32_t Read(uint32_t offset, enum bitness);
+ void Write(uint32_t offset, enum bitness, uint32_t value);
+ const uint32_t base_address;
+ constexpr static uint32_t kData1Offset = 0x3;
+ constexpr static uint32_t kData2Offset = 0x5;
+ constexpr static uint32_t kData3Offset = 0x7;
+ constexpr static uint32_t kControl1Offset = 0x9;
+ constexpr static uint32_t kControl2Offset = 0xb;
+ constexpr static uint32_t kControl3Offset = 0xd;
+ constexpr static uint32_t kTx1Offset = 0xf;
+ constexpr static uint32_t kRx1Offset = 0x11;
+ constexpr static uint32_t kStatus1Offset = 0x13;
+ constexpr static uint32_t kTx2Offset = 0x15;
+ constexpr static uint32_t kRx2Offset = 0x17;
+ constexpr static uint32_t kStatus2Offset = 0x19;
+ constexpr static uint32_t kTx3Offset = 0x1b;
+ constexpr static uint32_t kRx3Offset = 0x1d;
+ constexpr static uint32_t kStatus3Offset = 0x1f;
+ constexpr static uint32_t kZ80BusReq = 0x1100;
+ constexpr static uint32_t kZ80Reset = 0x1200;
+private:
+ uint32_t read(uint32_t offset);
+ void write(uint32_t offset, uint8_t value);
+ uint8_t _control1{}, _control2{}, _control3{};
+ uint8_t _data1{}, _data2{}, _data3{};
+ uint8_t _tx1{}, _rx1{}, _status1{};
+ uint8_t _tx2{}, _rx2{}, _status2{};
+ uint8_t _tx3{}, _rx3{}, _status3{};
+ bool _z80_reset{};
+ bool _z80_busreq{};
+};