This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Patch to provide m68k simulator to gdb


DJ Delorie and I have integrated the m68k emulator from the Un*x Amiga
Emulator (UAE) with gdb. UAE is GPL'ed software. The ChangeLog entries
and patch file are attached to this mail.  I would like to get this
incorporated into gdb. Other people might find this patch useful.

-Will Cohen
2001-02-27  Will Cohen  <wcohen@redhat.com>

	* src/dejagnu/baseboards/m68k-sim.exp: New file.
	* src/gdb/config/m68k/monitor.mt (SIM_OBJS): Added.
	(SIM): Added.
	* src/sim/configure: Added entry for m68k.
	* src/sim/configure.in: Added entry for m68k.


In sim/m68k:

2001-02-27  Will Cohen  <wcohen@redhat.com>

	* ChangeLog: New file.
	* README: New file.
	* Makefile.in: New file.
	* compiler.h: New file.
	* config.h: New file.
	* config.in: New file.
	* configure: New file.
	* gencpu.c: New file.
	* missing.c: New file.
	* custom.h: New file.
	* fpp.c: New file.
	* include/autoconf.h: New file.
	* include/debug.h: New file.
	* include/ersatz.h: New file.
	* include/memory.h: New file.
	* include/options.h: New file.
	* include/readcpu.h: New file.
	* include/sysdeps.h: New file.
	* include/uae.h: New file.
	* include/uaeexe.h: New file.
	* include/zfile.h: New file.
	* interp.c: New file.
	* machdep/m68k.h: New file.
	* machdep/maccess.h: New file.
	* machdep/rpt.h: New file.
	* md-fpp.h: New file.
 	* memory.c: New file.
	* newcpu.c: New file.
	* newcpu.h: New file.
	* readcpu.c: New file.
	* support.c: New file.
	* sysconfig.h: New file.
	* table68k: New file.
	* target.h: New file.
	* build68k.c: New file.
diff -Nrc3p /dunes/wcohen/virg-netgdb/src/dejagnu/baseboards/m68k-sim.exp src/dejagnu/baseboards/m68k-sim.exp
*** /dunes/wcohen/virg-netgdb/src/dejagnu/baseboards/m68k-sim.exp	Wed Dec 31 19:00:00 1969
--- src/dejagnu/baseboards/m68k-sim.exp	Tue Feb 27 16:27:10 2001
***************
*** 0 ****
--- 1,27 ----
+ # Load the generic configuration for this board. This will define a basic
+ # set of routines needed by the tool to communicate with the board.
+ load_generic_config "sim";
+ 
+ # basic-sim.exp is a basic description for the standard Cygnus simulator.
+ load_base_board_description "basic-sim";
+ 
+ # This tells it which directory to look in for the simulator.
+ setup_sim m68k;
+ 
+ # No multilib flags are set by default.
+ process_multilib_options "";
+ 
+ # The compiler used to build for this board. This has *nothing* to do
+ # with what compiler is tested if we're testing gcc.
+ set_board_info compiler "[find_gcc]";
+ set_board_info needs_status_wrapper 1
+ 
+ set_board_info cflags "[libgloss_include_flags] [newlib_include_flags]";
+ set_board_info ldflags "[libgloss_link_flags] [newlib_link_flags]";
+ 
+ # No linker script for this board.
+ set_board_info ldscript "-Tsim.ld";
+ 
+ # And, it can't do arguments, and doesn't have real signals.
+ set_board_info noargs 1;
+ set_board_info gdb,nosignals 1;
diff -Nrc3p /dunes/wcohen/virg-netgdb/src/gdb/config/m68k/monitor.mt src/gdb/config/m68k/monitor.mt
*** /dunes/wcohen/virg-netgdb/src/gdb/config/m68k/monitor.mt	Thu Apr 15 21:34:21 1999
--- src/gdb/config/m68k/monitor.mt	Tue Feb 27 16:25:08 2001
***************
*** 1,3 ****
--- 1,6 ----
  # Target: Motorola m68k embedded (EST emulator, rom68k and bug monitors)
  TDEPFILES= m68k-tdep.o monitor.o remote-est.o cpu32bug-rom.o rom68k-rom.o abug-rom.o dbug-rom.o dsrec.o
  TM_FILE= tm-monitor.h
+ 
+ SIM_OBS = remote-sim.o
+ SIM = ../sim/m68k/libsim.a
diff -Nrc3p /dunes/wcohen/virg-netgdb/src/sim/configure src/sim/configure
*** /dunes/wcohen/virg-netgdb/src/sim/configure	Wed Nov 29 20:55:11 2000
--- src/sim/configure	Tue Feb 27 16:21:22 2001
*************** case "${target}" in
*** 1431,1436 ****
--- 1431,1437 ----
    i960-*-*)		sim_target=i960 ;;
    m32r-*-*)		sim_target=m32r ;;
    m68hc11-*-*|m6811-*-*) sim_target=m68hc11 ;;
+   m68k*-*-*)		sim_target=m68k ;;
    mcore-*-*)		sim_target=mcore ;;
    mips*-*-*)
  	# The MIPS simulator can only be compiled by gcc.
diff -Nrc3p /dunes/wcohen/virg-netgdb/src/sim/configure.in src/sim/configure.in
*** /dunes/wcohen/virg-netgdb/src/sim/configure.in	Wed Nov 29 20:55:11 2000
--- src/sim/configure.in	Tue Feb 27 16:22:42 2001
*************** case "${target}" in
*** 70,75 ****
--- 70,76 ----
    i960-*-*)		sim_target=i960 ;;
    m32r-*-*)		sim_target=m32r ;;
    m68hc11-*-*|m6811-*-*) sim_target=m68hc11 ;;
+   m68k*-*-*)		sim_target=m68k ;;
    mcore-*-*)		sim_target=mcore ;;
    mips*-*-*)
  	# The MIPS simulator can only be compiled by gcc.
diff -Nrc3p /dunes/wcohen/virg-netgdb/src/sim/m68k/ChangeLog src/sim/m68k/ChangeLog
*** /dunes/wcohen/virg-netgdb/src/sim/m68k/ChangeLog	Wed Dec 31 19:00:00 1969
--- src/sim/m68k/ChangeLog	Tue Feb 27 11:36:40 2001
***************
*** 0 ****
--- 1,37 ----
+ 2001-02-27  Will Cohen  <wcohen@redhat.com>
+ 
+ 	* ChangeLog: New file.
+ 	* README: New file.
+ 	* Makefile.in: New file.
+ 	* compiler.h: New file.
+ 	* config.h: New file.
+ 	* config.in: New file.
+ 	* configure: New file.
+ 	* gencpu.c: New file.
+ 	* missing.c: New file.
+ 	* custom.h: New file.
+ 	* fpp.c: New file.
+ 	* include/autoconf.h: New file.
+ 	* include/debug.h: New file.
+ 	* include/ersatz.h: New file.
+ 	* include/memory.h: New file.
+ 	* include/options.h: New file.
+ 	* include/readcpu.h: New file.
+ 	* include/sysdeps.h: New file.
+ 	* include/uae.h: New file.
+ 	* include/uaeexe.h: New file.
+ 	* include/zfile.h: New file.
+ 	* interp.c: New file.
+ 	* machdep/m68k.h: New file.
+ 	* machdep/maccess.h: New file.
+ 	* machdep/rpt.h: New file.
+ 	* md-fpp.h: New file.
+ 	* memory.c: New file.
+ 	* newcpu.c: New file.
+ 	* newcpu.h: New file.
+ 	* readcpu.c: New file.
+ 	* support.c: New file.
+ 	* sysconfig.h: New file.
+ 	* table68k: New file.
+ 	* target.h: New file.
+ 	* build68k.c: New file.
diff -Nrc3p /dunes/wcohen/virg-netgdb/src/sim/m68k/Makefile.in src/sim/m68k/Makefile.in
*** /dunes/wcohen/virg-netgdb/src/sim/m68k/Makefile.in	Wed Dec 31 19:00:00 1969
--- src/sim/m68k/Makefile.in	Tue Feb 27 11:07:21 2001
***************
*** 0 ****
--- 1,68 ----
+ #    Makefile template for Configure for the m68k sim library.
+ #    Copyright (C) 2001 Free Software Foundation, Inc.
+ #    Written by Cygnus Support.
+ # 
+ # This program is free software; you can redistribute it and/or modify
+ # it under the terms of the GNU General Public License as published by
+ # the Free Software Foundation; either version 2 of the License, or
+ # (at your option) any later version.
+ # 
+ # This program 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 General Public License for more details.
+ # 
+ # You should have received a copy of the GNU General Public License
+ # along with this program; if not, write to the Free Software
+ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ 
+ ## COMMON_PRE_CONFIG_FRAG
+ 
+ SIM_OBJS = interp.o sim-load.o cpuemu.o memory.o newcpu.o cpustbl.o fpp.o support.o \
+ 	readcpu.o cpudefs.o
+ SIM_EXTRA_LIBS = -lm
+ SIM_EXTRA_CLEAN = m68k-clean
+ # NOTE -DREGPARAM define is a hack.
+ SIM_EXTRA_CFLAGS = -DHAVE_ENDIAN_H=1 -I$(srcdir)/include -DREGPARAM="__attribute__((regparm(3)))" \
+ 	-DNO_INLINE_MEMORY_ACCESS -DSIM_HAVE_ENVIRONMENT -DSIM_M68K -MMD
+ 
+ # Flags to use when cross-building m68k sim.
+ # Prefix to apply to names of object files when using them
+ # to run on the machine we are compiling on.
+ HOST_PREFIX=
+ # Prefix to apply to names of object files when compiling them
+ # to run on the machine we are compiling on.
+ # The default for this variable is chosen to keep these rules
+ # out of the way of the other rules for compiling the same source files.
+ HOST_PREFIX_1=loser-
+ HOST_CC=$(CC)
+ HOST_CFLAGS=$(ALL_CFLAGS) -DGENERATOR_FILE
+ HOST_CLIB=$(CLIB)
+ HOST_LDFLAGS=$(LDFLAGS)
+ HOST_CPPFLAGS=$(ALL_CPPFLAGS)
+ HOST_ALLOCA=$(ALLOCA)
+ HOST_MALLOC=$(MALLOC)
+ HOST_OBSTACK=$(OBSTACK)
+ HOST_VFPRINTF=$(VFPRINTF)
+ HOST_DOPRINT=$(DOPRINT)
+ 
+ 
+ ## COMMON_POST_CONFIG_FRAG
+ 
+ gencpu: gencpu.o readcpu.o cpudefs.o missing.o
+ 	$(HOST_CC) $(HOST_LDFLAGS) -o gencpu gencpu.o readcpu.o \
+ 			missing.o cpudefs.o
+ 
+ build68k: build68k.o
+ 	$(HOST_CC) $(HOST_LDFLAGS) -o build68k build68k.o
+ 
+ 
+ cpudefs.c: build68k $(srcdir)/table68k
+ 	./build68k <$(srcdir)/table68k >cpudefs.c
+ 
+ cpuemu.c cpustbl.c cputbl.h: gencpu
+ 	./gencpu
+ 
+ m68k-clean:
+ 	-rm -f build68k cpudefs.c 
+ 	-rm -f gencpu cpuemu.c cpustbl.c cputbl.h
diff -Nrc3p /dunes/wcohen/virg-netgdb/src/sim/m68k/README src/sim/m68k/README
*** /dunes/wcohen/virg-netgdb/src/sim/m68k/README	Wed Dec 31 19:00:00 1969
--- src/sim/m68k/README	Tue Feb 27 11:56:48 2001
***************
*** 0 ****
--- 1,24 ----
+ This is the m68k simulator directory.
+ 
+ It is still work-in-progress.  The code in this directory borrows
+ heavily from the ../sim/sh directory and the Un*x Amiga Emulator, both
+ GPL'ed pieces of software. The framework to interface the simulator
+ comes from ../sim/sh and the core m68k emulator is from UAE.
+ 
+ The UAE software can be obtained from:
+ 
+ http://www.freiburg.linux.de/~uae/
+ 
+ The integration has been done in such a manner to avoid making changes
+ to the the machine-generated files and code that produces the
+ machine-generated files. This allows future enhancements to the core
+ m68k emulator to be easily shared between UAE and this simulator.
+ 
+ The initial integration of the the m68k emulator was performed by
+ William Cohen (wcohen@redhat.com) and DJ Delorie (dj@redhat.com).
+ 
+ Will
+ 
+ wcohen@redhat.com
+ 
+ Tue Feb 27 11:56:35 EST 2001
diff -Nrc3p /dunes/wcohen/virg-netgdb/src/sim/m68k/build68k.c src/sim/m68k/build68k.c
*** /dunes/wcohen/virg-netgdb/src/sim/m68k/build68k.c	Wed Dec 31 19:00:00 1969
--- src/sim/m68k/build68k.c	Tue Feb 27 10:42:10 2001
***************
*** 0 ****
--- 1,246 ----
+ /*
+  * UAE - The Un*x Amiga Emulator
+  *
+  * Read 68000 CPU specs from file "table68k" and build table68k.c
+  *
+  * Copyright 1995,1996 Bernd Schmidt
+  */
+ 
+ #include "sysconfig.h"
+ #include "sysdeps.h"
+ 
+ #include <assert.h>
+ #include <ctype.h>
+ 
+ #include "config.h"
+ #include "options.h"
+ #include "readcpu.h"
+ 
+ static FILE *tablef;
+ static int nextch = 0;
+ 
+ static void getnextch(void)
+ {
+     do {
+ 	nextch = fgetc(tablef);
+ 	if (nextch == '%') {
+ 	    do {
+ 		nextch = fgetc(tablef);
+ 	    } while (nextch != EOF && nextch != '\n');
+ 	}
+     } while (nextch != EOF && isspace(nextch));
+ }
+ 
+ static int nextchtohex(void)
+ {
+     switch (isupper (nextch) ? tolower (nextch) : nextch) {
+      case '0': return 0;
+      case '1': return 1;
+      case '2': return 2;
+      case '3': return 3;
+      case '4': return 4;
+      case '5': return 5;
+      case '6': return 6;
+      case '7': return 7;
+      case '8': return 8;
+      case '9': return 9;
+      case 'a': return 10;
+      case 'b': return 11;
+      case 'c': return 12;
+      case 'd': return 13;
+      case 'e': return 14;
+      case 'f': return 15;
+      default: abort();
+     }
+ }
+ 
+ int main(int argc, char **argv)
+ {
+     int no_insns = 0;
+ 
+     printf ("#include \"sysconfig.h\"\n");
+     printf ("#include \"sysdeps.h\"\n");
+     printf ("#include \"config.h\"\n");
+     printf ("#include \"options.h\"\n");
+     printf ("#include \"readcpu.h\"\n");
+     printf ("struct instr_def defs68k[] = {\n");
+ #if 0
+     tablef = fopen("table68k","r");
+     if (tablef == NULL) {
+ 	fprintf(stderr, "table68k not found\n");
+ 	exit(1);
+     }
+ #else
+     tablef = stdin;
+ #endif
+     getnextch();
+     while (nextch != EOF) {
+ 	int cpulevel, plevel, sduse;
+ 	int i;
+ 
+ 	char patbits[16];
+ 	char opcstr[256];
+ 	int bitpos[16];
+ 	int flagset[5], flaguse[5];
+ 
+ 	unsigned int bitmask,bitpattern;
+ 	int n_variable;
+ 
+ 	n_variable = 0;
+ 	bitmask = bitpattern = 0;
+ 	memset (bitpos, 0, sizeof(bitpos));
+ 	for(i=0; i<16; i++) {
+ 	    int currbit;
+ 	    bitmask <<= 1;
+ 	    bitpattern <<= 1;
+ 
+ 	    switch (nextch) {
+ 	     case '0': currbit = bit0; bitmask |= 1; break;
+ 	     case '1': currbit = bit1; bitmask |= 1; bitpattern |= 1; break;
+ 	     case 'c': currbit = bitc; break;
+ 	     case 'C': currbit = bitC; break;
+ 	     case 'f': currbit = bitf; break;
+ 	     case 'i': currbit = biti; break;
+ 	     case 'I': currbit = bitI; break;
+ 	     case 'j': currbit = bitj; break;
+ 	     case 'J': currbit = bitJ; break;
+ 	     case 'k': currbit = bitk; break;
+ 	     case 'K': currbit = bitK; break;
+ 	     case 's': currbit = bits; break;
+ 	     case 'S': currbit = bitS; break;
+ 	     case 'd': currbit = bitd; break;
+ 	     case 'D': currbit = bitD; break;
+ 	     case 'r': currbit = bitr; break;
+ 	     case 'R': currbit = bitR; break;
+ 	     case 'z': currbit = bitz; break;
+ 	     default: abort();
+ 	    }
+ 	    if (!(bitmask & 1)) {
+ 		bitpos[n_variable] = currbit;
+ 		n_variable++;
+ 	    }
+ 
+ 	    if (nextch == '0' || nextch == '1')
+ 		bitmask |= 1;
+ 	    if (nextch == '1')
+ 		bitpattern |= 1;
+ 	    patbits[i] = nextch;
+ 	    getnextch();
+ 	}
+ 
+ 	while (isspace(nextch) || nextch == ':') /* Get CPU and privilege level */
+ 	    getnextch();
+ 
+ 	switch (nextch) {
+ 	 case '0': cpulevel = 0; break;
+ 	 case '1': cpulevel = 1; break;
+ 	 case '2': cpulevel = 2; break;
+ 	 case '3': cpulevel = 3; break;
+ 	 case '4': cpulevel = 4; break;
+ 	 default: abort();
+ 	}
+ 	getnextch();
+ 
+ 	switch (nextch) {
+ 	 case '0': plevel = 0; break;
+ 	 case '1': plevel = 1; break;
+ 	 case '2': plevel = 2; break;
+ 	 case '3': plevel = 3; break;
+ 	 default: abort();
+ 	}
+ 	getnextch();
+ 
+ 	while (isspace(nextch))                   /* Get flag set information */
+ 	    getnextch();
+ 
+ 	if (nextch != ':')
+ 	    abort();
+ 
+ 	for(i = 0; i < 5; i++) {
+ 	    getnextch();
+ 	    switch(nextch){
+ 	     case '-': flagset[i] = fa_unset; break;
+ 	     case '/': flagset[i] = fa_isjmp; break;
+ 	     case '0': flagset[i] = fa_zero; break;
+ 	     case '1': flagset[i] = fa_one; break;
+ 	     case 'x': flagset[i] = fa_dontcare; break;
+ 	     case '?': flagset[i] = fa_unknown; break;
+ 	     default: flagset[i] = fa_set; break;
+ 	    }
+ 	}
+ 
+ 	getnextch();
+ 	while (isspace(nextch))
+ 	    getnextch();
+ 
+ 	if (nextch != ':')                        /* Get flag used information */
+ 	    abort();
+ 
+ 	for(i = 0; i < 5; i++) {
+ 	    getnextch();
+ 	    switch(nextch){
+ 	     case '-': flaguse[i] = fu_unused; break;
+ 	     case '/': flaguse[i] = fu_isjmp; break;
+ 	     case '+': flaguse[i] = fu_maybecc; break;
+ 	     case '?': flaguse[i] = fu_unknown; break;
+ 	     default: flaguse[i] = fu_used; break;
+ 	    }
+ 	}
+ 
+ 	getnextch();
+ 	while (isspace(nextch))
+ 	    getnextch();
+ 
+ 	if (nextch != ':')                        /* Get source/dest usage information */
+ 	    abort();
+ 
+ 	getnextch();
+ 	sduse = nextchtohex() << 4;
+ 	getnextch();
+ 	sduse |= nextchtohex();
+ 
+ 	getnextch();
+ 	while (isspace(nextch))
+ 	    getnextch();
+ 
+ 	if (nextch != ':')
+ 	    abort();
+ 
+ 	fgets(opcstr, 250, tablef);
+ 	getnextch();
+ 	{
+ 	    int j;
+ 	    /* Remove superfluous spaces from the string */
+ 	    char *opstrp = opcstr, *osendp;
+ 	    int slen = 0;
+ 
+ 	    while (isspace(*opstrp))
+ 		opstrp++;
+ 
+ 	    osendp = opstrp;
+ 	    while (*osendp) {
+ 		if (!isspace (*osendp))
+ 		    slen = osendp - opstrp + 1;
+ 		osendp++;
+ 	    }
+ 	    opstrp[slen] = 0;
+ 
+ 	    if (no_insns > 0)
+ 		printf(",\n");
+ 	    no_insns++;
+ 	    printf("{ %d, %d, {", bitpattern, n_variable);
+ 	    for (j = 0; j < 16; j++) {
+ 		printf("%d", bitpos[j]);
+ 		if (j < 15)
+ 		    printf(",");
+ 	    }
+ 	    printf ("}, %d, %d, %d, { ", bitmask, cpulevel, plevel);
+ 	    for(i = 0; i < 5; i++) {
+ 		printf("{ %d, %d }%c ", flaguse[i], flagset[i], i == 4 ? ' ' : ',');
+ 	    }
+ 	    printf("}, %d, \"%s\"}", sduse, opstrp);
+ 	}
+     }
+     printf("};\nint n_defs68k = %d;\n", no_insns);
+     return 0;
+ }
diff -Nrc3p /dunes/wcohen/virg-netgdb/src/sim/m68k/compiler.h src/sim/m68k/compiler.h
*** /dunes/wcohen/virg-netgdb/src/sim/m68k/compiler.h	Wed Dec 31 19:00:00 1969
--- src/sim/m68k/compiler.h	Mon Feb 19 14:10:23 2001
***************
*** 0 ****
--- 1,111 ----
+  /*
+   * UAE - The Un*x Amiga Emulator
+   *
+   * m68k -> i386 compiler
+   *
+   * (c) 1995 Bernd Schmidt
+   */
+ 
+ typedef uaecptr (*code_execfunc)(void);
+ 
+ struct code_page {
+     struct code_page *next;
+     uae_u32 allocmask;
+ };
+ 
+ struct hash_block {
+     struct hash_block *lru_next, *lru_prev;
+     struct hash_entry *he_first;
+ 
+     struct code_page *cpage;
+     int alloclen;
+     uae_u32 page_allocmask;
+     char *compile_start;
+ 
+     int nrefs;
+ 
+     int translated:1;
+     int untranslatable:1;
+     int allocfailed:1;
+ };
+ 
+ struct hash_entry {
+     code_execfunc execute; /* For the sake of the stubs in X86.S */
+     struct hash_entry *next,*prev;
+     struct hash_entry *next_same_block, *lru_next, *lru_prev;
+     struct hash_block *block;
+ 
+     uaecptr addr;
+     uae_u32 matchword;
+     int ncalls:8;
+     int locked:1;
+     int cacheflush:1;
+ };
+ 
+ extern int nr_bbs_start;
+ extern uae_u8 nr_bbs_to_run;
+ extern code_execfunc exec_me;
+ 
+ #ifdef USE_COMPILER
+ STATIC_INLINE void run_compiled_code(void)
+ {
+ 
+     /*if (regs.spcflags == SPCFLAG_EXEC && may_run_compiled) {*/
+ 	while (regs.spcflags == SPCFLAG_EXEC) {
+ 	    uaecptr newpc;
+ 	    regs.spcflags = 0;
+ 	    /*		newpc = (*exec_me)();*/
+ 	    __asm__ __volatile__ ("pushl %%ebp; call *%1; popl %%ebp" : "=a" (newpc) : "r" (exec_me) :
+ 				  "%eax", "%edx", "%ecx", "%ebx",
+ 				  "%edi", "%esi", "memory", "cc");
+ 	    if (nr_bbs_to_run == 0) {
+ 		struct hash_entry *h = (struct hash_entry *)newpc;
+ 		regs.spcflags = SPCFLAG_EXEC;
+ 		exec_me = h->execute;
+ 		regs.pc = h->addr;
+ 		regs.pc_p = regs.pc_oldp = get_real_address(h->addr);
+ 		nr_bbs_to_run = nr_bbs_start;
+ 	    } else
+ 		m68k_setpc_fast(newpc);
+ 	    do_cycles();
+ 	}
+ /*} else */
+ 	regs.spcflags &= ~SPCFLAG_EXEC;
+ }
+ 
+ extern void compiler_init(void);
+ extern void possible_loadseg(void);
+ 
+ extern void m68k_do_rts(void);
+ extern void m68k_do_bsr(uaecptr, uae_s32);
+ extern void m68k_do_jsr(uaecptr, uaecptr);
+ extern void compiler_flush_jsr_stack(void);
+ 
+ #else
+ 
+ #define run_compiled_code() do { ; } while (0)
+ #define compiler_init() do { ; } while (0)
+ #define possible_loadseg() do { ; } while (0)
+ #define compiler_flush_jsr_stack() do { ; } while (0)
+ 
+ STATIC_INLINE void m68k_do_rts(void)
+ {
+     m68k_setpc(get_long(m68k_areg(regs, 7)));
+     m68k_areg(regs, 7) += 4;
+ }
+ 
+ STATIC_INLINE void m68k_do_bsr(uaecptr oldpc, uae_s32 offset)
+ {
+     m68k_areg(regs, 7) -= 4;
+     put_long(m68k_areg(regs, 7), oldpc);
+     m68k_incpc(offset);
+ }
+ 
+ STATIC_INLINE void m68k_do_jsr(uaecptr oldpc, uaecptr dest)
+ {
+     m68k_areg(regs, 7) -= 4;
+     put_long(m68k_areg(regs, 7), oldpc);
+     m68k_setpc(dest);
+ }
+ 
+ #endif
diff -Nrc3p /dunes/wcohen/virg-netgdb/src/sim/m68k/config.h src/sim/m68k/config.h
*** /dunes/wcohen/virg-netgdb/src/sim/m68k/config.h	Wed Dec 31 19:00:00 1969
--- src/sim/m68k/config.h	Mon Feb 19 14:10:23 2001
***************
*** 0 ****
--- 1,77 ----
+  /* 
+   * UAE - The Un*x Amiga Emulator
+   * 
+   * User configuration options
+   *
+   * Copyright 1995 - 1998 Bernd Schmidt
+   */
+ 
+ /*
+  * Please note: Many things are configurable with command line parameters,
+  * and you can put anything you can pass on the command line into a 
+  * configuration file ~/.uaerc. Please read the documentation for more
+  * information.
+  * 
+  * NOTE NOTE NOTE
+  * Whenever you change something in this file, you have to "make clean"
+  * afterwards.
+  * Don't remove the '#' signs. If you want to enable something, move it out
+  * of the C comment block, if you want to disable something, move it inside
+  * the block.
+  */
+ 
+ /*
+  * When USE_COMPILER is defined, a m68k->i386 instruction compiler will be
+  * used. This is experimental. It has only been tested on a Linux/i386 ELF
+  * machine, although it might work on other i386 Unices.
+  * This is supposed to speed up application programs. It will not work very
+  * well for hardware bangers like games and demos, in fact it will be much
+  * slower. It can also be slower for some applications and/or benchmarks.
+  * It needs a lot of tuning. Please let me know your results with this.
+  * The second define, RELY_ON_LOADSEG_DETECTION, decides how the compiler 
+  * tries to detect self-modifying code. If it is not set, the first bytes
+  * of every compiled routine are used as checksum before executing the
+  * routine. If it is set, the UAE filesystem will perform some checks to 
+  * detect whether an executable is being loaded. This is less reliable
+  * (it won't work if you don't use the harddisk emulation, so don't try to
+  * use floppies or even the RAM disk), but much faster.
+  *
+  * @@@ NOTE: This option is unfortunately broken in this version. Don't
+  * try to use it. @@@
+  *
+ #define USE_COMPILER
+ #define RELY_ON_LOADSEG_DETECTION
+  */
+ 
+ /*
+  * Set USER_PROGRAMS_BEHAVE to 1 or 2 to indicate that you are only running
+  * non-hardware banging programs which leave all the dirty work to the
+  * Kickstart. This affects the compiler. Any program that is _not_ in the ROM
+  * (i.e. everything but the Kickstart) will use faster memory access 
+  * functions.
+  * There is of course the problem that the Amiga doesn't really distinguish
+  * between user programs and the kernel. Not all of the OS is in the ROM,
+  * e.g. the parallel.device is on the disk and gets loaded into RAM at least
+  * with Kickstart 1.3 (don't know about newer Kickstarts). So you probably
+  * can't print, and some other stuff may also fail to work.
+  * A useless option, really, given the way lots of Amiga software is written.
+ #define USER_PROGRAMS_BEHAVE 0
+  */
+ 
+ /***************************************************************************
+  * Operating system/machine specific options
+  * Configure these for your CPU. The default settings should work on any
+  * machine, but may not give optimal performance everywhere.
+  * (These don't do very much yet, except HAVE_RDTSC
+  */
+ 
+ /*
+  * Define this on PPro's, K6's and maybe other non-x86 CPUs.
+ #define MULTIPLICATION_PROFITABLE
+  */
+ 
+ /*
+  * PPros don't like branches. With this option, UAE tries to avoid them in some
+  * places.
+ #define BRANCHES_ARE_EXPENSIVE
+  */
diff -Nrc3p /dunes/wcohen/virg-netgdb/src/sim/m68k/config.in src/sim/m68k/config.in
*** /dunes/wcohen/virg-netgdb/src/sim/m68k/config.in	Wed Dec 31 19:00:00 1969
--- src/sim/m68k/config.in	Mon Feb 19 14:10:23 2001
***************
*** 0 ****
--- 1,158 ----
+ /* config.in.  Generated automatically from configure.in by autoheader.  */
+ 
+ /* Define if using alloca.c.  */
+ #undef C_ALLOCA
+ 
+ /* Define to empty if the keyword does not work.  */
+ #undef const
+ 
+ /* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
+    This function is required for alloca.c support on those systems.  */
+ #undef CRAY_STACKSEG_END
+ 
+ /* Define if you have alloca, as a function or macro.  */
+ #undef HAVE_ALLOCA
+ 
+ /* Define if you have <alloca.h> and it should be used (not on Ultrix).  */
+ #undef HAVE_ALLOCA_H
+ 
+ /* Define if you have a working `mmap' system call.  */
+ #undef HAVE_MMAP
+ 
+ /* Define as __inline if that's what the C compiler calls it.  */
+ #undef inline
+ 
+ /* Define to `long' if <sys/types.h> doesn't define.  */
+ #undef off_t
+ 
+ /* Define if you need to in order for stat and other things to work.  */
+ #undef _POSIX_SOURCE
+ 
+ /* Define as the return type of signal handlers (int or void).  */
+ #undef RETSIGTYPE
+ 
+ /* Define to `unsigned' if <sys/types.h> doesn't define.  */
+ #undef size_t
+ 
+ /* If using the C implementation of alloca, define if you know the
+    direction of stack growth for your system; otherwise it will be
+    automatically deduced at run-time.
+  STACK_DIRECTION > 0 => grows toward higher addresses
+  STACK_DIRECTION < 0 => grows toward lower addresses
+  STACK_DIRECTION = 0 => direction of growth unknown
+  */
+ #undef STACK_DIRECTION
+ 
+ /* Define if you have the ANSI C header files.  */
+ #undef STDC_HEADERS
+ 
+ /* Define to 1 if NLS is requested.  */
+ #undef ENABLE_NLS
+ 
+ /* Define as 1 if you have gettext and don't want to use GNU gettext.  */
+ #undef HAVE_GETTEXT
+ 
+ /* Define as 1 if you have the stpcpy function.  */
+ #undef HAVE_STPCPY
+ 
+ /* Define if your locale.h file contains LC_MESSAGES.  */
+ #undef HAVE_LC_MESSAGES
+ 
+ /* Define if you have the __argz_count function.  */
+ #undef HAVE___ARGZ_COUNT
+ 
+ /* Define if you have the __argz_next function.  */
+ #undef HAVE___ARGZ_NEXT
+ 
+ /* Define if you have the __argz_stringify function.  */
+ #undef HAVE___ARGZ_STRINGIFY
+ 
+ /* Define if you have the __setfpucw function.  */
+ #undef HAVE___SETFPUCW
+ 
+ /* Define if you have the dcgettext function.  */
+ #undef HAVE_DCGETTEXT
+ 
+ /* Define if you have the getcwd function.  */
+ #undef HAVE_GETCWD
+ 
+ /* Define if you have the getpagesize function.  */
+ #undef HAVE_GETPAGESIZE
+ 
+ /* Define if you have the getrusage function.  */
+ #undef HAVE_GETRUSAGE
+ 
+ /* Define if you have the munmap function.  */
+ #undef HAVE_MUNMAP
+ 
+ /* Define if you have the putenv function.  */
+ #undef HAVE_PUTENV
+ 
+ /* Define if you have the setenv function.  */
+ #undef HAVE_SETENV
+ 
+ /* Define if you have the setlocale function.  */
+ #undef HAVE_SETLOCALE
+ 
+ /* Define if you have the sigaction function.  */
+ #undef HAVE_SIGACTION
+ 
+ /* Define if you have the stpcpy function.  */
+ #undef HAVE_STPCPY
+ 
+ /* Define if you have the strcasecmp function.  */
+ #undef HAVE_STRCASECMP
+ 
+ /* Define if you have the strchr function.  */
+ #undef HAVE_STRCHR
+ 
+ /* Define if you have the time function.  */
+ #undef HAVE_TIME
+ 
+ /* Define if you have the <argz.h> header file.  */
+ #undef HAVE_ARGZ_H
+ 
+ /* Define if you have the <fcntl.h> header file.  */
+ #undef HAVE_FCNTL_H
+ 
+ /* Define if you have the <fpu_control.h> header file.  */
+ #undef HAVE_FPU_CONTROL_H
+ 
+ /* Define if you have the <limits.h> header file.  */
+ #undef HAVE_LIMITS_H
+ 
+ /* Define if you have the <locale.h> header file.  */
+ #undef HAVE_LOCALE_H
+ 
+ /* Define if you have the <malloc.h> header file.  */
+ #undef HAVE_MALLOC_H
+ 
+ /* Define if you have the <nl_types.h> header file.  */
+ #undef HAVE_NL_TYPES_H
+ 
+ /* Define if you have the <stdlib.h> header file.  */
+ #undef HAVE_STDLIB_H
+ 
+ /* Define if you have the <string.h> header file.  */
+ #undef HAVE_STRING_H
+ 
+ /* Define if you have the <strings.h> header file.  */
+ #undef HAVE_STRINGS_H
+ 
+ /* Define if you have the <sys/param.h> header file.  */
+ #undef HAVE_SYS_PARAM_H
+ 
+ /* Define if you have the <sys/resource.h> header file.  */
+ #undef HAVE_SYS_RESOURCE_H
+ 
+ /* Define if you have the <sys/time.h> header file.  */
+ #undef HAVE_SYS_TIME_H
+ 
+ /* Define if you have the <time.h> header file.  */
+ #undef HAVE_TIME_H
+ 
+ /* Define if you have the <unistd.h> header file.  */
+ #undef HAVE_UNISTD_H
+ 
+ /* Define if you have the <values.h> header file.  */
+ #undef HAVE_VALUES_H
diff -Nrc3p /dunes/wcohen/virg-netgdb/src/sim/m68k/configure src/sim/m68k/configure
*** /dunes/wcohen/virg-netgdb/src/sim/m68k/configure	Wed Dec 31 19:00:00 1969
--- src/sim/m68k/configure	Mon Feb 19 14:10:23 2001
***************
*** 0 ****
--- 1,4024 ----
+ #! /bin/sh
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ sim_inline="-DDEFAULT_INLINE=0"
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ # This file is derived from `gettext.m4'.  The difference is that the
+ # included macros assume Cygnus-style source and build trees.
+ 
+ # Macro to add for using GNU gettext.
+ # Ulrich Drepper <drepper@cygnus.com>, 1995.
+ #
+ # This file file be copied and used freely without restrictions.  It can
+ # be used in projects which are not available under the GNU Public License
+ # but which still want to provide support for the GNU gettext functionality.
+ # Please note that the actual code is *not* freely available.
+ 
+ # serial 3
+ 
+ 
+ 
+ 
+ 
+ # Search path for a program which passes the given test.
+ # Ulrich Drepper <drepper@cygnus.com>, 1996.
+ #
+ # This file file be copied and used freely without restrictions.  It can
+ # be used in projects which are not available under the GNU Public License
+ # but which still want to provide support for the GNU gettext functionality.
+ # Please note that the actual code is *not* freely available.
+ 
+ # serial 1
+ 
+ 
+ 
+ # Check whether LC_MESSAGES is available in <locale.h>.
+ # Ulrich Drepper <drepper@cygnus.com>, 1995.
+ #
+ # This file file be copied and used freely without restrictions.  It can
+ # be used in projects which are not available under the GNU Public License
+ # but which still want to provide support for the GNU gettext functionality.
+ # Please note that the actual code is *not* freely available.
+ 
+ # serial 1
+ 
+ 
+ 
+ 
+ 
+ 
+ # Guess values for system-dependent variables and create Makefiles.
+ # Generated automatically using autoconf version 2.13 
+ # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+ #
+ # This configure script is free software; the Free Software Foundation
+ # gives unlimited permission to copy, distribute and modify it.
+ 
+ # Defaults:
+ ac_help=
+ ac_default_prefix=/usr/local
+ # Any additions from configure.in:
+ ac_help="$ac_help
+   --disable-nls           do not use Native Language Support"
+ ac_help="$ac_help
+   --with-included-gettext use the GNU gettext library included here"
+ ac_help="$ac_help
+   --enable-maintainer-mode		Enable developer functionality."
+ ac_help="$ac_help
+   --enable-sim-bswap			Use Host specific BSWAP instruction."
+ ac_help="$ac_help
+   --enable-sim-cflags=opts		Extra CFLAGS for use in building simulator"
+ ac_help="$ac_help
+   --enable-sim-debug=opts		Enable debugging flags"
+ ac_help="$ac_help
+   --enable-sim-stdio			Specify whether to use stdio for console input/output."
+ ac_help="$ac_help
+   --enable-sim-trace=opts		Enable tracing flags"
+ ac_help="$ac_help
+   --enable-sim-profile=opts		Enable profiling flags"
+ 
+ # Initialize some variables set by options.
+ # The variables have the same names as the options, with
+ # dashes changed to underlines.
+ build=NONE
+ cache_file=./config.cache
+ exec_prefix=NONE
+ host=NONE
+ no_create=
+ nonopt=NONE
+ no_recursion=
+ prefix=NONE
+ program_prefix=NONE
+ program_suffix=NONE
+ program_transform_name=s,x,x,
+ silent=
+ site=
+ sitefile=
+ srcdir=
+ target=NONE
+ verbose=
+ x_includes=NONE
+ x_libraries=NONE
+ bindir='${exec_prefix}/bin'
+ sbindir='${exec_prefix}/sbin'
+ libexecdir='${exec_prefix}/libexec'
+ datadir='${prefix}/share'
+ sysconfdir='${prefix}/etc'
+ sharedstatedir='${prefix}/com'
+ localstatedir='${prefix}/var'
+ libdir='${exec_prefix}/lib'
+ includedir='${prefix}/include'
+ oldincludedir='/usr/include'
+ infodir='${prefix}/info'
+ mandir='${prefix}/man'
+ 
+ # Initialize some other variables.
+ subdirs=
+ MFLAGS= MAKEFLAGS=
+ SHELL=${CONFIG_SHELL-/bin/sh}
+ # Maximum number of lines to put in a shell here document.
+ ac_max_here_lines=12
+ 
+ ac_prev=
+ for ac_option
+ do
+ 
+   # If the previous option needs an argument, assign it.
+   if test -n "$ac_prev"; then
+     eval "$ac_prev=\$ac_option"
+     ac_prev=
+     continue
+   fi
+ 
+   case "$ac_option" in
+   -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+   *) ac_optarg= ;;
+   esac
+ 
+   # Accept the important Cygnus configure options, so we can diagnose typos.
+ 
+   case "$ac_option" in
+ 
+   -bindir | --bindir | --bindi | --bind | --bin | --bi)
+     ac_prev=bindir ;;
+   -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+     bindir="$ac_optarg" ;;
+ 
+   -build | --build | --buil | --bui | --bu)
+     ac_prev=build ;;
+   -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+     build="$ac_optarg" ;;
+ 
+   -cache-file | --cache-file | --cache-fil | --cache-fi \
+   | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+     ac_prev=cache_file ;;
+   -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+   | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+     cache_file="$ac_optarg" ;;
+ 
+   -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+     ac_prev=datadir ;;
+   -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+   | --da=*)
+     datadir="$ac_optarg" ;;
+ 
+   -disable-* | --disable-*)
+     ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
+     # Reject names that are not valid shell variable names.
+     if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
+       { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+     fi
+     ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+     eval "enable_${ac_feature}=no" ;;
+ 
+   -enable-* | --enable-*)
+     ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
+     # Reject names that are not valid shell variable names.
+     if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
+       { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+     fi
+     ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+     case "$ac_option" in
+       *=*) ;;
+       *) ac_optarg=yes ;;
+     esac
+     eval "enable_${ac_feature}='$ac_optarg'" ;;
+ 
+   -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+   | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+   | --exec | --exe | --ex)
+     ac_prev=exec_prefix ;;
+   -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+   | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+   | --exec=* | --exe=* | --ex=*)
+     exec_prefix="$ac_optarg" ;;
+ 
+   -gas | --gas | --ga | --g)
+     # Obsolete; use --with-gas.
+     with_gas=yes ;;
+ 
+   -help | --help | --hel | --he)
+     # Omit some internal or obsolete options to make the list less imposing.
+     # This message is too long to be a string in the A/UX 3.1 sh.
+     cat << EOF
+ Usage: configure [options] [host]
+ Options: [defaults in brackets after descriptions]
+ Configuration:
+   --cache-file=FILE       cache test results in FILE
+   --help                  print this message
+   --no-create             do not create output files
+   --quiet, --silent       do not print \`checking...' messages
+   --site-file=FILE        use FILE as the site file
+   --version               print the version of autoconf that created configure
+ Directory and file names:
+   --prefix=PREFIX         install architecture-independent files in PREFIX
+                           [$ac_default_prefix]
+   --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+                           [same as prefix]
+   --bindir=DIR            user executables in DIR [EPREFIX/bin]
+   --sbindir=DIR           system admin executables in DIR [EPREFIX/sbin]
+   --libexecdir=DIR        program executables in DIR [EPREFIX/libexec]
+   --datadir=DIR           read-only architecture-independent data in DIR
+                           [PREFIX/share]
+   --sysconfdir=DIR        read-only single-machine data in DIR [PREFIX/etc]
+   --sharedstatedir=DIR    modifiable architecture-independent data in DIR
+                           [PREFIX/com]
+   --localstatedir=DIR     modifiable single-machine data in DIR [PREFIX/var]
+   --libdir=DIR            object code libraries in DIR [EPREFIX/lib]
+   --includedir=DIR        C header files in DIR [PREFIX/include]
+   --oldincludedir=DIR     C header files for non-gcc in DIR [/usr/include]
+   --infodir=DIR           info documentation in DIR [PREFIX/info]
+   --mandir=DIR            man documentation in DIR [PREFIX/man]
+   --srcdir=DIR            find the sources in DIR [configure dir or ..]
+   --program-prefix=PREFIX prepend PREFIX to installed program names
+   --program-suffix=SUFFIX append SUFFIX to installed program names
+   --program-transform-name=PROGRAM
+                           run sed PROGRAM on installed program names
+ EOF
+     cat << EOF
+ Host type:
+   --build=BUILD           configure for building on BUILD [BUILD=HOST]
+   --host=HOST             configure for HOST [guessed]
+   --target=TARGET         configure for TARGET [TARGET=HOST]
+ Features and packages:
+   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+   --x-includes=DIR        X include files are in DIR
+   --x-libraries=DIR       X library files are in DIR
+ EOF
+     if test -n "$ac_help"; then
+       echo "--enable and --with options recognized:$ac_help"
+     fi
+     exit 0 ;;
+ 
+   -host | --host | --hos | --ho)
+     ac_prev=host ;;
+   -host=* | --host=* | --hos=* | --ho=*)
+     host="$ac_optarg" ;;
+ 
+   -includedir | --includedir | --includedi | --included | --include \
+   | --includ | --inclu | --incl | --inc)
+     ac_prev=includedir ;;
+   -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+   | --includ=* | --inclu=* | --incl=* | --inc=*)
+     includedir="$ac_optarg" ;;
+ 
+   -infodir | --infodir | --infodi | --infod | --info | --inf)
+     ac_prev=infodir ;;
+   -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+     infodir="$ac_optarg" ;;
+ 
+   -libdir | --libdir | --libdi | --libd)
+     ac_prev=libdir ;;
+   -libdir=* | --libdir=* | --libdi=* | --libd=*)
+     libdir="$ac_optarg" ;;
+ 
+   -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+   | --libexe | --libex | --libe)
+     ac_prev=libexecdir ;;
+   -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+   | --libexe=* | --libex=* | --libe=*)
+     libexecdir="$ac_optarg" ;;
+ 
+   -localstatedir | --localstatedir | --localstatedi | --localstated \
+   | --localstate | --localstat | --localsta | --localst \
+   | --locals | --local | --loca | --loc | --lo)
+     ac_prev=localstatedir ;;
+   -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+   | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+   | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+     localstatedir="$ac_optarg" ;;
+ 
+   -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+     ac_prev=mandir ;;
+   -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+     mandir="$ac_optarg" ;;
+ 
+   -nfp | --nfp | --nf)
+     # Obsolete; use --without-fp.
+     with_fp=no ;;
+ 
+   -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+   | --no-cr | --no-c)
+     no_create=yes ;;
+ 
+   -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+   | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+     no_recursion=yes ;;
+ 
+   -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+   | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+   | --oldin | --oldi | --old | --ol | --o)
+     ac_prev=oldincludedir ;;
+   -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+   | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+   | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+     oldincludedir="$ac_optarg" ;;
+ 
+   -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+     ac_prev=prefix ;;
+   -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+     prefix="$ac_optarg" ;;
+ 
+   -program-prefix | --program-prefix | --program-prefi | --program-pref \
+   | --program-pre | --program-pr | --program-p)
+     ac_prev=program_prefix ;;
+   -program-prefix=* | --program-prefix=* | --program-prefi=* \
+   | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+     program_prefix="$ac_optarg" ;;
+ 
+   -program-suffix | --program-suffix | --program-suffi | --program-suff \
+   | --program-suf | --program-su | --program-s)
+     ac_prev=program_suffix ;;
+   -program-suffix=* | --program-suffix=* | --program-suffi=* \
+   | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+     program_suffix="$ac_optarg" ;;
+ 
+   -program-transform-name | --program-transform-name \
+   | --program-transform-nam | --program-transform-na \
+   | --program-transform-n | --program-transform- \
+   | --program-transform | --program-transfor \
+   | --program-transfo | --program-transf \
+   | --program-trans | --program-tran \
+   | --progr-tra | --program-tr | --program-t)
+     ac_prev=program_transform_name ;;
+   -program-transform-name=* | --program-transform-name=* \
+   | --program-transform-nam=* | --program-transform-na=* \
+   | --program-transform-n=* | --program-transform-=* \
+   | --program-transform=* | --program-transfor=* \
+   | --program-transfo=* | --program-transf=* \
+   | --program-trans=* | --program-tran=* \
+   | --progr-tra=* | --program-tr=* | --program-t=*)
+     program_transform_name="$ac_optarg" ;;
+ 
+   -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+   | -silent | --silent | --silen | --sile | --sil)
+     silent=yes ;;
+ 
+   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+     ac_prev=sbindir ;;
+   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+   | --sbi=* | --sb=*)
+     sbindir="$ac_optarg" ;;
+ 
+   -sharedstatedir | --sharedstatedir | --sharedstatedi \
+   | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+   | --sharedst | --shareds | --shared | --share | --shar \
+   | --sha | --sh)
+     ac_prev=sharedstatedir ;;
+   -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+   | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+   | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+   | --sha=* | --sh=*)
+     sharedstatedir="$ac_optarg" ;;
+ 
+   -site | --site | --sit)
+     ac_prev=site ;;
+   -site=* | --site=* | --sit=*)
+     site="$ac_optarg" ;;
+ 
+   -site-file | --site-file | --site-fil | --site-fi | --site-f)
+     ac_prev=sitefile ;;
+   -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*)
+     sitefile="$ac_optarg" ;;
+ 
+   -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+     ac_prev=srcdir ;;
+   -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+     srcdir="$ac_optarg" ;;
+ 
+   -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+   | --syscon | --sysco | --sysc | --sys | --sy)
+     ac_prev=sysconfdir ;;
+   -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+   | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+     sysconfdir="$ac_optarg" ;;
+ 
+   -target | --target | --targe | --targ | --tar | --ta | --t)
+     ac_prev=target ;;
+   -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+     target="$ac_optarg" ;;
+ 
+   -v | -verbose | --verbose | --verbos | --verbo | --verb)
+     verbose=yes ;;
+ 
+   -version | --version | --versio | --versi | --vers)
+     echo "configure generated by autoconf version 2.13"
+     exit 0 ;;
+ 
+   -with-* | --with-*)
+     ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
+     # Reject names that are not valid shell variable names.
+     if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
+       { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+     fi
+     ac_package=`echo $ac_package| sed 's/-/_/g'`
+     case "$ac_option" in
+       *=*) ;;
+       *) ac_optarg=yes ;;
+     esac
+     eval "with_${ac_package}='$ac_optarg'" ;;
+ 
+   -without-* | --without-*)
+     ac_package=`echo $ac_option|sed -e 's/-*without-//'`
+     # Reject names that are not valid shell variable names.
+     if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
+       { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+     fi
+     ac_package=`echo $ac_package| sed 's/-/_/g'`
+     eval "with_${ac_package}=no" ;;
+ 
+   --x)
+     # Obsolete; use --with-x.
+     with_x=yes ;;
+ 
+   -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+   | --x-incl | --x-inc | --x-in | --x-i)
+     ac_prev=x_includes ;;
+   -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+   | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+     x_includes="$ac_optarg" ;;
+ 
+   -x-libraries | --x-libraries | --x-librarie | --x-librari \
+   | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+     ac_prev=x_libraries ;;
+   -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+   | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+     x_libraries="$ac_optarg" ;;
+ 
+   -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
+     ;;
+ 
+   *)
+     if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
+       echo "configure: warning: $ac_option: invalid host type" 1>&2
+     fi
+     if test "x$nonopt" != xNONE; then
+       { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
+     fi
+     nonopt="$ac_option"
+     ;;
+ 
+   esac
+ done
+ 
+ if test -n "$ac_prev"; then
+   { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
+ fi
+ 
+ trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+ 
+ # File descriptor usage:
+ # 0 standard input
+ # 1 file creation
+ # 2 errors and warnings
+ # 3 some systems may open it to /dev/tty
+ # 4 used on the Kubota Titan
+ # 6 checking for... messages and results
+ # 5 compiler messages saved in config.log
+ if test "$silent" = yes; then
+   exec 6>/dev/null
+ else
+   exec 6>&1
+ fi
+ exec 5>./config.log
+ 
+ echo "\
+ This file contains any messages produced by compilers while
+ running configure, to aid debugging if configure makes a mistake.
+ " 1>&5
+ 
+ # Strip out --no-create and --no-recursion so they do not pile up.
+ # Also quote any args containing shell metacharacters.
+ ac_configure_args=
+ for ac_arg
+ do
+   case "$ac_arg" in
+   -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+   | --no-cr | --no-c) ;;
+   -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+   | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
+   *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
+   ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+   *) ac_configure_args="$ac_configure_args $ac_arg" ;;
+   esac
+ done
+ 
+ # NLS nuisances.
+ # Only set these to C if already set.  These must not be set unconditionally
+ # because not all systems understand e.g. LANG=C (notably SCO).
+ # Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
+ # Non-C LC_CTYPE values break the ctype check.
+ if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
+ if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+ if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
+ if test "${LC_CTYPE+set}"    = set; then LC_CTYPE=C;    export LC_CTYPE;    fi
+ 
+ # confdefs.h avoids OS command line length limits that DEFS can exceed.
+ rm -rf conftest* confdefs.h
+ # AIX cpp loses on an empty file, so make sure it contains at least a newline.
+ echo > confdefs.h
+ 
+ # A filename unique to this package, relative to the directory that
+ # configure is in, which we can look for to find out if srcdir is correct.
+ ac_unique_file=Makefile.in
+ 
+ # Find the source files, if location was not specified.
+ if test -z "$srcdir"; then
+   ac_srcdir_defaulted=yes
+   # Try the directory containing this script, then its parent.
+   ac_prog=$0
+   ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
+   test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
+   srcdir=$ac_confdir
+   if test ! -r $srcdir/$ac_unique_file; then
+     srcdir=..
+   fi
+ else
+   ac_srcdir_defaulted=no
+ fi
+ if test ! -r $srcdir/$ac_unique_file; then
+   if test "$ac_srcdir_defaulted" = yes; then
+     { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
+   else
+     { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+   fi
+ fi
+ srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+ 
+ # Prefer explicitly selected file to automatically selected ones.
+ if test -z "$sitefile"; then
+   if test -z "$CONFIG_SITE"; then
+     if test "x$prefix" != xNONE; then
+       CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+     else
+       CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+     fi
+   fi
+ else
+   CONFIG_SITE="$sitefile"
+ fi
+ for ac_site_file in $CONFIG_SITE; do
+   if test -r "$ac_site_file"; then
+     echo "loading site script $ac_site_file"
+     . "$ac_site_file"
+   fi
+ done
+ 
+ if test -r "$cache_file"; then
+   echo "loading cache $cache_file"
+   . $cache_file
+ else
+   echo "creating cache $cache_file"
+   > $cache_file
+ fi
+ 
+ ac_ext=c
+ # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ ac_cpp='$CPP $CPPFLAGS'
+ ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+ cross_compiling=$ac_cv_prog_cc_cross
+ 
+ ac_exeext=
+ ac_objext=o
+ if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+   # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
+   if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
+     ac_n= ac_c='
+ ' ac_t='	'
+   else
+     ac_n=-n ac_c= ac_t=
+   fi
+ else
+   ac_n= ac_c='\c' ac_t=
+ fi
+ 
+ 
+ 
+ echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+ echo "configure:679: checking how to run the C preprocessor" >&5
+ # On Suns, sometimes $CPP names a directory.
+ if test -n "$CPP" && test -d "$CPP"; then
+   CPP=
+ fi
+ if test -z "$CPP"; then
+ if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+     # This must be in double quotes, not single quotes, because CPP may get
+   # substituted into the Makefile and "${CC-cc}" will confuse make.
+   CPP="${CC-cc} -E"
+   # On the NeXT, cc -E runs the code through the compiler's parser,
+   # not just through cpp.
+   cat > conftest.$ac_ext <<EOF
+ #line 694 "configure"
+ #include "confdefs.h"
+ #include <assert.h>
+ Syntax Error
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+ { (eval echo configure:700: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+   :
+ else
+   echo "$ac_err" >&5
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+   rm -rf conftest*
+   CPP="${CC-cc} -E -traditional-cpp"
+   cat > conftest.$ac_ext <<EOF
+ #line 711 "configure"
+ #include "confdefs.h"
+ #include <assert.h>
+ Syntax Error
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+ { (eval echo configure:717: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+   :
+ else
+   echo "$ac_err" >&5
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+   rm -rf conftest*
+   CPP="${CC-cc} -nologo -E"
+   cat > conftest.$ac_ext <<EOF
+ #line 728 "configure"
+ #include "confdefs.h"
+ #include <assert.h>
+ Syntax Error
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+ { (eval echo configure:734: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+   :
+ else
+   echo "$ac_err" >&5
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+   rm -rf conftest*
+   CPP=/lib/cpp
+ fi
+ rm -f conftest*
+ fi
+ rm -f conftest*
+ fi
+ rm -f conftest*
+   ac_cv_prog_CPP="$CPP"
+ fi
+   CPP="$ac_cv_prog_CPP"
+ else
+   ac_cv_prog_CPP="$CPP"
+ fi
+ echo "$ac_t""$CPP" 1>&6
+ 
+ echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
+ echo "configure:759: checking whether ${MAKE-make} sets \${MAKE}" >&5
+ set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftestmake <<\EOF
+ all:
+ 	@echo 'ac_maketemp="${MAKE}"'
+ EOF
+ # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+ eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
+ if test -n "$ac_maketemp"; then
+   eval ac_cv_prog_make_${ac_make}_set=yes
+ else
+   eval ac_cv_prog_make_${ac_make}_set=no
+ fi
+ rm -f conftestmake
+ fi
+ if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+   echo "$ac_t""yes" 1>&6
+   SET_MAKE=
+ else
+   echo "$ac_t""no" 1>&6
+   SET_MAKE="MAKE=${MAKE-make}"
+ fi
+ 
+ echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
+ echo "configure:786: checking for POSIXized ISC" >&5
+ if test -d /etc/conf/kconfig.d &&
+   grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
+ then
+   echo "$ac_t""yes" 1>&6
+   ISC=yes # If later tests want to check for ISC.
+   cat >> confdefs.h <<\EOF
+ #define _POSIX_SOURCE 1
+ EOF
+ 
+   if test "$GCC" = yes; then
+     CC="$CC -posix"
+   else
+     CC="$CC -Xp"
+   fi
+ else
+   echo "$ac_t""no" 1>&6
+   ISC=
+ fi
+ 
+ echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
+ echo "configure:807: checking for ANSI C header files" >&5
+ if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+ #line 812 "configure"
+ #include "confdefs.h"
+ #include <stdlib.h>
+ #include <stdarg.h>
+ #include <string.h>
+ #include <float.h>
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+ { (eval echo configure:820: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+   rm -rf conftest*
+   ac_cv_header_stdc=yes
+ else
+   echo "$ac_err" >&5
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+   rm -rf conftest*
+   ac_cv_header_stdc=no
+ fi
+ rm -f conftest*
+ 
+ if test $ac_cv_header_stdc = yes; then
+   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat > conftest.$ac_ext <<EOF
+ #line 837 "configure"
+ #include "confdefs.h"
+ #include <string.h>
+ EOF
+ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+   egrep "memchr" >/dev/null 2>&1; then
+   :
+ else
+   rm -rf conftest*
+   ac_cv_header_stdc=no
+ fi
+ rm -f conftest*
+ 
+ fi
+ 
+ if test $ac_cv_header_stdc = yes; then
+   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat > conftest.$ac_ext <<EOF
+ #line 855 "configure"
+ #include "confdefs.h"
+ #include <stdlib.h>
+ EOF
+ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+   egrep "free" >/dev/null 2>&1; then
+   :
+ else
+   rm -rf conftest*
+   ac_cv_header_stdc=no
+ fi
+ rm -f conftest*
+ 
+ fi
+ 
+ if test $ac_cv_header_stdc = yes; then
+   # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then
+   :
+ else
+   cat > conftest.$ac_ext <<EOF
+ #line 876 "configure"
+ #include "confdefs.h"
+ #include <ctype.h>
+ #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+ #define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+ #define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+ int main () { int i; for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
+ exit (0); }
+ 
+ EOF
+ if { (eval echo configure:887: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+ then
+   :
+ else
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+   rm -fr conftest*
+   ac_cv_header_stdc=no
+ fi
+ rm -fr conftest*
+ fi
+ 
+ fi
+ fi
+ 
+ echo "$ac_t""$ac_cv_header_stdc" 1>&6
+ if test $ac_cv_header_stdc = yes; then
+   cat >> confdefs.h <<\EOF
+ #define STDC_HEADERS 1
+ EOF
+ 
+ fi
+ 
+ echo $ac_n "checking for working const""... $ac_c" 1>&6
+ echo "configure:911: checking for working const" >&5
+ if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+ #line 916 "configure"
+ #include "confdefs.h"
+ 
+ int main() {
+ 
+ /* Ultrix mips cc rejects this.  */
+ typedef int charset[2]; const charset x;
+ /* SunOS 4.1.1 cc rejects this.  */
+ char const *const *ccp;
+ char **p;
+ /* NEC SVR4.0.2 mips cc rejects this.  */
+ struct point {int x, y;};
+ static struct point const zero = {0,0};
+ /* AIX XL C 1.02.0.0 rejects this.
+    It does not let you subtract one const X* pointer from another in an arm
+    of an if-expression whose if-part is not a constant expression */
+ const char *g = "string";
+ ccp = &g + (g ? g-g : 0);
+ /* HPUX 7.0 cc rejects these. */
+ ++ccp;
+ p = (char**) ccp;
+ ccp = (char const *const *) p;
+ { /* SCO 3.2v4 cc rejects this.  */
+   char *t;
+   char const *s = 0 ? (char *) 0 : (char const *) 0;
+ 
+   *t++ = 0;
+ }
+ { /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
+   int x[] = {25, 17};
+   const int *foo = &x[0];
+   ++foo;
+ }
+ { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+   typedef const int *iptr;
+   iptr p = 0;
+   ++p;
+ }
+ { /* AIX XL C 1.02.0.0 rejects this saying
+      "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+   struct s { int j; const int *ap[3]; };
+   struct s *b; b->j = 5;
+ }
+ { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+   const int foo = 10;
+ }
+ 
+ ; return 0; }
+ EOF
+ if { (eval echo configure:965: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+   rm -rf conftest*
+   ac_cv_c_const=yes
+ else
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+   rm -rf conftest*
+   ac_cv_c_const=no
+ fi
+ rm -f conftest*
+ fi
+ 
+ echo "$ac_t""$ac_cv_c_const" 1>&6
+ if test $ac_cv_c_const = no; then
+   cat >> confdefs.h <<\EOF
+ #define const 
+ EOF
+ 
+ fi
+ 
+ echo $ac_n "checking for inline""... $ac_c" 1>&6
+ echo "configure:986: checking for inline" >&5
+ if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   ac_cv_c_inline=no
+ for ac_kw in inline __inline__ __inline; do
+   cat > conftest.$ac_ext <<EOF
+ #line 993 "configure"
+ #include "confdefs.h"
+ 
+ int main() {
+ } $ac_kw foo() {
+ ; return 0; }
+ EOF
+ if { (eval echo configure:1000: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+   rm -rf conftest*
+   ac_cv_c_inline=$ac_kw; break
+ else
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+ fi
+ rm -f conftest*
+ done
+ 
+ fi
+ 
+ echo "$ac_t""$ac_cv_c_inline" 1>&6
+ case "$ac_cv_c_inline" in
+   inline | yes) ;;
+   no) cat >> confdefs.h <<\EOF
+ #define inline 
+ EOF
+  ;;
+   *)  cat >> confdefs.h <<EOF
+ #define inline $ac_cv_c_inline
+ EOF
+  ;;
+ esac
+ 
+ echo $ac_n "checking for off_t""... $ac_c" 1>&6
+ echo "configure:1026: checking for off_t" >&5
+ if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+ #line 1031 "configure"
+ #include "confdefs.h"
+ #include <sys/types.h>
+ #if STDC_HEADERS
+ #include <stdlib.h>
+ #include <stddef.h>
+ #endif
+ EOF
+ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+   egrep "(^|[^a-zA-Z_0-9])off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+   rm -rf conftest*
+   ac_cv_type_off_t=yes
+ else
+   rm -rf conftest*
+   ac_cv_type_off_t=no
+ fi
+ rm -f conftest*
+ 
+ fi
+ echo "$ac_t""$ac_cv_type_off_t" 1>&6
+ if test $ac_cv_type_off_t = no; then
+   cat >> confdefs.h <<\EOF
+ #define off_t long
+ EOF
+ 
+ fi
+ 
+ echo $ac_n "checking for size_t""... $ac_c" 1>&6
+ echo "configure:1059: checking for size_t" >&5
+ if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+ #line 1064 "configure"
+ #include "confdefs.h"
+ #include <sys/types.h>
+ #if STDC_HEADERS
+ #include <stdlib.h>
+ #include <stddef.h>
+ #endif
+ EOF
+ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+   egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+   rm -rf conftest*
+   ac_cv_type_size_t=yes
+ else
+   rm -rf conftest*
+   ac_cv_type_size_t=no
+ fi
+ rm -f conftest*
+ 
+ fi
+ echo "$ac_t""$ac_cv_type_size_t" 1>&6
+ if test $ac_cv_type_size_t = no; then
+   cat >> confdefs.h <<\EOF
+ #define size_t unsigned
+ EOF
+ 
+ fi
+ 
+ # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
+ # for constant arguments.  Useless!
+ echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
+ echo "configure:1094: checking for working alloca.h" >&5
+ if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+ #line 1099 "configure"
+ #include "confdefs.h"
+ #include <alloca.h>
+ int main() {
+ char *p = alloca(2 * sizeof(int));
+ ; return 0; }
+ EOF
+ if { (eval echo configure:1106: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   rm -rf conftest*
+   ac_cv_header_alloca_h=yes
+ else
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+   rm -rf conftest*
+   ac_cv_header_alloca_h=no
+ fi
+ rm -f conftest*
+ fi
+ 
+ echo "$ac_t""$ac_cv_header_alloca_h" 1>&6
+ if test $ac_cv_header_alloca_h = yes; then
+   cat >> confdefs.h <<\EOF
+ #define HAVE_ALLOCA_H 1
+ EOF
+ 
+ fi
+ 
+ echo $ac_n "checking for alloca""... $ac_c" 1>&6
+ echo "configure:1127: checking for alloca" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+ #line 1132 "configure"
+ #include "confdefs.h"
+ 
+ #ifdef __GNUC__
+ # define alloca __builtin_alloca
+ #else
+ # ifdef _MSC_VER
+ #  include <malloc.h>
+ #  define alloca _alloca
+ # else
+ #  if HAVE_ALLOCA_H
+ #   include <alloca.h>
+ #  else
+ #   ifdef _AIX
+  #pragma alloca
+ #   else
+ #    ifndef alloca /* predefined by HP cc +Olibcalls */
+ char *alloca ();
+ #    endif
+ #   endif
+ #  endif
+ # endif
+ #endif
+ 
+ int main() {
+ char *p = (char *) alloca(1);
+ ; return 0; }
+ EOF
+ if { (eval echo configure:1160: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   rm -rf conftest*
+   ac_cv_func_alloca_works=yes
+ else
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+   rm -rf conftest*
+   ac_cv_func_alloca_works=no
+ fi
+ rm -f conftest*
+ fi
+ 
+ echo "$ac_t""$ac_cv_func_alloca_works" 1>&6
+ if test $ac_cv_func_alloca_works = yes; then
+   cat >> confdefs.h <<\EOF
+ #define HAVE_ALLOCA 1
+ EOF
+ 
+ fi
+ 
+ if test $ac_cv_func_alloca_works = no; then
+   # The SVR3 libPW and SVR4 libucb both contain incompatible functions
+   # that cause trouble.  Some versions do not even contain alloca or
+   # contain a buggy version.  If you still want to use their alloca,
+   # use ar to extract alloca.o from them instead of compiling alloca.c.
+   ALLOCA=alloca.${ac_objext}
+   cat >> confdefs.h <<\EOF
+ #define C_ALLOCA 1
+ EOF
+ 
+ 
+ echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
+ echo "configure:1192: checking whether alloca needs Cray hooks" >&5
+ if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+ #line 1197 "configure"
+ #include "confdefs.h"
+ #if defined(CRAY) && ! defined(CRAY2)
+ webecray
+ #else
+ wenotbecray
+ #endif
+ 
+ EOF
+ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+   egrep "webecray" >/dev/null 2>&1; then
+   rm -rf conftest*
+   ac_cv_os_cray=yes
+ else
+   rm -rf conftest*
+   ac_cv_os_cray=no
+ fi
+ rm -f conftest*
+ 
+ fi
+ 
+ echo "$ac_t""$ac_cv_os_cray" 1>&6
+ if test $ac_cv_os_cray = yes; then
+ for ac_func in _getb67 GETB67 getb67; do
+   echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+ echo "configure:1222: checking for $ac_func" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+ #line 1227 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+     which can conflict with char $ac_func(); below.  */
+ #include <assert.h>
+ /* Override any gcc2 internal prototype to avoid an error.  */
+ /* We use char because int might match the return type of a gcc2
+     builtin and then its argument prototype would still apply.  */
+ char $ac_func();
+ 
+ int main() {
+ 
+ /* The GNU C library defines this for functions which it implements
+     to always fail with ENOSYS.  Some functions are actually named
+     something starting with __ and the normal name is an alias.  */
+ #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+ choke me
+ #else
+ $ac_func();
+ #endif
+ 
+ ; return 0; }
+ EOF
+ if { (eval echo configure:1250: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   rm -rf conftest*
+   eval "ac_cv_func_$ac_func=yes"
+ else
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+   rm -rf conftest*
+   eval "ac_cv_func_$ac_func=no"
+ fi
+ rm -f conftest*
+ fi
+ 
+ if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+   echo "$ac_t""yes" 1>&6
+   cat >> confdefs.h <<EOF
+ #define CRAY_STACKSEG_END $ac_func
+ EOF
+ 
+   break
+ else
+   echo "$ac_t""no" 1>&6
+ fi
+ 
+ done
+ fi
+ 
+ echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
+ echo "configure:1277: checking stack direction for C alloca" >&5
+ if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   if test "$cross_compiling" = yes; then
+   ac_cv_c_stack_direction=0
+ else
+   cat > conftest.$ac_ext <<EOF
+ #line 1285 "configure"
+ #include "confdefs.h"
+ find_stack_direction ()
+ {
+   static char *addr = 0;
+   auto char dummy;
+   if (addr == 0)
+     {
+       addr = &dummy;
+       return find_stack_direction ();
+     }
+   else
+     return (&dummy > addr) ? 1 : -1;
+ }
+ main ()
+ {
+   exit (find_stack_direction() < 0);
+ }
+ EOF
+ if { (eval echo configure:1304: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+ then
+   ac_cv_c_stack_direction=1
+ else
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+   rm -fr conftest*
+   ac_cv_c_stack_direction=-1
+ fi
+ rm -fr conftest*
+ fi
+ 
+ fi
+ 
+ echo "$ac_t""$ac_cv_c_stack_direction" 1>&6
+ cat >> confdefs.h <<EOF
+ #define STACK_DIRECTION $ac_cv_c_stack_direction
+ EOF
+ 
+ fi
+ 
+ for ac_hdr in unistd.h
+ do
+ ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+ echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+ echo "configure:1329: checking for $ac_hdr" >&5
+ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+ #line 1334 "configure"
+ #include "confdefs.h"
+ #include <$ac_hdr>
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+ { (eval echo configure:1339: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+   rm -rf conftest*
+   eval "ac_cv_header_$ac_safe=yes"
+ else
+   echo "$ac_err" >&5
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+   rm -rf conftest*
+   eval "ac_cv_header_$ac_safe=no"
+ fi
+ rm -f conftest*
+ fi
+ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+   echo "$ac_t""yes" 1>&6
+     ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+   cat >> confdefs.h <<EOF
+ #define $ac_tr_hdr 1
+ EOF
+  
+ else
+   echo "$ac_t""no" 1>&6
+ fi
+ done
+ 
+ for ac_func in getpagesize
+ do
+ echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+ echo "configure:1368: checking for $ac_func" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+ #line 1373 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+     which can conflict with char $ac_func(); below.  */
+ #include <assert.h>
+ /* Override any gcc2 internal prototype to avoid an error.  */
+ /* We use char because int might match the return type of a gcc2
+     builtin and then its argument prototype would still apply.  */
+ char $ac_func();
+ 
+ int main() {
+ 
+ /* The GNU C library defines this for functions which it implements
+     to always fail with ENOSYS.  Some functions are actually named
+     something starting with __ and the normal name is an alias.  */
+ #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+ choke me
+ #else
+ $ac_func();
+ #endif
+ 
+ ; return 0; }
+ EOF
+ if { (eval echo configure:1396: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   rm -rf conftest*
+   eval "ac_cv_func_$ac_func=yes"
+ else
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+   rm -rf conftest*
+   eval "ac_cv_func_$ac_func=no"
+ fi
+ rm -f conftest*
+ fi
+ 
+ if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+   echo "$ac_t""yes" 1>&6
+     ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+   cat >> confdefs.h <<EOF
+ #define $ac_tr_func 1
+ EOF
+  
+ else
+   echo "$ac_t""no" 1>&6
+ fi
+ done
+ 
+ echo $ac_n "checking for working mmap""... $ac_c" 1>&6
+ echo "configure:1421: checking for working mmap" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   if test "$cross_compiling" = yes; then
+   ac_cv_func_mmap_fixed_mapped=no
+ else
+   cat > conftest.$ac_ext <<EOF
+ #line 1429 "configure"
+ #include "confdefs.h"
+ 
+ /* Thanks to Mike Haertel and Jim Avera for this test.
+    Here is a matrix of mmap possibilities:
+ 	mmap private not fixed
+ 	mmap private fixed at somewhere currently unmapped
+ 	mmap private fixed at somewhere already mapped
+ 	mmap shared not fixed
+ 	mmap shared fixed at somewhere currently unmapped
+ 	mmap shared fixed at somewhere already mapped
+    For private mappings, we should verify that changes cannot be read()
+    back from the file, nor mmap's back from the file at a different
+    address.  (There have been systems where private was not correctly
+    implemented like the infamous i386 svr4.0, and systems where the
+    VM page cache was not coherent with the filesystem buffer cache
+    like early versions of FreeBSD and possibly contemporary NetBSD.)
+    For shared mappings, we should conversely verify that changes get
+    propogated back to all the places they're supposed to be.
+ 
+    Grep wants private fixed already mapped.
+    The main things grep needs to know about mmap are:
+    * does it exist and is it safe to write into the mmap'd area
+    * how to use it (BSD variants)  */
+ #include <sys/types.h>
+ #include <fcntl.h>
+ #include <sys/mman.h>
+ 
+ /* This mess was copied from the GNU getpagesize.h.  */
+ #ifndef HAVE_GETPAGESIZE
+ # ifdef HAVE_UNISTD_H
+ #  include <unistd.h>
+ # endif
+ 
+ /* Assume that all systems that can run configure have sys/param.h.  */
+ # ifndef HAVE_SYS_PARAM_H
+ #  define HAVE_SYS_PARAM_H 1
+ # endif
+ 
+ # ifdef _SC_PAGESIZE
+ #  define getpagesize() sysconf(_SC_PAGESIZE)
+ # else /* no _SC_PAGESIZE */
+ #  ifdef HAVE_SYS_PARAM_H
+ #   include <sys/param.h>
+ #   ifdef EXEC_PAGESIZE
+ #    define getpagesize() EXEC_PAGESIZE
+ #   else /* no EXEC_PAGESIZE */
+ #    ifdef NBPG
+ #     define getpagesize() NBPG * CLSIZE
+ #     ifndef CLSIZE
+ #      define CLSIZE 1
+ #     endif /* no CLSIZE */
+ #    else /* no NBPG */
+ #     ifdef NBPC
+ #      define getpagesize() NBPC
+ #     else /* no NBPC */
+ #      ifdef PAGESIZE
+ #       define getpagesize() PAGESIZE
+ #      endif /* PAGESIZE */
+ #     endif /* no NBPC */
+ #    endif /* no NBPG */
+ #   endif /* no EXEC_PAGESIZE */
+ #  else /* no HAVE_SYS_PARAM_H */
+ #   define getpagesize() 8192	/* punt totally */
+ #  endif /* no HAVE_SYS_PARAM_H */
+ # endif /* no _SC_PAGESIZE */
+ 
+ #endif /* no HAVE_GETPAGESIZE */
+ 
+ #ifdef __cplusplus
+ extern "C" { void *malloc(unsigned); }
+ #else
+ char *malloc();
+ #endif
+ 
+ int
+ main()
+ {
+ 	char *data, *data2, *data3;
+ 	int i, pagesize;
+ 	int fd;
+ 
+ 	pagesize = getpagesize();
+ 
+ 	/*
+ 	 * First, make a file with some known garbage in it.
+ 	 */
+ 	data = malloc(pagesize);
+ 	if (!data)
+ 		exit(1);
+ 	for (i = 0; i < pagesize; ++i)
+ 		*(data + i) = rand();
+ 	umask(0);
+ 	fd = creat("conftestmmap", 0600);
+ 	if (fd < 0)
+ 		exit(1);
+ 	if (write(fd, data, pagesize) != pagesize)
+ 		exit(1);
+ 	close(fd);
+ 
+ 	/*
+ 	 * Next, try to mmap the file at a fixed address which
+ 	 * already has something else allocated at it.  If we can,
+ 	 * also make sure that we see the same garbage.
+ 	 */
+ 	fd = open("conftestmmap", O_RDWR);
+ 	if (fd < 0)
+ 		exit(1);
+ 	data2 = malloc(2 * pagesize);
+ 	if (!data2)
+ 		exit(1);
+ 	data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1);
+ 	if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE,
+ 	    MAP_PRIVATE | MAP_FIXED, fd, 0L))
+ 		exit(1);
+ 	for (i = 0; i < pagesize; ++i)
+ 		if (*(data + i) != *(data2 + i))
+ 			exit(1);
+ 
+ 	/*
+ 	 * Finally, make sure that changes to the mapped area
+ 	 * do not percolate back to the file as seen by read().
+ 	 * (This is a bug on some variants of i386 svr4.0.)
+ 	 */
+ 	for (i = 0; i < pagesize; ++i)
+ 		*(data2 + i) = *(data2 + i) + 1;
+ 	data3 = malloc(pagesize);
+ 	if (!data3)
+ 		exit(1);
+ 	if (read(fd, data3, pagesize) != pagesize)
+ 		exit(1);
+ 	for (i = 0; i < pagesize; ++i)
+ 		if (*(data + i) != *(data3 + i))
+ 			exit(1);
+ 	close(fd);
+ 	unlink("conftestmmap");
+ 	exit(0);
+ }
+ 
+ EOF
+ if { (eval echo configure:1569: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+ then
+   ac_cv_func_mmap_fixed_mapped=yes
+ else
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+   rm -fr conftest*
+   ac_cv_func_mmap_fixed_mapped=no
+ fi
+ rm -fr conftest*
+ fi
+ 
+ fi
+ 
+ echo "$ac_t""$ac_cv_func_mmap_fixed_mapped" 1>&6
+ if test $ac_cv_func_mmap_fixed_mapped = yes; then
+   cat >> confdefs.h <<\EOF
+ #define HAVE_MMAP 1
+ EOF
+ 
+ fi
+ 
+ echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
+ echo "configure:1592: checking for Cygwin environment" >&5
+ if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+ #line 1597 "configure"
+ #include "confdefs.h"
+ 
+ int main() {
+ 
+ #ifndef __CYGWIN__
+ #define __CYGWIN__ __CYGWIN32__
+ #endif
+ return __CYGWIN__;
+ ; return 0; }
+ EOF
+ if { (eval echo configure:1608: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+   rm -rf conftest*
+   ac_cv_cygwin=yes
+ else
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+   rm -rf conftest*
+   ac_cv_cygwin=no
+ fi
+ rm -f conftest*
+ rm -f conftest*
+ fi
+ 
+ echo "$ac_t""$ac_cv_cygwin" 1>&6
+ CYGWIN=
+ test "$ac_cv_cygwin" = yes && CYGWIN=yes
+ echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
+ echo "configure:1625: checking for mingw32 environment" >&5
+ if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+ #line 1630 "configure"
+ #include "confdefs.h"
+ 
+ int main() {
+ return __MINGW32__;
+ ; return 0; }
+ EOF
+ if { (eval echo configure:1637: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+   rm -rf conftest*
+   ac_cv_mingw32=yes
+ else
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+   rm -rf conftest*
+   ac_cv_mingw32=no
+ fi
+ rm -f conftest*
+ rm -f conftest*
+ fi
+ 
+ echo "$ac_t""$ac_cv_mingw32" 1>&6
+ MINGW32=
+ test "$ac_cv_mingw32" = yes && MINGW32=yes
+ 
+ # autoconf.info says this should be called right after AC_INIT.
+ 
+ 
+ ac_aux_dir=
+ for ac_dir in `cd $srcdir;pwd`/../.. $srcdir/`cd $srcdir;pwd`/../..; do
+   if test -f $ac_dir/install-sh; then
+     ac_aux_dir=$ac_dir
+     ac_install_sh="$ac_aux_dir/install-sh -c"
+     break
+   elif test -f $ac_dir/install.sh; then
+     ac_aux_dir=$ac_dir
+     ac_install_sh="$ac_aux_dir/install.sh -c"
+     break
+   fi
+ done
+ if test -z "$ac_aux_dir"; then
+   { echo "configure: error: can not find install-sh or install.sh in `cd $srcdir;pwd`/../.. $srcdir/`cd $srcdir;pwd`/../.." 1>&2; exit 1; }
+ fi
+ ac_config_guess=$ac_aux_dir/config.guess
+ ac_config_sub=$ac_aux_dir/config.sub
+ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+ 
+ 
+ # Do some error checking and defaulting for the host and target type.
+ # The inputs are:
+ #    configure --host=HOST --target=TARGET --build=BUILD NONOPT
+ #
+ # The rules are:
+ # 1. You are not allowed to specify --host, --target, and nonopt at the
+ #    same time.
+ # 2. Host defaults to nonopt.
+ # 3. If nonopt is not specified, then host defaults to the current host,
+ #    as determined by config.guess.
+ # 4. Target and build default to nonopt.
+ # 5. If nonopt is not specified, then target and build default to host.
+ 
+ # The aliases save the names the user supplied, while $host etc.
+ # will get canonicalized.
+ case $host---$target---$nonopt in
+ NONE---*---* | *---NONE---* | *---*---NONE) ;;
+ *) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;;
+ esac
+ 
+ 
+ # Make sure we can run config.sub.
+ if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
+ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+ fi
+ 
+ echo $ac_n "checking host system type""... $ac_c" 1>&6
+ echo "configure:1704: checking host system type" >&5
+ 
+ host_alias=$host
+ case "$host_alias" in
+ NONE)
+   case $nonopt in
+   NONE)
+     if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
+     else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
+     fi ;;
+   *) host_alias=$nonopt ;;
+   esac ;;
+ esac
+ 
+ host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
+ host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+ host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+ echo "$ac_t""$host" 1>&6
+ 
+ echo $ac_n "checking target system type""... $ac_c" 1>&6
+ echo "configure:1725: checking target system type" >&5
+ 
+ target_alias=$target
+ case "$target_alias" in
+ NONE)
+   case $nonopt in
+   NONE) target_alias=$host_alias ;;
+   *) target_alias=$nonopt ;;
+   esac ;;
+ esac
+ 
+ target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias`
+ target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+ target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+ echo "$ac_t""$target" 1>&6
+ 
+ echo $ac_n "checking build system type""... $ac_c" 1>&6
+ echo "configure:1743: checking build system type" >&5
+ 
+ build_alias=$build
+ case "$build_alias" in
+ NONE)
+   case $nonopt in
+   NONE) build_alias=$host_alias ;;
+   *) build_alias=$nonopt ;;
+   esac ;;
+ esac
+ 
+ build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
+ build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+ build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+ build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+ echo "$ac_t""$build" 1>&6
+ 
+ test "$host_alias" != "$target_alias" &&
+   test "$program_prefix$program_suffix$program_transform_name" = \
+     NONENONEs,x,x, &&
+   program_prefix=${target_alias}-
+ 
+ if test "$program_transform_name" = s,x,x,; then
+   program_transform_name=
+ else
+   # Double any \ or $.  echo might interpret backslashes.
+   cat <<\EOF_SED > conftestsed
+ s,\\,\\\\,g; s,\$,$$,g
+ EOF_SED
+   program_transform_name="`echo $program_transform_name|sed -f conftestsed`"
+   rm -f conftestsed
+ fi
+ test "$program_prefix" != NONE &&
+   program_transform_name="s,^,${program_prefix},; $program_transform_name"
+ # Use a double $ so make ignores it.
+ test "$program_suffix" != NONE &&
+   program_transform_name="s,\$\$,${program_suffix},; $program_transform_name"
+ 
+ # sed with no file args requires a program.
+ test "$program_transform_name" = "" && program_transform_name="s,x,x,"
+ 
+ # Extract the first word of "gcc", so it can be a program name with args.
+ set dummy gcc; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+ echo "configure:1787: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   if test -n "$CC"; then
+   ac_cv_prog_CC="$CC" # Let the user override the test.
+ else
+   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+   ac_dummy="$PATH"
+   for ac_dir in $ac_dummy; do
+     test -z "$ac_dir" && ac_dir=.
+     if test -f $ac_dir/$ac_word; then
+       ac_cv_prog_CC="gcc"
+       break
+     fi
+   done
+   IFS="$ac_save_ifs"
+ fi
+ fi
+ CC="$ac_cv_prog_CC"
+ if test -n "$CC"; then
+   echo "$ac_t""$CC" 1>&6
+ else
+   echo "$ac_t""no" 1>&6
+ fi
+ 
+ if test -z "$CC"; then
+   # Extract the first word of "cc", so it can be a program name with args.
+ set dummy cc; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+ echo "configure:1817: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   if test -n "$CC"; then
+   ac_cv_prog_CC="$CC" # Let the user override the test.
+ else
+   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+   ac_prog_rejected=no
+   ac_dummy="$PATH"
+   for ac_dir in $ac_dummy; do
+     test -z "$ac_dir" && ac_dir=.
+     if test -f $ac_dir/$ac_word; then
+       if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
+         ac_prog_rejected=yes
+ 	continue
+       fi
+       ac_cv_prog_CC="cc"
+       break
+     fi
+   done
+   IFS="$ac_save_ifs"
+ if test $ac_prog_rejected = yes; then
+   # We found a bogon in the path, so make sure we never use it.
+   set dummy $ac_cv_prog_CC
+   shift
+   if test $# -gt 0; then
+     # We chose a different compiler from the bogus one.
+     # However, it has the same basename, so the bogon will be chosen
+     # first if we set CC to just the basename; use the full file name.
+     shift
+     set dummy "$ac_dir/$ac_word" "$@"
+     shift
+     ac_cv_prog_CC="$@"
+   fi
+ fi
+ fi
+ fi
+ CC="$ac_cv_prog_CC"
+ if test -n "$CC"; then
+   echo "$ac_t""$CC" 1>&6
+ else
+   echo "$ac_t""no" 1>&6
+ fi
+ 
+   if test -z "$CC"; then
+     case "`uname -s`" in
+     *win32* | *WIN32*)
+       # Extract the first word of "cl", so it can be a program name with args.
+ set dummy cl; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+ echo "configure:1868: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   if test -n "$CC"; then
+   ac_cv_prog_CC="$CC" # Let the user override the test.
+ else
+   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+   ac_dummy="$PATH"
+   for ac_dir in $ac_dummy; do
+     test -z "$ac_dir" && ac_dir=.
+     if test -f $ac_dir/$ac_word; then
+       ac_cv_prog_CC="cl"
+       break
+     fi
+   done
+   IFS="$ac_save_ifs"
+ fi
+ fi
+ CC="$ac_cv_prog_CC"
+ if test -n "$CC"; then
+   echo "$ac_t""$CC" 1>&6
+ else
+   echo "$ac_t""no" 1>&6
+ fi
+  ;;
+     esac
+   fi
+   test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
+ fi
+ 
+ echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+ echo "configure:1900: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+ 
+ ac_ext=c
+ # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ ac_cpp='$CPP $CPPFLAGS'
+ ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+ cross_compiling=$ac_cv_prog_cc_cross
+ 
+ cat > conftest.$ac_ext << EOF
+ 
+ #line 1911 "configure"
+ #include "confdefs.h"
+ 
+ main(){return(0);}
+ EOF
+ if { (eval echo configure:1916: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   ac_cv_prog_cc_works=yes
+   # If we can't run a trivial program, we are probably using a cross compiler.
+   if (./conftest; exit) 2>/dev/null; then
+     ac_cv_prog_cc_cross=no
+   else
+     ac_cv_prog_cc_cross=yes
+   fi
+ else
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+   ac_cv_prog_cc_works=no
+ fi
+ rm -fr conftest*
+ ac_ext=c
+ # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ ac_cpp='$CPP $CPPFLAGS'
+ ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+ cross_compiling=$ac_cv_prog_cc_cross
+ 
+ echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
+ if test $ac_cv_prog_cc_works = no; then
+   { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
+ fi
+ echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+ echo "configure:1942: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+ echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
+ cross_compiling=$ac_cv_prog_cc_cross
+ 
+ echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
+ echo "configure:1947: checking whether we are using GNU C" >&5
+ if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.c <<EOF
+ #ifdef __GNUC__
+   yes;
+ #endif
+ EOF
+ if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1956: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+   ac_cv_prog_gcc=yes
+ else
+   ac_cv_prog_gcc=no
+ fi
+ fi
+ 
+ echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+ 
+ if test $ac_cv_prog_gcc = yes; then
+   GCC=yes
+ else
+   GCC=
+ fi
+ 
+ ac_test_CFLAGS="${CFLAGS+set}"
+ ac_save_CFLAGS="$CFLAGS"
+ CFLAGS=
+ echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+ echo "configure:1975: checking whether ${CC-cc} accepts -g" >&5
+ if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   echo 'void f(){}' > conftest.c
+ if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+   ac_cv_prog_cc_g=yes
+ else
+   ac_cv_prog_cc_g=no
+ fi
+ rm -f conftest*
+ 
+ fi
+ 
+ echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+ if test "$ac_test_CFLAGS" = set; then
+   CFLAGS="$ac_save_CFLAGS"
+ elif test $ac_cv_prog_cc_g = yes; then
+   if test "$GCC" = yes; then
+     CFLAGS="-g -O2"
+   else
+     CFLAGS="-g"
+   fi
+ else
+   if test "$GCC" = yes; then
+     CFLAGS="-O2"
+   else
+     CFLAGS=
+   fi
+ fi
+ 
+ # Find a good install program.  We prefer a C program (faster),
+ # so one script is as good as another.  But avoid the broken or
+ # incompatible versions:
+ # SysV /etc/install, /usr/sbin/install
+ # SunOS /usr/etc/install
+ # IRIX /sbin/install
+ # AIX /bin/install
+ # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+ # AFS /usr/afsws/bin/install, which mishandles nonexistent args
+ # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+ # ./install, which can be erroneously created by make from ./install.sh.
+ echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
+ echo "configure:2018: checking for a BSD compatible install" >&5
+ if test -z "$INSTALL"; then
+ if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+     IFS="${IFS= 	}"; ac_save_IFS="$IFS"; IFS=":"
+   for ac_dir in $PATH; do
+     # Account for people who put trailing slashes in PATH elements.
+     case "$ac_dir/" in
+     /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
+     *)
+       # OSF1 and SCO ODT 3.0 have their own names for install.
+       # Don't use installbsd from OSF since it installs stuff as root
+       # by default.
+       for ac_prog in ginstall scoinst install; do
+         if test -f $ac_dir/$ac_prog; then
+ 	  if test $ac_prog = install &&
+             grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
+ 	    # AIX install.  It has an incompatible calling convention.
+ 	    :
+ 	  else
+ 	    ac_cv_path_install="$ac_dir/$ac_prog -c"
+ 	    break 2
+ 	  fi
+ 	fi
+       done
+       ;;
+     esac
+   done
+   IFS="$ac_save_IFS"
+ 
+ fi
+   if test "${ac_cv_path_install+set}" = set; then
+     INSTALL="$ac_cv_path_install"
+   else
+     # As a last resort, use the slow shell script.  We don't cache a
+     # path for INSTALL within a source directory, because that will
+     # break other packages using the cache if that directory is
+     # removed, or if the path is relative.
+     INSTALL="$ac_install_sh"
+   fi
+ fi
+ echo "$ac_t""$INSTALL" 1>&6
+ 
+ # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+ # It thinks the first close brace ends the variable substitution.
+ test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+ 
+ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
+ 
+ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+ 
+ 
+ # Put a plausible default for CC_FOR_BUILD in Makefile.
+ if test "x$cross_compiling" = "xno"; then
+   CC_FOR_BUILD='$(CC)'
+ else
+   CC_FOR_BUILD=gcc
+ fi
+ 
+ 
+ 
+ 
+ AR=${AR-ar}
+ 
+ # Extract the first word of "ranlib", so it can be a program name with args.
+ set dummy ranlib; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+ echo "configure:2086: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   if test -n "$RANLIB"; then
+   ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+ else
+   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+   ac_dummy="$PATH"
+   for ac_dir in $ac_dummy; do
+     test -z "$ac_dir" && ac_dir=.
+     if test -f $ac_dir/$ac_word; then
+       ac_cv_prog_RANLIB="ranlib"
+       break
+     fi
+   done
+   IFS="$ac_save_ifs"
+   test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
+ fi
+ fi
+ RANLIB="$ac_cv_prog_RANLIB"
+ if test -n "$RANLIB"; then
+   echo "$ac_t""$RANLIB" 1>&6
+ else
+   echo "$ac_t""no" 1>&6
+ fi
+ 
+ 
+ ALL_LINGUAS=
+                               
+    for ac_hdr in argz.h limits.h locale.h nl_types.h malloc.h string.h \
+ unistd.h values.h sys/param.h
+ do
+ ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+ echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+ echo "configure:2121: checking for $ac_hdr" >&5
+ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+ #line 2126 "configure"
+ #include "confdefs.h"
+ #include <$ac_hdr>
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+ { (eval echo configure:2131: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+   rm -rf conftest*
+   eval "ac_cv_header_$ac_safe=yes"
+ else
+   echo "$ac_err" >&5
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+   rm -rf conftest*
+   eval "ac_cv_header_$ac_safe=no"
+ fi
+ rm -f conftest*
+ fi
+ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+   echo "$ac_t""yes" 1>&6
+     ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+   cat >> confdefs.h <<EOF
+ #define $ac_tr_hdr 1
+ EOF
+  
+ else
+   echo "$ac_t""no" 1>&6
+ fi
+ done
+ 
+    for ac_func in getcwd munmap putenv setenv setlocale strchr strcasecmp \
+ __argz_count __argz_stringify __argz_next
+ do
+ echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+ echo "configure:2161: checking for $ac_func" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+ #line 2166 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+     which can conflict with char $ac_func(); below.  */
+ #include <assert.h>
+ /* Override any gcc2 internal prototype to avoid an error.  */
+ /* We use char because int might match the return type of a gcc2
+     builtin and then its argument prototype would still apply.  */
+ char $ac_func();
+ 
+ int main() {
+ 
+ /* The GNU C library defines this for functions which it implements
+     to always fail with ENOSYS.  Some functions are actually named
+     something starting with __ and the normal name is an alias.  */
+ #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+ choke me
+ #else
+ $ac_func();
+ #endif
+ 
+ ; return 0; }
+ EOF
+ if { (eval echo configure:2189: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   rm -rf conftest*
+   eval "ac_cv_func_$ac_func=yes"
+ else
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+   rm -rf conftest*
+   eval "ac_cv_func_$ac_func=no"
+ fi
+ rm -f conftest*
+ fi
+ 
+ if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+   echo "$ac_t""yes" 1>&6
+     ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+   cat >> confdefs.h <<EOF
+ #define $ac_tr_func 1
+ EOF
+  
+ else
+   echo "$ac_t""no" 1>&6
+ fi
+ done
+ 
+ 
+    if test "${ac_cv_func_stpcpy+set}" != "set"; then
+      for ac_func in stpcpy
+ do
+ echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+ echo "configure:2218: checking for $ac_func" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+ #line 2223 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+     which can conflict with char $ac_func(); below.  */
+ #include <assert.h>
+ /* Override any gcc2 internal prototype to avoid an error.  */
+ /* We use char because int might match the return type of a gcc2
+     builtin and then its argument prototype would still apply.  */
+ char $ac_func();
+ 
+ int main() {
+ 
+ /* The GNU C library defines this for functions which it implements
+     to always fail with ENOSYS.  Some functions are actually named
+     something starting with __ and the normal name is an alias.  */
+ #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+ choke me
+ #else
+ $ac_func();
+ #endif
+ 
+ ; return 0; }
+ EOF
+ if { (eval echo configure:2246: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   rm -rf conftest*
+   eval "ac_cv_func_$ac_func=yes"
+ else
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+   rm -rf conftest*
+   eval "ac_cv_func_$ac_func=no"
+ fi
+ rm -f conftest*
+ fi
+ 
+ if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+   echo "$ac_t""yes" 1>&6
+     ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+   cat >> confdefs.h <<EOF
+ #define $ac_tr_func 1
+ EOF
+  
+ else
+   echo "$ac_t""no" 1>&6
+ fi
+ done
+ 
+    fi
+    if test "${ac_cv_func_stpcpy}" = "yes"; then
+      cat >> confdefs.h <<\EOF
+ #define HAVE_STPCPY 1
+ EOF
+ 
+    fi
+ 
+    if test $ac_cv_header_locale_h = yes; then
+     echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6
+ echo "configure:2280: checking for LC_MESSAGES" >&5
+ if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+ #line 2285 "configure"
+ #include "confdefs.h"
+ #include <locale.h>
+ int main() {
+ return LC_MESSAGES
+ ; return 0; }
+ EOF
+ if { (eval echo configure:2292: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   rm -rf conftest*
+   am_cv_val_LC_MESSAGES=yes
+ else
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+   rm -rf conftest*
+   am_cv_val_LC_MESSAGES=no
+ fi
+ rm -f conftest*
+ fi
+ 
+ echo "$ac_t""$am_cv_val_LC_MESSAGES" 1>&6
+     if test $am_cv_val_LC_MESSAGES = yes; then
+       cat >> confdefs.h <<\EOF
+ #define HAVE_LC_MESSAGES 1
+ EOF
+ 
+     fi
+   fi
+    echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6
+ echo "configure:2313: checking whether NLS is requested" >&5
+         # Check whether --enable-nls or --disable-nls was given.
+ if test "${enable_nls+set}" = set; then
+   enableval="$enable_nls"
+   USE_NLS=$enableval
+ else
+   USE_NLS=yes
+ fi
+ 
+     echo "$ac_t""$USE_NLS" 1>&6
+     
+ 
+     USE_INCLUDED_LIBINTL=no
+ 
+         if test "$USE_NLS" = "yes"; then
+       cat >> confdefs.h <<\EOF
+ #define ENABLE_NLS 1
+ EOF
+ 
+       echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6
+ echo "configure:2333: checking whether included gettext is requested" >&5
+       # Check whether --with-included-gettext or --without-included-gettext was given.
+ if test "${with_included_gettext+set}" = set; then
+   withval="$with_included_gettext"
+   nls_cv_force_use_gnu_gettext=$withval
+ else
+   nls_cv_force_use_gnu_gettext=no
+ fi
+ 
+       echo "$ac_t""$nls_cv_force_use_gnu_gettext" 1>&6
+ 
+       nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
+       if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
+                         		nls_cv_header_intl=
+ 	nls_cv_header_libgt=
+ 	CATOBJEXT=NONE
+ 
+ 	ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'`
+ echo $ac_n "checking for libintl.h""... $ac_c" 1>&6
+ echo "configure:2352: checking for libintl.h" >&5
+ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+ #line 2357 "configure"
+ #include "confdefs.h"
+ #include <libintl.h>
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+ { (eval echo configure:2362: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+   rm -rf conftest*
+   eval "ac_cv_header_$ac_safe=yes"
+ else
+   echo "$ac_err" >&5
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+   rm -rf conftest*
+   eval "ac_cv_header_$ac_safe=no"
+ fi
+ rm -f conftest*
+ fi
+ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+   echo "$ac_t""yes" 1>&6
+   echo $ac_n "checking for gettext in libc""... $ac_c" 1>&6
+ echo "configure:2379: checking for gettext in libc" >&5
+ if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+ #line 2384 "configure"
+ #include "confdefs.h"
+ #include <libintl.h>
+ int main() {
+ return (int) gettext ("")
+ ; return 0; }
+ EOF
+ if { (eval echo configure:2391: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   rm -rf conftest*
+   gt_cv_func_gettext_libc=yes
+ else
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+   rm -rf conftest*
+   gt_cv_func_gettext_libc=no
+ fi
+ rm -f conftest*
+ fi
+ 
+ echo "$ac_t""$gt_cv_func_gettext_libc" 1>&6
+ 
+ 	   if test "$gt_cv_func_gettext_libc" != "yes"; then
+ 	     echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6
+ echo "configure:2407: checking for bindtextdomain in -lintl" >&5
+ ac_lib_var=`echo intl'_'bindtextdomain | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   ac_save_LIBS="$LIBS"
+ LIBS="-lintl  $LIBS"
+ cat > conftest.$ac_ext <<EOF
+ #line 2415 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error.  */
+ /* We use char because int might match the return type of a gcc2
+     builtin and then its argument prototype would still apply.  */
+ char bindtextdomain();
+ 
+ int main() {
+ bindtextdomain()
+ ; return 0; }
+ EOF
+ if { (eval echo configure:2426: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   rm -rf conftest*
+   eval "ac_cv_lib_$ac_lib_var=yes"
+ else
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+   rm -rf conftest*
+   eval "ac_cv_lib_$ac_lib_var=no"
+ fi
+ rm -f conftest*
+ LIBS="$ac_save_LIBS"
+ 
+ fi
+ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+   echo "$ac_t""yes" 1>&6
+   echo $ac_n "checking for gettext in libintl""... $ac_c" 1>&6
+ echo "configure:2442: checking for gettext in libintl" >&5
+ if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+ #line 2447 "configure"
+ #include "confdefs.h"
+ 
+ int main() {
+ return (int) gettext ("")
+ ; return 0; }
+ EOF
+ if { (eval echo configure:2454: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   rm -rf conftest*
+   gt_cv_func_gettext_libintl=yes
+ else
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+   rm -rf conftest*
+   gt_cv_func_gettext_libintl=no
+ fi
+ rm -f conftest*
+ fi
+ 
+ echo "$ac_t""$gt_cv_func_gettext_libintl" 1>&6
+ else
+   echo "$ac_t""no" 1>&6
+ fi
+ 
+ 	   fi
+ 
+ 	   if test "$gt_cv_func_gettext_libc" = "yes" \
+ 	      || test "$gt_cv_func_gettext_libintl" = "yes"; then
+ 	      cat >> confdefs.h <<\EOF
+ #define HAVE_GETTEXT 1
+ EOF
+ 
+ 	      # Extract the first word of "msgfmt", so it can be a program name with args.
+ set dummy msgfmt; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+ echo "configure:2482: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   case "$MSGFMT" in
+   /*)
+   ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path.
+   ;;
+   *)
+   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+   for ac_dir in $PATH; do
+     test -z "$ac_dir" && ac_dir=.
+     if test -f $ac_dir/$ac_word; then
+       if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then
+ 	ac_cv_path_MSGFMT="$ac_dir/$ac_word"
+ 	break
+       fi
+     fi
+   done
+   IFS="$ac_save_ifs"
+   test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="no"
+   ;;
+ esac
+ fi
+ MSGFMT="$ac_cv_path_MSGFMT"
+ if test -n "$MSGFMT"; then
+   echo "$ac_t""$MSGFMT" 1>&6
+ else
+   echo "$ac_t""no" 1>&6
+ fi
+ 	      if test "$MSGFMT" != "no"; then
+ 		for ac_func in dcgettext
+ do
+ echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+ echo "configure:2516: checking for $ac_func" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+ #line 2521 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+     which can conflict with char $ac_func(); below.  */
+ #include <assert.h>
+ /* Override any gcc2 internal prototype to avoid an error.  */
+ /* We use char because int might match the return type of a gcc2
+     builtin and then its argument prototype would still apply.  */
+ char $ac_func();
+ 
+ int main() {
+ 
+ /* The GNU C library defines this for functions which it implements
+     to always fail with ENOSYS.  Some functions are actually named
+     something starting with __ and the normal name is an alias.  */
+ #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+ choke me
+ #else
+ $ac_func();
+ #endif
+ 
+ ; return 0; }
+ EOF
+ if { (eval echo configure:2544: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   rm -rf conftest*
+   eval "ac_cv_func_$ac_func=yes"
+ else
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+   rm -rf conftest*
+   eval "ac_cv_func_$ac_func=no"
+ fi
+ rm -f conftest*
+ fi
+ 
+ if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+   echo "$ac_t""yes" 1>&6
+     ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+   cat >> confdefs.h <<EOF
+ #define $ac_tr_func 1
+ EOF
+  
+ else
+   echo "$ac_t""no" 1>&6
+ fi
+ done
+ 
+ 		# Extract the first word of "gmsgfmt", so it can be a program name with args.
+ set dummy gmsgfmt; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+ echo "configure:2571: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   case "$GMSGFMT" in
+   /*)
+   ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path.
+   ;;
+   ?:/*)			 
+   ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path.
+   ;;
+   *)
+   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+   ac_dummy="$PATH"
+   for ac_dir in $ac_dummy; do 
+     test -z "$ac_dir" && ac_dir=.
+     if test -f $ac_dir/$ac_word; then
+       ac_cv_path_GMSGFMT="$ac_dir/$ac_word"
+       break
+     fi
+   done
+   IFS="$ac_save_ifs"
+   test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT"
+   ;;
+ esac
+ fi
+ GMSGFMT="$ac_cv_path_GMSGFMT"
+ if test -n "$GMSGFMT"; then
+   echo "$ac_t""$GMSGFMT" 1>&6
+ else
+   echo "$ac_t""no" 1>&6
+ fi
+ 
+ 		# Extract the first word of "xgettext", so it can be a program name with args.
+ set dummy xgettext; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+ echo "configure:2607: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   case "$XGETTEXT" in
+   /*)
+   ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path.
+   ;;
+   *)
+   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+   for ac_dir in $PATH; do
+     test -z "$ac_dir" && ac_dir=.
+     if test -f $ac_dir/$ac_word; then
+       if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then
+ 	ac_cv_path_XGETTEXT="$ac_dir/$ac_word"
+ 	break
+       fi
+     fi
+   done
+   IFS="$ac_save_ifs"
+   test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":"
+   ;;
+ esac
+ fi
+ XGETTEXT="$ac_cv_path_XGETTEXT"
+ if test -n "$XGETTEXT"; then
+   echo "$ac_t""$XGETTEXT" 1>&6
+ else
+   echo "$ac_t""no" 1>&6
+ fi
+ 
+ 		cat > conftest.$ac_ext <<EOF
+ #line 2639 "configure"
+ #include "confdefs.h"
+ 
+ int main() {
+ extern int _nl_msg_cat_cntr;
+ 			       return _nl_msg_cat_cntr
+ ; return 0; }
+ EOF
+ if { (eval echo configure:2647: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   rm -rf conftest*
+   CATOBJEXT=.gmo
+ 		   DATADIRNAME=share
+ else
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+   rm -rf conftest*
+   CATOBJEXT=.mo
+ 		   DATADIRNAME=lib
+ fi
+ rm -f conftest*
+ 		INSTOBJEXT=.mo
+ 	      fi
+ 	    fi
+ 	
+ else
+   echo "$ac_t""no" 1>&6
+ fi
+ 
+ 
+ 	        
+         if test "$CATOBJEXT" = "NONE"; then
+ 	  	  	  nls_cv_use_gnu_gettext=yes
+         fi
+       fi
+ 
+       if test "$nls_cv_use_gnu_gettext" = "yes"; then
+                 INTLOBJS="\$(GETTOBJS)"
+         # Extract the first word of "msgfmt", so it can be a program name with args.
+ set dummy msgfmt; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+ echo "configure:2679: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   case "$MSGFMT" in
+   /*)
+   ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path.
+   ;;
+   *)
+   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+   for ac_dir in $PATH; do
+     test -z "$ac_dir" && ac_dir=.
+     if test -f $ac_dir/$ac_word; then
+       if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then
+ 	ac_cv_path_MSGFMT="$ac_dir/$ac_word"
+ 	break
+       fi
+     fi
+   done
+   IFS="$ac_save_ifs"
+   test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="msgfmt"
+   ;;
+ esac
+ fi
+ MSGFMT="$ac_cv_path_MSGFMT"
+ if test -n "$MSGFMT"; then
+   echo "$ac_t""$MSGFMT" 1>&6
+ else
+   echo "$ac_t""no" 1>&6
+ fi
+ 
+         # Extract the first word of "gmsgfmt", so it can be a program name with args.
+ set dummy gmsgfmt; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+ echo "configure:2713: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   case "$GMSGFMT" in
+   /*)
+   ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path.
+   ;;
+   ?:/*)			 
+   ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path.
+   ;;
+   *)
+   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+   ac_dummy="$PATH"
+   for ac_dir in $ac_dummy; do 
+     test -z "$ac_dir" && ac_dir=.
+     if test -f $ac_dir/$ac_word; then
+       ac_cv_path_GMSGFMT="$ac_dir/$ac_word"
+       break
+     fi
+   done
+   IFS="$ac_save_ifs"
+   test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT"
+   ;;
+ esac
+ fi
+ GMSGFMT="$ac_cv_path_GMSGFMT"
+ if test -n "$GMSGFMT"; then
+   echo "$ac_t""$GMSGFMT" 1>&6
+ else
+   echo "$ac_t""no" 1>&6
+ fi
+ 
+         # Extract the first word of "xgettext", so it can be a program name with args.
+ set dummy xgettext; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+ echo "configure:2749: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   case "$XGETTEXT" in
+   /*)
+   ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path.
+   ;;
+   *)
+   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+   for ac_dir in $PATH; do
+     test -z "$ac_dir" && ac_dir=.
+     if test -f $ac_dir/$ac_word; then
+       if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then
+ 	ac_cv_path_XGETTEXT="$ac_dir/$ac_word"
+ 	break
+       fi
+     fi
+   done
+   IFS="$ac_save_ifs"
+   test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":"
+   ;;
+ esac
+ fi
+ XGETTEXT="$ac_cv_path_XGETTEXT"
+ if test -n "$XGETTEXT"; then
+   echo "$ac_t""$XGETTEXT" 1>&6
+ else
+   echo "$ac_t""no" 1>&6
+ fi
+ 
+         
+ 	USE_INCLUDED_LIBINTL=yes
+         CATOBJEXT=.gmo
+         INSTOBJEXT=.mo
+         DATADIRNAME=share
+ 	INTLDEPS='$(top_builddir)/../intl/libintl.a'
+ 	INTLLIBS=$INTLDEPS
+ 	LIBS=`echo $LIBS | sed -e 's/-lintl//'`
+         nls_cv_header_intl=libintl.h
+         nls_cv_header_libgt=libgettext.h
+       fi
+ 
+             if test "$XGETTEXT" != ":"; then
+ 			if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
+ 	  : ;
+ 	else
+ 	  echo "$ac_t""found xgettext programs is not GNU xgettext; ignore it" 1>&6
+ 	  XGETTEXT=":"
+ 	fi
+       fi
+ 
+       # We need to process the po/ directory.
+       POSUB=po
+     else
+       DATADIRNAME=share
+       nls_cv_header_intl=libintl.h
+       nls_cv_header_libgt=libgettext.h
+     fi
+ 
+     # If this is used in GNU gettext we have to set USE_NLS to `yes'
+     # because some of the sources are only built for this goal.
+     if test "$PACKAGE" = gettext; then
+       USE_NLS=yes
+       USE_INCLUDED_LIBINTL=yes
+     fi
+ 
+                 for lang in $ALL_LINGUAS; do
+       GMOFILES="$GMOFILES $lang.gmo"
+       POFILES="$POFILES $lang.po"
+     done
+ 
+         
+     
+     
+     
+     
+     
+     
+     
+     
+     
+     
+   
+ 
+    if test "x$CATOBJEXT" != "x"; then
+      if test "x$ALL_LINGUAS" = "x"; then
+        LINGUAS=
+      else
+        echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6
+ echo "configure:2839: checking for catalogs to be installed" >&5
+        NEW_LINGUAS=
+        for lang in ${LINGUAS=$ALL_LINGUAS}; do
+          case "$ALL_LINGUAS" in
+           *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
+          esac
+        done
+        LINGUAS=$NEW_LINGUAS
+        echo "$ac_t""$LINGUAS" 1>&6
+      fi
+ 
+           if test -n "$LINGUAS"; then
+        for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
+      fi
+    fi
+ 
+             if test $ac_cv_header_locale_h = yes; then
+      INCLUDE_LOCALE_H="#include <locale.h>"
+    else
+      INCLUDE_LOCALE_H="\
+ /* The system does not provide the header <locale.h>.  Take care yourself.  */"
+    fi
+    
+ 
+             if test -f $srcdir/po2tbl.sed.in; then
+       if test "$CATOBJEXT" = ".cat"; then
+ 	 ac_safe=`echo "linux/version.h" | sed 'y%./+-%__p_%'`
+ echo $ac_n "checking for linux/version.h""... $ac_c" 1>&6
+ echo "configure:2867: checking for linux/version.h" >&5
+ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+ #line 2872 "configure"
+ #include "confdefs.h"
+ #include <linux/version.h>
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+ { (eval echo configure:2877: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+   rm -rf conftest*
+   eval "ac_cv_header_$ac_safe=yes"
+ else
+   echo "$ac_err" >&5
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+   rm -rf conftest*
+   eval "ac_cv_header_$ac_safe=no"
+ fi
+ rm -f conftest*
+ fi
+ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+   echo "$ac_t""yes" 1>&6
+   msgformat=linux
+ else
+   echo "$ac_t""no" 1>&6
+ msgformat=xopen
+ fi
+ 
+ 
+ 	          	 sed -e '/^#/d' $srcdir/$msgformat-msg.sed > po2msg.sed
+       fi
+             sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
+ 	 $srcdir/po2tbl.sed.in > po2tbl.sed
+    fi
+ 
+             if test "$PACKAGE" = "gettext"; then
+      GT_NO="#NO#"
+      GT_YES=
+    else
+      GT_NO=
+      GT_YES="#YES#"
+    fi
+    
+    
+ 
+    MKINSTALLDIRS="\$(srcdir)/../../mkinstalldirs"
+    
+ 
+       l=
+    
+ 
+             if test -d $srcdir/po; then
+       test -d po || mkdir po
+       if test "x$srcdir" != "x."; then
+ 	 if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
+ 	    posrcprefix="$srcdir/"
+ 	 else
+ 	    posrcprefix="../$srcdir/"
+ 	 fi
+       else
+ 	 posrcprefix="../"
+       fi
+       rm -f po/POTFILES
+       sed -e "/^#/d" -e "/^\$/d" -e "s,.*,	$posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
+ 	 < $srcdir/po/POTFILES.in > po/POTFILES
+    fi
+   
+ 
+ # Check for common headers.
+ # FIXME: Seems to me this can cause problems for i386-windows hosts.
+ # At one point there were hardcoded AC_DEFINE's if ${host} = i386-*-windows*.
+ for ac_hdr in stdlib.h string.h strings.h unistd.h time.h
+ do
+ ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+ echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+ echo "configure:2946: checking for $ac_hdr" >&5
+ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+ #line 2951 "configure"
+ #include "confdefs.h"
+ #include <$ac_hdr>
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+ { (eval echo configure:2956: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+   rm -rf conftest*
+   eval "ac_cv_header_$ac_safe=yes"
+ else
+   echo "$ac_err" >&5
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+   rm -rf conftest*
+   eval "ac_cv_header_$ac_safe=no"
+ fi
+ rm -f conftest*
+ fi
+ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+   echo "$ac_t""yes" 1>&6
+     ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+   cat >> confdefs.h <<EOF
+ #define $ac_tr_hdr 1
+ EOF
+  
+ else
+   echo "$ac_t""no" 1>&6
+ fi
+ done
+ 
+ for ac_hdr in sys/time.h sys/resource.h
+ do
+ ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+ echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+ echo "configure:2986: checking for $ac_hdr" >&5
+ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+ #line 2991 "configure"
+ #include "confdefs.h"
+ #include <$ac_hdr>
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+ { (eval echo configure:2996: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+   rm -rf conftest*
+   eval "ac_cv_header_$ac_safe=yes"
+ else
+   echo "$ac_err" >&5
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+   rm -rf conftest*
+   eval "ac_cv_header_$ac_safe=no"
+ fi
+ rm -f conftest*
+ fi
+ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+   echo "$ac_t""yes" 1>&6
+     ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+   cat >> confdefs.h <<EOF
+ #define $ac_tr_hdr 1
+ EOF
+  
+ else
+   echo "$ac_t""no" 1>&6
+ fi
+ done
+ 
+ for ac_hdr in fcntl.h fpu_control.h
+ do
+ ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+ echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+ echo "configure:3026: checking for $ac_hdr" >&5
+ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+ #line 3031 "configure"
+ #include "confdefs.h"
+ #include <$ac_hdr>
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+ { (eval echo configure:3036: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+   rm -rf conftest*
+   eval "ac_cv_header_$ac_safe=yes"
+ else
+   echo "$ac_err" >&5
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+   rm -rf conftest*
+   eval "ac_cv_header_$ac_safe=no"
+ fi
+ rm -f conftest*
+ fi
+ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+   echo "$ac_t""yes" 1>&6
+     ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+   cat >> confdefs.h <<EOF
+ #define $ac_tr_hdr 1
+ EOF
+  
+ else
+   echo "$ac_t""no" 1>&6
+ fi
+ done
+ 
+ for ac_hdr in dlfcn.h errno.h sys/stat.h
+ do
+ ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+ echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+ echo "configure:3066: checking for $ac_hdr" >&5
+ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+ #line 3071 "configure"
+ #include "confdefs.h"
+ #include <$ac_hdr>
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+ { (eval echo configure:3076: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+   rm -rf conftest*
+   eval "ac_cv_header_$ac_safe=yes"
+ else
+   echo "$ac_err" >&5
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+   rm -rf conftest*
+   eval "ac_cv_header_$ac_safe=no"
+ fi
+ rm -f conftest*
+ fi
+ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+   echo "$ac_t""yes" 1>&6
+     ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+   cat >> confdefs.h <<EOF
+ #define $ac_tr_hdr 1
+ EOF
+  
+ else
+   echo "$ac_t""no" 1>&6
+ fi
+ done
+ 
+ for ac_func in getrusage time sigaction __setfpucw
+ do
+ echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+ echo "configure:3105: checking for $ac_func" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+ #line 3110 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+     which can conflict with char $ac_func(); below.  */
+ #include <assert.h>
+ /* Override any gcc2 internal prototype to avoid an error.  */
+ /* We use char because int might match the return type of a gcc2
+     builtin and then its argument prototype would still apply.  */
+ char $ac_func();
+ 
+ int main() {
+ 
+ /* The GNU C library defines this for functions which it implements
+     to always fail with ENOSYS.  Some functions are actually named
+     something starting with __ and the normal name is an alias.  */
+ #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+ choke me
+ #else
+ $ac_func();
+ #endif
+ 
+ ; return 0; }
+ EOF
+ if { (eval echo configure:3133: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   rm -rf conftest*
+   eval "ac_cv_func_$ac_func=yes"
+ else
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+   rm -rf conftest*
+   eval "ac_cv_func_$ac_func=no"
+ fi
+ rm -f conftest*
+ fi
+ 
+ if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+   echo "$ac_t""yes" 1>&6
+     ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+   cat >> confdefs.h <<EOF
+ #define $ac_tr_func 1
+ EOF
+  
+ else
+   echo "$ac_t""no" 1>&6
+ fi
+ done
+ 
+ 
+ # Check for socket libraries
+ echo $ac_n "checking for bind in -lsocket""... $ac_c" 1>&6
+ echo "configure:3160: checking for bind in -lsocket" >&5
+ ac_lib_var=`echo socket'_'bind | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   ac_save_LIBS="$LIBS"
+ LIBS="-lsocket  $LIBS"
+ cat > conftest.$ac_ext <<EOF
+ #line 3168 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error.  */
+ /* We use char because int might match the return type of a gcc2
+     builtin and then its argument prototype would still apply.  */
+ char bind();
+ 
+ int main() {
+ bind()
+ ; return 0; }
+ EOF
+ if { (eval echo configure:3179: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   rm -rf conftest*
+   eval "ac_cv_lib_$ac_lib_var=yes"
+ else
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+   rm -rf conftest*
+   eval "ac_cv_lib_$ac_lib_var=no"
+ fi
+ rm -f conftest*
+ LIBS="$ac_save_LIBS"
+ 
+ fi
+ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+   echo "$ac_t""yes" 1>&6
+     ac_tr_lib=HAVE_LIB`echo socket | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+     -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+   cat >> confdefs.h <<EOF
+ #define $ac_tr_lib 1
+ EOF
+ 
+   LIBS="-lsocket $LIBS"
+ 
+ else
+   echo "$ac_t""no" 1>&6
+ fi
+ 
+ echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
+ echo "configure:3207: checking for gethostbyname in -lnsl" >&5
+ ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   ac_save_LIBS="$LIBS"
+ LIBS="-lnsl  $LIBS"
+ cat > conftest.$ac_ext <<EOF
+ #line 3215 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error.  */
+ /* We use char because int might match the return type of a gcc2
+     builtin and then its argument prototype would still apply.  */
+ char gethostbyname();
+ 
+ int main() {
+ gethostbyname()
+ ; return 0; }
+ EOF
+ if { (eval echo configure:3226: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   rm -rf conftest*
+   eval "ac_cv_lib_$ac_lib_var=yes"
+ else
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+   rm -rf conftest*
+   eval "ac_cv_lib_$ac_lib_var=no"
+ fi
+ rm -f conftest*
+ LIBS="$ac_save_LIBS"
+ 
+ fi
+ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+   echo "$ac_t""yes" 1>&6
+     ac_tr_lib=HAVE_LIB`echo nsl | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+     -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+   cat >> confdefs.h <<EOF
+ #define $ac_tr_lib 1
+ EOF
+ 
+   LIBS="-lnsl $LIBS"
+ 
+ else
+   echo "$ac_t""no" 1>&6
+ fi
+ 
+ 
+ . ${srcdir}/../../bfd/configure.host
+ 
+ 
+ 
+ USE_MAINTAINER_MODE=no
+ # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
+ if test "${enable_maintainer_mode+set}" = set; then
+   enableval="$enable_maintainer_mode"
+   case "${enableval}" in
+   yes)	MAINT="" USE_MAINTAINER_MODE=yes ;;
+   no)	MAINT="#" ;;
+   *)	{ echo "configure: error: "--enable-maintainer-mode does not take a value"" 1>&2; exit 1; }; MAINT="#" ;;
+ esac
+ if test x"$silent" != x"yes" && test x"$MAINT" = x""; then
+   echo "Setting maintainer mode" 6>&1
+ fi
+ else
+   MAINT="#"
+ fi
+ 
+ 
+ 
+ # Check whether --enable-sim-bswap or --disable-sim-bswap was given.
+ if test "${enable_sim_bswap+set}" = set; then
+   enableval="$enable_sim_bswap"
+   case "${enableval}" in
+   yes)	sim_bswap="-DWITH_BSWAP=1 -DUSE_BSWAP=1";;
+   no)	sim_bswap="-DWITH_BSWAP=0";;
+   *)	{ echo "configure: error: "--enable-sim-bswap does not take a value"" 1>&2; exit 1; }; sim_bswap="";;
+ esac
+ if test x"$silent" != x"yes" && test x"$sim_bswap" != x""; then
+   echo "Setting bswap flags = $sim_bswap" 6>&1
+ fi
+ else
+   sim_bswap=""
+ fi
+ 
+ 
+ 
+ # Check whether --enable-sim-cflags or --disable-sim-cflags was given.
+ if test "${enable_sim_cflags+set}" = set; then
+   enableval="$enable_sim_cflags"
+   case "${enableval}" in
+   yes)	 sim_cflags="-O2 -fomit-frame-pointer";;
+   trace) { echo "configure: error: "Please use --enable-sim-debug instead."" 1>&2; exit 1; }; sim_cflags="";;
+   no)	 sim_cflags="";;
+   *)	 sim_cflags=`echo "${enableval}" | sed -e "s/,/ /g"`;;
+ esac
+ if test x"$silent" != x"yes" && test x"$sim_cflags" != x""; then
+   echo "Setting sim cflags = $sim_cflags" 6>&1
+ fi
+ else
+   sim_cflags=""
+ fi
+ 
+ 
+ 
+ # Check whether --enable-sim-debug or --disable-sim-debug was given.
+ if test "${enable_sim_debug+set}" = set; then
+   enableval="$enable_sim_debug"
+   case "${enableval}" in
+   yes) sim_debug="-DDEBUG=7 -DWITH_DEBUG=7";;
+   no)  sim_debug="-DDEBUG=0 -DWITH_DEBUG=0";;
+   *)   sim_debug="-DDEBUG='(${enableval})' -DWITH_DEBUG='(${enableval})'";;
+ esac
+ if test x"$silent" != x"yes" && test x"$sim_debug" != x""; then
+   echo "Setting sim debug = $sim_debug" 6>&1
+ fi
+ else
+   sim_debug=""
+ fi
+ 
+ 
+ 
+ # Check whether --enable-sim-stdio or --disable-sim-stdio was given.
+ if test "${enable_sim_stdio+set}" = set; then
+   enableval="$enable_sim_stdio"
+   case "${enableval}" in
+   yes)	sim_stdio="-DWITH_STDIO=DO_USE_STDIO";;
+   no)	sim_stdio="-DWITH_STDIO=DONT_USE_STDIO";;
+   *)	{ echo "configure: error: "Unknown value $enableval passed to --enable-sim-stdio"" 1>&2; exit 1; }; sim_stdio="";;
+ esac
+ if test x"$silent" != x"yes" && test x"$sim_stdio" != x""; then
+   echo "Setting stdio flags = $sim_stdio" 6>&1
+ fi
+ else
+   sim_stdio=""
+ fi
+ 
+ 
+ 
+ # Check whether --enable-sim-trace or --disable-sim-trace was given.
+ if test "${enable_sim_trace+set}" = set; then
+   enableval="$enable_sim_trace"
+   case "${enableval}" in
+   yes)	sim_trace="-DTRACE=1 -DWITH_TRACE=-1";;
+   no)	sim_trace="-DTRACE=0 -DWITH_TRACE=0";;
+   [-0-9]*)
+ 	sim_trace="-DTRACE='(${enableval})' -DWITH_TRACE='(${enableval})'";;
+   [a-z]*)
+ 	sim_trace=""
+ 	for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
+ 	  if test x"$sim_trace" = x; then
+ 	    sim_trace="-DWITH_TRACE='(TRACE_$x"
+ 	  else
+ 	    sim_trace="${sim_trace}|TRACE_$x"
+ 	  fi
+ 	done
+ 	sim_trace="$sim_trace)'" ;;
+ esac
+ if test x"$silent" != x"yes" && test x"$sim_trace" != x""; then
+   echo "Setting sim trace = $sim_trace" 6>&1
+ fi
+ else
+   sim_trace=""
+ fi
+ 
+ 
+ 
+ # Check whether --enable-sim-profile or --disable-sim-profile was given.
+ if test "${enable_sim_profile+set}" = set; then
+   enableval="$enable_sim_profile"
+   case "${enableval}" in
+   yes)	sim_profile="-DPROFILE=1 -DWITH_PROFILE=-1";;
+   no)	sim_profile="-DPROFILE=0 -DWITH_PROFILE=0";;
+   [-0-9]*)
+ 	sim_profile="-DPROFILE='(${enableval})' -DWITH_PROFILE='(${enableval})'";;
+   [a-z]*)
+ 	sim_profile=""
+ 	for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
+ 	  if test x"$sim_profile" = x; then
+ 	    sim_profile="-DWITH_PROFILE='(PROFILE_$x"
+ 	  else
+ 	    sim_profile="${sim_profile}|PROFILE_$x"
+ 	  fi
+ 	done
+ 	sim_profile="$sim_profile)'" ;;
+ esac
+ if test x"$silent" != x"yes" && test x"$sim_profile" != x""; then
+   echo "Setting sim profile = $sim_profile" 6>&1
+ fi
+ else
+   sim_profile="-DPROFILE=1 -DWITH_PROFILE=-1"
+ fi
+ 
+ 
+ 
+ echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
+ echo "configure:3402: checking return type of signal handlers" >&5
+ if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+ #line 3407 "configure"
+ #include "confdefs.h"
+ #include <sys/types.h>
+ #include <signal.h>
+ #ifdef signal
+ #undef signal
+ #endif
+ #ifdef __cplusplus
+ extern "C" void (*signal (int, void (*)(int)))(int);
+ #else
+ void (*signal ()) ();
+ #endif
+ 
+ int main() {
+ int i;
+ ; return 0; }
+ EOF
+ if { (eval echo configure:3424: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+   rm -rf conftest*
+   ac_cv_type_signal=void
+ else
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+   rm -rf conftest*
+   ac_cv_type_signal=int
+ fi
+ rm -f conftest*
+ fi
+ 
+ echo "$ac_t""$ac_cv_type_signal" 1>&6
+ cat >> confdefs.h <<EOF
+ #define RETSIGTYPE $ac_cv_type_signal
+ EOF
+ 
+ 
+ 
+ 
+ 
+ echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
+ echo "configure:3446: checking for executable suffix" >&5
+ if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
+   ac_cv_exeext=.exe
+ else
+   rm -f conftest*
+   echo 'int main () { return 0; }' > conftest.$ac_ext
+   ac_cv_exeext=
+   if { (eval echo configure:3456: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+     for file in conftest.*; do
+       case $file in
+       *.c | *.o | *.obj | *.ilk | *.pdb) ;;
+       *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
+       esac
+     done
+   else
+     { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; }
+   fi
+   rm -f conftest*
+   test x"${ac_cv_exeext}" = x && ac_cv_exeext=no
+ fi
+ fi
+ 
+ EXEEXT=""
+ test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext}
+ echo "$ac_t""${ac_cv_exeext}" 1>&6
+ ac_exeext=$EXEEXT
+ 
+ 
+ sim_link_files=
+ sim_link_links=
+ 
+ sim_link_links=tconfig.h
+ if test -f ${srcdir}/tconfig.in
+ then
+   sim_link_files=tconfig.in
+ else
+   sim_link_files=../common/tconfig.in
+ fi
+ 
+ # targ-vals.def points to the libc macro description file.
+ case "${target}" in
+ *-*-*) TARG_VALS_DEF=../common/nltvals.def ;;
+ esac
+ sim_link_files="${sim_link_files} ${TARG_VALS_DEF}"
+ sim_link_links="${sim_link_links} targ-vals.def"
+ 
+ 
+ 
+ for ac_hdr in unistd.h
+ do
+ ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+ echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+ echo "configure:3501: checking for $ac_hdr" >&5
+ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+ #line 3506 "configure"
+ #include "confdefs.h"
+ #include <$ac_hdr>
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+ { (eval echo configure:3511: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+   rm -rf conftest*
+   eval "ac_cv_header_$ac_safe=yes"
+ else
+   echo "$ac_err" >&5
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+   rm -rf conftest*
+   eval "ac_cv_header_$ac_safe=no"
+ fi
+ rm -f conftest*
+ fi
+ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+   echo "$ac_t""yes" 1>&6
+     ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+   cat >> confdefs.h <<EOF
+ #define $ac_tr_hdr 1
+ EOF
+  
+ else
+   echo "$ac_t""no" 1>&6
+ fi
+ done
+ 
+ 
+ 
+ 
+ trap '' 1 2 15
+ cat > confcache <<\EOF
+ # This file is a shell script that caches the results of configure
+ # tests run on this system so they can be shared between configure
+ # scripts and configure runs.  It is not useful on other systems.
+ # If it contains results you don't want to keep, you may remove or edit it.
+ #
+ # By default, configure uses ./config.cache as the cache file,
+ # creating it if it does not exist already.  You can give configure
+ # the --cache-file=FILE option to use a different cache file; that is
+ # what configure does when it calls configure scripts in
+ # subdirectories, so they share the cache.
+ # Giving --cache-file=/dev/null disables caching, for debugging configure.
+ # config.status only pays attention to the cache file if you give it the
+ # --recheck option to rerun configure.
+ #
+ EOF
+ # The following way of writing the cache mishandles newlines in values,
+ # but we know of no workaround that is simple, portable, and efficient.
+ # So, don't put newlines in cache variables' values.
+ # Ultrix sh set writes to stderr and can't be redirected directly,
+ # and sets the high bit in the cache file unless we assign to the vars.
+ (set) 2>&1 |
+   case `(ac_space=' '; set | grep ac_space) 2>&1` in
+   *ac_space=\ *)
+     # `set' does not quote correctly, so add quotes (double-quote substitution
+     # turns \\\\ into \\, and sed turns \\ into \).
+     sed -n \
+       -e "s/'/'\\\\''/g" \
+       -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+     ;;
+   *)
+     # `set' quotes correctly as required by POSIX, so do not add quotes.
+     sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+     ;;
+   esac >> confcache
+ if cmp -s $cache_file confcache; then
+   :
+ else
+   if test -w $cache_file; then
+     echo "updating cache $cache_file"
+     cat confcache > $cache_file
+   else
+     echo "not updating unwritable cache $cache_file"
+   fi
+ fi
+ rm -f confcache
+ 
+ trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+ 
+ test "x$prefix" = xNONE && prefix=$ac_default_prefix
+ # Let make expand exec_prefix.
+ test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+ 
+ # Any assignment to VPATH causes Sun make to only execute
+ # the first set of double-colon rules, so remove it if not needed.
+ # If there is a colon in the path, we need to keep it.
+ if test "x$srcdir" = x.; then
+   ac_vpsub='/^[ 	]*VPATH[ 	]*=[^:]*$/d'
+ fi
+ 
+ trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
+ 
+ DEFS=-DHAVE_CONFIG_H
+ 
+ # Without the "./", some shells look in PATH for config.status.
+ : ${CONFIG_STATUS=./config.status}
+ 
+ echo creating $CONFIG_STATUS
+ rm -f $CONFIG_STATUS
+ cat > $CONFIG_STATUS <<EOF
+ #! /bin/sh
+ # Generated automatically by configure.
+ # Run this file to recreate the current configuration.
+ # This directory was configured as follows,
+ # on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+ #
+ # $0 $ac_configure_args
+ #
+ # Compiler output produced by configure, useful for debugging
+ # configure, is in ./config.log if it exists.
+ 
+ ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
+ for ac_option
+ do
+   case "\$ac_option" in
+   -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+     echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
+     exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
+   -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
+     echo "$CONFIG_STATUS generated by autoconf version 2.13"
+     exit 0 ;;
+   -help | --help | --hel | --he | --h)
+     echo "\$ac_cs_usage"; exit 0 ;;
+   *) echo "\$ac_cs_usage"; exit 1 ;;
+   esac
+ done
+ 
+ ac_given_srcdir=$srcdir
+ ac_given_INSTALL="$INSTALL"
+ 
+ trap 'rm -fr `echo "Makefile.sim:Makefile.in Make-common.sim:../common/Make-common.in .gdbinit:../common/gdbinit.in config.h:config.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+ EOF
+ cat >> $CONFIG_STATUS <<EOF
+ 
+ # Protect against being on the right side of a sed subst in config.status.
+ sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
+  s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
+ $ac_vpsub
+ $extrasub
+ s%@sim_environment@%$sim_environment%g
+ s%@sim_alignment@%$sim_alignment%g
+ s%@sim_assert@%$sim_assert%g
+ s%@sim_bitsize@%$sim_bitsize%g
+ s%@sim_endian@%$sim_endian%g
+ s%@sim_hostendian@%$sim_hostendian%g
+ s%@sim_float@%$sim_float%g
+ s%@sim_scache@%$sim_scache%g
+ s%@sim_default_model@%$sim_default_model%g
+ s%@sim_hw_cflags@%$sim_hw_cflags%g
+ s%@sim_hw_objs@%$sim_hw_objs%g
+ s%@sim_hw@%$sim_hw%g
+ s%@sim_inline@%$sim_inline%g
+ s%@sim_packages@%$sim_packages%g
+ s%@sim_regparm@%$sim_regparm%g
+ s%@sim_reserved_bits@%$sim_reserved_bits%g
+ s%@sim_smp@%$sim_smp%g
+ s%@sim_stdcall@%$sim_stdcall%g
+ s%@sim_xor_endian@%$sim_xor_endian%g
+ s%@WARN_CFLAGS@%$WARN_CFLAGS%g
+ s%@WERROR_CFLAGS@%$WERROR_CFLAGS%g
+ s%@SHELL@%$SHELL%g
+ s%@CFLAGS@%$CFLAGS%g
+ s%@CPPFLAGS@%$CPPFLAGS%g
+ s%@CXXFLAGS@%$CXXFLAGS%g
+ s%@FFLAGS@%$FFLAGS%g
+ s%@DEFS@%$DEFS%g
+ s%@LDFLAGS@%$LDFLAGS%g
+ s%@LIBS@%$LIBS%g
+ s%@exec_prefix@%$exec_prefix%g
+ s%@prefix@%$prefix%g
+ s%@program_transform_name@%$program_transform_name%g
+ s%@bindir@%$bindir%g
+ s%@sbindir@%$sbindir%g
+ s%@libexecdir@%$libexecdir%g
+ s%@datadir@%$datadir%g
+ s%@sysconfdir@%$sysconfdir%g
+ s%@sharedstatedir@%$sharedstatedir%g
+ s%@localstatedir@%$localstatedir%g
+ s%@libdir@%$libdir%g
+ s%@includedir@%$includedir%g
+ s%@oldincludedir@%$oldincludedir%g
+ s%@infodir@%$infodir%g
+ s%@mandir@%$mandir%g
+ s%@host@%$host%g
+ s%@host_alias@%$host_alias%g
+ s%@host_cpu@%$host_cpu%g
+ s%@host_vendor@%$host_vendor%g
+ s%@host_os@%$host_os%g
+ s%@target@%$target%g
+ s%@target_alias@%$target_alias%g
+ s%@target_cpu@%$target_cpu%g
+ s%@target_vendor@%$target_vendor%g
+ s%@target_os@%$target_os%g
+ s%@build@%$build%g
+ s%@build_alias@%$build_alias%g
+ s%@build_cpu@%$build_cpu%g
+ s%@build_vendor@%$build_vendor%g
+ s%@build_os@%$build_os%g
+ s%@CC@%$CC%g
+ s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+ s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
+ s%@INSTALL_DATA@%$INSTALL_DATA%g
+ s%@CC_FOR_BUILD@%$CC_FOR_BUILD%g
+ s%@HDEFINES@%$HDEFINES%g
+ s%@AR@%$AR%g
+ s%@RANLIB@%$RANLIB%g
+ s%@SET_MAKE@%$SET_MAKE%g
+ s%@CPP@%$CPP%g
+ s%@ALLOCA@%$ALLOCA%g
+ s%@USE_NLS@%$USE_NLS%g
+ s%@MSGFMT@%$MSGFMT%g
+ s%@GMSGFMT@%$GMSGFMT%g
+ s%@XGETTEXT@%$XGETTEXT%g
+ s%@USE_INCLUDED_LIBINTL@%$USE_INCLUDED_LIBINTL%g
+ s%@CATALOGS@%$CATALOGS%g
+ s%@CATOBJEXT@%$CATOBJEXT%g
+ s%@DATADIRNAME@%$DATADIRNAME%g
+ s%@GMOFILES@%$GMOFILES%g
+ s%@INSTOBJEXT@%$INSTOBJEXT%g
+ s%@INTLDEPS@%$INTLDEPS%g
+ s%@INTLLIBS@%$INTLLIBS%g
+ s%@INTLOBJS@%$INTLOBJS%g
+ s%@POFILES@%$POFILES%g
+ s%@POSUB@%$POSUB%g
+ s%@INCLUDE_LOCALE_H@%$INCLUDE_LOCALE_H%g
+ s%@GT_NO@%$GT_NO%g
+ s%@GT_YES@%$GT_YES%g
+ s%@MKINSTALLDIRS@%$MKINSTALLDIRS%g
+ s%@l@%$l%g
+ s%@MAINT@%$MAINT%g
+ s%@sim_bswap@%$sim_bswap%g
+ s%@sim_cflags@%$sim_cflags%g
+ s%@sim_debug@%$sim_debug%g
+ s%@sim_stdio@%$sim_stdio%g
+ s%@sim_trace@%$sim_trace%g
+ s%@sim_profile@%$sim_profile%g
+ s%@EXEEXT@%$EXEEXT%g
+ 
+ CEOF
+ EOF
+ 
+ cat >> $CONFIG_STATUS <<\EOF
+ 
+ # Split the substitutions into bite-sized pieces for seds with
+ # small command number limits, like on Digital OSF/1 and HP-UX.
+ ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
+ ac_file=1 # Number of current file.
+ ac_beg=1 # First line for current file.
+ ac_end=$ac_max_sed_cmds # Line after last line for current file.
+ ac_more_lines=:
+ ac_sed_cmds=""
+ while $ac_more_lines; do
+   if test $ac_beg -gt 1; then
+     sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
+   else
+     sed "${ac_end}q" conftest.subs > conftest.s$ac_file
+   fi
+   if test ! -s conftest.s$ac_file; then
+     ac_more_lines=false
+     rm -f conftest.s$ac_file
+   else
+     if test -z "$ac_sed_cmds"; then
+       ac_sed_cmds="sed -f conftest.s$ac_file"
+     else
+       ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
+     fi
+     ac_file=`expr $ac_file + 1`
+     ac_beg=$ac_end
+     ac_end=`expr $ac_end + $ac_max_sed_cmds`
+   fi
+ done
+ if test -z "$ac_sed_cmds"; then
+   ac_sed_cmds=cat
+ fi
+ EOF
+ 
+ cat >> $CONFIG_STATUS <<EOF
+ 
+ CONFIG_FILES=\${CONFIG_FILES-"Makefile.sim:Makefile.in Make-common.sim:../common/Make-common.in .gdbinit:../common/gdbinit.in"}
+ EOF
+ cat >> $CONFIG_STATUS <<\EOF
+ for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
+   # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+   case "$ac_file" in
+   *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+        ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+   *) ac_file_in="${ac_file}.in" ;;
+   esac
+ 
+   # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
+ 
+   # Remove last slash and all that follows it.  Not all systems have dirname.
+   ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+   if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+     # The file is in a subdirectory.
+     test ! -d "$ac_dir" && mkdir "$ac_dir"
+     ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
+     # A "../" for each directory in $ac_dir_suffix.
+     ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
+   else
+     ac_dir_suffix= ac_dots=
+   fi
+ 
+   case "$ac_given_srcdir" in
+   .)  srcdir=.
+       if test -z "$ac_dots"; then top_srcdir=.
+       else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
+   /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
+   *) # Relative path.
+     srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
+     top_srcdir="$ac_dots$ac_given_srcdir" ;;
+   esac
+ 
+   case "$ac_given_INSTALL" in
+   [/$]*) INSTALL="$ac_given_INSTALL" ;;
+   *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
+   esac
+ 
+   echo creating "$ac_file"
+   rm -f "$ac_file"
+   configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
+   case "$ac_file" in
+   *Makefile*) ac_comsub="1i\\
+ # $configure_input" ;;
+   *) ac_comsub= ;;
+   esac
+ 
+   ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+   sed -e "$ac_comsub
+ s%@configure_input@%$configure_input%g
+ s%@srcdir@%$srcdir%g
+ s%@top_srcdir@%$top_srcdir%g
+ s%@INSTALL@%$INSTALL%g
+ " $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
+ fi; done
+ rm -f conftest.s*
+ 
+ # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
+ # NAME is the cpp macro being defined and VALUE is the value it is being given.
+ #
+ # ac_d sets the value in "#define NAME VALUE" lines.
+ ac_dA='s%^\([ 	]*\)#\([ 	]*define[ 	][ 	]*\)'
+ ac_dB='\([ 	][ 	]*\)[^ 	]*%\1#\2'
+ ac_dC='\3'
+ ac_dD='%g'
+ # ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
+ ac_uA='s%^\([ 	]*\)#\([ 	]*\)undef\([ 	][ 	]*\)'
+ ac_uB='\([ 	]\)%\1#\2define\3'
+ ac_uC=' '
+ ac_uD='\4%g'
+ # ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ ac_eA='s%^\([ 	]*\)#\([ 	]*\)undef\([ 	][ 	]*\)'
+ ac_eB='$%\1#\2define\3'
+ ac_eC=' '
+ ac_eD='%g'
+ 
+ if test "${CONFIG_HEADERS+set}" != set; then
+ EOF
+ cat >> $CONFIG_STATUS <<EOF
+   CONFIG_HEADERS="config.h:config.in"
+ EOF
+ cat >> $CONFIG_STATUS <<\EOF
+ fi
+ for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
+   # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+   case "$ac_file" in
+   *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+        ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+   *) ac_file_in="${ac_file}.in" ;;
+   esac
+ 
+   echo creating $ac_file
+ 
+   rm -f conftest.frag conftest.in conftest.out
+   ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+   cat $ac_file_inputs > conftest.in
+ 
+ EOF
+ 
+ # Transform confdefs.h into a sed script conftest.vals that substitutes
+ # the proper values into config.h.in to produce config.h.  And first:
+ # Protect against being on the right side of a sed subst in config.status.
+ # Protect against being in an unquoted here document in config.status.
+ rm -f conftest.vals
+ cat > conftest.hdr <<\EOF
+ s/[\\&%]/\\&/g
+ s%[\\$`]%\\&%g
+ s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
+ s%ac_d%ac_u%gp
+ s%ac_u%ac_e%gp
+ EOF
+ sed -n -f conftest.hdr confdefs.h > conftest.vals
+ rm -f conftest.hdr
+ 
+ # This sed command replaces #undef with comments.  This is necessary, for
+ # example, in the case of _POSIX_SOURCE, which is predefined and required
+ # on some systems where configure will not decide to define it.
+ cat >> conftest.vals <<\EOF
+ s%^[ 	]*#[ 	]*undef[ 	][ 	]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
+ EOF
+ 
+ # Break up conftest.vals because some shells have a limit on
+ # the size of here documents, and old seds have small limits too.
+ 
+ rm -f conftest.tail
+ while :
+ do
+   ac_lines=`grep -c . conftest.vals`
+   # grep -c gives empty output for an empty file on some AIX systems.
+   if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
+   # Write a limited-size here document to conftest.frag.
+   echo '  cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
+   sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
+   echo 'CEOF
+   sed -f conftest.frag conftest.in > conftest.out
+   rm -f conftest.in
+   mv conftest.out conftest.in
+ ' >> $CONFIG_STATUS
+   sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
+   rm -f conftest.vals
+   mv conftest.tail conftest.vals
+ done
+ rm -f conftest.vals
+ 
+ cat >> $CONFIG_STATUS <<\EOF
+   rm -f conftest.frag conftest.h
+   echo "/* $ac_file.  Generated automatically by configure.  */" > conftest.h
+   cat conftest.in >> conftest.h
+   rm -f conftest.in
+   if cmp -s $ac_file conftest.h 2>/dev/null; then
+     echo "$ac_file is unchanged"
+     rm -f conftest.h
+   else
+     # Remove last slash and all that follows it.  Not all systems have dirname.
+       ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+       if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+       # The file is in a subdirectory.
+       test ! -d "$ac_dir" && mkdir "$ac_dir"
+     fi
+     rm -f $ac_file
+     mv conftest.h $ac_file
+   fi
+ fi; done
+ 
+ EOF
+ 
+ cat >> $CONFIG_STATUS <<EOF
+ ac_sources="$sim_link_files"
+ ac_dests="$sim_link_links"
+ EOF
+ 
+ cat >> $CONFIG_STATUS <<\EOF
+ srcdir=$ac_given_srcdir
+ while test -n "$ac_sources"; do
+   set $ac_dests; ac_dest=$1; shift; ac_dests=$*
+   set $ac_sources; ac_source=$1; shift; ac_sources=$*
+ 
+   echo "linking $srcdir/$ac_source to $ac_dest"
+ 
+   if test ! -r $srcdir/$ac_source; then
+     { echo "configure: error: $srcdir/$ac_source: File not found" 1>&2; exit 1; }
+   fi
+   rm -f $ac_dest
+ 
+   # Make relative symlinks.
+   # Remove last slash and all that follows it.  Not all systems have dirname.
+   ac_dest_dir=`echo $ac_dest|sed 's%/[^/][^/]*$%%'`
+   if test "$ac_dest_dir" != "$ac_dest" && test "$ac_dest_dir" != .; then
+     # The dest file is in a subdirectory.
+     test ! -d "$ac_dest_dir" && mkdir "$ac_dest_dir"
+     ac_dest_dir_suffix="/`echo $ac_dest_dir|sed 's%^\./%%'`"
+     # A "../" for each directory in $ac_dest_dir_suffix.
+     ac_dots=`echo $ac_dest_dir_suffix|sed 's%/[^/]*%../%g'`
+   else
+     ac_dest_dir_suffix= ac_dots=
+   fi
+ 
+   case "$srcdir" in
+   [/$]*) ac_rel_source="$srcdir/$ac_source" ;;
+   *) ac_rel_source="$ac_dots$srcdir/$ac_source" ;;
+   esac
+ 
+   # Make a symlink if possible; otherwise try a hard link.
+   if ln -s $ac_rel_source $ac_dest 2>/dev/null ||
+     ln $srcdir/$ac_source $ac_dest; then :
+   else
+     { echo "configure: error: can not link $ac_dest to $srcdir/$ac_source" 1>&2; exit 1; }
+   fi
+ done
+ EOF
+ cat >> $CONFIG_STATUS <<EOF
+ 
+ EOF
+ cat >> $CONFIG_STATUS <<\EOF
+ case "x$CONFIG_FILES" in
+  xMakefile*)
+    echo "Merging Makefile.sim+Make-common.sim into Makefile ..."
+    rm -f Makesim1.tmp Makesim2.tmp Makefile
+    sed -n -e '/^## COMMON_PRE_/,/^## End COMMON_PRE_/ p' <Make-common.sim >Makesim1.tmp
+    sed -n -e '/^## COMMON_POST_/,/^## End COMMON_POST_/ p' <Make-common.sim >Makesim2.tmp
+    sed -e '/^## COMMON_PRE_/ r Makesim1.tmp' \
+ 	-e '/^## COMMON_POST_/ r Makesim2.tmp' \
+ 	<Makefile.sim >Makefile
+    rm -f Makefile.sim Make-common.sim Makesim1.tmp Makesim2.tmp
+    ;;
+  esac
+  case "x$CONFIG_HEADERS" in xconfig.h:config.in) echo > stamp-h ;; esac
+ 
+ exit 0
+ EOF
+ chmod +x $CONFIG_STATUS
+ rm -fr confdefs* $ac_clean_files
+ test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+ 
+ 
diff -Nrc3p /dunes/wcohen/virg-netgdb/src/sim/m68k/custom.h src/sim/m68k/custom.h
*** /dunes/wcohen/virg-netgdb/src/sim/m68k/custom.h	Wed Dec 31 19:00:00 1969
--- src/sim/m68k/custom.h	Mon Feb 19 14:10:25 2001
***************
*** 0 ****
--- 1,129 ----
+  /*
+   * UAE - The Un*x Amiga Emulator
+   *
+   * custom chip support
+   *
+   * (c) 1995 Bernd Schmidt
+   */
+ 
+ /* These are the masks that are ORed together in the chipset_mask option.
+  * If CSMASK_AGA is set, the ECS bits are guaranteed to be set as well.  */
+ #define CSMASK_ECS_AGNUS 1
+ #define CSMASK_ECS_DENISE 2
+ #define CSMASK_AGA 4
+ 
+ extern void custom_init (void);
+ extern void customreset (void);
+ extern int intlev (void);
+ extern void dumpcustom (void);
+ 
+ extern void do_disk (void);
+ extern void do_copper (void);
+ 
+ extern void notice_new_xcolors (void);
+ extern void notice_screen_contents_lost (void);
+ extern void init_row_map (void);
+ 
+ extern int picasso_requested_on;
+ extern int picasso_on;
+ 
+ extern int trace;
+ extern int verbose_trace;
+ 
+ /* Set to 1 to leave out the current frame in average frame time calculation.
+  * Useful if the debugger was active.  */
+ extern int bogusframe;
+ 
+ extern uae_u16 dmacon;
+ extern uae_u16 intena,intreq;
+ 
+ extern int current_hpos (void);
+ extern int vpos;
+ 
+ extern int n_frames;
+ 
+ STATIC_INLINE int dmaen (unsigned int dmamask)
+ {
+     return (dmamask & dmacon) && (dmacon & 0x200);
+ }
+ 
+ #define SPCFLAG_STOP 2
+ #define SPCFLAG_COPPER 4
+ #define SPCFLAG_INT 8
+ #define SPCFLAG_BRK 16
+ #define SPCFLAG_EXTRA_CYCLES 32
+ #define SPCFLAG_TRACE 64
+ #define SPCFLAG_DOTRACE 128
+ #define SPCFLAG_DOINT 256
+ #define SPCFLAG_BLTNASTY 512
+ #define SPCFLAG_EXEC 1024
+ #define SPCFLAG_MODE_CHANGE 8192
+ 
+ extern uae_u16 adkcon;
+ 
+ extern unsigned int joy0dir, joy1dir;
+ extern int joy0button, joy1button;
+ 
+ extern void INTREQ (uae_u16);
+ extern uae_u16 INTREQR (void);
+ 
+ /* maximums for statically allocated tables */
+ 
+ #define MAXHPOS 227
+ #define MAXVPOS 312
+ 
+ /* PAL/NTSC values */
+ 
+ /* The HRM says: The vertical blanking area (PAL) ranges from line 0 to line 29,
+  * and no data can be displayed there. Nevertheless, we lose some overscan data
+  * if minfirstline is set to 29. */
+ 
+ #define MAXHPOS_PAL 227
+ #define MAXHPOS_NTSC 227
+ #define MAXVPOS_PAL 312
+ #define MAXVPOS_NTSC 262
+ #define MINFIRSTLINE_PAL 21
+ #define MINFIRSTLINE_NTSC 18
+ #define VBLANK_ENDLINE_PAL 29
+ #define VBLANK_ENDLINE_NTSC 24
+ #define VBLANK_HZ_PAL 50
+ #define VBLANK_HZ_NTSC 60
+ 
+ extern int maxhpos, maxvpos, minfirstline, vblank_endline, numscrlines, vblank_hz;
+ extern unsigned long syncbase;
+ #define NUMSCRLINES (maxvpos+1-minfirstline+1)
+ 
+ #define DMA_AUD0      0x0001
+ #define DMA_AUD1      0x0002
+ #define DMA_AUD2      0x0004
+ #define DMA_AUD3      0x0008
+ #define DMA_DISK      0x0010
+ #define DMA_SPRITE    0x0020
+ #define DMA_BLITTER   0x0040
+ #define DMA_COPPER    0x0080
+ #define DMA_BITPLANE  0x0100
+ #define DMA_MASTER    0x0200
+ #define DMA_BLITPRI   0x0400
+ 
+ extern unsigned long frametime, timeframes;
+ 
+ /* 50 words give you 800 horizontal pixels. An A500 can't do that, so it ought
+  * to be enough.  Don't forget to update the definition in genp2c.c as well.  */
+ #define MAX_WORDS_PER_LINE 50
+ 
+ extern uae_u32 hirestab_h[256][2];
+ extern uae_u32 lorestab_h[256][4];
+ 
+ extern uae_u32 hirestab_l[256][1];
+ extern uae_u32 lorestab_l[256][2];
+ 
+ /* AGA mode color lookup tables */
+ extern unsigned int xredcolors[256], xgreencolors[256], xbluecolors[256];
+ 
+ /* get resolution from bplcon0 */
+ #define GET_RES(CON0) (((CON0) & 0x8000) ? RES_HIRES : ((CON0) & 0x40) ? RES_SUPERHIRES : RES_LORES)
+ /* get sprite width from FMODE */
+ #define GET_SPRITEWIDTH(FMODE) ((((FMODE) >> 2) & 3) == 3 ? 64 : (((FMODE) >> 2) & 3) == 0 ? 16 : 32)
+ /* Compute the number of bitplanes from a value written to BPLCON0  */
+ #define GET_PLANES(x) ((((x) >> 12) & 7) | (((x) & 0x10) >> 1))
+ 
diff -Nrc3p /dunes/wcohen/virg-netgdb/src/sim/m68k/fpp.c src/sim/m68k/fpp.c
*** /dunes/wcohen/virg-netgdb/src/sim/m68k/fpp.c	Wed Dec 31 19:00:00 1969
--- src/sim/m68k/fpp.c	Mon Feb 19 14:10:25 2001
***************
*** 0 ****
--- 1,1233 ----
+  /*
+   * UAE - The Un*x Amiga Emulator
+   *
+   * MC68881 emulation
+   *
+   * Copyright 1996 Herman ten Brugge
+   */
+ 
+ #include <math.h>
+ 
+ #include "sysconfig.h"
+ #include "sysdeps.h"
+ 
+ #include "config.h"
+ #include "options.h"
+ #include "memory.h"
+ #include "custom.h"
+ #include "newcpu.h"
+ #include "ersatz.h"
+ #include "md-fpp.h"
+ 
+ #if 1
+ 
+ #define	DEBUG_FPP	0
+ 
+ #define MAKE_FPSR(fpsr,r) (fpsr) = ((fpsr) & 0x00FFFFFF) | ((r) == 0 ? 0x4000000 : 0) | ((r) < 0 ? 0x8000000 : 0)
+ 
+ /* single   : S  8*E 23*F */
+ /* double   : S 11*E 52*F */
+ /* extended : S 15*E 64*F */
+ /* E = 0 & F = 0 -> 0 */
+ /* E = MAX & F = 0 -> Infin */
+ /* E = MAX & F # 0 -> NotANumber */
+ /* E = biased by 127 (single) ,1023 (double) ,16383 (extended) */
+ 
+ STATIC_INLINE double to_pack (uae_u32 wrd1, uae_u32 wrd2, uae_u32 wrd3)
+ {
+     double d;
+     char *cp;
+     char str[100];
+ 
+     cp = str;
+     if (wrd1 & 0x80000000)
+ 	*cp++ = '-';
+     *cp++ = (wrd1 & 0xf) + '0';
+     *cp++ = '.';
+     *cp++ = ((wrd2 >> 28) & 0xf) + '0';
+     *cp++ = ((wrd2 >> 24) & 0xf) + '0';
+     *cp++ = ((wrd2 >> 20) & 0xf) + '0';
+     *cp++ = ((wrd2 >> 16) & 0xf) + '0';
+     *cp++ = ((wrd2 >> 12) & 0xf) + '0';
+     *cp++ = ((wrd2 >> 8) & 0xf) + '0';
+     *cp++ = ((wrd2 >> 4) & 0xf) + '0';
+     *cp++ = ((wrd2 >> 0) & 0xf) + '0';
+     *cp++ = ((wrd3 >> 28) & 0xf) + '0';
+     *cp++ = ((wrd3 >> 24) & 0xf) + '0';
+     *cp++ = ((wrd3 >> 20) & 0xf) + '0';
+     *cp++ = ((wrd3 >> 16) & 0xf) + '0';
+     *cp++ = ((wrd3 >> 12) & 0xf) + '0';
+     *cp++ = ((wrd3 >> 8) & 0xf) + '0';
+     *cp++ = ((wrd3 >> 4) & 0xf) + '0';
+     *cp++ = ((wrd3 >> 0) & 0xf) + '0';
+     *cp++ = 'E';
+     if (wrd1 & 0x40000000)
+ 	*cp++ = '-';
+     *cp++ = ((wrd1 >> 24) & 0xf) + '0';
+     *cp++ = ((wrd1 >> 20) & 0xf) + '0';
+     *cp++ = ((wrd1 >> 16) & 0xf) + '0';
+     *cp = 0;
+     sscanf (str, "%le", &d);
+     return d;
+ }
+ 
+ STATIC_INLINE void from_pack (double src, uae_u32 * wrd1, uae_u32 * wrd2, uae_u32 * wrd3)
+ {
+     int i;
+     int t;
+     char *cp;
+     char str[100];
+ 
+     sprintf (str, "%.16e", src);
+     cp = str;
+     *wrd1 = *wrd2 = *wrd3 = 0;
+     if (*cp == '-') {
+ 	cp++;
+ 	*wrd1 = 0x80000000;
+     }
+     if (*cp == '+')
+ 	cp++;
+     *wrd1 |= (*cp++ - '0');
+     if (*cp == '.')
+ 	cp++;
+     for (i = 0; i < 8; i++) {
+ 	*wrd2 <<= 4;
+ 	if (*cp >= '0' && *cp <= '9')
+ 	    *wrd2 |= *cp++ - '0';
+     }
+     for (i = 0; i < 8; i++) {
+ 	*wrd3 <<= 4;
+ 	if (*cp >= '0' && *cp <= '9')
+ 	    *wrd3 |= *cp++ - '0';
+     }
+     if (*cp == 'e' || *cp == 'E') {
+ 	cp++;
+ 	if (*cp == '-') {
+ 	    cp++;
+ 	    *wrd1 |= 0x40000000;
+ 	}
+ 	if (*cp == '+')
+ 	    cp++;
+ 	t = 0;
+ 	for (i = 0; i < 3; i++) {
+ 	    if (*cp >= '0' && *cp <= '9')
+ 		t = (t << 4) | (*cp++ - '0');
+ 	}
+ 	*wrd1 |= t << 16;
+     }
+ }
+ 
+ STATIC_INLINE int get_fp_value (uae_u32 opcode, uae_u16 extra, double *src)
+ {
+     uaecptr tmppc;
+     uae_u16 tmp;
+     int size;
+     int mode;
+     int reg;
+     uae_u32 ad = 0;
+     static int sz1[8] = { 4, 4, 12, 12, 2, 8, 1, 0 };
+     static int sz2[8] = { 4, 4, 12, 12, 2, 8, 2, 0 };
+ 
+     if ((extra & 0x4000) == 0) {
+ 	*src = regs.fp[(extra >> 10) & 7];
+ 	return 1;
+     }
+     mode = (opcode >> 3) & 7;
+     reg = opcode & 7;
+     size = (extra >> 10) & 7;
+     switch (mode) {
+     case 0:
+ 	switch (size) {
+ 	case 6:
+ 	    *src = (double) (uae_s8) m68k_dreg (regs, reg);
+ 	    break;
+ 	case 4:
+ 	    *src = (double) (uae_s16) m68k_dreg (regs, reg);
+ 	    break;
+ 	case 0:
+ 	    *src = (double) (uae_s32) m68k_dreg (regs, reg);
+ 	    break;
+ 	case 1:
+ 	    *src = to_single (m68k_dreg (regs, reg));
+ 	    break;
+ 	default:
+ 	    return 0;
+ 	}
+ 	return 1;
+     case 1:
+ 	return 0;
+     case 2:
+ 	ad = m68k_areg (regs, reg);
+ 	break;
+     case 3:
+ 	ad = m68k_areg (regs, reg);
+ 	m68k_areg (regs, reg) += reg == 7 ? sz2[size] : sz1[size];
+ 	break;
+     case 4:
+ 	m68k_areg (regs, reg) -= reg == 7 ? sz2[size] : sz1[size];
+ 	ad = m68k_areg (regs, reg);
+ 	break;
+     case 5:
+ 	ad = m68k_areg (regs, reg) + (uae_s32) (uae_s16) next_iword ();
+ 	break;
+     case 6:
+ 	ad = get_disp_ea_020 (m68k_areg (regs, reg), next_iword ());
+ 	break;
+     case 7:
+ 	switch (reg) {
+ 	case 0:
+ 	    ad = (uae_s32) (uae_s16) next_iword ();
+ 	    break;
+ 	case 1:
+ 	    ad = next_ilong ();
+ 	    break;
+ 	case 2:
+ 	    ad = m68k_getpc ();
+ 	    ad += (uae_s32) (uae_s16) next_iword ();
+ 	    break;
+ 	case 3:
+ 	    tmppc = m68k_getpc ();
+ 	    tmp = next_iword ();
+ 	    ad = get_disp_ea_020 (tmppc, tmp);
+ 	    break;
+ 	case 4:
+ 	    ad = m68k_getpc ();
+ 	    m68k_setpc (ad + sz2[size]);
+ 	    break;
+ 	default:
+ 	    return 0;
+ 	}
+     }
+     switch (size) {
+     case 0:
+ 	*src = (double) (uae_s32) get_long (ad);
+ 	break;
+     case 1:
+ 	*src = to_single (get_long (ad));
+ 	break;
+     case 2:{
+ 	    uae_u32 wrd1, wrd2, wrd3;
+ 	    wrd1 = get_long (ad);
+ 	    ad += 4;
+ 	    wrd2 = get_long (ad);
+ 	    ad += 4;
+ 	    wrd3 = get_long (ad);
+ 	    *src = to_exten (wrd1, wrd2, wrd3);
+ 	}
+ 	break;
+     case 3:{
+ 	    uae_u32 wrd1, wrd2, wrd3;
+ 	    wrd1 = get_long (ad);
+ 	    ad += 4;
+ 	    wrd2 = get_long (ad);
+ 	    ad += 4;
+ 	    wrd3 = get_long (ad);
+ 	    *src = to_pack (wrd1, wrd2, wrd3);
+ 	}
+ 	break;
+     case 4:
+ 	*src = (double) (uae_s16) get_word (ad);
+ 	break;
+     case 5:{
+ 	    uae_u32 wrd1, wrd2;
+ 	    wrd1 = get_long (ad);
+ 	    ad += 4;
+ 	    wrd2 = get_long (ad);
+ 	    *src = to_double (wrd1, wrd2);
+ 	}
+ 	break;
+     case 6:
+ 	*src = (double) (uae_s8) get_byte (ad);
+ 	break;
+     default:
+ 	return 0;
+     }
+     return 1;
+ }
+ 
+ STATIC_INLINE int put_fp_value (double value, uae_u32 opcode, uae_u16 extra)
+ {
+     uae_u16 tmp;
+     uaecptr tmppc;
+     int size;
+     int mode;
+     int reg;
+     uae_u32 ad;
+     static int sz1[8] = { 4, 4, 12, 12, 2, 8, 1, 0 };
+     static int sz2[8] = { 4, 4, 12, 12, 2, 8, 2, 0 };
+ 
+     if ((extra & 0x4000) == 0) {
+ 	regs.fp[(extra >> 10) & 7] = value;
+ 	return 1;
+     }
+     mode = (opcode >> 3) & 7;
+     reg = opcode & 7;
+     size = (extra >> 10) & 7;
+     ad = -1;
+     switch (mode) {
+     case 0:
+ 	switch (size) {
+ 	case 6:
+ 	    m68k_dreg (regs, reg) = (((int) value & 0xff)
+ 				     | (m68k_dreg (regs, reg) & ~0xff));
+ 	    break;
+ 	case 4:
+ 	    m68k_dreg (regs, reg) = (((int) value & 0xffff)
+ 				     | (m68k_dreg (regs, reg) & ~0xffff));
+ 	    break;
+ 	case 0:
+ 	    m68k_dreg (regs, reg) = (int) value;
+ 	    break;
+ 	case 1:
+ 	    m68k_dreg (regs, reg) = from_single (value);
+ 	    break;
+ 	default:
+ 	    return 0;
+ 	}
+ 	return 1;
+     case 1:
+ 	return 0;
+     case 2:
+ 	ad = m68k_areg (regs, reg);
+ 	break;
+     case 3:
+ 	ad = m68k_areg (regs, reg);
+ 	m68k_areg (regs, reg) += reg == 7 ? sz2[size] : sz1[size];
+ 	break;
+     case 4:
+ 	m68k_areg (regs, reg) -= reg == 7 ? sz2[size] : sz1[size];
+ 	ad = m68k_areg (regs, reg);
+ 	break;
+     case 5:
+ 	ad = m68k_areg (regs, reg) + (uae_s32) (uae_s16) next_iword ();
+ 	break;
+     case 6:
+ 	ad = get_disp_ea_020 (m68k_areg (regs, reg), next_iword ());
+ 	break;
+     case 7:
+ 	switch (reg) {
+ 	case 0:
+ 	    ad = (uae_s32) (uae_s16) next_iword ();
+ 	    break;
+ 	case 1:
+ 	    ad = next_ilong ();
+ 	    break;
+ 	case 2:
+ 	    ad = m68k_getpc ();
+ 	    ad += (uae_s32) (uae_s16) next_iword ();
+ 	    break;
+ 	case 3:
+ 	    tmppc = m68k_getpc ();
+ 	    tmp = next_iword ();
+ 	    ad = get_disp_ea_020 (tmppc, tmp);
+ 	    break;
+ 	case 4:
+ 	    ad = m68k_getpc ();
+ 	    m68k_setpc (ad + sz2[size]);
+ 	    break;
+ 	default:
+ 	    return 0;
+ 	}
+     }
+     switch (size) {
+     case 0:
+ 	put_long (ad, (uae_s32) value);
+ 	break;
+     case 1:
+ 	put_long (ad, from_single (value));
+ 	break;
+     case 2:
+ 	{
+ 	    uae_u32 wrd1, wrd2, wrd3;
+ 	    from_exten (value, &wrd1, &wrd2, &wrd3);
+ 	    put_long (ad, wrd1);
+ 	    ad += 4;
+ 	    put_long (ad, wrd2);
+ 	    ad += 4;
+ 	    put_long (ad, wrd3);
+ 	}
+ 	break;
+     case 3:
+ 	{
+ 	    uae_u32 wrd1, wrd2, wrd3;
+ 	    from_pack (value, &wrd1, &wrd2, &wrd3);
+ 	    put_long (ad, wrd1);
+ 	    ad += 4;
+ 	    put_long (ad, wrd2);
+ 	    ad += 4;
+ 	    put_long (ad, wrd3);
+ 	}
+ 	break;
+     case 4:
+ 	put_word (ad, (uae_s16) value);
+ 	break;
+     case 5:{
+ 	    uae_u32 wrd1, wrd2;
+ 	    from_double (value, &wrd1, &wrd2);
+ 	    put_long (ad, wrd1);
+ 	    ad += 4;
+ 	    put_long (ad, wrd2);
+ 	}
+ 	break;
+     case 6:
+ 	put_byte (ad, (uae_s8) value);
+ 	break;
+     default:
+ 	return 0;
+     }
+     return 1;
+ }
+ 
+ STATIC_INLINE int get_fp_ad (uae_u32 opcode, uae_u32 * ad)
+ {
+     uae_u16 tmp;
+     uaecptr tmppc;
+     int mode;
+     int reg;
+ 
+     mode = (opcode >> 3) & 7;
+     reg = opcode & 7;
+     switch (mode) {
+     case 0:
+     case 1:
+ 	return 0;
+     case 2:
+ 	*ad = m68k_areg (regs, reg);
+ 	break;
+     case 3:
+ 	*ad = m68k_areg (regs, reg);
+ 	break;
+     case 4:
+ 	*ad = m68k_areg (regs, reg);
+ 	break;
+     case 5:
+ 	*ad = m68k_areg (regs, reg) + (uae_s32) (uae_s16) next_iword ();
+ 	break;
+     case 6:
+ 	*ad = get_disp_ea_020 (m68k_areg (regs, reg), next_iword ());
+ 	break;
+     case 7:
+ 	switch (reg) {
+ 	case 0:
+ 	    *ad = (uae_s32) (uae_s16) next_iword ();
+ 	    break;
+ 	case 1:
+ 	    *ad = next_ilong ();
+ 	    break;
+ 	case 2:
+ 	    *ad = m68k_getpc ();
+ 	    *ad += (uae_s32) (uae_s16) next_iword ();
+ 	    break;
+ 	case 3:
+ 	    tmppc = m68k_getpc ();
+ 	    tmp = next_iword ();
+ 	    *ad = get_disp_ea_020 (tmppc, tmp);
+ 	    break;
+ 	default:
+ 	    return 0;
+ 	}
+     }
+     return 1;
+ }
+ 
+ STATIC_INLINE int fpp_cond (uae_u32 opcode, int contition)
+ {
+     int N = (regs.fpsr & 0x8000000) != 0;
+     int Z = (regs.fpsr & 0x4000000) != 0;
+     /* int I = (regs.fpsr & 0x2000000) != 0; */
+     int NotANumber = (regs.fpsr & 0x1000000) != 0;
+ 
+     switch (contition) {
+     case 0x00:
+ 	return 0;
+     case 0x01:
+ 	return Z;
+     case 0x02:
+ 	return !(NotANumber || Z || N);
+     case 0x03:
+ 	return Z || !(NotANumber || N);
+     case 0x04:
+ 	return N && !(NotANumber || Z);
+     case 0x05:
+ 	return Z || (N && !NotANumber);
+     case 0x06:
+ 	return !(NotANumber || Z);
+     case 0x07:
+ 	return !NotANumber;
+     case 0x08:
+ 	return NotANumber;
+     case 0x09:
+ 	return NotANumber || Z;
+     case 0x0a:
+ 	return NotANumber || !(N || Z);
+     case 0x0b:
+ 	return NotANumber || Z || !N;
+     case 0x0c:
+ 	return NotANumber || (N && !Z);
+     case 0x0d:
+ 	return NotANumber || Z || N;
+     case 0x0e:
+ 	return !Z;
+     case 0x0f:
+ 	return 1;
+     case 0x10:
+ 	return 0;
+     case 0x11:
+ 	return Z;
+     case 0x12:
+ 	return !(NotANumber || Z || N);
+     case 0x13:
+ 	return Z || !(NotANumber || N);
+     case 0x14:
+ 	return N && !(NotANumber || Z);
+     case 0x15:
+ 	return Z || (N && !NotANumber);
+     case 0x16:
+ 	return !(NotANumber || Z);
+     case 0x17:
+ 	return !NotANumber;
+     case 0x18:
+ 	return NotANumber;
+     case 0x19:
+ 	return NotANumber || Z;
+     case 0x1a:
+ 	return NotANumber || !(N || Z);
+     case 0x1b:
+ 	return NotANumber || Z || !N;
+     case 0x1c:
+ 	return NotANumber || (Z && N);
+     case 0x1d:
+ 	return NotANumber || Z || N;
+     case 0x1e:
+ 	return !Z;
+     case 0x1f:
+ 	return 1;
+     }
+     return -1;
+ }
+ 
+ void fdbcc_opp (uae_u32 opcode, uae_u16 extra)
+ {
+     uaecptr pc = (uae_u32) m68k_getpc ();
+     uae_s32 disp = (uae_s32) (uae_s16) next_iword ();
+     int cc;
+ 
+ #if DEBUG_FPP
+     printf ("fdbcc_opp at %08lx\n", m68k_getpc ());
+     fflush (stdout);
+ #endif
+     cc = fpp_cond (opcode, extra & 0x3f);
+     if (cc == -1) {
+ 	m68k_setpc (pc - 4);
+ 	op_illg (opcode);
+     } else if (!cc) {
+ 	int reg = opcode & 0x7;
+ 
+ 	m68k_dreg (regs, reg) = ((m68k_dreg (regs, reg) & ~0xffff)
+ 				 | ((m68k_dreg (regs, reg) - 1) & 0xffff));
+ 	if ((m68k_dreg (regs, reg) & 0xffff) == 0xffff)
+ 	    m68k_setpc (pc + disp);
+     }
+ }
+ 
+ void fscc_opp (uae_u32 opcode, uae_u16 extra)
+ {
+     uae_u32 ad;
+     int cc;
+ 
+ #if DEBUG_FPP
+     printf ("fscc_opp at %08lx\n", m68k_getpc ());
+     fflush (stdout);
+ #endif
+     cc = fpp_cond (opcode, extra & 0x3f);
+     if (cc == -1) {
+ 	m68k_setpc (m68k_getpc () - 4);
+ 	op_illg (opcode);
+     } else if ((opcode & 0x38) == 0) {
+ 	m68k_dreg (regs, opcode & 7) = (m68k_dreg (regs, opcode & 7) & ~0xff) | (cc ? 0xff : 0x00);
+     } else {
+ 	if (get_fp_ad (opcode, &ad) == 0) {
+ 	    m68k_setpc (m68k_getpc () - 4);
+ 	    op_illg (opcode);
+ 	} else
+ 	    put_byte (ad, cc ? 0xff : 0x00);
+     }
+ }
+ 
+ void ftrapcc_opp (uae_u32 opcode, uaecptr oldpc)
+ {
+     int cc;
+ 
+ #if DEBUG_FPP
+     printf ("ftrapcc_opp at %08lx\n", m68k_getpc ());
+     fflush (stdout);
+ #endif
+     cc = fpp_cond (opcode, opcode & 0x3f);
+     if (cc == -1) {
+ 	m68k_setpc (oldpc);
+ 	op_illg (opcode);
+     }
+     if (cc)
+ 	Exception (7, oldpc - 2);
+ }
+ 
+ void fbcc_opp (uae_u32 opcode, uaecptr pc, uae_u32 extra)
+ {
+     int cc;
+ 
+ #if DEBUG_FPP
+     printf ("fbcc_opp at %08lx\n", m68k_getpc ());
+     fflush (stdout);
+ #endif
+     cc = fpp_cond (opcode, opcode & 0x3f);
+     if (cc == -1) {
+ 	m68k_setpc (pc);
+ 	op_illg (opcode);
+     } else if (cc) {
+ 	if ((opcode & 0x40) == 0)
+ 	    extra = (uae_s32) (uae_s16) extra;
+ 	m68k_setpc (pc + extra);
+     }
+ }
+ 
+ void fsave_opp (uae_u32 opcode)
+ {
+     uae_u32 ad;
+     int incr = (opcode & 0x38) == 0x20 ? -1 : 1;
+     int i;
+ 
+ #if DEBUG_FPP
+     printf ("fsave_opp at %08lx\n", m68k_getpc ());
+     fflush (stdout);
+ #endif
+     if (get_fp_ad (opcode, &ad) == 0) {
+ 	m68k_setpc (m68k_getpc () - 2);
+ 	op_illg (opcode);
+ 	return;
+     }
+ 
+     if (currprefs.cpu_level == 4) {
+ 	/* 4 byte 68040 IDLE frame.  */
+ 	if (incr < 0) {
+ 	    ad -= 4;
+ 	    put_long (ad, 0x41000000);
+ 	} else {
+ 	    put_long (ad, 0x41000000);
+ 	    ad += 4;
+ 	}
+     } else {
+ 	if (incr < 0) {
+ 	    ad -= 4;
+ 	    put_long (ad, 0x70000000);
+ 	    for (i = 0; i < 5; i++) {
+ 		ad -= 4;
+ 		put_long (ad, 0x00000000);
+ 	    }
+ 	    ad -= 4;
+ 	    put_long (ad, 0x1f180000);
+ 	} else {
+ 	    put_long (ad, 0x1f180000);
+ 	    ad += 4;
+ 	    for (i = 0; i < 5; i++) {
+ 		put_long (ad, 0x00000000);
+ 		ad += 4;
+ 	    }
+ 	    put_long (ad, 0x70000000);
+ 	    ad += 4;
+ 	}
+     }
+     if ((opcode & 0x38) == 0x18)
+ 	m68k_areg (regs, opcode & 7) = ad;
+     if ((opcode & 0x38) == 0x20)
+ 	m68k_areg (regs, opcode & 7) = ad;
+ }
+ 
+ void frestore_opp (uae_u32 opcode)
+ {
+     uae_u32 ad;
+     uae_u32 d;
+     int incr = (opcode & 0x38) == 0x20 ? -1 : 1;
+ 
+ #if DEBUG_FPP
+     printf ("frestore_opp at %08lx\n", m68k_getpc ());
+     fflush (stdout);
+ #endif
+     if (get_fp_ad (opcode, &ad) == 0) {
+ 	m68k_setpc (m68k_getpc () - 2);
+ 	op_illg (opcode);
+ 	return;
+     }
+     if (currprefs.cpu_level == 4) {
+ 	/* 68040 */
+ 	if (incr < 0) {
+ 	    /* @@@ This may be wrong.  */
+ 	    ad -= 4;
+ 	    d = get_long (ad);
+ 	    if ((d & 0xff000000) != 0) { /* Not a NULL frame? */
+ 		if ((d & 0x00ff0000) == 0) { /* IDLE */
+ 		} else if ((d & 0x00ff0000) == 0x00300000) { /* UNIMP */
+ 		    ad -= 44;
+ 		} else if ((d & 0x00ff0000) == 0x00600000) { /* BUSY */
+ 		    ad -= 92;
+ 		}
+ 	    }
+ 	} else {
+ 	    d = get_long (ad);
+ 	    ad += 4;
+ 	    if ((d & 0xff000000) != 0) { /* Not a NULL frame? */
+ 		if ((d & 0x00ff0000) == 0) { /* IDLE */
+ 		} else if ((d & 0x00ff0000) == 0x00300000) { /* UNIMP */
+ 		    ad += 44;
+ 		} else if ((d & 0x00ff0000) == 0x00600000) { /* BUSY */
+ 		    ad += 92;
+ 		}
+ 	    }
+ 	}
+     } else {
+ 	if (incr < 0) {
+ 	    ad -= 4;
+ 	    d = get_long (ad);
+ 	    if ((d & 0xff000000) != 0) {
+ 		if ((d & 0x00ff0000) == 0x00180000)
+ 		    ad -= 6 * 4;
+ 		else if ((d & 0x00ff0000) == 0x00380000)
+ 		    ad -= 14 * 4;
+ 		else if ((d & 0x00ff0000) == 0x00b40000)
+ 		    ad -= 45 * 4;
+ 	    }
+ 	} else {
+ 	    d = get_long (ad);
+ 	    ad += 4;
+ 	    if ((d & 0xff000000) != 0) {
+ 		if ((d & 0x00ff0000) == 0x00180000)
+ 		    ad += 6 * 4;
+ 		else if ((d & 0x00ff0000) == 0x00380000)
+ 		    ad += 14 * 4;
+ 		else if ((d & 0x00ff0000) == 0x00b40000)
+ 		    ad += 45 * 4;
+ 	    }
+ 	}
+     }
+     if ((opcode & 0x38) == 0x18)
+ 	m68k_areg (regs, opcode & 7) = ad;
+     if ((opcode & 0x38) == 0x20)
+ 	m68k_areg (regs, opcode & 7) = ad;
+ }
+ 
+ void fpp_opp (uae_u32 opcode, uae_u16 extra)
+ {
+     int reg;
+     double src;
+ 
+ #if DEBUG_FPP
+     printf ("FPP %04lx %04x at %08lx\n", opcode & 0xffff, extra & 0xffff, m68k_getpc () - 4);
+     fflush (stdout);
+ #endif
+     switch ((extra >> 13) & 0x7) {
+     case 3:
+ 	if (put_fp_value (regs.fp[(extra >> 7) & 7], opcode, extra) == 0) {
+ 	    m68k_setpc (m68k_getpc () - 4);
+ 	    op_illg (opcode);
+ 	}
+ 	return;
+     case 4:
+     case 5:
+ 	if ((opcode & 0x38) == 0) {
+ 	    if (extra & 0x2000) {
+ 		if (extra & 0x1000)
+ 		    m68k_dreg (regs, opcode & 7) = regs.fpcr;
+ 		if (extra & 0x0800)
+ 		    m68k_dreg (regs, opcode & 7) = regs.fpsr;
+ 		if (extra & 0x0400)
+ 		    m68k_dreg (regs, opcode & 7) = regs.fpiar;
+ 	    } else {
+ 		if (extra & 0x1000)
+ 		    regs.fpcr = m68k_dreg (regs, opcode & 7);
+ 		if (extra & 0x0800)
+ 		    regs.fpsr = m68k_dreg (regs, opcode & 7);
+ 		if (extra & 0x0400)
+ 		    regs.fpiar = m68k_dreg (regs, opcode & 7);
+ 	    }
+ 	} else if ((opcode & 0x38) == 1) {
+ 	    if (extra & 0x2000) {
+ 		if (extra & 0x1000)
+ 		    m68k_areg (regs, opcode & 7) = regs.fpcr;
+ 		if (extra & 0x0800)
+ 		    m68k_areg (regs, opcode & 7) = regs.fpsr;
+ 		if (extra & 0x0400)
+ 		    m68k_areg (regs, opcode & 7) = regs.fpiar;
+ 	    } else {
+ 		if (extra & 0x1000)
+ 		    regs.fpcr = m68k_areg (regs, opcode & 7);
+ 		if (extra & 0x0800)
+ 		    regs.fpsr = m68k_areg (regs, opcode & 7);
+ 		if (extra & 0x0400)
+ 		    regs.fpiar = m68k_areg (regs, opcode & 7);
+ 	    }
+ 	} else if ((opcode & 0x3f) == 0x3c) {
+ 	    if ((extra & 0x2000) == 0) {
+ 		if (extra & 0x1000)
+ 		    regs.fpcr = next_ilong ();
+ 		if (extra & 0x0800)
+ 		    regs.fpsr = next_ilong ();
+ 		if (extra & 0x0400)
+ 		    regs.fpiar = next_ilong ();
+ 	    }
+ 	} else if (extra & 0x2000) {
+ 	    /* FMOVEM FPP->memory */
+ 	    uae_u32 ad;
+ 	    int incr = 0;
+ 
+ 	    if (get_fp_ad (opcode, &ad) == 0) {
+ 		m68k_setpc (m68k_getpc () - 4);
+ 		op_illg (opcode);
+ 		return;
+ 	    }
+ 	    if ((opcode & 0x38) == 0x20) {
+ 		if (extra & 0x1000)
+ 		    incr += 4;
+ 		if (extra & 0x0800)
+ 		    incr += 4;
+ 		if (extra & 0x0400)
+ 		    incr += 4;
+ 	    }
+ 	    ad -= incr;
+ 	    if (extra & 0x1000) {
+ 		put_long (ad, regs.fpcr);
+ 		ad += 4;
+ 	    }
+ 	    if (extra & 0x0800) {
+ 		put_long (ad, regs.fpsr);
+ 		ad += 4;
+ 	    }
+ 	    if (extra & 0x0400) {
+ 		put_long (ad, regs.fpiar);
+ 		ad += 4;
+ 	    }
+ 	    ad -= incr;
+ 	    if ((opcode & 0x38) == 0x18)
+ 		m68k_areg (regs, opcode & 7) = ad;
+ 	    if ((opcode & 0x38) == 0x20)
+ 		m68k_areg (regs, opcode & 7) = ad;
+ 	} else {
+ 	    /* FMOVEM memory->FPP */
+ 	    uae_u32 ad;
+ 
+ 	    if (get_fp_ad (opcode, &ad) == 0) {
+ 		m68k_setpc (m68k_getpc () - 4);
+ 		op_illg (opcode);
+ 		return;
+ 	    }
+ 	    ad = (opcode & 0x38) == 0x20 ? ad - 12 : ad;
+ 	    if (extra & 0x1000) {
+ 		regs.fpcr = get_long (ad);
+ 		ad += 4;
+ 	    }
+ 	    if (extra & 0x0800) {
+ 		regs.fpsr = get_long (ad);
+ 		ad += 4;
+ 	    }
+ 	    if (extra & 0x0400) {
+ 		regs.fpiar = get_long (ad);
+ 		ad += 4;
+ 	    }
+ 	    if ((opcode & 0x38) == 0x18)
+ 		m68k_areg (regs, opcode & 7) = ad;
+ 	    if ((opcode & 0x38) == 0x20)
+ 		m68k_areg (regs, opcode & 7) = ad - 12;
+ 	}
+ 	return;
+     case 6:
+     case 7:
+ 	{
+ 	    uae_u32 ad, list = 0;
+ 	    int incr = 0;
+ 	    if (extra & 0x2000) {
+ 		/* FMOVEM FPP->memory */
+ 		if (get_fp_ad (opcode, &ad) == 0) {
+ 		    m68k_setpc (m68k_getpc () - 4);
+ 		    op_illg (opcode);
+ 		    return;
+ 		}
+ 		switch ((extra >> 11) & 3) {
+ 		case 0:	/* static pred */
+ 		    list = extra & 0xff;
+ 		    incr = -1;
+ 		    break;
+ 		case 1:	/* dynamic pred */
+ 		    list = m68k_dreg (regs, (extra >> 4) & 3) & 0xff;
+ 		    incr = -1;
+ 		    break;
+ 		case 2:	/* static postinc */
+ 		    list = extra & 0xff;
+ 		    incr = 1;
+ 		    break;
+ 		case 3:	/* dynamic postinc */
+ 		    list = m68k_dreg (regs, (extra >> 4) & 3) & 0xff;
+ 		    incr = 1;
+ 		    break;
+ 		}
+ 		while (list) {
+ 		    uae_u32 wrd1, wrd2, wrd3;
+ 		    if (incr < 0) {
+ 			from_exten (regs.fp[fpp_movem_index2[list]], &wrd1, &wrd2, &wrd3);
+ 			ad -= 4;
+ 			put_long (ad, wrd3);
+ 			ad -= 4;
+ 			put_long (ad, wrd2);
+ 			ad -= 4;
+ 			put_long (ad, wrd1);
+ 		    } else {
+ 			from_exten (regs.fp[fpp_movem_index1[list]], &wrd1, &wrd2, &wrd3);
+ 			put_long (ad, wrd1);
+ 			ad += 4;
+ 			put_long (ad, wrd2);
+ 			ad += 4;
+ 			put_long (ad, wrd3);
+ 			ad += 4;
+ 		    }
+ 		    list = fpp_movem_next[list];
+ 		}
+ 		if ((opcode & 0x38) == 0x18)
+ 		    m68k_areg (regs, opcode & 7) = ad;
+ 		if ((opcode & 0x38) == 0x20)
+ 		    m68k_areg (regs, opcode & 7) = ad;
+ 	    } else {
+ 		/* FMOVEM memory->FPP */
+ 		if (get_fp_ad (opcode, &ad) == 0) {
+ 		    m68k_setpc (m68k_getpc () - 4);
+ 		    op_illg (opcode);
+ 		    return;
+ 		}
+ 		switch ((extra >> 11) & 3) {
+ 		case 0:	/* static pred */
+ 		    list = extra & 0xff;
+ 		    incr = -1;
+ 		    break;
+ 		case 1:	/* dynamic pred */
+ 		    list = m68k_dreg (regs, (extra >> 4) & 3) & 0xff;
+ 		    incr = -1;
+ 		    break;
+ 		case 2:	/* static postinc */
+ 		    list = extra & 0xff;
+ 		    incr = 1;
+ 		    break;
+ 		case 3:	/* dynamic postinc */
+ 		    list = m68k_dreg (regs, (extra >> 4) & 3) & 0xff;
+ 		    incr = 1;
+ 		    break;
+ 		}
+ 		while (list) {
+ 		    uae_u32 wrd1, wrd2, wrd3;
+ 		    if (incr < 0) {
+ 			ad -= 4;
+ 			wrd3 = get_long (ad);
+ 			ad -= 4;
+ 			wrd2 = get_long (ad);
+ 			ad -= 4;
+ 			wrd1 = get_long (ad);
+ 			regs.fp[fpp_movem_index2[list]] = to_exten (wrd1, wrd2, wrd3);
+ 		    } else {
+ 			wrd1 = get_long (ad);
+ 			ad += 4;
+ 			wrd2 = get_long (ad);
+ 			ad += 4;
+ 			wrd3 = get_long (ad);
+ 			ad += 4;
+ 			regs.fp[fpp_movem_index1[list]] = to_exten (wrd1, wrd2, wrd3);
+ 		    }
+ 		    list = fpp_movem_next[list];
+ 		}
+ 		if ((opcode & 0x38) == 0x18)
+ 		    m68k_areg (regs, opcode & 7) = ad;
+ 		if ((opcode & 0x38) == 0x20)
+ 		    m68k_areg (regs, opcode & 7) = ad;
+ 	    }
+ 	}
+ 	return;
+     case 0:
+     case 2:
+ 	reg = (extra >> 7) & 7;
+ 	if ((extra & 0xfc00) == 0x5c00) {
+ 	    switch (extra & 0x7f) {
+ 	    case 0x00:
+ 		regs.fp[reg] = 4.0 * atan (1.0);
+ 		break;
+ 	    case 0x0b:
+ 		regs.fp[reg] = log10 (2.0);
+ 		break;
+ 	    case 0x0c:
+ 		regs.fp[reg] = exp (1.0);
+ 		break;
+ 	    case 0x0d:
+ 		regs.fp[reg] = log (exp (1.0)) / log (2.0);
+ 		break;
+ 	    case 0x0e:
+ 		regs.fp[reg] = log (exp (1.0)) / log (10.0);
+ 		break;
+ 	    case 0x0f:
+ 		regs.fp[reg] = 0.0;
+ 		break;
+ 	    case 0x30:
+ 		regs.fp[reg] = log (2.0);
+ 		break;
+ 	    case 0x31:
+ 		regs.fp[reg] = log (10.0);
+ 		break;
+ 	    case 0x32:
+ 		regs.fp[reg] = 1.0e0;
+ 		break;
+ 	    case 0x33:
+ 		regs.fp[reg] = 1.0e1;
+ 		break;
+ 	    case 0x34:
+ 		regs.fp[reg] = 1.0e2;
+ 		break;
+ 	    case 0x35:
+ 		regs.fp[reg] = 1.0e4;
+ 		break;
+ 	    case 0x36:
+ 		regs.fp[reg] = 1.0e8;
+ 		break;
+ 	    case 0x37:
+ 		regs.fp[reg] = 1.0e16;
+ 		break;
+ 	    case 0x38:
+ 		regs.fp[reg] = 1.0e32;
+ 		break;
+ 	    case 0x39:
+ 		regs.fp[reg] = 1.0e64;
+ 		break;
+ 	    case 0x3a:
+ 		regs.fp[reg] = 1.0e128;
+ 		break;
+ 	    case 0x3b:
+ 		regs.fp[reg] = 1.0e256;
+ 		break;
+ #if 0
+ 	    case 0x3c:
+ 		regs.fp[reg] = 1.0e512;
+ 		break;
+ 	    case 0x3d:
+ 		regs.fp[reg] = 1.0e1024;
+ 		break;
+ 	    case 0x3e:
+ 		regs.fp[reg] = 1.0e2048;
+ 		break;
+ 	    case 0x3f:
+ 		regs.fp[reg] = 1.0e4096;
+ 		break;
+ #endif
+ 	    default:
+ 		m68k_setpc (m68k_getpc () - 4);
+ 		op_illg (opcode);
+ 		break;
+ 	    }
+ 	    return;
+ 	}
+ 	if (get_fp_value (opcode, extra, &src) == 0) {
+ 	    m68k_setpc (m68k_getpc () - 4);
+ 	    op_illg (opcode);
+ 	    return;
+ 	}
+ 	switch (extra & 0x7f) {
+ 	case 0x00:		/* FMOVE */
+ 	    regs.fp[reg] = src;
+ 	    /* Brian King was here.  <ea> to register needs FPSR updated.
+ 	     * See page 3-73 in Motorola 68K programmers reference manual.
+ 	     * %%%FPU */
+ 	    MAKE_FPSR (regs.fpsr, regs.fp[reg]);
+ 	    break;
+ 	case 0x01:		/* FINT */
+ 	    /* need to take the current rounding mode into account */
+ 	    switch ((regs.fpcr >> 4) & 0x3) {
+ 	    case 0:
+ 		regs.fp[reg] = (int) (src + 0.5);
+ 		break;
+ 	    case 1:
+ 		regs.fp[reg] = (int) src;
+ 		break;
+ 	    case 2:
+ 		regs.fp[reg] = floor (src);
+ 		break;
+ 	    case 3:
+ 		regs.fp[reg] = ceil (src);
+ 		break;
+ 	    }
+ 	    break;
+ 	case 0x02:		/* FSINH */
+ 	    regs.fp[reg] = sinh (src);
+ 	    MAKE_FPSR (regs.fpsr, regs.fp[reg]);
+ 	    break;
+ 	case 0x03:		/* FINTRZ */
+ 	    regs.fp[reg] = (int) src;
+ 	    MAKE_FPSR (regs.fpsr, regs.fp[reg]);
+ 	    break;
+ 	case 0x04:		/* FSQRT */
+ 	    regs.fp[reg] = sqrt (src);
+ 	    MAKE_FPSR (regs.fpsr, regs.fp[reg]);
+ 	    break;
+ 	case 0x06:		/* FLOGNP1 */
+ 	    regs.fp[reg] = log (src + 1.0);
+ 	    MAKE_FPSR (regs.fpsr, regs.fp[reg]);
+ 	    break;
+ 	case 0x08:		/* FETOXM1 */
+ 	    regs.fp[reg] = exp (src) - 1.0;
+ 	    MAKE_FPSR (regs.fpsr, regs.fp[reg]);
+ 	    break;
+ 	case 0x09:		/* FTANH */
+ 	    regs.fp[reg] = tanh (src);
+ 	    MAKE_FPSR (regs.fpsr, regs.fp[reg]);
+ 	    break;
+ 	case 0x0a:		/* FATAN */
+ 	    regs.fp[reg] = atan (src);
+ 	    MAKE_FPSR (regs.fpsr, regs.fp[reg]);
+ 	    break;
+ 	case 0x0c:		/* FASIN */
+ 	    regs.fp[reg] = asin (src);
+ 	    MAKE_FPSR (regs.fpsr, regs.fp[reg]);
+ 	    break;
+ 	case 0x0d:		/* FATANH */
+ #if 1				/* The BeBox doesn't have atanh, and it isn't in the HPUX libm either */
+ 	    regs.fp[reg] = log ((1 + src) / (1 - src)) / 2;
+ #else
+ 	    regs.fp[reg] = atanh (src);
+ #endif
+ 	    MAKE_FPSR (regs.fpsr, regs.fp[reg]);
+ 	    break;
+ 	case 0x0e:		/* FSIN */
+ 	    regs.fp[reg] = sin (src);
+ 	    MAKE_FPSR (regs.fpsr, regs.fp[reg]);
+ 	    break;
+ 	case 0x0f:		/* FTAN */
+ 	    regs.fp[reg] = tan (src);
+ 	    MAKE_FPSR (regs.fpsr, regs.fp[reg]);
+ 	    break;
+ 	case 0x10:		/* FETOX */
+ 	    regs.fp[reg] = exp (src);
+ 	    MAKE_FPSR (regs.fpsr, regs.fp[reg]);
+ 	    break;
+ 	case 0x11:		/* FTWOTOX */
+ 	    regs.fp[reg] = pow (2.0, src);
+ 	    MAKE_FPSR (regs.fpsr, regs.fp[reg]);
+ 	    break;
+ 	case 0x12:		/* FTENTOX */
+ 	    regs.fp[reg] = pow (10.0, src);
+ 	    MAKE_FPSR (regs.fpsr, regs.fp[reg]);
+ 	    break;
+ 	case 0x14:		/* FLOGN */
+ 	    regs.fp[reg] = log (src);
+ 	    MAKE_FPSR (regs.fpsr, regs.fp[reg]);
+ 	    break;
+ 	case 0x15:		/* FLOG10 */
+ 	    regs.fp[reg] = log10 (src);
+ 	    MAKE_FPSR (regs.fpsr, regs.fp[reg]);
+ 	    break;
+ 	case 0x16:		/* FLOG2 */
+ 	    regs.fp[reg] = log (src) / log (2.0);
+ 	    MAKE_FPSR (regs.fpsr, regs.fp[reg]);
+ 	    break;
+ 	case 0x18:		/* FABS */
+ 	    regs.fp[reg] = src < 0 ? -src : src;
+ 	    MAKE_FPSR (regs.fpsr, regs.fp[reg]);
+ 	    break;
+ 	case 0x19:		/* FCOSH */
+ 	    regs.fp[reg] = cosh (src);
+ 	    MAKE_FPSR (regs.fpsr, regs.fp[reg]);
+ 	    break;
+ 	case 0x1a:		/* FNEG */
+ 	    regs.fp[reg] = -src;
+ 	    MAKE_FPSR (regs.fpsr, regs.fp[reg]);
+ 	    break;
+ 	case 0x1c:		/* FACOS */
+ 	    regs.fp[reg] = acos (src);
+ 	    MAKE_FPSR (regs.fpsr, regs.fp[reg]);
+ 	    break;
+ 	case 0x1d:		/* FCOS */
+ 	    regs.fp[reg] = cos (src);
+ 	    MAKE_FPSR (regs.fpsr, regs.fp[reg]);
+ 	    break;
+ 	case 0x1e:		/* FGETEXP */
+ 	    {
+ 		int expon;
+ 		frexp (src, &expon);
+ 		regs.fp[reg] = (double) (expon - 1);
+ 		MAKE_FPSR (regs.fpsr, regs.fp[reg]);
+ 	    }
+ 	    break;
+ 	case 0x1f:		/* FGETMAN */
+ 	    {
+ 		int expon;
+ 		regs.fp[reg] = frexp (src, &expon) * 2.0;
+ 		MAKE_FPSR (regs.fpsr, regs.fp[reg]);
+ 	    }
+ 	    break;
+ 	case 0x20:		/* FDIV */
+ 	    regs.fp[reg] /= src;
+ 	    MAKE_FPSR (regs.fpsr, regs.fp[reg]);
+ 	    break;
+ 	case 0x21:		/* FMOD */
+ 	    regs.fp[reg] = regs.fp[reg] - (double) ((int) (regs.fp[reg] / src)) * src;
+ 	    MAKE_FPSR (regs.fpsr, regs.fp[reg]);
+ 	    break;
+ 	case 0x22:		/* FADD */
+ 	    regs.fp[reg] += src;
+ 	    MAKE_FPSR (regs.fpsr, regs.fp[reg]);
+ 	    break;
+ 	case 0x23:		/* FMUL */
+ 	    regs.fp[reg] *= src;
+ 	    MAKE_FPSR (regs.fpsr, regs.fp[reg]);
+ 	    break;
+ 	case 0x24:		/* FSGLDIV */
+ 	    regs.fp[reg] /= src;
+ 	    MAKE_FPSR (regs.fpsr, regs.fp[reg]);
+ 	    break;
+ 	case 0x25:		/* FREM */
+ 	    regs.fp[reg] = regs.fp[reg] - (double) ((int) (regs.fp[reg] / src + 0.5)) * src;
+ 	    MAKE_FPSR (regs.fpsr, regs.fp[reg]);
+ 	    break;
+ 	case 0x26:		/* FSCALE */
+ 	    regs.fp[reg] *= exp (log (2.0) * src);
+ 	    MAKE_FPSR (regs.fpsr, regs.fp[reg]);
+ 	    break;
+ 	case 0x27:		/* FSGLMUL */
+ 	    regs.fp[reg] *= src;
+ 	    MAKE_FPSR (regs.fpsr, regs.fp[reg]);
+ 	    break;
+ 	case 0x28:		/* FSUB */
+ 	    regs.fp[reg] -= src;
+ 	    MAKE_FPSR (regs.fpsr, regs.fp[reg]);
+ 	    break;
+ 	case 0x30:		/* FSINCOS */
+ 	case 0x31:
+ 	case 0x32:
+ 	case 0x33:
+ 	case 0x34:
+ 	case 0x35:
+ 	case 0x36:
+ 	case 0x37:
+ 	    regs.fp[reg] = sin (src);
+ 	    regs.fp[extra & 7] = cos (src);
+ 	    MAKE_FPSR (regs.fpsr, regs.fp[reg]);
+ 	    break;
+ 	case 0x38:		/* FCMP */
+ 	    {
+ 		double tmp = regs.fp[reg] - src;
+ 		regs.fpsr = (tmp == 0 ? 0x4000000 : 0) | (tmp < 0 ? 0x8000000 : 0);
+ 	    }
+ 	    break;
+ 	case 0x3a:		/* FTST */
+ 	    regs.fpsr = (src == 0 ? 0x4000000 : 0) | (src < 0 ? 0x8000000 : 0);
+ 	    break;
+ 	default:
+ 	    m68k_setpc (m68k_getpc () - 4);
+ 	    op_illg (opcode);
+ 	    break;
+ 	}
+ 	return;
+     }
+     m68k_setpc (m68k_getpc () - 4);
+     op_illg (opcode);
+ }
+ 
+ #endif
diff -Nrc3p /dunes/wcohen/virg-netgdb/src/sim/m68k/gencpu.c src/sim/m68k/gencpu.c
*** /dunes/wcohen/virg-netgdb/src/sim/m68k/gencpu.c	Wed Dec 31 19:00:00 1969
--- src/sim/m68k/gencpu.c	Tue Feb 27 10:41:54 2001
***************
*** 0 ****
--- 1,2370 ----
+ /*
+  * UAE - The Un*x Amiga Emulator
+  *
+  * MC68000 emulation generator
+  *
+  * This is a fairly stupid program that generates a lot of case labels that
+  * can be #included in a switch statement.
+  * As an alternative, it can generate functions that handle specific
+  * MC68000 instructions, plus a prototype header file and a function pointer
+  * array to look up the function for an opcode.
+  * Error checking is bad, an illegal table68k file will cause the program to
+  * call abort().
+  * The generated code is sometimes sub-optimal, an optimizing compiler should
+  * take care of this.
+  *
+  * The source for the insn timings is Markt & Technik's Amiga Magazin 8/1992.
+  *
+  * Copyright 1995, 1996, 1997, 1998, 1999, 2000 Bernd Schmidt
+  */
+ 
+ #include "sysconfig.h"
+ #include "sysdeps.h"
+ #include <ctype.h>
+ 
+ #include "config.h"
+ #include "options.h"
+ #include "readcpu.h"
+ 
+ #define BOOL_TYPE "int"
+ 
+ static FILE *headerfile;
+ static FILE *stblfile;
+ 
+ static int using_prefetch;
+ static int using_exception_3;
+ static int cpu_level;
+ 
+ /* For the current opcode, the next lower level that will have different code.
+  * Initialized to -1 for each opcode. If it remains unchanged, indicates we
+  * are done with that opcode.  */
+ static int next_cpu_level;
+ 
+ void write_log (const char *s, ...)
+ {
+     fprintf (stderr, "%s", s);
+ }
+ 
+ static int *opcode_map;
+ static int *opcode_next_clev;
+ static int *opcode_last_postfix;
+ static unsigned long *counts;
+ 
+ static void read_counts (void)
+ {
+     FILE *file;
+     unsigned long opcode, count, total;
+     char name[20];
+     int nr = 0;
+     memset (counts, 0, 65536 * sizeof *counts);
+ 
+     file = fopen ("frequent.68k", "r");
+     if (file) {
+ 	fscanf (file, "Total: %lu\n", &total);
+ 	while (fscanf (file, "%lx: %lu %s\n", &opcode, &count, name) == 3) {
+ 	    opcode_next_clev[nr] = 4;
+ 	    opcode_last_postfix[nr] = -1;
+ 	    opcode_map[nr++] = opcode;
+ 	    counts[opcode] = count;
+ 	}
+ 	fclose (file);
+     }
+     if (nr == nr_cpuop_funcs)
+ 	return;
+     for (opcode = 0; opcode < 0x10000; opcode++) {
+ 	if (table68k[opcode].handler == -1 && table68k[opcode].mnemo != i_ILLG
+ 	    && counts[opcode] == 0)
+ 	{
+ 	    opcode_next_clev[nr] = 4;
+ 	    opcode_last_postfix[nr] = -1;
+ 	    opcode_map[nr++] = opcode;
+ 	    counts[opcode] = count;
+ 	}
+     }
+     if (nr != nr_cpuop_funcs)
+ 	abort ();
+ }
+ 
+ static char endlabelstr[80];
+ static int endlabelno = 0;
+ static int need_endlabel;
+ 
+ static int n_braces = 0;
+ static int m68k_pc_offset = 0;
+ static int insn_n_cycles;
+ 
+ static void start_brace (void)
+ {
+     n_braces++;
+     printf ("{");
+ }
+ 
+ static void close_brace (void)
+ {
+     assert (n_braces > 0);
+     n_braces--;
+     printf ("}");
+ }
+ 
+ static void finish_braces (void)
+ {
+     while (n_braces > 0)
+ 	close_brace ();
+ }
+ 
+ static void pop_braces (int to)
+ {
+     while (n_braces > to)
+ 	close_brace ();
+ }
+ 
+ static int bit_size (int size)
+ {
+     switch (size) {
+      case sz_byte: return 8;
+      case sz_word: return 16;
+      case sz_long: return 32;
+      default: abort ();
+     }
+     return 0;
+ }
+ 
+ static const char *bit_mask (int size)
+ {
+     switch (size) {
+      case sz_byte: return "0xff";
+      case sz_word: return "0xffff";
+      case sz_long: return "0xffffffff";
+      default: abort ();
+     }
+     return 0;
+ }
+ 
+ static const char *gen_nextilong (void)
+ {
+     static char buffer[80];
+     int r = m68k_pc_offset;
+     m68k_pc_offset += 4;
+ 
+     insn_n_cycles += 8;
+ 
+     if (using_prefetch)
+ 	sprintf (buffer, "get_ilong_prefetch(%d)", r);
+     else
+ 	sprintf (buffer, "get_ilong(%d)", r);
+     return buffer;
+ }
+ 
+ static const char *gen_nextiword (void)
+ {
+     static char buffer[80];
+     int r = m68k_pc_offset;
+     m68k_pc_offset += 2;
+ 
+     insn_n_cycles += 4;
+ 
+     if (using_prefetch)
+ 	sprintf (buffer, "get_iword_prefetch(%d)", r);
+     else
+ 	sprintf (buffer, "get_iword(%d)", r);
+     return buffer;
+ }
+ 
+ static const char *gen_nextibyte (void)
+ {
+     static char buffer[80];
+     int r = m68k_pc_offset;
+     m68k_pc_offset += 2;
+ 
+     insn_n_cycles += 4;
+ 
+     if (using_prefetch)
+ 	sprintf (buffer, "get_ibyte_prefetch(%d)", r);
+     else
+ 	sprintf (buffer, "get_ibyte(%d)", r);
+     return buffer;
+ }
+ 
+ static void fill_prefetch_0 (void)
+ {
+     if (using_prefetch)
+ 	printf ("fill_prefetch_0 ();\n");
+ }
+ 
+ static void fill_prefetch_2 (void)
+ {
+     if (using_prefetch)
+ 	printf ("fill_prefetch_2 ();\n");
+ }
+ 
+ static void sync_m68k_pc (void)
+ {
+     if (m68k_pc_offset == 0)
+ 	return;
+     printf ("m68k_incpc(%d);\n", m68k_pc_offset);
+     switch (m68k_pc_offset) {
+      case 0:
+ 	/*fprintf (stderr, "refilling prefetch at 0\n"); */
+ 	break;
+      case 2:
+ 	fill_prefetch_2 ();
+ 	break;
+      default:
+ 	fill_prefetch_0 ();
+ 	break;
+     }
+     m68k_pc_offset = 0;
+ }
+ 
+ /* getv == 1: fetch data; getv != 0: check for odd address. If movem != 0,
+  * the calling routine handles Apdi and Aipi modes. */
+ static void genamode (amodes mode, char *reg, wordsizes size, char *name, int getv, int movem)
+ {
+     start_brace ();
+     switch (mode) {
+     case Dreg:
+ 	if (movem)
+ 	    abort ();
+ 	if (getv == 1)
+ 	    switch (size) {
+ 	    case sz_byte:
+ #if defined(AMIGA) && !defined(WARPUP)
+ 		/* sam: I don't know why gcc.2.7.2.1 produces a code worse */
+ 		/* if it is not done like that: */
+ 		printf ("\tuae_s8 %s = ((uae_u8*)&m68k_dreg(regs, %s))[3];\n", name, reg);
+ #else
+ 		printf ("\tuae_s8 %s = m68k_dreg(regs, %s);\n", name, reg);
+ #endif
+ 		break;
+ 	    case sz_word:
+ #if defined(AMIGA) && !defined(WARPUP)
+ 		printf ("\tuae_s16 %s = ((uae_s16*)&m68k_dreg(regs, %s))[1];\n", name, reg);
+ #else
+ 		printf ("\tuae_s16 %s = m68k_dreg(regs, %s);\n", name, reg);
+ #endif
+ 		break;
+ 	    case sz_long:
+ 		printf ("\tuae_s32 %s = m68k_dreg(regs, %s);\n", name, reg);
+ 		break;
+ 	    default:
+ 		abort ();
+ 	    }
+ 	return;
+     case Areg:
+ 	if (movem)
+ 	    abort ();
+ 	if (getv == 1)
+ 	    switch (size) {
+ 	    case sz_word:
+ 		printf ("\tuae_s16 %s = m68k_areg(regs, %s);\n", name, reg);
+ 		break;
+ 	    case sz_long:
+ 		printf ("\tuae_s32 %s = m68k_areg(regs, %s);\n", name, reg);
+ 		break;
+ 	    default:
+ 		abort ();
+ 	    }
+ 	return;
+     case Aind:
+ 	printf ("\tuaecptr %sa = m68k_areg(regs, %s);\n", name, reg);
+ 	break;
+     case Aipi:
+ 	printf ("\tuaecptr %sa = m68k_areg(regs, %s);\n", name, reg);
+ 	break;
+     case Apdi:
+ 	insn_n_cycles += 2;
+ 	switch (size) {
+ 	case sz_byte:
+ 	    if (movem)
+ 		printf ("\tuaecptr %sa = m68k_areg(regs, %s);\n", name, reg);
+ 	    else
+ 		printf ("\tuaecptr %sa = m68k_areg(regs, %s) - areg_byteinc[%s];\n", name, reg, reg);
+ 	    break;
+ 	case sz_word:
+ 	    printf ("\tuaecptr %sa = m68k_areg(regs, %s) - %d;\n", name, reg, movem ? 0 : 2);
+ 	    break;
+ 	case sz_long:
+ 	    printf ("\tuaecptr %sa = m68k_areg(regs, %s) - %d;\n", name, reg, movem ? 0 : 4);
+ 	    break;
+ 	default:
+ 	    abort ();
+ 	}
+ 	break;
+     case Ad16:
+ 	printf ("\tuaecptr %sa = m68k_areg(regs, %s) + (uae_s32)(uae_s16)%s;\n", name, reg, gen_nextiword ());
+ 	break;
+     case Ad8r:
+ 	insn_n_cycles += 2;
+ 	if (cpu_level > 1) {
+ 	    if (next_cpu_level < 1)
+ 		next_cpu_level = 1;
+ 	    sync_m68k_pc ();
+ 	    start_brace ();
+ 	    /* This would ordinarily be done in gen_nextiword, which we bypass.  */
+ 	    insn_n_cycles += 4;
+ 	    printf ("\tuaecptr %sa = get_disp_ea_020(m68k_areg(regs, %s), next_iword());\n", name, reg);
+ 	} else
+ 	    printf ("\tuaecptr %sa = get_disp_ea_000(m68k_areg(regs, %s), %s);\n", name, reg, gen_nextiword ());
+ 
+ 	break;
+     case PC16:
+ 	printf ("\tuaecptr %sa = m68k_getpc () + %d;\n", name, m68k_pc_offset);
+ 	printf ("\t%sa += (uae_s32)(uae_s16)%s;\n", name, gen_nextiword ());
+ 	break;
+     case PC8r:
+ 	insn_n_cycles += 2;
+ 	if (cpu_level > 1) {
+ 	    if (next_cpu_level < 1)
+ 		next_cpu_level = 1;
+ 	    sync_m68k_pc ();
+ 	    start_brace ();
+ 	    /* This would ordinarily be done in gen_nextiword, which we bypass.  */
+ 	    insn_n_cycles += 4;
+ 	    printf ("\tuaecptr tmppc = m68k_getpc();\n");
+ 	    printf ("\tuaecptr %sa = get_disp_ea_020(tmppc, next_iword());\n", name);
+ 	} else {
+ 	    printf ("\tuaecptr tmppc = m68k_getpc() + %d;\n", m68k_pc_offset);
+ 	    printf ("\tuaecptr %sa = get_disp_ea_000(tmppc, %s);\n", name, gen_nextiword ());
+ 	}
+ 
+ 	break;
+     case absw:
+ 	printf ("\tuaecptr %sa = (uae_s32)(uae_s16)%s;\n", name, gen_nextiword ());
+ 	break;
+     case absl:
+ 	printf ("\tuaecptr %sa = %s;\n", name, gen_nextilong ());
+ 	break;
+     case imm:
+ 	if (getv != 1)
+ 	    abort ();
+ 	switch (size) {
+ 	case sz_byte:
+ 	    printf ("\tuae_s8 %s = %s;\n", name, gen_nextibyte ());
+ 	    break;
+ 	case sz_word:
+ 	    printf ("\tuae_s16 %s = %s;\n", name, gen_nextiword ());
+ 	    break;
+ 	case sz_long:
+ 	    printf ("\tuae_s32 %s = %s;\n", name, gen_nextilong ());
+ 	    break;
+ 	default:
+ 	    abort ();
+ 	}
+ 	return;
+     case imm0:
+ 	if (getv != 1)
+ 	    abort ();
+ 	printf ("\tuae_s8 %s = %s;\n", name, gen_nextibyte ());
+ 	return;
+     case imm1:
+ 	if (getv != 1)
+ 	    abort ();
+ 	printf ("\tuae_s16 %s = %s;\n", name, gen_nextiword ());
+ 	return;
+     case imm2:
+ 	if (getv != 1)
+ 	    abort ();
+ 	printf ("\tuae_s32 %s = %s;\n", name, gen_nextilong ());
+ 	return;
+     case immi:
+ 	if (getv != 1)
+ 	    abort ();
+ 	printf ("\tuae_u32 %s = %s;\n", name, reg);
+ 	return;
+     default:
+ 	abort ();
+     }
+ 
+     /* We get here for all non-reg non-immediate addressing modes to
+      * actually fetch the value. */
+ 
+     if (using_exception_3 && getv != 0 && size != sz_byte) {	    
+ 	printf ("\tif ((%sa & 1) != 0) {\n", name);
+ 	printf ("\t\tlast_fault_for_exception_3 = %sa;\n", name);
+ 	printf ("\t\tlast_op_for_exception_3 = opcode;\n");
+ 	printf ("\t\tlast_addr_for_exception_3 = m68k_getpc() + %d;\n", m68k_pc_offset);
+ 	printf ("\t\tException(3, 0);\n");
+ 	printf ("\t\tgoto %s;\n", endlabelstr);
+ 	printf ("\t}\n");
+ 	need_endlabel = 1;
+ 	start_brace ();
+     }
+ 
+     if (getv == 1) {
+ 	switch (size) {
+ 	case sz_byte: insn_n_cycles += 4; break;
+ 	case sz_word: insn_n_cycles += 4; break;
+ 	case sz_long: insn_n_cycles += 8; break;
+ 	default: abort ();
+ 	}
+ 	start_brace ();
+ 	switch (size) {
+ 	case sz_byte: printf ("\tuae_s8 %s = get_byte(%sa);\n", name, name); break;
+ 	case sz_word: printf ("\tuae_s16 %s = get_word(%sa);\n", name, name); break;
+ 	case sz_long: printf ("\tuae_s32 %s = get_long(%sa);\n", name, name); break;
+ 	default: abort ();
+ 	}
+     }
+ 
+     /* We now might have to fix up the register for pre-dec or post-inc
+      * addressing modes. */
+     if (!movem)
+ 	switch (mode) {
+ 	case Aipi:
+ 	    switch (size) {
+ 	    case sz_byte:
+ 		printf ("\tm68k_areg(regs, %s) += areg_byteinc[%s];\n", reg, reg);
+ 		break;
+ 	    case sz_word:
+ 		printf ("\tm68k_areg(regs, %s) += 2;\n", reg);
+ 		break;
+ 	    case sz_long:
+ 		printf ("\tm68k_areg(regs, %s) += 4;\n", reg);
+ 		break;
+ 	    default:
+ 		abort ();
+ 	    }
+ 	    break;
+ 	case Apdi:
+ 	    printf ("\tm68k_areg (regs, %s) = %sa;\n", reg, name);
+ 	    break;
+ 	default:
+ 	    break;
+ 	}
+ }
+ 
+ static void genastore (char *from, amodes mode, char *reg, wordsizes size, char *to)
+ {
+     switch (mode) {
+      case Dreg:
+ 	switch (size) {
+ 	 case sz_byte:
+ 	    printf ("\tm68k_dreg(regs, %s) = (m68k_dreg(regs, %s) & ~0xff) | ((%s) & 0xff);\n", reg, reg, from);
+ 	    break;
+ 	 case sz_word:
+ 	    printf ("\tm68k_dreg(regs, %s) = (m68k_dreg(regs, %s) & ~0xffff) | ((%s) & 0xffff);\n", reg, reg, from);
+ 	    break;
+ 	 case sz_long:
+ 	    printf ("\tm68k_dreg(regs, %s) = (%s);\n", reg, from);
+ 	    break;
+ 	 default:
+ 	    abort ();
+ 	}
+ 	break;
+      case Areg:
+ 	switch (size) {
+ 	 case sz_word:
+ 	    fprintf (stderr, "Foo\n");
+ 	    printf ("\tm68k_areg(regs, %s) = (uae_s32)(uae_s16)(%s);\n", reg, from);
+ 	    break;
+ 	 case sz_long:
+ 	    printf ("\tm68k_areg(regs, %s) = (%s);\n", reg, from);
+ 	    break;
+ 	 default:
+ 	    abort ();
+ 	}
+ 	break;
+      case Aind:
+      case Aipi:
+      case Apdi:
+      case Ad16:
+      case Ad8r:
+      case absw:
+      case absl:
+      case PC16:
+      case PC8r:
+ 	if (using_prefetch)
+ 	    sync_m68k_pc ();
+ 	switch (size) {
+ 	 case sz_byte:
+ 	    insn_n_cycles += 4;
+ 	    printf ("\tput_byte(%sa,%s);\n", to, from);
+ 	    break;
+ 	 case sz_word:
+ 	    insn_n_cycles += 4;
+ 	    if (cpu_level < 2 && (mode == PC16 || mode == PC8r))
+ 		abort ();
+ 	    printf ("\tput_word(%sa,%s);\n", to, from);
+ 	    break;
+ 	 case sz_long:
+ 	    insn_n_cycles += 8;
+ 	    if (cpu_level < 2 && (mode == PC16 || mode == PC8r))
+ 		abort ();
+ 	    printf ("\tput_long(%sa,%s);\n", to, from);
+ 	    break;
+ 	 default:
+ 	    abort ();
+ 	}
+ 	break;
+      case imm:
+      case imm0:
+      case imm1:
+      case imm2:
+      case immi:
+ 	abort ();
+ 	break;
+      default:
+ 	abort ();
+     }
+ }
+ 
+ static void genmovemel (uae_u16 opcode)
+ {
+     char getcode[100];
+     int size = table68k[opcode].size == sz_long ? 4 : 2;
+ 
+     if (table68k[opcode].size == sz_long) {
+ 	strcpy (getcode, "get_long(srca)");
+     } else {
+ 	strcpy (getcode, "(uae_s32)(uae_s16)get_word(srca)");
+     }
+ 
+     printf ("\tuae_u16 mask = %s;\n", gen_nextiword ());
+     printf ("\tunsigned int dmask = mask & 0xff, amask = (mask >> 8) & 0xff;\n");
+     genamode (table68k[opcode].dmode, "dstreg", table68k[opcode].size, "src", 2, 1);
+     start_brace ();
+     printf ("\twhile (dmask) { m68k_dreg(regs, movem_index1[dmask]) = %s; srca += %d; dmask = movem_next[dmask]; }\n",
+ 	    getcode, size);
+     printf ("\twhile (amask) { m68k_areg(regs, movem_index1[amask]) = %s; srca += %d; amask = movem_next[amask]; }\n",
+ 	    getcode, size);
+ 
+     if (table68k[opcode].dmode == Aipi)
+ 	printf ("\tm68k_areg(regs, dstreg) = srca;\n");
+ }
+ 
+ static void genmovemle (uae_u16 opcode)
+ {
+     char putcode[100];
+     int size = table68k[opcode].size == sz_long ? 4 : 2;
+     if (table68k[opcode].size == sz_long) {
+ 	strcpy (putcode, "put_long(srca,");
+     } else {
+ 	strcpy (putcode, "put_word(srca,");
+     }
+ 
+     printf ("\tuae_u16 mask = %s;\n", gen_nextiword ());
+     genamode (table68k[opcode].dmode, "dstreg", table68k[opcode].size, "src", 2, 1);
+     if (using_prefetch)
+ 	sync_m68k_pc ();
+ 
+     start_brace ();
+     if (table68k[opcode].dmode == Apdi) {
+ 	printf ("\tuae_u16 amask = mask & 0xff, dmask = (mask >> 8) & 0xff;\n");
+ 	printf ("\twhile (amask) { srca -= %d; %s m68k_areg(regs, movem_index2[amask])); amask = movem_next[amask]; }\n",
+ 		size, putcode);
+ 	printf ("\twhile (dmask) { srca -= %d; %s m68k_dreg(regs, movem_index2[dmask])); dmask = movem_next[dmask]; }\n",
+ 		size, putcode);
+ 	printf ("\tm68k_areg(regs, dstreg) = srca;\n");
+     } else {
+ 	printf ("\tuae_u16 dmask = mask & 0xff, amask = (mask >> 8) & 0xff;\n");
+ 	printf ("\twhile (dmask) { %s m68k_dreg(regs, movem_index1[dmask])); srca += %d; dmask = movem_next[dmask]; }\n",
+ 		putcode, size);
+ 	printf ("\twhile (amask) { %s m68k_areg(regs, movem_index1[amask])); srca += %d; amask = movem_next[amask]; }\n",
+ 		putcode, size);
+     }
+ }
+ 
+ static void duplicate_carry (void)
+ {
+     printf ("\tCOPY_CARRY;\n");
+ }
+ 
+ typedef enum
+ {
+   flag_logical_noclobber, flag_logical, flag_add, flag_sub, flag_cmp, flag_addx, flag_subx, flag_zn,
+   flag_av, flag_sv
+ }
+ flagtypes;
+ 
+ static void genflags_normal (flagtypes type, wordsizes size, char *value, char *src, char *dst)
+ {
+     char vstr[100], sstr[100], dstr[100];
+     char usstr[100], udstr[100];
+     char unsstr[100], undstr[100];
+ 
+     switch (size) {
+      case sz_byte:
+ 	strcpy (vstr, "((uae_s8)(");
+ 	strcpy (usstr, "((uae_u8)(");
+ 	break;
+      case sz_word:
+ 	strcpy (vstr, "((uae_s16)(");
+ 	strcpy (usstr, "((uae_u16)(");
+ 	break;
+      case sz_long:
+ 	strcpy (vstr, "((uae_s32)(");
+ 	strcpy (usstr, "((uae_u32)(");
+ 	break;
+      default:
+ 	abort ();
+     }
+     strcpy (unsstr, usstr);
+ 
+     strcpy (sstr, vstr);
+     strcpy (dstr, vstr);
+     strcat (vstr, value);
+     strcat (vstr, "))");
+     strcat (dstr, dst);
+     strcat (dstr, "))");
+     strcat (sstr, src);
+     strcat (sstr, "))");
+ 
+     strcpy (udstr, usstr);
+     strcat (udstr, dst);
+     strcat (udstr, "))");
+     strcat (usstr, src);
+     strcat (usstr, "))");
+ 
+     strcpy (undstr, unsstr);
+     strcat (unsstr, "-");
+     strcat (undstr, "~");
+     strcat (undstr, dst);
+     strcat (undstr, "))");
+     strcat (unsstr, src);
+     strcat (unsstr, "))");
+ 
+     switch (type) {
+      case flag_logical_noclobber:
+      case flag_logical:
+      case flag_zn:
+      case flag_av:
+      case flag_sv:
+      case flag_addx:
+      case flag_subx:
+ 	break;
+ 
+      case flag_add:
+ 	start_brace ();
+ 	printf ("uae_u32 %s = %s + %s;\n", value, dstr, sstr);
+ 	break;
+      case flag_sub:
+      case flag_cmp:
+ 	start_brace ();
+ 	printf ("uae_u32 %s = %s - %s;\n", value, dstr, sstr);
+ 	break;
+     }
+ 
+     switch (type) {
+      case flag_logical_noclobber:
+      case flag_logical:
+      case flag_zn:
+ 	break;
+ 
+      case flag_add:
+      case flag_sub:
+      case flag_addx:
+      case flag_subx:
+      case flag_cmp:
+      case flag_av:
+      case flag_sv:
+ 	start_brace ();
+ 	printf ("\t" BOOL_TYPE " flgs = %s < 0;\n", sstr);
+ 	printf ("\t" BOOL_TYPE " flgo = %s < 0;\n", dstr);
+ 	printf ("\t" BOOL_TYPE " flgn = %s < 0;\n", vstr);
+ 	break;
+     }
+ 
+     switch (type) {
+      case flag_logical:
+ 	printf ("\tCLEAR_CZNV;\n");
+ 	printf ("\tSET_ZFLG (%s == 0);\n", vstr);
+ 	printf ("\tSET_NFLG (%s < 0);\n", vstr);
+ 	break;
+      case flag_logical_noclobber:
+ 	printf ("\tSET_ZFLG (%s == 0);\n", vstr);
+ 	printf ("\tSET_NFLG (%s < 0);\n", vstr);
+ 	break;
+      case flag_av:
+ 	printf ("\tSET_VFLG ((flgs ^ flgn) & (flgo ^ flgn));\n");
+ 	break;
+      case flag_sv:
+ 	printf ("\tSET_VFLG ((flgs ^ flgo) & (flgn ^ flgo));\n");
+ 	break;
+      case flag_zn:
+ 	printf ("\tSET_ZFLG (GET_ZFLG & (%s == 0));\n", vstr);
+ 	printf ("\tSET_NFLG (%s < 0);\n", vstr);
+ 	break;
+      case flag_add:
+ 	printf ("\tSET_ZFLG (%s == 0);\n", vstr);
+ 	printf ("\tSET_VFLG ((flgs ^ flgn) & (flgo ^ flgn));\n");
+ 	printf ("\tSET_CFLG (%s < %s);\n", undstr, usstr);
+ 	duplicate_carry ();
+ 	printf ("\tSET_NFLG (flgn != 0);\n");
+ 	break;
+      case flag_sub:
+ 	printf ("\tSET_ZFLG (%s == 0);\n", vstr);
+ 	printf ("\tSET_VFLG ((flgs ^ flgo) & (flgn ^ flgo));\n");
+ 	printf ("\tSET_CFLG (%s > %s);\n", usstr, udstr);
+ 	duplicate_carry ();
+ 	printf ("\tSET_NFLG (flgn != 0);\n");
+ 	break;
+      case flag_addx:
+ 	printf ("\tSET_VFLG ((flgs ^ flgn) & (flgo ^ flgn));\n"); /* minterm SON: 0x42 */
+ 	printf ("\tSET_CFLG (flgs ^ ((flgs ^ flgo) & (flgo ^ flgn)));\n"); /* minterm SON: 0xD4 */
+ 	duplicate_carry ();
+ 	break;
+      case flag_subx:
+ 	printf ("\tSET_VFLG ((flgs ^ flgo) & (flgo ^ flgn));\n"); /* minterm SON: 0x24 */
+ 	printf ("\tSET_CFLG (flgs ^ ((flgs ^ flgn) & (flgo ^ flgn)));\n"); /* minterm SON: 0xB2 */
+ 	duplicate_carry ();
+ 	break;
+      case flag_cmp:
+ 	printf ("\tSET_ZFLG (%s == 0);\n", vstr);
+ 	printf ("\tSET_VFLG ((flgs != flgo) && (flgn != flgo));\n");
+ 	printf ("\tSET_CFLG (%s > %s);\n", usstr, udstr);
+ 	printf ("\tSET_NFLG (flgn != 0);\n");
+ 	break;
+     }
+ }
+ 
+ static void genflags (flagtypes type, wordsizes size, char *value, char *src, char *dst)
+ {
+     /* Temporarily deleted 68k/ARM flag optimizations.  I'd prefer to have
+        them in the appropriate m68k.h files and use just one copy of this
+        code here.  The API can be changed if necessary.  */
+ #ifdef OPTIMIZED_FLAGS
+     switch (type) {
+      case flag_add:
+      case flag_sub:
+ 	start_brace ();
+ 	printf ("\tuae_u32 %s;\n", value);
+ 	break;
+ 
+      default:
+ 	break;
+     }
+ 
+     /* At least some of those casts are fairly important! */
+     switch (type) {
+      case flag_logical_noclobber:
+ 	printf ("\t{uae_u32 oldcznv = GET_CZNV & ~(FLAGVAL_Z | FLAGVAL_N);\n");
+ 	if (strcmp (value, "0") == 0) {
+ 	    printf ("\tSET_CZNV (olcznv | FLAGVAL_Z);\n");
+ 	} else {
+ 	    switch (size) {
+ 	     case sz_byte: printf ("\toptflag_testb ((uae_s8)(%s));\n", value); break;
+ 	     case sz_word: printf ("\toptflag_testw ((uae_s16)(%s));\n", value); break;
+ 	     case sz_long: printf ("\toptflag_testl ((uae_s32)(%s));\n", value); break;
+ 	    }
+ 	    printf ("\tIOR_CZNV (oldcznv);\n");
+ 	}
+ 	printf ("\t}\n");
+ 	return;
+      case flag_logical:
+ 	if (strcmp (value, "0") == 0) {
+ 	    printf ("\tSET_CZNV (FLAGVAL_Z);\n");
+ 	} else {
+ 	    switch (size) {
+ 	     case sz_byte: printf ("\toptflag_testb ((uae_s8)(%s));\n", value); break;
+ 	     case sz_word: printf ("\toptflag_testw ((uae_s16)(%s));\n", value); break;
+ 	     case sz_long: printf ("\toptflag_testl ((uae_s32)(%s));\n", value); break;
+ 	    }
+ 	}
+ 	return;
+ 
+      case flag_add:
+ 	switch (size) {
+ 	 case sz_byte: printf ("\toptflag_addb (%s, (uae_s8)(%s), (uae_s8)(%s));\n", value, src, dst); break;
+ 	 case sz_word: printf ("\toptflag_addw (%s, (uae_s16)(%s), (uae_s16)(%s));\n", value, src, dst); break;
+ 	 case sz_long: printf ("\toptflag_addl (%s, (uae_s32)(%s), (uae_s32)(%s));\n", value, src, dst); break;
+ 	}
+ 	return;
+ 
+      case flag_sub:
+ 	switch (size) {
+ 	 case sz_byte: printf ("\toptflag_subb (%s, (uae_s8)(%s), (uae_s8)(%s));\n", value, src, dst); break;
+ 	 case sz_word: printf ("\toptflag_subw (%s, (uae_s16)(%s), (uae_s16)(%s));\n", value, src, dst); break;
+ 	 case sz_long: printf ("\toptflag_subl (%s, (uae_s32)(%s), (uae_s32)(%s));\n", value, src, dst); break;
+ 	}
+ 	return;
+ 
+      case flag_cmp:
+ 	switch (size) {
+ 	 case sz_byte: printf ("\toptflag_cmpb ((uae_s8)(%s), (uae_s8)(%s));\n", src, dst); break;
+ 	 case sz_word: printf ("\toptflag_cmpw ((uae_s16)(%s), (uae_s16)(%s));\n", src, dst); break;
+ 	 case sz_long: printf ("\toptflag_cmpl ((uae_s32)(%s), (uae_s32)(%s));\n", src, dst); break;
+ 	}
+ 	return;
+ 	
+      default:
+ 	break;
+     }
+ #endif
+ 
+     genflags_normal (type, size, value, src, dst);
+ }
+ 
+ static void force_range_for_rox (const char *var, wordsizes size)
+ {
+     /* Could do a modulo operation here... which one is faster? */
+     switch (size) {
+      case sz_long:
+ 	printf ("\tif (%s >= 33) %s -= 33;\n", var, var);
+ 	break;
+      case sz_word:
+ 	printf ("\tif (%s >= 34) %s -= 34;\n", var, var);
+ 	printf ("\tif (%s >= 17) %s -= 17;\n", var, var);
+ 	break;
+      case sz_byte:
+ 	printf ("\tif (%s >= 36) %s -= 36;\n", var, var);
+ 	printf ("\tif (%s >= 18) %s -= 18;\n", var, var);
+ 	printf ("\tif (%s >= 9) %s -= 9;\n", var, var);
+ 	break;
+     }
+ }
+ 
+ static const char *cmask (wordsizes size)
+ {
+     switch (size) {
+      case sz_byte: return "0x80";
+      case sz_word: return "0x8000";
+      case sz_long: return "0x80000000";
+      default: abort ();
+     }
+ }
+ 
+ static int source_is_imm1_8 (struct instr *i)
+ {
+     return i->stype == 3;
+ }
+ 
+ static void gen_opcode (unsigned long int opcode)
+ {
+     struct instr *curi = table68k + opcode;
+     insn_n_cycles = 4;
+ 
+     start_brace ();
+ #if 0
+     printf ("uae_u8 *m68k_pc = regs.pc_p;\n");
+ #endif
+     m68k_pc_offset = 2;
+     switch (curi->plev) {
+     case 0: /* not privileged */
+ 	break;
+     case 1: /* unprivileged only on 68000 */
+ 	if (cpu_level == 0)
+ 	    break;
+ 	if (next_cpu_level < 0)
+ 	    next_cpu_level = 0;
+ 
+ 	/* fall through */
+     case 2: /* priviledged */
+ 	printf ("if (!regs.s) { Exception(8,0); goto %s; }\n", endlabelstr);
+ 	need_endlabel = 1;
+ 	start_brace ();
+ 	break;
+     case 3: /* privileged if size == word */
+ 	if (curi->size == sz_byte)
+ 	    break;
+ 	printf ("if (!regs.s) { Exception(8,0); goto %s; }\n", endlabelstr);
+ 	need_endlabel = 1;
+ 	start_brace ();
+ 	break;
+     }
+     switch (curi->mnemo) {
+     case i_OR:
+     case i_AND:
+     case i_EOR:
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
+ 	genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0);
+ 	printf ("\tsrc %c= dst;\n", curi->mnemo == i_OR ? '|' : curi->mnemo == i_AND ? '&' : '^');
+ 	genflags (flag_logical, curi->size, "src", "", "");
+ 	genastore ("src", curi->dmode, "dstreg", curi->size, "dst");
+ 	break;
+     case i_ORSR:
+     case i_EORSR:
+ 	printf ("\tMakeSR();\n");
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
+ 	if (curi->size == sz_byte) {
+ 	    printf ("\tsrc &= 0xFF;\n");
+ 	}
+ 	printf ("\tregs.sr %c= src;\n", curi->mnemo == i_EORSR ? '^' : '|');
+ 	printf ("\tMakeFromSR();\n");
+ 	break;
+     case i_ANDSR:
+ 	printf ("\tMakeSR();\n");
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
+ 	if (curi->size == sz_byte) {
+ 	    printf ("\tsrc |= 0xFF00;\n");
+ 	}
+ 	printf ("\tregs.sr &= src;\n");
+ 	printf ("\tMakeFromSR();\n");
+ 	break;
+     case i_SUB:
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
+ 	genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0);
+ 	start_brace ();
+ 	genflags (flag_sub, curi->size, "newv", "src", "dst");
+ 	genastore ("newv", curi->dmode, "dstreg", curi->size, "dst");
+ 	break;
+     case i_SUBA:
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
+ 	genamode (curi->dmode, "dstreg", sz_long, "dst", 1, 0);
+ 	start_brace ();
+ 	printf ("\tuae_u32 newv = dst - src;\n");
+ 	genastore ("newv", curi->dmode, "dstreg", sz_long, "dst");
+ 	break;
+     case i_SUBX:
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
+ 	genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0);
+ 	start_brace ();
+ 	printf ("\tuae_u32 newv = dst - src - (GET_XFLG ? 1 : 0);\n");
+ 	genflags (flag_subx, curi->size, "newv", "src", "dst");
+ 	genflags (flag_zn, curi->size, "newv", "", "");
+ 	genastore ("newv", curi->dmode, "dstreg", curi->size, "dst");
+ 	break;
+     case i_SBCD:
+ 	/* Let's hope this works... */
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
+ 	genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0);
+ 	start_brace ();
+ 	printf ("\tuae_u16 newv_lo = (dst & 0xF) - (src & 0xF) - (GET_XFLG ? 1 : 0);\n");
+ 	printf ("\tuae_u16 newv_hi = (dst & 0xF0) - (src & 0xF0);\n");
+ 	printf ("\tuae_u16 newv;\n");
+ 	printf ("\tint cflg;\n");
+ 	printf ("\tif (newv_lo > 9) { newv_lo-=6; newv_hi-=0x10; }\n");
+ 	printf ("\tnewv = newv_hi + (newv_lo & 0xF);");
+ 	printf ("\tcflg = (newv_hi & 0x1F0) > 0x90;\n");
+ 	printf ("\tSET_CFLG (cflg);\n");
+ 	duplicate_carry ();
+ 	printf ("\tif (cflg) newv -= 0x60;\n");
+ 	genflags (flag_zn, curi->size, "newv", "", "");
+ 	genflags (flag_sv, curi->size, "newv", "src", "dst");
+ 	genastore ("newv", curi->dmode, "dstreg", curi->size, "dst");
+ 	break;
+     case i_ADD:
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
+ 	genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0);
+ 	start_brace ();
+ 	genflags (flag_add, curi->size, "newv", "src", "dst");
+ 	genastore ("newv", curi->dmode, "dstreg", curi->size, "dst");
+ 	break;
+     case i_ADDA:
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
+ 	genamode (curi->dmode, "dstreg", sz_long, "dst", 1, 0);
+ 	start_brace ();
+ 	printf ("\tuae_u32 newv = dst + src;\n");
+ 	genastore ("newv", curi->dmode, "dstreg", sz_long, "dst");
+ 	break;
+     case i_ADDX:
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
+ 	genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0);
+ 	start_brace ();
+ 	printf ("\tuae_u32 newv = dst + src + (GET_XFLG ? 1 : 0);\n");
+ 	genflags (flag_addx, curi->size, "newv", "src", "dst");
+ 	genflags (flag_zn, curi->size, "newv", "", "");
+ 	genastore ("newv", curi->dmode, "dstreg", curi->size, "dst");
+ 	break;
+     case i_ABCD:
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
+ 	genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0);
+ 	start_brace ();
+ 	printf ("\tuae_u16 newv_lo = (src & 0xF) + (dst & 0xF) + (GET_XFLG ? 1 : 0);\n");
+ 	printf ("\tuae_u16 newv_hi = (src & 0xF0) + (dst & 0xF0);\n");
+ 	printf ("\tuae_u16 newv;\n");
+ 	printf ("\tint cflg;\n");
+ 	printf ("\tif (newv_lo > 9) { newv_lo +=6; }\n");
+ 	printf ("\tnewv = newv_hi + newv_lo;");
+ 	printf ("\tcflg = (newv & 0x1F0) > 0x90;\n");
+ 	printf ("\tSET_CFLG (cflg);\n");
+ 	duplicate_carry ();
+ 	printf ("\tif (cflg) newv += 0x60;\n");
+ 	genflags (flag_zn, curi->size, "newv", "", "");
+ 	genflags (flag_sv, curi->size, "newv", "src", "dst");
+ 	genastore ("newv", curi->dmode, "dstreg", curi->size, "dst");
+ 	break;
+     case i_NEG:
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
+ 	start_brace ();
+ 	genflags (flag_sub, curi->size, "dst", "src", "0");
+ 	genastore ("dst", curi->smode, "srcreg", curi->size, "src");
+ 	break;
+     case i_NEGX:
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
+ 	start_brace ();
+ 	printf ("\tuae_u32 newv = 0 - src - (GET_XFLG ? 1 : 0);\n");
+ 	genflags (flag_subx, curi->size, "newv", "src", "0");
+ 	genflags (flag_zn, curi->size, "newv", "", "");
+ 	genastore ("newv", curi->smode, "srcreg", curi->size, "src");
+ 	break;
+     case i_NBCD:
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
+ 	start_brace ();
+ 	printf ("\tuae_u16 newv_lo = - (src & 0xF) - (GET_XFLG ? 1 : 0);\n");
+ 	printf ("\tuae_u16 newv_hi = - (src & 0xF0);\n");
+ 	printf ("\tuae_u16 newv;\n");
+ 	printf ("\tint cflg;\n");
+ 	printf ("\tif (newv_lo > 9) { newv_lo-=6; newv_hi-=0x10; }\n");
+ 	printf ("\tnewv = newv_hi + (newv_lo & 0xF);");
+ 	printf ("\tcflg = cflg = (newv_hi & 0x1F0) > 0x90;\n");
+ 	printf ("\tSET_CFLG (cflg);\n");
+ 	duplicate_carry();
+ 	printf ("\tif (cflg) newv -= 0x60;\n");
+ 	genflags (flag_zn, curi->size, "newv", "", "");
+ 	genastore ("newv", curi->smode, "srcreg", curi->size, "src");
+ 	break;
+     case i_CLR:
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 2, 0);
+ 	genflags (flag_logical, curi->size, "0", "", "");
+ 	genastore ("0", curi->smode, "srcreg", curi->size, "src");
+ 	break;
+     case i_NOT:
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
+ 	start_brace ();
+ 	printf ("\tuae_u32 dst = ~src;\n");
+ 	genflags (flag_logical, curi->size, "dst", "", "");
+ 	genastore ("dst", curi->smode, "srcreg", curi->size, "src");
+ 	break;
+     case i_TST:
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
+ 	genflags (flag_logical, curi->size, "src", "", "");
+ 	break;
+     case i_BTST:
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
+ 	genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0);
+ 	if (curi->size == sz_byte)
+ 	    printf ("\tsrc &= 7;\n");
+ 	else
+ 	    printf ("\tsrc &= 31;\n");
+ 	printf ("\tSET_ZFLG (1 ^ ((dst >> src) & 1));\n");
+ 	break;
+     case i_BCHG:
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
+ 	genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0);
+ 	if (curi->size == sz_byte)
+ 	    printf ("\tsrc &= 7;\n");
+ 	else
+ 	    printf ("\tsrc &= 31;\n");
+ 	printf ("\tdst ^= (1 << src);\n");
+ 	printf ("\tSET_ZFLG (((uae_u32)dst & (1 << src)) >> src);\n");
+ 	genastore ("dst", curi->dmode, "dstreg", curi->size, "dst");
+ 	break;
+     case i_BCLR:
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
+ 	genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0);
+ 	if (curi->size == sz_byte)
+ 	    printf ("\tsrc &= 7;\n");
+ 	else
+ 	    printf ("\tsrc &= 31;\n");
+ 	printf ("\tSET_ZFLG (1 ^ ((dst >> src) & 1));\n");
+ 	printf ("\tdst &= ~(1 << src);\n");
+ 	genastore ("dst", curi->dmode, "dstreg", curi->size, "dst");
+ 	break;
+     case i_BSET:
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
+ 	genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0);
+ 	if (curi->size == sz_byte)
+ 	    printf ("\tsrc &= 7;\n");
+ 	else
+ 	    printf ("\tsrc &= 31;\n");
+ 	printf ("\tSET_ZFLG (1 ^ ((dst >> src) & 1));\n");
+ 	printf ("\tdst |= (1 << src);\n");
+ 	genastore ("dst", curi->dmode, "dstreg", curi->size, "dst");
+ 	break;
+     case i_CMPM:
+     case i_CMP:
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
+ 	genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0);
+ 	start_brace ();
+ 	genflags (flag_cmp, curi->size, "newv", "src", "dst");
+ 	break;
+     case i_CMPA:
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
+ 	genamode (curi->dmode, "dstreg", sz_long, "dst", 1, 0);
+ 	start_brace ();
+ 	genflags (flag_cmp, sz_long, "newv", "src", "dst");
+ 	break;
+ 	/* The next two are coded a little unconventional, but they are doing
+ 	 * weird things... */
+     case i_MVPRM:
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
+ 
+ 	printf ("\tuaecptr memp = m68k_areg(regs, dstreg) + (uae_s32)(uae_s16)%s;\n", gen_nextiword ());
+ 	if (curi->size == sz_word) {
+ 	    printf ("\tput_byte(memp, src >> 8); put_byte(memp + 2, src);\n");
+ 	} else {
+ 	    printf ("\tput_byte(memp, src >> 24); put_byte(memp + 2, src >> 16);\n");
+ 	    printf ("\tput_byte(memp + 4, src >> 8); put_byte(memp + 6, src);\n");
+ 	}
+ 	break;
+     case i_MVPMR:
+ 	printf ("\tuaecptr memp = m68k_areg(regs, srcreg) + (uae_s32)(uae_s16)%s;\n", gen_nextiword ());
+ 	genamode (curi->dmode, "dstreg", curi->size, "dst", 2, 0);
+ 	if (curi->size == sz_word) {
+ 	    printf ("\tuae_u16 val = (get_byte(memp) << 8) + get_byte(memp + 2);\n");
+ 	} else {
+ 	    printf ("\tuae_u32 val = (get_byte(memp) << 24) + (get_byte(memp + 2) << 16)\n");
+ 	    printf ("              + (get_byte(memp + 4) << 8) + get_byte(memp + 6);\n");
+ 	}
+ 	genastore ("val", curi->dmode, "dstreg", curi->size, "dst");
+ 	break;
+     case i_MOVE:
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
+ 	genamode (curi->dmode, "dstreg", curi->size, "dst", 2, 0);
+ 	genflags (flag_logical, curi->size, "src", "", "");
+ 	genastore ("src", curi->dmode, "dstreg", curi->size, "dst");
+ 	break;
+     case i_MOVEA:
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
+ 	genamode (curi->dmode, "dstreg", curi->size, "dst", 2, 0);
+ 	if (curi->size == sz_word) {
+ 	    printf ("\tuae_u32 val = (uae_s32)(uae_s16)src;\n");
+ 	} else {
+ 	    printf ("\tuae_u32 val = src;\n");
+ 	}
+ 	genastore ("val", curi->dmode, "dstreg", sz_long, "dst");
+ 	break;
+     case i_MVSR2:
+ 	genamode (curi->smode, "srcreg", sz_word, "src", 2, 0);
+ 	printf ("\tMakeSR();\n");
+ 	if (curi->size == sz_byte)
+ 	    genastore ("regs.sr & 0xff", curi->smode, "srcreg", sz_word, "src");
+ 	else
+ 	    genastore ("regs.sr", curi->smode, "srcreg", sz_word, "src");
+ 	break;
+     case i_MV2SR:
+ 	genamode (curi->smode, "srcreg", sz_word, "src", 1, 0);
+ 	if (curi->size == sz_byte)
+ 	    printf ("\tMakeSR();\n\tregs.sr &= 0xFF00;\n\tregs.sr |= src & 0xFF;\n");
+ 	else {
+ 	    printf ("\tregs.sr = src;\n");
+ 	}
+ 	printf ("\tMakeFromSR();\n");
+ 	break;
+     case i_SWAP:
+ 	genamode (curi->smode, "srcreg", sz_long, "src", 1, 0);
+ 	start_brace ();
+ 	printf ("\tuae_u32 dst = ((src >> 16)&0xFFFF) | ((src&0xFFFF)<<16);\n");
+ 	genflags (flag_logical, sz_long, "dst", "", "");
+ 	genastore ("dst", curi->smode, "srcreg", sz_long, "src");
+ 	break;
+     case i_EXG:
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
+ 	genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0);
+ 	genastore ("dst", curi->smode, "srcreg", curi->size, "src");
+ 	genastore ("src", curi->dmode, "dstreg", curi->size, "dst");
+ 	break;
+     case i_EXT:
+ 	genamode (curi->smode, "srcreg", sz_long, "src", 1, 0);
+ 	start_brace ();
+ 	switch (curi->size) {
+ 	case sz_byte: printf ("\tuae_u32 dst = (uae_s32)(uae_s8)src;\n"); break;
+ 	case sz_word: printf ("\tuae_u16 dst = (uae_s16)(uae_s8)src;\n"); break;
+ 	case sz_long: printf ("\tuae_u32 dst = (uae_s32)(uae_s16)src;\n"); break;
+ 	default: abort ();
+ 	}
+ 	genflags (flag_logical,
+ 		  curi->size == sz_word ? sz_word : sz_long, "dst", "", "");
+ 	genastore ("dst", curi->smode, "srcreg",
+ 		   curi->size == sz_word ? sz_word : sz_long, "src");
+ 	break;
+     case i_MVMEL:
+ 	genmovemel (opcode);
+ 	break;
+     case i_MVMLE:
+ 	genmovemle (opcode);
+ 	break;
+     case i_TRAP:
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
+ 	sync_m68k_pc ();
+ 	printf ("\tException(src+32,0);\n");
+ 	m68k_pc_offset = 0;
+ 	break;
+     case i_MVR2USP:
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
+ 	printf ("\tregs.usp = src;\n");
+ 	break;
+     case i_MVUSP2R:
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 2, 0);
+ 	genastore ("regs.usp", curi->smode, "srcreg", curi->size, "src");
+ 	break;
+     case i_RESET:
+ 	printf ("\tcustomreset();\n");
+ 	break;
+     case i_NOP:
+ 	break;
+     case i_STOP:
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
+ 	printf ("\tregs.sr = src;\n");
+ 	printf ("\tMakeFromSR();\n");
+ 	printf ("\tm68k_setstopped(1);\n");
+ 	break;
+     case i_RTE:
+ 	if (cpu_level == 0) {
+ 	    genamode (Aipi, "7", sz_word, "sr", 1, 0);
+ 	    genamode (Aipi, "7", sz_long, "pc", 1, 0);
+ 	    printf ("\tregs.sr = sr; m68k_setpc_rte(pc);\n");
+ 	    fill_prefetch_0 ();
+ 	    printf ("\tMakeFromSR();\n");
+ 	} else {
+ 	    int old_brace_level = n_braces;
+ 	    if (next_cpu_level < 0)
+ 		next_cpu_level = 0;
+ 	    printf ("\tuae_u16 newsr; uae_u32 newpc; for (;;) {\n");
+ 	    genamode (Aipi, "7", sz_word, "sr", 1, 0);
+ 	    genamode (Aipi, "7", sz_long, "pc", 1, 0);
+ 	    genamode (Aipi, "7", sz_word, "format", 1, 0);
+ 	    printf ("\tnewsr = sr; newpc = pc;\n");
+ 	    printf ("\tif ((format & 0xF000) == 0x0000) { break; }\n");
+ 	    printf ("\telse if ((format & 0xF000) == 0x1000) { ; }\n");
+ 	    printf ("\telse if ((format & 0xF000) == 0x2000) { m68k_areg(regs, 7) += 4; break; }\n");
+ 	    printf ("\telse if ((format & 0xF000) == 0x8000) { m68k_areg(regs, 7) += 50; break; }\n");
+ 	    printf ("\telse if ((format & 0xF000) == 0x9000) { m68k_areg(regs, 7) += 12; break; }\n");
+ 	    printf ("\telse if ((format & 0xF000) == 0xa000) { m68k_areg(regs, 7) += 24; break; }\n");
+ 	    printf ("\telse if ((format & 0xF000) == 0xb000) { m68k_areg(regs, 7) += 84; break; }\n");
+ 	    printf ("\telse { Exception(14,0); goto %s; }\n", endlabelstr);
+ 	    printf ("\tregs.sr = newsr; MakeFromSR();\n}\n");
+ 	    pop_braces (old_brace_level);
+ 	    printf ("\tregs.sr = newsr; MakeFromSR();\n");
+ 	    printf ("\tm68k_setpc_rte(newpc);\n");
+ 	    fill_prefetch_0 ();
+ 	    need_endlabel = 1;
+ 	}
+ 	/* PC is set and prefetch filled. */
+ 	m68k_pc_offset = 0;
+ 	break;
+     case i_RTD:
+ 	printf ("\tcompiler_flush_jsr_stack();\n");
+ 	genamode (Aipi, "7", sz_long, "pc", 1, 0);
+ 	genamode (curi->smode, "srcreg", curi->size, "offs", 1, 0);
+ 	printf ("\tm68k_areg(regs, 7) += offs;\n");
+ 	printf ("\tm68k_setpc_rte(pc);\n");
+ 	fill_prefetch_0 ();
+ 	/* PC is set and prefetch filled. */
+ 	m68k_pc_offset = 0;
+ 	break;
+     case i_LINK:
+ 	genamode (Apdi, "7", sz_long, "old", 2, 0);
+ 	genamode (curi->smode, "srcreg", sz_long, "src", 1, 0);
+ 	genastore ("src", Apdi, "7", sz_long, "old");
+ 	genastore ("m68k_areg(regs, 7)", curi->smode, "srcreg", sz_long, "src");
+ 	genamode (curi->dmode, "dstreg", curi->size, "offs", 1, 0);
+ 	printf ("\tm68k_areg(regs, 7) += offs;\n");
+ 	break;
+     case i_UNLK:
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
+ 	printf ("\tm68k_areg(regs, 7) = src;\n");
+ 	genamode (Aipi, "7", sz_long, "old", 1, 0);
+ 	genastore ("old", curi->smode, "srcreg", curi->size, "src");
+ 	break;
+     case i_RTS:
+ 	printf ("\tm68k_do_rts();\n");
+ 	fill_prefetch_0 ();
+ 	m68k_pc_offset = 0;
+ 	break;
+     case i_TRAPV:
+ 	sync_m68k_pc ();
+ 	printf ("\tif (GET_VFLG) { Exception(7,m68k_getpc()); goto %s; }\n", endlabelstr);
+ 	need_endlabel = 1;
+ 	break;
+     case i_RTR:
+ 	printf ("\tcompiler_flush_jsr_stack();\n");
+ 	printf ("\tMakeSR();\n");
+ 	genamode (Aipi, "7", sz_word, "sr", 1, 0);
+ 	genamode (Aipi, "7", sz_long, "pc", 1, 0);
+ 	printf ("\tregs.sr &= 0xFF00; sr &= 0xFF;\n");
+ 	printf ("\tregs.sr |= sr; m68k_setpc(pc);\n");
+ 	fill_prefetch_0 ();
+ 	printf ("\tMakeFromSR();\n");
+ 	m68k_pc_offset = 0;
+ 	break;
+     case i_JSR:
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 0, 0);
+ 	printf ("\tm68k_do_jsr(m68k_getpc() + %d, srca);\n", m68k_pc_offset);
+ 	fill_prefetch_0 ();
+ 	m68k_pc_offset = 0;
+ 	break;
+     case i_JMP:
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 0, 0);
+ 	printf ("\tm68k_setpc(srca);\n");
+ 	fill_prefetch_0 ();
+ 	m68k_pc_offset = 0;
+ 	break;
+     case i_BSR:
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
+ 	printf ("\tuae_s32 s = (uae_s32)src + 2;\n");
+ 	if (using_exception_3) {
+ 	    printf ("\tif (src & 1) {\n");
+ 	    printf ("\tlast_addr_for_exception_3 = m68k_getpc() + 2;\n");
+ 	    printf ("\t\tlast_fault_for_exception_3 = m68k_getpc() + s;\n");
+ 	    printf ("\t\tlast_op_for_exception_3 = opcode; Exception(3,0); goto %s;\n", endlabelstr);
+ 	    printf ("\t}\n");
+ 	    need_endlabel = 1;
+ 	}
+ 	printf ("\tm68k_do_bsr(m68k_getpc() + %d, s);\n", m68k_pc_offset);
+ 	fill_prefetch_0 ();
+ 	m68k_pc_offset = 0;
+ 	break;
+     case i_Bcc:
+ 	if (curi->size == sz_long) {
+ 	    if (cpu_level < 2) {
+ 		printf ("\tm68k_incpc(2);\n");
+ 		printf ("\tif (!cctrue(%d)) goto %s;\n", curi->cc, endlabelstr);
+ 		printf ("\t\tlast_addr_for_exception_3 = m68k_getpc() + 2;\n");
+ 		printf ("\t\tlast_fault_for_exception_3 = m68k_getpc() + 1;\n");
+ 		printf ("\t\tlast_op_for_exception_3 = opcode; Exception(3,0); goto %s;\n", endlabelstr);
+ 		need_endlabel = 1;
+ 	    } else {
+ 		if (next_cpu_level < 1)
+ 		    next_cpu_level = 1;
+ 	    }
+ 	}
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
+ 	printf ("\tif (!cctrue(%d)) goto didnt_jump;\n", curi->cc);
+ 	if (using_exception_3) {
+ 	    printf ("\tif (src & 1) {\n");
+ 	    printf ("\t\tlast_addr_for_exception_3 = m68k_getpc() + 2;\n");
+ 	    printf ("\t\tlast_fault_for_exception_3 = m68k_getpc() + 2 + (uae_s32)src;\n");
+ 	    printf ("\t\tlast_op_for_exception_3 = opcode; Exception(3,0); goto %s;\n", endlabelstr);
+ 	    printf ("\t}\n");
+ 	    need_endlabel = 1;
+ 	}
+ #ifdef USE_COMPILER
+ 	printf ("\tm68k_setpc_bcc(m68k_getpc() + 2 + (uae_s32)src);\n");
+ #else
+ 	printf ("\tm68k_incpc ((uae_s32)src + 2);\n");
+ #endif
+ 	fill_prefetch_0 ();
+ 	printf ("\treturn 5;\n");
+ 	printf ("didnt_jump:;\n");
+ 	need_endlabel = 1;
+ 	insn_n_cycles = curi->size == sz_byte ? 8 : 12;
+ 	break;
+     case i_LEA:
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 0, 0);
+ 	genamode (curi->dmode, "dstreg", curi->size, "dst", 2, 0);
+ 	genastore ("srca", curi->dmode, "dstreg", curi->size, "dst");
+ 	break;
+     case i_PEA:
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 0, 0);
+ 	genamode (Apdi, "7", sz_long, "dst", 2, 0);
+ 	genastore ("srca", Apdi, "7", sz_long, "dst");
+ 	break;
+     case i_DBcc:
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
+ 	genamode (curi->dmode, "dstreg", curi->size, "offs", 1, 0);
+ 
+ 	printf ("\tif (!cctrue(%d)) {\n", curi->cc);
+ 	genastore ("(src-1)", curi->smode, "srcreg", curi->size, "src");
+ 
+ 	printf ("\t\tif (src) {\n");
+ 	if (using_exception_3) {
+ 	    printf ("\t\t\tif (offs & 1) {\n");
+ 	    printf ("\t\t\tlast_addr_for_exception_3 = m68k_getpc() + 2;\n");
+ 	    printf ("\t\t\tlast_fault_for_exception_3 = m68k_getpc() + 2 + (uae_s32)offs + 2;\n");
+ 	    printf ("\t\t\tlast_op_for_exception_3 = opcode; Exception(3,0); goto %s;\n", endlabelstr);
+ 	    printf ("\t\t}\n");
+ 	    need_endlabel = 1;
+ 	}
+ #ifdef USE_COMPILER
+ 	printf ("\t\t\tm68k_setpc_bcc(m68k_getpc() + (uae_s32)offs + 2);\n");
+ #else
+ 	printf ("\t\t\tm68k_incpc((uae_s32)offs + 2);\n");
+ #endif
+ 	fill_prefetch_0 ();
+ 	/* ??? Cycle count is a guess.  */
+ 	printf ("\t\treturn 6;\n");
+ 	printf ("\t\t}\n");
+ 	printf ("\t}\n");
+ 	insn_n_cycles = 12;
+ 	need_endlabel = 1;
+ 	break;
+     case i_Scc:
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 2, 0);
+ 	start_brace ();
+ 	printf ("\tint val = cctrue(%d) ? 0xff : 0;\n", curi->cc);
+ 	genastore ("val", curi->smode, "srcreg", curi->size, "src");
+ 	break;
+     case i_DIVU:
+ 	printf ("\tuaecptr oldpc = m68k_getpc();\n");
+ 	genamode (curi->smode, "srcreg", sz_word, "src", 1, 0);
+ 	genamode (curi->dmode, "dstreg", sz_long, "dst", 1, 0);
+ 	sync_m68k_pc ();
+ 	/* Clear V flag when dividing by zero - Alcatraz Odyssey demo depends
+ 	 * on this (actually, it's doing a DIVS).  */
+ 	printf ("\tif (src == 0) { SET_VFLG (0); Exception (5, oldpc); goto %s; } else {\n", endlabelstr);
+ 	printf ("\tuae_u32 newv = (uae_u32)dst / (uae_u32)(uae_u16)src;\n");
+ 	printf ("\tuae_u32 rem = (uae_u32)dst %% (uae_u32)(uae_u16)src;\n");
+ 	/* The N flag appears to be set each time there is an overflow.
+ 	 * Weird. */
+ 	printf ("\tif (newv > 0xffff) { SET_VFLG (1); SET_NFLG (1); SET_CFLG (0); } else\n\t{\n");
+ 	genflags (flag_logical, sz_word, "newv", "", "");
+ 	printf ("\tnewv = (newv & 0xffff) | ((uae_u32)rem << 16);\n");
+ 	genastore ("newv", curi->dmode, "dstreg", sz_long, "dst");
+ 	printf ("\t}\n");
+ 	printf ("\t}\n");
+ 	insn_n_cycles += 136;
+ 	need_endlabel = 1;
+ 	break;
+     case i_DIVS:
+ 	printf ("\tuaecptr oldpc = m68k_getpc();\n");
+ 	genamode (curi->smode, "srcreg", sz_word, "src", 1, 0);
+ 	genamode (curi->dmode, "dstreg", sz_long, "dst", 1, 0);
+ 	sync_m68k_pc ();
+ 	printf ("\tif (src == 0) { SET_VFLG (0); Exception(5,oldpc); goto %s; } else {\n", endlabelstr);
+ 	printf ("\tuae_s32 newv = (uae_s32)dst / (uae_s32)(uae_s16)src;\n");
+ 	printf ("\tuae_u16 rem = (uae_s32)dst %% (uae_s32)(uae_s16)src;\n");
+ 	printf ("\tif ((newv & 0xffff8000) != 0 && (newv & 0xffff8000) != 0xffff8000) { SET_VFLG (1); SET_NFLG (1); SET_CFLG (0); } else\n\t{\n");
+ 	printf ("\tif (((uae_s16)rem < 0) != ((uae_s32)dst < 0)) rem = -rem;\n");
+ 	genflags (flag_logical, sz_word, "newv", "", "");
+ 	printf ("\tnewv = (newv & 0xffff) | ((uae_u32)rem << 16);\n");
+ 	genastore ("newv", curi->dmode, "dstreg", sz_long, "dst");
+ 	printf ("\t}\n");
+ 	printf ("\t}\n");
+ 	insn_n_cycles += 154;
+ 	need_endlabel = 1;
+ 	break;
+     case i_MULU:
+ 	genamode (curi->smode, "srcreg", sz_word, "src", 1, 0);
+ 	genamode (curi->dmode, "dstreg", sz_word, "dst", 1, 0);
+ 	start_brace ();
+ 	printf ("\tuae_u32 newv = (uae_u32)(uae_u16)dst * (uae_u32)(uae_u16)src;\n");
+ 	genflags (flag_logical, sz_long, "newv", "", "");
+ 	genastore ("newv", curi->dmode, "dstreg", sz_long, "dst");
+ 	insn_n_cycles += 66;
+ 	break;
+     case i_MULS:
+ 	genamode (curi->smode, "srcreg", sz_word, "src", 1, 0);
+ 	genamode (curi->dmode, "dstreg", sz_word, "dst", 1, 0);
+ 	start_brace ();
+ 	printf ("\tuae_u32 newv = (uae_s32)(uae_s16)dst * (uae_s32)(uae_s16)src;\n");
+ 	genflags (flag_logical, sz_long, "newv", "", "");
+ 	genastore ("newv", curi->dmode, "dstreg", sz_long, "dst");
+ 	insn_n_cycles += 66;
+ 	break;
+     case i_CHK:
+ 	printf ("\tuaecptr oldpc = m68k_getpc();\n");
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
+ 	genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0);
+ 	printf ("\tif ((uae_s32)dst < 0) { SET_NFLG (1); Exception(6,oldpc); goto %s; }\n", endlabelstr);
+ 	printf ("\telse if (dst > src) { SET_NFLG (0); Exception(6,oldpc); goto %s; }\n", endlabelstr);
+ 	need_endlabel = 1;
+ 	break;
+ 
+     case i_CHK2:
+ 	printf ("\tuaecptr oldpc = m68k_getpc();\n");
+ 	genamode (curi->smode, "srcreg", curi->size, "extra", 1, 0);
+ 	genamode (curi->dmode, "dstreg", curi->size, "dst", 2, 0);
+ 	printf ("\t{uae_s32 upper,lower,reg = regs.regs[(extra >> 12) & 15];\n");
+ 	switch (curi->size) {
+ 	case sz_byte:
+ 	    printf ("\tlower=(uae_s32)(uae_s8)get_byte(dsta); upper = (uae_s32)(uae_s8)get_byte(dsta+1);\n");
+ 	    printf ("\tif ((extra & 0x8000) == 0) reg = (uae_s32)(uae_s8)reg;\n");
+ 	    break;
+ 	case sz_word:
+ 	    printf ("\tlower=(uae_s32)(uae_s16)get_word(dsta); upper = (uae_s32)(uae_s16)get_word(dsta+2);\n");
+ 	    printf ("\tif ((extra & 0x8000) == 0) reg = (uae_s32)(uae_s16)reg;\n");
+ 	    break;
+ 	case sz_long:
+ 	    printf ("\tlower=get_long(dsta); upper = get_long(dsta+4);\n");
+ 	    break;
+ 	default:
+ 	    abort ();
+ 	}
+ 	printf ("\tSET_ZFLG (upper == reg || lower == reg);\n");
+ 	printf ("\tSET_CFLG (lower <= upper ? reg < lower || reg > upper : reg > upper || reg < lower);\n");
+ 	printf ("\tif ((extra & 0x800) && GET_CFLG) { Exception(6,oldpc); goto %s; }\n}\n", endlabelstr);
+ 	need_endlabel = 1;
+ 	break;
+ 
+     case i_ASR:
+ 	genamode (curi->smode, "srcreg", curi->size, "cnt", 1, 0);
+ 	genamode (curi->dmode, "dstreg", curi->size, "data", 1, 0);
+ 	start_brace ();
+ 	switch (curi->size) {
+ 	case sz_byte: printf ("\tuae_u32 val = (uae_u8)data;\n"); break;
+ 	case sz_word: printf ("\tuae_u32 val = (uae_u16)data;\n"); break;
+ 	case sz_long: printf ("\tuae_u32 val = data;\n"); break;
+ 	default: abort ();
+ 	}
+ 	printf ("\tuae_u32 sign = (%s & val) >> %d;\n", cmask (curi->size), bit_size (curi->size) - 1);
+ 	printf ("\tcnt &= 63;\n");
+ 	printf ("\tCLEAR_CZNV;\n");
+ 	printf ("\tif (cnt >= %d) {\n", bit_size (curi->size));
+ 	printf ("\t\tval = %s & (uae_u32)-sign;\n", bit_mask (curi->size));
+ 	printf ("\t\tSET_CFLG (sign);\n");
+ 	duplicate_carry ();
+ 	if (source_is_imm1_8 (curi))
+ 	    printf ("\t} else {\n");
+ 	else
+ 	    printf ("\t} else if (cnt > 0) {\n");
+ 	printf ("\t\tval >>= cnt - 1;\n");
+ 	printf ("\t\tSET_CFLG (val & 1);\n");
+ 	duplicate_carry ();
+ 	printf ("\t\tval >>= 1;\n");
+ 	printf ("\t\tval |= (%s << (%d - cnt)) & (uae_u32)-sign;\n",
+ 		bit_mask (curi->size),
+ 		bit_size (curi->size));
+ 	printf ("\t\tval &= %s;\n", bit_mask (curi->size));
+ 	printf ("\t}\n");
+ 	genflags (flag_logical_noclobber, curi->size, "val", "", "");
+ 	genastore ("val", curi->dmode, "dstreg", curi->size, "data");
+ 	break;
+     case i_ASL:
+ 	genamode (curi->smode, "srcreg", curi->size, "cnt", 1, 0);
+ 	genamode (curi->dmode, "dstreg", curi->size, "data", 1, 0);
+ 	start_brace ();
+ 	switch (curi->size) {
+ 	case sz_byte: printf ("\tuae_u32 val = (uae_u8)data;\n"); break;
+ 	case sz_word: printf ("\tuae_u32 val = (uae_u16)data;\n"); break;
+ 	case sz_long: printf ("\tuae_u32 val = data;\n"); break;
+ 	default: abort ();
+ 	}
+ 	printf ("\tcnt &= 63;\n");
+ 	printf ("\tCLEAR_CZNV;\n");
+ 	printf ("\tif (cnt >= %d) {\n", bit_size (curi->size));
+ 	printf ("\t\tSET_VFLG (val != 0);\n");
+ 	printf ("\t\tSET_CFLG (cnt == %d ? val & 1 : 0);\n",
+ 		bit_size (curi->size));
+ 	duplicate_carry ();
+ 	printf ("\t\tval = 0;\n");
+ 	if (source_is_imm1_8 (curi))
+ 	    printf ("\t} else {\n");
+ 	else
+ 	    printf ("\t} else if (cnt > 0) {\n");
+ 	printf ("\t\tuae_u32 mask = (%s << (%d - cnt)) & %s;\n",
+ 		bit_mask (curi->size),
+ 		bit_size (curi->size) - 1,
+ 		bit_mask (curi->size));
+ 	printf ("\t\tSET_VFLG ((val & mask) != mask && (val & mask) != 0);\n");
+ 	printf ("\t\tval <<= cnt - 1;\n");
+ 	printf ("\t\tSET_CFLG ((val & %s) >> %d);\n", cmask (curi->size), bit_size (curi->size) - 1);
+ 	duplicate_carry ();
+ 	printf ("\t\tval <<= 1;\n");
+ 	printf ("\t\tval &= %s;\n", bit_mask (curi->size));
+ 	printf ("\t}\n");
+ 	genflags (flag_logical_noclobber, curi->size, "val", "", "");
+ 	genastore ("val", curi->dmode, "dstreg", curi->size, "data");
+ 	break;
+     case i_LSR:
+ 	genamode (curi->smode, "srcreg", curi->size, "cnt", 1, 0);
+ 	genamode (curi->dmode, "dstreg", curi->size, "data", 1, 0);
+ 	start_brace ();
+ 	switch (curi->size) {
+ 	case sz_byte: printf ("\tuae_u32 val = (uae_u8)data;\n"); break;
+ 	case sz_word: printf ("\tuae_u32 val = (uae_u16)data;\n"); break;
+ 	case sz_long: printf ("\tuae_u32 val = data;\n"); break;
+ 	default: abort ();
+ 	}
+ 	printf ("\tcnt &= 63;\n");
+ 	printf ("\tCLEAR_CZNV;\n");
+ 	printf ("\tif (cnt >= %d) {\n", bit_size (curi->size));
+ 	printf ("\t\tSET_CFLG ((cnt == %d) & (val >> %d));\n",
+ 		bit_size (curi->size), bit_size (curi->size) - 1);
+ 	duplicate_carry ();
+ 	printf ("\t\tval = 0;\n");
+ 	if (source_is_imm1_8 (curi))
+ 	    printf ("\t} else {\n");
+ 	else
+ 	    printf ("\t} else if (cnt > 0) {\n");
+ 	printf ("\t\tval >>= cnt - 1;\n");
+ 	printf ("\t\tSET_CFLG (val & 1);\n");
+ 	duplicate_carry ();
+ 	printf ("\t\tval >>= 1;\n");
+ 	printf ("\t}\n");
+ 	genflags (flag_logical_noclobber, curi->size, "val", "", "");
+ 	genastore ("val", curi->dmode, "dstreg", curi->size, "data");
+ 	break;
+     case i_LSL:
+ 	genamode (curi->smode, "srcreg", curi->size, "cnt", 1, 0);
+ 	genamode (curi->dmode, "dstreg", curi->size, "data", 1, 0);
+ 	start_brace ();
+ 	switch (curi->size) {
+ 	case sz_byte: printf ("\tuae_u32 val = (uae_u8)data;\n"); break;
+ 	case sz_word: printf ("\tuae_u32 val = (uae_u16)data;\n"); break;
+ 	case sz_long: printf ("\tuae_u32 val = data;\n"); break;
+ 	default: abort ();
+ 	}
+ 	printf ("\tcnt &= 63;\n");
+ 	printf ("\tCLEAR_CZNV;\n");
+ 	printf ("\tif (cnt >= %d) {\n", bit_size (curi->size));
+ 	printf ("\t\tSET_CFLG (cnt == %d ? val & 1 : 0);\n",
+ 		bit_size (curi->size));
+ 	duplicate_carry ();
+ 	printf ("\t\tval = 0;\n");
+ 	if (source_is_imm1_8 (curi))
+ 	    printf ("\t} else {\n");
+ 	else
+ 	    printf ("\t} else if (cnt > 0) {\n");
+ 	printf ("\t\tval <<= (cnt - 1);\n");
+ 	printf ("\t\tSET_CFLG ((val & %s) >> %d);\n", cmask (curi->size), bit_size (curi->size) - 1);
+ 	duplicate_carry ();
+ 	printf ("\t\tval <<= 1;\n");
+ 	printf ("\tval &= %s;\n", bit_mask (curi->size));
+ 	printf ("\t}\n");
+ 	genflags (flag_logical_noclobber, curi->size, "val", "", "");
+ 	genastore ("val", curi->dmode, "dstreg", curi->size, "data");
+ 	break;
+     case i_ROL:
+ 	genamode (curi->smode, "srcreg", curi->size, "cnt", 1, 0);
+ 	genamode (curi->dmode, "dstreg", curi->size, "data", 1, 0);
+ 	start_brace ();
+ 	switch (curi->size) {
+ 	case sz_byte: printf ("\tuae_u32 val = (uae_u8)data;\n"); break;
+ 	case sz_word: printf ("\tuae_u32 val = (uae_u16)data;\n"); break;
+ 	case sz_long: printf ("\tuae_u32 val = data;\n"); break;
+ 	default: abort ();
+ 	}
+ 	printf ("\tcnt &= 63;\n");
+ 	printf ("\tCLEAR_CZNV;\n");
+ 	if (source_is_imm1_8 (curi))
+ 	    printf ("{");
+ 	else
+ 	    printf ("\tif (cnt > 0) {\n");
+ 	printf ("\tuae_u32 loval;\n");
+ 	printf ("\tcnt &= %d;\n", bit_size (curi->size) - 1);
+ 	printf ("\tloval = val >> (%d - cnt);\n", bit_size (curi->size));
+ 	printf ("\tval <<= cnt;\n");
+ 	printf ("\tval |= loval;\n");
+ 	printf ("\tval &= %s;\n", bit_mask (curi->size));
+ 	printf ("\tSET_CFLG (val & 1);\n");
+ 	printf ("}\n");
+ 	genflags (flag_logical_noclobber, curi->size, "val", "", "");
+ 	genastore ("val", curi->dmode, "dstreg", curi->size, "data");
+ 	break;
+     case i_ROR:
+ 	genamode (curi->smode, "srcreg", curi->size, "cnt", 1, 0);
+ 	genamode (curi->dmode, "dstreg", curi->size, "data", 1, 0);
+ 	start_brace ();
+ 	switch (curi->size) {
+ 	case sz_byte: printf ("\tuae_u32 val = (uae_u8)data;\n"); break;
+ 	case sz_word: printf ("\tuae_u32 val = (uae_u16)data;\n"); break;
+ 	case sz_long: printf ("\tuae_u32 val = data;\n"); break;
+ 	default: abort ();
+ 	}
+ 	printf ("\tcnt &= 63;\n");
+ 	printf ("\tCLEAR_CZNV;\n");
+ 	if (source_is_imm1_8 (curi))
+ 	    printf ("{");
+ 	else
+ 	    printf ("\tif (cnt > 0) {");
+ 	printf ("\tuae_u32 hival;\n");
+ 	printf ("\tcnt &= %d;\n", bit_size (curi->size) - 1);
+ 	printf ("\thival = val << (%d - cnt);\n", bit_size (curi->size));
+ 	printf ("\tval >>= cnt;\n");
+ 	printf ("\tval |= hival;\n");
+ 	printf ("\tval &= %s;\n", bit_mask (curi->size));
+ 	printf ("\tSET_CFLG ((val & %s) >> %d);\n", cmask (curi->size), bit_size (curi->size) - 1);
+ 	printf ("\t}\n");
+ 	genflags (flag_logical_noclobber, curi->size, "val", "", "");
+ 	genastore ("val", curi->dmode, "dstreg", curi->size, "data");
+ 	break;
+     case i_ROXL:
+ 	genamode (curi->smode, "srcreg", curi->size, "cnt", 1, 0);
+ 	genamode (curi->dmode, "dstreg", curi->size, "data", 1, 0);
+ 	start_brace ();
+ 	switch (curi->size) {
+ 	case sz_byte: printf ("\tuae_u32 val = (uae_u8)data;\n"); break;
+ 	case sz_word: printf ("\tuae_u32 val = (uae_u16)data;\n"); break;
+ 	case sz_long: printf ("\tuae_u32 val = data;\n"); break;
+ 	default: abort ();
+ 	}
+ 	printf ("\tcnt &= 63;\n");
+ 	printf ("\tCLEAR_CZNV;\n");
+ 	if (source_is_imm1_8 (curi))
+ 	    printf ("{");
+ 	else {
+ 	    force_range_for_rox ("cnt", curi->size);
+ 	    printf ("\tif (cnt > 0) {\n");
+ 	}
+ 	printf ("\tcnt--;\n");
+ 	printf ("\t{\n\tuae_u32 carry;\n");
+ 	printf ("\tuae_u32 loval = val >> (%d - cnt);\n", bit_size (curi->size) - 1);
+ 	printf ("\tcarry = loval & 1;\n");
+ 	printf ("\tval = (((val << 1) | GET_XFLG) << cnt) | (loval >> 1);\n");
+ 	printf ("\tSET_XFLG (carry);\n");
+ 	printf ("\tval &= %s;\n", bit_mask (curi->size));
+ 	printf ("\t} }\n");
+ 	printf ("\tSET_CFLG (GET_XFLG);\n");
+ 	genflags (flag_logical_noclobber, curi->size, "val", "", "");
+ 	genastore ("val", curi->dmode, "dstreg", curi->size, "data");
+ 	break;
+     case i_ROXR:
+ 	genamode (curi->smode, "srcreg", curi->size, "cnt", 1, 0);
+ 	genamode (curi->dmode, "dstreg", curi->size, "data", 1, 0);
+ 	start_brace ();
+ 	switch (curi->size) {
+ 	case sz_byte: printf ("\tuae_u32 val = (uae_u8)data;\n"); break;
+ 	case sz_word: printf ("\tuae_u32 val = (uae_u16)data;\n"); break;
+ 	case sz_long: printf ("\tuae_u32 val = data;\n"); break;
+ 	default: abort ();
+ 	}
+ 	printf ("\tcnt &= 63;\n");
+ 	printf ("\tCLEAR_CZNV;\n");
+ 	if (source_is_imm1_8 (curi))
+ 	    printf ("{");
+ 	else {
+ 	    force_range_for_rox ("cnt", curi->size);
+ 	    printf ("\tif (cnt > 0) {\n");
+ 	}
+ 	printf ("\tcnt--;\n");
+ 	printf ("\t{\n\tuae_u32 carry;\n");
+ 	printf ("\tuae_u32 hival = (val << 1) | GET_XFLG;\n");
+ 	printf ("\thival <<= (%d - cnt);\n", bit_size (curi->size) - 1);
+ 	printf ("\tval >>= cnt;\n");
+ 	printf ("\tcarry = val & 1;\n");
+ 	printf ("\tval >>= 1;\n");
+ 	printf ("\tval |= hival;\n");
+ 	printf ("\tSET_XFLG (carry);\n");
+ 	printf ("\tval &= %s;\n", bit_mask (curi->size));
+ 	printf ("\t} }\n");
+ 	printf ("\tSET_CFLG (GET_XFLG);\n");
+ 	genflags (flag_logical_noclobber, curi->size, "val", "", "");
+ 	genastore ("val", curi->dmode, "dstreg", curi->size, "data");
+ 	break;
+     case i_ASRW:
+ 	genamode (curi->smode, "srcreg", curi->size, "data", 1, 0);
+ 	start_brace ();
+ 	switch (curi->size) {
+ 	case sz_byte: printf ("\tuae_u32 val = (uae_u8)data;\n"); break;
+ 	case sz_word: printf ("\tuae_u32 val = (uae_u16)data;\n"); break;
+ 	case sz_long: printf ("\tuae_u32 val = data;\n"); break;
+ 	default: abort ();
+ 	}
+ 	printf ("\tuae_u32 sign = %s & val;\n", cmask (curi->size));
+ 	printf ("\tuae_u32 cflg = val & 1;\n");
+ 	printf ("\tval = (val >> 1) | sign;\n");
+ 	genflags (flag_logical, curi->size, "val", "", "");
+ 	printf ("\tSET_CFLG (cflg);\n");
+ 	duplicate_carry ();
+ 	genastore ("val", curi->smode, "srcreg", curi->size, "data");
+ 	break;
+     case i_ASLW:
+ 	genamode (curi->smode, "srcreg", curi->size, "data", 1, 0);
+ 	start_brace ();
+ 	switch (curi->size) {
+ 	case sz_byte: printf ("\tuae_u32 val = (uae_u8)data;\n"); break;
+ 	case sz_word: printf ("\tuae_u32 val = (uae_u16)data;\n"); break;
+ 	case sz_long: printf ("\tuae_u32 val = data;\n"); break;
+ 	default: abort ();
+ 	}
+ 	printf ("\tuae_u32 sign = %s & val;\n", cmask (curi->size));
+ 	printf ("\tuae_u32 sign2;\n");
+ 	printf ("\tval <<= 1;\n");
+ 	genflags (flag_logical, curi->size, "val", "", "");
+ 	printf ("\tsign2 = %s & val;\n", cmask (curi->size));
+ 	printf ("\tSET_CFLG (sign != 0);\n");
+ 	duplicate_carry ();
+ 
+ 	printf ("\tSET_VFLG (GET_VFLG | (sign2 != sign));\n");
+ 	genastore ("val", curi->smode, "srcreg", curi->size, "data");
+ 	break;
+     case i_LSRW:
+ 	genamode (curi->smode, "srcreg", curi->size, "data", 1, 0);
+ 	start_brace ();
+ 	switch (curi->size) {
+ 	case sz_byte: printf ("\tuae_u32 val = (uae_u8)data;\n"); break;
+ 	case sz_word: printf ("\tuae_u32 val = (uae_u16)data;\n"); break;
+ 	case sz_long: printf ("\tuae_u32 val = data;\n"); break;
+ 	default: abort ();
+ 	}
+ 	printf ("\tuae_u32 carry = val & 1;\n");
+ 	printf ("\tval >>= 1;\n");
+ 	genflags (flag_logical, curi->size, "val", "", "");
+ 	printf ("SET_CFLG (carry);\n");
+ 	duplicate_carry ();
+ 	genastore ("val", curi->smode, "srcreg", curi->size, "data");
+ 	break;
+     case i_LSLW:
+ 	genamode (curi->smode, "srcreg", curi->size, "data", 1, 0);
+ 	start_brace ();
+ 	switch (curi->size) {
+ 	case sz_byte: printf ("\tuae_u8 val = data;\n"); break;
+ 	case sz_word: printf ("\tuae_u16 val = data;\n"); break;
+ 	case sz_long: printf ("\tuae_u32 val = data;\n"); break;
+ 	default: abort ();
+ 	}
+ 	printf ("\tuae_u32 carry = val & %s;\n", cmask (curi->size));
+ 	printf ("\tval <<= 1;\n");
+ 	genflags (flag_logical, curi->size, "val", "", "");
+ 	printf ("SET_CFLG (carry >> %d);\n", bit_size (curi->size) - 1);
+ 	duplicate_carry ();
+ 	genastore ("val", curi->smode, "srcreg", curi->size, "data");
+ 	break;
+     case i_ROLW:
+ 	genamode (curi->smode, "srcreg", curi->size, "data", 1, 0);
+ 	start_brace ();
+ 	switch (curi->size) {
+ 	case sz_byte: printf ("\tuae_u8 val = data;\n"); break;
+ 	case sz_word: printf ("\tuae_u16 val = data;\n"); break;
+ 	case sz_long: printf ("\tuae_u32 val = data;\n"); break;
+ 	default: abort ();
+ 	}
+ 	printf ("\tuae_u32 carry = val & %s;\n", cmask (curi->size));
+ 	printf ("\tval <<= 1;\n");
+ 	printf ("\tif (carry)  val |= 1;\n");
+ 	genflags (flag_logical, curi->size, "val", "", "");
+ 	printf ("SET_CFLG (carry >> %d);\n", bit_size (curi->size) - 1);
+ 	genastore ("val", curi->smode, "srcreg", curi->size, "data");
+ 	break;
+     case i_RORW:
+ 	genamode (curi->smode, "srcreg", curi->size, "data", 1, 0);
+ 	start_brace ();
+ 	switch (curi->size) {
+ 	case sz_byte: printf ("\tuae_u8 val = data;\n"); break;
+ 	case sz_word: printf ("\tuae_u16 val = data;\n"); break;
+ 	case sz_long: printf ("\tuae_u32 val = data;\n"); break;
+ 	default: abort ();
+ 	}
+ 	printf ("\tuae_u32 carry = val & 1;\n");
+ 	printf ("\tval >>= 1;\n");
+ 	printf ("\tif (carry) val |= %s;\n", cmask (curi->size));
+ 	genflags (flag_logical, curi->size, "val", "", "");
+ 	printf ("SET_CFLG (carry);\n");
+ 	genastore ("val", curi->smode, "srcreg", curi->size, "data");
+ 	break;
+     case i_ROXLW:
+ 	genamode (curi->smode, "srcreg", curi->size, "data", 1, 0);
+ 	start_brace ();
+ 	switch (curi->size) {
+ 	case sz_byte: printf ("\tuae_u8 val = data;\n"); break;
+ 	case sz_word: printf ("\tuae_u16 val = data;\n"); break;
+ 	case sz_long: printf ("\tuae_u32 val = data;\n"); break;
+ 	default: abort ();
+ 	}
+ 	printf ("\tuae_u32 carry = val & %s;\n", cmask (curi->size));
+ 	printf ("\tval <<= 1;\n");
+ 	printf ("\tif (GET_XFLG) val |= 1;\n");
+ 	genflags (flag_logical, curi->size, "val", "", "");
+ 	printf ("SET_CFLG (carry >> %d);\n", bit_size (curi->size) - 1);
+ 	duplicate_carry ();
+ 	genastore ("val", curi->smode, "srcreg", curi->size, "data");
+ 	break;
+     case i_ROXRW:
+ 	genamode (curi->smode, "srcreg", curi->size, "data", 1, 0);
+ 	start_brace ();
+ 	switch (curi->size) {
+ 	case sz_byte: printf ("\tuae_u8 val = data;\n"); break;
+ 	case sz_word: printf ("\tuae_u16 val = data;\n"); break;
+ 	case sz_long: printf ("\tuae_u32 val = data;\n"); break;
+ 	default: abort ();
+ 	}
+ 	printf ("\tuae_u32 carry = val & 1;\n");
+ 	printf ("\tval >>= 1;\n");
+ 	printf ("\tif (GET_XFLG) val |= %s;\n", cmask (curi->size));
+ 	genflags (flag_logical, curi->size, "val", "", "");
+ 	printf ("SET_CFLG (carry);\n");
+ 	duplicate_carry ();
+ 	genastore ("val", curi->smode, "srcreg", curi->size, "data");
+ 	break;
+     case i_MOVEC2:
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
+ 	start_brace ();
+ 	printf ("\tint regno = (src >> 12) & 15;\n");
+ 	printf ("\tuae_u32 *regp = regs.regs + regno;\n");
+ 	printf ("\tif (! m68k_movec2(src & 0xFFF, regp)) goto %s;\n", endlabelstr);
+ 	break;
+     case i_MOVE2C:
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
+ 	start_brace ();
+ 	printf ("\tint regno = (src >> 12) & 15;\n");
+ 	printf ("\tuae_u32 *regp = regs.regs + regno;\n");
+ 	printf ("\tif (! m68k_move2c(src & 0xFFF, regp)) goto %s;\n", endlabelstr);
+ 	break;
+     case i_CAS:
+     {
+ 	int old_brace_level;
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
+ 	genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0);
+ 	start_brace ();
+ 	printf ("\tint ru = (src >> 6) & 7;\n");
+ 	printf ("\tint rc = src & 7;\n");
+ 	genflags (flag_cmp, curi->size, "newv", "m68k_dreg(regs, rc)", "dst");
+ 	printf ("\tif (GET_ZFLG)");
+ 	old_brace_level = n_braces;
+ 	start_brace ();
+ 	genastore ("(m68k_dreg(regs, ru))", curi->dmode, "dstreg", curi->size, "dst");
+ 	pop_braces (old_brace_level);
+ 	printf ("else");
+ 	start_brace ();
+ 	printf ("m68k_dreg(regs, rc) = dst;\n");
+ 	pop_braces (old_brace_level);
+     }
+     break;
+     case i_CAS2:
+ 	genamode (curi->smode, "srcreg", curi->size, "extra", 1, 0);
+ 	printf ("\tuae_u32 rn1 = regs.regs[(extra >> 28) & 15];\n");
+ 	printf ("\tuae_u32 rn2 = regs.regs[(extra >> 12) & 15];\n");
+ 	if (curi->size == sz_word) {
+ 	    int old_brace_level = n_braces;
+ 	    printf ("\tuae_u16 dst1 = get_word(rn1), dst2 = get_word(rn2);\n");
+ 	    genflags (flag_cmp, curi->size, "newv", "m68k_dreg(regs, (extra >> 16) & 7)", "dst1");
+ 	    printf ("\tif (GET_ZFLG) {\n");
+ 	    genflags (flag_cmp, curi->size, "newv", "m68k_dreg(regs, extra & 7)", "dst2");
+ 	    printf ("\tif (GET_ZFLG) {\n");
+ 	    printf ("\tput_word(rn1, m68k_dreg(regs, (extra >> 22) & 7));\n");
+ 	    printf ("\tput_word(rn1, m68k_dreg(regs, (extra >> 6) & 7));\n");
+ 	    printf ("\t}}\n");
+ 	    pop_braces (old_brace_level);
+ 	    printf ("\tif (! GET_ZFLG) {\n");
+ 	    printf ("\tm68k_dreg(regs, (extra >> 22) & 7) = (m68k_dreg(regs, (extra >> 22) & 7) & ~0xffff) | (dst1 & 0xffff);\n");
+ 	    printf ("\tm68k_dreg(regs, (extra >> 6) & 7) = (m68k_dreg(regs, (extra >> 6) & 7) & ~0xffff) | (dst2 & 0xffff);\n");
+ 	    printf ("\t}\n");
+ 	} else {
+ 	    int old_brace_level = n_braces;
+ 	    printf ("\tuae_u32 dst1 = get_long(rn1), dst2 = get_long(rn2);\n");
+ 	    genflags (flag_cmp, curi->size, "newv", "m68k_dreg(regs, (extra >> 16) & 7)", "dst1");
+ 	    printf ("\tif (GET_ZFLG) {\n");
+ 	    genflags (flag_cmp, curi->size, "newv", "m68k_dreg(regs, extra & 7)", "dst2");
+ 	    printf ("\tif (GET_ZFLG) {\n");
+ 	    printf ("\tput_long(rn1, m68k_dreg(regs, (extra >> 22) & 7));\n");
+ 	    printf ("\tput_long(rn1, m68k_dreg(regs, (extra >> 6) & 7));\n");
+ 	    printf ("\t}}\n");
+ 	    pop_braces (old_brace_level);
+ 	    printf ("\tif (! GET_ZFLG) {\n");
+ 	    printf ("\tm68k_dreg(regs, (extra >> 22) & 7) = dst1;\n");
+ 	    printf ("\tm68k_dreg(regs, (extra >> 6) & 7) = dst2;\n");
+ 	    printf ("\t}\n");
+ 	}
+ 	break;
+     case i_MOVES:		/* ignore DFC and SFC because we have no MMU */
+     {
+ 	int old_brace_level;
+ 	genamode (curi->smode, "srcreg", curi->size, "extra", 1, 0);
+ 	printf ("\tif (extra & 0x800)\n");
+ 	old_brace_level = n_braces;
+ 	start_brace ();
+ 	printf ("\tuae_u32 src = regs.regs[(extra >> 12) & 15];\n");
+ 	genamode (curi->dmode, "dstreg", curi->size, "dst", 2, 0);
+ 	genastore ("src", curi->dmode, "dstreg", curi->size, "dst");
+ 	pop_braces (old_brace_level);
+ 	printf ("else");
+ 	start_brace ();
+ 	genamode (curi->dmode, "dstreg", curi->size, "src", 1, 0);
+ 	printf ("\tif (extra & 0x8000) {\n");
+ 	switch (curi->size) {
+ 	case sz_byte: printf ("\tm68k_areg(regs, (extra >> 12) & 7) = (uae_s32)(uae_s8)src;\n"); break;
+ 	case sz_word: printf ("\tm68k_areg(regs, (extra >> 12) & 7) = (uae_s32)(uae_s16)src;\n"); break;
+ 	case sz_long: printf ("\tm68k_areg(regs, (extra >> 12) & 7) = src;\n"); break;
+ 	default: abort ();
+ 	}
+ 	printf ("\t} else {\n");
+ 	genastore ("src", Dreg, "(extra >> 12) & 7", curi->size, "");
+ 	printf ("\t}\n");
+ 	pop_braces (old_brace_level);
+     }
+     break;
+     case i_BKPT:		/* only needed for hardware emulators */
+ 	sync_m68k_pc ();
+ 	printf ("\top_illg(opcode);\n");
+ 	break;
+     case i_CALLM:		/* not present in 68030 */
+ 	sync_m68k_pc ();
+ 	printf ("\top_illg(opcode);\n");
+ 	break;
+     case i_RTM:		/* not present in 68030 */
+ 	sync_m68k_pc ();
+ 	printf ("\top_illg(opcode);\n");
+ 	break;
+     case i_TRAPcc:
+ 	if (curi->smode != am_unknown && curi->smode != am_illg)
+ 	    genamode (curi->smode, "srcreg", curi->size, "dummy", 1, 0);
+ 	printf ("\tif (cctrue(%d)) { Exception(7,m68k_getpc()); goto %s; }\n", curi->cc, endlabelstr);
+ 	need_endlabel = 1;
+ 	break;
+     case i_DIVL:
+ 	sync_m68k_pc ();
+ 	start_brace ();
+ 	printf ("\tuaecptr oldpc = m68k_getpc();\n");
+ 	genamode (curi->smode, "srcreg", curi->size, "extra", 1, 0);
+ 	genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0);
+ 	sync_m68k_pc ();
+ 	printf ("\tm68k_divl(opcode, dst, extra, oldpc);\n");
+ 	break;
+     case i_MULL:
+ 	genamode (curi->smode, "srcreg", curi->size, "extra", 1, 0);
+ 	genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0);
+ 	sync_m68k_pc ();
+ 	printf ("\tm68k_mull(opcode, dst, extra);\n");
+ 	break;
+     case i_BFTST:
+     case i_BFEXTU:
+     case i_BFCHG:
+     case i_BFEXTS:
+     case i_BFCLR:
+     case i_BFFFO:
+     case i_BFSET:
+     case i_BFINS:
+ 	genamode (curi->smode, "srcreg", curi->size, "extra", 1, 0);
+ 	genamode (curi->dmode, "dstreg", sz_long, "dst", 2, 0);
+ 	start_brace ();
+ 	printf ("\tuae_s32 offset = extra & 0x800 ? m68k_dreg(regs, (extra >> 6) & 7) : (extra >> 6) & 0x1f;\n");
+ 	printf ("\tint width = (((extra & 0x20 ? m68k_dreg(regs, extra & 7) : extra) -1) & 0x1f) +1;\n");
+ 	if (curi->dmode == Dreg) {
+ 	    printf ("\tuae_u32 tmp = m68k_dreg(regs, dstreg) << (offset & 0x1f);\n");
+ 	} else {
+ 	    printf ("\tuae_u32 tmp,bf0,bf1;\n");
+ 	    printf ("\tdsta += (offset >> 3) | (offset & 0x80000000 ? ~0x1fffffff : 0);\n");
+ 	    printf ("\tbf0 = get_long(dsta);bf1 = get_byte(dsta+4) & 0xff;\n");
+ 	    printf ("\ttmp = (bf0 << (offset & 7)) | (bf1 >> (8 - (offset & 7)));\n");
+ 	}
+ 	printf ("\ttmp >>= (32 - width);\n");
+ 	printf ("\tSET_NFLG (tmp & (1 << (width-1)) ? 1 : 0);\n");
+ 	printf ("\tSET_ZFLG (tmp == 0); SET_VFLG (0); SET_CFLG (0);\n");
+ 	switch (curi->mnemo) {
+ 	case i_BFTST:
+ 	    break;
+ 	case i_BFEXTU:
+ 	    printf ("\tm68k_dreg(regs, (extra >> 12) & 7) = tmp;\n");
+ 	    break;
+ 	case i_BFCHG:
+ 	    printf ("\ttmp = ~tmp;\n");
+ 	    break;
+ 	case i_BFEXTS:
+ 	    printf ("\tif (GET_NFLG) tmp |= width == 32 ? 0 : (-1 << width);\n");
+ 	    printf ("\tm68k_dreg(regs, (extra >> 12) & 7) = tmp;\n");
+ 	    break;
+ 	case i_BFCLR:
+ 	    printf ("\ttmp = 0;\n");
+ 	    break;
+ 	case i_BFFFO:
+ 	    printf ("\t{ uae_u32 mask = 1 << (width-1);\n");
+ 	    printf ("\twhile (mask) { if (tmp & mask) break; mask >>= 1; offset++; }}\n");
+ 	    printf ("\tm68k_dreg(regs, (extra >> 12) & 7) = offset;\n");
+ 	    break;
+ 	case i_BFSET:
+ 	    printf ("\ttmp = 0xffffffff;\n");
+ 	    break;
+ 	case i_BFINS:
+ 	    printf ("\ttmp = m68k_dreg(regs, (extra >> 12) & 7);\n");
+ 	    break;
+ 	default:
+ 	    break;
+ 	}
+ 	if (curi->mnemo == i_BFCHG
+ 	    || curi->mnemo == i_BFCLR
+ 	    || curi->mnemo == i_BFSET
+ 	    || curi->mnemo == i_BFINS)
+ 	    {
+ 		printf ("\ttmp <<= (32 - width);\n");
+ 		if (curi->dmode == Dreg) {
+ 		    printf ("\tm68k_dreg(regs, dstreg) = (m68k_dreg(regs, dstreg) & ((offset & 0x1f) == 0 ? 0 :\n");
+ 		    printf ("\t\t(0xffffffff << (32 - (offset & 0x1f))))) |\n");
+ 		    printf ("\t\t(tmp >> (offset & 0x1f)) |\n");
+ 		    printf ("\t\t(((offset & 0x1f) + width) >= 32 ? 0 :\n");
+ 		    printf (" (m68k_dreg(regs, dstreg) & ((uae_u32)0xffffffff >> ((offset & 0x1f) + width))));\n");
+ 		} else {
+ 		    printf ("\tbf0 = (bf0 & (0xff000000 << (8 - (offset & 7)))) |\n");
+ 		    printf ("\t\t(tmp >> (offset & 7)) |\n");
+ 		    printf ("\t\t(((offset & 7) + width) >= 32 ? 0 :\n");
+ 		    printf ("\t\t (bf0 & ((uae_u32)0xffffffff >> ((offset & 7) + width))));\n");
+ 		    printf ("\tput_long(dsta,bf0 );\n");
+ 		    printf ("\tif (((offset & 7) + width) > 32) {\n");
+ 		    printf ("\t\tbf1 = (bf1 & (0xff >> (width - 32 + (offset & 7)))) |\n");
+ 		    printf ("\t\t\t(tmp << (8 - (offset & 7)));\n");
+ 		    printf ("\t\tput_byte(dsta+4,bf1);\n");
+ 		    printf ("\t}\n");
+ 		}
+ 	    }
+ 	break;
+     case i_PACK:
+ 	if (curi->smode == Dreg) {
+ 	    printf ("\tuae_u16 val = m68k_dreg(regs, srcreg) + %s;\n", gen_nextiword ());
+ 	    printf ("\tm68k_dreg(regs, dstreg) = (m68k_dreg(regs, dstreg) & 0xffffff00) | ((val >> 4) & 0xf0) | (val & 0xf);\n");
+ 	} else {
+ 	    printf ("\tuae_u16 val;\n");
+ 	    printf ("\tm68k_areg(regs, srcreg) -= areg_byteinc[srcreg];\n");
+ 	    printf ("\tval = (uae_u16)get_byte(m68k_areg(regs, srcreg));\n");
+ 	    printf ("\tm68k_areg(regs, srcreg) -= areg_byteinc[srcreg];\n");
+ 	    printf ("\tval = (val | ((uae_u16)get_byte(m68k_areg(regs, srcreg)) << 8)) + %s;\n", gen_nextiword ());
+ 	    printf ("\tm68k_areg(regs, dstreg) -= areg_byteinc[dstreg];\n");
+ 	    printf ("\tput_byte(m68k_areg(regs, dstreg),((val >> 4) & 0xf0) | (val & 0xf));\n");
+ 	}
+ 	break;
+     case i_UNPK:
+ 	if (curi->smode == Dreg) {
+ 	    printf ("\tuae_u16 val = m68k_dreg(regs, srcreg);\n");
+ 	    printf ("\tval = (((val << 4) & 0xf00) | (val & 0xf)) + %s;\n", gen_nextiword ());
+ 	    printf ("\tm68k_dreg(regs, dstreg) = (m68k_dreg(regs, dstreg) & 0xffff0000) | (val & 0xffff);\n");
+ 	} else {
+ 	    printf ("\tuae_u16 val;\n");
+ 	    printf ("\tm68k_areg(regs, srcreg) -= areg_byteinc[srcreg];\n");
+ 	    printf ("\tval = (uae_u16)get_byte(m68k_areg(regs, srcreg));\n");
+ 	    printf ("\tval = (((val << 4) & 0xf00) | (val & 0xf)) + %s;\n", gen_nextiword ());
+ 	    printf ("\tm68k_areg(regs, dstreg) -= areg_byteinc[dstreg];\n");
+ 	    printf ("\tput_byte(m68k_areg(regs, dstreg),val);\n");
+ 	    printf ("\tm68k_areg(regs, dstreg) -= areg_byteinc[dstreg];\n");
+ 	    printf ("\tput_byte(m68k_areg(regs, dstreg),val >> 8);\n");
+ 	}
+ 	break;
+     case i_TAS:
+ 	genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
+ 	genflags (flag_logical, curi->size, "src", "", "");
+ 	printf ("\tsrc |= 0x80;\n");
+ 	genastore ("src", curi->smode, "srcreg", curi->size, "src");
+ 	break;
+     case i_FPP:
+ 	genamode (curi->smode, "srcreg", curi->size, "extra", 1, 0);
+ 	sync_m68k_pc ();
+ 	printf ("\tfpp_opp(opcode,extra);\n");
+ 	break;
+     case i_FDBcc:
+ 	genamode (curi->smode, "srcreg", curi->size, "extra", 1, 0);
+ 	sync_m68k_pc ();
+ 	printf ("\tfdbcc_opp(opcode,extra);\n");
+ 	break;
+     case i_FScc:
+ 	genamode (curi->smode, "srcreg", curi->size, "extra", 1, 0);
+ 	sync_m68k_pc ();
+ 	printf ("\tfscc_opp(opcode,extra);\n");
+ 	break;
+     case i_FTRAPcc:
+ 	sync_m68k_pc ();
+ 	start_brace ();
+ 	printf ("\tuaecptr oldpc = m68k_getpc();\n");
+ 	if (curi->smode != am_unknown && curi->smode != am_illg)
+ 	    genamode (curi->smode, "srcreg", curi->size, "dummy", 1, 0);
+ 	sync_m68k_pc ();
+ 	printf ("\tftrapcc_opp(opcode,oldpc);\n");
+ 	break;
+     case i_FBcc:
+ 	sync_m68k_pc ();
+ 	start_brace ();
+ 	printf ("\tuaecptr pc = m68k_getpc();\n");
+ 	genamode (curi->dmode, "srcreg", curi->size, "extra", 1, 0);
+ 	sync_m68k_pc ();
+ 	printf ("\tfbcc_opp(opcode,pc,extra);\n");
+ 	break;
+     case i_FSAVE:
+ 	sync_m68k_pc ();
+ 	printf ("\tfsave_opp(opcode);\n");
+ 	break;
+     case i_FRESTORE:
+ 	sync_m68k_pc ();
+ 	printf ("\tfrestore_opp(opcode);\n");
+ 	break;
+ 
+      case i_CINVL:
+      case i_CINVP:
+      case i_CINVA:
+      case i_CPUSHL:
+      case i_CPUSHP:
+      case i_CPUSHA:
+ 	break;
+      case i_MOVE16:
+ 	printf ("\tuaecptr mems = m68k_areg(regs, srcreg) & ~15, memd;\n");
+ 	printf ("\tdstreg = (%s >> 12) & 7;\n", gen_nextiword());
+ 	printf ("\tmemd = m68k_areg(regs, dstreg) & ~15;\n");
+ 	printf ("\tput_long(memd, get_long(mems));\n");
+ 	printf ("\tput_long(memd+4, get_long(mems+4));\n");
+ 	printf ("\tput_long(memd+8, get_long(mems+8));\n");
+ 	printf ("\tput_long(memd+12, get_long(mems+12));\n");
+ 	printf ("\tm68k_areg(regs, srcreg) += 16;\n");
+ 	printf ("\tm68k_areg(regs, dstreg) += 16;\n");
+ 	break;
+ 
+     case i_MMUOP:
+ 	genamode (curi->smode, "srcreg", curi->size, "extra", 1, 0);
+ 	sync_m68k_pc ();
+ 	printf ("\tmmu_op(opcode,extra);\n");
+ 	break;
+     default:
+ 	abort ();
+ 	break;
+     }
+     finish_braces ();
+     sync_m68k_pc ();
+ }
+ 
+ static void generate_includes (FILE * f)
+ {
+     fprintf (f, "#include \"sysconfig.h\"\n");
+     fprintf (f, "#include \"sysdeps.h\"\n");
+     fprintf (f, "#include \"config.h\"\n");
+     fprintf (f, "#include \"options.h\"\n");
+     fprintf (f, "#include \"memory.h\"\n");
+     fprintf (f, "#include \"custom.h\"\n");
+     fprintf (f, "#include \"newcpu.h\"\n");
+     fprintf (f, "#include \"compiler.h\"\n");
+     fprintf (f, "#include \"cputbl.h\"\n");
+     
+     fprintf (f, "#define CPUFUNC(x) x##_ff\n"
+ 	     "#ifdef NOFLAGS\n"
+ 	     "#include \"noflags.h\"\n"
+ 	     "#endif\n");
+ }
+ 
+ static int postfix;
+ 
+ static void generate_one_opcode (int rp)
+ {
+     int i;
+     uae_u16 smsk, dmsk;
+     long int opcode = opcode_map[rp];
+ 
+     if (table68k[opcode].mnemo == i_ILLG
+ 	|| table68k[opcode].clev > cpu_level)
+ 	return;
+ 
+     for (i = 0; lookuptab[i].name[0]; i++) {
+ 	if (table68k[opcode].mnemo == lookuptab[i].mnemo)
+ 	    break;
+     }
+ 
+     if (table68k[opcode].handler != -1)
+ 	return;
+ 
+     if (opcode_next_clev[rp] != cpu_level) {
+ 	fprintf (stblfile, "{ CPUFUNC(op_%lx_%d), 0, %ld }, /* %s */\n", opcode, opcode_last_postfix[rp],
+ 		 opcode, lookuptab[i].name);
+ 	return;
+     }
+     fprintf (stblfile, "{ CPUFUNC(op_%lx_%d), 0, %ld }, /* %s */\n", opcode, postfix, opcode, lookuptab[i].name);
+     fprintf (headerfile, "extern cpuop_func op_%lx_%d_nf;\n", opcode, postfix);
+     fprintf (headerfile, "extern cpuop_func op_%lx_%d_ff;\n", opcode, postfix);
+     printf ("unsigned long REGPARAM2 CPUFUNC(op_%lx_%d)(uae_u32 opcode) /* %s */\n{\n", opcode, postfix, lookuptab[i].name);
+ 
+     switch (table68k[opcode].stype) {
+      case 0: smsk = 7; break;
+      case 1: smsk = 255; break;
+      case 2: smsk = 15; break;
+      case 3: smsk = 7; break;
+      case 4: smsk = 7; break;
+      case 5: smsk = 63; break;
+      default: abort ();
+     }
+     dmsk = 7;
+ 
+     next_cpu_level = -1;
+     if (table68k[opcode].suse
+ 	&& table68k[opcode].smode != imm && table68k[opcode].smode != imm0
+ 	&& table68k[opcode].smode != imm1 && table68k[opcode].smode != imm2
+ 	&& table68k[opcode].smode != absw && table68k[opcode].smode != absl
+ 	&& table68k[opcode].smode != PC8r && table68k[opcode].smode != PC16)
+     {
+ 	if (table68k[opcode].spos == -1) {
+ 	    if (((int) table68k[opcode].sreg) >= 128)
+ 		printf ("\tuae_u32 srcreg = (uae_s32)(uae_s8)%d;\n", (int) table68k[opcode].sreg);
+ 	    else
+ 		printf ("\tuae_u32 srcreg = %d;\n", (int) table68k[opcode].sreg);
+ 	} else {
+ 	    char source[100];
+ 	    int pos = table68k[opcode].spos;
+ 
+ 	    if (pos)
+ 		sprintf (source, "((opcode >> %d) & %d)", pos, smsk);
+ 	    else
+ 		sprintf (source, "(opcode & %d)", smsk);
+ 
+ 	    if (table68k[opcode].stype == 3)
+ 		printf ("\tuae_u32 srcreg = imm8_table[%s];\n", source);
+ 	    else if (table68k[opcode].stype == 1)
+ 		printf ("\tuae_u32 srcreg = (uae_s32)(uae_s8)%s;\n", source);
+ 	    else
+ 		printf ("\tuae_u32 srcreg = %s;\n", source);
+ 	}
+     }
+     if (table68k[opcode].duse
+ 	/* Yes, the dmode can be imm, in case of LINK or DBcc */
+ 	&& table68k[opcode].dmode != imm && table68k[opcode].dmode != imm0
+ 	&& table68k[opcode].dmode != imm1 && table68k[opcode].dmode != imm2
+ 	&& table68k[opcode].dmode != absw && table68k[opcode].dmode != absl)
+     {
+ 	if (table68k[opcode].dpos == -1) {
+ 	    if (((int) table68k[opcode].dreg) >= 128)
+ 		printf ("\tuae_u32 dstreg = (uae_s32)(uae_s8)%d;\n", (int) table68k[opcode].dreg);
+ 	    else
+ 		printf ("\tuae_u32 dstreg = %d;\n", (int) table68k[opcode].dreg);
+ 	} else {
+ 	    int pos = table68k[opcode].dpos;
+ #if 0
+ 	    /* Check that we can do the little endian optimization safely.  */
+ 	    if (pos < 8 && (dmsk >> (8 - pos)) != 0)
+ 		abort ();
+ #endif	    
+ 	    if (pos)
+ 		printf ("\tuae_u32 dstreg = (opcode >> %d) & %d;\n",
+ 			pos, dmsk);
+ 	    else
+ 		printf ("\tuae_u32 dstreg = opcode & %d;\n", dmsk);
+ 	}
+     }
+     need_endlabel = 0;
+     endlabelno++;
+     sprintf (endlabelstr, "endlabel%d", endlabelno);
+     gen_opcode (opcode);
+     if (need_endlabel)
+ 	printf ("%s: ;\n", endlabelstr);
+     printf ("return %d;\n", insn_n_cycles / 2);
+     printf ("}\n");
+     opcode_next_clev[rp] = next_cpu_level;
+     opcode_last_postfix[rp] = postfix;
+ }
+ 
+ static void generate_func (void)
+ {
+     int i, j, rp;
+ 
+     using_prefetch = 0;
+     using_exception_3 = 0;
+     for (i = 0; i < 6; i++) {
+ 	cpu_level = 4 - i;
+ 	if (i == 5) {
+ 	    cpu_level = 0;
+ 	    using_prefetch = 1;
+ 	    using_exception_3 = 1;
+ 	    for (rp = 0; rp < nr_cpuop_funcs; rp++)
+ 		opcode_next_clev[rp] = 0;
+ 	}
+ 
+ 	postfix = i;
+ 	fprintf (stblfile, "struct cputbl CPUFUNC(op_smalltbl_%d)[] = {\n", postfix);
+ 
+ 	/* sam: this is for people with low memory (eg. me :)) */
+ 	printf ("\n"
+                 "#if !defined(PART_1) && !defined(PART_2) && "
+ 	 	    "!defined(PART_3) && !defined(PART_4) && "
+ 		    "!defined(PART_5) && !defined(PART_6) && "
+ 		    "!defined(PART_7) && !defined(PART_8)"
+ 		"\n"
+ 	        "#define PART_1 1\n"
+ 	        "#define PART_2 1\n"
+ 	        "#define PART_3 1\n"
+ 	        "#define PART_4 1\n"
+ 	        "#define PART_5 1\n"
+ 	        "#define PART_6 1\n"
+ 	        "#define PART_7 1\n"
+ 	        "#define PART_8 1\n"
+ 	        "#endif\n\n");
+ 	
+ 	rp = 0;
+ 	for(j=1;j<=8;++j) {
+ 		int k = (j*nr_cpuop_funcs)/8;
+ 		printf ("#ifdef PART_%d\n",j);
+ 		for (; rp < k; rp++)
+ 		   generate_one_opcode (rp);
+ 		printf ("#endif\n\n");
+ 	}
+ 
+ 	fprintf (stblfile, "{ 0, 0, 0 }};\n");
+     }
+ 
+ }
+ 
+ int main (int argc, char **argv)
+ {
+     read_table68k ();
+     do_merges ();
+ 
+     opcode_map = (int *) xmalloc (sizeof (int) * nr_cpuop_funcs);
+     opcode_last_postfix = (int *) xmalloc (sizeof (int) * nr_cpuop_funcs);
+     opcode_next_clev = (int *) xmalloc (sizeof (int) * nr_cpuop_funcs);
+     counts = (unsigned long *) xmalloc (65536 * sizeof (unsigned long));
+     read_counts ();
+ 
+     /* It would be a lot nicer to put all in one file (we'd also get rid of
+      * cputbl.h that way), but cpuopti can't cope.  That could be fixed, but
+      * I don't dare to touch the 68k version.  */
+ 
+     headerfile = fopen ("cputbl.h", "wb");
+     stblfile = fopen ("cpustbl.c", "wb");
+     freopen ("cpuemu.c", "wb", stdout);
+ 
+     generate_includes (stdout);
+     generate_includes (stblfile);
+ 
+     generate_func ();
+ 
+     free (table68k);
+     return 0;
+ }
diff -Nrc3p /dunes/wcohen/virg-netgdb/src/sim/m68k/include/autoconf.h src/sim/m68k/include/autoconf.h
*** /dunes/wcohen/virg-netgdb/src/sim/m68k/include/autoconf.h	Wed Dec 31 19:00:00 1969
--- src/sim/m68k/include/autoconf.h	Mon Feb 19 14:10:25 2001
***************
*** 0 ****
--- 1,88 ----
+  /*
+   * UAE - The Un*x Amiga Emulator
+   *
+   * Autoconfig device support
+   *
+   * (c) 1996 Ed Hanway
+   */
+ 
+ typedef uae_u32 (*TrapFunction) (void);
+ 
+ extern int lasttrap;
+ extern void do_emultrap (int nr);
+ 
+ extern uae_u32 addr (int);
+ extern void db (uae_u8);
+ extern void dw (uae_u16);
+ extern void dl (uae_u32);
+ extern uae_u32 ds (char *);
+ extern void calltrap (uae_u32);
+ extern void org (uae_u32);
+ extern uae_u32 here (void);
+ extern int deftrap2 (TrapFunction func, int mode, const char *str);
+ extern int deftrap (TrapFunction);
+ extern void align (int);
+ extern uae_u32 CallLib (uaecptr base, uae_s16 offset);
+ extern void call_calltrap (int nr) REGPARAM;
+ 
+ extern volatile int uae_int_requested;
+ extern void set_uae_int_flag (void);
+ 
+ #define RTS 0x4e75
+ #define RTE 0x4e73
+ 
+ extern uaecptr EXPANSION_explibname, EXPANSION_doslibname, EXPANSION_uaeversion;
+ extern uaecptr EXPANSION_explibbase, EXPANSION_uaedevname, EXPANSION_haveV36;
+ extern uaecptr EXPANSION_bootcode, EXPANSION_nullfunc;
+ 
+ extern uaecptr ROM_filesys_resname, ROM_filesys_resid;
+ extern uaecptr ROM_filesys_diagentry;
+ extern uaecptr ROM_hardfile_resname, ROM_hardfile_resid;
+ extern uaecptr ROM_hardfile_init;
+ extern uaecptr filesys_initcode;
+ 
+ extern int nr_units (struct uaedev_mount_info *mountinfo);
+ extern int is_hardfile (struct uaedev_mount_info *mountinfo, int unit_no);
+ extern char *set_filesys_unit (struct uaedev_mount_info *mountinfo, int,
+ 			       char *volname, char *rootdir, int readonly,
+ 			       int secs, int surfaces, int reserved,
+ 			       int blocksize);
+ extern char *add_filesys_unit (struct uaedev_mount_info *mountinfo,
+ 			       char *volname, char *rootdir, int readonly,
+ 			       int secs, int surfaces, int reserved,
+ 			       int blocksize);
+ extern char *get_filesys_unit (struct uaedev_mount_info *mountinfo, int nr,
+ 			       char **volname, char **rootdir, int *readonly,
+ 			       int *secspertrack, int *surfaces, int *reserved,
+ 			       int *cylinders, int *size, int *blocksize);
+ extern int kill_filesys_unit (struct uaedev_mount_info *mountinfo, int);
+ extern int move_filesys_unit (struct uaedev_mount_info *mountinfo, int nr, int to);
+ extern int sprintf_filesys_unit (struct uaedev_mount_info *mountinfo, char *buffer, int num);
+ extern void write_filesys_config (struct uaedev_mount_info *mountinfo, const char *unexpanded,
+ 				  const char *defaultpath, FILE *f);
+ 
+ extern struct uaedev_mount_info *alloc_mountinfo (void);
+ extern struct uaedev_mount_info *dup_mountinfo (struct uaedev_mount_info *);
+ extern void free_mountinfo (struct uaedev_mount_info *);
+ 
+ extern void filesys_reset (void);
+ extern void filesys_prepare_reset (void);
+ extern void filesys_start_threads (void);
+ 
+ extern void reset_uaedevices (void);
+ extern int get_new_device (char **devname, uaecptr *devname_amiga);
+ 
+ extern void filesys_install (void);
+ extern void filesys_install_code (void);
+ extern void filesys_store_devinfo (uae_u8 *);
+ extern void hardfile_install (void);
+ extern void emulib_install (void);
+ extern void expansion_init (void);
+ 
+ #define TRAPFLAG_NO_REGSAVE 1
+ #define TRAPFLAG_NO_RETVAL 2
+ #define TRAPFLAG_EXTRA_STACK 4
+ #define TRAPFLAG_DORET 8
+ 
+ extern uaecptr libemu_InstallFunction (TrapFunction, uaecptr, int, const char *);
+ extern uaecptr libemu_InstallFunctionFlags (TrapFunction, uaecptr, int, int, const char *);
diff -Nrc3p /dunes/wcohen/virg-netgdb/src/sim/m68k/include/debug.h src/sim/m68k/include/debug.h
*** /dunes/wcohen/virg-netgdb/src/sim/m68k/include/debug.h	Wed Dec 31 19:00:00 1969
--- src/sim/m68k/include/debug.h	Mon Feb 19 14:10:25 2001
***************
*** 0 ****
--- 1,23 ----
+  /*
+   * UAE - The Un*x Amiga Emulator
+   *
+   * Debugger
+   *
+   * (c) 1995 Bernd Schmidt
+   *
+   */
+ 
+ #define	MAX_HIST	10000
+ 
+ extern int firsthist;
+ extern int lasthist;
+ extern int debugging;
+ #ifdef NEED_TO_DEBUG_BADLY
+ extern struct regstruct history[MAX_HIST];
+ extern union flagu historyf[MAX_HIST];
+ #else
+ extern uaecptr history[MAX_HIST];
+ #endif
+ 
+ extern void debug(void);
+ extern void activate_debugger(void);
diff -Nrc3p /dunes/wcohen/virg-netgdb/src/sim/m68k/include/ersatz.h src/sim/m68k/include/ersatz.h
*** /dunes/wcohen/virg-netgdb/src/sim/m68k/include/ersatz.h	Wed Dec 31 19:00:00 1969
--- src/sim/m68k/include/ersatz.h	Mon Feb 19 14:10:25 2001
***************
*** 0 ****
--- 1,11 ----
+  /*
+   * UAE - The Un*x Amiga Emulator
+   *
+   * A "replacement" for a missing Kickstart
+   *
+   * (c) 1995 Bernd Schmidt
+   */
+ 
+ extern void init_ersatz_rom (uae_u8 *data);
+ extern void ersatz_perform (uae_u16);
+ extern void DISK_ersatz_read (int,int, uaecptr);
diff -Nrc3p /dunes/wcohen/virg-netgdb/src/sim/m68k/include/memory.h src/sim/m68k/include/memory.h
*** /dunes/wcohen/virg-netgdb/src/sim/m68k/include/memory.h	Wed Dec 31 19:00:00 1969
--- src/sim/m68k/include/memory.h	Mon Feb 19 14:10:25 2001
***************
*** 0 ****
--- 1,189 ----
+  /*
+   * UAE - The Un*x Amiga Emulator
+   *
+   * memory management
+   *
+   * Copyright 1995 Bernd Schmidt
+   */
+ 
+ /* Enabling this adds one additional native memory reference per 68k memory
+  * access, but saves one shift (on the x86). Enabling this is probably
+  * better for the cache. My favourite benchmark (PP2) doesn't show a
+  * difference, so I leave this enabled. */
+ 
+ #if 1 || defined SAVE_MEMORY
+ #define SAVE_MEMORY_BANKS
+ #endif
+ 
+ extern int special_mem;
+ #define S_READ 1
+ #define S_WRITE 2
+ 
+ typedef uae_u32 (*mem_get_func)(uaecptr) REGPARAM;
+ typedef void (*mem_put_func)(uaecptr, uae_u32) REGPARAM;
+ typedef uae_u8 *(*xlate_func)(uaecptr) REGPARAM;
+ typedef int (*check_func)(uaecptr, uae_u32) REGPARAM;
+ 
+ extern char *address_space, *good_address_map;
+ extern uae_u8 *chipmemory;
+ 
+ extern uae_u32 allocated_chipmem;
+ extern uae_u32 allocated_fastmem;
+ extern uae_u32 allocated_bogomem;
+ extern uae_u32 allocated_gfxmem;
+ extern uae_u32 allocated_z3fastmem;
+ extern uae_u32 allocated_a3000mem;
+ 
+ #undef DIRECT_MEMFUNCS_SUCCESSFUL
+ #include "machdep/maccess.h"
+ 
+ #ifndef CAN_MAP_MEMORY
+ #undef USE_COMPILER
+ #endif
+ 
+ #if defined(USE_COMPILER) && !defined(USE_MAPPED_MEMORY)
+ #define USE_MAPPED_MEMORY
+ #endif
+ 
+ #define kickmem_size 0x080000
+ 
+ #define chipmem_start 0x00000000
+ #define bogomem_start 0x00C00000
+ #define a3000mem_start 0x07000000
+ #define kickmem_start 0x00F80000
+ 
+ extern int ersatzkickfile;
+ 
+ typedef struct {
+     /* These ones should be self-explanatory... */
+     mem_get_func lget, wget, bget;
+     mem_put_func lput, wput, bput;
+     /* Use xlateaddr to translate an Amiga address to a uae_u8 * that can
+      * be used to address memory without calling the wget/wput functions.
+      * This doesn't work for all memory banks, so this function may call
+      * abort(). */
+     xlate_func xlateaddr;
+     /* To prevent calls to abort(), use check before calling xlateaddr.
+      * It checks not only that the memory bank can do xlateaddr, but also
+      * that the pointer points to an area of at least the specified size.
+      * This is used for example to translate bitplane pointers in custom.c */
+     check_func check;
+ } addrbank;
+ 
+ extern uae_u8 filesysory[65536];
+ 
+ extern addrbank chipmem_bank;
+ extern addrbank kickmem_bank;
+ extern addrbank custom_bank;
+ extern addrbank clock_bank;
+ extern addrbank cia_bank;
+ extern addrbank rtarea_bank;
+ extern addrbank expamem_bank;
+ extern addrbank fastmem_bank;
+ extern addrbank gfxmem_bank;
+ 
+ extern void rtarea_init (void);
+ extern void rtarea_setup (void);
+ extern void expamem_init (void);
+ extern void expamem_reset (void);
+ 
+ extern uae_u32 gfxmem_start;
+ extern uae_u8 *gfxmemory;
+ extern uae_u32 gfxmem_mask;
+ extern int address_space_24;
+ 
+ /* Default memory access functions */
+ 
+ extern int default_check(uaecptr addr, uae_u32 size) REGPARAM;
+ extern uae_u8 *default_xlate(uaecptr addr) REGPARAM;
+ 
+ #define bankindex(addr) (((uaecptr)(addr)) >> 16)
+ 
+ #ifdef SAVE_MEMORY_BANKS
+ extern addrbank *mem_banks[65536];
+ #define get_mem_bank(addr) (*mem_banks[bankindex(addr)])
+ #define put_mem_bank(addr, b) (mem_banks[bankindex(addr)] = (b))
+ #else
+ extern addrbank mem_banks[65536];
+ #define get_mem_bank(addr) (mem_banks[bankindex(addr)])
+ #define put_mem_bank(addr, b) (mem_banks[bankindex(addr)] = *(b))
+ #endif
+ 
+ extern void memory_init(void);
+ extern void map_banks(addrbank *bank, int first, int count);
+ 
+ #ifndef NO_INLINE_MEMORY_ACCESS
+ 
+ #define longget(addr) (call_mem_get_func(get_mem_bank(addr).lget, addr))
+ #define wordget(addr) (call_mem_get_func(get_mem_bank(addr).wget, addr))
+ #define byteget(addr) (call_mem_get_func(get_mem_bank(addr).bget, addr))
+ #define longput(addr,l) (call_mem_put_func(get_mem_bank(addr).lput, addr, l))
+ #define wordput(addr,w) (call_mem_put_func(get_mem_bank(addr).wput, addr, w))
+ #define byteput(addr,b) (call_mem_put_func(get_mem_bank(addr).bput, addr, b))
+ 
+ #else
+ 
+ extern uae_u32 alongget(uaecptr addr);
+ extern uae_u32 awordget(uaecptr addr);
+ extern uae_u32 longget(uaecptr addr);
+ extern uae_u32 wordget(uaecptr addr);
+ extern uae_u32 byteget(uaecptr addr);
+ extern void longput(uaecptr addr, uae_u32 l);
+ extern void wordput(uaecptr addr, uae_u32 w);
+ extern void byteput(uaecptr addr, uae_u32 b);
+ 
+ #endif
+ 
+ #ifndef MD_HAVE_MEM_1_FUNCS
+ 
+ #define longget_1 longget
+ #define wordget_1 wordget
+ #define byteget_1 byteget
+ #define longput_1 longput
+ #define wordput_1 wordput
+ #define byteput_1 byteput
+ 
+ #endif
+ 
+ STATIC_INLINE uae_u32 get_long(uaecptr addr)
+ {
+     return longget_1(addr);
+ }
+ STATIC_INLINE uae_u32 get_word(uaecptr addr)
+ {
+     return wordget_1(addr);
+ }
+ STATIC_INLINE uae_u32 get_byte(uaecptr addr)
+ {
+     return byteget_1(addr);
+ }
+ STATIC_INLINE void put_long(uaecptr addr, uae_u32 l)
+ {
+     longput_1(addr, l);
+ }
+ STATIC_INLINE void put_word(uaecptr addr, uae_u32 w)
+ {
+     wordput_1(addr, w);
+ }
+ STATIC_INLINE void put_byte(uaecptr addr, uae_u32 b)
+ {
+     byteput_1(addr, b);
+ }
+ 
+ STATIC_INLINE uae_u8 *get_real_address(uaecptr addr)
+ {
+     return get_mem_bank(addr).xlateaddr(addr);
+ }
+ 
+ STATIC_INLINE int valid_address(uaecptr addr, uae_u32 size)
+ {
+     return get_mem_bank(addr).check(addr, size);
+ }
+ 
+ /* For faster access in custom chip emulation.  */
+ extern uae_u32 chipmem_lget (uaecptr) REGPARAM;
+ extern uae_u32 chipmem_wget (uaecptr) REGPARAM;
+ extern uae_u32 chipmem_bget (uaecptr) REGPARAM;
+ extern void chipmem_lput (uaecptr, uae_u32) REGPARAM;
+ extern void chipmem_wput (uaecptr, uae_u32) REGPARAM;
+ extern void chipmem_bput (uaecptr, uae_u32) REGPARAM;
diff -Nrc3p /dunes/wcohen/virg-netgdb/src/sim/m68k/include/options.h src/sim/m68k/include/options.h
*** /dunes/wcohen/virg-netgdb/src/sim/m68k/include/options.h	Wed Dec 31 19:00:00 1969
--- src/sim/m68k/include/options.h	Mon Feb 19 14:10:25 2001
***************
*** 0 ****
--- 1,271 ----
+  /*
+   * UAE - The Un*x Amiga Emulator
+   *
+   * Stuff
+   *
+   * Copyright 1995, 1996 Ed Hanway
+   * Copyright 1995-98 Bernd Schmidt
+   */
+ 
+ #define UAEMAJOR 0
+ #define UAEMINOR 8
+ #define UAESUBREV 15
+ 
+ typedef enum { KBD_LANG_US, KBD_LANG_DE, KBD_LANG_SE, KBD_LANG_FR, KBD_LANG_IT, KBD_LANG_ES } KbdLang;
+ 
+ extern long int version;
+ 
+ struct uaedev_mount_info;
+ 
+ struct strlist {
+     struct strlist *next;
+     char *str;
+ };
+ 
+ struct uae_prefs {
+     struct strlist *unknown_lines;
+ 
+     char description[256];
+ 
+     int illegal_mem;
+     int no_xhair;
+     int use_serial;
+     int serial_demand;
+     int parallel_demand;
+     int automount_uaedev;
+     int use_gfxlib;
+     int socket_emu;
+ 
+     int start_debugger;
+     int start_gui;
+ 
+     int jport0;
+     int jport1;
+     KbdLang keyboard_lang;
+     int allow_save;
+     int emul_accuracy;
+     int test_drawing_speed;
+ 
+     int produce_sound;
+     int stereo;
+     int sound_bits;
+     int sound_freq;
+     int sound_minbsiz;
+     int sound_maxbsiz;
+     int sound_pri_time;
+     int sound_pri_cutoff;
+     int sound_interpol;
+ 
+     int gfx_framerate;
+     int gfx_width;
+     int gfx_height;
+     int gfx_lores;
+     int gfx_linedbl;
+     int gfx_correct_aspect;
+     int gfx_afullscreen;
+     int gfx_pfullscreen;
+     int gfx_xcenter;
+     int gfx_ycenter;
+     int color_mode;
+ 
+     int blits_32bit_enabled;
+     int immediate_blits;
+     unsigned int chipset_mask;
+     int ntscmode;
+     int collision_level;
+ 
+     char df[4][256];
+     char romfile[256];
+     char keyfile[256];
+     char prtname[256];
+ 
+     char path_floppy[256];
+     char path_hardfile[256];
+     char path_rom[256];
+ 
+     int m68k_speed;
+     int cpu_level;
+     int cpu_compatible;
+     int address_space_24;
+ 
+     uae_u32 z3fastmem_size;
+     uae_u32 fastmem_size;
+     uae_u32 chipmem_size;
+     uae_u32 bogomem_size;
+     uae_u32 a3000mem_size;
+     uae_u32 gfxmem_size;
+ 
+     struct uaedev_mount_info *mountinfo;
+ 
+     int nr_floppies;
+ 
+     /* Target specific options */
+     int x11_use_low_bandwidth;
+     int x11_use_mitshm;
+     int x11_use_dgamode;
+     int x11_hide_cursor;
+     int svga_no_linear;
+     int win32_middle_mouse;
+     int win32_sound_style;
+     int win32_sound_tweak;
+     int win32_logfile;
+     int win32_iconified_nospeed;
+     int win32_iconified_nosound;
+     int curses_reverse_video;
+ };
+ 
+ /* Contains the filename of .uaerc */
+ extern char optionsfile[];
+ extern void save_options (FILE *, struct uae_prefs *);
+ 
+ extern void default_prefs (struct uae_prefs *);
+ extern void discard_prefs (struct uae_prefs *);
+ 
+ extern int parse_cmdline_option (char, char *);
+ 
+ extern int cfgfile_yesno (char *option, char *value, char *name, int *location);
+ extern int cfgfile_intval (char *option, char *value, char *name, int *location, int scale);
+ extern int cfgfile_strval (char *option, char *value, char *name, int *location, const char *table[], int more);
+ extern int cfgfile_string (char *option, char *value, char *name, char *location, int maxsz);
+ extern char *cfgfile_subst_path (const char *path, const char *subst, const char *file);
+ 
+ extern int target_parse_option (struct uae_prefs *, char *option, char *value);
+ extern void target_save_options (FILE *, struct uae_prefs *);
+ 
+ extern int cfgfile_load (struct uae_prefs *, const char *filename);
+ extern int cfgfile_save (struct uae_prefs *, const char *filename);
+ extern void cfgfile_parse_line (struct uae_prefs *p, char *);
+ extern int cfgfile_parse_option (struct uae_prefs *p, char *option, char *value);
+ extern int cfgfile_get_description (const char *filename, char *description);
+ extern void cfgfile_show_usage (void);
+ 
+ extern void fixup_prefs_dimensions (struct uae_prefs *prefs);
+ 
+ extern void check_prefs_changed_custom (void);
+ extern void check_prefs_changed_cpu (void);
+ extern void check_prefs_changed_audio (void);
+ extern int check_prefs_changed_gfx (void);
+ 
+ #define JSEM_DECODEVAL(n,v) ((n) == 0 ? (v)->jport0 : (v)->jport1)
+ /* Determine how port n is configured */
+ #define JSEM_ISJOY0(n,v) (JSEM_DECODEVAL(n,v) == 0)
+ #define JSEM_ISJOY1(n,v) (JSEM_DECODEVAL(n,v) == 1)
+ #define JSEM_ISMOUSE(n,v) (JSEM_DECODEVAL(n,v) == 2)
+ #define JSEM_ISNUMPAD(n,v) (JSEM_DECODEVAL(n,v) == 3)
+ #define JSEM_ISCURSOR(n,v) (JSEM_DECODEVAL(n,v) == 4)
+ #define JSEM_ISSOMEWHEREELSE(n,v) (JSEM_DECODEVAL(n,v) == 5)
+ extern const char *gameport_state (int n);
+ 
+ extern struct uae_prefs currprefs, changed_prefs;
+ 
+ #if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 6
+ extern void write_log (const char *, ...) __attribute__ ((format (printf, 1, 2)));
+ #else
+ extern void write_log (const char *, ...);
+ #endif
+ 
+ extern void machdep_init (void);
+ 
+ /* AIX doesn't think it is Unix. Neither do I. */
+ #if defined(_ALL_SOURCE) || defined(_AIX)
+ #undef __unix
+ #define __unix
+ #endif
+ 
+ extern char romfile[], keyfile[], prtname[], sername[];
+ 
+ extern int cloanto_rom;
+ 
+ #define MAX_COLOR_MODES 5
+ 
+ extern int fast_memcmp(const void *foo, const void *bar, int len);
+ extern int memcmpy(void *foo, const void *bar, int len);
+ 
+ /*
+  * You can specify numbers from 0 to 5 here. It is possible that higher
+  * numbers will make the CPU emulation slightly faster, but if the setting
+  * is too high, you will run out of memory while compiling.
+  * Best to leave this as it is.
+  */
+ #define CPU_EMU_SIZE 0
+ 
+ /* #define NEED_TO_DEBUG_BADLY */
+ 
+ #if !defined(USER_PROGRAMS_BEHAVE)
+ #define USER_PROGRAMS_BEHAVE 0
+ #endif
+ 
+ /* Some memsets which know that they can safely overwrite some more memory
+  * at both ends and use that knowledge to align the pointers. */
+ 
+ #define QUADRUPLIFY(c) (((c) | ((c) << 8)) | (((c) | ((c) << 8)) << 16))
+ 
+ /* When you call this routine, bear in mind that it rounds the bounds and
+  * may need some padding for the array. */
+ 
+ #define fuzzy_memset(p, c, o, l) fuzzy_memset_1 ((p), QUADRUPLIFY (c), (o) & ~3, ((l) + 4) >> 2)
+ STATIC_INLINE void fuzzy_memset_1 (void *p, uae_u32 c, int offset, int len)
+ {
+     uae_u32 *p2 = (uae_u32 *)((char *)p + offset);
+     int a = len & 7;
+     len >>= 3;
+     switch (a) {
+      case 7: p2--; goto l1;
+      case 6: p2-=2; goto l2;
+      case 5: p2-=3; goto l3;
+      case 4: p2-=4; goto l4;
+      case 3: p2-=5; goto l5;
+      case 2: p2-=6; goto l6;
+      case 1: p2-=7; goto l7;
+      case 0: if (!--len) return; break;
+     }
+ 
+     for (;;) {
+ 	p2[0] = c;
+ 	l1:
+ 	p2[1] = c;
+ 	l2:
+ 	p2[2] = c;
+ 	l3:
+ 	p2[3] = c;
+ 	l4:
+ 	p2[4] = c;
+ 	l5:
+ 	p2[5] = c;
+ 	l6:
+ 	p2[6] = c;
+ 	l7:
+ 	p2[7] = c;
+ 
+ 	if (!len)
+ 	    break;
+ 	len--;
+ 	p2 += 8;
+     }
+ }
+ 
+ /* This one knows it will never be asked to clear more than 32 bytes.  Make sure you call this with a
+    constant for the length.  */
+ #define fuzzy_memset_le32(p, c, o, l) fuzzy_memset_le32_1 ((p), QUADRUPLIFY (c), (o) & ~3, ((l) + 7) >> 2)
+ STATIC_INLINE void fuzzy_memset_le32_1 (void *p, uae_u32 c, int offset, int len)
+ {
+     uae_u32 *p2 = (uae_u32 *)((char *)p + offset);
+ 
+     switch (len) {
+      case 9: p2[0] = c; p2[1] = c; p2[2] = c; p2[3] = c; p2[4] = c; p2[5] = c; p2[6] = c; p2[7] = c; p2[8] = c; break;
+      case 8: p2[0] = c; p2[1] = c; p2[2] = c; p2[3] = c; p2[4] = c; p2[5] = c; p2[6] = c; p2[7] = c; break;
+      case 7: p2[0] = c; p2[1] = c; p2[2] = c; p2[3] = c; p2[4] = c; p2[5] = c; p2[6] = c; break;
+      case 6: p2[0] = c; p2[1] = c; p2[2] = c; p2[3] = c; p2[4] = c; p2[5] = c; break;
+      case 5: p2[0] = c; p2[1] = c; p2[2] = c; p2[3] = c; p2[4] = c; break;
+      case 4: p2[0] = c; p2[1] = c; p2[2] = c; p2[3] = c; break;
+      case 3: p2[0] = c; p2[1] = c; p2[2] = c; break;
+      case 2: p2[0] = c; p2[1] = c; break;
+      case 1: p2[0] = c; break;
+      case 0: break;
+      default: printf("Hit the programmer.\n"); break;
+     }
+ }
+ 
+ #if defined(AMIGA) && defined(__GNUC__)
+ #include "od-amiga/amiga-kludges.h"
+ #endif
diff -Nrc3p /dunes/wcohen/virg-netgdb/src/sim/m68k/include/readcpu.h src/sim/m68k/include/readcpu.h
*** /dunes/wcohen/virg-netgdb/src/sim/m68k/include/readcpu.h	Wed Dec 31 19:00:00 1969
--- src/sim/m68k/include/readcpu.h	Mon Feb 19 14:10:25 2001
***************
*** 0 ****
--- 1,100 ----
+ ENUMDECL {
+   Dreg, Areg, Aind, Aipi, Apdi, Ad16, Ad8r,
+   absw, absl, PC16, PC8r, imm, imm0, imm1, imm2, immi, am_unknown, am_illg
+ } ENUMNAME (amodes);
+ 
+ ENUMDECL {
+     i_ILLG,
+ 
+     i_OR, i_AND, i_EOR, i_ORSR, i_ANDSR, i_EORSR,
+     i_SUB, i_SUBA, i_SUBX, i_SBCD,
+     i_ADD, i_ADDA, i_ADDX, i_ABCD,
+     i_NEG, i_NEGX, i_NBCD, i_CLR, i_NOT, i_TST,
+     i_BTST, i_BCHG, i_BCLR, i_BSET,
+     i_CMP, i_CMPM, i_CMPA,
+     i_MVPRM, i_MVPMR, i_MOVE, i_MOVEA, i_MVSR2, i_MV2SR,
+     i_SWAP, i_EXG, i_EXT, i_MVMEL, i_MVMLE,
+     i_TRAP, i_MVR2USP, i_MVUSP2R, i_RESET, i_NOP, i_STOP, i_RTE, i_RTD,
+     i_LINK, i_UNLK,
+     i_RTS, i_TRAPV, i_RTR,
+     i_JSR, i_JMP, i_BSR, i_Bcc,
+     i_LEA, i_PEA, i_DBcc, i_Scc,
+     i_DIVU, i_DIVS, i_MULU, i_MULS,
+     i_ASR, i_ASL, i_LSR, i_LSL, i_ROL, i_ROR, i_ROXL, i_ROXR,
+     i_ASRW, i_ASLW, i_LSRW, i_LSLW, i_ROLW, i_RORW, i_ROXLW, i_ROXRW,
+     i_CHK,i_CHK2,
+     i_MOVEC2, i_MOVE2C, i_CAS, i_CAS2, i_DIVL, i_MULL,
+     i_BFTST,i_BFEXTU,i_BFCHG,i_BFEXTS,i_BFCLR,i_BFFFO,i_BFSET,i_BFINS,
+     i_PACK, i_UNPK, i_TAS, i_BKPT, i_CALLM, i_RTM, i_TRAPcc, i_MOVES,
+     i_FPP, i_FDBcc, i_FScc, i_FTRAPcc, i_FBcc, i_FSAVE, i_FRESTORE,
+     i_CINVL, i_CINVP, i_CINVA, i_CPUSHL, i_CPUSHP, i_CPUSHA, i_MOVE16,
+     i_MMUOP
+ } ENUMNAME (instrmnem);
+ 
+ extern struct mnemolookup {
+     instrmnem mnemo;
+     const char *name;
+ } lookuptab[];
+ 
+ ENUMDECL {
+     sz_byte, sz_word, sz_long
+ } ENUMNAME (wordsizes);
+ 
+ ENUMDECL {
+     fa_set, fa_unset, fa_zero, fa_one, fa_dontcare, fa_unknown, fa_isjmp
+ } ENUMNAME (flagaffect);
+ 
+ ENUMDECL {
+     fu_used, fu_unused, fu_maybecc, fu_unknown, fu_isjmp
+ } ENUMNAME (flaguse);
+ 
+ ENUMDECL {
+     bit0, bit1, bitc, bitC, bitf, biti, bitI, bitj, bitJ, bitk, bitK,
+     bits, bitS, bitd, bitD, bitr, bitR, bitz, lastbit
+ } ENUMNAME (bitvals);
+ 
+ struct instr_def {
+     unsigned int bits;
+     int n_variable;
+     char bitpos[16];
+     unsigned int mask;
+     int cpulevel;
+     int plevel;
+     struct {
+ 	unsigned int flaguse:3;
+ 	unsigned int flagset:3;
+     } flaginfo[5];
+     unsigned char sduse;
+     const char *opcstr;
+ };
+ 
+ extern struct instr_def defs68k[];
+ extern int n_defs68k;
+ 
+ extern struct instr {
+     long int handler;
+     unsigned char dreg;
+     unsigned char sreg;
+     signed char dpos;
+     signed char spos;
+     unsigned char sduse;
+     int flagdead:8, flaglive:8;
+     unsigned int mnemo:8;
+     unsigned int cc:4;
+     unsigned int plev:2;
+     unsigned int size:2;
+     unsigned int smode:5;
+     unsigned int stype:3;
+     unsigned int dmode:5;
+     unsigned int suse:1;
+     unsigned int duse:1;
+     unsigned int unused1:1;
+     unsigned int clev:3;
+     unsigned int unused2:5;
+ } *table68k;
+ 
+ extern void read_table68k (void);
+ extern void do_merges (void);
+ extern int get_no_mismatches (void);
+ extern int nr_cpuop_funcs;
+ 
diff -Nrc3p /dunes/wcohen/virg-netgdb/src/sim/m68k/include/sysdeps.h src/sim/m68k/include/sysdeps.h
*** /dunes/wcohen/virg-netgdb/src/sim/m68k/include/sysdeps.h	Wed Dec 31 19:00:00 1969
--- src/sim/m68k/include/sysdeps.h	Mon Feb 19 14:10:25 2001
***************
*** 0 ****
--- 1,368 ----
+  /*
+   * UAE - The Un*x Amiga Emulator
+   *
+   * Try to include the right system headers and get other system-specific
+   * stuff right & other collected kludges.
+   *
+   * If you think about modifying this, think twice. Some systems rely on
+   * the exact order of the #include statements. That's also the reason
+   * why everything gets included unconditionally regardless of whether
+   * it's actually needed by the .c file.
+   *
+   * Copyright 1996, 1997 Bernd Schmidt
+   */
+ 
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <errno.h>
+ #include <assert.h>
+ #include <limits.h>
+ 
+ #ifndef __STDC__
+ #error "Your compiler is not ANSI. Get a real one."
+ #endif
+ 
+ #include <stdarg.h>
+ 
+ #ifdef HAVE_SYS_TYPES_H
+ #include <sys/types.h>
+ #endif
+ 
+ #ifdef HAVE_VALUES_H
+ #include <values.h>
+ #endif
+ 
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #endif
+ 
+ #ifdef HAVE_UNISTD_H
+ #include <unistd.h>
+ #endif
+ #ifdef HAVE_FCNTL_H
+ #include <fcntl.h>
+ #endif
+ 
+ #ifdef HAVE_UTIME_H
+ #include <utime.h>
+ #endif
+ 
+ #ifdef HAVE_SYS_STAT_H
+ #include <sys/stat.h>
+ #endif
+ 
+ #if TIME_WITH_SYS_TIME
+ # include <sys/time.h>
+ # include <time.h>
+ #else
+ # if HAVE_SYS_TIME_H
+ #  include <sys/time.h>
+ # else
+ #  include <time.h>
+ # endif
+ #endif
+ 
+ #if HAVE_DIRENT_H
+ # include <dirent.h>
+ #else
+ # define dirent direct
+ # if HAVE_SYS_NDIR_H
+ #  include <sys/ndir.h>
+ # endif
+ # if HAVE_SYS_DIR_H
+ #  include <sys/dir.h>
+ # endif
+ # if HAVE_NDIR_H
+ #  include <ndir.h>
+ # endif
+ #endif
+ 
+ #ifdef HAVE_SYS_UTIME_H
+ # include <sys/utime.h>
+ #endif
+ 
+ #include <errno.h>
+ #include <assert.h>
+ 
+ #if EEXIST == ENOTEMPTY
+ #define BROKEN_OS_PROBABLY_AIX
+ #endif
+ 
+ #ifdef __NeXT__
+ #define S_IRUSR S_IREAD
+ #define S_IWUSR S_IWRITE
+ #define S_IXUSR S_IEXEC
+ #define S_ISDIR(val) (S_IFDIR & val)
+ struct utimbuf
+ {
+     time_t actime;
+     time_t modtime;
+ };
+ #endif
+ 
+ #if defined(__GNUC__) && defined(AMIGA)
+ /* gcc on the amiga need that __attribute((regparm)) must */
+ /* be defined in function prototypes as well as in        */
+ /* function definitions !                                 */
+ #define REGPARAM2 REGPARAM
+ #else /* not(GCC & AMIGA) */
+ #define REGPARAM2
+ #endif
+ 
+ /* sam: some definitions so that SAS/C can compile UAE */
+ #if defined(__SASC) && defined(AMIGA)
+ #define REGPARAM2 
+ #define REGPARAM
+ #define S_IRUSR S_IREAD
+ #define S_IWUSR S_IWRITE
+ #define S_IXUSR S_IEXECUTE
+ #define S_ISDIR(val) (S_IFDIR & val)
+ #define mkdir(x,y) mkdir(x)
+ #define truncate(x,y) 0
+ #define creat(x,y) open("T:creat",O_CREAT|O_TEMP|O_RDWR) /* sam: for zfile.c */
+ #define strcasecmp stricmp
+ #define utime(file,time) 0
+ struct utimbuf
+ {
+     time_t actime;
+     time_t modtime;
+ };
+ #endif
+ 
+ #if defined(WARPUP)
+ #include "devices/timer.h"
+ #include "osdep/posixemu.h"
+ #define REGPARAM
+ #define REGPARAM2
+ #define RETSIGTYPE
+ #define USE_ZFILE
+ #define strcasecmp stricmp
+ #define memcpy q_memcpy
+ #define memset q_memset
+ #define strdup my_strdup
+ #define random rand
+ #define creat(x,y) open("T:creat",O_CREAT|O_RDWR|O_TRUNC,777)
+ extern void* q_memset(void*,int,size_t);
+ extern void* q_memcpy(void*,const void*,size_t);
+ #endif
+ 
+ #ifdef __DOS__
+ #include <pc.h>
+ #include <io.h>
+ #endif
+ 
+ /* Acorn specific stuff */
+ #ifdef ACORN
+ 
+ #define S_IRUSR S_IREAD
+ #define S_IWUSR S_IWRITE
+ #define S_IXUSR S_IEXEC
+ 
+ #define strcasecmp stricmp
+ 
+ #endif
+ 
+ #ifndef L_tmpnam
+ #define L_tmpnam 128 /* ought to be safe */
+ #endif
+ 
+ /* If char has more then 8 bits, good night. */
+ typedef unsigned char uae_u8;
+ typedef signed char uae_s8;
+ 
+ typedef struct { uae_u8 RGB[3]; } RGB;
+ 
+ #if SIZEOF_SHORT == 2
+ typedef unsigned short uae_u16;
+ typedef short uae_s16;
+ #elif SIZEOF_INT == 2
+ typedef unsigned int uae_u16;
+ typedef int uae_s16;
+ #else
+ #error No 2 byte type, you lose.
+ #endif
+ 
+ #if SIZEOF_INT == 4
+ typedef unsigned int uae_u32;
+ typedef int uae_s32;
+ #elif SIZEOF_LONG == 4
+ typedef unsigned long uae_u32;
+ typedef long uae_s32;
+ #else
+ #error No 4 byte type, you lose.
+ #endif
+ 
+ typedef uae_u32 uaecptr;
+ 
+ #undef uae_s64
+ #undef uae_u64
+ 
+ #if SIZEOF_LONG_LONG == 8
+ #define uae_s64 long long
+ #define uae_u64 long long
+ #define VAL64(a) (a ## LL)
+ #define UVAL64(a) (a ## uLL)
+ #elif SIZEOF___INT64 == 8
+ #define uae_s64 __int64
+ #define uae_u64 unsigned __int64
+ #define VAL64(a) (a)
+ #define UVAL64(a) (a)
+ #elif SIZEOF_LONG == 8
+ #define uae_s64 long;
+ #define uae_u64 unsigned long;
+ #define VAL64(a) (a ## l)
+ #define UVAL64(a) (a ## ul)
+ #endif
+ 
+ #ifdef HAVE_STRDUP
+ #define my_strdup strdup
+ #else
+ extern char *my_strdup (const char*s);
+ #endif
+ 
+ extern void *xmalloc(size_t);
+ 
+ /* We can only rely on GNU C getting enums right. Mickeysoft VSC++ is known
+  * to have problems, and it's likely that other compilers choke too. */
+ #ifdef __GNUC__
+ #define ENUMDECL typedef enum
+ #define ENUMNAME(name) name
+ #else
+ #define ENUMDECL enum
+ #define ENUMNAME(name) ; typedef int name
+ #endif
+ 
+ /*
+  * Porters to weird systems, look! This is the preferred way to get
+  * filesys.c (and other stuff) running on your system. Define the
+  * appropriate macros and implement wrappers in a machine-specific file.
+  *
+  * I guess the Mac port could use this (Ernesto?)
+  */
+ 
+ #undef DONT_HAVE_POSIX
+ #undef DONT_HAVE_REAL_POSIX /* define if open+delete doesn't do what it should */
+ #undef DONT_HAVE_STDIO
+ #undef DONT_HAVE_MALLOC
+ 
+ #if defined(WARPUP)
+ #define DONT_HAVE_POSIX
+ #endif
+ 
+ #if defined _WIN32
+ 
+ #if defined __WATCOMC__
+ 
+ #define O_NDELAY 0
+ #include <direct.h>
+ #define dirent direct
+ #define mkdir(a,b) mkdir(a)
+ #define strcasecmp stricmp
+ 
+ #elif defined __MINGW32__
+ 
+ #define O_NDELAY 0
+ #define mkdir(a,b) mkdir(a)
+ 
+ #endif
+ 
+ #endif /* _WIN32 */ 
+ 
+ #ifdef DONT_HAVE_POSIX
+ 
+ #define access posixemu_access
+ extern int posixemu_access (const char *, int);
+ #define open posixemu_open
+ extern int posixemu_open (const char *, int, int);
+ #define close posixemu_close
+ extern void posixemu_close (int);
+ #define read posixemu_read
+ extern int posixemu_read (int, char *, int);
+ #define write posixemu_write
+ extern int posixemu_write (int, const char *, int);
+ #undef lseek
+ #define lseek posixemu_seek
+ extern int posixemu_seek (int, int, int);
+ #define stat(a,b) posixemu_stat ((a), (b))
+ extern int posixemu_stat (const char *, STAT *);
+ #define mkdir posixemu_mkdir
+ extern int mkdir (const char *, int);
+ #define rmdir posixemu_rmdir
+ extern int posixemu_rmdir (const char *);
+ #define unlink posixemu_unlink
+ extern int posixemu_unlink (const char *);
+ #define truncate posixemu_truncate
+ extern int posixemu_truncate (const char *, long int);
+ #define rename posixemu_rename
+ extern int posixemu_rename (const char *, const char *);
+ #define chmod posixemu_chmod
+ extern int posixemu_chmod (const char *, int);
+ #define tmpnam posixemu_tmpnam
+ extern void posixemu_tmpnam (char *);
+ #define utime posixemu_utime
+ extern int posixemu_utime (const char *, struct utimbuf *);
+ #define opendir posixemu_opendir
+ extern DIR * posixemu_opendir (const char *);
+ #define readdir posixemu_readdir
+ extern struct dirent* readdir (DIR *);
+ #define closedir posixemu_closedir
+ extern void closedir (DIR *);
+ 
+ /* This isn't the best place for this, but it fits reasonably well. The logic
+  * is that you probably don't have POSIX errnos if you don't have the above
+  * functions. */
+ extern long dos_errno (void);
+ 
+ #endif
+ 
+ #ifdef DONT_HAVE_STDIO
+ 
+ extern FILE *stdioemu_fopen (const char *, const char *);
+ #define fopen(a,b) stdioemu_fopen(a, b)
+ extern int stdioemu_fseek (FILE *, int, int);
+ #define fseek(a,b,c) stdioemu_fseek(a, b, c)
+ extern int stdioemu_fread (char *, int, int, FILE *);
+ #define fread(a,b,c,d) stdioemu_fread(a, b, c, d)
+ extern int stdioemu_fwrite (const char *, int, int, FILE *);
+ #define fwrite(a,b,c,d) stdioemu_fwrite(a, b, c, d)
+ extern int stdioemu_ftell (FILE *);
+ #define ftell(a) stdioemu_ftell(a)
+ extern int stdioemu_fclose (FILE *);
+ #define fclose(a) stdioemu_fclose(a)
+ 
+ #endif
+ 
+ #ifdef DONT_HAVE_MALLOC
+ 
+ #define malloc(a) mallocemu_malloc(a)
+ extern void *mallocemu_malloc (int size);
+ #define free(a) mallocemu_free(a)
+ extern void mallocemu_free (void *ptr);
+ 
+ #endif
+ 
+ #ifdef X86_ASSEMBLY
+ #define ASM_SYM_FOR_FUNC(a) __asm__(a)
+ #else
+ #define ASM_SYM_FOR_FUNC(a)
+ #endif
+ 
+ #if defined USE_COMPILER
+ #undef NO_PREFETCH_BUFFER
+ #undef NO_EXCEPTION_3
+ #define NO_EXCEPTION_3
+ #define NO_PREFETCH_BUFFER
+ #endif
+ 
+ #include "target.h"
+ 
+ #ifndef O_BINARY
+ #define O_BINARY 0
+ #endif
+ 
+ #ifndef STATIC_INLINE
+ #define STATIC_INLINE static __inline__
+ #endif
diff -Nrc3p /dunes/wcohen/virg-netgdb/src/sim/m68k/include/uae.h src/sim/m68k/include/uae.h
*** /dunes/wcohen/virg-netgdb/src/sim/m68k/include/uae.h	Wed Dec 31 19:00:00 1969
--- src/sim/m68k/include/uae.h	Mon Feb 19 14:10:25 2001
***************
*** 0 ****
--- 1,40 ----
+  /*
+   * UAE - The Un*x Amiga Emulator
+   *
+   * Prototypes for main.c
+   *
+   * Copyright 1996 Bernd Schmidt
+   */
+ 
+ extern void do_start_program (void);
+ extern void do_leave_program (void);
+ extern void start_program (void);
+ extern void leave_program (void);
+ extern void real_main (int, char **);
+ extern void usage (void);
+ extern void parse_cmdline (int argc, char **argv);
+ 
+ 
+ extern void uae_reset (void);
+ extern void uae_quit (void);
+ extern void reset_all_systems (void);
+ 
+ extern int quit_program;
+ 
+ extern char warning_buffer[256];
+ 
+ /* This structure is used to define menus. The val field can hold key
+  * shortcuts, or one of these special codes:
+  *   -4: deleted entry, not displayed, not selectable, but does count in
+  *       select value
+  *   -3: end of table
+  *   -2: line that is displayed, but not selectable
+  *   -1: line that is selectable, but has no keyboard shortcut
+  *    0: Menu title
+  */
+ struct bstring {
+     const char *data;
+     int val;
+ };
+ 
+ extern char *colormodes[];
diff -Nrc3p /dunes/wcohen/virg-netgdb/src/sim/m68k/include/uaeexe.h src/sim/m68k/include/uaeexe.h
*** /dunes/wcohen/virg-netgdb/src/sim/m68k/include/uaeexe.h	Wed Dec 31 19:00:00 1969
--- src/sim/m68k/include/uaeexe.h	Mon Feb 19 14:10:25 2001
***************
*** 0 ****
--- 1,21 ----
+ /*
+  *  uaeexe.h - launch executable in UAE
+  *
+  *  (c) 1997 by Samuel Devulder
+  */
+ 
+ struct uae_xcmd {
+     struct uae_xcmd *prev,*next;
+     char *cmd;
+ };
+ 
+ #define UAEEXE_ORG         0xF0FF90 /* sam: I hope this slot is free */
+ 
+ #define UAEEXE_OK          0
+ #define UAEEXE_NOTRUNNING  1
+ #define UAEEXE_NOMEM       2
+ 
+ extern void uaeexe_install(void);
+ extern int  uaeexe(char *cmd);
+ 
+ 
diff -Nrc3p /dunes/wcohen/virg-netgdb/src/sim/m68k/include/zfile.h src/sim/m68k/include/zfile.h
*** /dunes/wcohen/virg-netgdb/src/sim/m68k/include/zfile.h	Wed Dec 31 19:00:00 1969
--- src/sim/m68k/include/zfile.h	Mon Feb 19 14:10:25 2001
***************
*** 0 ****
--- 1,12 ----
+  /*
+   * UAE - The Un*x Amiga Emulator
+   *
+   * routines to handle compressed file automatically
+   *
+   * (c) 1996 Samuel Devulder
+   */
+ 
+ extern FILE *zfile_open (const char *, const char *);
+ extern int zfile_close (FILE *);
+ extern void zfile_exit (void);
+ 
diff -Nrc3p /dunes/wcohen/virg-netgdb/src/sim/m68k/interp.c src/sim/m68k/interp.c
*** /dunes/wcohen/virg-netgdb/src/sim/m68k/interp.c	Wed Dec 31 19:00:00 1969
--- src/sim/m68k/interp.c	Fri Feb 23 17:06:29 2001
***************
*** 0 ****
--- 1,954 ----
+ /* Simulator for the Motorola 68k architecture.
+ 
+    Written by William Cohen of Red Hat,
+    wcohen@redhat.com
+ 
+    This file is part of SH sim
+ 
+ 
+ 		THIS SOFTWARE IS NOT COPYRIGHTED
+ 
+    Cygnus offers the following for use in the public domain.  Cygnus
+    makes no warranty with regard to the software or it's performance
+    and the user accepts the software "AS IS" with all faults.
+ 
+    CYGNUS DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD TO
+    THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+    MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ 
+ */
+ 
+ #include "sysconfig.h"
+ #include "sysdeps.h"
+ 
+ #include "config.h"
+ 
+ #include <sys/types.h>
+ #include <setjmp.h>
+ 
+ #include <signal.h>
+ #ifdef HAVE_UNISTD_H
+ #include <unistd.h>
+ #endif
+ 
+ #include "sysdep.h"
+ #include "bfd.h"
+ #include "callback.h"
+ #include "remote-sim.h"
+ 
+ #include "config.h"
+ #include "options.h"
+ #include "uae.h"
+ #include "memory.h"
+ #include "custom.h"
+ #include "newcpu.h"
+ #include "autoconf.h"
+ #include "uaeexe.h"
+ #include "dis-asm.h"
+ 
+ int trace = 0;
+ int verbose_trace = 0;
+ int cloanto_rom = 0;
+ 
+ static bfd *current_bfd = 0;
+ 
+ static jmp_buf interp_trap;
+ 
+ /* This file is local - if newlib changes, then so should this.  */
+ #include "syscall.h"
+ 
+ #include <math.h>
+ 
+ #ifdef _WIN32
+ #include <float.h>		/* Needed for _isnan() */
+ #define isnan _isnan
+ #endif
+ 
+ #ifndef SIGBUS
+ #define SIGBUS SIGSEGV
+ #endif
+ 
+ #ifndef SIGQUIT
+ #define SIGQUIT SIGTERM
+ #endif
+ 
+ #ifndef SIGTRAP
+ #define SIGTRAP 5
+ #endif
+ 
+ 
+ struct regstruct saved_state;
+ struct uae_prefs currprefs;
+ static int opt_cpu_level = 4; /* 68040 default */
+ static int opt_mem_size = 20; /* 1M default */
+ 
+ /* These variables are at file scope so that functions other than
+    sim_resume can use the fetch/store macros */
+ 
+ static int target_little_endian;
+ static int global_endianw, endianb;
+ static int target_dsp;
+ static int host_little_endian;
+ 
+ static SIM_OPEN_KIND sim_kind;
+ static char *myname;
+ 
+ static FILE *profile_file;
+ 
+ static int sim_profile_size = 17;
+ static int nsamples;
+ 
+ static host_callback *callback;
+ 
+ #define MMASKB ((saved_state.msize -1) & ~0)
+ 
+ #if defined(__GO32__) || defined(_WIN32)
+ int sim_memory_size = 19;
+ #else
+ int sim_memory_size = 24;
+ #endif
+ 
+ static unsigned INLINE
+ swap (n)
+      unsigned n;
+ {
+   if (endianb)
+     n = (n << 24 | (n & 0xff00) << 8
+ 	 | (n & 0xff0000) >> 8 | (n & 0xff000000) >> 24);
+   return n;
+ }
+ 
+ int 
+ fail ()
+ {
+   abort ();
+ }
+ 
+ #define RAISE_EXCEPTION(x) \
+   (saved_state.exception = x, saved_state.insn_end = 0)
+ 
+ /* This function exists mainly for the purpose of setting a breakpoint to
+    catch simulated bus errors when running the simulator under GDB.  */
+ 
+ void
+ raise_exception (x)
+      int x;
+ {
+   RAISE_EXCEPTION(x);
+ }
+ 
+ void
+ raise_buserror ()
+ {
+   raise_exception (SIGBUS);
+ }
+ 
+ void
+ control_c (sig, code, scp, addr)
+      int sig;
+      int code;
+      char *scp;
+      char *addr;
+ {
+   raise_exception (SIGINT);
+ }
+ 
+ /* Set the memory size to the power of two provided. */
+ 
+ void
+ sim_size (power)
+      int power;
+ 
+ {
+   opt_mem_size = power;
+ }
+ 
+ static int initted_memory = 0;
+ 
+ static void
+ parse_and_set_memory_size (str)
+      char *str;
+ {
+   int n;
+ 
+   /* NOTE figure out the amount of memory that should be allocated */
+   n = strtol (str, NULL, 10);
+ 
+   if (n > 0 && n <= 24)
+     sim_memory_size = n;
+   else
+     callback->printf_filtered (callback, "Bad memory size %d; must be 1 to 24, inclusive\n", n);
+ 
+   currprefs.chipmem_size = n * 1024*1024;
+ }
+ 
+ 
+ SIM_DESC
+ sim_open (kind, cb, abfd, argv)
+      SIM_OPEN_KIND kind;
+      host_callback *cb;
+      struct _bfd *abfd;
+      char **argv;
+ {
+   char **p;
+   int endian_set = 0;
+   int i;
+   union
+     {
+       int i;
+       short s[2];
+       char c[4];
+     }
+   mem_word;
+ 
+   current_bfd = abfd;
+ 
+   sim_kind = kind;
+   myname = argv[0];
+   callback = cb;
+ 
+   /* default 1Mb memory, at 0x80000000 */
+   currprefs.chipmem_size = 1 << opt_mem_size;
+   currprefs.cpu_level = opt_cpu_level;
+ 
+   if (getenv("VERBOSE_TRACE"))
+     verbose_trace = 1;
+ 
+   for (p = argv + 1; *p != NULL; ++p)
+     {
+       if (strcmp (*p, "-E") == 0)
+ 	{
+ 	  ++p;
+ 	  if (*p == NULL)
+ 	    {
+ 	      /* FIXME: This doesn't use stderr, but then the rest of the
+ 		 file doesn't either.  */
+ 	      callback->printf_filtered (callback, "Missing argument to `-E'.\n");
+ 	      return 0;
+ 	    }
+ 	  target_little_endian = strcmp (*p, "big") != 0;
+           endian_set = 1;
+ 	}
+       else if (isdigit (**p))
+ 	parse_and_set_memory_size (*p);
+     }
+ 
+   memory_init();
+ 
+   if (abfd != NULL && ! endian_set)
+       target_little_endian = ! bfd_big_endian (abfd);
+ 
+   for (i = 4; (i -= 2) >= 0; )
+     mem_word.s[i >> 1] = i;
+   global_endianw = mem_word.i >> (target_little_endian ? 0 : 16) & 0xffff;
+ 
+   for (i = 4; --i >= 0; )
+     mem_word.c[i] = i;
+   endianb = mem_word.i >> (target_little_endian ? 0 : 24) & 0xff;
+ 
+   init_m68k ();
+ 
+   /* fudge our descriptor for now */
+   return (SIM_DESC) 1;
+ }
+ 
+ void
+ sim_set_cpu_variant(int which)
+ {
+   switch (which)
+     {
+     case '0':
+     case '1':
+     case '2':
+     case '4':
+       opt_cpu_level = which - '0';
+       break;
+     case 8:
+       opt_cpu_level = 3;
+       break;
+     }
+   printf("cpu_variant set to %d\n", opt_cpu_level);
+ }
+ 
+ SIM_RC
+ sim_create_inferior (sd, prog_bfd, argv, env)
+      SIM_DESC sd;
+      struct _bfd *prog_bfd;
+      char **argv;
+      char **env;
+ {
+   current_bfd = prog_bfd;
+   setlinebuf(stdout);
+   /* clear the registers */
+   memset (&saved_state, 0,
+ 	  (char*)&saved_state.end_of_registers - (char*)&saved_state);
+   /* set the PC */
+   saved_state.pc = 0x80000000;
+   if (prog_bfd != NULL)
+     saved_state.pc = bfd_get_start_address (prog_bfd);
+   saved_state.pc_p = saved_state.pc_oldp = get_real_address(saved_state.pc);
+   saved_state.regs[7+8] = /* $a7 */
+     saved_state.usp =
+     saved_state.isp =
+     saved_state.msp = 0x80000000 + currprefs.chipmem_size - 16;
+   return SIM_RC_OK;
+ }
+ 
+ int
+ sim_trace (sd)
+      SIM_DESC sd;
+ {
+   trace++;
+   sim_resume(sd, 1, 0);
+   trace--;
+   return 1;
+ }
+ 
+ 
+ int
+ sim_stop (sd)
+      SIM_DESC sd;
+ {
+   raise_exception (SIGINT);
+   return 1;
+ }
+ 
+ void
+ sim_set_trace (void)
+ {
+   trace = 1;
+ }
+ 
+ void
+ sim_set_callbacks (p)
+      host_callback *p;
+ {
+   callback = p;
+ }
+ 
+ static void
+ init_pointers ()
+ {
+   host_little_endian = 0;
+   *(char*)&host_little_endian = 1;
+   host_little_endian &= 1;
+ 
+   /* NOTE figure out if memory size has changed */
+ 
+   if (saved_state.profile && !profile_file)
+     {
+       profile_file = fopen ("gmon.out", "wb");
+       /* Seek to where to put the call arc data */
+       nsamples = (1 << sim_profile_size);
+ 
+       fseek (profile_file, nsamples * 2 + 12, 0);
+ 
+       if (!profile_file)
+ 	{
+ 	  fprintf (stderr, "Can't open gmon.out\n");
+ 	}
+       else
+ 	{
+ 	  saved_state.profile_hist =
+ 	    (unsigned short *) calloc (64, (nsamples * sizeof (short) / 64));
+ 	}
+     }
+ }
+ 
+ static int exit_code = 0;
+ 
+ void
+ sim_stop_reason (sd, reason, sigrc)
+      SIM_DESC sd;
+      enum sim_stop *reason;
+      int *sigrc;
+ {
+   /* The m68k simulator uses SIGQUIT to indicate that the program has
+      exited, so we must check for it here and translate it to exit.  */
+   if (saved_state.exception == SIGQUIT)
+     {
+       *reason = sim_exited;
+       *sigrc = exit_code;
+     }
+   else
+     {
+       *reason = sim_stopped;
+       *sigrc = saved_state.exception;
+     }
+ }
+ 
+ void
+ sim_info (sd, verbose)
+      SIM_DESC sd;
+      int verbose;
+ {
+   char *cpu;
+   switch (currprefs.cpu_level)
+     {
+     case 1: cpu="68010"; break;
+     case 2: cpu="68020"; break;
+     case 3: cpu="68020/881"; break;
+     case 4: cpu="68040"; break;
+     default: cpu="68000"; break;
+     }
+   callback->printf_filtered (callback, "\nCPU Configuration: %s\n", cpu);
+   callback->printf_filtered (callback, "Memory: %dKb from 0x%08x to 0x%08x\n",
+ 			     currprefs.chipmem_size/1024,
+ 			     0x80000000, 0x80000000 + currprefs.chipmem_size);
+ }
+ 
+ extern int in_m68k_go;
+ 
+ void
+ sim_resume (sd, step, siggnal)
+      SIM_DESC sd;
+      int step, siggnal;
+ {
+   void (*prev) ();
+   void (*prev_fpe) ();
+   /* NOTE need to actually run things */
+ 
+   /*  prev = signal (SIGINT, control_c);*/
+   prev_fpe = signal (SIGFPE, SIG_IGN);
+ 
+   init_pointers ();
+   saved_state.exception = 0;
+   if (step)
+     saved_state.exception = SIGTRAP;
+ 
+   saved_state.pc_p = saved_state.pc_oldp = get_real_address(saved_state.pc);
+   memcpy (&regs, &saved_state, sizeof(regs));
+   if (setjmp(interp_trap) == 0)
+     m68k_go (1, step);
+   in_m68k_go = 0;
+   memcpy (&saved_state, &regs, sizeof(regs));
+   saved_state.pc = m68k_getpc();
+ 
+   signal (SIGFPE, prev_fpe);
+   /*  signal (SIGINT, prev);*/
+ }
+ 
+ 
+ SIM_RC
+ sim_load (sd, prog, abfd, from_tty)
+      SIM_DESC sd;
+      char *prog;
+      bfd *abfd;
+      int from_tty;
+ {
+   extern bfd *sim_load_file (); /* ??? Don't know where this should live.  */
+   bfd *prog_bfd;
+ 
+   prog_bfd = sim_load_file (sd, myname, callback, prog, abfd,
+ 			    sim_kind == SIM_OPEN_DEBUG,
+ 			    0, sim_write);
+   if (prog_bfd == NULL)
+     return SIM_RC_FAIL;
+   if (abfd == NULL)
+     bfd_close (prog_bfd);
+   return SIM_RC_OK;
+ }
+ 
+ int
+ sim_write (sd, addr, buffer, size)
+      SIM_DESC sd;
+      SIM_ADDR addr;
+      unsigned char *buffer;
+      int size;
+ {
+   int i;
+ 
+   init_pointers ();
+   for (i = 0; i < size; i++)
+     put_byte(addr + i, buffer[i]);
+   return size;
+ }
+ 
+ 
+ int
+ sim_read (sd, addr, buffer, size)
+      SIM_DESC sd;
+      SIM_ADDR addr;
+      unsigned char *buffer;
+      int size;
+ {
+   int i;
+ 
+   init_pointers ();
+ 
+   for (i = 0; i < size; i++)
+     {
+       buffer[i] = get_byte(addr+i);
+     }
+   return size;
+ }
+ 
+ 
+ void
+ sim_close (sd, quitting)
+      SIM_DESC sd;
+      int quitting;
+ {
+   /* nothing to do */
+ }
+ 
+ int
+ sim_fetch_register (sd, rn, memory, length)
+      SIM_DESC sd;
+      int rn;
+      unsigned char *memory;
+      int length;
+ {
+   int val;
+   switch (rn)
+     {
+       /* data regs "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7" */
+     case  0: case  1: case  2: case  3: case  4: case  5: case  6: case  7:
+       /* address regs "a0", "a1", "a2", "a3", "a4", "a5", "fp", "sp" */
+     case  8: case  9: case 10: case 11: case 12: case 13: case 14: case 15:
+       val = saved_state.regs[rn];
+       break;
+       /*  "ps" */
+     case 16:
+       val = saved_state.usp;
+       break;
+       /* "pc" */
+     case 17:
+       val = saved_state.pc;
+       break;
+       /*  "fp0", "fp1", "fp2", "fp3", "fp4", "fp5", "fp6", "fp7" */
+     case 18: case 19: case 20: case 21:
+     case 22: case 23: case 24: case 25:
+       return 0;
+       /* "fpcontrol" */
+     case 26:
+       val = saved_state.fpcr;
+       break;
+       /* "fpstatus" */
+     case 27:
+       val = saved_state.fpsr;
+       break;
+       /* "fpiaddr" */
+     case 28:
+       val = saved_state.fpiar;
+       break;
+       /* "fpcode" */
+     case 29:
+       return 0;
+       /* "fpflags" */
+     case 30:
+       return 0;
+     default:
+       return 0;
+     }
+   
+   * (int *) memory = swap (val);
+   return -1;
+ }
+ 
+ int
+ sim_store_register (sd, rn, memory, length)
+      SIM_DESC sd;
+      int rn;
+      unsigned char *memory;
+      int length;
+ {
+   unsigned val;
+ 
+   val = swap (* (int *)memory);
+   switch (rn)
+     {
+       /* data regs "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7" */
+     case  0: case  1: case  2: case  3: case  4: case  5: case  6: case  7:
+       /* address regs "a0", "a1", "a2", "a3", "a4", "a5", "fp", "sp" */
+     case  8: case  9: case 10: case 11: case 12: case 13: case 14: case 15:
+       saved_state.regs[rn] = val;
+       break;
+       /*  "ps" */
+     case 16:
+       saved_state.usp = val;
+       break;
+       /* "pc" */
+     case 17:
+       saved_state.pc = val;
+       break;
+       /*  "fp0", "fp1", "fp2", "fp3", "fp4", "fp5", "fp6", "fp7" */
+     case 18: case 19: case 20: case 21:
+     case 22: case 23: case 24: case 25:
+       return 0;
+       /* "fpcontrol" */
+     case 26:
+       saved_state.fpcr = val;
+       break;
+       /* "fpstatus" */
+     case 27:
+       saved_state.fpsr = val;
+       break;
+       /* "fpiaddr" */
+     case 28:
+       saved_state.fpiar = val;
+       break;
+       /* "fpcode" */
+     case 29:
+       return 0;
+       /* "fpflags" */
+     case 30:
+       return 0;
+     default:
+       return 0;
+     }
+ 
+   return -1;
+ }
+ 
+ void
+ sim_do_command (sd, cmd)
+      SIM_DESC sd;
+      char *cmd;
+ {
+   if (cmd == NULL || *cmd == '\0')
+     {
+       cmd = "help";
+     }
+ }
+   
+   
+ /* stuff from UAE's main.c */
+ 
+ void write_log_standard (const char *fmt, ...)
+ {
+     va_list ap;
+     va_start (ap, fmt);
+ #ifdef HAVE_VFPRINTF
+     vfprintf (stderr, fmt, ap);
+ #else
+     /* Technique stolen from GCC.  */
+     {
+ 	int x1, x2, x3, x4, x5, x6, x7, x8;
+ 	x1 = va_arg (ap, int);
+ 	x2 = va_arg (ap, int);
+ 	x3 = va_arg (ap, int);
+ 	x4 = va_arg (ap, int);
+ 	x5 = va_arg (ap, int);
+ 	x6 = va_arg (ap, int);
+ 	x7 = va_arg (ap, int);
+ 	x8 = va_arg (ap, int);
+ 	fprintf (stderr, fmt, x1, x2, x3, x4, x5, x6, x7, x8);
+     }
+ #endif
+ }
+ 
+ int quit_program = 0;
+ 
+ void uae_reset (void)
+ {
+     if (quit_program == 0)
+ 	quit_program = -2;
+ }
+ 
+ void uae_quit (void)
+ {
+     if (quit_program != -1)
+ 	quit_program = -1;
+ }
+ 
+ void call_calltrap (int which)
+ {
+   fprintf(stderr, "calltrap %d\n", which);
+ }
+ 
+ void customreset ()
+ {
+ }
+ 
+ void
+ sim_exception (int which, int pc, int oldpc)
+ {
+   /*  if (trace)*/
+   switch (which) {
+   case 47:
+     regs.exception = SIGTRAP;
+     regs.pc = pc - 2;
+     regs.pc_p = regs.pc_oldp = get_real_address(regs.pc);
+     break;
+   default:
+     regs.exception = which;
+     break;
+   }
+   longjmp(interp_trap, 1);
+ }
+ 
+ static int
+ get_arg (int which)
+ {
+   return get_long (m68k_areg(regs, 7) + 4 + 4*which);
+ }
+ 
+ static void
+ put_arg (int which, int value)
+ {
+  put_long (m68k_areg(regs, 7) + 4 + 4*which, value);
+ }
+ 
+ #define S_ERR(c) \
+ 	if (c) { \
+ 		put_arg(0, errno); SET_CFLG(1); \
+ 	} else { \
+ 		m68k_dreg(regs,0) = rv; SET_CFLG(0); \
+ 	}; return
+ 
+ static void
+ put (unsigned char *addr, int size, int value)
+ {
+   switch (size)
+     {
+     case 1:
+       do_put_mem_byte (addr, value);
+       break;
+     case 2:
+       do_put_mem_word ((uae_u16 *)addr, value);
+       break;
+     case 4:
+       do_put_mem_long ((uae_u32 *)addr, value);
+       break;
+     }
+ }
+ 
+ int
+ sim_os_trap (int which)
+ {
+   int rv;
+   unsigned char *addr;
+   struct stat s;
+ 
+   switch (which)
+     {
+     case 1:
+       if (trace)
+ 	printf("exit (%d)\n", get_arg(0));
+       regs.exception = SIGQUIT;
+       exit_code = get_arg(0);
+       longjmp(interp_trap, 1);
+ 
+     case 3:
+       rv = read(get_arg(0), get_real_address(get_arg(1)), get_arg(2));
+       if (trace)
+ 	printf("read (%d,%08x,%d) = %d\n", get_arg(0), get_arg(1), get_arg(2), rv);
+       S_ERR(rv<0);
+ 
+     case 4:
+       rv = write(get_arg(0), get_real_address(get_arg(1)), get_arg(2));
+       if (trace)
+ 	printf("write (%d,%08x,%d) = %d\n", get_arg(0), get_arg(1), get_arg(2), rv);
+       S_ERR(rv<0);
+ 
+     case 5:
+       rv = open(get_real_address(get_arg(0)), get_arg(1), get_arg(2));
+       if (trace)
+ 	printf("open (%s,%d,%d) = %d\n", get_real_address(get_arg(0)), get_arg(1), get_arg(2), rv);
+       S_ERR(rv<0);
+ 
+     case 6:
+       if (get_arg(0) >= 3)
+ 	rv = close(get_arg(0));
+       else
+ 	rv = 0;
+       if (trace)
+ 	printf("close (%d) = %d\n", get_arg(0), rv);
+       S_ERR(rv<0);
+ 
+     case 17:
+       rv = 0;
+       if (get_arg(0) > 0x80000000 + currprefs.chipmem_size)
+ 	rv  = -1;
+       if (trace)
+ 	printf("brk (0x%08x) = %d\n", get_arg(0), rv);
+       S_ERR(rv<0);
+ 
+     case 28:
+       rv = fstat(get_arg(0), &s);
+       addr = get_real_address(get_arg(1));
+       put(addr+0, 2, s.st_dev);
+       put(addr+2, 2, s.st_ino);
+       put(addr+4, 4, s.st_mode);
+       put(addr+8, 2, s.st_nlink);
+       put(addr+10, 2, s.st_uid);
+       put(addr+12, 2, s.st_gid);
+       put(addr+14, 2, s.st_rdev);
+       put(addr+16, 4, s.st_size);
+       put(addr+20, 4, s.st_atime);
+       put(addr+28, 4, s.st_mtime);
+       put(addr+36, 4, s.st_ctime);
+       put(addr+44, 4, s.st_blksize);
+       put(addr+48, 4, s.st_blocks);
+       S_ERR(rv<0);
+ 
+     case 29:
+       rv = isatty(get_arg(0));
+       S_ERR(0);
+ 
+     case 199:
+       rv = lseek(get_arg(0), get_arg(1), get_arg(2));
+       if (trace)
+ 	printf("lseek (%d,%d,%d) = %d\n", get_arg(0), get_arg(1), get_arg(2), rv);
+       S_ERR(rv<0);
+ 
+     default:
+       printf("sim_os_trap(%d)\n", which);
+       abort();
+     }
+   return 2;
+ }
+ 
+ 
+ static int
+ sim_dis_read (memaddr, ptr, length, info)
+      bfd_vma memaddr;
+      bfd_byte *ptr;
+      unsigned int length;
+      struct disassemble_info *info;
+ {
+   sim_read (0, memaddr, ptr, length);
+   return 0;
+ }
+ 
+ /* Filter out (in place) symbols that are useless for disassembly.
+    COUNT is the number of elements in SYMBOLS.
+    Return the number of useful symbols. */
+ 
+ static long
+ remove_useless_symbols (symbols, count)
+      asymbol **symbols;
+      long count;
+ {
+   register asymbol **in_ptr = symbols, **out_ptr = symbols;
+ 
+   while (--count >= 0)
+     {
+       asymbol *sym = *in_ptr++;
+ 
+       if (strstr(sym->name, "gcc2_compiled"))
+ 	continue;
+       if (sym->name == NULL || sym->name[0] == '\0')
+ 	continue;
+       if (sym->flags & (BSF_DEBUGGING))
+ 	continue;
+       if (bfd_is_und_section (sym->section)
+ 	  || bfd_is_com_section (sym->section))
+ 	continue;
+ 
+       *out_ptr++ = sym;
+     }
+   return out_ptr - symbols;
+ }
+ 
+ static int 
+ compare_symbols (ap, bp)
+      const PTR ap;
+      const PTR bp;
+ {
+   const asymbol *a = *(const asymbol **)ap;
+   const asymbol *b = *(const asymbol **)bp;
+ 
+   if (bfd_asymbol_value (a) > bfd_asymbol_value (b))
+     return 1;
+   else if (bfd_asymbol_value (a) < bfd_asymbol_value (b))
+     return -1;
+   return 0;
+ }
+ 
+ static char opbuf[1000];
+ 
+ int
+ op_printf(char *buf, char *fmt, ...)
+ {
+   int ret;
+   va_list ap;
+ 
+   va_start (ap, fmt);
+   ret = vsprintf (opbuf+strlen(opbuf), fmt, ap);
+   va_end (ap);
+   return ret;
+ }
+ 
+ void
+ sim_trace_one(pc)
+      int pc;
+ {
+   static int initted = 0;
+   static asymbol **symtab = 0;
+   static int symcount = 0;
+   static int last_sym = -1;
+   static struct disassemble_info info;
+   int storage, sym, bestsym, bestaddr;
+   int min, max, i, pnl;
+   static uae_u32 prevregs[16];
+ 
+   if (current_bfd == 0)
+     return;
+ 
+   if (!initted)
+     {
+       initted = 1;
+       memset(prevregs, 0, sizeof(prevregs));
+       memset(&info, 0, sizeof(info));
+       INIT_DISASSEMBLE_INFO(info, stdout, op_printf);
+       info.read_memory_func = sim_dis_read;
+ 
+       storage = bfd_get_symtab_upper_bound (current_bfd);
+       if (storage > 0)
+ 	{
+ 	  symtab = (asymbol **) xmalloc (storage);
+ 	  symcount = bfd_canonicalize_symtab (current_bfd, symtab);
+ 	  symcount = remove_useless_symbols (symtab, symcount);
+ 	  qsort (symtab, symcount, sizeof(asymbol *), compare_symbols);
+ 	}
+     }
+ 
+   min = -1; max = symcount;
+   while (min < max-1) {
+     bfd_vma sa;
+     sym = (min+max)/2;
+     sa = bfd_asymbol_value (symtab[sym]);
+     /*printf("checking %4d %08x %s\n", sym, sa, bfd_asymbol_name (symtab[sym]));*/
+     if (sa > pc)
+       max = sym;
+     else if (sa < pc)
+       min = sym;
+     else
+       {
+ 	min = sym;
+ 	break;
+       }
+   }
+   bestaddr = bfd_asymbol_value (symtab[min]);
+   if (min != -1 && min != last_sym)
+     {
+       printf("%s", bfd_asymbol_name (symtab[min]));
+       if (bestaddr != pc)
+ 	printf("+%d", pc-bestaddr);
+       printf(":\n");
+       last_sym = min;
+     }
+   opbuf[0] = 0;
+   max = print_insn_m68k(pc, &info);
+   printf("  %8x: ", pc, 0);
+   for (i=0; i<max; i++)
+     printf(" %02x", get_byte(pc+i));
+   for (; i<7; i++)
+     printf("   ");
+   printf("%s", opbuf);
+ 
+   pnl = 0;
+   for (i=0; i<16; i++)
+     if (prevregs[i] != regs.regs[i])
+       {
+ 	if (pnl == 0)
+ 	  printf("\t");
+ 	prevregs[i] = regs.regs[i];
+ 	printf(" r%d=%08x", i, regs.regs[i]);
+ 	pnl = 1;
+       }
+ 
+   printf("\n");
+ }
diff -Nrc3p /dunes/wcohen/virg-netgdb/src/sim/m68k/machdep/m68k.h src/sim/m68k/machdep/m68k.h
*** /dunes/wcohen/virg-netgdb/src/sim/m68k/machdep/m68k.h	Wed Dec 31 19:00:00 1969
--- src/sim/m68k/machdep/m68k.h	Mon Feb 19 14:10:25 2001
***************
*** 0 ****
--- 1,173 ----
+  /* 
+   * UAE - The Un*x Amiga Emulator
+   * 
+   * MC68000 emulation - machine dependent bits
+   *
+   * Copyright 1996 Bernd Schmidt
+   */
+ 
+ #if 0 
+ struct flag_struct {
+     unsigned int c:1; /* first byte */
+     int :5;
+     unsigned int z:1;
+     unsigned int n:1;
+     int :3;           /* second, third & fourth byte */
+     unsigned int v:1; 
+     int :20;
+     unsigned int x:1; /* fifth */
+     int :31;
+ };
+ 
+ #define ZFLG (regflags.z)
+ #define NFLG (regflags.n)
+ #define CFLG (regflags.c)
+ #define VFLG (regflags.v)
+ #define XFLG (regflags.x)
+ 
+ #else
+ 
+ struct flag_struct {
+     unsigned int cznv;
+     unsigned int x;
+ };
+ 
+ #define FLAGVAL_Z 0x40
+ #define FLAGVAL_N 0x80
+ 
+ #define SET_ZFLG(y) (regflags.cznv = (regflags.cznv & ~0x40) | (((y) & 1) << 6))
+ #define SET_CFLG(y) (regflags.cznv = (regflags.cznv & ~1) | ((y) & 1))
+ #define SET_VFLG(y) (regflags.cznv = (regflags.cznv & ~0x800) | (((y) & 1) << 11))
+ #define SET_NFLG(y) (regflags.cznv = (regflags.cznv & ~0x80) | (((y) & 1) << 7))
+ #define SET_XFLG(y) (regflags.x = (y))
+ 
+ #define GET_ZFLG ((regflags.cznv >> 6) & 1)
+ #define GET_CFLG (regflags.cznv & 1)
+ #define GET_VFLG ((regflags.cznv >> 11) & 1)
+ #define GET_NFLG ((regflags.cznv >> 7) & 1)
+ #define GET_XFLG (regflags.x & 1)
+ 
+ #define CLEAR_CZNV (regflags.cznv = 0)
+ #define GET_CZNV (regflags.cznv)
+ #define IOR_CZNV(X) (regflags.cznv |= (X))
+ #define SET_CZNV(X) (regflags.cznv = (X))
+ 
+ #define COPY_CARRY (regflags.x = regflags.cznv)
+ 
+ 
+ #endif
+ 
+ extern struct flag_struct regflags __asm__ ("regflags");
+ 
+ static __inline__ int cctrue(int cc)
+ {
+     uae_u32 cznv = regflags.cznv;
+     switch(cc){
+      case 0: return 1;                       /* T */
+      case 1: return 0;                       /* F */
+      case 2: return (cznv & 0x41) == 0; /* !GET_CFLG && !GET_ZFLG;  HI */
+      case 3: return (cznv & 0x41) != 0; /* GET_CFLG || GET_ZFLG;    LS */
+      case 4: return (cznv & 1) == 0;        /* !GET_CFLG;               CC */
+      case 5: return (cznv & 1) != 0;           /* GET_CFLG;                CS */
+      case 6: return (cznv & 0x40) == 0; /* !GET_ZFLG;               NE */
+      case 7: return (cznv & 0x40) != 0; /* GET_ZFLG;                EQ */
+      case 8: return (cznv & 0x800) == 0;/* !GET_VFLG;               VC */
+      case 9: return (cznv & 0x800) != 0;/* GET_VFLG;                VS */
+      case 10:return (cznv & 0x80) == 0; /* !GET_NFLG;               PL */
+      case 11:return (cznv & 0x80) != 0; /* GET_NFLG;                MI */
+      case 12:return (((cznv << 4) ^ cznv) & 0x800) == 0; /* GET_NFLG == GET_VFLG;             GE */
+      case 13:return (((cznv << 4) ^ cznv) & 0x800) != 0;/* GET_NFLG != GET_VFLG;             LT */
+      case 14:
+ 	cznv &= 0x8c0;
+ 	return (((cznv << 4) ^ cznv) & 0x840) == 0; /* !GET_ZFLG && (GET_NFLG == GET_VFLG);  GT */
+      case 15:
+ 	cznv &= 0x8c0;
+ 	return (((cznv << 4) ^ cznv) & 0x840) != 0; /* GET_ZFLG || (GET_NFLG != GET_VFLG);   LE */
+     }
+     abort();
+     return 0;
+ }
+ 
+ #define optflag_testl(v) \
+   __asm__ __volatile__ ("testl %1,%1\n\t" \
+ 			"pushfl\n\t" \
+ 			"popl %0\n\t" \
+ 			: "=r" (regflags.cznv) : "r" (v) : "cc")
+ 
+ #define optflag_testw(v) \
+   __asm__ __volatile__ ("testw %w1,%w1\n\t" \
+ 			"pushfl\n\t" \
+ 			"popl %0\n\t" \
+ 			: "=r" (regflags.cznv) : "r" (v) : "cc")
+ 
+ #define optflag_testb(v) \
+   __asm__ __volatile__ ("testb %b1,%b1\n\t" \
+ 			"pushfl\n\t" \
+ 			"popl %0\n\t" \
+ 			: "=r" (regflags.cznv) : "q" (v) : "cc")
+ 
+ #define optflag_addl(v, s, d) do { \
+   __asm__ __volatile__ ("addl %k2,%k1\n\t" \
+ 			"pushfl\n\t" \
+ 			"popl %0\n\t" \
+ 			: "=r" (regflags.cznv), "=r" (v) : "rmi" (s), "1" (d) : "cc"); \
+     COPY_CARRY; \
+     } while (0)
+ #define optflag_addw(v, s, d) do { \
+   __asm__ __volatile__ ("addw %w2,%w1\n\t" \
+ 			"pushfl\n\t" \
+ 			"popl %0\n\t" \
+ 			: "=r" (regflags.cznv), "=r" (v) : "rmi" (s), "1" (d) : "cc"); \
+     COPY_CARRY; \
+     } while (0)
+ 
+ #define optflag_addb(v, s, d) do { \
+   __asm__ __volatile__ ("addb %b2,%b1\n\t" \
+ 			"pushfl\n\t" \
+ 			"popl %0\n\t" \
+ 			: "=r" (regflags.cznv), "=q" (v) : "qmi" (s), "1" (d) : "cc"); \
+     COPY_CARRY; \
+     } while (0)
+ 
+ #define optflag_subl(v, s, d) do { \
+   __asm__ __volatile__ ("subl %k2,%k1\n\t" \
+ 			"pushfl\n\t" \
+ 			"popl %0\n\t" \
+ 			: "=r" (regflags.cznv), "=r" (v) : "rmi" (s), "1" (d) : "cc"); \
+     COPY_CARRY; \
+     } while (0)
+ 
+ #define optflag_subw(v, s, d) do { \
+   __asm__ __volatile__ ("subw %w2,%w1\n\t" \
+ 			"pushfl\n\t" \
+ 			"popl %0\n\t" \
+ 			: "=r" (regflags.cznv), "=r" (v) : "rmi" (s), "1" (d) : "cc"); \
+     COPY_CARRY; \
+     } while (0)
+ 
+ #define optflag_subb(v, s, d) do { \
+   __asm__ __volatile__ ("subb %b2,%b1\n\t" \
+ 			"pushfl\n\t" \
+ 			"popl %0\n\t" \
+ 			: "=r" (regflags.cznv), "=q" (v) : "qmi" (s), "1" (d) : "cc"); \
+     COPY_CARRY; \
+     } while (0)
+ 
+ #define optflag_cmpl(s, d) \
+   __asm__ __volatile__ ("cmpl %k1,%k2\n\t" \
+ 			"pushfl\n\t" \
+ 			"popl %0\n\t" \
+ 			: "=r" (regflags.cznv) : "rmi" (s), "r" (d) : "cc")
+ 
+ #define optflag_cmpw(s, d) \
+   __asm__ __volatile__ ("cmpw %w1,%w2\n\t" \
+ 			"pushfl\n\t" \
+ 			"popl %0\n\t" \
+ 			: "=r" (regflags.cznv) : "rmi" (s), "r" (d) : "cc")
+ 
+ #define optflag_cmpb(s, d) \
+   __asm__ __volatile__ ("cmpb %b1,%b2\n\t" \
+ 			"pushfl\n\t" \
+ 			"popl %0\n\t" \
+ 			: "=r" (regflags.cznv) : "qmi" (s), "q" (d) : "cc")
+ 
diff -Nrc3p /dunes/wcohen/virg-netgdb/src/sim/m68k/machdep/maccess.h src/sim/m68k/machdep/maccess.h
*** /dunes/wcohen/virg-netgdb/src/sim/m68k/machdep/maccess.h	Wed Dec 31 19:00:00 1969
--- src/sim/m68k/machdep/maccess.h	Mon Feb 19 14:10:25 2001
***************
*** 0 ****
--- 1,56 ----
+  /* 
+   * UAE - The Un*x Amiga Emulator
+   * 
+   * Memory access functions
+   *
+   * Copyright 1996 Bernd Schmidt
+   */
+ 
+ static __inline__ uae_u32 do_get_mem_long(uae_u32 *a)
+ {
+     uae_u8 *b = (uae_u8 *)a;
+     
+     return (*b << 24) | (*(b+1) << 16) | (*(b+2) << 8) | (*(b+3));
+ }
+ 
+ static __inline__ uae_u16 do_get_mem_word(uae_u16 *a)
+ {
+     uae_u8 *b = (uae_u8 *)a;
+     
+     return (*b << 8) | (*(b+1));
+ }
+ 
+ static __inline__ uae_u8 do_get_mem_byte(uae_u8 *a)
+ {
+     return *a;
+ }
+ 
+ static __inline__ void do_put_mem_long(uae_u32 *a, uae_u32 v)
+ {
+     uae_u8 *b = (uae_u8 *)a;
+     
+     *b = v >> 24;
+     *(b+1) = v >> 16;    
+     *(b+2) = v >> 8;
+     *(b+3) = v;
+ }
+ 
+ static __inline__ void do_put_mem_word(uae_u16 *a, uae_u16 v)
+ {
+     uae_u8 *b = (uae_u8 *)a;
+     
+     *b = v >> 8;
+     *(b+1) = v;
+ }
+ 
+ static __inline__ void do_put_mem_byte(uae_u8 *a, uae_u8 v)
+ {
+     *a = v;
+ }
+ 
+ #define call_mem_get_func(func, addr) ((*func)(addr))
+ #define call_mem_put_func(func, addr, v) ((*func)(addr, v))
+ 
+ #undef NO_INLINE_MEMORY_ACCESS
+ #undef MD_HAVE_MEM_1_FUNCS
+ 
diff -Nrc3p /dunes/wcohen/virg-netgdb/src/sim/m68k/machdep/rpt.h src/sim/m68k/machdep/rpt.h
*** /dunes/wcohen/virg-netgdb/src/sim/m68k/machdep/rpt.h	Wed Dec 31 19:00:00 1969
--- src/sim/m68k/machdep/rpt.h	Mon Feb 19 14:10:25 2001
***************
*** 0 ****
--- 1,18 ----
+ /*
+   * UAE - The Un*x Amiga Emulator
+   *
+   * Definitions for accessing cycle counters on a given machine, if possible.
+   *
+   * Copyright 1997, 1998 Bernd Schmidt
+   */
+ 
+ typedef unsigned long frame_time_t;
+ 
+ static inline frame_time_t read_processor_time (void)
+ {
+     frame_time_t foo;
+     int dummy;
+     /* Don't assume the assembler knows rdtsc */
+     __asm__ __volatile__ (".byte 0x0f,0x31" : "=a" (foo), "=d" (dummy) :);
+     return foo;
+ }
diff -Nrc3p /dunes/wcohen/virg-netgdb/src/sim/m68k/md-fpp.h src/sim/m68k/md-fpp.h
*** /dunes/wcohen/virg-netgdb/src/sim/m68k/md-fpp.h	Wed Dec 31 19:00:00 1969
--- src/sim/m68k/md-fpp.h	Mon Feb 19 14:10:25 2001
***************
*** 0 ****
--- 1,139 ----
+  /*
+   * UAE - The Un*x Amiga Emulator
+   *
+   * MC68881 emulation
+   *
+   * Conversion routines for hosts with unknown floating point format.
+   *
+   * Copyright 1996 Herman ten Brugge
+   */
+ 
+ #ifndef HAVE_to_single
+ STATIC_INLINE double to_single (uae_u32 value)
+ {
+     double frac;
+ 
+     if ((value & 0x7fffffff) == 0)
+         return (0.0);
+     frac = (double) ((value & 0x7fffff) | 0x800000) / 8388608.0;
+     if (value & 0x80000000)
+         frac = -frac;
+     return (ldexp (frac, ((value >> 23) & 0xff) - 127));
+ }
+ #endif
+ 
+ #ifndef HAVE_from_single
+ STATIC_INLINE uae_u32 from_single (double src)
+ {
+     int expon;
+     uae_u32 tmp;
+     double frac;
+ 
+     if (src == 0.0)
+         return 0;
+     if (src < 0) {
+         tmp = 0x80000000;
+         src = -src;
+     } else {
+         tmp = 0;
+     }
+     frac = frexp (src, &expon);
+     frac += 0.5 / 16777216.0;
+     if (frac >= 1.0) {
+         frac /= 2.0;
+         expon++;
+     }
+     return (tmp | (((expon + 127 - 1) & 0xff) << 23) |
+             (((int) (frac * 16777216.0)) & 0x7fffff));
+ }
+ #endif
+ 
+ #ifndef HAVE_to_exten
+ STATIC_INLINE double to_exten(uae_u32 wrd1, uae_u32 wrd2, uae_u32 wrd3)
+ {
+     double frac;
+ 
+     if ((wrd1 & 0x7fff0000) == 0 && wrd2 == 0 && wrd3 == 0)
+         return 0.0;
+     frac = (double) wrd2 / 2147483648.0 +
+         (double) wrd3 / 9223372036854775808.0;
+     if (wrd1 & 0x80000000)
+         frac = -frac;
+     return ldexp (frac, ((wrd1 >> 16) & 0x7fff) - 16383);
+ }
+ #endif
+ 
+ #ifndef HAVE_from_exten
+ STATIC_INLINE void from_exten(double src, uae_u32 * wrd1, uae_u32 * wrd2, uae_u32 * wrd3)
+ {
+     int expon;
+     double frac;
+ 
+     if (src == 0.0) {
+         *wrd1 = 0;
+         *wrd2 = 0;
+         *wrd3 = 0;
+         return;
+     }
+     if (src < 0) {
+         *wrd1 = 0x80000000;
+         src = -src;
+     } else {
+         *wrd1 = 0;
+     }
+     frac = frexp (src, &expon);
+     frac += 0.5 / 18446744073709551616.0;
+     if (frac >= 1.0) {
+         frac /= 2.0;
+         expon++;
+     }
+     *wrd1 |= (((expon + 16383 - 1) & 0x7fff) << 16);
+     *wrd2 = (uae_u32) (frac * 4294967296.0);
+     *wrd3 = (uae_u32) (frac * 18446744073709551616.0 - *wrd2 * 4294967296.0);
+ }
+ #endif
+ 
+ #ifndef HAVE_to_double
+ STATIC_INLINE double to_double(uae_u32 wrd1, uae_u32 wrd2)
+ {
+     double frac;
+ 
+     if ((wrd1 & 0x7fffffff) == 0 && wrd2 == 0)
+         return 0.0;
+     frac = (double) ((wrd1 & 0xfffff) | 0x100000) / 1048576.0 +
+         (double) wrd2 / 4503599627370496.0;
+     if (wrd1 & 0x80000000)
+         frac = -frac;
+     return ldexp (frac, ((wrd1 >> 20) & 0x7ff) - 1023);
+ }
+ #endif
+ 
+ #ifndef HAVE_from_double
+ STATIC_INLINE void from_double(double src, uae_u32 * wrd1, uae_u32 * wrd2)
+ {
+     int expon;
+     int tmp;
+     double frac;
+ 
+     if (src == 0.0) {
+         *wrd1 = 0;
+         *wrd2 = 0;
+         return;
+     }
+     if (src < 0) {
+         *wrd1 = 0x80000000;
+         src = -src;
+     } else {
+         *wrd1 = 0;
+     }
+     frac = frexp (src, &expon);
+     frac += 0.5 / 9007199254740992.0;
+     if (frac >= 1.0) {
+         frac /= 2.0;
+         expon++;
+     }
+     tmp = (uae_u32) (frac * 2097152.0);
+     *wrd1 |= (((expon + 1023 - 1) & 0x7ff) << 20) | (tmp & 0xfffff);
+     *wrd2 = (uae_u32) (frac * 9007199254740992.0 - tmp * 4294967296.0);
+ }
+ #endif
diff -Nrc3p /dunes/wcohen/virg-netgdb/src/sim/m68k/memory.c src/sim/m68k/memory.c
*** /dunes/wcohen/virg-netgdb/src/sim/m68k/memory.c	Wed Dec 31 19:00:00 1969
--- src/sim/m68k/memory.c	Mon Feb 19 14:10:25 2001
***************
*** 0 ****
--- 1,296 ----
+  /*
+   * UAE - The Un*x Amiga Emulator
+   *
+   * Memory management
+   *
+   * (c) 1995 Bernd Schmidt
+   */
+ 
+ #include "sysconfig.h"
+ #include "sysdeps.h"
+ 
+ #include "config.h"
+ #include "options.h"
+ #include "uae.h"
+ #include "memory.h"
+ #include "ersatz.h"
+ #include "zfile.h"
+ 
+ #ifdef USE_MAPPED_MEMORY
+ #include <sys/mman.h>
+ #endif
+ 
+ /* Set by each memory handler that does not simply access real memory.  */
+ int special_mem;
+ 
+ int ersatzkickfile = 0;
+ 
+ uae_u32 allocated_chipmem;
+ 
+ #ifdef SAVE_MEMORY_BANKS
+ addrbank *mem_banks[65536];
+ #else
+ addrbank mem_banks[65536];
+ #endif
+ 
+ #ifdef NO_INLINE_MEMORY_ACCESS
+ __inline__ uae_u32 longget (uaecptr addr)
+ {
+     return call_mem_get_func (get_mem_bank (addr).lget, addr);
+ }
+ __inline__ uae_u32 wordget (uaecptr addr)
+ {
+     return call_mem_get_func (get_mem_bank (addr).wget, addr);
+ }
+ __inline__ uae_u32 byteget (uaecptr addr)
+ {
+     return call_mem_get_func (get_mem_bank (addr).bget, addr);
+ }
+ __inline__ void longput (uaecptr addr, uae_u32 l)
+ {
+     call_mem_put_func (get_mem_bank (addr).lput, addr, l);
+ }
+ __inline__ void wordput (uaecptr addr, uae_u32 w)
+ {
+     call_mem_put_func (get_mem_bank (addr).wput, addr, w);
+ }
+ __inline__ void byteput (uaecptr addr, uae_u32 b)
+ {
+     call_mem_put_func (get_mem_bank (addr).bput, addr, b);
+ }
+ #endif
+ 
+ uae_u32 chipmem_mask;
+ 
+ /* A dummy bank that only contains zeros */
+ 
+ static uae_u32 dummy_lget (uaecptr) REGPARAM;
+ static uae_u32 dummy_wget (uaecptr) REGPARAM;
+ static uae_u32 dummy_bget (uaecptr) REGPARAM;
+ static void dummy_lput (uaecptr, uae_u32) REGPARAM;
+ static void dummy_wput (uaecptr, uae_u32) REGPARAM;
+ static void dummy_bput (uaecptr, uae_u32) REGPARAM;
+ static int dummy_check (uaecptr addr, uae_u32 size) REGPARAM;
+ 
+ uae_u32 REGPARAM2 dummy_lget (uaecptr addr)
+ {
+     special_mem |= S_READ;
+     if (currprefs.illegal_mem)
+ 	write_log ("Illegal lget at %08lx\n", addr);
+ 
+     return 0;
+ }
+ 
+ uae_u32 REGPARAM2 dummy_wget (uaecptr addr)
+ {
+     special_mem |= S_READ;
+     if (currprefs.illegal_mem)
+ 	write_log ("Illegal wget at %08lx\n", addr);
+ 
+     return 0;
+ }
+ 
+ uae_u32 REGPARAM2 dummy_bget (uaecptr addr)
+ {
+     special_mem |= S_READ;
+     if (currprefs.illegal_mem)
+ 	write_log ("Illegal bget at %08lx\n", addr);
+ 
+     return 0;
+ }
+ 
+ void REGPARAM2 dummy_lput (uaecptr addr, uae_u32 l)
+ {
+     special_mem |= S_WRITE;
+     if (currprefs.illegal_mem)
+ 	write_log ("Illegal lput at %08lx\n", addr);
+ }
+ void REGPARAM2 dummy_wput (uaecptr addr, uae_u32 w)
+ {
+     special_mem |= S_WRITE;
+     if (currprefs.illegal_mem)
+ 	write_log ("Illegal wput at %08lx\n", addr);
+ }
+ void REGPARAM2 dummy_bput (uaecptr addr, uae_u32 b)
+ {
+     special_mem |= S_WRITE;
+     if (currprefs.illegal_mem)
+ 	write_log ("Illegal bput at %08lx\n", addr);
+ }
+ 
+ int REGPARAM2 dummy_check (uaecptr addr, uae_u32 size)
+ {
+     if (currprefs.illegal_mem)
+ 	write_log ("Illegal check at %08lx\n", addr);
+ 
+     return 0;
+ }
+ 
+ /* Chip memory */
+ 
+ uae_u8 *chipmemory;
+ 
+ static int chipmem_check (uaecptr addr, uae_u32 size) REGPARAM;
+ static uae_u8 *chipmem_xlate (uaecptr addr) REGPARAM;
+ 
+ uae_u32 REGPARAM2 chipmem_lget (uaecptr addr)
+ {
+     uae_u32 *m;
+ 
+     addr -= chipmem_start & chipmem_mask;
+     addr &= chipmem_mask;
+     m = (uae_u32 *)(chipmemory + addr);
+     return do_get_mem_long (m);
+ }
+ 
+ uae_u32 REGPARAM2 chipmem_wget (uaecptr addr)
+ {
+     uae_u16 *m;
+ 
+     addr -= chipmem_start & chipmem_mask;
+     addr &= chipmem_mask;
+     m = (uae_u16 *)(chipmemory + addr);
+     return do_get_mem_word (m);
+ }
+ 
+ uae_u32 REGPARAM2 chipmem_bget (uaecptr addr)
+ {
+     addr -= chipmem_start & chipmem_mask;
+     addr &= chipmem_mask;
+     return chipmemory[addr];
+ }
+ 
+ void REGPARAM2 chipmem_lput (uaecptr addr, uae_u32 l)
+ {
+     uae_u32 *m;
+ 
+     addr -= chipmem_start & chipmem_mask;
+     addr &= chipmem_mask;
+     m = (uae_u32 *)(chipmemory + addr);
+     do_put_mem_long (m, l);
+ }
+ 
+ void REGPARAM2 chipmem_wput (uaecptr addr, uae_u32 w)
+ {
+     uae_u16 *m;
+ 
+     addr -= chipmem_start & chipmem_mask;
+     addr &= chipmem_mask;
+     m = (uae_u16 *)(chipmemory + addr);
+     do_put_mem_word (m, w);
+ }
+ 
+ void REGPARAM2 chipmem_bput (uaecptr addr, uae_u32 b)
+ {
+     addr -= chipmem_start & chipmem_mask;
+     addr &= chipmem_mask;
+     chipmemory[addr] = b;
+ }
+ 
+ int REGPARAM2 chipmem_check (uaecptr addr, uae_u32 size)
+ {
+     addr -= chipmem_start & chipmem_mask;
+     addr &= chipmem_mask;
+     return (addr + size) <= allocated_chipmem;
+ }
+ 
+ uae_u8 REGPARAM2 *chipmem_xlate (uaecptr addr)
+ {
+     addr -= chipmem_start & chipmem_mask;
+     addr &= chipmem_mask;
+     return chipmemory + addr;
+ }
+ 
+ /* Default memory access functions */
+ 
+ int REGPARAM2 default_check (uaecptr a, uae_u32 b)
+ {
+     return 0;
+ }
+ 
+ uae_u8 REGPARAM2 *default_xlate (uaecptr a)
+ {
+     write_log ("Your m68k program just did something terribly stupid\n");
+     uae_reset();
+     abort();
+ }
+ 
+ static int load_kickstart (void)
+ {
+   /* NOTE No need for this code */
+ }
+ 
+ /* Address banks */
+ 
+ addrbank dummy_bank = {
+     dummy_lget, dummy_wget, dummy_bget,
+     dummy_lput, dummy_wput, dummy_bput,
+     default_xlate, dummy_check
+ };
+ 
+ addrbank chipmem_bank = {
+     chipmem_lget, chipmem_wget, chipmem_bget,
+     chipmem_lput, chipmem_wput, chipmem_bput,
+     chipmem_xlate, chipmem_check
+ };
+ 
+ char *address_space, *good_address_map;
+ int good_address_fd;
+ 
+ static void init_mem_banks (void)
+ {
+     int i;
+     for (i = 0; i < 65536; i++)
+ 	put_mem_bank (i<<16, &dummy_bank);
+ }
+ 
+ #define MAKE_USER_PROGRAMS_BEHAVE 1
+ void memory_init (void)
+ {
+     char buffer[4096];
+     char *nam;
+     int i, fd;
+     int custom_start;
+ 
+     allocated_chipmem = currprefs.chipmem_size;
+ 
+     chipmemory = (uae_u8 *)malloc (allocated_chipmem);
+ 
+     while (! chipmemory && allocated_chipmem > 512*1024) {
+ 	allocated_chipmem >>= 1;
+ 	chipmemory = (uae_u8 *)malloc (allocated_chipmem);
+ 	if (chipmemory)
+ 	    fprintf (stderr, "Reducing chipmem size to %dkb\n", allocated_chipmem >> 10);
+     }
+     if (! chipmemory) {
+ 	write_log ("virtual memory exhausted (chipmemory)!\n");
+ 	abort ();
+     }
+ 
+     do_put_mem_long ((uae_u32 *)(chipmemory + 4), 0);
+     init_mem_banks ();
+ 
+     /* Map the chipmem into all of the lower 16MB */
+     map_banks (&chipmem_bank, 0x8000, allocated_chipmem>>16);
+ 
+     /* NOTE Do we care about the following? -WEC */
+     chipmem_mask = allocated_chipmem- 1;
+ }
+ 
+ void map_banks (addrbank *bank, int start, int size)
+ {
+     int bnr;
+     unsigned long int hioffs = 0, endhioffs = 0x100;
+ 
+     if (start >= 0x100) {
+ 	for (bnr = start; bnr < start + size; bnr++)
+ 	    put_mem_bank (bnr << 16, bank);
+ 	return;
+     }
+     /* Some '020 Kickstarts apparently require a 24 bit address space... */
+     if (currprefs.address_space_24)
+ 	endhioffs = 0x10000;
+     for (hioffs = 0; hioffs < endhioffs; hioffs += 0x100)
+ 	for (bnr = start; bnr < start+size; bnr++)
+ 	    put_mem_bank ((bnr + hioffs) << 16, bank);
+ }
diff -Nrc3p /dunes/wcohen/virg-netgdb/src/sim/m68k/missing.c src/sim/m68k/missing.c
*** /dunes/wcohen/virg-netgdb/src/sim/m68k/missing.c	Wed Dec 31 19:00:00 1969
--- src/sim/m68k/missing.c	Tue Feb 27 10:41:54 2001
***************
*** 0 ****
--- 1,36 ----
+  /*
+   * UAE - The Un*x Amiga Emulator
+   *
+   * Various stuff missing in some OSes.
+   *
+   * Copyright 1997 Bernd Schmidt
+   */
+ 
+ #include "sysconfig.h"
+ #include "sysdeps.h"
+ 
+ #include "config.h"
+ #include "options.h"
+ #include "uae.h"
+ 
+ #ifndef HAVE_STRDUP
+ 
+ char *my_strdup (const char *s)
+ {
+     /* The casts to char * are there to shut up the compiler on HPUX */
+     char *x = (char*)xmalloc(strlen((char *)s) + 1);
+     strcpy(x, (char *)s);
+     return x;
+ }
+ 
+ #endif
+ 
+ void *xmalloc(size_t n)
+ {
+     void *a = malloc (n);
+     if (a == NULL) {
+ 	fprintf (stderr, "virtual memory exhausted\n");
+ 	abort ();
+     }
+     return a;
+ }
diff -Nrc3p /dunes/wcohen/virg-netgdb/src/sim/m68k/newcpu.c src/sim/m68k/newcpu.c
*** /dunes/wcohen/virg-netgdb/src/sim/m68k/newcpu.c	Wed Dec 31 19:00:00 1969
--- src/sim/m68k/newcpu.c	Tue Feb 27 09:32:58 2001
***************
*** 0 ****
--- 1,1560 ----
+  /*
+   * UAE - The Un*x Amiga Emulator
+   *
+   * MC68000 emulation
+   *
+   * (c) 1995 Bernd Schmidt
+   */
+ 
+ #include "sysconfig.h"
+ #include "sysdeps.h"
+ 
+ #include "config.h"
+ #include "options.h"
+ 
+ #include "uae.h"
+ #include "memory.h"
+ #include "custom.h"
+ #include "newcpu.h"
+ #include "autoconf.h"
+ #include "ersatz.h"
+ #include "debug.h"
+ #include "compiler.h"
+ 
+ 
+ /* Opcode of faulting instruction */
+ uae_u16 last_op_for_exception_3;
+ /* PC at fault time */
+ uaecptr last_addr_for_exception_3;
+ /* Address that generated the exception */
+ uaecptr last_fault_for_exception_3;
+ 
+ int areg_byteinc[] = { 1,1,1,1,1,1,1,2 };
+ int imm8_table[] = { 8,1,2,3,4,5,6,7 };
+ 
+ int movem_index1[256];
+ int movem_index2[256];
+ int movem_next[256];
+ 
+ int fpp_movem_index1[256];
+ int fpp_movem_index2[256];
+ int fpp_movem_next[256];
+ 
+ cpuop_func *cpufunctbl[65536];
+ 
+ #define COUNT_INSTRS 0
+ 
+ #if COUNT_INSTRS
+ static unsigned long int instrcount[65536];
+ static uae_u16 opcodenums[65536];
+ 
+ static int compfn (const void *el1, const void *el2)
+ {
+     return instrcount[*(const uae_u16 *)el1] < instrcount[*(const uae_u16 *)el2];
+ }
+ 
+ static char *icountfilename (void)
+ {
+     char *name = getenv ("INSNCOUNT");
+     if (name)
+ 	return name;
+     return COUNT_INSTRS == 2 ? "frequent.68k" : "insncount";
+ }
+ 
+ void dump_counts (void)
+ {
+     FILE *f = fopen (icountfilename (), "w");
+     unsigned long int total;
+     int i;
+ 
+     write_log ("Writing instruction count file...\n");
+     for (i = 0; i < 65536; i++) {
+ 	opcodenums[i] = i;
+ 	total += instrcount[i];
+     }
+     qsort (opcodenums, 65536, sizeof(uae_u16), compfn);
+ 
+     fprintf (f, "Total: %lu\n", total);
+     for (i=0; i < 65536; i++) {
+ 	unsigned long int cnt = instrcount[opcodenums[i]];
+ 	struct instr *dp;
+ 	struct mnemolookup *lookup;
+ 	if (!cnt)
+ 	    break;
+ 	dp = table68k + opcodenums[i];
+ 	for (lookup = lookuptab;lookup->mnemo != dp->mnemo; lookup++)
+ 	    ;
+ 	fprintf (f, "%04x: %lu %s\n", opcodenums[i], cnt, lookup->name);
+     }
+     fclose (f);
+ }
+ #else
+ void dump_counts (void)
+ {
+ }
+ #endif
+ 
+ int broken_in;
+ 
+ static unsigned long op_illg_1 (uae_u32 opcode) REGPARAM;
+ 
+ static unsigned long REGPARAM2 op_illg_1 (uae_u32 opcode)
+ {
+     if (opcode == 0x4afc) {
+       int code = get_iword(2);
+       sim_os_trap(code);
+       m68k_incpc (4);
+       return 4;
+     }
+     op_illg (opcode);
+     return 4;
+ }
+ 
+ static void build_cpufunctbl (void)
+ {
+     int i;
+     unsigned long opcode;
+     struct cputbl *tbl = (currprefs.cpu_level == 4 ? op_smalltbl_0_ff
+ 			  : currprefs.cpu_level == 3 ? op_smalltbl_1_ff
+ 			  : currprefs.cpu_level == 2 ? op_smalltbl_2_ff
+ 			  : currprefs.cpu_level == 1 ? op_smalltbl_3_ff
+ 			  : ! currprefs.cpu_compatible ? op_smalltbl_4_ff
+ 			  : op_smalltbl_5_ff);
+ 
+ #if 0
+     write_log ("Building CPU function table (%d %d %d).\n",
+ 	       currprefs.cpu_level, currprefs.cpu_compatible, currprefs.address_space_24);
+ #endif
+ 
+     for (opcode = 0; opcode < 65536; opcode++)
+ 	cpufunctbl[opcode] = op_illg_1;
+     for (i = 0; tbl[i].handler != NULL; i++) {
+ 	if (! tbl[i].specific)
+ 	    cpufunctbl[tbl[i].opcode] = tbl[i].handler;
+     }
+     for (opcode = 0; opcode < 65536; opcode++) {
+ 	cpuop_func *f;
+ 
+ 	if (table68k[opcode].mnemo == i_ILLG || table68k[opcode].clev > currprefs.cpu_level)
+ 	    continue;
+ 
+ 	if (table68k[opcode].handler != -1) {
+ 	    f = cpufunctbl[table68k[opcode].handler];
+ 	    if (f == op_illg_1)
+ 		abort();
+ 	    cpufunctbl[opcode] = f;
+ 	}
+     }
+     for (i = 0; tbl[i].handler != NULL; i++) {
+ 	if (tbl[i].specific)
+ 	    cpufunctbl[tbl[i].opcode] = tbl[i].handler;
+     }
+ }
+ 
+ unsigned long cycles_mask, cycles_val;
+ 
+ static void update_68k_cycles (void)
+ {
+     cycles_mask = 0;
+     cycles_val = currprefs.m68k_speed;
+     if (currprefs.m68k_speed < 1) {
+ 	cycles_mask = 0xFFFFFFFF;
+ 	cycles_val = 0;
+     }
+ }
+ 
+ #if !CYGNUS_SIM
+ void check_prefs_changed_cpu (void)
+ {
+     if (currprefs.cpu_level != changed_prefs.cpu_level
+ 	|| currprefs.cpu_compatible != changed_prefs.cpu_compatible) {
+ 	currprefs.cpu_level = changed_prefs.cpu_level;
+ 	currprefs.cpu_compatible = changed_prefs.cpu_compatible;
+ 	build_cpufunctbl ();
+     }
+     if (currprefs.m68k_speed != changed_prefs.m68k_speed) {
+ 	currprefs.m68k_speed = changed_prefs.m68k_speed;
+ 	reset_frame_rate_hack ();
+ 	update_68k_cycles ();
+     }
+ }
+ #endif
+ 
+ void init_m68k (void)
+ {
+     int i;
+ 
+     update_68k_cycles ();
+ 
+     for (i = 0 ; i < 256 ; i++) {
+ 	int j;
+ 	for (j = 0 ; j < 8 ; j++) {
+ 		if (i & (1 << j)) break;
+ 	}
+ 	movem_index1[i] = j;
+ 	movem_index2[i] = 7-j;
+ 	movem_next[i] = i & (~(1 << j));
+     }
+     for (i = 0 ; i < 256 ; i++) {
+ 	int j;
+ 	for (j = 7 ; j >= 0 ; j--) {
+ 		if (i & (1 << j)) break;
+ 	}
+ 	fpp_movem_index1[i] = 7-j;
+ 	fpp_movem_index2[i] = j;
+ 	fpp_movem_next[i] = i & (~(1 << j));
+     }
+ #if COUNT_INSTRS
+     {
+ 	FILE *f = fopen (icountfilename (), "r");
+ 	memset (instrcount, 0, sizeof instrcount);
+ 	if (f) {
+ 	    uae_u32 opcode, count, total;
+ 	    char name[20];
+ 	    write_log ("Reading instruction count file...\n");
+ 	    fscanf (f, "Total: %lu\n", &total);
+ 	    while (fscanf (f, "%lx: %lu %s\n", &opcode, &count, name) == 3) {
+ 		instrcount[opcode] = count;
+ 	    }
+ 	    fclose(f);
+ 	}
+     }
+ #endif
+     if (0)
+       {
+ 	write_log ("Building CPU table for configuration: 68");
+ 	if (currprefs.address_space_24 && currprefs.cpu_level > 1)
+ 	  write_log ("EC");
+ 	switch (currprefs.cpu_level) {
+ 	case 1:
+ 	  write_log ("010");
+ 	  break;
+ 	case 2:
+ 	  write_log ("020");
+ 	  break;
+ 	case 3:
+ 	  write_log ("020/881");
+ 	  break;
+ 	case 4:
+ 	  /* Who is going to miss the MMU anyway...? :-)  */
+ 	  write_log ("040");
+ 	  break;
+ 	default:
+ 	  write_log ("000");
+ 	  break;
+ 	}
+ 	if (currprefs.cpu_compatible)
+ 	  write_log (" (compatible mode)");
+ 	write_log ("\n");
+       }
+     
+     read_table68k ();
+     do_merges ();
+ 
+ #if 0
+     write_log ("%d CPU functions\n", nr_cpuop_funcs);
+ #endif
+ 
+     build_cpufunctbl ();
+ #if 0
+     write_log ("done.\n");
+ #endif
+ }
+ 
+ struct regstruct regs, lastint_regs;
+ static struct regstruct regs_backup[16];
+ static int backup_pointer = 0;
+ static long int m68kpc_offset;
+ int lastint_no;
+ 
+ #define get_ibyte_1(o) get_byte(regs.pc + (regs.pc_p - regs.pc_oldp) + (o) + 1)
+ #define get_iword_1(o) get_word(regs.pc + (regs.pc_p - regs.pc_oldp) + (o))
+ #define get_ilong_1(o) get_long(regs.pc + (regs.pc_p - regs.pc_oldp) + (o))
+ 
+ uae_s32 ShowEA (FILE *f, int reg, amodes mode, wordsizes size, char *buf)
+ {
+     uae_u16 dp;
+     uae_s8 disp8;
+     uae_s16 disp16;
+     int r;
+     uae_u32 dispreg;
+     uaecptr addr;
+     uae_s32 offset = 0;
+     char buffer[80];
+ 
+     switch (mode){
+      case Dreg:
+ 	sprintf (buffer,"D%d", reg);
+ 	break;
+      case Areg:
+ 	sprintf (buffer,"A%d", reg);
+ 	break;
+      case Aind:
+ 	sprintf (buffer,"(A%d)", reg);
+ 	break;
+      case Aipi:
+ 	sprintf (buffer,"(A%d)+", reg);
+ 	break;
+      case Apdi:
+ 	sprintf (buffer,"-(A%d)", reg);
+ 	break;
+      case Ad16:
+ 	disp16 = get_iword_1 (m68kpc_offset); m68kpc_offset += 2;
+ 	addr = m68k_areg(regs,reg) + (uae_s16)disp16;
+ 	sprintf (buffer,"(A%d,$%04x) == $%08lx", reg, disp16 & 0xffff,
+ 					(unsigned long)addr);
+ 	break;
+      case Ad8r:
+ 	dp = get_iword_1 (m68kpc_offset); m68kpc_offset += 2;
+ 	disp8 = dp & 0xFF;
+ 	r = (dp & 0x7000) >> 12;
+ 	dispreg = dp & 0x8000 ? m68k_areg(regs,r) : m68k_dreg(regs,r);
+ 	if (!(dp & 0x800)) dispreg = (uae_s32)(uae_s16)(dispreg);
+ 	dispreg <<= (dp >> 9) & 3;
+ 
+ 	if (dp & 0x100) {
+ 	    uae_s32 outer = 0, disp = 0;
+ 	    uae_s32 base = m68k_areg(regs,reg);
+ 	    char name[10];
+ 	    sprintf (name,"A%d, ",reg);
+ 	    if (dp & 0x80) { base = 0; name[0] = 0; }
+ 	    if (dp & 0x40) dispreg = 0;
+ 	    if ((dp & 0x30) == 0x20) { disp = (uae_s32)(uae_s16)get_iword_1 (m68kpc_offset); m68kpc_offset += 2; }
+ 	    if ((dp & 0x30) == 0x30) { disp = get_ilong_1 (m68kpc_offset); m68kpc_offset += 4; }
+ 	    base += disp;
+ 
+ 	    if ((dp & 0x3) == 0x2) { outer = (uae_s32)(uae_s16)get_iword_1 (m68kpc_offset); m68kpc_offset += 2; }
+ 	    if ((dp & 0x3) == 0x3) { outer = get_ilong_1 (m68kpc_offset); m68kpc_offset += 4; }
+ 
+ 	    if (!(dp & 4)) base += dispreg;
+ 	    if (dp & 3) base = get_long (base);
+ 	    if (dp & 4) base += dispreg;
+ 
+ 	    addr = base + outer;
+ 	    sprintf (buffer,"(%s%c%d.%c*%d+%ld)+%ld == $%08lx", name,
+ 		    dp & 0x8000 ? 'A' : 'D', (int)r, dp & 0x800 ? 'L' : 'W',
+ 		    1 << ((dp >> 9) & 3),
+ 		    disp,outer,
+ 		    (unsigned long)addr);
+ 	} else {
+ 	  addr = m68k_areg(regs,reg) + (uae_s32)((uae_s8)disp8) + dispreg;
+ 	  sprintf (buffer,"(A%d, %c%d.%c*%d, $%02x) == $%08lx", reg,
+ 	       dp & 0x8000 ? 'A' : 'D', (int)r, dp & 0x800 ? 'L' : 'W',
+ 	       1 << ((dp >> 9) & 3), disp8,
+ 	       (unsigned long)addr);
+ 	}
+ 	break;
+      case PC16:
+ 	addr = m68k_getpc () + m68kpc_offset;
+ 	disp16 = get_iword_1 (m68kpc_offset); m68kpc_offset += 2;
+ 	addr += (uae_s16)disp16;
+ 	sprintf (buffer,"(PC,$%04x) == $%08lx", disp16 & 0xffff,(unsigned long)addr);
+ 	break;
+      case PC8r:
+ 	addr = m68k_getpc () + m68kpc_offset;
+ 	dp = get_iword_1 (m68kpc_offset); m68kpc_offset += 2;
+ 	disp8 = dp & 0xFF;
+ 	r = (dp & 0x7000) >> 12;
+ 	dispreg = dp & 0x8000 ? m68k_areg(regs,r) : m68k_dreg(regs,r);
+ 	if (!(dp & 0x800)) dispreg = (uae_s32)(uae_s16)(dispreg);
+ 	dispreg <<= (dp >> 9) & 3;
+ 
+ 	if (dp & 0x100) {
+ 	    uae_s32 outer = 0,disp = 0;
+ 	    uae_s32 base = addr;
+ 	    char name[10];
+ 	    sprintf (name,"PC, ");
+ 	    if (dp & 0x80) { base = 0; name[0] = 0; }
+ 	    if (dp & 0x40) dispreg = 0;
+ 	    if ((dp & 0x30) == 0x20) { disp = (uae_s32)(uae_s16)get_iword_1 (m68kpc_offset); m68kpc_offset += 2; }
+ 	    if ((dp & 0x30) == 0x30) { disp = get_ilong_1 (m68kpc_offset); m68kpc_offset += 4; }
+ 	    base += disp;
+ 
+ 	    if ((dp & 0x3) == 0x2) { outer = (uae_s32)(uae_s16)get_iword_1 (m68kpc_offset); m68kpc_offset += 2; }
+ 	    if ((dp & 0x3) == 0x3) { outer = get_ilong_1 (m68kpc_offset); m68kpc_offset += 4; }
+ 
+ 	    if (!(dp & 4)) base += dispreg;
+ 	    if (dp & 3) base = get_long (base);
+ 	    if (dp & 4) base += dispreg;
+ 
+ 	    addr = base + outer;
+ 	    sprintf (buffer,"(%s%c%d.%c*%d+%ld)+%ld == $%08lx", name,
+ 		    dp & 0x8000 ? 'A' : 'D', (int)r, dp & 0x800 ? 'L' : 'W',
+ 		    1 << ((dp >> 9) & 3),
+ 		    disp,outer,
+ 		    (unsigned long)addr);
+ 	} else {
+ 	  addr += (uae_s32)((uae_s8)disp8) + dispreg;
+ 	  sprintf (buffer,"(PC, %c%d.%c*%d, $%02x) == $%08lx", dp & 0x8000 ? 'A' : 'D',
+ 		(int)r, dp & 0x800 ? 'L' : 'W',  1 << ((dp >> 9) & 3),
+ 		disp8, (unsigned long)addr);
+ 	}
+ 	break;
+      case absw:
+ 	sprintf (buffer,"$%08lx", (unsigned long)(uae_s32)(uae_s16)get_iword_1 (m68kpc_offset));
+ 	m68kpc_offset += 2;
+ 	break;
+      case absl:
+ 	sprintf (buffer,"$%08lx", (unsigned long)get_ilong_1 (m68kpc_offset));
+ 	m68kpc_offset += 4;
+ 	break;
+      case imm:
+ 	switch (size){
+ 	 case sz_byte:
+ 	    sprintf (buffer,"#$%02x", (unsigned int)(get_iword_1 (m68kpc_offset) & 0xff));
+ 	    m68kpc_offset += 2;
+ 	    break;
+ 	 case sz_word:
+ 	    sprintf (buffer,"#$%04x", (unsigned int)(get_iword_1 (m68kpc_offset) & 0xffff));
+ 	    m68kpc_offset += 2;
+ 	    break;
+ 	 case sz_long:
+ 	    sprintf (buffer,"#$%08lx", (unsigned long)(get_ilong_1 (m68kpc_offset)));
+ 	    m68kpc_offset += 4;
+ 	    break;
+ 	 default:
+ 	    break;
+ 	}
+ 	break;
+      case imm0:
+ 	offset = (uae_s32)(uae_s8)get_iword_1 (m68kpc_offset);
+ 	m68kpc_offset += 2;
+ 	sprintf (buffer,"#$%02x", (unsigned int)(offset & 0xff));
+ 	break;
+      case imm1:
+ 	offset = (uae_s32)(uae_s16)get_iword_1 (m68kpc_offset);
+ 	m68kpc_offset += 2;
+ 	sprintf (buffer,"#$%04x", (unsigned int)(offset & 0xffff));
+ 	break;
+      case imm2:
+ 	offset = (uae_s32)get_ilong_1 (m68kpc_offset);
+ 	m68kpc_offset += 4;
+ 	sprintf (buffer,"#$%08lx", (unsigned long)offset);
+ 	break;
+      case immi:
+ 	offset = (uae_s32)(uae_s8)(reg & 0xff);
+ 	sprintf (buffer,"#$%08lx", (unsigned long)offset);
+ 	break;
+      default:
+ 	break;
+     }
+     if (buf == 0)
+ 	fprintf (f, "%s", buffer);
+     else
+ 	strcat (buf, buffer);
+     return offset;
+ }
+ 
+ /* The plan is that this will take over the job of exception 3 handling -
+  * the CPU emulation functions will just do a longjmp to m68k_go whenever
+  * they hit an odd address. */
+ static int verify_ea (int reg, amodes mode, wordsizes size, uae_u32 *val)
+ {
+     uae_u16 dp;
+     uae_s8 disp8;
+     uae_s16 disp16;
+     int r;
+     uae_u32 dispreg;
+     uaecptr addr;
+     uae_s32 offset = 0;
+ 
+     switch (mode){
+      case Dreg:
+ 	*val = m68k_dreg (regs, reg);
+ 	return 1;
+      case Areg:
+ 	*val = m68k_areg (regs, reg);
+ 	return 1;
+ 
+      case Aind:
+      case Aipi:
+ 	addr = m68k_areg (regs, reg);
+ 	break;
+      case Apdi:
+ 	addr = m68k_areg (regs, reg);
+ 	break;
+      case Ad16:
+ 	disp16 = get_iword_1 (m68kpc_offset); m68kpc_offset += 2;
+ 	addr = m68k_areg(regs,reg) + (uae_s16)disp16;
+ 	break;
+      case Ad8r:
+ 	addr = m68k_areg (regs, reg);
+      d8r_common:
+ 	dp = get_iword_1 (m68kpc_offset); m68kpc_offset += 2;
+ 	disp8 = dp & 0xFF;
+ 	r = (dp & 0x7000) >> 12;
+ 	dispreg = dp & 0x8000 ? m68k_areg(regs,r) : m68k_dreg(regs,r);
+ 	if (!(dp & 0x800)) dispreg = (uae_s32)(uae_s16)(dispreg);
+ 	dispreg <<= (dp >> 9) & 3;
+ 
+ 	if (dp & 0x100) {
+ 	    uae_s32 outer = 0, disp = 0;
+ 	    uae_s32 base = addr;
+ 	    if (dp & 0x80) base = 0;
+ 	    if (dp & 0x40) dispreg = 0;
+ 	    if ((dp & 0x30) == 0x20) { disp = (uae_s32)(uae_s16)get_iword_1 (m68kpc_offset); m68kpc_offset += 2; }
+ 	    if ((dp & 0x30) == 0x30) { disp = get_ilong_1 (m68kpc_offset); m68kpc_offset += 4; }
+ 	    base += disp;
+ 
+ 	    if ((dp & 0x3) == 0x2) { outer = (uae_s32)(uae_s16)get_iword_1 (m68kpc_offset); m68kpc_offset += 2; }
+ 	    if ((dp & 0x3) == 0x3) { outer = get_ilong_1 (m68kpc_offset); m68kpc_offset += 4; }
+ 
+ 	    if (!(dp & 4)) base += dispreg;
+ 	    if (dp & 3) base = get_long (base);
+ 	    if (dp & 4) base += dispreg;
+ 
+ 	    addr = base + outer;
+ 	} else {
+ 	  addr += (uae_s32)((uae_s8)disp8) + dispreg;
+ 	}
+ 	break;
+      case PC16:
+ 	addr = m68k_getpc () + m68kpc_offset;
+ 	disp16 = get_iword_1 (m68kpc_offset); m68kpc_offset += 2;
+ 	addr += (uae_s16)disp16;
+ 	break;
+      case PC8r:
+ 	addr = m68k_getpc () + m68kpc_offset;
+ 	goto d8r_common;
+      case absw:
+ 	addr = (uae_s32)(uae_s16)get_iword_1 (m68kpc_offset);
+ 	m68kpc_offset += 2;
+ 	break;
+      case absl:
+ 	addr = get_ilong_1 (m68kpc_offset);
+ 	m68kpc_offset += 4;
+ 	break;
+      case imm:
+ 	switch (size){
+ 	 case sz_byte:
+ 	    *val = get_iword_1 (m68kpc_offset) & 0xff;
+ 	    m68kpc_offset += 2;
+ 	    break;
+ 	 case sz_word:
+ 	    *val = get_iword_1 (m68kpc_offset) & 0xffff;
+ 	    m68kpc_offset += 2;
+ 	    break;
+ 	 case sz_long:
+ 	    *val = get_ilong_1 (m68kpc_offset);
+ 	    m68kpc_offset += 4;
+ 	    break;
+ 	 default:
+ 	    break;
+ 	}
+ 	return 1;
+      case imm0:
+ 	*val = (uae_s32)(uae_s8)get_iword_1 (m68kpc_offset);
+ 	m68kpc_offset += 2;
+ 	return 1;
+      case imm1:
+ 	*val = (uae_s32)(uae_s16)get_iword_1 (m68kpc_offset);
+ 	m68kpc_offset += 2;
+ 	return 1;
+      case imm2:
+ 	*val = get_ilong_1 (m68kpc_offset);
+ 	m68kpc_offset += 4;
+ 	return 1;
+      case immi:
+ 	*val = (uae_s32)(uae_s8)(reg & 0xff);
+ 	return 1;
+      default:
+ 	addr = 0;
+ 	break;
+     }
+     if ((addr & 1) == 0)
+ 	return 1;
+ 
+     last_addr_for_exception_3 = m68k_getpc () + m68kpc_offset;
+     last_fault_for_exception_3 = addr;
+     return 0;
+ }
+ 
+ uae_u32 get_disp_ea_020 (uae_u32 base, uae_u32 dp)
+ {
+     int reg = (dp >> 12) & 15;
+     uae_s32 regd = regs.regs[reg];
+     if ((dp & 0x800) == 0)
+ 	regd = (uae_s32)(uae_s16)regd;
+     regd <<= (dp >> 9) & 3;
+     if (dp & 0x100) {
+ 	uae_s32 outer = 0;
+ 	if (dp & 0x80) base = 0;
+ 	if (dp & 0x40) regd = 0;
+ 
+ 	if ((dp & 0x30) == 0x20) base += (uae_s32)(uae_s16)next_iword();
+ 	if ((dp & 0x30) == 0x30) base += next_ilong();
+ 
+ 	if ((dp & 0x3) == 0x2) outer = (uae_s32)(uae_s16)next_iword();
+ 	if ((dp & 0x3) == 0x3) outer = next_ilong();
+ 
+ 	if ((dp & 0x4) == 0) base += regd;
+ 	if (dp & 0x3) base = get_long (base);
+ 	if (dp & 0x4) base += regd;
+ 
+ 	return base + outer;
+     } else {
+ 	return base + (uae_s32)((uae_s8)dp) + regd;
+     }
+ }
+ 
+ uae_u32 get_disp_ea_000 (uae_u32 base, uae_u32 dp)
+ {
+     int reg = (dp >> 12) & 15;
+     uae_s32 regd = regs.regs[reg];
+ #if 1
+     if ((dp & 0x800) == 0)
+ 	regd = (uae_s32)(uae_s16)regd;
+     return base + (uae_s8)dp + regd;
+ #else
+     /* Branch-free code... benchmark this again now that
+      * things are no longer inline.  */
+     uae_s32 regd16;
+     uae_u32 mask;
+     mask = ((dp & 0x800) >> 11) - 1;
+     regd16 = (uae_s32)(uae_s16)regd;
+     regd16 &= mask;
+     mask = ~mask;
+     base += (uae_s8)dp;
+     regd &= mask;
+     regd |= regd16;
+     return base + regd;
+ #endif
+ }
+ 
+ void MakeSR (void)
+ {
+ #if 0
+     assert((regs.t1 & 1) == regs.t1);
+     assert((regs.t0 & 1) == regs.t0);
+     assert((regs.s & 1) == regs.s);
+     assert((regs.m & 1) == regs.m);
+     assert((XFLG & 1) == XFLG);
+     assert((NFLG & 1) == NFLG);
+     assert((ZFLG & 1) == ZFLG);
+     assert((VFLG & 1) == VFLG);
+     assert((CFLG & 1) == CFLG);
+ #endif
+     regs.sr = ((regs.t1 << 15) | (regs.t0 << 14)
+ 	       | (regs.s << 13) | (regs.m << 12) | (regs.intmask << 8)
+ 	       | (GET_XFLG << 4) | (GET_NFLG << 3) | (GET_ZFLG << 2) | (GET_VFLG << 1)
+ 	       | GET_CFLG);
+ }
+ 
+ void MakeFromSR (void)
+ {
+     int oldm = regs.m;
+     int olds = regs.s;
+ 
+     regs.t1 = (regs.sr >> 15) & 1;
+     regs.t0 = (regs.sr >> 14) & 1;
+     regs.s = (regs.sr >> 13) & 1;
+     regs.m = (regs.sr >> 12) & 1;
+     regs.intmask = (regs.sr >> 8) & 7;
+     SET_XFLG ((regs.sr >> 4) & 1);
+     SET_NFLG ((regs.sr >> 3) & 1);
+     SET_ZFLG ((regs.sr >> 2) & 1);
+     SET_VFLG ((regs.sr >> 1) & 1);
+     SET_CFLG (regs.sr & 1);
+     if (currprefs.cpu_level >= 2) {
+ 	if (olds != regs.s) {
+ 	    if (olds) {
+ 		if (oldm)
+ 		    regs.msp = m68k_areg(regs, 7);
+ 		else
+ 		    regs.isp = m68k_areg(regs, 7);
+ 		m68k_areg(regs, 7) = regs.usp;
+ 	    } else {
+ 		regs.usp = m68k_areg(regs, 7);
+ 		m68k_areg(regs, 7) = regs.m ? regs.msp : regs.isp;
+ 	    }
+ 	} else if (olds && oldm != regs.m) {
+ 	    if (oldm) {
+ 		regs.msp = m68k_areg(regs, 7);
+ 		m68k_areg(regs, 7) = regs.isp;
+ 	    } else {
+ 		regs.isp = m68k_areg(regs, 7);
+ 		m68k_areg(regs, 7) = regs.msp;
+ 	    }
+ 	}
+     } else {
+ 	if (olds != regs.s) {
+ 	    if (olds) {
+ 		regs.isp = m68k_areg(regs, 7);
+ 		m68k_areg(regs, 7) = regs.usp;
+ 	    } else {
+ 		regs.usp = m68k_areg(regs, 7);
+ 		m68k_areg(regs, 7) = regs.isp;
+ 	    }
+ 	}
+     }
+ 
+     set_special (SPCFLAG_INT);
+     if (regs.t1 || regs.t0)
+ 	set_special (SPCFLAG_TRACE);
+     else
+ 	unset_special (SPCFLAG_TRACE | SPCFLAG_DOTRACE);
+ }
+ 
+ void Exception(int nr, uaecptr oldpc)
+ {
+     uae_u32 currpc = m68k_getpc ();
+ 
+     sim_exception (nr, currpc);
+ 
+     compiler_flush_jsr_stack();
+     MakeSR();
+ 
+     if (!regs.s) {
+ 	regs.usp = m68k_areg(regs, 7);
+ 	if (currprefs.cpu_level >= 2)
+ 	    m68k_areg(regs, 7) = regs.m ? regs.msp : regs.isp;
+ 	else
+ 	    m68k_areg(regs, 7) = regs.isp;
+ 	regs.s = 1;
+     }
+     if (currprefs.cpu_level > 0) {
+ 	if (nr == 2 || nr == 3) {
+ 	    int i;
+ 	    /* @@@ this is probably wrong (?) */
+ 	    for (i = 0 ; i < 12 ; i++) {
+ 		m68k_areg(regs, 7) -= 2;
+ 		put_word (m68k_areg(regs, 7), 0);
+ 	    }
+ 	    m68k_areg(regs, 7) -= 2;
+ 	    put_word (m68k_areg(regs, 7), 0xa000 + nr * 4);
+ 	} else if (nr ==5 || nr == 6 || nr == 7 || nr == 9) {
+ 	    m68k_areg(regs, 7) -= 4;
+ 	    put_long (m68k_areg(regs, 7), oldpc);
+ 	    m68k_areg(regs, 7) -= 2;
+ 	    put_word (m68k_areg(regs, 7), 0x2000 + nr * 4);
+ 	} else if (regs.m && nr >= 24 && nr < 32) {
+ 	    m68k_areg(regs, 7) -= 2;
+ 	    put_word (m68k_areg(regs, 7), nr * 4);
+ 	    m68k_areg(regs, 7) -= 4;
+ 	    put_long (m68k_areg(regs, 7), currpc);
+ 	    m68k_areg(regs, 7) -= 2;
+ 	    put_word (m68k_areg(regs, 7), regs.sr);
+ 	    regs.sr |= (1 << 13);
+ 	    regs.msp = m68k_areg(regs, 7);
+ 	    m68k_areg(regs, 7) = regs.isp;
+ 	    m68k_areg(regs, 7) -= 2;
+ 	    put_word (m68k_areg(regs, 7), 0x1000 + nr * 4);
+ 	} else {
+ 	    m68k_areg(regs, 7) -= 2;
+ 	    put_word (m68k_areg(regs, 7), nr * 4);
+ 	}
+     } else {
+ 	if (nr == 2 || nr == 3) {
+ 	    m68k_areg(regs, 7) -= 12;
+ 	    /* ??????? */
+ 	    if (nr == 3) {
+ 		put_long (m68k_areg(regs, 7), last_fault_for_exception_3);
+ 		put_word (m68k_areg(regs, 7)+4, last_op_for_exception_3);
+ 		put_long (m68k_areg(regs, 7)+8, last_addr_for_exception_3);
+ 	    }
+ 	    write_log ("Exception!\n");
+ 	    goto kludge_me_do;
+ 	}
+     }
+     m68k_areg(regs, 7) -= 4;
+     put_long (m68k_areg(regs, 7), currpc);
+ kludge_me_do:
+     m68k_areg(regs, 7) -= 2;
+     put_word (m68k_areg(regs, 7), regs.sr);
+     m68k_setpc (get_long (regs.vbr + 4*nr));
+     fill_prefetch_0 ();
+     regs.t1 = regs.t0 = regs.m = 0;
+     unset_special (SPCFLAG_TRACE | SPCFLAG_DOTRACE);
+ }
+ 
+ static void Interrupt(int nr)
+ {
+     assert(nr < 8 && nr >= 0);
+     lastint_regs = regs;
+     lastint_no = nr;
+     Exception(nr+24, 0);
+ 
+     regs.intmask = nr;
+     set_special (SPCFLAG_INT);
+ }
+ 
+ static uae_u32 caar, cacr, itt0, itt1, dtt0, dtt1, tc, mmusr;
+ 
+ int m68k_move2c (int regno, uae_u32 *regp)
+ {
+     if ((currprefs.cpu_level == 1 && (regno & 0x7FF) > 1)
+ 	|| (currprefs.cpu_level < 4 && (regno & 0x7FF) > 2)
+ 	|| (currprefs.cpu_level == 4 && regno == 0x802))
+     {
+ 	op_illg (0x4E7B);
+ 	return 0;
+     } else {
+ 	switch (regno) {
+ 	case 0: regs.sfc = *regp & 7; break;
+ 	case 1: regs.dfc = *regp & 7; break;
+ 	case 2: cacr = *regp & (currprefs.cpu_level < 4 ? 0x3 : 0x80008000); break;
+ 	case 3: tc = *regp & 0xc000; break;
+ 	  /* Mask out fields that should be zero.  */
+ 	case 4: itt0 = *regp & 0xffffe364; break;
+ 	case 5: itt1 = *regp & 0xffffe364; break;
+ 	case 6: dtt0 = *regp & 0xffffe364; break;
+ 	case 7: dtt1 = *regp & 0xffffe364; break;
+ 	  
+ 	case 0x800: regs.usp = *regp; break;
+ 	case 0x801: regs.vbr = *regp; break;
+ 	case 0x802: caar = *regp & 0xfc; break;
+ 	case 0x803: regs.msp = *regp; if (regs.m == 1) m68k_areg(regs, 7) = regs.msp; break;
+ 	case 0x804: regs.isp = *regp; if (regs.m == 0) m68k_areg(regs, 7) = regs.isp; break;
+ 	default:
+ 	    op_illg (0x4E7B);
+ 	    return 0;
+ 	}
+     }
+     return 1;
+ }
+ 
+ int m68k_movec2 (int regno, uae_u32 *regp)
+ {
+     if ((currprefs.cpu_level == 1 && (regno & 0x7FF) > 1)
+ 	|| (currprefs.cpu_level < 4 && (regno & 0x7FF) > 2)
+ 	|| (currprefs.cpu_level == 4 && regno == 0x802))
+     {
+ 	op_illg (0x4E7A);
+ 	return 0;
+     } else {
+ 	switch (regno) {
+ 	case 0: *regp = regs.sfc; break;
+ 	case 1: *regp = regs.dfc; break;
+ 	case 2: *regp = cacr; break;
+ 	case 3: *regp = tc; break;
+ 	case 4: *regp = itt0; break;
+ 	case 5: *regp = itt1; break;
+ 	case 6: *regp = dtt0; break;
+ 	case 7: *regp = dtt1; break;
+ 	case 0x800: *regp = regs.usp; break;
+ 	case 0x801: *regp = regs.vbr; break;
+ 	case 0x802: *regp = caar; break;
+ 	case 0x803: *regp = regs.m == 1 ? m68k_areg(regs, 7) : regs.msp; break;
+ 	case 0x804: *regp = regs.m == 0 ? m68k_areg(regs, 7) : regs.isp; break;
+ 	case 0x805: *regp = mmusr; break;
+ 	default:
+ 	    op_illg (0x4E7A);
+ 	    return 0;
+ 	}
+     }
+     return 1;
+ }
+ 
+ STATIC_INLINE int
+ div_unsigned(uae_u32 src_hi, uae_u32 src_lo, uae_u32 div, uae_u32 *quot, uae_u32 *rem)
+ {
+ 	uae_u32 q = 0, cbit = 0;
+ 	int i;
+ 
+ 	if (div <= src_hi) {
+ 	    return 1;
+ 	}
+ 	for (i = 0 ; i < 32 ; i++) {
+ 		cbit = src_hi & 0x80000000ul;
+ 		src_hi <<= 1;
+ 		if (src_lo & 0x80000000ul) src_hi++;
+ 		src_lo <<= 1;
+ 		q = q << 1;
+ 		if (cbit || div <= src_hi) {
+ 			q |= 1;
+ 			src_hi -= div;
+ 		}
+ 	}
+ 	*quot = q;
+ 	*rem = src_hi;
+ 	return 0;
+ }
+ 
+ void m68k_divl (uae_u32 opcode, uae_u32 src, uae_u16 extra, uaecptr oldpc)
+ {
+ #if defined(uae_s64)
+     if (src == 0) {
+ 	Exception (5, oldpc);
+ 	return;
+     }
+     if (extra & 0x800) {
+ 	/* signed variant */
+ 	uae_s64 a = (uae_s64)(uae_s32)m68k_dreg(regs, (extra >> 12) & 7);
+ 	uae_s64 quot, rem;
+ 
+ 	if (extra & 0x400) {
+ 	    a &= 0xffffffffu;
+ 	    a |= (uae_s64)m68k_dreg(regs, extra & 7) << 32;
+ 	}
+ 	rem = a % (uae_s64)(uae_s32)src;
+ 	quot = a / (uae_s64)(uae_s32)src;
+ 	if ((quot & UVAL64(0xffffffff80000000)) != 0
+ 	    && (quot & UVAL64(0xffffffff80000000)) != UVAL64(0xffffffff80000000))
+ 	{
+ 	    SET_VFLG (1);
+ 	    SET_NFLG (1);
+ 	    SET_CFLG (0);
+ 	} else {
+ 	    if (((uae_s32)rem < 0) != ((uae_s64)a < 0)) rem = -rem;
+ 	    SET_VFLG (0);
+ 	    SET_CFLG (0);
+ 	    SET_ZFLG (((uae_s32)quot) == 0);
+ 	    SET_NFLG (((uae_s32)quot) < 0);
+ 	    m68k_dreg(regs, extra & 7) = rem;
+ 	    m68k_dreg(regs, (extra >> 12) & 7) = quot;
+ 	}
+     } else {
+ 	/* unsigned */
+ 	uae_u64 a = (uae_u64)(uae_u32)m68k_dreg(regs, (extra >> 12) & 7);
+ 	uae_u64 quot, rem;
+ 
+ 	if (extra & 0x400) {
+ 	    a &= 0xffffffffu;
+ 	    a |= (uae_u64)m68k_dreg(regs, extra & 7) << 32;
+ 	}
+ 	rem = a % (uae_u64)src;
+ 	quot = a / (uae_u64)src;
+ 	if (quot > 0xffffffffu) {
+ 	    SET_VFLG (1);
+ 	    SET_NFLG (1);
+ 	    SET_CFLG (0);
+ 	} else {
+ 	    SET_VFLG (0);
+ 	    SET_CFLG (0);
+ 	    SET_ZFLG (((uae_s32)quot) == 0);
+ 	    SET_NFLG (((uae_s32)quot) < 0);
+ 	    m68k_dreg(regs, extra & 7) = rem;
+ 	    m68k_dreg(regs, (extra >> 12) & 7) = quot;
+ 	}
+     }
+ #else
+     if (src == 0) {
+ 	Exception (5, oldpc);
+ 	return;
+     }
+     if (extra & 0x800) {
+ 	/* signed variant */
+ 	uae_s32 lo = (uae_s32)m68k_dreg(regs, (extra >> 12) & 7);
+ 	uae_s32 hi = lo < 0 ? -1 : 0;
+ 	uae_s32 save_high;
+ 	uae_u32 quot, rem;
+ 	uae_u32 sign;
+ 
+ 	if (extra & 0x400) {
+ 	    hi = (uae_s32)m68k_dreg(regs, extra & 7);
+ 	}
+ 	save_high = hi;
+ 	sign = (hi ^ src);
+ 	if (hi < 0) {
+ 	    hi = ~hi;
+ 	    lo = -lo;
+ 	    if (lo == 0) hi++;
+ 	}
+ 	if ((uae_s32)src < 0) src = -src;
+ 	if (div_unsigned(hi, lo, src, &quot, &rem) ||
+ 	    (sign & 0x80000000) ? quot > 0x80000000 : quot > 0x7fffffff) {
+ 	    SET_VFLG (1);
+ 	    SET_NFLG (1);
+ 	    SET_CFLG (0);
+ 	} else {
+ 	    if (sign & 0x80000000) quot = -quot;
+ 	    if (((uae_s32)rem < 0) != (save_high < 0)) rem = -rem;
+ 	    SET_VFLG (0);
+ 	    SET_CFLG (0);
+ 	    SET_ZFLG (((uae_s32)quot) == 0);
+ 	    SET_NFLG (((uae_s32)quot) < 0);
+ 	    m68k_dreg(regs, extra & 7) = rem;
+ 	    m68k_dreg(regs, (extra >> 12) & 7) = quot;
+ 	}
+     } else {
+ 	/* unsigned */
+ 	uae_u32 lo = (uae_u32)m68k_dreg(regs, (extra >> 12) & 7);
+ 	uae_u32 hi = 0;
+ 	uae_u32 quot, rem;
+ 
+ 	if (extra & 0x400) {
+ 	    hi = (uae_u32)m68k_dreg(regs, extra & 7);
+ 	}
+ 	if (div_unsigned(hi, lo, src, &quot, &rem)) {
+ 	    SET_VFLG (1);
+ 	    SET_NFLG (1);
+ 	    SET_CFLG (0);
+ 	} else {
+ 	    SET_VFLG (0);
+ 	    SET_CFLG (0);
+ 	    SET_ZFLG (((uae_s32)quot) == 0);
+ 	    SET_NFLG (((uae_s32)quot) < 0);
+ 	    m68k_dreg(regs, extra & 7) = rem;
+ 	    m68k_dreg(regs, (extra >> 12) & 7) = quot;
+ 	}
+     }
+ #endif
+ }
+ 
+ STATIC_INLINE void
+ mul_unsigned(uae_u32 src1, uae_u32 src2, uae_u32 *dst_hi, uae_u32 *dst_lo)
+ {
+ 	uae_u32 r0 = (src1 & 0xffff) * (src2 & 0xffff);
+ 	uae_u32 r1 = ((src1 >> 16) & 0xffff) * (src2 & 0xffff);
+ 	uae_u32 r2 = (src1 & 0xffff) * ((src2 >> 16) & 0xffff);
+ 	uae_u32 r3 = ((src1 >> 16) & 0xffff) * ((src2 >> 16) & 0xffff);
+ 	uae_u32 lo;
+ 
+ 	lo = r0 + ((r1 << 16) & 0xffff0000ul);
+ 	if (lo < r0) r3++;
+ 	r0 = lo;
+ 	lo = r0 + ((r2 << 16) & 0xffff0000ul);
+ 	if (lo < r0) r3++;
+ 	r3 += ((r1 >> 16) & 0xffff) + ((r2 >> 16) & 0xffff);
+ 	*dst_lo = lo;
+ 	*dst_hi = r3;
+ }
+ 
+ void m68k_mull (uae_u32 opcode, uae_u32 src, uae_u16 extra)
+ {
+ #if defined(uae_s64)
+     if (extra & 0x800) {
+ 	/* signed variant */
+ 	uae_s64 a = (uae_s64)(uae_s32)m68k_dreg(regs, (extra >> 12) & 7);
+ 
+ 	a *= (uae_s64)(uae_s32)src;
+ 	SET_VFLG (0);
+ 	SET_CFLG (0);
+ 	SET_ZFLG (a == 0);
+ 	SET_NFLG (a < 0);
+ 	if (extra & 0x400)
+ 	    m68k_dreg(regs, extra & 7) = a >> 32;
+ 	else if ((a & UVAL64(0xffffffff80000000)) != 0
+ 		 && (a & UVAL64(0xffffffff80000000)) != UVAL64(0xffffffff80000000))
+ 	{
+ 	    SET_VFLG (1);
+ 	}
+ 	m68k_dreg(regs, (extra >> 12) & 7) = (uae_u32)a;
+     } else {
+ 	/* unsigned */
+ 	uae_u64 a = (uae_u64)(uae_u32)m68k_dreg(regs, (extra >> 12) & 7);
+ 
+ 	a *= (uae_u64)src;
+ 	SET_VFLG (0);
+ 	SET_CFLG (0);
+ 	SET_ZFLG (a == 0);
+ 	SET_NFLG (((uae_s64)a) < 0);
+ 	if (extra & 0x400)
+ 	    m68k_dreg(regs, extra & 7) = a >> 32;
+ 	else if ((a & UVAL64(0xffffffff00000000)) != 0) {
+ 	    SET_VFLG (1);
+ 	}
+ 	m68k_dreg(regs, (extra >> 12) & 7) = (uae_u32)a;
+     }
+ #else
+     if (extra & 0x800) {
+ 	/* signed variant */
+ 	uae_s32 src1,src2;
+ 	uae_u32 dst_lo,dst_hi;
+ 	uae_u32 sign;
+ 
+ 	src1 = (uae_s32)src;
+ 	src2 = (uae_s32)m68k_dreg(regs, (extra >> 12) & 7);
+ 	sign = (src1 ^ src2);
+ 	if (src1 < 0) src1 = -src1;
+ 	if (src2 < 0) src2 = -src2;
+ 	mul_unsigned((uae_u32)src1,(uae_u32)src2,&dst_hi,&dst_lo);
+ 	if (sign & 0x80000000) {
+ 		dst_hi = ~dst_hi;
+ 		dst_lo = -dst_lo;
+ 		if (dst_lo == 0) dst_hi++;
+ 	}
+ 	SET_VFLG (0);
+ 	SET_CFLG (0);
+ 	SET_ZFLG (dst_hi == 0 && dst_lo == 0);
+ 	SET_NFLG (((uae_s32)dst_hi) < 0);
+ 	if (extra & 0x400)
+ 	    m68k_dreg(regs, extra & 7) = dst_hi;
+ 	else if ((dst_hi != 0 || (dst_lo & 0x80000000) != 0)
+ 		 && ((dst_hi & 0xffffffff) != 0xffffffff
+ 		     || (dst_lo & 0x80000000) != 0x80000000))
+ 	{
+ 	    SET_VFLG (1);
+ 	}
+ 	m68k_dreg(regs, (extra >> 12) & 7) = dst_lo;
+     } else {
+ 	/* unsigned */
+ 	uae_u32 dst_lo,dst_hi;
+ 
+ 	mul_unsigned(src,(uae_u32)m68k_dreg(regs, (extra >> 12) & 7),&dst_hi,&dst_lo);
+ 
+ 	SET_VFLG (0);
+ 	SET_CFLG (0);
+ 	SET_ZFLG (dst_hi == 0 && dst_lo == 0);
+ 	SET_NFLG (((uae_s32)dst_hi) < 0);
+ 	if (extra & 0x400)
+ 	    m68k_dreg(regs, extra & 7) = dst_hi;
+ 	else if (dst_hi != 0) {
+ 	    SET_VFLG (1);
+ 	}
+ 	m68k_dreg(regs, (extra >> 12) & 7) = dst_lo;
+     }
+ #endif
+ }
+ static char* ccnames[] =
+ { "T ","F ","HI","LS","CC","CS","NE","EQ",
+   "VC","VS","PL","MI","GE","LT","GT","LE" };
+ 
+ void m68k_reset (void)
+ {
+     m68k_areg (regs, 7) = get_long (0x00f80000);
+     m68k_setpc (get_long (0x00f80004));
+     fill_prefetch_0 ();
+     regs.kick_mask = 0xF80000;
+     regs.s = 1;
+     regs.m = 0;
+     regs.stopped = 0;
+     regs.t1 = 0;
+     regs.t0 = 0;
+     SET_ZFLG (0);
+     SET_XFLG (0);
+     SET_CFLG (0);
+     SET_VFLG (0);
+     SET_NFLG (0);
+     regs.spcflags = 0;
+     regs.intmask = 7;
+     regs.vbr = regs.sfc = regs.dfc = 0;
+     regs.fpcr = regs.fpsr = regs.fpiar = 0;
+ }
+ 
+ unsigned long REGPARAM2 op_illg (uae_u32 opcode)
+ {
+     uaecptr pc = m68k_getpc ();
+     
+     if (cloanto_rom && (opcode & 0xF100) == 0x7100) {
+ 	m68k_dreg (regs, (opcode >> 9) & 7) = (uae_s8)(opcode & 0xFF);
+ 	m68k_incpc (2);
+ 	fill_prefetch_0 ();
+ 	return 4;
+     }
+ 
+     compiler_flush_jsr_stack ();
+     if (opcode == 0x4E7B && get_long (0x10) == 0 && (pc & 0xF80000) == 0xF80000) {
+ 	write_log ("Your Kickstart requires a 68020 CPU. Giving up.\n");
+ 	broken_in = 1;
+ 	set_special (SPCFLAG_BRK);
+ 	quit_program = 1;
+     }
+ #if !CYGNUS_SIM
+     if (opcode == 0xFF0D) {
+ 	if ((pc & 0xF80000) == 0xF80000) {
+ 	    /* This is from the dummy Kickstart replacement */
+ 	    uae_u16 arg = get_iword (2);
+ 	    m68k_incpc (4);
+ 	    ersatz_perform (arg);
+ 	    fill_prefetch_0 ();
+ 	    return 4;
+ 	} else if ((pc & 0xF80000) == 0xF00000) {
+ 	    /* User-mode STOP replacement */
+ 	    m68k_setstopped (1);
+ 	    return 4;
+ 	}
+     }
+ #endif
+ 
+     if ((opcode & 0xF000) == 0xA000 && (pc & 0xF80000) == 0xF00000) {
+ 	/* Calltrap. */
+ 	m68k_incpc(2);
+ 	call_calltrap (opcode & 0xFFF);
+ 	fill_prefetch_0 ();
+ 	return 4;
+     }
+ 
+     if ((opcode & 0xF000) == 0xF000) {
+ 	Exception(0xB,0);
+ 	return 4;
+     }
+     if ((opcode & 0xF000) == 0xA000) {
+ 	if ((pc & 0xF80000) == 0xF00000) {
+ 	    /* Calltrap. */
+ 	    call_calltrap (opcode & 0xFFF);
+ 	}
+ 	Exception(0xA,0);
+ 	return 4;
+     }
+ #if 1
+     write_log ("Illegal instruction: %04x at %08lx\n", opcode, pc);
+ #endif
+     Exception (4,0);
+     return 4;
+ }
+ 
+ void mmu_op(uae_u32 opcode, uae_u16 extra)
+ {
+     if ((opcode & 0xFE0) == 0x0500) {
+ 	/* PFLUSH */
+ 	mmusr = 0;
+ 	write_log ("PFLUSH\n");
+     } else if ((opcode & 0x0FD8) == 0x548) {
+ 	/* PTEST */
+ 	write_log ("PTEST\n");
+     } else
+ 	op_illg (opcode);
+ }
+ 
+ static int n_insns = 0, n_spcinsns = 0;
+ 
+ #if !CYGNUS_SIM
+ static uaecptr last_trace_ad = 0;
+ 
+ static void do_trace (void)
+ {
+     if (regs.t0 && currprefs.cpu_level >= 2) {
+ 	uae_u16 opcode;
+ 	/* should also include TRAP, CHK, SR modification FPcc */
+ 	/* probably never used so why bother */
+ 	/* We can afford this to be inefficient... */
+ 	m68k_setpc (m68k_getpc ());
+ 	fill_prefetch_0 ();
+ 	opcode = get_word (regs.pc);
+ 	if (opcode == 0x4e72 		/* RTE */
+ 	    || opcode == 0x4e74 		/* RTD */
+ 	    || opcode == 0x4e75 		/* RTS */
+ 	    || opcode == 0x4e77 		/* RTR */
+ 	    || opcode == 0x4e76 		/* TRAPV */
+ 	    || (opcode & 0xffc0) == 0x4e80 	/* JSR */
+ 	    || (opcode & 0xffc0) == 0x4ec0 	/* JMP */
+ 	    || (opcode & 0xff00) == 0x6100  /* BSR */
+ 	    || ((opcode & 0xf000) == 0x6000	/* Bcc */
+ 		&& cctrue((opcode >> 8) & 0xf))
+ 	    || ((opcode & 0xf0f0) == 0x5050 /* DBcc */
+ 		&& !cctrue((opcode >> 8) & 0xf)
+ 		&& (uae_s16)m68k_dreg(regs, opcode & 7) != 0))
+ 	{
+ 	    last_trace_ad = m68k_getpc ();
+ 	    unset_special (SPCFLAG_TRACE);
+ 	    set_special (SPCFLAG_DOTRACE);
+ 	}
+     } else if (regs.t1) {
+ 	last_trace_ad = m68k_getpc ();
+ 	unset_special (SPCFLAG_TRACE);
+ 	set_special (SPCFLAG_DOTRACE);
+     }
+ }
+ 
+ 
+ static int do_specialties (void)
+ {
+     if (regs.spcflags & SPCFLAG_COPPER)
+ 	do_copper ();
+ 
+     /*n_spcinsns++;*/
+     while (regs.spcflags & SPCFLAG_BLTNASTY) {
+ 	do_cycles (4);
+ 	if (regs.spcflags & SPCFLAG_COPPER)
+ 	    do_copper ();
+     }
+ 
+     run_compiled_code();
+     if (regs.spcflags & SPCFLAG_DOTRACE) {
+ 	Exception (9,last_trace_ad);
+     }
+     while (regs.spcflags & SPCFLAG_STOP) {
+ 	do_cycles (4);
+ 	if (regs.spcflags & SPCFLAG_COPPER)
+ 	    do_copper ();
+ 	if (regs.spcflags & (SPCFLAG_INT | SPCFLAG_DOINT)){
+ 	    int intr = intlev ();
+ 	    unset_special (SPCFLAG_INT | SPCFLAG_DOINT);
+ 	    if (intr != -1 && intr > regs.intmask) {
+ 		Interrupt (intr);
+ 		regs.stopped = 0;
+ 		unset_special (SPCFLAG_STOP);
+ 	    }
+ 	}
+     }
+     if (regs.spcflags & SPCFLAG_TRACE)
+ 	do_trace ();
+ 
+     if (regs.spcflags & SPCFLAG_DOINT) {
+ 	int intr = intlev ();
+ 	unset_special (SPCFLAG_DOINT);
+ 	if (intr != -1 && intr > regs.intmask) {
+ 	    Interrupt (intr);
+ 	    regs.stopped = 0;
+ 	}
+     }
+     if (regs.spcflags & SPCFLAG_INT) {
+ 	unset_special (SPCFLAG_INT);
+ 	set_special (SPCFLAG_DOINT);
+     }
+     if (regs.spcflags & (SPCFLAG_BRK | SPCFLAG_MODE_CHANGE)) {
+ 	unset_special (SPCFLAG_BRK | SPCFLAG_MODE_CHANGE);
+ 	return 1;
+     }
+     return 0;
+ }
+ #endif
+ 
+ /* It's really sad to have two almost identical functions for this, but we
+    do it all for performance... :( */
+ static void m68k_run_1 (void)
+ {
+ #ifdef DEBUG_PREFETCH
+   uae_u8 saved_bytes[20];
+   uae_u16 *oldpcp;
+ #endif
+   int cycles;
+   uae_u32 opcode = get_iword_prefetch (0);
+ #ifdef DEBUG_PREFETCH
+   if (get_ilong (0) != do_get_mem_long (&regs.prefetch)) {
+     fprintf (stderr, "Prefetch differs from memory.\n");
+     debugging = 1;
+     return;
+   }
+   oldpcp = regs.pc_p;
+   memcpy (saved_bytes, regs.pc_p, 20);
+ #endif
+   /* assert (!regs.stopped && !(regs.spcflags & SPCFLAG_STOP)); */
+   /*	regs_backup[backup_pointer = (backup_pointer + 1) % 16] = regs;*/
+ #if COUNT_INSTRS == 2
+   if (table68k[opcode].handler != -1)
+     instrcount[table68k[opcode].handler]++;
+ #elif COUNT_INSTRS == 1
+   instrcount[opcode]++;
+ #endif
+ #if defined X86_ASSEMBLY
+   __asm__ __volatile__("\tcall *%%ebx"
+ 		       : "=&a" (cycles) : "b" (cpufunctbl[opcode]), "0" (opcode)
+ 		       : "%edx", "%ecx",
+ 		       "%esi", "%edi", "%ebp", "memory", "cc");
+ #else
+   cycles = (*cpufunctbl[opcode])(opcode);
+ #endif
+ #ifdef DEBUG_PREFETCH
+   if (memcmp (saved_bytes, oldpcp, 20) != 0) {
+     fprintf (stderr, "Self-modifying code detected.\n");
+     set_special (SPCFLAG_BRK);
+     debugging = 1;
+   }
+ #endif
+   /*n_insns++;*/
+   cycles &= cycles_mask;
+   cycles |= cycles_val;
+ #if !CYGNUS_SIM
+   do_cycles (cycles);
+   if (regs.spcflags) {
+     if (do_specialties ())
+       return;
+   }
+ #endif
+ }
+ 
+ #define DEBUG_PREFETCH
+ 
+ /* Same thing, but don't use prefetch to get opcode.  */
+ static void m68k_run_2 (void)
+ {
+   int cycles;
+   uae_u32 opcode = get_iword (0);
+ 
+   /* assert (!regs.stopped && !(regs.spcflags & SPCFLAG_STOP)); */
+   /*	regs_backup[backup_pointer = (backup_pointer + 1) % 16] = regs;*/
+ #if COUNT_INSTRS == 2
+   if (table68k[opcode].handler != -1)
+     instrcount[table68k[opcode].handler]++;
+ #elif COUNT_INSTRS == 1
+   instrcount[opcode]++;
+ #endif
+ #if defined X86_ASSEMBLY
+   __asm__ __volatile__("\tcall *%%ebx"
+ 		       : "=&a" (cycles) : "b" (cpufunctbl[opcode]), "0" (opcode)
+ 		       : "%edx", "%ecx",
+ 		       "%esi", "%edi", "%ebp", "memory", "cc");
+ #else
+   cycles = (*cpufunctbl[opcode])(opcode);
+ #endif
+ 
+ #if !CYGNUS_SIM
+   /*n_insns++;*/
+   cycles &= cycles_mask;
+   cycles |= cycles_val;
+   do_cycles (cycles);
+   if (regs.spcflags) {
+     if (do_specialties ())
+       return;
+   }
+ #endif
+ }
+ 
+ #ifdef X86_ASSEMBLY
+ STATIC_INLINE void m68k_run1 (void (*func)(void))
+ {
+     /* Work around compiler bug: GCC doesn't push %ebp in m68k_run_1. */
+     __asm__ __volatile__ ("pushl %%ebp\n\tcall *%0\n\tpopl %%ebp"
+ 			  : : "r" (func) : "%eax", "%edx", "%ecx", "memory", "cc");
+ }
+ #else
+ #define m68k_run1(F) F()
+ #endif
+ 
+ int in_m68k_go = 0;
+ 
+ void m68k_go (int may_quit, int single_step)
+ {
+     if (in_m68k_go || !may_quit) {
+ 	write_log ("Bug! m68k_go is not reentrant.\n");
+ 	abort ();
+     }
+ 
+ #if !CYGNUS_SIM
+     reset_frame_rate_hack ();
+     update_68k_cycles ();
+ #endif
+ 
+     in_m68k_go++;
+     for (;;) {
+ 	if (quit_program > 0) {
+ 	    if (quit_program == 1)
+ 		break;
+ 	    quit_program = 0;
+ 	    m68k_reset ();
+ #if !CYGNUS_SIM
+ 	    reset_all_systems ();
+ #endif
+ 	    customreset ();
+ 	}
+ #if !CYGNUS_SIM
+ 	if (debugging)
+ 	    debug ();
+ #endif
+ 	if (verbose_trace)
+ 	  m68k_dumpstate (stdout, regs.pc_p);
+ 	else if (trace)
+ 	  {
+ 	    sim_trace_one(m68k_getpc());
+ 	  }
+ 	m68k_run1 (currprefs.cpu_compatible ? m68k_run_1 : m68k_run_2);
+ 	if (single_step)
+ 	  break;
+     }
+     in_m68k_go--;
+ }
+ 
+ static void m68k_verify (uaecptr addr, uaecptr *nextpc)
+ {
+     uae_u32 opcode, val;
+     struct instr *dp;
+ 
+     opcode = get_iword_1(0);
+     last_op_for_exception_3 = opcode;
+     m68kpc_offset = 2;
+ 
+     if (cpufunctbl[opcode] == op_illg_1) {
+ 	opcode = 0x4AFC;
+     }
+     dp = table68k + opcode;
+ 
+     if (dp->suse) {
+ 	if (!verify_ea (dp->sreg, dp->smode, dp->size, &val)) {
+ 	    Exception (3, 0);
+ 	    return;
+ 	}
+     }
+     if (dp->duse) {
+ 	if (!verify_ea (dp->dreg, dp->dmode, dp->size, &val)) {
+ 	    Exception (3, 0);
+ 	    return;
+ 	}
+     }
+ }
+ 
+ void m68k_disasm (FILE *f, uaecptr addr, uaecptr *nextpc, int cnt)
+ {
+     uaecptr newpc = 0;
+     m68kpc_offset = addr - m68k_getpc ();
+     while (cnt-- > 0) {
+ 	char instrname[20],*ccpt;
+ 	int opwords;
+ 	uae_u32 opcode;
+ 	struct mnemolookup *lookup;
+ 	struct instr *dp;
+ 	fprintf (f, "%08lx: ", m68k_getpc () + m68kpc_offset);
+ 	for (opwords = 0; opwords < 5; opwords++){
+ 	    fprintf (f, "%04x ", get_iword_1 (m68kpc_offset + opwords*2));
+ 	}
+ 	opcode = get_iword_1 (m68kpc_offset);
+ 	m68kpc_offset += 2;
+ 	if (cpufunctbl[opcode] == op_illg_1) {
+ 	    opcode = 0x4AFC;
+ 	}
+ 	dp = table68k + opcode;
+ 	for (lookup = lookuptab;lookup->mnemo != dp->mnemo; lookup++)
+ 	    ;
+ 
+ 	strcpy (instrname, lookup->name);
+ 	ccpt = strstr (instrname, "cc");
+ 	if (ccpt != 0) {
+ 	    strncpy (ccpt, ccnames[dp->cc], 2);
+ 	}
+ 	fprintf (f, "%s", instrname);
+ 	switch (dp->size){
+ 	 case sz_byte: fprintf (f, ".B "); break;
+ 	 case sz_word: fprintf (f, ".W "); break;
+ 	 case sz_long: fprintf (f, ".L "); break;
+ 	 default: fprintf (f, "   "); break;
+ 	}
+ 
+ 	if (dp->suse) {
+ 	    newpc = m68k_getpc () + m68kpc_offset;
+ 	    newpc += ShowEA (f, dp->sreg, dp->smode, dp->size, 0);
+ 	}
+ 	if (dp->suse && dp->duse)
+ 	    fprintf (f, ",");
+ 	if (dp->duse) {
+ 	    newpc = m68k_getpc () + m68kpc_offset;
+ 	    newpc += ShowEA (f, dp->dreg, dp->dmode, dp->size, 0);
+ 	}
+ 	if (ccpt != 0) {
+ 	    if (cctrue(dp->cc))
+ 		fprintf (f, " == %08lx (TRUE)", newpc);
+ 	    else
+ 		fprintf (f, " == %08lx (FALSE)", newpc);
+ 	} else if ((opcode & 0xff00) == 0x6100) /* BSR */
+ 	    fprintf (f, " == %08lx", newpc);
+ 	fprintf (f, "\n");
+     }
+     if (nextpc)
+ 	*nextpc = m68k_getpc () + m68kpc_offset;
+ }
+ 
+ void m68k_dumpstate (FILE *f, uaecptr *nextpc)
+ {
+     int i;
+     for (i = 0; i < 8; i++){
+ 	fprintf (f, "D%d: %08lx ", i, m68k_dreg(regs, i));
+ 	if ((i & 3) == 3) fprintf (f, "\n");
+     }
+     for (i = 0; i < 8; i++){
+ 	fprintf (f, "A%d: %08lx ", i, m68k_areg(regs, i));
+ 	if ((i & 3) == 3) fprintf (f, "\n");
+     }
+     if (regs.s == 0) regs.usp = m68k_areg(regs, 7);
+     if (regs.s && regs.m) regs.msp = m68k_areg(regs, 7);
+     if (regs.s && regs.m == 0) regs.isp = m68k_areg(regs, 7);
+     fprintf (f, "USP=%08lx ISP=%08lx MSP=%08lx VBR=%08lx\n",
+ 	     regs.usp,regs.isp,regs.msp,regs.vbr);
+     fprintf (f, "T=%d%d S=%d M=%d X=%d N=%d Z=%d V=%d C=%d IMASK=%d\n",
+ 	     regs.t1, regs.t0, regs.s, regs.m,
+ 	     GET_XFLG, GET_NFLG, GET_ZFLG, GET_VFLG, GET_CFLG, regs.intmask);
+     for (i = 0; i < 8; i++){
+ 	fprintf (f, "FP%d: %g ", i, regs.fp[i]);
+ 	if ((i & 3) == 3) fprintf (f, "\n");
+     }
+     fprintf (f, "N=%d Z=%d I=%d NAN=%d\n",
+ 	     (regs.fpsr & 0x8000000) != 0,
+ 	     (regs.fpsr & 0x4000000) != 0,
+ 	     (regs.fpsr & 0x2000000) != 0,
+ 	     (regs.fpsr & 0x1000000) != 0);
+     if (currprefs.cpu_compatible)
+ 	fprintf (f, "prefetch %08lx\n", (unsigned long)do_get_mem_long(&regs.prefetch));
+ 
+     m68k_disasm (f, m68k_getpc (), nextpc, 1);
+     if (nextpc)
+ 	fprintf (f, "next PC: %08lx\n", *nextpc);
+ }
diff -Nrc3p /dunes/wcohen/virg-netgdb/src/sim/m68k/newcpu.h src/sim/m68k/newcpu.h
*** /dunes/wcohen/virg-netgdb/src/sim/m68k/newcpu.h	Wed Dec 31 19:00:00 1969
--- src/sim/m68k/newcpu.h	Fri Feb 23 16:07:35 2001
***************
*** 0 ****
--- 1,302 ----
+  /*
+   * UAE - The Un*x Amiga Emulator
+   *
+   * MC68000 emulation
+   *
+   * Copyright 1995 Bernd Schmidt
+   */
+ 
+ #include "readcpu.h"
+ #include "machdep/m68k.h"
+ 
+ #define CYGNUS_SIM 1
+ 
+ #ifndef SET_CFLG
+ 
+ #define SET_CFLG(x) (CFLG = (x))
+ #define SET_NFLG(x) (NFLG = (x))
+ #define SET_VFLG(x) (VFLG = (x))
+ #define SET_ZFLG(x) (ZFLG = (x))
+ #define SET_XFLG(x) (XFLG = (x))
+ 
+ #define GET_CFLG CFLG
+ #define GET_NFLG NFLG
+ #define GET_VFLG VFLG
+ #define GET_ZFLG ZFLG
+ #define GET_XFLG XFLG
+ 
+ #define CLEAR_CZNV do { \
+  SET_CFLG (0); \
+  SET_ZFLG (0); \
+  SET_NFLG (0); \
+  SET_VFLG (0); \
+ } while (0)
+ 
+ #define COPY_CARRY (SET_XFLG (GET_CFLG))
+ #endif
+ 
+ extern int areg_byteinc[];
+ extern int imm8_table[];
+ 
+ extern int movem_index1[256];
+ extern int movem_index2[256];
+ extern int movem_next[256];
+ 
+ extern int fpp_movem_index1[256];
+ extern int fpp_movem_index2[256];
+ extern int fpp_movem_next[256];
+ 
+ extern int broken_in;
+ 
+ typedef unsigned long cpuop_func (uae_u32) REGPARAM;
+ 
+ struct cputbl {
+     cpuop_func *handler;
+     int specific;
+     uae_u16 opcode;
+ };
+ 
+ extern unsigned long op_illg (uae_u32) REGPARAM;
+ 
+ typedef char flagtype;
+ 
+ extern struct regstruct
+ {
+     uae_u32 regs[16];
+     uaecptr  usp,isp,msp;
+     uae_u16 sr;
+     flagtype t1;
+     flagtype t0;
+     flagtype s;
+     flagtype m;
+     flagtype x;
+     flagtype stopped;
+     int intmask;
+ 
+     uae_u32 pc;
+     uae_u8 *pc_p;
+     uae_u8 *pc_oldp;
+ 
+     uae_u32 vbr,sfc,dfc;
+ 
+     double fp[8];
+     uae_u32 fpcr,fpsr,fpiar;
+ 
+     uae_u32 spcflags;
+     uae_u32 kick_mask;
+ 
+     /* Fellow sources say this is 4 longwords. That's impossible. It needs
+      * to be at least a longword. The HRM has some cryptic comment about two
+      * instructions being on the same longword boundary.
+      * The way this is implemented now seems like a good compromise.
+      */
+     uae_u32 prefetch;
+ 
+   /* NOTE stuff related to simulator framework */
+ 
+     /* NOTE need to have m68k performance information here */
+ 
+     unsigned char *insn_end;
+ 
+     /* NOTE control information */
+ 
+     int prevlock;
+     int thislock;
+     int exception;
+ 
+     int end_of_registers;
+ 
+     /* NOTE simulator information */
+     int msize;
+ #define PROFILE_FREQ 1
+ #define PROFILE_SHIFT 2
+     int profile;
+     unsigned short *profile_hist;
+     unsigned char *memory;
+     int xyram_select, xram_start, yram_start;
+     unsigned char *xmem;
+     unsigned char *ymem;
+     unsigned char *xmem_offset;
+     unsigned char *ymem_offset;
+ 
+ } regs, lastint_regs;
+ 
+ STATIC_INLINE void set_special (uae_u32 x)
+ {
+     regs.spcflags |= x;
+ }
+ 
+ STATIC_INLINE void unset_special (uae_u32 x)
+ {
+     regs.spcflags &= ~x;
+ }
+ 
+ #define m68k_dreg(r,num) ((r).regs[(num)])
+ #define m68k_areg(r,num) (((r).regs + 8)[(num)])
+ 
+ #define get_ibyte(o) do_get_mem_byte((uae_u8 *)(regs.pc_p + (o) + 1))
+ #define get_iword(o) do_get_mem_word((uae_u16 *)(regs.pc_p + (o)))
+ #define get_ilong(o) do_get_mem_long((uae_u32 *)(regs.pc_p + (o)))
+ 
+ STATIC_INLINE uae_u32 get_ibyte_prefetch (uae_s32 o)
+ {
+     if (o > 3 || o < 0)
+ 	return do_get_mem_byte((uae_u8 *)(regs.pc_p + o + 1));
+ 
+     return do_get_mem_byte((uae_u8 *)(((uae_u8 *)&regs.prefetch) + o + 1));
+ }
+ STATIC_INLINE uae_u32 get_iword_prefetch (uae_s32 o)
+ {
+     if (o > 3 || o < 0)
+ 	return do_get_mem_word((uae_u16 *)(regs.pc_p + o));
+ 
+     return do_get_mem_word((uae_u16 *)(((uae_u8 *)&regs.prefetch) + o));
+ }
+ STATIC_INLINE uae_u32 get_ilong_prefetch (uae_s32 o)
+ {
+     if (o > 3 || o < 0)
+ 	return do_get_mem_long((uae_u32 *)(regs.pc_p + o));
+     if (o == 0)
+ 	return do_get_mem_long(&regs.prefetch);
+     return (do_get_mem_word (((uae_u16 *)&regs.prefetch) + 1) << 16) | do_get_mem_word ((uae_u16 *)(regs.pc_p + 4));
+ }
+ 
+ #define m68k_incpc(o) (regs.pc_p += (o))
+ 
+ STATIC_INLINE void fill_prefetch_0 (void)
+ {
+     uae_u32 r;
+ #ifdef UNALIGNED_PROFITABLE
+     r = *(uae_u32 *)regs.pc_p;
+     regs.prefetch = r;
+ #else
+     r = do_get_mem_long ((uae_u32 *)regs.pc_p);
+     do_put_mem_long (&regs.prefetch, r);
+ #endif
+ }
+ 
+ #if 0
+ STATIC_INLINE void fill_prefetch_2 (void)
+ {
+     uae_u32 r = do_get_mem_long (&regs.prefetch) << 16;
+     uae_u32 r2 = do_get_mem_word (((uae_u16 *)regs.pc_p) + 1);
+     r |= r2;
+     do_put_mem_long (&regs.prefetch, r);
+ }
+ #else
+ #define fill_prefetch_2 fill_prefetch_0
+ #endif
+ 
+ /* These are only used by the 68020/68881 code, and therefore don't
+  * need to handle prefetch.  */
+ STATIC_INLINE uae_u32 next_ibyte (void)
+ {
+     uae_u32 r = get_ibyte (0);
+     m68k_incpc (2);
+     return r;
+ }
+ 
+ STATIC_INLINE uae_u32 next_iword (void)
+ {
+     uae_u32 r = get_iword (0);
+     m68k_incpc (2);
+     return r;
+ }
+ 
+ STATIC_INLINE uae_u32 next_ilong (void)
+ {
+     uae_u32 r = get_ilong (0);
+     m68k_incpc (4);
+     return r;
+ }
+ 
+ #if !defined USE_COMPILER
+ STATIC_INLINE void m68k_setpc (uaecptr newpc)
+ {
+     regs.pc_p = regs.pc_oldp = get_real_address(newpc);
+     regs.pc = newpc;
+ }
+ #else
+ extern void m68k_setpc (uaecptr newpc);
+ #endif
+ 
+ STATIC_INLINE uaecptr m68k_getpc (void)
+ {
+     return regs.pc + ((char *)regs.pc_p - (char *)regs.pc_oldp);
+ }
+ 
+ STATIC_INLINE uaecptr m68k_getpc_p (uae_u8 *p)
+ {
+     return regs.pc + ((char *)p - (char *)regs.pc_oldp);
+ }
+ 
+ #ifdef USE_COMPILER
+ extern void m68k_setpc_fast (uaecptr newpc);
+ extern void m68k_setpc_bcc (uaecptr newpc);
+ extern void m68k_setpc_rte (uaecptr newpc);
+ #else
+ #define m68k_setpc_fast m68k_setpc
+ #define m68k_setpc_bcc  m68k_setpc
+ #define m68k_setpc_rte  m68k_setpc
+ #endif
+ 
+ STATIC_INLINE void m68k_setstopped (int stop)
+ {
+     regs.stopped = stop;
+     if (stop)
+ 	regs.spcflags |= SPCFLAG_STOP;
+ }
+ 
+ extern uae_u32 get_disp_ea_020 (uae_u32 base, uae_u32 dp);
+ extern uae_u32 get_disp_ea_000 (uae_u32 base, uae_u32 dp);
+ 
+ extern uae_s32 ShowEA (FILE *, int reg, amodes mode, wordsizes size, char *buf);
+ 
+ extern void MakeSR (void);
+ extern void MakeFromSR (void);
+ extern void Exception (int, uaecptr);
+ extern void dump_counts (void);
+ extern int m68k_move2c (int, uae_u32 *);
+ extern int m68k_movec2 (int, uae_u32 *);
+ extern void m68k_divl (uae_u32, uae_u32, uae_u16, uaecptr);
+ extern void m68k_mull (uae_u32, uae_u32, uae_u16);
+ extern void init_m68k (void);
+ extern void m68k_go (int,int);
+ extern void m68k_dumpstate (FILE *, uaecptr *);
+ extern void m68k_disasm (FILE *, uaecptr, uaecptr *, int);
+ extern void m68k_reset (void);
+ 
+ extern void mmu_op (uae_u32, uae_u16);
+ 
+ extern void fpp_opp (uae_u32, uae_u16);
+ extern void fdbcc_opp (uae_u32, uae_u16);
+ extern void fscc_opp (uae_u32, uae_u16);
+ extern void ftrapcc_opp (uae_u32,uaecptr);
+ extern void fbcc_opp (uae_u32, uaecptr, uae_u32);
+ extern void fsave_opp (uae_u32);
+ extern void frestore_opp (uae_u32);
+ 
+ /* Opcode of faulting instruction */
+ extern uae_u16 last_op_for_exception_3;
+ /* PC at fault time */
+ extern uaecptr last_addr_for_exception_3;
+ /* Address that generated the exception */
+ extern uaecptr last_fault_for_exception_3;
+ 
+ #define CPU_OP_NAME(a) op ## a
+ 
+ /* 68040 */
+ extern struct cputbl op_smalltbl_0_ff[];
+ /* 68020 + 68881 */
+ extern struct cputbl op_smalltbl_1_ff[];
+ /* 68020 */
+ extern struct cputbl op_smalltbl_2_ff[];
+ /* 68010 */
+ extern struct cputbl op_smalltbl_3_ff[];
+ /* 68000 */
+ extern struct cputbl op_smalltbl_4_ff[];
+ /* 68000 slow but compatible.  */
+ extern struct cputbl op_smalltbl_5_ff[];
+ 
+ extern cpuop_func *cpufunctbl[65536] ASM_SYM_FOR_FUNC ("cpufunctbl");
+ 
diff -Nrc3p /dunes/wcohen/virg-netgdb/src/sim/m68k/readcpu.c src/sim/m68k/readcpu.c
*** /dunes/wcohen/virg-netgdb/src/sim/m68k/readcpu.c	Wed Dec 31 19:00:00 1969
--- src/sim/m68k/readcpu.c	Tue Feb 27 10:41:54 2001
***************
*** 0 ****
--- 1,817 ----
+ /*
+  * UAE - The Un*x Amiga Emulator
+  *
+  * Read 68000 CPU specs from file "table68k"
+  *
+  * Copyright 1995,1996 Bernd Schmidt
+  */
+ 
+ #include "sysconfig.h"
+ #include "sysdeps.h"
+ #include <ctype.h>
+ 
+ #include "config.h"
+ #include "options.h"
+ #include "readcpu.h"
+ 
+ int nr_cpuop_funcs;
+ 
+ struct mnemolookup lookuptab[] = {
+     { i_ILLG, "ILLEGAL" },
+     { i_OR, "OR" },
+     { i_CHK, "CHK" },
+     { i_CHK2, "CHK2" },
+     { i_AND, "AND" },
+     { i_EOR, "EOR" },
+     { i_ORSR, "ORSR" },
+     { i_ANDSR, "ANDSR" },
+     { i_EORSR, "EORSR" },
+     { i_SUB, "SUB" },
+     { i_SUBA, "SUBA" },
+     { i_SUBX, "SUBX" },
+     { i_SBCD, "SBCD" },
+     { i_ADD, "ADD" },
+     { i_ADDA, "ADDA" },
+     { i_ADDX, "ADDX" },
+     { i_ABCD, "ABCD" },
+     { i_NEG, "NEG" },
+     { i_NEGX, "NEGX" },
+     { i_NBCD, "NBCD" },
+     { i_CLR, "CLR" },
+     { i_NOT, "NOT" },
+     { i_TST, "TST" },
+     { i_BTST, "BTST" },
+     { i_BCHG, "BCHG" },
+     { i_BCLR, "BCLR" },
+     { i_BSET, "BSET" },
+     { i_CMP, "CMP" },
+     { i_CMPM, "CMPM" },
+     { i_CMPA, "CMPA" },
+     { i_MVPRM, "MVPRM" },
+     { i_MVPMR, "MVPMR" },
+     { i_MOVE, "MOVE" },
+     { i_MOVEA, "MOVEA" },
+     { i_MVSR2, "MVSR2" },
+     { i_MV2SR, "MV2SR" },
+     { i_SWAP, "SWAP" },
+     { i_EXG, "EXG" },
+     { i_EXT, "EXT" },
+     { i_MVMEL, "MVMEL" },
+     { i_MVMLE, "MVMLE" },
+     { i_TRAP, "TRAP" },
+     { i_MVR2USP, "MVR2USP" },
+     { i_MVUSP2R, "MVUSP2R" },
+     { i_NOP, "NOP" },
+     { i_RESET, "RESET" },
+     { i_RTE, "RTE" },
+     { i_RTD, "RTD" },
+     { i_LINK, "LINK" },
+     { i_UNLK, "UNLK" },
+     { i_RTS, "RTS" },
+     { i_STOP, "STOP" },
+     { i_TRAPV, "TRAPV" },
+     { i_RTR, "RTR" },
+     { i_JSR, "JSR" },
+     { i_JMP, "JMP" },
+     { i_BSR, "BSR" },
+     { i_Bcc, "Bcc" },
+     { i_LEA, "LEA" },
+     { i_PEA, "PEA" },
+     { i_DBcc, "DBcc" },
+     { i_Scc, "Scc" },
+     { i_DIVU, "DIVU" },
+     { i_DIVS, "DIVS" },
+     { i_MULU, "MULU" },
+     { i_MULS, "MULS" },
+     { i_ASR, "ASR" },
+     { i_ASL, "ASL" },
+     { i_LSR, "LSR" },
+     { i_LSL, "LSL" },
+     { i_ROL, "ROL" },
+     { i_ROR, "ROR" },
+     { i_ROXL, "ROXL" },
+     { i_ROXR, "ROXR" },
+     { i_ASRW, "ASRW" },
+     { i_ASLW, "ASLW" },
+     { i_LSRW, "LSRW" },
+     { i_LSLW, "LSLW" },
+     { i_ROLW, "ROLW" },
+     { i_RORW, "RORW" },
+     { i_ROXLW, "ROXLW" },
+     { i_ROXRW, "ROXRW" },
+ 
+     { i_MOVE2C, "MOVE2C" },
+     { i_MOVEC2, "MOVEC2" },
+     { i_CAS, "CAS" },
+     { i_CAS2, "CAS2" },
+     { i_MULL, "MULL" },
+     { i_DIVL, "DIVL" },
+     { i_BFTST, "BFTST" },
+     { i_BFEXTU, "BFEXTU" },
+     { i_BFCHG, "BFCHG" },
+     { i_BFEXTS, "BFEXTS" },
+     { i_BFCLR, "BFCLR" },
+     { i_BFFFO, "BFFFO" },
+     { i_BFSET, "BFSET" },
+     { i_BFINS, "BFINS" },
+     { i_PACK, "PACK" },
+     { i_UNPK, "UNPK" },
+     { i_TAS, "TAS" },
+     { i_BKPT, "BKPT" },
+     { i_CALLM, "CALLM" },
+     { i_RTM, "RTM" },
+     { i_TRAPcc, "TRAPcc" },
+     { i_MOVES, "MOVES" },
+     { i_FPP, "FPP" },
+     { i_FDBcc, "FDBcc" },
+     { i_FScc, "FScc" },
+     { i_FTRAPcc, "FTRAPcc" },
+     { i_FBcc, "FBcc" },
+     { i_FBcc, "FBcc" },
+     { i_FSAVE, "FSAVE" },
+     { i_FRESTORE, "FRESTORE" },
+ 
+     { i_CINVL, "CINVL" },
+     { i_CINVP, "CINVP" },
+     { i_CINVA, "CINVA" },
+     { i_CPUSHL, "CPUSHL" },
+     { i_CPUSHP, "CPUSHP" },
+     { i_CPUSHA, "CPUSHA" },
+     { i_MOVE16, "MOVE16" },
+ 
+     { i_MMUOP, "MMUOP" },
+     { i_ILLG, "" },
+ };
+ 
+ struct instr *table68k;
+ 
+ STATIC_INLINE amodes mode_from_str (const char *str)
+ {
+     if (strncmp (str, "Dreg", 4) == 0) return Dreg;
+     if (strncmp (str, "Areg", 4) == 0) return Areg;
+     if (strncmp (str, "Aind", 4) == 0) return Aind;
+     if (strncmp (str, "Apdi", 4) == 0) return Apdi;
+     if (strncmp (str, "Aipi", 4) == 0) return Aipi;
+     if (strncmp (str, "Ad16", 4) == 0) return Ad16;
+     if (strncmp (str, "Ad8r", 4) == 0) return Ad8r;
+     if (strncmp (str, "absw", 4) == 0) return absw;
+     if (strncmp (str, "absl", 4) == 0) return absl;
+     if (strncmp (str, "PC16", 4) == 0) return PC16;
+     if (strncmp (str, "PC8r", 4) == 0) return PC8r;
+     if (strncmp (str, "Immd", 4) == 0) return imm;
+     abort ();
+     return 0;
+ }
+ 
+ STATIC_INLINE amodes mode_from_mr (int mode, int reg)
+ {
+     switch (mode) {
+      case 0: return Dreg;
+      case 1: return Areg;
+      case 2: return Aind;
+      case 3: return Aipi;
+      case 4: return Apdi;
+      case 5: return Ad16;
+      case 6: return Ad8r;
+      case 7:
+ 	switch (reg) {
+ 	 case 0: return absw;
+ 	 case 1: return absl;
+ 	 case 2: return PC16;
+ 	 case 3: return PC8r;
+ 	 case 4: return imm;
+ 	 case 5:
+ 	 case 6:
+ 	 case 7: return am_illg;
+ 	}
+     }
+     abort ();
+     return 0;
+ }
+ 
+ static void build_insn (int insn)
+ {
+     int find = -1;
+     int variants;
+     struct instr_def id;
+     const char *opcstr;
+     int i;
+ 
+     int flaglive = 0, flagdead = 0;
+ 
+     id = defs68k[insn];
+ 
+     for (i = 0; i < 5; i++) {
+ 	switch (id.flaginfo[i].flagset){
+ 	 case fa_unset: break;
+ 	 case fa_isjmp: break;
+ 	 case fa_zero: flagdead |= 1 << i; break;
+ 	 case fa_one: flagdead |= 1 << i; break;
+ 	 case fa_dontcare: flagdead |= 1 << i; break;
+ 	 case fa_unknown: flagdead = -1; goto out1;
+ 	 case fa_set: flagdead |= 1 << i; break;
+ 	}
+     }
+ 
+     out1:
+     for (i = 0; i < 5; i++) {
+ 	switch (id.flaginfo[i].flaguse) {
+ 	 case fu_unused: break;
+ 	 case fu_isjmp: flaglive |= 1 << i; break;
+ 	 case fu_maybecc: flaglive |= 1 << i; break;
+ 	 case fu_unknown: flaglive = -1; goto out2;
+ 	 case fu_used: flaglive |= 1 << i; break;
+ 	}
+     }
+     out2:
+ 
+     opcstr = id.opcstr;
+     for (variants = 0; variants < (1 << id.n_variable); variants++) {
+ 	int bitcnt[lastbit];
+ 	int bitval[lastbit];
+ 	int bitpos[lastbit];
+ 	int i;
+ 	uae_u16 opc = id.bits;
+ 	uae_u16 msk, vmsk;
+ 	int pos = 0;
+ 	int mnp = 0;
+ 	int bitno = 0;
+ 	char mnemonic[10];
+ 
+ 	wordsizes sz = sz_long;
+ 	int srcgather = 0, dstgather = 0;
+ 	int usesrc = 0, usedst = 0;
+ 	int srctype = 0;
+ 	int srcpos = -1, dstpos = -1;
+ 
+ 	amodes srcmode = am_unknown, destmode = am_unknown;
+ 	int srcreg = -1, destreg = -1;
+ 
+ 	for (i = 0; i < lastbit; i++)
+ 	    bitcnt[i] = bitval[i] = 0;
+ 
+ 	vmsk = 1 << id.n_variable;
+ 
+ 	for (i = 0, msk = 0x8000; i < 16; i++, msk >>= 1) {
+ 	    if (!(msk & id.mask)) {
+ 		int currbit = id.bitpos[bitno++];
+ 		int bit_set;
+ 		vmsk >>= 1;
+ 		bit_set = variants & vmsk ? 1 : 0;
+ 		if (bit_set)
+ 		    opc |= msk;
+ 		bitpos[currbit] = 15 - i;
+ 		bitcnt[currbit]++;
+ 		bitval[currbit] <<= 1;
+ 		bitval[currbit] |= bit_set;
+ 	    }
+ 	}
+ 
+ 	if (bitval[bitj] == 0) bitval[bitj] = 8;
+ 	/* first check whether this one does not match after all */
+ 	if (bitval[bitz] == 3 || bitval[bitC] == 1)
+ 	    continue;
+ 	if (bitcnt[bitI] && (bitval[bitI] == 0x00 || bitval[bitI] == 0xff))
+ 	    continue;
+ 
+ 	/* bitI and bitC get copied to biti and bitc */
+ 	if (bitcnt[bitI]) {
+ 	    bitval[biti] = bitval[bitI]; bitpos[biti] = bitpos[bitI];
+ 	}
+ 	if (bitcnt[bitC])
+ 	    bitval[bitc] = bitval[bitC];
+ 
+ 	pos = 0;
+ 	while (opcstr[pos] && !isspace(opcstr[pos])) {
+ 	    if (opcstr[pos] == '.') {
+ 		pos++;
+ 		switch (opcstr[pos]) {
+ 
+ 		 case 'B': sz = sz_byte; break;
+ 		 case 'W': sz = sz_word; break;
+ 		 case 'L': sz = sz_long; break;
+ 		 case 'z':
+ 		    switch (bitval[bitz]) {
+ 		     case 0: sz = sz_byte; break;
+ 		     case 1: sz = sz_word; break;
+ 		     case 2: sz = sz_long; break;
+ 		     default: abort();
+ 		    }
+ 		    break;
+ 		 default: abort();
+ 		}
+ 	    } else {
+ 		mnemonic[mnp] = opcstr[pos];
+ 		if (mnemonic[mnp] == 'f') {
+ 		    find = -1;
+ 		    switch (bitval[bitf]) {
+ 		     case 0: mnemonic[mnp] = 'R'; break;
+ 		     case 1: mnemonic[mnp] = 'L'; break;
+ 		     default: abort();
+ 		    }
+ 		}
+ 		mnp++;
+ 	    }
+ 	    pos++;
+ 	}
+ 	mnemonic[mnp] = 0;
+ 
+ 	/* now, we have read the mnemonic and the size */
+ 	while (opcstr[pos] && isspace(opcstr[pos]))
+ 	    pos++;
+ 
+ 	/* A goto a day keeps the D******a away. */
+ 	if (opcstr[pos] == 0)
+ 	    goto endofline;
+ 
+ 	/* parse the source address */
+ 	usesrc = 1;
+ 	switch (opcstr[pos++]) {
+ 	 case 'D':
+ 	    srcmode = Dreg;
+ 	    switch (opcstr[pos++]) {
+ 	     case 'r': srcreg = bitval[bitr]; srcgather = 1; srcpos = bitpos[bitr]; break;
+ 	     case 'R': srcreg = bitval[bitR]; srcgather = 1; srcpos = bitpos[bitR]; break;
+ 	     default: abort();
+ 	    }
+ 
+ 	    break;
+ 	 case 'A':
+ 	    srcmode = Areg;
+ 	    switch (opcstr[pos++]) {
+ 	     case 'r': srcreg = bitval[bitr]; srcgather = 1; srcpos = bitpos[bitr]; break;
+ 	     case 'R': srcreg = bitval[bitR]; srcgather = 1; srcpos = bitpos[bitR]; break;
+ 	     default: abort();
+ 	    }
+ 	    switch (opcstr[pos]) {
+ 	     case 'p': srcmode = Apdi; pos++; break;
+ 	     case 'P': srcmode = Aipi; pos++; break;
+ 	    }
+ 	    break;
+ 	 case '#':
+ 	    switch (opcstr[pos++]) {
+ 	     case 'z': srcmode = imm; break;
+ 	     case '0': srcmode = imm0; break;
+ 	     case '1': srcmode = imm1; break;
+ 	     case '2': srcmode = imm2; break;
+ 	     case 'i': srcmode = immi; srcreg = (uae_s32)(uae_s8)bitval[biti];
+ 		if (CPU_EMU_SIZE < 4) {
+ 		    /* Used for branch instructions */
+ 		    srctype = 1;
+ 		    srcgather = 1;
+ 		    srcpos = bitpos[biti];
+ 		}
+ 		break;
+ 	     case 'j': srcmode = immi; srcreg = bitval[bitj];
+ 		if (CPU_EMU_SIZE < 3) {
+ 		    /* 1..8 for ADDQ/SUBQ and rotshi insns */
+ 		    srcgather = 1;
+ 		    srctype = 3;
+ 		    srcpos = bitpos[bitj];
+ 		}
+ 		break;
+ 	     case 'J': srcmode = immi; srcreg = bitval[bitJ];
+ 		if (CPU_EMU_SIZE < 5) {
+ 		    /* 0..15 */
+ 		    srcgather = 1;
+ 		    srctype = 2;
+ 		    srcpos = bitpos[bitJ];
+ 		}
+ 		break;
+ 	     case 'k': srcmode = immi; srcreg = bitval[bitk];
+ 		if (CPU_EMU_SIZE < 3) {
+ 		    srcgather = 1;
+ 		    srctype = 4;
+ 		    srcpos = bitpos[bitk];
+ 		}
+ 		break;
+ 	     case 'K': srcmode = immi; srcreg = bitval[bitK];
+ 		if (CPU_EMU_SIZE < 5) {
+ 		    /* 0..15 */
+ 		    srcgather = 1;
+ 		    srctype = 5;
+ 		    srcpos = bitpos[bitK];
+ 		}
+ 		break;
+ 	     default: abort();
+ 	    }
+ 	    break;
+ 	 case 'd':
+ 	    srcreg = bitval[bitD];
+ 	    srcmode = mode_from_mr(bitval[bitd],bitval[bitD]);
+ 	    if (srcmode == am_illg)
+ 		continue;
+ 	    if (CPU_EMU_SIZE < 2 &&
+ 		(srcmode == Areg || srcmode == Dreg || srcmode == Aind
+ 		 || srcmode == Ad16 || srcmode == Ad8r || srcmode == Aipi
+ 		 || srcmode == Apdi))
+ 	    {
+ 		srcgather = 1; srcpos = bitpos[bitD];
+ 	    }
+ 	    if (opcstr[pos] == '[') {
+ 		pos++;
+ 		if (opcstr[pos] == '!') {
+ 		    /* exclusion */
+ 		    do {
+ 			pos++;
+ 			if (mode_from_str(opcstr+pos) == srcmode)
+ 			    goto nomatch;
+ 			pos += 4;
+ 		    } while (opcstr[pos] == ',');
+ 		    pos++;
+ 		} else {
+ 		    if (opcstr[pos+4] == '-') {
+ 			/* replacement */
+ 			if (mode_from_str(opcstr+pos) == srcmode)
+ 			    srcmode = mode_from_str(opcstr+pos+5);
+ 			else
+ 			    goto nomatch;
+ 			pos += 10;
+ 		    } else {
+ 			/* normal */
+ 			while(mode_from_str(opcstr+pos) != srcmode) {
+ 			    pos += 4;
+ 			    if (opcstr[pos] == ']')
+ 				goto nomatch;
+ 			    pos++;
+ 			}
+ 			while(opcstr[pos] != ']') pos++;
+ 			pos++;
+ 			break;
+ 		    }
+ 		}
+ 	    }
+ 	    /* Some addressing modes are invalid as destination */
+ 	    if (srcmode == imm || srcmode == PC16 || srcmode == PC8r)
+ 		goto nomatch;
+ 	    break;
+ 	 case 's':
+ 	    srcreg = bitval[bitS];
+ 	    srcmode = mode_from_mr(bitval[bits],bitval[bitS]);
+ 
+ 	    if (srcmode == am_illg)
+ 		continue;
+ 	    if (CPU_EMU_SIZE < 2 &&
+ 		(srcmode == Areg || srcmode == Dreg || srcmode == Aind
+ 		 || srcmode == Ad16 || srcmode == Ad8r || srcmode == Aipi
+ 		 || srcmode == Apdi))
+ 	    {
+ 		srcgather = 1; srcpos = bitpos[bitS];
+ 	    }
+ 	    if (opcstr[pos] == '[') {
+ 		pos++;
+ 		if (opcstr[pos] == '!') {
+ 		    /* exclusion */
+ 		    do {
+ 			pos++;
+ 			if (mode_from_str(opcstr+pos) == srcmode)
+ 			    goto nomatch;
+ 			pos += 4;
+ 		    } while (opcstr[pos] == ',');
+ 		    pos++;
+ 		} else {
+ 		    if (opcstr[pos+4] == '-') {
+ 			/* replacement */
+ 			if (mode_from_str(opcstr+pos) == srcmode)
+ 			    srcmode = mode_from_str(opcstr+pos+5);
+ 			else
+ 			    goto nomatch;
+ 			pos += 10;
+ 		    } else {
+ 			/* normal */
+ 			while(mode_from_str(opcstr+pos) != srcmode) {
+ 			    pos += 4;
+ 			    if (opcstr[pos] == ']')
+ 				goto nomatch;
+ 			    pos++;
+ 			}
+ 			while(opcstr[pos] != ']') pos++;
+ 			pos++;
+ 		    }
+ 		}
+ 	    }
+ 	    break;
+ 	 default: abort();
+ 	}
+ 	/* safety check - might have changed */
+ 	if (srcmode != Areg && srcmode != Dreg && srcmode != Aind
+ 	    && srcmode != Ad16 && srcmode != Ad8r && srcmode != Aipi
+ 	    && srcmode != Apdi && srcmode != immi)
+ 	{
+ 	    srcgather = 0;
+ 	}
+ 	if (srcmode == Areg && sz == sz_byte)
+ 	    goto nomatch;
+ 
+ 	if (opcstr[pos] != ',')
+ 	    goto endofline;
+ 	pos++;
+ 
+ 	/* parse the destination address */
+ 	usedst = 1;
+ 	switch (opcstr[pos++]) {
+ 	 case 'D':
+ 	    destmode = Dreg;
+ 	    switch (opcstr[pos++]) {
+ 	     case 'r': destreg = bitval[bitr]; dstgather = 1; dstpos = bitpos[bitr]; break;
+ 	     case 'R': destreg = bitval[bitR]; dstgather = 1; dstpos = bitpos[bitR]; break;
+ 	     default: abort();
+ 	    }
+ 	    break;
+ 	 case 'A':
+ 	    destmode = Areg;
+ 	    switch (opcstr[pos++]) {
+ 	     case 'r': destreg = bitval[bitr]; dstgather = 1; dstpos = bitpos[bitr]; break;
+ 	     case 'R': destreg = bitval[bitR]; dstgather = 1; dstpos = bitpos[bitR]; break;
+ 	     default: abort();
+ 	    }
+ 	    switch (opcstr[pos]) {
+ 	     case 'p': destmode = Apdi; pos++; break;
+ 	     case 'P': destmode = Aipi; pos++; break;
+ 	    }
+ 	    break;
+ 	 case '#':
+ 	    switch (opcstr[pos++]) {
+ 	     case 'z': destmode = imm; break;
+ 	     case '0': destmode = imm0; break;
+ 	     case '1': destmode = imm1; break;
+ 	     case '2': destmode = imm2; break;
+ 	     case 'i': destmode = immi; destreg = (uae_s32)(uae_s8)bitval[biti]; break;
+ 	     case 'j': destmode = immi; destreg = bitval[bitj]; break;
+ 	     case 'J': destmode = immi; destreg = bitval[bitJ]; break;
+ 	     case 'k': destmode = immi; destreg = bitval[bitk]; break;
+ 	     case 'K': destmode = immi; destreg = bitval[bitK]; break;
+ 	     default: abort();
+ 	    }
+ 	    break;
+ 	 case 'd':
+ 	    destreg = bitval[bitD];
+ 	    destmode = mode_from_mr(bitval[bitd],bitval[bitD]);
+ 	    if (destmode == am_illg)
+ 		continue;
+ 	    if (CPU_EMU_SIZE < 1 &&
+ 		(destmode == Areg || destmode == Dreg || destmode == Aind
+ 		 || destmode == Ad16 || destmode == Ad8r || destmode == Aipi
+ 		 || destmode == Apdi))
+ 	    {
+ 		dstgather = 1; dstpos = bitpos[bitD];
+ 	    }
+ 
+ 	    if (opcstr[pos] == '[') {
+ 		pos++;
+ 		if (opcstr[pos] == '!') {
+ 		    /* exclusion */
+ 		    do {
+ 			pos++;
+ 			if (mode_from_str(opcstr+pos) == destmode)
+ 			    goto nomatch;
+ 			pos += 4;
+ 		    } while (opcstr[pos] == ',');
+ 		    pos++;
+ 		} else {
+ 		    if (opcstr[pos+4] == '-') {
+ 			/* replacement */
+ 			if (mode_from_str(opcstr+pos) == destmode)
+ 			    destmode = mode_from_str(opcstr+pos+5);
+ 			else
+ 			    goto nomatch;
+ 			pos += 10;
+ 		    } else {
+ 			/* normal */
+ 			while(mode_from_str(opcstr+pos) != destmode) {
+ 			    pos += 4;
+ 			    if (opcstr[pos] == ']')
+ 				goto nomatch;
+ 			    pos++;
+ 			}
+ 			while(opcstr[pos] != ']') pos++;
+ 			pos++;
+ 			break;
+ 		    }
+ 		}
+ 	    }
+ 	    /* Some addressing modes are invalid as destination */
+ 	    if (destmode == imm || destmode == PC16 || destmode == PC8r)
+ 		goto nomatch;
+ 	    break;
+ 	 case 's':
+ 	    destreg = bitval[bitS];
+ 	    destmode = mode_from_mr(bitval[bits],bitval[bitS]);
+ 
+ 	    if (destmode == am_illg)
+ 		continue;
+ 	    if (CPU_EMU_SIZE < 1 &&
+ 		(destmode == Areg || destmode == Dreg || destmode == Aind
+ 		 || destmode == Ad16 || destmode == Ad8r || destmode == Aipi
+ 		 || destmode == Apdi))
+ 	    {
+ 		dstgather = 1; dstpos = bitpos[bitS];
+ 	    }
+ 
+ 	    if (opcstr[pos] == '[') {
+ 		pos++;
+ 		if (opcstr[pos] == '!') {
+ 		    /* exclusion */
+ 		    do {
+ 			pos++;
+ 			if (mode_from_str(opcstr+pos) == destmode)
+ 			    goto nomatch;
+ 			pos += 4;
+ 		    } while (opcstr[pos] == ',');
+ 		    pos++;
+ 		} else {
+ 		    if (opcstr[pos+4] == '-') {
+ 			/* replacement */
+ 			if (mode_from_str(opcstr+pos) == destmode)
+ 			    destmode = mode_from_str(opcstr+pos+5);
+ 			else
+ 			    goto nomatch;
+ 			pos += 10;
+ 		    } else {
+ 			/* normal */
+ 			while(mode_from_str(opcstr+pos) != destmode) {
+ 			    pos += 4;
+ 			    if (opcstr[pos] == ']')
+ 				goto nomatch;
+ 			    pos++;
+ 			}
+ 			while(opcstr[pos] != ']') pos++;
+ 			pos++;
+ 		    }
+ 		}
+ 	    }
+ 	    break;
+ 	 default: abort();
+ 	}
+ 	/* safety check - might have changed */
+ 	if (destmode != Areg && destmode != Dreg && destmode != Aind
+ 	    && destmode != Ad16 && destmode != Ad8r && destmode != Aipi
+ 	    && destmode != Apdi)
+ 	{
+ 	    dstgather = 0;
+ 	}
+ 
+ 	if (destmode == Areg && sz == sz_byte)
+ 	    goto nomatch;
+ #if 0
+ 	if (sz == sz_byte && (destmode == Aipi || destmode == Apdi)) {
+ 	    dstgather = 0;
+ 	}
+ #endif
+ 	endofline:
+ 	/* now, we have a match */
+ 	if (table68k[opc].mnemo != i_ILLG)
+ 	    fprintf(stderr, "Double match: %x: %s\n", opc, opcstr);
+ 	if (find == -1) {
+ 	    for (find = 0;; find++) {
+ 		if (strcmp(mnemonic, lookuptab[find].name) == 0) {
+ 		    table68k[opc].mnemo = lookuptab[find].mnemo;
+ 		    break;
+ 		}
+ 		if (strlen(lookuptab[find].name) == 0) abort();
+ 	    }
+ 	}
+ 	else {
+ 	    table68k[opc].mnemo = lookuptab[find].mnemo;
+ 	}
+ 	table68k[opc].cc = bitval[bitc];
+ 	if (table68k[opc].mnemo == i_BTST
+ 	    || table68k[opc].mnemo == i_BSET
+ 	    || table68k[opc].mnemo == i_BCLR
+ 	    || table68k[opc].mnemo == i_BCHG)
+ 	{
+ 	    sz = destmode == Dreg ? sz_long : sz_byte;
+ 	}
+ 	table68k[opc].size = sz;
+ 	table68k[opc].sreg = srcreg;
+ 	table68k[opc].dreg = destreg;
+ 	table68k[opc].smode = srcmode;
+ 	table68k[opc].dmode = destmode;
+ 	table68k[opc].spos = srcgather ? srcpos : -1;
+ 	table68k[opc].dpos = dstgather ? dstpos : -1;
+ 	table68k[opc].suse = usesrc;
+ 	table68k[opc].duse = usedst;
+ 	table68k[opc].stype = srctype;
+ 	table68k[opc].plev = id.plevel;
+ 	table68k[opc].clev = id.cpulevel;
+ #if 0
+ 	for (i = 0; i < 5; i++) {
+ 	    table68k[opc].flaginfo[i].flagset = id.flaginfo[i].flagset;
+ 	    table68k[opc].flaginfo[i].flaguse = id.flaginfo[i].flaguse;
+ 	}
+ #endif
+ 	table68k[opc].flagdead = flagdead;
+ 	table68k[opc].flaglive = flaglive;
+ 	nomatch:
+ 	/* FOO! */;
+     }
+ }
+ 
+ 
+ void read_table68k (void)
+ {
+     int i;
+ 
+     table68k = (struct instr *)xmalloc (65536 * sizeof (struct instr));
+     for (i = 0; i < 65536; i++) {
+ 	table68k[i].mnemo = i_ILLG;
+ 	table68k[i].handler = -1;
+     }
+     for (i = 0; i < n_defs68k; i++) {
+ 	build_insn (i);
+     }
+ }
+ 
+ static int mismatch;
+ 
+ static void handle_merges (long int opcode)
+ {
+     uae_u16 smsk;
+     uae_u16 dmsk;
+     int sbitdst, dstend;
+     int srcreg, dstreg;
+ 
+     if (table68k[opcode].spos == -1) {
+ 	sbitdst = 1; smsk = 0;
+     } else {
+ 	switch (table68k[opcode].stype) {
+ 	 case 0:
+ 	    smsk = 7; sbitdst = 8; break;
+ 	 case 1:
+ 	    smsk = 255; sbitdst = 256; break;
+ 	 case 2:
+ 	    smsk = 15; sbitdst = 16; break;
+ 	 case 3:
+ 	    smsk = 7; sbitdst = 8; break;
+ 	 case 4:
+ 	    smsk = 7; sbitdst = 8; break;
+ 	 case 5:
+ 	    smsk = 63; sbitdst = 64; break;
+ 	 default:
+ 	    smsk = 0; sbitdst = 0;
+ 	    abort();
+ 	    break;
+ 	}
+ 	smsk <<= table68k[opcode].spos;
+     }
+     if (table68k[opcode].dpos == -1) {
+ 	dstend = 1; dmsk = 0;
+     } else {
+ 	dmsk = 7 << table68k[opcode].dpos;
+ 	dstend = 8;
+     }
+     for (srcreg=0; srcreg < sbitdst; srcreg++) {
+ 	for (dstreg=0; dstreg < dstend; dstreg++) {
+ 	    uae_u16 code = opcode;
+ 
+ 	    code = (code & ~smsk) | (srcreg << table68k[opcode].spos);
+ 	    code = (code & ~dmsk) | (dstreg << table68k[opcode].dpos);
+ 
+ 	    /* Check whether this is in fact the same instruction.
+ 	     * The instructions should never differ, except for the
+ 	     * Bcc.(BW) case. */
+ 	    if (table68k[code].mnemo != table68k[opcode].mnemo
+ 		|| table68k[code].size != table68k[opcode].size
+ 		|| table68k[code].suse != table68k[opcode].suse
+ 		|| table68k[code].duse != table68k[opcode].duse)
+ 	    {
+ 		mismatch++; continue;
+ 	    }
+ 	    if (table68k[opcode].suse
+ 		&& (table68k[opcode].spos != table68k[code].spos
+ 		    || table68k[opcode].smode != table68k[code].smode
+ 		    || table68k[opcode].stype != table68k[code].stype))
+ 	    {
+ 		mismatch++; continue;
+ 	    }
+ 	    if (table68k[opcode].duse
+ 		&& (table68k[opcode].dpos != table68k[code].dpos
+ 		    || table68k[opcode].dmode != table68k[code].dmode))
+ 	    {
+ 		mismatch++; continue;
+ 	    }
+ 
+ 	    if (code != opcode)
+ 		table68k[code].handler = opcode;
+ 	}
+     }
+ }
+ 
+ void do_merges (void)
+ {
+     long int opcode;
+     int nr = 0;
+     mismatch = 0;
+     for (opcode = 0; opcode < 65536; opcode++) {
+ 	if (table68k[opcode].handler != -1 || table68k[opcode].mnemo == i_ILLG)
+ 	    continue;
+ 	nr++;
+ 	handle_merges (opcode);
+     }
+     nr_cpuop_funcs = nr;
+ }
+ 
+ int get_no_mismatches (void)
+ {
+     return mismatch;
+ }
diff -Nrc3p /dunes/wcohen/virg-netgdb/src/sim/m68k/support.c src/sim/m68k/support.c
*** /dunes/wcohen/virg-netgdb/src/sim/m68k/support.c	Wed Dec 31 19:00:00 1969
--- src/sim/m68k/support.c	Mon Feb 19 14:10:25 2001
***************
*** 0 ****
--- 1,32 ----
+  /* 
+   * UAE - The Un*x Amiga Emulator
+   * 
+   * Miscellaneous machine dependent support functions and definitions
+   *
+   * Copyright 1996 Bernd Schmidt
+   */
+ 
+ #include "sysconfig.h"
+ #include "sysdeps.h"
+ 
+ #include "config.h"
+ #include "options.h"
+ #include "machdep/m68k.h"
+ 
+ struct flag_struct regflags;
+ 
+ int fast_memcmp(const void *foo, const void *bar, int len)
+ {
+     return memcmp(foo, bar, len);
+ }
+ 
+ int memcmpy(void *foo, const void *bar, int len)
+ {
+     int differs = memcmp(foo, bar, len);
+     memcpy(foo, bar, len);
+     return differs;
+ }
+ 
+ void machdep_init (void)
+ {
+ }
diff -Nrc3p /dunes/wcohen/virg-netgdb/src/sim/m68k/sysconfig.h src/sim/m68k/sysconfig.h
*** /dunes/wcohen/virg-netgdb/src/sim/m68k/sysconfig.h	Wed Dec 31 19:00:00 1969
--- src/sim/m68k/sysconfig.h	Mon Feb 19 14:10:25 2001
***************
*** 0 ****
--- 1,364 ----
+ /* src/sysconfig.h.  Generated automatically by configure.  */
+ /* src/sysconfig.h.in.  Generated automatically from configure.in by autoheader.  */
+ 
+ /* Define if on AIX 3.
+    System headers sometimes define this.
+    We just want to avoid a redefinition error message.  */
+ #ifndef _ALL_SOURCE
+ /* #undef _ALL_SOURCE */
+ #endif
+ 
+ /* Define to empty if the keyword does not work.  */
+ /* #undef const */
+ 
+ /* Define if you have the getmntent function.  */
+ #define HAVE_GETMNTENT 1
+ 
+ /* Define if your struct stat has st_blocks.  */
+ #define HAVE_ST_BLOCKS 1
+ 
+ /* Define if utime(file, NULL) sets file's timestamp to the present.  */
+ #define HAVE_UTIME_NULL 1
+ 
+ /* Define as __inline if that's what the C compiler calls it.  */
+ /* #undef inline */
+ 
+ /* Define to `int' if <sys/types.h> doesn't define.  */
+ /* #undef mode_t */
+ 
+ /* Define to `long' if <sys/types.h> doesn't define.  */
+ /* #undef off_t */
+ 
+ /* Define to `int' if <sys/types.h> doesn't define.  */
+ /* #undef pid_t */
+ 
+ /* Define if you need to in order for stat and other things to work.  */
+ /* #undef _POSIX_SOURCE */
+ 
+ /* Define as the return type of signal handlers (int or void).  */
+ #define RETSIGTYPE void
+ 
+ /* Define if you have the ANSI C header files.  */
+ #define STDC_HEADERS 1
+ 
+ /* Define if you can safely include both <sys/time.h> and <time.h>.  */
+ #define TIME_WITH_SYS_TIME 1
+ 
+ /* Define if your <sys/time.h> declares struct tm.  */
+ /* #undef TM_IN_SYS_TIME */
+ 
+ /* Define if the X Window System is missing or not being used.  */
+ /* #undef X_DISPLAY_MISSING */
+ 
+ /* Define if you have the Andrew File System.  */
+ /* #undef AFS */
+ 
+ /* Define if there is no specific function for reading the list of
+    mounted filesystems.  fread will be used to read /etc/mnttab.  [SVR2]  */
+ /* #undef MOUNTED_FREAD */
+ 
+ /* Define if (like SVR2) there is no specific function for reading the
+    list of mounted filesystems, and your system has these header files:
+    <sys/fstyp.h> and <sys/statfs.h>.  [SVR3]  */
+ /* #undef MOUNTED_FREAD_FSTYP */
+ 
+ /* Define if there is a function named getfsstat for reading the list
+    of mounted filesystems.  [DEC Alpha running OSF/1]  */
+ /* #undef MOUNTED_GETFSSTAT */
+ 
+ /* Define if there is a function named getmnt for reading the list of
+    mounted filesystems.  [Ultrix]  */
+ /* #undef MOUNTED_GETMNT */
+ 
+ /* Define if there is a function named getmntent for reading the list
+    of mounted filesystems, and that function takes a single argument.
+    [4.3BSD, SunOS, HP-UX, Dynix, Irix]  */
+ #define MOUNTED_GETMNTENT1 1
+ 
+ /* Define if there is a function named getmntent for reading the list of
+    mounted filesystems, and that function takes two arguments.  [SVR4]  */
+ /* #undef MOUNTED_GETMNTENT2 */
+ 
+ /* Define if there is a function named getmntinfo for reading the list
+    of mounted filesystems.  [4.4BSD]  */
+ /* #undef MOUNTED_GETMNTINFO */
+ 
+ /* Define if there is a function named listmntent that can be used to
+    list all mounted filesystems. [UNICOS] */
+ /* #undef MOUNTED_LISTMNTENT */
+ 
+ /* Define if there is a function named mntctl that can be used to read
+    the list of mounted filesystems, and there is a system header file
+    that declares `struct vmount.'  [AIX]  */
+ /* #undef MOUNTED_VMOUNT */
+ 
+ /*  Define if  statfs takes 3 args.  [DEC Alpha running OSF/1]  */
+ /* #undef STAT_STATFS3_OSF1 */
+ 
+ /* Define if there is no specific function for reading filesystems usage
+    information and you have the <sys/filsys.h> header file.  [SVR2]  */
+ /* #undef STAT_READ_FILSYS */
+ 
+ /* Define if statfs takes 2 args and struct statfs has a field named f_bsize.
+    [4.3BSD, SunOS 4, HP-UX, AIX PS/2]  */
+ /* #undef STAT_STATFS2_BSIZE */
+ 
+ /* Define if statfs takes 2 args and struct statfs has a field named f_fsize.
+    [4.4BSD, NetBSD]  */
+ /* #undef STAT_STATFS2_FSIZE */
+ 
+ /* Define if statfs takes 2 args and the second argument has
+    type struct fs_data.  [Ultrix]  */
+ /* #undef STAT_STATFS2_FS_DATA */
+ 
+ /* Define if statfs takes 4 args.  [SVR3, Dynix, Irix, Dolphin]  */
+ /* #undef STAT_STATFS4 */
+ 
+ /* Define if there is a function named statvfs.  [SVR4]  */
+ #define STAT_STATVFS 1
+ 
+ /* Define if the block counts reported by statfs may be truncated to 2GB
+    and the correct values may be stored in the f_spare array.
+    [SunOS 4.1.2, 4.1.3, and 4.1.3_U1 are reported to have this problem.
+    SunOS 4.1.1 seems not to be affected.]  */
+ /* #undef STATFS_TRUNCATES_BLOCK_COUNTS */
+ 
+ /* The number of bytes in a __int64.  */
+ #define SIZEOF___INT64 0
+ 
+ /* The number of bytes in a char.  */
+ #define SIZEOF_CHAR 1
+ 
+ /* The number of bytes in a int.  */
+ #define SIZEOF_INT 4
+ 
+ /* The number of bytes in a long.  */
+ #define SIZEOF_LONG 4
+ 
+ /* The number of bytes in a long long.  */
+ #define SIZEOF_LONG_LONG 8
+ 
+ /* The number of bytes in a short.  */
+ #define SIZEOF_SHORT 2
+ 
+ /* Define if you have the bcopy function.  */
+ #define HAVE_BCOPY 1
+ 
+ /* Define if you have the cfmakeraw function.  */
+ #define HAVE_CFMAKERAW 1
+ 
+ /* Define if you have the endgrent function.  */
+ #define HAVE_ENDGRENT 1
+ 
+ /* Define if you have the endpwent function.  */
+ #define HAVE_ENDPWENT 1
+ 
+ /* Define if you have the fchdir function.  */
+ #define HAVE_FCHDIR 1
+ 
+ /* Define if you have the ftime function.  */
+ #define HAVE_FTIME 1
+ 
+ /* Define if you have the ftruncate function.  */
+ #define HAVE_FTRUNCATE 1
+ 
+ /* Define if you have the getcwd function.  */
+ #define HAVE_GETCWD 1
+ 
+ /* Define if you have the getmntinfo function.  */
+ /* #undef HAVE_GETMNTINFO */
+ 
+ /* Define if you have the getopt function.  */
+ #define HAVE_GETOPT 1
+ 
+ /* Define if you have the gettimeofday function.  */
+ #define HAVE_GETTIMEOFDAY 1
+ 
+ /* Define if you have the isascii function.  */
+ #define HAVE_ISASCII 1
+ 
+ /* Define if you have the lchown function.  */
+ #define HAVE_LCHOWN 1
+ 
+ /* Define if you have the listmntent function.  */
+ /* #undef HAVE_LISTMNTENT */
+ 
+ /* Define if you have the memcpy function.  */
+ #define HAVE_MEMCPY 1
+ 
+ /* Define if you have the mkdir function.  */
+ #define HAVE_MKDIR 1
+ 
+ /* Define if you have the mkfifo function.  */
+ #define HAVE_MKFIFO 1
+ 
+ /* Define if you have the readdir_r function.  */
+ #define HAVE_READDIR_R 1
+ 
+ /* Define if you have the rmdir function.  */
+ #define HAVE_RMDIR 1
+ 
+ /* Define if you have the select function.  */
+ #define HAVE_SELECT 1
+ 
+ /* Define if you have the sigaction function.  */
+ #define HAVE_SIGACTION 1
+ 
+ /* Define if you have the strchr function.  */
+ #define HAVE_STRCHR 1
+ 
+ /* Define if you have the strdup function.  */
+ #define HAVE_STRDUP 1
+ 
+ /* Define if you have the strerror function.  */
+ #define HAVE_STRERROR 1
+ 
+ /* Define if you have the strrchr function.  */
+ #define HAVE_STRRCHR 1
+ 
+ /* Define if you have the strstr function.  */
+ #define HAVE_STRSTR 1
+ 
+ /* Define if you have the tcgetattr function.  */
+ #define HAVE_TCGETATTR 1
+ 
+ /* Define if you have the vfprintf function.  */
+ #define HAVE_VFPRINTF 1
+ 
+ /* Define if you have the vprintf function.  */
+ #define HAVE_VPRINTF 1
+ 
+ /* Define if you have the vsprintf function.  */
+ #define HAVE_VSPRINTF 1
+ 
+ /* Define if you have the <curses.h> header file.  */
+ #define HAVE_CURSES_H 1
+ 
+ /* Define if you have the <cybergraphx/cybergraphics.h> header file.  */
+ /* #undef HAVE_CYBERGRAPHX_CYBERGRAPHICS_H */
+ 
+ /* Define if you have the <ddraw.h> header file.  */
+ /* #undef HAVE_DDRAW_H */
+ 
+ /* Define if you have the <devices/ahi.h> header file.  */
+ /* #undef HAVE_DEVICES_AHI_H */
+ 
+ /* Define if you have the <dirent.h> header file.  */
+ #define HAVE_DIRENT_H 1
+ 
+ /* Define if you have the <fcntl.h> header file.  */
+ #define HAVE_FCNTL_H 1
+ 
+ /* Define if you have the <features.h> header file.  */
+ #define HAVE_FEATURES_H 1
+ 
+ /* Define if you have the <getopt.h> header file.  */
+ #define HAVE_GETOPT_H 1
+ 
+ /* Define if you have the <libraries/cybergraphics.h> header file.  */
+ /* #undef HAVE_LIBRARIES_CYBERGRAPHICS_H */
+ 
+ /* Define if you have the <machine/joystick.h> header file.  */
+ /* #undef HAVE_MACHINE_JOYSTICK_H */
+ 
+ /* Define if you have the <machine/soundcard.h> header file.  */
+ /* #undef HAVE_MACHINE_SOUNDCARD_H */
+ 
+ /* Define if you have the <mntent.h> header file.  */
+ #define HAVE_MNTENT_H 1
+ 
+ /* Define if you have the <mnttab.h> header file.  */
+ /* #undef HAVE_MNTTAB_H */
+ 
+ /* Define if you have the <ncurses.h> header file.  */
+ #define HAVE_NCURSES_H 1
+ 
+ /* Define if you have the <ndir.h> header file.  */
+ /* #undef HAVE_NDIR_H */
+ 
+ /* Define if you have the <posix_opt.h> header file.  */
+ /* #undef HAVE_POSIX_OPT_H */
+ 
+ /* Define if you have the <string.h> header file.  */
+ #define HAVE_STRING_H 1
+ 
+ /* Define if you have the <strings.h> header file.  */
+ #define HAVE_STRINGS_H 1
+ 
+ /* Define if you have the <sun/audioio.h> header file.  */
+ /* #undef HAVE_SUN_AUDIOIO_H */
+ 
+ /* Define if you have the <sys/audioio.h> header file.  */
+ /* #undef HAVE_SYS_AUDIOIO_H */
+ 
+ /* Define if you have the <sys/dir.h> header file.  */
+ /* #undef HAVE_SYS_DIR_H */
+ 
+ /* Define if you have the <sys/filsys.h> header file.  */
+ /* #undef HAVE_SYS_FILSYS_H */
+ 
+ /* Define if you have the <sys/fs/s5param.h> header file.  */
+ /* #undef HAVE_SYS_FS_S5PARAM_H */
+ 
+ /* Define if you have the <sys/fs_types.h> header file.  */
+ /* #undef HAVE_SYS_FS_TYPES_H */
+ 
+ /* Define if you have the <sys/fstyp.h> header file.  */
+ /* #undef HAVE_SYS_FSTYP_H */
+ 
+ /* Define if you have the <sys/ioctl.h> header file.  */
+ #define HAVE_SYS_IOCTL_H 1
+ 
+ /* Define if you have the <sys/ipc.h> header file.  */
+ #define HAVE_SYS_IPC_H 1
+ 
+ /* Define if you have the <sys/mount.h> header file.  */
+ #define HAVE_SYS_MOUNT_H 1
+ 
+ /* Define if you have the <sys/ndir.h> header file.  */
+ /* #undef HAVE_SYS_NDIR_H */
+ 
+ /* Define if you have the <sys/param.h> header file.  */
+ #define HAVE_SYS_PARAM_H 1
+ 
+ /* Define if you have the <sys/shm.h> header file.  */
+ #define HAVE_SYS_SHM_H 1
+ 
+ /* Define if you have the <sys/soundcard.h> header file.  */
+ #define HAVE_SYS_SOUNDCARD_H 1
+ 
+ /* Define if you have the <sys/stat.h> header file.  */
+ #define HAVE_SYS_STAT_H 1
+ 
+ /* Define if you have the <sys/statfs.h> header file.  */
+ #define HAVE_SYS_STATFS_H 1
+ 
+ /* Define if you have the <sys/statvfs.h> header file.  */
+ #define HAVE_SYS_STATVFS_H 1
+ 
+ /* Define if you have the <sys/termios.h> header file.  */
+ #define HAVE_SYS_TERMIOS_H 1
+ 
+ /* Define if you have the <sys/time.h> header file.  */
+ #define HAVE_SYS_TIME_H 1
+ 
+ /* Define if you have the <sys/types.h> header file.  */
+ #define HAVE_SYS_TYPES_H 1
+ 
+ /* Define if you have the <sys/utime.h> header file.  */
+ /* #undef HAVE_SYS_UTIME_H */
+ 
+ /* Define if you have the <sys/vfs.h> header file.  */
+ #define HAVE_SYS_VFS_H 1
+ 
+ /* Define if you have the <unistd.h> header file.  */
+ #define HAVE_UNISTD_H 1
+ 
+ /* Define if you have the <utime.h> header file.  */
+ #define HAVE_UTIME_H 1
+ 
+ /* Define if you have the <values.h> header file.  */
+ #define HAVE_VALUES_H 1
+ 
+ /* Define if you have the <windows.h> header file.  */
+ /* #undef HAVE_WINDOWS_H */
diff -Nrc3p /dunes/wcohen/virg-netgdb/src/sim/m68k/table68k src/sim/m68k/table68k
*** /dunes/wcohen/virg-netgdb/src/sim/m68k/table68k	Wed Dec 31 19:00:00 1969
--- src/sim/m68k/table68k	Mon Feb 19 14:10:25 2001
***************
*** 0 ****
--- 1,253 ----
+ % 0: bit 0
+ % 1: bit 1
+ % c: condition code
+ % C: condition codes, except F
+ % f: direction
+ % i: immediate
+ % I: immediate, except 00 and ff
+ % j: immediate 1..8
+ % J: immediate 0..15
+ % k: immediate 0..7
+ % K: immediate 0..63
+ % s: source mode
+ % S: source reg
+ % d: dest mode
+ % D: dest reg
+ % r: reg
+ % z: size
+ %
+ % Actually, a sssSSS may appear as a destination, and
+ % vice versa. The only difference between sssSSS and
+ % dddDDD are the valid addressing modes. There is
+ % no match for immediate and pc-rel. addressing modes
+ % in case of dddDDD.
+ %
+ % Arp: --> -(Ar)
+ % ArP: --> (Ar)+
+ %
+ % Fields on a line: 
+ % 16 chars bitpattern : 
+ % CPU level / privildge level :
+ %   CPU level 0: 68000
+ %             1: 68010
+ %             2: 68020
+ %   privilege level 0: not privileged
+ %                   1: unprivileged only on 68000 (check regs.s)
+ %                   2: privileged                 (check regs.s)
+ %                   3: privileged if size == word (check regs.s)
+ % Flags set by instruction: XNZVC :
+ % Flags used by instruction: XNZVC :
+ %   - means flag unaffected / unused
+ %   0 means flag reset
+ %   1 means flag set
+ %   ? means programmer was too lazy to check or instruction may trap
+ %   + means instruction is conditional branch 
+ %     everything else means flag set/used
+ %   / means instruction is unconditional branch/call
+ %   x means flag is unknown and well-behaved programs shouldn't check it
+ % srcaddr status destaddr status :
+ %   bitmasks of
+ %   1 means fetched
+ %   2 means stored
+ %   4 means jump offset
+ %   8 means jump address
+ % instruction
+ %
+ 
+ 0000 0000 0011 1100:00:XNZVC:XNZVC:10: ORSR.B  #1
+ 0000 0000 0111 1100:02:?????:?????:10: ORSR.W  #1
+ 0000 0zz0 11ss sSSS:20:?????:?????:11: CHK2.z  #1,s[!Dreg,Areg,Aipi,Apdi,Immd]
+ 0000 0000 zzdd dDDD:00:-NZ00:-----:13: OR.z    #z,d[!Areg]
+ 0000 0010 0011 1100:00:XNZVC:XNZVC:10: ANDSR.B #1
+ 0000 0010 0111 1100:02:?????:?????:10: ANDSR.W #1
+ 0000 0010 zzdd dDDD:00:-NZ00:-----:13: AND.z   #z,d[!Areg]
+ 0000 0100 zzdd dDDD:00:XNZVC:-----:13: SUB.z   #z,d[!Areg]
+ 0000 0110 zzdd dDDD:00:XNZVC:-----:13: ADD.z   #z,d[!Areg]
+ 0000 0110 11ss sSSS:20:?????:?????:10: CALLM   s[!Dreg,Areg,Aipi,Apdi,Immd]
+ 0000 0110 11ss sSSS:20:?????:?????:10: RTM     s[Dreg,Areg]
+ 0000 1000 00ss sSSS:00:--Z--:-----:11: BTST    #1,s[!Areg]
+ 0000 1000 01ss sSSS:00:--Z--:-----:13: BCHG    #1,s[!Areg,Immd]
+ 0000 1000 10ss sSSS:00:--Z--:-----:13: BCLR    #1,s[!Areg,Immd]
+ 0000 1000 11ss sSSS:00:--Z--:-----:13: BSET    #1,s[!Areg,Immd]
+ 0000 1010 0011 1100:00:XNZVC:XNZVC:10: EORSR.B #1
+ 0000 1010 0111 1100:02:?????:?????:10: EORSR.W #1
+ 0000 1010 zzdd dDDD:00:-NZ00:-----:13: EOR.z   #z,d[!Areg]
+ 0000 1100 zzss sSSS:00:-NZVC:-----:11: CMP.z   #z,s[!Areg,Immd]
+ 
+ 0000 1010 11ss sSSS:20:?????:?????:13: CAS.B   #1,s[!Dreg,Areg,Immd,PC8r,PC16]
+ 0000 1100 11ss sSSS:20:?????:?????:13: CAS.W   #1,s[!Dreg,Areg,Immd,PC8r,PC16]
+ 0000 1100 1111 1100:20:?????:?????:10: CAS2.W  #2
+ 0000 1110 zzss sSSS:22:?????:?????:13: MOVES.z #1,s[!Dreg,Areg,Immd,PC8r,PC16]
+ 0000 1110 11ss sSSS:20:?????:?????:13: CAS.L   #1,s[!Dreg,Areg,Immd,PC8r,PC16]
+ 0000 1110 1111 1100:20:?????:?????:10: CAS2.L  #2
+ 
+ 0000 rrr1 00dd dDDD:00:-----:-----:12: MVPMR.W d[Areg-Ad16],Dr
+ 0000 rrr1 01dd dDDD:00:-----:-----:12: MVPMR.L d[Areg-Ad16],Dr
+ 0000 rrr1 10dd dDDD:00:-----:-----:12: MVPRM.W Dr,d[Areg-Ad16]
+ 0000 rrr1 11dd dDDD:00:-----:-----:12: MVPRM.L Dr,d[Areg-Ad16]
+ 0000 rrr1 00ss sSSS:00:--Z--:-----:11: BTST    Dr,s[!Areg]
+ 0000 rrr1 01ss sSSS:00:--Z--:-----:13: BCHG    Dr,s[!Areg,Immd]
+ 0000 rrr1 10ss sSSS:00:--Z--:-----:13: BCLR    Dr,s[!Areg,Immd]
+ 0000 rrr1 11ss sSSS:00:--Z--:-----:13: BSET    Dr,s[!Areg,Immd]
+ 
+ 0001 DDDd ddss sSSS:00:-NZ00:-----:12: MOVE.B  s,d[!Areg]
+ 0010 DDDd ddss sSSS:00:-----:-----:12: MOVEA.L s,d[Areg]
+ 0010 DDDd ddss sSSS:00:-NZ00:-----:12: MOVE.L  s,d[!Areg]
+ 0011 DDDd ddss sSSS:00:-----:-----:12: MOVEA.W s,d[Areg]
+ 0011 DDDd ddss sSSS:00:-NZ00:-----:12: MOVE.W  s,d[!Areg]
+ 
+ 0100 0000 zzdd dDDD:00:XxZxC:-----:30: NEGX.z  d[!Areg]
+ 0100 0000 11dd dDDD:01:?????:?????:10: MVSR2.W d[!Areg]
+ 0100 0010 zzdd dDDD:00:-0100:-----:20: CLR.z   d[!Areg]
+ 0100 0010 11dd dDDD:10:?????:?????:10: MVSR2.B d[!Areg]
+ 0100 0100 zzdd dDDD:00:XNZVC:-----:30: NEG.z   d[!Areg]
+ 0100 0100 11ss sSSS:00:XNZVC:-----:10: MV2SR.B s[!Areg]
+ 0100 0110 zzdd dDDD:00:-NZ00:-----:30: NOT.z   d[!Areg]
+ 0100 0110 11ss sSSS:02:?????:?????:10: MV2SR.W s[!Areg]
+ 0100 1000 0000 1rrr:20:-----:-----:31: LINK.L  Ar,#2
+ 0100 1000 00dd dDDD:00:X?Z?C:X-Z--:30: NBCD.B  d[!Areg]
+ 0100 1000 0100 1kkk:20:?????:?????:10: BKPT    #k
+ 0100 1000 01ss sSSS:00:-NZ00:-----:30: SWAP.W  s[Dreg]         
+ 0100 1000 01ss sSSS:00:-----:-----:00: PEA.L   s[!Dreg,Areg,Aipi,Apdi,Immd]
+ 0100 1000 10dd dDDD:00:-NZ00:-----:30: EXT.W   d[Dreg]         
+ 0100 1000 10dd dDDD:00:-----:-----:02: MVMLE.W #1,d[!Dreg,Areg,Aipi]
+ 0100 1000 11dd dDDD:00:-NZ00:-----:30: EXT.L   d[Dreg]         
+ 0100 1000 11dd dDDD:00:-----:-----:02: MVMLE.L #1,d[!Dreg,Areg,Aipi]
+ 0100 1001 11dd dDDD:00:-NZ00:-----:30: EXT.B   d[Dreg]         
+ 0100 1010 zzss sSSS:00:-NZ00:-----:10: TST.z   s
+ 0100 1010 11dd dDDD:00:?????:?????:30: TAS.B   d[!Areg]
+ 0100 1010 1111 1100:00:?????:?????:00: ILLEGAL
+ 0100 1100 00ss sSSS:20:-NZVC:-----:13: MULL.L  #1,s[!Areg]
+ 0100 1100 01ss sSSS:20:?????:?????:13: DIVL.L  #1,s[!Areg]
+ 0100 1100 10ss sSSS:00:-----:-----:01: MVMEL.W #1,s[!Dreg,Areg,Apdi,Immd]
+ 0100 1100 11ss sSSS:00:-----:-----:01: MVMEL.L #1,s[!Dreg,Areg,Apdi,Immd]
+ 0100 1110 0100 JJJJ:00:-----:XNZVC:10: TRAP    #J
+ 0100 1110 0101 0rrr:00:-----:-----:31: LINK.W  Ar,#1
+ 0100 1110 0101 1rrr:00:-----:-----:30: UNLK.L  Ar
+ 0100 1110 0110 0rrr:02:-----:-----:10: MVR2USP.L Ar
+ 0100 1110 0110 1rrr:02:-----:-----:20: MVUSP2R.L Ar
+ 0100 1110 0111 0000:02:-----:-----:00: RESET
+ 0100 1110 0111 0001:00:-----:-----:00: NOP
+ 0100 1110 0111 0010:02:XNZVC:-----:10: STOP    #1
+ 0100 1110 0111 0011:02:XNZVC:-----:00: RTE
+ 0100 1110 0111 0100:00:?????:?????:10: RTD     #1
+ 0100 1110 0111 0101:00:-----:-----:00: RTS
+ 0100 1110 0111 0110:00:-----:XNZVC:00: TRAPV
+ 0100 1110 0111 0111:00:XNZVC:-----:00: RTR
+ 0100 1110 0111 1010:12:?????:?????:10: MOVEC2  #1
+ 0100 1110 0111 1011:12:?????:?????:10: MOVE2C  #1
+ 0100 1110 10ss sSSS:00://///://///:80: JSR.L   s[!Dreg,Areg,Aipi,Apdi,Immd]
+ 0100 rrr1 00ss sSSS:00:?????:?????:11: CHK.L   s[!Areg],Dr
+ 0100 rrr1 10ss sSSS:00:?????:?????:11: CHK.W   s[!Areg],Dr
+ 0100 1110 11ss sSSS:00://///://///:80: JMP.L   s[!Dreg,Areg,Aipi,Apdi,Immd]
+ 0100 rrr1 11ss sSSS:00:-----:-----:02: LEA.L   s[!Dreg,Areg,Aipi,Apdi,Immd],Ar
+ 
+ 0101 jjj0 01dd dDDD:00:-----:-----:13: ADDA.W  #j,d[Areg]
+ 0101 jjj0 10dd dDDD:00:-----:-----:13: ADDA.L  #j,d[Areg]
+ 0101 jjj0 zzdd dDDD:00:XNZVC:-----:13: ADD.z   #j,d[!Areg]
+ 0101 jjj1 01dd dDDD:00:-----:-----:13: SUBA.W  #j,d[Areg]
+ 0101 jjj1 10dd dDDD:00:-----:-----:13: SUBA.L  #j,d[Areg]
+ 0101 jjj1 zzdd dDDD:00:XNZVC:-----:13: SUB.z   #j,d[!Areg]
+ 0101 cccc 1100 1rrr:00:-----:+++++:31: DBcc.W  Dr,#1
+ 0101 cccc 11dd dDDD:00:-----:+++++:20: Scc.B   d[!Areg]
+ 0101 cccc 1111 1010:20:?????:?????:10: TRAPcc  #1
+ 0101 cccc 1111 1011:20:?????:?????:10: TRAPcc  #2
+ 0101 cccc 1111 1100:20:?????:?????:00: TRAPcc
+ 
+ % Bxx.L is 68020 only, but setting the CPU level to 2 would give illegal
+ % instruction exceptions when compiling a 68000 only emulation, which isn't
+ % what we want either.
+ 0110 0001 0000 0000:00://///://///:40: BSR.W   #1
+ 0110 0001 IIII IIII:00://///://///:40: BSR.B   #i
+ 0110 0001 1111 1111:00://///://///:40: BSR.L   #2
+ 0110 CCCC 0000 0000:00:-----:+++++:40: Bcc.W   #1
+ 0110 CCCC IIII IIII:00:-----:+++++:40: Bcc.B   #i
+ 0110 CCCC 1111 1111:00:-----:+++++:40: Bcc.L   #2
+ 
+ 0111 rrr0 iiii iiii:00:-NZ00:-----:12: MOVE.L  #i,Dr
+ 
+ 1000 rrr0 zzss sSSS:00:-NZ00:-----:13: OR.z    s[!Areg],Dr
+ 1000 rrr0 11ss sSSS:00:?????:?????:13: DIVU.W  s[!Areg],Dr
+ 1000 rrr1 00dd dDDD:00:XxZxC:X-Z--:13: SBCD.B  d[Dreg],Dr      
+ 1000 rrr1 00dd dDDD:00:XxZxC:X-Z--:13: SBCD.B  d[Areg-Apdi],Arp      
+ 1000 rrr1 zzdd dDDD:00:-NZ00:-----:13: OR.z    Dr,d[!Areg,Dreg]
+ 1000 rrr1 01dd dDDD:20:?????:?????:12: PACK    d[Dreg],Dr      
+ 1000 rrr1 01dd dDDD:20:?????:?????:12: PACK    d[Areg-Apdi],Arp      
+ 1000 rrr1 10dd dDDD:20:?????:?????:12: UNPK    d[Dreg],Dr      
+ 1000 rrr1 10dd dDDD:20:?????:?????:12: UNPK    d[Areg-Apdi],Arp      
+ 1000 rrr1 11ss sSSS:00:?????:?????:13: DIVS.W  s[!Areg],Dr
+ 
+ 1001 rrr0 zzss sSSS:00:XNZVC:-----:13: SUB.z   s,Dr
+ 1001 rrr0 11ss sSSS:00:-----:-----:13: SUBA.W  s,Ar
+ 1001 rrr1 zzdd dDDD:00:XNZVC:X-Z--:13: SUBX.z  d[Dreg],Dr      
+ 1001 rrr1 zzdd dDDD:00:XNZVC:X-Z--:13: SUBX.z  d[Areg-Apdi],Arp      
+ 1001 rrr1 zzdd dDDD:00:XNZVC:-----:13: SUB.z   Dr,d[!Areg,Dreg]
+ 1001 rrr1 11ss sSSS:00:-----:-----:13: SUBA.L  s,Ar
+ 
+ 1011 rrr0 zzss sSSS:00:-NZVC:-----:11: CMP.z   s,Dr
+ 1011 rrr0 11ss sSSS:00:-NZVC:-----:11: CMPA.W  s,Ar
+ 1011 rrr1 11ss sSSS:00:-NZVC:-----:11: CMPA.L  s,Ar
+ 1011 rrr1 zzdd dDDD:00:-NZVC:-----:11: CMPM.z  d[Areg-Aipi],ArP
+ 1011 rrr1 zzdd dDDD:00:-NZ00:-----:13: EOR.z   Dr,d[!Areg]
+ 
+ 1100 rrr0 zzss sSSS:00:-NZ00:-----:13: AND.z   s[!Areg],Dr
+ 1100 rrr0 11ss sSSS:00:-NZ00:-----:13: MULU.W  s[!Areg],Dr
+ 1100 rrr1 00dd dDDD:00:XxZxC:X-Z--:13: ABCD.B  d[Dreg],Dr      
+ 1100 rrr1 00dd dDDD:00:XxZxC:X-Z--:13: ABCD.B  d[Areg-Apdi],Arp      
+ 1100 rrr1 zzdd dDDD:00:-NZ00:-----:13: AND.z   Dr,d[!Areg,Dreg]
+ 1100 rrr1 01dd dDDD:00:-----:-----:33: EXG.L   Dr,d[Dreg]      
+ 1100 rrr1 01dd dDDD:00:-----:-----:33: EXG.L   Ar,d[Areg]            
+ 1100 rrr1 10dd dDDD:00:-----:-----:33: EXG.L   Dr,d[Areg]      
+ 1100 rrr1 11ss sSSS:00:-NZ00:-----:13: MULS.W  s[!Areg],Dr
+ 
+ 1101 rrr0 zzss sSSS:00:XNZVC:-----:13: ADD.z   s,Dr
+ 1101 rrr0 11ss sSSS:00:-----:-----:13: ADDA.W  s,Ar
+ 1101 rrr1 zzdd dDDD:00:XNZVC:X-Z--:13: ADDX.z  d[Dreg],Dr      
+ 1101 rrr1 zzdd dDDD:00:XNZVC:X-Z--:13: ADDX.z  d[Areg-Apdi],Arp      
+ 1101 rrr1 zzdd dDDD:00:XNZVC:-----:13: ADD.z   Dr,d[!Areg,Dreg]
+ 1101 rrr1 11ss sSSS:00:-----:-----:13: ADDA.L  s,Ar
+ 
+ 1110 jjjf zz00 0RRR:00:XNZVC:-----:13: ASf.z   #j,DR
+ 1110 jjjf zz00 1RRR:00:XNZ0C:-----:13: LSf.z   #j,DR
+ 1110 jjjf zz01 0RRR:00:XNZ0C:X----:13: ROXf.z  #j,DR
+ 1110 jjjf zz01 1RRR:00:-NZ0C:-----:13: ROf.z   #j,DR
+ 1110 rrrf zz10 0RRR:00:XNZVC:X----:13: ASf.z   Dr,DR
+ 1110 rrrf zz10 1RRR:00:XNZ0C:X----:13: LSf.z   Dr,DR
+ 1110 rrrf zz11 0RRR:00:XNZ0C:X----:13: ROXf.z  Dr,DR
+ 1110 rrrf zz11 1RRR:00:-NZ0C:-----:13: ROf.z   Dr,DR
+ 1110 000f 11dd dDDD:00:XNZVC:-----:13: ASfW.W  d[!Dreg,Areg]
+ 1110 001f 11dd dDDD:00:XNZ0C:-----:13: LSfW.W  d[!Dreg,Areg]
+ 1110 010f 11dd dDDD:00:XNZ0C:X----:13: ROXfW.W d[!Dreg,Areg]
+ 1110 011f 11dd dDDD:00:-NZ0C:-----:13: ROfW.W  d[!Dreg,Areg]
+ 
+ 1110 1000 11ss sSSS:20:?????:?????:11: BFTST   #1,s[!Areg,Apdi,Aipi,Immd]
+ 1110 1001 11ss sSSS:20:?????:?????:11: BFEXTU  #1,s[!Areg,Apdi,Aipi,Immd]
+ 1110 1010 11ss sSSS:20:?????:?????:13: BFCHG   #1,s[!Areg,Apdi,Aipi,Immd,PC8r,PC16]
+ 1110 1011 11ss sSSS:20:?????:?????:11: BFEXTS  #1,s[!Areg,Apdi,Aipi,Immd]
+ 1110 1100 11ss sSSS:20:?????:?????:13: BFCLR   #1,s[!Areg,Apdi,Aipi,Immd,PC8r,PC16]
+ 1110 1101 11ss sSSS:20:?????:?????:11: BFFFO   #1,s[!Areg,Apdi,Aipi,Immd]
+ 1110 1110 11ss sSSS:20:?????:?????:13: BFSET   #1,s[!Areg,Apdi,Aipi,Immd,PC8r,PC16]
+ 1110 1111 11ss sSSS:20:?????:?????:13: BFINS   #1,s[!Areg,Apdi,Aipi,Immd,PC8r,PC16]
+ 
+ % floating point co processor
+ 1111 0010 00ss sSSS:30:?????:?????:11: FPP      #1,s
+ 1111 0010 01ss sSSS:30:?????:?????:11: FDBcc    #1,s[Areg-Dreg]
+ 1111 0010 01ss sSSS:30:?????:?????:11: FScc     #1,s[!Areg,Immd,PC8r,PC16]
+ 1111 0010 0111 1010:30:?????:?????:10: FTRAPcc  #1
+ 1111 0010 0111 1011:30:?????:?????:10: FTRAPcc  #2
+ 1111 0010 0111 1100:30:?????:?????:00: FTRAPcc
+ 1111 0010 10KK KKKK:30:?????:?????:11: FBcc     #K,#1
+ 1111 0010 11KK KKKK:30:?????:?????:11: FBcc     #K,#2
+ 1111 0011 00ss sSSS:32:?????:?????:20: FSAVE    s[!Dreg,Areg,Aipi,Immd,PC8r,PC16]
+ 1111 0011 01ss sSSS:32:?????:?????:10: FRESTORE s[!Dreg,Areg,Apdi,Immd]
+ 
+ 1111 0101 iiii iSSS:40:?????:?????:11: MMUOP    #i,s
+ 
+ % 68040 instructions
+ 1111 0100 ii00 1rrr:42:-----:-----:02: CINVL    #i,Ar
+ 1111 0100 ii01 0rrr:42:-----:-----:02: CINVP    #i,Ar
+ 1111 0100 ii01 1rrr:42:-----:-----:00: CINVA    #i
+ 1111 0100 ii10 1rrr:42:-----:-----:02: CPUSHL   #i,Ar
+ 1111 0100 ii11 0rrr:42:-----:-----:02: CPUSHP   #i,Ar
+ 1111 0100 ii11 1rrr:42:-----:-----:00: CPUSHA   #i
+ 1111 0110 0010 0rrr:40:-----:-----:12: MOVE16   ArP,ARP
diff -Nrc3p /dunes/wcohen/virg-netgdb/src/sim/m68k/target.h src/sim/m68k/target.h
*** /dunes/wcohen/virg-netgdb/src/sim/m68k/target.h	Wed Dec 31 19:00:00 1969
--- src/sim/m68k/target.h	Mon Feb 19 14:10:25 2001
***************
*** 0 ****
--- 1,19 ----
+  /*
+   * UAE - The Un*x Amiga Emulator
+   *
+   * Target specific stuff, X11 version
+   *
+   * Copyright 1997 Bernd Schmidt
+   */
+ 
+ #define TARGET_NAME "x11"
+ 
+ #define OPTIONSFILENAME ".uaerc"
+ #define OPTIONS_IN_HOME
+ 
+ #define DEFPRTNAME "lpr"
+ #define DEFSERNAME "/dev/ttyS1"
+ 
+ #define PICASSO96_SUPPORTED
+ 
+ #define write_log write_log_standard

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]