summaryrefslogtreecommitdiff
path: root/assemble.c
diff options
context:
space:
mode:
Diffstat (limited to 'assemble.c')
-rw-r--r--assemble.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/assemble.c b/assemble.c
index 49137c3..8100485 100644
--- a/assemble.c
+++ b/assemble.c
@@ -364,7 +364,8 @@ uint64_t parse_tokens(token *t, bytecount *bc, uint8_t isasm, uint64_t address,
switch (t->id) {
case TOK_DIR:
switch (t->type) {
- case DIR_ORG: t = t->next; address = get_val(t, address, 3, dbg); break;
+ case DIR_RES: t = t->next; address += get_val(t, address, 3, dbg); break;
+ case DIR_ORG: t = t->next; address = get_val(t, address, 3, dbg); break;
case DIR_BYTE:
case DIR_WORD:
case DIR_DWORD:
@@ -422,7 +423,6 @@ void assemble(line *ln, bytecount *bc, uint8_t dbg) {
for (; l; l = l->next) {
address = parse_tokens(l->tok, bc, 1, address, dbg);
}
-
}
static inline void free_tokens(token *t) {
@@ -474,19 +474,24 @@ void cleanup() {
uint16_t i;
if (lines) {
free_lines();
+ lines = NULL;
}
if (symbols) {
free_symbols(symbols);
+ symbols = NULL;
}
if (fixups) {
free_fixups();
+ fixups = NULL;
}
while (i < stridx || i < comidx) {
- if (i < stridx) {
+ if (i < stridx && string[i]) {
free(string[i]);
+ string[i] = NULL;
}
- if (i < comidx) {
+ if (i < comidx && comment[i]) {
free(comment[i]);
+ comment[i] = NULL;
}
i++;
}