diff options
author | Robert de Bath <rdebath@poboxes.com> | 1997-02-25 20:42:19 +0100 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2013-10-23 23:38:07 +0200 |
commit | 4c36e9a0c125ccfff37aa440dab2cf58c4152fff (patch) | |
tree | a5d9c84ba2661029ddb2223dacd50529a361c3d5 /as | |
parent | f8de35da65c5d93bb733073cf40da154bc1c0748 (diff) | |
parent | 9696d7b0e1f3a1b0f5fd4a0428eb75afe8ad4ed6 (diff) | |
download | dev86-4c36e9a0c125ccfff37aa440dab2cf58c4152fff.tar.gz |
Import Dev86src-0.0.11.tar.gzv0.0.11
Diffstat (limited to 'as')
-rw-r--r-- | as/Makefile | 20 | ||||
-rw-r--r-- | as/as.c | 22 | ||||
-rw-r--r-- | as/as86_encap.sh (renamed from as/as86_encap) | 5 | ||||
-rw-r--r-- | as/express.c | 8 | ||||
-rw-r--r-- | as/flag.h | 2 | ||||
-rw-r--r-- | as/genbin.c | 18 | ||||
-rw-r--r-- | as/genlist.c | 2 | ||||
-rw-r--r-- | as/macro.c | 2 | ||||
-rw-r--r-- | as/pops.c | 2 | ||||
-rw-r--r-- | as/proto.h | 6 | ||||
-rw-r--r-- | as/readsrc.c | 19 | ||||
-rw-r--r-- | as/syshead.h | 22 | ||||
-rw-r--r-- | as/typeconv.c | 1 |
13 files changed, 83 insertions, 46 deletions
diff --git a/as/Makefile b/as/Makefile index 3fb2551..4319371 100644 --- a/as/Makefile +++ b/as/Makefile @@ -1,35 +1,33 @@ -ifneq ($(TOPDIR),) -include $(TOPDIR)/Make.defs -else CFLAGS=-O +LDFLAGS=-s LIBDIR=/usr/bin BINDIR=/usr/bin -endif - -# Temp needed for libc-5.4.7 -CFLAGS+= -Dwarn=as_warn OBJS =as.o assemble.o error.o express.o \ genbin.o genlist.o genobj.o gensym.o \ keywords.o macro.o mops.o pops.o readsrc.o \ scan.o table.o typeconv.o -all: as86 +all: as86 as86_encap as86: $(OBJS) $(CC) $(LDFLAGS) $(OBJS) -o as86 +as86_encap: as86_encap.sh + sed "s:%%LIBDIR%%:$(LIBDIR):" < as86_encap.sh > tmp + @mv -f tmp as86_encap + chmod +x as86_encap + install: all install -d $(LIBDIR) install -m 755 as86 $(LIBDIR) - sed "s:%%LIBDIR%%:$(LIBDIR):" < as86_encap > tmp install -d $(BINDIR) install -m 755 tmp $(BINDIR)/as86_encap -@rm -f tmp -clean: - rm -f *.o as86 +clean realclean: + rm -f *.o as86 as86_encap as.o: const.h type.h byteord.h macro.h file.h flag.h globvar.h assemble.o: const.h type.h address.h globvar.h opcode.h scan.h @@ -63,7 +63,7 @@ char **argv; initobj(); initsource(); /* only nec to init for unsupported mem file */ typeconv_init(BIG_ENDIAN, LONG_BIG_ENDIAN); - warn.global = TRUE; /* constant */ + as_warn.global = TRUE; /* constant */ last_pass=1; process_args(argc, argv); initscan(); @@ -158,6 +158,7 @@ char **argv; bool_t isnextarg; char *nextarg = 0; int opened_file = 0; + int flag_state; #ifdef I80386 setcpu(0xF); @@ -170,6 +171,10 @@ char **argv; arg = *++argv; if (arg[0] == '-' && arg[1] != '\0') { + flag_state = 1; + if (arg[2] == '-' && arg[3] == 0 ) + flag_state = 0; + else if (arg[2] != 0) usage(); /* no multiple options */ isnextarg = FALSE; @@ -191,7 +196,7 @@ char **argv; setcpu(0xF); break; case 'a': - asld_compatible = TRUE; + asld_compatible = flag_state; break; #endif case 'b': @@ -203,12 +208,13 @@ char **argv; ++argv; break; case 'g': - globals_only_in_obj = TRUE; + globals_only_in_obj = flag_state; break; #ifdef I80386 case 'j': - jumps_long = TRUE; - ++last_pass; + jumps_long = flag_state; + if( jumps_long ) ++last_pass; + else last_pass = 1; break; #endif case 'l': @@ -250,10 +256,12 @@ char **argv; ++argv; break; case 'u': - inidata = IMPBIT | SEGM; + if( flag_state ) inidata = IMPBIT | SEGM; + else inidata = 0; break; case 'w': - warn.semaphore = -1; + if( flag_state ) as_warn.semaphore = -1; + else as_warn.semaphore = 0; break; default: usage(); /* bad option */ diff --git a/as/as86_encap b/as/as86_encap.sh index 4d50e23..0ba4e71 100644 --- a/as/as86_encap +++ b/as/as86_encap.sh @@ -19,7 +19,10 @@ trap "rm -f _$$.* ; exit 99" 1 2 3 15 LIBDIR='%%LIBDIR%%' # Set by make install -[ -d "$LIBDIR" ] || LIBDIR=/usr/bin + +# If the one set by install fails then try a couple of others. +[ -x "$LIBDIR/as86" ] || LIBDIR="`dirname $0`/../lib" +[ -x "$LIBDIR/as86" ] || LIBDIR=/usr/bin IFILE="$1" OFILE="$2" diff --git a/as/express.c b/as/express.c index 3e93061..0bcd8b4 100644 --- a/as/express.c +++ b/as/express.c @@ -358,26 +358,32 @@ PUBLIC void scompare() register char *string1; register char *string2; - for (string2 = string1 = lineptr; *string2 != ')'; ++string2) + for (string2 = string1 = lineptr; *string2 != ','; ++string2) if (*string2 == 0 || *string2 == ')') { symname = string2; experror(COMEXP); return; } + string2++; while (*string1++ == *string2++) ; if (string2[-1] == ')') { if (string1[-1] == ',') lastexp.offset = TRUE; /* else leave FALSE */ + lineptr = string2; } else /* FALSE, keep reading to verify syntax */ + { for (; *string2 != ')'; ++string2) if (*string2 == 0 || *string2 == ',') { symname = string2; experror(RPEXP); } + lineptr = ++string2; + } + getsym(); } } @@ -2,4 +2,4 @@ EXTERN struct flags_s list; /* listing on/off */ EXTERN struct flags_s maclist; /* list macros on/off */ -EXTERN struct flags_s warn; /* warnings on/off */ +EXTERN struct flags_s as_warn; /* warnings on/off */ diff --git a/as/genbin.c b/as/genbin.c index 377c6bf..887c921 100644 --- a/as/genbin.c +++ b/as/genbin.c @@ -213,18 +213,22 @@ opcode_pt ch; else #endif { +#ifdef MSDOS +static PT zapptr = 0; +#endif outfd = binfil; - if( binfbuf != (PT)binmbuf) - if( lseek(binfil, (long)((PT)binmbuf-binfbuf), 1) < 0 ) - error(BWRAP); - binfbuf = binmbuf; -#if 0 - while (binfbuf < (PT)binmbuf) +#ifdef MSDOS + while (binfbuf < (PT)binmbuf && binfbuf >= zapptr+binmin) { - writec(0x0);/* pad with nulls if file buffer behind */ + writec(0); ++binfbuf; + ++zapptr; } #endif + if( binfbuf != (PT)binmbuf) + if( lseek(binfil, (long)((PT)binmbuf-binfbuf), 1) < 0 ) + error(BWRAP); + binfbuf = binmbuf; writec(ch); binmbuf = ++binfbuf; } diff --git a/as/genlist.c b/as/genlist.c index e1c43ea..f7c2572 100644 --- a/as/genlist.c +++ b/as/genlist.c @@ -138,7 +138,7 @@ error_pt errnum; register struct error_s *errptrlow; unsigned char position; - if ((unsigned) errnum < MINWARN || warn.current) + if ((unsigned) errnum < MINWARN || as_warn.current) { if (errcount >= MAXERR) erroverflow = TRUE; @@ -114,7 +114,7 @@ PUBLIC void pmacro() else symptr->type |= MACBIT; symptr->data = UNDBIT; /* undefined till end */ - symptr->value_reg_or_op.value = (unsigned) heapptr; + symptr->value_reg_or_op.value = (offset_t) heapptr; /* beginning of store for macro */ /* value s.b. (char *) */ getsym_nolookup(); /* test for "C" */ @@ -990,7 +990,7 @@ PUBLIC void ptext() PUBLIC void pwarn() { - bumpsem(&warn, -1); + bumpsem(&as_warn, -1); } #ifdef I80386 @@ -1,11 +1,5 @@ /* extern functions */ -#if __STDC__ -#define P(x) x -#else -#define P(x) () -#endif - /* as.c */ int main P((int argc, char **argv)); void as_abort P((char *message)); diff --git a/as/readsrc.c b/as/readsrc.c index 82be10f..557ca5d 100644 --- a/as/readsrc.c +++ b/as/readsrc.c @@ -29,6 +29,10 @@ #endif #endif +#ifdef MSDOS +#define off_t long /* Not a typedef! */ +#endif + #ifndef MINIBUF #define MINIBUF 1 /* Add in a reasonable buffer */ #endif @@ -94,8 +98,13 @@ char *name; fd = 0; else #endif +#ifdef O_BINARY if ((unsigned) (fd = open(name, O_RDONLY|O_BINARY)) > 255) as_abort("error opening input file"); +#else + if ((unsigned) (fd = open(name, O_RDONLY)) > 255) + as_abort("error opening input file"); +#endif #if BIGBUFFER == 1 if( mem_start == 0 ) @@ -254,9 +263,9 @@ PUBLIC void pproceof() { list.current = list.global; maclist.current = maclist.global; - warn.current = TRUE; - if (warn.semaphore < 0) - warn.current = FALSE; + as_warn.current = TRUE; + if (as_warn.semaphore < 0) + as_warn.current = FALSE; } if (infiln != 0) @@ -348,6 +357,10 @@ PUBLIC void readline() } } macstak->text = bufptr; +#if 0 + *reglineptr = 0; + printf("MLINE:%s.\n", lineptr); +#endif *reglineptr = EOLCHAR; return; } diff --git a/as/syshead.h b/as/syshead.h index d2a1655..926be5d 100644 --- a/as/syshead.h +++ b/as/syshead.h @@ -6,9 +6,9 @@ #endif #ifndef POSIX_HEADERS_MISSING -#include <unistd.h> #include <sys/types.h> #include <sys/stat.h> +#include <unistd.h> #include <fcntl.h> #endif @@ -20,6 +20,12 @@ #undef POSIX_HEADERS_MISSING #endif +#if __STDC__ && !defined(__minix) +#define P(x) x +#else +#define P(x) () +#endif + #ifdef STDC_HEADERS_MISSING char *strcpy P((char *s1, const char *s2)); char *strrchr P((const char *s, int c)); @@ -38,13 +44,17 @@ int creat P((const char *path, int mode)); int open P((const char *path, int oflag, ...)); int read P((int fd, void *buf, unsigned nbytes)); int write P((int fd, const void *buf, unsigned nbytes)); -off_t lseek P((int fd, off_t offset, int whence)); typedef long off_t; -#define O_RDONLY 0 - +off_t lseek P((int fd, off_t offset, int whence)); #define BIGBUFFER 0 /* Can't use a big buffer ... sorry */ #endif -#ifndef O_BINARY -#define O_BINARY 0 +#ifndef O_RDONLY +#define O_RDONLY 0 +#endif +#ifndef O_WRONLY +#define O_WRONLY 1 +#endif +#ifndef O_RDWR +#define O_RDWR 2 #endif diff --git a/as/typeconv.c b/as/typeconv.c index 82dafdd..c51b991 100644 --- a/as/typeconv.c +++ b/as/typeconv.c @@ -34,6 +34,7 @@ preprocessor is too dumb to tell us at compile time. */ +#include "syshead.h" #include "const.h" #include "type.h" #include "globvar.h" |