diff options
author | mrb0nk500 <b0nk@b0nk.xyz> | 2020-08-08 10:28:36 -0400 |
---|---|---|
committer | mrb0nk500 <b0nk@b0nk.xyz> | 2020-08-08 10:28:36 -0400 |
commit | 1ec19679b3db209429b0897f6ccda6d09d018a70 (patch) | |
tree | ef17e28b388a04fadeb14982a5332eb647981d8b /assemble.c | |
parent | 39081609ec4f1f5d96e15e346eecd09ca2cc9f41 (diff) |
Did a ton of stuff.
- Changed the file structure of the SuB Suite, so that
all variable declarations, symbols, and constants
are in a single file.
- Moved the C library functionss into a separate
file, and made them use stack frames.
- Added support for using the emulator's assembler for
realtime debugging, to enter it, get in to stepping
mode by pressing Ctrl+s, press any other key, then
press F1,
The reason for having to press some other key before
pressing F1 is because it only allows entering the
assembler when the keyboard is not ready.
- Added the ".res" directive to the emulator's
assembler, the ".res" directive tells the assembler
to reserve however many bytes specified by the
operand.
- Fixed some bugs in the emulator's assembler.
Diffstat (limited to 'assemble.c')
-rw-r--r-- | assemble.c | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -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++; } |