home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 2 / RISC_DISC_2.iso / pd_share / program / language / as / source / c / asm < prev    next >
Encoding:
Text File  |  1993-12-28  |  998 b   |  49 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.  
  25.   while(inputNextLine()) {
  26.     if(inputLook() && !isspace(inputLook()) && !inputComment()) {
  27.       label = lexGetId();
  28.       skipblanks();
  29.       if(inputLook() == ':')
  30.         inputSkip();
  31.       symbol = symbolAdd(label);
  32.       if(areaCurrent) {
  33.         symbol->value = valueLateToCode(areaCurrent->value.ValueInt.i,
  34.                                         codeNewLateInfo(areaCurrent));
  35.         symbol->type |= SYMBOL_ABSOLUTE;
  36.       } else {
  37.         symbol->type = 0;
  38.         symbol->value.Tag = ValueIllegal;
  39.       }
  40.     } else
  41.       symbol = 0;
  42.     skipblanks();
  43.     if(!inputComment()) {
  44.       if(decode(symbol))
  45.         break;
  46.     }     
  47.   }
  48. }
  49.