summaryrefslogtreecommitdiff
path: root/bin86-0.3
diff options
context:
space:
mode:
Diffstat (limited to 'bin86-0.3')
-rw-r--r--bin86-0.3/ChangeLog67
-rw-r--r--bin86-0.3/Makefile36
-rw-r--r--bin86-0.3/README79
-rw-r--r--bin86-0.3/a.out.h/a.out.gnu.h276
-rw-r--r--bin86-0.3/a.out.h/bsd-a.out.h108
-rw-r--r--bin86-0.3/as/6809/const.h507
-rw-r--r--bin86-0.3/as/Makefile57
-rw-r--r--bin86-0.3/as/address.h36
-rw-r--r--bin86-0.3/as/as.c280
-rw-r--r--bin86-0.3/as/asm/calljmp.asm70
-rw-r--r--bin86-0.3/as/asm/ea.asm109
-rw-r--r--bin86-0.3/as/asm/each.asm145
-rw-r--r--bin86-0.3/as/asm/easlow.as1219
-rw-r--r--bin86-0.3/as/asm/f.asm114
-rw-r--r--bin86-0.3/as/asm/fadd.asm271
-rw-r--r--bin86-0.3/as/asm/farcall.asm10
-rw-r--r--bin86-0.3/as/asm/group1.asm31
-rw-r--r--bin86-0.3/as/asm/group6.asm24
-rw-r--r--bin86-0.3/as/asm/group7.asm34
-rw-r--r--bin86-0.3/as/asm/imul.asm33
-rw-r--r--bin86-0.3/as/asm/incdec.asm83
-rw-r--r--bin86-0.3/as/asm/inher.asm127
-rw-r--r--bin86-0.3/as/asm/inout.asm25
-rw-r--r--bin86-0.3/as/asm/movspec.asm246
-rw-r--r--bin86-0.3/as/asm/pushpop.asm86
-rw-r--r--bin86-0.3/as/asm/seg.asm6
-rw-r--r--bin86-0.3/as/asm/shdouble.asm34
-rw-r--r--bin86-0.3/as/asm/shift.asm119
-rw-r--r--bin86-0.3/as/asm/summary.as385
-rw-r--r--bin86-0.3/as/asm/xchg.asm103
-rw-r--r--bin86-0.3/as/assemble.c314
-rw-r--r--bin86-0.3/as/byteord.h24
-rwxr-xr-xbin86-0.3/as/chk9
-rw-r--r--bin86-0.3/as/const.h430
-rw-r--r--bin86-0.3/as/det_endian.c34
-rw-r--r--bin86-0.3/as/error.c105
-rw-r--r--bin86-0.3/as/express.c388
-rw-r--r--bin86-0.3/as/file.h18
-rw-r--r--bin86-0.3/as/flag.h11
-rw-r--r--bin86-0.3/as/genbin.c226
-rw-r--r--bin86-0.3/as/genlist.c454
-rw-r--r--bin86-0.3/as/genobj.c669
-rw-r--r--bin86-0.3/as/gensym.c202
-rw-r--r--bin86-0.3/as/globvar.h95
-rw-r--r--bin86-0.3/as/keywords.c733
-rw-r--r--bin86-0.3/as/macro.c174
-rw-r--r--bin86-0.3/as/macro.h16
-rw-r--r--bin86-0.3/as/mops.c2840
-rw-r--r--bin86-0.3/as/opcode.h162
-rw-r--r--bin86-0.3/as/pops.c977
-rw-r--r--bin86-0.3/as/proto.h256
-rw-r--r--bin86-0.3/as/readsrc.c335
-rw-r--r--bin86-0.3/as/scan.c253
-rw-r--r--bin86-0.3/as/scan.h18
-rw-r--r--bin86-0.3/as/source.h10
-rw-r--r--bin86-0.3/as/table.c229
-rw-r--r--bin86-0.3/as/todo10
-rw-r--r--bin86-0.3/as/type.h177
-rw-r--r--bin86-0.3/as/work/q4
-rw-r--r--bin86-0.3/as/work/r4
-rw-r--r--bin86-0.3/as/work/r-good1183
-rw-r--r--bin86-0.3/as/work/t3
-rw-r--r--bin86-0.3/as/work/t110
-rw-r--r--bin86-0.3/as/work/z5
-rw-r--r--bin86-0.3/bcc/bcc.c831
-rw-r--r--bin86-0.3/bcc/bcc.doc165
-rw-r--r--bin86-0.3/bccfp/Makefile44
-rw-r--r--bin86-0.3/bccfp/bccfp.tex0
-rw-r--r--bin86-0.3/bccfp/changes30
-rw-r--r--bin86-0.3/bccfp/fabs.x17
-rw-r--r--bin86-0.3/bccfp/fadd.x485
-rw-r--r--bin86-0.3/bccfp/fcomp.x89
-rw-r--r--bin86-0.3/bccfp/fdiv.x312
-rw-r--r--bin86-0.3/bccfp/fmul.x150
-rw-r--r--bin86-0.3/bccfp/fpbsr.x25
-rw-r--r--bin86-0.3/bccfp/fperr.c50
-rw-r--r--bin86-0.3/bccfp/fperr.h14
-rw-r--r--bin86-0.3/bccfp/fperror.x126
-rw-r--r--bin86-0.3/bccfp/fplib.h49
-rw-r--r--bin86-0.3/bccfp/fptoi.x117
-rw-r--r--bin86-0.3/bccfp/fpulld.x20
-rw-r--r--bin86-0.3/bccfp/fpullf.x101
-rw-r--r--bin86-0.3/bccfp/fpushd.x60
-rw-r--r--bin86-0.3/bccfp/fpushf.x74
-rw-r--r--bin86-0.3/bccfp/fpushi.x126
-rw-r--r--bin86-0.3/bccfp/frexp.x66
-rw-r--r--bin86-0.3/bccfp/ftst.x28
-rw-r--r--bin86-0.3/bccfp/ldexp.x74
-rw-r--r--bin86-0.3/bccfp/modf.c20
-rw-r--r--bin86-0.3/bccfp/test.c124
-rw-r--r--bin86-0.3/ld/6809/config.h34
-rw-r--r--bin86-0.3/ld/Makefile29
-rw-r--r--bin86-0.3/ld/align.h14
-rw-r--r--bin86-0.3/ld/ar.h24
-rw-r--r--bin86-0.3/ld/bugs17
-rw-r--r--bin86-0.3/ld/byteord.h24
-rw-r--r--bin86-0.3/ld/config.h34
-rw-r--r--bin86-0.3/ld/const.h20
-rw-r--r--bin86-0.3/ld/dumps.c72
-rw-r--r--bin86-0.3/ld/globvar.h18
-rw-r--r--bin86-0.3/ld/io.c583
-rw-r--r--bin86-0.3/ld/ld.c180
-rw-r--r--bin86-0.3/ld/obj.h58
-rw-r--r--bin86-0.3/ld/readobj.c368
-rw-r--r--bin86-0.3/ld/table.c202
-rw-r--r--bin86-0.3/ld/type.h228
-rw-r--r--bin86-0.3/ld/typeconv.c540
-rw-r--r--bin86-0.3/ld/writebin.c949
108 files changed, 0 insertions, 21689 deletions
diff --git a/bin86-0.3/ChangeLog b/bin86-0.3/ChangeLog
deleted file mode 100644
index 1e6d936..0000000
--- a/bin86-0.3/ChangeLog
+++ /dev/null
@@ -1,67 +0,0 @@
-Tue May 16 22:01:05 1995 H.J. Lu (hjl@nynexst.com)
-
- * version 0.3 is released.
-
- * Makefile: fix a few typos.
-
- * as/const.h: include "endian.h".
- (LOW_BYTE): check the byte order.
-
- * Makefile (endian.h): new target.
- (const.h): depend on endian.h.
-
- * as/det_endian.c: new from glibc.
-
-Sat Mar 18 16:39:19 1995 Francois-Rene Rideau (rideau@clipper.ens.fr)
-
- * as/pops.c (doif): support nested conditionals.
-
-Mon Nov 21 22:48:26 1994 H.J. Lu (hlu@nighthawk)
-
- * version 0.2 is released.
-
- * Makefile (MFLAGS): new. add BINDIR and CC.
-
-Fri Nov 18 22:25:24 1994 Package Maintainer (opt@calum.csclub.uwaterloo.ca)
-
- * ./as/Makefile:
- * ./as/const.h:
- * ./as/proto.h:
- * ./as/readsrc.c:
- * ./as/type.h:
- * ./ld/Makefile:
- * ./ld/align.h:
- * ./ld/config.h:
- * ./ld/type.h:
- * ./ld/typeconv.c: remove endian dependency.
-
-Thu Mar 3 15:12:23 1994 H.J. Lu (hlu@nighthawk)
-
- * version 0.1 is released.
-
- * Makefile: new.
-
- * a.out.h/bsd-a.out.h (struct exec): use short form if
- __linux__ is defined.
-
- * as/Makefile: minor changes.
- (CLFAGS): add -I../a.out.h.
-
- * ld/Makefile: minor changes.
- (CLFAGS): add -I../a.out.h.
-
- * ld/io.c (MY_STAT_H): don't define it if __linux__ is
- defined.
-
- * ld/ld.c (flag['z']): initialized to 0 if __linux__ is
- defined.
-
- * ld/obj.h (roundup):
- * ld/writebin.c (roundup):
- ld/readobj.c (roundup): change that to ld_roundup to avoid the
- conflict with the system's roundup.
-
- * ld/writebin.c: cleanup for the latest Linux C library.
- (FILEHEADERLENGTH): change to sizeof (struct exec).
- don't write a_trsize and its friends.
-
diff --git a/bin86-0.3/Makefile b/bin86-0.3/Makefile
deleted file mode 100644
index 62a0730..0000000
--- a/bin86-0.3/Makefile
+++ /dev/null
@@ -1,36 +0,0 @@
-CC=gcc
-CFLAGS=-O6 -fomit-frame-pointer
-LDFLAGS=
-# Where to get strtoul ()?
-#LIBS=-liberty
-DIRS=ld as
-
-BINDIR=/usr/gnu/i486-linux/bin
-AS86=i486-linux-ld86
-LD86=i486-linux-ld86
-
-BINDIR=/usr/bin
-AS86=as86
-LD86=ld86
-
-STRIP=strip
-
-MFLAGS= "LIBS=$(LIBS)" \
- "CFLAGS=$(CFLAGS)" \
- "LDFLAGS=$(LDFLAGS)" \
- "CC=$(CC)"
-
-all:
- for d in $(DIRS); do \
- (cd $$d; $(MAKE) $(MFLAGS) $@;); \
- done
-
-install: all
- cp as/as86 $(BINDIR)/$(AS86)
- cp ld/ld86 $(BINDIR)/$(LD86)
- $(STRIP) $(BINDIR)/$(AS86) $(BINDIR)/$(LD86)
-
-depend clean clobber:
- for d in $(DIRS); do \
- (cd $$d; $(MAKE) $(MFLAGS) $@;); \
- done
diff --git a/bin86-0.3/README b/bin86-0.3/README
deleted file mode 100644
index f91a9dc..0000000
--- a/bin86-0.3/README
+++ /dev/null
@@ -1,79 +0,0 @@
-To build this real mode as/ld for x86, just edit Makefile and then
-do
-
-make install
-
-It is only tested under SunOS 4.1.3 and Linux.
-
-H.J. Lu
-hjl@nynexst.com
-11/21/94
-------
-We seem to have cross bin86 for Solaris working. The most important
-changes involve alignment (it needs to be on) and byte ordering.
-Some of the patches just eliminate compiler warnings (conversion of
-pointer to integer without a cast, etc.) and some (in the Makefiles)
-reflect the local setup, and can probably be ignored (the change to $BINDIR,
-for example).
-
- - Ian (iagoldbe@csclub.uwaterloo.ca)
-
-----
-I modified it for the latest Linux C library 4.5.21 and released it as
-bin86 0.1. It is only tested for building the Linux kernel and is not
-intended for any other purposes. To build it under Linux, just type
-
-make all
-make install
-
-It is not tested for cross-compiling. If you have any patches for
-cross-compiling, please send them to me.
-
-Thanks.
-
-
-H.J. Lu
-hjl@nynexst.com
-03/03/94
--------------
-This is the as86 and ld86 distribution written by Bruce Evans. It's
-copyright Bruce Evans, all rights reserved although you may use and copy
-it for your personal use. It's a complete 8086 assembler and loader
-which can make 32-bit code for the 386+ processors (under linux it's
-used only to create the 16-bit bootsector and setup binaries). The
-syntax is not compatible with the GNU assembler, but closer to intel
-syntax ("wrong" order of operands etc).
-
-Hints for compiling:
-
- - you'll need the a.out.h-files from the a.out.h directory for the
-linker. These aren't really part of the distribution, but I included
-them for ease of setup (in case you need to crosscompile etc). Do a
- cp a.out.h/* ld/
-or similar before compiling the linker.
-
- - the assembler needs the typeconv.o file produced by the linker
-compilation. So compile the linker first, and then do a
- cp ld/typeconv.o as/
-before making the assembler.
-
-This distribution also contains some test-files etc that aren't actually
-needed, but as they also give some idea of the assembler syntax, I left
-them in. The directories are as follows:
-
- as - the assembler sources (minus typeconv.c)
- ld - linker sources
- bcc - bruce evans' cc frontend sources (the actual compiler isn't
- included).
- bccfp - assembly floating point routines written by bruce evans. Note
- that these use integer register returns, and won't work with the
- linux libraries. They can be used as examples of as86 code.
- a.out.h - header files for crosscompilation.
-
-Note that I am NOT the author of this package, but I'll forward any
-comments to bruce evans and I'll try to answer any questions about the
-assembler/linker I can. I just made it available as bde doesn't have
-ftp capability right now. Bruce Evans does have mail as
-<bde@runx.oz.au>.
-
- Linus Torvalds
diff --git a/bin86-0.3/a.out.h/a.out.gnu.h b/bin86-0.3/a.out.h/a.out.gnu.h
deleted file mode 100644
index bf6d4d9..0000000
--- a/bin86-0.3/a.out.h/a.out.gnu.h
+++ /dev/null
@@ -1,276 +0,0 @@
-#ifndef __A_OUT_GNU_H__
-#define __A_OUT_GNU_H__
-
-#if defined(sequent) && defined(i386)
-#define a_magic a_info
-#include <a.out.h>
-#undef a_magic
-#define __STRUCT_EXEC_OVERRIDE__
-#define N_NLIST_DECLARED
-#define N_RELOCATION_INFO_DECLARED
-#endif
-
-#define __GNU_EXEC_MACROS__
-
-#ifndef __STRUCT_EXEC_OVERRIDE__
-
-struct exec
-{
- unsigned long a_info; /* Use macros N_MAGIC, etc for access */
- unsigned long a_text; /* length of text, in bytes */
- unsigned long a_data; /* length of data, in bytes */
- unsigned long a_bss; /* length of uninitialized data area for file, in bytes */
- unsigned long a_syms; /* length of symbol table data in file, in bytes */
- unsigned long a_entry; /* start address */
- unsigned long a_trsize; /* length of relocation info for text, in bytes */
- unsigned long a_drsize; /* length of relocation info for data, in bytes */
-};
-
-#endif /* __STRUCT_EXEC_OVERRIDE__ */
-
-/* these go in the N_MACHTYPE field */
-enum machine_type {
-#if defined (M_OLDSUN2)
- M__OLDSUN2 = M_OLDSUN2,
-#else
- M_OLDSUN2 = 0,
-#endif
-#if defined (M_68010)
- M__68010 = M_68010,
-#else
- M_68010 = 1,
-#endif
-#if defined (M_68020)
- M__68020 = M_68020,
-#else
- M_68020 = 2,
-#endif
-#if defined (M_SPARC)
- M__SPARC = M_SPARC,
-#else
- M_SPARC = 3,
-#endif
- /* skip a bunch so we don't run into any of sun's numbers */
- M_386 = 100,
-};
-
-#if !defined (N_MAGIC)
-#define N_MAGIC(exec) ((exec).a_info & 0xffff)
-#endif
-#define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff))
-#define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff)
-#define N_SET_INFO(exec, magic, type, flags) \
- ((exec).a_info = ((magic) & 0xffff) \
- | (((int)(type) & 0xff) << 16) \
- | (((flags) & 0xff) << 24))
-#define N_SET_MAGIC(exec, magic) \
- ((exec).a_info = (((exec).a_info & 0xffff0000) | ((magic) & 0xffff)))
-
-#define N_SET_MACHTYPE(exec, machtype) \
- ((exec).a_info = \
- ((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16))
-
-#define N_SET_FLAGS(exec, flags) \
- ((exec).a_info = \
- ((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24))
-
-#ifndef OMAGIC
-/* Code indicating object file or impure executable. */
-#define OMAGIC 0407
-/* Code indicating pure executable. */
-#define NMAGIC 0410
-/* Code indicating demand-paged executable. */
-#define ZMAGIC 0413
-#endif /* not OMAGIC */
-
-#if !defined (N_BADMAG)
-#define N_BADMAG(x) \
- (N_MAGIC(x) != OMAGIC && N_MAGIC(x) != NMAGIC \
- && N_MAGIC(x) != ZMAGIC)
-#endif
-
-#define _N_BADMAG(x) \
- (N_MAGIC(x) != OMAGIC && N_MAGIC(x) != NMAGIC \
- && N_MAGIC(x) != ZMAGIC)
-
-#define _N_HDROFF(x) (SEGMENT_SIZE - sizeof (struct exec))
-
-#if !defined (N_TXTOFF)
-#define N_TXTOFF(x) \
- (N_MAGIC(x) == ZMAGIC ? _N_HDROFF((x)) + sizeof (struct exec) : sizeof (struct exec))
-#endif
-
-#if !defined (N_DATOFF)
-#define N_DATOFF(x) (N_TXTOFF(x) + (x).a_text)
-#endif
-
-#if !defined (N_TRELOFF)
-#define N_TRELOFF(x) (N_DATOFF(x) + (x).a_data)
-#endif
-
-#if !defined (N_DRELOFF)
-#define N_DRELOFF(x) (N_TRELOFF(x) + (x).a_trsize)
-#endif
-
-#if !defined (N_SYMOFF)
-#define N_SYMOFF(x) (N_DRELOFF(x) + (x).a_drsize)
-#endif
-
-#if !defined (N_STROFF)
-#define N_STROFF(x) (N_SYMOFF(x) + (x).a_syms)
-#endif
-
-/* Address of text segment in memory after it is loaded. */
-#if !defined (N_TXTADDR)
-#define N_TXTADDR(x) 0
-#endif
-
-/* Address of data segment in memory after it is loaded.
- Note that it is up to you to define SEGMENT_SIZE
- on machines not listed here. */
-#if defined(vax) || defined(hp300) || defined(pyr)
-#define SEGMENT_SIZE PAGE_SIZE
-#endif
-#ifdef hp300
-#define PAGE_SIZE 4096
-#endif
-#ifdef sony
-#define SEGMENT_SIZE 0x2000
-#endif /* Sony. */
-#ifdef is68k
-#define SEGMENT_SIZE 0x20000
-#endif
-#if defined(m68k) && defined(PORTAR)
-#define PAGE_SIZE 0x400
-#define SEGMENT_SIZE PAGE_SIZE
-#endif
-
-#define _N_SEGMENT_ROUND(x) (((x) + SEGMENT_SIZE - 1) & ~(SEGMENT_SIZE - 1))
-
-#define _N_TXTENDADDR(x) (N_TXTADDR(x)+(x).a_text)
-
-#ifndef N_DATADDR
-#define N_DATADDR(x) \
- (N_MAGIC(x)==OMAGIC? (_N_TXTENDADDR(x)) \
- : (_N_SEGMENT_ROUND (_N_TXTENDADDR(x))))
-#endif
-
-/* Address of bss segment in memory after it is loaded. */
-#if !defined (N_BSSADDR)
-#define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data)
-#endif
-
-#if !defined (N_NLIST_DECLARED)
-struct nlist {
- union {
- char *n_name;
- struct nlist *n_next;
- long n_strx;
- } n_un;
- unsigned char n_type;
- char n_other;
- short n_desc;
- unsigned long n_value;
-};
-#endif /* no N_NLIST_DECLARED. */
-
-#if !defined (N_UNDF)
-#define N_UNDF 0
-#endif
-#if !defined (N_ABS)
-#define N_ABS 2
-#endif
-#if !defined (N_TEXT)
-#define N_TEXT 4
-#endif
-#if !defined (N_DATA)
-#define N_DATA 6
-#endif
-#if !defined (N_BSS)
-#define N_BSS 8
-#endif
-#if !defined (N_COMM)
-#define N_COMM 18
-#endif
-#if !defined (N_FN)
-#define N_FN 15
-#endif
-
-#if !defined (N_EXT)
-#define N_EXT 1
-#endif
-#if !defined (N_TYPE)
-#define N_TYPE 036
-#endif
-#if !defined (N_STAB)
-#define N_STAB 0340
-#endif
-
-/* The following type indicates the definition of a symbol as being
- an indirect reference to another symbol. The other symbol
- appears as an undefined reference, immediately following this symbol.
-
- Indirection is asymmetrical. The other symbol's value will be used
- to satisfy requests for the indirect symbol, but not vice versa.
- If the other symbol does not have a definition, libraries will
- be searched to find a definition. */
-#define N_INDR 0xa
-
-/* The following symbols refer to set elements.
- All the N_SET[ATDB] symbols with the same name form one set.
- Space is allocated for the set in the text section, and each set
- element's value is stored into one word of the space.
- The first word of the space is the length of the set (number of elements).
-
- The address of the set is made into an N_SETV symbol
- whose name is the same as the name of the set.
- This symbol acts like a N_DATA global symbol
- in that it can satisfy undefined external references. */
-
-/* These appear as input to LD, in a .o file. */
-#define N_SETA 0x14 /* Absolute set element symbol */
-#define N_SETT 0x16 /* Text set element symbol */
-#define N_SETD 0x18 /* Data set element symbol */
-#define N_SETB 0x1A /* Bss set element symbol */
-
-/* This is output from LD. */
-#define N_SETV 0x1C /* Pointer to set vector in data area. */
-
-#if !defined (N_RELOCATION_INFO_DECLARED)
-/* This structure describes a single relocation to be performed.
- The text-relocation section of the file is a vector of these structures,
- all of which apply to the text section.
- Likewise, the data-relocation section applies to the data section. */
-
-struct relocation_info
-{
- /* Address (within segment) to be relocated. */
- unsigned long r_address;
-#if 0
- /* The meaning of r_symbolnum depends on r_extern. */
- unsigned int r_symbolnum:24;
- /* Nonzero means value is a pc-relative offset
- and it should be relocated for changes in its own address
- as well as for changes in the symbol or section specified. */
- unsigned int r_pcrel:1;
- /* Length (as exponent of 2) of the field to be relocated.
- Thus, a value of 2 indicates 1<<2 bytes. */
- unsigned int r_length:2;
- /* 1 => relocate with value of symbol.
- r_symbolnum is the index of the symbol
- in file's the symbol table.
- 0 => relocate with the address of a segment.
- r_symbolnum is N_TEXT, N_DATA, N_BSS or N_ABS
- (the N_EXT bit may be set also, but signifies nothing). */
- unsigned int r_extern:1;
- /* Four bits that aren't used, but when writing an object file
- it is desirable to clear them. */
- unsigned int r_pad:4;
-#else
- unsigned long foo;
-#endif
-};
-#endif /* no N_RELOCATION_INFO_DECLARED. */
-
-
-#endif /* __A_OUT_GNU_H__ */
diff --git a/bin86-0.3/a.out.h/bsd-a.out.h b/bin86-0.3/a.out.h/bsd-a.out.h
deleted file mode 100644
index b59435b..0000000
--- a/bin86-0.3/a.out.h/bsd-a.out.h
+++ /dev/null
@@ -1,108 +0,0 @@
-#ifndef _BSD_A_OUT_H
-#define _BSD_A_OUT_H
-
-struct exec { /* a.out header */
- unsigned char a_magic[2]; /* magic number */
- unsigned char a_flags; /* flags, see below */
- unsigned char a_cpu; /* cpu id */
- unsigned char a_hdrlen; /* length of header */
- unsigned char a_unused; /* reserved for future use */
- unsigned short a_version; /* version stamp (not used at present) */
- long a_text; /* size of text segement in bytes */
- long a_data; /* size of data segment in bytes */
- long a_bss; /* size of bss segment in bytes */
- long a_entry; /* entry point */
- long a_total; /* total memory allocated */
- long a_syms; /* size of symbol table */
- /* SHORT FORM ENDS HERE */
-#ifndef __linux__
- long a_trsize; /* text relocation size */
- long a_drsize; /* data relocation size */
- long a_tbase; /* text relocation base */
- long a_dbase; /* data relocation base */
-#endif
-};
-
-#define A_MAGIC0 ((unsigned char) 0x01)
-#define A_MAGIC1 ((unsigned char) 0x03)
-#define BADMAG(X) ((X).a_magic[0] != A_MAGIC0 || (X).a_magic[1] != A_MAGIC1)
-
-/* CPU Id of TARGET machine (byte order coded in low order two bits) */
-#define A_NONE 0x00 /* unknown */
-#define A_I8086 0x04 /* intel i8086/8088 */
-#define A_M68K 0x0B /* motorola m68000 */
-#define A_NS16K 0x0C /* national semiconductor 16032 */
-#define A_I80386 0x10 /* intel i80386 */
-#define A_SPARC 0x17 /* Sun SPARC */
-
-#define A_BLR(cputype) ((cputype&0x01)!=0) /* TRUE if bytes left-to-right */
-#define A_WLR(cputype) ((cputype&0x02)!=0) /* TRUE if words left-to-right */
-
-/* Flags. */
-#define A_UZP 0x01 /* unmapped zero page (pages) */
-#define A_EXEC 0x10 /* executable */
-#define A_SEP 0x20 /* separate I/D */
-#define A_PURE 0x40 /* pure text */ /* not used */
-#define A_TOVLY 0x80 /* text overlay */ /* not used */
-
-/* Tell a.out.gnu.h not to define `struct exec'. */
-#define __STRUCT_EXEC_OVERRIDE__
-
-/* Hide M_386 from enum declaration in a.out.h. */
-#define M_386 HIDE_M_386
-
-#include "a.out.gnu.h"
-
-#undef M_386
-#define M_386 A_I80386
-
-#undef N_MAGIC
-#define N_MAGIC3(magic0, magic1, type) \
- ((magic0) | ((magic1) << 8) | ((type) << 16))
-#define N_MAGIC(exec) \
- N_MAGIC3((exec).a_magic[0], (exec).a_magic[1], (exec).a_flags)
-
-#undef N_MACHTYPE
-#define N_MACHTYPE(exec) ((enum machine_type)((exec).a_cpu))
-
-#undef N_FLAGS
-#define N_FLAGS(exec) 0
-
-#undef N_SET_INFO
-#define N_SET_INFO(exec, magic, type, flags) \
- ((exec).a_magic[0] = (magic) & 0xff, \
- (exec).a_magic[1] = ((magic) >> 8) & 0xff, \
- (exec).a_flags = ((magic) >> 16) & 0xff, \
- (exec).a_cpu = (type) & 0xff)
-
-#undef N_SET_MAGIC
-#define N_SET_MAGIC(exec, magic) \
- ((exec).a_magic[0] = (magic) & 0xff, \
- (exec).a_magic[1] = ((magic) >> 8) & 0xff, \
- (exec).a_flags = ((magic) >> 16) & 0xff)
-
-#undef N_SET_MACHTYPE
-#define N_SET_MACHTYPE(exec, machtype) \
- ((exec).a_cpu = (machtype) & 0xff, \
- (exec).a_hdrlen = sizeof (exec))
-
-#undef N_SET_FLAGS
-#define N_SET_FLAGS(exec, flags) /* nothing */
-
-#undef OMAGIC
-#define OMAGIC N_MAGIC3(A_MAGIC0, A_MAGIC1, 0)
-
-#undef NMAGIC
-#define NMAGIC N_MAGIC3(A_MAGIC0, A_MAGIC1, A_EXEC)
-
-#undef ZMAGIC
-#define ZMAGIC N_MAGIC3(A_MAGIC0, A_MAGIC1, A_EXEC)
-
-#undef _N_HDROFF
-#define _N_HDROFF(x) 0
-
-#define PAGE_SIZE 16
-#define SEGMENT_SIZE PAGE_SIZE
-#define getpagesize() PAGE_SIZE
-
-#endif /* _BSD_A_OUT_H */
diff --git a/bin86-0.3/as/6809/const.h b/bin86-0.3/as/6809/const.h
deleted file mode 100644
index 512c348..0000000
--- a/bin86-0.3/as/6809/const.h
+++ /dev/null
@@ -1,507 +0,0 @@
-/*
- * bin86/as/6809/const.h
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-#define align(x) /* ((x) = ((int) (x) + (4-1)) & ~(4-1)) */
-#define LOW_BYTE 0 /* must be changed for big-endian */
-
-/* const.h - constants for assembler */
-
-/* major switches */
-
-#undef I80386 /* generate 80386 code */
-#define MC6809 /* generate 6809 code */
-#define MNSIZE /* allow byte size in mnemonic, e.g. "movb" */
-#undef SOS_EDOS /* source OS is EDOS */
-
-/* defaults */
-
-#define DIRCHAR '/' /* character separating filename from dir */
-#define INBUFSIZE 8192
-#define SOS_EOLSTR "\012"
-
-/* defaults modified by switches */
-
-#ifdef SOS_EDOS
-# undef INBUFSIZE
-# define INBUFSIZE 512
-# undef SOS_EOLSTR
-# define SOS_EOLSTR "\015\012"
-# define STAKSIZ 256 /* table grows up to stack less this */
-#endif
-
-/* booleans */
-
-#define FALSE 0
-#define TRUE 1
-
-/* ASCII constants */
-
-#define ETB 23
-
-/* C tricks */
-
-#define EXTERN extern
-#define FORWARD static
-#define PRIVATE static
-#define PUBLIC
-#define NULL 0
-
-/* O/S constants */
-
-#define CREAT_PERMS 0666
-#define EOF (-1)
-#define STDIN 0
-#define STDOUT 1
-
-/* register codes (internal to assembler) */
-
-#ifdef I80386
-
-/* index regs must be first */
-
-#define BPREG 0
-#define BXREG 1
-#define DIREG 2
-#define SIREG 3
-#define MAX16BITINDREG 3
-
-#define EAXREG 4
-#define EBPREG 5
-#define EBXREG 6
-#define ECXREG 7
-#define EDIREG 8
-#define EDXREG 9
-#define ESIREG 10
-#define ESPREG 11
-#define MAXINDREG 11
-
-#define AXREG 12
-#define CXREG 13
-#define DXREG 14
-#define SPREG 15
-
-#define AHREG 16
-#define ALREG 17
-#define BHREG 18
-#define BLREG 19
-#define CHREG 20
-#define CLREG 21
-#define DHREG 22
-#define DLREG 23
-
-#define CSREG 24
-#define DSREG 25
-#define ESREG 26
-#define FSREG 27
-#define GSREG 28
-#define SSREG 29
-
-#define CR0REG 30
-#define CR2REG 31
-#define CR3REG 32
-#define DR0REG 33
-#define DR1REG 34
-#define DR2REG 35
-#define DR3REG 36
-#define DR6REG 37
-#define DR7REG 38
-#define TR6REG 39
-#define TR7REG 40
-
-#define NOREG 41
-
-#endif /* I80386 */
-
-#ifdef MC6809
-
-/* index regs must be first, then PC, then other regs */
-
-#define AREG 5
-#define BREG 6
-#define CCREG 7
-#define DPREG 8
-#define DREG 9
-#define MAXINDREG 3
-#define NOREG 10
-#define PCREG 4
-#define SREG 0
-#define UREG 1
-#define XREG 2
-#define YREG 3
-
-#endif
-
-#ifdef I80386
-
-/* type and size keywords */
-
-#define BYTEOP 0
-#define DWORDOP 1
-#define FWORDOP 2
-#define FAROP 3
-#define PTROP 4
-#define PWORDOP 5
-#define QWORDOP 6
-#define TBYTEOP 7
-#define WORDOP 8
-#endif
-
-/* special chars */
-
-#define EOL 0
-#define MACROCHAR '?'
-
-/* symbol codes */
-
-/* the first 2 must be from chars in identifiers */
-#define IDENT 0
-#define INTCONST 1
-
-/* the next few are best for other possibly-multi-char tokens */
-#define ADDOP 2 /* also ++ */
-#define BINCONST 3
-#define CHARCONST 4
-#define GREATERTHAN 5 /* also >> and context-sensitive */
-#define HEXCONST 6
-#define LESSTHAN 7 /* also << and context-sensitive */
-#define SUBOP 8 /* also -- */
-#define WHITESPACE 9
-
-#define ANDOP 10
-#define COMMA 11
-#define EOLSYM 12
-#define EQOP 13
-#define IMMEDIATE 14
-#define INDIRECT 15
-#define LBRACKET 16
-#define LPAREN 17
-#define MACROARG 18
-#define NOTOP 19
-#define OROP 20
-#define OTHERSYM 21
-#define POSTINCOP 22
-#define PREDECOP 23
-#define RBRACKET 24
-#define RPAREN 25
-#define SLASH 26 /* context-sensitive */
-#define SLOP 27
-#define SROP 28
-#define STAR 29 /* context-sensitive */
-#define STRINGCONST 30
-#define COLON 31
-
-/* these are from assembler errors module */
-
-/* syntax errors */
-
-#define COMEXP 0
-#define DELEXP 1
-#define FACEXP 2
-#define IREGEXP 3
-#define LABEXP 4
-#define LPEXP 5
-#define OPEXP 6
-#define RBEXP 7
-#define REGEXP 8
-#define RPEXP 9
-#define SPEXP 10
-
-/* expression errors */
-
-#define ABSREQ 11
-#define NONIMPREQ 12
-#define RELBAD 13
-
-/* label errors */
-
-#define ILLAB 14
-#define MACUID 15
-#define MISLAB 16
-#define MNUID 17
-#define REGUID 18
-#define RELAB 19
-#define UNBLAB 20
-#define UNLAB 21
-#define VARLAB 22
-
-/* addressing errors */
-
-#define ABOUNDS 23
-#define DBOUNDS 24
-#define ILLMOD 25
-#define ILLREG 26
-
-/* control structure errors */
-
-#define ELSEBAD 27
-#define ELSEIFBAD 27
-#define ENDBBAD 28
-#define ENDIFBAD 27
-#define EOFBLOCK 29
-#define EOFIF 30
-
-#define EOFLC 31
-#define EOFMAC 32
-#define FAILERR 33
-
-/* overflow errors */
-
-#define BLOCKOV 34
-#define BWRAP 35
-#define COUNTOV 36
-#define COUNTUN 37
-#define GETOV 38
-#define IFOV 39
-
-#define LINLONG 40
-#define MACOV 41
-#define OBJSYMOV 42
-#define OWRITE 43
-#define PAROV 44
-#define SYMOV 45
-#define SYMOUTOV 46
-
-/* i/o errors */
-
-#define OBJOUT 47
-
-/* miscellaneous errors */
-
-#define CTLINS 48
-#define FURTHER 49
-#define NOIMPORT 50
-#define NOTIMPLEMENTED 51
-#define REENTER 52
-#define SEGREL 53
-
-/* warnings */
-
-#define MINWARN 54
-#define ALREADY 54
-#define SHORTB 55
-
-/* symbol table entry */
-
- /* type entry contains following flags */
-#define ENTBIT (1<<0) /* entry point (=OBJ_N_MASK) */
-#define COMMBIT (1<<1) /* common */
-#define LABIT (1<<2) /* label (a PC location or defined by EQU) */
-#define MNREGBIT (1<<3) /* mnemonic for op or pseudo-op, or register */
-#define MACBIT (1<<4) /* macro */
-#define REDBIT (1<<5) /* redefined */
-#define VARBIT (1<<6) /* variable (i.e. something defined by SET) */
-#define EXPBIT (1<<7) /* exported (= OBJ_E_MASK) */
-
- /* data entry contains following flags, valid */
- /* for expressions as well as syms */
-#define PAGE1 (1<<0) /* page 1 machine op = MNREGBIT \ PAGE1 */
-#define PAGE2 (1<<1) /* page 2 machine op = MNREGBIT \ PAGE2 */
-#define REGBIT (1<<2) /* register = MNREGBIT \ REGBIT */
-#define SIZEBIT (1<<3) /* sizing mnemonic = MNREGBIT \ SIZEBIT */
-#define SEGM 15 /* 1st 4 bits reused for segment if !MNREGBIT */
-#define RELBIT (1<<4) /* relative (= OBJ_A_MASK) */
-#define FORBIT (1<<5) /* forward referenced */
-#define IMPBIT (1<<6) /* imported (= OBJ_I_MASK) */
-#define UNDBIT (1<<7) /* undefined */
-
-/* pseudo-op routine numbers */
-/* conditionals are first, this is used to test if op is a conditional */
-
-#define ELSEOP 0
-#define ELSEIFOP 1
-#define ELSEIFCOP 2
-#define ENDIFOP 3
-#define IFOP 4
-#define IFCOP 5
-#define MAXCOND 6 /* limit of conditionals */
-
-#define BLOCKOP 6
-#define COMMOP 7
-#define ENDOP 8
-#define ENDBOP 9
-#define ENTEROP 10
-#define ENTRYOP 11
-#define EQUOP 12
-#define EXPORTOP 13
-#define FAILOP 14
-#define FCBOP 15
-#define FCCOP 16
-#define FDBOP 17
-#define GETOP 18
-#define IDENTOP 19
-#define IMPORTOP 20
-#define _LISTOP 21
-#define LOCOP 22
-#define _MACLISTOP 23
-#define MACROOP 24
-#define _MAPOP 25
-#define ORGOP 26
-#define RMBOP 27
-#define SETOP 28
-#define SETDPOP 29
-#define _WARNOP 30
-
-#ifdef I80386
-
-/* further pseudo-ops */
-
-#define BSSOP 31
-#define COMMOP1 32
-#define DATAOP 33
-#define TEXTOP 34
-#define USE16OP 35
-#define USE32OP 36
-
-/* machine-op routine numbers */
-
-#define ARPL 37
-#define BCC 38
-#define BOUND 39
-#define CALL 40
-#define DIVMUL 41
-#define ENTER 42
-#define GROUP1 43
-#define GROUP2 44
-#define GROUP6 45
-#define GROUP7 46
-#define GROUP8 47
-#define GvEv 48
-#define IMUL 49
-#define IN 50
-#define INCDEC 51
-#define INHER 52
-#define INHER16 53
-#define INHER32 54
-#define INHER_A 55
-#define INT 56
-#define JCC 57
-#define JCXZ 58
-#define LEA 59
-#define LOAD_FULL_POINTER 60
-#define MOV 61
-#define MOVX 62
-#define NEGNOT 63
-#define OUT 64
-#define PUSHPOP 65
-#define RET 66
-#define RETF 67
-#define SEG 68
-#define SETCC 69
-#define SH_DOUBLE 70
-#define TEST 71
-#define XCHG 72
-
-/* further pseudo-ops */
-
-#define BLKWOP 73
-#define EVENOP 74
-#define FQBOP 75
-#define ALIGNOP 76
-
-/* further machine-ops */
-
-#define CALLI 77
-
-/* yet further pseudo-ops */
-
-#define LCOMMOP 78
-#define LCOMMOP1 79
-
-#endif /* I80386 */
-
-#ifdef MC6809
-
-/* machine-op routine numbers */
-
-#define ALL 31 /* all address modes allowed, like LDA */
-#define ALTER 32 /* all but immediate, like STA */
-#define IMMED 33 /* immediate only (ANDCC, ORCC) */
-#define INDEXD 34 /* indexed (LEA's) */
-#define INHER 35 /* inherent, like CLC or CLRA */
-#define LONG 36 /* long branches */
-#define SHORT 37 /* short branches */
-#define SSTAK 38 /* S-stack (PSHS, PULS) */
-#define SWAP 39 /* TFR, EXG */
-#define USTAK 40 /* U-stack (PSHU,PULU) */
-
-/* yet further pseudo-ops */
-
-#define LCOMMOP 41
-
-#endif
-
-/* object code format (Introl) */
-
-#define OBJ_SEGSZ_TWO 0x02 /* size 2 code for segment size descriptor */
-
-#define OBJ_MAX_ABS_LEN 64 /* max length of chunk of absolute code */
-
-#define OBJ_ABS 0x40 /* absolute code command */
-#define OBJ_OFFSET_REL 0x80 /* offset relocation command */
-#define OBJ_SET_SEG 0x20 /* set segment command */
-#define OBJ_SKIP_1 0x11 /* skip with 1 byte count */
-#define OBJ_SKIP_2 0x12 /* skip with 2 byte count */
-#define OBJ_SKIP_4 0x13 /* skip with 4 byte count */
-#define OBJ_SYMBOL_REL 0xC0 /* symbol relocation command */
-
-#define OBJ_A_MASK 0x10 /* absolute bit(symbols) */
-#if OBJ_A_MASK - RELBIT /* must match internal format (~byte 1 -> 0) */
-oops - RELBIT misplaced
-#endif
-#define OBJ_E_MASK 0x80 /* exported bit (symbols) */
-#if OBJ_E_MASK - EXPBIT /* must match internal format (byte 0 -> 0) */
-oops - EXPBIT misplaced
-#endif
-#define OBJ_I_MASK 0x40 /* imported bit (symbols) */
-#if OBJ_I_MASK - IMPBIT /* must match internal format (byte 1 -> 0) */
-oops - IMPBIT misplaced
-#endif
-#define OBJ_N_MASK 0x01 /* entry bit (symbols) */
-#if OBJ_N_MASK - ENTBIT /* must match internal format (byte 0 -> 1) */
-oops - ENTBIT misplaced
-#endif
-#define OBJ_SA_MASK 0x20 /* size allocation bit (symbols) */
-#define OBJ_SZ_ONE 0x40 /* size one code for symbol value */
-#define OBJ_SZ_TWO 0x80 /* size two code for symbol value */
-#define OBJ_SZ_FOUR 0xC0 /* size four code for symbol value */
-
-#define OBJ_R_MASK 0x20 /* PC-rel bit (off & sym reloc commands) */
-#define OBJ_SEGM_MASK 0x0F /* segment mask (symbols, off reloc command) */
-
-#define OBJ_OF_MASK 0x03 /* offset size code for symbol reloc */
-#define OBJ_S_MASK 0x04 /* symbol number size code for symbol reloc */
-
-#define SYMLIS_NAMELEN 26
-#define SYMLIS_LEN (sizeof (struct sym_listing_s))
-
-#define FILNAMLEN 64 /* max length of a file name */
-#define LINLEN 256 /* max length of input line */
-#define LINUM_LEN 5 /* length of formatted line number */
-
-#define SPTSIZ 1024 /* number of symbol ptrs */
- /* pseudo-op flags */
-#define POPHI 1 /* set to print hi byte of adr */
-#define POPLO 2 /* to print lo byte of ADR */
-#define POPLC 4 /* to print LC */
-#define POPLONG 8 /* to print high word of ADR */
-#define MAXBLOCK 8 /* max nesting level of BLOCK stack */
-#define MAXGET 8 /* max nesting level of GET stack */
-#define MAXIF 8 /* max nesting level of IF stack */
-#define MACPSIZ (128/sizeof (struct schain_s))
- /* size of macro param buffer */
-#define MAXMAC 8 /* max nesting level of macro stack */
-#define NLOC 16 /* number of location counters */
-#ifdef I80386
-#define NO_SIB 0340 /* illegal sib (3 with 4) to mean no sib */
-#endif
-
-/* special segments */
-
-#define BSSLOC 3
-#define DATALOC 3
-#define DPLOC 2
-#define STRLOC 1
-#define TEXTLOC 0
diff --git a/bin86-0.3/as/Makefile b/bin86-0.3/as/Makefile
deleted file mode 100644
index 70104e8..0000000
--- a/bin86-0.3/as/Makefile
+++ /dev/null
@@ -1,57 +0,0 @@
-CC =gcc
-CFLAGS =-O1 -fomit-frame-pointer -Dwarn=as_warn
-INC_CFLAGS =-I../a.out.h
-LDFLAGS =-s
-
-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 ../ld/typeconv.o
-
-.SUFFIXES:
-.SUFFIXES: .c .o
-
-.c.o:
- $(CC) $(CFLAGS) $(INC_CFLAGS) -c $<
-
-all: as86
-
-as86: $(OBJS)
- $(CC) $(LDFLAGS) -o $@ $(OBJS)
-
-clean:
- $(RM) *.o as86 core endian.h
-
-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
-error.o: const.h type.h
-express.o: const.h type.h address.h globvar.h scan.h source.h
-genbin.o: const.h type.h address.h file.h globvar.h
-genlist.o: const.h type.h address.h flag.h file.h globvar.h macro.h scan.h \
- source.h
-genobj.o: const.h type.h address.h file.h globvar.h
-gensym.o: const.h type.h flag.h file.h globvar.h
-keywords.o: const.h type.h opcode.h
-macro.o: const.h type.h globvar.h scan.h macro.h
-mops.o: const.h type.h globvar.h opcode.h scan.h address.h
-pops.o: const.h type.h address.h flag.h globvar.h opcode.h scan.h
-readsrc.o: const.h type.h flag.h file.h globvar.h macro.h scan.h source.h
-scan.o: const.h type.h scan.h
-table.o: const.h type.h globvar.h scan.h
-
-const.h: endian.h
-
-endian.h: det_endian.c
- $(CC) -o det_endian det_endian.c
- -@if [ $$? = 0 ]; then \
- det_endian > $@; \
- if [ $$? = 0 ]; then \
- rm -f det_endian; \
- else \
- echo Failed to create $@; \
- exit 1; \
- fi; \
- else \
- echo Failed to compile det_endian.c; \
- exit 1; \
- fi
diff --git a/bin86-0.3/as/address.h b/bin86-0.3/as/address.h
deleted file mode 100644
index e310535..0000000
--- a/bin86-0.3/as/address.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * bin86/as/address.h
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-/* address.h - global variables involving addresses for assembler */
-
-EXTERN struct address_s lastexp;/* last expression parsed */
-
-EXTERN union
-{
- char fcbuf[LINLEN - 6]; /* buffer for fcb and fcc data */
- /* data is absolute in 1 char pieces */
- /* limited by FCC\t"" etc on line */
- struct address_s fdbuf[(LINLEN - 4) / 2];
- /* buffer for fdb data */
- /* data can be of any 2-byte adr type */
- /* limited by FDB\t and commas on line */
-#if SIZEOF_OFFSET_T > 2
- struct address_s fqbuf[(LINLEN - 4) / 4];
- /* buffer for fqb data */
- /* data can be of any 4-byte adr type */
- /* limited by FQB\t and commas on line */
-#endif
-}
- databuf;
-
-EXTERN bool_t fcflag;
-EXTERN bool_t fdflag;
-#if SIZEOF_OFFSET_T > 2
-EXTERN bool_t fqflag;
-#endif
-
-EXTERN struct address_s immadr;
-EXTERN smallcount_t immcount;
diff --git a/bin86-0.3/as/as.c b/bin86-0.3/as/as.c
deleted file mode 100644
index 9f91639..0000000
--- a/bin86-0.3/as/as.c
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
- * bin86/as/as.c
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-/* as.c - assembler */
-
-/*
- usage: as source [-b [bin]] [-lm [list]] [-n name] [-o obj] [-s sym] [-guw]
- in any order (but no repeated file options)
-*/
-
-#include <sys/types.h>
-#include <fcntl.h>
-#include "const.h"
-#include "type.h"
-#include "byteord.h"
-#include "macro.h"
-#undef EXTERN
-#define EXTERN
-#include "file.h"
-#include "flag.h"
-#include "globvar.h"
-
-PRIVATE struct block_s hid_blockstak[MAXBLOCK]; /* block stack */
-PRIVATE struct lc_s hid_lctab[NLOC]; /* location counter table */
-PRIVATE struct if_s hid_ifstak[MAXBLOCK]; /* if stack */
-PRIVATE struct schain_s hid_mcpar[MACPSIZ]; /* MACRO params */
-PRIVATE struct macro_s hid_macstak[MAXBLOCK]; /* macro stack */
-PRIVATE struct sym_s *hid_spt[SPTSIZ]; /* hash table */
-
-FORWARD void initp1 P((void));
-FORWARD int my_creat P((char *name, char *message));
-FORWARD void process_args P((int argc, char **argv));
-FORWARD void summary P((fd_t fd));
-FORWARD void summ_number P((unsigned num));
-FORWARD void usage P((void));
-
-#define USERMEM (sizeof(int) <= 2 ? (unsigned) 0xAC00 : (unsigned) 0x20000L)
-
-PUBLIC int main(argc, argv)
-int argc;
-char **argv;
-{
- heapptr = malloc(USERMEM);
- heapend = heapptr + USERMEM;
- if (heapptr == 0)
- as_abort("cannot allocate memory");
-#ifdef SOS_EDOS
- heapend = stackreg() - STAKSIZ;
-#endif
- initp1();
- initp1p2();
- inst_keywords();
- initbin();
- initobj();
- initsource(); /* only nec to init for unsupported mem file */
- typeconv_init(BIG_ENDIAN, LONG_BIG_ENDIAN);
- warn.global = TRUE; /* constant */
- process_args(argc, argv);
- initscan();
-
- assemble(); /* doesn't return, maybe use setjmp */
-
- /* NOTREACHED */
- return 0;
-}
-
-PUBLIC void as_abort(message)
-char *message;
-{
- write(STDOUT, "as: ", 4);
- write(STDOUT, message, strlen(message));
- write(STDOUT, "\n", 1);
- exit(1);
-}
-
-PUBLIC void finishup()
-{
- bintrailer();
- objtrailer();
- if (list.global ||symgen)
- gensym(); /* output to lstfil and/or symfil */
- if (list.global ||toterr != 0 || totwarn != 0)
- summary(lstfil);
- if (lstfil != STDOUT && (toterr != 0 || totwarn != 0))
- summary(STDOUT);
- statistics();
- exit(toterr != 0 ? 1 : 0); /* should close output files and check */
-}
-
-/* initialise constant nonzero values */
-
-PRIVATE void initp1()
-{
-#ifdef I80386
- idefsize = defsize = sizeof (char *) > 2 ? 4 : 2;
-#endif
- lctabtop = lctab + NLOC;
- lstfil = STDOUT;
- mapnum = 15; /* default map number for symbol table */
- spt_top = (spt = hid_spt) + SPTSIZ;
-}
-
-/* initialise nonzero values which start same each pass */
-
-PUBLIC void initp1p2()
-{
- register struct lc_s *lcp;
-
- ifflag = TRUE;
- pedata = UNDBIT; /* program entry point not defined */
- blockstak = hid_blockstak + MAXBLOCK;
- ifstak = hid_ifstak + MAXIF;
- macstak = hid_macstak + MAXMAC;
- macptop = (macpar = hid_mcpar) + MACPSIZ;
- lctabtop = (lcptr = lctab = hid_lctab) + NLOC;
- for (lcp = lctab; lcp < lctabtop; ++lcp)
- /* init of lcdata/lc (many times) in loop to save space */
- {
- lcp->data = lcdata = RELBIT; /* lc relocatable until 1st ORG */
- lcp->lc = lc = 0;
- }
-}
-
-PRIVATE int my_creat(name, message)
-char *name;
-char *message;
-{
- int fd;
-
- if ((fd = creat(name, CREAT_PERMS)) < 0 || fd > 255)
- as_abort(message);
- return fd;
-}
-
-PRIVATE void process_args(argc, argv)
-int argc;
-char **argv;
-{
- char *arg;
- bool_t isnextarg;
- char *nextarg;
-
- if (argc <= 1)
- usage();
- do
- {
- arg = *++argv;
- if (arg[0] == '-')
- {
- if (arg[2] != 0)
- usage(); /* no multiple options */
- isnextarg = FALSE;
- if (argc > 2)
- {
- nextarg = argv[1];
- if (nextarg[0] != 0 && nextarg[0] != '-')
- isnextarg = TRUE;
- }
- switch (arg[1])
- {
-#ifdef I80386
- case '0':
- idefsize = defsize = 0x2;
- break;
- case '3':
- idefsize = defsize = 0x4;
- break;
- case 'a':
- asld_compatible = TRUE;
- break;
-#endif
- case 'b':
- if (!isnextarg || binfil != 0)
- usage();
- binfil = my_creat(nextarg, "error creating binary file");
- binaryg = TRUE;
- --argc;
- ++argv;
- break;
- case 'g':
- globals_only_in_obj = TRUE;
- break;
-#ifdef I80386
- case 'j':
- jumps_long = TRUE;
- break;
-#endif
- case 'l':
- list.global = TRUE;
- goto get_any_list_file;
- case 'm':
- maclist.global = TRUE;
- get_any_list_file:
- if (isnextarg)
- {
- if (lstfil != STDOUT)
- usage();
- lstfil = my_creat(nextarg, "error creating list file");
- --argc;
- ++argv;
- }
- break;
- case 'n':
- if (!isnextarg)
- usage();
- truefilename = nextarg;
- --argc;
- ++argv;
- break;
- case 'o':
- if (!isnextarg || objfil != 0)
- usage();
- objectg = TRUE;
- objfil = my_creat(nextarg, "error creating object file");
- --argc;
- ++argv;
- break;
- case 's':
- if (!isnextarg || symfil != 0)
- usage();
- symgen = TRUE;
- symfil = my_creat(nextarg, "error creating symbol file");
- --argc;
- ++argv;
- break;
- case 'u':
- inidata = IMPBIT | SEGM;
- break;
- case 'w':
- warn.semaphore = -1;
- break;
- default:
- usage(); /* bad option */
- }
- }
- else if (infil != 0)
- usage(); /* no multiple sources */
- else
- {
- if (strlen(arg) > FILNAMLEN)
- as_abort("source file name too long");
- infil = open_input(strcpy(filnamptr, arg));
- infiln = infil0 = 1;
- }
- }
- while (--argc != 1);
- inidata = (~binaryg & inidata) | (RELBIT | UNDBIT);
-} /* IMPBIT from inidata unless binaryg */
-
-PRIVATE void summary(fd)
-int fd;
-{
- innum = fd;
- writenl();
- summ_number(toterr);
- writesn(" errors");
- summ_number(totwarn);
- writesn(" warnings");
-}
-
-PRIVATE void summ_number(num)
-unsigned num;
-{
- /* format number like line numbers, build it at free spot heapptr */
- *build_number(num, LINUM_LEN, heapptr) = 0;
- writes(heapptr);
-}
-
-PRIVATE void usage()
-{
- as_abort(
-#ifdef I80386
-"usage: as [-03agjuw] [-b [bin]] [-lm [list]] [-n name] [-o obj] [-s sym] src");
-#else
- "usage: as [-guw] [-b [bin]] [-lm [list]] [-n name] [-o obj] [-s sym] src");
-#endif
-}
diff --git a/bin86-0.3/as/asm/calljmp.asm b/bin86-0.3/as/asm/calljmp.asm
deleted file mode 100644
index 36a6ea4..0000000
--- a/bin86-0.3/as/asm/calljmp.asm
+++ /dev/null
@@ -1,70 +0,0 @@
- CALL 0x10:0x20 ; not implemented
- CALL AL; ; illeg
- CALL DS ; illeg
-
- CALL REL16
-
- CALL AX
- CALL BX
- CALL CX
- CALL DX
- CALL SP
- CALL BP
- CALL SI
- CALL DI
-
- CALL BYTE [BX] ; illeg
- CALL [BX]
- CALL WORD [BX]
-
- USE32
- CALL REL32
-
- USE16
- CALL EAX
- CALL EBX
- CALL ECX
- CALL EDX
- CALL ESP
- CALL EBP
- CALL ESI
- CALL EDI
-
- CALL DWORD [BX]
-
- JMP 0x10:0x20 ; not implemented
- JMP AL; ; illeg
- JMP DS ; illeg
-
- JMP REL16
-
- JMP AX
- JMP BX
- JMP CX
- JMP DX
- JMP SP
- JMP BP
- JMP SI
- JMP DI
-
- JMP BYTE [BX] ; illeg
- JMP [BX]
- JMP WORD [BX]
-
- USE32
- JMP REL32
-
- USE16
- JMP EAX
- JMP EBX
- JMP ECX
- JMP EDX
- JMP ESP
- JMP EBP
- JMP ESI
- JMP EDI
-
- JMP DWORD [BX]
-
-REL16:
-REL32:
diff --git a/bin86-0.3/as/asm/ea.asm b/bin86-0.3/as/asm/ea.asm
deleted file mode 100644
index 8717a73..0000000
--- a/bin86-0.3/as/asm/ea.asm
+++ /dev/null
@@ -1,109 +0,0 @@
- MOV AX,[BX+SI]
- MOV AX,[BX+DI]
- MOV AX,[BP+SI]
- MOV AX,[BP+DI]
- MOV AX,[SI]
- MOV AX,[DI]
- MOV AX,[0x1234]
- MOV AX,[BX]
-
- MOV AX,[BX+SI+0x12]
- MOV AX,[BX+DI+0x12]
- MOV AX,[BP+SI+0x12]
- MOV AX,[BP+DI+0x12]
- MOV AX,[SI+0x12]
- MOV AX,[DI+0x12]
- MOV AX,[BP+0x12]
- MOV AX,[BX+0x12]
-
- MOV AX,[BX+SI+0x1234]
- MOV AX,[BX+DI+0x1234]
- MOV AX,[BP+SI+0x1234]
- MOV AX,[BP+DI+0x1234]
- MOV AX,[SI+0x1234]
- MOV AX,[DI+0x1234]
- MOV AX,[BP+0x1234]
- MOV AX,[BX+0x1234]
-
- MOV AL,AL
- MOV AL,AH
- MOV AL,BL
- MOV AL,BH
- MOV AL,CL
- MOV AL,CH
- MOV AL,DL
- MOV AL,DH
-
- MOV AX,AX
- MOV AX,CX
- MOV AX,DX
- MOV AX,BX
- MOV AX,SP
- MOV AX,BP
- MOV AX,SI
- MOV AX,DI
-
- MOV AX,[EAX]
- MOV AX,[ECX]
- MOV AX,[EDX]
- MOV AX,[EBX]
-
- MOV AX,[0x12345678]
- MOV AX,[ESI]
- MOV AX,[EDI]
-
- MOV AX,[EAX+0x12]
- MOV AX,[ECX+0x12]
- MOV AX,[EDX+0x12]
- MOV AX,[EBX+0x12]
-
- MOV AX,[EBP+0x12]
- MOV AX,[ESI+0x12]
- MOV AX,[EDI+0x12]
-
- MOV AX,[EAX+0x12345678]
- MOV AX,[ECX+0x12345678]
- MOV AX,[EDX+0x12345678]
- MOV AX,[EBX+0x12345678]
-
- MOV AX,[EBP+0x12345678]
- MOV AX,[ESI+0x12345678]
- MOV AX,[EDI+0x12345678]
-
- MOV EAX,EAX
- MOV EAX,ECX
- MOV EAX,EDX
- MOV EAX,EBX
- MOV EAX,ESP
- MOV EAX,EBP
- MOV EAX,ESI
- MOV EAX,EDI
-
- MOV AX,[EAX+ESI*2]
- MOV AX,[ECX+ESI*2]
- MOV AX,[EDX+ESI*2]
- MOV AX,[EBX+ESI*2]
- MOV AX,[ESP+ESI*2]
- MOV AX,[ESI*2+0x12345678]
- MOV AX,[ESI+ESI*2]
- MOV AX,[EDI+ESI*2]
-
- MOV AX,[EAX+ESI*2+0x12]
- MOV AX,[ECX+ESI*2+0x12]
- MOV AX,[EDX+ESI*2+0x12]
- MOV AX,[EBX+ESI*2+0x12]
- MOV AX,[ESP+ESI*2+0x12]
- MOV AX,[ESP+0x12]
- MOV AX,[EBP+ESI*2+0x12]
- MOV AX,[ESI+ESI*2+0x12]
- MOV AX,[EDI+ESI*2+0x12]
-
- MOV AX,[EAX+ESI*2+0x12345678]
- MOV AX,[ECX+ESI*2+0x12345678]
- MOV AX,[EDX+ESI*2+0x12345678]
- MOV AX,[EBX+ESI*2+0x12345678]
- MOV AX,[ESP+ESI*2+0x12345678]
- MOV AX,[ESP+0x12345678]
- MOV AX,[EBP+ESI*2+0x12345678]
- MOV AX,[ESI+ESI*2+0x12345678]
- MOV AX,[EDI+ESI*2+0x12345678]
diff --git a/bin86-0.3/as/asm/each.asm b/bin86-0.3/as/asm/each.asm
deleted file mode 100644
index 2145489..0000000
--- a/bin86-0.3/as/asm/each.asm
+++ /dev/null
@@ -1,145 +0,0 @@
-aaa
-aad
-aam
-aas
-adc bx,[esi*4]
-add bx,[esi*4]
-and bx,[esi*4]
-arpl [esi*4],bx
-bound bx,[esi*4]
-bsf bx,[esi*4]
-bsr bx,[esi*4]
-bswap ebx
-bt [esi*4],bx
-btc [esi*4],bx
-btr [esi*4],bx
-bts [esi*4],bx
-call [esi*4]
-cbw
-cwde
-clc
-cld
-cli
-clts
-cmc
-cmp bx,[esi*4]
-cmpsb
-cmpsw
-cmpsd
-cmpxchg [esi*4],bx
-cwd
-cdq
-daa
-das
-dec [esi*4]
-div [esi*4]
-enter 0x200,3
-hlt
-idiv [esi*4]
-imul [esi*4]
-in al,0x20
-inc [esi*4]
-insb
-insw
-insd
-int 0x20
-into
-invd
-invlpg [esi*4]
-iret
-iretd
-jnz many
-many:
-jmp [esi*4]
-lahf
-lar bx,[esi*4]
-lea bx,[esi*4]
-leave
-lgdt [esi*4]
-lidt [esi*4]
-lds bx,[esi*4]
-les bx,[esi*4]
-lfs bx,[esi*4]
-lgs bx,[esi*4]
-lss bx,[esi*4]
-lldt [esi*4]
-lmsw [esi*4]
-lock
-lodsb
-lodsw
-lodsd
-loop alot
-alot:
-lsl bx,[esi*4]
-ltr [esi*4]
-mov ax,[esi*4]
-mov bx,[esi*4]
-mov cr0,eax
-movsb
-movsw
-movsd
-movsx bx,byte [esi*4]
-movzx bx,byte [esi*4]
-mul [esi*4]
-neg [esi*4]
-nop
-not [esi*4]
-or bx,[esi*4]
-out 0x20,al
-outsb
-outsw
-outsd
-pop [esi*4]
-popa
-popad
-popf
-popfd
-push [esi*4]
-pusha
-pushad
-pushf
-pushfd
-rcl [esi*4],1
-rcr [esi*4],1
-rol [esi*4],1
-ror [esi*4],1
-rep
-repe
-repz
-repne
-repnz
-ret
-retf
-sahf
-sal [esi*4],1
-sar [esi*4],1
-shl [esi*4],1
-shr [esi*4],1
-sbb bx,[esi*4]
-scasb
-scasw
-scasd
-setnz byte [esi*4]
-sgdt [esi*4]
-sidt [esi*4]
-shld [esi*4],bx,1
-shrd [esi*4],bx,1
-sldt [esi*4]
-smsw [esi*4]
-stc
-std
-sti
-stosb
-stosw
-stosd
-str [esi*4]
-sub bx,[esi*4]
-test bx,[esi*4]
-verr [esi*4]
-verw [esi*4]
-wait
-wbinvd
-xadd [esi*4],bx
-xchg bx,[esi*4]
-xlat
-xor bx,[esi*4]
diff --git a/bin86-0.3/as/asm/easlow.as b/bin86-0.3/as/asm/easlow.as
deleted file mode 100644
index 75d71e2..0000000
--- a/bin86-0.3/as/asm/easlow.as
+++ /dev/null
@@ -1,1219 +0,0 @@
- MOV AL,[0]
- MOV AH,[1]
- MOV BL,[-1] ; illeg
- MOV BH,[127]
- MOV CL,[-128] ; illeg
- MOV CH,[128]
- MOV DL,[-129] ; illeg
- MOV DH,[32767]
- MOV AL,[-32768] ; illeg
- MOV AH,[32768]
- MOV BL,[-32769] ; illeg
- MOV BH,[$7FFFFFFF] ; illeg
- MOV CL,[$80000000] ; illeg
-
- MOV AL,AL
- MOV AL,AH
- MOV AL,BL
- MOV AL,BH
- MOV AL,CL
- MOV AL,CH
- MOV AL,DL
- MOV AL,DH
-
- MOV AL,AX ; illeg
- MOV AL,BX ; illeg
- MOV AL,CX ; illeg
- MOV AL,DX ; illeg
- MOV AL,BP ; illeg
- MOV AL,DI ; illeg
- MOV AL,SI ; illeg
- MOV AL,SP ; illeg
-
- MOV AH,AL
- MOV AH,AH
- MOV AH,BL
- MOV AH,BH
- MOV AH,CL
- MOV AH,CH
- MOV AH,DL
- MOV AH,DH
-
- MOV AH,AX ; illeg
- MOV AH,BX ; illeg
- MOV AH,CX ; illeg
- MOV AH,DX ; illeg
- MOV AH,BP ; illeg
- MOV AH,DI ; illeg
- MOV AH,SI ; illeg
- MOV AH,SP ; illeg
-
- MOV BL,AL
- MOV BL,AH
- MOV BL,BL
- MOV BL,BH
- MOV BL,CL
- MOV BL,CH
- MOV BL,DL
- MOV BL,DH
-
- MOV BL,AX ; illeg
- MOV BL,BX ; illeg
- MOV BL,CX ; illeg
- MOV BL,DX ; illeg
- MOV BL,BP ; illeg
- MOV BL,DI ; illeg
- MOV BL,SI ; illeg
- MOV BL,SP ; illeg
-
- MOV BH,AL
- MOV BH,AH
- MOV BH,BL
- MOV BH,BH
- MOV BH,CL
- MOV BH,CH
- MOV BH,DL
- MOV BH,DH
-
- MOV BH,AX ; illeg
- MOV BH,BX ; illeg
- MOV BH,CX ; illeg
- MOV BH,DX ; illeg
- MOV BH,BP ; illeg
- MOV BH,DI ; illeg
- MOV BH,SI ; illeg
- MOV BH,SP ; illeg
-
- MOV CL,AL
- MOV CL,AH
- MOV CL,BL
- MOV CL,BH
- MOV CL,CL
- MOV CL,CH
- MOV CL,DL
- MOV CL,DH
-
- MOV CL,AX ; illeg
- MOV CL,BX ; illeg
- MOV CL,CX ; illeg
- MOV CL,DX ; illeg
- MOV CL,BP ; illeg
- MOV CL,DI ; illeg
- MOV CL,SI ; illeg
- MOV CL,SP ; illeg
-
- MOV CH,AL
- MOV CH,AH
- MOV CH,BL
- MOV CH,BH
- MOV CH,CL
- MOV CH,CH
- MOV CH,DL
- MOV CH,DH
-
- MOV CH,AX ; illeg
- MOV CH,BX ; illeg
- MOV CH,CX ; illeg
- MOV CH,DX ; illeg
- MOV CH,BP ; illeg
- MOV CH,DI ; illeg
- MOV CH,SI ; illeg
- MOV CH,SP ; illeg
-
- MOV DL,AL
- MOV DL,AH
- MOV DL,BL
- MOV DL,BH
- MOV DL,CL
- MOV DL,CH
- MOV DL,DL
- MOV DL,DH
-
- MOV DL,AX ; illeg
- MOV DL,BX ; illeg
- MOV DL,CX ; illeg
- MOV DL,DX ; illeg
- MOV DL,BP ; illeg
- MOV DL,DI ; illeg
- MOV DL,SI ; illeg
- MOV DL,SP ; illeg
-
- MOV DH,AL
- MOV DH,AH
- MOV DH,BL
- MOV DH,BH
- MOV DH,CL
- MOV DH,CH
- MOV DH,DL
- MOV DH,DH
-
- MOV DH,AX ; illeg
- MOV DH,BX ; illeg
- MOV DH,CX ; illeg
- MOV DH,DX ; illeg
- MOV DH,BP ; illeg
- MOV DH,DI ; illeg
- MOV DH,SI ; illeg
- MOV DH,SP ; illeg
-
- MOV AL,[AL] ; illeg
- MOV AH,[AH] ; illeg
- MOV BL,[BL] ; illeg
- MOV BH,[BH] ; illeg
- MOV CL,[CL] ; illeg
- MOV CH,[CH] ; illeg
- MOV DL,[DL] ; illeg
- MOV DH,[DH] ; illeg
-
- MOV AL,[AX] ; illeg
- MOV AH,[BX]
- MOV BL,[CX] ; illeg
- MOV BH,[DX] ; illeg
- MOV CL,[BP]
- MOV CH,[DI]
- MOV DL,[SI]
- MOV DH,[SP] ; illeg
-
- MOV AL,[AX+1] ; illeg
- MOV AH,[BX+1]
- MOV BL,[CX+1] ; illeg
- MOV BH,[DX+1] ; illeg
- MOV CL,[BP+1]
- MOV CH,[DI+1]
- MOV DL,[SI+1]
- MOV DH,[SP+1] ; illeg
-
- MOV AL,[AX-1] ; illeg
- MOV AH,[BX-1]
- MOV BL,[CX-1] ; illeg
- MOV BH,[DX-1] ; illeg
- MOV CL,[BP-1]
- MOV CH,[DI-1]
- MOV DL,[SI-1]
- MOV DH,[SP-1] ; illeg
-
- MOV AL,[AX+127] ; illeg
- MOV AH,[BX+127]
- MOV BL,[CX+127] ; illeg
- MOV BH,[DX+127] ; illeg
- MOV CL,[BP+127]
- MOV CH,[DI+127]
- MOV DL,[SI+127]
- MOV DH,[SP+127] ; illeg
-
- MOV AL,[AX-128] ; illeg
- MOV AH,[BX-128]
- MOV BL,[CX-128] ; illeg
- MOV BH,[DX-128] ; illeg
- MOV CL,[BP-128]
- MOV CH,[DI-128]
- MOV DL,[SI-128]
- MOV DH,[SP-128] ; illeg
-
- MOV AL,[AX+128] ; illeg
- MOV AH,[BX+128]
- MOV BL,[CX+128] ; illeg
- MOV BH,[DX+128] ; illeg
- MOV CL,[BP+128]
- MOV CH,[DI+128]
- MOV DL,[SI+128]
- MOV DH,[SP+128] ; illeg
-
- MOV AL,[AX-129] ; illeg
- MOV AH,[BX-129]
- MOV BL,[CX-129] ; illeg
- MOV BH,[DX-129] ; illeg
- MOV CL,[BP-129]
- MOV CH,[DI-129]
- MOV DL,[SI-129]
- MOV DH,[SP-129] ; illeg
-
- MOV AL,[AX+32767] ; illeg
- MOV AH,[BX+32767]
- MOV BL,[CX+32767] ; illeg
- MOV BH,[DX+32767] ; illeg
- MOV CL,[BP+32767]
- MOV CH,[DI+32767]
- MOV DL,[SI+32767]
- MOV DH,[SP+32767] ; illeg
-
- MOV AL,[AX-32768] ; illeg
- MOV AH,[BX-32768]
- MOV BL,[CX-32768] ; illeg
- MOV BH,[DX-32768] ; illeg
- MOV CL,[BP-32768]
- MOV CH,[DI-32768]
- MOV DL,[SI-32768]
- MOV DH,[SP-32768] ; illeg
-
- MOV AL,[AX+32768] ; illeg
- MOV AH,[BX+32768]
- MOV BL,[CX+32768] ; illeg
- MOV BH,[DX+32768] ; illeg
- MOV CL,[BP+32768]
- MOV CH,[DI+32768]
- MOV DL,[SI+32768]
- MOV DH,[SP+32768] ; illeg
-
- MOV AL,[AX-32769] ; illeg
- MOV AH,[BX-32769]
- MOV BL,[CX-32769] ; illeg
- MOV BH,[DX-32769] ; illeg
- MOV CL,[BP-32769]
- MOV CH,[DI-32769]
- MOV DL,[SI-32769]
- MOV DH,[SP-32769] ; illeg
-
- MOV AL,[AX+$7FFFFFFF] ; illeg
- MOV AH,[BX+$7FFFFFFF] ; illeg (bounds)
- MOV BL,[CX+$7FFFFFFF] ; illeg
- MOV BH,[DX+$7FFFFFFF] ; illeg
- MOV CL,[BP+$7FFFFFFF] ; illeg (bounds)
- MOV CH,[DI+$7FFFFFFF] ; illeg (bounds)
- MOV DL,[SI+$7FFFFFFF] ; illeg (bounds)
- MOV DH,[SP+$7FFFFFFF] ; illeg
-
- MOV AL,[AX-$80000000] ; illeg
- MOV AH,[BX-$80000000] ; illeg (bounds)
- MOV BL,[CX-$80000000] ; illeg
- MOV BH,[DX-$80000000] ; illeg
- MOV CL,[BP-$80000000] ; illeg (bounds)
- MOV CH,[DI-$80000000] ; illeg (bounds)
- MOV DL,[SI-$80000000] ; illeg (bounds)
- MOV DH,[SP-$80000000] ; illeg
-
- MOV AL,[AX+AX] ; illeg
- MOV AH,[AX+BX] ; illeg
- MOV BL,[AX+CX] ; illeg
- MOV BH,[AX+DX] ; illeg
- MOV CL,[AX+BP] ; illeg
- MOV CH,[AX+DI] ; illeg
- MOV DL,[AX+SI] ; illeg
- MOV DH,[AX+SP] ; illeg
-
- MOV AL,[BX+AX] ; illeg
- MOV AH,[BX+BX] ; illeg
- MOV BL,[BX+CX] ; illeg
- MOV BH,[BX+DX] ; illeg
- MOV CL,[BX+BP] ; illeg
- MOV CH,[BX+DI]
- MOV DL,[BX+SI]
- MOV DH,[BX+SP] ; illeg
-
- MOV AL,[CX+AX] ; illeg
- MOV AH,[CX+BX] ; illeg
- MOV BL,[CX+CX] ; illeg
- MOV BH,[CX+DX] ; illeg
- MOV CL,[CX+BP] ; illeg
- MOV CH,[CX+DI] ; illeg
- MOV DL,[CX+SI] ; illeg
- MOV DH,[CX+SP] ; illeg
-
- MOV AL,[DX+AX] ; illeg
- MOV AH,[DX+BX] ; illeg
- MOV BL,[DX+CX] ; illeg
- MOV BH,[DX+DX] ; illeg
- MOV CL,[DX+BP] ; illeg
- MOV CH,[DX+DI] ; illeg
- MOV DL,[DX+SI] ; illeg
- MOV DH,[DX+SP] ; illeg
-
- MOV AL,[BP+AX] ; illeg
- MOV AH,[BP+BX] ; illeg
- MOV BL,[BP+CX] ; illeg
- MOV BH,[BP+DX] ; illeg
- MOV CL,[BP+BP] ; illeg
- MOV CH,[BP+DI]
- MOV DL,[BP+SI]
- MOV DH,[BP+SP] ; illeg
-
- MOV AL,[DI+AX] ; illeg
- MOV AH,[DI+BX]
- MOV BL,[DI+CX] ; illeg
- MOV BH,[DI+DX] ; illeg
- MOV CL,[DI+BP]
- MOV CH,[DI+DI] ; illeg
- MOV DL,[DI+SI] ; illeg
- MOV DH,[DI+SP] ; illeg
-
- MOV AL,[SI+AX] ; illeg
- MOV AH,[SI+BX]
- MOV BL,[SI+CX] ; illeg
- MOV BH,[SI+DX] ; illeg
- MOV CL,[SI+BP]
- MOV CH,[SI+DI] ; illeg
- MOV DL,[SI+SI] ; illeg
- MOV DH,[SI+SP] ; illeg
-
- MOV AL,[SP+AX] ; illeg
- MOV AH,[SP+BX] ; illeg
- MOV BL,[SP+CX] ; illeg
- MOV BH,[SP+DX] ; illeg
- MOV CL,[SP+BP] ; illeg
- MOV CH,[SP+DI] ; illeg
- MOV DL,[SP+SI] ; illeg
- MOV DH,[SP+SP] ; illeg
-
- MOV AL,[AX+AX+1] ; illeg
- MOV AH,[AX+BX+1] ; illeg
- MOV BL,[AX+CX+1] ; illeg
- MOV BH,[AX+DX+1] ; illeg
- MOV CL,[AX+BP+1] ; illeg
- MOV CH,[AX+DI+1] ; illeg
- MOV DL,[AX+SI+1] ; illeg
- MOV DH,[AX+SP+1] ; illeg
-
- MOV AL,[BX+AX+1] ; illeg
- MOV AH,[BX+BX+1] ; illeg
- MOV BL,[BX+CX+1] ; illeg
- MOV BH,[BX+DX+1] ; illeg
- MOV CL,[BX+BP+1] ; illeg
- MOV CH,[BX+DI+1]
- MOV DL,[BX+SI+1]
- MOV DH,[BX+SP+1] ; illeg
-
- MOV AL,[CX+AX+1] ; illeg
- MOV AH,[CX+BX+1] ; illeg
- MOV BL,[CX+CX+1] ; illeg
- MOV BH,[CX+DX+1] ; illeg
- MOV CL,[CX+BP+1] ; illeg
- MOV CH,[CX+DI+1] ; illeg
- MOV DL,[CX+SI+1] ; illeg
- MOV DH,[CX+SP+1] ; illeg
-
- MOV AL,[DX+AX+1] ; illeg
- MOV AH,[DX+BX+1] ; illeg
- MOV BL,[DX+CX+1] ; illeg
- MOV BH,[DX+DX+1] ; illeg
- MOV CL,[DX+BP+1] ; illeg
- MOV CH,[DX+DI+1] ; illeg
- MOV DL,[DX+SI+1] ; illeg
- MOV DH,[DX+SP+1] ; illeg
-
- MOV AL,[BP+AX+1] ; illeg
- MOV AH,[BP+BX+1] ; illeg
- MOV BL,[BP+CX+1] ; illeg
- MOV BH,[BP+DX+1] ; illeg
- MOV CL,[BP+BP+1] ; illeg
- MOV CH,[BP+DI+1]
- MOV DL,[BP+SI+1]
- MOV DH,[BP+SP+1] ; illeg
-
- MOV AL,[DI+AX+1] ; illeg
- MOV AH,[DI+BX+1]
- MOV BL,[DI+CX+1] ; illeg
- MOV BH,[DI+DX+1] ; illeg
- MOV CL,[DI+BP+1]
- MOV CH,[DI+DI+1] ; illeg
- MOV DL,[DI+SI+1] ; illeg
- MOV DH,[DI+SP+1] ; illeg
-
- MOV AL,[SI+AX+1] ; illeg
- MOV AH,[SI+BX+1]
- MOV BL,[SI+CX+1] ; illeg
- MOV BH,[SI+DX+1] ; illeg
- MOV CL,[SI+BP+1]
- MOV CH,[SI+DI+1] ; illeg
- MOV DL,[SI+SI+1] ; illeg
- MOV DH,[SI+SP+1] ; illeg
-
- MOV AL,[SP+AX+1] ; illeg
- MOV AH,[SP+BX+1] ; illeg
- MOV BL,[SP+CX+1] ; illeg
- MOV BH,[SP+DX+1] ; illeg
- MOV CL,[SP+BP+1] ; illeg
- MOV CH,[SP+DI+1] ; illeg
- MOV DL,[SP+SI+1] ; illeg
- MOV DH,[SP+SP+1] ; illeg
-
- MOV AL,[AX+AX-1] ; illeg
- MOV AH,[AX+BX-1] ; illeg
- MOV BL,[AX+CX-1] ; illeg
- MOV BH,[AX+DX-1] ; illeg
- MOV CL,[AX+BP-1] ; illeg
- MOV CH,[AX+DI-1] ; illeg
- MOV DL,[AX+SI-1] ; illeg
- MOV DH,[AX+SP-1] ; illeg
-
- MOV AL,[BX+AX-1] ; illeg
- MOV AH,[BX+BX-1] ; illeg
- MOV BL,[BX+CX-1] ; illeg
- MOV BH,[BX+DX-1] ; illeg
- MOV CL,[BX+BP-1] ; illeg
- MOV CH,[BX+DI-1]
- MOV DL,[BX+SI-1]
- MOV DH,[BX+SP-1] ; illeg
-
- MOV AL,[CX+AX-1] ; illeg
- MOV AH,[CX+BX-1] ; illeg
- MOV BL,[CX+CX-1] ; illeg
- MOV BH,[CX+DX-1] ; illeg
- MOV CL,[CX+BP-1] ; illeg
- MOV CH,[CX+DI-1] ; illeg
- MOV DL,[CX+SI-1] ; illeg
- MOV DH,[CX+SP-1] ; illeg
-
- MOV AL,[DX+AX-1] ; illeg
- MOV AH,[DX+BX-1] ; illeg
- MOV BL,[DX+CX-1] ; illeg
- MOV BH,[DX+DX-1] ; illeg
- MOV CL,[DX+BP-1] ; illeg
- MOV CH,[DX+DI-1] ; illeg
- MOV DL,[DX+SI-1] ; illeg
- MOV DH,[DX+SP-1] ; illeg
-
- MOV AL,[BP+AX-1] ; illeg
- MOV AH,[BP+BX-1] ; illeg
- MOV BL,[BP+CX-1] ; illeg
- MOV BH,[BP+DX-1] ; illeg
- MOV CL,[BP+BP-1] ; illeg
- MOV CH,[BP+DI-1]
- MOV DL,[BP+SI-1]
- MOV DH,[BP+SP-1] ; illeg
-
- MOV AL,[DI+AX-1] ; illeg
- MOV AH,[DI+BX-1]
- MOV BL,[DI+CX-1] ; illeg
- MOV BH,[DI+DX-1] ; illeg
- MOV CL,[DI+BP-1]
- MOV CH,[DI+DI-1] ; illeg
- MOV DL,[DI+SI-1] ; illeg
- MOV DH,[DI+SP-1] ; illeg
-
- MOV AL,[SI+AX-1] ; illeg
- MOV AH,[SI+BX-1]
- MOV BL,[SI+CX-1] ; illeg
- MOV BH,[SI+DX-1] ; illeg
- MOV CL,[SI+BP-1]
- MOV CH,[SI+DI-1] ; illeg
- MOV DL,[SI+SI-1] ; illeg
- MOV DH,[SI+SP-1] ; illeg
-
- MOV AL,[SP+AX-1] ; illeg
- MOV AH,[SP+BX-1] ; illeg
- MOV BL,[SP+CX-1] ; illeg
- MOV BH,[SP+DX-1] ; illeg
- MOV CL,[SP+BP-1] ; illeg
- MOV CH,[SP+DI-1] ; illeg
- MOV DL,[SP+SI-1] ; illeg
- MOV DH,[SP+SP-1] ; illeg
-
- MOV AL,[AX+AX+127] ; illeg
- MOV AH,[AX+BX+127] ; illeg
- MOV BL,[AX+CX+127] ; illeg
- MOV BH,[AX+DX+127] ; illeg
- MOV CL,[AX+BP+127] ; illeg
- MOV CH,[AX+DI+127] ; illeg
- MOV DL,[AX+SI+127] ; illeg
- MOV DH,[AX+SP+127] ; illeg
-
- MOV AL,[BX+AX+127] ; illeg
- MOV AH,[BX+BX+127] ; illeg
- MOV BL,[BX+CX+127] ; illeg
- MOV BH,[BX+DX+127] ; illeg
- MOV CL,[BX+BP+127] ; illeg
- MOV CH,[BX+DI+127]
- MOV DL,[BX+SI+127]
- MOV DH,[BX+SP+127] ; illeg
-
- MOV AL,[CX+AX+127] ; illeg
- MOV AH,[CX+BX+127] ; illeg
- MOV BL,[CX+CX+127] ; illeg
- MOV BH,[CX+DX+127] ; illeg
- MOV CL,[CX+BP+127] ; illeg
- MOV CH,[CX+DI+127] ; illeg
- MOV DL,[CX+SI+127] ; illeg
- MOV DH,[CX+SP+127] ; illeg
-
- MOV AL,[DX+AX+127] ; illeg
- MOV AH,[DX+BX+127] ; illeg
- MOV BL,[DX+CX+127] ; illeg
- MOV BH,[DX+DX+127] ; illeg
- MOV CL,[DX+BP+127] ; illeg
- MOV CH,[DX+DI+127] ; illeg
- MOV DL,[DX+SI+127] ; illeg
- MOV DH,[DX+SP+127] ; illeg
-
- MOV AL,[BP+AX+127] ; illeg
- MOV AH,[BP+BX+127] ; illeg
- MOV BL,[BP+CX+127] ; illeg
- MOV BH,[BP+DX+127] ; illeg
- MOV CL,[BP+BP+127] ; illeg
- MOV CH,[BP+DI+127]
- MOV DL,[BP+SI+127]
- MOV DH,[BP+SP+127] ; illeg
-
- MOV AL,[DI+AX+127] ; illeg
- MOV AH,[DI+BX+127]
- MOV BL,[DI+CX+127] ; illeg
- MOV BH,[DI+DX+127] ; illeg
- MOV CL,[DI+BP+127]
- MOV CH,[DI+DI+127] ; illeg
- MOV DL,[DI+SI+127] ; illeg
- MOV DH,[DI+SP+127] ; illeg
-
- MOV AL,[SI+AX+127] ; illeg
- MOV AH,[SI+BX+127]
- MOV BL,[SI+CX+127] ; illeg
- MOV BH,[SI+DX+127] ; illeg
- MOV CL,[SI+BP+127]
- MOV CH,[SI+DI+127] ; illeg
- MOV DL,[SI+SI+127] ; illeg
- MOV DH,[SI+SP+127] ; illeg
-
- MOV AL,[SP+AX+127] ; illeg
- MOV AH,[SP+BX+127] ; illeg
- MOV BL,[SP+CX+127] ; illeg
- MOV BH,[SP+DX+127] ; illeg
- MOV CL,[SP+BP+127] ; illeg
- MOV CH,[SP+DI+127] ; illeg
- MOV DL,[SP+SI+127] ; illeg
- MOV DH,[SP+SP+127] ; illeg
-
- MOV AL,[AX+AX-128] ; illeg
- MOV AH,[AX+BX-128] ; illeg
- MOV BL,[AX+CX-128] ; illeg
- MOV BH,[AX+DX-128] ; illeg
- MOV CL,[AX+BP-128] ; illeg
- MOV CH,[AX+DI-128] ; illeg
- MOV DL,[AX+SI-128] ; illeg
- MOV DH,[AX+SP-128] ; illeg
-
- MOV AL,[BX+AX-128] ; illeg
- MOV AH,[BX+BX-128] ; illeg
- MOV BL,[BX+CX-128] ; illeg
- MOV BH,[BX+DX-128] ; illeg
- MOV CL,[BX+BP-128] ; illeg
- MOV CH,[BX+DI-128]
- MOV DL,[BX+SI-128]
- MOV DH,[BX+SP-128] ; illeg
-
- MOV AL,[CX+AX-128] ; illeg
- MOV AH,[CX+BX-128] ; illeg
- MOV BL,[CX+CX-128] ; illeg
- MOV BH,[CX+DX-128] ; illeg
- MOV CL,[CX+BP-128] ; illeg
- MOV CH,[CX+DI-128] ; illeg
- MOV DL,[CX+SI-128] ; illeg
- MOV DH,[CX+SP-128] ; illeg
-
- MOV AL,[DX+AX-128] ; illeg
- MOV AH,[DX+BX-128] ; illeg
- MOV BL,[DX+CX-128] ; illeg
- MOV BH,[DX+DX-128] ; illeg
- MOV CL,[DX+BP-128] ; illeg
- MOV CH,[DX+DI-128] ; illeg
- MOV DL,[DX+SI-128] ; illeg
- MOV DH,[DX+SP-128] ; illeg
-
- MOV AL,[BP+AX-128] ; illeg
- MOV AH,[BP+BX-128] ; illeg
- MOV BL,[BP+CX-128] ; illeg
- MOV BH,[BP+DX-128] ; illeg
- MOV CL,[BP+BP-128] ; illeg
- MOV CH,[BP+DI-128]
- MOV DL,[BP+SI-128]
- MOV DH,[BP+SP-128] ; illeg
-
- MOV AL,[DI+AX-128] ; illeg
- MOV AH,[DI+BX-128]
- MOV BL,[DI+CX-128] ; illeg
- MOV BH,[DI+DX-128] ; illeg
- MOV CL,[DI+BP-128]
- MOV CH,[DI+DI-128] ; illeg
- MOV DL,[DI+SI-128] ; illeg
- MOV DH,[DI+SP-128] ; illeg
-
- MOV AL,[SI+AX-128] ; illeg
- MOV AH,[SI+BX-128]
- MOV BL,[SI+CX-128] ; illeg
- MOV BH,[SI+DX-128] ; illeg
- MOV CL,[SI+BP-128]
- MOV CH,[SI+DI-128] ; illeg
- MOV DL,[SI+SI-128] ; illeg
- MOV DH,[SI+SP-128] ; illeg
-
- MOV AL,[SP+AX-128] ; illeg
- MOV AH,[SP+BX-128] ; illeg
- MOV BL,[SP+CX-128] ; illeg
- MOV BH,[SP+DX-128] ; illeg
- MOV CL,[SP+BP-128] ; illeg
- MOV CH,[SP+DI-128] ; illeg
- MOV DL,[SP+SI-128] ; illeg
- MOV DH,[SP+SP-128] ; illeg
-
- MOV AL,[AX+AX+128] ; illeg
- MOV AH,[AX+BX+128] ; illeg
- MOV BL,[AX+CX+128] ; illeg
- MOV BH,[AX+DX+128] ; illeg
- MOV CL,[AX+BP+128] ; illeg
- MOV CH,[AX+DI+128] ; illeg
- MOV DL,[AX+SI+128] ; illeg
- MOV DH,[AX+SP+128] ; illeg
-
- MOV AL,[BX+AX+128] ; illeg
- MOV AH,[BX+BX+128] ; illeg
- MOV BL,[BX+CX+128] ; illeg
- MOV BH,[BX+DX+128] ; illeg
- MOV CL,[BX+BP+128] ; illeg
- MOV CH,[BX+DI+128]
- MOV DL,[BX+SI+128]
- MOV DH,[BX+SP+128] ; illeg
-
- MOV AL,[CX+AX+128] ; illeg
- MOV AH,[CX+BX+128] ; illeg
- MOV BL,[CX+CX+128] ; illeg
- MOV BH,[CX+DX+128] ; illeg
- MOV CL,[CX+BP+128] ; illeg
- MOV CH,[CX+DI+128] ; illeg
- MOV DL,[CX+SI+128] ; illeg
- MOV DH,[CX+SP+128] ; illeg
-
- MOV AL,[DX+AX+128] ; illeg
- MOV AH,[DX+BX+128] ; illeg
- MOV BL,[DX+CX+128] ; illeg
- MOV BH,[DX+DX+128] ; illeg
- MOV CL,[DX+BP+128] ; illeg
- MOV CH,[DX+DI+128] ; illeg
- MOV DL,[DX+SI+128] ; illeg
- MOV DH,[DX+SP+128] ; illeg
-
- MOV AL,[BP+AX+128] ; illeg
- MOV AH,[BP+BX+128] ; illeg
- MOV BL,[BP+CX+128] ; illeg
- MOV BH,[BP+DX+128] ; illeg
- MOV CL,[BP+BP+128] ; illeg
- MOV CH,[BP+DI+128]
- MOV DL,[BP+SI+128]
- MOV DH,[BP+SP+128] ; illeg
-
- MOV AL,[DI+AX+128] ; illeg
- MOV AH,[DI+BX+128]
- MOV BL,[DI+CX+128] ; illeg
- MOV BH,[DI+DX+128] ; illeg
- MOV CL,[DI+BP+128]
- MOV CH,[DI+DI+128] ; illeg
- MOV DL,[DI+SI+128] ; illeg
- MOV DH,[DI+SP+128] ; illeg
-
- MOV AL,[SI+AX+128] ; illeg
- MOV AH,[SI+BX+128]
- MOV BL,[SI+CX+128] ; illeg
- MOV BH,[SI+DX+128] ; illeg
- MOV CL,[SI+BP+128]
- MOV CH,[SI+DI+128] ; illeg
- MOV DL,[SI+SI+128] ; illeg
- MOV DH,[SI+SP+128] ; illeg
-
- MOV AL,[SP+AX+128] ; illeg
- MOV AH,[SP+BX+128] ; illeg
- MOV BL,[SP+CX+128] ; illeg
- MOV BH,[SP+DX+128] ; illeg
- MOV CL,[SP+BP+128] ; illeg
- MOV CH,[SP+DI+128] ; illeg
- MOV DL,[SP+SI+128] ; illeg
- MOV DH,[SP+SP+128] ; illeg
-
- MOV AL,[AX+AX-129] ; illeg
- MOV AH,[AX+BX-129] ; illeg
- MOV BL,[AX+CX-129] ; illeg
- MOV BH,[AX+DX-129] ; illeg
- MOV CL,[AX+BP-129] ; illeg
- MOV CH,[AX+DI-129] ; illeg
- MOV DL,[AX+SI-129] ; illeg
- MOV DH,[AX+SP-129] ; illeg
-
- MOV AL,[BX+AX-129] ; illeg
- MOV AH,[BX+BX-129] ; illeg
- MOV BL,[BX+CX-129] ; illeg
- MOV BH,[BX+DX-129] ; illeg
- MOV CL,[BX+BP-129] ; illeg
- MOV CH,[BX+DI-129]
- MOV DL,[BX+SI-129]
- MOV DH,[BX+SP-129] ; illeg
-
- MOV AL,[CX+AX-129] ; illeg
- MOV AH,[CX+BX-129] ; illeg
- MOV BL,[CX+CX-129] ; illeg
- MOV BH,[CX+DX-129] ; illeg
- MOV CL,[CX+BP-129] ; illeg
- MOV CH,[CX+DI-129] ; illeg
- MOV DL,[CX+SI-129] ; illeg
- MOV DH,[CX+SP-129] ; illeg
-
- MOV AL,[DX+AX-129] ; illeg
- MOV AH,[DX+BX-129] ; illeg
- MOV BL,[DX+CX-129] ; illeg
- MOV BH,[DX+DX-129] ; illeg
- MOV CL,[DX+BP-129] ; illeg
- MOV CH,[DX+DI-129] ; illeg
- MOV DL,[DX+SI-129] ; illeg
- MOV DH,[DX+SP-129] ; illeg
-
- MOV AL,[BP+AX-129] ; illeg
- MOV AH,[BP+BX-129] ; illeg
- MOV BL,[BP+CX-129] ; illeg
- MOV BH,[BP+DX-129] ; illeg
- MOV CL,[BP+BP-129] ; illeg
- MOV CH,[BP+DI-129]
- MOV DL,[BP+SI-129]
- MOV DH,[BP+SP-129] ; illeg
-
- MOV AL,[DI+AX-129] ; illeg
- MOV AH,[DI+BX-129]
- MOV BL,[DI+CX-129] ; illeg
- MOV BH,[DI+DX-129] ; illeg
- MOV CL,[DI+BP-129]
- MOV CH,[DI+DI-129] ; illeg
- MOV DL,[DI+SI-129] ; illeg
- MOV DH,[DI+SP-129] ; illeg
-
- MOV AL,[SI+AX-129] ; illeg
- MOV AH,[SI+BX-129]
- MOV BL,[SI+CX-129] ; illeg
- MOV BH,[SI+DX-129] ; illeg
- MOV CL,[SI+BP-129]
- MOV CH,[SI+DI-129] ; illeg
- MOV DL,[SI+SI-129] ; illeg
- MOV DH,[SI+SP-129] ; illeg
-
- MOV AL,[SP+AX-129] ; illeg
- MOV AH,[SP+BX-129] ; illeg
- MOV BL,[SP+CX-129] ; illeg
- MOV BH,[SP+DX-129] ; illeg
- MOV CL,[SP+BP-129] ; illeg
- MOV CH,[SP+DI-129] ; illeg
- MOV DL,[SP+SI-129] ; illeg
- MOV DH,[SP+SP-129] ; illeg
-
- MOV AL,[AX+AX+32767] ; illeg
- MOV AH,[AX+BX+32767] ; illeg
- MOV BL,[AX+CX+32767] ; illeg
- MOV BH,[AX+DX+32767] ; illeg
- MOV CL,[AX+BP+32767] ; illeg
- MOV CH,[AX+DI+32767] ; illeg
- MOV DL,[AX+SI+32767] ; illeg
- MOV DH,[AX+SP+32767] ; illeg
-
- MOV AL,[BX+AX+32767] ; illeg
- MOV AH,[BX+BX+32767] ; illeg
- MOV BL,[BX+CX+32767] ; illeg
- MOV BH,[BX+DX+32767] ; illeg
- MOV CL,[BX+BP+32767] ; illeg
- MOV CH,[BX+DI+32767]
- MOV DL,[BX+SI+32767]
- MOV DH,[BX+SP+32767] ; illeg
-
- MOV AL,[CX+AX+32767] ; illeg
- MOV AH,[CX+BX+32767] ; illeg
- MOV BL,[CX+CX+32767] ; illeg
- MOV BH,[CX+DX+32767] ; illeg
- MOV CL,[CX+BP+32767] ; illeg
- MOV CH,[CX+DI+32767] ; illeg
- MOV DL,[CX+SI+32767] ; illeg
- MOV DH,[CX+SP+32767] ; illeg
-
- MOV AL,[DX+AX+32767] ; illeg
- MOV AH,[DX+BX+32767] ; illeg
- MOV BL,[DX+CX+32767] ; illeg
- MOV BH,[DX+DX+32767] ; illeg
- MOV CL,[DX+BP+32767] ; illeg
- MOV CH,[DX+DI+32767] ; illeg
- MOV DL,[DX+SI+32767] ; illeg
- MOV DH,[DX+SP+32767] ; illeg
-
- MOV AL,[BP+AX+32767] ; illeg
- MOV AH,[BP+BX+32767] ; illeg
- MOV BL,[BP+CX+32767] ; illeg
- MOV BH,[BP+DX+32767] ; illeg
- MOV CL,[BP+BP+32767] ; illeg
- MOV CH,[BP+DI+32767]
- MOV DL,[BP+SI+32767]
- MOV DH,[BP+SP+32767] ; illeg
-
- MOV AL,[DI+AX+32767] ; illeg
- MOV AH,[DI+BX+32767]
- MOV BL,[DI+CX+32767] ; illeg
- MOV BH,[DI+DX+32767] ; illeg
- MOV CL,[DI+BP+32767]
- MOV CH,[DI+DI+32767] ; illeg
- MOV DL,[DI+SI+32767] ; illeg
- MOV DH,[DI+SP+32767] ; illeg
-
- MOV AL,[SI+AX+32767] ; illeg
- MOV AH,[SI+BX+32767]
- MOV BL,[SI+CX+32767] ; illeg
- MOV BH,[SI+DX+32767] ; illeg
- MOV CL,[SI+BP+32767]
- MOV CH,[SI+DI+32767] ; illeg
- MOV DL,[SI+SI+32767] ; illeg
- MOV DH,[SI+SP+32767] ; illeg
-
- MOV AL,[SP+AX+32767] ; illeg
- MOV AH,[SP+BX+32767] ; illeg
- MOV BL,[SP+CX+32767] ; illeg
- MOV BH,[SP+DX+32767] ; illeg
- MOV CL,[SP+BP+32767] ; illeg
- MOV CH,[SP+DI+32767] ; illeg
- MOV DL,[SP+SI+32767] ; illeg
- MOV DH,[SP+SP+32767] ; illeg
-
- MOV AL,[AX+AX-32768] ; illeg
- MOV AH,[AX+BX-32768] ; illeg
- MOV BL,[AX+CX-32768] ; illeg
- MOV BH,[AX+DX-32768] ; illeg
- MOV CL,[AX+BP-32768] ; illeg
- MOV CH,[AX+DI-32768] ; illeg
- MOV DL,[AX+SI-32768] ; illeg
- MOV DH,[AX+SP-32768] ; illeg
-
- MOV AL,[BX+AX-32768] ; illeg
- MOV AH,[BX+BX-32768] ; illeg
- MOV BL,[BX+CX-32768] ; illeg
- MOV BH,[BX+DX-32768] ; illeg
- MOV CL,[BX+BP-32768] ; illeg
- MOV CH,[BX+DI-32768]
- MOV DL,[BX+SI-32768]
- MOV DH,[BX+SP-32768] ; illeg
-
- MOV AL,[CX+AX-32768] ; illeg
- MOV AH,[CX+BX-32768] ; illeg
- MOV BL,[CX+CX-32768] ; illeg
- MOV BH,[CX+DX-32768] ; illeg
- MOV CL,[CX+BP-32768] ; illeg
- MOV CH,[CX+DI-32768] ; illeg
- MOV DL,[CX+SI-32768] ; illeg
- MOV DH,[CX+SP-32768] ; illeg
-
- MOV AL,[DX+AX-32768] ; illeg
- MOV AH,[DX+BX-32768] ; illeg
- MOV BL,[DX+CX-32768] ; illeg
- MOV BH,[DX+DX-32768] ; illeg
- MOV CL,[DX+BP-32768] ; illeg
- MOV CH,[DX+DI-32768] ; illeg
- MOV DL,[DX+SI-32768] ; illeg
- MOV DH,[DX+SP-32768] ; illeg
-
- MOV AL,[BP+AX-32768] ; illeg
- MOV AH,[BP+BX-32768] ; illeg
- MOV BL,[BP+CX-32768] ; illeg
- MOV BH,[BP+DX-32768] ; illeg
- MOV CL,[BP+BP-32768] ; illeg
- MOV CH,[BP+DI-32768]
- MOV DL,[BP+SI-32768]
- MOV DH,[BP+SP-32768] ; illeg
-
- MOV AL,[DI+AX-32768] ; illeg
- MOV AH,[DI+BX-32768]
- MOV BL,[DI+CX-32768] ; illeg
- MOV BH,[DI+DX-32768] ; illeg
- MOV CL,[DI+BP-32768]
- MOV CH,[DI+DI-32768] ; illeg
- MOV DL,[DI+SI-32768] ; illeg
- MOV DH,[DI+SP-32768] ; illeg
-
- MOV AL,[SI+AX-32768] ; illeg
- MOV AH,[SI+BX-32768]
- MOV BL,[SI+CX-32768] ; illeg
- MOV BH,[SI+DX-32768] ; illeg
- MOV CL,[SI+BP-32768]
- MOV CH,[SI+DI-32768] ; illeg
- MOV DL,[SI+SI-32768] ; illeg
- MOV DH,[SI+SP-32768] ; illeg
-
- MOV AL,[SP+AX-32768] ; illeg
- MOV AH,[SP+BX-32768] ; illeg
- MOV BL,[SP+CX-32768] ; illeg
- MOV BH,[SP+DX-32768] ; illeg
- MOV CL,[SP+BP-32768] ; illeg
- MOV CH,[SP+DI-32768] ; illeg
- MOV DL,[SP+SI-32768] ; illeg
- MOV DH,[SP+SP-32768] ; illeg
-
- MOV AL,[AX+AX+32768] ; illeg
- MOV AH,[AX+BX+32768] ; illeg
- MOV BL,[AX+CX+32768] ; illeg
- MOV BH,[AX+DX+32768] ; illeg
- MOV CL,[AX+BP+32768] ; illeg
- MOV CH,[AX+DI+32768] ; illeg
- MOV DL,[AX+SI+32768] ; illeg
- MOV DH,[AX+SP+32768] ; illeg
-
- MOV AL,[BX+AX+32768] ; illeg
- MOV AH,[BX+BX+32768] ; illeg
- MOV BL,[BX+CX+32768] ; illeg
- MOV BH,[BX+DX+32768] ; illeg
- MOV CL,[BX+BP+32768] ; illeg
- MOV CH,[BX+DI+32768]
- MOV DL,[BX+SI+32768]
- MOV DH,[BX+SP+32768] ; illeg
-
- MOV AL,[CX+AX+32768] ; illeg
- MOV AH,[CX+BX+32768] ; illeg
- MOV BL,[CX+CX+32768] ; illeg
- MOV BH,[CX+DX+32768] ; illeg
- MOV CL,[CX+BP+32768] ; illeg
- MOV CH,[CX+DI+32768] ; illeg
- MOV DL,[CX+SI+32768] ; illeg
- MOV DH,[CX+SP+32768] ; illeg
-
- MOV AL,[DX+AX+32768] ; illeg
- MOV AH,[DX+BX+32768] ; illeg
- MOV BL,[DX+CX+32768] ; illeg
- MOV BH,[DX+DX+32768] ; illeg
- MOV CL,[DX+BP+32768] ; illeg
- MOV CH,[DX+DI+32768] ; illeg
- MOV DL,[DX+SI+32768] ; illeg
- MOV DH,[DX+SP+32768] ; illeg
-
- MOV AL,[BP+AX+32768] ; illeg
- MOV AH,[BP+BX+32768] ; illeg
- MOV BL,[BP+CX+32768] ; illeg
- MOV BH,[BP+DX+32768] ; illeg
- MOV CL,[BP+BP+32768] ; illeg
- MOV CH,[BP+DI+32768]
- MOV DL,[BP+SI+32768]
- MOV DH,[BP+SP+32768] ; illeg
-
- MOV AL,[DI+AX+32768] ; illeg
- MOV AH,[DI+BX+32768]
- MOV BL,[DI+CX+32768] ; illeg
- MOV BH,[DI+DX+32768] ; illeg
- MOV CL,[DI+BP+32768]
- MOV CH,[DI+DI+32768] ; illeg
- MOV DL,[DI+SI+32768] ; illeg
- MOV DH,[DI+SP+32768] ; illeg
-
- MOV AL,[SI+AX+32768] ; illeg
- MOV AH,[SI+BX+32768]
- MOV BL,[SI+CX+32768] ; illeg
- MOV BH,[SI+DX+32768] ; illeg
- MOV CL,[SI+BP+32768]
- MOV CH,[SI+DI+32768] ; illeg
- MOV DL,[SI+SI+32768] ; illeg
- MOV DH,[SI+SP+32768] ; illeg
-
- MOV AL,[SP+AX+32768] ; illeg
- MOV AH,[SP+BX+32768] ; illeg
- MOV BL,[SP+CX+32768] ; illeg
- MOV BH,[SP+DX+32768] ; illeg
- MOV CL,[SP+BP+32768] ; illeg
- MOV CH,[SP+DI+32768] ; illeg
- MOV DL,[SP+SI+32768] ; illeg
- MOV DH,[SP+SP+32768] ; illeg
-
- MOV AL,[AX+AX-32769] ; illeg
- MOV AH,[AX+BX-32769] ; illeg
- MOV BL,[AX+CX-32769] ; illeg
- MOV BH,[AX+DX-32769] ; illeg
- MOV CL,[AX+BP-32769] ; illeg
- MOV CH,[AX+DI-32769] ; illeg
- MOV DL,[AX+SI-32769] ; illeg
- MOV DH,[AX+SP-32769] ; illeg
-
- MOV AL,[BX+AX-32769] ; illeg
- MOV AH,[BX+BX-32769] ; illeg
- MOV BL,[BX+CX-32769] ; illeg
- MOV BH,[BX+DX-32769] ; illeg
- MOV CL,[BX+BP-32769] ; illeg
- MOV CH,[BX+DI-32769]
- MOV DL,[BX+SI-32769]
- MOV DH,[BX+SP-32769] ; illeg
-
- MOV AL,[CX+AX-32769] ; illeg
- MOV AH,[CX+BX-32769] ; illeg
- MOV BL,[CX+CX-32769] ; illeg
- MOV BH,[CX+DX-32769] ; illeg
- MOV CL,[CX+BP-32769] ; illeg
- MOV CH,[CX+DI-32769] ; illeg
- MOV DL,[CX+SI-32769] ; illeg
- MOV DH,[CX+SP-32769] ; illeg
-
- MOV AL,[DX+AX-32769] ; illeg
- MOV AH,[DX+BX-32769] ; illeg
- MOV BL,[DX+CX-32769] ; illeg
- MOV BH,[DX+DX-32769] ; illeg
- MOV CL,[DX+BP-32769] ; illeg
- MOV CH,[DX+DI-32769] ; illeg
- MOV DL,[DX+SI-32769] ; illeg
- MOV DH,[DX+SP-32769] ; illeg
-
- MOV AL,[BP+AX-32769] ; illeg
- MOV AH,[BP+BX-32769] ; illeg
- MOV BL,[BP+CX-32769] ; illeg
- MOV BH,[BP+DX-32769] ; illeg
- MOV CL,[BP+BP-32769] ; illeg
- MOV CH,[BP+DI-32769]
- MOV DL,[BP+SI-32769]
- MOV DH,[BP+SP-32769] ; illeg
-
- MOV AL,[DI+AX-32769] ; illeg
- MOV AH,[DI+BX-32769]
- MOV BL,[DI+CX-32769] ; illeg
- MOV BH,[DI+DX-32769] ; illeg
- MOV CL,[DI+BP-32769]
- MOV CH,[DI+DI-32769] ; illeg
- MOV DL,[DI+SI-32769] ; illeg
- MOV DH,[DI+SP-32769] ; illeg
-
- MOV AL,[SI+AX-32769] ; illeg
- MOV AH,[SI+BX-32769]
- MOV BL,[SI+CX-32769] ; illeg
- MOV BH,[SI+DX-32769] ; illeg
- MOV CL,[SI+BP-32769]
- MOV CH,[SI+DI-32769] ; illeg
- MOV DL,[SI+SI-32769] ; illeg
- MOV DH,[SI+SP-32769] ; illeg
-
- MOV AL,[SP+AX-32769] ; illeg
- MOV AH,[SP+BX-32769] ; illeg
- MOV BL,[SP+CX-32769] ; illeg
- MOV BH,[SP+DX-32769] ; illeg
- MOV CL,[SP+BP-32769] ; illeg
- MOV CH,[SP+DI-32769] ; illeg
- MOV DL,[SP+SI-32769] ; illeg
- MOV DH,[SP+SP-32769] ; illeg
-
- MOV AL,[AX+AX+$7FFFFFFF] ; illeg
- MOV AH,[AX+BX+$7FFFFFFF] ; illeg
- MOV BL,[AX+CX+$7FFFFFFF] ; illeg
- MOV BH,[AX+DX+$7FFFFFFF] ; illeg
- MOV CL,[AX+BP+$7FFFFFFF] ; illeg
- MOV CH,[AX+DI+$7FFFFFFF] ; illeg
- MOV DL,[AX+SI+$7FFFFFFF] ; illeg
- MOV DH,[AX+SP+$7FFFFFFF] ; illeg
-
- MOV AL,[BX+AX+$7FFFFFFF] ; illeg
- MOV AH,[BX+BX+$7FFFFFFF] ; illeg
- MOV BL,[BX+CX+$7FFFFFFF] ; illeg
- MOV BH,[BX+DX+$7FFFFFFF] ; illeg
- MOV CL,[BX+BP+$7FFFFFFF] ; illeg
- MOV CH,[BX+DI+$7FFFFFFF] ; illeg (bounds)
- MOV DL,[BX+SI+$7FFFFFFF] ; illeg (bounds)
- MOV DH,[BX+SP+$7FFFFFFF] ; illeg
-
- MOV AL,[CX+AX+$7FFFFFFF] ; illeg
- MOV AH,[CX+BX+$7FFFFFFF] ; illeg
- MOV BL,[CX+CX+$7FFFFFFF] ; illeg
- MOV BH,[CX+DX+$7FFFFFFF] ; illeg
- MOV CL,[CX+BP+$7FFFFFFF] ; illeg
- MOV CH,[CX+DI+$7FFFFFFF] ; illeg
- MOV DL,[CX+SI+$7FFFFFFF] ; illeg
- MOV DH,[CX+SP+$7FFFFFFF] ; illeg
-
- MOV AL,[DX+AX+$7FFFFFFF] ; illeg
- MOV AH,[DX+BX+$7FFFFFFF] ; illeg
- MOV BL,[DX+CX+$7FFFFFFF] ; illeg
- MOV BH,[DX+DX+$7FFFFFFF] ; illeg
- MOV CL,[DX+BP+$7FFFFFFF] ; illeg
- MOV CH,[DX+DI+$7FFFFFFF] ; illeg
- MOV DL,[DX+SI+$7FFFFFFF] ; illeg
- MOV DH,[DX+SP+$7FFFFFFF] ; illeg
-
- MOV AL,[BP+AX+$7FFFFFFF] ; illeg
- MOV AH,[BP+BX+$7FFFFFFF] ; illeg
- MOV BL,[BP+CX+$7FFFFFFF] ; illeg
- MOV BH,[BP+DX+$7FFFFFFF] ; illeg
- MOV CL,[BP+BP+$7FFFFFFF] ; illeg
- MOV CH,[BP+DI+$7FFFFFFF] ; illeg (bounds)
- MOV DL,[BP+SI+$7FFFFFFF] ; illeg (bounds)
- MOV DH,[BP+SP+$7FFFFFFF] ; illeg
-
- MOV AL,[DI+AX+$7FFFFFFF] ; illeg
- MOV AH,[DI+BX+$7FFFFFFF] ; illeg (bounds)
- MOV BL,[DI+CX+$7FFFFFFF] ; illeg
- MOV BH,[DI+DX+$7FFFFFFF] ; illeg
- MOV CL,[DI+BP+$7FFFFFFF] ; illeg (bounds)
- MOV CH,[DI+DI+$7FFFFFFF] ; illeg
- MOV DL,[DI+SI+$7FFFFFFF] ; illeg
- MOV DH,[DI+SP+$7FFFFFFF] ; illeg
-
- MOV AL,[SI+AX+$7FFFFFFF] ; illeg
- MOV AH,[SI+BX+$7FFFFFFF] ; illeg (bounds)
- MOV BL,[SI+CX+$7FFFFFFF] ; illeg
- MOV BH,[SI+DX+$7FFFFFFF] ; illeg
- MOV CL,[SI+BP+$7FFFFFFF] ; illeg (bounds)
- MOV CH,[SI+DI+$7FFFFFFF] ; illeg
- MOV DL,[SI+SI+$7FFFFFFF] ; illeg
- MOV DH,[SI+SP+$7FFFFFFF] ; illeg
-
- MOV AL,[SP+AX+$7FFFFFFF] ; illeg
- MOV AH,[SP+BX+$7FFFFFFF] ; illeg
- MOV BL,[SP+CX+$7FFFFFFF] ; illeg
- MOV BH,[SP+DX+$7FFFFFFF] ; illeg
- MOV CL,[SP+BP+$7FFFFFFF] ; illeg
- MOV CH,[SP+DI+$7FFFFFFF] ; illeg
- MOV DL,[SP+SI+$7FFFFFFF] ; illeg
- MOV DH,[SP+SP+$7FFFFFFF] ; illeg
-
- MOV AL,[AX+AX-$80000000] ; illeg
- MOV AH,[AX+BX-$80000000] ; illeg
- MOV BL,[AX+CX-$80000000] ; illeg
- MOV BH,[AX+DX-$80000000] ; illeg
- MOV CL,[AX+BP-$80000000] ; illeg
- MOV CH,[AX+DI-$80000000] ; illeg
- MOV DL,[AX+SI-$80000000] ; illeg
- MOV DH,[AX+SP-$80000000] ; illeg
-
- MOV AL,[BX+AX-$80000000] ; illeg
- MOV AH,[BX+BX-$80000000] ; illeg
- MOV BL,[BX+CX-$80000000] ; illeg
- MOV BH,[BX+DX-$80000000] ; illeg
- MOV CL,[BX+BP-$80000000] ; illeg
- MOV CH,[BX+DI-$80000000] ; illeg (bounds)
- MOV DL,[BX+SI-$80000000] ; illeg (bounds)
- MOV DH,[BX+SP-$80000000] ; illeg
-
- MOV AL,[CX+AX-$80000000] ; illeg
- MOV AH,[CX+BX-$80000000] ; illeg
- MOV BL,[CX+CX-$80000000] ; illeg
- MOV BH,[CX+DX-$80000000] ; illeg
- MOV CL,[CX+BP-$80000000] ; illeg
- MOV CH,[CX+DI-$80000000] ; illeg
- MOV DL,[CX+SI-$80000000] ; illeg
- MOV DH,[CX+SP-$80000000] ; illeg
-
- MOV AL,[DX+AX-$80000000] ; illeg
- MOV AH,[DX+BX-$80000000] ; illeg
- MOV BL,[DX+CX-$80000000] ; illeg
- MOV BH,[DX+DX-$80000000] ; illeg
- MOV CL,[DX+BP-$80000000] ; illeg
- MOV CH,[DX+DI-$80000000] ; illeg
- MOV DL,[DX+SI-$80000000] ; illeg
- MOV DH,[DX+SP-$80000000] ; illeg
-
- MOV AL,[BP+AX-$80000000] ; illeg
- MOV AH,[BP+BX-$80000000] ; illeg
- MOV BL,[BP+CX-$80000000] ; illeg
- MOV BH,[BP+DX-$80000000] ; illeg
- MOV CL,[BP+BP-$80000000] ; illeg
- MOV CH,[BP+DI-$80000000] ; illeg (bounds)
- MOV DL,[BP+SI-$80000000] ; illeg (bounds)
- MOV DH,[BP+SP-$80000000] ; illeg
-
- MOV AL,[DI+AX-$80000000] ; illeg
- MOV AH,[DI+BX-$80000000] ; illeg (bounds)
- MOV BL,[DI+CX-$80000000] ; illeg
- MOV BH,[DI+DX-$80000000] ; illeg
- MOV CL,[DI+BP-$80000000] ; illeg (bounds)
- MOV CH,[DI+DI-$80000000] ; illeg
- MOV DL,[DI+SI-$80000000] ; illeg
- MOV DH,[DI+SP-$80000000] ; illeg
-
- MOV AL,[SI+AX-$80000000] ; illeg
- MOV AH,[SI+BX-$80000000] ; illeg (bounds)
- MOV BL,[SI+CX-$80000000] ; illeg
- MOV BH,[SI+DX-$80000000] ; illeg
- MOV CL,[SI+BP-$80000000] ; illeg (bounds)
- MOV CH,[SI+DI-$80000000] ; illeg
- MOV DL,[SI+SI-$80000000] ; illeg
- MOV DH,[SI+SP-$80000000] ; illeg
-
- MOV AL,[SP+AX-$80000000] ; illeg
- MOV AH,[SP+BX-$80000000] ; illeg
- MOV BL,[SP+CX-$80000000] ; illeg
- MOV BH,[SP+DX-$80000000] ; illeg
- MOV CL,[SP+BP-$80000000] ; illeg
- MOV CH,[SP+DI-$80000000] ; illeg
- MOV DL,[SP+SI-$80000000] ; illeg
- MOV DH,[SP+SP-$80000000] ; illeg
diff --git a/bin86-0.3/as/asm/f.asm b/bin86-0.3/as/asm/f.asm
deleted file mode 100644
index c067bf9..0000000
--- a/bin86-0.3/as/asm/f.asm
+++ /dev/null
@@ -1,114 +0,0 @@
-; [fadd fdiv fdivr fmul fsub fsubr] [mem4r mem8r st,st(i) st(i),st]
- fadd qword [ebx]
- fadd dword [ebx]
- fadd st,st(1)
- fadd st(1),st
- fdiv qword [ebx]
- fdiv dword [ebx]
- fdiv st,st(1) ; special swapping for this
-
-; [faddp fdivp fdivrp fmulp fsubp fsubrp] st(i),st
- faddp st(1),st
-
-; [fbld fbstp] mem10r
- fbld tbyte [ebx]
- fbstp tbyte [ebx]
-
-; [fcom fcomp] [mem4r mem8r optional-st(i)]
- fcom dword [ebx]
- fcom qword [ebx]
- fcom
- fcom st(1)
-
-; ffree st(i)
- ffree st(1)
-
-; [fucom fucomp fxch] optional-st(i)
- fucom
- fucom st(1)
-
-; [fiadd ficom ficomp fidiv fidivr fimul fist fisub fisubr] [mem2i mem4i]
- fiadd word [ebx]
- fiadd dword [ebx]
-
-; [fild fistp] [mem2i mem4i mem8i]
- fild word [ebx]
- fild dword [ebx]
- fild qword [ebx]
-
-; [fld fstp] [mem4r mem8r mem10r st(i)]
- fld dword [ebx]
- fld qword [ebx]
- fld tbyte [ebx]
- fld st(1)
-
-; [fldcw fnstcw] mem2i
- fldcw word [ebx]
- fnstcw word [ebx]
-
-; [fldenv fnsave fnstenv frstor] mem
- fldenv [ebx]
- fnsave [ebx]
- fnstenv [ebx]
- frstor [ebx]
-
-; fnstsw [mem2i ax]
- fnstsw word [ebx]
- fnstsw ax
-
-; fst [mem4r mem8r st(i)]
- fst dword [ebx]
- fst qword [ebx]
- fst st(1)
-
-; fstcw mem2i (wait)
- fstcw word [ebx]
-
-; fstsw [mem2i ax] (wait)
- fstsw word [ebx]
- fstsw ax
-
-; [fsave fstenv] mem (wait)
- fsave [ebx]
- fstenv [ebx]
-
-; [fxxx] (no operands)
- fnop ; D9D0
- fchs ; D9E0
- fabs ; D9E1
- ftst ; D9E4
- fxam ; D9E5
- fld1 ; D9E8
- fldl2t ; D9E9
- fldl2e ; D9EA
- fldpi ; D9EB
- fldlg2 ; D9EC
- fldln2 ; D9ED
- fldz ; D9EE
- f2xm1 ; D9F0
- fyl2x ; D9F1
- fptan ; D9F2
- fpatan ; D9F3
- fxtract ; D9F4
- fprem1 ; D9F5
- fdecstp ; D9F6
- fincstp ; D9F7
- fprem ; D9F8
- fyl2xp1 ; D9F9
- fsqrt ; D9FA
- fsincos ; D9FB
- frndint ; D9FC
- fscale ; D9FD
- fsin ; D9FE
- fcos ; D9FF
- fucompp ; DAE9
- feni ; 9BDBE0
- fneni ; DBE0
- fdisi ; 9BDBE1
- fndisi ; DBE1
- fclex ; 9BDBE2
- fnclex ; DBE2
- finit ; 9BDBE3
- fninit ; DBE3
- fsetpm ; DBE4
- fcompp ; DED9
diff --git a/bin86-0.3/as/asm/fadd.asm b/bin86-0.3/as/asm/fadd.asm
deleted file mode 100644
index d18f002..0000000
--- a/bin86-0.3/as/asm/fadd.asm
+++ /dev/null
@@ -1,271 +0,0 @@
-_fadd:
- PUSH BP
- MOV BP,SP
- MOV EAX,DWORD PTR [BP+4]
- MOV EDX,DWORD PTR [BP+8]
- MOV EBX,DWORD PTR [BP+12]
- MOV ECX,DWORD PTR [BP+16]
- CALL faddfxfy
- MOV DWORD PTR _facc,EAX
- MOV DWORD PTR _facc+4,EDX
- POP BP
- RET
-
-fsubfxfy:
- XOR ECX,#$80000000 ; complement sign bit, fall into add routine
-faddfxfy:
- PUSH EBP
- PUSH EDI
- PUSH ESI
- MOV EDI,ECX ; free CL for shifts
- MOV ESI,EDX ; this mainly for consistent naming
- AND ESI,#$7FFFFFFF ; discard sign so comparison is simple
- AND EDI,#$7FFFFFFF
-
- CMP ESI,EDI
- JA XBIG
- JB SWAP
- CMP EAX,EBX
- JAE XBIG
-SWAP:
- XCHG EDX,ECX
- XCHG ESI,EDI
- XCHG EAX,EBX
-XBIG:
- AND ESI,#$000FFFFF ; discard exponent
- AND EDI,#$000FFFFF
- OR ESI,#$00100000 ; normalize
- OR EDI,#$00100000
-
- SHR ECX,32-(1+11)
- SHR EDX,32-(1+11)
- MOV EBP,ECX ; prepare to compare signs (want high bits 0)
- SUB CX,DX ; get difference of signs in CX
- NEG CX ; D holds sign and exponent of both throughout
- CMP CX,#(64-11)+2
- JAE TO_DONE1 ; x dominates y
- XOR BP,DX
- AND BP,#$0800 ; see if signs are same
- JNZ TO_SUBTRACT ; else roundoff reg EBP is 0
-
- CMP CL,#32
- JAE TO_ADD_BIGSHIFT
- SHRD EBP,EBX,CL
- SHRD EBX,EDI,CL
- SHR EDI,CL
- ADD EAX,EBX
- ADC ESI,EDI
- SUB EBX,EBX
-
-; result DX(1+11):SI:AX:BP:BX but needs normalization
-
-NORMALIZE:
- MOV CX,DX
- AND CX,#$07FF
- TEST ESI,#$00200000
- JZ NORMALIZE2
- BR LOVERFLOW
-
-TO_DONE1:
- JMP DONE1
-
-TO_SUBTRACT:
- BR SUBTRACT
-
-TO_ADD_BIGSHIFT:
- BR ADD_BIGSHIFT
-
-TO_NORMLITTLE:
- BR NORMLITTLE
-
-; result DX(1):CX(11):SI:AX:BP:BX
-
-NORMALIZE2:
- SHRD EDI,ESI,32-11
- ; top 11 bits of ESI known 0 and BSR is slooow
- BSR EDI,EDI ; index of leading 1 bit in EDI is 11..31 in DI
- JZ TO_NORMLITTLE ; ESI is zero (flag wrong in Intel Manual)
- SUB DI,#31
- NEG DI
- PUSH CX ; gr
- MOV CX,DI ; rr
- SHLD ESI,EAX,CL
- SHLD EAX,EBP,CL
- SHLD EBP,EBX,CL
- SHL EBX,CL
- POP CX ; rr
- SUB CX,DI
- JC UNDERFLOW
-
-ROUND:
- CMP EBP,#$80000000 ; test roundoff register
- JA ROUNDUP
- JB DONE ; no rounding
- TEST EBX,EBX
- JNZ ROUNDUP
- TEST AL,#1 ; ambiguous case, round to even
- JZ DONE ; even, no rounding
-ROUNDUP:
- ADD EAX,#1
- ADC ESI,#0
- SUB EBP,EBP
- SUB EBX,EBX
- TEST ESI,#$00200000
- JNZ LOVERFLOW ; rounding may cause overflow!
-
-DONE:
- AND DX,#$0800 ; extract sign of largest and result
- OR DX,CX ; include exponent with sign
-DONE1:
- SHL EDX,32-(1+11)
- AND ESI,#$000FFFFF ; discard normalization bit
- OR EDX,ESI
- POP ESI
- POP EDI
- POP EBP
- RET
-
-UNDERFLOW: ; should have error message here
-ANSWER0:
- SUB EDX,EDX
- MOV EAX,EDX
- POP ESI
- POP EDI
- POP EBP
- RET
-
-LOVERFLOW: ; carry bit must be right-shifted back in
- SHR ESI,1
- RCR EAX,1
- RCR EBP,1
- RCR EBX,1
- INC CX
- CMP CX,#$0800
- JNZ ROUND
-
-OVERFLOW: ; should have error message here
- MOV EDX,#$FFE00000 ; + infinity
- SUB EAX,EAX
- POP ESI
- POP EDI
- POP EBP
- RET
-
-ADD_BIGSHIFT:
- SUB CL,#32
- SHRD EBP,EBX,CL
- SHRD EBX,EDI,CL
- SHR EDI,CL
- ADD EAX,EDI
- ADC ESI,#0
- XCHG EBP,EBX
- BR NORMALIZE
-
-NORMLITTLE:
- SHLD ESI,EAX,32-(1+11)
- SHLD EAX,EBP,32-(1+11)
- SHLD EBP,EBX,32-(1+11)
- SHL EBX,20
- SUB CL,#32-(1+11)
- JC UNDERFLOW
- BR NORMALIZE2
-
-SUBTRACT:
- SUB EBP,EBP ; set up roundoff register
- CMP CL,#32
- JAE SUBTRACT_BIGSHIFT
- SHRD EBP,EBX,CL
- SHRD EBX,EDI,CL
- SHR EDI,CL
- NEG EBP
- SBB EAX,EBX
- SBB ESI,EDI
- SUB EBX,EBX
- MOV CX,DX
- AND CX,#$07FF
- BR NORMALIZE2
-
-SUBTRACT_BIGSHIFT:
- SUB CL,#32
- SHRD EBP,EBX,CL
- SHRD EBX,EDI,CL
- SHR EDI,CL
- NEG EBX
- NEG EBP
- SBB EBX,#0
- SBB EAX,EDI
- SBB ESI,#0
- XCHG EBP,EBX
- MOV CX,DX
- AND CX,#$07FF
- BR NORMALIZE2
-
-TO_ANSWER0:
- BR ANSWER0
-
-TO_OVERFLOW:
- JMP TO_OVERFLOW
-
-TO_UNDERFLOW:
- BR UNDERFLOW
-
-fmulfxfy:
- PUSH EBP
- PUSH EDI
- PUSH ESI
- MOV ESI,EDX ; free DX for multiplications
- MOV EDI,ECX ; this mainly for consistent naming
- SHR EDX,32-(1+11)
- SHR ECX,32-(1+11)
- MOV BP,DX
- XOR BP,CX
- AND BP,#$0800 ; extract sign
- AND DX,#$07FF ; exp(x)
- JZ TO_ANSWER0
- AND CX,#$07FF ; exp(y)
- JZ TO_ANSWER0
- ADD CX,DX
- SUB CX,#$0400
- JB TO_UNDERFLOW
- CMP CX,#$07FF
- JA TO_OVERFLOW ; probably not quite right
-
- AND ESI,#$000FFFFF ; discard sign and exponent
- AND EDI,#$000FFFFF
- OR ESI,#$00100000 ; normalize
- OR EDI,#$00100000
-
-; exponent is in CX, sign in BP, operands in ESI:EAX and EDI:EBX, DX is free
-; product to go in ESI:EAX:EBP:EBX
-; terminology: x * y = (x32:x0) * (y32:y0) = x32y32 + x32y0 + x0y32 +x0y0
-
- PUSH CX
- PUSH BP
- MOV ECX,EAX
- MUL EBX ; x0y0
- MOV EBP,EDX ; x0y0.high in EBP
- XCHG EBX,EAX ; x0y0.low in EBX (final), y0 in EAX
- MUL ESI ; x32y0
- PUSH EAX ; x32y0.low on stack
- PUSH EDX ; x32y0.high on stack
- MOV EAX,ESI
- MUL EDI ; x32y32
- MOV ESI,EDX ; x32y32.high in ESI (final except carries)
- XCHG ECX,EAX ; x32y32.low in ECX, x0 in EAX
- MUL EDI ; x0y32
-
- ADD EBP,EAX ; x0y0.high + x0y32.low
- POP EAX ; x32y0.high
- ADC EAX,EDX ; x32y0.high + x0y32.high
- ADC ESI,#0
- POP EDX ; x32y0.low
- ADD EBP,EDX ; (x0y0.high + x0y32.low) + x32y0.low
- ADC EAX,ECX ; (x32y0.high + x0y32.high) + x32y32.low
- ADC ESI,#0
- POP DX ; sign
- POP CX ; exponent
- ADD CX,#13 ; temp fixup
- BR NORMALIZE2
-
-_facc:
- .word 0,0
diff --git a/bin86-0.3/as/asm/farcall.asm b/bin86-0.3/as/asm/farcall.asm
deleted file mode 100644
index 6a779d9..0000000
--- a/bin86-0.3/as/asm/farcall.asm
+++ /dev/null
@@ -1,10 +0,0 @@
-call 1:2
-call far [1]
-use32
-call far [1]
-
-use16
-jmp 1:2
-jmp far [1]
-use32
-jmp far [1]
diff --git a/bin86-0.3/as/asm/group1.asm b/bin86-0.3/as/asm/group1.asm
deleted file mode 100644
index fe2fb45..0000000
--- a/bin86-0.3/as/asm/group1.asm
+++ /dev/null
@@ -1,31 +0,0 @@
- ADD AL,#3
- ADD AX,#$1234
- ADD EAX,#$12345678
- ADD BL,#3
- ADD BX,#$1234
- ADD EBX,#$12345678
- ADD BYTE [BX],#3
- ADD BYTE 3[BX],#4
- ADD BYTE [BX+SI],#4
- ADD WORD [BX],#$1234
- ADD DWORD [BX],#$12345678
- ADD BYTE [BX],#3
- ADD WORD [BX],#-3
- ADD DWORD [BX],#-3
- ADD CL,BL
- ADD CX,BX
- ADD ECX,EBX
- ADD [BX],CL
- ADD [BX],CX
- ADD [BX],ECX
- ADD CL,[BX]
- ADD CX,[BX]
- ADD ECX,[BX]
-
- ADC CL,BL
- AND CL,BL
- CMP CL,BL
- OR CL,BL
- SUB CL,BL
- SBB CL,BL
- XOR CL,BL
diff --git a/bin86-0.3/as/asm/group6.asm b/bin86-0.3/as/asm/group6.asm
deleted file mode 100644
index f742672..0000000
--- a/bin86-0.3/as/asm/group6.asm
+++ /dev/null
@@ -1,24 +0,0 @@
-; group6.asm
-; 0F 00 /nnn
-
-; LLDT r/m16 nnn = 010
-; LTR r/m16 nnn = 011
-; SLDT r/m16 nnn = 000
-; STR r/m16 nnn = 001
-; VERR r/m16 nnn = 100
-; VERW r/m16 nnn = 101
-
- LLDT AL ; illeg size
- LLDT EAX ; illeg size
- LLDT WORD $1234 ; immed not allowed
- LLDT DS ; segreg not allowed
-
- LLDT AX
- LLDT [BX]
- LLDT [EAX]
-
- LTR BX
- SLDT [BP]
- STR [EBX]
- VERR CX
- VERW [SI]
diff --git a/bin86-0.3/as/asm/group7.asm b/bin86-0.3/as/asm/group7.asm
deleted file mode 100644
index 0df497c..0000000
--- a/bin86-0.3/as/asm/group7.asm
+++ /dev/null
@@ -1,34 +0,0 @@
-; group7.asm
-; 0F 01 /nnn
-
-; INVLPG m nnn = 111
-; LGDT m16&32 nnn = 010
-; LIDT m16&32 nnn = 011
-; LMSW r/m16 nnn = 110
-; SGDT m nnn = 000
-; SIDT m nnn = 001
-; SMSW r/m16 nnn = 100
-
- LGDT EAX ; register not allowed
- LGDT #$1234 ; immed not allowed
- LGDT WORD PTR [BX] ; illegal size
-
- LGDT [BX]
- LGDT PWORD PTR [BX]
- LGDT FWORD PTR [BX]
- LGDT [EAX]
-
- INVLPG [EDI]
- SGDT [BP]
- SIDT [EBX]
-
- LMSW AL ; illeg size
- LMSW EAX ; illeg size
- LMSW #$1234 ; immed not allowed
- LMSW DS ; segreg not allowed
-
- LMSW AX
- LMSW [BX]
- LMSW [EAX]
-
- SMSW BX
diff --git a/bin86-0.3/as/asm/imul.asm b/bin86-0.3/as/asm/imul.asm
deleted file mode 100644
index e2772c2..0000000
--- a/bin86-0.3/as/asm/imul.asm
+++ /dev/null
@@ -1,33 +0,0 @@
- use32
-
- imul bl
- imul byte ptr [esi]
- imul bx
- imul word ptr [esi]
- imul ebx
- imul dword ptr [esi]
-
- imul ax,bx
- imul ax,[esi]
- imul eax,ebx
- imul eax,[esi]
-
- imul ax,bx,22
- imul ax,[esi],22
- imul eax,ebx,22
- imul eax,[esi],22
-
- imul ax,[22]
- imul eax,[22]
- imul ax,#22
- imul eax,#22
-
- imul ax,bx,300
- imul ax,[esi],300
- imul eax,ebx,300000
- imul eax,[esi],300000
-
- imul ax,[300]
- imul eax,[300000]
- imul ax,#300
- imul eax,#300000
diff --git a/bin86-0.3/as/asm/incdec.asm b/bin86-0.3/as/asm/incdec.asm
deleted file mode 100644
index 573861c..0000000
--- a/bin86-0.3/as/asm/incdec.asm
+++ /dev/null
@@ -1,83 +0,0 @@
- INC AL
- INC AH
- INC BL
- INC BH
- INC CL
- INC CH
- INC DL
- INC DH
- INC #1 ; illeg
- INC BYTE #1 ; illeg
- INC [BX] ; illeg
- INC BYTE [BX]
-
- INC AX
- INC BX
- INC CX
- INC DX
- INC SP
- INC BP
- INC SI
- INC DI
- INC CS ; illeg
- INC DS ; illeg
- INC ES ; illeg
- INC FS ; illeg
- INC GS ; illeg
- INC #$1234 ; illeg
- INC WORD #$1234 ; illeg
- INC WORD [BX]
-
- INC EAX
- INC EBX
- INC ECX
- INC EDX
- INC ESP
- INC EBP
- INC ESI
- INC EDI
- INC #$12345678 ; illeg
- INC DWORD #$12345678 ; illeg
- INC DWORD [BX]
-
- DEC AL
- DEC AH
- DEC BL
- DEC BH
- DEC CL
- DEC CH
- DEC DL
- DEC DH
- DEC #1 ; illeg
- DEC BYTE #1 ; illeg
- DEC [BX] ; illeg
- DEC BYTE [BX]
-
- DEC AX
- DEC BX
- DEC CX
- DEC DX
- DEC SP
- DEC BP
- DEC SI
- DEC DI
- DEC CS ; illeg
- DEC DS ; illeg
- DEC ES ; illeg
- DEC FS ; illeg
- DEC GS ; illeg
- DEC #$1234 ; illeg
- DEC WORD #$1234 ; illeg
- DEC WORD [BX]
-
- DEC EAX
- DEC EBX
- DEC ECX
- DEC EDX
- DEC ESP
- DEC EBP
- DEC ESI
- DEC EDI
- DEC #$12345678 ; illeg
- DEC DWORD #$12345678 ; illeg
- DEC DWORD [BX]
diff --git a/bin86-0.3/as/asm/inher.asm b/bin86-0.3/as/asm/inher.asm
deleted file mode 100644
index f1343fa..0000000
--- a/bin86-0.3/as/asm/inher.asm
+++ /dev/null
@@ -1,127 +0,0 @@
-; INHER.ASM
-
-; INHER opcodes
-
- AAA
- AAS
-
- CLC
- CLD
- CLI
- CLTS
- CMC
- CMPSB
-
- DAA
- DAS
-
- HLT
-
- INTO
- INSB
-
- LAHF
- LEAVE
- LOCK
- LODSB
-
- MOVSB
-
- NOP
-
- OUTSB
-
- REP
- REPE
- REPNE
-
- SAHF
- SCASB
- STC
- STD
- STI
- STOSB
-
- WAIT
-
-; INHER16 and INHER32 opcodes
-
- USE16
-
- CBW
- CWD
- CWDE
- CDQ
- CMPSW
- CMPSD
-
- INSW
- INSD
- IRET
- IRETD
-
- LODSW
- LODSD
-
- MOVSW
- MOVSD
-
- OUTSW
- OUTSD
-
- POPA
- POPAD
- POPF
- POPFD
- PUSHA
- PUSHAD
- PUSHF
- PUSHFD
-
- SCASW
- SCASD
- STOSW
- STOSW
-
- XLAT
- XLATB
-
- USE32
-
- CBW
- CWD
- CWDE
- CDQ
- CMPSW
- CMPSD
-
- INSW
- INSD
- IRET
- IRETD
-
- LODSW
- LODSD
-
- MOVSW
- MOVSD
-
- OUTSW
- OUTSD
-
- POPA
- POPAD
- POPF
- POPFD
- PUSHA
- PUSHAD
- PUSHF
- PUSHFD
-
- SCASW
- SCASD
- STOSW
- STOSW
-
- XLAT
- XLATB
diff --git a/bin86-0.3/as/asm/inout.asm b/bin86-0.3/as/asm/inout.asm
deleted file mode 100644
index 3f0a3f2..0000000
--- a/bin86-0.3/as/asm/inout.asm
+++ /dev/null
@@ -1,25 +0,0 @@
- IN EAX,DX ; plain IN is no longer allowed
- INB
- IN AL,DX
- INW
- IN AX,DX
- IN EAX,DX
- IN AL,$20
- IN AL,$101
- IN AX,$20
- IN AX,$101
- IN EAX,$20
- IN EAX,$101
-
- OUTB DX,EAX ; plain OUT is no longer allowed
- OUTB
- OUT DX,AL
- OUTW
- OUT DX,AX
- OUT DX,EAX
- OUT $20,AL
- OUT $101,AL
- OUT $20,AX
- OUT #101,AX
- OUT $20,EAX
- OUT $101,EAX
diff --git a/bin86-0.3/as/asm/movspec.asm b/bin86-0.3/as/asm/movspec.asm
deleted file mode 100644
index a4f9c15..0000000
--- a/bin86-0.3/as/asm/movspec.asm
+++ /dev/null
@@ -1,246 +0,0 @@
-mov eax,cr0
-mov eax,cr2
-mov eax,cr3
-mov eax,dr0
-mov eax,dr1
-mov eax,dr2
-mov eax,dr3
-mov eax,dr6
-mov eax,dr7
-mov eax,tr3
-mov eax,tr4
-mov eax,tr5
-mov eax,tr6
-mov eax,tr7
-
-mov cr0,eax
-mov cr2,eax
-mov cr3,eax
-mov dr0,eax
-mov dr1,eax
-mov dr2,eax
-mov dr3,eax
-mov dr6,eax
-mov dr7,eax
-mov tr3,eax
-mov tr4,eax
-mov tr5,eax
-mov tr6,eax
-mov tr7,eax
-
-
-mov ebx,cr0
-mov ebx,cr2
-mov ebx,cr3
-mov ebx,dr0
-mov ebx,dr1
-mov ebx,dr2
-mov ebx,dr3
-mov ebx,dr6
-mov ebx,dr7
-mov ebx,tr3
-mov ebx,tr4
-mov ebx,tr5
-mov ebx,tr6
-mov ebx,tr7
-
-mov cr0,ebx
-mov cr2,ebx
-mov cr3,ebx
-mov dr0,ebx
-mov dr1,ebx
-mov dr2,ebx
-mov dr3,ebx
-mov dr6,ebx
-mov dr7,ebx
-mov tr3,ebx
-mov tr4,ebx
-mov tr5,ebx
-mov tr6,ebx
-mov tr7,ebx
-
-
-mov ecx,cr0
-mov ecx,cr2
-mov ecx,cr3
-mov ecx,dr0
-mov ecx,dr1
-mov ecx,dr2
-mov ecx,dr3
-mov ecx,dr6
-mov ecx,dr7
-mov ecx,tr3
-mov ecx,tr4
-mov ecx,tr5
-mov ecx,tr6
-mov ecx,tr7
-
-mov cr0,ecx
-mov cr2,ecx
-mov cr3,ecx
-mov dr0,ecx
-mov dr1,ecx
-mov dr2,ecx
-mov dr3,ecx
-mov dr6,ecx
-mov dr7,ecx
-mov tr3,ecx
-mov tr4,ecx
-mov tr5,ecx
-mov tr6,ecx
-mov tr7,ecx
-
-
-mov edx,cr0
-mov edx,cr2
-mov edx,cr3
-mov edx,dr0
-mov edx,dr1
-mov edx,dr2
-mov edx,dr3
-mov edx,dr6
-mov edx,dr7
-mov edx,tr3
-mov edx,tr4
-mov edx,tr5
-mov edx,tr6
-mov edx,tr7
-
-mov cr0,edx
-mov cr2,edx
-mov cr3,edx
-mov dr0,edx
-mov dr1,edx
-mov dr2,edx
-mov dr3,edx
-mov dr6,edx
-mov dr7,edx
-mov tr3,edx
-mov tr4,edx
-mov tr5,edx
-mov tr6,edx
-mov tr7,edx
-
-
-mov esi,cr0
-mov esi,cr2
-mov esi,cr3
-mov esi,dr0
-mov esi,dr1
-mov esi,dr2
-mov esi,dr3
-mov esi,dr6
-mov esi,dr7
-mov esi,tr3
-mov esi,tr4
-mov esi,tr5
-mov esi,tr6
-mov esi,tr7
-
-mov cr0,esi
-mov cr2,esi
-mov cr3,esi
-mov dr0,esi
-mov dr1,esi
-mov dr2,esi
-mov dr3,esi
-mov dr6,esi
-mov dr7,esi
-mov tr3,esi
-mov tr4,esi
-mov tr5,esi
-mov tr6,esi
-mov tr7,esi
-
-
-mov edi,cr0
-mov edi,cr2
-mov edi,cr3
-mov edi,dr0
-mov edi,dr1
-mov edi,dr2
-mov edi,dr3
-mov edi,dr6
-mov edi,dr7
-mov edi,tr3
-mov edi,tr4
-mov edi,tr5
-mov edi,tr6
-mov edi,tr7
-
-mov cr0,edi
-mov cr2,edi
-mov cr3,edi
-mov dr0,edi
-mov dr1,edi
-mov dr2,edi
-mov dr3,edi
-mov dr6,edi
-mov dr7,edi
-mov tr3,edi
-mov tr4,edi
-mov tr5,edi
-mov tr6,edi
-mov tr7,edi
-
-
-mov esp,cr0
-mov esp,cr2
-mov esp,cr3
-mov esp,dr0
-mov esp,dr1
-mov esp,dr2
-mov esp,dr3
-mov esp,dr6
-mov esp,dr7
-mov esp,tr3
-mov esp,tr4
-mov esp,tr5
-mov esp,tr6
-mov esp,tr7
-
-mov cr0,esp
-mov cr2,esp
-mov cr3,esp
-mov dr0,esp
-mov dr1,esp
-mov dr2,esp
-mov dr3,esp
-mov dr6,esp
-mov dr7,esp
-mov tr3,esp
-mov tr4,esp
-mov tr5,esp
-mov tr6,esp
-mov tr7,esp
-
-
-mov ebp,cr0
-mov ebp,cr2
-mov ebp,cr3
-mov ebp,dr0
-mov ebp,dr1
-mov ebp,dr2
-mov ebp,dr3
-mov ebp,dr6
-mov ebp,dr7
-mov ebp,tr3
-mov ebp,tr4
-mov ebp,tr5
-mov ebp,tr6
-mov ebp,tr7
-
-mov cr0,ebp
-mov cr2,ebp
-mov cr3,ebp
-mov dr0,ebp
-mov dr1,ebp
-mov dr2,ebp
-mov dr3,ebp
-mov dr6,ebp
-mov dr7,ebp
-mov tr3,ebp
-mov tr4,ebp
-mov tr5,ebp
-mov tr6,ebp
-mov tr7,ebp
diff --git a/bin86-0.3/as/asm/pushpop.asm b/bin86-0.3/as/asm/pushpop.asm
deleted file mode 100644
index b45117a..0000000
--- a/bin86-0.3/as/asm/pushpop.asm
+++ /dev/null
@@ -1,86 +0,0 @@
- PUSH AL ; illeg
- PUSH AH ; illeg
- PUSH BL ; illeg
- PUSH BH ; illeg
- PUSH CL ; illeg
- PUSH CH ; illeg
- PUSH DL ; illeg
- PUSH DH ; illeg
- PUSH #1 ; illeg
- PUSH BYTE #1 ; illeg
- PUSH [BX] ; illeg
- PUSH BYTE [BX] ; illeg
- PUSH WORD #-1 ; right way to push a signed byte value
-
- PUSH AX
- PUSH BX
- PUSH CX
- PUSH DX
- PUSH SP
- PUSH BP
- PUSH SI
- PUSH DI
- PUSH CS
- PUSH DS
- PUSH ES
- PUSH FS
- PUSH GS
- PUSH SS
- PUSH #$1234 ; illeg
- PUSH WORD #$1234
- PUSH WORD [BX]
-
- PUSH EAX
- PUSH EBX
- PUSH ECX
- PUSH EDX
- PUSH ESP
- PUSH EBP
- PUSH ESI
- PUSH EDI
- PUSH #$12345678 ; illeg
- PUSH DWORD #$12345678
- PUSH DWORD [BX]
-
- POP AL ; illeg
- POP AH ; illeg
- POP BL ; illeg
- POP BH ; illeg
- POP CL ; illeg
- POP CH ; illeg
- POP DL ; illeg
- POP DH ; illeg
- POP #1 ; illeg
- POP BYTE #1 ; illeg
- POP [BX] ; illeg
- POP BYTE [BX] ; illeg
-
- POP AX
- POP BX
- POP CX
- POP DX
- POP SP
- POP BP
- POP SI
- POP DI
- POP CS ; illeg
- POP DS
- POP ES
- POP FS
- POP GS
- POP SS
- POP #$1234 ; illeg
- POP WORD #$1234 ; illeg
- POP WORD [BX]
-
- POP EAX
- POP EBX
- POP ECX
- POP EDX
- POP ESP
- POP EBP
- POP ESI
- POP EDI
- POP #$12345678 ; illeg
- POP DWORD #$12345678 ; illeg
- POP DWORD [BX]
diff --git a/bin86-0.3/as/asm/seg.asm b/bin86-0.3/as/asm/seg.asm
deleted file mode 100644
index 0394615..0000000
--- a/bin86-0.3/as/asm/seg.asm
+++ /dev/null
@@ -1,6 +0,0 @@
- SEG CS
- SEG DS
- SEG ES
- SEG FS
- SEG GS
- SEG SS
diff --git a/bin86-0.3/as/asm/shdouble.asm b/bin86-0.3/as/asm/shdouble.asm
deleted file mode 100644
index 1080ece..0000000
--- a/bin86-0.3/as/asm/shdouble.asm
+++ /dev/null
@@ -1,34 +0,0 @@
-; SHDOUBLE.ASM
-
-ILLEGALS EQU 1
-
-; 0F A4 SHLD r/m16,r16,imm8 3/7
-; 0F A4 SHLD r/m32,r32,imm8 3/7
-; 0F A5 SHLD r/m16,r16,CL 3/7
-; 0F A5 SHLD r/m32,r32,CL 3/7
-
-; 0F AC SHRD r/m16,r16,imm8 3/7
-; 0F AC SHRD r/m32,r32,imm8 3/7
-; 0F AD SHRD r/m16,r16,CL 3/7
-; 0F AD SHRD r/m32,r32,CL 3/7
-
-IF ILLEGALS
- SHLD AL,BL,8 ; byte size
- SHLD AX,8,8 ; immediate source
- SHLD AX,DS,8 ; segment register
- SHLD AX,[BX],8 ; non-register source
- SHLD AX,BX,256 ; shift count too big
- SHLD AL,BL,8 ; byte size
-ENDIF
-
- SHLD BX,CX,3
- SHLD EDX,ESI,1
- SHLD CX,BX,CL
- SHLD ESI,EDX,1
- SHLD [BX],CX,3
- SHLD [BX],ECX,1
- SHLD [SI],BX,CL
- SHLD [SI],EBX,CL
-
- SHRD BX,CX,3
- SHRD CX,BX,CL
diff --git a/bin86-0.3/as/asm/shift.asm b/bin86-0.3/as/asm/shift.asm
deleted file mode 100644
index 35cc23f..0000000
--- a/bin86-0.3/as/asm/shift.asm
+++ /dev/null
@@ -1,119 +0,0 @@
- RCL AL,CL
- RCL AH,CL
- RCL BL,CL
- RCL BH,CL
- RCL CL,CL
- RCL CH,CL
- RCL DL,CL
- RCL DH,CL
- RCL #1,CL ; illeg
- RCL [BX],CL ; illeg
- RCL BYTE [BX],CL
-
- RCL AX,CL
- RCL BX,CL
- RCL CX,CL
- RCL DX,CL
- RCL SP,CL
- RCL BP,CL
- RCL SI,CL
- RCL DI,CL
- RCL CS,CL ; illeg
- RCL DS,CL ; illeg
- RCL ES,CL ; illeg
- RCL FS,CL ; illeg
- RCL GS,CL ; illeg
- RCL WORD [BX],CL
-
- RCL EAX,CL
- RCL EBX,CL
- RCL ECX,CL
- RCL EDX,CL
- RCL ESP,CL
- RCL EBP,CL
- RCL ESI,CL
- RCL EDI,CL
- RCL DWORD [BX],CL
-
- RCL AL,1
- RCL AH,1
- RCL BL,1
- RCL BH,1
- RCL CL,1
- RCL CH,1
- RCL DL,1
- RCL DH,1
- RCL #1,1 ; illeg
- RCL [BX],1 ; illeg
- RCL BYTE [BX],1
-
- RCL AX,1
- RCL BX,1
- RCL CX,1
- RCL DX,1
- RCL SP,1
- RCL BP,1
- RCL SI,1
- RCL DI,1
- RCL CS,1 ; illeg
- RCL DS,1 ; illeg
- RCL ES,1 ; illeg
- RCL FS,1 ; illeg
- RCL GS,1 ; illeg
- RCL WORD [BX],1
-
- RCL EAX,1
- RCL EBX,1
- RCL ECX,1
- RCL EDX,1
- RCL ESP,1
- RCL EBP,1
- RCL ESI,1
- RCL EDI,1
- RCL DWORD [BX],1
-
- RCL AL,15
- RCL AH,15
- RCL BL,15
- RCL BH,15
- RCL CL,15
- RCL CH,15
- RCL DL,15
- RCL DH,15
- RCL #1,15 ; illeg
- RCL [BX],15 ; illeg
- RCL BYTE [BX],15
- RCL AL,$1000
-
- RCL AX,15
- RCL BX,15
- RCL CX,15
- RCL DX,15
- RCL SP,15
- RCL BP,15
- RCL SI,15
- RCL DI,15
- RCL CS,15 ; illeg
- RCL DS,15 ; illeg
- RCL ES,15 ; illeg
- RCL FS,15 ; illeg
- RCL GS,15 ; illeg
- RCL WORD [BX],15
-
- RCL EAX,15
- RCL EBX,15
- RCL ECX,15
- RCL EDX,15
- RCL ESP,15
- RCL EBP,15
- RCL ESI,15
- RCL EDI,15
- RCL DWORD [BX],15
-
- RCR AX,7
- ROL AX,7
- ROR AX,7
- SAL AX,7
- SAR AX,7
- SHL AX,7
- SHR AX,7
diff --git a/bin86-0.3/as/asm/summary.as b/bin86-0.3/as/asm/summary.as
deleted file mode 100644
index cd62e37..0000000
--- a/bin86-0.3/as/asm/summary.as
+++ /dev/null
@@ -1,385 +0,0 @@
-general:
- ; AL,imm8
- ; AX,imm16
- ; EAX,imm32
- ; r/m8,imm8
- ; r/m16,imm16
- ; r/m32.imm32
- ; r/m16,signed imm8
- ; r/m32,signed imm8
- ; r/m8,r8
- ; r/m16,r16
- ; r/m32,r32
- ; r8,r/m8
- ; r16,r/m16
- ; r32,r/m32
-
-shiftcount:
- ; 1
- ; CL
- ; imm8
-unary alterable:
- ; r/m8
- ; r/m16
- ; r/m32
-
- AAA
- AAD ; [unsupported base]
- AAM ; [unsupported base]
- AAS
- ADC ; general
- ADD ; general
- AND ; general
- ARPL ; r/m16,r16
- BOUND ; r16,m16&16
- BOUND ; r32,m32&32
- BSF ; r16,r/m16
- BSF ; r32,r/m32
- BSR ; r16,r/m16
- BSR ; r32,r/m32
- BSWAP ; r32
- BT ; r/m16,r16
- BT ; r/m32,r32
- BT ; r/m16,imm8
- BT ; r/m32,imm8
- BTC ; r/m16,r16
- BTC ; r/m32,r32
- BTC ; r/m16,imm8
- BTC ; r/m32,imm8
- BTR ; r/m16,r16
- BTR ; r/m32,r32
- BTR ; r/m16,imm8
- BTR ; r/m32,imm8
- BTS ; r/m16,r16
- BTS ; r/m32,r32
- BTS ; r/m16,imm8
- BTS ; r/m32,imm8
- CALL ; rel16
- CALL ; r/m16
- CALL ; ptr16:16
- CALL ; m16:16
- CALL ; rel32
- CALL ; r/m32
- CALL ; ptr16:32
- CALL ; m16:32
- CBW
- CDQ
- CLC
- CLD
- CLI
- CLTS
- CMC
- CMP ; general
- CMPS ; [segreg:]m8,m8
- CMPS ; [segreg:]m16,m16
- CMPS ; [segreg:]m32,m32
- CMPSB
- CMPSW
- CMPSD
- CMPXCHG ; r/m8,r8
- CMPXCHG ; r/m16,r16
- CMPXCHG ; r/m32,r32
- CWD
- CWDE
- DAA
- DAS
- DEC ; unary alterable
- DEC ; r16
- DEC ; r32
- DIV ; AL,r/m8
- DIV ; AX,r/m16
- DIV ; EAX,r/m32
- ENTER ; imm16,imm8
- HLT
- IDIV ; AL,r/m8
- IDIV ; AX,r/m16
- IDIV ; EAX,r/m32
- IMUL ; r/m8
- IMUL ; r/m16
- IMUL ; r/m32
- IMUL ; r16,r/m16
- IMUL ; r32,r/m32
- IMUL ; r16,r/m16,imm8
- IMUL ; r32,r/m32,imm8
- IMUL ; r16,imm8
- IMUL ; r32,imm8
- IMUL ; r16,r/m16,imm16
- IMUL ; r32,r/m32,imm32
- IMUL ; r16,imm16
- IMUL ; r32,imm32
- IN ; AL,imm8
- IN ; AX,imm8
- IN ; EAX,imm8
- IN ; AL,DX
- IN ; AX,DX
- IN ; EAX,DX
- INC ; unary alterable
- INC ; r16
- INC ; r32
- INSB
- INSW
- INSD
- INT ; imm8
- INTO
- INVD
- INVLPG ; m
- IRET
- IRETD
- JCC ; rel8
- JCC ; rel16/32
- JA
- JAE
- JB
- JBE
- JC
- JCXZ
- JECXZ
- JE
- JG
- JGE
- JL
- JLE
- JNA
- JNAE
- JNB
- JNBE
- JNC
- JNE
- JNG
- JNGE
- JNL
- JNLE
- JNO
- JNP
- JNS
- JNZ
- JO
- JP
- JPE
- JPO
- JS
- JZ
- JMP ; rel8
- JMP ; rel16
- JMP ; r/m16
- JMP ; ptr16:16
- JMP ; m16:16
- JMP ; rel32
- JMP ; r/m32
- JMP ; ptr16:32
- JMP ; m16:32
- LAHF
- LAR ; r16,r/m16
- LAR ; r32,r/m32
- LEA ; r16,m
- LEA ; r32,m
- LEAVE
- LGDT ; m16&32
- LIDT ; m16&32
- LDS ; r16,m16:16
- LDS ; r32,m16:32
- LES ; r16,m16:16
- LES ; r32,m16:32
- LFS ; r16,m16:16
- LFS ; r32,m16:32
- LGS ; r16,m16:16
- LGS ; r32,m16:32
- LSS ; r16,m16:16
- LSS ; r32,m16:32
- LLDT ; r/m16
- LMSW ; r/m16
- LOCK
- LODS ; [segreg:]m8
- LODS ; [segreg:]m16
- LODS ; [segreg:]m32
- LODSB
- LODSW
- LODSD
- LOOP ; rel8
- LOOPE ; rel8
- LOOPZ ; rel8
- LOOPNE ; rel8
- LOOPNZ ; rel8
- LSL ; r16,r/m16
- LSL ; r32,r/m32
- LTR ; r/m16
- MOV ; r/m8,r8
- MOV ; r/m16,r16
- MOV ; r/m32,r32
- MOV ; r8,r/m8
- MOV ; r16,r/m16
- MOV ; r32,r/m32
- MOV ; r/m16,Sreg
- MOV ; Sreg,r/m16
- MOV ; AL,moffs8
- MOV ; AX,moffs16
- MOV ; EAX,moffs32
- MOV ; moffs8,AL
- MOV ; moffs16,AX
- MOV ; moffs32,EAX
- MOV ; r8,imm8
- MOV ; r16,imm16
- MOV ; r32,imm32
- MOV ; r32,CR0/CR2/CR3
- MOV ; r/m8,imm8
- MOV ; r/m16,imm16
- MOV ; r/m32,imm32
- MOV ; r32,CR0/CR2/CR3
- MOV ; CR0/CR2/CR3,r32
- MOV ; r32,DR0/DR1/DR2/DR3/DR6/DR7
- MOV ; DR0/DR1/DR2/DR3/DR6/DR7,r32
- MOV ; r32,TR6/TR7
- MOV ; TR6/TR7,r32
- MOVS ; [segreg:]m8,m8
- MOVS ; [segreg:]m16,m16
- MOVS ; [segreg:]m32,m32
- MOVSB
- MOVSW
- MOVSD
- MOVSX ; r16,r/m8
- MOVSX ; r32,r/m8
- MOVSX ; r32,r/m16
- MOVZX ; r16,r/m8
- MOVZX ; r32,r/m8
- MOVZX ; r32,r/m16
- MUL ; AL,r/m8
- MUL ; AX,r/m16
- MUL ; EAX,r/m32
- NEG ; unary alterable
- NOP
- NOT ; unary alterable
- OR ; general
- OUT ; imm8,AL
- OUT ; imm8,AX
- OUT ; imm8,EAX
- OUT ; DX,AL
- OUT ; DX,AX
- OUT ; DX,EAX
- OUTS ; [segreg:]m8
- OUTS ; [segreg:]m16
- OUTS ; [segreg:]m32
- OUTSB
- OUTSW
- OUTSD
- POP ; m16
- POP ; m32
- POP ; r16
- POP ; r32
- POP ; DS
- POP ; ES
- POP ; FS
- POP ; GS
- POP ; SS
- POPA
- POPAD
- POPF
- POPFD
- PUSH ; m16
- PUSH ; m32
- PUSH ; r16
- PUSH ; r32
- PUSH ; imm8
- PUSH ; imm16
- PUSH ; imm32
- PUSH ; CS
- PUSH ; DS
- PUSH ; ES
- PUSH ; FS
- PUSH ; GS
- PUSH ; SS
- PUSHA
- PUSHAD
- PUSHF
- PUSHFD
- RCL ; shiftcount
- RCR ; shiftcount
- ROL ; shiftcount
- ROR ; shiftcount
- REP ; INS/MOVS/OUTS/STOS
- REPE ; CMPS/SCAS
- REPNE ; CMPS/SCAS
- RET
- RET ; imm16
- SAHF
- SAL ; shiftcount
- SAR ; shiftcount
- SHL ; shiftcount
- SHR ; shiftcount
- SBB ; general
- SCASB
- SCASW
- SCASD
- SETA ; r/m8
- SETAE ; r/m8
- SETB ; r/m8
- SETBE ; r/m8
- SETC ; r/m8
- SETE ; r/m8
- SETG ; r/m8
- SETGE ; r/m8
- SETL ; r/m8
- SETLE ; r/m8
- SETNA ; r/m8
- SETNAE ; r/m8
- SETNB ; r/m8
- SETNBE ; r/m8
- SETNC ; r/m8
- SETNE ; r/m8
- SETNG ; r/m8
- SETNGE ; r/m8
- SETNL ; r/m8
- SETNLE ; r/m8
- SETNO ; r/m8
- SETNP ; r/m8
- SETNS ; r/m8
- SETNZ ; r/m8
- SETO ; r/m8
- SETP ; r/m8
- SETPE ; r/m8
- SETPO ; r/m8
- SETS ; r/m8
- SETZ ; r/m8
- SGDT ; m
- SHLD ; r/m16,r16,imm8
- SHLD ; r/m32,r32,imm8
- SHLD ; r/m16,r16,CL
- SHLD ; r/m32,r32,CL
- SHRD ; r/m16,r16,imm8
- SHRD ; r/m32,r32,imm8
- SHRD ; r/m16,r16,CL
- SHRD ; r/m32,r32,CL
- SIDT ; m
- SLDT ; r/m16
- SMSW ; r/m16
- STC
- STD
- STI
- STOSB
- STOSW
- STOSD
- STR ; r/m16
- SUB ; general
- TEST ; AL,imm8
- TEST ; AX,imm16
- TEST ; EAX,imm32
- TEST ; r/m8,imm8
- TEST ; r/m16,imm16
- TEST ; r/m32,imm32
- TEST ; r/m8,r8
- TEST ; r/m16,r16
- TEST ; r/m32/r32
- VERR ; r/m16
- VERW ; r/m16
- WAIT
- WBINVD
- XADD ; r/m8,r8
- XADD ; r/m16,r16
- XADD ; r/m32,r32
- XCHG ; AX,r16
- XCHG ; EAX,r32
- XCHG ; r/m8,r8
- XCHG ; r/m16,r16
- XCHG ; r/m32,r32
- XLAT ; [segreg:]m8
- XLATB
- XOR ; general
diff --git a/bin86-0.3/as/asm/xchg.asm b/bin86-0.3/as/asm/xchg.asm
deleted file mode 100644
index f05157f..0000000
--- a/bin86-0.3/as/asm/xchg.asm
+++ /dev/null
@@ -1,103 +0,0 @@
- XCHG AX,BL ; illeg
- XCHG AX,BYTE [BX] ; illeg
- XCHG AX,DS ; illeg
- XCHG AX,#1 ; illeg
-
- XCHG AX,AX
- XCHG AX,BX
- XCHG AX,CX
- XCHG AX,DX
- XCHG AX,SP
- XCHG AX,BP
- XCHG AX,SI
- XCHG AX,DI
-
- XCHG AX,AX
- XCHG BX,AX
- XCHG CX,AX
- XCHG DX,AX
- XCHG SP,AX
- XCHG BP,AX
- XCHG SI,AX
- XCHG DI,AX
-
- XCHG EAX,EAX
- XCHG EAX,EBX
- XCHG EAX,ECX
- XCHG EAX,EDX
- XCHG EAX,ESP
- XCHG EAX,EBP
- XCHG EAX,ESI
- XCHG EAX,EDI
-
- XCHG EAX,EAX
- XCHG EBX,EAX
- XCHG ECX,EAX
- XCHG EDX,EAX
- XCHG ESP,EAX
- XCHG EBP,EAX
- XCHG ESI,EAX
- XCHG EDI,EAX
-
- XCHG AL,AL
- XCHG AL,AH
- XCHG AL,BL
- XCHG AL,BH
- XCHG BL,CL
- XCHG BL,CH
- XCHG BL,DL
- XCHG BL,DH
-
- XCHG [BX],AL
- XCHG [BX],AH
- XCHG [BX],BL
- XCHG [BX],BH
- XCHG [BX],CL
- XCHG [BX],CH
- XCHG [BX],DL
- XCHG [BX],DH
-
- XCHG AL,[BX]
- XCHG AH,[BX]
- XCHG BL,[BX]
- XCHG BH,[BX]
- XCHG CL,[BX]
- XCHG CH,[BX]
- XCHG DL,[BX]
- XCHG DH,[BX]
-
- XCHG [BX],AX
- XCHG [BX],BX
- XCHG [BX],CX
- XCHG [BX],DX
- XCHG [BX],SP
- XCHG [BX],BP
- XCHG [BX],SI
- XCHG [BX],DI
-
- XCHG AX,[BX]
- XCHG BX,[BX]
- XCHG CX,[BX]
- XCHG DX,[BX]
- XCHG SP,[BX]
- XCHG BP,[BX]
- XCHG SI,[BX]
- XCHG DI,[BX]
-
- XCHG [BX],EAX
- XCHG [BX],EBX
- XCHG [BX],ECX
- XCHG [BX],EDX
- XCHG [BX],ESP
- XCHG [BX],EBP
- XCHG [BX],ESI
- XCHG [BX],EDI
-
- XCHG AX,[EBX]
- XCHG BX,[EBX]
- XCHG CX,[EBX]
- XCHG DX,[EBX]
- XCHG SP,[EBX]
- XCHG BP,[EBX]
- XCHG SI,[EBX]
- XCHG DI,[EBX]
diff --git a/bin86-0.3/as/assemble.c b/bin86-0.3/as/assemble.c
deleted file mode 100644
index 4e96178..0000000
--- a/bin86-0.3/as/assemble.c
+++ /dev/null
@@ -1,314 +0,0 @@
-/*
- * bin86/as/assemble.c
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-/* assemble.c - main loop for assembler */
-
-#include "const.h"
-#include "type.h"
-#include "address.h"
-#include "globvar.h"
-#include "opcode.h"
-#include "scan.h"
-
-PRIVATE bool_t nocolonlabel; /* set for labels not followed by ':' */
-PRIVATE void (*routine) P((void));
-PRIVATE pfv rout_table[] =
-{
- pelse,
- pelseif,
- pelsifc,
- pendif,
- pif,
- pifc,
-
- /* start of non-conditionals */
- palign,
- pblkw,
- pblock,
- pbss,
- pcomm,
- pcomm1,
- pdata,
- pendb,
- penter,
- pentry,
- pequ,
- peven,
- pexport,
- pfail,
- pfcb,
- pfcc,
- pfdb,
- pfqb,
- pget,
- pglobl,
- pident,
- pimport,
- plcomm,
- plcomm1,
- plist,
- ploc,
- pmaclist,
- pmacro,
- pmap,
- porg,
- pproceof,
- prmb,
- psect,
- pset,
- psetdp,
- ptext,
-#ifdef I80386
- puse16,
- puse32,
-#endif
- pwarn,
- /* end of pseudo-ops */
-
-#ifdef I80386
- mbcc,
- mbswap,
- mcall,
- mcalli,
- mdivmul,
- menter,
- mEwGw,
- mExGx,
- mf_inher,
- mf_m,
- mf_m2,
- mf_m2_ax,
- mf_m2_m4,
- mf_m2_m4_m8,
- mf_m4_m8_optst,
- mf_m4_m8_st,
- mf_m4_m8_stst,
- mf_m4_m8_m10_st,
- mf_m10,
- mf_optst,
- mf_st,
- mf_stst,
- mf_w_inher,
- mf_w_m,
- mf_w_m2,
- mf_w_m2_ax,
- mgroup1,
- mgroup2,
- mgroup6,
- mgroup7,
- mgroup8,
- mGvEv,
- mGvMa,
- mGvMp,
- mimul,
- min,
- mincdec,
- minher,
- minher16,
- minher32,
- minhera,
- mint,
- mjcc,
- mjcxz,
- mlea,
- mmov,
- mmovx,
- mnegnot,
- mout,
- mpushpop,
- mret,
- mseg,
- msetcc,
- mshdouble,
- mtest,
- mxchg,
-#endif /* I80386 */
-
-#ifdef MC6809
- mall, /* all address modes allowed, like LDA */
- malter, /* all but immediate, like STA */
- mimmed, /* immediate only (ANDCC, ORCC) */
- mindex, /* indexed (LEA's) */
- minher, /* inherent, like CLC or CLRA */
- mlong, /* long branches */
- mshort, /* short branches */
- msstak, /* S-stack (PSHS, PULS) */
- mswap, /* TFR, EXG */
- mustak, /* U-stack (PSHU,PULU) */
-#endif /* MC6809 */
-};
-
-FORWARD void asline P((void));
-
-/*
- This uses registers as follows: A is for work and is not preserved by
- the subroutines.B holds the last symbol code, X usually points to data
- about the last symbol, U usually holds the value of last expression
- or symbol, and Y points to the current char. The value in Y is needed
- by READCH and GETSYM. EXPRES needs B and Y, and returns a value in U.
- If the expression starts with an identifier, X must point to its string.
- LOOKUP needs a string pointer in X and length in A. It returns a table
- pointer in X (unless not assembling and not found), symbol type in A
- and overflow in CC.
-*/
-
-PUBLIC void assemble()
-{
- while (TRUE)
- {
- asline();
- if (label != NULL) /* must be confirmed if still set */
- { /* it is nulled by EQU, COMM and SET */
-#ifndef MC6809
-#define NEEDENDLABEL ILLAB
- if (nocolonlabel)
- error(NEEDENDLABEL);
-#endif
- label->type |= LABIT; /* confirm, perhaps redundant */
- if (label->type & REDBIT)
- {
- /* REDBIT meant 'GLOBLBIT' while LABIT was not set. */
- label->type |= EXPBIT;
- label->type &= ~REDBIT;
- }
- if ((mcount | popflags) == 0)
- /* unaccompanied label, display adr like EQU and SET */
- showlabel();
- label = NULL; /* reset for next line */
- }
- skipline();
- listline();
- genbin();
- genobj();
- binmbuf = lc += lcjump
-#ifdef I80386
- + immcount
-#endif
- ;
- }
-}
-
-PRIVATE void asline()
-{
- register struct sym_s *symptr;
-
- postb = popflags = pcrflag =
-#ifdef I80386
- sprefix = oprefix = aprefix =
-#endif
- immcount = lastexp.data = lcjump = 0;
-#ifdef I80386
- sib = NO_SIB;
-#endif
-#if SIZEOF_OFFSET_T > 2
- fqflag =
-#endif
- fdflag = fcflag = FALSE;
- readline();
- getsym();
- if (sym != IDENT) /* expect label, mnemonic or macro */
- return; /* anything else is a comment */
- symptr = gsymptr;
- if (!ifflag)
- /* not assembling, just test for IF/ELSE/ELSEIF/ENDIF */
- {
- if (symptr == NULL || !(symptr->type & MNREGBIT) ||
- symptr->data & REGBIT ||
- symptr->value_reg_or_op.op.routine >= MIN_NONCOND)
- return;
- }
- else if (!(symptr->type & (MACBIT | MNREGBIT)))
- /* not macro, op, pseudo-op or register, expect label */
- {
- if ((nocolonlabel = (*lineptr - ':')) == 0) /* exported label? */
- {
- sym = COLON;
- ++lineptr;
- }
- if (symptr->type & (LABIT | VARBIT))
- {
- if (symptr->type & REDBIT)
- labelerror(RELAB);
- label = symptr;
- }
- else if (checksegrel(symptr))
- {
- symptr->type &= ~COMMBIT; /* ignore COMM, PCOMM gives warning */
-#ifdef MC6809
-#if 0
- if (sym == COLON)
- symptr->type |= EXPBIT;
-#endif
-#endif
- symptr->data = (symptr->data & FORBIT) | lcdata;
- /* remember if forward referenced */
- symptr->value_reg_or_op.value = lc;
- /* unless changed by EQU,COMM or SET */
- label = symptr;
- }
- getsym();
- if (sym != IDENT)
- {
- if (sym == EQOP)
- {
- getsym();
- pequ();
- }
- return; /* anything but ident is comment */
- }
- symptr = gsymptr;
- }
- if (symptr->type & MACBIT)
- {
- entermac(symptr);
- return;
- }
- if (!(symptr->type & MNREGBIT))
- {
- error(OPEXP);
- return;
- }
- if (symptr->data & REGBIT)
- {
- error(REGUID);
- return;
- }
- mnsize = 0;
- if ((page = (symptr->data & (PAGE1 | PAGE2))) != 0)
- {
-#ifdef MNSIZE
- if (page == (PAGE1 | PAGE2))
- {
- mnsize = 1;
- page = 0;
- }
- else
-#endif
- {
-#ifdef PAGE2_OPCODE
- if (page == PAGE2)
- page = PAGE2_OPCODE;
- else
-#endif
- page = PAGE1_OPCODE;
- mcount = 1;
- }
- }
- opcode = symptr->value_reg_or_op.op.opcode;
- routine = rout_table[symptr->value_reg_or_op.op.routine];
- getsym();
- (*routine)();
- if (sym != EOLSYM)
- error(JUNK_AFTER_OPERANDS);
-#ifdef I80386
- if (aprefix != 0)
- ++mcount;
- if (oprefix != 0)
- ++mcount;
- if (sprefix != 0)
- ++mcount;
-#endif
-}
diff --git a/bin86-0.3/as/byteord.h b/bin86-0.3/as/byteord.h
deleted file mode 100644
index 01d2d85..0000000
--- a/bin86-0.3/as/byteord.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * bin86/as/byteord.h
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-/* byteord.h - byte order dependencies for C compiler, assembler, linker */
-
-/* These are for the targets of everything and for linker source too. */
-
-#ifdef I8086
-# define BIG_ENDIAN 0
-# define LONG_BIG_ENDIAN 0 /* except longs are back to front for Xenix */
-#endif
-
-#ifdef I80386
-# define BIG_ENDIAN 0
-# define LONG_BIG_ENDIAN 0
-#endif
-
-#ifdef MC6809
-# define BIG_ENDIAN 1 /* byte order in words is high-low */
-# define LONG_BIG_ENDIAN 1 /* byte order in longs is high-low */
-#endif
diff --git a/bin86-0.3/as/chk b/bin86-0.3/as/chk
deleted file mode 100755
index ce55954..0000000
--- a/bin86-0.3/as/chk
+++ /dev/null
@@ -1,9 +0,0 @@
-for i in `ls asm/*.asm`
-do
- j=`basename $i .asm`
- ./as asm/$j.asm -b $j.bin -o $j.obj > /dev/null
- cmp $j.bin bin/$j.bin
- cmp $j.obj obj/$j.obj
- rm $j.bin $j.obj
-done
-
diff --git a/bin86-0.3/as/const.h b/bin86-0.3/as/const.h
deleted file mode 100644
index 7961cf5..0000000
--- a/bin86-0.3/as/const.h
+++ /dev/null
@@ -1,430 +0,0 @@
-/*
- * bin86/as/const.h
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-#undef __BYTE_ORDER
-#undef __LITTLE_ENDIAN
-#undef __BIG_ENDIAN
-#include "endian.h"
-#define __LITTLE_ENDIAN 1234
-#define __BIG_ENDIAN 4321
-
-#if __BYTE_ORDER == __BIG_ENDIAN
-#define LOW_BYTE 3
-#else
-#define LOW_BYTE 0
-#endif
-
-#define align(x) ((x) = (void *)(((int) (x) + (4-1)) & ~(4-1)))
-/* const.h - constants for assembler */
-
-/* major switches */
-
-#define I80386 /* generate 80386 code */
-#undef MC6809 /* generate 6809 code */
-#define MNSIZE /* allow byte size in mnemonic, e.g. "movb" */
-#undef SOS_EDOS /* source OS is EDOS */
-
-/* defaults */
-
-#define DIRCHAR '/' /* character separating filename from dir */
-#define INBUFSIZE 8192
-#define SOS_EOLSTR "\012"
-
-/* defaults modified by switches */
-
-#ifdef SOS_EDOS
-# undef INBUFSIZE
-# define INBUFSIZE 512
-# undef SOS_EOLSTR
-# define SOS_EOLSTR "\015\012"
-# define STAKSIZ 256 /* table grows up to stack less this */
-#endif
-
-/* booleans */
-
-#define FALSE 0
-#define TRUE 1
-
-/* ASCII constants */
-
-#define ETB 23
-
-/* C tricks */
-
-#define EXTERN extern
-#define FORWARD static
-#define PRIVATE static
-#define PUBLIC
-
-#ifndef NULL
-#define NULL ((void *)0)
-#endif
-
-/* O/S constants */
-
-#define CREAT_PERMS 0666
-#define EOF (-1)
-#define STDIN 0
-#define STDOUT 1
-
-enum
-{
-/* Register codes (internal to assembler). */
-#ifdef I80386
-
-/* Index regs must be first. */
- BPREG,
- BXREG,
- DIREG,
- SIREG,
-#define MAX16BITINDREG SIREG
-
- EAXREG,
- EBPREG,
- EBXREG,
- ECXREG,
- EDIREG,
- EDXREG,
- ESIREG,
- ESPREG,
-#define MAXINDREG ESPREG
-
- AXREG,
- CXREG,
- DXREG,
- SPREG,
-
- AHREG,
- ALREG,
- BHREG,
- BLREG,
- CHREG,
- CLREG,
- DHREG,
- DLREG,
-
- CSREG,
- DSREG,
- ESREG,
- FSREG,
- GSREG,
- SSREG,
-
- CR0REG,
- CR2REG,
- CR3REG,
- DR0REG,
- DR1REG,
- DR2REG,
- DR3REG,
- DR6REG,
- DR7REG,
- TR3REG,
- TR4REG,
- TR5REG,
- TR6REG,
- TR7REG,
-
- ST0REG,
- ST1REG,
- ST2REG,
- ST3REG,
- ST4REG,
- ST5REG,
- ST6REG,
- ST7REG,
-
- NOREG,
-#endif /* I80386 */
-
-#ifdef MC6809
-
-/* Index regs must be first, then PC. */
- SREG,
- UREG,
- XREG,
- YREG,
-#define MAXINDREG YREG
-
- PCREG,
- AREG,
- BREG,
- CCREG,
- DPREG,
- DREG,
-
- NOREG,
-#endif /* MC6809 */
-};
-
-#ifdef I80386
-enum
-{
-/* Type and size keywords. */
- BYTEOP,
- DWORDOP,
- FWORDOP,
- FAROP,
- PTROP,
- PWORDOP,
- QWORDOP,
- TBYTEOP,
- WORDOP,
-};
-#endif /* I80386 */
-
-/* special chars */
-
-#define EOL 0
-#define MACROCHAR '?'
-
-enum
-{
-/* Symbol codes. */
-
-/* The first 2 must be from chars in identifiers. */
- IDENT,
- INTCONST,
-
-/* The next few are best for other possibly-multi-char tokens. */
- ADDOP, /* also ++ */
- BINCONST,
- CHARCONST,
- GREATERTHAN, /* also >> and context-sensitive */
- HEXCONST,
- LESSTHAN, /* also << and context-sensitive */
- SUBOP, /* also -- */
- WHITESPACE,
-
- ANDOP,
- COMMA,
- EOLSYM,
- EQOP,
- IMMEDIATE,
- INDIRECT,
- LBRACKET,
- LPAREN,
- MACROARG,
- NOTOP,
- OROP,
- OTHERSYM,
- POSTINCOP,
- PREDECOP,
- RBRACKET,
- RPAREN,
- SLASH, /* context-sensitive */
- SLOP,
- SROP,
- STAR, /* context-sensitive */
- STRINGCONST,
- COLON,
-};
-
-enum
-{
-/* Error codes. */
-
-/* Syntax errors. */
- COMEXP,
- DELEXP,
- FACEXP,
- IREGEXP,
- LABEXP,
- LPEXP,
- OPEXP,
- RBEXP,
- REGEXP,
- RPEXP,
- SPEXP,
-
-/* Expression errors. */
- ABSREQ,
- NONIMPREQ,
- RELBAD,
-
-/* Label errors. */
- ILLAB,
- MACUID,
- MISLAB,
- MNUID,
- REGUID,
- RELAB,
- UNBLAB,
- UNLAB,
- VARLAB,
-
-/* Addressing errors. */
- ABOUNDS,
- DBOUNDS,
- ILLMOD,
- ILLREG,
-
-/* Control structure errors. */
- ELSEBAD,
-#define ELSEIFBAD ELSEBAD
- ENDBBAD,
-#define ENDIFBAD ELSEBAD
- EOFBLOCK,
- EOFIF,
- EOFLC,
- EOFMAC,
- FAILERR,
-
-/* Overflow errors. */
- BLOCKOV,
- BWRAP,
- COUNTOV,
- COUNTUN,
- GETOV,
- IFOV,
-
- LINLONG,
- MACOV,
- OBJSYMOV,
- OWRITE,
- PAROV,
- SYMOV,
- SYMOUTOV,
-
-/* I/O errors. */
- OBJOUT,
-
-/* Miscellaneous errors. */
- AL_AX_EAX_EXP,
- CTLINS,
- FURTHER,
- ILL_IMM_MODE,
- ILL_IND_TO_IND,
- ILL_IND,
- ILL_IND_PTR,
- ILL_SCALE,
- ILL_SECTION,
- ILL_SEG_REG,
- ILL_SOURCE_EA,
- ILL_SIZE,
- IMM_REQ,
- INDEX_REG_EXP,
- IND_REQ,
- MISMATCHED_SIZE,
- NOIMPORT,
- REENTER,
- REL_REQ,
- REPEATED_DISPL,
- SEGREL,
- SEG_REG_REQ,
- SIZE_UNK,
-
- FP_REG_REQ,
- FP_REG_NOT_ALLOWED,
- ILL_FP_REG,
- ILL_FP_REG_PAIR,
- JUNK_AFTER_OPERANDS,
-
- ALREADY,
-
-/* Warnings. */
-#define MINWARN SHORTB
- SHORTB,
-};
-
-/* symbol table entry */
-
- /* type entry contains following flags */
-#define ENTBIT (1<<0) /* entry point (= OBJ_N_MASK) */
-#define COMMBIT (1<<1) /* common */
-#define LABIT (1<<2) /* label (a PC location or defined by EQU) */
-#define MNREGBIT (1<<3) /* mnemonic for op or pseudo-op, or register */
-#define MACBIT (1<<4) /* macro */
-#define REDBIT (1<<5) /* redefined (if with LABIT or VARBIT), to do
- * with SA_MASK (if with COMMBIT), otherwise
- * means globl */
-#define VARBIT (1<<6) /* variable (i.e. something defined by SET) */
-#define EXPBIT (1<<7) /* exported (= OBJ_E_MASK) */
-
- /* data entry contains following flags, valid */
- /* for expressions as well as syms */
-#define PAGE1 (1<<0) /* page 1 machine op = MNREGBIT | PAGE1 */
-#define PAGE2 (1<<1) /* page 2 machine op = MNREGBIT | PAGE2 */
-#define REGBIT (1<<2) /* register = MNREGBIT | REGBIT */
-#define SIZEBIT (1<<3) /* sizing mnemonic = MNREGBIT | SIZEBIT */
-#define SEGM 0x0F /* 1st 4 bits reused for segment if !MNREGBIT */
-#define RELBIT (1<<4) /* relative (= OBJ_A_MASK) */
-#define FORBIT (1<<5) /* forward referenced */
-#define IMPBIT (1<<6) /* imported (= OBJ_I_MASK) */
-#define UNDBIT (1<<7) /* undefined */
-
-/* object code format (Introl) */
-
-#define OBJ_SEGSZ_TWO 0x02 /* size 2 code for segment size descriptor */
-
-#define OBJ_MAX_ABS_LEN 64 /* max length of chunk of absolute code */
-
-#define OBJ_ABS 0x40 /* absolute code command */
-#define OBJ_OFFSET_REL 0x80 /* offset relocation command */
-#define OBJ_SET_SEG 0x20 /* set segment command */
-#define OBJ_SKIP_1 0x11 /* skip with 1 byte count */
-#define OBJ_SKIP_2 0x12 /* skip with 2 byte count */
-#define OBJ_SKIP_4 0x13 /* skip with 4 byte count */
-#define OBJ_SYMBOL_REL 0xC0 /* symbol relocation command */
-
-#define OBJ_A_MASK 0x10 /* absolute bit(symbols) */
-#if OBJ_A_MASK - RELBIT /* must match internal format (~byte 1 -> 0) */
-oops - RELBIT misplaced
-#endif
-#define OBJ_E_MASK 0x80 /* exported bit (symbols) */
-#if OBJ_E_MASK - EXPBIT /* must match internal format (byte 0 -> 0) */
-oops - EXPBIT misplaced
-#endif
-#define OBJ_I_MASK 0x40 /* imported bit (symbols) */
-#if OBJ_I_MASK - IMPBIT /* must match internal format (byte 1 -> 0) */
-oops - IMPBIT misplaced
-#endif
-#define OBJ_N_MASK 0x01 /* entry bit (symbols) */
-#if OBJ_N_MASK - ENTBIT /* must match internal format (byte 0 -> 1) */
-oops - ENTBIT misplaced
-#endif
-#define OBJ_SA_MASK 0x20 /* size allocation bit (symbols) */
-#define OBJ_SZ_ONE 0x40 /* size one code for symbol value */
-#define OBJ_SZ_TWO 0x80 /* size two code for symbol value */
-#define OBJ_SZ_FOUR 0xC0 /* size four code for symbol value */
-
-#define OBJ_R_MASK 0x20 /* PC-rel bit (off & sym reloc commands) */
-#define OBJ_SEGM_MASK 0x0F /* segment mask (symbols, off reloc command) */
-
-#define OBJ_OF_MASK 0x03 /* offset size code for symbol reloc */
-#define OBJ_S_MASK 0x04 /* symbol number size code for symbol reloc */
-
-#define SYMLIS_NAMELEN 26
-#define SYMLIS_LEN (sizeof (struct sym_listing_s))
-
-#define FILNAMLEN 64 /* max length of a file name */
-#define LINLEN 256 /* max length of input line */
-#define LINUM_LEN 5 /* length of formatted line number */
-
-#define SPTSIZ 1024 /* number of symbol ptrs */
- /* pseudo-op flags */
-#define POPHI 1 /* set to print hi byte of adr */
-#define POPLO 2 /* to print lo byte of ADR */
-#define POPLC 4 /* to print LC */
-#define POPLONG 8 /* to print high word of ADR */
-#define MAXBLOCK 8 /* max nesting level of BLOCK stack */
-#define MAXGET 8 /* max nesting level of GET stack */
-#define MAXIF 8 /* max nesting level of IF stack */
-#define MACPSIZ (128 / sizeof (struct schain_s))
- /* size of macro param buffer */
-#define MAXMAC 8 /* max nesting level of macro stack */
-#define NLOC 16 /* number of location counters */
-#ifdef I80386
-#define NO_SIB 0340 /* illegal sib (3 with 4) to mean no sib */
-#endif
-
-/* special segments */
-
-#define BSSLOC 3
-#define DATALOC 3
-#define DPLOC 2
-#define STRLOC 1
-#define TEXTLOC 0
diff --git a/bin86-0.3/as/det_endian.c b/bin86-0.3/as/det_endian.c
deleted file mode 100644
index 50b5bdc..0000000
--- a/bin86-0.3/as/det_endian.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Determine the "endianness" of the CPU.
- Copyright (C) 1991, 1992 Free Software Foundation, Inc.
- Contributed by Torbjorn Granlund (tege@sics.se).
-
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
-
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
-
-#include <stdio.h>
-
-main ()
-{
- unsigned long int i;
-
- if (sizeof (i) != 4)
- puts ("#error \"Not a 32-bit machine!\"");
-
- i = (((((('4' << 8) + '3') << 8) + '2') << 8) + '1');
-
- printf ("#define __BYTE_ORDER %.4s\n", (char *) &i);
-
- exit (0);
-}
diff --git a/bin86-0.3/as/error.c b/bin86-0.3/as/error.c
deleted file mode 100644
index 343ec8c..0000000
--- a/bin86-0.3/as/error.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * bin86/as/error.c
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-/* error.c - error routines for assembler */
-
-#include <string.h>
-#include "const.h"
-#include "type.h"
-
-PRIVATE char *errormessage[] =
-{
- "comma expected",
- "delimiter expected",
- "factor expected",
- "index register expected",
- "label expected",
- "left parentheses expected",
- "opcode expected",
- "right bracket expected",
- "register expected",
- "right parentheses expected",
- "space expected",
- "absolute expression required",
- "non-imported expression required",
- "relocation impossible",
- "illegal label",
- "MACRO used as identifier",
- "missing label",
- "opcode used as identifier",
- "register used as identifier",
- "redefined label",
- "unbound label",
- "undefined label",
- "variable used as label",
- "address out of bounds",
- "data out of bounds",
- "illegal address mode",
- "illegal register",
- "no matching IF",
- "no matching BLOCK",
- "end of file in BLOCK",
- "end of file in IF",
- "location counter was undefined at end",
- "end of file in MACRO",
- "user-generated error",
- "BLOCK stack overflow",
- "binary file wrap-around",
- "counter overflow",
- "counter underflow",
- "GET stack overflow",
- "IF stack overflow",
- "line too long",
- "MACRO stack overflow",
- "object symbol table overflow",
- "program overwrite",
- "parameter table overflow",
- "symbol table overflow",
- "output symbol table overflow",
- "error writing object file",
- "al, ax or eax expected",
- "control character in string",
- "futher errors suppressed",
- "illegal immediate mode",
- "illegal indirect to indirect",
- "illegal indirection",
- "illegal indirection from previous 'ptr'",
- "illegal scale",
- "illegal section",
- "illegal segment register",
- "illegal source effective address",
- "illegal size",
- "immediate expression expected",
- "index register expected",
- "indirect expression required",
- "mismatched size",
- "no imports with binary file output",
- "multiple ENTER pseudo-ops",
- "relative expression required",
- "repeated displacement",
- "segment or relocatability redefined",
- "segment register required",
- "size unknown",
- "FP register required",
- "FP register not allowed",
- "illegal FP register",
- "illegal FP register pair",
- "junk after operands",
- "already defined",
- "short branch would do",
- "unknown error",
-};
-
-/* build null-terminated error message for given error at given spot */
-
-PUBLIC char *build_error_message(errnum, buf)
-unsigned errnum;
-char *buf;
-{
- if (errnum >= sizeof errormessage / sizeof errormessage[0])
- errnum = sizeof errormessage / sizeof errormessage[0] - 1;
- return strcpy(buf, errormessage[errnum]);
-}
diff --git a/bin86-0.3/as/express.c b/bin86-0.3/as/express.c
deleted file mode 100644
index 7cd0b55..0000000
--- a/bin86-0.3/as/express.c
+++ /dev/null
@@ -1,388 +0,0 @@
-/*
- * bin86/as/express.c
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-/* express.c - expression handler for assembler */
-
-#include "const.h"
-#include "type.h"
-#include "address.h"
-#include "globvar.h"
-#include "scan.h"
-#include "source.h"
-
-FORWARD void experror P((error_pt errnum));
-FORWARD void expundefined P((void));
-FORWARD void simple2 P((void));
-FORWARD void simple P((void));
-FORWARD void term P((void));
-FORWARD void factor2 P((void));
-
-PUBLIC void absexpres()
-{
- expres();
- chkabs();
-}
-
-/* check lastexp.data is abs */
-
-PUBLIC void chkabs()
-{
- if (lastexp.data & RELBIT)
- {
- if (pass != 0)
- error(ABSREQ);
- expundefined();
- }
-}
-
-PRIVATE void experror(errnum)
-error_pt errnum;
-{
- error(errnum);
- expundefined();
-}
-
-PRIVATE void expundefined()
-{
- lastexp.data = FORBIT | UNDBIT;
-}
-
-PUBLIC void nonimpexpres()
-{
- expres();
- if (lastexp.data & IMPBIT)
- experror(NONIMPREQ);
-}
-
-/* generate relocation error if pass 2, make lastexp.data forward&undefined */
-
-PUBLIC void showrelbad()
-{
- if (pass != 0)
- error(RELBAD);
- expundefined();
-}
-
-PUBLIC void symabsexpres()
-{
- getsym();
- absexpres();
-}
-
-PUBLIC void symexpres()
-{
- getsym();
- expres();
-}
-
-/*
- expres() parses expression = simple expression [op simple expression],
- where op is =, < or >.
- Parameters: sym, number in number, identifier from symname to lineptr - 1.
- Returns value in lastexp.
-*/
-
-PUBLIC void expres()
-{
- offset_t leftoffset;
-
- simple();
- leftoffset = lastexp.offset;
- if (sym == EQOP)
- {
- simple2();
- if (leftoffset == lastexp.offset)
- lastexp.offset = -1;
- else
- lastexp.offset = 0;
- }
- else if (sym == LESSTHAN)
- {
- /* context-sensitive, LESSTHAN really means less than here */
- simple2();
- if (leftoffset < lastexp.offset)
- lastexp.offset = -1;
- else
- lastexp.offset = 0;
- }
- else if (sym == GREATERTHAN)
- {
- /* context-sensitive, GREATERTHAN really means greater than here */
- simple2();
- if (leftoffset > lastexp.offset)
- lastexp.offset = -1;
- else
- lastexp.offset = 0;
- }
-}
-
-/* get symbol and 2nd simple expression, check both rel or both abs */
-
-PRIVATE void simple2()
-{
- unsigned char leftdata;
-
- leftdata = lastexp.data;
- getsym();
- simple();
- if ((leftdata | lastexp.data) & IMPBIT ||
- (leftdata ^ lastexp.data) & (RELBIT | SEGM))
- showrelbad();
- else
- lastexp.data = (leftdata & lastexp.data) & ~(RELBIT | SEGM);
-}
-
-/*
- simple() parses simple expression = [+-] term {op term},
- where op is +, -, or \ (OR).
-*/
-
-PRIVATE void simple()
-{
- offset_t leftoffset;
- unsigned char leftdata;
-
- if (sym == ADDOP || sym == SUBOP)
- lastexp.data = lastexp.offset = 0;
- else
- term();
- while (TRUE)
- {
- leftoffset = lastexp.offset;
- leftdata = lastexp.data;
- if (sym == ADDOP)
- {
- getsym();
- term();
- if (leftdata & lastexp.data & RELBIT)
- showrelbad(); /* rel + rel no good */
- else
- lastexp.data |= leftdata;
- lastexp.offset += leftoffset;
- }
- else if (sym == SUBOP)
- {
- getsym();
- term();
- /* check not abs - rel or rel - rel with mismatch */
- if (lastexp.data & RELBIT &&
- (!(leftdata & RELBIT) ||
- (leftdata | lastexp.data) & IMPBIT ||
- (leftdata ^ lastexp.data) & (RELBIT | SEGM)))
- showrelbad();
- else
- lastexp.data = ((leftdata | lastexp.data) & ~(RELBIT | SEGM))
- | ((leftdata ^ lastexp.data) & (RELBIT | SEGM));
- lastexp.offset = leftoffset - lastexp.offset;
- }
- else if (sym == OROP)
- {
- getsym();
- term();
- lastexp.data |= leftdata;
- chkabs(); /* both must be absolute */
- lastexp.offset |= leftoffset;
- }
- else
- return;
- }
-}
-
-/* term() parses term = factor {op factor}, where op is *, /, &, <<, or >>. */
-
-PRIVATE void term()
-{
- offset_t leftoffset;
-
- factor();
- while (TRUE)
- {
- leftoffset = lastexp.offset;
- if (sym == STAR)
- {
- /* context-sensitive, STAR means multiplication here */
- factor2();
- lastexp.offset *= leftoffset;
- }
- else if (sym == SLASH)
- {
- /* context-sensitive, SLASH means division here */
- factor2();
- lastexp.offset = leftoffset / lastexp.offset;
- }
- else if (sym == ANDOP)
- {
- factor2();
- lastexp.offset &= leftoffset;
- }
- else if (sym == SLOP)
- {
- factor2();
- lastexp.offset = leftoffset << lastexp.offset;
- }
- else if (sym == SROP)
- {
- factor2();
- lastexp.offset = leftoffset >> lastexp.offset;
- }
- else
- return;
- }
-}
-
-/* get symbol and 2nd or later factor, check both abs */
-
-PRIVATE void factor2()
-{
- unsigned char leftdata;
-
- leftdata = lastexp.data;
- getsym();
- factor();
- lastexp.data |= leftdata;
- chkabs();
-}
-
-/*
- factor() parses factor = number | identifier | * | (expression) | ! factor,
- ! is complementation. Returns value in lastexp.offset, possible flags
- IMPBIT, FORBIT, RELBIT and UNDBIT in lastexp.data, and segment in SEGM
- part of lastexp.data, and lastexp.sym at imported symbol if IMPBIT.
- If the factor is an identifier, LOOKUP is used to get its value
- (so the ident is installed in the symbol table if necessary, with
- default flags inidata). If the identifier is not a label,
- (could be imported, or later in the program), its FORBIT is set.
- The expression FORBIT, IMPBIT, RELBIT, UNDBIT and SEGM are then
- taken from the identifier.
-*/
-
-PUBLIC void factor()
-{
- switch (sym)
- {
- case SLASH:
- /* context-sensitive, SLASH means a hex number here */
- context_hexconst();
- case INTCONST:
- lastexp.data = 0; /* absolute & not forward or undefined */
- lastexp.offset = number;
- getsym();
- return;
- case IDENT:
- {
- register struct sym_s *symptr;
-
- symptr = gsymptr;
- if (symptr->type & (MNREGBIT | MACBIT))
- experror(symptr->type & MACBIT ? MACUID :
- symptr->data & REGBIT ? REGUID : MNUID);
- else
- {
- if (!(symptr->type & (LABIT | VARBIT)))
- {
- symptr->data |= FORBIT;
- lastexp.sym = symptr;
- }
- if (pass == 0)
- {
- lastexp.data = symptr->data &
- (FORBIT | RELBIT | UNDBIT | SEGM);
- /* possible flags for pass 1 */
- lastexp.offset = symptr->value_reg_or_op.value;
- }
- else
- {
- if ((lastexp.data = symptr->data) & IMPBIT)
- lastexp.offset = 0; /* value != 0 for commons */
- /* OK even if UNDBIT */
- else
- {
- lastexp.offset = symptr->value_reg_or_op.value;
- if (lastexp.data & UNDBIT)
- experror(UNBLAB);
- }
- }
- }
- getsym();
- return;
- }
- case LBRACKET:
- if (!asld_compatible)
- break; /* error, LPAREN is the grouping symbol */
- getsym();
- expres();
- if (sym != RBRACKET)
- error(RBEXP);
- else
- getsym();
- return;
- case LPAREN:
- if (asld_compatible)
- break; /* error, LBRACKET is the grouping symbol */
- getsym();
- expres();
- if (sym != RPAREN)
- error(RPEXP);
- else
- getsym();
- return;
- case NOTOP:
- getsym();
- factor();
- chkabs();
- lastexp.offset = ~lastexp.offset;
- return;
- case STAR:
- /* context-sensitive, STAR means location counter here */
- lastexp.offset = lc;
- if ((lastexp.data = lcdata) & UNDBIT && pass != 0)
- experror(UNBLAB);
- getsym();
- return;
- }
- experror(FACEXP);
-}
-
-/*
- string compare for IFC/ELSEIFC
- expects (<string1>,<string2>)
- returns logical value in lastexp
-*/
-
-PUBLIC void scompare()
-{
- /* prepare flags for OK, lastexp.offset for error */
- lastexp.data = lastexp.offset = 0;
- if (sym != LPAREN)
- experror(LPEXP);
- else
- {
- register char *string1;
- register char *string2;
-
- for (string2 = string1 = lineptr; *string2 != ')'; ++string2)
- if (*string2 == 0 || *string2 == ')')
- {
- symname = string2;
- experror(COMEXP);
- return;
- }
- while (*string1++ == *string2++)
- ;
- if (string2[-1] == ')')
- {
- if (string1[-1] == ',')
- lastexp.offset = TRUE; /* else leave FALSE */
- }
- else /* FALSE, keep reading to verify syntax */
- for (; *string2 != ')'; ++string2)
- if (*string2 == 0 || *string2 == ',')
- {
- symname = string2;
- experror(RPEXP);
- }
- }
-}
diff --git a/bin86-0.3/as/file.h b/bin86-0.3/as/file.h
deleted file mode 100644
index 180b19b..0000000
--- a/bin86-0.3/as/file.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * bin86/as/file.h
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-/* file.h - global variables involving files for assembler */
-
-EXTERN fd_t binfil; /* binary output file (0 = memory) */
-EXTERN char *filnamptr; /* file name pointer */
-EXTERN fd_t infil0; /* initial input file */
-EXTERN fd_t infil; /* current input file (stacked, 0 = memory) */
-EXTERN unsigned char infiln; /* innum when file was opened */
-EXTERN unsigned char innum; /* counter for calls to opem */
-EXTERN fd_t lstfil; /* list output file (0 = standard) */
-EXTERN fd_t objfil; /* object output file */
-EXTERN fd_t symfil; /* symbol table output file */
-EXTERN char *truefilename; /* in case actual source name is a tmpname */
diff --git a/bin86-0.3/as/flag.h b/bin86-0.3/as/flag.h
deleted file mode 100644
index 21859cf..0000000
--- a/bin86-0.3/as/flag.h
+++ /dev/null
@@ -1,11 +0,0 @@
-/*
- * bin86/as/flag.h
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-/* flag.h - global structured-flag variables for assembler */
-
-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 */
diff --git a/bin86-0.3/as/genbin.c b/bin86-0.3/as/genbin.c
deleted file mode 100644
index c215249..0000000
--- a/bin86-0.3/as/genbin.c
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * bin86/as/genbin.c
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-/* genbin.c - binary code generation routines for assembler */
-
-#include "const.h"
-#include "type.h"
-#include "address.h"
-#include "file.h"
-#include "globvar.h"
-
-PRIVATE char *asmbeg; /* beginning of assembler code */
- /* for overwrite check */
- /* bss-init to zero = NULL and not changed */
-PRIVATE offset_t binfbuf; /* binary code buffer for file (counter) */
-PRIVATE offset_t binmax; /* maximum value of binmbuf for pass 1 */
-PRIVATE offset_t binmin; /* minimum value of binmbuf for pass 1 */
-
-FORWARD void putbinoffset P((offset_t offset, count_t size));
-
-/* write header to binary file */
-
-PUBLIC void binheader()
-{
- if ((innum = binfil) != 0x0)
- {
- writec(0x0); /* binary header byte */
-#ifdef LONG_BINHEADER
- writeoff(binmax - binmin); /* program length */
- writeoff(binfbuf = binmin); /* program start */
-#else
- writew((unsigned) (binmax - binmin)); /* program length */
- writew((unsigned) (binfbuf = binmin)); /* program start */
-#endif
- }
-}
-
-/* write trailer to binary file */
-
-PUBLIC void bintrailer()
-{
- if ((innum = binfil) != 0x0)
- {
- writec(0xFF); /* binary trailer byte */
- writew(0x0); /* further trailer bytes */
-#ifdef LONG_BINHEADER
- writeoff(pedata & UNDBIT ? binmin : progent); /* entry point */
-#else
- writew(pedata & UNDBIT ? (unsigned) binmin : (unsigned) progent);
-#endif
- }
-}
-
-/* generate binary code for current line */
-
-PUBLIC void genbin()
-{
- struct address_s *adrptr;
- char *bufptr;
- unsigned char remaining;
-
- if (binaryg && mcount != 0x0)
- {
- if (popflags)
- {
- if (fcflag)
- {
- bufptr = databuf.fcbuf;
- remaining = mcount;
- do
- putbin(*bufptr++);
- while (--remaining != 0x0);
- }
- if (fdflag)
- {
- adrptr = databuf.fdbuf;
- remaining = mcount;
- do
- {
- putbinoffset(adrptr->offset, 0x2);
- ++adrptr;
- }
- while ((remaining -= 0x2) != 0x0);
- }
-#if SIZEOF_OFFSET_T > 0x2
- if (fqflag)
- {
- adrptr = databuf.fqbuf;
- remaining = mcount;
- do
- {
- putbinoffset(adrptr->offset, 0x4);
- ++adrptr;
- }
- while ((remaining -= 0x4) != 0x0);
- }
-#endif
- }
- else
- {
- remaining = mcount - 0x1; /* count opcode immediately */
-#ifdef I80386
- if (aprefix != 0x0)
- {
- putbin(aprefix);
- --remaining;
- }
- if (oprefix != 0x0)
- {
- putbin(oprefix);
- --remaining;
- }
- if (sprefix != 0x0)
- {
- putbin(sprefix);
- --remaining;
- }
-#endif
- if (page != 0x0)
- {
- putbin(page);
- --remaining;
- }
- putbin(opcode);
- if (remaining != 0x0)
- {
- if (postb != 0x0)
- {
- putbin(postb);
- --remaining;
- }
-#ifdef I80386
- if (sib != NO_SIB)
- {
- putbin(sib);
- --remaining;
- }
-#endif
- if (remaining != 0x0)
- putbinoffset(lastexp.offset, remaining);
- }
-#ifdef I80386
- if (immcount != 0x0)
- putbinoffset(immadr.offset, immcount);
-#endif
- }
- /* else no code for this instruction, or already generated */
- }
-}
-
-/* initialise private variables */
-
-PUBLIC void initbin()
-{
- binmin = -1; /* greater than anything */
-}
-
-/* write char to binary file or directly to memory */
-
-PUBLIC void putbin(c)
-opcode_pt c;
-{
- if (binfil != 0x0)
- {
- if (!binaryc) /* pass 1, just record limits */
- {
- if (binmbuf < binmin)
- binmin = binmbuf;
- if (++binmbuf > binmax)
- binmax = binmbuf;
- }
- else
- {
- if (binfbuf > binmbuf)
- error(BWRAP); /* file buffer ahead of memory buffer */
- else
- {
- innum = binfil;
- while (binfbuf < binmbuf)
- {
- writec(0x0);/* pad with nulls if file buffer behind */
- ++binfbuf;
- }
- writec(c);
- binmbuf = ++binfbuf;
- }
- }
- }
- else if (binaryc && !(lcdata & UNDBIT))
- /* memory output, and enabled */
- {
- register char *bufptr;
-
- if ((bufptr = (char *) binmbuf) >= asmbeg && bufptr < heapptr)
- error(OWRITE);
- else
- *bufptr = c;
- ++binmbuf;
- }
-}
-
-/* write sized offset to binary file or directly to memory */
-
-PRIVATE void putbinoffset(offset, size)
-offset_t offset;
-count_t size;
-{
- char buf[sizeof offset];
-
-#if SIZEOF_OFFSET_T > 0x2
- u4cn(buf, offset, size);
-#else
- u2cn(buf, offset, size);
-#endif
- putbin(buf[0]);
- if (size > 0x1)
- putbin(buf[1]);
- if (size > 0x2)
- {
- putbin(buf[2]);
- putbin(buf[3]);
- }
-}
diff --git a/bin86-0.3/as/genlist.c b/bin86-0.3/as/genlist.c
deleted file mode 100644
index 6286d4b..0000000
--- a/bin86-0.3/as/genlist.c
+++ /dev/null
@@ -1,454 +0,0 @@
-/*
- * bin86/as/genlist.c
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-/* genlist.c - generate listing and error reports for assembler */
-
-#include "const.h"
-#include "type.h"
-#include "address.h"
-#include "flag.h"
-#include "file.h"
-#include "globvar.h"
-#include "macro.h"
-#include "scan.h"
-#include "source.h"
-
-#define CODE_LIST_LENGTH (sizeof (struct code_listing_s) - 1)
- /* length of formatted code listing */
-#define MAXERR 6 /* maximum errors listed per line */
-
-struct error_s /* to record error info */
-{
- unsigned char errnum;
- unsigned char position;
-};
-
-/* code listing format */
-
-struct code_listing_s
-{
- union linum_macro_u
- {
- char linum[LINUM_LEN];
- struct
- {
- char pad[1];
- char mark[1];
- char level[1];
- }
- macro;
- }
- linum_or_macro;
- char padlinum[1];
- char lc[4];
- char padlc[1];
-#ifdef I80386
- char lprefix[2];
- char aprefix[2];
- char oprefix[2];
- char sprefix[2];
-#endif
- char page[2];
- char opcode[2];
- char postb[2];
-#ifdef I80386
- char sib[2];
-#endif
- char padopcode[1];
-#if SIZEOF_OFFSET_T > 2
- char displ4[2];
- char displ3[2];
-#endif
- char displ2[2];
- char displ1[2];
- char reldispl[1];
- char paddispl[1];
-#ifdef I80386
- char imm4[2];
- char imm3[2];
- char imm2[2];
- char imm1[2];
- char relimm[1];
- char padimm[1];
-#endif
- char nullterm;
-};
-
-PRIVATE struct error_s errbuf[MAXERR]; /* error buffer */
-PRIVATE unsigned char errcount; /* # errors in line */
-PRIVATE bool_t erroverflow; /* set if too many errors on line */
-
-FORWARD char *build_1hex_number P((unsigned num, char *where));
-FORWARD void list1 P((fd_t fd));
-FORWARD void listcode P((void));
-FORWARD void listerrors P((void));
-FORWARD void paderrorline P((unsigned nspaces));
-
-/* format 1 byte number as 2 hex digits, return ptr to end */
-
-PRIVATE char *build_1hex_number(num, where)
-unsigned num;
-register char *where;
-{
- static char hexdigits[] = "0123456789ABCDEF";
-
- where[0] = hexdigits[(num % 256) / 16];
- where[1] = hexdigits[num % 16];
- return where + 2;
-}
-
-/* format 2 byte number as 4 hex digits, return ptr to end */
-
-PUBLIC char *build_2hex_number(num, where)
-unsigned num;
-char *where;
-{
- return build_1hex_number(num, build_1hex_number(num / 256, where));
-}
-
-/* format 2 byte number as decimal with given width (pad with leading '0's) */
-/* return ptr to end */
-
-PUBLIC char *build_number(num, width, where)
-unsigned num;
-unsigned width;
-register char *where;
-{
- static unsigned powers_of_10[] = {1, 10, 100, 1000, 10000,};
- unsigned char digit;
- unsigned char power;
- register unsigned power_of_10;
-
- power = 5; /* actually 1 more than power */
- do
- {
- for (digit = '0', power_of_10 = (powers_of_10 - 1)[power];
- num >= power_of_10; num -= power_of_10)
- ++digit;
- if (power <= width)
- *where++ = digit;
- }
- while (--power != 0);
- return where;
-}
-
-/* record number and position of error (or error buffer overflow) */
-
-PUBLIC void error(errnum)
-error_pt errnum;
-{
- register struct error_s *errptr;
- register struct error_s *errptrlow;
- unsigned char position;
-
- if (errnum < MINWARN || warn.current)
- {
- if (errcount >= MAXERR)
- erroverflow = TRUE;
- else
- {
- position = symname - linebuf;
- for (errptr = errbuf + errcount;
- errptr > errbuf && errptr->position > position;
- errptr = errptrlow)
- {
- errptrlow = errptr - 1;
- errptr->errnum = errptrlow->errnum;
- errptr->position = errptrlow->position;
- }
- errptr->errnum = errnum;
- errptr->position = position;
- ++errcount;
- if (errnum >= MINWARN)
- ++totwarn;
- else
- ++toterr;
- }
- }
-}
-
-/* list 1 line to list file if any errors or flags permit */
-/* list line to console as well if any errors and list file is not console */
-
-PUBLIC void listline()
-{
- if (!listpre)
- {
- if (errcount || list.current && (!macflag || mcount != 0) ||
- macflag && maclist.current)
- list1(lstfil);
- if (errcount)
- {
- if (lstfil != STDOUT)
- list1(STDOUT);
- errcount = 0;
- erroverflow = FALSE;
- }
- }
-}
-
-/* list 1 line unconditionally */
-
-PRIVATE void list1(fd)
-fd_t fd;
-{
- innum = fd;
- listcode();
- write(innum, linebuf, lineptr - linebuf);
- writenl();
- if (errcount != 0)
- listerrors();
- listpre = TRUE;
-}
-
-/* list object code for 1 line */
-
-PRIVATE void listcode()
-{
- unsigned char count;
- struct code_listing_s *listptr;
- int numlength;
- char *numptr;
-
- listptr = (struct code_listing_s *) heapptr;
- memset((char *) listptr, ' ', sizeof *listptr);
- listptr->nullterm = 0;
- if (macflag)
- {
- listptr->linum_or_macro.macro.mark[0] = '+';
- listptr->linum_or_macro.macro.level[0] = maclevel + ('a' - 1);
- }
- else
- {
- numlength = LINUM_LEN;
- numptr = listptr->linum_or_macro.linum;
- if (infiln != infil0)
- {
- *numptr++ = infiln - infil0 + ('a' - 1);
- numlength = LINUM_LEN - 1;
- }
- build_number(linum, numlength, numptr);
- }
- if ((count = mcount) != 0 || popflags & POPLC)
- build_2hex_number((u16_t) lc, listptr->lc);
- if (popflags & POPLO)
- {
-#if SIZEOF_OFFSET_T > 2
- if (popflags & POPLONG)
- build_2hex_number((u16_t) (lastexp.offset / (offset_t) 0x10000L),
- listptr->displ4);
-#endif
- if (popflags & POPHI)
- build_2hex_number((u16_t) lastexp.offset, listptr->displ2);
- else
- build_1hex_number((u16_t) lastexp.offset, listptr->displ1);
- if (lastexp.data & RELBIT)
- listptr->reldispl[0] = '>';
- }
- else if (count != 0)
- {
-#ifdef I80386
- if (aprefix != 0)
- {
- --count;
- build_1hex_number(aprefix, listptr->aprefix);
- }
- if (oprefix != 0)
- {
- --count;
- build_1hex_number(oprefix, listptr->oprefix);
- }
- if (sprefix != 0)
- {
- --count;
- build_1hex_number(sprefix, listptr->sprefix);
- }
-#endif
- if (page != 0)
- {
- build_1hex_number(page, listptr->page);
- --count;
- }
- build_1hex_number(opcode, listptr->opcode);
- --count;
- if (postb != 0)
- {
- --count;
- build_1hex_number(postb,
-#ifdef MC6809
- count == 0 ? listptr->displ1 :
-#endif
- listptr->postb);
- }
-#ifdef I80386
- if (sib != NO_SIB)
- {
- --count;
- build_1hex_number(sib, listptr->sib);
- }
-#endif
- if (count > 0)
- {
- build_1hex_number((opcode_pt) lastexp.offset, listptr->displ1);
- if (lastexp.data & RELBIT)
- listptr->reldispl[0] = '>';
- }
- if (count > 1)
- build_1hex_number((opcode_pt) lastexp.offset >> 0x8,
- listptr->displ2);
-#if SIZEOF_OFFSET_T > 2
- if (count > 2)
- {
- build_1hex_number((opcode_pt) (lastexp.offset >> 0x10),
- listptr->displ3);
- build_1hex_number((opcode_pt) (lastexp.offset >> 0x18),
- listptr->displ4);
- }
-#endif
-#ifdef I80386
- if (immcount > 0)
- {
- build_1hex_number((opcode_pt) immadr.offset, listptr->imm1);
- if (immadr.data & RELBIT)
- listptr->relimm[0] = '>';
- }
- if (immcount > 1)
- build_1hex_number((opcode_pt) immadr.offset >> 0x8,
- listptr->imm2);
- if (immcount > 2)
- {
- build_1hex_number((opcode_pt) (immadr.offset >> 0x10),
- listptr->imm3);
- build_1hex_number((opcode_pt) (immadr.offset >> 0x18),
- listptr->imm4);
- }
-#endif
- }
- writes((char *) listptr);
-}
-
-/* list errors, assuming some */
-
-PRIVATE void listerrors()
-{
- unsigned char column;
- unsigned char errcol; /* column # in error line */
- unsigned char errcolw; /* working column in error line */
- char *errmsg;
- struct error_s *errptr;
- char *linep;
- unsigned char remaining;
-
- paderrorline(CODE_LIST_LENGTH - LINUM_LEN);
- remaining = errcount;
- column = 0; /* column to match with error column */
- errcolw = errcol = CODE_LIST_LENGTH; /* working & col number on err line */
- errptr = errbuf;
- linep = linebuf;
- do
- {
- while (column < errptr->position)
- {
- ++column;
- if (*linep++ == '\t') /* next tab (standard tabs only) */
- errcolw = (errcolw + 8) & 0xf8;
- else
- ++errcolw;
- while (errcolw > errcol)
- {
- writec(' ');
- ++errcol;
- }
- }
- if (errcolw < errcol) /* position under error on new line */
- {
- writenl();
- paderrorline(errcolw - LINUM_LEN);
- }
- writec('^');
- writes(errmsg = build_error_message(errptr->errnum, heapptr));
- errcol += strlen(errmsg);
- ++errptr;
- }
- while (--remaining != 0);
- writenl();
- if (erroverflow)
- {
- paderrorline(CODE_LIST_LENGTH - LINUM_LEN);
- writesn(build_error_message(FURTHER, heapptr));
- }
-}
-
-/* pad out error line to begin under 1st char of source listing */
-
-PRIVATE void paderrorline(nspaces)
-unsigned nspaces;
-{
- int nstars = LINUM_LEN;
-
- while (nstars-- != 0)
- writec('*'); /* stars under line number */
- while (nspaces-- != 0)
- writec(' '); /* spaces out to error position */
-}
-
-/* write 1 character */
-
-PUBLIC void writec(c)
-char c;
-{
- write(innum, &c, 1);
-}
-
-/* write newline */
-
-PUBLIC void writenl()
-{
- writes(SOS_EOLSTR);
-}
-
-/* write 1 offset_t, order to suit target */
-
-PUBLIC void writeoff(offset)
-offset_t offset;
-{
- char buf[sizeof offset];
-
-#if SIZEOF_OFFSET_T > 2
- u4c4(buf, offset);
-#else
- u2c2(buf, offset);
-#endif
- write(innum, buf, sizeof buf);
-}
-
-/* write string */
-
-PUBLIC void writes(s)
-char *s;
-{
- write(innum, s, strlen(s));
-}
-
-/* write string followed by newline */
-
-PUBLIC void writesn(s)
-char *s;
-{
- writes(s);
- writenl();
-}
-
-/* write 1 word, order to suit target */
-
-PUBLIC void writew(word)
-unsigned word;
-{
- char buf[2];
-
- u2c2(buf, (u16_t) word);
- write(innum, buf, sizeof buf);
-}
diff --git a/bin86-0.3/as/genobj.c b/bin86-0.3/as/genobj.c
deleted file mode 100644
index fc42394..0000000
--- a/bin86-0.3/as/genobj.c
+++ /dev/null
@@ -1,669 +0,0 @@
-/*
- * bin86/as/genobj.c
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-/* genobj.c - object code generation routines for assembler */
-
-#include "const.h"
-#include "type.h"
-#include "address.h"
-#include "file.h"
-#include "globvar.h"
-
-#define OBJBUFSIZE 512 /* size of object code output buffer */
-#define isge2byteoffset(offset) ((offset) >= 0x100)
-#define isge4byteoffset(offset) ((offset) >= 0x10000L)
-
-PRIVATE char hid_absbuf[OBJ_MAX_ABS_LEN]; /* absolute object code buf */
-PRIVATE char *absbuf; /* start */
-PRIVATE char *absbufend; /* last location + 1 */
-PRIVATE char *absbufptr; /* current location */
-PRIVATE struct sym_s **arrext; /* array of external symbol ptrs */
-PRIVATE char hid_objbuf[OBJBUFSIZE]; /* object code buffer */
-PRIVATE unsigned numext; /* number of external symbols */
-PRIVATE char *objbuf; /* start */
-PRIVATE char *objbufend; /* last location + 1 */
-PRIVATE char *objbufptr; /* current location */
-PRIVATE unsigned char relsize; /* current relocation size, 0 init */
- /* local to genobjadr, but here */
- /* because of static re-init bug */
-PRIVATE offset_t rmbcount; /* accumulator for repeated RMB's */
-
-FORWARD void flushabs P((void));
-FORWARD void flushrmb P((void));
-FORWARD void genobjadr P((struct address_s *adrptr, int size));
-FORWARD void putobj1 P((opcode_pt c));
-FORWARD void putobj4 P((u32_t offset));
-FORWARD void putobjoffset P((offset_t offset, count_t size));
-FORWARD void putobjword P((unsigned word));
-FORWARD void writeobj P((char *buf, unsigned count));
-
-/* accumulate RMB requests into 1 (so + and - requests cancel) */
-
-PUBLIC void accumulate_rmb(offset)
-offset_t offset;
-{
- if (objectc)
- {
- flushabs();
- rmbcount += offset;
- }
-}
-
-/* flush absolute object code buffer to object code buffer if necessary */
-
-PRIVATE void flushabs()
-{
- if (absbufptr > absbuf)
- {
- putobj1((absbufptr - absbuf) | OBJ_ABS);
- {
- register char *bufptr;
-
- bufptr = absbuf;
- do
- putobj1(*bufptr);
- while (++bufptr < absbufptr);
- absbufptr = absbuf;
- }
- }
-}
-
-/* flush object code buffer if necessary */
-
-PUBLIC void flushobj()
-{
- int ntowrite;
-
- if ((ntowrite = objbufptr - objbuf) > 0)
- {
- if (write(objfil, objbuf, ntowrite) != ntowrite)
- {
- error(OBJOUT);
- listline();
- finishup();
- }
- objbufptr = objbuf;
- }
-}
-
-/* flush RMB count if necessary */
-
-PRIVATE void flushrmb()
-{
- count_t size;
-
- if (rmbcount != 0)
- {
-#if SIZEOF_OFFSET_T > 2
- if (isge4byteoffset(rmbcount))
- {
- putobj1(OBJ_SKIP_4);
- size = 4;
- }
- else
-#endif
- if (isge2byteoffset(rmbcount))
- {
- putobj1(OBJ_SKIP_2);
- size = 2;
- }
- else
- {
- putobj1(OBJ_SKIP_1);
- size = 1;
- }
- putobjoffset(rmbcount, size);
- rmbcount = 0;
- }
-}
-
-/* generate object code for current line */
-
-/*
- any address parameter is (regrettably) in lastexp
- any immediate parameter is (corectly) in immadr
-*/
-
-PUBLIC void genobj()
-{
- struct address_s *adrptr;
- char *bufptr;
- unsigned char remaining;
-
- if (objectc && mcount != 0)
- {
- if (popflags)
- {
- if (fcflag)
- {
- bufptr = databuf.fcbuf;
- remaining = mcount;
- do
- putabs(*bufptr++);
- while (--remaining != 0);
- }
- if (fdflag)
- {
- adrptr = databuf.fdbuf;
- remaining = mcount;
- do
- genobjadr(adrptr++, 2);
- while ((remaining -= 2) != 0);
- }
-#if SIZEOF_OFFSET_T > 2
- if (fqflag)
- {
- adrptr = databuf.fqbuf;
- remaining = mcount;
- do
- genobjadr(adrptr++, 4);
- while ((remaining -= 4) != 0);
- }
-#endif
- }
- else
- {
- remaining = mcount - 1; /* count opcode immediately */
-#ifdef I80386
- if (aprefix != 0)
- {
- putabs(aprefix);
- --remaining;
- }
- if (oprefix != 0)
- {
- putabs(oprefix);
- --remaining;
- }
- if (sprefix != 0)
- {
- putabs(sprefix);
- --remaining;
- }
-#endif
- if (page != 0)
- {
- putabs(page);
- --remaining;
- }
- putabs(opcode);
- if (remaining != 0)
- {
- if (postb != 0)
- {
- putabs(postb);
- --remaining;
- }
-#ifdef I80386
- if (sib != NO_SIB)
- {
- putabs(sib);
- --remaining;
- }
-#endif
- if (remaining != 0)
- genobjadr(&lastexp, remaining);
- }
- }
-#ifdef I80386
- if (immcount != 0)
- genobjadr(&immadr, immcount);
-#endif
- }
-}
-
-/* generate object code for current address */
-
-PRIVATE void genobjadr(adrptr, size)
-struct address_s *adrptr;
-smallcount_t size;
-{
- unsigned char byte;
- unsigned symnum;
-
- if (!(adrptr->data & RELBIT))
- {
- /* absolute address */
-
- char buf[sizeof(offset_t)];
-
-#if SIZEOF_OFFSET_T > 2
- u4cn(buf, adrptr->offset, size);
-#else
- u2cn(buf, adrptr->offset, size);
-#endif
- putabs(buf[0]);
- if (size > 1)
- putabs(buf[1]);
- if (size > 2)
- {
- putabs(buf[2]);
- putabs(buf[3]);
- }
- }
- else
- {
- /* relocatable address */
- if (size != relsize)
- /* set reloc size index |00|0000xx| */
- putobj((relsize = size) == 4 ? 0x03 : relsize);
- if (!(adrptr->data & IMPBIT))
- {
- /* offset relocation (known offset) */
- putobj((adrptr->data & SEGM) | OBJ_OFFSET_REL | pcrflag);
- putobjoffset(adrptr->offset, size);
- }
- else
- {
- /* symbol relocation (imported symbol + offset) */
- {
- register struct sym_s **copyptr;
-
- for (copyptr = arrext, symnum = 0;
- symnum < numext && *copyptr++ != adrptr->sym; ++symnum)
- ;
- }
- byte = OBJ_SYMBOL_REL;
- if (isge2byteoffset(symnum))
- byte = OBJ_SYMBOL_REL | OBJ_S_MASK;
-#if SIZEOF_OFFSET_T > 2
- if (isge4byteoffset(adrptr->offset))
- {
- byte |= 0x03; /* 4 byte offset */
- size = 4;
- }
- else
-#endif
- if (isge2byteoffset(adrptr->offset))
- {
- byte |= 0x02; /* 2 byte offset */
- size = 2;
- }
- else if (adrptr->offset != 0)
- {
- byte |= 0x01; /* 1 byte offset */
- size = 1;
- }
- else
- size = 0;
- putobj(byte | pcrflag);
- if (isge2byteoffset(symnum))
- putobjword(symnum);
- else
- putobj1(symnum);
- if (adrptr->offset != 0)
- putobjoffset(adrptr->offset, size);
- }
- }
-}
-
-/* initialise private variables */
-
-PUBLIC void initobj()
-{
- absbufend = (absbufptr = absbuf = hid_absbuf) + sizeof hid_absbuf;
- objbufend = (objbufptr = objbuf = hid_objbuf) + sizeof hid_objbuf;
-}
-
-/*
- write header to object file
- also build array of imported/exported symbols
-*/
-
-PUBLIC void objheader()
-{
- static char module_header[] =
- {
-#ifdef I80386
- 0xA3, 0x86,
- 1, 0,
- (char) (0xA3 + 0x86 + 1 + 0),
-#endif
-#ifdef MC6809
- 'S', '1', /* 2 byte magic number */
- 0, 1, /* 2 byte number of modules in file */
- 'S' + '1' + 0 + 1, /* 1 byte checksum */
-#endif
- };
- static char seg_max_sizes[] =
- {
- 0x55, /* all segments have maximum size 2^16 */
- 0x55, /* this is encoded by 0b01 4 times per byte */
- 0x55, /* other codes are 0b00 = max size 2^8 */
- 0x55, /* 0b10 = max size 2^24, 0b11 = max 2^32 */
- };
- unsigned char byte;
- register struct sym_s **copyptr;
- struct sym_s **copytop;
- struct sym_s **hashptr;
- struct lc_s *lcp;
- char module_name[FILNAMLEN + 1];
- char *nameptr;
- unsigned offset;
- unsigned segsizebytes;
- unsigned size;
- unsigned char sizebits;
- unsigned strsiz; /* size of object string table */
- unsigned symosiz; /* size of object symbol table */
- register struct sym_s *symptr;
- u32_t textlength;
-
- if ((objectc = objectg) == 0)
- return;
- writeobj(module_header, sizeof module_header);
-
- /* calculate number of imported/exported symbols */
- /* and lengths of symbol and string tables */
- /* build array of imported/exported symbols */
-
- symosiz = 0;
- if (truefilename == NULL)
- truefilename = filnamptr;
- nameptr = strrchr(truefilename, DIRCHAR);
- strcpy(module_name, nameptr != NULL ? nameptr + 1 : truefilename);
- if ((nameptr = strrchr(module_name, '.')) != NULL)
- *nameptr = 0;
- strsiz = strlen(module_name) + 1;
- align(heapptr);
- for (hashptr = spt, arrext = copyptr = (struct sym_s **) heapptr;
- hashptr < spt_top;)
- if ((symptr = *hashptr++) != NULL)
- do
- {
- if ((symptr->type & EXPBIT || symptr->data & IMPBIT) ||
- !globals_only_in_obj && symptr->name[0] != '.' &&
- !(symptr->type & (MNREGBIT | MACBIT | VARBIT)))
- {
- if (copyptr >= (struct sym_s **) heapend)
- {
- heapptr = (char *) copyptr;
- fatalerror(OBJSYMOV);
- }
- *copyptr++ = symptr;
- strsiz += symptr->length + 1;
-#if SIZEOF_OFFSET_T > 2
- if (isge4byteoffset(symptr->value_reg_or_op.value))
- size = 4 + 4;
- /* 4 is size of offset into string table and flags */
- /* 2nd 4 is for 4 byte offset */
- else
-#endif
- if (isge2byteoffset(symptr->value_reg_or_op.value))
- size = 4 + 2;
- else if (symptr->value_reg_or_op.value != 0)
- size = 4 + 1;
- else
- size = 4;
- symosiz += size;
- ++numext;
- }
- }
- while ((symptr = symptr->next) != NULL);
- heapptr = (char *) (copytop = copyptr);
-
- /* calculate length of text, and number of seg size bytes in header */
-
- textlength = segsizebytes = 0;
- lcp = lctab;
- do
- if (lcp->lc != 0)
- {
- textlength += lcp->lc; /* assuming text starts at 0 */
-#if SIZEOF_OFFSET_T > 2
- if (isge4byteoffset(lcp->lc))
- segsizebytes += 4;
- else
-#endif
- segsizebytes += 2; /* use 2 byte size if possible */
- }
- while (++lcp < lctabtop);
-
-/*
- offset to text = length of header since only 1 module
- header consists of:
- module header sizeof module_header
- offset to start of text 4
- length of text 4
- length of string area 2
- class 1
- revision 1
- seg max sizes sizeof seg_max_sizes
- seg size descriptors 4
- seg sizes segsizebytes
- symbol count 2
- symbol offsets and types symosiz
- strings strsiz
-*/
-
- /* offset to start of text */
-
- putobj4((u32_t) (sizeof module_header + 4 + 4 + 2 + 1 + 1 +
- sizeof seg_max_sizes + 4 + segsizebytes + 2 +
- symosiz) + strsiz);
-
- /* length of text */
-
- putobj4((u32_t) textlength);
-
- /* length of string area */
-
- putobjword(strsiz);
-
- /* class and revision */
-
- putobj1(0);
- putobj1(0);
-
- /* segment max sizes (constant) */
-
- writeobj(seg_max_sizes, sizeof seg_max_sizes);
-
- /* segment size descriptors */
- /* produce only 0 and 2 byte sizes */
-
- lcp = lctabtop;
- byte = 0;
- sizebits = OBJ_SEGSZ_TWO << 6;
- do
- {
- --lcp;
- if (lcp->lc != 0)
- {
- byte |= sizebits;
-#if SIZEOF_OFFSET_T > 2
- if (isge4byteoffset(lcp->lc))
- byte |= sizebits >> 1; /* XXX - convert size 2 to size 4 */
-#endif
- }
- if ((sizebits >>= 2) == 0)
- {
- putobj1(byte);
- sizebits = OBJ_SEGSZ_TWO << 6;
- }
- }
- while (lcp > lctab);
-
- /* segment sizes */
-
- do /* lcp starts at lctab */
- if (lcp->lc != 0)
- {
-#if SIZEOF_OFFSET_T > 2
- if (isge4byteoffset(lcp->lc))
- putobj4(lcp->lc);
- else
-#endif
- putobjword((unsigned) lcp->lc);
- }
- while (++lcp < lctabtop);
-
- /* symbol count */
-
- putobjword(numext);
-
- /* symbol offsets and types */
-
- offset = strlen(module_name) + 1; /* 1st symbol begins after name */
- for (copyptr = arrext; copyptr < copytop;)
- {
- putobjword(offset);
- symptr = *copyptr++;
- byte = symptr->type & OBJ_N_MASK;
-#if SIZEOF_OFFSET_T > 2
- if (isge4byteoffset(symptr->value_reg_or_op.value))
- {
- byte |= OBJ_SZ_FOUR;
- size = 4;
- }
- else
-#endif
- if (isge2byteoffset(symptr->value_reg_or_op.value))
- {
- byte |= OBJ_SZ_TWO;
- size = 2;
- }
- else if (symptr->value_reg_or_op.value != 0)
- {
- byte |= OBJ_SZ_ONE;
- size = 1;
- }
- else
- size = 0;
- if ((symptr->type & (COMMBIT | REDBIT)) == (COMMBIT | REDBIT))
- {
- byte |= OBJ_SA_MASK;
- symptr->data &= ~OBJ_I_MASK;
- }
- putobjword((byte << 0x8) |
- (symptr->type & OBJ_E_MASK) | /* |E|0000000| */
- ((symptr->data & (OBJ_I_MASK | OBJ_A_MASK | OBJ_SEGM_MASK)) ^
- /* |0|I|0|A|SEGM| */
- RELBIT)); /* RELBIT by negative logic */
- if ((symptr->type & (COMMBIT | REDBIT)) == (COMMBIT | REDBIT))
- symptr->data |= OBJ_I_MASK;
- if (size != 0)
- putobjoffset(symptr->value_reg_or_op.value, size);
- offset += symptr->length + 1;
- }
-
- /* strings */
-
- writeobj(module_name, strlen(module_name));
- putobj1(0);
- for (copyptr = arrext; copyptr < copytop;)
- {
- symptr = *copyptr++;
- writeobj(symptr->name, symptr->length);
- putobj1(0);
- }
- putobj1(OBJ_SET_SEG | 0); /* default segment 0, |0010|SEGM| */
-}
-
-/* write trailer to object file */
-
-PUBLIC void objtrailer()
-{
- if (objectc)
- {
- putobj(0); /* end of object file */
- flushobj();
- }
-}
-
-/* write char to absolute object code buffer, flush if necessary */
-
-PUBLIC void putabs(c)
-opcode_pt c;
-{
- if (objectc)
- {
- if (rmbcount != 0)
- flushrmb();
- if (absbufptr >= absbufend)
- flushabs();
- *absbufptr++ = c;
- }
-}
-
-/* write char to object code buffer, flush if necessary */
-
-PUBLIC void putobj(c)
-opcode_pt c;
-{
- if (objectc)
- {
- flushabs();
- flushrmb();
- putobj1(c);
- }
-}
-
-/* write char to object code buffer assuming nothing in absolute & rmb bufs */
-
-PRIVATE void putobj1(c)
-opcode_pt c;
-{
- if (objbufptr >= objbufend)
- flushobj();
- *objbufptr++ = c;
-}
-
-/* write 32 bit offset to object code buffer assuming ... */
-
-PRIVATE void putobj4(offset)
-u32_t offset;
-{
- char buf[sizeof offset];
-
- u4c4(buf, offset);
- writeobj(buf, sizeof buf);
-}
-
-/* write sized offset to object code buffer assuming ... */
-
-PRIVATE void putobjoffset(offset, size)
-offset_t offset;
-count_t size;
-{
- char buf[sizeof offset];
-
-#if SIZEOF_OFFSET_T > 2
- u4cn(buf, offset, size);
-#else
- u2cn(buf, offset, size);
-#endif
- putobj1(buf[0]);
- if (size > 1)
- putobj1(buf[1]);
- if (size > 2)
- {
- putobj1(buf[2]);
- putobj1(buf[3]);
- }
-}
-
-/* write word to object code buffer assuming ... */
-
-PRIVATE void putobjword(word)
-unsigned word;
-{
- char buf[sizeof word];
-
- u2c2(buf, word);
- putobj1(buf[0]);
- putobj1(buf[1]);
-}
-
-/* write several bytes to object code buffer assuming ... */
-
-PRIVATE void writeobj(buf, count)
-char *buf;
-unsigned count;
-{
- do
- putobj1(*buf++);
- while (--count);
-}
diff --git a/bin86-0.3/as/gensym.c b/bin86-0.3/as/gensym.c
deleted file mode 100644
index e06d3ce..0000000
--- a/bin86-0.3/as/gensym.c
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * bin86/as/gensym.c
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-/* gensym.c - generate symbol table for assembler */
-
-#include "const.h"
-#include "type.h"
-#include "flag.h"
-#include "file.h"
-#include "globvar.h"
-
-FORWARD int printsym P((register struct sym_s *symptr, unsigned column));
-FORWARD void sort P((struct sym_s **array, struct sym_s **top,
- bool_pt nameflag));
-
-/* sort labels in symbol table on name and value */
-/* if listing, write human-readable table to list file */
-/* if symbol file, write machine-readable tables to it */
-/* pointers become relative to start of file */
-
-PUBLIC void gensym()
-{
- unsigned column;
- struct sym_s **copyptr;
- struct sym_s **copytop;
- register struct sym_s **hashptr;
- unsigned label_count; /* number of labels */
- unsigned labels_length; /* length of all label strings */
- unsigned label_stringptr; /* offset of label str from start of file */
- register struct sym_s *symptr;
- struct sym_s **symlptr; /* start of symbol output list */
-
- labels_length = label_count = 0;
-
- /* make copy of all relavant symbol ptrs on heap */
- /* original ptrs can now be modified, but need to be an array for sort */
-
- align(heapptr);
- for (hashptr = spt, symlptr = copyptr = (struct sym_s **) heapptr;
- hashptr < spt_top;)
- if ((symptr = *hashptr++) != NULL)
- do
- if (!(symptr->type & (MACBIT | MNREGBIT | VARBIT)))
- {
- if (copyptr >= (struct sym_s **) heapend)
- {
- heapptr = (char *) copyptr;
- error(SYMOUTOV); /* avoid recursive fatalerror */
- listline(); /* the main job is OK if here */
- goto sort_symbols;
- }
- *copyptr++ = symptr;
- ++label_count;
- labels_length += symptr->length + 3; /* 3 for type, value */
- }
- while ((symptr = symptr->next) != NULL);
-
-sort_symbols:
- sort(symlptr, copyptr, TRUE); /* sort on name */
- heapptr = (char *) (copytop = copyptr);
- if (list.global)
- {
- innum = lstfil;
- writenl();
- writesn("Symbols:");
- for (copyptr = symlptr, column = 0; copyptr < copytop;)
- column = printsym(*copyptr++, column);
- if (column != 0)
- writenl();
- }
- if ((innum = symfil) != 0)
- {
- writew(mapnum);
- label_count *= 2; /* now length of ptr table (2 bytes per ptr) */
- label_stringptr = label_count + 6;
- /* offset to current string in symbol file */
- /* 6 is length of header */
- labels_length += label_stringptr;
- /* offset to ptr table sorted on value */
- writew(labels_length + label_count);
- /* total length of symbol file */
- writew(label_count);
- for (copyptr = symlptr; copyptr < copytop;)
- {
- symptr = *copyptr++;
- writew((unsigned)
- (symptr->next = (struct sym_s *) label_stringptr));
- /* reuse "next" to record string position */
- label_stringptr += symptr->length + 3;
- }
- for (copyptr = symlptr; copyptr < copytop;)
- {
- symptr = *copyptr++;
- writew((unsigned) symptr->value_reg_or_op.value);
- writec(symptr->type);
- write(innum, symptr->name, symptr->length - 1);
- writec(symptr->name[symptr->length - 1] | 0x80);
- }
- sort(symlptr, copyptr, FALSE);
- /* sort on value */
- for (copyptr = symlptr; copyptr < copytop;)
- {
- symptr = *copyptr++;
- writew((unsigned) symptr->next); /* now has string position */
- }
- }
-}
-
-/* print symbol nicely formatted for given column */
-
-PRIVATE int printsym(symptr, column)
-register struct sym_s *symptr;
-unsigned column;
-{
- unsigned char length;
- register struct sym_listing_s *listptr;
- char *outname;
- char *symname;
-
- listptr = (struct sym_listing_s *) heapptr;
- memset((char *) listptr, ' ', SYMLIS_LEN);
- listptr->nullterm = 0;
- if ((length = symptr->length) > SYMLIS_NAMELEN)
- {
- outname = listptr->name;
- outname[length = SYMLIS_NAMELEN] = '+';
- }
- else
- outname = (listptr->name + SYMLIS_NAMELEN) - length;
- symname = symptr->name;
- do
- *outname++ = *symname++;
- while (--length != 0);
- listptr->ar[0] = symptr->data & RELBIT ? 'R' : 'A';
- listptr->segm[0] = (symptr->data & SEGM) + '0';
- if (symptr->type & COMMBIT)
- listptr->cein[0] = 'C';
- else if (symptr->type & ENTBIT)
- listptr->cein[0] = 'N';
- else if (symptr->type & EXPBIT)
- listptr->cein[0] = 'E';
- else if (symptr->data & IMPBIT)
- listptr->cein[0] = 'I';
-#if SIZEOF_OFFSET_T > 2
- build_2hex_number((unsigned) (symptr->value_reg_or_op.value >> 16),
- listptr->value);
-#endif
- build_2hex_number((unsigned) symptr->value_reg_or_op.value,
- listptr->value);
- writes((char *) listptr);
- if ((column += SYMLIS_LEN) > (80 - SYMLIS_LEN))
- {
- writenl();
- column = 0;
- }
- return column;
-}
-
-/* shell sort symbols */
-
-PRIVATE void sort(array, top, nameflag)
-struct sym_s **array;
-struct sym_s **top;
-bool_pt nameflag;
-{
- int gap;
- int i;
- int j;
- register struct sym_s **left;
- register struct sym_s **right;
- int size;
- struct sym_s *swap;
-
- size = top - array;
- /* choose gaps according to Knuth V3 p95 */
- for (gap = 1, i = 4; (j = 3 * i + 1) < size; gap = i, i = j)
- ;
- do
- {
- for (j = gap; j < size; ++j)
- for (i = j - gap; i >= 0; i -= gap)
- {
- left = &array[i];
- right = &array[i + gap];
- if ((bool_t) nameflag)
- {
- if (strcmp((*left)->name, (*right)->name) <= 0)
- break;
- }
- else if ((unsigned) (*left)->value_reg_or_op.value <=
- (*right)->value_reg_or_op.value)
- break;
- swap = *left;
- *left = *right;
- *right = swap;
- }
- }
- while ((gap /= 3) != 0);
-}
diff --git a/bin86-0.3/as/globvar.h b/bin86-0.3/as/globvar.h
deleted file mode 100644
index e560abc..0000000
--- a/bin86-0.3/as/globvar.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * bin86/as/globvar.h
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-/* globvar.h - global variables for assembler */
-
-/* global control and bookkeeping */
-
-EXTERN bool_t binaryc; /* current binary code flag */
-EXTERN bool_t binaryg; /* global binary code flag */
-EXTERN offset_t binmbuf; /* offset in binary code buffer for memory */
-
-EXTERN unsigned char dirpag; /* direct page */
-
-EXTERN bool_t globals_only_in_obj; /* global symbols only in object file */
-
-EXTERN bool_t jumps_long; /* make all jumps long */
-
-EXTERN unsigned char mapnum; /* global map number */
-
-EXTERN bool_t objectc; /* current object code flag */
-EXTERN bool_t objectg; /* global object code flag */
-
-EXTERN bool_t pass; /* pass, FALSE means 0, TRUE means 1 */
-
-EXTERN offset_t progent; /* program entry point */
-
-EXTERN bool_t symgen; /* generate symbol table flag */
-
-EXTERN unsigned toterr; /* total errors */
-EXTERN unsigned totwarn; /* total warnings */
-
-/* bookeeping for current line */
-
-EXTERN char *linebuf; /* buffer */
-
-/* for symbol table routines */
-
-EXTERN char *heapend; /* end of free space for symbol list */
-EXTERN char *heapptr; /* next free space in symbol list */
-EXTERN unsigned char inidata; /* init sym entry data governed by "u" flag */
-EXTERN struct sym_s **spt; /* symbol pointer table */
-EXTERN struct sym_s **spt_top; /* top of symbol ptr table */
-
-/* for translator */
-
-EXTERN struct sym_s *label; /* non-null if valid label starts line */
-EXTERN unsigned char pedata; /* shows how PROGENT bound, flags like LCDATA*/
-EXTERN unsigned char popflags; /* pseudo-op flags */
-
-/* for BLOCK stack */
-
-EXTERN struct block_s *blockstak; /* stack ptr */
-EXTERN unsigned char blocklevel; /* nesting level */
-
-/* for IF stack */
-
-EXTERN struct if_s *ifstak; /* stack ptr */
-EXTERN unsigned char iflevel; /* nesting level */
-EXTERN bool_t ifflag; /* set if assembling */
-
-/* location counters for various segments */
-
-EXTERN offset_t lc; /* location counter */
-EXTERN unsigned char lcdata; /* shows how lc is bound */
- /* FORBIT is set if lc is forward referenced */
- /* RELBIT is is if lc is relocat. (not ASEG) */
-EXTERN offset_t lcjump; /* lc jump between lines */
-#define mcount (((unsigned char *) &lcjump)[LOW_BYTE])
- /* low byte of lcjump */
-EXTERN struct lc_s *lcptr; /* top of current spot in lctab */
-EXTERN struct lc_s *lctab; /* start of lctab */
-EXTERN struct lc_s *lctabtop; /* top of lctab */
-
-/* for code generator */
-
-EXTERN opsize_t mnsize; /* 1 if forced byte operand size, else 0 */
-EXTERN opcode_t page;
-EXTERN opcode_t opcode;
-EXTERN opcode_t postb; /* postbyte, 0 if none */
-EXTERN unsigned char pcrflag; /* OBJ_RMASK set if addressing is PC-relative */
-
-#ifdef I80386
-
-EXTERN opcode_t aprefix; /* address size prefix or 0 */
-EXTERN bool_t asld_compatible; /* asld compatibility flag */
-EXTERN opsize_t defsize; /* current default size */
-EXTERN opsize_t idefsize; /* initial default size */
-EXTERN opcode_t oprefix; /* operand size prefix or 0 */
-EXTERN opcode_t sprefix; /* segment prefix or 0 */
-EXTERN opcode_t sib; /* scale-index-base byte */
-
-#endif
diff --git a/bin86-0.3/as/keywords.c b/bin86-0.3/as/keywords.c
deleted file mode 100644
index 5d0bf84..0000000
--- a/bin86-0.3/as/keywords.c
+++ /dev/null
@@ -1,733 +0,0 @@
-/*
- * bin86/as/keywords.c
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-/* keywords.c - keywords for assembler */
-
-#include "const.h"
-#include "type.h"
-#include "opcode.h"
-
-/* registers */
-/* the register code (internal to assembler) is given in 1 byte */
-/* the "opcode" field is not used */
-
-PUBLIC char regs[] =
-{
-#ifdef I80386
- 2, 'B', 'P', BPREG, 0,
- 2, 'B', 'X', BXREG, 0,
- 2, 'D', 'I', DIREG, 0,
- 2, 'S', 'I', SIREG, 0,
-
- 3, 'E', 'A', 'X', EAXREG, 0,
- 3, 'E', 'B', 'P', EBPREG, 0,
- 3, 'E', 'B', 'X', EBXREG, 0,
- 3, 'E', 'C', 'X', ECXREG, 0,
- 3, 'E', 'D', 'I', EDIREG, 0,
- 3, 'E', 'D', 'X', EDXREG, 0,
- 3, 'E', 'S', 'I', ESIREG, 0,
- 3, 'E', 'S', 'P', ESPREG, 0,
-
- 2, 'A', 'X', AXREG, 0,
- 2, 'C', 'X', CXREG, 0,
- 2, 'D', 'X', DXREG, 0,
- 2, 'S', 'P', SPREG, 0,
-
- 2, 'A', 'H', AHREG, 0,
- 2, 'A', 'L', ALREG, 0,
- 2, 'B', 'H', BHREG, 0,
- 2, 'B', 'L', BLREG, 0,
- 2, 'C', 'H', CHREG, 0,
- 2, 'C', 'L', CLREG, 0,
- 2, 'D', 'H', DHREG, 0,
- 2, 'D', 'L', DLREG, 0,
-
- 2, 'C', 'S', CSREG, 0,
- 2, 'D', 'S', DSREG, 0,
- 2, 'E', 'S', ESREG, 0,
- 2, 'F', 'S', FSREG, 0,
- 2, 'G', 'S', GSREG, 0,
- 2, 'S', 'S', SSREG, 0,
-
- 3, 'C', 'R', '0', CR0REG, 0,
- 3, 'C', 'R', '2', CR2REG, 0,
- 3, 'C', 'R', '3', CR3REG, 0,
- 3, 'D', 'R', '0', DR0REG, 0,
- 3, 'D', 'R', '1', DR1REG, 0,
- 3, 'D', 'R', '2', DR2REG, 0,
- 3, 'D', 'R', '3', DR3REG, 0,
- 3, 'D', 'R', '6', DR6REG, 0,
- 3, 'D', 'R', '7', DR7REG, 0,
- 3, 'T', 'R', '3', TR3REG, 0,
- 3, 'T', 'R', '4', TR4REG, 0,
- 3, 'T', 'R', '5', TR5REG, 0,
- 3, 'T', 'R', '6', TR6REG, 0,
- 3, 'T', 'R', '7', TR7REG, 0,
-
- 2, 'S', 'T', ST0REG, 0,
-#endif /* I80386 */
-
-#ifdef MC6809
- 1, 'A', AREG, 0,
- 1, 'B', BREG, 0,
- 2, 'C', 'C', CCREG, 0,
- 1, 'D', DREG, 0,
- 2, 'D', 'P', DPREG, 0,
- 2, 'P', 'C', PCREG, 0,
- 3, 'P', 'C', 'R', PCREG, 0,
- 1, 'S', SREG, 0,
- 1, 'U', UREG, 0,
- 1, 'X', XREG, 0,
- 1, 'Y', YREG, 0,
-#endif
- 0 /* end of register list */
-};
-
-#ifdef I80386
-
-/* type sizes */
-/* the "opcode" field gives the type size */
-
-PUBLIC char typesizes[] =
-{
- 4, 'B', 'Y', 'T', 'E', BYTEOP, 1,
- 5, 'D', 'W', 'O', 'R', 'D', DWORDOP, 4,
- 5, 'F', 'W', 'O', 'R', 'D', FWORDOP, 6,
- 3, 'F', 'A', 'R', FAROP, 0,
- 3, 'P', 'T', 'R', PTROP, 0,
- 5, 'P', 'W', 'O', 'R', 'D', PWORDOP, 6,
- 5, 'Q', 'W', 'O', 'R', 'D', QWORDOP, 8,
- 5, 'T', 'B', 'Y', 'T', 'E', TBYTEOP, 10,
- 4, 'W', 'O', 'R', 'D', WORDOP, 2,
- 0 /* end of typesize list */
-};
-
-#endif
-
-/* ops */
-/* the routine number is given in 1 byte */
-/* the opcode is given in 1 byte (it is not used for pseudo-ops) */
-
-PUBLIC char ops[] =
-{
- /* pseudo-ops. The "opcode" field is unused and padded with a null byte */
- /* conditionals - must be first */
- 4, 'E', 'L', 'S', 'E', ELSEOP, 0,
- 6, 'E', 'L', 'S', 'E', 'I', 'F', ELSEIFOP, 0,
- 7, 'E', 'L', 'S', 'E', 'I', 'F', 'C', ELSEIFCOP, 0,
- 5, 'E', 'N', 'D', 'I', 'F', ENDIFOP, 0,
- 2, 'I', 'F', IFOP, 0,
- 3, 'I', 'F', 'C', IFCOP, 0,
-
- /* unconditionals */
- 6, '.', 'A', 'L', 'I', 'G', 'N', ALIGNOP, 0,
- 6, '.', 'A', 'S', 'C', 'I', 'I', FCCOP, 0,
- 5, '.', 'B', 'L', 'K', 'B', RMBOP, 0,
- 5, '.', 'B', 'L', 'K', 'W', BLKWOP, 0,
- 5, 'B', 'L', 'O', 'C', 'K', BLOCKOP, 0,
- 4, '.', 'B', 'S', 'S', BSSOP, 0,
- 5, '.', 'B', 'Y', 'T', 'E', FCBOP, 0,
- 4, 'C', 'O', 'M', 'M', COMMOP, 0,
- 5, '.', 'C', 'O', 'M', 'M', COMMOP1, 0,
- 5, '.', 'D', 'A', 'T', 'A', DATAOP, 0,
- 6, '.', 'D', 'A', 'T', 'A', '1', FCBOP, 0,
- 6, '.', 'D', 'A', 'T', 'A', '2', FDBOP, 0,
- 6, '.', 'D', 'A', 'T', 'A', '4', FQBOP, 0,
- 2, 'D', 'B', FCBOP, 0,
- 2, 'D', 'D', FQBOP, 0,
- 7, '.', 'D', 'E', 'F', 'I', 'N', 'E', EXPORTOP, 0,
- 2, 'D', 'W', FDBOP, 0,
- 3, 'E', 'N', 'D', PROCEOFOP, 0,
- 4, 'E', 'N', 'D', 'B', ENDBOP, 0,
- 5, 'E', 'N', 'T', 'E', 'R', ENTEROP, 0,
- 5, 'E', 'N', 'T', 'R', 'Y', ENTRYOP, 0,
- 3, 'E', 'Q', 'U', EQUOP, 0,
- 5, '.', 'E', 'V', 'E', 'N', EVENOP, 0,
- 6, 'E', 'X', 'P', 'O', 'R', 'T', EXPORTOP, 0,
- 6, 'E', 'X', 'T', 'E', 'R', 'N', IMPORTOP, 0,
- 7, '.', 'E', 'X', 'T', 'E', 'R', 'N', IMPORTOP, 0,
- 5, 'E', 'X', 'T', 'R', 'N', IMPORTOP, 0,
- 4, 'F', 'A', 'I', 'L', FAILOP, 0,
- 5, '.', 'F', 'A', 'I', 'L', FAILOP, 0,
- 3, 'F', 'C', 'B', FCBOP, 0,
- 3, 'F', 'C', 'C', FCCOP, 0,
- 3, 'F', 'D', 'B', FDBOP, 0,
- 3, 'G', 'E', 'T', GETOP, 0,
- 6, '.', 'G', 'L', 'O', 'B', 'L', GLOBLOP, 0,
- 5, 'I', 'D', 'E', 'N', 'T', IDENTOP, 0,
- 6, 'I', 'M', 'P', 'O', 'R', 'T', IMPORTOP, 0,
- 7, 'I', 'N', 'C', 'L', 'U', 'D', 'E', GETOP, 0,
- 5, 'L', 'C', 'O', 'M', 'M', LCOMMOP, 0,
- 6, '.', 'L', 'C', 'O', 'M', 'M', LCOMMOP1, 0,
- 5, '.', 'L', 'I', 'S', 'T', LISTOP, 0,
- 3, 'L', 'O', 'C', LOCOP, 0,
- 5, '.', 'L', 'O', 'N', 'G', FQBOP, 0,
- 8, '.', 'M', 'A', 'C', 'L', 'I', 'S', 'T', MACLISTOP, 0,
- 5, 'M', 'A', 'C', 'R', 'O', MACROOP, 0,
- 4, '.', 'M', 'A', 'P', MAPOP, 0,
- 3, 'O', 'R', 'G', ORGOP, 0,
- 4, '.', 'O', 'R', 'G', ORGOP, 0,
- 6, 'P', 'U', 'B', 'L', 'I', 'C', EXPORTOP, 0,
- 3, 'R', 'M', 'B', RMBOP, 0,
- 4, '.', 'R', 'O', 'M', DATAOP, 0,
- 5, '.', 'S', 'E', 'C', 'T', SECTOP, 0,
- 3, 'S', 'E', 'T', SETOP, 0,
- 5, 'S', 'E', 'T', 'D', 'P', SETDPOP, 0,
- 6, '.', 'S', 'H', 'O', 'R', 'T', FDBOP, 0,
- 6, '.', 'S', 'P', 'A', 'C', 'E', RMBOP, 0,
- 5, '.', 'T', 'E', 'X', 'T', TEXTOP, 0,
- 5, 'U', 'S', 'E', '1', '6', USE16OP, 0,
- 5, 'U', 'S', 'E', '3', '2', USE32OP, 0,
- 5, '.', 'W', 'A', 'R', 'N', WARNOP, 0,
- 5, '.', 'W', 'O', 'R', 'D', FDBOP, 0,
- 6, '.', 'Z', 'E', 'R', 'O', 'W', BLKWOP, 0,
-
- /* hardware ops. The opcode field is now used */
-#ifdef I80386
- 3, 'A', 'A', 'A', INHER, 0x37,
- 3, 'A', 'A', 'D', INHER_A, 0xD5,
- 3, 'A', 'A', 'M', INHER_A, 0xD4,
- 3, 'A', 'A', 'S', INHER, 0x3F,
- 3, 'A', 'D', 'C', GROUP1, 0x10,
- 3, 'A', 'D', 'D', GROUP1, 0x00,
- 3, 'A', 'N', 'D', GROUP1, 0x20,
- 4, 'A', 'R', 'P', 'L', EwGw, 0x63,
- 3, 'B', 'C', 'C', BCC, 0x73,
- 3, 'B', 'C', 'S', BCC, 0x72,
- 3, 'B', 'E', 'Q', BCC, 0x74,
- 3, 'B', 'G', 'E', BCC, 0x7D,
- 3, 'B', 'G', 'T', BCC, 0x7F,
- 3, 'B', 'H', 'I', BCC, 0x77,
- 4, 'B', 'H', 'I', 'S', BCC, 0x73,
- 3, 'B', 'L', 'E', BCC, 0x7E,
- 3, 'B', 'L', 'O', BCC, 0x72,
- 4, 'B', 'L', 'O', 'S', BCC, 0x76,
- 3, 'B', 'L', 'T', BCC, 0x7C,
- 3, 'B', 'M', 'I', BCC, 0x78,
- 3, 'B', 'N', 'E', BCC, 0x75,
- 5, 'B', 'O', 'U', 'N', 'D', GvMa, 0x62,
- 3, 'B', 'P', 'C', BCC, 0x7B,
- 3, 'B', 'P', 'L', BCC, 0x79,
- 3, 'B', 'P', 'S', BCC, 0x7A,
- 2, 'B', 'R', CALL, JMP_OPCODE,
- 3, 'B', 'V', 'C', BCC, 0x71,
- 3, 'B', 'V', 'S', BCC, 0x70,
- 4, 'C', 'A', 'L', 'L', CALL, JSR_OPCODE,
- 5, 'C', 'A', 'L', 'L', 'F', CALLI, 0x9A,
- 5, 'C', 'A', 'L', 'L', 'I', CALLI, 0x9A,
- 3, 'C', 'B', 'W', INHER16, 0x98,
- 3, 'C', 'L', 'C', INHER, 0xF8,
- 3, 'C', 'L', 'D', INHER, 0xFC,
- 3, 'C', 'L', 'I', INHER, 0xFA,
- 3, 'C', 'M', 'C', INHER, 0xF5,
- 3, 'C', 'M', 'P', GROUP1, CMP_OPCODE_BASE,
- 4, 'C', 'M', 'P', 'S', INHER, CMPSW_OPCODE,
- 5, 'C', 'M', 'P', 'S', 'B', INHER, CMPSB_OPCODE,
- 5, 'C', 'M', 'P', 'S', 'D', INHER32, CMPSW_OPCODE,
- 5, 'C', 'M', 'P', 'S', 'W', INHER16, CMPSW_OPCODE,
- 4, 'C', 'M', 'P', 'W', INHER16, CMPSW_OPCODE,
- 4, 'C', 'S', 'E', 'G', INHER, 0x2E,
- 3, 'C', 'W', 'D', INHER16, 0x99,
- 4, 'C', 'W', 'D', 'E', INHER32, 0x98,
- 3, 'C', 'D', 'Q', INHER32, 0x99,
- 3, 'D', 'A', 'A', INHER, 0x27,
- 3, 'D', 'A', 'S', INHER, 0x2F,
- 4, 'D', 'S', 'E', 'G', INHER, 0x3E,
- 3, 'D', 'E', 'C', INCDEC, 0x08,
- 3, 'D', 'I', 'V', DIVMUL, 0x30,
- 5, 'E', 'N', 'T', 'E', 'R', ENTER, 0xC8,
- 4, 'E', 'S', 'E', 'G', INHER, 0x26,
- 4, 'F', 'S', 'E', 'G', INHER, 0x64,
- 4, 'G', 'S', 'E', 'G', INHER, 0x65,
- 3, 'H', 'L', 'T', INHER, 0xF4,
- 4, 'I', 'D', 'I', 'V', DIVMUL, 0x38,
- 4, 'I', 'M', 'U', 'L', IMUL, 0x28,
- 2, 'I', 'N', IN, 0xEC,
- 3, 'I', 'N', 'C', INCDEC, 0x00,
- 3, 'I', 'N', 'S', INHER, 0x6D,
- 4, 'I', 'N', 'S', 'B', INHER, 0x6C,
- 4, 'I', 'N', 'S', 'D', INHER32, 0x6D,
- 4, 'I', 'N', 'S', 'W', INHER16, 0x6D,
- 3, 'I', 'N', 'T', INT, 0xCD,
- 4, 'I', 'N', 'T', 'O', INHER, 0xCE,
- 3, 'I', 'N', 'W', IN, 0xED,
- 4, 'I', 'R', 'E', 'T', INHER16, 0xCF,
- 5, 'I', 'R', 'E', 'T', 'D', INHER32, 0xCF,
- 1, 'J', CALL, JMP_SHORT_OPCODE,
- 2, 'J', 'A', JCC, 0x77,
- 3, 'J', 'A', 'E', JCC, 0x73,
- 2, 'J', 'B', JCC, 0x72,
- 3, 'J', 'B', 'E', JCC, 0x76,
- 2, 'J', 'C', JCC, 0x72,
- 4, 'J', 'C', 'X', 'E', JCXZ, 0x2,
- 4, 'J', 'C', 'X', 'Z', JCXZ, 0x2,
- 5, 'J', 'E', 'C', 'X', 'E', JCXZ, 0x4,
- 5, 'J', 'E', 'C', 'X', 'Z', JCXZ, 0x4,
- 2, 'J', 'E', JCC, 0x74,
- 2, 'J', 'G', JCC, 0x7F,
- 3, 'J', 'G', 'E', JCC, 0x7D,
- 2, 'J', 'L', JCC, 0x7C,
- 3, 'J', 'L', 'E', JCC, 0x7E,
- 3, 'J', 'M', 'P', CALL, JMP_SHORT_OPCODE,
- 4, 'J', 'M', 'P', 'F', CALLI, 0xEA,
- 4, 'J', 'M', 'P', 'I', CALLI, 0xEA,
- 3, 'J', 'N', 'A', JCC, 0x76,
- 4, 'J', 'N', 'A', 'E', JCC, 0x72,
- 3, 'J', 'N', 'B', JCC, 0x73,
- 4, 'J', 'N', 'B', 'E', JCC, 0x77,
- 3, 'J', 'N', 'C', JCC, 0x73,
- 3, 'J', 'N', 'E', JCC, 0x75,
- 3, 'J', 'N', 'G', JCC, 0x7E,
- 4, 'J', 'N', 'G', 'E', JCC, 0x7C,
- 3, 'J', 'N', 'L', JCC, 0x7D,
- 4, 'J', 'N', 'L', 'E', JCC, 0x7F,
- 3, 'J', 'N', 'O', JCC, 0x71,
- 3, 'J', 'N', 'P', JCC, 0x7B,
- 3, 'J', 'N', 'S', JCC, 0x79,
- 3, 'J', 'N', 'Z', JCC, 0x75,
- 2, 'J', 'O', JCC, 0x70,
- 2, 'J', 'P', JCC, 0x7A,
- 3, 'J', 'P', 'E', JCC, 0x7A,
- 3, 'J', 'P', 'O', JCC, 0x7B,
- 2, 'J', 'S', JCC, 0x78,
- 2, 'J', 'Z', JCC, 0x74,
- 4, 'L', 'A', 'H', 'F', INHER, 0x9F,
- 3, 'L', 'D', 'S', GvMp, 0xC5,
- 3, 'L', 'E', 'A', LEA, 0x8D,
- 5, 'L', 'E', 'A', 'V', 'E', INHER, 0xC9,
- 3, 'L', 'E', 'S', GvMp, 0xC4,
- 4, 'L', 'O', 'C', 'K', INHER, 0xF0,
- 4, 'L', 'O', 'D', 'B', INHER, 0xAC,
- 4, 'L', 'O', 'D', 'S', INHER, 0xAD,
- 5, 'L', 'O', 'D', 'S', 'B', INHER, 0xAC,
- 5, 'L', 'O', 'D', 'S', 'D', INHER32, 0xAD,
- 5, 'L', 'O', 'D', 'S', 'W', INHER16, 0xAD,
- 4, 'L', 'O', 'D', 'W', INHER16, 0xAD,
- 4, 'L', 'O', 'O', 'P', JCC, 0xE2,
- 5, 'L', 'O', 'O', 'P', 'E', JCC, 0xE1,
- 6, 'L', 'O', 'O', 'P', 'N', 'E', JCC, 0xE0,
- 6, 'L', 'O', 'O', 'P', 'N', 'Z', JCC, 0xE0,
- 5, 'L', 'O', 'O', 'P', 'Z', JCC, 0xE1,
- 3, 'M', 'O', 'V', MOV, 0x88,
- 4, 'M', 'O', 'V', 'S', INHER, MOVSW_OPCODE,
- 5, 'M', 'O', 'V', 'S', 'B', INHER, MOVSB_OPCODE,
- 5, 'M', 'O', 'V', 'S', 'D', INHER32, MOVSW_OPCODE,
- 5, 'M', 'O', 'V', 'S', 'W', INHER16, MOVSW_OPCODE,
- 4, 'M', 'O', 'V', 'W', INHER16, MOVSW_OPCODE,
- 3, 'M', 'U', 'L', DIVMUL, 0x20,
- 3, 'N', 'E', 'G', NEGNOT, 0x18,
- 3, 'N', 'O', 'P', INHER, 0x90,
- 3, 'N', 'O', 'T', NEGNOT, 0x10,
- 2, 'O', 'R', GROUP1, 0x08,
- 3, 'O', 'U', 'T', OUT, 0xEE,
- 4, 'O', 'U', 'T', 'S', INHER, 0x6F,
- 5, 'O', 'U', 'T', 'S', 'B', INHER, 0x6E,
- 5, 'O', 'U', 'T', 'S', 'D', INHER32, 0x6F,
- 5, 'O', 'U', 'T', 'S', 'W', INHER16, 0x6F,
- 4, 'O', 'U', 'T', 'W', OUT, 0xEF,
- 3, 'P', 'O', 'P', PUSHPOP, POP_OPCODE,
- 4, 'P', 'O', 'P', 'A', INHER16, 0x61,
- 5, 'P', 'O', 'P', 'A', 'D', INHER32, 0x61,
- 4, 'P', 'O', 'P', 'F', INHER16, 0x9D,
- 5, 'P', 'O', 'P', 'F', 'D', INHER32, 0x9D,
- 4, 'P', 'U', 'S', 'H', PUSHPOP, PUSH_OPCODE,
- 5, 'P', 'U', 'S', 'H', 'A', INHER16, 0x60,
- 6, 'P', 'U', 'S', 'H', 'A', 'D', INHER32, 0x60,
- 5, 'P', 'U', 'S', 'H', 'F', INHER16, 0x9C,
- 6, 'P', 'U', 'S', 'H', 'F', 'D', INHER32, 0x9C,
- 3, 'R', 'C', 'L', GROUP2, 0x10,
- 3, 'R', 'C', 'R', GROUP2, 0x18,
- 3, 'R', 'O', 'L', GROUP2, 0x00,
- 3, 'R', 'O', 'R', GROUP2, 0x08,
- 3, 'R', 'E', 'P', INHER, 0xF3,
- 4, 'R', 'E', 'P', 'E', INHER, 0xF3,
- 5, 'R', 'E', 'P', 'N', 'E', INHER, 0xF2,
- 5, 'R', 'E', 'P', 'N', 'Z', INHER, 0xF2,
- 4, 'R', 'E', 'P', 'Z', INHER, 0xF3,
- 3, 'R', 'E', 'T', RET, 0xC3,
- 4, 'R', 'E', 'T', 'F', RET, 0xCB,
- 4, 'R', 'E', 'T', 'I', RET, 0xCB,
- 4, 'S', 'A', 'H', 'F', INHER, 0x9E,
- 3, 'S', 'A', 'L', GROUP2, 0x20,
- 3, 'S', 'A', 'R', GROUP2, 0x38,
- 3, 'S', 'B', 'B', GROUP1, 0x18,
- 4, 'S', 'C', 'A', 'B', INHER, 0xAE,
- 4, 'S', 'C', 'A', 'S', INHER, 0xAF,
- 5, 'S', 'C', 'A', 'S', 'B', INHER, 0xAE,
- 5, 'S', 'C', 'A', 'S', 'D', INHER32, 0xAF,
- 5, 'S', 'C', 'A', 'S', 'W', INHER16, 0xAF,
- 4, 'S', 'C', 'A', 'W', INHER16, 0xAF,
- 3, 'S', 'E', 'G', SEG, 0x06,
- 3, 'S', 'H', 'L', GROUP2, 0x20,
- 3, 'S', 'H', 'R', GROUP2, 0x28,
- 4, 'S', 'S', 'E', 'G', INHER, 0x36,
- 3, 'S', 'T', 'C', INHER, 0xF9,
- 3, 'S', 'T', 'D', INHER, 0xFD,
- 3, 'S', 'T', 'I', INHER, 0xFB,
- 4, 'S', 'T', 'O', 'B', INHER, 0xAA,
- 4, 'S', 'T', 'O', 'S', INHER, 0xAB,
- 5, 'S', 'T', 'O', 'S', 'B', INHER, 0xAA,
- 5, 'S', 'T', 'O', 'S', 'D', INHER32, 0xAB,
- 5, 'S', 'T', 'O', 'S', 'W', INHER16, 0xAB,
- 4, 'S', 'T', 'O', 'W', INHER16, 0xAB,
- 3, 'S', 'U', 'B', GROUP1, 0x28,
- 4, 'T', 'E', 'S', 'T', TEST, 0x84,
- 4, 'W', 'A', 'I', 'T', INHER, WAIT_OPCODE,
- 4, 'X', 'C', 'H', 'G', XCHG, 0x86,
- 4, 'X', 'L', 'A', 'T', INHER, 0xD7,
- 5, 'X', 'L', 'A', 'T', 'B', INHER, 0xD7,
- 3, 'X', 'O', 'R', GROUP1, 0x30,
-
- /* floating point */
- 5, 'F', '2', 'X', 'M', '1', F_INHER, 0x70,
- 4, 'F', 'A', 'B', 'S', F_INHER, 0x61,
- 4, 'F', 'A', 'D', 'D', F_M4_M8_STST, 0x00,
- 5, 'F', 'A', 'D', 'D', 'P', F_STST, 0x60,
- 4, 'F', 'B', 'L', 'D', F_M10, 0x74,
- 5, 'F', 'B', 'S', 'T', 'P', F_M10, 0x76,
- 4, 'F', 'C', 'H', 'S', F_INHER, 0x60,
- 5, 'F', 'C', 'L', 'E', 'X', F_W_INHER, 0xE2,
- 4, 'F', 'C', 'O', 'M', F_M4_M8_OPTST, 0x02,
- 5, 'F', 'C', 'O', 'M', 'P', F_M4_M8_OPTST, 0x03,
- 6, 'F', 'C', 'O', 'M', 'P', 'P', F_INHER, 0x19,
- 4, 'F', 'C', 'O', 'S', F_INHER, 0x7F,
- 7, 'F', 'D', 'E', 'C', 'S', 'T', 'P', F_INHER, 0x76,
- 5, 'F', 'D', 'I', 'S', 'I', F_W_INHER, 0xE1,
- 4, 'F', 'D', 'I', 'V', F_M4_M8_STST, 0x06,
- 5, 'F', 'D', 'I', 'V', 'P', F_STST, 0x67,
- 5, 'F', 'D', 'I', 'V', 'R', F_M4_M8_STST, 0x07,
- 6, 'F', 'D', 'I', 'V', 'R', 'P', F_STST, 0x66,
- 4, 'F', 'E', 'N', 'I', F_W_INHER, 0xE0,
- 5, 'F', 'F', 'R', 'E', 'E', F_ST, 0x50,
- 5, 'F', 'I', 'A', 'D', 'D', F_M2_M4, 0x20,
- 5, 'F', 'I', 'C', 'O', 'M', F_M2_M4, 0x22,
- 6, 'F', 'I', 'C', 'O', 'M', 'P', F_M2_M4, 0x23,
- 5, 'F', 'I', 'D', 'I', 'V', F_M2_M4, 0x26,
- 6, 'F', 'I', 'D', 'I', 'V', 'R', F_M2_M4, 0x27,
- 4, 'F', 'I', 'L', 'D', F_M2_M4_M8, 0x30,
- 5, 'F', 'I', 'M', 'U', 'L', F_M2_M4, 0x21,
- 7, 'F', 'I', 'N', 'C', 'S', 'T', 'P', F_INHER, 0x77,
- 5, 'F', 'I', 'N', 'I', 'T', F_W_INHER, 0xE3,
- 4, 'F', 'I', 'S', 'T', F_M2_M4, 0x32,
- 5, 'F', 'I', 'S', 'T', 'P', F_M2_M4_M8, 0x33,
- 5, 'F', 'I', 'S', 'U', 'B', F_M2_M4, 0x24,
- 6, 'F', 'I', 'S', 'U', 'B', 'R', F_M2_M4, 0x25,
- 3, 'F', 'L', 'D', F_M4_M8_M10_ST, 0x10,
- 4, 'F', 'L', 'D', '1', F_INHER, 0x68,
- 6, 'F', 'L', 'D', 'L', '2', 'E', F_INHER, 0x6A,
- 6, 'F', 'L', 'D', 'L', '2', 'T', F_INHER, 0x69,
- 5, 'F', 'L', 'D', 'C', 'W', F_M2, 0x15,
- 6, 'F', 'L', 'D', 'E', 'N', 'V', F_M, 0x14,
- 6, 'F', 'L', 'D', 'L', 'G', '2', F_INHER, 0x6C,
- 6, 'F', 'L', 'D', 'L', 'N', '2', F_INHER, 0x6D,
- 5, 'F', 'L', 'D', 'P', 'I', F_INHER, 0x6B,
- 4, 'F', 'L', 'D', 'Z', F_INHER, 0x6E,
- 4, 'F', 'M', 'U', 'L', F_M4_M8_STST, 0x01,
- 5, 'F', 'M', 'U', 'L', 'P', F_STST, 0x61,
- 6, 'F', 'N', 'C', 'L', 'E', 'X', F_INHER, 0xE2,
- 6, 'F', 'N', 'D', 'I', 'S', 'I', F_INHER, 0xE1,
- 5, 'F', 'N', 'E', 'N', 'I', F_INHER, 0xE0,
- 6, 'F', 'N', 'I', 'N', 'I', 'T', F_INHER, 0xE3,
- 4, 'F', 'N', 'O', 'P', F_INHER, 0x50,
- 6, 'F', 'N', 'S', 'A', 'V', 'E', F_M, 0x56,
- 6, 'F', 'N', 'S', 'T', 'C', 'W', F_M2, 0x17,
- 7, 'F', 'N', 'S', 'T', 'E', 'N', 'V', F_M, 0x16,
- 6, 'F', 'N', 'S', 'T', 'S', 'W', F_M2_AX, 0x57,
- 6, 'F', 'P', 'A', 'T', 'A', 'N', F_INHER, 0x73,
- 5, 'F', 'P', 'R', 'E', 'M', F_INHER, 0x78,
- 6, 'F', 'P', 'R', 'E', 'M', '1', F_INHER, 0x75,
- 5, 'F', 'P', 'T', 'A', 'N', F_INHER, 0x72,
- 7, 'F', 'R', 'N', 'D', 'I', 'N', 'T', F_INHER, 0x7C,
- 6, 'F', 'R', 'S', 'T', 'O', 'R', F_M, 0x54,
- 5, 'F', 'S', 'A', 'V', 'E', F_W_M, 0x56,
- 6, 'F', 'S', 'C', 'A', 'L', 'E', F_INHER, 0x7D,
- 6, 'F', 'S', 'E', 'T', 'P', 'M', F_INHER, 0xE4,
- 4, 'F', 'S', 'I', 'N', F_INHER, 0x7E,
- 7, 'F', 'S', 'I', 'N', 'C', 'O', 'S', F_INHER, 0x7B,
- 5, 'F', 'S', 'Q', 'R', 'T', F_INHER, 0x7A,
- 3, 'F', 'S', 'T', F_M4_M8_ST, FST_ENCODED,
- 5, 'F', 'S', 'T', 'C', 'W', F_W_M2, 0x17,
- 6, 'F', 'S', 'T', 'E', 'N', 'V', F_W_M, 0x16,
- 4, 'F', 'S', 'T', 'P', F_M4_M8_M10_ST, FSTP_ENCODED,
- 5, 'F', 'S', 'T', 'S', 'W', F_W_M2_AX, 0x57,
- 4, 'F', 'S', 'U', 'B', F_M4_M8_STST, 0x04,
- 5, 'F', 'S', 'U', 'B', 'P', F_STST, 0x65,
- 5, 'F', 'S', 'U', 'B', 'R', F_M4_M8_STST, 0x05,
- 6, 'F', 'S', 'U', 'B', 'R', 'P', F_STST, 0x64,
- 4, 'F', 'T', 'S', 'T', F_INHER, 0x64,
- 5, 'F', 'U', 'C', 'O', 'M', F_OPTST, 0x54,
- 6, 'F', 'U', 'C', 'O', 'M', 'P', F_OPTST, 0x55,
- 7, 'F', 'U', 'C', 'O', 'M', 'P', 'P', F_INHER, 0xA9,
- 5, 'F', 'W', 'A', 'I', 'T', INHER, WAIT_OPCODE,
- 4, 'F', 'X', 'A', 'M', F_INHER, 0x65,
- 4, 'F', 'X', 'C', 'H', F_OPTST, 0x11,
- 7, 'F', 'X', 'T', 'R', 'A', 'C', 'T', F_INHER, 0x74,
- 5, 'F', 'Y', 'L', '2', 'X', F_INHER, 0x71,
- 7, 'F', 'Y', 'L', '2', 'X', 'P', '1', F_INHER, 0x79,
-#endif /* I80386 */
-
-#ifdef MC6809
- 3, 'A', 'B', 'X', INHER, 0x3A,
- 4, 'A', 'D', 'C', 'A', ALL, 0x89,
- 4, 'A', 'D', 'C', 'B', ALL, 0xC9,
- 4, 'A', 'D', 'D', 'A', ALL, 0x8B,
- 4, 'A', 'D', 'D', 'B', ALL, 0xCB,
- 4, 'A', 'D', 'D', 'D', ALL, 0xC3,
- 4, 'A', 'N', 'D', 'A', ALL, 0x84,
- 4, 'A', 'N', 'D', 'B', ALL, 0xC4,
- 5, 'A', 'N', 'D', 'C', 'C', IMMED, 0x1C,
- 3, 'A', 'S', 'L', ALTER, 0x08,
- 4, 'A', 'S', 'L', 'A', INHER, 0x48,
- 4, 'A', 'S', 'L', 'B', INHER, 0x58,
- 3, 'A', 'S', 'R', ALTER, 0x07,
- 4, 'A', 'S', 'R', 'A', INHER, 0x47,
- 4, 'A', 'S', 'R', 'B', INHER, 0x57,
- 3, 'B', 'C', 'C', SHORT, 0x24,
- 3, 'B', 'C', 'S', SHORT, 0x25,
- 3, 'B', 'E', 'Q', SHORT, 0x27,
- 3, 'B', 'G', 'E', SHORT, 0x2C,
- 3, 'B', 'G', 'T', SHORT, 0x2E,
- 3, 'B', 'H', 'I', SHORT, 0x22,
- 3, 'B', 'H', 'S', SHORT, 0x24,
- 4, 'B', 'I', 'T', 'A', ALL, 0X85,
- 4, 'B', 'I', 'T', 'B', ALL, 0XC5,
- 3, 'B', 'L', 'E', SHORT, 0x2F,
- 3, 'B', 'L', 'O', SHORT, 0x25,
- 3, 'B', 'L', 'S', SHORT, 0x23,
- 3, 'B', 'L', 'T', SHORT, 0x2D,
- 3, 'B', 'M', 'I', SHORT, 0x2B,
- 3, 'B', 'N', 'E', SHORT, 0x26,
- 3, 'B', 'P', 'L', SHORT, 0x2A,
- 3, 'B', 'R', 'A', SHORT, 0x20,
- 4, 'L', 'B', 'R', 'A', LONG, 0x16,
- 3, 'B', 'R', 'N', SHORT, 0x21,
- 3, 'B', 'S', 'R', SHORT, 0x8D,
- 4, 'L', 'B', 'S', 'R', LONG, 0x17,
- 3, 'B', 'V', 'C', SHORT, 0x28,
- 3, 'B', 'V', 'S', SHORT, 0x29,
- 3, 'C', 'L', 'R', ALTER, 0x0F,
- 4, 'C', 'L', 'R', 'A', INHER, 0x4F,
- 4, 'C', 'L', 'R', 'B', INHER, 0x5F,
- 4, 'C', 'M', 'P', 'A', ALL, 0x81,
- 4, 'C', 'M', 'P', 'B', ALL, 0xC1,
- 4, 'C', 'M', 'P', 'X', ALL, 0x8C,
- 3, 'C', 'O', 'M', ALTER, 0x03,
- 4, 'C', 'O', 'M', 'A', INHER, 0x43,
- 4, 'C', 'O', 'M', 'B', INHER, 0x53,
- 4, 'C', 'W', 'A', 'I', IMMED, 0x3C,
- 3, 'D', 'A', 'A', INHER, 0x19,
- 3, 'D', 'E', 'C', ALTER, 0x0A,
- 4, 'D', 'E', 'C', 'A', INHER, 0x4A,
- 4, 'D', 'E', 'C', 'B', INHER, 0x5A,
- 4, 'E', 'O', 'R', 'A', ALL, 0x88,
- 4, 'E', 'O', 'R', 'B', ALL, 0xC8,
- 3, 'E', 'X', 'G', SWAP, 0x1E,
- 3, 'I', 'N', 'C', ALTER, 0x0C,
- 4, 'I', 'N', 'C', 'A', INHER, 0x4C,
- 4, 'I', 'N', 'C', 'B', INHER, 0x5C,
- 3, 'J', 'M', 'P', ALTER, 0x0E,
- 3, 'J', 'S', 'R', ALTER, 0x8D,
- 3, 'L', 'D', 'A', ALL, 0x86,
- 3, 'L', 'D', 'B', ALL, 0xC6,
- 3, 'L', 'D', 'D', ALL, 0xCC,
- 3, 'L', 'D', 'U', ALL, 0xCE,
- 3, 'L', 'D', 'X', ALL, 0x8E,
- 4, 'L', 'E', 'A', 'S', INDEXD, 0x32,
- 4, 'L', 'E', 'A', 'U', INDEXD, 0x33,
- 4, 'L', 'E', 'A', 'X', INDEXD, 0x30,
- 4, 'L', 'E', 'A', 'Y', INDEXD, 0x31,
- 3, 'L', 'S', 'L', ALTER, 0x08,
- 4, 'L', 'S', 'L', 'A', INHER, 0x48,
- 4, 'L', 'S', 'L', 'B', INHER, 0x58,
- 3, 'L', 'S', 'R', ALTER, 0x04,
- 4, 'L', 'S', 'R', 'A', INHER, 0x44,
- 4, 'L', 'S', 'R', 'B', INHER, 0x54,
- 3, 'M', 'U', 'L', INHER, 0x3D,
- 3, 'N', 'E', 'G', ALTER, 0x00,
- 4, 'N', 'E', 'G', 'A', INHER, 0x40,
- 4, 'N', 'E', 'G', 'B', INHER, 0x50,
- 3, 'N', 'O', 'P', INHER, 0x12,
- 3, 'O', 'R', 'A', ALL, 0x8A,
- 3, 'O', 'R', 'B', ALL, 0xCA,
- 4, 'O', 'R', 'C', 'C', IMMED, 0x1A,
- 4, 'P', 'S', 'H', 'S', SSTAK, 0x34,
- 4, 'P', 'S', 'H', 'U', USTAK, 0x36,
- 4, 'P', 'U', 'L', 'S', SSTAK, 0x35,
- 4, 'P', 'U', 'L', 'U', USTAK, 0x37,
- 3, 'R', 'O', 'L', ALTER, 0x09,
- 4, 'R', 'O', 'L', 'A', INHER, 0x49,
- 4, 'R', 'O', 'L', 'B', INHER, 0x59,
- 3, 'R', 'O', 'R', ALTER, 0x06,
- 4, 'R', 'O', 'R', 'A', INHER, 0x46,
- 4, 'R', 'O', 'R', 'B', INHER, 0x56,
- 3, 'R', 'T', 'I', INHER, 0x3B,
- 3, 'R', 'T', 'S', INHER, 0x39,
- 4, 'S', 'B', 'C', 'A', ALL, 0x82,
- 4, 'S', 'B', 'C', 'B', ALL, 0xC2,
- 3, 'S', 'E', 'X', INHER, 0x1D,
- 3, 'S', 'T', 'A', ALTER, 0x87,
- 3, 'S', 'T', 'B', ALTER, 0xC7,
- 3, 'S', 'T', 'D', ALTER, 0xCD,
- 3, 'S', 'T', 'U', ALTER, 0xCF,
- 3, 'S', 'T', 'X', ALTER, 0x8F,
- 4, 'S', 'U', 'B', 'A', ALL, 0x80,
- 4, 'S', 'U', 'B', 'B', ALL, 0xC0,
- 4, 'S', 'U', 'B', 'D', ALL, 0x83,
- 3, 'S', 'W', 'I', INHER, 0x3F,
- 4, 'S', 'Y', 'N', 'C', INHER, 0x13,
- 3, 'T', 'F', 'R', SWAP, 0x1F,
- 3, 'T', 'S', 'T', ALTER, 0x0D,
- 4, 'T', 'S', 'T', 'A', INHER, 0x4D,
- 4, 'T', 'S', 'T', 'B', INHER, 0x5D,
-#endif /* MC6809 */
- 0 /* end of ops */
-};
-
-PUBLIC char page1ops[] =
-{
-#ifdef I80386
- 3, 'B', 'S', 'F', GvEv, 0xBC,
- 3, 'B', 'S', 'R', GvEv, 0xBD,
- 5, 'B', 'S', 'W', 'A', 'P', BSWAP, 0xC8,
- 2, 'B', 'T', GROUP8, 0x20,
- 3, 'B', 'T', 'C', GROUP8, 0x38,
- 3, 'B', 'T', 'R', GROUP8, 0x30,
- 3, 'B', 'T', 'S', GROUP8, 0x28,
- 4, 'C', 'L', 'T', 'S', INHER, 0x06,
- 7, 'C', 'M', 'P', 'X', 'C', 'H', 'G', ExGx, 0xA6,
- 4, 'I', 'N', 'V', 'D', INHER, 0x08,
- 6, 'I', 'N', 'V', 'L', 'P', 'G', GROUP7, 0x38,
- 3, 'L', 'A', 'R', GvEv, 0x02,
- 3, 'L', 'F', 'S', GvMp, 0xB4,
- 4, 'L', 'G', 'D', 'T', GROUP7, 0x10,
- 3, 'L', 'G', 'S', GvMp, 0xB5,
- 4, 'L', 'I', 'D', 'T', GROUP7, 0x18,
- 4, 'L', 'L', 'D', 'T', GROUP6, 0x10,
- 4, 'L', 'M', 'S', 'W', GROUP7, 0x30,
- 3, 'L', 'S', 'L', GvEv, 0x03,
- 3, 'L', 'S', 'S', GvMp, 0xB2,
- 3, 'L', 'T', 'R', GROUP6, 0x18,
- 5, 'M', 'O', 'V', 'S', 'X', MOVX, 0xBE,
- 5, 'M', 'O', 'V', 'Z', 'X', MOVX, 0xB6,
- 4, 'S', 'E', 'T', 'A', SETCC, 0x97,
- 5, 'S', 'E', 'T', 'A', 'E', SETCC, 0x93,
- 4, 'S', 'E', 'T', 'B', SETCC, 0x92,
- 5, 'S', 'E', 'T', 'B', 'E', SETCC, 0x96,
- 4, 'S', 'E', 'T', 'C', SETCC, 0x92,
- 4, 'S', 'E', 'T', 'E', SETCC, 0x94,
- 4, 'S', 'E', 'T', 'G', SETCC, 0x9F,
- 5, 'S', 'E', 'T', 'G', 'E', SETCC, 0x9D,
- 4, 'S', 'E', 'T', 'L', SETCC, 0x9C,
- 5, 'S', 'E', 'T', 'L', 'E', SETCC, 0x9E,
- 5, 'S', 'E', 'T', 'N', 'A', SETCC, 0x96,
- 6, 'S', 'E', 'T', 'N', 'A', 'E', SETCC, 0x92,
- 5, 'S', 'E', 'T', 'N', 'B', SETCC, 0x93,
- 6, 'S', 'E', 'T', 'N', 'B', 'E', SETCC, 0x97,
- 5, 'S', 'E', 'T', 'N', 'C', SETCC, 0x93,
- 5, 'S', 'E', 'T', 'N', 'E', SETCC, 0x95,
- 5, 'S', 'E', 'T', 'N', 'G', SETCC, 0x9E,
- 6, 'S', 'E', 'T', 'N', 'G', 'E', SETCC, 0x9C,
- 5, 'S', 'E', 'T', 'N', 'L', SETCC, 0x9D,
- 6, 'S', 'E', 'T', 'N', 'L', 'E', SETCC, 0x9F,
- 5, 'S', 'E', 'T', 'N', 'O', SETCC, 0x91,
- 5, 'S', 'E', 'T', 'N', 'P', SETCC, 0x9B,
- 5, 'S', 'E', 'T', 'N', 'S', SETCC, 0x99,
- 5, 'S', 'E', 'T', 'N', 'Z', SETCC, 0x95,
- 4, 'S', 'E', 'T', 'O', SETCC, 0x90,
- 4, 'S', 'E', 'T', 'P', SETCC, 0x9A,
- 5, 'S', 'E', 'T', 'P', 'E', SETCC, 0x9A,
- 5, 'S', 'E', 'T', 'P', 'O', SETCC, 0x9B,
- 4, 'S', 'E', 'T', 'S', SETCC, 0x98,
- 4, 'S', 'E', 'T', 'Z', SETCC, 0x94,
- 4, 'S', 'G', 'D', 'T', GROUP7, 0x00,
- 4, 'S', 'I', 'D', 'T', GROUP7, 0x08,
- 4, 'S', 'H', 'L', 'D', SH_DOUBLE, 0xA4,
- 4, 'S', 'H', 'R', 'D', SH_DOUBLE, 0xAC,
- 4, 'S', 'L', 'D', 'T', GROUP6, 0x00,
- 4, 'S', 'M', 'S', 'W', GROUP7, 0x20,
- 3, 'S', 'T', 'R', GROUP6, 0x08,
- 4, 'V', 'E', 'R', 'R', GROUP6, 0x20,
- 4, 'V', 'E', 'R', 'W', GROUP6, 0x28,
- 6, 'W', 'B', 'I', 'N', 'V', 'D', INHER, 0x09,
- 4, 'X', 'A', 'D', 'D', ExGx, 0xC0,
-#endif /* I80386 */
-
-#ifdef MC6809
- 4, 'L', 'B', 'C', 'C', LONG, 0x24,
- 4, 'L', 'B', 'C', 'S', LONG, 0x25,
- 4, 'L', 'B', 'E', 'Q', LONG, 0x27,
- 4, 'L', 'B', 'G', 'E', LONG, 0x2C,
- 4, 'L', 'B', 'G', 'T', LONG, 0x2E,
- 4, 'L', 'B', 'H', 'I', LONG, 0x22,
- 4, 'L', 'B', 'H', 'S', LONG, 0x24,
- 4, 'L', 'B', 'L', 'E', LONG, 0x2F,
- 4, 'L', 'B', 'L', 'O', LONG, 0x25,
- 4, 'L', 'B', 'L', 'S', LONG, 0x23,
- 4, 'L', 'B', 'L', 'T', LONG, 0x2D,
- 4, 'L', 'B', 'M', 'I', LONG, 0x2B,
- 4, 'L', 'B', 'N', 'E', LONG, 0x26,
- 4, 'L', 'B', 'P', 'L', LONG, 0x2A,
- 4, 'L', 'B', 'R', 'N', LONG, 0x21,
- 4, 'L', 'B', 'V', 'C', LONG, 0x28,
- 4, 'L', 'B', 'V', 'S', LONG, 0x29,
- 4, 'C', 'M', 'P', 'D', ALL, 0x83,
- 4, 'C', 'M', 'P', 'Y', ALL, 0x8C,
- 3, 'L', 'D', 'S', ALL, 0xCE,
- 3, 'L', 'D', 'Y', ALL, 0x8E,
- 3, 'S', 'T', 'S', ALTER, 0xCF,
- 3, 'S', 'T', 'Y', ALTER, 0x8F,
- 4, 'S', 'W', 'I', '2', INHER, 0x3F,
-#endif /* MC6809 */
- 0 /* end of page 1 ops */
-};
-
-PUBLIC char page2ops[] =
-{
-#ifdef MC6809
- 4, 'C', 'M', 'P', 'S', ALL, 0x8C,
- 4, 'C', 'M', 'P', 'U', ALL, 0x83,
- 4, 'S', 'W', 'I', '3', INHER, 0x3F,
-#endif
- 0 /* end of page 2 ops */
-};
-
-#ifdef I80386
-# ifdef MNSIZE
-PUBLIC char bytesizeops[] =
-{
- 4, 'A', 'D', 'C', 'B', GROUP1, 0x10,
- 4, 'A', 'D', 'D', 'B', GROUP1, 0x00,
- 4, 'A', 'N', 'D', 'B', GROUP1, 0x20,
- 4, 'C', 'M', 'P', 'B', GROUP1, CMP_OPCODE_BASE,
- 4, 'D', 'E', 'C', 'b', INCDEC, 0x08,
- 4, 'D', 'I', 'V', 'B', DIVMUL, 0x30,
- 5, 'I', 'D', 'I', 'V', 'B', DIVMUL, 0x38,
- 5, 'I', 'M', 'U', 'L', 'B', IMUL, 0x28,
- 3, 'I', 'N', 'B', IN, 0xEC,
- 4, 'I', 'N', 'C', 'B', INCDEC, 0x00,
- 4, 'M', 'O', 'V', 'B', MOV, 0x88,
- 4, 'M', 'U', 'L', 'B', DIVMUL, 0x20,
- 4, 'N', 'E', 'G', 'B', NEGNOT, 0x18,
- 4, 'N', 'O', 'T', 'B', NEGNOT, 0x10,
- 3, 'O', 'R', 'B', GROUP1, 0x08,
- 4, 'O', 'U', 'T', 'B', OUT, 0xEE,
- 4, 'R', 'C', 'L', 'B', GROUP2, 0x10,
- 4, 'R', 'C', 'R', 'B', GROUP2, 0x18,
- 4, 'R', 'O', 'L', 'B', GROUP2, 0x00,
- 4, 'R', 'O', 'R', 'B', GROUP2, 0x08,
- 4, 'S', 'A', 'L', 'B', GROUP2, 0x20,
- 4, 'S', 'A', 'R', 'B', GROUP2, 0x38,
- 4, 'S', 'H', 'L', 'B', GROUP2, 0x20,
- 4, 'S', 'H', 'R', 'B', GROUP2, 0x28,
- 4, 'S', 'B', 'B', 'B', GROUP1, 0x18,
- 4, 'S', 'U', 'B', 'B', GROUP1, 0x28,
- 5, 'T', 'E', 'S', 'T', 'B', TEST, 0x84,
- 5, 'X', 'C', 'H', 'G', 'B', XCHG, 0x86,
- 4, 'X', 'O', 'R', 'B', GROUP1, 0x30,
- 0 /* end of byte size ops */
-};
-# endif /* MNSIZE */
-#endif /* I80386 */
diff --git a/bin86-0.3/as/macro.c b/bin86-0.3/as/macro.c
deleted file mode 100644
index 103ed08..0000000
--- a/bin86-0.3/as/macro.c
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * bin86/as/macro.c
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-/* macro.c - expand macros for assembler */
-
-#include "const.h"
-#include "type.h"
-#include "globvar.h"
-#include "scan.h"
-#undef EXTERN
-#define EXTERN
-#include "macro.h"
-
-/*
- Enter macro: stack macro and get its parameters.
- Parameters form a linked list of null-terminated strings of form
- next:string. The first string is the macro number in 4 bytes.
-*/
-
-PUBLIC void entermac(symptr)
-struct sym_s *symptr;
-{
- if (maclevel >= MAXMAC)
- error(MACOV);
- else if (macpar + 2 > macptop)
- error(PAROV); /* no room for 0th param */
- /* (2 structs to fit it!) */
- else
- {
- char ch;
- struct schain_s *param1;
- register char *reglineptr;
- register char *stringptr;
-
- ++maclevel;
- (--macstak)->text = (char *) symptr->value_reg_or_op.value;
- macstak->parameters = param1 = macpar;
- param1->next = NULL;
- *(stringptr = build_number(++macnum, 3, param1->string)) = 0;
- macpar = (struct schain_s *) (stringptr + 1);
- /* TODO: alignment */
- getsym();
- if (sym != LPAREN)
- return; /* no other params */
- reglineptr = lineptr;
- stringptr = macpar->string;
- while (TRUE)
- {
- if (stringptr >= (char *) macptop)
- {
- symname = reglineptr;
- error(PAROV);
- return;
- }
- ch = *reglineptr++;
- if (ch == '/')
- /* escaped means no special meaning for slash, comma, paren */
- ch = *reglineptr++;
- else if (ch == ',' || ch == ')')
- {
- if (stringptr >= (char *) macptop)
- {
- symname = reglineptr;
- error(PAROV); /* no room for null */
- return;
- }
- *stringptr = 0;
- param1->next = macpar; /* ptr from previous */
- (param1 = macpar)->next = NULL;
- /* this goes nowhere */
- macpar = (struct schain_s *) (stringptr + 1);
- /* but is finished OK - TODO align */
- stringptr = macpar->string;
- if (ch == ')')
- return;
- continue;
- }
- if ((*stringptr++ = ch) == 0)
- {
- symname = reglineptr;
- error(RPEXP);
- return;
- }
- }
- }
-}
-
-/* MACRO pseudo-op */
-
-PUBLIC void pmacro()
-{
- bool_t saving;
- bool_t savingc;
- struct sym_s *symptr;
-
- saving = /* prepare for bad macro */
- savingc = FALSE; /* normally don't save comments */
- macload = TRUE; /* show loading */
- if (label != NULL)
- error(ILLAB);
- else if (sym != IDENT)
- error(LABEXP);
- else
- {
- symptr = gsymptr;
- if (symptr->type & MNREGBIT)
- error(LABEXP);
- else if (symptr->type & LABIT || symptr->data & FORBIT)
- error(RELAB);
- else if (pass == 0 || symptr->type & REDBIT)
- /* copy on pass 0, also pass 1 if redefined */
- {
- saving = TRUE;
- if (symptr->type & MACBIT)
- symptr->type |= REDBIT;
- else
- symptr->type |= MACBIT;
- symptr->data = UNDBIT; /* undefined till end */
- symptr->value_reg_or_op.value = (unsigned) heapptr;
- /* beginning of store for macro */
- /* value s.b. (char *) */
- getsym_nolookup(); /* test for "C" */
- if (sym == IDENT && lineptr == symname + 1 && *symname == 'C')
- savingc = TRUE;
- }
- }
- while (TRUE)
- {
- skipline();
- listline();
- readline();
- if (!macload)
- break; /* macload cleared to show eof */
- getsym_nolookup();
- if (sym == IDENT)
- {
- if (lineptr == symname + 4 && strncmp(symname, "MEND", 4) == 0)
- break;
- }
- else if (sym != MACROARG)
- {
- if (!savingc)
- continue; /* don't save comment */
- }
- if (!saving)
- continue;
- {
- register char *reglineptr;
- register char *regheapptr;
-
- reglineptr = linebuf;
- regheapptr = heapptr;
- do
- {
- if (regheapptr >= heapend)
- {
- heapptr = regheapptr;
- fatalerror(SYMOV); /* won't fit */
- }
- }
- while ((*regheapptr++ = *reglineptr++) != EOLCHAR);
- heapptr = regheapptr;
- }
- }
- macload = FALSE;
- if (saving)
- {
- *heapptr++ = ETB;
- symptr->data = 0;
- }
-}
diff --git a/bin86-0.3/as/macro.h b/bin86-0.3/as/macro.h
deleted file mode 100644
index 9fdee58..0000000
--- a/bin86-0.3/as/macro.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * bin86/as/macro.h
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-/* macro.h - global variables for macro expansion for assembler */
-
-EXTERN bool_t macflag; /* inside macro flag */
-EXTERN bool_t macload; /* loading macro flag */
-EXTERN unsigned macnum; /* macro call counter */
-
-EXTERN unsigned char maclevel; /* nesting level */
-EXTERN struct schain_s *macpar; /* parameter save buffer */
-EXTERN struct schain_s *macptop; /* top of param buffer (+1) */
-EXTERN struct macro_s *macstak; /* stack ptr */
diff --git a/bin86-0.3/as/mops.c b/bin86-0.3/as/mops.c
deleted file mode 100644
index be4e0f6..0000000
--- a/bin86-0.3/as/mops.c
+++ /dev/null
@@ -1,2840 +0,0 @@
-/*
- * bin86/as/mops.c
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-/* mops.c - handle pseudo-ops */
-
-#include "const.h"
-#include "type.h"
-#include "globvar.h"
-#include "opcode.h"
-#include "scan.h"
-#undef EXTERN
-#define EXTERN
-#include "address.h"
-
-#define is8bitadr(offset) ((offset_t) offset < 0x100)
-#define is8bitsignedoffset(offset) ((offset_t) (offset) + 0x80 < 0x100)
-#define pass2 pass
-
-FORWARD void mshort2 P((void));
-FORWARD reg_pt regchk P((void));
-FORWARD void reldata P((void));
-
-#ifdef I80386
-
-#define iswordadr(offset) ((offset_t) (offset) < 0x10000L)
-#define iswordoffset(offset) ((offset_t) (offset) + 0x8000L < 0x10000L)
-#define iswordorswordoffset(offset) ((offset_t) (offset) + 0xFFFFL < 0x1FFFEL)
-
-#define BYTE_SEGWORD 0x00
-#define isspecreg(r) ((r) >= CR0REG && (r) <= TR7REG)
-
-#define BASE_MASK 0x07
-#define BASE_SHIFT 0
-#define INDEX_MASK 0x38
-#define INDEX_SHIFT 3
-#define MOD_MASK 0xC0
-# define REG_MOD 0xC0
-# define MEM0_MOD 0x00
-# define MEM1_MOD 0x40
-# define MEM2_MOD 0x80
-#define REG_MASK 0x38
-#define REG_SHIFT 3
-#define RM_MASK 0x07
-#define RM_SHIFT 0
-# define D16_RM 0x06
-# define D32_RM 0x05
-# define SIB_NOBASE 0x05
-# define SIB_RM 0x04
-#define SREG_MASK 0x38
-#define SREG_SHIFT 3
-#define SS_MASK 0xC0
-#define SS_SHIFT 6
-
-#define SEGMOV 0x04
-#define SIGNBIT 0x02
-#define TOREGBIT 0x02
-#define WORDBIT 0x01
-
-PRIVATE opcode_t baseind16[] =
-{
- 0x00, /* BP + BP, illegal */
- 0x00, /* BX + BP, illegal */
- 0x03, /* DI + BP */
- 0x02, /* SI + BP */
- 0x00, /* BP + BX, illegal */
- 0x00, /* BX + BX, illegal */
- 0x01, /* DI + BX */
- 0x00, /* SI + BX */
- 0x03, /* BP + DI */
- 0x01, /* BX + DI */
- 0x00, /* DI + DI, illegal */
- 0x00, /* SI + DI, illegal */
- 0x02, /* BP + SI */
- 0x00, /* BX + SI */
- 0x00, /* DI + SI, illegal */
- 0x00, /* SI + SI, illegal */
-};
-
-PRIVATE opcode_t regbits[] =
-{
- 0x05 << REG_SHIFT, /* BP */
- 0x03 << REG_SHIFT, /* BX */
- 0x07 << REG_SHIFT, /* DI */
- 0x06 << REG_SHIFT, /* SI */
-
- 0x00 << REG_SHIFT, /* EAX */
- 0x05 << REG_SHIFT, /* EBP */
- 0x03 << REG_SHIFT, /* EBX */
- 0x01 << REG_SHIFT, /* ECX */
- 0x07 << REG_SHIFT, /* EDI */
- 0x02 << REG_SHIFT, /* EDX */
- 0x06 << REG_SHIFT, /* ESI */
- 0x04 << REG_SHIFT, /* ESP */
-
- 0x00 << REG_SHIFT, /* AX */
- 0x01 << REG_SHIFT, /* CX */
- 0x02 << REG_SHIFT, /* DX */
- 0x04 << REG_SHIFT, /* SP */
-
- 0x04 << REG_SHIFT, /* AH */
- 0x00 << REG_SHIFT, /* AL */
- 0x07 << REG_SHIFT, /* BH */
- 0x03 << REG_SHIFT, /* BL */
- 0x05 << REG_SHIFT, /* CH */
- 0x01 << REG_SHIFT, /* CL */
- 0x06 << REG_SHIFT, /* DH */
- 0x02 << REG_SHIFT, /* DL */
-
- 0x01 << REG_SHIFT, /* CS */
- 0x03 << REG_SHIFT, /* DS */
- 0x00 << REG_SHIFT, /* ES */
- 0x04 << REG_SHIFT, /* FS */
- 0x05 << REG_SHIFT, /* GS */
- 0x02 << REG_SHIFT, /* SS */
-
- 0x00 << REG_SHIFT, /* CR0 */
- 0x02 << REG_SHIFT, /* CR2 */
- 0x03 << REG_SHIFT, /* CR3 */
-
- 0x00 << REG_SHIFT, /* DR0 */
- 0x01 << REG_SHIFT, /* DR1 */
- 0x02 << REG_SHIFT, /* DR2 */
- 0x03 << REG_SHIFT, /* DR3 */
- 0x06 << REG_SHIFT, /* DR6 */
- 0x07 << REG_SHIFT, /* DR7 */
-
- 0x03 << REG_SHIFT, /* TR3 */
- 0x04 << REG_SHIFT, /* TR4 */
- 0x05 << REG_SHIFT, /* TR5 */
- 0x06 << REG_SHIFT, /* TR6 */
- 0x07 << REG_SHIFT, /* TR7 */
-
- 0x00 << REG_SHIFT, /* ST(0) */
- 0x01 << REG_SHIFT, /* ST(1) */
- 0x02 << REG_SHIFT, /* ST(2) */
- 0x03 << REG_SHIFT, /* ST(3) */
- 0x04 << REG_SHIFT, /* ST(4) */
- 0x05 << REG_SHIFT, /* ST(5) */
- 0x06 << REG_SHIFT, /* ST(6) */
- 0x07 << REG_SHIFT, /* ST(7) */
-};
-
-PRIVATE opsize_t regsize[] =
-{
- 2, /* BP */
- 2, /* BX */
- 2, /* DI */
- 2, /* SI */
-
- 4, /* EAX */
- 4, /* EBP */
- 4, /* EBX */
- 4, /* ECX */
- 4, /* EDI */
- 4, /* EDX */
- 4, /* ESI */
- 4, /* ESP */
-
- 2, /* AX */
- 2, /* CX */
- 2, /* DX */
- 2, /* SP */
-
- 1, /* AH */
- 1, /* AL */
- 1, /* BH */
- 1, /* BL */
- 1, /* CH */
- 1, /* CL */
- 1, /* DH */
- 1, /* DL */
-
- 2, /* CS */
- 2, /* DS */
- 2, /* ES */
- 2, /* FS */
- 2, /* GS */
- 2, /* SS */
-
- 4, /* CR0 */
- 4, /* CR2 */
- 4, /* CR3 */
-
- 4, /* DR0 */
- 4, /* DR1 */
- 4, /* DR2 */
- 4, /* DR3 */
- 4, /* DR6 */
- 4, /* DR7 */
-
- 4, /* TR3 */
- 4, /* TR4 */
- 4, /* TR5 */
- 4, /* TR6 */
- 4, /* TR7 */
-
- 10, /* ST(0) */
- 10, /* ST(1) */
- 10, /* ST(2) */
- 10, /* ST(3) */
- 10, /* ST(4) */
- 10, /* ST(5) */
- 10, /* ST(6) */
- 10, /* ST(7) */
-
- 0, /* NOREG */
-};
-
-PRIVATE opcode_t regsegword[] =
-{
- WORDBIT, /* BP */
- WORDBIT, /* BX */
- WORDBIT, /* DI */
- WORDBIT, /* SI */
-
- WORDBIT, /* EAX */
- WORDBIT, /* EBP */
- WORDBIT, /* EBX */
- WORDBIT, /* ECX */
- WORDBIT, /* EDI */
- WORDBIT, /* EDX */
- WORDBIT, /* ESI */
- WORDBIT, /* ESP */
-
- WORDBIT, /* AX */
- WORDBIT, /* CX */
- WORDBIT, /* DX */
- WORDBIT, /* SP */
-
- BYTE_SEGWORD, /* AH */
- BYTE_SEGWORD, /* AL */
- BYTE_SEGWORD, /* BH */
- BYTE_SEGWORD, /* BL */
- BYTE_SEGWORD, /* CH */
- BYTE_SEGWORD, /* CL */
- BYTE_SEGWORD, /* DH */
- BYTE_SEGWORD, /* DL */
-
- SEGMOV, /* CS */
- SEGMOV, /* DS */
- SEGMOV, /* ES */
- SEGMOV, /* FS */
- SEGMOV, /* GS */
- SEGMOV, /* SS */
-
- 0x20, /* CR0 */
- 0x20, /* CR2 */
- 0x20, /* CR3 */
-
- 0x21, /* DR0 */
- 0x21, /* DR1 */
- 0x21, /* DR2 */
- 0x21, /* DR3 */
- 0x21, /* DR6 */
- 0x21, /* DR7 */
-
- 0x24, /* TR3 */
- 0x24, /* TR4 */
- 0x24, /* TR5 */
- 0x24, /* TR6 */
- 0x24, /* TR7 */
-
- 0x00, /* ST(0) */
- 0x00, /* ST(1) */
- 0x00, /* ST(2) */
- 0x00, /* ST(3) */
- 0x00, /* ST(4) */
- 0x00, /* ST(5) */
- 0x00, /* ST(6) */
- 0x00, /* ST(7) */
-
- 0x00, /* NOREG */
-};
-
-PRIVATE opcode_t rm[] =
-{
- 0x05, /* BP */
- 0x03, /* BX */
- 0x07, /* DI */
- 0x06, /* SI */
-
- 0x00, /* EAX */
- 0x05, /* EBP */
- 0x03, /* EBX */
- 0x01, /* ECX */
- 0x07, /* EDI */
- 0x02, /* EDX */
- 0x06, /* ESI */
- 0x04, /* ESP */
-
- 0x00, /* AX */
- 0x01, /* CX */
- 0x02, /* DX */
- 0x04, /* SP */
-
- 0x04, /* AH */
- 0x00, /* AL */
- 0x07, /* BH */
- 0x03, /* BL */
- 0x05, /* CH */
- 0x01, /* CL */
- 0x06, /* DH */
- 0x02, /* DL */
-
- 0x01, /* CS */
- 0x03, /* DS */
- 0x00, /* ES */
- 0x04, /* FS */
- 0x05, /* GS */
- 0x02, /* SS */
-
- 0x00, /* CR0 */
- 0x00, /* CR2 */
- 0x00, /* CR3 */
-
- 0x00, /* DR0 */
- 0x00, /* DR1 */
- 0x00, /* DR2 */
- 0x00, /* DR3 */
- 0x00, /* DR6 */
- 0x00, /* DR7 */
-
- 0x00, /* TR3 */
- 0x00, /* TR4 */
- 0x00, /* TR5 */
- 0x00, /* TR6 */
- 0x00, /* TR7 */
-
- 0x00, /* ST(0) */
- 0x00, /* ST(1) */
- 0x00, /* ST(2) */
- 0x00, /* ST(3) */
- 0x00, /* ST(4) */
- 0x00, /* ST(5) */
- 0x00, /* ST(6) */
- 0x00, /* ST(7) */
-
- 0x04, /* null index reg for sib only */
-};
-
-PRIVATE opcode_t rmfunny[] =
-{
- 0x06, /* BP */
- 0x07, /* BX */
- 0x05, /* DI */
- 0x04, /* SI */
-};
-
-PRIVATE opcode_t segoverride[] =
-{
- 0x2E, /* CS */
- 0x3E, /* DS */
- 0x26, /* ES */
- 0x64, /* FS */
- 0x65, /* GS */
- 0x36, /* SS */
-};
-
-PRIVATE opcode_t ss[] = /* scale to ss bits */
-{
- 0x00, /* x0, illegal */
- 0x00 << SS_SHIFT, /* x1 */
- 0x01 << SS_SHIFT, /* x2 */
- 0x00, /* x3, illegal */
- 0x02 << SS_SHIFT, /* x4 */
- 0x00, /* x5, illegal */
- 0x00, /* x6, illegal */
- 0x00, /* x7, illegal */
- 0x03 << SS_SHIFT, /* x8 */
-};
-
-PRIVATE unsigned char calljmp_kludge;
-PRIVATE opcode_t direction;
-PRIVATE bool_t fpreg_allowed;
-PRIVATE opcode_t segword;
-/*
- Values of segword:
- BYTE_SEGWORD for byte ea's.
- SEGMOV for segment registers
- opcode for special registers
- WORDBIT for other word and dword ea's
-*/
-
-PRIVATE struct ea_s source;
-PRIVATE struct ea_s source2;
-PRIVATE struct ea_s target;
-
-FORWARD void Eb P((struct ea_s *eap));
-FORWARD void Ew P((struct ea_s *eap));
-FORWARD void Ev P((struct ea_s *eap));
-FORWARD void Ex P((struct ea_s *eap));
-FORWARD void Gw P((struct ea_s *eap));
-FORWARD void Gv P((struct ea_s *eap));
-FORWARD void Gx P((struct ea_s *eap));
-FORWARD void buildea P((struct ea_s *eap));
-FORWARD void buildfloat P((void));
-FORWARD void buildfreg P((void));
-FORWARD void buildimm P((struct ea_s *eap, bool_pt signflag));
-FORWARD void buildregular P((void));
-FORWARD void buildsegword P((struct ea_s *eap));
-FORWARD void buildunary P((opcode_pt opc));
-FORWARD opsize_pt displsize P((struct ea_s *eap));
-FORWARD reg_pt fpregchk P((void));
-FORWARD bool_pt getaccumreg P((struct ea_s *eap));
-FORWARD void getbinary P((void));
-FORWARD bool_pt getdxreg P((struct ea_s *eap));
-FORWARD void getea P((struct ea_s *eap));
-FORWARD void getimmed P((struct ea_s *eap, count_t immcount));
-FORWARD void getindirect P((struct ea_s *eap));
-FORWARD void getshift P((struct ea_s *eap));
-FORWARD reg_pt indregchk P((reg_pt matchreg));
-FORWARD void kgerror P((error_pt errnum));
-FORWARD void lbranch P((unsigned backamount));
-FORWARD void notbytesize P((struct ea_s *eap));
-FORWARD void notimmed P((struct ea_s *eap));
-FORWARD void notindirect P((struct ea_s *eap));
-FORWARD void notsegorspecreg P((struct ea_s *eap));
-FORWARD void yesimmed P((struct ea_s *eap));
-FORWARD void yes_samesize P((void));
-
-PRIVATE void Eb(eap)
-register struct ea_s *eap;
-{
- Ex(eap);
- if (eap->size != 0x1)
- {
-#ifndef NODEFAULTSIZE
- if (eap->size == 0x0)
- eap->size = 0x1;
- else
-#endif
- kgerror(ILL_SIZE);
- }
-}
-
-PRIVATE void Ew(eap)
-register struct ea_s *eap;
-{
- Ex(eap);
- if (eap->size != 0x2)
- {
-#ifndef NODEFAULTSIZE
- if (eap->size == 0x0)
- eap->size = 0x2;
- else
-#endif
- kgerror(ILL_SIZE);
- }
-}
-
-PRIVATE void Ev(eap)
-register struct ea_s *eap;
-{
- Ex(eap);
- notbytesize(eap);
-}
-
-PRIVATE void Ex(eap)
-register struct ea_s *eap;
-{
- getea(eap);
- notimmed(eap);
- notsegorspecreg(eap);
-}
-
-PRIVATE void Gd(eap)
-register struct ea_s *eap;
-{
- Gx(eap);
- if (eap->size != 0x4)
- kgerror(ILL_SIZE);
-}
-
-PRIVATE void Gw(eap)
-register struct ea_s *eap;
-{
- Gx(eap);
- if (eap->size != 0x2)
- kgerror(ILL_SIZE);
-}
-
-PRIVATE void Gv(eap)
-register struct ea_s *eap;
-{
- Gx(eap);
- notbytesize(eap);
-}
-
-PRIVATE void Gx(eap)
-register struct ea_s *eap;
-{
- Ex(eap);
- notindirect(eap);
-}
-
-PRIVATE void buildea(eap)
-register struct ea_s *eap;
-{
- opsize_t asize;
-
- ++mcount;
- lastexp = eap->displ;
- if (eap->indcount == 0x0)
- postb = REG_MOD | rm[eap->base];
- else
- {
- if (eap->base == NOREG)
- {
- if (eap->index == NOREG)
- {
- if ((asize = displsize(eap)) > 0x2)
- postb = D32_RM;
- else
- postb = D16_RM;
- }
- else
- {
- asize = 0x4;
- postb = SIB_NOBASE; /* for sib later */
- }
- }
- else
- {
- if (eap->base > MAX16BITINDREG)
- {
- asize = 0x4;
- postb = rm[eap->base];
- }
- else
- {
- asize = 0x2;
- if (!(lastexp.data & UNDBIT) &&
- !iswordorswordoffset(lastexp.offset))
- error(ABOUNDS);
- if (eap->index == NOREG)
- postb = rmfunny[eap->base];
- else if (eap->base <= MAX16BITINDREG)
- postb = baseind16[eap->base + 0x4 * eap->index];
- }
- }
- if (asize != defsize)
- aprefix = 0x67;
- if (eap->base == NOREG)
- mcount += asize;
- else if (lastexp.data & (FORBIT | RELBIT | UNDBIT) ||
- !is8bitsignedoffset(lastexp.offset))
- {
- postb |= MEM2_MOD;
- mcount += asize;
- }
- else if (lastexp.offset != 0x0 ||
- eap->base == BPREG && eap->index == NOREG ||
- eap->base == EBPREG)
- {
- postb |= MEM1_MOD;
- ++mcount;
- }
- if (asize > 0x2 && (eap->base == ESPREG || eap->index != NOREG))
- {
- sib = ss[eap->scale] |
- (rm[eap->index] << INDEX_SHIFT) |
- (postb & RM_MASK);
- postb = (postb & MOD_MASK) | SIB_RM;
- ++mcount;
- }
- }
-}
-
-PRIVATE void buildfloat()
-{
- if (mcount != 0x0)
- {
- buildea(&source);
- oprefix = 0x0;
- postb |= (opcode & 0x07) << REG_SHIFT;
- opcode = ESCAPE_OPCODE_BASE | ((opcode & 0x70) >> 0x4);
- }
-}
-
-PRIVATE void buildfreg()
-{
- mcount += 0x2;
- oprefix = 0x0;
- postb = REG_MOD | ((opcode & 0x07) << REG_SHIFT) | (target.base - ST0REG);
- opcode = ESCAPE_OPCODE_BASE | ((opcode & 0x70) >> 0x4);
-}
-
-PRIVATE void buildimm(eap, signflag)
-register struct ea_s *eap;
-bool_pt signflag;
-{
- immadr = eap->displ;
- immcount = eap->size;
- if (!(immadr.data & (FORBIT | RELBIT | UNDBIT)))
- {
- if (immcount == 0x1)
- {
- if ((offset_t) (immadr.offset + 0x80) >= 0x180)
- datatoobig();
- }
- else if (signflag && is8bitsignedoffset(immadr.offset))
- {
- opcode |= SIGNBIT;
- immcount = 0x1;
- }
- else if (immcount == 0x2)
- {
- if ((offset_t) (immadr.offset + 0x8000L) >= 0x18000L)
- datatoobig();
- }
- }
-}
-
-PRIVATE void buildregular()
-{
- if (mcount != 0x0)
- {
- buildea(&target);
- postb |= regbits[source.base];
- }
-}
-
-/* Check size and build segword. */
-
-PRIVATE void buildsegword(eap)
-register struct ea_s *eap;
-{
- if (eap->size == 0x0)
-#ifdef NODEFAULTSIZE
- kgerror(SIZE_UNK);
-#else
- eap->size = defsize;
-#endif
- if (eap->indcount != 0x0 || eap->base == NOREG)
- {
- segword = WORDBIT;
- if (eap->size == 0x1)
- segword = BYTE_SEGWORD;
- }
- else
- segword = regsegword[eap->base];
-}
-
-PRIVATE void buildunary(opc)
-opcode_pt opc;
-{
- if (mcount != 0x0)
- {
- buildea(&target);
- postb |= opcode;
- opcode = opc;
- }
-}
-
-PRIVATE opsize_pt displsize(eap)
-register struct ea_s *eap;
-{
- opsize_t asize;
-
- asize = defsize;
- if (!(eap->displ.data & UNDBIT))
- {
- if (asize > 0x2)
- {
- if (!(eap->displ.data & (FORBIT | RELBIT)) &&
- iswordadr(eap->displ.offset))
- asize = 0x2;
- }
- else if (!iswordorswordoffset(eap->displ.offset))
- /* should really use iswordadr() */
- /* but compiler generates signed offsets */
- {
- if (!(eap->displ.data & (FORBIT | RELBIT)))
- asize = 0x4;
- else if (pass2)
- error(ABOUNDS);
- }
- }
- return asize;
-}
-
-PRIVATE reg_pt fpregchk()
-{
- reg_pt fpreg;
-
- fpreg_allowed = TRUE;
- fpreg = regchk();
- fpreg_allowed = FALSE;
- if (fpreg != ST0REG)
- return NOREG;
- getsym();
- if (sym == LPAREN)
- {
- getsym();
- if (sym != INTCONST || (unsigned) number >= 0x8)
- error(ILL_FP_REG);
- else
- {
- fpreg += number;
- getsym();
- if (sym != RPAREN)
- error(RPEXP);
- else
- getsym();
- }
- }
- return fpreg;
-}
-
-PRIVATE bool_pt getaccumreg(eap)
-register struct ea_s *eap;
-{
- if ((eap->base = regchk()) != AXREG && eap->base != ALREG
- && eap->base != EAXREG)
- return FALSE;
- getsym();
- if ((eap->size = regsize[eap->base]) > 0x1 && eap->size != defsize)
- oprefix = 0x66;
- return TRUE;
-}
-
-/*
- Get binary ea's in target & source (flipped if direction is set).
- Put size in source if not already.
- Initialise direction, segword, bump mcount.
-*/
-
-PRIVATE void getbinary()
-{
- ++mcount;
- getea(&target);
- if (target.indcount == 0x0 && target.base == NOREG)
- {
- error(ILL_IMM_MODE);
- target.base = AXREG;
- target.size = defsize;
- }
- getcomma();
- getea(&source);
- if (source.size == 0x0)
- source.size = target.size;
- else if (target.size != 0x0 && target.size != source.size)
- {
- kgerror(MISMATCHED_SIZE);
- return;
- }
- if (source.indcount == 0x0 && regsegword[target.base] < SEGMOV)
- direction = 0x0;
- else if (target.indcount == 0x0 && regsegword[source.base] < SEGMOV)
- {
- struct ea_s swap;
-
- direction = TOREGBIT;
- swap = source;
- source = target;
- target = swap;
- }
- else if (target.indcount != 0x0)
- {
- kgerror(ILL_IND_TO_IND);
- return;
- }
- else
- {
- kgerror(ILL_SEG_REG);
- return;
- }
- buildsegword(&source);
-}
-
-PRIVATE bool_pt getdxreg(eap)
-register struct ea_s *eap;
-{
- if ((eap->base = regchk()) != DXREG)
- return FALSE;
- getsym();
- return TRUE;
-}
-
-/* parse effective address */
-
-/*
- Syntax is restrictive in that displacements must be in the right spots
- and will not be added up.
-
- optional size-type prefix, which is
- BYTE
- BYTE PTR
- WORD
- WORD PTR
- DWORD
- DWORD PTR
- PTR
- reg
- segreg
- [scaled index]
- where scaled index =
- indreg
- indreg*scale
- indreg+indreg
- indreg+indreg*scale
- [scaled index+displ]
- [scaled index-displ]
- optional-immediate-prefix displ[scaled index]
- [displ]
- optional-imediate-prefix displ
- (scaled index) -- anachronism
- optional-imediate-prefix displ(scaled index) -- anachronism
-*/
-
-PRIVATE void getea(eap)
-register struct ea_s *eap;
-{
- bool_t leading_displ;
- bool_t leading_immed;
- register struct sym_s *symptr;
-
- leading_immed = leading_displ = lastexp.data = eap->indcount
- = lastexp.offset = 0x0;
- eap->index = eap->base = NOREG;
- eap->scale = 0x1;
- eap->size = mnsize; /* 0x1 for byte ops, else 0x0 */
-
- if (sym == IDENT)
- {
- if ((symptr = gsymptr)->type & MNREGBIT)
- {
- if (symptr->data & SIZEBIT)
- {
- getsym();
- if (symptr->value_reg_or_op.op.opcode == 0x0)
- eap->indcount = 0x2 - calljmp_kludge;
- else
- {
- if (eap->size != 0x0)
- {
- if (eap->size != symptr->value_reg_or_op.op.opcode)
- error(MISMATCHED_SIZE);
- }
- else
- eap->size = symptr->value_reg_or_op.op.opcode;
- if (eap->size > 0x1 && eap->size != defsize)
- oprefix = 0x66;
- if (sym == IDENT &&
- (symptr = gsymptr)->type & MNREGBIT &&
- symptr->data & SIZEBIT &&
- symptr->value_reg_or_op.op.routine == PTROP)
- {
- getsym();
- eap->indcount = 0x2 - calljmp_kludge;
- }
- }
- }
- }
- if (!(symptr->type & (LABIT | MACBIT | MNREGBIT | VARBIT)))
- symptr->data |= FORBIT; /* show seen in advance */
- }
- if ((eap->base = regchk()) != NOREG)
- {
- getsym();
- if (eap->indcount != 0x0)
- {
- error(ILL_IND_PTR);
- eap->indcount = 0x0;
- }
- if (eap->size != 0x0 && eap->size != regsize[eap->base])
- error(MISMATCHED_SIZE);
- if ((eap->size = regsize[eap->base]) > 0x1 && eap->size != defsize)
- oprefix = 0x66;
- eap->displ = lastexp;
- return;
- }
- if (sym != lindirect)
- {
- if (sym == IMMEDIATE || sym == STAR)
- {
- /* context-sensitive, STAR means signed immediate here */
- leading_immed = TRUE;
- getsym();
- }
- leading_displ = TRUE;
- expres();
- eap->displ = lastexp;
- }
- if (sym == lindirect)
- {
- getsym();
- eap->indcount = 0x2 - calljmp_kludge;
- if ((eap->base = indregchk(NOREG)) != NOREG)
- {
- if (eap->indcount == 0x0 && leading_displ)
- error(IND_REQ);
- getsym();
- if (sym == ADDOP)
- {
- getsym();
- if ((eap->index = indregchk(eap->base)) != NOREG)
- getsym();
- else
- {
- if (eap->indcount == 0x0)
- error(IND_REQ);
- if (leading_displ)
- error(REPEATED_DISPL);
- expres(); /* this eats ADDOP, SUBOP, MULOP */
- }
- }
- if (sym == STAR)
- {
- /* context-sensitive, STAR means scaled here*/
- if (eap->index == NOREG && eap->base == ESPREG)
- {
- error(INDEX_REG_EXP);
- eap->base = EAXREG;
- }
- getsym();
- factor();
- chkabs();
- if (!(lastexp.data & UNDBIT) && lastexp.offset != 0x1)
- {
- if (eap->base <= MAX16BITINDREG ||
- lastexp.offset != 0x2 && lastexp.offset != 0x4 &&
- lastexp.offset != 0x8)
- error(ILL_SCALE);
- else
- {
- eap->scale = lastexp.offset;
- if (eap->index == NOREG)
- {
- eap->index = eap->base;
- eap->base = NOREG;
- }
- }
- }
- lastexp.data = lastexp.offset = 0x0;
- }
- if ((sym == ADDOP || sym == SUBOP))
- {
- if (eap->indcount == 0x0)
- error(IND_REQ);
- if (leading_displ)
- error(REPEATED_DISPL);
- expres();
- }
- }
- else
- {
- if (leading_displ)
- error(REPEATED_DISPL);
- expres();
- }
- if (sym != rindirect)
- error(rindexp);
- else
- getsym();
- }
- else if (!leading_immed && idefsize <= 0x2)
- eap->indcount = 0x1; /* compatibility kludge */
- if (!leading_displ)
- eap->displ = lastexp;
-}
-
-PRIVATE void getimmed(eap, immcount)
-struct ea_s *eap;
-count_t immcount;
-{
- getea(eap);
- yesimmed(eap);
- if (mcount != 0x0)
- {
- eap->size = immcount;
- buildimm(eap, FALSE);
- }
-}
-
-PRIVATE void getindirect(eap)
-register struct ea_s *eap;
-{
- getea(eap);
- if (eap->indcount == 0x0)
- kgerror(IND_REQ);
-}
-
-PRIVATE void getshift(eap)
-register struct ea_s *eap;
-{
- getcomma();
- getea(eap);
- if (eap->base != CLREG)
- yesimmed(eap);
-}
-
-/*
- Check if current symbol is a compatible index register.
- Generate error if it is a reg but not a compatible index.
- Return register number (adjusted if necessary to a legal index) or NOREG.
-*/
-
-PRIVATE reg_pt indregchk(matchreg)
-reg_pt matchreg;
-{
- reg_pt reg;
-
- if ((reg = regchk()) != NOREG)
- {
- switch (matchreg)
- {
- case BPREG:
- case BXREG:
- if (reg != DIREG && reg != SIREG)
- {
- reg = SIREG;
- error(INDEX_REG_EXP);
- }
- break;
- case DIREG:
- case SIREG:
- if (reg != BPREG && reg != BXREG)
- {
- reg = BXREG;
- error(INDEX_REG_EXP);
- }
- break;
- case NOREG:
- break;
- default:
- if (reg <= MAX16BITINDREG || reg == ESPREG)
- {
- reg = EAXREG;
- error(INDEX_REG_EXP);
- }
- break;
- }
- if (reg > MAXINDREG && calljmp_kludge == 0x0)
- {
- if (matchreg != NOREG)
- reg = EAXREG;
- else
- reg = BXREG;
- error(INDEX_REG_EXP);
- }
- }
- return reg;
-}
-
-PRIVATE void kgerror(errnum)
-error_pt errnum;
-{
- error(errnum);
- sprefix = oprefix = aprefix = mcount = 0x0;
-}
-
-PRIVATE void lbranch(backamount)
-unsigned backamount;
-{
- mcount += defsize + 0x1;
- if (pass2)
- {
- reldata();
- if (!(lastexp.data & (RELBIT | UNDBIT)))
- {
- lastexp.offset = lastexp.offset - lc - lcjump;
- if (backamount != 0x0 && !(lastexp.data & IMPBIT) &&
- lastexp.offset + backamount < 0x80 + backamount)
- error(SHORTB); /* -0x8? to 0x7F, warning */
- }
- }
-}
-
-/* BCC (long branches emulated by short branch over & long jump) */
-
-PUBLIC void mbcc()
-{
- getea(&target);
- if (target.indcount >= 0x2 || target.base != NOREG)
- kgerror(REL_REQ);
- else
- {
- if (defsize != 0x2)
- {
- page = PAGE1_OPCODE;
- ++mcount;
- opcode += 0x10;
- lbranch(0x84);
- }
- else
- {
- aprefix = opcode ^ 0x1; /* kludged storage for short branch
- over */
- oprefix = defsize + 0x1;
- mcount += 0x2;
- opcode = JMP_OPCODE;
- lbranch(0x83);
- mcount -= 0x2;
- }
- }
-}
-
-/* bswap r32 */
-
-PUBLIC void mbswap()
-{
- ++mcount;
- Gd(&target);
- opcode |= rm[target.base];
-}
-
-/* BR, CALL, J, JMP */
-
-PUBLIC void mcall()
-{
- opcode_pt far;
- bool_t indirect;
- register struct sym_s *symptr;
-
- far = 0x0;
- if (sym == IDENT && (symptr = gsymptr)->type & MNREGBIT &&
- symptr->data & SIZEBIT &&
- symptr->value_reg_or_op.op.routine == FAROP)
- {
- far = 0x8;
- getsym();
- }
- indirect = FALSE;
- if (asld_compatible && idefsize <= 0x2)
- {
- calljmp_kludge = 0x2;
- if (sym == INDIRECT)
- {
- calljmp_kludge = 0x0;
- indirect = TRUE;
- getsym();
- }
- }
- getea(&target);
- if (indirect && target.indcount == 0x1)
- target.indcount = 0x2;
- calljmp_kludge = 0x0;
- if (sym == COLON)
- {
- if (opcode == JMP_SHORT_OPCODE)
- opcode = JMP_OPCODE;
- ++mcount;
- yesimmed(&target);
- getsym();
- getea(&source);
- yesimmed(&source);
- if (mcount != 0x0)
- {
- if (opcode == JMP_OPCODE)
- opcode = 0xEA;
- else
- opcode = 0x9A;
- lastexp = source.displ;
- if (!(lastexp.data & (FORBIT | RELBIT | UNDBIT)) &&
- defsize == 0x2 &&
- (offset_t) (lastexp.offset + 0x8000L) >= 0x18000L)
- datatoobig();
- mcount += defsize;
- target.size = 0x2;
- buildimm(&target, FALSE);
- }
- }
- else if (target.indcount >= 0x2 || target.base != NOREG)
- {
- ++mcount;
- notsegorspecreg(&target);
- if (target.indcount == 0)
- notbytesize(&target);
- if (mcount != 0x0)
- {
- if (opcode == JMP_SHORT_OPCODE)
- opcode = JMP_OPCODE;
- buildea(&target);
- if (opcode == JMP_OPCODE)
- opcode = 0x20;
- else
- opcode = 0x10;
- postb |= opcode + far;
- opcode = 0xFF;
- }
- }
- else if (opcode == JMP_SHORT_OPCODE)
- {
- if (jumps_long)
- {
- opcode = JMP_OPCODE;
- lbranch(0x83);
- }
- else
- {
- lastexp = target.displ;
- if (lastexp.data & IMPBIT)
- {
- error(NONIMPREQ);
- lastexp.data = FORBIT | UNDBIT;
- }
- mshort2();
- }
- }
- else
- lbranch(opcode == JMP_OPCODE ? 0x83 : 0x0);
-}
-
-/* CALLI, JMPI */
-
-PUBLIC void mcalli()
-{
- bool_t indirect;
-
- ++mcount;
- indirect = FALSE;
- if (sym == INDIRECT)
- {
- getsym();
- indirect = TRUE;
- }
- getea(&target);
- if (target.indcount >= 0x2 || target.base != NOREG)
- indirect = TRUE;
- if (indirect)
- {
- buildea(&target);
- if (opcode == 0xEA)
- opcode = 0x28;
- else
- opcode = 0x18;
- postb |= opcode;
- opcode = 0xFF;
- }
- else
- {
- getcomma();
- getea(&source);
- yesimmed(&source);
- if (mcount != 0x0)
- {
- lastexp = target.displ;
- if (!(lastexp.data & (FORBIT | RELBIT | UNDBIT)) &&
- defsize == 0x2 &&
- (offset_t) (lastexp.offset + 0x8000L) >= 0x18000L)
- datatoobig();
- mcount += defsize;
- source.size = 0x2;
- buildimm(&source, FALSE);
- }
- }
-}
-
-/* DIV, IDIV, MUL */
-
-PUBLIC void mdivmul()
-{
- if (getaccumreg(&source))
- {
- ++mcount;
- getcomma();
- Ex(&target);
- yes_samesize();
- buildunary(0xF6 | regsegword[source.base]);
- }
- else
- mnegnot();
-}
-
-/* ENTER */
-
-PUBLIC void menter()
-{
- ++mcount;
- getimmed(&target, 0x2);
- getcomma();
- getimmed(&source, 0x1);
- if (mcount != 0x0)
- {
- mcount += 2;
- lastexp = target.displ; /* getimmed(&source) wiped it out */
- }
-}
-
-/* arpl r/m16,r16 (Intel manual opcode chart wrongly says EwRw) */
-
-PUBLIC void mEwGw()
-{
- ++mcount;
- Ew(&target);
- getcomma();
- Gw(&source);
- oprefix = 0x0;
- buildregular();
-}
-
-/* [cmpxchg xadd] [r/m8,r8 r/m16,r16, r/m32,r32] */
-
-PUBLIC void mExGx()
-{
- ++mcount;
- Ex(&target);
- getcomma();
- Gx(&source);
- yes_samesize();
- opcode |= segword;
- buildregular();
-}
-
-PUBLIC void mf_inher()
-{
- mcount += 0x2;
- postb = REG_MOD | (opcode & ~REG_MOD);
- opcode = ESCAPE_OPCODE_BASE | (opcode >> 0x6);
- if (opcode == ESCAPE_OPCODE_BASE)
- opcode = ESCAPE_OPCODE_BASE | 0x6; /* fix up encoding of fcompp */
-}
-
-/* [fldenv fnsave fnstenv frstor] mem */
-
-PUBLIC void mf_m()
-{
- ++mcount;
- getindirect(&source);
- if (source.size != 0x0)
- kgerror(ILL_SIZE);
- buildfloat();
-}
-
-/* [fldcw fnstcw] mem2i */
-
-PUBLIC void mf_m2()
-{
- ++mcount;
- getindirect(&source);
- if (source.size != 0x0 && source.size != 0x2)
- kgerror(ILL_SIZE);
- buildfloat();
-}
-
-/* fnstsw [mem2i ax] */
-
-PUBLIC void mf_m2_ax()
-{
- if (getaccumreg(&target))
- {
- if (target.base != AXREG)
- kgerror(ILLREG);
- else
- {
- opcode = 0x74;
- target.base = ST0REG; /* fake, really ax */
- buildfreg();
- }
- }
- else
- mf_m2();
-}
-
-/* [fiadd ficom ficomp fidiv fidivr fimul fist fisub fisubr] [mem2i mem4i] */
-
-PUBLIC void mf_m2_m4()
-{
- ++mcount;
- getindirect(&source);
- if (source.size == 0x0)
- kgerror(SIZE_UNK);
- else if (source.size == 0x2)
- opcode |= 0x40;
- else if (source.size != 0x4)
- kgerror(ILL_SIZE);
- buildfloat();
-}
-
-/* [fild fistp] [mem2i mem4i mem8i] */
-
-PUBLIC void mf_m2_m4_m8()
-{
- ++mcount;
- getindirect(&source);
- if (source.size == 0x0)
- kgerror(SIZE_UNK);
- else if (source.size == 0x2)
- opcode |= 0x40;
- else if (source.size == 0x8)
- opcode |= 0x45; /* low bits 0 -> 5 and 3 -> 7 */
- else if (source.size != 0x4)
- kgerror(ILL_SIZE);
- buildfloat();
-}
-
-/* [fcom fcomp] [mem4r mem8r optional-st(i)] */
-
-PUBLIC void mf_m4_m8_optst()
-{
- if (sym == EOLSYM)
- {
- target.base = ST1REG;
- buildfreg();
- }
- else
- mf_m4_m8_st();
-}
-
-/* [fadd fdiv fdivr fmul fsub fsubr] [mem4r mem8r st,st(i) st(i),st] */
-
-PUBLIC void mf_m4_m8_stst()
-{
- target.base = fpregchk();
- if (target.base != NOREG)
- {
- getcomma();
- source.base = fpregchk();
- if (source.base == NOREG)
- {
- error(FP_REG_REQ);
- source.base = ST0REG;
- }
- if (target.base == ST0REG)
- target.base = source.base;
- else
- {
- if (source.base != ST0REG)
- error(ILL_FP_REG_PAIR);
- opcode |= 0x40;
- if ((opcode & 0x07) >= 0x4)
- opcode ^= 0x01; /* weird swap of fdiv/fdivr, fsub/fsubr */
- }
- buildfreg();
- }
- else
- {
- ++mcount;
- getindirect(&source);
- if (source.size == 0x0)
- kgerror(SIZE_UNK);
- else if (source.size == 0x8)
- opcode |= 0x40;
- else if (source.size != 0x4)
- kgerror(ILL_SIZE);
- buildfloat();
- }
-}
-
-/* fst [mem4r mem8r st(i)] */
-
-PUBLIC void mf_m4_m8_st()
-{
- target.base = fpregchk();
- if (target.base != NOREG)
- {
- if (opcode == FST_ENCODED)
- opcode |= 0x40;
- buildfreg();
- }
- else
- {
- ++mcount;
- getindirect(&source);
- if (source.size == 0x0)
- kgerror(SIZE_UNK);
- else if (source.size == 0x8)
- opcode |= 0x40;
- else if (source.size != 0x4)
- kgerror(ILL_SIZE);
- buildfloat();
- }
-}
-
-/* [fld fstp] [mem4r mem8r mem10r st(i)] */
-
-PUBLIC void mf_m4_m8_m10_st()
-{
- target.base = fpregchk();
- if (target.base != NOREG)
- {
- if (opcode == FSTP_ENCODED)
- opcode |= 0x40;
- buildfreg();
- }
- else
- {
- ++mcount;
- getindirect(&source);
- if (source.size == 0x0)
- kgerror(SIZE_UNK);
- else if (source.size == 0x8)
- opcode |= 0x40;
- else if (source.size == 0xA)
- opcode |= 0x25; /* low bits 0 -> 5 and 3 -> 7 */
- else if (source.size != 0x4)
- kgerror(ILL_SIZE);
- buildfloat();
- }
-}
-
-/* [fbld fbstp] mem10r */
-
-PUBLIC void mf_m10()
-{
- ++mcount;
- getindirect(&source);
- if (source.size != 0xA)
- kgerror(ILL_SIZE);
- buildfloat();
-}
-
-/* ffree st(i) */
-
-PUBLIC void mf_st()
-{
- target.base = fpregchk();
- if (target.base == NOREG)
- kgerror(FP_REG_REQ);
- buildfreg();
-}
-
-/* [fucom fucomp fxch] optional-st(i) */
-
-PUBLIC void mf_optst()
-{
- if (sym == EOLSYM)
- {
- target.base = ST1REG;
- buildfreg();
- }
- else
- mf_st();
-}
-
-/* [faddp fdivp fdivrp fmulp fsubp fsubrp] st(i),st */
-
-PUBLIC void mf_stst()
-{
- target.base = fpregchk();
- if (target.base == NOREG)
- {
- kgerror(FP_REG_REQ);
- return;
- }
- getcomma();
- source.base = fpregchk();
- if (source.base == NOREG)
- {
- kgerror(FP_REG_REQ);
- return;
- }
- if (source.base != ST0REG)
- {
- kgerror(ILL_FP_REG);
- return;
- }
- buildfreg();
-}
-
-PUBLIC void mf_w_inher()
-{
- sprefix = WAIT_OPCODE;
- mf_inher();
-}
-
-/* [fsave fstenv] mem */
-
-PUBLIC void mf_w_m()
-{
- sprefix = WAIT_OPCODE;
- mf_m();
-}
-
-/* fstcw mem2i */
-
-PUBLIC void mf_w_m2()
-{
- sprefix = WAIT_OPCODE;
- mf_m2();
-}
-
-/* fstsw [mem2i ax] */
-
-PUBLIC void mf_w_m2_ax()
-{
- sprefix = WAIT_OPCODE;
- mf_m2_ax();
-}
-
-/* ADC, ADD, AND, CMP, OR, SBB, SUB, XOR */
-
-PUBLIC void mgroup1()
-{
- getbinary();
- notsegorspecreg(&source);
- if (mcount != 0x0)
- {
- if (source.base == NOREG)
- {
- if (target.indcount == 0x0 && (target.base == ALREG ||
- target.base == AXREG ||
- target.base == EAXREG &&
- (source.displ.data & (FORBIT | RELBIT | UNDBIT) ||
- !is8bitsignedoffset(source.displ.offset))))
- {
- opcode |= 0x04 | segword;
- buildimm(&source, FALSE);
- }
- else
- {
- buildunary(0x80 | segword);
- buildimm(&source, TRUE);
- }
- }
- else
- {
- opcode |= direction | segword;
- buildregular();
- }
- }
-}
-
-/* RCL, RCR, ROL, ROR, SAL, SAR, SHL, SHR */
-
-PUBLIC void mgroup2()
-{
- ++mcount;
- Ex(&target);
- buildsegword(&target);
- getshift(&source);
- if (mcount != 0x0)
- {
- buildunary(0xD0 | segword);
- if (source.base == CLREG)
- opcode |= 0x2;
- else if (source.displ.offset != 0x1)
- {
- opcode -= 0x10;
- source.size = 0x1;
- buildimm(&source, FALSE);
- }
- }
-}
-
-/* LLDT, LTR, SLDT, STR, VERR, VERW */
-
-PUBLIC void mgroup6()
-{
- ++mcount;
- Ew(&target);
- oprefix = 0x0;
- buildunary(0x0);
-}
-
-/* INVLPG, LGDT, LIDT, LMSW, SGDT, SIDT, SMSW */
-
-PUBLIC void mgroup7()
-{
- ++mcount;
- if (opcode == 0x20 || opcode == 0x30)
- {
- Ew(&target);
- oprefix = 0x0;
- }
- else
- {
- getindirect(&target);
- oprefix = 0x0;
- if (target.size != 0x0 && target.size != 0x6)
- error(MISMATCHED_SIZE); /* XXX - size 6 wrong for INVLPG? */
- }
- buildunary(0x1);
-}
-
-/* BT, BTR, BTS, BTC */
-
-PUBLIC void mgroup8()
-{
- ++mcount;
- Ev(&target);
- getcomma();
- /* Gv or Ib */
- getea(&source);
- notindirect(&source);
- notsegorspecreg(&source);
- if (mcount != 0x0)
- {
- if (source.base == NOREG)
- {
- buildunary(0xBA);
- source.size = 0x1;
- buildimm(&source, TRUE);
- }
- else
- {
- yes_samesize();
- opcode += 0x83;
- buildregular();
- }
- }
-}
-
-/* BSF, BSR, LAR, LSL (Intel manual opcode chart wrongly says GvEw for L*) */
-
-PUBLIC void mGvEv()
-{
- ++mcount;
- Gv(&source);
- getcomma();
- Ev(&target);
- yes_samesize();
- buildregular();
-}
-
-/* bound [r16,m16&16 r32,m32&32] */
-
-PUBLIC void mGvMa()
-{
- ++mcount;
- Gv(&source);
- getcomma();
- getindirect(&target);
- yes_samesize();
- buildregular();
-}
-
-/* LDS, LES, LFS, LGS, LSS */
-
-PUBLIC void mGvMp()
-{
- ++mcount;
- Gv(&source);
- getcomma();
- getindirect(&target);
- if (target.size != 0x0 && target.size != 0x2 + source.size)
- error(MISMATCHED_SIZE);
- buildregular();
-}
-
-/* IMUL */
-
-PUBLIC void mimul()
-{
- ++mcount;
- Ex(&target);
- if (sym != COMMA)
- {
- buildsegword(&target);
- buildunary(0xF6 | segword);
- return;
- }
- getcomma();
- notindirect(&target);
- source = target; /* direction is swapped */
- getea(&target);
- notsegorspecreg(&target);
- yes_samesize();
- if (sym != COMMA && (target.indcount != 0x0 || target.base != NOREG))
- {
- page = PAGE1_OPCODE;
- ++mcount;
- opcode = 0xAF;
- buildregular();
- }
- else
- {
- if (sym == COMMA)
- {
- getsym();
- getea(&source2);
- yesimmed(&source2);
- }
- else
- {
- source2 = target;
- target = source;
- }
- source2.size = target.size;
- if (is8bitsignedoffset(source2.displ.offset))
- {
- source2.size = 0x1;
- opcode = 0x6B;
- }
- else
- {
- source2.size = target.size;
- opcode = 0x69;
- }
- buildregular();
- if (mcount != 0x0)
- buildimm(&source2, FALSE);
- }
-}
-
-/* IN */
-
-PUBLIC void min()
-{
- ++mcount;
- if (opcode & WORDBIT) /* inw; ind not supported */
- mnsize = 0x2;
- if (sym == EOLSYM && mnsize != 0x0)
- target.size = mnsize;
- else
- {
- if (getaccumreg(&target))
- {
- if (mnsize != 0x0 && regsize[target.base] != mnsize)
- error(MISMATCHED_SIZE);
- getcomma();
- }
- else
- target.size = regsize[target.base = mnsize < 0x2 ? ALREG : AXREG];
- opcode |= regsegword[target.base];
- if (!getdxreg(&source))
- {
- getimmed(&source, 0x1);
- opcode -= 0x8;
- }
- }
- if (target.size > 0x1 && target.size != defsize)
- oprefix = 0x66;
-}
-
-/* DEC, INC */
-
-PUBLIC void mincdec()
-{
- ++mcount;
- Ex(&target);
- buildsegword(&target);
- if (target.indcount == 0x0 && segword == WORDBIT)
- opcode |= 0x40 | rm[target.base];
- else
- buildunary(0xFE | segword);
-}
-
-/* CBW, CWD, CMPSW, INSW, IRET, LODSW, POPA, POPF, PUSHA, PUSHF */
-/* MOVSW, OUTSW, SCASW, STOSW */
-
-PUBLIC void minher16()
-{
- minher();
- if (defsize != 0x2)
- oprefix = 0x66;
-}
-
-/* CWDE, CDQ, CMPSD, INSD, IRETD, LODSD, POPAD, POPFD, PUSHAD, PUSHFD */
-/* MOVSD, OUTSD, SCASD, STOSD */
-
-PUBLIC void minher32()
-{
- minher();
- if (defsize != 0x4)
- oprefix = 0x66;
-}
-
-/* AAD, AAM */
-
-PUBLIC void minhera()
-{
- ++mcount;
- if (sym == EOLSYM)
- {
- target.displ.offset = 0xA;
- target.size = 0x1;
- buildimm(&target, FALSE);
- }
- else
- getimmed(&target, 0x1);
-}
-
-/* INT */
-
-PUBLIC void mint()
-{
- ++mcount;
- getimmed(&target, 0x1);
- if (!(immadr.data & (FORBIT | RELBIT | UNDBIT)) &&
- (opcode_t) immadr.offset == 0x3)
- {
- immcount = 0x0;
- opcode = 0xCC;
- }
-}
-
-/* JCC */
-
-PUBLIC void mjcc()
-{
- if (jumps_long && opcode < 0x80) /* above 0x80 means loop - not long */
- mbcc();
- else
- mshort();
-}
-
-/* JCXZ, JECXZ */
-
-PUBLIC void mjcxz()
-{
- if (opcode != defsize)
- {
- aprefix = 0x67;
- ++mcount; /* quick fix - mshort() needs to know */
- }
- opcode = 0xE3;
- mshort();
- if (aprefix != 0x0)
- --mcount; /* quick fix - main routine bumps it again */
-}
-
-/* LEA */
-
-PUBLIC void mlea()
-{
- Gv(&source); /* back to front */
- getcomma();
- ++mcount;
- getindirect(&target);
- yes_samesize();
- buildregular();
-}
-
-/* MOV */
-
-PUBLIC void mmov()
-{
- getbinary();
- if (segword >= SEGMOV)
- {
- oprefix = 0x0;
- notimmed(&source);
- if (segword > SEGMOV) /* special reg */
- notindirect(&target);
- }
- if (mcount != 0x0)
- {
- if (target.base == NOREG && target.index == NOREG &&
- (source.base == ALREG || source.base == AXREG ||
- source.base == EAXREG))
- {
- opcode = 0xA0 | (direction ^ TOREGBIT) | segword;
- lastexp = target.displ;
- if ((source.size = displsize(&target)) != defsize)
- aprefix = 0x67;
- mcount += source.size;
- }
- else if (source.base == NOREG)
- {
- if (target.indcount == 0x0)
- opcode = 0xB0 | (segword << 0x3) | rm[target.base];
- else
- {
- buildea(&target);
- opcode = 0xC6 | segword;
- }
- buildimm(&source, FALSE);
- }
- else
- {
- if (isspecreg(source.base))
- {
- page = PAGE1_OPCODE;
- ++mcount;
- opcode = 0x0;
- }
- opcode |= direction | segword;
- buildregular();
- }
- }
-}
-
-/* MOVSX, MOVZX */
-
-PUBLIC void mmovx()
-{
- ++mcount;
- Gv(&source);
- getcomma();
- Ex(&target);
- if (target.size == 0x0)
- kgerror(SIZE_UNK);
- if (target.size > 0x2)
- kgerror(ILL_SIZE);
- oprefix = 0x0;
- if (source.size != defsize)
- oprefix = 0x66;
- buildsegword(&target);
- opcode |= segword;
- buildregular();
-}
-
-/* NEG, NOT */
-
-PUBLIC void mnegnot()
-{
- ++mcount;
- Ex(&target);
- buildsegword(&target);
- buildunary(0xF6 | segword);
-}
-
-/* OUT */
-
-PUBLIC void mout()
-{
- ++mcount;
- if (opcode & WORDBIT) /* outw; outd not supported */
- mnsize = 0x2;
- if (sym == EOLSYM && mnsize != 0x0)
- source.size = mnsize;
- else
- {
- if (!getdxreg(&target))
- {
- getimmed(&target, 0x1);
- opcode -= 0x8;
- }
- if (sym == COMMA)
- {
- getsym();
- if (!getaccumreg(&source))
- kgerror(AL_AX_EAX_EXP);
- else if (mnsize != 0x0 && regsize[source.base] != mnsize)
- error(MISMATCHED_SIZE);
- }
- else
- source.size = regsize[source.base = mnsize < 0x2 ? ALREG : AXREG];
- opcode |= regsegword[source.base];
- }
- if (source.size > 0x1 && source.size != defsize)
- oprefix = 0x66;
-}
-
-/* POP, PUSH */
-
-PUBLIC void mpushpop()
-{
- opcode_t oldopcode;
-
- ++mcount;
- getea(&target);
- buildsegword(&target);
- notbytesize(&target);
- if ((oldopcode = opcode) == POP_OPCODE)
- {
- notimmed(&target);
- if (target.base == CSREG)
- kgerror(ILL_SEG_REG);
- }
- if (mcount != 0x0)
- {
- if (target.indcount == 0x0)
- {
- if (segword == SEGMOV)
- {
- switch (target.base)
- {
- case CSREG:
- opcode = 0x0E;
- break;
- case DSREG:
- opcode = 0x1E;
- break;
- case ESREG:
- opcode = 0x06;
- break;
- case SSREG:
- opcode = 0x16;
- break;
- case FSREG:
- opcode = 0xA0;
- page = PAGE1_OPCODE;
- ++mcount;
- break;
- case GSREG:
- opcode = 0xA8;
- page = PAGE1_OPCODE;
- ++mcount;
- break;
- }
- if (oldopcode == POP_OPCODE)
- ++opcode;
- }
- else if (target.base != NOREG)
- {
- opcode = 0x50 | rm[target.base];
- if (oldopcode == POP_OPCODE)
- opcode |= 0x8;
- }
- else
- {
- opcode = 0x68;
- if (oldopcode == POP_OPCODE)
- ++opcode;
- buildimm(&target, TRUE);
- }
- }
- else
- {
- buildea(&target);
- if (oldopcode == PUSH_OPCODE)
- postb |= 0x6 << REG_SHIFT;
- }
- }
-}
-
-/* RET, RETF */
-
-PUBLIC void mret()
-{
- ++mcount;
- if (sym != EOLSYM)
- {
- --opcode;
- getimmed(&target, 0x2);
- }
-}
-
-/* SEG CS/DS/ES/FS/GS/SS */
-
-PUBLIC void mseg()
-{
- reg_pt reg;
-
- if (regsegword[reg = regchk()] != SEGMOV)
- error(SEG_REG_REQ);
- else
- {
- getsym();
- ++mcount;
- opcode = (segoverride - CSREG)[reg];
- }
-}
-
-/* SETCC */
-
-PUBLIC void msetcc()
-{
- ++mcount;
- Eb(&target);
- if (mcount != 0x0)
- buildea(&target);
-}
-
-/* SHLD, SHRD */
-
-PUBLIC void mshdouble()
-{
- ++mcount;
- Ev(&target);
- getcomma();
- Gv(&source);
- yes_samesize();
- buildregular();
- getshift(&source2);
- lastexp = target.displ; /* getshift() wiped it out */
- if (mcount != 0x0)
- {
- if (source2.base == CLREG)
- opcode |= 0x1;
- else
- {
- source2.size = 0x1;
- buildimm(&source2, FALSE);
- }
- }
-}
-
-/*
- TEST
- Similar to the regular group1 operators.
- It does not allow the sign extended immediate byte forms
- and does not use the relevant direction bit.
-*/
-
-PUBLIC void mtest()
-{
- getbinary();
- notsegorspecreg(&source);
- if (source.base == NOREG)
- {
- if (mcount != 0x0)
- {
- if (target.indcount == 0x0
- && (target.base == ALREG || target.base == AXREG
- || target.base == EAXREG))
- opcode = 0xA8 | segword;
- else
- {
- buildea(&target);
- opcode = 0xF6 | segword;
- }
- }
- buildimm(&source, FALSE);
- }
- else
- {
- opcode |= segword;
- buildregular();
- }
-}
-
-/*
- XCHG
- Similar to the regular group1 operators.
- It does not allow any of the immediate forms
- and does not use the irrelevant direction bit.
-*/
-
-PUBLIC void mxchg()
-{
- getbinary();
- notimmed(&source);
- notsegorspecreg(&source);
- if (target.indcount == 0x0)
- {
- if (target.base == AXREG || target.base == EAXREG)
- {
- opcode = 0x90 + rm[source.base];
- return;
- }
- if (source.base == AXREG || source.base == EAXREG)
- {
- opcode = 0x90 + rm[target.base];
- return;
- }
- }
- opcode |= segword;
- buildregular();
-}
-
-PRIVATE void notbytesize(eap)
-register struct ea_s *eap;
-{
- if (eap->size == 0x1)
- kgerror(ILL_SIZE);
-}
-
-PRIVATE void notimmed(eap)
-register struct ea_s *eap;
-{
- if (eap->indcount == 0x0 && eap->base == NOREG)
- kgerror(ILL_IMM_MODE);
-}
-
-PRIVATE void notindirect(eap)
-register struct ea_s *eap;
-{
- if (eap->indcount != 0x0)
- kgerror(ILL_IND);
-}
-
-PRIVATE void notsegorspecreg(eap)
-register struct ea_s *eap;
-{
- if (regsegword[eap->base] >= SEGMOV)
- kgerror(ILLREG);
-}
-
-PRIVATE void yesimmed(eap)
-register struct ea_s *eap;
-{
- if (eap->indcount == 0x1)
- eap->indcount = 0x0;
- if (eap->indcount != 0x0 || eap->base != NOREG)
- kgerror(IMM_REQ);
-}
-
-PRIVATE void yes_samesize()
-{
- if (target.size == 0x0)
- target.size = source.size;
- else if (source.size != 0x0 && target.size != source.size)
- kgerror(MISMATCHED_SIZE);
-}
-
-#endif /* I80386 */
-
-#ifdef MC6809
-
-/* 6809 opcode constants */
-
-/* bits for indexed addressing */
-
-#define INDIRECTBIT 0x10
-#define INDEXBIT 0x80 /* except 5 bit offset */
-#define PCRELBIT 0x04 /* PC relative (in certain cases) */
-#define RRBITS 0x60 /* register select bits */
-
-PRIVATE opcode_t rrindex[] = /* register and index bits for indexed adr */
-{
- 0x60 | INDEXBIT, /* S */
- 0x40 | INDEXBIT, /* U */
- 0x00 | INDEXBIT, /* X */
- 0x20 | INDEXBIT, /* Y */
- PCRELBIT | INDEXBIT, /* PC */
-};
-
-PRIVATE opcode_t pushpull[] = /* push/pull codes */
-{
- 0x40, /* S */
- 0x40, /* U */
- 0x10, /* X */
- 0x20, /* Y */
- 0x80, /* PC */
- 0x02, /* A */
- 0x04, /* B */
- 0x01, /* CC */
- 0x08, /* DP */
- 0x06, /* D */
-};
-
-PRIVATE opcode_t tfrexg1[] = /* transfer/exchange codes for source reg */
-{
- 0x40, /* S */
- 0x30, /* U */
- 0x10, /* X */
- 0x20, /* Y */
- 0x50, /* PC */
- 0x80, /* A */
- 0x90, /* B */
- 0xA0, /* CC */
- 0xB0, /* DP */
- 0x00, /* D */
-};
-
-PRIVATE opcode_t tfrexg2[] = /* transfer/exchange codes for target reg */
-{
- 0x04, /* S */
- 0x03, /* U */
- 0x01, /* X */
- 0x02, /* Y */
- 0x05, /* PC */
- 0x08, /* A */
- 0x09, /* B */
- 0x0A, /* CC */
- 0x0B, /* DP */
- 0x00, /* D */
-};
-
-FORWARD void checkpostinc P((void));
-FORWARD void doaltind P((void));
-FORWARD void do1altind P((void));
-FORWARD void fixupind P((void));
-FORWARD void getindexnopost P((void));
-FORWARD void inderror P((error_pt errnum));
-FORWARD reg_pt indreg P((reg_pt maxindex));
-FORWARD void predec1 P((void));
-FORWARD void sustack P((reg_pt stackreg));
-
-PRIVATE void checkpostinc()
-{
- if (sym == ADDOP)
- {
- if (postb & INDIRECTBIT)
- inderror(ILLMOD); /* single-inc indirect illegal */
- else
- {
- lastexp.offset &= 0xFF00; /* for printing if postbyte is 0: ,X+ */
- getsym();
- }
- }
- else if (sym == POSTINCOP)
- {
- postb |= 0x1;
- getsym();
- }
- else
- postb |= 0x4;
- fixupind();
-}
-
-/* common code for all-mode ops, alterable-mode ops, indexed ops */
-
-PRIVATE void doaltind()
-{
- mcount += 0x2;
- if (sym == LBRACKET)
- {
- postb = INDIRECTBIT;
- getsym();
- do1altind();
- if (sym != RBRACKET)
- error(RBEXP);
- }
- else
- do1altind();
-}
-
-PRIVATE void do1altind()
-{
- bool_t byteflag; /* set if direct or short indexed adr forced */
- char *oldlineptr;
- char *oldsymname;
- reg_pt reg;
- bool_t wordflag; /* set if extended or long indexed adr forced*/
-
- if ((reg = regchk()) != NOREG)
- {
- switch (reg)
- {
- case AREG:
- postb |= 0x86;
- break;
- case BREG:
- postb |= 0x85;
- break;
- case DREG:
- postb |= 0x8B;
- break;
- default:
- if (indreg(MAXINDREG) != NOREG)
- checkpostinc();
- return;
- }
- getsym();
- if (sym != COMMA)
- inderror(COMEXP);
- else
- getindexnopost();
- return;
- }
- else if (sym == SUBOP) /* could be -R or - in expression */
- {
- oldlineptr = lineptr; /* save state */
- oldsymname = symname;
- getsym();
- reg = regchk();
- lineptr = oldlineptr;
- symname = oldsymname;
- if (reg != NOREG)
- {
- predec1(); /* it's -R */
- return;
- }
- sym = SUBOP;
- }
- else if (sym == COMMA)
- {
- postb |= INDEXBIT;
- getsym();
- if (sym == SUBOP)
- {
- predec1();
- return;
- }
- else if (sym != PREDECOP)
- {
- if (indreg(MAXINDREG) != NOREG)
- checkpostinc();
- return;
- }
- }
- if (sym == PREDECOP)
- {
- postb |= 0x83;
- getindexnopost();
- return;
- }
-
- /* should have expression */
-
- wordflag = byteflag = FALSE;
- if (sym == LESSTHAN)
- {
- /* context-sensitive, LESSTHAN means byte-sized here */
- byteflag = TRUE;
- getsym();
- }
- else if (sym == GREATERTHAN)
- {
- /* context-sensitive, GREATERTHAN means word-sized here */
- wordflag = TRUE;
- getsym();
- }
- expres();
- if (sym == COMMA)
- { /* offset from register */
- getsym();
- if ((reg = indreg(PCREG)) == NOREG)
- return;
- postb |= 0x8; /* default 8 bit offset */
- if (reg == PCREG)
- {
- reldata();
- if (!(lastexp.data & (RELBIT | UNDBIT)))
- {
- lastexp.offset = lastexp.offset - lc;
- if (page != 0x0)
- lastexp.offset -= 0x4; /* extra for instruction */
- else
- lastexp.offset -= 0x3; /* 3 byte instruction
- assuming 8 bit offset */
- }
- }
- if (byteflag)
- {
- if (!(lastexp.data & (RELBIT | UNDBIT)) &&
- !is8bitsignedoffset(lastexp.offset))
- error(ABOUNDS); /* forced short form is impossible */
- ++mcount;
- }
- else if (wordflag || lastexp.data & (FORBIT | RELBIT | UNDBIT) ||
- !is8bitsignedoffset(lastexp.offset))
- { /* 16 bit offset */
- if (postb & PCRELBIT && !(lastexp.data & RELBIT))
- --lastexp.offset; /* instruction 1 longer than already
- allowed */
- postb |= 0x1;
- mcount += 0x2;
- }
- else if (!(postb & PCRELBIT) &&
- (offset_t) (lastexp.offset + 0x10) < 0x20 &&
- !(postb & INDIRECTBIT && lastexp.offset != 0x0))
- { /* 5 bit offset */
- postb &= RRBITS | INDIRECTBIT;
- if (lastexp.offset == 0x0)
- postb |= 0x84; /* index with zero offset */
- else
- postb |= (lastexp.offset & 0x1F);
- }
- else /* 8 bit offset */
- ++mcount;
- fixupind();
- }
- else if (postb & INDIRECTBIT)
- { /* extended indirect */
- postb = 0x9F;
- mcount += 0x2;
- fixupind();
- }
- else if (postb & INDEXBIT)
- inderror(ILLMOD); /* e.g. LEAX $10 */
- else
- {
- if (byteflag || !wordflag && !(lastexp.data & (FORBIT | RELBIT)) &&
- (lastexp.offset >> 0x8) == dirpag)
- { /* direct addressing */
- if (opcode >= 0x80)
- opcode |= 0x10;
- }
- else /* extended addressing */
- {
- if (opcode < 0x80)
- opcode |= 0x70;
- else
- opcode |= 0x30;
- ++mcount;
- if (pass2 && (opcode == JSR_OPCODE || opcode == JMP_OPCODE) &&
- !(lastexp.data & IMPBIT) &&
- lastexp.offset + (0x81 - 0x3) < 0x101)
- /* JSR or JMP could be done with BSR or BRA */
- error(SHORTB);
- }
- }
-}
-
-PRIVATE void fixupind()
-{
- if ((opcode & 0x30) == 0x0) /* change all but LEA opcodes */
- {
- if (opcode < 0x80)
- opcode |= 0x60;
- else
- opcode |= 0x20;
- }
-}
-
-PRIVATE void getindexnopost()
-{
- getsym();
- if (indreg(MAXINDREG) != NOREG)
- fixupind();
-}
-
-PRIVATE void inderror(errnum)
-error_pt errnum;
-{
- error(errnum);
- if (postb & INDIRECTBIT)
- sym = RBRACKET; /* fake right bracket to kill further errors */
- fixupind();
-}
-
-/* check current symbol is an index register (possibly excepting PC) */
-/* if so, modify postbyte RR and INDEXBIT for it, get next sym, return TRUE */
-/* otherwise generate error, return FALSE */
-
-PRIVATE reg_pt indreg(maxindex)
-reg_pt maxindex;
-{
- reg_pt reg;
-
- if ((reg = regchk()) == NOREG)
- inderror(IREGEXP);
- else if (reg > maxindex)
- {
- inderror(ILLREG);
- reg = NOREG;
- }
- else
- {
- postb |= rrindex[reg];
- getsym();
- }
- return reg;
-}
-
-/* all-mode ops */
-
-PUBLIC void mall()
-{
- if (sym == IMMEDIATE)
- mimmed();
- else
- malter();
-}
-
-/* alterable mode ops */
-
-PUBLIC void malter()
-{
- postb = 0x0; /* not yet indexed or indirect */
- doaltind();
-}
-
-/* indexed mode ops */
-
-PUBLIC void mindex()
-{
- postb = INDEXBIT; /* indexed but not yet indirect */
- doaltind();
-}
-
-/* immediate ops */
-
-PUBLIC void mimmed()
-{
- opcode_t nybble;
-
- mcount += 0x2;
- if (sym != IMMEDIATE)
- error(ILLMOD);
- else
- {
- if (opcode >= 0x80 && ((nybble = opcode & 0xF) == 0x3 ||
- nybble == 0xC || nybble >= 0xE))
- ++mcount; /* magic for long immediate */
- symexpres();
- if (pass2 && mcount <= 0x2)
- {
- chkabs();
- checkdatabounds();
- }
- }
-}
-
-/* long branches */
-
-PUBLIC void mlong()
-{
- mcount += 0x3; /* may be 0x0 or 0x1 here */
- expres();
- if (pass2)
- {
- reldata();
- if (!(lastexp.data & (RELBIT | UNDBIT)))
- {
- lastexp.offset = lastexp.offset - lc - lcjump;
- if (!(lastexp.data & IMPBIT) &&
- lastexp.offset + 0x81 < 0x101)
- error(SHORTB); /* -0x81 to 0x7F, warning */
- }
- }
-}
-
-/* PSHS and PULS */
-
-PUBLIC void msstak()
-{
- sustack(SREG);
-}
-
-/* TFR and EXG */
-
-PUBLIC void mswap()
-{
- reg_pt reg;
-
- mcount = 0x2;
- if ((reg = regchk()) == NOREG)
- error(REGEXP);
- else
- {
- postb = tfrexg1[reg];
- getsym();
- if (sym != COMMA)
- error(COMEXP);
- else
- {
- getsym();
- if ((reg = regchk()) == NOREG)
- error(REGEXP);
- else if ((postb |= tfrexg2[reg])
- & 0x88 && (postb & 0x88) != 0x88)
- error(ILLREG); /* registers not of same size */
- }
- }
-}
-
-/* PSHU and PULU */
-
-PUBLIC void mustak()
-{
- sustack(UREG);
-}
-
-PRIVATE void predec1()
-{
- if (postb & INDIRECTBIT)
- inderror(ILLMOD); /* single-dec indirect illegal */
- else
- {
- postb |= 0x82;
- getindexnopost();
- }
-}
-
-/* common routine for PSHS/PULS/PSHU/PULU */
-
-PRIVATE void sustack(stackreg)
-reg_pt stackreg;
-{
- reg_pt reg;
-
- mcount = 0x2;
- while ((reg = regchk()) != NOREG)
- {
- if (reg == stackreg)
- {
- error(ILLREG); /* cannot stack self */
- break;
- }
- postb |= pushpull[reg];
- getsym();
- if (sym != COMMA)
- break;
- getsym();
- }
-}
-
-#endif /* MC6809 */
-
-/* routines common to all processors */
-
-PUBLIC void getcomma()
-{
- if (sym != COMMA)
- error(COMEXP);
- else
- getsym();
-}
-
-/* inherent ops */
-
-/* for I80386 */
-/* AAA, AAS, CLC, CLD, CLI, CLTS, CMC, CMPSB, DAA, DAS, HLT, INTO, INSB, */
-/* INVD, */
-/* LAHF, LEAVE, LOCK, LODSB, MOVSB, NOP, OUTSB, REP, REPE, REPNE, REPNZ, */
-/* REPZ, SAHF, SCASB, STC, STD, STI, STOSB, WAIT, WBINVD */
-
-PUBLIC void minher()
-{
- ++mcount;
-}
-
-/* short branches */
-
-PUBLIC void mshort()
-{
- nonimpexpres();
- mshort2();
-}
-
-PRIVATE void mshort2()
-{
- mcount += 0x2;
- if (pass2)
- {
- reldata();
- if (lastexp.data & RELBIT)
- showrelbad();
- else if (!(lastexp.data & UNDBIT))
- {
- lastexp.offset = lastexp.offset - lc - mcount;
- if (!is8bitsignedoffset(lastexp.offset))
- error(ABOUNDS);
- }
- }
-}
-
-/* check if current symbol is a register, return register number or NOREG */
-
-PRIVATE reg_pt regchk()
-{
- register struct sym_s *symptr;
-
- if (sym == IDENT)
- {
- if ((symptr = gsymptr)->type & MNREGBIT)
- {
- if (symptr->data & REGBIT)
- {
-#ifdef I80386
- if (symptr->value_reg_or_op.reg == ST0REG && !fpreg_allowed)
- error(FP_REG_NOT_ALLOWED);
-#endif
- return symptr->value_reg_or_op.reg;
- }
- }
- else if (!(symptr->type & (LABIT | MACBIT | VARBIT)))
- symptr->data |= FORBIT; /* show seen in advance */
- }
- return NOREG;
-}
-
-/* convert lastexp.data for PC relative */
-
-PRIVATE void reldata()
-{
- if ((lastexp.data ^ lcdata) & (IMPBIT | RELBIT | SEGM))
- {
- if ((lastexp.data ^ lcdata) & RELBIT)
- showrelbad(); /* rel - abs is weird, abs - rel is bad */
- else
- {
- pcrflag = OBJ_R_MASK;
- lastexp.data = (lcdata & ~SEGM) | lastexp.data | RELBIT;
- /* segment is that of lastexp.data */
- }
- }
- else /* same file, segment and relocation */
- lastexp.data = (lastexp.data | lcdata) & ~(RELBIT | SEGM);
-}
diff --git a/bin86-0.3/as/opcode.h b/bin86-0.3/as/opcode.h
deleted file mode 100644
index 1e96079..0000000
--- a/bin86-0.3/as/opcode.h
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * bin86/as/opcode.h
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-/* opcode.h - routine numbers and special opcodes for assembler */
-
-enum
-{
-/* Pseudo-op routine numbers.
- * Conditionals are first - this is used to test if op is a conditional.
- */
- ELSEOP,
- ELSEIFOP,
- ELSEIFCOP,
- ENDIFOP,
- IFOP,
- IFCOP,
-
-#define MIN_NONCOND ALIGNOP
- ALIGNOP,
- BLKWOP,
- BLOCKOP,
- BSSOP,
- COMMOP,
- COMMOP1,
- DATAOP,
- ENDBOP,
- ENTEROP,
- ENTRYOP,
- EQUOP,
- EVENOP,
- EXPORTOP,
- FAILOP,
- FCBOP,
- FCCOP,
- FDBOP,
- FQBOP,
- GETOP,
- GLOBLOP,
- IDENTOP,
- IMPORTOP,
- LCOMMOP,
- LCOMMOP1,
- LISTOP,
- LOCOP,
- MACLISTOP,
- MACROOP,
- MAPOP,
- ORGOP,
- PROCEOFOP,
- RMBOP,
- SECTOP,
- SETOP,
- SETDPOP,
- TEXTOP,
-#ifdef I80386
- USE16OP,
- USE32OP,
-#endif
- WARNOP,
-
-/* Machine-op routine numbers. */
-#ifdef I80386
- BCC,
- BSWAP,
- CALL,
- CALLI,
- DIVMUL,
- ENTER,
- EwGw,
- ExGx,
- F_INHER,
- F_M,
- F_M2,
- F_M2_AX,
- F_M2_M4,
- F_M2_M4_M8,
- F_M4_M8_OPTST,
- F_M4_M8_ST,
- F_M4_M8_STST,
- F_M4_M8_M10_ST,
- F_M10,
- F_OPTST,
- F_ST,
- F_STST,
- F_W_INHER,
- F_W_M,
- F_W_M2,
- F_W_M2_AX,
- GROUP1,
- GROUP2,
- GROUP6,
- GROUP7,
- GROUP8,
- GvEv,
- GvMa,
- GvMp,
- IMUL,
- IN,
- INCDEC,
- INHER,
- INHER16,
- INHER32,
- INHER_A,
- INT,
- JCC,
- JCXZ,
- LEA,
- MOV,
- MOVX,
- NEGNOT,
- OUT,
- PUSHPOP,
- RET,
- SEG,
- SETCC,
- SH_DOUBLE,
- TEST,
- XCHG,
-#endif /* I80386 */
-
-#ifdef MC6809
- ALL, /* all address modes allowed, like LDA */
- ALTER, /* all but immediate, like STA */
- IMMED, /* immediate only (ANDCC, ORCC) */
- INDEXD, /* indexed (LEA's) */
- INHER, /* inherent, like CLC or CLRA */
- LONG, /* long branches */
- SHORT, /* short branches */
- SSTAK, /* S-stack (PSHS, PULS) */
- SWAP, /* TFR, EXG */
- USTAK, /* U-stack (PSHU,PULU) */
-#endif /* MC6809 */
-};
-
-/* Special opcodes. */
-#ifdef I80386
-# define CMP_OPCODE_BASE 0x38
-# define CMPSB_OPCODE 0xA6
-# define CMPSW_OPCODE 0xA7
-# define ESCAPE_OPCODE_BASE 0xD8
-# define FST_ENCODED 0x12
-# define FSTP_ENCODED 0x13
-# define JMP_OPCODE 0xE9
-# define JMP_SHORT_OPCODE 0xEB
-# define JSR_OPCODE 0xE8
-# define MOVSB_OPCODE 0xA4
-# define MOVSW_OPCODE 0xA5
-# define PAGE1_OPCODE 0x0F
-# define POP_OPCODE 0x8F
-# define PUSH_OPCODE 0xFF
-# define WAIT_OPCODE 0x9B
-#endif
-
-#ifdef MC6809
-# define JMP_OPCODE 0x7E
-# define JSR_OPCODE 0xBD
-# define PAGE1_OPCODE 0x10
-# define PAGE2_OPCODE 0x11
-#endif
diff --git a/bin86-0.3/as/pops.c b/bin86-0.3/as/pops.c
deleted file mode 100644
index a475df6..0000000
--- a/bin86-0.3/as/pops.c
+++ /dev/null
@@ -1,977 +0,0 @@
-/*
- * bin86/as/pops.c
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-/* pops.c - handle pseudo-ops for assembler */
-
-#include "const.h"
-#include "type.h"
-#include "address.h"
-#include "flag.h"
-#include "globvar.h"
-#include "opcode.h"
-#include "scan.h"
-
-PRIVATE bool_t elseflag; /* set if ELSE/ELSEIF are enabled */
- /* depends on zero = FALSE init */
-PRIVATE bool_t lcommflag;
-
-FORWARD void bumpsem P((struct flags_s *flagptr));
-FORWARD void constdata P((unsigned size));
-FORWARD void docomm P((void));
-FORWARD void doelseif P((pfv func));
-FORWARD void doequset P((int labits));
-FORWARD void doentexp P((int entbits, int impbits));
-FORWARD void doif P((pfv func));
-FORWARD struct sym_s *needlabel P((void));
-FORWARD void showredefinedlabel P((void));
-FORWARD void setloc P((unsigned seg));
-
-PRIVATE void bumpsem(flagptr)
-register struct flags_s *flagptr;
-{
- int newcount;
-
- if (flagptr->global &&pass != 0)
- {
- /* bump semaphore count by an expression (default 1), */
- /* then set currentflag iff semaphore count is plus */
- if (sym == EOLSYM)
- lastexp.offset = 1;
- else
- {
- absexpres();
- if (lastexp.data & UNDBIT)
- return;
- }
- newcount = (int) lastexp.offset;
-#ifdef I80386 /* really sizeof (offset_t) != sizeof (int) */
- if (newcount != lastexp.offset)
- datatoobig();
-#endif
- newcount += flagptr->semaphore;
- if ((int) lastexp.offset >= 0)
- {
- if (newcount < flagptr->semaphore)
- {
- error(COUNTOV);
- newcount = 0x7fff;
- }
- }
- else if (newcount >= flagptr->semaphore)
- {
- error(COUNTUN);
- newcount = -0x8000;
- }
- flagptr->semaphore = newcount;
- flagptr->current = newcount >= 0;
- }
-}
-
-/* check symbol is either undefined */
-/* or has the same segment & relocatability as lc */
-
-PUBLIC bool_pt checksegrel(symptr)
-register struct sym_s *symptr;
-{
- if ((symptr->type & LABIT ||
- symptr->data & IMPBIT && !(symptr->data & UNDBIT)) &&
- ((symptr->data ^ lcdata) & (RELBIT | SEGM)))
- {
- error(SEGREL);
- return FALSE;
- }
- return TRUE;
-}
-
-/* check address fits in 1 byte (possibly with sign truncated) */
-
-PUBLIC void checkdatabounds()
-{
- if (!(lastexp.data & UNDBIT) &&
- (offset_t) (lastexp.offset + 0x80) >= 0x180)
- datatoobig();
-}
-
-/* allocate constant data (zero except for size 1), default zero for size 1 */
-
-PRIVATE void constdata(size)
-unsigned size;
-{
- offset_t remaining;
-
- absexpres();
- if (!((lcdata |= lastexp.data) & UNDBIT))
- {
- lcjump = lastexp.offset * size;
- popflags = POPLONG | POPHI | POPLO | POPLC;
- if (size == 1 && sym == COMMA)
- {
- symabsexpres();
- checkdatabounds();
- for (remaining = lcjump; remaining != 0; --remaining)
- {
- putbin((opcode_pt) lastexp.offset); /* fill byte */
- putabs((opcode_pt) lastexp.offset);
- }
- lastexp.offset = lcjump;
- }
- else
- accumulate_rmb(lastexp.offset * size);
- }
-}
-
-PUBLIC void datatoobig()
-{
- error(DBOUNDS);
-}
-
-/* common routine for COMM/.COMM */
-
-PRIVATE void docomm()
-{
- register struct sym_s *labptr;
-
- absexpres(); /* if undefined, value 0 and size unchanged */
- labptr = label;
- if (checksegrel(labptr))
- {
- if (labptr->type & (EXPBIT | LABIT))
- labelerror(ALREADY);
- else
- {
- if (!(labptr->type & COMMBIT) ||
- lastexp.offset > labptr->value_reg_or_op.value)
- labptr->value_reg_or_op.value = lastexp.offset;
- labptr->type |= COMMBIT;
- if (lcommflag)
- labptr->type |= REDBIT; /* kludge - COMMBIT | REDBIT => SA */
- labptr->data = (lcdata & SEGM) | (FORBIT | IMPBIT | RELBIT);
- showlabel();
- }
- }
- lcommflag = FALSE;
-}
-
-/* common routine for ELSEIF/ELSEIFC */
-
-PRIVATE void doelseif(func)
-pfv func;
-{
- if (iflevel == 0)
- error(ELSEIFBAD);
- else
- {
- ifflag = FALSE;
- if (elseflag)
- {
- (*func) ();
- if (!(lastexp.data & UNDBIT) && lastexp.offset != 0)
- /* expression valid and TRUE, enable assembling */
- {
- ifflag = TRUE;
- elseflag = FALSE;
- }
- }
- }
-}
-
-/* common routine for EQU/SET */
-
-PRIVATE void doequset(labits)
-unsigned char labits;
-{
- register struct sym_s *labptr;
- unsigned char olddata;
- unsigned char oldtype;
-
- labptr = label;
- /* set up new label flags in case labe isl used in expression */
- labptr->type = (oldtype = labptr->type) | labits;
- labptr->data = (olddata = labptr->data) & ~IMPBIT;
- /* non-imported now */
- nonimpexpres();
- lastexp.data |= olddata & FORBIT; /* take all but FORBIT from
- expression */
- if (oldtype & LABIT && !(olddata & UNDBIT))
- /* this is a previously defined label */
-
- /*
- redefinition only allowed if same relocatability, segment and
- value
- */
- {
- if ((olddata ^ lastexp.data) & (RELBIT | UNDBIT) ||
- labptr->value_reg_or_op.value != lastexp.offset)
- {
- showredefinedlabel();
- return;
- }
- }
- labptr->data = lastexp.data;
- labptr->value_reg_or_op.value = lastexp.offset;
- showlabel();
-}
-
-/* common routine for ENTRY/EXPORT */
-
-PRIVATE void doentexp(entbits, impbits)
-unsigned char entbits;
-unsigned char impbits;
-{
- struct sym_s *symptr;
-
- while (TRUE)
- {
- if ((symptr = needlabel()) != NULL)
- {
- if (symptr->type & COMMBIT)
- error(ALREADY);
- else if (impbits != 0)
- {
- if (pass != 0)
- ;
- else if (symptr->type & (EXPBIT | LABIT))
- symptr->type |= EXPBIT;
- else
- {
- symptr->type |= REDBIT;
- if (!(symptr->data & IMPBIT))
- symptr->data |= IMPBIT | SEGM;
- }
- }
- else
- {
- if (pass != 0)
- {
- if (!(symptr->type & LABIT))
- error(UNLAB);
- }
- else
- {
- symptr->type |= entbits | EXPBIT;
- symptr->data &= ~IMPBIT;
- }
- }
- }
- getsym();
- if (sym != COMMA)
- break;
- getsym();
- }
-}
-
-/* common routine for IF/IFC */
-
-PRIVATE void doif(func)
-pfv func;
-{
- if (iflevel >= MAXIF)
- error(IFOV);
- else
- {
- ++iflevel;
- --ifstak;
- ifstak->elseflag = elseflag;
- elseflag = FALSE; /* prepare */
-
-
- /* parse the argument.
- * [Fare] moved it here to allow nested if's, as
- * the argument must be parsed even if we are not assembling !
- */
- (*func) ();
-
- if ((ifstak->ifflag = ifflag) != FALSE)
- /* else not assembling before, so not now & no ELSE's */
- {
- /* [Fari]: was here! (*func) (); */
- if (!(lastexp.data & UNDBIT) && lastexp.offset == 0)
- /* else expression invalid or FALSE, don't change flags */
- {
- ifflag = FALSE; /* not assembling */
- elseflag = TRUE;/* but ELSE will change that */
- }
- }
- }
-}
-
-PUBLIC void fatalerror(errnum)
-error_pt errnum;
-{
- error(errnum);
- skipline();
- listline();
- finishup();
-}
-
-/* swap position with label position, do error, put back posn */
-/* also clear label ptr */
-
-PUBLIC void labelerror(errnum)
-error_pt errnum;
-{
- struct sym_s *oldgsymptr;
- char *oldlineptr;
- unsigned char oldsym;
- char *oldsymname;
-
- oldgsymptr = gsymptr;
- oldlineptr = lineptr;
- oldsym = sym;
- oldsymname = symname;
- lineptr = linebuf;
- getsym(); /* 1st symbol is label or symbol after
- * missing one */
- error(errnum);
- gsymptr = oldgsymptr;
- lineptr = oldlineptr;
- sym = oldsym;
- symname = oldsymname;
- label = NULL;
-}
-
-PRIVATE struct sym_s *needlabel()
-{
- register struct sym_s *symptr;
-
- if (sym != IDENT ||
- (symptr = gsymptr)->type & (MACBIT | MNREGBIT | VARBIT))
- {
- error(LABEXP);
- return NULL;
- }
- return symptr;
-}
-
-/* .ALIGN pseudo-op */
-
-PUBLIC void palign()
-{
- absexpres();
- if (!((lcdata |= lastexp.data) & UNDBIT))
- {
- popflags = POPLONG | POPHI | POPLO | POPLC;
- if (lastexp.offset != 0 &&
- (lcjump = lc % lastexp.offset) != 0)
- accumulate_rmb(lcjump = lastexp.offset - lcjump);
- }
-}
-
-/* .BLKW pseudo-op */
-
-PUBLIC void pblkw()
-{
- constdata(2);
-}
-
-/* BLOCK pseudo-op */
-
-PUBLIC void pblock()
-{
- if (blocklevel >= MAXBLOCK)
- error(BLOCKOV);
- else
- {
- register struct block_s *blockp;
-
- ++blocklevel;
- blockp = blockstak;
- blockstak = --blockp;
- blockp->data = lcdata;
- blockp->dp = dirpag;
- blockp->lc = lc;
- porg(); /* same as ORG apart from stacking */
- }
-}
-
-/* .BSS pseudo-op */
-
-PUBLIC void pbss()
-{
- setloc(BSSLOC);
-}
-
-/* COMM pseudo-op */
-
-PUBLIC void pcomm()
-{
- if (label == NULL)
- labelerror(MISLAB);
- else if (label->type & VARBIT)
- labelerror(VARLAB); /* variable cannot be COMM'd */
- else
- docomm();
-}
-
-/* .COMM pseudo-op */
-
-PUBLIC void pcomm1()
-{
- unsigned oldseg;
-
- if (label != NULL)
- labelerror(ILLAB);
- oldseg = lcdata & SEGM;
- setloc(BSSLOC);
- if ((label = needlabel()) != NULL && checksegrel(label))
- {
- /* Like import. */
- if (label->type & (EXPBIT | LABIT))
- error(ALREADY);
- else
- label->data = lcdata | (FORBIT | IMPBIT | RELBIT);
- getsym();
- getcomma();
- if (label->type & (EXPBIT | LABIT))
- absexpres(); /* just to check it */
- else
- docomm();
- }
- setloc(oldseg);
-}
-
-/* .DATA pseudo-op */
-
-PUBLIC void pdata()
-{
- setloc(DATALOC);
-}
-
-/* ELSE pseudo-op */
-
-PUBLIC void pelse()
-{
- if (iflevel == 0)
- error(ELSEBAD);
- else
- {
- ifflag = FALSE; /* assume ELSE disabled */
- if (elseflag)
- {
- ifflag = TRUE; /* ELSE enabled */
- elseflag = FALSE;
- }
- }
-}
-
-/* ELSEIF pseudo-op */
-
-PUBLIC void pelseif()
-{
- doelseif(absexpres);
-}
-
-/* ELSEIFC pseudo-op */
-
-PUBLIC void pelsifc()
-{
- doelseif(scompare);
-}
-
-/* ENDB pseudo-op */
-
-PUBLIC void pendb()
-{
- if (label != NULL)
- labelerror(ILLAB);
- if (blocklevel == 0)
- error(ENDBBAD);
- else
- {
- register struct block_s *blockp;
-
- blockp = blockstak;
- lcdata = blockp->data;
- dirpag = blockp->dp;
- accumulate_rmb(blockp->lc - lc);
- lc = blockp->lc;
- --blocklevel;
- blockstak = blockp + 1;
- }
-}
-
-/* ENDIF pseudo-op */
-
-PUBLIC void pendif()
-{
- if (iflevel == 0)
- error(ENDIFBAD);
- else
- {
- ifflag = ifstak->ifflag;
- elseflag = ifstak->elseflag;
- ++ifstak;
- --iflevel;
- }
-}
-
-/* ENTER pseudo-op */
-
-PUBLIC void penter()
-{
- if (!(pedata & UNDBIT))
- error(REENTER);
- else
- {
- if (!((pedata = (pedata & ~UNDBIT) | lcdata) & UNDBIT))
- {
- progent = lc;
- popflags = POPLC;
- }
- }
-}
-
-/* ENTRY pseudo-op */
-
-PUBLIC void pentry()
-{
- doentexp(ENTBIT, 0);
-}
-
-/* EQU pseudo-op */
-
-PUBLIC void pequ()
-{
- register struct sym_s *labptr;
-
- if ((labptr = label) == NULL)
- labelerror(MISLAB);
- else if (labptr->type & COMMBIT)
- showredefinedlabel(); /* common cannot be EQU'd */
- else if (labptr->type & VARBIT)
- labelerror(VARLAB); /* variable cannot be EQU'd */
- else
- doequset(LABIT);
-}
-
-/* .EVEN pseudo-op */
-
-PUBLIC void peven()
-{
- popflags = POPLONG | POPHI | POPLO | POPLC;
- accumulate_rmb(lcjump = lastexp.data = lc & 1);
-}
-
-/* EXPORT pseudo-op */
-
-PUBLIC void pexport()
-{
- doentexp(0, 0);
-}
-
-/* FAIL pseudo-op */
-
-PUBLIC void pfail()
-{
- error(FAILERR);
-}
-
-/* FCB pseudo-op */
-
-PUBLIC void pfcb()
-{
- char *bufptr;
- offset_t firstbyte;
-
- bufptr = databuf.fcbuf;
- absexpres();
- firstbyte = lastexp.offset;
- while (TRUE)
- {
- checkdatabounds();
- *bufptr++ = lastexp.offset;
- ++mcount; /* won't overflow, line length limits it */
- if (sym != COMMA)
- break;
- symabsexpres();
- }
- lastexp.offset = firstbyte;
- popflags = POPLO | POPLC;
- fcflag = TRUE;
-}
-
-/* FCC pseudo-op */
-
-PUBLIC void pfcc()
-{
- register char *bufptr;
- unsigned char byte;
- char delimiter;
- register char *reglineptr;
-
- bufptr = databuf.fcbuf;
- reglineptr = symname;
- if ((delimiter = *reglineptr) != EOLCHAR)
- ++reglineptr;
- while (TRUE)
- {
- if (*reglineptr == EOLCHAR)
- {
- symname = reglineptr;
- error(DELEXP);
- break;
- }
- if (*reglineptr == delimiter)
- {
- if (*++reglineptr != delimiter)
- break;
- }
- else if (*reglineptr == '\\' && reglineptr[1] != EOLCHAR)
- ++reglineptr;
- if ((byte = *reglineptr) < ' ')
- {
- symname = reglineptr;
- error(CTLINS);
- byte = ' ';
- }
- *bufptr++ = byte;
- ++reglineptr;
- }
- lineptr = reglineptr;
- getsym();
- if (bufptr > databuf.fcbuf)
- {
- lastexp.offset = databuf.fcbuf[0]; /* show 1st char only */
- mcount = bufptr - databuf.fcbuf;
- /* won't overflow, line length limits it */
- fcflag = TRUE;
- popflags = POPLO | POPLC;
- }
-}
-
-/* FDB pseudo-op */
-
-PUBLIC void pfdb()
-{
- struct address_s *adrptr;
- unsigned firstdata;
- offset_t firstword;
-
- adrptr = databuf.fdbuf;
- expres();
- firstword = lastexp.offset;
- firstdata = lastexp.data;
- while (TRUE)
- {
- *adrptr++ = lastexp;
- mcount += 2; /* won't overflow, line length limits it */
- if (sym != COMMA)
- break;
- symexpres();
- }
- lastexp.offset = firstword;
- lastexp.data = firstdata;
- popflags = POPHI | POPLO | POPLC;
- fdflag = TRUE;
-}
-
-#if SIZEOF_OFFSET_T > 2
-
-/* FQB pseudo-op */
-
-PUBLIC void pfqb()
-{
- struct address_s *adrptr;
- offset_t firstdata;
- offset_t firstword;
-
- adrptr = databuf.fqbuf;
- expres();
- firstword = lastexp.offset;
- firstdata = lastexp.data;
- while (TRUE)
- {
- *adrptr++ = lastexp;
- mcount += 4; /* won't overflow, line length limits it */
- if (sym != COMMA)
- break;
- symexpres();
- }
- lastexp.offset = firstword;
- lastexp.data = firstdata;
- popflags = POPLONG | POPHI | POPLO | POPLC;
- fqflag = TRUE;
-}
-
-#endif /* SIZEOF_OFFSET_T > 2 */
-
-/* .GLOBL pseudo-op */
-
-PUBLIC void pglobl()
-{
- if (binaryg)
- error(NOIMPORT);
- doentexp(0, IMPBIT);
-}
-
-/* IDENT pseudo-op (not complete) */
-
-PUBLIC void pident()
-{
- if (sym != IDENT)
- error(LABEXP);
- else
- getsym_nolookup(); /* should save ident string */
-}
-
-/* IF pseudo-op */
-
-PUBLIC void pif()
-{
- doif(absexpres);
-}
-
-/* IFC pseudo-op */
-
-PUBLIC void pifc()
-{
- doif(scompare);
-}
-
-/* IMPORT pseudo-op */
-
-PUBLIC void pimport()
-{
- struct sym_s *symptr;
-
- if (binaryg)
- error(NOIMPORT);
- while (TRUE)
- {
- if ((symptr = needlabel()) != NULL && checksegrel(symptr))
- {
- if (symptr->type & (COMMBIT | EXPBIT | LABIT))
- /* IMPORT is null if label (to be) declared */
- error(ALREADY);
- else
- /* get current segment from lcdata, no need to mask rest */
- symptr->data = lcdata | (FORBIT | IMPBIT | RELBIT);
- }
- getsym();
- if (sym != COMMA)
- break;
- getsym();
- }
-}
-
-/* LCOMM pseudo-op */
-
-PUBLIC void plcomm()
-{
- lcommflag = TRUE;
- pcomm();
-}
-
-/* .LCOMM pseudo-op */
-
-PUBLIC void plcomm1()
-{
- lcommflag = TRUE;
- pcomm1();
-}
-
-/* .LIST pseudo-op */
-
-PUBLIC void plist()
-{
- bumpsem(&list);
-}
-
-/* LOC pseudo-op */
-
-PUBLIC void ploc()
-{
- if (label != NULL)
- labelerror(ILLAB);
- absexpres();
- if (!(lastexp.data & UNDBIT))
- {
- if (lastexp.offset >= NLOC)
- datatoobig();
- else
- setloc((unsigned) lastexp.offset);
- }
-}
-
-/* .MACLIST pseudo-op */
-
-PUBLIC void pmaclist()
-{
- bumpsem(&maclist);
-}
-
-/* .MAP pseudo-op */
-
-PUBLIC void pmap()
-{
- absexpres();
- if (!(lastexp.data & UNDBIT))
- {
- mapnum = lastexp.offset;
- popflags = POPLO;
- if (lastexp.offset >= 0x100)
- datatoobig();
- }
-}
-
-/* ORG pseudo-op */
-
-PUBLIC void porg()
-{
- if (label != NULL)
- labelerror(ILLAB);
- absexpres();
- if (!((lcdata = lastexp.data) & UNDBIT))
- {
- accumulate_rmb(lastexp.offset - lc);
- binmbuf = lc = lastexp.offset;
- popflags = POPLC;
- }
-}
-
-/* RMB pseudo-op */
-
-PUBLIC void prmb()
-{
- constdata(1);
-}
-
-/* .SECT pseudo-op */
-
-PUBLIC void psect()
-{
- if (label != NULL)
- labelerror(ILLAB);
- while (sym == IDENT)
- {
- if (!(gsymptr->type & MNREGBIT))
- error(ILL_SECTION);
- else switch (gsymptr->value_reg_or_op.op.routine)
- {
- case BSSOP:
- pbss();
- break;
- case DATAOP:
- pdata();
- break;
- case TEXTOP:
- ptext();
- break;
- default:
- error(ILL_SECTION);
- break;
- }
- getsym();
- if (sym == COMMA)
- getsym();
- }
-}
-
-/* SET pseudo-op */
-
-PUBLIC void pset()
-{
- register struct sym_s *labptr;
-
- if ((labptr = label) == NULL)
- labelerror(MISLAB);
- else if (labptr->type & COMMBIT)
- labelerror(RELAB); /* common cannot be SET'd */
- else
- doequset(labptr->type & LABIT ? 0 : VARBIT);
-}
-
-/* SETDP pseudo-op */
-
-PUBLIC void psetdp()
-{
- absexpres();
- if (!(lastexp.data & UNDBIT))
- {
- dirpag = lastexp.offset;
- popflags = POPLO;
- if (lastexp.offset >= 0x100)
- datatoobig();
- }
-}
-
-/* .TEXT pseudo-op */
-
-PUBLIC void ptext()
-{
- setloc(TEXTLOC);
-}
-
-/* .WARN pseudo-op */
-
-PUBLIC void pwarn()
-{
- bumpsem(&warn);
-}
-
-#ifdef I80386
-
-/* USE16 pseudo-op */
-
-PUBLIC void puse16()
-{
- defsize = 2;
-}
-
-/* USE16 pseudo-op */
-
-PUBLIC void puse32()
-{
- defsize = 4;
-}
-
-#endif
-
-/* show redefined label and error, and set REDBIT */
-
-PRIVATE void showredefinedlabel()
-{
- register struct sym_s *labptr;
-
- labptr = label; /* showlabel() will kill label prematurely */
- showlabel();
- if (!(labptr->type & REDBIT))
- {
- labptr->type |= REDBIT;
- labelerror(RELAB);
- }
-}
-
-PUBLIC void showlabel()
-{
- register struct sym_s *labptr;
-
- labptr = label;
- lastexp.data = labptr->data;
- lastexp.offset = labptr->value_reg_or_op.value;
- popflags = POPLONG | POPHI | POPLO;
- label = NULL; /* show handled by COMM, EQU or SET */
-}
-
-/* set location segment */
-
-PRIVATE void setloc(seg)
-unsigned seg;
-{
- if (pass != 0 && seg != (lcdata & SEGM))
- putobj(seg | OBJ_SET_SEG);
- {
- register struct lc_s *lcp;
-
- lcp = lcptr;
- lcp->data = lcdata;
- lcp->lc = lc;
- lcptr = lcp = lctab + (unsigned char) seg;
- lcdata = (lcp->data & ~SEGM) | (unsigned char) seg;
- binmbuf = lc = lcp->lc;
- popflags = POPLC;
- }
-}
diff --git a/bin86-0.3/as/proto.h b/bin86-0.3/as/proto.h
deleted file mode 100644
index 0b70a4b..0000000
--- a/bin86-0.3/as/proto.h
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * bin86/as/proto.h
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-/* 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));
-void finishup P((void));
-void initp1p2 P((void));
-
-/* assemble.c */
-void assemble P((void));
-
-/* error.c */
-char *build_error_message P((error_pt errnum, char *buf));
-
-/* express.c */
-void absexpres P((void));
-void chkabs P((void));
-void nonimpexpres P((void));
-void showrelbad P((void));
-void symabsexpres P((void));
-void symexpres P((void));
-void expres P((void));
-void factor P((void));
-void scompare P((void));
-
-/* genbin.c */
-void binheader P((void));
-void bintrailer P((void));
-void genbin P((void));
-void initbin P((void));
-void putbin P((opcode_pt c));
-
-/* genlist.c */
-char *build_2hex_number P((unsigned num, char *where));
-char *build_number P((unsigned num, unsigned width, char *where));
-void error P((error_pt errnum));
-void listline P((void));
-void writec P((int c));
-void writenl P((void));
-void writeoff P((offset_t offset));
-void writes P((char *s));
-void writesn P((char *s));
-void writew P((unsigned word));
-
-/* genobj.c */
-void accumulate_rmb P((offset_t offset));
-void flushobj P((void));
-void genobj P((void));
-void initobj P((void));
-void objheader P((void));
-void objtrailer P((void));
-void putabs P((opcode_pt c));
-void putobj P((opcode_pt c));
-
-/* gensym.c */
-void gensym P((void));
-
-/* macro.c */
-void entermac P((struct sym_s *symptr));
-void pmacro P((void));
-
-/* mops.c */
-#ifdef I80386
-void mbcc P((void));
-void mbswap P((void));
-void mcall P((void));
-void mcalli P((void));
-void mdivmul P((void));
-void menter P((void));
-void mEwGw P((void));
-void mExGx P((void));
-void mf_inher P((void));
-void mf_m P((void));
-void mf_m2 P((void));
-void mf_m2_ax P((void));
-void mf_m2_m4 P((void));
-void mf_m2_m4_m8 P((void));
-void mf_m4_m8_optst P((void));
-void mf_m4_m8_st P((void));
-void mf_m4_m8_stst P((void));
-void mf_m4_m8_m10_st P((void));
-void mf_m10 P((void));
-void mf_optst P((void));
-void mf_st P((void));
-void mf_stst P((void));
-void mf_w_inher P((void));
-void mf_w_m P((void));
-void mf_w_m2 P((void));
-void mf_w_m2_ax P((void));
-void mgroup1 P((void));
-void mgroup2 P((void));
-void mgroup6 P((void));
-void mgroup7 P((void));
-void mgroup8 P((void));
-void mGvEv P((void));
-void mGvMa P((void));
-void mGvMp P((void));
-void mimul P((void));
-void min P((void));
-void mincdec P((void));
-void minher P((void));
-void minher16 P((void));
-void minher32 P((void));
-void minhera P((void));
-void mint P((void));
-void mjcc P((void));
-void mjcxz P((void));
-void mlea P((void));
-void mmov P((void));
-void mmovx P((void));
-void mnegnot P((void));
-void mout P((void));
-void mpushpop P((void));
-void mret P((void));
-void mseg P((void));
-void msetcc P((void));
-void mshdouble P((void));
-void mtest P((void));
-void mxchg P((void));
-#endif /* I80386 */
-
-#ifdef MC6809
-void mall P((void));
-void malter P((void));
-void mimmed P((void));
-void mindex P((void));
-void minher P((void));
-void mlong P((void));
-void msstak P((void));
-void mswap P((void));
-void mustak P((void));
-#endif /* MC6809 */
-
-void getcomma P((void));
-void mshort P((void));
-
-/* pops.c */
-bool_pt checksegrel P((struct sym_s *symptr));
-void checkdatabounds P((void));
-void datatoobig P((void));
-void fatalerror P((error_pt errnum));
-void labelerror P((error_pt errnum));
-void palign P((void));
-void pblkw P((void));
-void pblock P((void));
-void pbss P((void));
-void pcomm P((void));
-void pcomm1 P((void));
-void pdata P((void));
-void pelse P((void));
-void pelseif P((void));
-void pelsifc P((void));
-void pendb P((void));
-void pendif P((void));
-void penter P((void));
-void pentry P((void));
-void pequ P((void));
-void peven P((void));
-void pexport P((void));
-void pfail P((void));
-void pfcb P((void));
-void pfcc P((void));
-void pfdb P((void));
-void pfqb P((void));
-void pglobl P((void));
-void pident P((void));
-void pif P((void));
-void pifc P((void));
-void pimport P((void));
-void plcomm P((void));
-void plcomm1 P((void));
-void plist P((void));
-void ploc P((void));
-void pmaclist P((void));
-void pmap P((void));
-void porg P((void));
-void prmb P((void));
-void psect P((void));
-void pset P((void));
-void psetdp P((void));
-void ptext P((void));
-void puse16 P((void));
-void puse32 P((void));
-void pwarn P((void));
-void showlabel P((void));
-
-/* readsrc.c */
-void initsource P((void));
-fd_t open_input P((char *name));
-void pget P((void));
-void pproceof P((void));
-void readline P((void));
-void skipline P((void));
-
-/* scan.c */
-void context_hexconst P((void));
-void getsym P((void));
-void getsym_nolookup P((void));
-void initscan P((void));
-
-/* table.c */
-void inst_keywords P((void));
-struct sym_s *lookup P((void));
-void statistics P((void));
-
-/* type.c */
-void u2c2 P((char *buf, u16_pt offset));
-void u4c4 P((char *buf, u32_t offset));
-void u2cn P((char *buf, u16_pt offset, unsigned count));
-void u4cn P((char *buf, u32_t offset, unsigned count));
-bool_pt typeconv_init P((bool_pt big_endian, bool_pt long_big_endian));
-
-char *strrchr(const char *s, int c);
-void *malloc(int c);
-
-#if 0
-/* library - fcntl.h */
-int creat P((const char *__path, int __mode));
-int open P((const char *__path, int __oflag, ...));
-
-/* library - stdlib.h */
-void abort P((void));
-void exit P((int __status));
-void *malloc P((unsigned __size));
-
-/* library - string.h */
-int memcmp P((const void *__s1, const void *__s2, unsigned __max));
-void *memset P((void *__s, int __ch, unsigned __nbytes));
-char *strchr P((const char *__s, int __ch));
-int strcmp P((const char *__s1, const char *__s2));
-char *strcpy P((char *__target, const char *__source));
-unsigned strlen P((const char *__s));
-int strncmp P((const char *__s1, const char *__s2, int __max));
-char *strrchr P((const char *__s, int __ch));
-
-/* library - unistd.h */
-char *brk P((char *__adr));
-int close P((int __fd));
-long lseek P((int __fd, long __offset, int __whence));
-int read P((int __fd, char *__buf, unsigned __nbytes));
-char *sbrk P((int __incr));
-int write P((int __fd, char *__buf, unsigned __nbytes));
-
-#endif
diff --git a/bin86-0.3/as/readsrc.c b/bin86-0.3/as/readsrc.c
deleted file mode 100644
index 350fc4d..0000000
--- a/bin86-0.3/as/readsrc.c
+++ /dev/null
@@ -1,335 +0,0 @@
-/*
- * bin86/as/readsrc.c
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-#define MAXLINE 256 /* when this is made bigger, fix pfcc not
- * to store the string length in a byte-
- * sized variable */
-
-/* readsrc.c - read source files for assembler */
-
-#include <sys/types.h>
-#include <fcntl.h>
-#include "const.h"
-#include "type.h"
-#include "flag.h"
-#include "file.h"
-#include "globvar.h"
-#include "macro.h"
-#include "scan.h"
-#undef EXTERN
-#define EXTERN
-#include "source.h"
-
-struct fcbstruct /* file control block structure */
-{
- fd_t fd; /* file descriptor */
- char *lineptr; /* current spot in line */
- char *buf; /* start of buffer (after partial line) */
- char *first; /* start of partial line before buf */
- char *limit; /* end of used part of input buffer */
- unsigned blocksize; /* chars from last read and partial line flag */
- struct fbufstruct *includer;/* buffer of file which included current one */
-};
-
-struct fbufstruct /* file buffer structure */
-{
- struct fcbstruct fcb; /* status after opening an include sub-file */
- char fpartline[MAXLINE + 1];/* buffer for partial line */
- char fbuf[INBUFSIZE + 1]; /* buffer to read into */
- char fname[1]; /* file name (variable length), 1 for null */
-};
-
-struct get_s /* to record included files */
-{
- fd_t fd;
- unsigned line;
- long position;
-};
-
-PRIVATE char hid_filnambuf[FILNAMLEN + 1]; /* buffer for file name */
-
-PRIVATE struct get_s hid_getstak[MAXGET]; /* GET stack */
-PRIVATE struct get_s *getstak; /* ptr */
-
-PRIVATE struct fcbstruct input; /* current input file control block */
- /* input.lineptr is not kept up to date */
- /* input.fd depends on zero init */
-PRIVATE struct fbufstruct xyz;
-PRIVATE struct fbufstruct *inputbuf; /* current input file buffer */
- /* its fcb only to date in includes */
-
-PRIVATE char hid_linebuf[LINLEN]; /* line buffer */
-PRIVATE char *maclinebuf;
-PRIVATE char *maclineptr;
-
-FORWARD void clearsource P((void));
-FORWARD void line_too_long P((void));
-
-PRIVATE void clearsource()
-{
- input.includer = inputbuf;
- inputbuf = &xyz;
- input.first = input.limit = input.buf = inputbuf->fbuf;
- *(lineptr = linebuf = input.first - 1) = EOLCHAR;
- input.blocksize = 0;
-}
-
-PRIVATE void line_too_long()
-{
- symname = linebuf + (LINLEN - 1); /* spot for the error */
- error(LINLONG); /* so error is shown in column LINLEN - 1 */
-}
-
-/* initialise private variables */
-
-PUBLIC void initsource()
-{
- filnamptr = hid_filnambuf;
- getstak = hid_getstak + MAXGET;
- clearsource(); /* sentinel to invoke blank skipping */
-}
-
-PUBLIC fd_t open_input(name)
-char *name;
-{
- fd_t fd;
-
- if ((unsigned) (fd = open(name, O_RDONLY)) > 255)
- as_abort("error opening input file");
- clearsource();
- return fd;
-}
-
-/*
- handle GET pseudo_op
- stack state of current file, open new file and reset global state vars
- file must be seekable for the buffer discard/restore method to work
-*/
-
-PUBLIC void pget()
-{
-#if OLD
- if (infiln >= MAXGET)
- error(GETOV);
- else
- {
- skipline();
- listline();
- if (infiln != 0)
- {
- --getstak;
- getstak->fd = infil;
- getstak->line = linum;
- getstak->position = lseek(infil, 0L, 1) - (inbufend - inbufptr);
- ++infiln;
- linum = 0;
- infil = open_input(lineptr - 1);
- }
- }
-#else
- abort();
-#endif
-}
-
-/* process end of file */
-/* close file, unstack old file if current one is included */
-/* otherwise switch pass 0 to pass 1 or exit on pass 2 */
-/* end of file may be from phyical end of file or an END statement */
-
-PUBLIC void pproceof()
-{
- if (infiln != 0)
- close(infil);
- if (lineptr == linebuf)
- list.current = FALSE; /* don't list line after last unless error */
- if (infiln == infil0)
- /* all conditionals must be closed before end of main file (not GETs) */
- {
- if (blocklevel != 0)
- error(EOFBLOCK);
- if (iflevel != 0)
- error(EOFIF);
- if (lcdata & UNDBIT)
- error(EOFLC);
- lcptr->data = lcdata;
- lcptr->lc = lc;
- }
- /* macros must be closed before end of all files */
- if (macload)
- error(EOFMAC);
- listline(); /* last line or line after last if error */
- if (infiln != infil0)
- {
- infil = getstak->fd;
- linum = getstak->line;
- if (--infiln != 0)
- lseek(infil, getstak->position, 0);
- ++getstak;
- }
- else if (!pass)
- {
- pass = TRUE;
- objheader(); /* while pass 1 data all valid */
- binmbuf = 0; /* reset zero variables */
- maclevel = iflevel = blocklevel =
- totwarn = toterr = linum = macnum = 0;
- initp1p2(); /* reset other varaiables */
- binaryc = binaryg;
-#ifdef I80386
- defsize = idefsize;
-#endif
- list.current = list.global;
- maclist.current = maclist.global;
-
- warn.current = TRUE;
- if (warn.semaphore < 0)
- warn.current = FALSE;
- if (infiln != 0)
- infil = open_input(filnamptr);
- binheader();
- }
- else
- finishup();
-}
-
-/*
- read 1 line of source.
- Source line ends with '\n', line returned is null terminated without '\n'.
- Control characters other than blank, tab and newline are discarded.
- Long lines (length > LINLEN) are truncated, and an error is generated.
- On EOF, calls pproceof(), and gets next line unless loading a macro.
- This is where macro lines are recursively expanded.
-*/
-
-PUBLIC void readline()
-{
- listpre = FALSE; /* not listed yet */
- if (maclevel != 0)
- {
- register char *bufptr; /* hold *bufptr in a reg char variable */
- register char *reglineptr; /* if possible (not done here) */
- char *oldbufptr;
- struct schain_s *parameters;
- char paramnum;
- unsigned char remaining; /* space remaining in line + 2 */
- /* value 0 not used except for temp predec */
- /* value 1 means error already gen */
- /* values 1 and 2 mean no space */
-
- for (; maclevel != 0;
- macpar = macstak->parameters, ++macstak, --maclevel)
- if (*(bufptr = macstak->text) != ETB)
- /* nonempty macro, process it and return without continuing the for loop */
- {
- if (!macflag)
- {
- maclinebuf = linebuf;
- maclineptr = lineptr;
- macflag = TRUE;
- }
- remaining = (unsigned char)LINLEN + 2;
- lineptr = linebuf = reglineptr = hid_linebuf;
- while (*bufptr++ != EOLCHAR)
- {
- if (bufptr[-1] == MACROCHAR && *bufptr >= '0' && *bufptr <= '9')
- {
- parameters = macstak->parameters;
- for (paramnum = *bufptr++; paramnum-- != '0';)
- if ((parameters = parameters->next) == NULL)
- break;
- if (parameters != NULL)
- {
- for (oldbufptr = bufptr, bufptr = parameters->string;
- *bufptr++ != 0;)
- {
- if (--remaining <= 1)
- {
- if (remaining != 0)
- line_too_long();
- remaining = 1;
- break; /* forget rest, param on 1 line */
- }
- *reglineptr++ = bufptr[-1];
- }
- bufptr = oldbufptr;
- }
- }
- else
- {
- if (--remaining <= 1)
- {
- if (remaining != 0)
- line_too_long();
- remaining = 1;
- }
- else
- *reglineptr++ = bufptr[-1];
- }
- }
- macstak->text = bufptr;
- *reglineptr = EOLCHAR;
- return;
- }
- }
- if (macflag)
- {
- linebuf = maclinebuf;
- lineptr = maclineptr;
- macflag = FALSE;
- }
-again:
- ++linum;
- ++lineptr; /* if eof, this is input.limit + 1 */
- if (input.blocksize != 0) /* and this routine just resets eof */
- {
- if (lineptr < input.limit) /* move back partial line */
- {
- register char *col;
-
- col = input.buf;
- while ((*--col = *--input.limit) != EOLCHAR)
- ;
- input.first = col + 1;
- ++input.limit;
- input.blocksize = 0;
- }
- else /* may be non-terminated line, don't stop */
- lineptr = input.limit;
- }
- if (lineptr == input.limit)
- {
- lineptr = input.first;
- input.blocksize = read(infil, input.buf, INBUFSIZE);
- if (input.blocksize < 0)
- abort();
- if (input.blocksize == 0)
- {
- clearsource();
- pproceof();
- if (macload)
- {
- symname = lineptr;
- return; /* macro not allowed across eof */
- }
- goto again;
- }
- input.first = input.buf;
- *(input.limit = input.buf + input.blocksize) = EOLCHAR;
- }
- linebuf = lineptr;
- if (lineptr >= input.limit)
- *(lineptr = input.limit = input.buf) = EOLCHAR;
-}
-
-PUBLIC void skipline()
-{
- register char *reglineptr;
-
- reglineptr = lineptr - 1;
- while (*reglineptr != EOLCHAR)
- ++reglineptr;
- lineptr = reglineptr;
-}
diff --git a/bin86-0.3/as/scan.c b/bin86-0.3/as/scan.c
deleted file mode 100644
index d8c3cd2..0000000
--- a/bin86-0.3/as/scan.c
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * bin86/as/scan.c
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-/* scan.c - lexical analyser for assembler */
-
-#include "const.h"
-#include "type.h"
-#include "globvar.h"
-#undef EXTERN
-#define EXTERN
-#include "scan.h"
-
-PRIVATE int numbase; /* base for number */
-
-PRIVATE char symofchar[256] = /* table to convert chars to their symbols */
-{
- WHITESPACE, WHITESPACE, WHITESPACE, WHITESPACE,
- WHITESPACE, WHITESPACE, WHITESPACE, WHITESPACE,
- WHITESPACE, WHITESPACE, EOLSYM, WHITESPACE,
- WHITESPACE, WHITESPACE, WHITESPACE, WHITESPACE,
- WHITESPACE, WHITESPACE, WHITESPACE, WHITESPACE,
- WHITESPACE, WHITESPACE, WHITESPACE, WHITESPACE,
- WHITESPACE, WHITESPACE, WHITESPACE, WHITESPACE,
- WHITESPACE, WHITESPACE, WHITESPACE, WHITESPACE,
-
- WHITESPACE, EOLSYM, STRINGCONST, IMMEDIATE, /* !"# */
- HEXCONST, BINCONST, ANDOP, CHARCONST, /* $%&' */
- LPAREN, RPAREN, STAR, ADDOP, /* ()*+ */
- COMMA, SUBOP, IDENT, SLASH, /* ,-./ */
-
- INTCONST, INTCONST, INTCONST, INTCONST, /* 0123 */
- INTCONST, INTCONST, INTCONST, INTCONST, /* 4567 */
- INTCONST, INTCONST, COLON, EOLSYM, /* 89:; */
- LESSTHAN, EQOP, GREATERTHAN, MACROARG, /* <=>? */
-
- INDIRECT, IDENT, IDENT, IDENT, /* @ABC */
- IDENT, IDENT, IDENT, IDENT, /* DEFG */
- IDENT, IDENT, IDENT, IDENT, /* HIJK */
- IDENT, IDENT, IDENT, IDENT, /* LMNO */
- IDENT, IDENT, IDENT, IDENT, /* PQRS */
- IDENT, IDENT, IDENT, IDENT, /* TUVW */
- IDENT, IDENT, IDENT, LBRACKET, /* XYZ[ */
- OTHERSYM, RBRACKET, OTHERSYM, IDENT, /* \]^_ */
-
- OTHERSYM, IDENT, IDENT, IDENT, /* `abc */
- IDENT, IDENT, IDENT, IDENT, /* defg */
- IDENT, IDENT, IDENT, IDENT, /* hijk */
- IDENT, IDENT, IDENT, IDENT, /* lmno */
- IDENT, IDENT, IDENT, IDENT, /* pqrs */
- IDENT, IDENT, IDENT, IDENT, /* tuvw */
- IDENT, IDENT, IDENT, OTHERSYM, /* xyz{ */
- OROP, OTHERSYM, NOTOP, OTHERSYM, /* |}~ */
-
- WHITESPACE, WHITESPACE, WHITESPACE, WHITESPACE,
- WHITESPACE, WHITESPACE, WHITESPACE, WHITESPACE,
- WHITESPACE, WHITESPACE, WHITESPACE, WHITESPACE,
- WHITESPACE, WHITESPACE, WHITESPACE, WHITESPACE,
- WHITESPACE, WHITESPACE, WHITESPACE, WHITESPACE,
- WHITESPACE, WHITESPACE, WHITESPACE, WHITESPACE,
- WHITESPACE, WHITESPACE, WHITESPACE, WHITESPACE,
- WHITESPACE, WHITESPACE, WHITESPACE, WHITESPACE,
-
- WHITESPACE, WHITESPACE, WHITESPACE, WHITESPACE,
- WHITESPACE, WHITESPACE, WHITESPACE, WHITESPACE,
- WHITESPACE, WHITESPACE, WHITESPACE, WHITESPACE,
- WHITESPACE, WHITESPACE, WHITESPACE, WHITESPACE,
- WHITESPACE, WHITESPACE, WHITESPACE, WHITESPACE,
- WHITESPACE, WHITESPACE, WHITESPACE, WHITESPACE,
- WHITESPACE, WHITESPACE, WHITESPACE, WHITESPACE,
- WHITESPACE, WHITESPACE, WHITESPACE, WHITESPACE,
-
- WHITESPACE, WHITESPACE, WHITESPACE, WHITESPACE,
- WHITESPACE, WHITESPACE, WHITESPACE, WHITESPACE,
- WHITESPACE, WHITESPACE, WHITESPACE, WHITESPACE,
- WHITESPACE, WHITESPACE, WHITESPACE, WHITESPACE,
- WHITESPACE, WHITESPACE, WHITESPACE, WHITESPACE,
- WHITESPACE, WHITESPACE, WHITESPACE, WHITESPACE,
- WHITESPACE, WHITESPACE, WHITESPACE, WHITESPACE,
- WHITESPACE, WHITESPACE, WHITESPACE, WHITESPACE,
-
- WHITESPACE, WHITESPACE, WHITESPACE, WHITESPACE,
- WHITESPACE, WHITESPACE, WHITESPACE, WHITESPACE,
- WHITESPACE, WHITESPACE, WHITESPACE, WHITESPACE,
- WHITESPACE, WHITESPACE, WHITESPACE, WHITESPACE,
- WHITESPACE, WHITESPACE, WHITESPACE, WHITESPACE,
- WHITESPACE, WHITESPACE, WHITESPACE, WHITESPACE,
- WHITESPACE, WHITESPACE, WHITESPACE, WHITESPACE,
- WHITESPACE, WHITESPACE, WHITESPACE, WHITESPACE
-};
-
-FORWARD void intconst P((void));
-
-PUBLIC void context_hexconst()
-{
- numbase = 16;
- intconst();
-}
-
-PUBLIC void getsym()
-{
- register char *reglineptr;
-
- reglineptr = lineptr;
-advance:
- symname = reglineptr;
- switch (sym = symofchar[*reglineptr++])
- {
- case WHITESPACE:
- goto advance;
- case ADDOP:
- if (*reglineptr == '+')
- {
- sym = POSTINCOP;
- ++reglineptr;
- }
- break;
- case BINCONST:
- numbase = 2;
- lineptr = reglineptr;
- intconst();
- return;
- case CHARCONST:
- if ((number = *reglineptr) < ' ')
- number = ' ';
- if (*reglineptr != EOL)
- ++reglineptr;
- sym = INTCONST;
- break;
- case GREATERTHAN: /* context-sensitive */
- if (*reglineptr == '>')
- {
- sym = SROP;
- ++reglineptr;
- }
- break;
- case HEXCONST:
- numbase = 16;
- lineptr = reglineptr;
- intconst();
- return;
- case IDENT:
- /* walk to end of identifier - magic INTCONST is max of INT, IDENT */
- while (symofchar[*reglineptr] <= INTCONST)
- ++reglineptr;
- lineptr = reglineptr;
- gsymptr = lookup();
- return;
- case INTCONST:
- if (*(reglineptr - 1) == '0')
- {
- if (*reglineptr != 'x' && *reglineptr != 'X')
- numbase = 8;
- else
- {
- numbase = 16;
- ++reglineptr;
- }
- }
- else
- {
- --reglineptr;
- numbase = 10;
- }
- lineptr = reglineptr;
- intconst();
- return;
- case LESSTHAN: /* context-sensitive */
- if (*reglineptr == '<')
- {
- sym = SLOP;
- ++reglineptr;
- }
- break;
- case SUBOP:
- if (*reglineptr == '-')
- {
- sym = PREDECOP;
- ++reglineptr;
- }
- break;
- }
- lineptr = reglineptr;
- return;
-}
-
-PUBLIC void getsym_nolookup()
-{
- bool_t old_ifflag;
-
- old_ifflag = ifflag;
- ifflag = FALSE;
- getsym();
- ifflag = old_ifflag;
-}
-
-PRIVATE void intconst()
-{
- register char *reglineptr;
-
- number = 0;
- reglineptr = lineptr;
- for (; *reglineptr >= '0'; ++reglineptr)
- {
- if (*reglineptr > '9')
- {
- if (numbase != 16)
- break;
- if (*reglineptr >= 'a' && *reglineptr <= 'f')
- {
- if (number != 0)
- number = numbase * number + (*reglineptr - 'a' + 10);
- else
- number = *reglineptr - 'a' + 10;
- }
- else if (*reglineptr >= 'A' && *reglineptr <= 'F')
- {
- if (number != 0)
- number = numbase * number + (*reglineptr - 'A' + 10);
- else
- number = *reglineptr - 'A' + 10;
- }
- else
- break;
- }
- else if (number != 0)
- number = numbase * number + (*reglineptr - '0');
- else
- number = *reglineptr - '0';
- }
- if (*reglineptr == 'L' || *reglineptr == 'l')
- ++reglineptr;
- sym = INTCONST;
- lineptr = reglineptr;
-}
-
-PUBLIC void initscan()
-{
- if (asld_compatible)
- {
- lindirect = LPAREN;
- rindexp = RPEXP;
- rindirect = RPAREN;
- }
- else
- {
- lindirect = LBRACKET;
- rindexp = RBEXP;
- rindirect = RBRACKET;
- }
-}
diff --git a/bin86-0.3/as/scan.h b/bin86-0.3/as/scan.h
deleted file mode 100644
index f4421b7..0000000
--- a/bin86-0.3/as/scan.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * bin86/as/scan.h
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-/* scan.h - global variables for scanner for assembler */
-
-#define EOLCHAR '\n'
-
-EXTERN struct sym_s *gsymptr; /* global symbol ptr */
-EXTERN char lindirect; /* left symbol for indirect addressing */
-EXTERN char *lineptr; /* current line position */
-EXTERN offset_t number; /* constant number */
-EXTERN int rindexp; /* error code for missing rindirect */
-EXTERN char rindirect; /* right symbol for indirect addressing */
-EXTERN char sym; /* current symbol */
-EXTERN char *symname; /* current symbol name */
diff --git a/bin86-0.3/as/source.h b/bin86-0.3/as/source.h
deleted file mode 100644
index 5b4f847..0000000
--- a/bin86-0.3/as/source.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * bin86/as/source.h
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-/* source.h - global variables for source handlers for assembler */
-
-EXTERN unsigned linum; /* line # */
-EXTERN bool_t listpre; /* flag to show line has already been listed */
diff --git a/bin86-0.3/as/table.c b/bin86-0.3/as/table.c
deleted file mode 100644
index eab6e4b..0000000
--- a/bin86-0.3/as/table.c
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * bin86/as/table.c
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-/* table.c - symbol table handler for assembler */
-
-#include "const.h"
-#include "type.h"
-#include "globvar.h"
-#include "scan.h"
-
-#define hconv(ch) ((unsigned char) (ch) - 0x41) /* better form for hashing */
-
-#ifdef I80386
-# ifdef MNSIZE
-EXTERN char bytesizeops[];
-# endif
-#endif
-EXTERN char ops[];
-EXTERN char page1ops[];
-EXTERN char page2ops[];
-EXTERN char regs[];
-#ifdef I80386
-EXTERN char typesizes[];
-#endif
-
-#ifdef DEBUG
-unsigned nhash;
-unsigned nlookup;
-unsigned nsym;
-unsigned nx[30];
-FORWARD void printchain P((void));
-#endif
-
-FORWARD void install P((register char *keyptr, unsigned data));
-
-PUBLIC void inst_keywords()
-{
- install(regs, REGBIT);
-#ifdef I80386
- install(typesizes, SIZEBIT);
-#endif
- install(ops, 0);
- install(page1ops, PAGE1);
- install(page2ops, PAGE2);
-#ifdef I80386
-# ifdef MNSIZE
- install(bytesizeops, PAGE1 | PAGE2);
-# endif
-#endif
-}
-
-PRIVATE void install(keyptr, data)
-register char *keyptr;
-unsigned data;
-{
- char lowcasebuf[20];
- unsigned namelength;
- char *nameptr;
- char *namend;
- register struct sym_s *symptr;
-
- while (*keyptr != 0)
- {
- namelength = *keyptr++;
- lineptr = (symname = keyptr) + namelength;
- for (nameptr = lowcasebuf, namend = lowcasebuf + namelength;
- nameptr < namend;)
- {
- if (*keyptr < 'A' || *keyptr > 'Z')
- *nameptr++ = *keyptr++;
- else
- *nameptr++ = *keyptr++ + ('a' - 'A');
- }
- symptr = lookup();
- symptr->type = MNREGBIT;
- symptr->data = data;
- symptr->value_reg_or_op.op.routine = *keyptr;
- symptr->value_reg_or_op.op.opcode = keyptr[1];
- lineptr = (symname = lowcasebuf) + namelength;
- symptr = lookup();
- symptr->type = MNREGBIT;
- symptr->data = data;
- symptr->value_reg_or_op.op.routine = *keyptr;
- symptr->value_reg_or_op.op.opcode = keyptr[1];
- keyptr += 2;
- }
-}
-
-/* Lookup() searches symbol table for the string from symname to lineptr - 1.
- * If string is not found and ifflag is TRUE, string is added to table, with
- * type = 0
- * data = inidata (RELBIT | UNDBIT, possibly with IMPBIT | SEGM)
- * Returns pointer to symbol entry (NULL if not found and not installed)
- * unless symbol table overflows, when routine aborts.
- */
-
-PUBLIC struct sym_s *lookup()
-{
- struct sym_s **hashptr;
- register char *nameptr;
- register struct sym_s *symptr;
- register unsigned hashval;
- register unsigned length;
-#ifdef DEBUG
- int tries;
-
- ++nlookup;
- tries = 0;
-#endif
-
- /* Hash function is a weighted xor of 1 to 4 chars in the string.
- * This works seems to work better than looking at all the chars.
- * It is important that the function be fast.
- * The string comparision function should also be fast and it helps
- * if it is optimized for mostly identical comparisions.
- * The multiplication by MULTIPLIER should compile as a shift.
- */
-
-#define MULTIPLIER (SPTSIZ / (1 << USEFUL_BITS_IN_ASCII))
-#define USEFUL_BITS_IN_ASCII 6
-
- nameptr = lineptr;
- length = nameptr - symname;
- if (length <= 3)
- {
- if (length <= 2)
- hashval = hconv(nameptr[-1]) * MULTIPLIER;
- else
- hashval = hconv(nameptr[-2]) * MULTIPLIER,
- hashval ^= hconv(nameptr[-1]);
- }
- else
- hashval = hconv(nameptr[-(length / 2)]) * MULTIPLIER,
- hashval ^= hconv(nameptr[-2]) << 2,
- hashval ^= hconv(nameptr[-1]);
- nameptr = symname;
- if ((symptr = *(hashptr = spt +
- (hashval ^ (hconv(nameptr[0]) << 1)) % SPTSIZ))
- != NULL)
- {
- do
- {
-#ifdef DEBUG
- if (tries != 0)
- --nx[tries];
- ++tries;
- if (tries < sizeof nx / sizeof nx[0])
- ++nx[tries];
- if (tries >= 5)
- printchain(hashptr - spt)
-#endif
- if ((unsigned char) length != symptr->length)
- continue;
- if (memcmp(symptr->name, nameptr, length) == 0)
- return symptr;
- }
- while ((symptr = symptr->next) != NULL);
-
- /* Calculate last non-NULL hash ptr.
- * This is faster than keeping hashptr up to date in previous loop
- * since most lookups are successful and hash ptr is not needed.
- */
- do
- {
- symptr = *hashptr;
- hashptr = &symptr->next;
- }
- while (symptr->next != NULL);
- }
- if (!ifflag)
- return NULL;
- align(heapptr);
- if (heapptr >= heapend)
- fatalerror(SYMOV);
-#ifdef DEBUG
- ++nsym;
- if (hashptr >= spt && hashptr < spt + SPTSIZ)
- ++nhash;
-#endif
- *hashptr = symptr = (struct sym_s *) heapptr;
- symptr->type = 0;
- symptr->data = inidata;
- symptr->length = length;
- symptr->value_reg_or_op.value = (unsigned) (symptr->next = NULL);
- heapptr = symptr->name;
- do
- *heapptr++ = *nameptr++;
- while (--length != 0);
- *heapptr++ = 0;
- return symptr;
-}
-
-#ifdef DEBUG
-
-static void printchain(hashval)
-unsigned hashval;
-{
- register struct sym_s *symptr;
-
- printf("%04x ", hashval);
- for (symptr = spt[hashval]; symptr != NULL; symptr = symptr->next)
- printf("%s ", symptr->name);
- printf("\n");
-}
-
-#endif
-
-PUBLIC void statistics()
-{
-#ifdef DEBUG
- int i;
- int weight;
-
- for (i = 0; i < SPTSIZ; ++i)
- printchain(i);
- printf("nhash = %d, nsym = %d, nlookup = %d nx =\n", nhash, nsym, nlookup);
- weight = 0;
- for (i = 0; i < 30; ++i)
- {
- printf("%5d", nx[i]);
- weight += nx[i] * i;
- }
- printf("\n");
- printf("weight = %d%d\n", w;
-#endif
-}
diff --git a/bin86-0.3/as/todo b/bin86-0.3/as/todo
deleted file mode 100644
index 56c5424..0000000
--- a/bin86-0.3/as/todo
+++ /dev/null
@@ -1,10 +0,0 @@
-Improve string escaping.
-
-Produce bsd symbol tables.
-
-Accept gas format.
-
-Decide how to choose between 8-bit and 32-bit branches. 16-bit branches in
-32-bit mode are unusable because top 16 bits of PC are messed up.
-
-Limit insns to specified processor (warn for 386 insns on 8086).
diff --git a/bin86-0.3/as/type.h b/bin86-0.3/as/type.h
deleted file mode 100644
index cb2aed5..0000000
--- a/bin86-0.3/as/type.h
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * bin86/as/type.h
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-/* type.h - types for assembler */
-
-/* redefine foo_t's because their use has become non-portable */
-
-#define bool_t bool_T
-#define count_t count_T
-#define fd_t fd_T
-#define indcount_t indcount_T
-#define offset_t offset_T
-#define opcode_t opcode_T
-#define opsize_t opsize_T
-#define scale_t scale_T
-#define sem_t sem_T
-#define smallcount_t smallcount_T
-#define soffset_t soffset_T
-#define u8_t u8_T
-#define u16_t u16_T
-#define u32_t u32_T
-
-typedef unsigned char bool_t;
-typedef int bool_pt; /* change to int for ANSI C */
-typedef unsigned count_t;
-typedef unsigned error_pt;
-typedef int fd_t;
-typedef unsigned char indcount_t;
-#ifdef I80386
-typedef unsigned long offset_t;
-typedef long soffset_t;
-# define SIZEOF_OFFSET_T 4 /* non-portable */
-#endif
-#ifdef MC6809
-typedef unsigned offset_t;
-typedef int soffset_t;
-# define SIZEOF_OFFSET_T 2 /* but sizeof (offset_t) often breaks cpp */
-#endif
-typedef unsigned opcode_pt;
-typedef unsigned char opcode_t;
-typedef unsigned opsize_pt;
-typedef unsigned char opsize_t;
-typedef unsigned reg_pt;
-typedef unsigned char scale_t;
-typedef unsigned char smallcount_t;
-typedef /* signed */ char sem_t;
-typedef unsigned u16_pt;
-typedef unsigned short u16_t;
-typedef unsigned long u32_pt;
-typedef unsigned long u32_t;
-
-/* symbol table entry */
-
-struct sym_s
-{
- struct sym_s *next; /* next symbol in hash chain (NULL if none) */
- /* zero offset because it is accessed most */
- unsigned char type;
- unsigned char data; /* flags valid for expressions as well as syms*/
- union
- {
- offset_t value; /* value, if sym is a label */
- unsigned char reg; /* register code, if sym is a register */
- struct
- {
- unsigned char routine; /* routine number */
- opcode_t opcode; /* opcode, if sym is a hardware op */
- }
- op; /* if sym is pseudo-op or hardware op */
- }
- value_reg_or_op;
- unsigned char length; /* length of symbol string */
- char name[1]; /* string of variable length */
-};
-
-/* address */
-
-struct address_s
-{
- offset_t offset;
- unsigned char data;
- struct sym_s *sym;
-};
-
-#ifdef I80386
-
-/* effective address */
-
-struct ea_s
-{
- indcount_t indcount;
- opsize_t size;
- reg_pt base;
- reg_pt index;
- scale_t scale;
- struct address_s displ;
-};
-
-#endif
-
-/* flags */
-
-struct flags_s
-{
- bool_t global;
- bool_t current;
- int semaphore;
-};
-
-/* location counter */
-
-struct lc_s
-{
- unsigned char data;
- offset_t lc;
-};
-
-/* string chain */
-
-struct schain_s
-{
- struct schain_s *next;
- char string[2]; /* variable length */
-};
-
-/* block stack */
-
-struct block_s
-{
- unsigned char data;
- unsigned char dp;
- offset_t lc;
-};
-
-/* if stack */
-
-struct if_s
-{
- bool_t ifflag;
- bool_t elseflag;
-};
-
-/* macro stack */
-
-struct macro_s
-{
- char *text;
- struct schain_s *parameters;
-};
-
-/* symbol listing format */
-
-struct sym_listing_s
-{
- char name[SYMLIS_NAMELEN];
- char zname[2];
- char segm[1];
- char pad1[1];
- char value[4];
- char pad2[1];
- char ar[1];
- char pad3[1];
- char cein[1];
- char pad4[1];
- char nullterm;
-};
-
-#if __STDC__
-typedef void (*pfv)(void);
-#else
-typedef void (*pfv)();
-#endif
-
-#include "proto.h"
diff --git a/bin86-0.3/as/work/q b/bin86-0.3/as/work/q
deleted file mode 100644
index 0f6fefe..0000000
--- a/bin86-0.3/as/work/q
+++ /dev/null
@@ -1,4 +0,0 @@
-for i in $k/*.s $k/*.s $k/*.s $k/*.s $k/*.s $k/*.s $k/*.s $k/*.s $k/*.s $k/*.s
-do
- $a/as $i -3 -w -u
-done
diff --git a/bin86-0.3/as/work/r b/bin86-0.3/as/work/r
deleted file mode 100644
index aca1637..0000000
--- a/bin86-0.3/as/work/r
+++ /dev/null
@@ -1,4 +0,0 @@
-for i in $k/*.s $k/*.s $k/*.s $k/*.s $k/*.s $k/*.s $k/*.s $k/*.s $k/*.s $k/*.s
-do
- $lb/as $i -3 -w -u
-done
diff --git a/bin86-0.3/as/work/r-good b/bin86-0.3/as/work/r-good
deleted file mode 100644
index 1fa22e6..0000000
--- a/bin86-0.3/as/work/r-good
+++ /dev/null
@@ -1,1183 +0,0 @@
-sgdt sidt sldt _aprefix _oprefix
-sgdt sidt sldt _aprefix _oprefix
-.byte CBW JB JNBE .C9
-sgdt sidt sldt _aprefix _oprefix
-edx sal _notimmed _getimmed _yesimmed
-sgdt sidt sldt _aprefix _oprefix _getshift
-sgdt sidt sldt _aprefix _oprefix _getshift
-sgdt sidt sldt _aprefix _oprefix _getshift
-sgdt sidt sldt _aprefix _oprefix _getshift _sprefix
-LCOMM REPE STOW .4 .4A
-sgdt sidt sldt _aprefix _oprefix _getshift _sprefix
-edx sal _notimmed _getimmed _yesimmed
-edx sal _notimmed _getimmed _yesimmed
-INC JNA REPNE SETNC .131
-edx sal _notimmed _getimmed _yesimmed
-edx sal _notimmed _getimmed _yesimmed
-qword outsd rcrb rorb _mdivmul
-JNL ROL CMPB .2D .140
-BNE INW JMPI LOOPNE .141
-dr0 SALB SHLB .7D .154
-sgdt sidt sldt _aprefix _oprefix _getshift _sprefix
-sgdt sidt sldt _aprefix _oprefix _getshift _sprefix
-EXPORT RCLB ROLB .7F .156
-sgdt sidt sldt _aprefix _oprefix _getshift _sprefix
-sgdt sidt sldt _aprefix _oprefix _getshift _sprefix
-sgdt sidt sldt _aprefix _oprefix _getshift _sprefix
-edx sal _notimmed _getimmed _yesimmed
-sgdt sidt sldt _aprefix _oprefix _getshift _sprefix
-sgdt sidt sldt _aprefix _oprefix _getshift _sprefix
-scasw stosw setc smsw .19A
-sgdt sidt sldt _aprefix _oprefix _getshift _sprefix
-XLAT ADDB ANDB .B8 .1B4
-LGDT LIDT LLDT INCB .B4
-LGDT LIDT LLDT INCB .B4 .1B8
-LGDT LIDT LLDT INCB .B4 .1B8
-sgdt sidt sldt _aprefix _oprefix _getshift _sprefix
-sgdt sidt sldt _aprefix _oprefix _getshift _sprefix
-.byte CBW JB JNBE .C9
-BH JG PUSHA .F9 .1E9
-cmpsd iretd verr .FF .1EF
-sgdt sidt sldt _aprefix _oprefix _getshift _sprefix
-sgdt sidt sldt _aprefix _oprefix _getshift _sprefix
-ELSEIF PUSHAD REP .E8 .1F4
-word insd xorb .EB ..FFFF
-byte cmpsw .E .EA ..FFFE
-byte cmpsw .E .EA ..FFFE .1FE
-byte cmpsw .E .EA ..FFFE .1FE
-byte cmpsw .E .EA ..FFFE .1FE
-byte cmpsw .E .EA ..FFFE .1FE
-CWD MOVSX NOTB .102 .202
-LCOMM REPE STOW .4 .4A .111
-LCOMM REPE STOW .4 .4A .111
-edx sal _notimmed _getimmed _yesimmed
-INC JNA REPNE SETNC .131
-INB LOOP SETNB .134 .234
-BMI .2 .2A .139 .239
-JNL ROL CMPB .2D .140
-JNL ROL CMPB .2D .140 .240
-JNL ROL CMPB .2D .140 .240
-LCOMM REPE STOW .4 .4A .111 .211
-sgdt sidt sldt _aprefix _oprefix _getshift _sprefix
-sgdt sidt sldt _aprefix _oprefix _getshift _sprefix
-sgdt sidt sldt _aprefix _oprefix _getshift _sprefix
-LGDT LIDT LLDT INCB .B4 .1B8
-.byte CBW JB JNBE .C9 .1C1
-.byte CBW JB JNBE .C9 .1C1
-edx sal _notimmed _getimmed _yesimmed
-sgdt sidt sldt _aprefix _oprefix _getshift _sprefix
-sgdt sidt sldt _aprefix _oprefix _getshift _sprefix
-edx sal _notimmed _getimmed _yesimmed
-word insd xorb .EB ..FFFF .1FF
-sgdt sidt sldt _aprefix _oprefix _getshift _sprefix
-sgdt sidt sldt _aprefix _oprefix _getshift _sprefix
-sgdt sidt sldt _aprefix _oprefix _getshift _sprefix
-sgdt sidt sldt _aprefix _oprefix _getshift _sprefix
-sgdt sidt sldt _aprefix _oprefix _getshift _sprefix
-LCOMM REPE STOW .4 .4A .111 .211
-LCOMM REPE STOW .4 .4A .111 .211
-sgdt sidt sldt _aprefix _oprefix _getshift _sprefix
-edx sal _notimmed _getimmed _yesimmed
-edx sal _notimmed _getimmed _yesimmed
-INC JNA REPNE SETNC .131 .231
-INC JNA REPNE SETNC .131 .231
-edx sal _notimmed _getimmed _yesimmed
-edx sal _notimmed _getimmed _yesimmed
-qword outsd rcrb rorb _mdivmul
-qword outsd rcrb rorb _mdivmul
-JNL ROL CMPB .2D .140 .240
-JNL ROL CMPB .2D .140 .240
-BNE INW JMPI LOOPNE .141
-BNE INW JMPI LOOPNE .141
-dr0 SALB SHLB .7D .154
-dr0 SALB SHLB .7D .154
-sgdt sidt sldt _aprefix _oprefix _getshift _sprefix
-sgdt sidt sldt _aprefix _oprefix _getshift _sprefix
-EXPORT RCLB ROLB .7F .156
-EXPORT RCLB ROLB .7F .156
-sgdt sidt sldt _aprefix _oprefix _getshift _sprefix
-sgdt sidt sldt _aprefix _oprefix _getshift _sprefix
-sgdt sidt sldt _aprefix _oprefix _getshift _sprefix
-edx sal _notimmed _getimmed _yesimmed
-sgdt sidt sldt _aprefix _oprefix _getshift _sprefix
-sgdt sidt sldt _aprefix _oprefix _getshift _sprefix
-scasw stosw setc smsw .19A
-retf testb _segword _marpl .19B
-scasw stosw setc smsw .19A
-ENDB SAR SBB .A0 .1A0
-sgdt sidt sldt _aprefix _oprefix _getshift _sprefix
-jcxe jecxe .A .AA .1AA
-XLAT ADDB ANDB .B8 .1B4
-XLAT ADDB ANDB .B8 .1B4
-LGDT LIDT LLDT INCB .B4 .1B8
-LGDT LIDT LLDT INCB .B4 .1B8
-LGDT LIDT LLDT INCB .B4 .1B8
-LGDT LIDT LLDT INCB .B4 .1B8
-sgdt sidt sldt _aprefix _oprefix _getshift _sprefix
-sgdt sidt sldt _aprefix _oprefix _getshift _sprefix
-.byte CBW JB JNBE .C9 .1C1
-.byte CBW JB JNBE .C9 .1C1
-byte cmpsw .E .EA ..FFFE .1FE
-BH JG PUSHA .F9 .1E9
-BH JG PUSHA .F9 .1E9
-lodsw lmsw verw .FC .1EC
-cmpsd iretd verr .FF .1EF
-cmpsd iretd verr .FF .1EF
-sgdt sidt sldt _aprefix _oprefix _getshift _sprefix
-sgdt sidt sldt _aprefix _oprefix _getshift _sprefix
-ELSEIF PUSHAD REP .E8 .1F4
-ELSEIF PUSHAD REP .E8 .1F4
-word insd xorb .EB ..FFFF .1FF
-word insd xorb .EB ..FFFF .1FF
-byte cmpsw .E .EA ..FFFE .1FE
-byte cmpsw .E .EA ..FFFE .1FE
-byte cmpsw .E .EA ..FFFE .1FE
-byte cmpsw .E .EA ..FFFE .1FE
-byte cmpsw .E .EA ..FFFE .1FE
-byte cmpsw .E .EA ..FFFE .1FE
-CWD MOVSX NOTB .102 .202
-CWD MOVSX NOTB .102 .202
-LCOMM REPE STOW .4 .4A .111 .211
-LCOMM REPE STOW .4 .4A .111 .211
-LCOMM REPE STOW .4 .4A .111 .211
-edx sal _notimmed _getimmed _yesimmed
-INC JNA REPNE SETNC .131 .231
-INC JNA REPNE SETNC .131 .231
-IN JNC SETNA .133 .233
-INB LOOP SETNB .134 .234
-CMC JNE SETNG .135 .235
-INB LOOP SETNB .134 .234
-BMI .2 .2A .139 .239
-BMI .2 .2A .139 .239
-JNL ROL CMPB .2D .140 .240
-JNL ROL CMPB .2D .140 .240
-JNL ROL CMPB .2D .140 .240
-JNL ROL CMPB .2D .140 .240
-0000 .bss AAA .1C3
-0001 .list EXTERN .1C4
-0002 .byte CBW JB JNBE .C9 .1C1
-0003 AAD .1C2
-0004 .1C7
-0005 .D0 .1C8
-0006 .data DAA JBE .1C5
-0007 LAR .1C6
-0008 .C3
-0009 RCL .C4 .1D0
-000a .C1 .1C9
-000b SGDT SIDT SLDT .C2
-000c AAM .C7
-000d .C8
-000e .C5
-000f EBX DECb .C6
-0010 .1D7
-0011 .1D8
-0012 AAS JA .D9 .1D5
-0013 RCR .1D6
-0014 DAS .1D3
-0015 .C0 .1D4
-0016 DB JAE JNAE .1D1
-0017 EBP SETDP
-0018 .D3
-0019 .D4
-001a .D1
-001b FAR .D2
-001c .D7
-001d POPAD .D8 .1C0
-001e .D5 .1D9
-001f EAX .D6
-0020 BLOCK BCC SETAE
-0021 .1B0
-0022 .A9 .1A9
-0023 .warn
-0024 CDQ
-0025 SCAB .B0
-0026
-0027
-0028 FCC .org .A3 .1A3
-0029 ADCB .A4 .1A4
-002a .A1 .1A1
-002b FCB LODB .A2 .1A2
-002c .A7 .1A7
-002d .word .A8 .1A8
-002e .A5 .1A5
-002f EDX SAL .A6 .1A6
-0030 EDI BCS
-0031 SBBB SUBB
-0032 ADC JC SCAW .B9
-0033 ADD
-0034 LDS LOCK SETBE
-0035 ENDB SAR SBB .A0 .1A0
-0036 DD SCAS .1B9
-0037
-0038 LODS .B3 .1B7
-0039 LGDT LIDT LLDT INCB .B4 .1B8
-003a .B1 .1B5
-003b FDB .B2 .1B6
-003c CWDE LODW .B7 .1B3
-003d XLAT ADDB ANDB .B8 .1B4
-003e .B5 .1B1
-003f ECX .B6 .1B2
-0040 IF
-0041
-0042 IFC .199
-0043
-0044 .zerow DEC LES XCHG
-0045 .text SHR
-0046
-0047
-0048 .193
-0049 ENTER _Ev .194
-004a _Ew .191
-004b _Ex .192
-004c .197
-004d SAHF _source2 .198
-004e .195
-004f .196
-0050
-0051
-0052 BEQ JE
-0053 IRET
-0054 LFS
-0055 .190
-0056 LEA
-0057 XCHGB
-0058 SETGE .9C
-0059 POPFD .9D
-005a .9 .9A
-005b .9B
-005c NEG
-005d
-005e .9E
-005f GET SHL .9F
-0060
-0061
-0062 SEG .E9
-0063 NEGB
-0064 LGS
-0065 .F0 .1E0
-0066 BGE .1F9
-0067
-0068 .E3 .1F7
-0069 _Gv .E4 .1F8
-006a _Gw .E1 .1F5
-006b _Gx .E2 .1F6
-006c .E7 .1F3
-006d ELSEIF PUSHAD REP .E8 .1F4
-006e JNGE .E5 .1F1
-006f .E6 .1F2
-0070 AH
-0071 BGT RET .1F0
-0072 BH JG PUSHA .F9 .1E9
-0073
-0074 CH
-0075 .E0
-0076 DH JGE
-0077 SET PUSHF
-0078 .F3 .1E3
-0079 PUSHFD .F4 .1E4
-007a BHI .F1 .1E1
-007b .F2 .1E2
-007c .F7 .1E7
-007d .F8 .1E8
-007e .F5 .1E5
-007f LAHF .F6 .1E6
-0080 tr7 .187
-0081 .188
-0082 J .185
-0083 tr6 .186
-0084 .183
-0085 MULB .184
-0086 DI .181
-0087 .182
-0088 .6C
-0089 .6D
-008a JNLE .6 .6A
-008b .6B
-008c PUBLIC
-008d IMULB .170
-008e .6E .189
-008f .6F
-0090 CALLI .173
-0091 .174
-0092 .171
-0093 CALL DIV .172
-0094 .177
-0095 .178
-0096 .175
-0097 .176
-0098 .5C
-0099 .5D .180
-009a .5 .5A .179
-009b .5B
-009c
-009d
-009e ELSEIFC .5E
-009f WAIT .5F
-00a0 dr7
-00a1 FAIL BLT
-00a2 JL
-00a3 dr6
-00a4 SI dr3
-00a5 cr2 IDIV .150
-00a6 cr3 dr1 JLE .169
-00a7 dr2 IMPORT
-00a8 .8C .167
-00a9 .8D .168
-00aa .8 .8A .165
-00ab .8B .166
-00ac .163
-00ad ENDIF HLT .164
-00ae .8E .161
-00af .8F .162
-00b0 AL BHIS
-00b1 .160
-00b2 BL .159
-00b3
-00b4 CL
-00b5
-00b6 DL BLE CLC
-00b7 CLD
-00b8 .7C .153
-00b9 dr0 SALB SHLB .7D .154
-00ba .7 .7A .151
-00bb cr0 SHLD .7B .152
-00bc BLO CLI SETLE .157
-00bd .158
-00be .7E .155
-00bf EXPORT RCLB ROLB .7F .156
-00c0 IN JNC SETNA .133 .233
-00c1 INB LOOP SETNB .134 .234
-00c2 INC JNA REPNE SETNC .131 .231
-00c3 JNB LOOPZ .132 .232
-00c4 JNG SETNE .137 .237
-00c5 .138 .238
-00c6 CMC JNE SETNG .135 .235
-00c7 ARPL .136 .236
-00c8 BLOS .2C
-00c9 JNL ROL CMPB .2D .140 .240
-00ca BMI .2 .2A .139 .239
-00cb CMP LOOPNZ SETNL .2B
-00cc JNO
-00cd JNP
-00ce SETNO .2E
-00cf SETNP .2F
-00d0 JNS .147
-00d1 .148
-00d2 INS POPA SETNS .145
-00d3 AND INT ROR .146
-00d4 SP .143
-00d5 .144
-00d6 BNE INW JMPI LOOPNE .141
-00d7 POPF .142
-00d8 .1C
-00d9 SETNZ .1D
-00da CMPS .1 .1A
-00db END JNZ .1B
-00dc SETNLE
-00dd JMP .130 .230
-00de CMPW LOOPE .1E .149
-00df REPNZ XOR .1F
-00e0 BPS
-00e1 .120 .220
-00e2 JP .119 .219
-00e3 RMB
-00e4
-00e5 BOUND
-00e6 JPE SETPO
-00e7 IDENT
-00e8 SETNGE .4C .113 .213
-00e9 NOT .4D .114 .214
-00ea LCOMM REPE STOW .4 .4A .111 .211
-00eb .4B .112 .212
-00ec JPO SETPE .117 .217
-00ed MOV .118 .218
-00ee STOS .4E .115 .215
-00ef .4F .116 .216
-00f0 BPC SETNAE
-00f1 POP
-00f2 BP JO
-00f3
-00f4 LOC SETNBE
-00f5 NOP .110 .210
-00f6 .129 .229
-00f7 REPZ
-00f8 COMM .3C .127 .227
-00f9 BPL .3D .128 .228
-00fa .3 .3A .125 .225
-00fb .3B .126 .226
-00fc .123 .223
-00fd STOB .124 .224
-00fe .3E .121 .221
-00ff .3F .122 .222
-0100
-0101
-0102
-0103 DIVB
-0104 SS
-0105 STR
-0106
-0107
-0108
-0109
-010a ORG MOVW
-010b IMUL
-010c OR
-010d ORB
-010e MOVS
-010f
-0110
-0111
-0112 BR
-0113
-0114
-0115 IDIVB
-0116 LEAVE STC
-0117 STD
-0118
-0119
-011a
-011b
-011c EQU STI
-011d MOVB
-011e
-011f
-0120 ESI BTS
-0121
-0122
-0123 BTR
-0124 CS LSS
-0125
-0126 DS
-0127 ESP .even JCXZ JECXZ BSF
-0128 ES
-0129
-012a FS
-012b
-012c GS
-012d
-012e
-012f
-0130 BTC
-0131
-0132 JS BT
-0133 BSR
-0134
-0135
-0136
-0137 LTR
-0138
-0139
-013a JCXE JECXE
-013b
-013c
-013d LSL
-013e
-013f PTR
-0140 BVS
-0141 SETZ
-0142 MACRO
-0143
-0144 ENTRY
-0145
-0146
-0147
-0148
-0149 PWORD
-014a SETS
-014b
-014c
-014d SCASB STOSB
-014e _jumps_long
-014f OUT SCASD STOSD
-0150 BVC
-0151 DWORD EXTRN
-0152
-0153 MUL XLATB SETL
-0154
-0155
-0156 RETI SETO
-0157 SETP
-0158 INCLUDE SETA
-0159 SETB
-015a SCASW STOSW SETC SMSW
-015b RETF TESTB
-015c SETE
-015d FWORD TEST
-015e TBYTE SETG
-015f
-0160 _calljmp_kludge .107 .207
-0161 OUTB .108 .208
-0162 INTO OUTSW .105 .205
-0163 .106 .206
-0164 ELSE .103 .203
-0165 SUB .104 .204
-0166 DW MOVSW .101 .201
-0167 CWD MOVSX NOTB .102 .202
-0168 LODSW LMSW VERW
-0169
-016a CLTS
-016b
-016c
-016d CMPSB
-016e INSW .109 .209
-016f CMPSD IRETD VERR
-0170 AX
-0171 MOVSB PUSH SARB SHRB
-0172 BX .ascii OUTS
-0173 .extern MOVSD SHRD
-0174 CX
-0175 .map OUTSB
-0176 DX .space OUTW
-0177 QWORD OUTSD RCRB RORB
-0178
-0179 INSB .100 .200
-017a BYTE CMPSW
-017b WORD INSD XORB
-017c
-017d LODSD
-017e
-017f LODSB
-0180
-0181
-0182 JZ
-0183
-0184
-0185
-0186 .comm
-0187
-0188
-0189
-018a
-018b
-018c
-018d
-018e
-018f
-0190 _mgroup1
-0191 .maclist _mgroup2
-0192 _mgroup3
-0193
-0194
-0195 .globl _mgroup6
-0196 _mgroup7
-0197 _mgroup8
-0198 .long
-0199
-019a
-019b
-019c
-019d
-019e
-019f
-01a0
-01a1
-01a2
-01a3
-01a4
-01a5
-01a6 .lcomm
-01a7
-01a8
-01a9
-01aa
-01ab
-01ac
-01ad
-01ae
-01af
-01b0
-01b1
-01b2
-01b3
-01b4
-01b5
-01b6
-01b7
-01b8
-01b9
-01ba
-01bb
-01bc
-01bd
-01be
-01bf
-01c0
-01c1
-01c2
-01c3
-01c4
-01c5
-01c6
-01c7
-01c8
-01c9
-01ca .define
-01cb
-01cc
-01cd .short
-01ce
-01cf
-01d0
-01d1 .fail
-01d2
-01d3
-01d4
-01d5
-01d6
-01d7
-01d8
-01d9
-01da
-01db
-01dc
-01dd
-01de
-01df
-01e0
-01e1
-01e2
-01e3
-01e4 .blkw
-01e5
-01e6
-01e7
-01e8
-01e9
-01ea
-01eb
-01ec
-01ed
-01ee
-01ef .align
-01f0
-01f1
-01f2
-01f3 .blkb
-01f4
-01f5
-01f6
-01f7
-01f8
-01f9
-01fa
-01fb MOVZX
-01fc
-01fd
-01fe
-01ff
-0200 if
-0201 _gsymptr
-0202 seg
-0203
-0204 lgs
-0205 bound
-0206 bge setpo
-0207 ident _mimul
-0208 setnge _mcalli
-0209
-020a lcomm repe stow
-020b
-020c setpe
-020d rep
-020e stos
-020f
-0210 setnae _getunary
-0211 bgt ret
-0212 je
-0213
-0214 setnbe
-0215
-0216 jge
-0217 set repz
-0218 comm
-0219
-021a bhi
-021b
-021c
-021d stob
-021e
-021f
-0220 setna
-0221 loop setnb
-0222 ifc repne setnc
-0223 loopz
-0224 dec les setne
-0225 shr
-0226 setng
-0227 arpl
-0228 blos
-0229 cmpb
-022a _fqflag _fdflag _fcflag
-022b loopnz setnl _mshort
-022c
-022d _mloadfullpointer
-022e setno
-022f setnp
-0230 ah
-0231 _min
-0232 bh beq jg popa setns
-0233
-0234 ch lfs
-0235
-0236 dh jmpi lea loopne
-0237 popf
-0238
-0239 setnz
-023a cmps
-023b
-023c neg setnle _buildea _yes_samesize
-023d _sib
-023e cmpw loope
-023f get repnz shl _mmovx
-0240 bcc _getbinary
-0241 fail
-0242 jb
-0243
-0244 cdq
-0245 idiv _minher32
-0246
-0247 import
-0248 fcc
-0249 _minher16
-024a
-024b fcb
-024c _displsize _getcomma
-024d endif
-024e
-024f edx sal _notimmed _getimmed _yesimmed
-0250 edi bcs bhis
-0251 _mmov
-0252 adc ja
-0253 add
-0254 lds _mshdouble
-0255 sar sbb
-0256 db
-0257
-0258
-0259 salb shlb
-025a _datatoobig
-025b fdb shld _immcount
-025c setle
-025d
-025e
-025f ecx export rclb rolb
-0260 aaa
-0261
-0262 cbw
-0263 aad
-0264
-0265 mulb
-0266 daa jbe
-0267 lar
-0268
-0269 rcl
-026a jnle
-026b _mint
-026c public aam
-026d imulb
-026e
-026f ebx
-0270 calli
-0271
-0272 aas jc
-0273 call rcr
-0274 das _opcode _asld_compatible
-0275
-0276 dd jae
-0277 ebp
-0278
-0279
-027a
-027b far
-027c _mnsize
-027d
-027e elseifc
-027f eax wait
-0280 bps in
-0281 _immadr
-0282
-0283 rmb .WARN negb
-0284
-0285
-0286 jpe
-0287 _mtest
-0288 .ORG
-0289 not _baseind16 _direction
-028a _chkabs
-028b
-028c jpo
-028d elseif .WORD mov pushad
-028e jnge
-028f
-0290 bpc _buildimm
-0291 pop
-0292 pusha .10E .20E
-0293 _lbranch .10F .20F
-0294 sp loc .10C .20C
-0295 nop .10D _mretf .20D
-0296 .10A .20A
-0297 pushf .10B .20B
-0298
-0299 bpl pushfd
-029a
-029b _buildsegword
-029c
-029d
-029e
-029f lahf
-02a0 .BSS jnc
-02a1 .LIST inb
-02a2 .BYTE inc jna jp
-02a3 jnb
-02a4 jng xchg
-02a5
-02a6 .DATA cmc jne _mxchg
-02a7
-02a8 _minhera
-02a9 enter jnl rol
-02aa bmi _getaccumreg _regchk
-02ab cmp
-02ac jno
-02ad jnp sahf
-02ae _lc _mincdec
-02af
-02b0 jns
-02b1
-02b2 bp ins jo
-02b3 and int iret ror
-02b4
-02b5
-02b6 bne inw _mbcc _mjcc
-02b7 xchgb _notindirect _getindirect
-02b8 setge
-02b9 popfd
-02ba
-02bb end jnz _regsegword _mcall
-02bc
-02bd jmp
-02be
-02bf xor
-02c0 TR7 block setae
-02c1 blt
-02c2 j
-02c3 TR6
-02c4
-02c5 scab
-02c6 di jle
-02c7
-02c8
-02c9 adcb _databuf
-02ca _notsegreg _indregchk _mseg _pcrflag
-02cb lodb
-02cc _mlea
-02cd hlt _buildregular
-02ce
-02cf decb
-02d0 _lcdata
-02d1 sbbb subb
-02d2 scaw _regbits
-02d3
-02d4 lock setbe _segoverride
-02d5 endb
-02d6 ble clc scas
-02d7 cld _mnegnot
-02d8 lods
-02d9 lgdt lidt lldt incb
-02da
-02db _mpushpop
-02dc blo cli cwde lodw
-02dd xlat addb andb
-02de _nonimpexpres
-02df _mret _showrelbad
-02e0 DR7 _reldata _page
-02e1 extern
-02e2 jl jnbe
-02e3 DR6
-02e4 si DR3 .ZEROW
-02e5 CR2 .TEXT
-02e6 CR3 DR1
-02e7 DR2
-02e8
-02e9
-02ea
-02eb sgdt sidt sldt _aprefix _oprefix _getshift _sprefix
-02ec
-02ed _minher
-02ee
-02ef
-02f0 al
-02f1
-02f2 bl
-02f3 div
-02f4 cl
-02f5
-02f6 dl jnae
-02f7 setdp
-02f8
-02f9 DR0 _mjcxz
-02fa
-02fb CR0
-02fc
-02fd popad
-02fe
-02ff _target
-0300 _rm
-0301
-0302 .39
-0303
-0304
-0305 sub .40
-0306 .LCOMM
-0307 cwd
-0308 .33
-0309 .34
-030a .31 .12E .22E
-030b .32 .12F .22F
-030c .37 .12C .22C
-030d .38 .12D .22D
-030e .35 .12A .22A
-030f .36 .12B .22B
-0310
-0311
-0312 .49
-0313
-0314
-0315 .30
-0316
-0317
-0318 .43 .11C .21C
-0319 .44 .11D .21D
-031a .41 .11A .21A
-031b movzx .42 .11B .21B
-031c .47
-031d USE16 .48
-031e .45 .11E .21E
-031f .46 .11F .21F
-0320 bvs
-0321
-0322 .19 .14E
-0323 .14F
-0324 .14C
-0325 .20 .14D
-0326 .COMM dw .14A
-0327 .14B
-0328 .13
-0329 .14
-032a .11
-032b .12
-032c .17
-032d .18
-032e _ss .15
-032f out .16
-0330 ax bvc .13C .23C
-0331 .MACLIST USE32 .13D .23D
-0332 bx .29 .13A .23A
-0333 mul .13B .23B
-0334 cx
-0335 .GLOBL .10
-0336 dx .13E .23E
-0337 .13F .23F
-0338 .LONG .23
-0339 .24
-033a .21
-033b .22
-033c .27
-033d .28
-033e .25
-033f .26
-0340 esi bts
-0341 _mEvGv
-0342 .79
-0343 btr
-0344 ss .BLKW lss
-0345 .80
-0346
-0347 esp bsf
-0348 .73 .15C
-0349 .74 .15D _mGvEv
-034a .71 .15A
-034b .72 .15B
-034c or .77
-034d .78
-034e .75 .15E
-034f .ALIGN .76 .15F
-0350 btc
-0351
-0352 br .89
-0353 .BLKB bsr
-0354
-0355 .70
-0356
-0357 ltr
-0358 .83
-0359 .84
-035a .81 .16E
-035b .82 .16F
-035c .87 .16C
-035d use16 lsl .88 .16D
-035e .85 .16A
-035f ptr .86 .16B
-0360 .17C
-0361 .17D
-0362 .59 .17A
-0363 .17B
-0364 cs
-0365 str .60
-0366 ds .17E
-0367 .17F
-0368 es .53
-0369 .54
-036a fs org .DEFINE .51
-036b .52
-036c gs .57
-036d .SHORT orb .58
-036e .55
-036f .56
-0370 _sym
-0371 .FAIL use32
-0372 js bt .69 .18E
-0373 .18F
-0374 .18C
-0375 .50 .18D
-0376 stc .18A
-0377 std .18B
-0378 .63
-0379 .64
-037a .61
-037b .62
-037c equ sti .67
-037d .68
-037e .65
-037f .66
-0380 _source _buildunary
-0381 outb
-0382 into outsw
-0383
-0384 else
-0385 _factor
-0386 movsw
-0387 .EVEN movsx notb
-0388 lodsw lmsw verw .FC .1EC
-0389 .FD .1ED
-038a clts .F .FA .1EA
-038b .FB .1EB
-038c
-038d cmpsb
-038e insw _expres .FE .1EE
-038f cmpsd iretd verr .FF .1EF
-0390
-0391 movsb push sarb shrb
-0392 outs
-0393 movsd shrd
-0394
-0395 outsb
-0396 outw
-0397 qword outsd rcrb rorb _mdivmul
-0398 .EC
-0399 insb
-039a byte cmpsw .E .EA ..FFFE .1FE
-039b word insd xorb .EB ..FFFF .1FF
-039c .1FC
-039d lodsd .1FD
-039e .EE .1FA
-039f lodsb .EF _mout .1FB
-03a0
-03a1 setz
-03a2 macro .99
-03a3
-03a4 entry
-03a5 _error _kgerror
-03a6 _msetcc
-03a7
-03a8 .93
-03a9 pword .94
-03aa sets .91 _notcsreg
-03ab .92
-03ac .97
-03ad scasb stosb .98 _menter
-03ae .95
-03af scasd stosd .96
-03b0
-03b1 dword extrn
-03b2
-03b3 xlatb setl
-03b4
-03b5 .90
-03b6 reti seto
-03b7 setp
-03b8 include seta .19C
-03b9 setb .19D
-03ba scasw stosw setc smsw .19A
-03bb retf testb _segword _marpl .19B
-03bc sete _getea
-03bd fword test
-03be tbyte setg .19E
-03bf .19F
-03c0
-03c1
-03c2 jz
-03c3
-03c4
-03c5
-03c6
-03c7 jcxz jecxz
-03c8 .BC
-03c9 .BD
-03ca .B .BA .1BE
-03cb .BB .1BF
-03cc _notbytesize .1BC
-03cd .1BD
-03ce .BE .1BA
-03cf .BF .1BB
-03d0 _getsym
-03d1
-03d2 .ASCII
-03d3 .EXTERN
-03d4
-03d5 .MAP
-03d6 .SPACE
-03d7
-03d8 .AC .1AC
-03d9 .AD .1AD
-03da jcxe jecxe .A .AA .1AA
-03db .AB .1AB
-03dc _regsize _defsize
-03dd
-03de .AE .1AE
-03df .AF .1AF
-03e0
-03e1
-03e2 .1DE
-03e3 divb _lcjump .1DF
-03e4 .1DC
-03e5 .1DD
-03e6 _pass .1DA
-03e7 .1DB
-03e8 .DC
-03e9 .DD
-03ea movw .D .DA
-03eb imul .DB _mbound
-03ec _yeswordsize
-03ed
-03ee movs .DE
-03ef .DF
-03f0 _rmfunny .1CC
-03f1 _postb .1CD
-03f2 .1CA
-03f3 .1CB
-03f4
-03f5 idivb
-03f6 leave .1CE
-03f7 .1CF
-03f8 .CC
-03f9 .CD
-03fa .C _getdxreg .CA
-03fb .CB
-03fc
-03fd movb
-03fe .CE
-03ff _lastexp .CF
-nhash = 731, nsym = 1463, nlookup = 18376 nx =
- 011029 2760 2820 185 97 20 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 731 406 200 87 29 8 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-weight = 26368, compares = 27603
diff --git a/bin86-0.3/as/work/t b/bin86-0.3/as/work/t
deleted file mode 100644
index 29ebfd6..0000000
--- a/bin86-0.3/as/work/t
+++ /dev/null
@@ -1,3 +0,0 @@
-cp work/$1 as
-sync
-time sh t1
diff --git a/bin86-0.3/as/work/t1 b/bin86-0.3/as/work/t1
deleted file mode 100644
index c2a47d5..0000000
--- a/bin86-0.3/as/work/t1
+++ /dev/null
@@ -1,10 +0,0 @@
-./as q -w -u
-./as q -w -u
-./as q -w -u
-./as q -w -u
-./as q -w -u
-./as q -w -u
-./as q -w -u
-./as q -w -u
-./as q -w -u
-./as q -w -u
diff --git a/bin86-0.3/as/work/z b/bin86-0.3/as/work/z
deleted file mode 100644
index 108c07e..0000000
--- a/bin86-0.3/as/work/z
+++ /dev/null
@@ -1,5 +0,0 @@
-r q -w -u
-_exit b
-c
-_nhash/x
-_hid_spt+0x40/32x
diff --git a/bin86-0.3/bcc/bcc.c b/bin86-0.3/bcc/bcc.c
deleted file mode 100644
index 58035c8..0000000
--- a/bin86-0.3/bcc/bcc.c
+++ /dev/null
@@ -1,831 +0,0 @@
-/*
- * bin86/bcc/bcc.c
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-/* bcc.c - driver for Bruce's C compiler and for CvW's C compiler */
-
-#define _POSIX_SOURCE 1
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-#include <unistd.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <string.h>
-
-#define FALSE 0
-#define FORWARD static
-#ifndef NULL
-#define NULL 0
-#endif
-#define PRIVATE static
-#define PUBLIC
-#define TRUE 1
-
-#if __STDC__
-#define P(x) x
-#else
-#define P(x) ()
-#endif
-
-#define AS "as"
-#define BAS86
-#define BCC86
-#define CC1 "cc1"
-#define CC1_MINUS_O_BROKEN FALSE
-#define CPP "cc1"
-#define CPPFLAGS "-E"
-#define CRTSO "crtso.o"
-#define GCC "/usr/bin/gcc"
-#define LD "ld"
-#define STANDARD_CRTSO0_PREFIX "/usr/local/lib/i86/"
-#define STANDARD_CRTSO3_PREFIX "/usr/local/lib/i386/"
-#define STANDARD_EXEC_PREFIX "/usr/local/libexec/i386/bcc/"
-
-#ifdef CCC
-#undef BCC86
-#undef CC1
-#define CC1 "c386"
-#undef CC1_MINUS_O_BROKEN
-#define CC1_MINUS_O_BROKEN TRUE
-#undef CPP
-#define CPP "cpp" /* could also use bcc-cc1 -E */
-#undef CPPFLAGS
-#define CPPFLAGS "-traditional"
-#undef GCC
-#undef STANDARD_CRTSO0_PREFIX
-#undef STANDARD_CRTSO3_PREFIX
-#define STANDARD_CRTSO_PREFIX "/usr/local/lib/i386/"
-#define STANDARD_EXEC_PREFIX_2 "/usr/local/bin/"
-#endif /* CCC */
-
-#ifdef MC6809
-#undef BAS86
-#undef BCC86
-#undef CRTSO
-#undef GCC
-#undef STANDARD_CRTSO0_PREFIX
-#undef STANDARD_CRTSO3_PREFIX
-#undef STANDARD_EXEC_PREFIX
-#define STANDARD_EXEC_PREFIX "/usr/local/libexec/m09/bcc/"
-#endif /* MC6809 */
-
-#define ALLOC_UNIT 16 /* allocation unit for arg arrays */
-#define DIRCHAR '/'
-#define START_ARGS 4 /* number of reserved args */
-
-typedef unsigned char bool_T; /* boolean: TRUE if nonzero */
-
-struct arg_s
-{
- char *prog;
- bool_T minus_O_broken;
- int argc;
- char **argv;
- unsigned nr_allocated;
-};
-
-struct prefix_s
-{
- char *name;
- struct prefix_s *next;
-};
-
-PRIVATE struct arg_s asargs = { AS, };
-PRIVATE struct arg_s ccargs = { CC1, CC1_MINUS_O_BROKEN, };
-PRIVATE struct arg_s cppargs = { CPP, };
-#ifdef STANDARD_CRTSO_PREFIX
-PRIVATE struct prefix_s crtso_prefix = { STANDARD_CRTSO_PREFIX, };
-#endif
-#ifdef STANDARD_CRTSO0_PREFIX
-PRIVATE struct prefix_s crtso0_prefix = { STANDARD_CRTSO0_PREFIX, };
-#endif
-#ifdef STANDARD_CRTSO3_PREFIX
-PRIVATE struct prefix_s crtso3_prefix = { STANDARD_CRTSO3_PREFIX, };
-#endif
-PRIVATE struct prefix_s exec_prefix;
-PRIVATE struct arg_s ldargs = { LD, };
-#ifdef BAS86
-PRIVATE struct arg_s ldrargs = { LD, };
-#endif
-PRIVATE char *progname;
-PRIVATE bool_T runerror; /* = FALSE */
-PRIVATE struct arg_s tmpargs; /* = empty */
-PRIVATE char *tmpdir;
-PRIVATE bool_T verbose; /* = FALSE */
-
-/* Who can say if the standard headers declared these? */
-int chmod P((const char *name, int mode));
-int execv P((char *name, char **argv));
-void exit P((int status));
-pid_t fork P((void));
-char *getenv P((const char *_name));
-pid_t getpid P((void));
-void *malloc P((unsigned size));
-void *realloc P((void *ptr, unsigned size));
-void (*signal P((int sig, void (*func) P((int sig))))) P((int sig));
-char *strcpy P((char *target, const char *source));
-size_t strlen P((const char *s));
-char *strrchr P((const char *s, int c));
-int unlink P((const char *name));
-pid_t wait P((int *status));
-int write P((int fd, char *buf, unsigned nbytes));
-
-FORWARD void addarg P((struct arg_s *argp, char *arg));
-FORWARD void addprefix P((struct prefix_s *prefix, char *name));
-FORWARD void fatal P((char *message));
-FORWARD char *fixpath P((char *path, struct prefix_s *prefix, int mode));
-FORWARD void killtemps P((void));
-FORWARD void *my_malloc P((unsigned size, char *where));
-FORWARD char *my_mktemp P((void));
-FORWARD void my_unlink P((char *name));
-FORWARD void outofmemory P((char *where));
-FORWARD int run P((char *in_name, char *out_name, struct arg_s *argp));
-FORWARD void set_trap P((void));
-FORWARD void show_who P((char *message));
-FORWARD void startarg P((struct arg_s *argp));
-FORWARD char *stralloc P((char *s));
-FORWARD char *stralloc2 P((char *s1, char *s2));
-FORWARD void trap P((int signum));
-FORWARD void unsupported P((char *option, char *message));
-FORWARD void writen P((void));
-FORWARD void writes P((char *s));
-FORWARD void writesn P((char *s));
-
-PUBLIC int main(argc, argv)
-int argc;
-char **argv;
-{
- char *arg;
- int argcount = argc;
- bool_T *argdone = my_malloc((unsigned) argc * sizeof *argdone, "argdone");
- bool_T as_only = FALSE;
- char *basename;
-#ifdef BCC86
- bool_T bits32 = sizeof (char *) >= 4;
- char *bits_arg;
-#endif
- bool_T cc_only = FALSE;
-#ifdef CCC
- bool_T cpp_pass = TRUE;
-#else
- bool_T cpp_pass = FALSE;
-#endif
-#ifdef BCC86
- char *crtso;
-#endif
- bool_T debug = FALSE;
- bool_T echo = FALSE;
- unsigned errcount = 0;
- char ext;
- char *f_out = NULL;
- bool_T float_emulation = FALSE;
-#ifdef BAS86
- bool_T gnu_objects = FALSE;
-#endif
- char *in_name;
- int length;
- unsigned ncisfiles = 0;
- unsigned nifiles = 0;
- unsigned npass_specs;
- bool_T optimize = FALSE;
- char *out_name;
- bool_T profile = FALSE;
- bool_T prep_only = FALSE;
- bool_T prep_line_numbers = FALSE;
- int status;
- char *temp;
-
- progname = argv[0];
- addarg(&cppargs, CPPFLAGS);
-#ifdef CCC
- addarg(&asargs, "-j");
-#endif
- addarg(&asargs, "-u");
- addarg(&asargs, "-w");
-#ifdef BCC86
- addarg(&ldargs, "-i");
-#endif
-#ifdef BAS86
- addarg(&ldrargs, "-r");
-#endif
-
- /* pass 1 over argv to gather compile options */
- for (; --argc != 0;)
- {
- arg = *++argv;
- *++argdone = TRUE;
- if (arg[0] == '-' && arg[1] != 0 && arg[2] == 0)
- switch (arg[1])
- {
-#ifdef BCC86
- case '0':
- bits32 = FALSE;
- break;
- case '3':
- bits32 = TRUE;
- break;
-#endif
- case 'E':
- prep_only = prep_line_numbers = cpp_pass = TRUE;
- break;
-#ifdef BAS86
- case 'G':
- gnu_objects = TRUE;
- break;
-#endif
- case 'P':
- prep_only = cpp_pass = TRUE;
- prep_line_numbers = FALSE;
- break;
- case 'O':
- optimize = TRUE; /* unsupported( arg, "optimize" ); */
- break;
- case 'S':
- cc_only = TRUE;
- break;
- case 'V':
- echo = TRUE;
- break;
- case 'c':
- as_only = TRUE;
- break;
- case 'e':
- cpp_pass = TRUE;
- break;
- case 'f':
- float_emulation = TRUE;
- ++errcount;
- unsupported(arg, "float emulation");
- break;
- case 'g':
- debug = TRUE; /* unsupported( arg, "debug" ); */
- break;
- case 'o':
- if (--argc < 1)
- {
- ++errcount;
- show_who("output file missing after -o\n");
- }
- else
- {
- if (f_out != NULL)
- show_who("more than one output file\n");
- f_out = *++argv;
- *++argdone = TRUE;
- }
- break;
- case 'p':
- profile = TRUE;
- ++errcount;
- unsupported(arg, "profile");
- break;
- case 'v':
- verbose = TRUE;
- break;
- default:
- *argdone = FALSE;
- break;
- }
- else if (arg[0] == '-')
- switch (arg[1])
- {
- case 'A':
- addarg(&asargs, arg + 2);
- break;
- case 'B':
- addprefix(&exec_prefix, arg + 2);
- break;
- case 'C':
- addarg(&ccargs, arg + 2);
- break;
- case 'D':
- case 'I':
- case 'U':
-#ifndef CCC
- addarg(&ccargs, arg);
-#endif
- addarg(&cppargs, arg);
- break;
- case 'L':
- addarg(&ldargs, arg + 2);
- break;
- case 'P':
- addarg(&cppargs, arg + 2);
- break;
-#ifdef CCC
- case 'Q':
- addarg(&ccargs, arg);
- break;
-#endif
- case 'T':
- tmpdir = arg + 2;
- break;
- case 't':
- ++errcount;
- unsupported(arg, "pass number");
- break;
- default:
- *argdone = FALSE;
- break;
- }
- else
- {
- ++nifiles;
- *argdone = FALSE;
- length = strlen(arg);
- if (length >= 2 && arg[length - 2] == '.' &&
- ((ext = arg[length - 1]) == 'c' || ext == 'i' || ext == 's'))
- ++ncisfiles;
- }
- }
- npass_specs = prep_only + cc_only + as_only;
- if (npass_specs != 0)
- {
- if (npass_specs > 1)
- {
- ++errcount;
- show_who("more than 1 option from -E -P -S -c\n");
- }
- if (f_out != NULL && ncisfiles > 1)
- {
- ++errcount;
- show_who("cannot have more than 1 input with non-linked output\n");
- }
- }
- if (nifiles == 0)
- {
- ++errcount;
- show_who("no input files\n");
- }
- if (errcount != 0)
- exit(1);
-
- if ((temp = getenv("BCC_EXEC_PREFIX")) != NULL)
- addprefix(&exec_prefix, temp);
- addprefix(&exec_prefix, STANDARD_EXEC_PREFIX);
-#ifdef STANDARD_EXEC_PREFIX_2
- addprefix(&exec_prefix, STANDARD_EXEC_PREFIX_2);
-#endif
- cppargs.prog = fixpath(cppargs.prog, &exec_prefix, X_OK);
- ccargs.prog = fixpath(ccargs.prog, &exec_prefix, X_OK);
- asargs.prog = fixpath(asargs.prog, &exec_prefix, X_OK);
- ldargs.prog = fixpath(ldargs.prog, &exec_prefix, X_OK);
- ldrargs.prog = fixpath(ldrargs.prog, &exec_prefix, X_OK);
- if (tmpdir == NULL && (tmpdir = getenv("TMPDIR")) == NULL)
- tmpdir = "/tmp";
-
- if (prep_only && !prep_line_numbers)
- addarg(&cppargs, "-P");
-#ifdef BCC86
- if (bits32)
- {
- bits_arg = "-3";
- crtso = fixpath(CRTSO, &crtso3_prefix, R_OK);
- }
- else
- {
- bits_arg = "-0";
- crtso = fixpath(CRTSO, &crtso0_prefix, R_OK);
- }
- addarg(&ccargs, bits_arg);
- addarg(&cppargs, bits_arg);
- addarg(&asargs, bits_arg);
-#ifdef BAS86
- if (!gnu_objects)
- {
- addarg(&ldargs, bits_arg);
- addarg(&ldrargs, bits_arg);
- addarg(&ldargs, crtso);
- }
-#endif /* BAS86 */
-#endif /* BCC86 */
-#if defined(BAS86) && !defined(BCC86)
- if (!gnu_objects)
- addarg(&ldargs, fixpath(CRTSO, &crtso_prefix, R_OK));
-#endif
- if (ncisfiles < 2)
- echo = FALSE;
- set_trap();
-
- /* pass 2 over argv to compile and assemble .c and .s files */
- /* and gather arguments for loader */
- for (argv -= (argc = argcount) - 1, argdone -= argcount - 1; --argc != 0;)
- {
- arg = *++argv;
- if (!*++argdone)
- {
- length = strlen(arg);
- if (length >= 2 && arg[length - 2] == '.' &&
- ((ext = arg[length - 1]) == 'c' || ext == 'i' || ext == 's'))
- {
- if (echo || verbose)
- {
- writes(arg);
- writesn(":");
- }
- if ((basename = strrchr(arg, DIRCHAR)) == NULL)
- basename = arg;
- else
- ++basename;
- in_name = arg;
- if (ext == 'c')
- {
- if (cpp_pass)
- {
- if (prep_only)
- out_name = f_out;
- else
- out_name = my_mktemp();
- if (run(in_name, out_name, &cppargs) != 0)
- continue;
- in_name = out_name;
- }
- ext = 'i';
- }
- if (ext == 'i')
- {
- if (prep_only)
- continue;
- if (cc_only)
- {
- if (f_out != NULL)
- out_name = f_out;
- else
- {
- out_name = stralloc(basename);
- out_name[strlen(out_name) - 1] = 's';
- }
- }
- else
- out_name = my_mktemp();
- if (run(in_name, out_name, &ccargs) != 0)
- continue;
- in_name = out_name;
- ext = 's';
- }
- if (ext == 's')
- {
- if (prep_only || cc_only)
- continue;
- out_name = stralloc(basename);
- out_name[strlen(out_name) - 1] = 'o';
- if (as_only)
- {
- if (f_out != NULL)
- out_name = f_out;
- else
- {
- out_name = stralloc(basename);
- out_name[strlen(out_name) - 1] = 'o';
- }
- }
- else
- out_name = my_mktemp();
- addarg(&asargs, "-n");
- arg[length - 1] = 's';
- addarg(&asargs, arg);
-#ifdef BCC86
- if (gnu_objects)
- {
- char *tmp_out_name;
-
- tmp_out_name = my_mktemp();
- status = run(in_name, tmp_out_name, &asargs);
- asargs.argc -= 2;
- if (status != 0)
- continue;
- if (run(tmp_out_name, out_name, &ldrargs) != 0)
- continue;
- }
- else
-#endif
- {
- status = run(in_name, out_name, &asargs);
- asargs.argc -= 2;
- if (status != 0)
- continue;
- }
- ext = 'o';
- in_name = out_name;
- }
- if (ext == 'o')
- {
- if (prep_only || cc_only || as_only)
- continue;
- addarg(&ldargs, in_name);
- }
- }
- else
- addarg(&ldargs, arg);
- }
- }
-
- if (!prep_only && !cc_only && !as_only && !runerror)
- {
- if (f_out == NULL)
- f_out = "a.out";
-#ifdef BCC86
- if (gnu_objects)
- {
- ldargs.prog = GCC;
- run((char *) NULL, f_out, &ldargs);
- }
- else
-#endif
- {
- addarg(&ldargs, "-lc");
- run((char *) NULL, f_out, &ldargs);
- }
- }
- killtemps();
- return runerror ? 1 : 0;
-}
-
-PRIVATE void addarg(argp, arg)
-register struct arg_s *argp;
-char *arg;
-{
- int new_argc;
- char **new_argv;
-
- if (argp->nr_allocated == 0)
- startarg(argp);
- new_argc = argp->argc + 1;
- if (new_argc >= argp->nr_allocated)
- {
- argp->nr_allocated += ALLOC_UNIT;
- new_argv = realloc(argp->argv, argp->nr_allocated * sizeof *argp->argv);
- if (new_argv == NULL)
- outofmemory("addarg");
- argp->argv = new_argv;
- }
- argp->argv[argp->argc] = arg;
- argp->argv[argp->argc = new_argc] = NULL;
-}
-
-PRIVATE void addprefix(prefix, name)
-struct prefix_s *prefix;
-char *name;
-{
- struct prefix_s *new_prefix;
-
- if (prefix->name == NULL)
- prefix->name = name;
- else
- {
- new_prefix = my_malloc(sizeof *new_prefix, "addprefix");
- new_prefix->name = name;
- new_prefix->next = NULL;
- prefix->next = new_prefix;
- }
-}
-
-PRIVATE void fatal(message)
-char *message;
-{
- writesn(message);
- killtemps();
- exit(1);
-}
-
-PRIVATE char *fixpath(path, prefix, mode)
-char *path;
-struct prefix_s *prefix;
-int mode;
-{
- char *ppath;
-
- for (; prefix != NULL; prefix = prefix->next)
- {
- ppath = stralloc2(prefix->name, path);
- if (access(ppath, mode) == 0)
- return ppath;
- free(ppath);
- }
- return path;
-}
-
-PRIVATE void killtemps()
-{
- while (tmpargs.argc > START_ARGS)
- my_unlink(tmpargs.argv[--tmpargs.argc]);
-}
-
-PRIVATE void *my_malloc(size, where)
-unsigned size;
-char *where;
-{
- void *block;
-
- if ((block = malloc(size)) == NULL)
- outofmemory(where);
- return block;
-}
-
-PRIVATE char *my_mktemp()
-{
- char *p;
- unsigned digit;
- unsigned digits;
- char *template;
- static unsigned tmpnum;
-
- p = template = stralloc2(tmpdir, "/bccYYYYXXXX");
- p += strlen(p);
- digits = getpid();
- while (*--p == 'X')
- {
- if ((digit = digits % 16) > 9)
- digit += 'A' - ('9' + 1);
- *p = digit + '0';
- digits /= 16;
- }
- digits = tmpnum;
- while (*p == 'Y')
- {
- if ((digit = digits % 16) > 9)
- digit += 'A' - ('9' + 1);
- *p-- = digit + '0';
- digits /= 16;
- }
- ++tmpnum;
- addarg(&tmpargs, template);
- return template;
-}
-
-PRIVATE void my_unlink(name)
-char *name;
-{
- if (verbose)
- {
- show_who("unlinking ");
- writesn(name);
- }
- if (unlink(name) < 0 && verbose)
- {
- show_who("error unlinking ");
- writesn(name);
- }
-}
-
-PRIVATE void outofmemory(where)
-char *where;
-{
- show_who("out of memory in ");
- fatal(where);
-}
-
-PRIVATE int run(in_name, out_name, argp)
-char *in_name;
-char *out_name;
-struct arg_s *argp;
-{
- int arg0;
- int i;
- int status;
-
- arg0 = 0;
- if (in_name == NULL)
- ++arg0;
- if (out_name == NULL)
- arg0 += 2;
- else if (argp->minus_O_broken)
- ++arg0;
- if (argp->nr_allocated == 0)
- startarg(argp);
- argp->argv[arg0] = argp->prog;
- i = arg0 + 1;
- if (in_name != NULL)
- argp->argv[i++] = in_name;
- if (out_name != NULL)
- {
- if (!argp->minus_O_broken)
- argp->argv[i++] = "-o";
- argp->argv[i++] = out_name;
- }
- if (verbose)
- {
- for (i = arg0; i < argp->argc; ++i)
- {
- writes(argp->argv[i]);
- writes(" ");
- }
- writen();
- }
- switch (fork())
- {
- case -1:
- show_who("fork failed");
- fatal("");
- case 0:
- execv(argp->prog, argp->argv + arg0);
- show_who("exec of ");
- writes(argp->prog);
- fatal(" failed");
- default:
- wait(&status);
- for (i = tmpargs.argc - 1; i >= START_ARGS; --i)
- if (in_name == tmpargs.argv[i])
- {
- my_unlink(in_name);
- --tmpargs.argc;
- memmove(tmpargs.argv + i, tmpargs.argv + i + 1,
- (tmpargs.argc - i) * sizeof tmpargs.argv[0]);
- break;
- }
- if (status != 0)
- {
- killtemps();
- runerror = TRUE;
- }
- return status;
- }
-}
-
-PRIVATE void set_trap()
-{
- int signum;
-
-#ifndef _NSIG
-#define NSIG _NSIG
-#endif
- for (signum = 0; signum <= _NSIG; ++signum)
-#ifdef SIGCHLD
- if (signum != SIGCHLD)
-#endif
- if (signal(signum, SIG_IGN) != SIG_IGN)
- signal(signum, trap);
-}
-
-PRIVATE void show_who(message)
-char *message;
-{
- writes(progname);
- writes(": ");
- writes(message);
-}
-
-PRIVATE void startarg(argp)
-struct arg_s *argp;
-{
- argp->argv = my_malloc((argp->nr_allocated = ALLOC_UNIT)
- * sizeof *argp->argv, "startarg");
- argp->argc = START_ARGS;
- argp->argv[START_ARGS] = NULL;
-}
-
-PRIVATE char *stralloc(s)
-char *s;
-{
- return strcpy(my_malloc(strlen(s) + 1, "stralloc"), s);
-}
-
-PRIVATE char *stralloc2(s1, s2)
-char *s1;
-char *s2;
-{
- return strcat(strcpy(my_malloc(
- strlen(s1) + strlen(s2) + 1, "stralloc2"), s1), s2);
-}
-
-PRIVATE void trap(signum)
-int signum;
-{
- signal(signum, SIG_IGN);
- if (verbose)
- show_who("caught signal");
- fatal("");
-}
-
-PRIVATE void unsupported(option, message)
-char *option;
-char *message;
-{
- show_who("compiler option ");
- writes(option);
- writes(" (");
- writes(message);
- writesn(") not supported yet");
-}
-
-PRIVATE void writen()
-{
- writes("\n");
-}
-
-PRIVATE void writes(s)
-char *s;
-{
- write(2, s, strlen(s));
-}
-
-PRIVATE void writesn(s)
-char *s;
-{
- writes(s);
- writen();
-}
diff --git a/bin86-0.3/bcc/bcc.doc b/bin86-0.3/bcc/bcc.doc
deleted file mode 100644
index 7f2a8ed..0000000
--- a/bin86-0.3/bcc/bcc.doc
+++ /dev/null
@@ -1,165 +0,0 @@
-Bcc options
------------
-
-bcc [-03EGOPSVcegv] [-Aas_option] [-Bexecutable_prefix] [-Ccc1_option]
- [-Ddefine] [-Iinclude_dir] [-Lld_option] [-Qc386_option] [-Ttmpdir]
- [-Uundef] [-o outfile] [-fpt error] [ld_options] [infiles]
-
-The 6809 version does not support -0, -3 or -G.
-Only the c386 version supports -Q.
-
-defaults (off or none except for these):
--03 native
-outfile stdout for preprocessor output
- somewhere/file.[ci] -> file.s for compiler output
- somewhere/file.[cis] -> file.o for assembler output
- a.out for ld output
-
--0 8086 target (works even on 80386 host)
--3 80386 target (works even on 8086 host)
--A pass remainder of option to assembler (e.g. -A-l -Alistfile for a listing)
--B prefix for executable search path (as usual; after the -B prefixes comes
- the environment variable BCC_EXEC_PREFIX if that is set, followed by the
- compiled-in default (something like /usr/libexec/i386/bcc/))
--C pass remainder of option to cc1 (e.g. -C-c for caller-saves)
--D define (as usual)
--E produce preprocessor output (as usual)
--G produce gnu-Minix objects (link with gnu ld)
--I include search path (as usual)
--L pass remainder of option to linker
--O optimize (does nothing)
--P produce preprocessor output with no line numbers (as usual)
--Q pass full option to c386
--S produce assembler file (as usual)
--T temporary directory (overrides previous value and default; default is
- from the environment variable TMPDIR if that is set, otherwise /tmp)
--U undefine (as usual)
--V print names of files being compiled
--c produce object file (as usual)
--e run the preprocess pass separately. This takes less memory, and may help
- or harm by giving more traditional semantics like token pasting with /**/.
--f error (float emulation not supported)
--g produce debugging info (does nothing)
--o output file name follows (assembler, object or executable) (as usual)
--p error (profiling not supported)
--t error (substitution of some cc passes not supported)
--v print names and args of subprocesses being run
-
-Other options are passed to the linker, in particular -i-, -lx, -M, -m, -s.
-The -i option is always passed to the linker but can be cancelled using -i-.
-
-This is supposed to match the V7 manual except for -0, -3, -A, -C, -G, -L,
--T, -V, -e, -v and where not supported.
-
-cc1 options
-----------
-
-cc1 [-03EPcdfltw[-]] [-Ddefine] [-Iinclude_dir] [-Uundef] [-o outfile] [infile]
-
-The 6809 version does not support -0 or -3 but it supports -p.
-
-defaults (off or none except for these):
--03 native
--c on for 6809
--f on for 6809
-outfile stdout
-infile stdin
-
--0 8086 target (works even on 80386 host)
--3 80386 target (works even on 8086 host)
--D define (as usual)
--E produce preprocessor output (as usual)
--I include search path (as usual)
--P produce preprocessor output with no line numbers (as usual)
--c produce code with caller saving regs before function calls
--d print debugging information in assembly output
--f produce code with 1st argument passed in a register
--l produce code for 2 3 1 0 long byte order (only works in 16-bit versions)
--o assembler output file name follows
--p produce (almost) position-independent code
--t print source code in assemby output
--w print what cc1 thinks is the location counter in assembly output
-
-All the options except -D, -I and -o may be turned off by following the
-option letter by a '-'. Options are processed left to right so the last
-setting has precedence.
-
-The following is defined before option processing:
-
-__BCC__ 1
-
-The following may be defined after option processing:
-
-__AS09__ 1 if 6809 version
-__AS386_16__ 1 if -0 option on 80*86
-__AS386_32__ 1 if -3 option on 80*86
-__CALLER_SAVES__ 1 if -c option
-__FIRST_ARG_IN_AX__ 1 if -f option on 80*86
-__FIRST_ARG_IN_X__ 1 if -f option on 6809
-__LONG_BIG_ENDIAN__ 1 if -l option
-__POS_INDEPENDENT__ 1 if -p option on 6809
-
-The following are standard builtins:
-
-__FILE__ stringized name of current input file
-__LINE__ current line number
-
-As options
-----------
-
-as [-03agjuw] [-b [bin]] [-lm [list]] [-n name] [-o obj] [-s sym] src
-
-The 6809 version does not support -0, -3, -a or -j.
-
-defaults (off or none except for these; no output is produced without a flag):
--03 native
-list stdout (beware of clobbering next arg)
-name basename of the source name
-
--0 start with 16-bit code segment
--3 start with 32-bit code segment
--a enable partial compatibility with asld
--b produce binary file, filename may follow (obsolete)
--g only put global symbols in object file
--j force all jumps to be long
--l produce list file, filename may follow
--m print macro expansions in listing
--n name of module follows (goes in object instead of source name)
--o produce object file, filename follows
--s produce symbol file, filename follows (obsolete)
--u take undefined symbols as imported-with-unspecified segment
--w don't print warnings
-
-The -u and -w options are perhaps back to front because they are needed for
-cc1 output and Minix's make does the wrong thing with .s files left around.
-However, all assembler code not written by compilers should assemble with
-them turned off.
-
-Ld options
-----------
-
-For the version that produces Minix a.out format:
-ld [-03Mims[-]] [-T textaddr] [-llib_extension] [-o outfile] infile...
-
-For the version that produces gnu-Minix a.out format:
-ld [-03Mimrs[-]] [-T textaddr] [-llib_extension] [-o outfile] infile...
-
-The 6809 version does not support -i or -r.
-
-defaults (off or none except for these):
--03 native
-outfile a.out
-
--0 produce header with 16-bit magic and use subdir i86 for -lx
--3 produce header with 32-bit magic and use subdir i386 for -lx
--M print symbols linked on stdout
--T text base address follows (in format suitable for strtoul)
--i separate I&D output
--lx add library /local/lib/subdir/libx.a to list of files linked
--m print modules linked on stdout
--o output file name follows
--r produce output suitable for further relocation
--s strip symbols
-
-All the options except -T, -l and -o may be turned off by following the option
-letter by a '-', as for cc1.
diff --git a/bin86-0.3/bccfp/Makefile b/bin86-0.3/bccfp/Makefile
deleted file mode 100644
index 6caa362..0000000
--- a/bin86-0.3/bccfp/Makefile
+++ /dev/null
@@ -1,44 +0,0 @@
-# Makefile for bcc 386 software floating point library
-
-.SUFFIXES: .x # .x files are .s files that need C-preprocessing
-.x.o:
- $(CPP) $(CPPFLAGS) $< >tmp
- $(AS) tmp -n $* -o $@
-
-AS =as -3
-CFLAGS =-O
-CPP =/lib/cpp
-CPPFLAGS =-P
-FPDIST =Makefile $(FPSRC) test.c bccfp.tex
-FPSRC =fadd.x fcomp.x fdiv.x fmul.x fbsr.x \
- fperr.c fperror.x fptoi.x fpushd.x fpulld.x \
- fpushi.x fpushf.x fpullf.x frexp.x ftst.x \
- gcclib.x \
- fabs.x ldexp.x modf.c \
- fperr.h fplib.h
-FPOBJ =fadd.o fcomp.o fdiv.o fmul.o fpbsr.o \
- fperr.o fperror.o fptoi.o fpushd.o fpulld.o \
- fpushi.o fpushf.o fpullf.o frexp.o ftst.o \
- fabs.o ldexp.o modf.o
-JUNK =tmp
-LIB =.
-
-test: test.c $(LIB)/libfp.a
- $(CC) -o $@ test.c $(LIB)/libfp.a -lm
-
-$(FPOBJ): fplib.h
-fperr.c fperror.x: fperr.h
-
-$(LIB)/libfp.a: $(FPOBJ)
- ar rc $(LIB)/libfp.a $(FPOBJ)
- rm -f $(JUNK)
-
-dist: $(FPDIST)
- /bin/tar cvf - $(FPDIST) | /bin/compress -b 13 >bccfp.tar.Z
- uue bccfp.tar.Z
-
-clean:
- rm -f $(FPOBJ) $(JUNK) test
-
-realclean: clean
- rm -f $(LIB)/libfp.a bccfp.tar.Z bccfp.uue
diff --git a/bin86-0.3/bccfp/bccfp.tex b/bin86-0.3/bccfp/bccfp.tex
deleted file mode 100644
index e69de29..0000000
--- a/bin86-0.3/bccfp/bccfp.tex
+++ /dev/null
diff --git a/bin86-0.3/bccfp/changes b/bin86-0.3/bccfp/changes
deleted file mode 100644
index 2cc632a..0000000
--- a/bin86-0.3/bccfp/changes
+++ /dev/null
@@ -1,30 +0,0 @@
-fcomp:
-Fixes for negative 0 (perhaps this shouldn't be generated, like denormals
-and infinities (these would cause even more trouble) but Fsub routine or
-something generated one).
-
-frexp.x:
-Deleted 3rd arg (used to return value when bcc wasn't doing it right).
-
-Fixed frexp(value = 0) and ldexp(value = 0) returning nonzero.
-
-Most files:
-Changed comment symbol to '!' for new assembler (not the native ';' in
-case this is ported to ACK someday).
-
-Avoided using ebp and unnecessary register saves.
-
-Changed assembler style to make it a bit more portable or like I do it
-(no '$' for hex, 8[esp] instead of [esp+8], use only .define and not export
-or .globl, use '#' (could use nothing) instead of '*' for immediate).
-The partly-supported 8(ebp) and .globl would be still more portable.
-
-Changed terminology 'mantissa' to 'fraction'.
-
-Round to even. Required for 'paranioa' not to find any defects.
-
-Used preprocessor.
-
-Parametrized most of the magic numbers. Phew!
-
-Supported denormals. Now 'paranioa' doesn't find any flaws.
diff --git a/bin86-0.3/bccfp/fabs.x b/bin86-0.3/bccfp/fabs.x
deleted file mode 100644
index fe81676..0000000
--- a/bin86-0.3/bccfp/fabs.x
+++ /dev/null
@@ -1,17 +0,0 @@
-! bcc 386 floating point routines (version 2) -- _fabs
-! author: Bruce Evans
-
-#include "fplib.h"
-
-! double fabs(double value);
-! returns the absolute value of a number
-! this works for all NaNs, like the 80*87 fabs, but perhaps we should check
-! for exceptions that can happen when an 80*87 register is loaded
-
- .globl _fabs
- .align ALIGNMENT
-_fabs:
- mov eax,PC_SIZE+D_LOW[esp]
- mov edx,PC_SIZE+D_HIGH[esp]
- and edx,~D_SIGN_MASK
- ret
diff --git a/bin86-0.3/bccfp/fadd.x b/bin86-0.3/bccfp/fadd.x
deleted file mode 100644
index d1e60b1..0000000
--- a/bin86-0.3/bccfp/fadd.x
+++ /dev/null
@@ -1,485 +0,0 @@
-! bcc 386 floating point routines (version 2)
-! -- Fadd, Faddd, Faddf, Fsub, Fsubd, Fsubf, normalize2
-! author: Bruce Evans
-
-#include "fplib.h"
-
-#define FRAME_SIZE (3 * GENREG_SIZE + PC_SIZE)
-
- .extern Fpushf
- .extern fpdenormal
- .extern fpoverflow
- .extern fpunderflow
-
- .globl Fadd
- .align ALIGNMENT
-Fadd:
- push ebp
- push edi
- push esi
- mov eax,FRAME_SIZE+D_LOW[esp]
- mov edx,FRAME_SIZE+D_HIGH[esp]
- mov ebx,FRAME_SIZE+D_SIZE+D_LOW[esp]
- mov ecx,FRAME_SIZE+D_SIZE+D_HIGH[esp]
- call addition
- mov FRAME_SIZE+D_SIZE+D_LOW[esp],eax
- mov FRAME_SIZE+D_SIZE+D_HIGH[esp],edx
- pop esi
- pop edi
- pop ebp
- ret #D_SIZE
-
- .globl Faddd
- .align ALIGNMENT
-Faddd:
- push ebp
- push edi
- push esi
- mov eax,FRAME_SIZE+D_LOW[esp]
- mov edx,FRAME_SIZE+D_HIGH[esp]
- mov ecx,D_HIGH[ebx]
- mov ebx,D_LOW[ebx]
- call addition
- mov FRAME_SIZE+D_LOW[esp],eax
- mov FRAME_SIZE+D_HIGH[esp],edx
- pop esi
- pop edi
- pop ebp
- ret
-
- .globl Faddf
- .align ALIGNMENT
-Faddf:
- push ebp
- push edi
- push esi
- call Fpushf
- pop ebx ! yl
- pop ecx ! yu
- mov eax,FRAME_SIZE+D_LOW[esp] ! xl
- mov edx,FRAME_SIZE+D_HIGH[esp] ! xu
- call addition
- mov FRAME_SIZE+D_LOW[esp],eax
- mov FRAME_SIZE+D_HIGH[esp],edx
- pop esi
- pop edi
- pop ebp
- ret
-
- .globl Fsub
- .align ALIGNMENT
-Fsub:
- push ebp
- push edi
- push esi
- mov eax,FRAME_SIZE+D_LOW[esp]
- mov edx,FRAME_SIZE+D_HIGH[esp]
- mov ebx,FRAME_SIZE+D_SIZE+D_LOW[esp]
- mov ecx,FRAME_SIZE+D_SIZE+D_HIGH[esp]
- xor ecx,#D_SIGN_MASK ! complement sign
- call addition
- mov FRAME_SIZE+D_SIZE+D_LOW[esp],eax
- mov FRAME_SIZE+D_SIZE+D_HIGH[esp],edx
- pop esi
- pop edi
- pop ebp
- ret #D_SIZE
-
- .globl Fsubd
- .align ALIGNMENT
-Fsubd:
- push ebp
- push edi
- push esi
- mov eax,FRAME_SIZE+D_LOW[esp]
- mov edx,FRAME_SIZE+D_HIGH[esp]
- mov ecx,D_HIGH[ebx]
- mov ebx,D_LOW[ebx]
- xor ecx,#D_SIGN_MASK ! complement sign
- call addition
- mov FRAME_SIZE+D_LOW[esp],eax
- mov FRAME_SIZE+D_HIGH[esp],edx
- pop esi
- pop edi
- pop ebp
- ret
-
- .globl Fsubf
- .align ALIGNMENT
-Fsubf:
- push ebp
- push edi
- push esi
- call Fpushf
- pop ebx ! yl
- pop ecx ! yu
- mov eax,FRAME_SIZE+D_LOW[esp] ! xl
- mov edx,FRAME_SIZE+D_HIGH[esp] ! xu
- xor ecx,#D_SIGN_MASK ! complement sign
- call addition
- mov FRAME_SIZE+D_LOW[esp],eax
- mov FRAME_SIZE+D_HIGH[esp],edx
- pop esi
- pop edi
- pop ebp
- ret
-
- .align ALIGNMENT
-exp_y_0:
-
-! Check for x denormal, to split off special case where both are denormal,
-! so the norm bit (or 1 higher) is known to be set for addition, so addition
-! can be done faster
-
- test esi,#D_EXP_MASK
- jnz x_normal_exp_y_0
- test esi,esi ! test top bits of x fraction
- jnz both_denorm ! denormal iff nonzero fraction with zero exp
- test eax,eax ! test rest of fraction
- jz return_edx_eax ! everything 0 (XXX - do signs matter?)
-both_denorm:
- call fpdenormal
- test ebp,#D_SIGN_MASK
- jnz denorm_subtract
-
-! Add denormal x to denormal or zero y
-
-#if D_NORM_BIT != D_EXP_SHIFT
-#include "error, carry into norm bit does not go into exponent"
-#endif
-
- add eax,ebx
- adc esi,edi
- or edx,esi
- ret
-
-denorm_subtract:
- sub eax,ebx
- sbb esi,edi
- or edx,esi
- ret
-
- .align ALIGNMENT
-x_normal_exp_y_0:
- test edi,edi ! this is like the check for x denormal
- jnz y_denorm
- test ebx,ebx
- jz return_edx_eax ! y = 0
-y_denorm:
- call fpdenormal
- or ecx,#1 << D_EXP_SHIFT ! normalize y by setting exponent to 1
- jmp got_y
-
- .align ALIGNMENT
-return_edx_eax:
- ret
-
- .align ALIGNMENT
-add_bigshift:
- cmp ecx,#D_FRAC_BIT+2
- jae return_edx_eax ! x dominates y
- sub ecx,#REG_BIT
- shrd ebp,ebx,cl
- shrd ebx,edi,cl
- shr edi,cl
- add eax,edi
- adc esi,#0
- xchg ebp,ebx
- br normalize
-
- .align ALIGNMENT
-addition:
- mov esi,edx ! this mainly for consistent naming
- and esi,#D_EXP_MASK | D_FRAC_MASK ! discard sign so comparison is simple
- mov edi,ecx ! free cl for shifts
- and edi,#D_EXP_MASK | D_FRAC_MASK
- cmp esi,edi
- ja xbigger
- jb swap
- cmp eax,ebx
- jae xbigger
-swap:
- xchg edx,ecx
- xchg eax,ebx
- xchg esi,edi
-xbigger:
-
-! edx holds sign of result from here on
-! and exponent of result before the normalization step
-
- mov ebp,edx ! prepare difference of signs
- xor ebp,ecx
-
- and ecx,#D_EXP_MASK ! extract exp_y and check for y 0 or denormal
- beq exp_y_0 ! otherwise x is not 0 or denormal either
- and edi,#D_FRAC_MASK ! extract fraction
- or edi,#D_NORM_MASK ! normalize
-got_y:
- and esi,#D_FRAC_MASK ! extract fraction
- or esi,#D_NORM_MASK ! normalize
-
- sub ecx,edx ! carries from non-exp bits in edx killed later
- neg ecx
- and ecx,#D_EXP_MASK
- shr ecx,#D_EXP_SHIFT ! difference of exponents
-
-got_x_and_y:
- and ebp,#D_SIGN_MASK ! see if signs are same
- bne subtract ! else roundoff reg ebp has been cleared
-
- cmp cl,#REG_BIT
- bhis add_bigshift
- shrd ebp,ebx,cl
- shrd ebx,edi,cl
- shr edi,cl
- add eax,ebx
- adc esi,edi
-
-! result edx(D_SIGN_MASK | D_EXP_MASK bits):esi:eax:ebp but needs normalization
-
- mov edi,edx
- and edi,#D_EXP_MASK
- test esi,#D_NORM_MASK << 1
- jnz add_loverflow
-
-add_round:
- cmp ebp,#1 << (REG_BIT-1) ! test roundoff register
- jb add_done ! no rounding
- jz tie
-add_roundup:
- add eax,#1
- adc esi,#0
- test esi,#D_NORM_MASK << 1
- jnz pre_add_loverflow ! rounding may cause overflow!
-add_done:
- mov ecx,edx ! duplicated code from 'done'
- and edx,#D_SIGN_MASK
- or edx,edi
- and esi,#D_FRAC_MASK
- or edx,esi
- ret
-
- .align ALIGNMENT
-tie:
- test al,#1 ! tie case, round to even
- jz add_done ! even, no rounding
- jmp add_roundup
-
- .align ALIGNMENT
-pre_add_loverflow:
- sub ebp,ebp ! clear rounding register
- ! probably avoiding tests for more rounding
-add_loverflow:
- shrd ebp,eax,#1
- jnc over_set_sticky_bit
- or ebp,#1
-over_set_sticky_bit:
- shrd eax,esi,#1
- shr esi,#1
- add edi,1 << D_EXP_SHIFT
- cmp edi,#D_EXP_INFINITE << D_EXP_SHIFT
- jl add_round
-overflow:
- call fpoverflow
- mov eax,ecx ! XXX - wrong reg
- ret
-
-! result edx(D_SIGN_MASK | D_EXP_MASK bits):
-! esi((D_NORM_MASK << 1) | D_NORM_MASK | D_FRAC_MASK bits):eax:ebp:ebx
-! but needs normalization
-
- .align ALIGNMENT
-normalize:
- mov edi,edx
- and edi,#D_EXP_MASK
- test esi,#D_NORM_MASK << 1
- bne loverflow
-
-! result edx(D_SIGN_MASK bit):edi(D_EXP_MASK bits):
-! esi(D_NORM_MASK | D_FRAC_MASK bits):eax:ebp:ebx
-! but needs normalization
-
- .globl normalize2
-normalize2:
- test esi,#D_NORM_MASK ! already-normalized is very common
- jz normalize3
-round:
- cmp ebp,#1 << (REG_BIT-1) ! test roundoff register
- jb done ! no rounding
- jz near_tie
-roundup:
- add eax,#1
- adc esi,#0
- test esi,#D_NORM_MASK << 1
- bne pre_loverflow ! rounding may cause overflow!
-done:
-cmp edi,#D_EXP_INFINITE << D_EXP_SHIFT
-jae overflow
- and edx,#D_SIGN_MASK ! extract sign of largest and result
- or edx,edi ! include exponent with sign
- and esi,#D_FRAC_MASK ! discard norm bit
- or edx,esi ! include fraction with sign and exponent
- ret
-
- .align ALIGNMENT
-near_tie:
- test ebx,ebx
- jnz roundup
- test al,#1 ! tie case, round to even
- jz done ! even, no rounding
- jmp roundup
-
- .align ALIGNMENT
-not_in_8_below:
- shld ecx,esi,#REG_BIT-D_NORM_BIT+16 ! in 9 to 16 below?
- jz not_in_16_below ! must be way below (17-20 for usual D_NORM_BIT)
- mov cl,bsr_table[ecx] ! bsr(esi) - (D_NORM_BIT-16)
- neg ecx ! (D_NORM_BIT-16) - bsr(esi)
- add ecx,#16
- jmp got_shift
-
- .align ALIGNMENT
-not_in_16_below:
- mov cl,bsr_table[esi] ! bsr(esi) directly
- neg ecx ! -bsr(esi)
- add ecx,#D_NORM_BIT ! D_NORM_BIT - bsr(esi)
- jmp got_shift
-
- .align ALIGNMENT
-normalize3:
- test esi,esi
- jz shift32
-
-! Find first nonzero bit in esi
-! Don't use bsr, it is very slow (const + 3 * bit_found)
-! We know that there is some nonzero bit, and the norm bit and above are clear
-
- sub ecx,ecx ! prepare unsigned extension of cl
- shld ecx,esi,#REG_BIT-D_NORM_BIT+8 ! any bits in 8 below norm bit?
- jz not_in_8_below
- mov cl,bsr_table[ecx] ! bsr(esi) - (D_NORM_BIT-8)
- neg ecx ! (D_NORM_BIT-8) - bsr(esi)
- add ecx,#8 ! D_NORM_BIT - bsr(esi)
-got_shift:
- shld esi,eax,cl
- shld eax,ebp,cl
- shld ebp,ebx,cl
- shl ebx,cl
- shl ecx,D_EXP_SHIFT
- sub edi,ecx
- bhi round ! XXX - can rounding change the exponent to > 0?
- ! not bgt since edi may be 0x80000000
- neg edi
- shr edi,#D_EXP_SHIFT
- inc edi
- br fpunderflow
-
- .align ALIGNMENT
-pre_loverflow:
- sub ebp,ebp ! clear rounding registers
- sub ebx,ebx ! probably avoiding tests for more rounding
-
-loverflow:
- shr esi,#1 ! carry bit stayed in the reg
- rcr eax,#1
- rcr ebp,#1
- rcr ebx,#1
- add edi,1 << D_EXP_SHIFT
- cmp edi,#D_EXP_INFINITE << D_EXP_SHIFT
- blt round
- call fpoverflow
- mov eax,ecx ! XXX - wrong reg
- ret
-
- .align ALIGNMENT
-shift32:
- test eax,eax
- jz shift64
- mov esi,eax
- mov eax,ebp
- mov ebp,ebx
- sub ebx,ebx
- sub edi,#REG_BIT << D_EXP_SHIFT
-shiftxx:
- test esi,#~(D_NORM_MASK | D_FRAC_MASK)
- jz over_adjust ! else too big already
- shrd ebx,ebp,#D_BIT-D_FRAC_BIT
- shrd ebp,eax,#D_BIT-D_FRAC_BIT
- shrd eax,esi,#D_BIT-D_FRAC_BIT
- shr esi,#D_BIT-D_FRAC_BIT
- add edi,#(D_BIT-D_FRAC_BIT) << D_EXP_SHIFT
-over_adjust:
- test edi,edi
- bgt normalize2
- neg edi
- shr edi,#D_EXP_SHIFT
- inc edi
- br fpunderflow
-
- .align ALIGNMENT
-shift64:
- test ebp,ebp
- jz shift96
- mov esi,ebp
- mov eax,ebx
- sub ebp,ebp
- mov ebx,ebp
- sub edi,#(2*REG_BIT) << D_EXP_SHIFT
- jmp shiftxx
-
- .align ALIGNMENT
-shift96:
- test ebx,ebx ! XXX - this test is probably unnecessary
- ! since the shift must be small unless we
- ! are subtracting 2 almost-equal numbers,
- ! and then the bits beyond 64 will mostly
- ! be 0
- jz return_esi_eax ! all zero
- mov esi,ebx
- sub ebx,ebx
- sub edi,#(3*REG_BIT) << D_EXP_SHIFT
- jmp shiftxx
-
- .align ALIGNMENT
-return_esi_eax:
- mov edx,esi
- ret
-
- .align ALIGNMENT
-subtract:
- sub ebp,ebp ! set up roundoff register
- cmp ecx,#REG_BIT
- jae subtract_bigshift
- shrd ebp,ebx,cl
- shrd ebx,edi,cl
- shr edi,cl
- neg ebp ! begin subtraction esi:eax:0 - edi:ebx:ebp
- sbb eax,ebx
- sbb esi,edi
- sub ebx,ebx
- mov edi,edx
- and edi,#D_EXP_MASK
- br normalize2
-
- .align ALIGNMENT
-subtract_bigshift:
- cmp ecx,#D_FRAC_BIT+2
- bhis return_edx_eax ! x dominates y
- sub ecx,#REG_BIT
- shrd ebp,ebx,cl
- shrd ebx,edi,cl
- shr edi,cl
- not ebp ! begin subtraction esi:eax:0:0 - 0:edi:ebx:ebp
- not ebx
- add ebp,#1
- adc ebx,#0
- cmc
- sbb eax,edi
- sbb esi,#0
- xchg ebp,ebx
- mov edi,edx
- and edi,#D_EXP_MASK
- br normalize2
-
- .data
- .extern bsr_table
diff --git a/bin86-0.3/bccfp/fcomp.x b/bin86-0.3/bccfp/fcomp.x
deleted file mode 100644
index 71148ab..0000000
--- a/bin86-0.3/bccfp/fcomp.x
+++ /dev/null
@@ -1,89 +0,0 @@
-! bcc 386 floating point routines (version 2) -- Fcomp, Fcompd, Fcompf
-! authors: Timothy Murphy (tim@maths.tcd.ie), Bruce Evans
-
-#include "fplib.h"
-
- .extern Fpushf
-
-! Pop 2 doubles from stack and compare them, return result in flags so
-! normal signed branches work (unlike 80x87 which returns the result in
-! the zero and carry flags).
-
- .globl Fcomp
- .align ALIGNMENT
-Fcomp:
- pop ecx ! get return address
- pop eax ! xl
- pop edx ! xu
- push ecx ! put back ret address - pop 2nd double later
-
-! All this popping is bad on 486's since plain mov takes 1+ cycle and pop
-! takes 4 cycles. But this code is designed for 386's where popping is
-! nominally the same speed and saves code space and so maybe instruction
-! fetch time as well as the instruction to adjust the stack (ret #n takes
-! no longer than plain ret but inhibits gotos).
-
- mov ebx,PC_SIZE+D_LOW[esp] ! yl
- mov ecx,PC_SIZE+D_HIGH[esp] ! yu
- jmp compare
-
-! Pop double from stack and compare with double at [ebx]
-
- .globl Fcompd
- .align ALIGNMENT
-Fcompd:
- mov eax,PC_SIZE+D_LOW[esp] ! xl
- mov edx,PC_SIZE+D_HIGH[esp] ! xu
- mov ecx,D_HIGH[ebx] ! yu
- mov ebx,D_LOW[ebx] ! yl
-
-compare:
- test edx,#D_SIGN_MASK ! is x >= 0?
- jz cmp0 ! yes; just compare x and y
- test ecx,#D_SIGN_MASK ! no; but is y >= 0?
- jz cmp0 ! yes; just compare x and y
-
- xchg edx,ecx ! x, y < 0, so ...
- xchg eax,ebx ! ... swap x and y ...
- xor edx,#D_SIGN_MASK ! ... and toggle signs
- xor ecx,#D_SIGN_MASK
-
-cmp0:
- cmp edx,ecx ! compare upper dwords
- jnz checkneg0 ! if upper dwords differ, job is almost done
- mov edx,eax ! upper dwords equal, so ...
- mov ecx,ebx ! ... must make unsigned comparison of lower dwords
- shr edx,#1 ! shift past sign
- shr ecx,#1
- cmp edx,ecx ! compare top 31 bits of lower dwords
- jnz return ! if these differ, job is done
- and eax,#1 ! compare lowest bits
- and ebx,#1
- cmp eax,ebx
-
-return:
- ret #D_SIZE ! return, popping 1 double from stack
-
-checkneg0:
- test edx,#D_EXP_MASK | D_FRAC_MASK ! check to catch unusual case ...
- jnz recheck
- test eax,eax
- jnz recheck
- test ecx,#D_EXP_MASK | D_FRAC_MASK
- jnz recheck
- test ebx,ebx
- jz return ! ... both are (+-) zero, return 'z'
-
-recheck:
- cmp edx,ecx ! the upper words were really different
- ret #D_SIZE
-
- .globl Fcompf
- .align ALIGNMENT
-Fcompf:
- call Fpushf
- pop ebx ! yl
- pop ecx ! yu
- mov eax,PC_SIZE+D_LOW[esp] ! xl
- mov edx,PC_SIZE+D_HIGH[esp] ! xu
- jmp compare
diff --git a/bin86-0.3/bccfp/fdiv.x b/bin86-0.3/bccfp/fdiv.x
deleted file mode 100644
index 4a5cf74..0000000
--- a/bin86-0.3/bccfp/fdiv.x
+++ /dev/null
@@ -1,312 +0,0 @@
-#define EF_SIZE 4
-
-! bcc 386 floating point routines (version 2) -- Fdiv, Fdivd, Fdivf
-! authors: Timothy Murphy (tim@maths.tcd.ie), Bruce Evans
-
-#include "fplib.h"
-
-#define FRAME_SIZE (3 * GENREG_SIZE + PC_SIZE)
-
- .extern Fpushf
- .extern fpdivzero
- .extern fpoverflow
- .extern fpunderflow
-
-! double Fdiv(double x, double y) returns x / y
-
-! pop 2 doubles from stack, divide first by second, and push quotient on stack
-
-! we denote upper and lower dwords of x and y (or their fractions)
-! by (xu,xl), (yu,yl)
-
- .globl Fdivf
- .align ALIGNMENT
-Fdivf:
- sub esp,#D_SIZE ! make space for dummy double on stack
- push ebp
- push edi ! save some regs
- push esi
- mov eax,FRAME_SIZE-PC_SIZE+D_SIZE[esp] ! move return address ...
- mov FRAME_SIZE-PC_SIZE[esp],eax ! ... to usual spot
- call Fpushf
- pop esi ! yl
- pop edi ! yu
- mov eax,FRAME_SIZE+D_SIZE+D_LOW[esp] ! xl
- mov edx,FRAME_SIZE+D_SIZE+D_HIGH[esp] ! xu
- jmp division
-
- .globl Fdiv
- .align ALIGNMENT
-Fdiv:
- push ebp
- push edi ! save some regs
- push esi
- mov eax,FRAME_SIZE+D_LOW[esp] ! xl
- mov edx,FRAME_SIZE+D_HIGH[esp] ! xu
- mov esi,FRAME_SIZE+D_SIZE+D_LOW[esp] ! yl
- mov edi,FRAME_SIZE+D_SIZE+D_HIGH[esp] ! yu
- jmp division
-
- .align ALIGNMENT
-exp_y_0:
- mov ebx,edi
- or ebx,esi
- beq zerodivide
- mov ebx,#1
-fix_y:
- test edi,edi ! XXX - sloow
- js y_unpacked
- shld edi,esi,#1
- shl esi,#1
- dec bx
- jmp fix_y
-
- .align ALIGNMENT
-exp_x_0:
- mov ecx,edx
- or ecx,eax
- beq retz
- mov ecx,#1 ! change exponent from 0 to 1
-fix_x:
- test edx,#1 << (REG_BIT-1-2) ! XXX - sloow
- jnz x_unpacked
- shld edx,eax,#1
- shl eax,#1
- dec cx
- jmp fix_x
-
-! Fdivd pops double from stack, divides it by double at [ebx],
-! and pushes quotient back on stack
-
- .globl Fdivd
- .align ALIGNMENT
-Fdivd:
- sub esp,#D_SIZE ! make space for dummy double on stack
- push ebp
- push edi ! save some regs
- push esi
- mov eax,FRAME_SIZE-PC_SIZE+D_SIZE[esp] ! move return address ...
- mov FRAME_SIZE-PC_SIZE[esp],eax ! ... to usual spot
- mov eax,FRAME_SIZE+D_SIZE+D_LOW[esp] ! xl
- mov edx,FRAME_SIZE+D_SIZE+D_HIGH[esp] ! xu
- mov esi,D_LOW[ebx] ! yl
- mov edi,D_HIGH[ebx] ! yu
-
-division:
-
-! The full calculations are
-
-! (xu,xl,0) = yu * (zu,zl) + (0,r,0) (normal 96/32 -> 64 bit division)
-! yl * zu = yu * q1 + r1 (32*32 -> 64 bit mul and 64/32 -> 32 bit div)
-
-! so
-
-! (xu,xl,0,0) = (yu,yl) * (zu,zl-q1) + (0,0,r-r1,yl*(q1-zl))
-
-! where the calculations zl-q1, r-r1 and yl*(q1-zl) are more complicated
-! than the notation suggests. They may be negative and the one with the
-! multiplication may not fit in 32 bits and in both cases the overflow
-! has to be moved into higher bit positions.
-
-! See Knuth for why (zu,zl-q1) is the correct 64-bit quotient to within
-! 1 bit either way (assuming the normalization x < 2 * y).
-
-! We only need to calculate the remainder (0,0,r-r1,yl*(q1-zl)) to resolve
-! tie cases. It tells whether the approximate quotient is too high or too
-! low.
-
-#define NTEMPS 5
-
- sub esp,#NTEMPS*GENREG_SIZE ! space to remember values for rounding of tie case
-
-! Offsets from esp for these values (offsets using FRAME_SIZE are invalid
-! while these temps are active)
-r = 0
-q1 = 4
-r1 = 8
-yl = 12
-zl = 16
-
-! Step 1: unpack and normalize x to fraction in edx:eax (left shifted as
-! far as possible less 2 so that x < y, and later z < y); unpack and normalize
-! y to a fraction in edi:esi (left shifted as far as possible), put difference
-! of signs (= sign of quotient) in ecx(D_SIGN_MASK) and difference of exponents
-! (= exponent of quotient before normalization) in cx.
-
- mov ebp,edx ! xu
- xor ebp,edi ! xu ^ yu
- and ebp,#D_SIGN_MASK ! sign of result is difference of signs
-
-! Unpack y first to trap 0 / 0
-
- mov ebx,edi ! remember yu for exponent of y
- shld edi,esi,#D_BIT-D_FRAC_BIT ! extract fraction of y ...
- shl esi,#D_BIT-D_FRAC_BIT
- and ebx,#D_EXP_MASK ! exponent of y
- jz exp_y_0
- shr ebx,#D_EXP_SHIFT ! in ebx (actually in bx, with high bits 0)
- or edi,#D_NORM_MASK << (D_BIT-D_FRAC_BIT) ! normalize
-y_unpacked:
-
-! Unpack x
-
- mov ecx,edx ! remember xu for exponent of x
- shld edx,eax,#D_BIT-D_FRAC_BIT-2 ! extract fraction of x ...
- shl eax,#D_BIT-D_FRAC_BIT-2
- and edx,#(D_NORM_MASK << (D_BIT-D_FRAC_BIT-2+1))-1
- ! XXX - above may be shifted 1 extra unnecessarily
- and ecx,#D_EXP_MASK ! exponent of x
- jz exp_x_0
- shr ecx,#D_EXP_SHIFT ! in ecx (actually in cx, with high bits 0)
- or edx,#D_NORM_MASK << (D_BIT-D_FRAC_BIT-2) ! normalize
-x_unpacked:
-
- sub cx,bx ! not ecx,ebx because we want to use high bit for sign
- add cx,#D_EXP_BIAS ! adjust exponent of quotient
-
- or ecx,ebp ! include sign with exponent
-
-! Step 2: quotient of fractions -> (edx,eax)
-
-! 2a: (xu,xl,0) div yu = (zu,zl) -> (ebx,esi)
-
- div eax,edi ! (xu,xl) div yu = zu in eax; remainder (rem) in edx
- mov ebx,eax ! save zu in ebx
- sub eax,eax ! clear eax: (edx,eax) = (rem,0)
- div eax,edi ! (rem,0) div yu = zl in eax
- mov r[esp],edx
- mov zl[esp],eax
- xchg eax,esi ! store zl in esi; save yl in eax
- mov yl[esp],eax
-
-! 2b: (yl * zu) div yu -> (0,eax)
-
- mul eax,ebx ! yl * zu -> (edx,eax)
- div eax,edi ! (yl * zu) div yu in eax
- mov q1[esp],eax
- mov r1[esp],edx
-
-! 2c: (xu,xl) / (yu,yl) = (zu,zl) - (yl * zu) div yu -> (edx,eax)
-
- mov edx,ebx ! zu
- xchg eax,esi ! eax <- zl; esi <- (yl * zu) div yu
- sub eax,esi
- sbb edx,#0
-
-! Step 3: normalise quotient
-
- test edx,#1 << (REG_BIT-2) ! is fraction too small? (can only be by 1 bit)
- jnz div4
- shld edx,eax,#1 ! yes; multiply fraction ...
- shl eax,#1 ! ... by 2 ...
- dec cx ! ... and decrement exponent
-
-! Step 4: shift and round
-
-div4:
- mov ebx,eax ! save for rounding
- shrd eax,edx,#D_BIT-D_FRAC_BIT-1 ! shift fraction of result ...
- shr edx,#D_BIT-D_FRAC_BIT-1 ! ... to proper position
- and ebx,#(1 << (D_BIT-D_FRAC_BIT-1))-1 ! look at bits shifted out
- cmp ebx,#D_NORM_MASK >> (D_BIT-D_FRAC_BIT) ! compare with middle value
- jb div5 ! below middle, don't round up
- ja roundup ! above middle, round up
-
-! The low bits don't contain enough information to resolve the tie case,
-! because the quotient itself is only an approximation.
-! Calculate the exact remainder.
-! This case is not very common, so don't worry much about speed.
-! Unfortunately we had to save extra in all cases to prepare for it.
-
- push edx
- push eax
-
- sub esi,esi ! the calculation requires 33 bits - carry to here
- mov eax,2*GENREG_SIZE+q1[esp]
- sub eax,2*GENREG_SIZE+zl[esp]
- pushfd
- mul dword EF_SIZE+2*GENREG_SIZE+yl[esp]
- popfd
- jnc foo
- sub edx,2*GENREG_SIZE+yl[esp]
- sbb esi,#0
-foo:
- add edx,2*GENREG_SIZE+r[esp]
- adc esi,#0
- sub edx,2*GENREG_SIZE+r1[esp]
- sbb esi,#0
- mov ebx,eax
- mov edi,edx
-
- pop eax
- pop edx
-
-! Can finally decide rounding of tie case
-
- js div5 ! remainder < 0 from looking at top 64 bits
- jnz roundup ! remainder > 0 from looking at top 64 bits
- or edi,ebx ! test bottom 64 bits
- jnz roundup ! remainder > 0
-
- test al,#1 ! at last we know it is the tie case, check parity bit
- jz div5 ! already even, otherwise round up to make even
-
-roundup:
- add eax,#1 ! add rounding bit
- adc edx,#0
- test edx,#D_NORM_MASK << 1 ! has fraction overflowed (very unlikely)
- jz div5
-! Why were the shifts commented out?
- shrd eax,edx,#1 ! yes, divide fraction ...
- shr edx,#1 ! ... by 2 ...
- inc cx ! ... and increment exponent
-
-! Step 5: put it all together
-
-div5:
- mov ebx,ecx ! extract sign
- and ebx,D_SIGN_MASK
- cmp cx,#D_EXP_INFINITE ! is exponent too big?
- jge overflow
- test cx,cx
- jle underflow
- shl ecx,#D_EXP_SHIFT
-
- and edx,#D_FRAC_MASK ! remove norm bit
- or edx,ecx ! include exponent ...
- or edx,ebx ! ... and sign
-
-return:
- add esp,#NTEMPS*GENREG_SIZE ! reclaim temp space
- mov FRAME_SIZE+D_SIZE+D_LOW[esp],eax ! "push" lower dword of product ...
- mov FRAME_SIZE+D_SIZE+D_HIGH[esp],edx ! ... and upper dword
- pop esi ! restore registers
- pop edi
- pop ebp
- ret #D_SIZE
-
-retz:
- sub edx,edx ! clear upper dword
- sub eax,eax ! ... and lower dword
- jmp return
-
-overflow:
- mov edx,ecx ! put sign in usual reg
- call fpoverflow
- mov eax,ecx ! XXX - wrong reg
- jmp return
-
-underflow:
- mov esi,edx ! put upper part of fraction in usual reg
- mov edx,ecx ! sign
- movsx edi,cx ! put shift in usual reg
- neg edi
- inc edi
- call fpunderflow
- jmp return
-
-zerodivide:
- mov edx,ebp ! sign
- call fpdivzero
- mov eax,ecx ! XXX - wrong reg
- jmp return
diff --git a/bin86-0.3/bccfp/fmul.x b/bin86-0.3/bccfp/fmul.x
deleted file mode 100644
index aa62b5c..0000000
--- a/bin86-0.3/bccfp/fmul.x
+++ /dev/null
@@ -1,150 +0,0 @@
-! bcc 386 floating point routines (version 2) -- Fmul, Fmuld, Fmulf
-! author: Bruce Evans
-
-#include "fplib.h"
-
-#define FRAME_SIZE (3 * GENREG_SIZE + PC_SIZE)
-
- .extern Fpushf
- .extern fpoverflow
- .extern fpunderflow
- .extern normalize2
-
- .globl Fmul
- .align ALIGNMENT
-Fmul:
- push ebp
- push edi
- push esi
- mov eax,FRAME_SIZE+D_LOW[esp]
- mov edx,FRAME_SIZE+D_HIGH[esp]
- mov ebx,FRAME_SIZE+D_SIZE+D_LOW[esp]
- mov ecx,FRAME_SIZE+D_SIZE+D_HIGH[esp]
- call multiplication
- mov FRAME_SIZE+D_SIZE+D_LOW[esp],eax
- mov FRAME_SIZE+D_SIZE+D_HIGH[esp],edx
- pop esi
- pop edi
- pop ebp
- ret #D_SIZE
-
- .globl Fmuld
- .align ALIGNMENT
-Fmuld:
- push ebp
- push edi
- push esi
- mov eax,FRAME_SIZE+D_LOW[esp]
- mov edx,FRAME_SIZE+D_HIGH[esp]
- mov ecx,D_HIGH[ebx]
- mov ebx,D_LOW[ebx]
- call multiplication
- mov FRAME_SIZE+D_LOW[esp],eax
- mov FRAME_SIZE+D_HIGH[esp],edx
- pop esi
- pop edi
- pop ebp
- ret
-
- .globl Fmulf
- .align ALIGNMENT
-Fmulf:
- push ebp
- push edi
- push esi
- call Fpushf
- pop ebx ! yl
- pop ecx ! xu
- mov eax,FRAME_SIZE+D_LOW[esp] ! xl
- mov edx,FRAME_SIZE+D_HIGH[esp] ! xu
- call multiplication
- mov FRAME_SIZE+D_LOW[esp],eax
- mov FRAME_SIZE+D_HIGH[esp],edx
- pop esi
- pop edi
- pop ebp
- ret
-
- .align ALIGNMENT
-exp_x_0:
- mov edx,#1 << D_EXP_SHIFT ! change exponent from 0 to 1
- jmp x_unpacked ! XXX - check for denormal?
-
- .align ALIGNMENT
-exp_y_0:
- mov ecx,#1 << D_EXP_SHIFT
- jmp y_unpacked
-
- .align ALIGNMENT
-multiplication:
- mov ebp,edx ! xu
- xor ebp,ecx ! xu ^ yu
- and ebp,#D_SIGN_MASK ! sign of result is difference of signs
-
- mov esi,edx ! free edx for multiplications
- and esi,#D_FRAC_MASK ! discard sign and exponent
- and edx,#D_EXP_MASK ! exponent(x)
- jz exp_x_0
- or esi,#D_NORM_MASK ! normalize
-x_unpacked:
-
- mov edi,ecx ! this mainly for consistent naming
- and edi,#D_FRAC_MASK
- and ecx,#D_EXP_MASK ! exponent(y)
- jz exp_y_0
- or edi,#D_NORM_MASK
-y_unpacked:
-
- add ecx,edx ! add exponents
-
-! exponent is in ecx, sign in ebp, operands in esi:eax and edi:ebx, edx is free
-! product to go in esi:eax:ebp:ebx
-! terminology: x * y = (xu,xl) * (yu,yl)
-! = (xu * yu,0,0) + (0,xu * yl + xl * yu,0) + (0,0,xl * yl)
-
- push ecx
- push ebp
- mov ecx,eax
- mul ebx ! xl * yl
- mov ebp,edx ! (xl * yl).u in ebp
- xchg ebx,eax ! (xl * yl).l in ebx (final), yl in eax
- mul esi ! xu * yl
- push eax ! (xu * yl).l on stack
- push edx ! (xu * yl).u on stack
- mov eax,esi ! xu
- mul edi ! xu * yu
- mov esi,edx ! (xu * yu).u in esi (final except carries)
- xchg ecx,eax ! (xu * yu).l in ecx, xl in eax
- mul edi ! xl * yu
-
- add ebp,eax ! (xl * yl).u + (xl * yu).l
- pop eax ! (xu * yl).u
- adc eax,edx ! (xu * yl).u + (xl * yu).u
- adc esi,#0
- pop edx ! (xu * yl).l
- add ebp,edx ! ((xl * yl).u + (xl * yu).l) + (xu * yl).l
- adc eax,ecx ! ((xu * yl).u + (xl * yu).u) + (xu * yu).l
- adc esi,#0
- pop edx ! sign
- pop edi ! exponent
- sub edi,#(D_EXP_BIAS+1-(D_EXP_BIT+2)) << D_EXP_SHIFT ! adjust
-! cmp edi,#(D_EXP_INFINITE-1+(D_EXP_BIT+2)) << D_EXP_SHIFT
-! jae outofbounds ! 0 will be caught as underflow by normalize2
-cmp edi,#(2*D_EXP_INFINITE-(D_EXP_BIAS+1)+(D_EXP_BIT+2)) << D_EXP_SHIFT
-ja underflow
- br normalize2
-
- .align ALIGNMENT
-overflow:
- mov edx,ebp ! put sign in usual reg
- call fpoverflow
- mov eax,ecx ! XXX - wrong reg
- ret
-
- .align ALIGNMENT
-underflow:
- mov edx,ebp ! put sign in usual reg
- neg edi
- shr edi,#D_EXP_SHIFT
- inc edi
- br fpunderflow
diff --git a/bin86-0.3/bccfp/fpbsr.x b/bin86-0.3/bccfp/fpbsr.x
deleted file mode 100644
index 8ff38d7..0000000
--- a/bin86-0.3/bccfp/fpbsr.x
+++ /dev/null
@@ -1,25 +0,0 @@
-! bcc 386 floating point routines (version 2) -- bsr_table
-! author: Bruce Evans
-
-#include "fplib.h"
-
- .globl bsr_table
- .data
- .align ALIGNMENT
-bsr_table: ! table to replace bsr on range 0-255
-.byte -1, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3
-.byte 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
-.byte 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
-.byte 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
-.byte 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6
-.byte 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6
-.byte 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6
-.byte 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6
-.byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
-.byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
-.byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
-.byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
-.byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
-.byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
-.byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
-.byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
diff --git a/bin86-0.3/bccfp/fperr.c b/bin86-0.3/bccfp/fperr.c
deleted file mode 100644
index d5372dc..0000000
--- a/bin86-0.3/bccfp/fperr.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * bin86/bccfp/fperr.c
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-#include <stdio.h>
-#include <signal.h>
-
-#include "fperr.h"
-
-void fperr(errno)
-int errno;
-{
-
-#if defined(DEBUG) || 0
- switch(errno) {
-
- case EFDENORMAL:
- fputs("\nDenormal - ", stderr);
- break;
-
- case EFINFINITY:
- fputs("\nInfinity - ", stderr);
- break;
-
- case EFNAN:
- fputs("\nNaN - ", stderr);
- break;
-
- case EFOVERFLOW:
- fputs("\nOverflow - ", stderr);
- break;
-
- case EFUNDERFLOW:
- fputs("\nUnderflow - ", stderr);
- break;
-
- case EFDIVZERO:
- fputs("\nZero divide - ", stderr);
- break;
-
- default:
- fprintf(stderr, "\nUnknown error 0x%x - ", errno);
- }
- fflush(stderr);
-#endif
-
- kill(getpid(), SIGFPE);
-}
diff --git a/bin86-0.3/bccfp/fperr.h b/bin86-0.3/bccfp/fperr.h
deleted file mode 100644
index 42d54fd..0000000
--- a/bin86-0.3/bccfp/fperr.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * bin86/bccfp/fperr.h
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-/* fperr.h */
-
-#define EFDENORMAL 1
-#define EFINFINITY 2
-#define EFNAN 3
-#define EFOVERFLOW 4
-#define EFUNDERFLOW 5
-#define EFDIVZERO 6
diff --git a/bin86-0.3/bccfp/fperror.x b/bin86-0.3/bccfp/fperror.x
deleted file mode 100644
index 04f3f74..0000000
--- a/bin86-0.3/bccfp/fperror.x
+++ /dev/null
@@ -1,126 +0,0 @@
-! bcc 386 floating point routines (version 2)
-! --- fpdenormal, fperror, fpinfinity, fpNaN, fpoverflow, fpunderflow,fpdivzero
-! author: Bruce Evans
-
-#include "fperr.h"
-#include "fplib.h"
-
- .extern _fperr
-
-! Cause a denormal-operand exception
-! Preserves all general registers if signal handler returns
-
- .globl fpdenormal
- .align ALIGNMENT
-fpdenormal:
-#if 0
- push eax
- mov eax,#EFDENORMAL
- call fperror
- pop eax
-#endif
- ret
-
-! Cause an exception with error code eax, preserving all genregs except eax
-
- .globl fperror
- .align ALIGNMENT
-fperror:
- push ebp ! set up usual frame ...
- mov ebp,esp ! ... for debugging
- push edx ! save default
- push ecx
- push eax ! error code is arg to C routine
- call _fperr
- add esp,#GENREG_SIZE
- pop ecx ! restore default
- pop edx
- pop ebp
- ret
-
- .align ALIGNMENT
-fphuge:
- mov ecx,#D_HUGE_LOW ! prepare number +-HUGEVAL
- or edx,#D_HUGE_HIGH ! ... in case signal handler returns
- jmp fperror
-
-! Cause an infinite-operand exception
-! Return +-HUGEVAL in edx:ecx with sign from edx
-
- .globl fpinfinity
- .align ALIGNMENT
-fpinfinity:
- mov eax,#EFINFINITY
- jmp fphuge ! almost right
-
-! Cause an NaN-operand exception
-! Return +-HUGEVAL in edx:ecx with sign from edx
-
- .globl fpNaN
- .align ALIGNMENT
-fpNaN:
- mov eax,#EFNAN ! there are different types of NaNs but...
- jmp fphuge ! WRONG
-
-! Cause an overflow exception
-! Return +-HUGEVAL in edx:ecx with sign from edx
-
- .globl fpoverflow
- .align ALIGNMENT
-fpoverflow:
- mov eax,#EFOVERFLOW
- jmp fphuge ! almost right
-
-! Cause an underflow exception (actually assume it is masked for now)
-! Return denormal or 0.0 in edx:ecx
-! XXX - this should cause a denormal exception or none for the denormal case
-! Args: sign in edx, fraction in esi:eax, right shift in edi
-! Returns: denormalized number in edx:eax
-
- .globl fpunderflow
- .align ALIGNMENT
-fpunderflow:
-#if 0
- mov eax,#EFUNDERFLOW
- jmp fperror
-#endif
- cmp edi,#REG_BIT
- jb denormalize1
- mov eax,esi
- sub esi,esi
- sub edi,#REG_BIT
- cmp edi,#REG_BIT
- jb denormalize1
-denormalize_underflow:
-#if 0
- mov eax,#EFUNDERFLOW
- jmp fperror
-#endif
- sub eax,eax
- mov edx,eax
- ret
-
- .align ALIGNMENT
-denormalize1:
- mov ecx,edi
- shrd eax,esi,cl
- shr esi,cl
- mov ecx,esi
- or ecx,eax
- jz denormalize_underflow
- and edx,#D_SIGN_MASK
- or edx,esi
- ret
-
-! Cause an fp division by zero exception
-! Return +-HUGEVAL in edx:ecx with sign from edx
-
- .globl fpdivzero
- .align ALIGNMENT
-fpdivzero:
- mov eax,#EFDIVZERO
- test edx,#D_EXP_MASK
- jnz fphuge ! almost right
- sub ecx,ecx
- mov edx,ecx
- jmp fperror
diff --git a/bin86-0.3/bccfp/fplib.h b/bin86-0.3/bccfp/fplib.h
deleted file mode 100644
index b346c61..0000000
--- a/bin86-0.3/bccfp/fplib.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * bin86/bccfp/fplib.h
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-#define ALIGNMENT 4
-#define CHAR_BIT 8
-#define D_BIT (D_SIZE * CHAR_BIT)
-#define D_EXP_BIAS ((1 << (D_EXP_BIT - 1)) - 1)
-#define D_EXP_BIT 11
-#define D_EXP_INFINITE ((1 << D_EXP_BIT) - 1)
-#define D_EXP_MASK (((1 << D_EXP_BIT) - 1) << D_EXP_SHIFT)
-#define D_EXP_SHIFT (REG_BIT - (1 + D_EXP_BIT))
-#define D_FRAC_BIT 53
-#define D_FRAC_MASK (D_NORM_MASK - 1)
-#define D_HIGH 4
-#define D_HUGE_HIGH (D_EXP_MASK - 1)
-#define D_HUGE_LOW 0xFFFFFFFF
-#define D_LOW 0
-#define D_NORM_BIT (D_FRAC_BIT - 1 - REG_BIT)
-#define D_NORM_MASK (1 << D_NORM_BIT)
-#define D_SIGN_BIT 63
-#define D_SIGN_MASK (1 << (D_SIGN_BIT - REG_BIT))
-#define D_SIZE 8
-#define F_BIT (F_SIZE * CHAR_BIT)
-#define F_EXP_BIAS ((1 << (F_EXP_BIT - 1)) - 1)
-#define F_EXP_BIT 8
-#define F_EXP_INFINITE ((1 << F_EXP_BIT) - 1)
-#define F_EXP_MASK (((1 << F_EXP_BIT) - 1) << F_EXP_SHIFT)
-#define F_EXP_SHIFT (REG_BIT - (1 + F_EXP_BIT))
-#define F_FRAC_BIT 24
-#define F_FRAC_MASK (F_NORM_MASK - 1)
-#define F_HIGH 0
-#define F_HUGE_HIGH (F_EXP_MASK - 1)
-#define F_NORM_BIT (F_FRAC_BIT - 1)
-#define F_NORM_MASK (1 << F_NORM_BIT)
-#define F_SIGN_BIT 31
-#define F_SIGN_MASK (1 << F_SIGN_BIT)
-#define F_SIZE 4
-#define FREE_D_SIGN_BIT_TEST (D_SIGN_BIT % REG_BIT == REG_BIT - 1)
-#define GENREG_SIZE 4
-#define INT_BIT 32
-#define INT_MAX 0x7FFFFFFF
-#define INT_MIN (-0x7FFFFFFF - 1)
-#define PC_SIZE 4
-#define REG_BIT 32
-#define SHORT_BIT 16
-#define UINT_MAX 0xFFFFFFFF
diff --git a/bin86-0.3/bccfp/fptoi.x b/bin86-0.3/bccfp/fptoi.x
deleted file mode 100644
index 30de729..0000000
--- a/bin86-0.3/bccfp/fptoi.x
+++ /dev/null
@@ -1,117 +0,0 @@
-! bcc 386 floating point routines (version 2)
-! -- dtoi, dtol, dtoui, dtoul, ftoi, ftol (todo: ftoui, ftoul)
-! authors: Timothy Murphy (tim@maths.tcd.ie), Bruce Evans
-
-#include "fplib.h"
-
- .extern fpoverflow
- .extern Fpushf
-
-! Convert double x at [ebx] to int and return in eax
-
- .globl dtoi
- .globl dtol
- .align ALIGNMENT
-dtoi:
-dtol:
- mov eax,D_HIGH[ebx]
- mov ecx,eax
- and ecx,#D_EXP_MASK ! extract exponent
- jz retz ! if 0 return 0
- test eax,#D_SIGN_MASK
- jnz negative
- call into_dtoui
- cmp eax,#INT_MAX
- ja overflow_int_max
- ret
-
- .align ALIGNMENT
-negative:
- and eax,#~D_SIGN_MASK
- call into_dtoui
- cmp eax,#INT_MIN
- ja overflow_int_min
- neg eax
- ret
-
- .align ALIGNMENT
-overflow_int_max:
- call fpoverflow
- mov eax,#INT_MAX
- ret
-
- .align ALIGNMENT
-overflow_int_min:
- js return ! actually INT_MIN is OK
- call fpoverflow
- mov eax,#INT_MIN
-return:
- ret
-
- .align ALIGNMENT
-retz:
- sub eax,eax ! clear return value
- ret
-
-! Convert double x at [ebx] to unsigned and return in eax
-
- .globl dtoui
- .globl dtoul
- .align ALIGNMENT
-dtoui:
-dtoul:
- mov eax,D_HIGH[ebx]
- mov ecx,eax
- and ecx,#D_EXP_MASK ! extract exponent
- jz retz ! if 0 return 0
- test eax,#D_SIGN_MASK
- jnz overflow_0
-into_dtoui:
- mov edx,D_LOW[ebx]
-
- and eax,#D_FRAC_MASK ! extract fraction
- or eax,#D_NORM_MASK ! restore normalization bit
-
- shr ecx,#D_EXP_SHIFT ! convert exponent to number
- sub ecx,#D_EXP_BIAS+D_NORM_BIT ! adjust radix point
- jl dtoui_rightshift ! should we shift left or right?
- cmp ecx,#D_BIT-D_FRAC_BIT ! can shift left by at most this
- ja overflow_uint_max ! if more, overflow
- shld eax,edx,cl
- ret
-
- .align ALIGNMENT
-dtoui_rightshift:
- neg ecx ! make shift count > 0
- cmp ecx,#REG_BIT ! big shifts would be taken mod REG_BIT ...
- jae retz ! ... no good
- shr eax,cl ! otherwise it is faster to do the shift ...
- ret ! ... then to jump for the slightly smaller
- ! ... shift counts that shift out all bits
-
- .align ALIGNMENT
-overflow_0:
- call fpoverflow
- sub eax,eax
- ret
-
- .align ALIGNMENT
-overflow_uint_max:
- call fpoverflow
- mov eax,#UINT_MAX
- ret
-
-! ftoi is like dtoi except ebx points to a float instead of a double.
-! This is a quickly-written slowish version that does not take advantage
-! of the float being smaller.
-
- .globl ftoi
- .globl ftol
- .align ALIGNMENT
-ftoi:
-ftol:
- call Fpushf
- mov ebx,esp
- call dtoi
- add esp,#D_SIZE
- ret
diff --git a/bin86-0.3/bccfp/fpulld.x b/bin86-0.3/bccfp/fpulld.x
deleted file mode 100644
index 928a846..0000000
--- a/bin86-0.3/bccfp/fpulld.x
+++ /dev/null
@@ -1,20 +0,0 @@
-! bcc 386 floating point routines (version 2) -- Fpulld
-! authors: Timothy Murphy (tim@maths.tcd.ie), Bruce Evans
-
-#include "fplib.h"
-
-! Pop double from stack and store at address [ebx]
-
- .globl Fpulld
- .align ALIGNMENT
-Fpulld:
- pop ecx
- pop dword D_LOW[ebx]
- pop dword D_HIGH[ebx]
- jmp ecx ! return
-
-! This popping method is much slower on 486's because popping to memory
-! takes 5+ while moving twice takes 2 and the return address doesn't
-! have to be moved. However, popping is a little faster on a non-cached
-! 386/20 with static column RAM although the memory access pattern is
-! better for a double-width move than for popping. What about a cached 386?
diff --git a/bin86-0.3/bccfp/fpullf.x b/bin86-0.3/bccfp/fpullf.x
deleted file mode 100644
index 417ef92..0000000
--- a/bin86-0.3/bccfp/fpullf.x
+++ /dev/null
@@ -1,101 +0,0 @@
-! bcc 386 floating point routines (version 2) -- Fpullf
-! authors: Timothy Murphy (tim@maths.tcd.ie), Bruce Evans
-
-#include "fplib.h"
-
- .extern fpoverflow
- .extern fpunderflow
-
-! pop double from stack, convert to float and store at address [ebx]
-
- .globl Fpullf
- .align ALIGNMENT
-Fpullf:
-
-! Step 1: load and shift left
-
- mov eax,PC_SIZE+D_LOW[esp] ! lower dword
- mov edx,PC_SIZE+D_HIGH[esp] ! upper dword
- mov ecx,edx ! copy upper dword into ecx ...
- and ecx,#D_SIGN_MASK ! ... and extract sign
- and edx,#D_EXP_MASK | D_FRAC_MASK ! extract exponent and fraction
- sub edx,#(D_EXP_BIAS-F_EXP_BIAS) << D_EXP_SHIFT ! adjust exponent bias
- jz underflow
- cmp edx,#F_EXP_INFINITE << D_EXP_SHIFT ! check if exponent lies in reduced range
- jae outofbounds
- shld edx,eax,#D_EXP_BIT-F_EXP_BIT ! shift exponent and fraction
-
-! Step 2: round
-
- test eax,#1 << (REG_BIT-1-(D_EXP_BIT-F_EXP_BIT)) ! test upper rounding bit
- jz step3 ! below middle, don't round up
- test eax,#(1 << (REG_BIT-1-(D_EXP_BIT-F_EXP_BIT)))-1 ! test other rounding bits
- jnz roundup ! above middle, round up
- test dl,#1 ! in middle, check parity bit
- jz step3 ! already even, otherwise round up to make even
-
-roundup:
- inc edx ! carry 1
- test edx,#F_FRAC_MASK ! is fraction now 0? (carry into F_EXPMASK)
- jnz step3 ! no -- carry complete
- cmp edx,#(F_EXP_INFINITE << F_EXP_SHIFT) & ~F_NORM_MASK ! yes (very unlikely): check for overflow
- ! XXX - I think these tests say 0x7e7fffff overflows
- jae overflow
-
-! Step 3: put it all together
-
-step3:
- or edx,ecx ! include sign
- mov F_HIGH[ebx],edx ! store the result in [ebx]
- ret #D_SIZE ! return and release double from stack
-
- .align ALIGNMENT
-outofbounds:
- jns overflow ! have just compared exponent with the max
-underflow:
-! call fpunderflow ! XXX
- push ecx ! save sign
- mov ecx,edx
- and ecx,#~D_FRAC_MASK ! assume fraction is below exp
- cmp ecx,#-((D_EXP_BIAS-F_EXP_BIAS) << D_EXP_SHIFT) ! was exp = 0?
- jz exp_x_0
- shr ecx,#D_EXP_SHIFT
- neg ecx
- and edx,#D_FRAC_MASK
- or edx,#D_NORM_MASK
- shld edx,eax,#D_EXP_BIT-F_EXP_BIT-1
- shl eax,#D_EXP_BIT-F_EXP_BIT-1
- push ebx ! save to use for rounding
- sub ebx,ebx
- shrd ebx,eax,cl
- shrd eax,edx,cl
- shr edx,cl
- cmp eax,#1 << (REG_BIT-1)
- jb over_denorm_roundup
- ja denorm_roundup
- test dl,#1
- jz over_denorm_roundup
-denorm_roundup:
-#if F_NORM_BIT != F_EXP_SHIFT
-#include "carry into norm bit doesn't go into low exp bit"
-#endif
- inc edx
-over_denorm_roundup:
- pop ebx
- pop ecx
- or edx,ecx
- mov F_HIGH[ebx],edx
- ret #D_SIZE
-
- .align ALIGNMENT
-exp_x_0: ! XXX check for denormals - they underflow
- pop ecx
- mov dword F_HIGH[ebx],#0
- ret #D_SIZE
-
- .align ALIGNMENT
-overflow:
- mov edx,ebx ! put sign in usual reg
- call fpoverflow
- mov F_HIGH[ebx],dword #F_HUGE_HIGH ! XXX - should use infinity
- ret #D_SIZE ! ... if fpoverflow does
diff --git a/bin86-0.3/bccfp/fpushd.x b/bin86-0.3/bccfp/fpushd.x
deleted file mode 100644
index 68caab0..0000000
--- a/bin86-0.3/bccfp/fpushd.x
+++ /dev/null
@@ -1,60 +0,0 @@
-! bcc 386 floating point routines (version 2) -- dtof, Fpushd, Fneg, Fnegd
-! authors: Timothy Murphy (tim@maths.tcd.ie), Bruce Evans
-
-#include "fplib.h"
-
- .extern Fpullf
-
-! dtof converts the double at [ebx] to a float and pushes the float onto
-! the stack (D_SIZE bytes are allocated for the float although only the bottom
-! F_SIZE are used).
-! This is a quickly-written slowish version.
-
- .globl dtof
- .align ALIGNMENT
-dtof:
- pop eax
- sub esp,#D_SIZE ! build result here
- push eax ! put back return address
- call Fpushd
- lea ebx,D_SIZE+PC_SIZE[esp]
- call Fpullf
- ret
-
-! Push double at address [ebx] onto stack
-
- .globl Fpushd
- .align ALIGNMENT
-Fpushd:
- pop ecx
- push dword D_HIGH[ebx]
- push dword D_LOW[ebx]
- jmp ecx ! return
-
-! Push double at address [ebx] onto stack, negating it on the way.
-
-! Don't worry about generating -0 because other routines have to allow for
-! it anyway.
-
-! Perhaps this and Fneg should check for denormals and illegal operands
-! (I think only signalling NaNs are illegal).
-! fchs doesn't check, but fld does.
-! Our Fpushd is not quite like fld because no conversions are involved.
-
- .globl Fnegd
- .align ALIGNMENT
-Fnegd:
- pop ecx
- mov eax,D_HIGH[ebx]
- xor eax,#D_SIGN_MASK ! toggle sign
- push eax
- push dword D_LOW[ebx]
- jmp ecx ! return
-
-! Negate double on stack
-
- .globl Fneg
- .align ALIGNMENT
-Fneg:
- xorb PC_SIZE+D_SIZE-1[esp],D_SIGN_MASK >> (REG_BIT-CHAR_BIT) ! toggle sign
- ret
diff --git a/bin86-0.3/bccfp/fpushf.x b/bin86-0.3/bccfp/fpushf.x
deleted file mode 100644
index 7cb2f8d..0000000
--- a/bin86-0.3/bccfp/fpushf.x
+++ /dev/null
@@ -1,74 +0,0 @@
-! bcc 386 floating point routines (version 2) -- Fpushf, Fnegf
-! authors: Timothy Murphy (tim@maths.tcd.ie), Bruce Evans
-
-#include "fplib.h"
-
- .extern fpdenormal
-
-! Load float at [ebx], convert to double and push on stack
-
- .globl Fpushf
- .align ALIGNMENT
-Fpushf:
- mov edx,F_HIGH[ebx]
-into_Fpushf:
- test edx,#F_EXP_MASK ! is exponent 0?
- jz exp_x_0
-
- mov ecx,edx ! extract sign
- and ecx,#F_SIGN_MASK
-
- and edx,#F_EXP_MASK | F_FRAC_MASK ! extract exponent and fraction
- sub eax,eax ! clear lower dword
- shrd eax,edx,#D_EXP_BIT-F_EXP_BIT ! shift exponent and fraction to new position
- shr edx,#D_EXP_BIT-F_EXP_BIT
-
- add edx,#(D_EXP_BIAS-F_EXP_BIAS) << D_EXP_SHIFT ! adjust exponent bias
- or edx,ecx ! include sign
-
- pop ecx
- push edx ! upper dword
- push eax ! lower dword
- jmp ecx ! return
-
- .align ALIGNMENT
-exp_x_0:
- mov eax,edx
- and eax,#F_FRAC_MASK
- jnz x_denorm
- pop ecx
- push eax ! upper dword = 0
- push eax ! lower dword = 0
- jmp ecx ! return
-
- .align ALIGNMENT
-x_denorm:
- call fpdenormal
- bsr ecx,eax ! zzzz
- neg ecx
- add ecx,#F_NORM_BIT
- shl eax,cl
- and eax,#F_FRAC_MASK
- neg ecx
- add ecx,#D_EXP_BIAS-F_EXP_BIAS+1
- shl ecx,#D_EXP_SHIFT
- and edx,#F_SIGN_MASK ! assumed same as D_SIGN_MASK
- or edx,ecx
- sub ecx,ecx
- shrd ecx,eax,#D_EXP_BIT-F_EXP_BIT
- shr eax,#D_EXP_BIT-F_EXP_BIT
- or edx,eax
-
- pop eax
- push edx ! upper dword
- push ecx ! lower dword
- jmp eax ! return
-
-! Fnegf: as Fpushf, but negate double before pushing onto stack
-
- .globl Fnegf
- .align ALIGNMENT
-Fnegf:
- mov edx,F_HIGH[ebx]
- xor edx,#F_SIGN_MASK ! toggle sign
- jmp into_Fpushf ! join Fpushf
diff --git a/bin86-0.3/bccfp/fpushi.x b/bin86-0.3/bccfp/fpushi.x
deleted file mode 100644
index b19aae2..0000000
--- a/bin86-0.3/bccfp/fpushi.x
+++ /dev/null
@@ -1,126 +0,0 @@
-! bcc 386 floating point routines (version 2)
-! -- Fpushi, Fpushl, Fpushs, Fpushc, Fpushuc, Fpushui, Fpushul, Fpushus
-! authors: Timothy Murphy (tim@maths.tcd.ie), Bruce Evans
-
-#include "fplib.h"
-
-! Convert the short in ax to double and push on stack
-
- .globl Fpushs
- .align ALIGNMENT
-Fpushs:
- cwde
- add eax,#0 ! fast 3-byte instruction to align
-
-! Convert the int or long in eax to double and push on stack
-
- .globl Fpushi
- .globl Fpushl
-! .align ALIGNMENT ! don't do this until it pads with nop's
-Fpushi:
-Fpushl:
- test eax,eax
- jz return_eax ! got 0 in eax
- mov ebx,#(D_EXP_BIAS+D_NORM_BIT) << D_EXP_SHIFT ! set no-sign and exponent
- jns normalize ! sign and fraction bits already set up
- mov ebx,#D_SIGN_MASK | ((D_EXP_BIAS+D_NORM_BIT) << D_EXP_SHIFT) ! adjust sign
- neg eax ! adjust fraction
- jmp normalize
-
- .align ALIGNMENT
-ret1:
- mov eax,#D_EXP_BIAS << D_EXP_SHIFT
- add eax,#0 ! fast 3-byte instruction to align
-
-! .align ALIGNMENT ! don't do this until it pads with nop's
-return_eax:
- pop ecx
- push eax ! upper dword
- push dword #0 ! lower dword = 0
- jmp ecx ! return
-
-! Convert the (unsigned) char in al to double and push on stack
-
- .globl Fpushc
- .globl Fpushuc
- .align ALIGNMENT
-Fpushc:
-Fpushuc:
- and eax,#(1 << CHAR_BIT)-1
- add eax,#0 ! fast 3-byte instruction to align
-
-! Convert the unsigned short in ax to double and push on stack
-
- .globl Fpushus
-! .align ALIGNMENT ! don't do this until it pads with nop's
-Fpushus:
- and eax,#(1 << SHORT_BIT)-1
- add eax,#0 ! fast 3-byte instruction to align
-
-! Convert the unsigned int or long in eax to double and push on stack
-
- .globl Fpushui
- .globl Fpushul
-! .align ALIGNMENT ! don't do this until it pads with nop's
-Fpushui:
-Fpushul:
- cmp eax,#1 ! this tests for both 0 and 1
- jb return_eax ! got 0 in eax
- jz ret1
- mov ebx,#(D_EXP_BIAS+D_NORM_BIT) << D_EXP_SHIFT ! set no-sign and exponent
-
-! .align ALIGNMENT ! don't do this until it pads with nop's
-normalize:
- sub edx,edx ! clear lower dword of result
-
-! Find first nonzero bit
-! Don't use bsr, it is slow (const + 3n on 386, const + n on 486)
-
- sub ecx,ecx ! prepare unsigned extension of cl
- test eax,#~D_FRAC_MASK
- jnz large
- test eax,#0xFF << (D_NORM_BIT-8)
- jnz middle
- shl eax,#8
- sub ebx,#8 << D_EXP_SHIFT
- test eax,#0xFF << (D_NORM_BIT-8)
- jnz middle
- shl eax,#8
- sub ebx,#8 << D_EXP_SHIFT
-middle:
- shld ecx,eax,#D_NORM_BIT
- mov cl,bsr_table[ecx]
- add ecx,#REG_BIT-D_NORM_BIT-D_NORM_BIT
- neg ecx
- shl eax,cl
- shl ecx,#D_EXP_SHIFT
- sub ebx,ecx
-return:
- and eax,#D_FRAC_MASK ! remove normalization bit
- or eax,ebx ! include exponent (and sign) to fraction
- pop ecx
- push eax ! upper dword
- push edx ! lower dword
- jmp ecx ! return
-
- .align ALIGNMENT
-large:
- shld ecx,eax,#REG_BIT-(D_NORM_BIT+8)
- jnz huge
- shld ecx,eax,#REG_BIT-D_NORM_BIT
- mov cl,bsr_table[ecx]
-got_shift_right:
- shrd edx,eax,cl
- shr eax,cl
- shl ecx,#D_EXP_SHIFT
- add ebx,ecx
- jmp return
-
- .align ALIGNMENT
-huge:
- mov cl,bsr_table[ecx]
- add cl,#8
- jmp got_shift_right
-
- .data
- .extern bsr_table
diff --git a/bin86-0.3/bccfp/frexp.x b/bin86-0.3/bccfp/frexp.x
deleted file mode 100644
index 318fc34..0000000
--- a/bin86-0.3/bccfp/frexp.x
+++ /dev/null
@@ -1,66 +0,0 @@
-! bcc 386 floating point routines (version 2) -- _frexp
-! authors: Timothy Murphy (tim@maths.tcd.ie), Bruce Evans
-
-#include "fplib.h"
-
- .extern fpdenormal
-
-! void frexp(double value, int *exponent);
-! splits a double into exponent and fraction (where 0.5 <= fraction < 1.0)
-
- .globl _frexp
- .align ALIGNMENT
-_frexp:
-push ebx
-#undef PC_SIZE
-#define PC_SIZE 8
- mov eax,PC_SIZE+D_LOW[esp] ! lower dword of x
- mov ebx,PC_SIZE+D_HIGH[esp] ! upper dword of x
- mov edx,PC_SIZE+D_SIZE[esp] ! exponent pointer
- mov ecx,ebx ! extract exponent here
- and ecx,#D_EXP_MASK
- jz exp_x_0
-
- shr ecx,#D_EXP_SHIFT ! exponent + bias
-got_x:
- sub ecx,#D_EXP_BIAS-1 ! D_EXP_BIAS is for 1.x form, we want 0.1x form
- mov [edx],ecx ! return exponent
- and ebx,#D_SIGN_MASK | D_FRAC_MASK ! extract sign and fraction
- or ebx,#(D_EXP_BIAS-1) << D_EXP_SHIFT ! set new exponent for 0.1x
-mov edx,ebx
-pop ebx
- ret
-
- .align ALIGNMENT
-exp_x_0:
- test ebx,#D_FRAC_MASK
- jnz xu_denorm
- test eax,eax
- jnz xl_denorm
- mov [edx],ecx ! return zero exponent
- mov ebx,ecx ! guard against -0 (may not be necessary)
-mov edx,ebx
-pop ebx
- ret
-
- .align ALIGNMENT
-xl_denorm:
- call fpdenormal
- bsr ecx,eax ! zzzz
- neg ecx
- add ecx,#REG_BIT-1
- shl eax,cl
- shld ebx,eax,#D_NORM_BIT+1
- shl eax,#D_NORM_BIT+1
- sub ecx,#D_NORM_BIT+1
- jmp got_x
-
- .align ALIGNMENT
-xu_denorm:
- call fpdenormal
- bsr ecx,ebx
- neg ecx
- add ecx,#D_NORM_BIT
- shld ebx,eax,cl
- shl eax,cl
- jmp got_x
diff --git a/bin86-0.3/bccfp/ftst.x b/bin86-0.3/bccfp/ftst.x
deleted file mode 100644
index 2a92ef1..0000000
--- a/bin86-0.3/bccfp/ftst.x
+++ /dev/null
@@ -1,28 +0,0 @@
-! bcc 386 floating point routines (version 2) -- Ftst, Ftstd, Ftstf
-! authors: Timothy Murphy (tim@maths.tcd.ie), Bruce Evans
-
-#include "fplib.h"
-
-#if 0 /* bcc doesn't generate Ftst (but it might in future) */
- .globl Ftst
-#endif
- .align ALIGNMENT
-Ftst:
- cmp dword PC_SIZE+D_HIGH[esp],#0 ! need only test upper dword of x
- ret #D_SIZE
-
-! Compare double at address [ebx] with 0
-
- .globl Ftstd
- .align ALIGNMENT
-Ftstd:
- cmp dword D_HIGH[ebx],#0 ! need only test upper dword of x
- ret
-
-! Compare float at address [ebx] with 0
-
- .globl Ftstf
- .align ALIGNMENT
-Ftstf:
- cmp dword F_HIGH[ebx],#0
- ret
diff --git a/bin86-0.3/bccfp/ldexp.x b/bin86-0.3/bccfp/ldexp.x
deleted file mode 100644
index bc9dd03..0000000
--- a/bin86-0.3/bccfp/ldexp.x
+++ /dev/null
@@ -1,74 +0,0 @@
-! bcc 386 floating point routines (version 2) -- _ldexp
-! authors: Timothy Murphy (tim@maths.tcd.ie), Bruce Evans
-
-#include "fplib.h"
-
- .extern fpoverflow
- .extern fpunderflow
-
-! void ldexp(double value, int exponent);
-! returns value * (2 ** exponent)
-
- .globl _ldexp
- .align ALIGNMENT
-_ldexp:
-push ebx
-#undef PC_SIZE
-#define PC_SIZE 8
- mov ebx,PC_SIZE+D_HIGH[esp] ! upper dword of x
- mov ecx,PC_SIZE+D_SIZE[esp] ! exponent arg
- mov eax,ebx ! extract exponent (of x) here
- and eax,#D_EXP_MASK
-! jz exp_y_0 ! may need check for preposterous exponent arg too
-
- shr eax,#D_EXP_SHIFT ! shift to low bits just for testing
- jz underflow ! denormal?
- add eax,ecx ! test-add the exponents
- jz underflow ! XXX probably need to fiddle norm bit
- cmp eax,#D_EXP_INFINITE ! check if still within range
- jae outofbounds ! the unsigned compare catches all overflow cases
- ! because the exponent of x is non-negative
-
- shl ecx,#D_EXP_SHIFT ! shift exponent arg bits into final position ...
- add ebx,ecx ! ... safe to add it to exponent of x now
- mov eax,PC_SIZE+D_LOW[esp] ! lower dword of x
-mov edx,ebx
-pop ebx
- ret
-
-
- .align ALIGNMENT
-outofbounds:
- test ecx,ecx ! overflow or underflow?
- jns overflow
-underflow:
- mov edx,ebx ! put sign in usual reg
- push edi
- push esi
- mov edi,eax ! put exponent in usual reg
- mov eax,2*GENREG_SIZE+PC_SIZE+D_LOW[esp]
- ! put lower dword of x in usual reg
- mov esi,ebx ! put upper dword of x in usual reg
- and esi,#D_EXP_MASK | D_FRAC_MASK
- test esi,#D_EXP_MASK
- jz foo
- and esi,#D_FRAC_MASK
- or esi,#D_NORM_MASK
-foo:
- neg edi
-! inc edi ! XXX ?
- call fpunderflow
- pop esi
- pop edi
- mov ebx,edx ! XXX = wrong reg
-pop ebx
- ret
-
- .align ALIGNMENT
-overflow:
- mov edx,ebx ! put sign in usual reg
- call fpoverflow
- mov eax,ecx ! XXX = wrong reg
- mov ebx,edx ! XXX = wrong reg
-pop ebx
- ret
diff --git a/bin86-0.3/bccfp/modf.c b/bin86-0.3/bccfp/modf.c
deleted file mode 100644
index a83f801..0000000
--- a/bin86-0.3/bccfp/modf.c
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * bin86/bccfp/modf.c
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-#include <math.h>
-
-/* Slooow version. */
-
-double modf(x, pint)
-double x;
-double *pint;
-{
- if (x >= 0)
- *pint = floor(x);
- else
- *pint = ceil(x);
- return x - *pint;
-}
diff --git a/bin86-0.3/bccfp/test.c b/bin86-0.3/bccfp/test.c
deleted file mode 100644
index 05b5d84..0000000
--- a/bin86-0.3/bccfp/test.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * bin86/bccfp/test.c
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-#include <sys/times.h>
-#include <limits.h>
-#include <stdio.h>
-#include <time.h>
-
-#define CONVTYPE int
-#define MAX (MIN + NITER - 1)
-#define MIN INT_MIN
-
-#define NITER 100000
-
-double one = 1;
-double two = 2;
-double big = 1e99;
-
-double d;
-double d1;
-float f;
-
-int main()
-{
- CONVTYPE cti;
- CONVTYPE cto;
- clock_t delta;
- struct tms finish;
- int i;
- struct tms start;
-
-#if 0
- times(&start);
- for (cti = MIN; cti <= MAX; ++cti)
- {
- d = cti;
- cto = d;
- if (cti != cto)
- printf("%08x %08x\n", cti, cto);
- if (cti % 10000000 == 0)
- {
- printf("%8x ok ", cti);
- fflush(stdout);
- }
- }
- times(&finish);
- delta = finish.tms_utime - start.tms_utime;
- printf("Time for %d i -> d and d -> i conversions was %g s (%d t)\n",
- MAX - MIN + 1, delta / (double) CLOCKS_PER_SEC, delta);
-#endif
-
- times(&start);
- for (cti = MIN; cti <= MAX; ++cti)
- d = cti;
- times(&finish);
- delta = finish.tms_utime - start.tms_utime;
- printf("Time for %d i -> d conversions was %g s (%d t)\n",
- MAX - MIN + 1, delta / (double) CLOCKS_PER_SEC, delta);
-
- times(&start);
- for (cti = MIN; cti <= MAX; ++cti)
- {
- d = cti;
- cto = d;
- }
- times(&finish);
- delta = finish.tms_utime - start.tms_utime - delta;
- printf("Time for %d d -> i conversions was %g s (%d t)\n",
- MAX - MIN + 1, delta / (double) CLOCKS_PER_SEC, delta);
-
- d = 0;
- times(&start);
- for (i = 0; i < NITER; ++i)
- d = d + 1;
- times(&finish);
- delta = finish.tms_utime - start.tms_utime;
- printf("Time for adding %d 1.0's to 0.0 was %g s (%d t), result = %g\n",
- NITER, delta / (double) CLOCKS_PER_SEC, delta, d);
-
- d = 0;
- times(&start);
- for (; d < NITER;)
- d = d + 1;
- times(&finish);
- delta = finish.tms_utime - start.tms_utime;
- printf("Time for adding %d 1.0's to 0.0 (d index) was %g s (%d t), result = %g\n",
- NITER, delta / (double) CLOCKS_PER_SEC, delta, d);
-
- times(&start);
- for (i = 1; i <= NITER; ++i)
- {
- d1 = i;
- d = d1 * d1;
- }
- times(&finish);
- delta = finish.tms_utime - start.tms_utime;
- printf("Time for %d mults was %g s (%d t), result = %g\n",
- NITER, delta / (double) CLOCKS_PER_SEC, delta, d);
-
- times(&start);
- for (i = 1; i <= NITER; ++i)
- {
- d1 = i;
- d = 1 / d1;
- }
- times(&finish);
- delta = finish.tms_utime - start.tms_utime;
- printf("Time for %d divs was %g s (%d t), result = %g\n",
- NITER, delta / (double) CLOCKS_PER_SEC, delta, d);
-
- f = 0;
- times(&start);
- for (i = 0; i < NITER; ++i)
- f = f + 1;
- times(&finish);
- delta = finish.tms_utime - start.tms_utime;
- printf("Time for adding %d 1.0f's to 0.0f was %g s (%d t), result = %g\n",
- NITER, delta / (double) CLOCKS_PER_SEC, delta, f);
-
- return 0;
-}
diff --git a/bin86-0.3/ld/6809/config.h b/bin86-0.3/ld/6809/config.h
deleted file mode 100644
index b2203ab..0000000
--- a/bin86-0.3/ld/6809/config.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * bin86/ld/6809/config.h
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-/* config.h - configuration for linker */
-
-/* one of these target processors must be defined */
-
-#undef I8086 /* Intel 8086 */
-#undef I80386 /* Intel 80386 */
-#define MC6809 /* Motorola 6809 */
-
-/* one of these target operating systems must be defined */
-
-#define EDOS /* generate EDOS executable */
-#undef MINIX /* generate Minix executable */
-
-/* these may need to be defined to suit the source processor */
-
-#undef S_ALIGNMENT 4 /* source memory alignment, power of 2 */
- /* don't use for 8 bit processors */
- /* don't use even for 80386 - overhead for */
- /* alignment cancels improved access */
-
-/* these should be defined if they are supported by the source compiler */
-
-#undef PROTO /* compiler handles prototypes */
-
-/* these must be defined to suit the source libraries */
-
-#define CREAT_PERMS 0666 /* permissions for creat() */
-#define EXEC_PERMS 0111 /* extra permissions to set for executable */
diff --git a/bin86-0.3/ld/Makefile b/bin86-0.3/ld/Makefile
deleted file mode 100644
index a7da6d7..0000000
--- a/bin86-0.3/ld/Makefile
+++ /dev/null
@@ -1,29 +0,0 @@
-CC =gcc
-CFLAGS =-O1 -fomit-frame-pointer
-INC_CFLAGS =-DBSD_A_OUT -I../a.out.h -D__linux__
-LDFLAGS =-s
-
-OBJS =dumps.o io.o ld.o readobj.o table.o typeconv.o \
- writebin.o
-
-.SUFFIXES:
-.SUFFIXES: .c .o
-
-.c.o:
- $(CC) $(CFLAGS) $(INC_CFLAGS) -c $<
-
-all: ld86
-
-ld86: $(OBJS)
- $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
-
-clean:
- $(RM) $(OBJS) ld86 core
-
-dumps.o: dumps.c const.h config.h obj.h type.h globvar.h
-io.o: io.c const.h config.h type.h globvar.h
-ld.o: ld.c const.h config.h type.h byteord.h globvar.h
-readobj.o: readobj.c const.h config.h byteord.h obj.h type.h globvar.h
-table.o: table.c const.h config.h align.h obj.h type.h globvar.h
-typeconv.o: typeconv.c const.h config.h type.h globvar.h
-writebin.o: writebin.c const.h config.h obj.h type.h globvar.h
diff --git a/bin86-0.3/ld/align.h b/bin86-0.3/ld/align.h
deleted file mode 100644
index f34652c..0000000
--- a/bin86-0.3/ld/align.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * bin86/ld/align.h
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-/* align.h - memory alignment requirements for linker */
-
-#ifndef S_ALIGNMENT
-# define align(x)
-#else
-# define align(x) ((x) = (void *)(((int) (x) + (S_ALIGNMENT-1)) & ~(S_ALIGNMENT-1)))
- /* assumes sizeof(int) == sizeof(char *) */
-#endif
diff --git a/bin86-0.3/ld/ar.h b/bin86-0.3/ld/ar.h
deleted file mode 100644
index 780d457..0000000
--- a/bin86-0.3/ld/ar.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * bin86/ld/ar.h
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-#ifndef _AR_H
-#define _AR_H
-
-#define ARMAG "!<arch>\n"
-#define SARMAG 8
-#define ARFMAG "`\n"
-
-struct ar_hdr {
- char ar_name[16];
- char ar_date[12];
- char ar_uid[6];
- char ar_gid[6];
- char ar_mode[8];
- char ar_size[10];
- char ar_fmag[2];
-};
-
-#endif /* _AR_H */
diff --git a/bin86-0.3/ld/bugs b/bin86-0.3/ld/bugs
deleted file mode 100644
index b671f30..0000000
--- a/bin86-0.3/ld/bugs
+++ /dev/null
@@ -1,17 +0,0 @@
-1. Should cause error when an address which requires > 16 bits is referenced
- using 16 bits.
-
-TODO:
- integrate byteord.h with compiler as well as assembler
-
-TODO:
- integrate align.h with compiler and assembler
- use alignment for *86 like compiler - use more portable macro
- ((x) + (-(int) (x) & MASK)) when it is either necessary or
- faster
-
-TODO:
- do malloc stuff better, as in compiler
-
-2. Error message about "foo.a is not an object file" is confusing - should
- name archive member.
diff --git a/bin86-0.3/ld/byteord.h b/bin86-0.3/ld/byteord.h
deleted file mode 100644
index 0e2b403..0000000
--- a/bin86-0.3/ld/byteord.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * bin86/ld/byteord.h
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-/* byteord.h - byte order dependencies for C compiler, assembler, linker */
-
-/* These are for the targets of everything and for linker source too. */
-
-#ifdef I8086
-# define BIG_ENDIAN 0
-# define LONG_BIG_ENDIAN 0 /* except longs are back to front for Xenix */
-#endif
-
-#ifdef I80386
-# define BIG_ENDIAN 0
-# define LONG_BIG_ENDIAN 0
-#endif
-
-#ifdef MC6809
-# define BIG_ENDIAN 1 /* byte order in words is high-low */
-# define LONG_BIG_ENDIAN 1 /* byte order in longs is high-low */
-#endif
diff --git a/bin86-0.3/ld/config.h b/bin86-0.3/ld/config.h
deleted file mode 100644
index 173d1c4..0000000
--- a/bin86-0.3/ld/config.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * bin86/ld/config.h
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-/* config.h - configuration for linker */
-
-/* one of these target processors must be defined */
-
-#undef I8086 /* Intel 8086 */
-#define I80386 /* Intel 80386 */
-#undef MC6809 /* Motorola 6809 */
-
-/* one of these target operating systems must be defined */
-
-#undef EDOS /* generate EDOS executable */
-#define MINIX /* generate Minix executable */
-
-/* these may need to be defined to suit the source processor */
-
-#define S_ALIGNMENT 4 /* source memory alignment, power of 2 */
- /* don't use for 8 bit processors */
- /* don't use even for 80386 - overhead for */
- /* alignment cancels improved access */
-
-/* these should be defined if they are supported by the source compiler */
-
-#define PROTO /* compiler handles prototypes */
-
-/* these must be defined to suit the source libraries */
-
-#define CREAT_PERMS 0666 /* permissions for creat() */
-#define EXEC_PERMS 0111 /* extra permissions to set for executable */
diff --git a/bin86-0.3/ld/const.h b/bin86-0.3/ld/const.h
deleted file mode 100644
index a933bdc..0000000
--- a/bin86-0.3/ld/const.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * bin86/ld/const.h
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-/* const.h - constants for linker */
-
-#define FALSE 0
-#ifndef NULL
-#define NULL 0
-#endif
-#define TRUE 1
-
-#define EXTERN extern
-#define FORWARD static
-#define PRIVATE static
-#define PUBLIC
-
-#include "config.h"
diff --git a/bin86-0.3/ld/dumps.c b/bin86-0.3/ld/dumps.c
deleted file mode 100644
index c91653f..0000000
--- a/bin86-0.3/ld/dumps.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * bin86/ld/dumps.c
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-/* dumps.c - print data about symbols and modules for linker */
-
-#include "const.h"
-#include "obj.h"
-#include "type.h"
-#include "globvar.h"
-
-/* print list of modules and whether they are loaded */
-
-PUBLIC void dumpmods()
-{
- struct modstruct *modptr;
-
- for (modptr = modfirst; modptr != NULL; modptr = modptr->modnext)
- {
- putstr(modptr->loadflag ? "L " : " ");
- putbstr(20, modptr->modname);
- putbyte('\n');
- }
-}
-
-/* print data about symbols (in loaded modules only) */
-
-PUBLIC void dumpsyms()
-{
- flags_t flags;
- struct modstruct *modptr;
- struct symstruct **symparray;
- struct symstruct *symptr;
- char uflag;
-
- for (modptr = modfirst; modptr != NULL; modptr = modptr->modnext)
- if (modptr->loadflag)
- {
- for (symparray = modptr->symparray;
- (symptr = *symparray) != NULL; ++symparray)
- if (symptr->modptr == modptr)
- {
- uflag = FALSE;
- if (((flags = symptr->flags) & (C_MASK | I_MASK)) == I_MASK)
- uflag = TRUE;
- putbstr(20, uflag ? "" : modptr->modname);
- putstr(" ");
- putbstr(20, symptr->name);
- putstr(" ");
- putbyte(hexdigit[flags & SEGM_MASK]);
- putstr(" ");
- if (uflag)
- putstr(" ");
- else
-#ifdef LONG_OFFSETS
- put08lx(symptr->value);
-#else
- put08x(symptr->value);
-#endif
- putstr(flags & A_MASK ? " A" : " R");
- if (uflag)
- putstr(" U");
- if (flags & C_MASK)
- putstr(" C");
- if (flags & N_MASK)
- putstr(" N");
- putbyte('\n');
- }
- }
-}
diff --git a/bin86-0.3/ld/globvar.h b/bin86-0.3/ld/globvar.h
deleted file mode 100644
index 0c382c7..0000000
--- a/bin86-0.3/ld/globvar.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * bin86/ld/globvar.h
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-/* globvar.h - global variables for linker */
-
-#ifdef EXTERN
-EXTERN char hexdigit[];
-#else
-#define EXTERN
-PUBLIC char hexdigit[] = "0123456789abcdef";
-#endif
-EXTERN unsigned errcount; /* count of errors */
-EXTERN struct entrylist *entryfirst; /* first on list of entry symbols */
-EXTERN struct modstruct *modfirst; /* data for 1st module */
-EXTERN struct redlist *redfirst; /* first on list of redefined symbols */
diff --git a/bin86-0.3/ld/io.c b/bin86-0.3/ld/io.c
deleted file mode 100644
index 999dbd3..0000000
--- a/bin86-0.3/ld/io.c
+++ /dev/null
@@ -1,583 +0,0 @@
-/*
- * bin86/ld/io.c
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-/* io.c - input/output and error modules for linker */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#ifndef __linux__
-#define MY_STAT_H
-#endif
-#include <fcntl.h>
-#include <unistd.h>
-#include "const.h"
-#include "obj.h" /* needed for LONG_OFFSETS and offset_t */
-#include "type.h"
-#include "globvar.h"
-
-#define DRELBUFSIZE 2048
-#define ERR (-1)
-#define ERRBUFSIZE 1024
-#define INBUFSIZE 1024
-#define OUTBUFSIZE 2048
-#define TRELBUFSIZE 1024
-
-#ifdef BSD_A_OUT
-PRIVATE char *drelbuf; /* extra output buffer for data relocations */
-PRIVATE char *drelbufptr; /* data relocation output buffer ptr */
-PRIVATE char *drelbuftop; /* data relocation output buffer top */
-#endif
-PRIVATE char *errbuf; /* error buffer (actually uses STDOUT) */
-PRIVATE char *errbufptr; /* error buffer ptr */
-PRIVATE char *errbuftop; /* error buffer top */
-PRIVATE char *inbuf; /* input buffer */
-PRIVATE char *inbufend; /* input buffer top */
-PRIVATE char *inbufptr; /* end of input in input buffer */
-PRIVATE int infd; /* input file descriptor */
-PRIVATE char *inputname; /* name of current input file */
-PRIVATE char *outbuf; /* output buffer */
-PRIVATE char *outbufptr; /* output buffer ptr */
-PRIVATE char *outbuftop; /* output buffer top */
-PRIVATE int outfd; /* output file descriptor */
-PRIVATE unsigned outputperms; /* permissions of output file */
-PRIVATE char *outputname; /* name of output file */
-PRIVATE char *refname; /* name of program for error reference */
-#ifdef BSD_A_OUT
-PRIVATE char *trelbuf; /* extra output buffer for text relocations */
-PRIVATE char *trelbufptr; /* text relocation output buffer ptr */
-PRIVATE char *trelbuftop; /* text relocation output buffer top */
-PRIVATE int trelfd; /* text relocation output file descriptor */
-#endif
-PRIVATE unsigned warncount; /* count of warnings */
-
-FORWARD void errexit P((char *message));
-FORWARD void flushout P((void));
-#ifdef BSD_A_OUT
-FORWARD void flushtrel P((void));
-#endif
-FORWARD void outhexdigs P((offset_t num));
-FORWARD void outputerror P((char *message));
-FORWARD void put04x P((unsigned num));
-FORWARD void putstrn P((char *message));
-FORWARD void refer P((void));
-
-PUBLIC void ioinit(progname)
-char *progname;
-{
- infd = ERR;
- if (*progname)
- refname = progname; /* name must be static (is argv[0]) */
- else
- refname = "link";
-#ifdef BSD_A_OUT
- drelbuf = malloc(DRELBUFSIZE);
- drelbuftop = drelbuf + DRELBUFSIZE;
-#endif
- errbuf = malloc(ERRBUFSIZE);
- errbufptr = errbuf;
- errbuftop = errbuf + ERRBUFSIZE;
- inbuf = malloc(INBUFSIZE);
- outbuf = malloc(OUTBUFSIZE);/* outbuf invalid if this fails but then */
- /* will not be used - tableinit() aborts */
- outbuftop = outbuf + OUTBUFSIZE;
-#ifdef BSD_A_OUT
- trelbuf = malloc(TRELBUFSIZE);
- trelbuftop = trelbuf + TRELBUFSIZE;
-#endif
-}
-
-PUBLIC void closein()
-{
- if (infd != ERR && close(infd) < 0)
- inputerror("cannot close");
- infd = ERR;
-}
-
-PUBLIC void closeout()
-{
-#ifdef BSD_A_OUT
- unsigned nbytes;
-#endif
-
- flushout();
-#ifdef BSD_A_OUT
- flushtrel();
- nbytes = drelbufptr - drelbuf;
- if (write(trelfd, drelbuf, nbytes) != nbytes)
- outputerror("cannot write");
-#endif
- if (close(outfd) == ERR)
- outputerror("cannot close");
-#ifdef BSD_A_OUT
- if (close(trelfd) == ERR)
- outputerror("cannot close");
-#endif
-}
-
-PUBLIC void errtrace(name, level)
-char *name;
-{
- while (level-- > 0)
- putbyte(' ');
- putstrn(name);
-}
-
-PUBLIC void executable()
-{
- int oldmask;
-
- if (errcount == 0)
- {
- oldmask = umask(0);
- umask(oldmask);
- chmod(outputname, outputperms | (EXEC_PERMS & ~oldmask));
- }
-}
-
-PUBLIC void flusherr()
-{
- write(STDOUT_FILENO, errbuf, errbufptr - errbuf);
- errbufptr = errbuf;
-}
-
-PRIVATE void flushout()
-{
- unsigned nbytes;
-
- nbytes = outbufptr - outbuf;
- if (write(outfd, outbuf, nbytes) != nbytes)
- outputerror("cannot write");
- outbufptr = outbuf;
-}
-
-#ifdef BSD_A_OUT
-PRIVATE void flushtrel()
-{
- unsigned nbytes;
-
- nbytes = trelbufptr - trelbuf;
- if (write(trelfd, trelbuf, nbytes) != nbytes)
- outputerror("cannot write");
- trelbufptr = trelbuf;
-}
-#endif
-
-PUBLIC void openin(filename)
-char *filename;
-{
-#if 0 /* XXX - this probably won't work with constructed lib names? */
- if (infd == ERR || strcmp(inputname, filename) != 0)
-#endif
- {
- closein();
- inputname = filename; /* this relies on filename being static */
- if ((infd = open(filename, O_RDONLY)) < 0)
- inputerror("cannot open");
- inbufptr = inbufend = inbuf;
- }
-}
-
-PUBLIC void openout(filename)
-char *filename;
-{
- struct stat statbuf;
-
- outputname = filename;
- if ((outfd = creat(filename, CREAT_PERMS)) == ERR)
- outputerror("cannot open");
- if (fstat(outfd, &statbuf) != 0)
- outputerror("cannot stat");
- outputperms = statbuf.st_mode;
- chmod(filename, outputperms & ~EXEC_PERMS);
-#ifdef BSD_A_OUT
- drelbufptr = drelbuf;
-#endif
- outbufptr = outbuf;
-#ifdef BSD_A_OUT
- if ((trelfd = open(filename, O_WRONLY)) == ERR)
- outputerror("cannot reopen");
- trelbufptr = trelbuf;
-#endif
-}
-
-PRIVATE void outhexdigs(num)
-register offset_t num;
-{
- if (num >= 0x10)
- {
- outhexdigs(num / 0x10);
- num %= 0x10;
- }
- putbyte(hexdigit[num]);
-}
-
-PRIVATE void put04x(num)
-register unsigned num;
-{
- putbyte(hexdigit[num / 0x1000]);
- putbyte(hexdigit[(num / 0x100) & 0x0F]);
- putbyte(hexdigit[(num / 0x10) & 0x0F]);
- putbyte(hexdigit[num & 0x0F]);
-}
-
-#ifdef LONG_OFFSETS
-
-PUBLIC void put08lx(num)
-register offset_t num;
-{
- put04x(num / 0x10000);
- put04x(num % 0x10000);
-}
-
-#else /* not LONG_OFFSETS */
-
-PUBLIC void put08x(num)
-register offset_t num;
-{
- putstr("0000");
- put04x(num);
-}
-
-#endif /* not LONG_OFFSETS */
-
-PUBLIC void putbstr(width, str)
-unsigned width;
-char *str;
-{
- unsigned length;
-
- for (length = strlen(str); length < width; ++length)
- putbyte(' ');
- putstr(str);
-}
-
-PUBLIC void putbyte(ch)
-int ch;
-{
- register char *ebuf;
-
- ebuf = errbufptr;
- if (ebuf >= errbuftop)
- {
- flusherr();
- ebuf = errbufptr;
- }
- *ebuf++ = ch;
- errbufptr = ebuf;
-}
-
-PUBLIC void putstr(message)
-char *message;
-{
- while (*message != 0)
- putbyte(*message++);
-}
-
-PRIVATE void putstrn(message)
-char *message;
-{
- putstr(message);
- putbyte('\n');
- flusherr();
-}
-
-PUBLIC int readchar()
-{
- int ch;
-
- register char *ibuf;
- int nread;
-
- ibuf = inbufptr;
- if (ibuf >= inbufend)
- {
- ibuf = inbufptr = inbuf;
- nread = read(infd, ibuf, INBUFSIZE);
- if (nread <= 0)
- {
- inbufend = ibuf;
- return ERR;
- }
- inbufend = ibuf + nread;
- }
- ch = (unsigned char) *ibuf++;
- inbufptr = ibuf;
- return ch;
-}
-
-PUBLIC void readin(buf, count)
-char *buf;
-unsigned count;
-{
- int ch;
-
- while (count--)
- {
- if ((ch = readchar()) < 0)
- prematureeof();
- *buf++ = ch;
- }
-}
-
-PUBLIC bool_pt readineofok(buf, count)
-char *buf;
-unsigned count;
-{
- int ch;
-
- while (count--)
- {
- if ((ch = readchar()) < 0)
- return TRUE;
- *buf++ = ch;
- }
- return FALSE;
-}
-
-PUBLIC void seekin(offset)
-long offset;
-{
- inbufptr = inbufend = inbuf;
- if (lseek(infd, offset, SEEK_SET) < 0)
- prematureeof();
-}
-
-PUBLIC void seekout(offset)
-long offset;
-{
- flushout();
- if (lseek(outfd, offset, SEEK_SET) != offset)
- outputerror("cannot seek in");
-}
-
-#ifdef BSD_A_OUT
-PUBLIC void seektrel(offset)
-long offset;
-{
- flushtrel();
- if (lseek(trelfd, offset, SEEK_SET) != offset)
- outputerror("cannot seek in");
-}
-#endif
-
-PUBLIC void writechar(ch)
-int ch;
-{
- register char *obuf;
-
- obuf = outbufptr;
- if (obuf >= outbuftop)
- {
- flushout();
- obuf = outbufptr;
- }
- *obuf++ = ch;
- outbufptr = obuf;
-}
-
-#ifdef BSD_A_OUT
-PUBLIC void writedrel(buf, count)
-register char *buf;
-unsigned count;
-{
- register char *rbuf;
-
- rbuf = drelbufptr;
- while (count--)
- {
- if (rbuf >= drelbuftop)
- inputerror("data relocation buffer full while processing");
- *rbuf++ = *buf++;
- }
- drelbufptr = rbuf;
-}
-#endif
-
-PUBLIC void writeout(buf, count)
-register char *buf;
-unsigned count;
-{
- register char *obuf;
-
- obuf = outbufptr;
- while (count--)
- {
- if (obuf >= outbuftop)
- {
- outbufptr = obuf;
- flushout();
- obuf = outbufptr;
- }
- *obuf++ = *buf++;
- }
- outbufptr = obuf;
-}
-
-#ifdef BSD_A_OUT
-PUBLIC void writetrel(buf, count)
-register char *buf;
-unsigned count;
-{
- register char *rbuf;
-
- rbuf = trelbufptr;
- while (count--)
- {
- if (rbuf >= trelbuftop)
- {
- trelbufptr = rbuf;
- flushtrel();
- rbuf = trelbufptr;
- }
- *rbuf++ = *buf++;
- }
- trelbufptr = rbuf;
-}
-#endif
-
-/* error module */
-
-PRIVATE void errexit(message)
-char *message;
-{
- putstrn(message);
- exit(2);
-}
-
-PUBLIC void fatalerror(message)
-char *message;
-{
- refer();
- errexit(message);
-}
-
-PUBLIC void inputerror(message)
-char *message;
-{
- refer();
- putstr(message);
- putstr(" input file ");
- errexit(inputname);
-}
-
-PUBLIC void input1error(message)
-char *message;
-{
- refer();
- putstr(inputname);
- errexit(message);
-}
-
-PRIVATE void outputerror(message)
-char *message;
-{
- refer();
- putstr(message);
- putstr(" output file ");
- errexit(outputname);
-}
-
-PUBLIC void outofmemory()
-{
- inputerror("out of memory while processing");
-}
-
-PUBLIC void prematureeof()
-{
- inputerror("premature end of");
-}
-
-PUBLIC void redefined(name, message, archentry, deffilename, defarchentry)
-char *name;
-char *message;
-char *archentry;
-char *deffilename;
-char *defarchentry;
-{
- ++warncount;
- refer();
- putstr("warning: ");
- putstr(name);
- putstr(" redefined");
- putstr(message);
- putstr(" in file ");
- putstr(inputname);
- if (archentry != NULL)
- {
- putbyte('(');
- putstr(archentry);
- putbyte(')');
- }
- putstr("; using definition in ");
- putstr(deffilename);
- if (defarchentry != NULL)
- {
- putbyte('(');
- putstr(defarchentry);
- putbyte(')');
- }
- putbyte('\n');
-}
-
-PRIVATE void refer()
-{
- putstr(refname);
- putstr(": ");
-}
-
-PUBLIC void reserved(name)
-char *name;
-{
- ++errcount;
- putstr("incorrect use of reserved symbol: ");
- putstrn(name);
-}
-
-PUBLIC void size_error(seg, count, size)
-char seg;
-offset_t count;
-offset_t size;
-{
- refer();
- putstr("seg ");
- outhexdigs((offset_t) seg);
- putstr(" has wrong size ");
- outhexdigs(count);
- putstr(", supposed to be ");
- outhexdigs(size);
- errexit("\n");
-}
-
-PUBLIC void undefined(name)
-char *name;
-{
- ++errcount;
- putstr("undefined symbol: ");
- putstrn(name);
-}
-
-PUBLIC void usage()
-{
- putstr("usage: ");
- putstr(refname);
-#ifdef BSD_A_OUT
- errexit("\
- [-03Mimrstz[-]] [-llib_extension] [-o outfile] [-Ccrtfile]\n\
- [-L libdir] [-Olibfile] [-T textaddr] infile...");
-#else
- errexit("\
- [-03Mimstz[-]] [-llib_extension] [-o outfile] [-Ccrtfile]\n\
- [-L libdir] [-Olibfile] [-T textaddr] infile...");
-#endif
-}
-
-PUBLIC void use_error(message)
-char *message;
-{
- refer();
- putstrn(message);
- usage();
-}
diff --git a/bin86-0.3/ld/ld.c b/bin86-0.3/ld/ld.c
deleted file mode 100644
index 04ffe83..0000000
--- a/bin86-0.3/ld/ld.c
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * bin86/ld/ld.c
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-/* ld.c - linker for Introl format (6809 C) object files 6809/8086/80386 */
-
-#ifdef STDC_HEADERS_MISSING
-extern int errno;
-#else
-#include <errno.h>
-#endif
-
-#include "const.h"
-#include "byteord.h"
-#include "type.h"
-#include "globvar.h"
-
-#define MAX_LIBS (NR_STDLIBS + 5)
-#define NR_STDLIBS 1
-
-PUBLIC long text_base_address; /* XXX */
-
-PRIVATE bool_t flag[128];
-PRIVATE char *libs[MAX_LIBS] = {
-#ifdef MC6809
- "/usr/local/lib/m09/",
-#else
- /* One of the following values will be inserted at run time. */
-# define std386lib "/usr/local/lib/i386/"
-# define std86lib "/usr/local/lib/i86/"
-#endif
- 0
-};
-PRIVATE int lastlib = NR_STDLIBS;
-
-FORWARD char *buildname P((char *pre, char *mid, char *suf));
-FORWARD char *expandlib P((char *fn));
-
-PRIVATE char *buildname(pre, mid, suf)
-char *pre;
-char *mid;
-char *suf;
-{
- char *name;
-
- name = ourmalloc(strlen(pre) + strlen(mid) + strlen(suf) + 1);
- strcpy(name, pre);
- strcat(name, mid);
- strcat(name, suf);
- return name;
-}
-
-PRIVATE char *expandlib(fn)
-char *fn;
-{
- char *path;
- int i;
-
-#ifndef MC6809
- libs[0] = flag['3'] ? std386lib : std86lib;
-#endif
-
- for (i = lastlib - 1; i >= 0; --i)
- {
- path = ourmalloc(strlen(libs[i]) + strlen(fn) + 1);
- strcpy(path, libs[i]);
- strcat(path, fn);
- if (access(path, R_OK) == 0)
- return path;
- ourfree(path);
- }
- return NULL;
-}
-
-PUBLIC int main(argc, argv)
-int argc;
-char **argv;
-{
- register char *arg;
- int argn;
- static char crtprefix[] = "crt";
- static char crtsuffix[] = ".o";
- char *infilename;
- static char libprefix[] = "lib";
- static char libsuffix[] = ".a";
- char *outfilename;
- char *tfn;
-
- ioinit(argv[0]);
- objinit();
- syminit();
- typeconv_init(BIG_ENDIAN, LONG_BIG_ENDIAN);
-#if 0
- flag['z'] = flag['3'] = sizeof(char *) >= 4;
-#else
- flag['z'] = 0;
- flag['3'] = sizeof(char *) >= 4;
-#endif
- outfilename = NULL;
- for (argn = 1; argn < argc; ++argn)
- {
- arg = argv[argn];
- if (*arg != '-')
- readsyms(arg, flag['t']);
- else
- switch (arg[1])
- {
- case '0': /* use 16-bit libraries */
- case '3': /* use 32-bit libraries */
- case 'M': /* print symbols linked */
- case 'i': /* separate I & D output */
- case 'm': /* print modules linked */
-#ifdef BSD_A_OUT
- case 'r': /* relocatable output */
-#endif
- case 's': /* strip symbols */
- case 't': /* trace modules linked */
- case 'z': /* unmapped zero page */
- if (arg[2] == 0)
- flag[arg[1]] = TRUE;
- else if (arg[2] == '-' && arg[3] == 0)
- flag[arg[1]] = FALSE;
- else
- usage();
- if (arg[1] == '0') /* flag 0 is negative logic flag 3 */
- flag['3'] = !flag['0'];
- break;
- case 'C': /* startfile name */
- tfn = buildname(crtprefix, arg + 2, crtsuffix);
- if ((infilename = expandlib(tfn)) == NULL)
- fatalerror(tfn);
- readsyms(infilename, flag['t']);
- break;
- case 'L': /* library path */
- if (lastlib < MAX_LIBS)
- libs[lastlib++] = arg + 2;
- else
- fatalerror("too many library paths");
- break;
- case 'O': /* library file name */
- if ((infilename = expandlib(arg + 2)) == NULL)
- fatalerror(arg);
- readsyms(infilename, flag['t']);
- break;
- case 'T': /* text base address */
- if (arg[2] != 0 || ++argn >= argc)
- usage();
- errno = 0;
- text_base_address = strtoul(argv[argn], (char **) NULL, 16);
- if (errno != 0)
- use_error("invalid text address");
- break;
- case 'l': /* library name */
- tfn = buildname(libprefix, arg + 2, libsuffix);
- if ((infilename = expandlib(tfn)) == NULL)
- fatalerror(tfn);
- readsyms(infilename, flag['t']);
- break;
- case 'o': /* output file name */
- if (arg[2] != 0 || ++argn >= argc || outfilename != NULL)
- usage();
- outfilename = argv[argn];
- break;
- default:
- usage();
- }
- }
- linksyms(flag['r']);
- if (outfilename == NULL)
- outfilename = "a.out";
- writebin(outfilename, flag['i'], flag['3'], flag['s'], flag['z']);
- if (flag['m'])
- dumpmods();
- if (flag['M'])
- dumpsyms();
- flusherr();
- return errcount ? 1 : 0;
-}
diff --git a/bin86-0.3/ld/obj.h b/bin86-0.3/ld/obj.h
deleted file mode 100644
index d9ba2ba..0000000
--- a/bin86-0.3/ld/obj.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * bin86/ld/obj.h
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-/* obj.h - constants for Introl object modules */
-
-#define OBJ_H
-
-#ifdef I80386
-# define LONG_OFFSETS /* others can use this, but wasteful */
-#endif
-
-#ifndef OMAGIC
-# ifdef I80386
-# define OMAGIC 0x86A3
-# endif
-
-# ifdef I8086
-# define OMAGIC 0x86A0
-# endif
-
-# ifdef MC6809
-# define OMAGIC 0x5331
-# endif
-#endif
-
-#ifdef LONG_OFFSETS
-# define cntooffset cnu4
-# define offtocn u4cn
-#else
-# define cntooffset cnu2
-# define offtocn u2cn
-#endif
-
-#ifdef MC6809 /* temp don't support alignment at all */
-# define ld_roundup( num, boundary, type ) (num)
-#else
-# define ld_roundup( num, boundary, type ) \
- (((num) + ((boundary) - 1)) & (type) ~((boundary) - 1))
-#endif
-
-#define MAX_OFFSET_SIZE 4
-#define NSEG 16
-
-/* flag values |SZ|LXXXX|N|E|I|R|A|SEGM|, X not used */
-
-#define A_MASK 0x0010 /* absolute */
-#define C_MASK 0x0020 /* common (internal only) */
-#define E_MASK 0x0080 /* exported */
-#define I_MASK 0x0040 /* imported */
-#define N_MASK 0x0100 /* entry point */
-#define R_MASK 0x0020 /* relative (in text only) */
-#define SEGM_MASK 0x000F /* segment (if not absolute) */
-#define SA_MASK 0x2000 /* offset is storage allocation */
-#define SZ_MASK 0xC000 /* size descriptor for value */
-#define SZ_SHIFT 14
diff --git a/bin86-0.3/ld/readobj.c b/bin86-0.3/ld/readobj.c
deleted file mode 100644
index 5c4dd72..0000000
--- a/bin86-0.3/ld/readobj.c
+++ /dev/null
@@ -1,368 +0,0 @@
-/*
- * bin86/ld/readobj.c
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-/* readobj.c - read object file for linker */
-
-#include "ar.h" /* maybe local copy of <ar.h> for cross-link */
-#include "const.h"
-#include "byteord.h"
-#include "obj.h"
-#include "type.h"
-#include "globvar.h"
-
-/*
- Linking takes 2 passes. The 1st pass reads through all files specified
-in the command line, and all libraries. All public symbols are extracted
-and stored in a chained hash table. For each module, its file and header
-data recorded, and the resulting structures are chained together
-(interleaved with the symbols).
-
- The symbol descriptors are separated from the symbol names, so we must
-record all the descriptors of a module before putting the symbols in the
-symbol table (poor design). The descriptors are stored in the symbol
-table, then moved to the top of the table to make room for the symols.
-The symbols referred to in a given module are linked together by a chain
-beginning in the module descriptor.
-*/
-
-PRIVATE char convertsize[NSEG / 4] = {0, 1, 2, 4};
-PRIVATE struct entrylist *entrylast; /* last on list of entry symbols */
-PRIVATE struct redlist *redlast; /* last on list of redefined symbols */
-PRIVATE struct modstruct *modlast; /* data for last module */
-
-FORWARD long readarheader P((char **parchentry));
-FORWARD unsigned readfileheader P((void));
-FORWARD void readmodule P((char *filename, char *archentry));
-FORWARD void reedmodheader P((void));
-FORWARD bool_pt redsym P((struct symstruct *symptr, offset_t value));
-FORWARD unsigned checksum P((char *string, unsigned length));
-FORWARD unsigned segbits P((unsigned seg, char *sizedesc));
-
-/* initialise object file handler */
-
-PUBLIC void objinit()
-{
- modfirst = modlast = NULL;
- entryfirst = entrylast = NULL;
- redfirst = redlast = NULL;
-}
-
-/* read all symbol definitions in an object file */
-
-PUBLIC void readsyms(filename, trace)
-char *filename;
-bool_pt trace;
-{
- char *archentry;
- long filelength;
- char filemagic[SARMAG];
- long filepos;
- unsigned modcount;
-
- if (trace)
- errtrace(filename, 0);
- openin(filename); /* input is not open, so position is start */
- switch ((unsigned) readsize(2))
- {
- case OMAGIC:
- seekin(0L);
- for (modcount = readfileheader(); modcount-- != 0;)
- readmodule(filename, (char *) NULL);
- break;
- default:
- seekin(0L);
- readin(filemagic, sizeof filemagic);
- if (strncmp(filemagic, ARMAG, sizeof filemagic) != 0)
- input1error(" has bad magic number");
- filepos = SARMAG;
- while ((filelength = readarheader(&archentry)) > 0)
- {
- if (trace)
- errtrace(archentry, 2);
- filepos += sizeof(struct ar_hdr);
- for (modcount = readfileheader(); modcount-- != 0;)
- {
- readmodule(stralloc(filename), archentry);
- modlast->textoffset += filepos;
- }
- seekin(filepos += ld_roundup(filelength, 2, long));
- }
- break;
- }
- closein();
-}
-
-/* read archive header and return length */
-
-PRIVATE long readarheader(parchentry)
-char **parchentry;
-{
- struct ar_hdr arheader;
- char *endptr;
- char *nameptr;
-
- if (readineofok((char *) &arheader, sizeof arheader))
- return 0;
- strncpy (*parchentry = nameptr = ourmalloc(sizeof arheader.ar_name + 1),
- arheader.ar_name, sizeof arheader.ar_name);
- endptr = nameptr + sizeof arheader.ar_name;
- do
- *endptr = 0;
- while (endptr > nameptr && *--endptr == ' ');
- return strtoul(arheader.ar_size, (char **) NULL, 0);
-}
-
-/* read and check file header of the object file just opened */
-
-PRIVATE unsigned readfileheader()
-{
- struct
- {
- char magic[2];
- char count[2]; /* really an int */
- }
- fileheader;
- char filechecksum; /* part of fileheader but would unalign */
-
- readin((char *) &fileheader, sizeof fileheader);
- readin(&filechecksum, sizeof filechecksum);
- if (filechecksum != checksum((char *) &fileheader, sizeof fileheader))
- input1error(" is not an object file");
- return c2u2(fileheader.count);
-}
-
-/* read the next module */
-
-PRIVATE void readmodule(filename, archentry)
-char *filename;
-char *archentry;
-{
- struct symdstruct /* to save parts of symbol before name known */
- {
- offset_t dvalue;
- flags_t dflags;
- };
- struct symdstruct *endsymdptr;
- flags_t flags;
- unsigned nsymbol;
- struct symdstruct *symdptr;
- char *symname;
- struct symstruct **symparray;
- struct symstruct *symptr;
-
- reedmodheader();
- modlast->filename = filename;
- modlast->archentry = archentry;
- nsymbol = readsize(2);
- symdptr = (struct symdstruct *)
- ourmalloc(nsymbol * sizeof(struct symdstruct));
- for (endsymdptr = symdptr + nsymbol; symdptr < endsymdptr; ++symdptr)
- {
- readsize(2); /* discard string offset, assume strings seq */
- symdptr->dflags = flags = readsize(2);
- symdptr->dvalue = readconvsize((flags & SZ_MASK) >> SZ_SHIFT);
- /* NB unsigned flags to give logical shift */
- /* bug in Xenix 2.5 cc causes (int) of the */
- /* argument to turn flags into an int */
- }
- symdptr = (struct symdstruct *)
- moveup(nsymbol * sizeof(struct symdstruct));
- modlast->symparray = symparray = (struct symstruct **)
- ourmalloc((nsymbol + 1) * sizeof(struct symstruct *));
- symname = readstring(); /* module name */
- modlast->modname = stralloc(symname); /* likely OK overlapped copy */
- for (endsymdptr = symdptr + nsymbol; symdptr < endsymdptr;
- *symparray++ = symptr, release((char *) ++symdptr))
- {
- symname = readstring();
- if ((flags = symdptr->dflags) & (E_MASK | I_MASK) &&
- (symptr = findsym(symname)) != NULL)
- {
- /*
- weaken segment-checking by letting the maximum segment
- (SEGM_MASK) mean any segment
- */
- if ((symptr->flags & SEGM_MASK) == SEGM_MASK)
- symptr->flags &= ~SEGM_MASK | (flags & SEGM_MASK);
- else if ((flags & SEGM_MASK) == SEGM_MASK)
- flags &= ~SEGM_MASK | (symptr->flags & SEGM_MASK);
- if ((flags ^ symptr->flags) & (N_MASK | A_MASK | SEGM_MASK))
- {
- redefined(symname, " with different segment or relocatability",
- archentry, symptr->modptr->filename,
- symptr->modptr->archentry);
- continue;
- }
- if (symptr->flags & E_MASK)
- {
- if (flags & E_MASK && redsym(symptr, symdptr->dvalue))
- redefined(symname, "", archentry, symptr->modptr->filename,
- symptr->modptr->archentry);
- continue;
- }
- if (flags & I_MASK && symdptr->dvalue <= symptr->value)
- continue;
- }
- else
- symptr = addsym(symname);
- symptr->modptr = modlast;
- symptr->value = symdptr->dvalue;
- symptr->flags = flags;
- if (flags & N_MASK)
- entrysym(symptr);
- }
- *symparray = NULL;
-}
-
-/* put symbol on entry symbol list if it is not already */
-
-PUBLIC void entrysym(symptr)
-struct symstruct *symptr;
-{
- register struct entrylist *elptr;
-
- for (elptr = entryfirst; elptr != NULL; elptr = elptr->elnext)
- if (symptr == elptr->elsymptr)
- return;
- elptr = (struct entrylist *) ourmalloc(sizeof(struct entrylist));
- elptr->elnext = NULL;
- elptr->elsymptr = symptr;
- if (entryfirst == NULL)
- entryfirst = elptr;
- else
- entrylast->elnext = elptr;
- entrylast = elptr;
-}
-
-/* read the header of the next module */
-
-PRIVATE void reedmodheader()
-{
- struct
- {
- char htextoffset[4]; /* offset to module text in file */
- char htextsize[4]; /* size of text (may be 0 for last mod) */
- char stringssize[2]; /* size of string area */
- char hclass; /* module class */
- char revision; /* module revision */
- }
- modheader;
- unsigned seg;
- unsigned count;
- char *cptr;
- struct modstruct *modptr;
-
- readin((char *) &modheader, sizeof modheader);
- modptr = (struct modstruct *) ourmalloc(sizeof(struct modstruct));
- modptr->modnext = NULL;
- modptr->textoffset = c4u4(modheader.htextoffset);
- modptr->class = modheader.hclass;
- readin(modptr->segmaxsize, sizeof modptr->segmaxsize);
- readin(modptr->segsizedesc, sizeof modptr->segsizedesc);
- cptr = modptr->segsize;
- for (seg = 0; seg < NSEG; ++seg)
- {
- if ((count = segsizecount(seg, modptr)) != 0)
- {
- if (cptr == modptr->segsize)
- ourmalloc(count - 1); /* 1st byte reserved in struct */
- else
- ourmalloc(count);
- readin(cptr, count);
- cptr += count;
- }
- }
- if (modfirst == NULL)
- modfirst = modptr;
- else
- modlast->modnext = modptr;
- modlast = modptr;
-}
-
-PRIVATE bool_pt redsym(symptr, value)
-register struct symstruct *symptr;
-offset_t value;
-{
- register struct redlist *rlptr;
- char class;
-
- if (symptr->modptr->class != (class = modlast->class))
- for (rlptr = redfirst;; rlptr = rlptr->rlnext)
- {
- if (rlptr == NULL)
- {
- rlptr = (struct redlist *)
- ourmalloc(sizeof(struct redlist));
- rlptr->rlnext = NULL;
- rlptr->rlsymptr = symptr;
- if (symptr->modptr->class < class)
- /* prefer lower class - put other on redlist */
- {
- rlptr->rlmodptr = modlast;
- rlptr->rlvalue = value;
- }
- else
- {
- rlptr->rlmodptr = symptr->modptr;
- symptr->modptr = modlast;
- rlptr->rlvalue = symptr->value;
- symptr->value = value;
- }
- if (redfirst == NULL)
- redfirst = rlptr;
- else
- redlast->rlnext = rlptr;
- redlast = rlptr;
- return FALSE;
- }
- if (symptr == rlptr->rlsymptr && class == rlptr->rlmodptr->class)
- break;
- }
- return TRUE;
-}
-
-PRIVATE unsigned checksum(string, length)
-char *string;
-unsigned length;
-{
- unsigned char sum; /* this is a 1-byte checksum */
-
- for (sum = 0; length-- != 0;)
- sum += *string++ & 0xFF;
- return sum;
-}
-
-PUBLIC offset_t readconvsize(countindex)
-unsigned countindex;
-{
- return readsize(convertsize[countindex]);
-}
-
-PUBLIC offset_t readsize(count)
-unsigned count;
-{
- char buf[MAX_OFFSET_SIZE];
-
- if (count == 0)
- return 0;
- readin(buf, count);
- return cntooffset(buf, count);
-}
-
-PRIVATE unsigned segbits(seg, sizedesc)
-unsigned seg;
-char *sizedesc;
-{
- return 3 & ((unsigned) sizedesc[((NSEG - 1) - seg) / 4] >> (2 * (seg % 4)));
- /* unsigned to give logical shift */
-}
-
-PUBLIC unsigned segsizecount(seg, modptr)
-unsigned seg;
-struct modstruct *modptr;
-{
- return convertsize[segbits(seg, modptr->segsizedesc)];
-}
diff --git a/bin86-0.3/ld/table.c b/bin86-0.3/ld/table.c
deleted file mode 100644
index 557eec6..0000000
--- a/bin86-0.3/ld/table.c
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * bin86/ld/table.c
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-/* table.c - table-handler module for linker */
-
-#include "const.h"
-#include "align.h"
-#include "obj.h"
-#include "type.h"
-#include "globvar.h"
-
-#define GOLDEN 157 /* GOLDEN/HASHTABSIZE approx golden ratio */
-#define HASHTABSIZE 256
-
-PRIVATE struct symstruct *hashtab[HASHTABSIZE]; /* hash table */
-PRIVATE char *tableptr; /* next free spot in catchall table */
-PRIVATE char *tableend; /* ptr to spot after last in table */
-
-FORWARD struct symstruct **gethashptr P((char *name));
-
-/* initialise symbol table */
-
-PUBLIC void syminit()
-{
- unsigned i;
-
- for (i = sizeof(int) <= 2 ? 0xE000 : (unsigned) 0x38000;
- i != 0; i -= 512)
- if ((tableptr = malloc(i)) != NULL)
- break;
- if (tableptr == NULL)
- outofmemory();
- tableend = tableptr + i;
- for (i = 0; i < HASHTABSIZE; i++)
- hashtab[i] = NULL;
-}
-
-/* add named symbol to end of table - initialise only name and next fields */
-/* caller must not duplicate names of externals for findsym() to work */
-
-PUBLIC struct symstruct *addsym(name)
-char *name;
-{
- struct symstruct **hashptr;
- struct symstruct *oldsymptr;
- struct symstruct *symptr;
-
- hashptr = gethashptr(name);
- symptr = *hashptr;
- while (symptr != NULL)
- {
- oldsymptr = symptr;
- symptr = symptr->next;
- }
- align(tableptr);
- symptr = (struct symstruct *) tableptr;
- if ((tableptr = symptr->name + (strlen(name) + 1)) > tableend)
- outofmemory();
- symptr->modptr = NULL;
- symptr->next = NULL;
- if (name != symptr->name)
- strcpy(symptr->name, name); /* should't happen */
- if (*hashptr == NULL)
- *hashptr = symptr;
- else
- oldsymptr->next = symptr;
- return symptr;
-}
-
-/* lookup named symbol */
-
-PUBLIC struct symstruct *findsym(name)
-char *name;
-{
- struct symstruct *symptr;
-
- symptr = *gethashptr(name);
- while (symptr != NULL && (!(symptr->flags & (E_MASK | I_MASK)) ||
- strcmp(symptr->name, name) != 0))
- symptr = symptr->next;
- return symptr;
-}
-
-/* convert name to a hash table ptr */
-
-PRIVATE struct symstruct **gethashptr(name)
-register char *name;
-{
- register unsigned hashval;
-
- hashval = 0;
- while (*name)
- hashval = hashval * 2 + *name++;
- return hashtab + ((hashval * GOLDEN) & (HASHTABSIZE - 1));
-
-/*
-
-#asm
-
-GOLDEN EQU 157
-HASHTABSIZE EQU 256
-
- CLRB can build value here since HASHTABSIZE <= 256
- LDA ,X
- BEQ HASHVAL.EXIT
-HASHVAL.LOOP
- ADDB ,X+
- LSLB
- LDA ,X
- BNE HASHVAL.LOOP
- RORB
- LDA #GOLDEN
- MUL
-HASHVAL.EXIT
-HASHVAL.EXIT
- LDX #_hashtab
- ABX discard A - same as taking mod HASHTABSIZE
- ABX
-#endasm
-
-*/
-
-}
-
-/* move symbol descriptor entries to top of table (no error checking) */
-
-PUBLIC char *moveup(nbytes)
-unsigned nbytes;
-{
- register char *source;
- register char *target;
-
- source = tableptr;
- target = tableend;
- while (nbytes--)
- *--target = *--source;
- tableptr = source;
- return tableend = target;
-}
-
-/* our version of malloc */
-
-PUBLIC char *ourmalloc(nbytes)
-unsigned nbytes;
-{
- char *allocptr;
-
- align(tableptr);
- allocptr = tableptr;
- if ((tableptr += nbytes) > tableend)
- outofmemory();
- return allocptr;
-}
-
-/* our version of free (release from bottom of table) */
-
-PUBLIC void ourfree(cptr)
-char *cptr;
-{
- tableptr = cptr;
-}
-
-/* read string from file into table at offset suitable for next symbol */
-
-PUBLIC char *readstring()
-{
- int c;
- char *s;
- char *start;
-
- align(tableptr);
- start = s = ((struct symstruct *) tableptr)->name;
- while (TRUE)
- {
- if (s >= tableend)
- outofmemory();
- if ((c = readchar()) < 0)
- prematureeof();
- if ((*s++ = c) == 0)
- return start;
- }
- /* NOTREACHED */
-}
-
-/* release from top of table */
-
-PUBLIC void release(cptr)
-char *cptr;
-{
- tableend = cptr;
-}
-
-/* allocate space for string */
-
-PUBLIC char *stralloc(s)
-char *s;
-{
- return strcpy(ourmalloc((unsigned) strlen(s) + 1), s);
-}
diff --git a/bin86-0.3/ld/type.h b/bin86-0.3/ld/type.h
deleted file mode 100644
index d5d9a8d..0000000
--- a/bin86-0.3/ld/type.h
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- * bin86/ld/type.h
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-/* type.h - types for linker */
-
-typedef unsigned bool_pt;
-typedef unsigned char bool_t;
-
-typedef unsigned short u2_t;
-typedef unsigned u2_pt;
-typedef unsigned long u4_t;
-typedef unsigned long u4_pt;
-
-#ifdef OBJ_H /* obj.h is included */
-
-/* Prevent the use of offset_t */
-#ifndef offset_t
-#define offset_t offset_T
-#endif
-
-typedef unsigned flags_t; /* unsigned makes shifts logical */
-
-#ifdef LONG_OFFSETS
-typedef unsigned long offset_t;
-#else
-typedef unsigned offset_t;
-#endif
-
-struct entrylist /* list of entry symbols */
-{
- struct entrylist *elnext; /* next on list */
- struct symstruct *elsymptr; /* entry on list */
-};
-
-struct modstruct /* module table entry format */
-{
- char *filename; /* file containing this module */
- char *archentry; /* name of component file for archives */
- char *modname; /* name of module */
- long textoffset; /* offset to module text in file */
- char class; /* class of module */
- char loadflag; /* set if module to be loaded */
- char segmaxsize[NSEG / 4]; /* |SF|SE|..|S0|, 2 bits for seg max size */
- /* 00 = 1, 01 = 2, 10 = 3, 11 = 4 */
- char segsizedesc[NSEG / 4]; /* |SF|SE|..|S0|, 2 bits for #bytes for size */
- /* 00 = 0, 01 = 1, 10 = 2, 11 = 4 */
- struct symstruct **symparray; /* ^array of ptrs to referenced syms */
- struct modstruct *modnext; /* next module in order of initial reading */
- char segsize[1]; /* up to 64 size bytes begin here */
-}; /* careful with sizeof( struct modstruct )!! */
-
-struct redlist /* list of redefined (exported) symbols */
-{
- struct redlist *rlnext; /* next on list */
- struct symstruct *rlsymptr; /* to symbol with same name, flags */
- struct modstruct *rlmodptr; /* module for this redefinition */
- offset_t rlvalue; /* value for this redefinition */
-};
-
-struct symstruct /* symbol table entry format */
-{
- struct modstruct *modptr; /* module where symbol is defined */
- offset_t value; /* value of symbol */
- flags_t flags; /* see below (unsigned makes shifts logical) */
- struct symstruct *next; /* next symbol with same hash value */
- char name[1]; /* name is any string beginning here */
-}; /* don't use sizeof( struct symstruct )!! */
-
-#endif /* obj.h is included */
-
-/* prototypes */
-
-#if defined(PROTO) || __STDC__
-#define P(x) x
-#else
-#define P(x) ()
-#endif
-
-/* dump.c */
-void dumpmods P((void));
-void dumpsyms P((void));
-
-/* io.c */
-void ioinit P((char *progname));
-void closein P((void));
-void closeout P((void));
-void errtrace P((char *name, int level));
-void executable P((void));
-void flusherr P((void));
-void openin P((char *filename));
-void openout P((char *filename));
-void putstr P((char *message));
-#ifdef OBJ_H
-void put08x P((offset_t num));
-void put08lx P((offset_t num));
-#endif
-void putbstr P((unsigned width, char *str));
-void putbyte P((int ch));
-int readchar P((void));
-void readin P((char *buf, unsigned count));
-bool_pt readineofok P((char *buf, unsigned count));
-void seekin P((long offset));
-void seekout P((long offset));
-void seektrel P((long offset));
-void writechar P((int c));
-void writedrel P((char *buf, unsigned count));
-void writeout P((char *buf, unsigned count));
-void writetrel P((char *buf, unsigned count));
-void fatalerror P((char *message));
-void inputerror P((char *message));
-void input1error P((char *message));
-void outofmemory P((void));
-void prematureeof P((void));
-void redefined P((char *name, char *message, char *archentry,
- char *deffilename, char *defarchentry));
-void reserved P((char *name));
-#ifdef OBJ_H
-void size_error P((int seg, offset_t count, offset_t size));
-#endif
-void undefined P((char *name));
-void usage P((void));
-void use_error P((char *message));
-
-/* ld.c */
-int main P((int argc, char **argv));
-
-/* readobj.c */
-void objinit P((void));
-void readsyms P((char *filename, bool_pt trace));
-#ifdef OBJ_H
-void entrysym P((struct symstruct *symptr));
-offset_t readconvsize P((unsigned countindex));
-offset_t readsize P((unsigned count));
-unsigned segsizecount P((unsigned seg, struct modstruct *modptr));
-#endif
-
-/* table.c */
-void syminit P((void));
-struct symstruct *addsym P((char *name));
-struct symstruct *findsym P((char *name));
-char *moveup P((unsigned nbytes));
-char *ourmalloc P((unsigned nbytes));
-void ourfree P((char *cptr));
-char *readstring P((void));
-void release P((char *cptr));
-char *stralloc P((char *s));
-
-/* typeconvert.c */
-u2_pt c2u2 P((char *buf));
-u4_t c4u4 P((char *buf));
-u2_pt cnu2 P((char *buf, unsigned count));
-u4_t cnu4 P((char *buf, unsigned count));
-void u2c2 P((char *buf, u2_pt offset));
-void u4c4 P((char *buf, u4_t offset));
-void u2cn P((char *buf, u2_pt offset, unsigned count));
-void u4cn P((char *buf, u4_t offset, unsigned count));
-bool_pt typeconv_init P((bool_pt big_endian, bool_pt long_big_endian));
-
-/* writebin.c */
-void writebin P((char *outfilename, bool_pt argsepid, bool_pt argbits32,
- bool_pt argstripflag, bool_pt arguzp));
-void linksyms P((bool_pt argreloc_output));
-
-/* Make offset_t safe for the standard includes */
-#undef offset_t
-
-/* library - fcntl.h */
-#undef NULL
-#include <fcntl.h>
-/*
-int creat P((const char *_path, int _mode));
-int open P((const char *_path, int _oflag, ...));
-*/
-
-/* library - sys/stat.h */
-#include <sys/stat.h>
-#ifdef MY_STAT_H
-int chmod P((const char *_path, mode_t _mode));
-int fstat P((int _fd, struct stat *_statbuf));
-mode_t umask P((mode_t _oldmask));
- /* it should be mode_t but it's hard to
- * decide which systems define it, and where */
-#endif
-
-/* library - stdlib.h */
-#include <stdlib.h>
-/*
-void exit P((int _status));
-void *malloc P((unsigned _nbytes));
-unsigned long strtoul P((const char *_nptr, char **_endptr, int _base));
-*/
-
-/* library - string.h */
-#include <string.h>
-/*
-void *memset P((void *_s, int _c, unsigned _nbytes));
-char *strcat P((char *_target, const char *_source));
-char *strchr P((const char *_s, int _ch));
-int strcmp P((const char *_s1, const char *_s2));
-char *strcpy P((char *_target, const char *_source));
-unsigned strlen P((const char *_s));
-char *strncat P((char *_target, const char *_source, unsigned _maxlength));
-int strncmp P((const char *_s1, const char *_s2, unsigned _nbytes));
-char *strncpy P((char *_target, const char *_source, unsigned _maxlength));
-char *strrchr P((const char *_s, int _ch));
-*/
-
-/* library - unistd.h */
-#include <unistd.h>
-/*
-int access P((char *_path, int _amode));
-int close P((int _fd));
-long lseek P((int _fd, long _offset, int _whence));
-int read P((int _fd, char *_buf, unsigned _nbytes));
-int write P((int _fd, char *_buf, unsigned _nbytes));
-*/
-
-#ifdef OBJ_H /* obj.h is included */
-
-/* Prevent the use of offset_t */
-#ifndef offset_t
-#define offset_t offset_T
-#endif
-
-#endif
diff --git a/bin86-0.3/ld/typeconv.c b/bin86-0.3/ld/typeconv.c
deleted file mode 100644
index 1465106..0000000
--- a/bin86-0.3/ld/typeconv.c
+++ /dev/null
@@ -1,540 +0,0 @@
-/*
- * bin86/ld/typeconv.c
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-/* typeconv.c - convert between char arrays and unsigneds */
-
-/*
- c2u2(): 2 byte array to 2 byte unsigned
- c4u4(): 4 byte array to 4 byte unsigned
- cnu2(): n byte array to 2 byte unsigned
- cnu4(): n byte array to 4 byte unsigned
- u2c2(): 2 byte unsigned to 2 byte array
- u2cn(): 2 byte unsigned to n byte array
- u4c4(): 4 byte unsigned to 4 byte array
- u4cn(): 4 byte unsigned to n byte array
- typeconv_init: (re)initialise for given byte order.
- Default is no swapping, but the initialisation should be done
- anyway to provide some validity checks (returns FALSE if error).
-
- Not provided:
- c2u4(), c4u2(), u2c4(), u4c2().
- Each of these is best done by truncating or extending a return value
- or argument to the appropiate fixed-count function.
- c4u2() has too many cases to do in-line conveniently, and the others
- are hardly more efficient when done in-line.
-
- 4 byte orderings for both char arrays and unsigneds are supported:
- 0123 - little-endian
- 3210 - big-endian
- 2301 - little-endian with long words big-endian (pdp11)
- 1032 - big-endian with long words little_endian (who knows?)
-
- The unsigned's byte order is that of the machine on which these
- routines are running.
- It is determined at run time initialisation since the compiler/
- preprocessor is too dumb to tell us at compile time.
-*/
-
-#include "const.h"
-#include "type.h"
-#include "globvar.h"
-
-FORWARD u2_pt c2u2_00 P((char *buf));
-FORWARD u4_pt c4u4_00 P((char *buf));
-FORWARD u2_pt c2u2_ss P((char *buf));
-FORWARD u4_pt c4u4_ss P((char *buf));
-FORWARD u4_pt c4u4_s0 P((char *buf));
-FORWARD u4_pt c4u4_0s P((char *buf));
-FORWARD void u2c2_00 P((char *buf, u2_pt offset));
-FORWARD void u4c4_00 P((char *buf, u4_t offset));
-FORWARD void u2c2_ss P((char *buf, u2_pt offset));
-FORWARD void u4c4_ss P((char *buf, u4_t offset));
-FORWARD void u4c4_s0 P((char *buf, u4_t offset));
-FORWARD void u4c4_0s P((char *buf, u4_t offset));
-
-PRIVATE u2_pt (*pc2u2) P((char *buf)) = c2u2_00;
-PRIVATE u4_pt (*pc4u4) P((char *buf)) = c4u4_00;
-PRIVATE void (*pu2c2) P((char *buf, u2_pt offset)) = u2c2_00;
-PRIVATE void (*pu4c4) P((char *buf, u4_t offset)) = u4c4_00;
-
-/* === char arrays to unsigneds === */
-
-/* no bytes swapped, longwinded to avoid alignment problems */
-
-PRIVATE u2_pt c2u2_00(buf)
-register char *buf;
-{
- u2_t offset;
-
- ((char *) &offset)[0] = buf[0];
- ((char *) &offset)[1] = buf[1];
- return offset;
-}
-
-PRIVATE u4_pt c4u4_00(buf)
-register char *buf;
-{
- u4_t offset;
-
- ((char *) &offset)[0] = buf[0];
- ((char *) &offset)[1] = buf[1];
- ((char *) &offset)[2] = buf[2];
- ((char *) &offset)[3] = buf[3];
- return offset;
-}
-
-/* straight swapping for little-endian to big-endian and vice versa */
-
-PRIVATE u2_pt c2u2_ss(buf)
-register char *buf;
-{
- u2_t offset;
-
- ((char *) &offset)[0] = buf[1];
- ((char *) &offset)[1] = buf[0];
- return offset;
-}
-
-PRIVATE u4_pt c4u4_ss(buf)
-register char *buf;
-{
- u4_t offset;
-
- ((char *) &offset)[0] = buf[3];
- ((char *) &offset)[1] = buf[2];
- ((char *) &offset)[2] = buf[1];
- ((char *) &offset)[3] = buf[0];
- return offset;
-}
-
-/* wierd swapping for different-endian u2's, same-endian u4's */
-
-PRIVATE u4_pt c4u4_s0(buf)
-register char *buf;
-{
- u4_t offset;
-
- ((char *) &offset)[0] = buf[1];
- ((char *) &offset)[1] = buf[0];
- ((char *) &offset)[2] = buf[3];
- ((char *) &offset)[3] = buf[2];
- return offset;
-}
-
-/* very wierd swapping for same-endian u2's, different-endian u4's */
-
-PRIVATE u4_pt c4u4_0s(buf)
-register char *buf;
-{
- u4_t offset;
-
- ((char *) &offset)[0] = buf[2];
- ((char *) &offset)[1] = buf[3];
- ((char *) &offset)[2] = buf[0];
- ((char *) &offset)[3] = buf[1];
- return offset;
-}
-
-/* === entry points === */
-
-PUBLIC u2_pt c2u2(buf)
-char *buf;
-{
- return (*pc2u2) (buf);
-}
-
-PUBLIC u4_t c4u4(buf)
-char *buf;
-{
- return (*pc4u4) (buf);
-}
-
-PUBLIC u2_pt cnu2(buf, count)
-char *buf;
-unsigned count;
-{
- switch (count)
- {
- case 1:
- return buf[0] & 0xFF;
- case 2:
- return (*pc2u2) (buf);
- case 4:
- return (u2_pt) (*pc4u4) (buf);
- default:
- return 0;
- }
-}
-
-PUBLIC u4_t cnu4(buf, count)
-char *buf;
-unsigned count;
-{
- switch (count)
- {
- case 1:
- return buf[0] & 0xFF;
- case 2:
- return (*pc2u2) (buf);
- case 4:
- return (*pc4u4) (buf);
- default:
- return 0;
- }
-}
-
-/* === unsigneds to char arrays === */
-
-/* no bytes swapped, longwinded to avoid alignment problems */
-
-PRIVATE void u2c2_00(buf, offset)
-register char *buf;
-u2_pt offset;
-{
-
- buf[0] = ((char *) &offset)[0];
- buf[1] = ((char *) &offset)[1];
-}
-
-PRIVATE void u4c4_00(buf, offset)
-register char *buf;
-u4_t offset;
-{
- buf[0] = ((char *) &offset)[0];
- buf[1] = ((char *) &offset)[1];
- buf[2] = ((char *) &offset)[2];
- buf[3] = ((char *) &offset)[3];
-}
-
-/* straight swapping for little-endian to big-endian and vice versa */
-
-PRIVATE void u2c2_ss(buf, offset)
-register char *buf;
-u2_pt offset;
-{
- u2_t offset2;
-
- offset2 = offset;
- buf[0] = ((char *) &offset2)[1];
- buf[1] = ((char *) &offset2)[0];
-}
-
-PRIVATE void u4c4_ss(buf, offset)
-register char *buf;
-u4_t offset;
-{
- buf[0] = ((char *) &offset)[3];
- buf[1] = ((char *) &offset)[2];
- buf[2] = ((char *) &offset)[1];
- buf[3] = ((char *) &offset)[0];
-}
-
-/* wierd swapping for different-endian u2's, same-endian u4's */
-
-PRIVATE void u4c4_s0(buf, offset)
-register char *buf;
-u4_t offset;
-{
- buf[0] = ((char *) &offset)[1];
- buf[1] = ((char *) &offset)[0];
- buf[2] = ((char *) &offset)[3];
- buf[3] = ((char *) &offset)[2];
-}
-
-/* very wierd swapping for same-endian u2's, different-endian u4's */
-
-PRIVATE void u4c4_0s(buf, offset)
-register char *buf;
-u4_t offset;
-{
- buf[0] = ((char *) &offset)[2];
- buf[1] = ((char *) &offset)[3];
- buf[2] = ((char *) &offset)[0];
- buf[3] = ((char *) &offset)[1];
-}
-
-/* === entry points === */
-
-PUBLIC void u2c2(buf, offset)
-register char *buf;
-u2_pt offset;
-{
- (*pu2c2) (buf, offset);
-}
-
-PUBLIC void u4c4(buf, offset)
-register char *buf;
-u4_t offset;
-{
- (*pu4c4) (buf, offset);
-}
-
-PUBLIC void u2cn(buf, offset, count)
-register char *buf;
-u2_pt offset;
-unsigned count;
-{
- switch (count)
- {
- case 1:
- buf[0] = (char) offset;
- return;
- case 2:
- (*pu2c2) (buf, offset);
- return;
- case 4:
- (*pu4c4) (buf, (u4_t) offset);
- return;
- }
-}
-
-PUBLIC void u4cn(buf, offset, count)
-register char *buf;
-u4_t offset;
-unsigned count;
-{
- switch (count)
- {
- case 1:
- buf[0] = (char) offset;
- return;
- case 2:
- (*pu2c2) (buf, (u2_pt) (u2_t) offset);
- return;
- case 4:
- (*pu4c4) (buf, offset);
- return;
- }
-}
-
-/* initialise type conversion, return FALSE if it cannot be handled */
-
-PUBLIC bool_pt typeconv_init(big_endian, long_big_endian)
-bool_pt big_endian;
-bool_pt long_big_endian;
-{
- u2_pt conv2;
- u4_pt conv4;
- char *conv2ptr;
- char *conv4ptr;
-
- if (sizeof(u2_t) != 2 || sizeof(u4_t) != 4)
- /* dumb preprocessor's don't accept sizeof in #if expressions */
- return FALSE;
-
- if (big_endian)
- {
- conv2ptr = (conv4ptr = "\1\2\3\4") + 2;
- if (!long_big_endian)
- conv4ptr = "\3\4\1\2";
- }
- else
- {
- conv2ptr = conv4ptr = "\4\3\2\1";
- if (long_big_endian)
- conv4ptr = "\2\1\4\3";
- }
- conv2 = c2u2_00(conv2ptr);
- conv4 = c4u4_00(conv4ptr);
- if (conv2 == 0x0304)
- {
- pc2u2 = c2u2_00;
- pc4u4 = c4u4_00;
- pu2c2 = u2c2_00;
- pu4c4 = u4c4_00;
- if (conv4 == 0x03040102L)
- {
- pc4u4 = c4u4_0s;
- pu4c4 = u4c4_0s;
- }
- else if (conv4 != 0x01020304L)
- return FALSE;
- }
- else if (conv2 == 0x0403)
- {
- pc2u2 = c2u2_ss;
- pc4u4 = c4u4_ss;
- pu2c2 = u2c2_ss;
- pu4c4 = u4c4_ss;
- if (conv4 == 0x02010403L)
- {
- pc4u4 = c4u4_s0;
- pu4c4 = u4c4_s0;
- }
- else if (conv4 != 0x04030201L)
- return FALSE;
- }
- else
- return FALSE;
- return TRUE;
-}
-
-#ifdef DEBUG_TYPECONV
-
-main(int argc,char **argv)
-{
- char *source;
- char target[4];
- u2_t u2;
- u2_t u2a;
- u4_t u4;
- u4_t u4a;
-
- printf("%u\n", typeconv_init(FALSE, FALSE));
- printf("%u\n", typeconv_init(FALSE, TRUE));
- printf("%u\n", typeconv_init(TRUE, FALSE));
- printf("%u\n", typeconv_init(TRUE, TRUE));
-
- typeconv_init(FALSE, FALSE);
- source = "\4\3\2\1";
-
- target[0] = 0;
- target[1] = 0;
- u2 = cnu2(source, 2);
- u2cn(target, u2, 2);
- if (strncmp(source, target, 2))
- printf("oops9\n");
-
- target[0] = 0;
- target[1] = 0;
- u4a = cnu4(source, 2);
- u4cn(target, u4a, 2);
- if (strncmp(source, target, 2))
- printf("oops10\n");
-
- target[0] = 0;
- target[1] = 0;
- target[2] = 0;
- target[3] = 0;
- u2a = cnu2(source, 4);
- u2cn(target, u2a, 4);
- if (strncmp(target, "\4\3\0\0", 4))
- printf("oops11\n");
-
- target[0] = 0;
- target[1] = 0;
- target[2] = 0;
- target[3] = 0;
- u4 = cnu4(source, 4);
- u4cn(target, u4, 4);
- if (strncmp(source, target, 4))
- printf("oops12\n");
-
- printf("%04x %04x %08lx %08lx\n", u2, u2a, u4, u4a);
-
- typeconv_init(FALSE, TRUE);
- source = "\2\1\4\3";
-
- target[0] = 0;
- target[1] = 0;
- u2 = cnu2(source + 2, 2);
- u2cn(target, u2, 2);
- if (strncmp(source + 2, target, 2))
- printf("oops13\n");
-
- target[0] = 0;
- target[1] = 0;
- u4a = cnu4(source + 2, 2);
- u4cn(target, u4a, 2);
- if (strncmp(source + 2, target, 2))
- printf("oops14\n");
-
- target[0] = 0;
- target[1] = 0;
- target[2] = 0;
- target[3] = 0;
- u2a = cnu2(source, 4);
- u2cn(target, u2a, 4);
- if (strncmp(target, "\0\0\4\3", 4))
- printf("oops15\n");
-
- target[0] = 0;
- target[1] = 0;
- target[2] = 0;
- target[3] = 0;
- u4 = cnu4(source, 4);
- u4cn(target, u4, 4);
- if (strncmp(source, target, 4))
- printf("oops16\n");
-
- printf("%04x %04x %08lx %08lx\n", u2, u2a, u4, u4a);
-
- typeconv_init(TRUE, FALSE);
- source = "\3\4\1\2";
-
- target[0] = 0;
- target[1] = 0;
- u2 = cnu2(source, 2);
- u2cn(target, u2, 2);
- if (strncmp(source, target, 2))
- printf("oops5\n");
-
- target[0] = 0;
- target[1] = 0;
- u4a = cnu4(source, 2);
- u4cn(target, u4a, 2);
- if (strncmp(source, target, 2))
- printf("oops6\n");
-
- target[0] = 0;
- target[1] = 0;
- target[2] = 0;
- target[3] = 0;
- u2a = cnu2(source, 4);
- u2cn(target, u2a, 4);
- if (strncmp(target, "\3\4\0\0", 4))
- printf("oops7\n");
-
- target[0] = 0;
- target[1] = 0;
- target[2] = 0;
- target[3] = 0;
- u4 = cnu4(source, 4);
- u4cn(target, u4, 4);
- if (strncmp(source, target, 4))
- printf("oops8\n");
-
- printf("%04x %04x %08lx %08lx\n", u2, u2a, u4, u4a);
-
- typeconv_init(TRUE, TRUE);
- source = "\1\2\3\4";
-
- target[0] = 0;
- target[1] = 0;
- u2 = cnu2(source + 2, 2);
- u2cn(target, u2, 2);
- if (strncmp(source + 2, target, 2))
- printf("oops1\n");
-
- target[0] = 0;
- target[1] = 0;
- u4a = cnu4(source + 2, 2);
- u4cn(target, u4a, 2);
- if (strncmp(source + 2, target, 2))
- printf("oops2\n");
-
- target[0] = 0;
- target[1] = 0;
- target[2] = 0;
- target[3] = 0;
- u2a = cnu2(source, 4);
- u2cn(target, u2a, 4);
- if (strncmp(target, "\0\0\3\4", 4))
- printf("oops3\n");
-
- target[0] = 0;
- target[1] = 0;
- target[2] = 0;
- target[3] = 0;
- u4 = cnu4(source, 4);
- u4cn(target, u4, 4);
- if (strncmp(source, target, 4))
- printf("oops4\n");
-
- printf("%04x %04x %08lx %08lx\n", u2, u2a, u4, u4a);
-}
-
-#endif /* DEBUG_TYPECONV */
diff --git a/bin86-0.3/ld/writebin.c b/bin86-0.3/ld/writebin.c
deleted file mode 100644
index 56b329d..0000000
--- a/bin86-0.3/ld/writebin.c
+++ /dev/null
@@ -1,949 +0,0 @@
-/*
- * bin86/ld/writebin.c
- *
- * Copyright (C) 1992 Bruce Evans
- */
-
-extern long text_base_address;
-#define btextoffset text_base_address
-static long bdataoffset;
-#define page_size() 4096
-
-/* writebin.c - write binary file for linker */
-
-#ifdef A_OUT_H
-# include A_OUT_H
-#else
-# ifdef BSD_A_OUT
-# include "bsd-a.out.h"
-# define A_MINHDR 0
-# define C_EXT N_EXT
-# define C_STAT 0
-# define n_was_name n_un.n_name
-# define n_was_numaux n_other
-# define n_was_other n_numaux
-# define n_was_sclass n_type
-# define n_was_strx n_un.n_strx
-# define n_was_type n_desc
-# else /* not BSD_A_OUT */
-# include "a.out.h" /* maybe local copy of <a.out.h> for X-link */
-# define n_was_name n_name
-# define n_was_numaux n_numaux
-# define n_was_other n_other
-# define n_was_sclass n_sclass
-# define n_was_strx n_value
-# define n_was_type n_type
-# endif /* BSD_A_OUT */
-#endif
-
-#include "const.h"
-#include "obj.h"
-#include "type.h"
-#undef EXTERN
-#include "globvar.h"
-
-#ifdef EDOS
-# define FILEHEADERLENGTH 0
-#endif
-#ifdef MINIX
-# ifdef BSD_A_OUT
-# define FILEHEADERLENGTH sizeof (struct exec)
-# else
-# define FILEHEADERLENGTH A_MINHDR
- /* part of header not counted in offsets */
-# endif
-#endif
-#define DPSEG 2
-
-#define CM_MASK 0xC0
-#define MODIFY_MASK 0x3F
-#define S_MASK 0x04
-#define OF_MASK 0x03
-
-#define CM_SPECIAL 0
-#define CM_ABSOLUTE 0x40
-#define CM_OFFSET_RELOC 0x80
-#define CM_SYMBOL_RELOC 0xC0
-
-#define CM_EOT 0
-#define CM_BYTE_SIZE 1
-#define CM_WORD_SIZE 2
-#define CM_LONG_SIZE 3
-#define CM_1_SKIP 17
-#define CM_2_SKIP 18
-#define CM_4_SKIP 19
-#define CM_0_SEG 32
-
-#define ABS_TEXT_MAX 64
-
-#define offsetof(struc, mem) ((int) &((struc *) 0)->mem)
-#define memsizeof(struc, mem) sizeof(((struc *) 0)->mem)
-
-PRIVATE bool_t bits32; /* nonzero for 32-bit executable */
-PRIVATE offset_t combase[NSEG]; /* bases of common parts of segments */
-PRIVATE offset_t comsz[NSEG]; /* sizes of common parts of segments */
-PRIVATE char curseg; /* current segment, 0 to $F */
-PRIVATE offset_t edataoffset; /* end of data */
-PRIVATE offset_t endoffset; /* end of bss */
-PRIVATE offset_t etextoffset; /* end of text */
-PRIVATE offset_t etextpadoff; /* end of padded text */
-#ifdef BSD_A_OUT
-PRIVATE unsigned ndreloc; /* number of data relocations */
-#endif
-PRIVATE unsigned nsym; /* number of symbols written */
-#ifdef BSD_A_OUT
-PRIVATE unsigned ntreloc; /* number of text relocations */
-PRIVATE bool_t reloc_output; /* nonzero to leave reloc info in output */
-#endif
-PRIVATE unsigned relocsize; /* current relocation size 1, 2 or 4 */
-PRIVATE offset_t segadj[NSEG]; /* adjusts (file offset - seg offset) */
- /* depends on zero init */
-PRIVATE offset_t segbase[NSEG]; /* bases of data parts of segments */
-PRIVATE char segboundary[9] = "__seg0DH";
- /* name of seg boundary __seg0DL to __segfCH */
-PRIVATE offset_t segpos[NSEG]; /* segment positions for current module */
-PRIVATE offset_t segsz[NSEG]; /* sizes of data parts of segments */
- /* depends on zero init */
-PRIVATE bool_t sepid; /* nonzero for separate I & D */
-PRIVATE bool_t stripflag; /* nonzero to strip symbols */
-PRIVATE offset_t spos; /* position in current seg */
-PRIVATE bool_t uzp; /* nonzero for unmapped zero page */
-
-#ifdef EDOS
-FORWARD unsigned binheaderlength P((char *commandname));
-FORWARD char *idconvert P((struct entrylist *elptr, char *commandname));
-#endif
-FORWARD void linkmod P((struct modstruct *modptr));
-FORWARD void linkrefs P((struct modstruct *modptr));
-FORWARD void padmod P((struct modstruct *modptr));
-FORWARD void setsym P((char *name, offset_t value));
-FORWARD void symres P((char *name));
-FORWARD void setseg P((unsigned newseg));
-FORWARD void skip P((unsigned countsize));
-#ifdef EDOS
-FORWARD void writeheader P((char *commandname));
-#else
-FORWARD void writeheader P((void));
-#endif
-FORWARD void writenulls P((offset_t count));
-
-/* link all symbols connected to entry symbols */
-
-PUBLIC void linksyms(argreloc_output)
-bool_pt argreloc_output;
-{
- char needlink;
- struct entrylist *elptr;
- struct modstruct *modptr;
- struct symstruct *symptr;
-
-#ifdef BSD_A_OUT
- reloc_output = argreloc_output;
- if (argreloc_output)
- {
- if (modfirst->modnext != NULL)
- fatalerror("relocatable output only works for one input file");
- for (modptr = modfirst; modptr != NULL; modptr = modptr->modnext)
- modptr->loadflag = TRUE;
- return;
- }
-#endif
- if ((symptr = findsym("_main")) != NULL)
- entrysym(symptr);
- do
- {
- if ((elptr = entryfirst) == NULL)
- fatalerror("no start symbol");
- for (modptr = modfirst; modptr != NULL; modptr = modptr->modnext)
- modptr->loadflag = FALSE;
- for (; elptr != NULL; elptr = elptr->elnext)
- linkrefs(elptr->elsymptr->modptr);
- if ((symptr = findsym("start")) != NULL ||
- (symptr = findsym("crtso")) != NULL)
- linkrefs(symptr->modptr);
- needlink = FALSE;
- {
- struct redlist *prlptr;
- struct redlist *rlptr;
-
- for (rlptr = redfirst; rlptr != NULL;
- rlptr = (prlptr = rlptr)->rlnext)
- if (rlptr->rlmodptr->loadflag &&
- rlptr->rlmodptr->class > rlptr->rlsymptr->modptr->class)
- {
- rlptr->rlsymptr->modptr = rlptr->rlmodptr;
- rlptr->rlsymptr->value = rlptr->rlvalue;
- if (rlptr == redfirst)
- redfirst = rlptr->rlnext;
- else
- prlptr->rlnext = rlptr->rlnext;
- needlink = TRUE;
- }
- }
- }
- while (needlink);
-}
-
-/* write binary file */
-
-PUBLIC void writebin(outfilename, argsepid, argbits32, argstripflag, arguzp)
-char *outfilename;
-bool_pt argsepid;
-bool_pt argbits32;
-bool_pt argstripflag;
-bool_pt arguzp;
-{
- char buf4[4];
-#ifdef EDOS
- char *commandname;
-#endif
- char *cptr;
- struct nlist extsym;
- flags_t flags;
- struct modstruct *modptr;
- char seg;
- unsigned sizecount;
- offset_t tempoffset;
- struct symstruct *symptr;
-
- sepid = argsepid;
- bits32 = argbits32;
- stripflag = argstripflag;
-#ifdef BSD_A_OUT
- uzp = arguzp && !reloc_output;
-#else
- uzp = arguzp;
-#endif
- if (uzp)
- {
- if (btextoffset == 0)
- btextoffset = page_size();
- if (bdataoffset == 0 && sepid)
- bdataoffset = page_size();
- }
-#ifdef EDOS
- commandname = stralloc(outfilename);
- if ((cptr = strchr(commandname, ':')) != NULL)
- commandname = cptr + 1;
- if ((cptr = strrchr(commandname, '.')) != NULL)
- *cptr = 0;
-#endif
-
- /* reserve special symbols use curseg to pass parameter to symres() */
- for (curseg = 0; curseg < NSEG; ++curseg)
- {
- segboundary[5] = hexdigit[curseg]; /* to __segX?H */
- segboundary[6] = 'D';
- symres(segboundary); /* __segXDH */
- segboundary[7] = 'L';
- symres(segboundary); /* __segXDL */
- segboundary[6] = 'C';
- symres(segboundary); /* __segXCL */
- segboundary[7] = 'H';
- symres(segboundary); /* __segXCH */
- }
-#ifdef EDOS
- curseg = 0; /* data seg, s.b. variable */
-#else
- curseg = 3;
-#endif
- symres("__edata");
- symres("__end");
- curseg = 0; /* text seg, s.b. variable */
- symres("__etext");
-
- /* calculate segment and common sizes (sum over loaded modules) */
- /* use zero init of segsz[] */
- /* also relocate symbols relative to starts of their segments */
- for (modptr = modfirst; modptr != NULL; modptr = modptr->modnext)
- if (modptr->loadflag)
- {
- register struct symstruct **symparray;
- register struct symstruct *symptr;
-
- for (symparray = modptr->symparray;
- (symptr = *symparray) != NULL; ++symparray)
- if (symptr->modptr == modptr && !(symptr->flags & A_MASK))
- {
- if (!(symptr->flags & (I_MASK | SA_MASK)))
- {
- /* relocate by offset of module in segment later */
- /* relocate by offset of segment in memory special */
- /* symbols get relocated improperly */
- symptr->value += segsz[symptr->flags & SEGM_MASK];
- }
- else if (symptr->value == 0)
- {
-#ifdef BSD_A_OUT
- if (!reloc_output)
-#endif
- undefined(symptr->name);
- }
- else
- {
-#ifdef BSD_A_OUT
-#if 0
- if (!reloc_output)
-#else
- if (!reloc_output || !(symptr->flags & I_MASK))
-#endif
-#endif
- {
- tempoffset = ld_roundup(symptr->value, 4, offset_t);
- /* temp kludge quad alignment for 386 */
- symptr->value = comsz[seg = symptr->flags & SEGM_MASK];
- comsz[seg] += tempoffset;
- }
- if (!(symptr->flags & SA_MASK))
- symptr->flags |= C_MASK;
- }
- }
- for (seg = 0, cptr = modptr->segsize; seg < NSEG; ++seg)
- {
- segsz[seg] += cntooffset(cptr,
- sizecount = segsizecount((unsigned) seg, modptr));
-#ifndef EDOS
-
- /* adjust sizes to even to get quad boundaries */
- /* this should be specifiable dynamically */
- segsz[seg] = ld_roundup(segsz[seg], 4, offset_t);
- comsz[seg] = ld_roundup(comsz[seg], 4, offset_t);
-#endif
- cptr += sizecount;
- }
- }
-
- /* calculate seg positions now their sizes are known */
- /* temp use fixed order 0D 0C 1D 1C 2D 2C ... */
- /* assume seg 0 is text and rest are data */
-#ifdef EDOS
- if (btextoffset == 0)
- btextoffset = binheaderlength(commandname);
-#endif
- segpos[0] = segbase[0] = spos = btextoffset;
- combase[0] = segbase[0] + segsz[0];
- segadj[1] = segadj[0] = -btextoffset;
- etextpadoff = etextoffset = combase[0] + comsz[0];
- if (sepid)
- {
- etextpadoff = ld_roundup(etextoffset, 0x10, offset_t);
- segadj[1] += etextpadoff - bdataoffset;
- }
- else if (bdataoffset == 0)
- bdataoffset = etextpadoff;
- segpos[1] = segbase[1] = edataoffset = bdataoffset;
- combase[1] = segbase[1] + segsz[1];
- for (seg = 2; seg < NSEG; ++seg)
- {
- segpos[seg] = segbase[seg] = combase[seg - 1] + comsz[seg - 1];
- if (seg == DPSEG)
- {
- /* temporarily have fixed DP seg */
- /* adjust if nec so it only spans 1 page */
- tempoffset = segsz[seg] + comsz[seg];
- if (tempoffset > 0x100)
- fatalerror("direct page segment too large");
- if ((((segbase[seg] + tempoffset) ^ segbase[seg]) & ~0xFF) != 0)
- segpos[seg] = segbase[seg] = (segbase[seg] + 0xFF) & ~0xFF;
- }
- combase[seg] = segbase[seg] + segsz[seg];
- segadj[seg] = segadj[seg - 1];
- }
-
- /* relocate symbols by offsets of segments in memory */
- for (modptr = modfirst; modptr != NULL; modptr = modptr->modnext)
- if (modptr->loadflag)
- {
- register struct symstruct **symparray;
- register struct symstruct *symptr;
-
- for (symparray = modptr->symparray;
- (symptr = *symparray) != NULL; ++symparray)
- if (symptr->modptr == modptr && !(symptr->flags & A_MASK))
- {
- if (symptr->flags & (C_MASK | SA_MASK))
- {
-#ifdef BSD_A_OUT
-#if 0
- if (!reloc_output)
-#else
- if (!reloc_output || !(symptr->flags & I_MASK))
-#endif
-#endif
- symptr->value += combase[symptr->flags & SEGM_MASK];
- }
- else
-#ifdef BSD_A_OUT
- if (!reloc_output || !(symptr->flags & I_MASK))
-#endif
- symptr->value += segbase[symptr->flags & SEGM_MASK];
- }
- }
-
- /* adjust special symbols */
- for (seg = 0; seg < NSEG; ++seg)
- {
- if (segsz[seg] != 0)
- /* only count data of nonzero length */
- edataoffset = segbase[seg] + segsz[seg];
- segboundary[5] = hexdigit[seg]; /* to __segX?H */
- segboundary[6] = 'D';
- setsym(segboundary, (tempoffset = segbase[seg]) + segsz[seg]);
- /* __segXDH */
- segboundary[7] = 'L';
- setsym(segboundary, tempoffset); /* __segXDL */
- segboundary[6] = 'C';
- setsym(segboundary, tempoffset = combase[seg]);
- /* __segXCL */
- segboundary[7] = 'H';
- setsym(segboundary, tempoffset + comsz[seg]);
- /* __segXCH */
- }
- setsym("__etext", etextoffset);
- setsym("__edata", edataoffset);
- setsym("__end", endoffset = combase[NSEG - 1] + comsz[NSEG - 1]);
-
- openout(outfilename);
-#ifdef BSD_A_OUT
- if (reloc_output)
- seektrel(FILEHEADERLENGTH
- + (long) (etextpadoff - btextoffset)
- + (long) (edataoffset - bdataoffset));
-#endif
-#ifdef EDOS
- writeheader(commandname);
-#else
- writeheader();
-#endif
- for (modptr = modfirst; modptr != NULL; modptr = modptr->modnext)
- if (modptr->loadflag)
- {
- linkmod(modptr);
- padmod(modptr);
- }
-
- /* dump symbol table */
-#ifdef MINIX
- if (!stripflag)
- {
-#ifdef BSD_A_OUT
- unsigned stringoff;
-#endif
-
- seekout(FILEHEADERLENGTH
- + (long) (etextpadoff - btextoffset)
- + (long) (edataoffset - bdataoffset)
-#ifdef BSD_A_OUT
- + ((long) ndreloc + ntreloc)
- * (long) sizeof(struct relocation_info)
-#endif
- );
- extsym.n_was_numaux = extsym.n_was_type = 0;
-#ifdef BSD_A_OUT
- stringoff = 4;
-#endif
- for (modptr = modfirst; modptr != NULL; modptr = modptr->modnext)
- if (modptr->loadflag)
- {
- register struct symstruct **symparray;
- register struct symstruct *symptr;
-
- for (symparray = modptr->symparray;
- (symptr = *symparray) != NULL; ++symparray)
- if (symptr->modptr == modptr)
- {
-#ifdef BSD_A_OUT
- offtocn((char *) &extsym.n_was_strx,
- (offset_t) stringoff, 4);
-#else
- strncpy((char *) &extsym.n_was_name, symptr->name,
- sizeof extsym.n_was_name);
-#endif
- u4cn((char *) &extsym.n_value, (u4_t) symptr->value,
- sizeof extsym.n_value);
- if ((flags = symptr->flags) & A_MASK)
- extsym.n_was_sclass = N_ABS;
- else if (flags & (E_MASK | I_MASK))
- extsym.n_was_sclass = C_EXT;
- else
- extsym.n_was_sclass = C_STAT;
- if (!(flags & I_MASK) ||
-#ifdef BSD_A_OUT
- !reloc_output &&
-#endif
- flags & C_MASK)
- switch (flags & (A_MASK | SEGM_MASK))
- {
- case 0:
- extsym.n_was_sclass |= N_TEXT;
- case A_MASK:
- break;
- default:
- if (flags & (C_MASK | SA_MASK))
- extsym.n_was_sclass |= N_BSS;
- else
- extsym.n_was_sclass |= N_DATA;
- break;
- }
- writeout((char *) &extsym, sizeof extsym);
- ++nsym;
-#ifdef BSD_A_OUT
- stringoff += strlen(symptr->name) + 1;
-#endif
- }
- }
-#ifdef BSD_A_OUT
- offtocn((char *) &extsym.n_was_strx, (offset_t) stringoff, 4);
- writeout((char *) &extsym.n_was_strx, 4);
- for (modptr = modfirst; modptr != NULL; modptr = modptr->modnext)
- if (modptr->loadflag)
- {
- register struct symstruct **symparray;
- register struct symstruct *symptr;
-
- for (symparray = modptr->symparray;
- (symptr = *symparray) != NULL; ++symparray)
- if (symptr->modptr == modptr)
- writeout(symptr->name, strlen(symptr->name) + 1);
- }
-#endif
- seekout((long) offsetof(struct exec, a_syms));
- u4cn(buf4, (u4_t) nsym * sizeof extsym,
- memsizeof(struct exec, a_syms));
- writeout(buf4, memsizeof(struct exec, a_syms));
-#if defined (BSD_A_OUT) && !defined(__linux__)
- seekout((long) offsetof(struct exec, a_trsize));
- u4cn(buf4, (u4_t) ntreloc * sizeof(struct relocation_info),
- memsizeof(struct exec, a_trsize));
- writeout(buf4, memsizeof(struct exec, a_trsize));
- seekout((long) offsetof(struct exec, a_drsize));
- u4cn(buf4, (u4_t) ndreloc * sizeof(struct relocation_info),
- memsizeof(struct exec, a_drsize));
- writeout(buf4, memsizeof(struct exec, a_drsize));
-#endif
- }
-#endif /* MINIX */
- closeout();
-#ifdef BSD_A_OUT
- if (!reloc_output)
-#endif
- executable();
-}
-
-#ifdef EDOS
-
-PRIVATE unsigned binheaderlength(commandname)
-char *commandname;
-{
- unsigned count;
- char *name;
- struct entrylist *elptr;
- struct symstruct *startptr;
-
- count = 2 + 2 + 1; /* len len nul */
- startptr = findsym("start");
- for (elptr = entryfirst; elptr != NULL; elptr = elptr->elnext)
- {
- name = idconvert(elptr, commandname);
- count += strlen(name) + 1 + 2 + 1; /* nul off flg */
- ourfree(name);
- if (startptr != NULL)
- count += 6; /* LBSR $xxxx and LBRA $xxxx */
- }
- return count;
-}
-
-/* convert name of symbol (entry) list element to a Basic identifier */
-/* new name is built in storage obtained from stralloc() */
-/* the special name _main is converted to the command name first */
-/* copy upper case and numerals, convert lower case to upper, ignore rest */
-
-PRIVATE char *idconvert(elptr, commandname)
-struct entrylist *elptr;
-char *commandname;
-{
- char *name;
- char *newname;
-
- if (strcmp(name = elptr->elsymptr->name, "_main") == 0)
- name = commandname;
- newname = stralloc(name);
- {
- register char *t;
- register char *s;
-
- t = newname;
- s = name;
- do
- {
- if (*s >= '0' && *s <= '9' || *s >= 'A' && *s <= 'Z')
- *t++ = *s;
- if (*s >= 'a' && *s <= 'z')
- *t++ = *s + ('A' - 'a');
- }
- while (*s++);
- *t = 0;
- }
- if (*newname < 'A') /* numeral or null */
- fatalerror("bad entry name");
- return newname;
-}
-
-#endif /* EDOS */
-
-PRIVATE void linkmod(modptr)
-struct modstruct *modptr;
-{
- char buf[ABS_TEXT_MAX];
- int command;
- unsigned char modify;
- offset_t offset;
- int symbolnum;
- struct symstruct **symparray;
- struct symstruct *symptr;
-
- setseg(0);
- relocsize = 2;
- symparray = modptr->symparray;
- openin(modptr->filename); /* does nothing if already open */
- seekin((long) modptr->textoffset);
- while (TRUE)
- {
- if ((command = readchar()) < 0)
- prematureeof();
- modify = command & MODIFY_MASK;
- switch (command & CM_MASK)
- {
- case CM_SPECIAL:
- switch (modify)
- {
- case CM_EOT:
- segpos[curseg] = spos;
- return;
- case CM_BYTE_SIZE:
- relocsize = 1;
- break;
- case CM_WORD_SIZE:
- relocsize = 2;
- break;
- case CM_LONG_SIZE:
-#ifdef LONG_OFFSETS
- relocsize = 4;
- break;
-#else
- fatalerror("relocation by long offsets not implemented");
-#endif
- case CM_1_SKIP:
- skip(1);
- break;
- case CM_2_SKIP:
- skip(2);
- break;
- case CM_4_SKIP:
- skip(4);
- break;
- default:
- if ((modify -= CM_0_SEG) >= NSEG)
- inputerror("bad data in");
- setseg((unsigned) modify);
- break;
- }
- break;
- case CM_ABSOLUTE:
- if (modify == 0)
- modify = ABS_TEXT_MAX;
- readin(buf, (unsigned) modify);
- writeout(buf, (unsigned) modify);
- spos += (int) modify;
- break;
- case CM_OFFSET_RELOC:
- offset = readsize(relocsize);
- if (modify & R_MASK)
- offset -= (spos + relocsize);
- offtocn(buf, segbase[modify & SEGM_MASK] + offset, relocsize);
- writeout(buf, relocsize);
-#ifdef BSD_A_OUT
- if (reloc_output)
- {
- u4_t bitfield;
-
- if (curseg == 0)
- {
- ++ntreloc;
- offtocn(buf, spos, 4);
- writetrel(buf, 4);
- }
- else
- {
- ++ndreloc;
- offtocn(buf, spos - segbase[1], 4);
- writedrel(buf, 4);
- }
- if ((modify & SEGM_MASK) == 0)
- bitfield = N_TEXT;
- else
- bitfield = N_DATA;
- if (modify & R_MASK)
- bitfield |= 1L << 24;
- if (relocsize == 2)
- bitfield |= 1L << 25;
- else if (relocsize == 4)
- bitfield |= 1L << 26;
- u4cn(buf, bitfield, 4);
- if (curseg == 0)
- writetrel(buf, 4);
- else
- writedrel(buf, 4);
- }
-#endif /* BSD_A_OUT */
- spos += relocsize;
- break;
- case CM_SYMBOL_RELOC:
- symptr = symparray[symbolnum = readconvsize((unsigned)
- (modify & S_MASK ? 2 : 1))];
- offset = readconvsize((unsigned) modify & OF_MASK);
- if (modify & R_MASK)
- offset -= (spos + relocsize);
-#ifdef BSD_A_OUT
- if (!reloc_output || !(symptr->flags & I_MASK))
-#endif
- offset += symptr->value;
- offtocn(buf, offset, relocsize);
- writeout(buf, relocsize);
-#ifdef BSD_A_OUT
- if (reloc_output)
- {
- u4_t bitfield;
-
- if (curseg == 0)
- {
- ++ntreloc;
- offtocn(buf, spos, 4);
- writetrel(buf, 4);
- }
- else
- {
- ++ndreloc;
- offtocn(buf, spos - segbase[1], 4);
- writedrel(buf, 4);
- }
- if (symptr->flags & I_MASK)
- bitfield = (1L << 27) | symbolnum;
- else if ((symptr->flags & SEGM_MASK) == 0)
- bitfield = N_TEXT;
- else if (symptr->flags & (C_MASK | SA_MASK))
- bitfield = N_BSS;
- else
- bitfield = N_DATA;
- if (modify & R_MASK)
- bitfield |= 1L << 24;
- if (relocsize == 2)
- bitfield |= 1L << 25;
- else if (relocsize == 4)
- bitfield |= 1L << 26;
- u4cn(buf, bitfield, 4);
- if (curseg == 0)
- writetrel(buf, 4);
- else
- writedrel(buf, 4);
- }
-#endif /* BSD_A_OUT */
- spos += relocsize;
- }
- }
-}
-
-PRIVATE void linkrefs(modptr)
-struct modstruct *modptr;
-{
- register struct symstruct **symparray;
- register struct symstruct *symptr;
-
- modptr->loadflag = TRUE;
- for (symparray = modptr->symparray;
- (symptr = *symparray) != NULL; ++symparray)
- if (symptr->modptr->loadflag == FALSE)
- linkrefs(symptr->modptr);
-}
-
-PRIVATE void padmod(modptr)
-struct modstruct *modptr;
-{
- offset_t count;
- char seg;
- offset_t size;
- unsigned sizecount;
- char *sizeptr;
-
- for (seg = 0, sizeptr = modptr->segsize; seg < NSEG; ++seg)
- {
- size = cntooffset(sizeptr,
- sizecount = segsizecount((unsigned) seg, modptr));
- sizeptr += sizecount;
- if ((count = segpos[seg] - segbase[seg]) != size)
- size_error(seg, count, size);
-
- /* pad to quad boundary */
- /* not padding in-between common areas which sometimes get into file */
- if ((size = ld_roundup(segpos[seg], 4, offset_t) - segpos[seg]) != 0)
- {
- setseg(seg);
- writenulls(size);
- segpos[seg] = spos;
- }
- segbase[seg] = segpos[seg];
- }
-}
-
-PRIVATE void setsym(name, value)
-char *name;
-offset_t value;
-{
- struct symstruct *symptr;
-
-#ifdef BSD_A_OUT
- if (!reloc_output)
-#endif
- if ((symptr = findsym(name)) != NULL)
- symptr->value = value;
-}
-
-PRIVATE void symres(name)
-register char *name;
-{
- register struct symstruct *symptr;
-
- if ((symptr = findsym(name)) != NULL)
- {
- if ((symptr->flags & SEGM_MASK) == SEGM_MASK)
- symptr->flags &= ~SEGM_MASK | curseg;
- if (symptr->flags != (I_MASK | curseg) || symptr->value != 0)
- reserved(name);
-#ifdef BSD_A_OUT
- if (!reloc_output)
-#endif
- symptr->flags = E_MASK | curseg; /* show defined, not common */
- }
-}
-
-/* set new segment */
-
-PRIVATE void setseg(newseg)
-unsigned newseg;
-{
- if (newseg != curseg)
- {
- segpos[curseg] = spos;
- spos = segpos[curseg = newseg];
- seekout(FILEHEADERLENGTH + (long) spos + (long) segadj[curseg]);
- }
-}
-
-PRIVATE void skip(countsize)
-unsigned countsize;
-{
- writenulls((offset_t) readsize(countsize));
-}
-
-#ifdef EDOS
-
-PRIVATE void writeheader(commandname)
-char *commandname;
-{
- char buf[MAX_OFFSET_SIZE];
- offset_t offset;
- unsigned headlength;
- char *name;
- struct entrylist *elptr;
- struct symstruct *startptr;
-
- headlength = binheaderlength(commandname);
- for (elptr = entryfirst; elptr != NULL; elptr = elptr->elnext)
- headlength -= 6;
- offset = headlength;
- startptr = findsym("start");
- offtocn(buf, edataoffset, 2);
- writeout(buf, 2);
- writechar(0xFF); /* dummy data length 0xFFFF takes everything */
- writechar(0xFF);
- for (elptr = entryfirst; elptr != NULL; elptr = elptr->elnext)
- {
- name = idconvert(elptr, commandname);
- writeout(name, (unsigned) strlen(name) + 1);
- ourfree(name);
- offtocn(buf, startptr == NULL ? elptr->elsymptr->value : offset, 2);
- writeout(buf, 2);
- writechar(0x82); /* 8 = set flags from here, 2 = cmd line */
- offset += 6; /* LBSR $xxxx and LBRA $xxxx */
- }
- writechar(0);
- if (startptr != NULL)
- {
- offset = headlength + 3; /* over 1st LBSR */
- for (elptr = entryfirst; elptr != NULL; elptr = elptr->elnext)
- {
- writechar(0x17); /* LBSR */
- offtocn(buf, startptr->value - offset, 2);
- writeout(buf, 2);
- writechar(0x16); /* LBRA */
- offtocn(buf, elptr->elsymptr->value - offset - 3, 2);
- writeout(buf, 2);
- offset += 6;
- }
- }
-}
-
-#endif /* EDOS */
-
-#ifdef MINIX
-
-PRIVATE void writeheader()
-{
- struct exec header;
-
- memset(&header, 0, sizeof header);
- header.a_magic[0] = A_MAGIC0;
- header.a_magic[1] = A_MAGIC1;
-#ifdef BSD_A_OUT
- if (!reloc_output)
-#endif
- {
- header.a_flags = sepid ? A_SEP : A_EXEC;
- if (uzp)
- header.a_flags |= A_UZP;
- }
-#ifdef BSD_A_OUT
- header.a_cpu = (bits32 || reloc_output) ? A_I80386 : A_I8086;
-#else
- header.a_cpu = bits32 ? A_I80386 : A_I8086;
-#endif
- header.a_hdrlen = FILEHEADERLENGTH;
- offtocn((char *) &header.a_text, etextpadoff - btextoffset,
- sizeof header.a_text);
- offtocn((char *) &header.a_data, edataoffset - bdataoffset,
- sizeof header.a_data);
- offtocn((char *) &header.a_bss, endoffset - edataoffset,
- sizeof header.a_bss);
-#ifdef BSD_A_OUT
- if (!reloc_output)
-#endif
- {
- if (uzp)
- offtocn((char *) &header.a_entry, page_size(),
- sizeof header.a_entry);
- offtocn((char *) &header.a_total, (offset_t)
- (endoffset < 0x00010000L ? 0x00010000L : endoffset + 0x0008000L),
- sizeof header.a_total);
- }
- writeout((char *) &header, FILEHEADERLENGTH);
-}
-
-#endif /* MINIX */
-
-PRIVATE void writenulls(count)
-offset_t count;
-{
- spos += count;
- while (count--)
- writechar(0);
-}