diff options
Diffstat (limited to 'asmmon.c')
-rw-r--r-- | asmmon.c | 40 |
1 files changed, 5 insertions, 35 deletions
@@ -487,9 +487,6 @@ void assemble(struct line *line, bytecount *bc, uint8_t dbg) { tmp+=2; bc->datasize+=2; break; - case DIR_INCLUDE: - incl[inc_file++] = line[i].incl; - break; } tmpaddr += tmp; tmp = 0; @@ -768,21 +765,13 @@ int asmmon(const char *fn) { } i++; } - if (!isinclude) { - list(tokline, start, end, isstart, islinenum, isaddr, isdebug); - } else { - list(tln, start, end, isstart, islinenum, isaddr, isdebug); - } + list(tokline, start, end, isstart, islinenum, isaddr, isdebug); } else { - if (!isinclude) { - list(tokline, 0, 0, 1, 0, 0, 0); - } else { - list(tln, 0, 0, 1, 0, 0, 0); - } + list(tokline, 0, 0, 1, 0, 0, 0); } break; case 0x08: - if (!isinclude) { + if (!inc_file) { printf("Assembling %s\n", (strcasecmp(fn, "stdin")) ? fn : "typed in program."); assemble(tokline, &bc, dbg); progsize = bc.progsize; @@ -791,26 +780,13 @@ int asmmon(const char *fn) { printf("%"PRIu64"/$%"PRIX64" bytes of program code.\n", progsize, progsize); printf("%"PRIu64"/$%"PRIX64" bytes of data.\n", datasize, datasize); putchar('\n'); - } else { - printf("Assembling %s\n", string[incl[inc_count]]); - assemble(tln, &bc, dbg); - progsize += bc.progsize; - datasize += bc.datasize; - printf("Finished assembling %s\n", string[incl[inc_count]]); - printf("%"PRIu64"/$%"PRIX64" bytes of program code.\n", bc.progsize, bc.progsize); - printf("%"PRIu64"/$%"PRIX64" bytes of data.\n", bc.datasize, bc.datasize); - putchar('\n'); } isinclude = (inc_file != 0); if (inc_file) { size = strlen(path)+strlen(string[incl[inc_count]])+1; char *fn2 = malloc(size+1); sprintf(fn2, "%s/%s", path, string[incl[inc_count]]); - if (!tmp_lineidx) { - tmp_lineidx = lineidx; - } - lineidx = 0; - linenum = 10; + isinclude = (inc_file != 0); inc_file--; inc_count++; if (inc_file && fp2 != NULL) { @@ -822,8 +798,6 @@ int asmmon(const char *fn) { fclose(fp); return 2; } - } else if (!inc_file && tmp_lineidx) { - lineidx = tmp_lineidx; } if (!isinclude) { puts("Finished assembling."); @@ -872,11 +846,7 @@ int asmmon(const char *fn) { case 0xFF: break; default: - if (!isinclude) { - address = lex(lex_line, tokline, address, dbg); - } else { - address = lex(lex_line, tln, address, dbg); - } + address = lex(lex_line, tokline, address, dbg); break; } } |