diff options
Diffstat (limited to 'bus.cpp')
-rw-r--r-- | bus.cpp | 26 |
1 files changed, 19 insertions, 7 deletions
@@ -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; } |