From da50ee27a1c6d98a42b4810bf0561a1615713e17 Mon Sep 17 00:00:00 2001 From: GDBWNV <93523315+GDBWNV@users.noreply.github.com> Date: Thu, 6 Jun 2024 16:40:24 +0100 Subject: [PATCH] added label, branch, halt, directive to switch statement --- src/a64instruction_Directive.h | 2 +- src/twopassassembly.c | 30 +++++++++++++++++++++++++----- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/a64instruction_Directive.h b/src/a64instruction_Directive.h index 5c70dd4..da36624 100644 --- a/src/a64instruction_Directive.h +++ b/src/a64instruction_Directive.h @@ -1,5 +1,5 @@ #include "global.h" typedef struct { - dword value; + word value; } a64inst_DirectiveData; diff --git a/src/twopassassembly.c b/src/twopassassembly.c index 7643223..4710968 100644 --- a/src/twopassassembly.c +++ b/src/twopassassembly.c @@ -175,26 +175,46 @@ word ldl(a64inst_instruction cI) { return out; } -void secondPass(a64inst_instruction instrs[], int numInstrs, st* table){ +void secondPass(a64inst_instruction instrs[], int numInstrs, st* table, word arr[]){ //TODO: // iterate over instructions again, this time replacing labels // with values from symbol table // after a line has had all the values replaced, assemble it and append + int index = 0; + int lbl = 0; for (int i=0; i