From 2af3d7874471a96f16fa2ebfd5b88bb34dbcbb6d Mon Sep 17 00:00:00 2001 From: Jeremiah Orians Date: Fri, 16 Jun 2017 14:33:46 -0400 Subject: [PATCH] Prepend address to disassembler output to enable easier debugging --- High_level_prototypes/disasm.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/High_level_prototypes/disasm.c b/High_level_prototypes/disasm.c index 40339c4..d2b6b1c 100644 --- a/High_level_prototypes/disasm.c +++ b/High_level_prototypes/disasm.c @@ -22,6 +22,7 @@ #include FILE* binary_file; +int32_t address; /* Unpacked instruction */ struct Instruction @@ -1344,6 +1345,7 @@ void decode_HALCODE(struct Instruction* c) void eval_instruction(struct Instruction* c) { + fprintf(stdout,"%08X\t", address); switch(c->raw0) { case 0x01: /* Integer 4OP */ @@ -1414,6 +1416,7 @@ int main(int argc, char **argv) binary_file = fopen(argv[1], "r"); struct Instruction* current; current = calloc(1, sizeof(struct Instruction)); + address = 0; int32_t byte; byte = fgetc(binary_file); @@ -1423,6 +1426,7 @@ int main(int argc, char **argv) { read_instruction(current); eval_instruction(current); + address = address + 4; byte = fgetc(binary_file); ungetc(byte, binary_file); }