#define VERSION "V01.70 + NoICE + SDCC mods + Flat24 Feb-1999"
+#if !defined(__BORLANDC__) && !defined(_MSC_VER)
+#include <unistd.h>
+#endif
+
/*
* Case Sensitivity Flag
*/
#define OTHERSYSTEM
#endif
+/*
+ * PATH_MAX
+ */
+#include <limits.h>
+#ifndef PATH_MAX /* POSIX, but not required */
+#ifdef _MSC_VER /* Microsoft C */
+#include <stdlib.h>
+#define PATH_MAX _MAX_PATH
+#else
+#define PATH_MAX /* define a reasonable value */
+#endif
+#endif
+
/*
* Assembler definitions.
*/
#define NCPS 80 /* Chars. per symbol (JLH: change from 8) */
#define HUGE 1000 /* A huge number */
#define NERR 3 /* Errors per line */
-#define NINPUT 128 /* Input buffer size */
+#define NINPUT PATH_MAX /* Input buffer size (BH: change from 128) */
#define NCODE 128 /* Listing code buffer size */
#define NTITL 64 /* Title buffer size */
#define NSBTL 64 /* SubTitle buffer size */
#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 FILSPC 80 /* Chars. in filespec */
#define NLIST 0 /* No listing */
#define SLIST 1 /* Source only */
#define dca area[0] /* Dca, default code area */
-/* NB: for Flat24 extentions to work, addr_t must be at least 24
+/* 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
struct area *a_ap; /* Area link */
char a_id[NCPS]; /* Area Name */
int a_ref; /* Ref. number */
- addr_t a_size; /* Area size */
- addr_t a_fuzz; /* Area fuzz */
+ Addr_T a_size; /* Area size */
+ Addr_T a_fuzz; /* Area fuzz */
int a_flag; /* Area flags */
};
* +-----+-----+-----+-----+-----+-----+-----+-----+
*/
-#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 Byte */
-#define R_USGN 0020 /* Unsigned Byte */
+#define R_SGND 0x00 /* Signed Byte */
+#define R_USGN 0x10 /* Unsigned Byte */
-#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' */
-#define R_LSB 0000 /* low byte */
-#define R_MSB 0200 /* 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_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 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.
+ */
+
/*
* Listing Control Flags
*/
char *m_id; /* Mnemonic JLH: change from [NCPS] */
char m_type; /* Mnemonic subtype */
char m_flag; /* Mnemonic flags */
- addr_t m_valu; /* Value */
+ Addr_T m_valu; /* Value */
};
/*
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_addr; /* Address */
};
#define S_GBL 01 /* Global */
int t_flg; /* flags */
struct area *t_area; /* Area */
- addr_t t_addr; /* Address */
+ Addr_T t_addr; /* Address */
};
/*
* values indexed by tlevel
*/
extern char
- afn[FILSPC]; /* afile() temporary filespec
+ afn[PATH_MAX]; /* afile() temporary filespec
*/
extern char
- srcfn[MAXFIL][FILSPC]; /* array of source file names
+ srcfn[MAXFIL][PATH_MAX]; /* array of source file names
*/
extern int
srcline[MAXFIL]; /* current source file line
*/
extern char
- incfn[MAXINC][FILSPC]; /* array of include file names
+ incfn[MAXINC][PATH_MAX]; /* array of include file names
*/
extern int
incline[MAXINC]; /* current include file line
*/
extern int fflag; /* -f(f), relocations flagged flag
*/
-extern addr_t laddr; /* address of current assembler line
+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
+extern Addr_T fuzz; /* tracks pass to pass changes in the
* address of symbols caused by
* variable length instruction formats
*/
{
char e_mode; /* Address mode */
char e_flag; /* Symbol flag */
- addr_t e_addr; /* Address */
+ Addr_T e_addr; /* Address */
union {
struct area *e_ap;
struct sym *e_sp;
} e_base; /* Rel. base */
- char e_rlcf; /* Rel. flags */
+ int e_rlcf; /* Rel. flags */
};
/* C Library functions */
extern VOID getst();
extern int more();
extern VOID unget();
+extern VOID chop_crlf();
/* assym.c */
extern struct area * alookup();
/* asexpr.c */
extern VOID abscheck();
-extern addr_t absexpr();
+extern Addr_T absexpr();
extern VOID clrexpr();
extern int digit();
extern int is_abs();
extern VOID outchk();
extern VOID outgsd();
extern VOID outrb();
-extern VOID outrw();
+extern VOID outrw(struct expr *, int);
extern VOID outr24(struct expr *, int);
extern VOID outsym();
extern VOID out_lb();
/* Machine dependent functions */
-extern VOID machin();
extern VOID minit();
-
-/* SD added THIS define to change
- strcmpi --> strcmp (strcmpi is NOT ANSI) */
-#define strcmpi strcmp
+extern VOID machine(struct mne *);