Changed the way HAVE_DEBUGGER works and renamed it (so it’s on by default) to DISABLE_DEBUGGER. Fixes build break.
This commit is contained in:
parent
9615ca6fa6
commit
dcadfc37f4
@ -5,7 +5,16 @@
|
|||||||
#include "gb_struct_def.h"
|
#include "gb_struct_def.h"
|
||||||
#include "symbol_hash.h"
|
#include "symbol_hash.h"
|
||||||
|
|
||||||
|
|
||||||
#ifdef GB_INTERNAL
|
#ifdef GB_INTERNAL
|
||||||
|
#ifdef DISABLE_DEBUGGER
|
||||||
|
#define GB_debugger_run(gb) (void)0
|
||||||
|
#define GB_debugger_handle_async_commands(gb) (void)0
|
||||||
|
#define GB_debugger_ret_hook(gb) (void)0
|
||||||
|
#define GB_debugger_call_hook(gb, addr) (void)addr
|
||||||
|
#define GB_debugger_test_write_watchpoint(gb, addr, value) ((void)addr, (void)value)
|
||||||
|
#define GB_debugger_test_read_watchpoint(gb, addr) (void)addr
|
||||||
|
#else
|
||||||
void GB_debugger_run(GB_gameboy_t *gb);
|
void GB_debugger_run(GB_gameboy_t *gb);
|
||||||
void GB_debugger_handle_async_commands(GB_gameboy_t *gb);
|
void GB_debugger_handle_async_commands(GB_gameboy_t *gb);
|
||||||
void GB_debugger_call_hook(GB_gameboy_t *gb, uint16_t call_addr);
|
void GB_debugger_call_hook(GB_gameboy_t *gb, uint16_t call_addr);
|
||||||
@ -13,6 +22,7 @@ void GB_debugger_ret_hook(GB_gameboy_t *gb);
|
|||||||
void GB_debugger_test_write_watchpoint(GB_gameboy_t *gb, uint16_t addr, uint8_t value);
|
void GB_debugger_test_write_watchpoint(GB_gameboy_t *gb, uint16_t addr, uint8_t value);
|
||||||
void GB_debugger_test_read_watchpoint(GB_gameboy_t *gb, uint16_t addr);
|
void GB_debugger_test_read_watchpoint(GB_gameboy_t *gb, uint16_t addr);
|
||||||
const GB_bank_symbol_t *GB_debugger_find_symbol(GB_gameboy_t *gb, uint16_t addr);
|
const GB_bank_symbol_t *GB_debugger_find_symbol(GB_gameboy_t *gb, uint16_t addr);
|
||||||
|
#endif /* DISABLE_DEBUGGER */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef GB_INTERNAL
|
#ifdef GB_INTERNAL
|
||||||
|
@ -280,16 +280,12 @@ exit:
|
|||||||
|
|
||||||
void GB_run(GB_gameboy_t *gb)
|
void GB_run(GB_gameboy_t *gb)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_DEBUGGER
|
|
||||||
GB_debugger_run(gb);
|
GB_debugger_run(gb);
|
||||||
#endif
|
|
||||||
GB_cpu_run(gb);
|
GB_cpu_run(gb);
|
||||||
if (gb->vblank_just_occured) {
|
if (gb->vblank_just_occured) {
|
||||||
GB_update_joyp(gb);
|
GB_update_joyp(gb);
|
||||||
GB_rtc_run(gb);
|
GB_rtc_run(gb);
|
||||||
#ifdef HAVE_DEBUGGER
|
|
||||||
GB_debugger_handle_async_commands(gb);
|
GB_debugger_handle_async_commands(gb);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,10 +266,9 @@ static GB_read_function_t * const read_map[] =
|
|||||||
|
|
||||||
uint8_t GB_read_memory(GB_gameboy_t *gb, uint16_t addr)
|
uint8_t GB_read_memory(GB_gameboy_t *gb, uint16_t addr)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_DEBUGGER
|
if (gb->n_watchpoints) {
|
||||||
if (gb->n_watchpoints)
|
|
||||||
GB_debugger_test_read_watchpoint(gb, addr);
|
GB_debugger_test_read_watchpoint(gb, addr);
|
||||||
#endif
|
}
|
||||||
if (is_addr_in_dma_use(gb, addr)) {
|
if (is_addr_in_dma_use(gb, addr)) {
|
||||||
addr = gb->dma_current_src;
|
addr = gb->dma_current_src;
|
||||||
}
|
}
|
||||||
@ -679,10 +678,9 @@ static GB_write_function_t * const write_map[] =
|
|||||||
|
|
||||||
void GB_write_memory(GB_gameboy_t *gb, uint16_t addr, uint8_t value)
|
void GB_write_memory(GB_gameboy_t *gb, uint16_t addr, uint8_t value)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_DEBUGGER
|
if (gb->n_watchpoints) {
|
||||||
if (gb->n_watchpoints)
|
|
||||||
GB_debugger_test_write_watchpoint(gb, addr, value);
|
GB_debugger_test_write_watchpoint(gb, addr, value);
|
||||||
#endif
|
}
|
||||||
if (is_addr_in_dma_use(gb, addr)) {
|
if (is_addr_in_dma_use(gb, addr)) {
|
||||||
/* Todo: What should happen? Will this affect DMA? Will data be written? What and where? */
|
/* Todo: What should happen? Will this affect DMA? Will data be written? What and where? */
|
||||||
return;
|
return;
|
||||||
|
@ -701,9 +701,7 @@ static void ret_cc(GB_gameboy_t *gb, uint8_t opcode)
|
|||||||
{
|
{
|
||||||
/* Todo: Verify timing */
|
/* Todo: Verify timing */
|
||||||
if (condition_code(gb, opcode)) {
|
if (condition_code(gb, opcode)) {
|
||||||
#ifdef HAVE_DEBUGGER
|
|
||||||
GB_debugger_ret_hook(gb);
|
GB_debugger_ret_hook(gb);
|
||||||
#endif
|
|
||||||
GB_advance_cycles(gb, 8);
|
GB_advance_cycles(gb, 8);
|
||||||
gb->pc = GB_read_memory(gb, gb->registers[GB_REGISTER_SP]);
|
gb->pc = GB_read_memory(gb, gb->registers[GB_REGISTER_SP]);
|
||||||
GB_advance_cycles(gb, 4);
|
GB_advance_cycles(gb, 4);
|
||||||
@ -771,9 +769,7 @@ static void call_cc_a16(GB_gameboy_t *gb, uint8_t opcode)
|
|||||||
GB_advance_cycles(gb, 4);
|
GB_advance_cycles(gb, 4);
|
||||||
gb->pc = addr;
|
gb->pc = addr;
|
||||||
|
|
||||||
#ifdef HAVE_DEBUGGER
|
|
||||||
GB_debugger_call_hook(gb, call_addr);
|
GB_debugger_call_hook(gb, call_addr);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
GB_advance_cycles(gb, 12);
|
GB_advance_cycles(gb, 12);
|
||||||
@ -942,16 +938,12 @@ static void rst(GB_gameboy_t *gb, uint8_t opcode)
|
|||||||
GB_write_memory(gb, gb->registers[GB_REGISTER_SP], (gb->pc) & 0xFF);
|
GB_write_memory(gb, gb->registers[GB_REGISTER_SP], (gb->pc) & 0xFF);
|
||||||
GB_advance_cycles(gb, 4);
|
GB_advance_cycles(gb, 4);
|
||||||
gb->pc = opcode ^ 0xC7;
|
gb->pc = opcode ^ 0xC7;
|
||||||
#ifdef HAVE_DEBUGGER
|
|
||||||
GB_debugger_call_hook(gb, call_addr);
|
GB_debugger_call_hook(gb, call_addr);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ret(GB_gameboy_t *gb, uint8_t opcode)
|
static void ret(GB_gameboy_t *gb, uint8_t opcode)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_DEBUGGER
|
|
||||||
GB_debugger_ret_hook(gb);
|
GB_debugger_ret_hook(gb);
|
||||||
#endif
|
|
||||||
GB_advance_cycles(gb, 4);
|
GB_advance_cycles(gb, 4);
|
||||||
gb->pc = GB_read_memory(gb, gb->registers[GB_REGISTER_SP]);
|
gb->pc = GB_read_memory(gb, gb->registers[GB_REGISTER_SP]);
|
||||||
GB_advance_cycles(gb, 4);
|
GB_advance_cycles(gb, 4);
|
||||||
@ -980,9 +972,7 @@ static void call_a16(GB_gameboy_t *gb, uint8_t opcode)
|
|||||||
GB_write_memory(gb, gb->registers[GB_REGISTER_SP], (gb->pc) & 0xFF);
|
GB_write_memory(gb, gb->registers[GB_REGISTER_SP], (gb->pc) & 0xFF);
|
||||||
GB_advance_cycles(gb, 4);
|
GB_advance_cycles(gb, 4);
|
||||||
gb->pc = addr;
|
gb->pc = addr;
|
||||||
#ifdef HAVE_DEBUGGER
|
|
||||||
GB_debugger_call_hook(gb, call_addr);
|
GB_debugger_call_hook(gb, call_addr);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ld_da8_a(GB_gameboy_t *gb, uint8_t opcode)
|
static void ld_da8_a(GB_gameboy_t *gb, uint8_t opcode)
|
||||||
@ -1398,9 +1388,7 @@ void GB_cpu_run(GB_gameboy_t *gb)
|
|||||||
gb->pc = 0;
|
gb->pc = 0;
|
||||||
}
|
}
|
||||||
gb->ime = false;
|
gb->ime = false;
|
||||||
#ifdef HAVE_DEBUGGER
|
|
||||||
GB_debugger_call_hook(gb, call_addr);
|
GB_debugger_call_hook(gb, call_addr);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else if(!gb->halted && !gb->stopped) {
|
else if(!gb->halted && !gb->stopped) {
|
||||||
uint8_t opcode = GB_read_memory(gb, gb->pc++);
|
uint8_t opcode = GB_read_memory(gb, gb->pc++);
|
||||||
|
@ -1,23 +1,24 @@
|
|||||||
INCFLAGS := -I$(CORE_DIR) \
|
INCFLAGS := -I$(CORE_DIR) \
|
||||||
-I$(CORE_DIR)/Core
|
-I$(CORE_DIR)/Core
|
||||||
|
|
||||||
SOURCES_C := $(CORE_DIR)/Core/gb.c \
|
SOURCES_C := $(CORE_DIR)/Core/gb.c \
|
||||||
$(CORE_DIR)/Core/apu.c \
|
$(CORE_DIR)/Core/apu.c \
|
||||||
$(CORE_DIR)/Core/gbmemory.c \
|
$(CORE_DIR)/Core/gbmemory.c \
|
||||||
$(CORE_DIR)/Core/mbc.c \
|
$(CORE_DIR)/Core/mbc.c \
|
||||||
$(CORE_DIR)/Core/timing.c \
|
$(CORE_DIR)/Core/timing.c \
|
||||||
$(CORE_DIR)/Core/display.c \
|
$(CORE_DIR)/Core/display.c \
|
||||||
$(CORE_DIR)/Core/symbol_hash.c \
|
$(CORE_DIR)/Core/symbol_hash.c \
|
||||||
$(CORE_DIR)/Core/camera.c \
|
$(CORE_DIR)/Core/camera.c \
|
||||||
$(CORE_DIR)/Core/z80_cpu.c \
|
$(CORE_DIR)/Core/z80_cpu.c \
|
||||||
$(CORE_DIR)/Core/joypad.c \
|
$(CORE_DIR)/Core/joypad.c \
|
||||||
$(CORE_DIR)/Core/save_state.c \
|
$(CORE_DIR)/Core/save_state.c \
|
||||||
$(CORE_DIR)/libretro/libretro.c
|
$(CORE_DIR)/libretro/libretro.c
|
||||||
|
|
||||||
ifeq ($(HAVE_DEBUGGER), 1)
|
ifeq ($(HAVE_DEBUGGER), 1)
|
||||||
SOURCES_C += $(CORE_DIR)/Core/debugger.c \
|
SOURCES_C += $(CORE_DIR)/Core/debugger.c \
|
||||||
$(CORE_DIR)/Core/z80_disassembler.c
|
$(CORE_DIR)/Core/z80_disassembler.c
|
||||||
|
else
|
||||||
|
CFLAGS += -DDISABLE_DEBUGGER
|
||||||
endif
|
endif
|
||||||
|
|
||||||
SOURCES_CXX :=
|
SOURCES_CXX :=
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ static uint32_t rgb_encode(GB_gameboy_t *gb, uint8_t r, uint8_t g, uint8_t b)
|
|||||||
return r<<16|g<<8|b;
|
return r<<16|g<<8|b;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_DEBUGGER
|
#ifndef DISABLE_DEBUGGER
|
||||||
static void debugger_interrupt(int ignore)
|
static void debugger_interrupt(int ignore)
|
||||||
{
|
{
|
||||||
/* ^C twice to exit */
|
/* ^C twice to exit */
|
||||||
@ -319,7 +319,7 @@ bool retro_load_game(const struct retro_game_info *info)
|
|||||||
|
|
||||||
size_t path_length = strlen(retro_game_path);
|
size_t path_length = strlen(retro_game_path);
|
||||||
|
|
||||||
#ifdef HAVE_DEBUGGER
|
#ifndef DISABLE_DEBUGGER
|
||||||
{
|
{
|
||||||
char TMPC[512];
|
char TMPC[512];
|
||||||
sprintf(TMPC,"%s/registers.sym",retro_system_directory);
|
sprintf(TMPC,"%s/registers.sym",retro_system_directory);
|
||||||
@ -329,7 +329,7 @@ bool retro_load_game(const struct retro_game_info *info)
|
|||||||
|
|
||||||
replace_extension(retro_game_path, path_length, symbols_path, ".sym");
|
replace_extension(retro_game_path, path_length, symbols_path, ".sym");
|
||||||
|
|
||||||
#ifdef HAVE_DEBUGGER
|
#ifndef DISABLE_DEBUGGER
|
||||||
GB_debugger_load_symbol_file(&gb, symbols_path);
|
GB_debugger_load_symbol_file(&gb, symbols_path);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user