From 72abe5f3e714df9cc8310a78bdfa648feb79c4d2 Mon Sep 17 00:00:00 2001 From: Oxore Date: Sat, 1 Oct 2022 19:34:58 +0300 Subject: Add more VDP tracing, add VRAM, CRAM, VSRAM and status --- bus.cpp | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'bus.cpp') diff --git a/bus.cpp b/bus.cpp index eb2c83b..32a5b5c 100644 --- a/bus.cpp +++ b/bus.cpp @@ -6,12 +6,14 @@ #include "utils.hpp" #include "vdp.hpp" +#include #include #include #include #include #include #include +#include #if !defined(DEBUG_TRACE_VDP_ACCESS) # define DEBUG_TRACE_VDP_ACCESS 0 @@ -23,13 +25,14 @@ static constexpr uint32_t kZ80BusReq = 0x00a11100; extern void m68k_breakpoint_callback(void); -unsigned char g_rom[ROM_SIZE] = {}; -unsigned char g_ram[RAM_SIZE] = {}; -unsigned char g_sound_ram[SOUND_RAM_SIZE] = {}; -unsigned char g_io1[IO1_SIZE] = {}; -std::vector code_bkpts{}, read_bkpts{}, write_bkpts{}, access_bkpts{}; - -static VDP g_vdp(VDP_START); +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 unsigned char g_io2[VDP_SIZE]; +extern unsigned char g_psg[PSG_SIZE]; +extern VDP g_vdp; +extern std::vector code_bkpts, read_bkpts, write_bkpts, access_bkpts; static void exit_error(const char* fmt, ...) { @@ -154,6 +157,10 @@ static inline ReadResult memory_read( true, }; } else if (is_in_range(address, VDP_START, VDP_SIZE)) { + if (address == PSG_START) { + // XXX PSG does not seem necessary to implement + return ReadResult{ g_psg[0], true }; + } return ReadResult{ g_vdp.Read(address - g_vdp.base_address, bitness), true, @@ -231,6 +238,11 @@ static inline bool memory_write( } return true; } else if (is_in_range(address, VDP_START, VDP_SIZE)) { + if (address == PSG_START) { + // XXX PSG does not seem necessary to implement + g_psg[0] = value & 0xff; + return true; + } g_vdp.Write(address - g_vdp.base_address, bitness, value); return true; } -- cgit v1.2.3