diff debug.c @ 1965:3a46ff899fa6

More correct implementation of byte printing in builtin debugger. Fix GDB debugger to use helper in backend.c for reading bytes
author Michael Pavone <pavone@retrodev.com>
date Sun, 03 May 2020 23:28:42 -0700
parents 495569c1dc61
children a7b753e260a2 8ee7ecbf3f21
line wrap: on
line diff
--- a/debug.c	Sun May 03 23:24:03 2020 -0700
+++ b/debug.c	Sun May 03 23:28:42 2020 -0700
@@ -95,6 +95,12 @@
 	}
 }
 
+static uint8_t m68k_read_byte(uint32_t address, m68k_context *context)
+{
+	//TODO: share this implementation with GDB debugger
+	return read_byte(address, (void **)context->mem_pointers, &context->options->gen, context);
+}
+
 uint16_t m68k_read_word(uint32_t address, m68k_context *context)
 {
 	return read_word(address, (void **)context->mem_pointers, &context->options->gen, context);
@@ -159,8 +165,7 @@
 		if (after[0] == '.' && after[1] == 'l') {
 			value = m68k_read_long(p_addr, context);
 		} else if (after[0] == '.' && after[1] == 'b') {
-			value = m68k_read_word(p_addr, context);
-			value &= 0xFF;
+			value = m68k_read_byte(p_addr, context);
 		} else {
 			value = m68k_read_word(p_addr, context);
 		}
@@ -170,8 +175,7 @@
 		if (param[4] == '.' && param[5] == 'l') {
 			value = m68k_read_long(p_addr, context);
 		} else if (param[4] == '.' && param[5] == 'b') {
-			value = m68k_read_word(p_addr, context);
-			value &= 0xFF;
+			value = m68k_read_byte(p_addr, context);
 		} else {
 			value = m68k_read_word(p_addr, context);
 		}