Pass base address when disassembling.

This commit is contained in:
Lawrence Kesteloot 2018-08-03 14:27:16 -07:00
parent f73bd75654
commit 86b0e366bd
1 changed files with 6 additions and 1 deletions

7
main.c
View File

@ -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];
}