From fccfe0e0b4848fa38403b515d77b6aba37570e54 Mon Sep 17 00:00:00 2001 From: Oxore Date: Sat, 10 Jun 2023 13:26:58 +0300 Subject: Impl IO class with tracing, add VDP addr regs tracing --- bus.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'bus.cpp') 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 #include @@ -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) { -- cgit v1.2.3