💾 Archived View for uscoffings.net › retro-computing › systems › TI994a › assemblers › tiasm › src ›… captured on 2022-06-04 at 01:13:52.
-=-=-=-=-=-=-
#include "TIasm.h" #include <stdio.h> #include "mio.h" /* Globals */ flag Ferror; /* To flag an error in assembly */ int Lincnt = 1; /* To count the lines in the source */ struct stab *Entry; /* Current symbol table entry */ int Debug; /* debug flag */ int Ofd; /* Object file descriptor */ char objtfl[40]; /* Temp file for object */ extern short lcctr; /* The (re)location counter */ main(argc, argv) int argc; char *argv[]; { char *tmp; int x; int fcnt = 0; int fd; char *outfil; struct format header; struct stab *ent; struct symbol symb; struct a_lst *atmp; extern void resrv(); extern yydebug; extern debug; extern struct stab *nxtent(); extern Sdvec[]; argv[argc] = NULL; umask (0111); /* No execute bit set */ /* Parse switches */ for (x = 1; x < argc - 1; ++x) if (*(tmp = argv[x]) != '-') /* Should have been handled by the front end */ aabort ("Non-switch"); else { ++tmp; while (*tmp != NULL) switch (*tmp++) { case 'd': ++x; Debug = atoi(argv[x]); break; case 'o': ++x; outfil = argv[x]; break; default: aabort ("Unrecognized switch\n"); } } if ((Ofd = xcreat(outfil, 0777)) < 0) aabort ("Cannot create output file"); xwrite (Ofd, header, sizeof(header)); resrv(); Ferror = FALSE; yyparse(); /* Put the header together */ header.f_csiz = lcctr; header.f_magic = OMAGIC; xseek (Ofd, 0L, 0); xwrite (Ofd, header, sizeof(header)); xseek (Ofd, 0L, 2); /* Write out the symbol table info */ sstab(); while ((ent = nxtent()) != NULL) { for (x = 0, atmp = ent->en_lst; atmp != NULL; atmp = atmp->a_next) ++x; if (x == 0) continue; /* if (ent->st_type & TYEXTID) x *= -1;