From 24ee8de914199faf944b2401fd78561f792be38c Mon Sep 17 00:00:00 2001 From: Oxore Date: Sun, 26 May 2024 13:37:43 +0300 Subject: Add Z80RAM and PSG logging --- bus.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'bus.cpp') diff --git a/bus.cpp b/bus.cpp index f7e97ba..6ad4aa8 100644 --- a/bus.cpp +++ b/bus.cpp @@ -148,6 +148,13 @@ static inline ReadResult memory_read( true, }; } else if (is_in_range(address, SOUND_RAM_START, SOUND_RAM_SIZE)) { + if (DEBUG_TRACE_Z80RAM_ACCESS) { + printf( + "Z80RAM r%d%s @0x%08x\n", + bitness * 8, + (bitness <= 1 ? " " : ""), + SOUND_RAM_START + address); + } return ReadResult{ memory_read_concrete(bitness, g_sound_ram, address - SOUND_RAM_START), true, @@ -159,6 +166,13 @@ static inline ReadResult memory_read( }; } else if (is_in_range(address, VDP_START, VDP_SIZE)) { if (address == PSG_START) { + if (DEBUG_TRACE_PSG_ACCESS) { + printf( + "PSG r%d%s @0x%08x\n", + bitness * 8, + (bitness <= 1 ? " " : ""), + PSG_START + address); + } // XXX PSG does not seem necessary to implement return ReadResult{ g_psg[0], true }; } @@ -226,6 +240,15 @@ static inline bool memory_write( memory_write_concrete(bitness, g_ram, address - RAM_START, value); return true; } else if (is_in_range(address, SOUND_RAM_START, SOUND_RAM_SIZE)) { + if (DEBUG_TRACE_Z80RAM_ACCESS) { + printf( + "Z80RAM w%d%s @0x%08x 0x%0*x\n", + bitness * 8, + (bitness <= 1 ? " " : ""), + SOUND_RAM_START + address, + bitness * 2, + value); + } memory_write_concrete(bitness, g_sound_ram, address - SOUND_RAM_START, value); return true; } else if (is_in_range(address, IO1_START, IO1_SIZE)) { @@ -233,6 +256,15 @@ static inline bool memory_write( return true; } else if (is_in_range(address, VDP_START, VDP_SIZE)) { if (address == PSG_START) { + if (DEBUG_TRACE_PSG_ACCESS) { + printf( + "PSG w%d%s @0x%08x 0x%0*x\n", + bitness * 8, + (bitness <= 1 ? " " : ""), + PSG_START + address, + bitness * 2, + value); + } // XXX PSG does not seem necessary to implement g_psg[0] = value & 0xff; return true; -- cgit v1.2.3