diff m68k_core.c @ 2676:7e86ec94c899

Implement breakpoints in new 68K core
author Michael Pavone <pavone@retrodev.com>
date Sat, 15 Mar 2025 23:15:05 -0700
parents 9df8dec435b7
children
line wrap: on
line diff
--- a/m68k_core.c	Fri Mar 14 01:18:11 2025 -0700
+++ b/m68k_core.c	Sat Mar 15 23:15:05 2025 -0700
@@ -792,7 +792,7 @@
 	return 0xFFFF;
 }
 
-static m68k_debug_handler find_breakpoint(m68k_context *context, uint32_t address)
+static debug_handler find_breakpoint(m68k_context *context, uint32_t address)
 {
 	for (uint32_t i = 0; i < context->num_breakpoints; i++)
 	{
@@ -803,7 +803,7 @@
 	return NULL;
 }
 
-void insert_breakpoint(m68k_context * context, uint32_t address, m68k_debug_handler bp_handler)
+void insert_breakpoint(m68k_context * context, uint32_t address, debug_handler bp_handler)
 {
 	if (!find_breakpoint(context, address)) {
 		if (context->bp_storage == context->num_breakpoints) {
@@ -811,9 +811,9 @@
 			if (context->bp_storage < 4) {
 				context->bp_storage = 4;
 			}
-			context->breakpoints = realloc(context->breakpoints, context->bp_storage * sizeof(m68k_breakpoint));
+			context->breakpoints = realloc(context->breakpoints, context->bp_storage * sizeof(breakpoint));
 		}
-		context->breakpoints[context->num_breakpoints++] = (m68k_breakpoint){
+		context->breakpoints[context->num_breakpoints++] = (breakpoint){
 			.handler = bp_handler,
 			.address = address
 		};
@@ -823,7 +823,7 @@
 
 m68k_context *m68k_bp_dispatcher(m68k_context *context, uint32_t address)
 {
-	m68k_debug_handler handler = find_breakpoint(context, address);
+	debug_handler handler = find_breakpoint(context, address);
 	if (handler) {
 		handler(context, address);
 	} else {
@@ -1085,7 +1085,7 @@
 	code_ptr start = opts->gen.code.cur;
 	check_cycles_int(&opts->gen, inst->address);
 
-	m68k_debug_handler bp;
+	debug_handler bp;
 	if ((bp = find_breakpoint(context, inst->address))) {
 		m68k_breakpoint_patch(context, inst->address, bp, start);
 	}