summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOxore <oxore@protonmail.com>2024-05-26 13:37:43 +0300
committerOxore <oxore@protonmail.com>2024-05-26 23:09:23 +0300
commit24ee8de914199faf944b2401fd78561f792be38c (patch)
tree1b94689031ad7554a204b0aee4761b26685852dd
parent2275447be6316579d5daf8dea0dff55da53578d4 (diff)
Add Z80RAM and PSG logging
-rw-r--r--CMakeLists.txt4
-rw-r--r--bus.cpp32
2 files changed, 35 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6ba5328..6f60f90 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -89,7 +89,9 @@ target_compile_definitions(emulator PRIVATE
DEBUG_TRACE_INSTRUCTIONS=0
DEBUG_TRACE_GDB_REMOTE=0
DEBUG_TRACE_VDP_ACCESS=1
- DEBUG_TRACE_IO_ACCESS=1
+ DEBUG_TRACE_IO_ACCESS=0
+ DEBUG_TRACE_PSG_ACCESS=0
+ DEBUG_TRACE_Z80RAM_ACCESS=0
HAS_GRAPHICS=1
)
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;