summaryrefslogtreecommitdiff
path: root/bus.cpp
diff options
context:
space:
mode:
authorOxore <oxore@protonmail.com>2022-10-01 19:34:58 +0300
committerOxore <oxore@protonmail.com>2022-10-01 23:09:44 +0300
commit72abe5f3e714df9cc8310a78bdfa648feb79c4d2 (patch)
tree0333ee5e61f02548c7ce9dc7038698d15369acc9 /bus.cpp
parentf125cc7018ed32b7f919ff71ea3c7d9d2e6565de (diff)
Add more VDP tracing, add VRAM, CRAM, VSRAM and status
Diffstat (limited to 'bus.cpp')
-rw-r--r--bus.cpp26
1 files changed, 19 insertions, 7 deletions
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 <algorithm>
#include <cassert>
#include <cstdarg>
#include <cstdbool>
#include <cstdio>
#include <cstdint>
#include <cstdlib>
+#include <vector>
#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<Breakpoint> 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<Breakpoint> 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;
}