From mike@augean.ua.oz.au Wed Feb  6 21:03:52 1991
Received: by csl (5.57/SAM 07-20-90 10:07:54)
	id AA01555; Wed, 6 Feb 91 21:03:42 EST
Posted-Date: Thu, 7 Feb 91 12:33:34 CST
Received-Date: Wed, 6 Feb 91 21:03:42 EST
Received: from augean.ua.oz.au by munnari.oz.au with SMTP (5.64+1.3.1+0.50)
	id AA12985; Thu, 7 Feb 1991 13:03:57 +1100 (from mike@augean.ua.oz.au)
From: mike@augean.ua.oz.au
Message-Id: <9102070203.12985@munnari.oz.au>
Received: by augean (5.61+IDA+MU/4.8K)
	id AA00959; Thu, 7 Feb 1991 12:33:40 +1030
Subject: Assembler and simulator patches
To: paulf@csl.ncsu.edu (Paul Franzon)
Date: Thu, 7 Feb 91 12:33:34 CST
X-Mailer: ELM [version 2.3 PL6]
Status: OR

Paul,

Herer are the chnges I made to get the asmmbler and simulator to work on the
Sun-4.  There are 3 context diffs.

The simulator built without changes to the source.  I only had to change the
Makefile to not include the 'dnet' library which I assume is an Ultrixism:

---------------------- Cut here ------------------------------------------

*** 68ksim/Makefile	Wed Feb  6 12:33:51 1991
--- 68ksim/Makefile.orig	Fri Feb  1 10:44:58 1991
***************
*** 17,23 ****
  #  sim is the C simulator program:
  #
  sim:		SI_defs.o SI_user.o sim.o
! 		   $(CC) SI_defs.o SI_user.o sim.o  -lm -lX11 -o sim 
  		   cp sim ../../bin/sim
  		   rm -f sim
  
--- 17,23 ----
  #  sim is the C simulator program:
  #
  sim:		SI_defs.o SI_user.o sim.o
! 		   $(CC) SI_defs.o SI_user.o sim.o  -lm -lX11 -ldnet -o sim 
  		   cp sim ../../bin/sim
  		   rm -f sim

---------------------- Cut here ------------------------------------------
  
I had to make two changes to the assembler.  The first makes the declaration
of tableSize in instlookup.c consistent with that elsewhere.  On the Sun the
inconsistent declarations led to a ridiculous number when 1 was subtracted from
it and a segmnentation violation when it was used as an array index.

---------------------- Cut here ------------------------------------------

*** 68kasm/instlookup.c	Wed Feb  6 16:26:57 1991
--- 68kasm/instlookup.c.orig	Fri Feb  1 11:01:07 1991
***************
*** 44,51 ****
  
  
  extern instruction instTable[];
! extern short int tableSize;
! /*extern int tableSize;*/
  
  
  char *instLookup(p, instPtrPtr, sizePtr, errorPtr)
--- 44,50 ----
  
  
  extern instruction instTable[];
! extern int tableSize;
  
  
  char *instLookup(p, instPtrPtr, sizePtr, errorPtr)

---------------------- Cut here ------------------------------------------

The other change was in main.c to do the lower case to upper case conversion
correctly.  As it was it was trying to upper case characters like '.'  Perhaps
the Ultrix toupper() macro is different to the SunOS/BSD version.  I also
changed the case of the extensions for the list and object files.

---------------------- Cut here ------------------------------------------

*** 68kasm/main.c	Wed Feb  6 16:31:00 1991
--- 68kasm/main.c.orig	Fri Feb  1 11:03:31 1991
***************
*** 82,90 ****
  	 *	append the appropriate file extension (.LIS or .H68)	*
  	 *	for each file. 						*
  	 *								*
- 	 *	Extensions changed to .lis and .h68 - MJL 6-Feb-91	*
- 	 *								*
- 	 *								*
  	 ****************************************************************/
  
  	/* Process output file names in their own buffer */
--- 82,87 ----
***************
*** 108,120 ****
  		p = outName + strlen(outName);
  
  	if (listFlag) {
! 		strcpy(p, ".lis");
  /*		printf("Listing filename is \"%s\"\n", outName); */
  		initList(outName);
  		}
  
  	if (objFlag) {
! 		strcpy(p, ".h68");
  /*		printf("Object filename is \"%s\"\n", outName); */
  		initObj(outName);
  	}
--- 105,117 ----
  		p = outName + strlen(outName);
  
  	if (listFlag) {
! 		strcpy(p, ".LIS");
  /*		printf("Listing filename is \"%s\"\n", outName); */
  		initList(outName);
  		}
  
  	if (objFlag) {
! 		strcpy(p, ".H68");
  /*		printf("Object filename is \"%s\"\n", outName); */
  		initObj(outName);
  	}
***************
*** 161,167 ****
  	capFlag = TRUE;
  	while (*s) {
  		if (capFlag)
! 			*d = islower(*s) ? toupper(*s) : *s;
  		else
  			*d = *s;
  		if (*s == '\'')
--- 158,164 ----
  	capFlag = TRUE;
  	while (*s) {
  		if (capFlag)
! 			*d = toupper(*s);
  		else
  			*d = *s;
  		if (*s == '\'')

---------------------- Cut here ------------------------------------------
I think none of the changes I have made are Sun specific so they should all
help portability.

Cheers,
Mike

