2007-11-17 Borut Razem <borut.razem AT siol.net>
authorborutr <borutr@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 17 Nov 2007 18:55:50 +0000 (18:55 +0000)
committerborutr <borutr@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 17 Nov 2007 18:55:50 +0000 (18:55 +0000)
* src/SDCCglue.c, src/pic16/glue.c: reverted fix for bug
  #983491 - "Merge duplicate strings function is ineffective"
* support/regression/tests/bug-983491.c: regtest disabled
* as/asxxsrc: created
  as/asxxsrc/assym.c, as/asxxsrc/strcmpi.c: moved
  as/hc08/assym.c, as/mcs51/assym.c, as/strcmpi.c,
  as/z80/assym.c: deleted
  as/hc08/Makefile.bcc, as/hc08/Makefile.in, as/hc08/as_hc08.dsp,
  as/hc08/asm.h, as/link/hc08/Makefile.bcc, as/link/hc08/Makefile.in,
  as/link/hc08/link_hc08.dsp, as/link/mcs51/Makefile.bcc,
  as/link/mcs51/Makefile.in, as/link/mcs51/aslink.dsp,
  as/link/z80/Makefile.in, as/link/z80/linkgbz80.dsp,
  as/link/z80/linkz80.dsp, as/mcs51/Makefile.bcc, as/mcs51/Makefile.in,
  as/mcs51/asm.h, as/mcs51/asx8051.dsp, as/z80/Makefile.bcc,
  as/z80/Makefile.in, as/z80/as_gbz80.dsp, as/z80/as_z80.dsp: modified
  created as/asxxsrc directory, assym.c and strcpi.c moved into it

git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4968 4a8a32a2-be11-0410-ad9d-d568d2c75423

28 files changed:
ChangeLog
as/asxxsrc/assym.c [new file with mode: 0644]
as/asxxsrc/strcmpi.c [new file with mode: 0644]
as/hc08/Makefile.bcc
as/hc08/Makefile.in
as/hc08/as_hc08.dsp
as/hc08/asm.h
as/hc08/assym.c [deleted file]
as/link/hc08/Makefile.bcc
as/link/hc08/Makefile.in
as/link/hc08/link_hc08.dsp
as/link/mcs51/Makefile.bcc
as/link/mcs51/Makefile.in
as/link/mcs51/aslink.dsp
as/link/z80/Makefile.in
as/link/z80/linkgbz80.dsp
as/link/z80/linkz80.dsp
as/mcs51/Makefile.bcc
as/mcs51/Makefile.in
as/mcs51/asm.h
as/mcs51/assym.c [deleted file]
as/mcs51/asx8051.dsp
as/strcmpi.c [deleted file]
as/z80/Makefile.bcc
as/z80/Makefile.in
as/z80/as_gbz80.dsp
as/z80/as_z80.dsp
as/z80/assym.c [deleted file]

index f3d1fafcbd29d0f1f8ebddb152def1c51dab4c55..41376c96771451a38fa7e434906fa951a2716b46 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,19 @@
        * src/SDCCglue.c, src/pic16/glue.c: reverted fix for bug
          #983491 - "Merge duplicate strings function is ineffective"
        * support/regression/tests/bug-983491.c: regtest disabled
+       * as/asxxsrc: created
+         as/asxxsrc/assym.c, as/asxxsrc/strcmpi.c: moved
+         as/hc08/assym.c, as/mcs51/assym.c, as/strcmpi.c,
+         as/z80/assym.c: deleted
+         as/hc08/Makefile.bcc, as/hc08/Makefile.in, as/hc08/as_hc08.dsp,
+         as/hc08/asm.h, as/link/hc08/Makefile.bcc, as/link/hc08/Makefile.in,
+         as/link/hc08/link_hc08.dsp, as/link/mcs51/Makefile.bcc,
+         as/link/mcs51/Makefile.in, as/link/mcs51/aslink.dsp,
+         as/link/z80/Makefile.in, as/link/z80/linkgbz80.dsp,
+         as/link/z80/linkz80.dsp, as/mcs51/Makefile.bcc, as/mcs51/Makefile.in,
+         as/mcs51/asm.h, as/mcs51/asx8051.dsp, as/z80/Makefile.bcc,
+         as/z80/Makefile.in, as/z80/as_gbz80.dsp, as/z80/as_z80.dsp: modified
+         created as/asxxsrc directory, assym.c and strcpi.c moved into it
 
 2007-11-15 Maarten Brock <sourceforge.brock AT dse.nl>
 
diff --git a/as/asxxsrc/assym.c b/as/asxxsrc/assym.c
new file mode 100644 (file)
index 0000000..13d175a
--- /dev/null
@@ -0,0 +1,505 @@
+/* assym.c */
+
+/*
+ * (C) Copyright 1989-1995
+ * All Rights Reserved
+ *
+ * Alan R. Baldwin
+ * 721 Berkeley St.
+ * Kent, Ohio  44240
+ *
+ * 10-Nov-07 borutr:
+ *           - use strsto instead StoreString and include it in assym.c
+ *             for compatibility with the original asxxxx
+ *           - applied changes from 28-Oct-97 JLH:
+ *             - lookup: Use StoreString for sym construction
+ *             - change symeq() to do length-independent string compare
+ *             - change hash() to do length-independent hash calculation
+ *           - applied changes from 29-Oct-97 JLH:
+ *             - make mnemonics case insensitive ALWAYS
+ *             - make hash() case-insensitive always
+ *             - replace symeq() call in mlookup with strcmpi
+ */
+
+#include <stdio.h>
+#include <setjmp.h>
+#include <string.h>
+#include <stdlib.h>
+#include "asm.h"
+
+/*)Module       assym.c
+ *
+ *      The module assym.c contains the functions that operate
+ *      on the mnemonic/directive and symbol structures.
+ *
+ *      assym.c contains the following functions:
+ *              VOID    allglob()
+ *              area *  alookup()
+ *              int     hash()
+ *              sym *   lookup()
+ *              mne *   mlookup()
+ *              VOID *  new()
+ *              int     symeq()
+ *              VOID    syminit()
+ *              VOID    symglob()
+ *
+ *      assym.c contains no local/static variables.
+ */
+
+/*)Function     VOID    syminit()
+ *
+ *      The function syminit() is called early in the game
+ *      to set up the hashtables.  First all buckets in a
+ *      table are cleared.  Then a pass is made through
+ *      the respective symbol lists, linking them into
+ *      their hash buckets.  Finally the base area pointer
+ *      is set to 'dca'.
+ *
+ *      local variables:
+ *              int     h               computed hash value
+ *              mne *   mp              pointer to a mne structure
+ *              mne **  mpp             pointer to an array of
+ *                                      mne structure pointers
+ *              sym *   sp              pointer to a sym structure
+ *              sym **  spp             pointer to an array of
+ *                                      sym structure pointers
+ *
+ *      global variables:
+ *              area    area[]          single elememt area array
+ *              area    dca             defined as area[0]
+ *              mne * mnehash[]         array of pointers to NHASH
+ *                                      linked mnemonic/directive lists
+ *              sym * symhash[]         array of pointers to NHASH
+ *                                      linked symbol lists
+ *
+ *      functions called:
+ *              none
+ *
+ *      side effects:
+ *              (1)     The symbol hash tables are initialized,
+ *                      the only defined symbol is '.'.
+ *              (2)     The mnemonic/directive hash tables are
+ *                      initialized with the assembler directives
+ *                      and mnemonics found in the machine dependent
+ *                      file ___pst.c.
+ *              (3)     The area pointer is initialized to dca (area[0]).
+ */
+
+VOID
+syminit(void)
+{
+        register struct mne  *mp;
+        struct mne **mpp;
+        register struct sym  *sp;
+        struct sym **spp;
+        register int h;
+
+        mpp = &mnehash[0];
+        while (mpp < &mnehash[NHASH])
+                *mpp++ = NULL;
+        mp = &mne[0];
+        for (;;) {
+                h = hash(mp->m_id);
+                mp->m_mp = mnehash[h];
+                mnehash[h] = mp;
+                if (mp->m_flag&S_END)
+                        break;
+                ++mp;
+        }
+
+        spp = &symhash[0];
+        while (spp < &symhash[NHASH])
+                *spp++ = NULL;
+        sp = &sym[0];
+        for (;;) {
+                h = hash(sp->s_id);
+                sp->s_sp = symhash[h];
+                symhash[h] = sp;
+                if (sp->s_flag&S_END)
+                        break;
+                ++sp;
+        }
+
+        areap = &dca;
+}
+
+/*)Function     area *  alookup(id)
+ *
+ *              char *  id              area name string
+ *
+ *      The function alookup() searches the area list for a
+ *      match with id.  If the area is defined then a pointer
+ *      to this area is returned else a NULL is returned.
+ *
+ *      local variables:
+ *              area *  ap              pointer to area structure
+ *
+ *      global variables:
+ *              area *  areap           pointer to an area structure
+ *
+ *      functions called:
+ *              int     symeq()         assym.c
+ *
+ *      side effects:
+ *              none
+ */
+
+struct area *
+alookup(char *id)
+{
+        register struct area *ap;
+
+        ap = areap;
+        while (ap) {
+                if (symeq(id, ap->a_id)) {
+                        return (ap);
+                }
+                ap = ap->a_ap;
+        }
+        return(NULL);
+}
+
+/*)Function     mne *   mlookup(id)
+ *
+ *              char *  id              mnemonic/directive name string
+ *
+ *      The function mlookup() searches the mnemonic/directive
+ *      hash tables for a match returning a pointer to the
+ *      mne structure else it returns a NULL.
+ *
+ *      local variables:
+ *              mne *   mp              pointer to mne structure
+ *              int     h               calculated hash value
+ *
+ *      global variables:
+ *              mne * mnehash[]         array of pointers to NHASH
+ *                                      linked mnemonic/directive lists
+ *
+ *      functions called:
+ *              none
+ *
+ *      side effects:
+ *              none
+ */
+
+struct mne *
+mlookup(char *id)
+{
+        register struct mne *mp;
+        register int h;
+
+        h = hash(id);
+        mp = mnehash[h];
+        while (mp) {
+                if (as_strcmpi(id, mp->m_id) == 0)      /* JLH: case insensitive */
+                        return (mp);
+                mp = mp->m_mp;
+        }
+        return (NULL);
+}
+
+/*)Function     sym *   lookup(id)
+ *
+ *              char *  id              symbol name string
+ *
+ *      The function lookup() searches the symbol hash tables for
+ *      a symbol name match returning a pointer to the sym structure.
+ *      If the symbol is not found then a sym structure is created,
+ *      initialized, and linked to the appropriate hash table.
+ *      A pointer to this new sym structure is returned.
+ *
+ *      local variables:
+ *              int     h               computed hash value
+ *              sym *   sp              pointer to a sym structure
+ *
+ *      global varaibles:
+ *              sym * symhash[]         array of pointers to NHASH
+ *                                      linked symbol lists
+ *
+ *      functions called:
+ *              int     hash()          assym.c
+ *              VOID *  new()           assym.c
+ *              int     symeq()         assym.c
+ *
+ *      side effects:
+ *              If the function new() fails to allocate space
+ *              for the new sym structure the assembly terminates.
+ */
+
+struct sym *
+lookup(char *id)
+{
+        register struct sym *sp;
+        register int h;
+
+        h = hash(id);
+        sp = symhash[h];
+        while (sp) {
+                if (symeq(id, sp->s_id))
+                        return (sp);
+                sp = sp->s_sp;
+        }
+        sp = (struct sym *) new (sizeof(struct sym));
+        sp->s_sp = symhash[h];
+        symhash[h] = sp;
+        sp->s_tsym = NULL;
+        sp->s_id = strsto(id);
+        sp->s_type = S_NEW;
+        sp->s_flag = 0;
+        sp->s_area = NULL;
+        sp->s_ref = 0;
+        sp->s_addr = 0;
+        return (sp);
+}
+
+/*)Function     VOID    symglob()
+ *
+ *      The function symglob() will mark all symbols of
+ *      type S_NEW as global.  Called at the beginning of pass 1
+ *      if the assembly option -g was specified.
+ *
+ *      local variables:
+ *              sym *   sp              pointer to a sym structure
+ *              int     i               loop index
+ *
+ *      global variables:
+ *              sym * symhash[]         array of pointers to NHASH
+ *                                      linked symbol lists
+ *
+ *      functions called:
+ *              none
+ *
+ *      side effects:
+ *              Symbol types changed.
+ */
+
+VOID
+symglob(void)
+{
+        register struct sym *sp;
+        register int i;
+
+        for (i=0; i<NHASH; ++i) {
+                sp = symhash[i];
+                while (sp != NULL) {
+                        if (sp->s_type == S_NEW)
+                                sp->s_flag |= S_GBL;
+                        sp = sp->s_sp;
+                }
+        }
+}
+
+/*)Function     VOID    allglob()
+ *
+ *      The function allglob() will mark all symbols of
+ *      type S_USER as global.  Called at the beginning of pass 1
+ *      if the assembly option -a was specified.
+ *
+ *      local variables:
+ *              sym *   sp              pointer to a sym structure
+ *              int     i               loop index
+ *
+ *      global variables:
+ *              sym * symhash[]         array of pointers to NHASH
+ *                                      linked symbol lists
+ *
+ *      functions called:
+ *              none
+ *
+ *      side effects:
+ *              Symbol types changed.
+ */
+
+VOID
+allglob(void)
+{
+        register struct sym *sp;
+        register int i;
+
+        for (i=0; i<NHASH; ++i) {
+                sp = symhash[i];
+                while (sp != NULL) {
+                        if (sp != &dot && sp->s_type == S_USER)
+                                sp->s_flag |= S_GBL;
+                        sp = sp->s_sp;
+                }
+        }
+}
+
+/*)Function     int     symeq(p1, p2)
+ *
+ *              char *  p1              name string
+ *              char *  p2              name string
+ *
+ *      The function symeq() compares the two name strings for a match.
+ *      The return value is 1 for a match and 0 for no match.
+ *
+ *      local variables:
+ *              int     h               loop counter
+ *
+ *      global variables:
+ *              char    ccase[]         an array of characters which
+ *                                      perform the case translation function
+ *
+ *      functions called:
+ *              none
+ *
+ *      side effects:
+ *              none
+ *
+ */
+
+int
+symeq(char *p1, char *p2)
+{
+#if     CASE_SENSITIVE
+                return (strcmp( p1, p2 ) == 0);
+#else
+                return (as_strcmpi( p1, p2 ) == 0);
+#endif
+}
+
+/*)Function     int     hash(p)
+ *
+ *              char *  p               pointer to string to hash
+ *
+ *      The function hash() computes a hash code using the sum
+ *      of all characters mod table size algorithm.
+ *
+ *      local variables:
+ *              int     h               accumulated character sum
+ *              int     n               loop counter
+ *
+ *      global variables:
+ *              char    ccase[]         an array of characters which
+ *                                      perform the case translation function
+ *
+ *      functions called:
+ *              none
+ *
+ *      side effects:
+ *              none
+ */
+
+int
+hash(char *p)
+{
+        register int h;
+
+        h = 0;
+        while (*p) {
+                /* JLH: case insensitive hash:  Doesn't much affect
+                 * hashing, and allows same function for mnemonics and symbols
+                 */
+                h += ccase[(int)*p++];
+        }
+        return (h&HMASK);
+}
+
+/*)Function     char *  strsto(str)
+ *
+ *              char *  str             pointer to string to save
+ *
+ *      Allocate space for "str", copy str into new space.
+ *      Return a pointer to the allocated string.
+ *
+ *      This function based on code by
+ *              John L. Hartman
+ *              jhartman at compuserve dot com
+ *
+ *      local variables:
+ *              int     l               string length + 1
+ *              int     bytes           bytes remaining in buffer area
+ *              char *  p               pointer to head of copied string
+ *              char *  pnext           next location in buffer area
+ *
+ *      global variables:
+ *              none
+ *
+ *      functions called:
+ *              VOID *  new()           assym.c
+ *              char *  strncpy()       c_library
+ *
+ *      side effects:
+ *              Space allocated for string, string copied
+ *              to space.  Out of Space terminates assembler.
+ */
+
+/*
+ * To avoid wasting memory headers on small allocations, we
+ * allocate a big chunk and parcel it out as required.
+ * These static variables remember our hunk
+ */
+
+#define STR_SPC 1024
+static  char *  pnext = NULL;
+static  int     bytes = 0;
+
+char *
+strsto(char *str)
+{
+        int  l;
+        char *p;
+
+        /*
+         * What we need, including a null.
+         */
+        l = strlen(str) + 1;
+
+        if (l > bytes) {
+                /*
+                 * No space.  Allocate a new hunk.
+                 * We lose the pointer to any old hunk.
+                 * We don't care, as the names are never deleted.
+                */
+                pnext = (char *) new (STR_SPC);
+                bytes = STR_SPC;
+        }
+
+        /*
+         * Copy the name and terminating null.
+         */
+        p = pnext;
+        strncpy(p, str, l);
+
+        pnext += l;
+        bytes -= l;
+
+        return(p);
+}
+
+/*)Function     VOID *  new(n)
+ *
+ *              unsigned int    n       allocation size in bytes
+ *
+ *      The function new() allocates n bytes of space and returns
+ *      a pointer to this memory.  If no space is available the
+ *      assembly is terminated.
+ *
+ *      local variables:
+ *              VOID *  p               a general pointer
+ *
+ *      global variables:
+ *              none
+ *
+ *      functions called:
+ *              VOID    asexit()        asmain.c
+ *              int     fprintf()       c_library
+ *              VOID *  malloc()        c_library
+ *
+ *      side effects:
+ *              Memory is allocated, if allocation fails
+ *              the assembly is terminated.
+ */
+
+VOID *
+new(unsigned int n)
+{
+        register VOID *p;
+
+        if ((p = (VOID *) malloc(n)) == NULL) {
+                fprintf(stderr, "Out of space!\n");
+                asexit(1);
+        }
+        return (p);
+}
diff --git a/as/asxxsrc/strcmpi.c b/as/asxxsrc/strcmpi.c
new file mode 100644 (file)
index 0000000..c45ce9d
--- /dev/null
@@ -0,0 +1,55 @@
+/* strcmpi.c */
+
+/*
+ * Compare two strings ignoring case.
+ *
+ * Taken from GLIBC 2.2.5. Original code is copyrighted "Free
+ * Software Foundation" and published under the GNU Lesser General
+ * Public License.
+ * 
+ */
+
+#include <ctype.h>
+#include <stddef.h>
+
+int as_strcmpi (const char *s1, const char *s2)
+{
+  const unsigned char *p1 = (const unsigned char *) s1;
+  const unsigned char *p2 = (const unsigned char *) s2;
+  unsigned char c1, c2;
+
+  if (p1 == p2)
+    return 0;
+
+  do
+    {
+      c1 = tolower (*p1++);
+      c2 = tolower (*p2++);
+      if (c1 == '\0')
+       break;
+    }
+  while (c1 == c2);
+  
+  return c1 - c2;
+}
+
+int as_strncmpi (const char *s1, const char *s2, size_t n)
+{
+  const unsigned char *p1 = (const unsigned char *) s1;
+  const unsigned char *p2 = (const unsigned char *) s2;
+  unsigned char c1, c2;
+
+  if ((p1 == p2) || (n == 0))
+    return 0;
+
+  do
+    {
+      c1 = tolower (*p1++);
+      c2 = tolower (*p2++);
+      if (c1 == '\0')
+       break;
+    }
+  while ((c1 == c2) && --n);
+
+  return c1 - c2;
+}
index 9a165ea41c31e0e37b213c9650de8275072f08c8..5e59393c3c427fa32637d09966f5a3e5342b58bb 100644 (file)
@@ -4,10 +4,10 @@ PRJDIR          = ../..
 
 !include $(PRJDIR)/Bcc.inc
 
-ASOBJECTS       = asmain.obj aslex.obj assym.obj assubr.obj asnoice.obj \
+ASOBJECTS       = asmain.obj aslex.obj assubr.obj asnoice.obj \
                   asexpr.obj asdata.obj aslist.obj asout.obj asstore.obj \
                   h08ext.obj h08pst.obj h08mch.obj h08adr.obj \
-                  ../strcmpi.obj
+                  ../asxxsrc/strcmpi.obj ../asxxsrc/assym.obj
 
 ASX8051         = $(PRJDIR)/bin/asx8051.exe
 
index efb96986828fa8c0c32d5866706d9310c7a27181..706fec62d86b24afc3be0b78b769c825a25beee3 100644 (file)
@@ -7,17 +7,17 @@ VERSIONHI       = @VERSIONHI@
 VERSIONLO       = @VERSIONLO@
 VERSIONP        = @VERSIONP@
 
-SHELL          = /bin/sh
-CC             = @CC@
-CPP            = @CPP@
-INSTALL                = @INSTALL@
+SHELL           = /bin/sh
+CC              = @CC@
+CPP             = @CPP@
+INSTALL         = @INSTALL@
 STRIP           = @STRIP@
 
-top_builddir   = @top_builddir@
-top_srcdir     = @top_srcdir@
+top_builddir    = @top_builddir@
+top_srcdir      = @top_srcdir@
 
-srcdir         = @srcdir@
-prefix         = @prefix@
+srcdir          = @srcdir@
+prefix          = @prefix@
 exec_prefix     = @exec_prefix@
 bindir          = @bindir@
 libdir          = @libdir@
@@ -33,24 +33,34 @@ EXEEXT          = @EXEEXT@
 
 VPATH           = @srcdir@
 
-CPPFLAGS       = @CPPFLAGS@ -I. -I$(srcdir)
-CFLAGS         = @CFLAGS@ -Wall
-M_OR_MM                = @M_OR_MM@
-LDFLAGS                = @LDFLAGS@
+CPPFLAGS        = @CPPFLAGS@ -I. -I$(srcdir)
+CFLAGS          = @CFLAGS@ -Wall -I. -I$(srcdir)
+M_OR_MM         = @M_OR_MM@
+LDFLAGS         = @LDFLAGS@
 
-ASOBJECTS      = asmain.o aslex.o assym.o assubr.o asnoice.o \
-                 asexpr.o asdata.o aslist.o asout.o asstore.o \
-                 m08ext.o m08pst.o m08mch.o m08adr.o \
-                 ../strcmpi.o
-ASSOURCES      = $(patsubst %.o,%.c,$(ASOBJECTS))
+OBJDIR = obj
 
-ASHC08         = $(top_builddir)/bin/as-hc08$(EXEEXT)
+ASXXLIB = $(srcdir)/../asxxsrc
+
+ASXXLIBSRC = strcmpi.c assym.c
+
+SRC = asmain.c aslex.c assubr.c asnoice.c \
+      asexpr.c asdata.c aslist.c asout.c asstore.c \
+      m08ext.c m08pst.c m08mch.c m08adr.c
+
+ASSOURCES = %(SRC) $(ASXXLIBSRC:%.c=$(ASXXLIB)/%.c)
+                  
+OBJS = $(SRC:%.c=$(OBJDIR)/%.o)
+ASXXLIBOBJS = $(ASXXLIBSRC:%.c=$(OBJDIR)/%.o)
+ASOBJECTS = $(OBJS) $(ASXXLIBOBJS)
+
+ASHC08 = $(top_builddir)/bin/as-hc08$(EXEEXT)
 
 transform       = @program_transform_name@
 
 # Compiling entire program or any subproject
 # ------------------------------------------
-all: checkconf $(ASHC08) $(ASLINK)
+all: checkconf $(ASHC08)
 
 $(ASHC08): $(ASOBJECTS)
        $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(ASOBJECTS) 
@@ -87,7 +97,7 @@ installdirs:
 # ---------------------
 dep: Makefile.dep
 
-Makefile.dep: $(ASSOURCES) $(srcdir)/*.h $(top_builddir)/*.h $(top_srcdir)/*.h
+Makefile.dep: $(ASSOURCES) $(srcdir)/*.h
        $(CPP) $(CPPFLAGS) $(M_OR_MM) $(filter %.c,$^) >Makefile.dep
 
 ifeq "$(findstring $(MAKECMDGOALS),uninstall check installcheck installdirs \
@@ -98,8 +108,15 @@ include $(srcdir)/clean.mk
 
 # My rules
 # --------
-.c.o:
-       $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
+$(OBJDIR)/.stamp:
+       mkdir -p $(OBJDIR)
+       touch $(OBJDIR)/.stamp
+
+$(OBJDIR)/%.o: %.c $(OBJDIR)/.stamp
+       $(CC) -c $(CFLAGS) -o $@ $<
+
+$(OBJDIR)/%.o: $(ASXXLIB)/%.c $(OBJDIR)/.stamp
+       $(CC) -c $(CFLAGS) -o $@ $<
 
 
 # Remaking configuration
index 5071c401d8381de3b9bb1ab12849ad63609ae01a..b2500ed74f222483fdc4a7801cd0c75c1125e3b7 100644 (file)
@@ -42,7 +42,7 @@ RSC=rc.exe
 # PROP Ignore_Export_Lib 0\r
 # PROP Target_Dir ""\r
 # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c\r
-# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c\r
+# ADD CPP /nologo /W3 /GX /O2 /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c\r
 # ADD BASE RSC /l 0x409 /d "NDEBUG"\r
 # ADD RSC /l 0x409 /d "NDEBUG"\r
 BSC32=bscmake.exe\r
@@ -65,8 +65,8 @@ LINK32=link.exe
 # PROP Intermediate_Dir "Debug"\r
 # PROP Ignore_Export_Lib 0\r
 # PROP Target_Dir ""\r
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ  /c\r
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ  /c\r
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c\r
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /U "." /YX /FD /GZ /c\r
 # ADD BASE RSC /l 0x409 /d "_DEBUG"\r
 # ADD RSC /l 0x409 /d "_DEBUG"\r
 BSC32=bscmake.exe\r
@@ -123,7 +123,7 @@ SOURCE=.\assubr.c
 # End Source File\r
 # Begin Source File\r
 \r
-SOURCE=.\assym.c\r
+SOURCE=..\asxxsrc\assym.c\r
 # End Source File\r
 # Begin Source File\r
 \r
@@ -143,7 +143,7 @@ SOURCE=.\m08pst.c
 # End Source File\r
 # Begin Source File\r
 \r
-SOURCE=..\strcmpi.c\r
+SOURCE=..\asxxsrc\strcmpi.c\r
 # End Source File\r
 # End Group\r
 # Begin Group "Header Files"\r
index 81881bdf374cc3914b9a98bf0b87cc357dab7a5b..4ce9ef5d8cfa02671bcc2e863ba7d60b90850579 100644 (file)
@@ -9,10 +9,10 @@
  * Kent, Ohio  44240
  *
  * 28-Oct-97 JLH:
- *          - add proto for StoreString
- *          - change s_id from [NCPS] to pointer
- *          - change m_id from [NCPS] to pointer
- *          - change NCPS to 80
+ *           - add proto for StoreString
+ *           - change s_id from [NCPS] to pointer
+ *           - change m_id from [NCPS] to pointer
+ *           - change NCPS to 80
  *           - case sensitive
  *           - add R_J11 for 8051 assembler
  *           - add outr11 prototype for 8051 assembler
  *           - add memory space flags to a_flag for 8051
  *
  *  3-Feb-00 KV:
- *          - add DS80C390 flat mode support.
+ *           - add DS80C390 flat mode support.
  */
 
-#define        VERSION "V01.70 + NoICE + SDCC mods + Flat24 Feb-1999"
+#define VERSION "V01.70 + NoICE + SDCC mods + Flat24 Feb-1999"
 
 #if !defined(__BORLANDC__) && !defined(_MSC_VER)
 #include <unistd.h>
 /*
  * Case Sensitivity Flag
  */
-#define        CASE_SENSITIVE  1
+#define CASE_SENSITIVE  1
 
-/*)Module      asm.h
+/*)Module       asm.h
  *
- *     The module asm.h contains the definitions for constants,
- *     structures, global variables, and ASxxxx functions
- *     contained in the ASxxxx.c files.  The two functions
- *     and three global variables from the machine dependent
- *     files are also defined.
+ *      The module asm.h contains the definitions for constants,
+ *      structures, global variables, and ASxxxx functions
+ *      contained in the ASxxxx.c files.  The two functions
+ *      and three global variables from the machine dependent
+ *      files are also defined.
  */
 
 /*
- *      compiler/operating system specific definitions
+ *       compiler/operating system specific definitions
  */
 
 /* DECUS C void definition */
 /* File/extension seperator */
 
-#ifdef decus
-#define        VOID    char
-#define        FSEPX   '.'
+#ifdef  decus
+#define VOID    char
+#define FSEPX   '.'
 #endif
 
 /* PDOS C void definition */
 /* File/extension seperator */
 
-#ifdef PDOS
-#define        VOID    char
-#define        FSEPX   ':'
+#ifdef  PDOS
+#define VOID    char
+#define FSEPX   ':'
 #endif
 
 /* Default void definition */
 /* File/extension seperator */
 
-#ifndef        VOID
-#define        VOID    void
-#define        FSEPX   '.'
-#define        OTHERSYSTEM
+#ifndef VOID
+#define VOID    void
+#define FSEPX   '.'
+#define OTHERSYSTEM
 #endif
 
 /*
  * PATH_MAX
  */
 #include <limits.h>
-#ifndef PATH_MAX               /* POSIX, but not required   */
+#ifndef PATH_MAX                /* POSIX, but not required   */
 #if defined(_MSC_VER) || defined(__BORLANDC__)  /* Microsoft C or Borland C*/
 #include <stdlib.h>
-#define PATH_MAX       _MAX_PATH
+#define PATH_MAX        _MAX_PATH
 #else
-#define PATH_MAX               /* define a reasonable value */
+#define PATH_MAX                /* define a reasonable value */
 #endif
 #endif
 
 /*
  * Assembler definitions.
  */
-#define        LFTERM  '('             /* Left expression delimeter */
-#define        RTTERM  ')'             /* Right expression delimeter */
-
-#define NCPS   80              /* Chars. per symbol (JLH: change from 8) */
-#define        HUGE    1000            /* A huge number */
-#define NERR   3               /* Errors per line */
-#define        NINPUT  1024            /* Input buffer size (icodes need space) */
-#define NCODE  128             /* Listing code buffer size */
-#define NTITL  64              /* Title buffer size */
-#define        NSBTL   64              /* SubTitle buffer size */
-#define        NHASH   64              /* Buckets in hash table */
-#define        HMASK   077             /* Hash mask */
-#define        NLPP    60              /* Lines per page */
-#define        MAXFIL  6               /* Maximum command line input files */
-#define        MAXINC  6               /* Maximum nesting of include files */
-#define        MAXIF   10              /* Maximum nesting of if/else/endif */
-
-#define NLIST  0               /* No listing */
-#define SLIST  1               /* Source only */
-#define ALIST  2               /* Address only */
-#define        BLIST   3               /* Address only with allocation */
-#define CLIST  4               /* Code */
-#define        ELIST   5               /* Equate only */
-
-#define        dot     sym[0]          /* Dot, current loc */
-#define        dca     area[0]         /* Dca, default code area */
+#define LFTERM  '('             /* Left expression delimeter */
+#define RTTERM  ')'             /* Right expression delimeter */
+
+#define NCPS    80              /* Chars. per symbol (JLH: change from 8) */
+#define HUGE    1000            /* A huge number */
+#define NERR    3               /* Errors per line */
+#define NINPUT  1024            /* Input buffer size (icodes need space) */
+#define NCODE   128             /* Listing code buffer size */
+#define NTITL   64              /* Title buffer size */
+#define NSBTL   64              /* SubTitle buffer size */
+#define NHASH   64              /* Buckets in hash table */
+#define HMASK   077             /* Hash mask */
+#define NLPP    60              /* Lines per page */
+#define MAXFIL  6               /* Maximum command line input files */
+#define MAXINC  6               /* Maximum nesting of include files */
+#define MAXIF   10              /* Maximum nesting of if/else/endif */
+
+#define NLIST   0               /* No listing */
+#define SLIST   1               /* Source only */
+#define ALIST   2               /* Address only */
+#define BLIST   3               /* Address only with allocation */
+#define CLIST   4               /* Code */
+#define ELIST   5               /* Equate only */
+
+#define dot     sym[0]          /* Dot, current loc */
+#define dca     area[0]         /* Dca, default code area */
 
 
 /* NB: for Flat24 extentions to work, Addr_T must be at least 24
  * bits. This is checked at runtime when the .flat24 directive
  * is processed.
  */
-typedef        unsigned int Addr_T;
+typedef unsigned int Addr_T;
 
 /*
- *     The area structure contains the parameter values for a
- *     specific program or data section.  The area structure
- *     is a linked list of areas.  The initial default area
- *     is "_CODE" defined in asdata.c, the next area structure
- *     will be linked to this structure through the structure
- *     element 'struct area *a_ap'.  The structure contains the
- *     area name, area reference number ("_CODE" is 0) determined
- *     by the order of .area directives, area size determined
- *     from the total code and/or data in an area, area fuzz is
- *     a variable used to track pass to pass changes in the
- *     area size caused by variable length instruction formats,
- *     and area flags which specify the area's relocation type.
+ *      The area structure contains the parameter values for a
+ *      specific program or data section.  The area structure
+ *      is a linked list of areas.  The initial default area
+ *      is "_CODE" defined in asdata.c, the next area structure
+ *      will be linked to this structure through the structure
+ *      element 'struct area *a_ap'.  The structure contains the
+ *      area name, area reference number ("_CODE" is 0) determined
+ *      by the order of .area directives, area size determined
+ *      from the total code and/or data in an area, area fuzz is
+ *      a variable used to track pass to pass changes in the
+ *      area size caused by variable length instruction formats,
+ *      and area flags which specify the area's relocation type.
  */
-struct area
+struct  area
 {
-       struct  area *a_ap;     /* Area link */
-       char    a_id[NCPS];     /* Area Name */
-       int     a_ref;          /* Ref. number */
-       Addr_T  a_addr;         /* Area address */
-       Addr_T  a_size;         /* Area size */
-       Addr_T  a_fuzz;         /* Area fuzz */
-       int     a_flag;         /* Area flags */
+        struct  area *a_ap;     /* Area link */
+        char    a_id[NCPS];     /* Area Name */
+        int     a_ref;          /* Ref. number */
+        Addr_T  a_addr;         /* Area address */
+        Addr_T  a_size;         /* Area size */
+        Addr_T  a_fuzz;         /* Area fuzz */
+        int     a_flag;         /* Area flags */
 };
 
 /*
- *     The "A_" area constants define values used in
- *     generating the assembler area output data.
+ *      The "A_" area constants define values used in
+ *      generating the assembler area output data.
  *
  * Area flags
  *
- *        7     6      5    4     3     2     1     0
- *     +-----+-----+-----+-----+-----+-----+-----+-----+
- *     | BIT |XDATA|DATA | PAG | ABS | OVR |     |     |
- *     +-----+-----+-----+-----+-----+-----+-----+-----+
+ *         7     6      5    4     3     2     1     0
+ *      +-----+-----+-----+-----+-----+-----+-----+-----+
+ *      | BIT |XDATA|DATA | PAG | ABS | OVR |     |     |
+ *      +-----+-----+-----+-----+-----+-----+-----+-----+
  */
 
-#define        A_CON   0000            /* Concatenating */
-#define        A_OVR   0004            /* Overlaying */
-#define        A_REL   0000            /* Relocatable */
-#define        A_ABS   0010            /* absolute */
-#define        A_NOPAG 0000            /* Non-Paged */
-#define        A_PAG   0020            /* Paged */
+#define A_CON   0000            /* Concatenating */
+#define A_OVR   0004            /* Overlaying */
+#define A_REL   0000            /* Relocatable */
+#define A_ABS   0010            /* absolute */
+#define A_NOPAG 0000            /* Non-Paged */
+#define A_PAG   0020            /* Paged */
 
 /* Additional flags for 8051 address spaces */
-#define A_DATA  0000           /* data space (default)*/
-#define A_CODE  0040           /* code space */
-#define A_XDATA 0100           /* external data space */
-#define A_BIT   0200           /* bit addressable space */
+#define A_DATA  0000            /* data space (default)*/
+#define A_CODE  0040            /* code space */
+#define A_XDATA 0100            /* external data space */
+#define A_BIT   0200            /* bit addressable space */
 
-#define A_NOLOAD  0400         /* nonloadable */
-#define A_LOAD  0000           /* loadable (default) */
+#define A_NOLOAD  0400          /* nonloadable */
+#define A_LOAD  0000            /* loadable (default) */
 
 /*
- *     The "R_" relocation constants define values used in
- *     generating the assembler relocation output data for
- *     areas, symbols, and code.
+ *      The "R_" relocation constants define values used in
+ *      generating the assembler relocation output data for
+ *      areas, symbols, and code.
  *
  * Relocation flags
  *
- *        7     6     5     4     3     2     1     0
- *     +-----+-----+-----+-----+-----+-----+-----+-----+
- *     | MSB | PAGn| PAG0| USGN| BYT2| PCR | SYM | BYT |
- *     +-----+-----+-----+-----+-----+-----+-----+-----+
+ *         7     6     5     4     3     2     1     0
+ *      +-----+-----+-----+-----+-----+-----+-----+-----+
+ *      | MSB | PAGn| PAG0| USGN| BYT2| PCR | SYM | BYT |
+ *      +-----+-----+-----+-----+-----+-----+-----+-----+
  */
 
-#define        R_WORD  0x00            /* 16 bit */
-#define        R_BYTE  0x01            /*  8 bit */
+#define R_WORD  0x00            /* 16 bit */
+#define R_BYTE  0x01            /*  8 bit */
 
-#define        R_AREA  0x00            /* Base type */
-#define        R_SYM   0x02
+#define R_AREA  0x00            /* Base type */
+#define R_SYM   0x02
 
-#define        R_NORM  0x00            /* PC adjust */
-#define        R_PCR   0x04
+#define R_NORM  0x00            /* PC adjust */
+#define R_PCR   0x04
 
-#define        R_BYT1  0x00            /* Byte count for R_BYTE = 1 */
-#define        R_BYT2  0x08            /* Byte count for R_BYTE = 2 */
+#define R_BYT1  0x00            /* Byte count for R_BYTE = 1 */
+#define R_BYT2  0x08            /* Byte count for R_BYTE = 2 */
 
-#define        R_SGND  0x00            /* Signed Byte */
-#define        R_USGN  0x10            /* Unsigned Byte */
+#define R_SGND  0x00            /* Signed Byte */
+#define R_USGN  0x10            /* Unsigned Byte */
 
-#define        R_NOPAG 0x00            /* Page Mode */
-#define        R_PAG0  0x20            /* Page '0' */
-#define        R_PAG   0x40            /* Page 'nnn' */
+#define R_NOPAG 0x00            /* Page Mode */
+#define R_PAG0  0x20            /* Page '0' */
+#define R_PAG   0x40            /* Page 'nnn' */
 
-#define        R_LSB   0x00            /* low byte */
-#define        R_MSB   0x80            /* high byte */
+#define R_LSB   0x00            /* low byte */
+#define R_MSB   0x80            /* high byte */
 
-#define R_BYT3 0x100           /* if R_BYTE is set, this is a
-                                * 3 byte address, of which
-                                * the linker must select one byte.
-                                */
-#define R_HIB  0x200           /* If R_BYTE & R_BYT3 are set, linker
-                                * will select byte 3 of the relocated
-                                * 24 bit address.
-                                */
+#define R_BYT3  0x100           /* if R_BYTE is set, this is a
+                                 * 3 byte address, of which
+                                 * the linker must select one byte.
+                                 */
+#define R_HIB   0x200           /* If R_BYTE & R_BYT3 are set, linker
+                                 * will select byte 3 of the relocated
+                                 * 24 bit address.
+                                 */
 
-#define R_J11   (R_WORD|R_BYT2)        /* JLH: 11 bit JMP and CALL (8051) */
+#define R_J11   (R_WORD|R_BYT2) /* JLH: 11 bit JMP and CALL (8051) */
 #define R_J19   (R_WORD|R_BYT2|R_MSB) /* 19 bit JMP/CALL (DS80C390) */
 #define R_C24   (R_WORD|R_BYT1|R_MSB) /* 24 bit address (DS80C390) */
 #define R_J19_MASK (R_BYTE|R_BYT2|R_MSB)
@@ -232,439 +232,440 @@ struct  area
 #define IS_R_J11(x) (((x) & R_J19_MASK) == R_J11)
 #define IS_C24(x) (((x) & R_J19_MASK) == R_C24)
 
-#define R_ESCAPE_MASK  0xf0    /* Used to escape relocation modes
-                                * greater than 0xff in the .rel
-                                * file.
-                                */
+#define R_ESCAPE_MASK   0xf0    /* Used to escape relocation modes
+                                 * greater than 0xff in the .rel
+                                 * file.
+                                 */
 
 /*
  * Listing Control Flags
  */
 
-#define        R_HIGH  0040000         /* High Byte */
-#define        R_RELOC 0100000         /* Relocation */
+#define R_HIGH  0040000         /* High Byte */
+#define R_RELOC 0100000         /* Relocation */
 
-#define        R_DEF   00              /* Global def. */
-#define        R_REF   01              /* Global ref. */
-#define        R_REL   00              /* Relocatable */
-#define        R_ABS   02              /* Absolute */
-#define        R_GBL   00              /* Global */
-#define        R_LCL   04              /* Local */
+#define R_DEF   00              /* Global def. */
+#define R_REF   01              /* Global ref. */
+#define R_REL   00              /* Relocatable */
+#define R_ABS   02              /* Absolute */
+#define R_GBL   00              /* Global */
+#define R_LCL   04              /* Local */
 
 /*
- *     The mne structure is a linked list of the assembler
- *     mnemonics and directives.  The list of mnemonics and
- *     directives contained in the device dependent file
- *     xxxpst.c are hashed and linked into NHASH lists in
- *     module assym.c by syminit().  The structure contains
- *     the mnemonic/directive name, a subtype which directs
- *     the evaluation of this mnemonic/directive, a flag which
- *     is used to detect the end of the mnemonic/directive
- *     list in xxxpst.c, and a value which is normally
- *     associated with the assembler mnemonic base instruction
- *     value.
+ *      The mne structure is a linked list of the assembler
+ *      mnemonics and directives.  The list of mnemonics and
+ *      directives contained in the device dependent file
+ *      xxxpst.c are hashed and linked into NHASH lists in
+ *      module assym.c by syminit().  The structure contains
+ *      the mnemonic/directive name, a subtype which directs
+ *      the evaluation of this mnemonic/directive, a flag which
+ *      is used to detect the end of the mnemonic/directive
+ *      list in xxxpst.c, and a value which is normally
+ *      associated with the assembler mnemonic base instruction
+ *      value.
  */
-struct mne
+struct  mne
 {
-       struct  mne *m_mp;      /* Hash link */
-       char    *m_id;          /* Mnemonic JLH: change from [NCPS] */
-       char    m_type;         /* Mnemonic subtype */
-       char    m_flag;         /* Mnemonic flags */
-       Addr_T  m_valu;         /* Value */
+        struct  mne *m_mp;      /* Hash link */
+        char    *m_id;          /* Mnemonic JLH: change from [NCPS] */
+        char    m_type;         /* Mnemonic subtype */
+        char    m_flag;         /* Mnemonic flags */
+        Addr_T  m_valu;         /* Value */
 };
 
 /*
- *     The sym structure is a linked list of symbols defined
- *     in the assembler source files.  The first symbol is "."
- *     defined in asdata.c.  The entry 'struct tsym *s_tsym'
- *     links any temporary symbols following this symbol and
- *     preceeding the next normal symbol.  The structure also
- *     contains the symbol's name, type (USER or NEW), flag
- *     (global, assigned, and multiply defined), a pointer
- *     to the area structure defining where the symbol is
- *     located, a reference number assigned by outgsd() in
- *     asout.c, and the symbols address relative to the base
- *     address of the area where the symbol is located.
+ *      The sym structure is a linked list of symbols defined
+ *      in the assembler source files.  The first symbol is "."
+ *      defined in asdata.c.  The entry 'struct tsym *s_tsym'
+ *      links any temporary symbols following this symbol and
+ *      preceeding the next normal symbol.  The structure also
+ *      contains the symbol's name, type (USER or NEW), flag
+ *      (global, assigned, and multiply defined), a pointer
+ *      to the area structure defining where the symbol is
+ *      located, a reference number assigned by outgsd() in
+ *      asout.c, and the symbols address relative to the base
+ *      address of the area where the symbol is located.
  */
-struct sym
+struct  sym
 {
-       struct  sym  *s_sp;     /* Hash link */
-       struct  tsym *s_tsym;   /* Temporary symbol link */
-       char    *s_id;          /* Symbol: JLH change from [NCPS] */
-       char    s_type;         /* Symbol subtype */
-       char    s_flag;         /* Symbol flags */
-       struct  area *s_area;   /* Area line, 0 if absolute */
-       int     s_ref;          /* Ref. number */
-       Addr_T  s_addr;         /* Address */
-       Addr_T  s_org;          /* Start Address if absolute */
+        struct  sym  *s_sp;     /* Hash link */
+        struct  tsym *s_tsym;   /* Temporary symbol link */
+        char    *s_id;          /* Symbol: JLH change from [NCPS] */
+        char    s_type;         /* Symbol subtype */
+        char    s_flag;         /* Symbol flags */
+        struct  area *s_area;   /* Area line, 0 if absolute */
+        int     s_ref;          /* Ref. number */
+        Addr_T  s_addr;         /* Address */
+        Addr_T  s_org;          /* Start Address if absolute */
 };
 
-#define        S_GBL           01      /* Global */
-#define        S_ASG           02      /* Assigned */
-#define        S_MDF           04      /* Mult. def */
-#define        S_END           010     /* End mark for pst. */
-
-#define        S_NEW           0       /* New name */
-#define        S_USER          1       /* User name */
-                               /* unused slot */
-                               /* unused slot */
-                               /* unused slot */
-
-#define        S_BYTE          5       /* .byte */
-#define        S_WORD          6       /* .word */
-#define        S_ASCII         7       /* .ascii */
-#define        S_ASCIZ         8       /* .asciz */
-#define        S_BLK           9       /* .blkb or .blkw */
-#define        S_INCL          10      /* .include */
-#define        S_DAREA         11      /* .area */
-#define        S_ATYP          12      /* .area type */
-#define        S_AREA          13      /* .area name */
-#define        S_GLOBL         14      /* .globl */
-#define        S_PAGE          15      /* .page */
-#define        S_TITLE         16      /* .title */
-#define        S_SBTL          17      /* .sbttl */
-#define        S_IF            18      /* .if */
-#define        S_ELSE          19      /* .else */
-#define        S_ENDIF         20      /* .endif */
-#define        S_EVEN          21      /* .even */
-#define        S_ODD           22      /* .odd */
-#define        S_RADIX         23      /* .radix */
-#define        S_ORG           24      /* .org */
-#define        S_MODUL         25      /* .module */
-#define        S_ASCIS         26      /* .ascis */
-#define        S_FLAT24        27  /* .flat24 */
-#define        S_OPTSDCC       28  /* .optsdcc */
-#define S_ULEB128      29      /* .uleb128 */
-#define S_SLEB128      30      /* .sleb128 */
+#define S_GBL           01      /* Global */
+#define S_ASG           02      /* Assigned */
+#define S_MDF           04      /* Mult. def */
+#define S_END           010     /* End mark for pst. */
+
+#define S_NEW           0       /* New name */
+#define S_USER          1       /* User name */
+                                /* unused slot */
+                                /* unused slot */
+                                /* unused slot */
+
+#define S_BYTE          5       /* .byte */
+#define S_WORD          6       /* .word */
+#define S_ASCII         7       /* .ascii */
+#define S_ASCIZ         8       /* .asciz */
+#define S_BLK           9       /* .blkb or .blkw */
+#define S_INCL          10      /* .include */
+#define S_DAREA         11      /* .area */
+#define S_ATYP          12      /* .area type */
+#define S_AREA          13      /* .area name */
+#define S_GLOBL         14      /* .globl */
+#define S_PAGE          15      /* .page */
+#define S_TITLE         16      /* .title */
+#define S_SBTL          17      /* .sbttl */
+#define S_IF            18      /* .if */
+#define S_ELSE          19      /* .else */
+#define S_ENDIF         20      /* .endif */
+#define S_EVEN          21      /* .even */
+#define S_ODD           22      /* .odd */
+#define S_RADIX         23      /* .radix */
+#define S_ORG           24      /* .org */
+#define S_MODUL         25      /* .module */
+#define S_ASCIS         26      /* .ascis */
+#define S_FLAT24        27  /* .flat24 */
+#define S_OPTSDCC       28  /* .optsdcc */
+#define S_ULEB128       29      /* .uleb128 */
+#define S_SLEB128       30      /* .sleb128 */
 
 /*
- *     The tsym structure is a linked list of temporary
- *     symbols defined in the assembler source files following
- *     a normal symbol.  The structure contains the temporary
- *     symbols number, a flag (multiply defined), a pointer to the
- *     area structure defining where the temporary structure
- *     is located, and the temporary symbol's address relative
- *     to the base address of the area where the symbol
- *     is located.
+ *      The tsym structure is a linked list of temporary
+ *      symbols defined in the assembler source files following
+ *      a normal symbol.  The structure contains the temporary
+ *      symbols number, a flag (multiply defined), a pointer to the
+ *      area structure defining where the temporary structure
+ *      is located, and the temporary symbol's address relative
+ *      to the base address of the area where the symbol
+ *      is located.
  */
-struct tsym
+struct  tsym
 {
-       struct  tsym *t_lnk;    /* Link to next */
+        struct  tsym *t_lnk;    /* Link to next */
 /* sandeep changed to 'int' from 'char' */
 /* this will increase the number temp symbols
    that can be defined from 255 to INT_MAX */
-       int t_num;              /* 0-INT_MAX$ */
-       int t_flg;              /* flags */
+        int t_num;              /* 0-INT_MAX$ */
+        int t_flg;              /* flags */
 
-       struct  area *t_area;   /* Area */
-       Addr_T  t_addr;         /* Address */
+        struct  area *t_area;   /* Area */
+        Addr_T  t_addr;         /* Address */
 };
 
 /*
- *     External Definitions for all Global Variables
+ *      External Definitions for all Global Variables
  */
 
-extern int     aserr;          /*      ASxxxx error counter
-                                */
-extern jmp_buf jump_env;       /*      compiler dependent structure
-                                *      used by setjmp() and longjmp()
-                                */
-extern int     inpfil;         /*      count of assembler
-                                *      input files specified
-                                */
-extern int     incfil;         /*      current file handle index
-                                *      for include files
-                                */
-extern int     cfile;          /*      current file handle index
-                                *      of input assembly files
-                                */
-extern int     flevel;         /*      IF-ELSE-ENDIF flag will be non
-                                *      zero for false conditional case
-                                */
-extern int     tlevel;         /*      current conditional level
-                                */
-extern int     ifcnd[MAXIF+1]; /*      array of IF statement condition
-                                *      values (0 = FALSE) indexed by tlevel
-                                */
-extern int     iflvl[MAXIF+1]; /*      array of IF-ELSE-ENDIF flevel
-                                *      values indexed by tlevel
-                                */
-extern char
-       afn[PATH_MAX];          /*      afile() temporary filespec
-                                */
-extern char
-       srcfn[MAXFIL][PATH_MAX];        /*      array of source file names
-                                */
-extern int
-       srcline[MAXFIL];        /*      current source file line
-                                */
-extern char
-       incfn[MAXINC][PATH_MAX];        /*      array of include file names
-                                */
-extern int
-       incline[MAXINC];        /*      current include file line
-                                */
-extern int     radix;          /*      current number conversion radix:
-                                *      2 (binary), 8 (octal), 10 (decimal),
-                                *      16 (hexadecimal)
-                                */
-extern int     line;           /*      current assembler source
-                                *      line number
-                                */
-extern int     page;           /*      current page number
-                                */
-extern int     lop;            /*      current line number on page
-                                */
-extern int     pass;           /*      assembler pass number
-                                */
-extern int     lflag;          /*      -l, generate listing flag
-                                */
-extern int     cflag;          /*      -c, generate sdcdb debug information
-                                */
-extern int     gflag;          /*      -g, make undefined symbols global flag
-                                */
-extern int     aflag;          /*      -a, make all symbols global flag
-                                */
-extern  int    jflag;          /*      -j, generate debug information flag
-                                */
-extern int     oflag;          /*      -o, generate relocatable output flag
-                                */
-extern int     sflag;          /*      -s, generate symbol table flag
-                                */
-extern int     pflag;          /*      -p, enable listing pagination
-                                */
-extern int     xflag;          /*      -x, listing radix flag
-                                */
-extern int     fflag;          /*      -f(f), relocations flagged flag
-                                */
-extern Addr_T  laddr;          /*      address of current assembler line
-                                *      or value of .if argument
-                                */
-extern Addr_T  fuzz;           /*      tracks pass to pass changes in the
-                                *      address of symbols caused by
-                                *      variable length instruction formats
-                                */
-extern int     lmode;          /*      listing mode
-                                */
-extern struct  area    area[]; /*      array of 1 area
-                                */
-extern struct  area *areap;    /*      pointer to an area structure
-                                */
-extern struct  sym     sym[];  /*      array of 1 symbol
-                                */
-extern struct  sym *symp;      /*      pointer to a symbol structure
-                                */
-extern struct  sym *symhash[NHASH]; /* array of pointers to NHASH
-                                     * linked symbol lists
-                                     */
-extern struct  mne *mnehash[NHASH]; /* array of pointers to NHASH
-                                     * linked mnemonic/directive lists
-                                     */
-extern char    *ep;            /*      pointer into error list
-                                *      array eb[NERR]
-                                */
-extern char    eb[NERR];       /*      array of generated error codes
-                                */
-extern char    *ip;            /*      pointer into the assembler-source
-                                *      text line in ib[]
-                                */
-extern char    ib[NINPUT];     /*      assembler-source text line
-                                */
-extern char    *cp;            /*      pointer to assembler output
-                                *      array cb[]
-                                */
-extern char    cb[NCODE];      /*      array of assembler output values
-                                */
-extern int     *cpt;           /*      pointer to assembler relocation type
-                                *      output array cbt[]
-                                */
-extern int     cbt[NCODE];     /*      array of assembler relocation types
-                                *      describing the data in cb[]
-                                */
-extern char    tb[NTITL];      /*      Title string buffer
-                                */
-extern char    stb[NSBTL];     /*      Subtitle string buffer
-                                */
-extern  char   optsdcc[NINPUT];        /*      sdcc compile options
-                        */
-extern         int     flat24Mode;     /*      non-zero if we are using DS390 24 bit
-                                *      flat mode (via .flat24 directive).
-                                */
-extern char    symtbl[];       /*      string "Symbol Table"
-                                */
-extern char    aretbl[];       /*      string "Area Table"
-                                */
-extern char    module[NCPS];   /*      module name string
-                                */
-extern FILE    *lfp;           /*      list output file handle
-                                */
-extern FILE    *ofp;           /*      relocation output file handle
-                                */
-extern FILE    *tfp;           /*      symbol table output file handle
-                                */
-extern FILE    *sfp[MAXFIL];   /*      array of assembler-source file handles
-                                */
-extern FILE    *ifp[MAXINC];   /*      array of include-file file handles
-                                */
-extern unsigned char   ctype[128];     /*      array of character types, one per
-                                *      ASCII character
-                                */
-
-extern char    ccase[128];     /* an array of characters which
-                                * perform the case translation function
-                                */
+extern  int     aserr;          /*      ASxxxx error counter
+                                 */
+extern  jmp_buf jump_env;       /*      compiler dependent structure
+                                 *      used by setjmp() and longjmp()
+                                 */
+extern  int     inpfil;         /*      count of assembler
+                                 *      input files specified
+                                 */
+extern  int     incfil;         /*      current file handle index
+                                 *      for include files
+                                 */
+extern  int     cfile;          /*      current file handle index
+                                 *      of input assembly files
+                                 */
+extern  int     flevel;         /*      IF-ELSE-ENDIF flag will be non
+                                 *      zero for false conditional case
+                                 */
+extern  int     tlevel;         /*      current conditional level
+                                 */
+extern  int     ifcnd[MAXIF+1]; /*      array of IF statement condition
+                                 *      values (0 = FALSE) indexed by tlevel
+                                 */
+extern  int     iflvl[MAXIF+1]; /*      array of IF-ELSE-ENDIF flevel
+                                 *      values indexed by tlevel
+                                 */
+extern  char
+        afn[PATH_MAX];          /*      afile() temporary filespec
+                                 */
+extern  char
+        srcfn[MAXFIL][PATH_MAX];        /*      array of source file names
+                                 */
+extern  int
+        srcline[MAXFIL];        /*      current source file line
+                                 */
+extern  char
+        incfn[MAXINC][PATH_MAX];        /*      array of include file names
+                                 */
+extern  int
+        incline[MAXINC];        /*      current include file line
+                                 */
+extern  int     radix;          /*      current number conversion radix:
+                                 *      2 (binary), 8 (octal), 10 (decimal),
+                                 *      16 (hexadecimal)
+                                 */
+extern  int     line;           /*      current assembler source
+                                 *      line number
+                                 */
+extern  int     page;           /*      current page number
+                                 */
+extern  int     lop;            /*      current line number on page
+                                 */
+extern  int     pass;           /*      assembler pass number
+                                 */
+extern  int     lflag;          /*      -l, generate listing flag
+                                 */
+extern  int     cflag;          /*      -c, generate sdcdb debug information
+                                 */
+extern  int     gflag;          /*      -g, make undefined symbols global flag
+                                 */
+extern  int     aflag;          /*      -a, make all symbols global flag
+                                 */
+extern  int     jflag;          /*      -j, generate debug information flag
+                                 */
+extern  int     oflag;          /*      -o, generate relocatable output flag
+                                 */
+extern  int     sflag;          /*      -s, generate symbol table flag
+                                 */
+extern  int     pflag;          /*      -p, enable listing pagination
+                                 */
+extern  int     xflag;          /*      -x, listing radix flag
+                                 */
+extern  int     fflag;          /*      -f(f), relocations flagged flag
+                                 */
+extern  Addr_T  laddr;          /*      address of current assembler line
+                                 *      or value of .if argument
+                                 */
+extern  Addr_T  fuzz;           /*      tracks pass to pass changes in the
+                                 *      address of symbols caused by
+                                 *      variable length instruction formats
+                                 */
+extern  int     lmode;          /*      listing mode
+                                 */
+extern  struct  area    area[]; /*      array of 1 area
+                                 */
+extern  struct  area *areap;    /*      pointer to an area structure
+                                 */
+extern  struct  sym     sym[];  /*      array of 1 symbol
+                                 */
+extern  struct  sym *symp;      /*      pointer to a symbol structure
+                                 */
+extern  struct  sym *symhash[NHASH]; /* array of pointers to NHASH
+                                      * linked symbol lists
+                                      */
+extern  struct  mne *mnehash[NHASH]; /* array of pointers to NHASH
+                                      * linked mnemonic/directive lists
+                                      */
+extern  char    *ep;            /*      pointer into error list
+                                 *      array eb[NERR]
+                                 */
+extern  char    eb[NERR];       /*      array of generated error codes
+                                 */
+extern  char    *ip;            /*      pointer into the assembler-source
+                                 *      text line in ib[]
+                                 */
+extern  char    ib[NINPUT];     /*      assembler-source text line
+                                 */
+extern  char    *cp;            /*      pointer to assembler output
+                                 *      array cb[]
+                                 */
+extern  char    cb[NCODE];      /*      array of assembler output values
+                                 */
+extern  int     *cpt;           /*      pointer to assembler relocation type
+                                 *      output array cbt[]
+                                 */
+extern  int     cbt[NCODE];     /*      array of assembler relocation types
+                                 *      describing the data in cb[]
+                                 */
+extern  char    tb[NTITL];      /*      Title string buffer
+                                 */
+extern  char    stb[NSBTL];     /*      Subtitle string buffer
+                                 */
+extern  char    optsdcc[NINPUT];        /*      sdcc compile options
+                         */
+extern  int     flat24Mode;     /*      non-zero if we are using DS390 24 bit
+                                 *      flat mode (via .flat24 directive).
+                                 */
+extern  char    symtbl[];       /*      string "Symbol Table"
+                                 */
+extern  char    aretbl[];       /*      string "Area Table"
+                                 */
+extern  char    module[NCPS];   /*      module name string
+                                 */
+extern  FILE    *lfp;           /*      list output file handle
+                                 */
+extern  FILE    *ofp;           /*      relocation output file handle
+                                 */
+extern  FILE    *tfp;           /*      symbol table output file handle
+                                 */
+extern  FILE    *sfp[MAXFIL];   /*      array of assembler-source file handles
+                                 */
+extern  FILE    *ifp[MAXINC];   /*      array of include-file file handles
+                                 */
+extern  unsigned char   ctype[128];     /*      array of character types, one per
+                                 *      ASCII character
+                                 */
+
+extern  char    ccase[128];     /* an array of characters which
+                                 * perform the case translation function
+                                 */
 /*
  * Definitions for Character Types
  */
-#define        SPACE   0000
-#define ETC    0000
-#define        LETTER  0001
-#define        DIGIT   0002
-#define        BINOP   0004
-#define        RAD2    0010
-#define        RAD8    0020
-#define        RAD10   0040
-#define        RAD16   0100
-#define        ILL     0200
-
-#define        DGT2    DIGIT|RAD16|RAD10|RAD8|RAD2
-#define        DGT8    DIGIT|RAD16|RAD10|RAD8
-#define        DGT10   DIGIT|RAD16|RAD10
-#define        LTR16   LETTER|RAD16
+#define SPACE   0000
+#define ETC     0000
+#define LETTER  0001
+#define DIGIT   0002
+#define BINOP   0004
+#define RAD2    0010
+#define RAD8    0020
+#define RAD10   0040
+#define RAD16   0100
+#define ILL     0200
+
+#define DGT2    DIGIT|RAD16|RAD10|RAD8|RAD2
+#define DGT8    DIGIT|RAD16|RAD10|RAD8
+#define DGT10   DIGIT|RAD16|RAD10
+#define LTR16   LETTER|RAD16
 
 /*
- *     The exp structure is used to return the evaluation
- *     of an expression.  The structure supports three valid
- *     cases:
- *     (1)     The expression evaluates to a constant,
- *             mode = S_USER, flag = 0, addr contains the
- *             constant, and base = NULL.
- *     (2)     The expression evaluates to a defined symbol
- *             plus or minus a constant, mode = S_USER,
- *             flag = 0, addr contains the constant, and
- *             base = pointer to area symbol.
- *     (3)     The expression evaluates to a external
- *             global symbol plus or minus a constant,
- *             mode = S_NEW, flag = 1, addr contains the
- *             constant, and base = pointer to symbol.
+ *      The exp structure is used to return the evaluation
+ *      of an expression.  The structure supports three valid
+ *      cases:
+ *      (1)     The expression evaluates to a constant,
+ *              mode = S_USER, flag = 0, addr contains the
+ *              constant, and base = NULL.
+ *      (2)     The expression evaluates to a defined symbol
+ *              plus or minus a constant, mode = S_USER,
+ *              flag = 0, addr contains the constant, and
+ *              base = pointer to area symbol.
+ *      (3)     The expression evaluates to a external
+ *              global symbol plus or minus a constant,
+ *              mode = S_NEW, flag = 1, addr contains the
+ *              constant, and base = pointer to symbol.
  */
-struct expr
+struct  expr
 {
-       char    e_mode;         /* Address mode */
-       char    e_flag;         /* Symbol flag */
-       Addr_T  e_addr;         /* Address */
-       union   {
-               struct area *e_ap;
-               struct sym  *e_sp;
-       } e_base;               /* Rel. base */
-       int     e_rlcf;         /* Rel. flags */
+        char    e_mode;         /* Address mode */
+        char    e_flag;         /* Symbol flag */
+        Addr_T  e_addr;         /* Address */
+        union   {
+                struct area *e_ap;
+                struct sym  *e_sp;
+        } e_base;               /* Rel. base */
+        int     e_rlcf;         /* Rel. flags */
 };
 
 /* C Library functions */
 /* for reference only
-extern VOID            exit();
-extern int             fclose();
-extern char *          fgets();
-extern FILE *          fopen();
-extern int             fprintf();
-extern VOID            longjmp();
-extern VOID *          malloc();
-extern int             printf();
-extern char            putc();
-extern int             rewind();
-extern int             setjmp();
-extern int             strcmp();
-extern char *          strcpy();
-extern int             strlen();
-extern char *          strncpy();
+extern  VOID            exit();
+extern  int             fclose();
+extern  char *          fgets();
+extern  FILE *          fopen();
+extern  int             fprintf();
+extern  VOID            longjmp();
+extern  VOID *          malloc();
+extern  int             printf();
+extern  char            putc();
+extern  int             rewind();
+extern  int             setjmp();
+extern  int             strcmp();
+extern  char *          strcpy();
+extern  int             strlen();
+extern  char *          strncpy();
 */
 
 /* Machine independent functions */
 
 /* asmain.c */
-extern FILE *          afile();
-extern VOID            asexit();
-extern VOID            asmbl();
-extern int             main();
-extern VOID            newdot();
-extern VOID            phase();
-extern VOID            usage();
+extern  FILE *          afile();
+extern  VOID            asexit();
+extern  VOID            asmbl();
+extern  int             main();
+extern  VOID            newdot();
+extern  VOID            phase();
+extern  VOID            usage();
 
 /* aslex.c */
-extern char            endline();
-extern char            get();
-extern VOID            getid();
-extern int             as_getline();
-extern int             getmap();
-extern char            getnb();
-extern VOID            getst();
-extern int             more();
-extern VOID            unget();
-extern VOID            chop_crlf();
+extern  char            endline();
+extern  char            get();
+extern  VOID            getid();
+extern  int             as_getline();
+extern  int             getmap();
+extern  char            getnb();
+extern  VOID            getst();
+extern  int             more();
+extern  VOID            unget();
+extern  VOID            chop_crlf();
 
 /* assym.c */
-extern struct  area *  alookup();
-extern struct  mne *   mlookup();
-extern int             hash();
-extern struct  sym *   lookup();
-extern VOID *          new();
-extern int             symeq();
-extern VOID            syminit();
-extern VOID            symglob();
-extern VOID            allglob();
+extern  struct  area *  alookup();
+extern  struct  mne *   mlookup();
+extern  int             hash();
+extern  struct  sym *   lookup();
+extern  VOID *          new();
+extern  char *          strsto(char *str);
+extern  int             symeq();
+extern  VOID            syminit();
+extern  VOID            symglob();
+extern  VOID            allglob();
 
 /* assubr.c */
-extern VOID            aerr();
-extern VOID            diag();
-extern VOID            err();
-extern         VOID            warnBanner(void);
-extern char *          geterr();
-extern VOID            qerr();
-extern VOID            rerr();
+extern  VOID            aerr();
+extern  VOID            diag();
+extern  VOID            err();
+extern  VOID            warnBanner(void);
+extern  char *          geterr();
+extern  VOID            qerr();
+extern  VOID            rerr();
 
 /* asexpr.c */
-extern VOID            abscheck();
-extern Addr_T          absexpr();
-extern VOID            clrexpr();
-extern int             digit();
-extern int             is_abs();
-extern VOID            expr();
-extern int             oprio();
-extern VOID            term();
+extern  VOID            abscheck();
+extern  Addr_T          absexpr();
+extern  VOID            clrexpr();
+extern  int             digit();
+extern  int             is_abs();
+extern  VOID            expr();
+extern  int             oprio();
+extern  VOID            term();
 
 /* aslist.c */
-extern VOID            list();
-extern VOID            list1();
-extern VOID            list2();
-extern VOID            lstsym();
-extern VOID            slew();
+extern  VOID            list();
+extern  VOID            list1();
+extern  VOID            list2();
+extern  VOID            lstsym();
+extern  VOID            slew();
 
 /* asout.c */
-extern int             hibyte();
-extern int             lobyte();
-extern         int             byte3(int);
-extern VOID            out();
-extern VOID            outab();
-extern VOID            outarea();
-extern VOID            outaw();
-extern VOID            outall();
-extern VOID            outdot();
-extern VOID            outbuf();
-extern VOID            outchk();
-extern VOID            outgsd();
-extern VOID            outrb();
-extern VOID            outrw(struct expr *, int);
-extern VOID            outr24(struct expr *, int);
-extern VOID            outsym();
-extern VOID            out_lb();
-extern VOID            out_lw();
-extern VOID            out_l24(int, int);
-extern VOID            out_rw();
-extern VOID            out_tw();
-extern VOID            out_t24(int);
-extern VOID            outr11();       /* JLH */
-extern VOID            outr19(struct expr *, int, int);
-extern  VOID           outdp(struct area *, struct expr *);
+extern  int             hibyte();
+extern  int             lobyte();
+extern  int             byte3(int);
+extern  VOID            out();
+extern  VOID            outab();
+extern  VOID            outarea();
+extern  VOID            outaw();
+extern  VOID            outall();
+extern  VOID            outdot();
+extern  VOID            outbuf();
+extern  VOID            outchk();
+extern  VOID            outgsd();
+extern  VOID            outrb();
+extern  VOID            outrw(struct expr *, int);
+extern  VOID            outr24(struct expr *, int);
+extern  VOID            outsym();
+extern  VOID            out_lb();
+extern  VOID            out_lw();
+extern  VOID            out_l24(int, int);
+extern  VOID            out_rw();
+extern  VOID            out_tw();
+extern  VOID            out_t24(int);
+extern  VOID            outr11();       /* JLH */
+extern  VOID            outr19(struct expr *, int, int);
+extern  VOID            outdp(struct area *, struct expr *);
 
 /* asstore.c */
 extern char *StoreString( char *str );
@@ -675,15 +676,15 @@ extern void DefineCDB_Line();
 
 /* Machine dependent variables */
 
-extern char *          cpu;
-extern char *          dsft;
-extern int             hilo;
-extern struct  mne     mne[];
+extern  char *          cpu;
+extern  char *          dsft;
+extern  int             hilo;
+extern  struct  mne     mne[];
 
 /* Machine dependent functions */
 
-extern VOID            minit();
-extern VOID            machine(struct mne *);
+extern  VOID            minit();
+extern  VOID            machine(struct mne *);
 
 /* strcmpi.c */
 extern  int as_strcmpi(const char *s1, const char *s2);
diff --git a/as/hc08/assym.c b/as/hc08/assym.c
deleted file mode 100644 (file)
index 996cd32..0000000
+++ /dev/null
@@ -1,436 +0,0 @@
-/* assym.c */
-
-/*
- * (C) Copyright 1989-1995
- * All Rights Reserved
- *
- * Alan R. Baldwin
- * 721 Berkeley St.
- * Kent, Ohio  44240
- *
- * 28-Oct-97 JLH:
- *          - lookup: Use StoreString for sym construction
- *          - change symeq() to do length-independent string compare
- *          - change hash() to do length-independent hash calculation
- * 29-Oct-97 JLH:
- *           - make mnemonics case insensitive ALWAYS
- *           - make hash() case-insensitive always
- *           - replace symeq() call in mlookup with strcmpi
- */
-
-#include <stdio.h>
-#include <setjmp.h>
-#include <string.h>
-#include <stdlib.h>
-#include "asm.h"
-
-/*)Module      assym.c
- *
- *     The module assym.c contains the functions that operate
- *     on the mnemonic/directive and symbol structures.
- *
- *     assym.c contains the following functions:
- *             VOID    allglob()
- *             area *  alookup()
- *             int     hash()
- *             sym *   lookup()
- *             mne *   mlookup()
- *             VOID *  new()
- *             int     symeq()
- *             VOID    syminit()
- *             VOID    symglob()
- *
- *     assym.c contains no local/static variables.
- */
-
-/*)Function    VOID    syminit()
- *
- *     The function syminit() is called early in the game
- *     to set up the hashtables.  First all buckets in a
- *     table are cleared.  Then a pass is made through
- *     the respective symbol lists, linking them into
- *     their hash buckets.  Finally the base area pointer
- *     is set to 'dca'.
- *
- *     local variables:
- *             int     h               computed hash value
- *             mne *   mp              pointer to a mne structure
- *             mne **  mpp             pointer to an array of
- *                                     mne structure pointers
- *             sym *   sp              pointer to a sym structure
- *             sym **  spp             pointer to an array of
- *                                     sym structure pointers
- *
- *     global variables:
- *             area    area[]          single elememt area array
- *             area    dca             defined as area[0]
- *             mne * mnehash[]         array of pointers to NHASH
- *                                     linked mnemonic/directive lists
- *             sym * symhash[]         array of pointers to NHASH
- *                                     linked symbol lists
- *
- *     functions called:
- *             none
- *
- *     side effects:
- *             (1)     The symbol hash tables are initialized,
- *                     the only defined symbol is '.'.
- *             (2)     The mnemonic/directive hash tables are
- *                     initialized with the assembler directives
- *                     and mnemonics found in the machine dependent
- *                     file ___pst.c.
- *             (3)     The area pointer is initialized to dca (area[0]).
- */
-
-VOID
-syminit()
-{
-       register struct mne  *mp;
-       struct mne **mpp;
-       register struct sym  *sp;
-       struct sym **spp;
-       register int h;
-
-       mpp = &mnehash[0];
-       while (mpp < &mnehash[NHASH])
-               *mpp++ = NULL;
-       mp = &mne[0];
-       for (;;) {
-               h = hash(mp->m_id);
-               mp->m_mp = mnehash[h];
-               mnehash[h] = mp;
-               if (mp->m_flag&S_END)
-                       break;
-               ++mp;
-       }
-
-       spp = &symhash[0];
-       while (spp < &symhash[NHASH])
-               *spp++ = NULL;
-       sp = &sym[0];
-       for (;;) {
-               h = hash(sp->s_id);
-               sp->s_sp = symhash[h];
-               symhash[h] = sp;
-               if (sp->s_flag&S_END)
-                       break;
-               ++sp;
-       }
-
-       areap = &dca;
-}
-
-/*)Function    area *  alookup(id)
- *
- *             char *  id              area name string
- *
- *     The function alookup() searches the area list for a
- *     match with id.  If the area is defined then a pointer
- *     to this area is returned else a NULL is returned.
- *
- *     local variables:
- *             area *  ap              pointer to area structure
- *
- *     global variables:
- *             area *  areap           pointer to an area structure
- *
- *     functions called:
- *             int     symeq()         assym.c
- *
- *     side effects:
- *             none
- */
-
-struct area *
-alookup(id)
-char *id;
-{
-       register struct area *ap;
-
-       ap = areap;
-       while (ap) {
-               if (symeq(id, ap->a_id)) {
-                       return (ap);
-               }
-               ap = ap->a_ap;
-       }
-       return(NULL);
-}
-
-/*)Function    mne *   mlookup(id)
- *
- *             char *  id              mnemonic/directive name string
- *
- *     The function mlookup() searches the mnemonic/directive
- *     hash tables for a match returning a pointer to the
- *     mne structure else it returns a NULL.
- *
- *     local variables:
- *             mne *   mp              pointer to mne structure
- *             int     h               calculated hash value
- *
- *     global variables:
- *             mne * mnehash[]         array of pointers to NHASH
- *                                     linked mnemonic/directive lists
- *
- *     functions called:
- *             none
- *
- *     side effects:
- *             none
- */
-
-struct mne *
-mlookup(id)
-char *id;
-{
-       register struct mne *mp;
-       register int h;
-
-       h = hash(id);
-       mp = mnehash[h];
-       while (mp) {
-               if (as_strcmpi(id, mp->m_id) == 0)      /* JLH: case insensitive */
-                       return (mp);
-               mp = mp->m_mp;
-       }
-       return (NULL);
-}
-
-/*)Function    sym *   lookup(id)
- *
- *             char *  id              symbol name string
- *
- *     The function lookup() searches the symbol hash tables for
- *     a symbol name match returning a pointer to the sym structure.
- *     If the symbol is not found then a sym structure is created,
- *     initialized, and linked to the appropriate hash table.
- *     A pointer to this new sym structure is returned.
- *
- *     local variables:
- *             int     h               computed hash value
- *             sym *   sp              pointer to a sym structure
- *
- *     global varaibles:
- *             sym * symhash[]         array of pointers to NHASH
- *                                     linked symbol lists
- *
- *     functions called:
- *             int     hash()          assym.c
- *             VOID *  new()           assym.c
- *             int     symeq()         assym.c
- *
- *     side effects:
- *             If the function new() fails to allocate space
- *             for the new sym structure the assembly terminates.
- */
-
-struct sym *
-lookup(id)
-char *id;
-{
-       register struct sym *sp;
-       register int h;
-
-       h = hash(id);
-       sp = symhash[h];
-       while (sp) {
-               if (symeq(id, sp->s_id))
-                       return (sp);
-               sp = sp->s_sp;
-       }
-       sp = (struct sym *) new (sizeof(struct sym));
-       sp->s_sp = symhash[h];
-       symhash[h] = sp;
-       sp->s_tsym = NULL;
-       sp->s_id = StoreString( id ); /* JLH */
-       sp->s_type = S_NEW;
-       sp->s_flag = 0;
-       sp->s_area = NULL;
-       sp->s_ref = 0;
-       sp->s_addr = 0;
-       return (sp);
-}
-
-/*)Function    VOID    symglob()
- *
- *     The function symglob() will mark all symbols of
- *     type S_NEW as global.  Called at the beginning of pass 1
- *     if the assembly option -g was specified.
- *
- *     local variables:
- *             sym *   sp              pointer to a sym structure
- *             int     i               loop index
- *
- *     global variables:
- *             sym * symhash[]         array of pointers to NHASH
- *                                     linked symbol lists
- *
- *     functions called:
- *             none
- *
- *     side effects:
- *             Symbol types changed.
- */
-
-VOID
-symglob()
-{
-       register struct sym *sp;
-       register int i;
-
-       for (i=0; i<NHASH; ++i) {
-               sp = symhash[i];
-               while (sp != NULL) {
-                       if (sp->s_type == S_NEW)
-                               sp->s_flag |= S_GBL;
-                       sp = sp->s_sp;
-               }
-       }
-}
-
-/*)Function    VOID    allglob()
- *
- *     The function allglob() will mark all symbols of
- *     type S_USER as global.  Called at the beginning of pass 1
- *     if the assembly option -a was specified.
- *
- *     local variables:
- *             sym *   sp              pointer to a sym structure
- *             int     i               loop index
- *
- *     global variables:
- *             sym * symhash[]         array of pointers to NHASH
- *                                     linked symbol lists
- *
- *     functions called:
- *             none
- *
- *     side effects:
- *             Symbol types changed.
- */
-
-VOID
-allglob()
-{
-       register struct sym *sp;
-       register int i;
-
-       for (i=0; i<NHASH; ++i) {
-               sp = symhash[i];
-               while (sp != NULL) {
-                       if (sp != &dot && sp->s_type == S_USER)
-                               sp->s_flag |= S_GBL;
-                       sp = sp->s_sp;
-               }
-       }
-}
-
-/*)Function    int     symeq(p1, p2)
- *
- *             char *  p1              name string
- *             char *  p2              name string
- *
- *     The function symeq() compares the two name strings for a match.
- *     The return value is 1 for a match and 0 for no match.
- *
- *     local variables:
- *             int     h               loop counter
- *
- *     global variables:
- *             char    ccase[]         an array of characters which
- *                                     perform the case translation function
- *
- *     functions called:
- *             none
- *
- *     side effects:
- *             none
- *
- */
-
-int
-symeq(p1, p2)
-register char *p1, *p2;
-{
-#if    CASE_SENSITIVE
-               return (strcmp( p1, p2 ) == 0);
-#else
-               return (as_strcmpi( p1, p2 ) == 0);
-#endif
-}
-
-/*)Function    int     hash(p)
- *
- *             char *  p               pointer to string to hash
- *
- *     The function hash() computes a hash code using the sum
- *     of all characters mod table size algorithm.
- *
- *     local variables:
- *             int     h               accumulated character sum
- *             int     n               loop counter
- *
- *     global variables:
- *             char    ccase[]         an array of characters which
- *                                     perform the case translation function
- *
- *     functions called:
- *             none
- *
- *     side effects:
- *             none
- */
-
-int
-hash(p)
-register char *p;
-{
-       register int h;
-
-       h = 0;
-       while (*p) {
-               /* JLH: case insensitive hash:  Doesn't much affect
-                 * hashing, and allows same function for mnemonics and symbols
-                 */
-               h += ccase[(int)*p++];
-       }
-       return (h&HMASK);
-}
-
-/*)Function    VOID *  new(n)
- *
- *             unsigned int    n       allocation size in bytes
- *
- *     The function new() allocates n bytes of space and returns
- *     a pointer to this memory.  If no space is available the
- *     assembly is terminated.
- *
- *     local variables:
- *             VOID *  p               a general pointer
- *
- *     global variables:
- *             none
- *
- *     functions called:
- *             VOID    asexit()        asmain.c
- *             int     fprintf()       c_library
- *             VOID *  malloc()        c_library
- *
- *     side effects:
- *             Memory is allocated, if allocation fails
- *             the assembly is terminated.
- */
-
-VOID *
-new(n)
-unsigned int n;
-{
-       register VOID *p;
-
-       if ((p = (VOID *) malloc(n)) == NULL) {
-               fprintf(stderr, "Out of space!\n");
-               asexit(1);
-       }
-       return (p);
-}
index b64ff7bbb3a15a2dcbaa0737c145609e821c2705..8db4b06c6cee49908892e9f306713663dcaedd01 100644 (file)
@@ -10,7 +10,7 @@ LKOBJECTS       = lkmain.obj lkarea.obj lkihx.obj \
                   ../lkaomf51.obj ../lkdata.obj \
                   ../lkeval.obj ../lkhead.obj ../lklex.obj ../lklist.obj \
                   ../lknoice.obj ../lkstore.obj ../lksym.obj \
-                  ../../strcmpi.obj
+                  ../../asxxsrc/strcmpi.obj
 
 ASLINK          = $(PRJDIR)/bin/aslink.exe
 
index 12bdd6cfe0776bc600b1112ca787557d4e4d1bae..a7016b0e27aed340f38e88a8ebff0740aedaec56 100644 (file)
@@ -44,7 +44,7 @@ LKOBJECTS     = lkmain.o lkarea.o lkihx.o \
                          ../lkaomf51.o ../lkdata.o \
                          ../lkeval.o ../lkhead.o ../lklex.o ../lklist.o  \
                          ../lknoice.o ../lkstore.o ../lksym.o \
-                         ../../strcmpi.o
+                         ../../asxxsrc/strcmpi.o
 LKSOURCES      = $(patsubst %.o,%.c,$(LKOBJECTS))
 
 ASLINK         = $(top_builddir)/bin/link-hc08$(EXEEXT)
index bdf7925b7b371de9700ee93c5aa1e8a0a03dcfc5..d6b9709ed4b1676b89993be86ab829fd0328f7ab 100644 (file)
@@ -7,19 +7,19 @@
 CFG=link_hc08 - Win32 Debug\r
 !MESSAGE This is not a valid makefile. To build this project using NMAKE,\r
 !MESSAGE use the Export Makefile command and run\r
-!MESSAGE\r
+!MESSAGE \r
 !MESSAGE NMAKE /f "link_hc08.mak".\r
-!MESSAGE\r
+!MESSAGE \r
 !MESSAGE You can specify a configuration when running NMAKE\r
 !MESSAGE by defining the macro CFG on the command line. For example:\r
-!MESSAGE\r
+!MESSAGE \r
 !MESSAGE NMAKE /f "link_hc08.mak" CFG="link_hc08 - Win32 Debug"\r
-!MESSAGE\r
+!MESSAGE \r
 !MESSAGE Possible choices for configuration are:\r
-!MESSAGE\r
+!MESSAGE \r
 !MESSAGE "link_hc08 - Win32 Release" (based on "Win32 (x86) Console Application")\r
 !MESSAGE "link_hc08 - Win32 Debug" (based on "Win32 (x86) Console Application")\r
-!MESSAGE\r
+!MESSAGE \r
 \r
 # Begin Project\r
 # PROP AllowPerConfigDependencies 0\r
@@ -76,7 +76,7 @@ LINK32=link.exe
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /debug /machine:I386 /out:"..\..\..\bin_vc\link-hc08.exe" /pdbtype:sept\r
 \r
-!ENDIF\r
+!ENDIF \r
 \r
 # Begin Target\r
 \r
@@ -155,7 +155,7 @@ SOURCE=..\lksym.c
 # End Source File\r
 # Begin Source File\r
 \r
-SOURCE=..\..\strcmpi.c\r
+SOURCE=..\..\asxxsrc\strcmpi.c\r
 # End Source File\r
 # End Group\r
 # Begin Group "Header Files"\r
index b64ff7bbb3a15a2dcbaa0737c145609e821c2705..8db4b06c6cee49908892e9f306713663dcaedd01 100644 (file)
@@ -10,7 +10,7 @@ LKOBJECTS       = lkmain.obj lkarea.obj lkihx.obj \
                   ../lkaomf51.obj ../lkdata.obj \
                   ../lkeval.obj ../lkhead.obj ../lklex.obj ../lklist.obj \
                   ../lknoice.obj ../lkstore.obj ../lksym.obj \
-                  ../../strcmpi.obj
+                  ../../asxxsrc/strcmpi.obj
 
 ASLINK          = $(PRJDIR)/bin/aslink.exe
 
index 31116f00e83dc7bd1995717024f1a2d900942983..0ce2f4a115ccaf48f3096898f97062702d671f65 100644 (file)
@@ -44,7 +44,7 @@ LKOBJECTS       = lkmain.o lkarea.o lkihx.o \
                   ../lkaomf51.o ../lkdata.o \
                   ../lkeval.o ../lkhead.o ../lklex.o ../lklist.o \
                   ../lknoice.o ../lkstore.o ../lksym.o \
-                  ../../strcmpi.o
+                  ../../asxxsrc/strcmpi.o
 LKSOURCES       = $(patsubst %.o,%.c,$(LKOBJECTS))
 
 ASLINK          = $(top_builddir)/bin/aslink$(EXEEXT)
index 8d88bcda3805cb36b7ea59497f0904b36430e628..c185fa6dee33400c98810bad6ce979b0e66bb399 100644 (file)
@@ -152,7 +152,7 @@ SOURCE=..\lksym.c
 # End Source File\r
 # Begin Source File\r
 \r
-SOURCE=..\..\strcmpi.c\r
+SOURCE=..\..\asxxsrc\strcmpi.c\r
 # End Source File\r
 # End Group\r
 # Begin Group "Header Files"\r
index 607143d354a380c0aeb5ff07e2779055aad74408..3b97da28c1d72843045258c2733c69b939a569a8 100644 (file)
@@ -15,7 +15,7 @@ SRC   = lkmain.c lkarea.c lkihx.c \
          ../lkaomf51.c ../lkdata.c \
          ../lkeval.c ../lkhead.c ../lklex.c ../lklist.c \
          ../lknoice.c ../lkstore.c ../lksym.c \
-         ../../strcmpi.c
+         ../../asxxsrc/strcmpi.c
 
 OBJS   = $(SRC:%.c=$(OBJDIR)/%.o)
 SLIBOBJS       = $(SLIBSRC:%.c=$(OBJDIR)/%.o)
index 00d4f09f6954e7eef172f6754a7cbbbd26781c4d..d8dab4cbaa39ac686c95b82f6a8ce955f09bbfa3 100644 (file)
@@ -174,7 +174,7 @@ SOURCE=..\lksym.c
 # End Source File\r
 # Begin Source File\r
 \r
-SOURCE=..\..\strcmpi.c\r
+SOURCE=..\..\asxxsrc\strcmpi.c\r
 # End Source File\r
 # End Group\r
 # Begin Group "Header Files"\r
index a8ac124e60e04fdca1a6d3e1917e35bb72805a56..8f9cfca24de3c79325242d94b0d357d60527d5fc 100644 (file)
@@ -174,7 +174,7 @@ SOURCE=..\lksym.c
 # End Source File\r
 # Begin Source File\r
 \r
-SOURCE=..\..\strcmpi.c\r
+SOURCE=..\..\asxxsrc\strcmpi.c\r
 # End Source File\r
 # End Group\r
 # Begin Group "Header Files"\r
index 758760781b57f213cac2b9bb39323e5c6e81aa09..72639819f8c1d93b7184785c352f70f84c659053 100644 (file)
@@ -4,10 +4,10 @@ PRJDIR          = ../..
 
 !include $(PRJDIR)/Bcc.inc
 
-ASOBJECTS       = asmain.obj aslex.obj assym.obj assubr.obj asnoice.obj \
+ASOBJECTS       = asmain.obj aslex.obj assubr.obj asnoice.obj \
                   asexpr.obj asdata.obj aslist.obj asout.obj asstore.obj \
                   i51ext.obj i51pst.obj i51mch.obj i51adr.obj \
-                  ../strcmpi.obj
+                  ../asxxsrc/strcmpi.obj ../asxxsrc/assym.obj
 
 ASX8051         = $(PRJDIR)/bin/asx8051.exe
 
index f708d56132a15e6de3df974ca7ec2ae32b532601..c73d151436fe236f1a57c21044c3f873b0ae777a 100644 (file)
@@ -7,17 +7,17 @@ VERSIONHI       = @VERSIONHI@
 VERSIONLO       = @VERSIONLO@
 VERSIONP        = @VERSIONP@
 
-SHELL          = /bin/sh
-CC             = @CC@
-CPP            = @CPP@
-INSTALL                = @INSTALL@
+SHELL           = /bin/sh
+CC              = @CC@
+CPP             = @CPP@
+INSTALL         = @INSTALL@
 STRIP           = @STRIP@
 
-top_builddir   = @top_builddir@
-top_srcdir     = @top_srcdir@
+top_builddir    = @top_builddir@
+top_srcdir      = @top_srcdir@
 
-srcdir         = @srcdir@
-prefix         = @prefix@
+srcdir          = @srcdir@
+prefix          = @prefix@
 exec_prefix     = @exec_prefix@
 bindir          = @bindir@
 libdir          = @libdir@
@@ -33,18 +33,28 @@ EXEEXT          = @EXEEXT@
 
 VPATH           = @srcdir@
 
-CPPFLAGS       = @CPPFLAGS@ -I. -I$(srcdir)
-CFLAGS         = @CFLAGS@ -Wall -DINDEXLIB
-M_OR_MM                = @M_OR_MM@
-LDFLAGS                = @LDFLAGS@
+CPPFLAGS        = @CPPFLAGS@ -I. -I$(srcdir)
+CFLAGS          = @CFLAGS@ -Wall -DINDEXLIB -I. -I$(srcdir)
+M_OR_MM         = @M_OR_MM@
+LDFLAGS         = @LDFLAGS@
 
-ASOBJECTS      = asmain.o aslex.o assym.o assubr.o asnoice.o \
-                 asexpr.o asdata.o aslist.o asout.o asstore.o \
-                 i51ext.o i51pst.o i51mch.o i51adr.o \
-                 ../strcmpi.o
-ASSOURCES      = $(patsubst %.o,%.c,$(ASOBJECTS))
+OBJDIR = obj
 
-ASX8051                = $(top_builddir)/bin/asx8051$(EXEEXT)
+ASXXLIB = $(srcdir)/../asxxsrc
+
+ASXXLIBSRC = strcmpi.c assym.c
+
+SRC = asmain.c aslex.c assubr.c asnoice.c \
+      asexpr.c asdata.c aslist.c asout.c asstore.c \
+      i51ext.c i51pst.c i51mch.c i51adr.c
+
+ASSOURCES = %(SRC) $(ASXXLIBSRC:%.c=$(ASXXLIB)/%.c)
+                  
+OBJS = $(SRC:%.c=$(OBJDIR)/%.o)
+ASXXLIBOBJS = $(ASXXLIBSRC:%.c=$(OBJDIR)/%.o)
+ASOBJECTS = $(OBJS) $(ASXXLIBOBJS)
+
+ASX8051 = $(top_builddir)/bin/asx8051$(EXEEXT)
 
 transform       = @program_transform_name@
 
@@ -87,7 +97,7 @@ installdirs:
 # ---------------------
 dep: Makefile.dep
 
-Makefile.dep: $(ASSOURCES) $(srcdir)/*.h $(top_builddir)/*.h $(top_srcdir)/*.h
+Makefile.dep: $(ASSOURCES) $(srcdir)/*.h
        $(CPP) $(CPPFLAGS) $(M_OR_MM) $(filter %.c,$^) >Makefile.dep
 
 ifeq "$(findstring $(MAKECMDGOALS),uninstall check installcheck installdirs \
@@ -98,8 +108,15 @@ include $(srcdir)/clean.mk
 
 # My rules
 # --------
-.c.o:
-       $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
+$(OBJDIR)/.stamp:
+       mkdir -p $(OBJDIR)
+       touch $(OBJDIR)/.stamp
+
+$(OBJDIR)/%.o: %.c $(OBJDIR)/.stamp
+       $(CC) -c $(CFLAGS) -o $@ $<
+
+$(OBJDIR)/%.o: $(ASXXLIB)/%.c $(OBJDIR)/.stamp
+       $(CC) -c $(CFLAGS) -o $@ $<
 
 
 # Remaking configuration
index 08f9bcb18bafd1e7a10a319785dc0291b1260682..3dd84bce187e693e0ecc0b4ebff20f0e189eef1c 100644 (file)
@@ -623,6 +623,7 @@ extern  struct  mne *   mlookup();
 extern  int             hash();
 extern  struct  sym *   lookup();
 extern  VOID *          new();
+extern  char *          strsto(char *str);
 extern  int             symeq();
 extern  VOID            syminit();
 extern  VOID            symglob();
diff --git a/as/mcs51/assym.c b/as/mcs51/assym.c
deleted file mode 100644 (file)
index 996cd32..0000000
+++ /dev/null
@@ -1,436 +0,0 @@
-/* assym.c */
-
-/*
- * (C) Copyright 1989-1995
- * All Rights Reserved
- *
- * Alan R. Baldwin
- * 721 Berkeley St.
- * Kent, Ohio  44240
- *
- * 28-Oct-97 JLH:
- *          - lookup: Use StoreString for sym construction
- *          - change symeq() to do length-independent string compare
- *          - change hash() to do length-independent hash calculation
- * 29-Oct-97 JLH:
- *           - make mnemonics case insensitive ALWAYS
- *           - make hash() case-insensitive always
- *           - replace symeq() call in mlookup with strcmpi
- */
-
-#include <stdio.h>
-#include <setjmp.h>
-#include <string.h>
-#include <stdlib.h>
-#include "asm.h"
-
-/*)Module      assym.c
- *
- *     The module assym.c contains the functions that operate
- *     on the mnemonic/directive and symbol structures.
- *
- *     assym.c contains the following functions:
- *             VOID    allglob()
- *             area *  alookup()
- *             int     hash()
- *             sym *   lookup()
- *             mne *   mlookup()
- *             VOID *  new()
- *             int     symeq()
- *             VOID    syminit()
- *             VOID    symglob()
- *
- *     assym.c contains no local/static variables.
- */
-
-/*)Function    VOID    syminit()
- *
- *     The function syminit() is called early in the game
- *     to set up the hashtables.  First all buckets in a
- *     table are cleared.  Then a pass is made through
- *     the respective symbol lists, linking them into
- *     their hash buckets.  Finally the base area pointer
- *     is set to 'dca'.
- *
- *     local variables:
- *             int     h               computed hash value
- *             mne *   mp              pointer to a mne structure
- *             mne **  mpp             pointer to an array of
- *                                     mne structure pointers
- *             sym *   sp              pointer to a sym structure
- *             sym **  spp             pointer to an array of
- *                                     sym structure pointers
- *
- *     global variables:
- *             area    area[]          single elememt area array
- *             area    dca             defined as area[0]
- *             mne * mnehash[]         array of pointers to NHASH
- *                                     linked mnemonic/directive lists
- *             sym * symhash[]         array of pointers to NHASH
- *                                     linked symbol lists
- *
- *     functions called:
- *             none
- *
- *     side effects:
- *             (1)     The symbol hash tables are initialized,
- *                     the only defined symbol is '.'.
- *             (2)     The mnemonic/directive hash tables are
- *                     initialized with the assembler directives
- *                     and mnemonics found in the machine dependent
- *                     file ___pst.c.
- *             (3)     The area pointer is initialized to dca (area[0]).
- */
-
-VOID
-syminit()
-{
-       register struct mne  *mp;
-       struct mne **mpp;
-       register struct sym  *sp;
-       struct sym **spp;
-       register int h;
-
-       mpp = &mnehash[0];
-       while (mpp < &mnehash[NHASH])
-               *mpp++ = NULL;
-       mp = &mne[0];
-       for (;;) {
-               h = hash(mp->m_id);
-               mp->m_mp = mnehash[h];
-               mnehash[h] = mp;
-               if (mp->m_flag&S_END)
-                       break;
-               ++mp;
-       }
-
-       spp = &symhash[0];
-       while (spp < &symhash[NHASH])
-               *spp++ = NULL;
-       sp = &sym[0];
-       for (;;) {
-               h = hash(sp->s_id);
-               sp->s_sp = symhash[h];
-               symhash[h] = sp;
-               if (sp->s_flag&S_END)
-                       break;
-               ++sp;
-       }
-
-       areap = &dca;
-}
-
-/*)Function    area *  alookup(id)
- *
- *             char *  id              area name string
- *
- *     The function alookup() searches the area list for a
- *     match with id.  If the area is defined then a pointer
- *     to this area is returned else a NULL is returned.
- *
- *     local variables:
- *             area *  ap              pointer to area structure
- *
- *     global variables:
- *             area *  areap           pointer to an area structure
- *
- *     functions called:
- *             int     symeq()         assym.c
- *
- *     side effects:
- *             none
- */
-
-struct area *
-alookup(id)
-char *id;
-{
-       register struct area *ap;
-
-       ap = areap;
-       while (ap) {
-               if (symeq(id, ap->a_id)) {
-                       return (ap);
-               }
-               ap = ap->a_ap;
-       }
-       return(NULL);
-}
-
-/*)Function    mne *   mlookup(id)
- *
- *             char *  id              mnemonic/directive name string
- *
- *     The function mlookup() searches the mnemonic/directive
- *     hash tables for a match returning a pointer to the
- *     mne structure else it returns a NULL.
- *
- *     local variables:
- *             mne *   mp              pointer to mne structure
- *             int     h               calculated hash value
- *
- *     global variables:
- *             mne * mnehash[]         array of pointers to NHASH
- *                                     linked mnemonic/directive lists
- *
- *     functions called:
- *             none
- *
- *     side effects:
- *             none
- */
-
-struct mne *
-mlookup(id)
-char *id;
-{
-       register struct mne *mp;
-       register int h;
-
-       h = hash(id);
-       mp = mnehash[h];
-       while (mp) {
-               if (as_strcmpi(id, mp->m_id) == 0)      /* JLH: case insensitive */
-                       return (mp);
-               mp = mp->m_mp;
-       }
-       return (NULL);
-}
-
-/*)Function    sym *   lookup(id)
- *
- *             char *  id              symbol name string
- *
- *     The function lookup() searches the symbol hash tables for
- *     a symbol name match returning a pointer to the sym structure.
- *     If the symbol is not found then a sym structure is created,
- *     initialized, and linked to the appropriate hash table.
- *     A pointer to this new sym structure is returned.
- *
- *     local variables:
- *             int     h               computed hash value
- *             sym *   sp              pointer to a sym structure
- *
- *     global varaibles:
- *             sym * symhash[]         array of pointers to NHASH
- *                                     linked symbol lists
- *
- *     functions called:
- *             int     hash()          assym.c
- *             VOID *  new()           assym.c
- *             int     symeq()         assym.c
- *
- *     side effects:
- *             If the function new() fails to allocate space
- *             for the new sym structure the assembly terminates.
- */
-
-struct sym *
-lookup(id)
-char *id;
-{
-       register struct sym *sp;
-       register int h;
-
-       h = hash(id);
-       sp = symhash[h];
-       while (sp) {
-               if (symeq(id, sp->s_id))
-                       return (sp);
-               sp = sp->s_sp;
-       }
-       sp = (struct sym *) new (sizeof(struct sym));
-       sp->s_sp = symhash[h];
-       symhash[h] = sp;
-       sp->s_tsym = NULL;
-       sp->s_id = StoreString( id ); /* JLH */
-       sp->s_type = S_NEW;
-       sp->s_flag = 0;
-       sp->s_area = NULL;
-       sp->s_ref = 0;
-       sp->s_addr = 0;
-       return (sp);
-}
-
-/*)Function    VOID    symglob()
- *
- *     The function symglob() will mark all symbols of
- *     type S_NEW as global.  Called at the beginning of pass 1
- *     if the assembly option -g was specified.
- *
- *     local variables:
- *             sym *   sp              pointer to a sym structure
- *             int     i               loop index
- *
- *     global variables:
- *             sym * symhash[]         array of pointers to NHASH
- *                                     linked symbol lists
- *
- *     functions called:
- *             none
- *
- *     side effects:
- *             Symbol types changed.
- */
-
-VOID
-symglob()
-{
-       register struct sym *sp;
-       register int i;
-
-       for (i=0; i<NHASH; ++i) {
-               sp = symhash[i];
-               while (sp != NULL) {
-                       if (sp->s_type == S_NEW)
-                               sp->s_flag |= S_GBL;
-                       sp = sp->s_sp;
-               }
-       }
-}
-
-/*)Function    VOID    allglob()
- *
- *     The function allglob() will mark all symbols of
- *     type S_USER as global.  Called at the beginning of pass 1
- *     if the assembly option -a was specified.
- *
- *     local variables:
- *             sym *   sp              pointer to a sym structure
- *             int     i               loop index
- *
- *     global variables:
- *             sym * symhash[]         array of pointers to NHASH
- *                                     linked symbol lists
- *
- *     functions called:
- *             none
- *
- *     side effects:
- *             Symbol types changed.
- */
-
-VOID
-allglob()
-{
-       register struct sym *sp;
-       register int i;
-
-       for (i=0; i<NHASH; ++i) {
-               sp = symhash[i];
-               while (sp != NULL) {
-                       if (sp != &dot && sp->s_type == S_USER)
-                               sp->s_flag |= S_GBL;
-                       sp = sp->s_sp;
-               }
-       }
-}
-
-/*)Function    int     symeq(p1, p2)
- *
- *             char *  p1              name string
- *             char *  p2              name string
- *
- *     The function symeq() compares the two name strings for a match.
- *     The return value is 1 for a match and 0 for no match.
- *
- *     local variables:
- *             int     h               loop counter
- *
- *     global variables:
- *             char    ccase[]         an array of characters which
- *                                     perform the case translation function
- *
- *     functions called:
- *             none
- *
- *     side effects:
- *             none
- *
- */
-
-int
-symeq(p1, p2)
-register char *p1, *p2;
-{
-#if    CASE_SENSITIVE
-               return (strcmp( p1, p2 ) == 0);
-#else
-               return (as_strcmpi( p1, p2 ) == 0);
-#endif
-}
-
-/*)Function    int     hash(p)
- *
- *             char *  p               pointer to string to hash
- *
- *     The function hash() computes a hash code using the sum
- *     of all characters mod table size algorithm.
- *
- *     local variables:
- *             int     h               accumulated character sum
- *             int     n               loop counter
- *
- *     global variables:
- *             char    ccase[]         an array of characters which
- *                                     perform the case translation function
- *
- *     functions called:
- *             none
- *
- *     side effects:
- *             none
- */
-
-int
-hash(p)
-register char *p;
-{
-       register int h;
-
-       h = 0;
-       while (*p) {
-               /* JLH: case insensitive hash:  Doesn't much affect
-                 * hashing, and allows same function for mnemonics and symbols
-                 */
-               h += ccase[(int)*p++];
-       }
-       return (h&HMASK);
-}
-
-/*)Function    VOID *  new(n)
- *
- *             unsigned int    n       allocation size in bytes
- *
- *     The function new() allocates n bytes of space and returns
- *     a pointer to this memory.  If no space is available the
- *     assembly is terminated.
- *
- *     local variables:
- *             VOID *  p               a general pointer
- *
- *     global variables:
- *             none
- *
- *     functions called:
- *             VOID    asexit()        asmain.c
- *             int     fprintf()       c_library
- *             VOID *  malloc()        c_library
- *
- *     side effects:
- *             Memory is allocated, if allocation fails
- *             the assembly is terminated.
- */
-
-VOID *
-new(n)
-unsigned int n;
-{
-       register VOID *p;
-
-       if ((p = (VOID *) malloc(n)) == NULL) {
-               fprintf(stderr, "Out of space!\n");
-               asexit(1);
-       }
-       return (p);
-}
index 4b6a1cfe462b6530635dffc64d31c831db9fd042..b8670f91f25dba1ab19f4f72aa4d7d012710a5a6 100644 (file)
@@ -42,7 +42,7 @@ RSC=rc.exe
 # PROP Ignore_Export_Lib 0\r
 # PROP Target_Dir ""\r
 # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "INDEXLIB" /D "MLH_MAP" /D "SDK" /FR /FD /GZ /c\r
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "INDEXLIB" /D "MLH_MAP" /D "SDK" /FR /FD /GZ /c\r
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "INDEXLIB" /D "MLH_MAP" /D "SDK" /FR /FD /GZ /c\r
 # ADD BASE RSC /l 0x409 /d "_DEBUG"\r
 # ADD RSC /l 0x409 /d "_DEBUG"\r
 BSC32=bscmake.exe\r
@@ -67,7 +67,7 @@ LINK32=link.exe
 # PROP Ignore_Export_Lib 0\r
 # PROP Target_Dir ""\r
 # ADD BASE CPP /nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "INDEXLIB" /D "MLH_MAP" /D "SDK" /FD /c\r
-# ADD CPP /nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "INDEXLIB" /D "MLH_MAP" /D "SDK" /FD /c\r
+# ADD CPP /nologo /ML /W3 /GX /O2 /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "INDEXLIB" /D "MLH_MAP" /D "SDK" /FD /c\r
 # ADD BASE RSC /l 0x409 /d "NDEBUG"\r
 # ADD RSC /l 0x409 /d "NDEBUG"\r
 BSC32=bscmake.exe\r
@@ -124,7 +124,7 @@ SOURCE=.\assubr.c
 # End Source File\r
 # Begin Source File\r
 \r
-SOURCE=.\assym.c\r
+SOURCE=..\asxxsrc\assym.c\r
 # End Source File\r
 # Begin Source File\r
 \r
@@ -144,7 +144,7 @@ SOURCE=.\i51pst.c
 # End Source File\r
 # Begin Source File\r
 \r
-SOURCE=..\strcmpi.c\r
+SOURCE=..\asxxsrc\strcmpi.c\r
 # End Source File\r
 # End Group\r
 # Begin Group "Header Files"\r
diff --git a/as/strcmpi.c b/as/strcmpi.c
deleted file mode 100644 (file)
index c45ce9d..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/* strcmpi.c */
-
-/*
- * Compare two strings ignoring case.
- *
- * Taken from GLIBC 2.2.5. Original code is copyrighted "Free
- * Software Foundation" and published under the GNU Lesser General
- * Public License.
- * 
- */
-
-#include <ctype.h>
-#include <stddef.h>
-
-int as_strcmpi (const char *s1, const char *s2)
-{
-  const unsigned char *p1 = (const unsigned char *) s1;
-  const unsigned char *p2 = (const unsigned char *) s2;
-  unsigned char c1, c2;
-
-  if (p1 == p2)
-    return 0;
-
-  do
-    {
-      c1 = tolower (*p1++);
-      c2 = tolower (*p2++);
-      if (c1 == '\0')
-       break;
-    }
-  while (c1 == c2);
-  
-  return c1 - c2;
-}
-
-int as_strncmpi (const char *s1, const char *s2, size_t n)
-{
-  const unsigned char *p1 = (const unsigned char *) s1;
-  const unsigned char *p2 = (const unsigned char *) s2;
-  unsigned char c1, c2;
-
-  if ((p1 == p2) || (n == 0))
-    return 0;
-
-  do
-    {
-      c1 = tolower (*p1++);
-      c2 = tolower (*p2++);
-      if (c1 == '\0')
-       break;
-    }
-  while ((c1 == c2) && --n);
-
-  return c1 - c2;
-}
index e1ca4a0f6f1aebb55c1e940de7c0b8412306495e..177563b4900b5aeb5d60f470f9c0c5735e59e610 100644 (file)
@@ -7,9 +7,9 @@ PRJDIR          = ../..
 CFLAGS          = $(CFLAGS) -DINDEXLIB -DMLH_MAP -DSDK
 
 OBJECTS       = asdata.obj asexpr.obj aslex.obj aslist.obj asmain.obj \
-                asout.obj assubr.obj assym.obj z80adr.obj z80ext.obj \
+                asout.obj assubr.obj z80adr.obj z80ext.obj \
                 z80mch.obj z80pst.obj \
-                ../strcmpi.obj
+                ../asxxsrc/strcmpi.obj ../asxxsrc/assym.obj
 
 TARGET         = $(PRJDIR)/bin/as-z80.exe
 
index b843112b5a42ba78ccd0d628923301957a15af6d..f67d462880aef7789141ba1843a08098a21af2a6 100644 (file)
@@ -5,31 +5,35 @@ top_srcdir   = @top_srcdir@
 
 include $(top_builddir)/Makefile.common
 
-OBJDIR = obj/$(EXT)
+OBJDIR = obj/$(EXT)
 
-SDC    = .
+ASXXLIB = $(srcdir)/../asxxsrc
 
-SLIBSRC        = NewAlloc.c ../strcmpi.c
+ASXXLIBSRC = strcmpi.c assym.c
 
-SRC    = asdata.c asexpr.c aslex.c aslist.c asmain.c asout.c \
-         assubr.c assym.c z80adr.c z80ext.c z80mch.c z80pst.c
+SRC = asdata.c asexpr.c aslex.c aslist.c asmain.c asout.c \
+      assubr.c z80adr.c z80ext.c z80mch.c z80pst.c
 
-OBJS   = $(SRC:%.c=$(OBJDIR)/%.o)
-SLIBOBJS       = $(SLIBSRC:%.c=$(OBJDIR)/%.o)
+ASSOURCES = $(SRC) $(ASXXLIBSRC:%.c=$(ASXXLIB)/%.c)
 
-BINS   = $(BUILDDIR)/as$(EXT)$(EXEEXT)
+ASXXLIBOBJS = $(ASXXLIBSRC:%.c=$(OBJDIR)/%.o)
 
-CFLAGS += $(CPPFLAGS) $(OPTS) -I. -DINDEXLIB -DMLH_MAP -DUNIX -DSDK
-CFLAGS += -funsigned-char
-CFLAGS += -I$(SLIB)
+OBJS = $(SRC:%.c=$(OBJDIR)/%.o)
+
+ASOBJECTS = $(OBJS) $(ASXXLIBOBJS)
+
+BINS = $(BUILDDIR)/as$(EXT)$(EXEEXT)
+
+CFLAGS += $(CPPFLAGS) $(OPTS) -I. -DINDEXLIB -DMLH_MAP -DUNIX -DSDK
+CFLAGS += -funsigned-char
 
 LDFLAGS = @LDFLAGS@ -lm $(EXTRALIBS)
 
-all:   dep $(BINS)
+all: dep $(BINS)
 
 dep: Makefile.dep
 
-Makefile.dep: $(SRC) $(srcdir)/*.h
+Makefile.dep: $(ASSOURCES) $(srcdir)/*.h
        $(CPP) $(CPPFLAGS) $(M_OR_MM) $(filter %.c,$^) > Makefile.dep
 
 ifeq "$(findstring $(MAKECMDGOALS),uninstall check installcheck installdirs \
@@ -47,14 +51,13 @@ $(OBJDIR)/.stamp:
        mkdir -p $(OBJDIR)
        touch $(OBJDIR)/.stamp
 
-$(BINS): $(OBJS) $(SLIBOBJS)
-       $(CC) -o $(BINS) $(OBJS) $(SLIBOBJS) $(LDFLAGS)
-
+$(BINS): $(ASOBJECTS)
+       $(CC) -o $(BINS) $(ASOBJECTS) $(LDFLAGS)
 
-$(OBJDIR)/%.o: %.c $(OBJDIR)/.stamp
+$(OBJDIR)/%.o: %.c $(OBJDIR)/.stamp
        $(CC) -c $(CFLAGS) -o $@ $<
 
-$(OBJDIR)/%.o: $(SLIB)/%.c $(OBJDIR)/.stamp
+$(OBJDIR)/%.o: $(ASXXLIB)/%.c $(OBJDIR)/.stamp
        $(CC) -c $(CFLAGS) -o $@ $<
 
 _as-z80:
index fd4be4623d923a69d141cf01fe55366dc9433102..d8c604ae5b77bba74bc08118e443cfc7f167dfa9 100644 (file)
@@ -7,19 +7,19 @@
 CFG=as_gbz80 - Win32 Release\r
 !MESSAGE This is not a valid makefile. To build this project using NMAKE,\r
 !MESSAGE use the Export Makefile command and run\r
-!MESSAGE\r
+!MESSAGE \r
 !MESSAGE NMAKE /f "as_gbz80.mak".\r
-!MESSAGE\r
+!MESSAGE \r
 !MESSAGE You can specify a configuration when running NMAKE\r
 !MESSAGE by defining the macro CFG on the command line. For example:\r
-!MESSAGE\r
+!MESSAGE \r
 !MESSAGE NMAKE /f "as_gbz80.mak" CFG="as_gbz80 - Win32 Release"\r
-!MESSAGE\r
+!MESSAGE \r
 !MESSAGE Possible choices for configuration are:\r
-!MESSAGE\r
+!MESSAGE \r
 !MESSAGE "as_gbz80 - Win32 Debug" (based on "Win32 (x86) Console Application")\r
 !MESSAGE "as_gbz80 - Win32 Release" (based on "Win32 (x86) Console Application")\r
-!MESSAGE\r
+!MESSAGE \r
 \r
 # Begin Project\r
 # PROP AllowPerConfigDependencies 0\r
@@ -42,7 +42,7 @@ RSC=rc.exe
 # PROP Ignore_Export_Lib 0\r
 # PROP Target_Dir ""\r
 # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "INDEXLIB" /D "MLH_MAP" /D "SDK" /FR /FD /GZ /c\r
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\support\util" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "INDEXLIB" /D "MLH_MAP" /D "SDK" /FR /FD /GZ /c\r
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "INDEXLIB" /D "MLH_MAP" /D "SDK" /FR /FD /GZ /c\r
 # ADD BASE RSC /l 0x409 /d "_DEBUG"\r
 # ADD RSC /l 0x409 /d "_DEBUG"\r
 BSC32=bscmake.exe\r
@@ -67,7 +67,7 @@ LINK32=link.exe
 # PROP Ignore_Export_Lib 0\r
 # PROP Target_Dir ""\r
 # ADD BASE CPP /nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "INDEXLIB" /D "MLH_MAP" /D "SDK" /FD /c\r
-# ADD CPP /nologo /ML /W3 /GX /O2 /I "..\support\util" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "INDEXLIB" /D "MLH_MAP" /D "SDK" /FD /c\r
+# ADD CPP /nologo /ML /W3 /GX /O2 /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "INDEXLIB" /D "MLH_MAP" /D "SDK" /FD /c\r
 # ADD BASE RSC /l 0x409 /d "NDEBUG"\r
 # ADD RSC /l 0x409 /d "NDEBUG"\r
 BSC32=bscmake.exe\r
@@ -77,7 +77,7 @@ LINK32=link.exe
 # ADD BASE LINK32 /nologo /subsystem:console /machine:I386 /out:"..\..\bin_vc\as-z80.exe" /pdbtype:sept\r
 # ADD LINK32 /nologo /subsystem:console /machine:I386 /out:"..\..\bin_vc\as-gbz80.exe" /pdbtype:sept\r
 \r
-!ENDIF\r
+!ENDIF \r
 \r
 # Begin Target\r
 \r
@@ -123,12 +123,11 @@ SOURCE=.\assubr.c
 # End Source File\r
 # Begin Source File\r
 \r
-SOURCE=.\assym.c\r
-# ADD CPP /D "GAMEBOY"\r
+SOURCE=..\asxxsrc\assym.c\r
 # End Source File\r
 # Begin Source File\r
 \r
-SOURCE=..\strcmpi.c\r
+SOURCE=..\asxxsrc\strcmpi.c\r
 # End Source File\r
 # Begin Source File\r
 \r
index a09e5e8910a06983024e2bed95c39abe28cf0333..01d16385b0740772ff3c159be40ff4d21b4f2fd9 100644 (file)
@@ -7,19 +7,19 @@
 CFG=as_z80 - Win32 Release\r
 !MESSAGE This is not a valid makefile. To build this project using NMAKE,\r
 !MESSAGE use the Export Makefile command and run\r
-!MESSAGE\r
+!MESSAGE \r
 !MESSAGE NMAKE /f "as_z80.mak".\r
-!MESSAGE\r
+!MESSAGE \r
 !MESSAGE You can specify a configuration when running NMAKE\r
 !MESSAGE by defining the macro CFG on the command line. For example:\r
-!MESSAGE\r
+!MESSAGE \r
 !MESSAGE NMAKE /f "as_z80.mak" CFG="as_z80 - Win32 Release"\r
-!MESSAGE\r
+!MESSAGE \r
 !MESSAGE Possible choices for configuration are:\r
-!MESSAGE\r
+!MESSAGE \r
 !MESSAGE "as_z80 - Win32 Debug" (based on "Win32 (x86) Console Application")\r
 !MESSAGE "as_z80 - Win32 Release" (based on "Win32 (x86) Console Application")\r
-!MESSAGE\r
+!MESSAGE \r
 \r
 # Begin Project\r
 # PROP AllowPerConfigDependencies 0\r
@@ -42,7 +42,7 @@ RSC=rc.exe
 # PROP Ignore_Export_Lib 0\r
 # PROP Target_Dir ""\r
 # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "INDEXLIB" /D "MLH_MAP" /D "SDK" /FR /FD /GZ /c\r
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../support/util" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "INDEXLIB" /D "MLH_MAP" /D "SDK" /FR /FD /GZ /c\r
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "INDEXLIB" /D "MLH_MAP" /D "SDK" /FR /FD /GZ /c\r
 # ADD BASE RSC /l 0x409 /d "_DEBUG"\r
 # ADD RSC /l 0x409 /d "_DEBUG"\r
 BSC32=bscmake.exe\r
@@ -67,7 +67,7 @@ LINK32=link.exe
 # PROP Ignore_Export_Lib 0\r
 # PROP Target_Dir ""\r
 # ADD BASE CPP /nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "INDEXLIB" /D "MLH_MAP" /D "SDK" /FD /c\r
-# ADD CPP /nologo /ML /W3 /GX /O2 /I "..\support\util\\" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "INDEXLIB" /D "MLH_MAP" /D "SDK" /FD /c\r
+# ADD CPP /nologo /ML /W3 /GX /O2 /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "INDEXLIB" /D "MLH_MAP" /D "SDK" /FD /c\r
 # ADD BASE RSC /l 0x409 /d "NDEBUG"\r
 # ADD RSC /l 0x409 /d "NDEBUG"\r
 BSC32=bscmake.exe\r
@@ -77,7 +77,7 @@ LINK32=link.exe
 # ADD BASE LINK32 /nologo /subsystem:console /machine:I386 /out:"..\..\bin_vc\as-z80.exe" /pdbtype:sept\r
 # ADD LINK32 /nologo /subsystem:console /machine:I386 /out:"..\..\bin_vc\as-z80.exe" /pdbtype:sept\r
 \r
-!ENDIF\r
+!ENDIF \r
 \r
 # Begin Target\r
 \r
@@ -116,11 +116,11 @@ SOURCE=.\assubr.c
 # End Source File\r
 # Begin Source File\r
 \r
-SOURCE=.\assym.c\r
+SOURCE=..\asxxsrc\assym.c\r
 # End Source File\r
 # Begin Source File\r
 \r
-SOURCE=..\strcmpi.c\r
+SOURCE=..\asxxsrc\strcmpi.c\r
 # End Source File\r
 # Begin Source File\r
 \r
diff --git a/as/z80/assym.c b/as/z80/assym.c
deleted file mode 100644 (file)
index 13d175a..0000000
+++ /dev/null
@@ -1,505 +0,0 @@
-/* assym.c */
-
-/*
- * (C) Copyright 1989-1995
- * All Rights Reserved
- *
- * Alan R. Baldwin
- * 721 Berkeley St.
- * Kent, Ohio  44240
- *
- * 10-Nov-07 borutr:
- *           - use strsto instead StoreString and include it in assym.c
- *             for compatibility with the original asxxxx
- *           - applied changes from 28-Oct-97 JLH:
- *             - lookup: Use StoreString for sym construction
- *             - change symeq() to do length-independent string compare
- *             - change hash() to do length-independent hash calculation
- *           - applied changes from 29-Oct-97 JLH:
- *             - make mnemonics case insensitive ALWAYS
- *             - make hash() case-insensitive always
- *             - replace symeq() call in mlookup with strcmpi
- */
-
-#include <stdio.h>
-#include <setjmp.h>
-#include <string.h>
-#include <stdlib.h>
-#include "asm.h"
-
-/*)Module       assym.c
- *
- *      The module assym.c contains the functions that operate
- *      on the mnemonic/directive and symbol structures.
- *
- *      assym.c contains the following functions:
- *              VOID    allglob()
- *              area *  alookup()
- *              int     hash()
- *              sym *   lookup()
- *              mne *   mlookup()
- *              VOID *  new()
- *              int     symeq()
- *              VOID    syminit()
- *              VOID    symglob()
- *
- *      assym.c contains no local/static variables.
- */
-
-/*)Function     VOID    syminit()
- *
- *      The function syminit() is called early in the game
- *      to set up the hashtables.  First all buckets in a
- *      table are cleared.  Then a pass is made through
- *      the respective symbol lists, linking them into
- *      their hash buckets.  Finally the base area pointer
- *      is set to 'dca'.
- *
- *      local variables:
- *              int     h               computed hash value
- *              mne *   mp              pointer to a mne structure
- *              mne **  mpp             pointer to an array of
- *                                      mne structure pointers
- *              sym *   sp              pointer to a sym structure
- *              sym **  spp             pointer to an array of
- *                                      sym structure pointers
- *
- *      global variables:
- *              area    area[]          single elememt area array
- *              area    dca             defined as area[0]
- *              mne * mnehash[]         array of pointers to NHASH
- *                                      linked mnemonic/directive lists
- *              sym * symhash[]         array of pointers to NHASH
- *                                      linked symbol lists
- *
- *      functions called:
- *              none
- *
- *      side effects:
- *              (1)     The symbol hash tables are initialized,
- *                      the only defined symbol is '.'.
- *              (2)     The mnemonic/directive hash tables are
- *                      initialized with the assembler directives
- *                      and mnemonics found in the machine dependent
- *                      file ___pst.c.
- *              (3)     The area pointer is initialized to dca (area[0]).
- */
-
-VOID
-syminit(void)
-{
-        register struct mne  *mp;
-        struct mne **mpp;
-        register struct sym  *sp;
-        struct sym **spp;
-        register int h;
-
-        mpp = &mnehash[0];
-        while (mpp < &mnehash[NHASH])
-                *mpp++ = NULL;
-        mp = &mne[0];
-        for (;;) {
-                h = hash(mp->m_id);
-                mp->m_mp = mnehash[h];
-                mnehash[h] = mp;
-                if (mp->m_flag&S_END)
-                        break;
-                ++mp;
-        }
-
-        spp = &symhash[0];
-        while (spp < &symhash[NHASH])
-                *spp++ = NULL;
-        sp = &sym[0];
-        for (;;) {
-                h = hash(sp->s_id);
-                sp->s_sp = symhash[h];
-                symhash[h] = sp;
-                if (sp->s_flag&S_END)
-                        break;
-                ++sp;
-        }
-
-        areap = &dca;
-}
-
-/*)Function     area *  alookup(id)
- *
- *              char *  id              area name string
- *
- *      The function alookup() searches the area list for a
- *      match with id.  If the area is defined then a pointer
- *      to this area is returned else a NULL is returned.
- *
- *      local variables:
- *              area *  ap              pointer to area structure
- *
- *      global variables:
- *              area *  areap           pointer to an area structure
- *
- *      functions called:
- *              int     symeq()         assym.c
- *
- *      side effects:
- *              none
- */
-
-struct area *
-alookup(char *id)
-{
-        register struct area *ap;
-
-        ap = areap;
-        while (ap) {
-                if (symeq(id, ap->a_id)) {
-                        return (ap);
-                }
-                ap = ap->a_ap;
-        }
-        return(NULL);
-}
-
-/*)Function     mne *   mlookup(id)
- *
- *              char *  id              mnemonic/directive name string
- *
- *      The function mlookup() searches the mnemonic/directive
- *      hash tables for a match returning a pointer to the
- *      mne structure else it returns a NULL.
- *
- *      local variables:
- *              mne *   mp              pointer to mne structure
- *              int     h               calculated hash value
- *
- *      global variables:
- *              mne * mnehash[]         array of pointers to NHASH
- *                                      linked mnemonic/directive lists
- *
- *      functions called:
- *              none
- *
- *      side effects:
- *              none
- */
-
-struct mne *
-mlookup(char *id)
-{
-        register struct mne *mp;
-        register int h;
-
-        h = hash(id);
-        mp = mnehash[h];
-        while (mp) {
-                if (as_strcmpi(id, mp->m_id) == 0)      /* JLH: case insensitive */
-                        return (mp);
-                mp = mp->m_mp;
-        }
-        return (NULL);
-}
-
-/*)Function     sym *   lookup(id)
- *
- *              char *  id              symbol name string
- *
- *      The function lookup() searches the symbol hash tables for
- *      a symbol name match returning a pointer to the sym structure.
- *      If the symbol is not found then a sym structure is created,
- *      initialized, and linked to the appropriate hash table.
- *      A pointer to this new sym structure is returned.
- *
- *      local variables:
- *              int     h               computed hash value
- *              sym *   sp              pointer to a sym structure
- *
- *      global varaibles:
- *              sym * symhash[]         array of pointers to NHASH
- *                                      linked symbol lists
- *
- *      functions called:
- *              int     hash()          assym.c
- *              VOID *  new()           assym.c
- *              int     symeq()         assym.c
- *
- *      side effects:
- *              If the function new() fails to allocate space
- *              for the new sym structure the assembly terminates.
- */
-
-struct sym *
-lookup(char *id)
-{
-        register struct sym *sp;
-        register int h;
-
-        h = hash(id);
-        sp = symhash[h];
-        while (sp) {
-                if (symeq(id, sp->s_id))
-                        return (sp);
-                sp = sp->s_sp;
-        }
-        sp = (struct sym *) new (sizeof(struct sym));
-        sp->s_sp = symhash[h];
-        symhash[h] = sp;
-        sp->s_tsym = NULL;
-        sp->s_id = strsto(id);
-        sp->s_type = S_NEW;
-        sp->s_flag = 0;
-        sp->s_area = NULL;
-        sp->s_ref = 0;
-        sp->s_addr = 0;
-        return (sp);
-}
-
-/*)Function     VOID    symglob()
- *
- *      The function symglob() will mark all symbols of
- *      type S_NEW as global.  Called at the beginning of pass 1
- *      if the assembly option -g was specified.
- *
- *      local variables:
- *              sym *   sp              pointer to a sym structure
- *              int     i               loop index
- *
- *      global variables:
- *              sym * symhash[]         array of pointers to NHASH
- *                                      linked symbol lists
- *
- *      functions called:
- *              none
- *
- *      side effects:
- *              Symbol types changed.
- */
-
-VOID
-symglob(void)
-{
-        register struct sym *sp;
-        register int i;
-
-        for (i=0; i<NHASH; ++i) {
-                sp = symhash[i];
-                while (sp != NULL) {
-                        if (sp->s_type == S_NEW)
-                                sp->s_flag |= S_GBL;
-                        sp = sp->s_sp;
-                }
-        }
-}
-
-/*)Function     VOID    allglob()
- *
- *      The function allglob() will mark all symbols of
- *      type S_USER as global.  Called at the beginning of pass 1
- *      if the assembly option -a was specified.
- *
- *      local variables:
- *              sym *   sp              pointer to a sym structure
- *              int     i               loop index
- *
- *      global variables:
- *              sym * symhash[]         array of pointers to NHASH
- *                                      linked symbol lists
- *
- *      functions called:
- *              none
- *
- *      side effects:
- *              Symbol types changed.
- */
-
-VOID
-allglob(void)
-{
-        register struct sym *sp;
-        register int i;
-
-        for (i=0; i<NHASH; ++i) {
-                sp = symhash[i];
-                while (sp != NULL) {
-                        if (sp != &dot && sp->s_type == S_USER)
-                                sp->s_flag |= S_GBL;
-                        sp = sp->s_sp;
-                }
-        }
-}
-
-/*)Function     int     symeq(p1, p2)
- *
- *              char *  p1              name string
- *              char *  p2              name string
- *
- *      The function symeq() compares the two name strings for a match.
- *      The return value is 1 for a match and 0 for no match.
- *
- *      local variables:
- *              int     h               loop counter
- *
- *      global variables:
- *              char    ccase[]         an array of characters which
- *                                      perform the case translation function
- *
- *      functions called:
- *              none
- *
- *      side effects:
- *              none
- *
- */
-
-int
-symeq(char *p1, char *p2)
-{
-#if     CASE_SENSITIVE
-                return (strcmp( p1, p2 ) == 0);
-#else
-                return (as_strcmpi( p1, p2 ) == 0);
-#endif
-}
-
-/*)Function     int     hash(p)
- *
- *              char *  p               pointer to string to hash
- *
- *      The function hash() computes a hash code using the sum
- *      of all characters mod table size algorithm.
- *
- *      local variables:
- *              int     h               accumulated character sum
- *              int     n               loop counter
- *
- *      global variables:
- *              char    ccase[]         an array of characters which
- *                                      perform the case translation function
- *
- *      functions called:
- *              none
- *
- *      side effects:
- *              none
- */
-
-int
-hash(char *p)
-{
-        register int h;
-
-        h = 0;
-        while (*p) {
-                /* JLH: case insensitive hash:  Doesn't much affect
-                 * hashing, and allows same function for mnemonics and symbols
-                 */
-                h += ccase[(int)*p++];
-        }
-        return (h&HMASK);
-}
-
-/*)Function     char *  strsto(str)
- *
- *              char *  str             pointer to string to save
- *
- *      Allocate space for "str", copy str into new space.
- *      Return a pointer to the allocated string.
- *
- *      This function based on code by
- *              John L. Hartman
- *              jhartman at compuserve dot com
- *
- *      local variables:
- *              int     l               string length + 1
- *              int     bytes           bytes remaining in buffer area
- *              char *  p               pointer to head of copied string
- *              char *  pnext           next location in buffer area
- *
- *      global variables:
- *              none
- *
- *      functions called:
- *              VOID *  new()           assym.c
- *              char *  strncpy()       c_library
- *
- *      side effects:
- *              Space allocated for string, string copied
- *              to space.  Out of Space terminates assembler.
- */
-
-/*
- * To avoid wasting memory headers on small allocations, we
- * allocate a big chunk and parcel it out as required.
- * These static variables remember our hunk
- */
-
-#define STR_SPC 1024
-static  char *  pnext = NULL;
-static  int     bytes = 0;
-
-char *
-strsto(char *str)
-{
-        int  l;
-        char *p;
-
-        /*
-         * What we need, including a null.
-         */
-        l = strlen(str) + 1;
-
-        if (l > bytes) {
-                /*
-                 * No space.  Allocate a new hunk.
-                 * We lose the pointer to any old hunk.
-                 * We don't care, as the names are never deleted.
-                */
-                pnext = (char *) new (STR_SPC);
-                bytes = STR_SPC;
-        }
-
-        /*
-         * Copy the name and terminating null.
-         */
-        p = pnext;
-        strncpy(p, str, l);
-
-        pnext += l;
-        bytes -= l;
-
-        return(p);
-}
-
-/*)Function     VOID *  new(n)
- *
- *              unsigned int    n       allocation size in bytes
- *
- *      The function new() allocates n bytes of space and returns
- *      a pointer to this memory.  If no space is available the
- *      assembly is terminated.
- *
- *      local variables:
- *              VOID *  p               a general pointer
- *
- *      global variables:
- *              none
- *
- *      functions called:
- *              VOID    asexit()        asmain.c
- *              int     fprintf()       c_library
- *              VOID *  malloc()        c_library
- *
- *      side effects:
- *              Memory is allocated, if allocation fails
- *              the assembly is terminated.
- */
-
-VOID *
-new(unsigned int n)
-{
-        register VOID *p;
-
-        if ((p = (VOID *) malloc(n)) == NULL) {
-                fprintf(stderr, "Out of space!\n");
-                asexit(1);
-        }
-        return (p);
-}