* as/z80/asm.h: made CASE_SENSITIVE 1
[fw/sdcc] / link / z80 / aslink.h
index c241194da4a82bac993a831c28408d70ab274085..e18cd023a825c13966934974d352dd1008afed3e 100644 (file)
 /*
  * Extensions: P. Felber
  */
-
 #define        VERSION "V01.75"
 
 /*
  * Case Sensitivity Flag
  */
-#define        CASE_SENSITIVE  0
+#define        CASE_SENSITIVE  1
 
 /*)Module      asmlnk.h
  *
 #define        OTHERSYSTEM
 #endif
 
+/*
+ * PATH_MAX
+ */
+#include <limits.h>
+#ifndef PATH_MAX                /* POSIX, but not required   */
+ #if defined(__BORLANDC__) || defined(_MSC_VER)
+  #include <stdlib.h>
+  #define PATH_MAX     _MAX_PATH
+ #else
+  #define PATH_MAX     255     /* define a reasonable value */
+ #endif
+#endif
+
 /*
  * This file defines the format of the
  * relocatable binary file.
  */
 
 #ifdef SDK
-#define        NCPS    32              /* characters per symbol */
+#define        NCPS    80              /* characters per symbol.  Used to be 32... */
 #else /* SDK */
 #define        NCPS    8               /* characters per symbol */
 #endif /* SDK */
 /* #define     NCPS    32 */   /* characters per symbol */
 #define        NDATA   16              /* actual data */
-#define        NINPUT  128             /* Input buffer size */
+#define        NINPUT  PATH_MAX        /* Input buffer size */
 #define        NHASH   64              /* Buckets in hash table */
 #define        HMASK   077             /* Hash mask */
 #define        NLPP    60              /* Lines per page */
 #define        NTXT    16              /* T values */
-#define        FILSPC  80              /* File spec length */
+#define        FILSPC  PATH_MAX        /* File spec length */
 
 /*
  *     The "R_" relocation constants define values used in
  *         +-----+-----+-----+-----+-----+-----+-----+-----+
  */
 
-#define        R_WORD  0000            /* 16 bit */
-#define        R_BYTE  0001            /*  8 bit */
+#define        R_WORD  0x00            /* 16 bit */
+#define        R_BYTE  0x01            /*  8 bit */
 
-#define        R_AREA  0000            /* Base type */
-#define        R_SYM   0002
+#define        R_AREA  0x00            /* Base type */
+#define        R_SYM   0x02
 
-#define        R_NORM  0000            /* PC adjust */
-#define        R_PCR   0004
+#define        R_NORM  0x00            /* PC adjust */
+#define        R_PCR   0x04
 
-#define        R_BYT1  0000            /* Byte count for R_BYTE = 1 */
-#define        R_BYT2  0010            /* 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  0000            /* Signed value */
-#define        R_USGN  0020            /* Unsigned value */
+#define        R_SGND  0x00            /* Signed value */
+#define        R_USGN  0x10            /* Unsigned value */
 
-#define        R_NOPAG 0000            /* Page Mode */
-#define        R_PAG0  0040            /* Page '0' */
-#define        R_PAG   0100            /* Page 'nnn' */
+#define        R_NOPAG 0x00            /* Page Mode */
+#define        R_PAG0  0x20            /* Page '0' */
+#define        R_PAG   0x40            /* Page 'nnn' */
 
 /*
  * Valid for R_BYT2:
  */
-#define        R_LSB   0000            /* output low byte */
-#define        R_MSB   0200            /* output high byte */
+#define        R_LSB   0x00            /* output low byte */
+#define        R_MSB   0x80            /* output high byte */
 
 /*
  * Global symbol types.
 /*
  * Area types
  */
-#define        A_CON   000             /* concatenate */
-#define        A_OVR   00            /* overlay */
-#define        A_REL   000             /* relocatable */
-#define        A_ABS   010             /* absolute */
-#define        A_NOPAG 000             /* non-paged */
-#define        A_PAG   020             /* paged */
+#define        A_CON   0000            /* concatenate */
+#define        A_OVR   0004            /* overlay */
+#define        A_REL   0000            /* relocatable */
+#define        A_ABS   0010            /* absolute */
+#define        A_NOPAG 0000            /* non-paged */
+#define        A_PAG   0020            /* paged */
 
 /*
  * File types
  */
+#define F_INV  0               /* invalid */
 #define        F_STD   1               /* stdin */
 #define        F_LNK   2               /* File.lnk */
 #define        F_REL   3               /* File.rel */
@@ -178,7 +191,7 @@ extern patch* patches;
 /*
  *     General assembler address type
  */
-typedef unsigned int addr_t;
+typedef unsigned int Addr_T;
 
 /*
  *     The structures of head, area, areax, and sym are created
@@ -224,8 +237,8 @@ struct      area
 {
        struct  area    *a_ap;  /* Area link */
        struct  areax   *a_axp; /* Area extension link */
-       addr_t  a_addr;         /* Beginning address of area */
-       addr_t  a_size;         /* Total size of the area */
+       Addr_T  a_addr;         /* Beginning address of area */
+       Addr_T  a_size;         /* Total size of the area */
        char    a_type;         /* Area subtype */
        char    a_flag;         /* Flag byte */
        char    a_id[NCPS];     /* Name */
@@ -251,8 +264,8 @@ struct      areax
        struct  areax   *a_axp; /* Area extension link */
        struct  area    *a_bap; /* Base area link */
        struct  head    *a_bhp; /* Base header link */
-       addr_t  a_addr;         /* Beginning address of section */
-       addr_t  a_size;         /* Size of the area in section */
+       Addr_T  a_addr;         /* Beginning address of section */
+       Addr_T  a_size;         /* Size of the area in section */
 };
 
 /*
@@ -273,7 +286,7 @@ struct      sym
        struct  areax   *s_axp; /* Symbol area link */
        char    s_type;         /* Symbol subtype */
        char    s_flag;         /* Flag byte */
-       addr_t  s_addr;         /* Address */
+       Addr_T  s_addr;         /* Address */
        char    s_id[NCPS];     /* Name */
 };
 
@@ -322,7 +335,7 @@ struct      sdp
 {
        struct  area  *s_area;  /* Paged Area link */
        struct  areax *s_areax; /* Paged Area Extension Link */
-       addr_t  s_addr;         /* Page address offset */
+       Addr_T  s_addr;         /* Page address offset */
 };
 
 /*
@@ -339,9 +352,9 @@ struct      rerr
 {
        int     aindex;         /* Linking area */
        int     mode;           /* Relocation mode */
-       addr_t  rtbase;         /* Base address in section */
+       Addr_T  rtbase;         /* Base address in section */
        int     rindex;         /* Area/Symbol reloaction index */
-       addr_t  rval;           /* Area/Symbol offset value */
+       Addr_T  rval;           /* Area/Symbol offset value */
 };
 
 /*
@@ -415,6 +428,7 @@ struct lbfile {
        char            *libspc;
        char            *relfil;
        char            *filspc;
+    long               offset; /*>=0 if rel file is embedded in a lib file at this offset*/
 };
 
 /*
@@ -436,10 +450,14 @@ extern    char    *rp;            /*      pointer into the LST file
 extern char    rb[NINPUT];     /*      LST file text line being
                                 *      address relocated
                                 */
-extern char    ctype[];        /*      array of character types, one per
+extern unsigned char   ctype[];        /*      array of character types, one per
                                 *      ASCII character
                                 */
 
+extern char sdccopt[NINPUT];
+extern char sdccopt_module[NINPUT];
+extern char curr_module[NINPUT];
+
 /*
  *     Character Type Definitions
  */
@@ -469,7 +487,7 @@ extern      char    ccase[];        /*      an array of characters which
 extern struct  lfile   *filep; /*      The pointers (lfile *) filep,
                                 *      (lfile *) cfp, and (FILE *) sfp
                                 *      are used in conjunction with
-                                *      the routine getline() to read
+                                *      the routine lk_getline() to read
                                 *      asmlnk commands from
                                 *      (1) the standard input or
                                 *      (2) or a command file
@@ -571,7 +589,7 @@ extern      int     pass;           /*      linker pass number
 extern int     rtcnt;          /*      count of elements in the
                                 *      rtval[] and rtflg[] arrays
                                 */
-extern addr_t  rtval[];        /*      data associated with relocation
+extern Addr_T  rtval[];        /*      data associated with relocation
                                 */
 extern int     rtflg[];        /*      indicates if rtval[] value is
                                 *      to be sent to the output file.
@@ -618,7 +636,7 @@ extern      VOID            bassav();
 extern VOID            gblsav();
 extern VOID            link();
 extern VOID            lkexit();
-extern VOID            main();
+extern int             main();
 extern VOID            map();
 #ifdef SDK
 extern VOID            sym();
@@ -633,12 +651,13 @@ extern    char            endline();
 extern char            get();
 extern VOID            getfid();
 extern VOID            getid();
-extern int             getline();
+extern int             lk_getline();
 extern int             getmap();
 extern char            getnb();
 extern int             more();
 extern VOID            skip();
 extern VOID            unget();
+extern VOID            chop_crlf();
 
 /* lkarea.c */
 extern VOID            lkparea();
@@ -659,14 +678,14 @@ extern    VOID            symdef();
 extern int             symeq();
 extern VOID            syminit();
 extern VOID            symmod();
-extern addr_t          symval();
+extern Addr_T          symval();
 
 /* lkeval.c */
 extern int             digit();
-extern addr_t          eval();
-extern addr_t          expr();
+extern Addr_T          eval();
+extern Addr_T          expr();
 extern int             oprio();
-extern addr_t          term();
+extern Addr_T          term();
 
 /* lklist.c */
 extern int             dgt();
@@ -678,13 +697,13 @@ extern    VOID            newpag();
 extern VOID            slew();
 
 /* lkrloc.c */
-extern addr_t          adb_b();
-extern addr_t          adb_hi();
-extern addr_t          adb_lo();
-extern addr_t          adw_w();
-extern addr_t          adw_hi();
-extern addr_t          adw_lo();
-extern addr_t          evword();
+extern Addr_T          adb_b();
+extern Addr_T          adb_hi();
+extern Addr_T          adb_lo();
+extern Addr_T          adw_w();
+extern Addr_T          adw_hi();
+extern Addr_T          adw_lo();
+extern Addr_T          evword();
 extern VOID            rele();
 extern VOID            reloc();
 extern VOID            relt();
@@ -698,7 +717,7 @@ extern      VOID            erpdmp();
 extern VOID            prntval();
 
 /* lklibr.c */
-extern VOID            addfile();
+extern int             addfile();
 extern VOID            addlib();
 extern VOID            addpath();
 extern int             fndsym();
@@ -711,3 +730,8 @@ extern      VOID            s19();
 
 /* lkihx.c */
 extern VOID            ihx();
+
+/* lkgb.h */
+VOID gb(int in);
+VOID gg(int in);
+