diff options
Diffstat (limited to 'assemble.c')
-rw-r--r-- | assemble.c | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -103,10 +103,32 @@ uint64_t get_val(token *t, uint64_t addr, uint8_t size, uint8_t dbg) { case EXPR_NONE : value = tmp_val; break; } isstart = 0; + if (dbg) { + printf("get_val(): Value: $%"PRIX64", Expression type: $%X, Expression Value: $%"PRIX64".\n", value, type, tmp_val); + } } while (t && t->id == TOK_EXPR && isexpr(t->type, dbg)); return value; } +token *skip_expr(token *t, uint8_t dbg) { + /*if (t->next && t->next->id == TOK_EXPR && isexpr(t->next->type, dbg)) { + }*/ + do { + t = (t->id == TOK_EXPR) ? t->next : t; + switch (t->id) { + case TOK_HEX : + case TOK_DEC : + case TOK_BIN : + case TOK_CHAR : + case TOK_SYM : + case TOK_LABEL: t = t->next; break; + } + } while (t && t->id == TOK_EXPR && isexpr(t->type, dbg)); + return t; +} + + + uint8_t get_directivesize(uint8_t type, uint8_t dbg) { switch (type) { case DIR_QWORD: return 3; @@ -163,6 +185,9 @@ uint64_t handle_directive(token *t, bytecount *bc, uint8_t isasm, uint64_t addre bc->datasize += tmp; break; } + if (t->next && t->next->id == TOK_EXPR && isexpr(t->next->type, dbg)) { + t = skip_expr(t, dbg); + } break; case TOK_STRING: if (type == DIR_BYTE) { @@ -196,6 +221,9 @@ uint64_t handle_directive(token *t, bytecount *bc, uint8_t isasm, uint64_t addre } break; } + if (t == NULL) { + break; + } } return tmpaddr; } |