[FEAT] Decompiler

[BUG] Several address calculation errors
This commit is contained in:
2021-05-05 09:34:58 +02:00
parent 1516043f17
commit 37fdf1f42f
6 changed files with 80 additions and 4 deletions

View File

@@ -9,6 +9,7 @@
#include <stdio.h>
#include <string.h>
#include <stack>
#include "decompiler.h"
#define MAX_CODE_SIZE 65536
#define MAX_LABELS 256
@@ -326,7 +327,7 @@ static void parse_expr_atom() {
const int address = get_variable_address();
if (address == -1) return;
emmit(scope_is_local() ? OP_LDL : OP_LD);
emmit(address);
emmit_dw(address);
tkn_next();
return;
} else {
@@ -890,7 +891,9 @@ void parser_parse(const char* buffer, byte* mem) {
//codepos = 0xA000;
//emmit(OP_JMP);
//emmit_w(0xA000);
}
} else {
decompiler_save(code, codepos);
}
//FILE *f = fopen("test.bin", "wb");
//fwrite(mem, codepos, 1, f);