home *** CD-ROM | disk | FTP | other *** search
/ APDL Public Domain 1 / APDL_PD1A.iso / program / assembler / as / src / c / asm < prev    next >
Encoding:
Text File  |  1992-08-28  |  1011 b   |  50 lines

  1.  
  2. /*
  3.  *  asm.c
  4.  * Copyright © 1992 Niklas Röjemo
  5.  */
  6. #include <setjmp.h>
  7. #include <stdlib.h>
  8. #include <stdio.h>
  9. #include <ctype.h>
  10. #include <string.h>
  11. #include "input.h"
  12. #include "error.h"
  13. #include "decode.h"
  14. #include "lex.h"
  15. #include "symbol.h"
  16. #include "area.h"
  17. #include "asm.h"
  18. #include "code.h"
  19.  
  20. void asm(void)
  21. {
  22.   Lex label;
  23.   Symbol *symbol;
  24.   char  c;
  25.  
  26.   while(inputNextLine()) {
  27.     if((c=inputLook())!=0 && !isspace(c) && c!=';' ) {
  28.       label = lexGetId();
  29.       skipblanks();
  30.       if(inputLook() == ':')
  31.         inputSkip();
  32.       symbol = symbolAdd(label);
  33.       if(areaCurrent) {
  34.         symbol->value = valueLateToCode(areaCurrent->value.ValueInt.i,
  35.                                         codeNewLateInfo(areaCurrent));
  36.         symbol->type |= SYMBOL_ABSOLUTE;
  37.       } else {
  38.         symbol->type = 0;
  39.         symbol->value.Tag = ValueIllegal;
  40.       }
  41.     } else
  42.       symbol = 0;
  43.     skipblanks();
  44.     if((c=inputLook())!=0 && c!=';') {
  45.       if(decode(symbol))
  46.         break;
  47.     }     
  48.   }
  49. }
  50.