From 86b0e366bd07c052dd206460cbe4ea54307ef4ff Mon Sep 17 00:00:00 2001 From: Lawrence Kesteloot Date: Fri, 3 Aug 2018 14:27:16 -0700 Subject: [PATCH] Pass base address when disassembling. --- main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index 5385282..cdf5059 100644 --- a/main.c +++ b/main.c @@ -579,7 +579,12 @@ static void complete_compile_and_execute(void) { int i; uint8_t *debug_port = (uint8_t *) 0xBFFE; - debug_port[0] = g_compiled_length; + // Size of program (including initial address). + debug_port[0] = 2 + g_compiled_length; + // Address of program start, little endian. + debug_port[1] = ((uint16_t) &g_compiled[0]) & 0xFF; + debug_port[1] = ((uint16_t) &g_compiled[0]) >> 8; + // Program bytes. for (i = 0; i < g_compiled_length; i++) { debug_port[1] = g_compiled[i]; }