summaryrefslogtreecommitdiff
path: root/bus.cpp
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 /bus.cpp
parenta8beae02428f4c7762c3621b4a6d23a498b7d394 (diff)
Impl IO class with tracing, add VDP addr regs tracing
Diffstat (limited to 'bus.cpp')
-rw-r--r--bus.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/bus.cpp b/bus.cpp
index 32a5b5c..f9aab5f 100644
--- a/bus.cpp
+++ b/bus.cpp
@@ -5,6 +5,7 @@
#include "musashi-m68k/m68k.h"
#include "utils.hpp"
#include "vdp.hpp"
+#include "io.hpp"
#include <algorithm>
#include <cassert>
@@ -21,6 +22,7 @@
namespace Adr {
static constexpr uint32_t kZ80BusReq = 0x00a11100;
+static constexpr uint32_t kZ80Reset = 0x00a11200;
}
extern void m68k_breakpoint_callback(void);
@@ -28,7 +30,7 @@ extern void m68k_breakpoint_callback(void);
extern unsigned char g_rom[ROM_SIZE];
extern unsigned char g_ram[RAM_SIZE];
extern unsigned char g_sound_ram[SOUND_RAM_SIZE];
-extern unsigned char g_io1[IO1_SIZE];
+extern IO g_io1;
extern unsigned char g_io2[VDP_SIZE];
extern unsigned char g_psg[PSG_SIZE];
extern VDP g_vdp;
@@ -153,7 +155,7 @@ static inline ReadResult memory_read(
};
} else if (is_in_range(address, IO1_START, IO1_SIZE)) {
return ReadResult{
- memory_read_concrete(bitness, g_io1, address - IO1_START),
+ g_io1.Read(address - g_io1.base_address, bitness),
true,
};
} else if (is_in_range(address, VDP_START, VDP_SIZE)) {
@@ -228,14 +230,7 @@ static inline bool memory_write(
memory_write_concrete(bitness, g_sound_ram, address - SOUND_RAM_START, value);
return true;
} else if (is_in_range(address, IO1_START, IO1_SIZE)) {
- memory_write_concrete(bitness, g_io1, address - IO1_START, value);
- if (address == Adr::kZ80BusReq || address == Adr::kZ80BusReq + 1) {
- if (g_io1[Adr::kZ80BusReq - IO1_START] == 1 && g_io1[Adr::kZ80BusReq - IO1_START + 1] == 0) {
- // Acknowledge S80 BUSREQ
- g_io1[Adr::kZ80BusReq - IO1_START + 0] = 0;
- g_io1[Adr::kZ80BusReq - IO1_START + 1] = 0;
- }
- }
+ g_io1.Write(address - g_io1.base_address, bitness, value);
return true;
} else if (is_in_range(address, VDP_START, VDP_SIZE)) {
if (address == PSG_START) {