]> git.gag.com Git - fw/sdcc/commitdiff
small xa progress
authorjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Mon, 21 Jan 2002 16:10:08 +0000 (16:10 +0000)
committerjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Mon, 21 Jan 2002 16:10:08 +0000 (16:10 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1832 4a8a32a2-be11-0410-ad9d-d568d2c75423

as/xa51/xa_asm.y
as/xa51/xa_main.c
as/xa51/xa_main.h

index b63b842884b096bd8692f04abcbddc2092a09e18..339b750915da8e6fccad8292a3c589f03ab64532 100644 (file)
@@ -150,10 +150,10 @@ directive:     '.' ORG expr {
                         $$ = 0;
                 }
 
-             | db_directive bytes {
+             | '.' db_directive bytes {
                        $$ = db_count;
                }
-            | dw_directive words {
+            | '.' dw_directive words {
                        $$ = dw_count;
                }
             | '.' AREA AREA_NAME AREA_DESC {
index c38221d45c611417a3958b2eb372442a343d8199..f632f562ae3ae221da817447016cdee20e5bd315 100644 (file)
@@ -17,6 +17,7 @@
 /* adapted from the osu8asm project, 1995 */
 /* http://www.pjrc.com/tech/osu8/index.html */
 
+#define printf(x...) fprintf(stderr,x)
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -46,6 +47,21 @@ struct area_struct area[NUM_AREAS];
 int current_area=AREA_CSEG;
 
 
+char *areaToString (int area) {
+  switch (area) 
+    {
+    case AREA_CSEG: return "CSEG";
+    case AREA_DSEG: return "DSEG";
+    case AREA_OSEG: return "OSEG";
+    case AREA_ISEG: return "ISEG";
+    case AREA_BSEG: return "BSEG";
+    case AREA_XSEG: return "XSEG";
+    case AREA_XISEG: return "XISEG";
+    case AREA_XINIT: return "XINIT";
+    }
+  return ("UNKNOW");
+}
+
 /* "mem" is replaced by area[current_area].alloc_position */
 /* int mem=0; */   /* mem is location in memory */
 
@@ -68,6 +84,7 @@ struct symbol * build_sym_list(char *thename)
        new->isbit = 0;
        new->isreg = 0;
        new->line_def = lineno - 1;
+       new->area = current_area;
        new->next = NULL;
        if (sym_list == NULL) return (sym_list = new);
        p = sym_list;
@@ -180,19 +197,17 @@ void flag_targets()
 
 void print_symbol_table()
 {
-       struct symbol *p;
-       p = sym_list;
-       while (p != NULL) {
-               printf("Sym:%12s = %5d (%04X)  Def:", \
-                 p->name, p->value, p->value);
-               if (p->isdef) printf("Yes"); else printf("No ");
-               printf("  Bit:");
-               if (p->isbit) printf("Yes"); else printf("No ");
-               printf("  Target:");
-               if (p->istarget) printf("Yes"); else printf("No ");
-               printf(" Line %d\n", p->line_def);
-               p = p->next;
-       }
+  struct symbol *p;
+  p = sym_list;
+  while (p != NULL) {
+    printf("Sym in %-5s: %s\n", areaToString(p->area), p->name);
+    printf("  at: 0x%04X (%5d)", p->value, p->value);
+    printf(" Def:%s", p->isdef ? "Yes" : "No ");
+    printf(" Bit:%s", p->isbit ? "Yes" : "No ");
+    printf(" Target:%s", p->istarget ? "Yes" : "No ");
+    printf(" Line %d\n", p->line_def);
+    p = p->next;
+  }
 }
 
 /* check that every symbol is in the table only once */
index 6a9cc14f7b9953d0e5e54828f9b67a972bb1f91e..e3bf912bda8589b9c577d1527a3f07aac3945884 100644 (file)
@@ -33,6 +33,7 @@ struct symbol {
         int line_def;   /* line in which is was defined */
         int isbit;      /* 1 if a bit address, 0 otherwise */
        int isreg;      /* 1 if a register, 0 otehrwise */
+  int area;       /* the area that this symbol is in */
         struct symbol *next; };
 
 /* a list of all the symbols that are branch targets */