From: denniss@tekig1.PEN.TEK.COM (Dennis I Smith)
Newsgroups: comp.sys.m6809
Subject: Re: 6809 simulator
Date: 17 Nov 92 01:26:50 GMT
Organization: Tektronix, Inc., Beaverton,  OR.

Here are the patchs that I have applied to sim09 files to get it to compile and
execute using gcc 1.37 on a Sun 3/80 running SunOS 4.1.1.  I also have included
a makefile to automate the process.

The main obstacle that I encountered in getting sim09 to work was signed vs.
unsigned char's as well as the size of int's.

I added prototypes for all routines to the main.h file.  This resulted in the
deletion of disa.h menu.h and simulate.h.  The prototypes exposed several cases
in which improper number of arguments were being passed.

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  sim.patch makefile
# Wrapped by denniss@aaron on Mon Nov 16 17:10:31 1992
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'sim.patch' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'sim.patch'\"
else
echo shar: Extracting \"'sim.patch'\" \(56422 characters\)
sed "s/^X//" >'sim.patch' <<'END_OF_FILE'
X*** alu.c.orig	Sat Sep 19 19:11:13 1992
X--- alu.c	Mon Nov 16 16:39:44 1992
X***************
X*** 3,9 ****
X  /*
X  	8 bit arithmetic
X  */
X! int alu(int operation,unsigned int d0,unsigned int d1)
X  {
X  	int tmp;
X  
X--- 3,9 ----
X  /*
X  	8 bit arithmetic
X  */
X! unsigned alu(int operation,unsigned d0,unsigned d1)
X  {
X  	int tmp;
X  
X***************
X*** 163,169 ****
X  	return(tmp);
X  }
X  
X! int alu16(int operation,unsigned t0,unsigned t1)
X  {
X  	long tmp,d0=t0,d1=t1;
X  
X--- 163,169 ----
X  	return(tmp);
X  }
X  
X! unsigned alu16(int operation,unsigned t0,unsigned t1)
X  {
X  	long tmp,d0=t0,d1=t1;
X  
X*** breakpoint.c.orig	Thu Nov  5 10:22:33 1992
X--- breakpoint.c	Mon Nov 16 09:46:30 1992
X***************
X*** 1,6 ****
X  #include <curses.h>
X  #include "main.h"
X- #include "menu.h"
X  
X  
X  const char *breakmenu[4]={"Add a breakpoint     ",
X--- 1,5 ----
X***************
X*** 10,20 ****
X  
X  breakpoint()
X  {
X- 	extern WINDOW *displaywin, *topwin;
X  	WINDOW *breakwin;
X  	int choix=0;
X  
X! 	choix=menu(4,breakmenu,2,38,choix);
X  	touchwin(topwin);
X  	wrefresh(topwin);
X  	touchwin(displaywin);
X--- 9,18 ----
X  
X  breakpoint()
X  {
X  	WINDOW *breakwin;
X  	int choix=0;
X  
X! 	choix=menu(4,breakmenu,2,38);
X  	touchwin(topwin);
X  	wrefresh(topwin);
X  	touchwin(displaywin);
X*** cshell.c.orig	Sun Oct 18 07:46:34 1992
X--- cshell.c	Mon Nov 16 09:46:44 1992
X***************
X*** 6,15 ****
X  cshell()
X  {
X  	WINDOW *shellwin;
X- 	extern  WINDOW  *topwin,
X- 			*displaywin,
X- 			*regwin;
X- 	extern void display_registers();
X  	char commande[32];
X  
X  	nocbreak();
X--- 6,11 ----
X*** d_direct.c.orig	Mon Sep 21 09:09:08 1992
X--- d_direct.c	Mon Nov 16 16:52:39 1992
X***************
X*** 1,20 ****
X  #include "main.h"
X! #include "disa.h"
X! #define FALSE 0
X! #define TRUE 1
X  /*
X  	Cherche une instruction en mode DIRECT
X  */
X  
X! int disa_direct(unsigned int pc)
X  {
X  	int errflag=TRUE;
X! 	unsigned int opcode,adresse,tmp;
X  
X  		if (*(memoire+pc)==0x10 || *(memoire+pc)==0x11)
X  			opcode= *(memoire+pc)*256+*(memoire+pc+1);
X  		else
X! 			opcode=*(memoire+pc);
X  
X  		switch(opcode) {
X  
X--- 1,18 ----
X  #include "main.h"
X! 
X  /*
X  	Cherche une instruction en mode DIRECT
X  */
X  
X! int disa_direct(unsigned pc)
X  {
X  	int errflag=TRUE;
X! 	unsigned opcode,adresse,tmp;
X  
X  		if (*(memoire+pc)==0x10 || *(memoire+pc)==0x11)
X  			opcode= *(memoire+pc)*256+*(memoire+pc+1);
X  		else
X! 			opcode= *(memoire+pc);
X  
X  		switch(opcode) {
X  
X*** d_extended.c.orig	Mon Sep 21 09:09:29 1992
X--- d_extended.c	Mon Nov 16 16:52:55 1992
X***************
X*** 1,16 ****
X  #include "main.h"
X! #include "disa.h"
X! #define FALSE 0
X! #define TRUE 1
X  /*
X  	Cherche une instruction en mode EXTENDED
X  */
X  
X! int disa_extended(unsigned int pc)
X  
X  {
X  	int errflag=TRUE;
X! 	unsigned int opcode,tmp;
X  
X  		if (*(memoire+pc)==0x10 || *(memoire+pc)==0x11)
X  			opcode= *(memoire+pc)*256+*(memoire+pc+1);
X--- 1,14 ----
X  #include "main.h"
X! 
X  /*
X  	Cherche une instruction en mode EXTENDED
X  */
X  
X! int disa_extended(unsigned pc)
X  
X  {
X  	int errflag=TRUE;
X! 	unsigned opcode,tmp;
X  
X  		if (*(memoire+pc)==0x10 || *(memoire+pc)==0x11)
X  			opcode= *(memoire+pc)*256+*(memoire+pc+1);
X*** d_immediat.c.orig	Mon Sep 21 09:10:07 1992
X--- d_immediat.c	Mon Nov 16 16:53:01 1992
X***************
X*** 1,17 ****
X  #include "main.h"
X- #include "disa.h"
X  #include "operand.h"
X! #define FALSE 0
X! #define TRUE 1
X  /*
X  	DISASSEMBLE in immediat mode
X  */
X  
X! int disa_immediat(pc)
X! 	unsigned int pc;
X  {
X  	int errflag=TRUE;
X! 	unsigned int opcode,tmp,mask;
X  
X  		if (*(memoire+pc)==0x10 || *(memoire+pc)==0x11)
X  			opcode= *(memoire+pc)*256+*(memoire+pc+1);
X--- 1,14 ----
X  #include "main.h"
X  #include "operand.h"
X! 
X  /*
X  	DISASSEMBLE in immediat mode
X  */
X  
X! int disa_immediat(unsigned pc)
X  {
X  	int errflag=TRUE;
X! 	unsigned opcode,tmp,mask;
X  
X  		if (*(memoire+pc)==0x10 || *(memoire+pc)==0x11)
X  			opcode= *(memoire+pc)*256+*(memoire+pc+1);
X*** d_indexed.c.orig	Mon Sep 21 09:07:59 1992
X--- d_indexed.c	Mon Nov 16 16:53:08 1992
X***************
X*** 1,15 ****
X  #include "main.h"
X! #include "disa.h"
X! #define FALSE 0
X! #define TRUE 1
X  /*
X  	Disassemble in INDEXED mode
X  */
X  
X! int disa_indexed(unsigned int pc)
X  {
X  	int errflag=TRUE;
X! 	unsigned int opcode,tmp;
X  
X  		if (*(memoire+pc)==0x10 || *(memoire+pc)==0x11)
X  			opcode= *(memoire+pc)*256+*(memoire+pc+1);
X--- 1,13 ----
X  #include "main.h"
X! 
X  /*
X  	Disassemble in INDEXED mode
X  */
X  
X! int disa_indexed(unsigned pc)
X  {
X  	int errflag=TRUE;
X! 	unsigned opcode,tmp;
X  
X  		if (*(memoire+pc)==0x10 || *(memoire+pc)==0x11)
X  			opcode= *(memoire+pc)*256+*(memoire+pc+1);
X*** d_inherent.c.orig	Mon Sep 21 09:10:34 1992
X--- d_inherent.c	Mon Nov 16 16:53:15 1992
X***************
X*** 1,16 ****
X  #include "main.h"
X! #define FALSE 0
X! #define TRUE 1
X  /*
X  	Cherche une instruction en mode INHERENT
X  */
X  
X! int disa_inherent(pc)
X! 
X! 	unsigned int pc;
X  {
X  	int errflag=TRUE;
X! 	unsigned int opcode,tmp,mask;
X  
X  		if (*(memoire+pc)==0x11||*(memoire+pc)==0x10)
X  			opcode= *(memoire+pc)*256+*(memoire+pc+1);
X--- 1,13 ----
X  #include "main.h"
X! 
X  /*
X  	Cherche une instruction en mode INHERENT
X  */
X  
X! int disa_inherent(unsigned pc)
X  {
X  	int errflag=TRUE;
X! 	unsigned opcode,tmp,mask;
X  
X  		if (*(memoire+pc)==0x11||*(memoire+pc)==0x10)
X  			opcode= *(memoire+pc)*256+*(memoire+pc+1);
X*** d_relative.c.orig	Mon Sep 21 09:10:56 1992
X--- d_relative.c	Mon Nov 16 16:53:22 1992
X***************
X*** 1,16 ****
X  #include "main.h"
X- #include "disa.h"
X  #include "operand.h"
X! #define FALSE 0
X! #define TRUE 1
X  /*
X  	Cherche une instruction en mode RELATIVE
X  */
X  
X! int disa_relative(unsigned int pc)
X  {
X  	int errflag=TRUE;
X! 	unsigned int opcode;
X  
X  		if (*(memoire+pc)==0x10)
X  			opcode= *(memoire+pc)*256+*(memoire+pc+1);
X--- 1,14 ----
X  #include "main.h"
X  #include "operand.h"
X! 
X  /*
X  	Cherche une instruction en mode RELATIVE
X  */
X  
X! int disa_relative(unsigned pc)
X  {
X  	int errflag=TRUE;
X! 	unsigned opcode;
X  
X  		if (*(memoire+pc)==0x10)
X  			opcode= *(memoire+pc)*256+*(memoire+pc+1);
X*** execute.c.orig	Wed Nov  4 13:49:40 1992
X--- execute.c	Mon Nov 16 10:05:17 1992
X***************
X*** 2,9 ****
X  #include "main.h"
X  #include "mode.h"
X  
X- extern WINDOW *displaywin;
X- extern WINDOW *regwin;
X  int line=1;
X  
X  /*
X--- 2,7 ----
X***************
X*** 145,151 ****
X  {
X  	WINDOW *startwin;
X  	char start[16];
X- 	extern WINDOW *displaywin, *regwin;
X  	int tmp;
X  
X  	echo();
X--- 143,148 ----
X***************
X*** 202,214 ****
X  
X  int cpu()
X  {
X- 	extern int simulate_immediat();
X- 	extern int simulate_direct();
X- 	extern int simulate_indexed();
X- 	extern int simulate_extended();
X- 	extern int simulate_inherent();
X- 	extern int simulate_relative();
X- 
X  	if(simulate_indexed()==TRUE)
X  		return(TRUE);
X  
X--- 199,204 ----
X***************
X*** 237,243 ****
X  display_registers()
X  {
X  	char tmp[80];
X! 	int i, temp;
X  
X  	sprintf(tmp,"A=%02X  B=%02X  DP=%02X  CC=%02X  X=%04X  Y=%04X  U=%04X  S=%04X  PC=%04X  EFHINZVC    ", acca,accb,dpr,ccr,xreg,yreg,ureg,sreg,pcr);
X  
X--- 227,233 ----
X  display_registers()
X  {
X  	char tmp[80];
X! 	unsigned i, temp;
X  
X  	sprintf(tmp,"A=%02X  B=%02X  DP=%02X  CC=%02X  X=%04X  Y=%04X  U=%04X  S=%04X  PC=%04X  EFHINZVC    ", acca,accb,dpr,ccr,xreg,yreg,ureg,sreg,pcr);
X  
X*** file.c.orig	Tue Sep 15 17:01:45 1992
X--- file.c	Mon Nov 16 09:15:19 1992
X***************
X*** 1,6 ****
X  #include <curses.h>
X  #include "main.h"
X- #include "menu.h"
X  
X  const char *filemenu[5]={"Load a program       ",
X  			 "Save a program       ",
X--- 1,5 ----
X***************
X*** 56,62 ****
X  	WINDOW *loadwin,*addwin;
X  	char filename[80],start[8];
X  	int c;
X! 	unsigned int adresse;
X  	FILE *fp, *fopen();
X  
X  	loadwin=newwin(4,29,5,4);
X--- 55,61 ----
X  	WINDOW *loadwin,*addwin;
X  	char filename[80],start[8];
X  	int c;
X! 	unsigned adresse;
X  	FILE *fp, *fopen();
X  
X  	loadwin=newwin(4,29,5,4);
X***************
X*** 139,145 ****
X  {
X  	WINDOW *savewin, *askwin;
X  	char start[8], end[8], filename[32], tmp[32];
X! 	unsigned int debut, fin, n;
X  	FILE *fp, *fopen();
X  
X  	savewin=newwin(4,29,5,4);
X--- 138,144 ----
X  {
X  	WINDOW *savewin, *askwin;
X  	char start[8], end[8], filename[32], tmp[32];
X! 	unsigned debut, fin, n;
X  	FILE *fp, *fopen();
X  
X  	savewin=newwin(4,29,5,4);
X***************
X*** 272,296 ****
X  	wgetstr(restorewin,filename);
X  
X  	if((fp=fopen(filename,"r")) != NULL) {
X! 		ccr= (unsigned int) fgetc(fp);
X! 		acca=(unsigned int) fgetc(fp);
X! 		accb=(unsigned int) fgetc(fp);
X! 		dpr= (unsigned int) fgetc(fp);
X! 		xreg=(unsigned int) fgetc(fp);
X  		xreg<<=8;
X! 		xreg+=(unsigned int) fgetc(fp);
X! 		yreg=(unsigned int) fgetc(fp);
X  		yreg<<=8;
X! 		yreg+=(unsigned int) fgetc(fp);
X! 		ureg=(unsigned int) fgetc(fp);
X  		ureg<<=8;
X! 		ureg+=(unsigned int) fgetc(fp);
X! 		sreg=(unsigned int) fgetc(fp);
X  		sreg<<=8;
X! 		sreg+=(unsigned int) fgetc(fp);
X! 		pcr=(unsigned int) fgetc(fp);
X  		pcr<<=8;
X! 		pcr+=(unsigned int) fgetc(fp);
X  		fclose(fp);
X  	}
X  
X--- 271,295 ----
X  	wgetstr(restorewin,filename);
X  
X  	if((fp=fopen(filename,"r")) != NULL) {
X! 		ccr= (unsigned) fgetc(fp);
X! 		acca=(unsigned) fgetc(fp);
X! 		accb=(unsigned) fgetc(fp);
X! 		dpr= (unsigned) fgetc(fp);
X! 		xreg=(unsigned) fgetc(fp);
X  		xreg<<=8;
X! 		xreg+=(unsigned) fgetc(fp);
X! 		yreg=(unsigned) fgetc(fp);
X  		yreg<<=8;
X! 		yreg+=(unsigned) fgetc(fp);
X! 		ureg=(unsigned) fgetc(fp);
X  		ureg<<=8;
X! 		ureg+=(unsigned) fgetc(fp);
X! 		sreg=(unsigned) fgetc(fp);
X  		sreg<<=8;
X! 		sreg+=(unsigned) fgetc(fp);
X! 		pcr=(unsigned) fgetc(fp);
X  		pcr<<=8;
X! 		pcr+=(unsigned) fgetc(fp);
X  		fclose(fp);
X  	}
X  
X*** main.c.orig	Mon Sep 28 09:39:15 1992
X--- main.c	Mon Nov 16 09:33:39 1992
X***************
X*** 5,12 ****
X--- 5,15 ----
X  			(C)opyright July 1992
X  */
X  
X+ #define MAIN_C
X+ 
X  #include <stdio.h>
X  #include <curses.h>
X+ #include "main.h"
X  #include "mode.h"
X  
X  WINDOW *topwin;
X***************
X*** 14,20 ****
X  WINDOW *regwin;
X  
X  /* MC6809 internal registers */
X! unsigned short int ccr=0,
X  	           acca=0,
X  	           accb=0,
X                     dpr=0,
X--- 17,23 ----
X  WINDOW *regwin;
X  
X  /* MC6809 internal registers */
X! unsigned short     ccr=0,
X  	           acca=0,
X  	           accb=0,
X                     dpr=0,
X***************
X*** 25,31 ****
X                     pcr=0;
X  
X  
X! char *memoire;                  /* MC6809 64K Memory space pointer */
X  int length;			/* current instruction length */
X  char code[32],			/* Instruction codes */
X       mnemonique[8],		/* Mnemonic */
X--- 28,34 ----
X                     pcr=0;
X  
X  
X! unsigned char *memoire;         /* MC6809 64K Memory space pointer */
X  int length;			/* current instruction length */
X  char code[32],			/* Instruction codes */
X       mnemonique[8],		/* Mnemonic */
X***************
X*** 37,49 ****
X  int mode=STEP;			/* Simulator modes */
X  
X  int breaknum=0;			/* Number of breakpoints */
X! unsigned int breaklist[8];	/* Breakpoints list */
X  
X! unsigned int couleur=A_NORMAL; 	/* Colors */
X! unsigned int inverse=A_REVERSE;	/* Reverse */
X  
X! unsigned int keyboard=0;			/* Keyboard */
X! unsigned int keystat=0;				/* Keyboard STATUS */
X  
X  
X  
X--- 40,52 ----
X  int mode=STEP;			/* Simulator modes */
X  
X  int breaknum=0;			/* Number of breakpoints */
X! unsigned breaklist[8];		/* Breakpoints list */
X  
X! unsigned couleur=A_NORMAL; 	/* Colors */
X! unsigned inverse=A_REVERSE;	/* Reverse */
X  
X! unsigned keyboard=0;		/* Keyboard */
X! unsigned keystat=0;		/* Keyboard STATUS */
X  
X  
X  
X***************
X*** 52,68 ****
X  */
X  main()
X  {
X- 	extern void welcome();
X- 	extern int mainmenu();
X- 	extern void fichier();
X- 	extern void modes();
X- 	extern void monitor();
X- 	extern void breakpoint();
X- 	extern void cshell();
X- 	extern void display_registers();
X  	int choix;
X  
X! 	if((memoire=(char *)malloc(65536))==NULL) {
X  					 /* Reserve 64K for CPU */ 
X  		endwin();
X  		fprintf(stderr,"-- Out of memory.\n");
X--- 55,63 ----
X  */
X  main()
X  {
X  	int choix;
X  
X! 	if((memoire=(unsigned char *)malloc(65536))==NULL) {
X  					 /* Reserve 64K for CPU */ 
X  		endwin();
X  		fprintf(stderr,"-- Out of memory.\n");
X***************
X*** 76,82 ****
X  	setscrreg(0,23);
X  
X  	topwin=newwin(3,80,0,0);		/* Define TOP window       */
X! 	displaywin=newwin(18,80,3,0);		/* Define DISPLAY window   */
X  	wattrset(displaywin,couleur);
X  	werase(displaywin);
X  	idlok(displaywin,TRUE);
X--- 71,77 ----
X  	setscrreg(0,23);
X  
X  	topwin=newwin(3,80,0,0);		/* Define TOP window       */
X! 	displaywin=newwin(19,80,3,0);		/* Define DISPLAY window   */
X  	wattrset(displaywin,couleur);
X  	werase(displaywin);
X  	idlok(displaywin,TRUE);
X*** main.h.orig	Thu Nov  5 16:43:20 1992
X--- main.h	Mon Nov 16 16:39:34 1992
X***************
X*** 2,19 ****
X  	MAIN global variables
X  */
X  
X  extern int mode;
X  extern int length, cycles;
X  extern char code[], mnemonique[], operand[], cycle[];
X! extern unsigned int couleur;
X! extern unsigned int inverse;
X! extern char *memoire;
X! extern unsigned short int acca,accb,xreg,yreg,ureg,sreg,pcr,ccr,dpr;
X  extern long ccounter;
X  extern int breaknum;
X! extern unsigned int breaklist[];
X! extern unsigned int keyboard;
X! extern unsigned int keystat;
X  
X  #define ESC   0x06
X  
X--- 2,145 ----
X  	MAIN global variables
X  */
X  
X+ #include <curses.h>
X+ 
X+ #ifndef MAIN_C
X+ 
X+ extern WINDOW *topwin;
X+ extern WINDOW *displaywin;
X+ extern WINDOW *regwin;
X+ 
X  extern int mode;
X  extern int length, cycles;
X  extern char code[], mnemonique[], operand[], cycle[];
X! extern unsigned couleur;
X! extern unsigned inverse;
X! extern unsigned char *memoire;
X! extern unsigned short acca,accb,xreg,yreg,ureg,sreg,pcr,ccr,dpr;
X  extern long ccounter;
X  extern int breaknum;
X! extern unsigned breaklist[];
X! extern unsigned keyboard;
X! extern unsigned keystat;
X  
X+ #endif MAIN_C
X+ 
X  #define ESC   0x06
X  
X+ /* PROTOTYPES */
X+ 
X+ /* alu.c */
X+ unsigned alu(int operation, unsigned d0, unsigned d1);
X+ unsigned alu16(int operation, unsigned t0, unsigned t1);
X+ 
X+ /* breakpoint.c */
X+ int breakpoint(void);
X+ int add_breakpoint(void);
X+ int delete_breakpoint(void);
X+ int clear_breakpoint(void);
X+ int show_breakpoint(void);
X+ 
X+ /* cshell.c */
X+ int cshell(void);
X+ 
X+ /* d_direct.c */
X+ int disa_direct(unsigned pc);
X+ 
X+ /* d_extended.c */
X+ int disa_extended(unsigned pc);
X+ 
X+ /* d_immediat.c */
X+ int disa_immediat(unsigned pc);
X+ 
X+ /* d_indexed.c */
X+ int disa_indexed(unsigned pc);
X+ 
X+ /* d_inherent.c */
X+ int disa_inherent(unsigned pc);
X+ 
X+ /* d_relative.c */
X+ int disa_relative(unsigned pc);
X+ 
X+ /* execute.c */
X+ int execute_step(void);
X+ int execute_trace(void);
X+ int execute_run(void);
X+ int execute_disk(void);
X+ int cpu(void);
X+ int display_registers(void);
X+ 
X+ /* file.c */
X+ int fichier(void);
X+ int loadp(void);
X+ int changedir(void);
X+ int savep(void);
X+ int savestate(void);
X+ int restorestate(void);
X+ 
X+ /* main.c */
X+ int main(void);
X+ 
X+ /* mainmenu.c */
X+ int mainmenu(void);
X+ 
X+ /* menu.c */
X+ int menu(int n, const char *items[], int y, int x);
X+ int wmenu(struct _win_st *mwin, int n, const char *items[], int position);
X+ 
X+ /* misc.c */
X+ unsigned dpcalc(unsigned short pc);
X+ unsigned extendcalc(unsigned short pc);
X+ unsigned readbus(unsigned short pc);
X+ void writebus(unsigned short pc, unsigned char data);
X+ int xtoi(char *input);
X+ unsigned getregval(int regnum);
X+ void putregval(int regnum, unsigned regval);
X+ unsigned getpushregval(int stack, unsigned regbit);
X+ void putpullregval(int stack, unsigned regbit, unsigned regval);
X+ unsigned indexcalc(void);
X+ 
X+ /* mode.c */
X+ int modes(void);
X+ 
X+ /* monitor.c */
X+ int monitor(void);
X+ int start_execution(void);
X+ int dump(void);
X+ int fill(void);
X+ int disa(void);
X+ int disassemble(unsigned pc);
X+ int mregister(void);
X+ int mcycle(void);
X+ int show_vectors(void);
X+ int modify(void);
X+ int refresh_panel(struct _win_st *win, unsigned short memory);
X+ 
X+ /* operand.c */
X+ int immediat(int type, unsigned pc);
X+ int direct(unsigned pc);
X+ int extended(unsigned pc);
X+ int relative(int type, unsigned short pc);
X+ int indexed(unsigned pc);
X+ 
X+ /* s_direct.c */
X+ int simulate_direct(void);
X+ 
X+ /* s_extended.c */
X+ int simulate_extended(void);
X+ 
X+ /* s_immediat.c */
X+ int simulate_immediat(void);
X+ 
X+ /* s_indexed.c */
X+ int simulate_indexed(void);
X+ 
X+ /* s_inherent.c */
X+ int simulate_inherent(void);
X+ 
X+ /* s_relative.c */
X+ int simulate_relative(void);
X+ 
X+ /* welcome.c */
X+ int welcome(void);
X*** mainmenu.c.orig	Thu Oct  1 11:40:24 1992
X--- mainmenu.c	Mon Nov 16 09:47:34 1992
X***************
X*** 15,21 ****
X  
X  int mainmenu()
X  {
X- 	extern WINDOW *topwin;
X  	static char *topmenu[6]= {"File","Run","Monitor","Breakpoint",
X  				  "Shell","Quit"};
X  	int i;
X--- 15,20 ----
X*** menu.c.orig	Thu Sep 17 12:32:46 1992
X--- menu.c	Mon Nov 16 09:32:48 1992
X***************
X*** 5,11 ****
X  /*
X  	Affiche un MENU de n items a x,y
X  */
X! int menu(int n,char*items[],int y,int x)
X  {
X  	WINDOW *mwin;
X  	int i,ls,position=0;
X--- 5,11 ----
X  /*
X  	Affiche un MENU de n items a x,y
X  */
X! int menu(int n,const char*items[],int y,int x)
X  {
X  	WINDOW *mwin;
X  	int i,ls,position=0;
X***************
X*** 75,81 ****
X  /*
X  	Affiche un MENU de n items 
X  */
X! int wmenu(WINDOW *mwin,int n,char*items[],int position)
X  {
X  	int i;
X  
X--- 76,82 ----
X  /*
X  	Affiche un MENU de n items 
X  */
X! int wmenu(WINDOW *mwin,int n,const char*items[],int position)
X  {
X  	int i;
X  
X*** misc.c.orig	Thu Nov  5 16:58:54 1992
X--- misc.c	Mon Nov 16 10:04:48 1992
X***************
X*** 7,14 ****
X  /*
X  	DP address calculation
X  */
X! int dpcalc(pc)
X! 	unsigned short int pc;
X  {
X  	return(256*dpr+*(memoire+pc));
X  }
X--- 7,13 ----
X  /*
X  	DP address calculation
X  */
X! unsigned dpcalc(unsigned short pc)
X  {
X  	return(256*dpr+*(memoire+pc));
X  }
X***************
X*** 17,24 ****
X  /*
X  	EXTENDED address calculation
X  */
X! int extendcalc(pc)
X! 	unsigned short int pc;
X  {
X  	return(readbus(pc)*256+readbus(pc+1));
X  }
X--- 16,22 ----
X  /*
X  	EXTENDED address calculation
X  */
X! unsigned extendcalc(unsigned short pc)
X  {
X  	return(readbus(pc)*256+readbus(pc+1));
X  }
X***************
X*** 27,33 ****
X  /*
X  	Get DATA from Address bus
X  */
X! short int readbus(unsigned short int pc)
X  {
X  
X  	switch(pc) {
X--- 25,31 ----
X  /*
X  	Get DATA from Address bus
X  */
X! unsigned readbus(unsigned short pc)
X  {
X  
X  	switch(pc) {
X***************
X*** 72,93 ****
X  	Hexadecimal (ASCII) to Integer (int)
X  */
X  
X! short int xtoi(input)
X! 	char *input;
X! {
X! 	int n,r=0;
X! 
X! 	while(*input!='\0') {
X! 		if((n=convert(*input))!=-1) {
X! 			r<<=4;
X! 			r|=n;
X! 		}
X! 		++input;
X! 	}
X! 	return(r);
X! }
X! 
X! int convert(c)
X  	char c;
X  {
X  	switch(c) {
X--- 71,77 ----
X  	Hexadecimal (ASCII) to Integer (int)
X  */
X  
X! static int convert(c)
X  	char c;
X  {
X  	switch(c) {
X***************
X*** 125,136 ****
X  	return(c);
X  }
X  
X  
X  /*
X  	Simulate TFR & EXG instructions
X  */
X! int getregval(regnum)
X! 	int regnum;
X  {
X  	unsigned regval=0;
X  
X--- 109,133 ----
X  	return(c);
X  }
X  
X+ int xtoi(char *input)
X+ {
X+ 	int n,r=0;
X  
X+ 	while(*input!='\0') {
X+ 		if((n=convert(*input))!=-1) {
X+ 			r<<=4;
X+ 			r|=n;
X+ 		}
X+ 		++input;
X+ 	}
X+ 	return(r);
X+ }
X+ 
X+ 
X  /*
X  	Simulate TFR & EXG instructions
X  */
X! unsigned getregval(int regnum)
X  {
X  	unsigned regval=0;
X  
X***************
X*** 183,191 ****
X  /*
X  	Handle TFR & EXG instructions
X  */
X! putregval(regnum,regval)
X! 	int regnum;
X! 	unsigned regval;
X  {
X  
X  	switch(regnum) {
X--- 180,186 ----
X  /*
X  	Handle TFR & EXG instructions
X  */
X! void putregval(int regnum, unsigned regval)
X  {
X  
X  	switch(regnum) {
X***************
X*** 236,246 ****
X  /*
X  	Handle Push & Pull Instructions
X  */
X! int getpushregval(stack,regbit)
X! 	int stack;
X! 	unsigned int regbit;
X  {
X! 	unsigned int regval;
X  
X  	switch(regbit) {
X  
X--- 231,239 ----
X  /*
X  	Handle Push & Pull Instructions
X  */
X! unsigned getpushregval(int stack, unsigned regbit)
X  {
X! 	unsigned regval;
X  
X  	switch(regbit) {
X  
X***************
X*** 282,290 ****
X  	return(regval);
X  }
X  
X! putpullregval(stack,regbit,regval)
X! 	int stack;
X! 	unsigned int regbit,regval;
X  {
X  
X  	switch(regbit) {
X--- 275,281 ----
X  	return(regval);
X  }
X  
X! void putpullregval(int stack, unsigned regbit, unsigned regval)
X  {
X  
X  	switch(regbit) {
X***************
X*** 329,339 ****
X  /*
X  	Simulate Indexed MODE
X  */
X! int indexcalc()
X  {
X  	int registre=0;
X  	unsigned char postbyte;
X! 	unsigned int tmp;
X  
X  	postbyte= readbus(pcr-1);
X  	registre= (postbyte&0x7f)>>5;
X--- 320,330 ----
X  /*
X  	Simulate Indexed MODE
X  */
X! unsigned indexcalc(void)
X  {
X  	int registre=0;
X  	unsigned char postbyte;
X! 	unsigned tmp;
X  
X  	postbyte= readbus(pcr-1);
X  	registre= (postbyte&0x7f)>>5;
X*** mode.c.orig	Mon Nov  2 09:18:06 1992
X--- mode.c	Mon Nov 16 09:39:36 1992
X***************
X*** 6,15 ****
X  	Modes de fonctionnement du SIMULATEUR
X  */
X  
X! char *modemenu[4]= {"Step ",
X! 		    "Trace",
X! 		    "Disk ",
X! 		    "Run  " };
X  
X  modes()
X  {
X--- 6,15 ----
X  	Modes de fonctionnement du SIMULATEUR
X  */
X  
X! const char *modemenu[4]= {"Step ",
X! 			  "Trace",
X! 			  "Disk ",
X! 			  "Run  " };
X  
X  modes()
X  {
X*** monitor.c.orig	Thu Nov  5 17:31:01 1992
X--- monitor.c	Mon Nov 16 09:48:02 1992
X***************
X*** 2,8 ****
X  #include <string.h>
X  #include <stdlib.h>
X  #include "main.h"
X- #include "menu.h"
X  #include "mode.h"
X  
X  const char *vectormenu[8]= {"RESERV: $    ",
X--- 2,7 ----
X***************
X*** 14,20 ****
X  			    "NMI   : $    ",
X  			    "RESET : $    " };
X  
X! char *monitormenu[9]= { "Execute        ",
X  		        "Disassemble    ",
X  			"Fill memory    ",
X  			"Move memory    ",
X--- 13,19 ----
X  			    "NMI   : $    ",
X  			    "RESET : $    " };
X  
X! const char *monitormenu[9]= { "Execute        ",
X  		        "Disassemble    ",
X  			"Fill memory    ",
X  			"Move memory    ",
X***************
X*** 26,32 ****
X  
X  monitor()
X  {
X- 	extern WINDOW *displaywin,*topwin;
X  	int choix;
X  
X  	choix=menu(9,monitormenu,2,23);
X--- 25,30 ----
X***************
X*** 77,87 ****
X  */
X  start_execution()
X  {
X- 	extern void execute_step();
X- 	extern void execute_trace();
X- 	extern void execute_run();
X- 	extern void execute_disk();
X- 
X  	switch(mode) {
X  
X  		case STEP:
X--- 75,80 ----
X***************
X*** 109,115 ****
X  {
X  	WINDOW *dumpwin, *headwin, *viewwin;
X  	char start[8],line[80],tmp[80];
X! 	unsigned int adresse;
X  	int l,b,cle;
X  
X  	echo();
X--- 102,108 ----
X  {
X  	WINDOW *dumpwin, *headwin, *viewwin;
X  	char start[8],line[80],tmp[80];
X! 	unsigned adresse;
X  	int l,b,cle;
X  
X  	echo();
X***************
X*** 185,191 ****
X  {
X  	WINDOW *fillwin;
X  	char value[4],start[8],end[8];
X! 	unsigned int valeur,debut,fin;
X  
X  	echo();
X  	cbreak();
X--- 178,184 ----
X  {
X  	WINDOW *fillwin;
X  	char value[4],start[8],end[8];
X! 	unsigned valeur,debut,fin;
X  
X  	echo();
X  	cbreak();
X***************
X*** 235,241 ****
X  {
X  	WINDOW *disawin,*listwin,*askwin;
X  	char tmp[16],start[16];
X! 	unsigned int debut;
X  	int l,b,cle;
X  
X  	askwin=newwin(3,24,10,28);
X--- 228,234 ----
X  {
X  	WINDOW *disawin,*listwin,*askwin;
X  	char tmp[16],start[16];
X! 	unsigned debut;
X  	int l,b,cle;
X  
X  	askwin=newwin(3,24,10,28);
X***************
X*** 290,303 ****
X  	delwin(listwin);
X  }
X  
X! disassemble(unsigned int pc)
X  {
X- 	extern int disa_immediat();
X- 	extern int disa_direct();
X- 	extern int disa_indexed();
X- 	extern int disa_extended();
X- 	extern int disa_inherent();
X- 	extern int disa_relative();
X  	char tmp[32];
X  	int b;
X  
X--- 283,290 ----
X  	delwin(listwin);
X  }
X  
X! disassemble(unsigned pc)
X  {
X  	char tmp[32];
X  	int b;
X  
X***************
X*** 367,373 ****
X  */
X  mregister()
X  {
X- 	extern WINDOW *displaywin;
X  	WINDOW *regwin2,*valwin;
X  	char tmp[10],key;
X  	int x[10]= {4,12,20,31,4,12,20,31,4,12};
X--- 354,359 ----
X***************
X*** 550,556 ****
X  {
X  	WINDOW *vectorwin;
X  	int item;
X! 	short unsigned int vector= 0xfff0;
X  
X  	noecho();
X  	vectorwin=newwin(10,15,7,30);
X--- 537,543 ----
X  {
X  	WINDOW *vectorwin;
X  	int item;
X! 	short unsigned vector= 0xfff0;
X  
X  	noecho();
X  	vectorwin=newwin(10,15,7,30);
X***************
X*** 578,584 ****
X  {
X          WINDOW *win, *valwin;
X  	char valstr[8];
X! 	unsigned short int memory=0;
X  	int cle, position=0, value;
X  
X          noecho();
X--- 565,571 ----
X  {
X          WINDOW *win, *valwin;
X  	char valstr[8];
X! 	unsigned short memory=0;
X  	int cle, position=0, value;
X  
X          noecho();
X***************
X*** 660,668 ****
X  /*
X  	Refresh Panel
X  */
X! refresh_panel(win, memory)
X! 	WINDOW *win;
X! 	unsigned short int memory;
X  {
X  	int line, byte;
X  	char lineout[80],tmp[80];
X--- 647,653 ----
X  /*
X  	Refresh Panel
X  */
X! refresh_panel(WINDOW *win, unsigned short memory)
X  {
X  	int line, byte;
X  	char lineout[80],tmp[80];
X*** operand.c.orig	Thu Oct  1 12:04:10 1992
X--- operand.c	Mon Nov 16 16:56:15 1992
X***************
X*** 4,12 ****
X  	IMMEDIAT mode
X  */
X  
X! immediat(type,pc)
X! 	int	type;
X! 	unsigned int pc;
X  {
X  	int i, mask;
X  	static char *pulls[8]= {"cc,", "a,", "b,", "dp,", "x,", "y,", "u,", "pc," };
X--- 4,10 ----
X  	IMMEDIAT mode
X  */
X  
X! immediat(int type, unsigned pc)
X  {
X  	int i, mask;
X  	static char *pulls[8]= {"cc,", "a,", "b,", "dp,", "x,", "y,", "u,", "pc," };
X***************
X*** 64,70 ****
X  	Desassemble en mode DIRECT
X  */
X  
X! direct(unsigned int pc)
X  {
X  	sprintf(operand,"<$%02x", *(memoire+pc+length-1));
X  }
X--- 62,68 ----
X  	Desassemble en mode DIRECT
X  */
X  
X! direct(unsigned pc)
X  {
X  	sprintf(operand,"<$%02x", *(memoire+pc+length-1));
X  }
X***************
X*** 75,81 ****
X  	Desassemble en mode ETENDU
X  */
X  
X! extended(unsigned int pc)
X  {
X  	sprintf(operand,">$%04x", *(memoire+pc+length-2)*256+*(memoire+pc+length-1));
X  }
X--- 73,79 ----
X  	Desassemble en mode ETENDU
X  */
X  
X! extended(unsigned pc)
X  {
X  	sprintf(operand,">$%04x", *(memoire+pc+length-2)*256+*(memoire+pc+length-1));
X  }
X***************
X*** 83,90 ****
X  /*
X  	Desassemble en mode RELATIF
X  */
X! relative(type, pc)
X! 	unsigned short int pc;
X  {
X  	switch(type) {
X  
X--- 81,88 ----
X  /*
X  	Desassemble en mode RELATIF
X  */
X! relative(int type, unsigned short pc)
X! 
X  {
X  	switch(type) {
X  
X***************
X*** 93,99 ****
X  			break;
X  
X  		case	SIXTEEN_BIT:
X! 			sprintf(operand,"$%04x",(unsigned short int)((pc+length)+*(memoire+pc+length-2)*256+*(memoire+pc+length-1)));
X  			break;
X  	}
X  }
X--- 91,97 ----
X  			break;
X  
X  		case	SIXTEEN_BIT:
X! 			sprintf(operand,"$%04x",(unsigned short)((pc+length)+*(memoire+pc+length-2)*256+*(memoire+pc+length-1)));
X  			break;
X  	}
X  }
X***************
X*** 104,110 ****
X  	Desassemble en mode INDEXE
X  */
X  
X! int indexed(unsigned int pc)
X  
X  {
X  	int registre=0, more=0;
X--- 102,108 ----
X  	Desassemble en mode INDEXE
X  */
X  
X! int indexed(unsigned pc)
X  
X  {
X  	int registre=0, more=0;
X*** s_direct.c.orig	Mon Sep 21 09:14:05 1992
X--- s_direct.c	Mon Nov 16 16:56:35 1992
X***************
X*** 1,8 ****
X  #include "alu.h"
X  #include "main.h"
X! #include "simulate.h"
X! #define FALSE 0
X! #define TRUE 1
X  /*
X  	Execute in DIRECT mode.
X  */
X--- 1,6 ----
X  #include "alu.h"
X  #include "main.h"
X! 
X  /*
X  	Execute in DIRECT mode.
X  */
X***************
X*** 10,16 ****
X  int simulate_direct()
X  {
X  	int errflag=TRUE;
X! 	unsigned int opcode,adresse,tmp;
X  
X  		opcode=readbus(pcr);
X  		if (opcode==0x10 || opcode==0x11)
X--- 8,14 ----
X  int simulate_direct()
X  {
X  	int errflag=TRUE;
X! 	unsigned opcode,adresse,tmp;
X  
X  		opcode=readbus(pcr);
X  		if (opcode==0x10 || opcode==0x11)
X***************
X*** 66,72 ****
X  			case 0x08:
X  				pcr+=2;
X  				tmp=dpcalc(pcr-1);
X! 				writebus(tmp,alu(SHL,readbus(tmp)));
X  				cycles=6;
X  				break;
X  
X--- 64,70 ----
X  			case 0x08:
X  				pcr+=2;
X  				tmp=dpcalc(pcr-1);
X! 				writebus(tmp,alu(SHL,readbus(tmp),0));
X  				cycles=6;
X  				break;
X  
X***************
X*** 86,92 ****
X  
X  			case 0x0f:
X  				pcr+=2;
X! 				writebus(dpcalc(pcr-1),alu(CLR));
X  				cycles=6;
X  				break;
X  
X--- 84,90 ----
X  
X  			case 0x0f:
X  				pcr+=2;
X! 				writebus(dpcalc(pcr-1),alu(CLR,0,0));
X  				cycles=6;
X  				break;
X  
X***************
X*** 140,146 ****
X  			case 0x03:
X  				pcr+=2;
X  				tmp=dpcalc(pcr-1);
X! 				writebus(tmp,alu(COM,readbus(tmp)));
X  				cycles=6;
X  				break;
X  
X--- 138,144 ----
X  			case 0x03:
X  				pcr+=2;
X  				tmp=dpcalc(pcr-1);
X! 				writebus(tmp,alu(COM,readbus(tmp),0));
X  				cycles=6;
X  				break;
X  
X***************
X*** 147,153 ****
X  			case 0x0a:
X  				pcr+=2;
X  				tmp=dpcalc(pcr-1);
X! 				writebus(tmp,alu(DEC,readbus(tmp)));
X  				cycles=6;
X  				break;
X  
X--- 145,151 ----
X  			case 0x0a:
X  				pcr+=2;
X  				tmp=dpcalc(pcr-1);
X! 				writebus(tmp,alu(DEC,readbus(tmp),0));
X  				cycles=6;
X  				break;
X  
X***************
X*** 168,174 ****
X  			case 0x0c:
X  				pcr+=2;
X  				tmp=dpcalc(pcr-1);
X! 				writebus(tmp,alu(INC,readbus(tmp)));
X  				cycles=6;
X  				break;
X  
X--- 166,172 ----
X  			case 0x0c:
X  				pcr+=2;
X  				tmp=dpcalc(pcr-1);
X! 				writebus(tmp,alu(INC,readbus(tmp),0));
X  				cycles=6;
X  				break;
X  
X***************
X*** 187,199 ****
X  
X  			case 0x96:
X  				pcr+=2;
X! 				acca=alu(STA,readbus(dpcalc(pcr-1)));
X  				cycles=4;
X  				break;
X  
X  			case 0xd6:
X  				pcr+=2;
X! 				accb=alu(STA,readbus(dpcalc(pcr-1)));
X  				cycles=4;
X  				break;
X  
X--- 185,197 ----
X  
X  			case 0x96:
X  				pcr+=2;
X! 				acca=alu(STA,readbus(dpcalc(pcr-1)),0);
X  				cycles=4;
X  				break;
X  
X  			case 0xd6:
X  				pcr+=2;
X! 				accb=alu(STA,readbus(dpcalc(pcr-1)),0);
X  				cycles=4;
X  				break;
X  
X***************
X*** 202,208 ****
X  				tmp=dpcalc(pcr-1);
X  				acca=readbus(tmp);
X  				accb=readbus(tmp+1);
X! 				alu16(STA16,acca*256+accb);
X  				cycles=5;
X  				break;
X  
X--- 200,206 ----
X  				tmp=dpcalc(pcr-1);
X  				acca=readbus(tmp);
X  				accb=readbus(tmp+1);
X! 				alu16(STA16,acca*256+accb,0);
X  				cycles=5;
X  				break;
X  
X***************
X*** 241,247 ****
X  			case 0x04:
X  				pcr+=2;
X  				tmp=dpcalc(pcr-1);
X! 				writebus(tmp,alu(SHR,readbus(tmp)));
X  				cycles=6;
X  				break;
X  
X--- 239,245 ----
X  			case 0x04:
X  				pcr+=2;
X  				tmp=dpcalc(pcr-1);
X! 				writebus(tmp,alu(SHR,readbus(tmp),0));
X  				cycles=6;
X  				break;
X  
X***************
X*** 248,254 ****
X  			case 0x00:
X  				pcr+=2;
X  				tmp=dpcalc(pcr-1);
X! 				writebus(tmp,alu(NEG,readbus(tmp)));
X  				cycles=6;
X  				break;
X  
X--- 246,252 ----
X  			case 0x00:
X  				pcr+=2;
X  				tmp=dpcalc(pcr-1);
X! 				writebus(tmp,alu(NEG,readbus(tmp),0));
X  				cycles=6;
X  				break;
X  
X***************
X*** 269,275 ****
X  			case 0x09:
X  				pcr+=2;
X  				tmp=dpcalc(pcr-1);
X! 				writebus(tmp,alu(ROL,readbus(tmp)));
X  				cycles=6;
X  				break;
X  
X--- 267,273 ----
X  			case 0x09:
X  				pcr+=2;
X  				tmp=dpcalc(pcr-1);
X! 				writebus(tmp,alu(ROL,readbus(tmp),0));
X  				cycles=6;
X  				break;
X  
X***************
X*** 276,282 ****
X  			case 0x06:
X  				pcr+=2;
X  				tmp=dpcalc(pcr-1);
X! 				writebus(tmp,alu(ROR,readbus(tmp)));
X  				cycles=6;
X  				break;
X  
X--- 274,280 ----
X  			case 0x06:
X  				pcr+=2;
X  				tmp=dpcalc(pcr-1);
X! 				writebus(tmp,alu(ROR,readbus(tmp),0));
X  				cycles=6;
X  				break;
X  
X***************
X*** 298,304 ****
X  				pcr+=2;
X  				tmp=dpcalc(pcr-1);
X  				writebus(tmp,acca);
X! 				alu(STA,acca);
X  				cycles=4;
X  				break;
X  
X--- 296,302 ----
X  				pcr+=2;
X  				tmp=dpcalc(pcr-1);
X  				writebus(tmp,acca);
X! 				alu(STA,acca,0);
X  				cycles=4;
X  				break;
X  
X***************
X*** 306,312 ****
X  				pcr+=2;
X  				tmp=dpcalc(pcr-1);
X  				writebus(tmp,accb);
X! 				alu(STA,accb);
X  				cycles=4;
X  				break;
X  
X--- 304,310 ----
X  				pcr+=2;
X  				tmp=dpcalc(pcr-1);
X  				writebus(tmp,accb);
X! 				alu(STA,accb,0);
X  				cycles=4;
X  				break;
X  
X***************
X*** 315,321 ****
X  				tmp=dpcalc(pcr-1);
X  				writebus(tmp,acca);
X  				writebus(tmp+1,accb);
X! 				alu16(STA16,acca*256+accb);
X  				cycles=5;
X  				break;
X  
X--- 313,319 ----
X  				tmp=dpcalc(pcr-1);
X  				writebus(tmp,acca);
X  				writebus(tmp+1,accb);
X! 				alu16(STA16,acca*256+accb,0);
X  				cycles=5;
X  				break;
X  
X***************
X*** 324,330 ****
X  				tmp=dpcalc(pcr-1);
X  				writebus(tmp,sreg>>8);
X  				writebus(tmp+1,sreg&0xff);
X! 				alu16(STA16,sreg);
X  				cycles=6;
X  				break;
X  
X--- 322,328 ----
X  				tmp=dpcalc(pcr-1);
X  				writebus(tmp,sreg>>8);
X  				writebus(tmp+1,sreg&0xff);
X! 				alu16(STA16,sreg,0);
X  				cycles=6;
X  				break;
X  
X***************
X*** 333,339 ****
X  				tmp=dpcalc(pcr-1);
X  				writebus(tmp,ureg>>8);
X  				writebus(tmp+1,ureg&0xff);
X! 				alu16(STA16,ureg);
X  				cycles=5;
X  				break;
X  
X--- 331,337 ----
X  				tmp=dpcalc(pcr-1);
X  				writebus(tmp,ureg>>8);
X  				writebus(tmp+1,ureg&0xff);
X! 				alu16(STA16,ureg,0);
X  				cycles=5;
X  				break;
X  
X***************
X*** 342,348 ****
X  				tmp=dpcalc(pcr-1);
X  				writebus(tmp,xreg>>8);
X  				writebus(tmp+1,xreg&0xff);
X! 				alu16(STA16,xreg);
X  				cycles=5;
X  				break;
X  
X--- 340,346 ----
X  				tmp=dpcalc(pcr-1);
X  				writebus(tmp,xreg>>8);
X  				writebus(tmp+1,xreg&0xff);
X! 				alu16(STA16,xreg,0);
X  				cycles=5;
X  				break;
X  
X***************
X*** 351,357 ****
X  				tmp=dpcalc(pcr-1);
X  				writebus(tmp,yreg>>8);
X  				writebus(tmp+1,yreg&0xff);
X! 				alu16(STA16,yreg);
X  				cycles=6;
X  				break;
X  
X--- 349,355 ----
X  				tmp=dpcalc(pcr-1);
X  				writebus(tmp,yreg>>8);
X  				writebus(tmp+1,yreg&0xff);
X! 				alu16(STA16,yreg,0);
X  				cycles=6;
X  				break;
X  
X***************
X*** 380,386 ****
X  
X  			case 0x0d:
X  				pcr+=2;
X! 				alu(STA,readbus(dpcalc(pcr-1)));
X  				cycles=6;
X  				break;
X  
X--- 378,384 ----
X  
X  			case 0x0d:
X  				pcr+=2;
X! 				alu(STA,readbus(dpcalc(pcr-1)),0);
X  				cycles=6;
X  				break;
X  
X*** s_extended.c.orig	Mon Sep 21 09:14:52 1992
X--- s_extended.c	Mon Nov 16 16:56:41 1992
X***************
X*** 1,8 ****
X  #include "alu.h"
X  #include "main.h"
X! #include "simulate.h"
X! #define FALSE 0
X! #define TRUE 1
X  /*
X  	Cherche une instruction en mode EXTENDED
X  */
X--- 1,6 ----
X  #include "alu.h"
X  #include "main.h"
X! 
X  /*
X  	Cherche une instruction en mode EXTENDED
X  */
X***************
X*** 10,16 ****
X  int simulate_extended()
X  {
X  	int errflag=TRUE;
X! 	unsigned int opcode,tmp;
X  
X  		opcode=readbus(pcr);
X  		if (opcode==0x10 || opcode==0x11)
X--- 8,14 ----
X  int simulate_extended()
X  {
X  	int errflag=TRUE;
X! 	unsigned opcode,tmp;
X  
X  		opcode=readbus(pcr);
X  		if (opcode==0x10 || opcode==0x11)
X***************
X*** 72,78 ****
X  			case 0x78:
X  				pcr+=3;
X  				tmp=extendcalc(pcr-2);
X! 				writebus(tmp,alu(SHL,readbus(tmp)));
X  				cycles=7;
X  				break;
X  
X--- 70,76 ----
X  			case 0x78:
X  				pcr+=3;
X  				tmp=extendcalc(pcr-2);
X! 				writebus(tmp,alu(SHL,readbus(tmp),0));
X  				cycles=7;
X  				break;
X  
X***************
X*** 93,99 ****
X  			case 0x7f:
X  				pcr+=3;
X  				tmp=extendcalc(pcr-2);
X! 				writebus(tmp,alu(CLR));
X  				cycles=7;
X  				break;
X  
X--- 91,97 ----
X  			case 0x7f:
X  				pcr+=3;
X  				tmp=extendcalc(pcr-2);
X! 				writebus(tmp,alu(CLR,0,0));
X  				cycles=7;
X  				break;
X  
X***************
X*** 149,155 ****
X  			case 0x73:
X  				pcr+=3;
X  				tmp=extendcalc(pcr-2);
X! 				writebus(tmp,alu(COM,readbus(tmp)));
X  				cycles=7;
X  				break;
X  
X--- 147,153 ----
X  			case 0x73:
X  				pcr+=3;
X  				tmp=extendcalc(pcr-2);
X! 				writebus(tmp,alu(COM,readbus(tmp),0));
X  				cycles=7;
X  				break;
X  
X***************
X*** 156,162 ****
X  			case 0x7a:
X  				pcr+=3;
X  				tmp=extendcalc(pcr-2);
X! 				writebus(tmp,alu(DEC,readbus(tmp)));
X  				cycles=7;
X  				break;
X  
X--- 154,160 ----
X  			case 0x7a:
X  				pcr+=3;
X  				tmp=extendcalc(pcr-2);
X! 				writebus(tmp,alu(DEC,readbus(tmp),0));
X  				cycles=7;
X  				break;
X  
X***************
X*** 177,183 ****
X  			case 0x7c:
X  				pcr+=3;
X  				tmp=extendcalc(pcr-2);
X! 				writebus(tmp,alu(INC,readbus(tmp)));
X  				cycles=7;
X  				break;
X  
X--- 175,181 ----
X  			case 0x7c:
X  				pcr+=3;
X  				tmp=extendcalc(pcr-2);
X! 				writebus(tmp,alu(INC,readbus(tmp),0));
X  				cycles=7;
X  				break;
X  
X***************
X*** 197,203 ****
X  			case 0xb6:
X  				pcr+=3;
X  				tmp=extendcalc(pcr-2);
X! 				acca=alu(STA,readbus(tmp));
X  				cycles=5;
X  				break;
X  
X--- 195,201 ----
X  			case 0xb6:
X  				pcr+=3;
X  				tmp=extendcalc(pcr-2);
X! 				acca=alu(STA,readbus(tmp),0);
X  				cycles=5;
X  				break;
X  
X***************
X*** 204,210 ****
X  			case 0xf6:
X  				pcr+=3;
X  				tmp=extendcalc(pcr-2);
X! 				accb=alu(STA,readbus(tmp));
X  				cycles=5;
X  				break;
X  
X--- 202,208 ----
X  			case 0xf6:
X  				pcr+=3;
X  				tmp=extendcalc(pcr-2);
X! 				accb=alu(STA,readbus(tmp),0);
X  				cycles=5;
X  				break;
X  
X***************
X*** 213,219 ****
X  				tmp=extendcalc(pcr-2);
X  				acca=readbus(tmp);
X  				accb=readbus(tmp+1);
X! 				alu16(STA16,acca*256+accb);
X  				cycles=6;
X  				break;
X  
X--- 211,217 ----
X  				tmp=extendcalc(pcr-2);
X  				acca=readbus(tmp);
X  				accb=readbus(tmp+1);
X! 				alu16(STA16,acca*256+accb,0);
X  				cycles=6;
X  				break;
X  
X***************
X*** 222,228 ****
X  				tmp=extendcalc(pcr-2);
X  				sreg=readbus(tmp)<<8;
X  				sreg|=readbus(tmp+1);
X! 				alu16(STA16,sreg);
X  				cycles=7;
X  				break;
X  
X--- 220,226 ----
X  				tmp=extendcalc(pcr-2);
X  				sreg=readbus(tmp)<<8;
X  				sreg|=readbus(tmp+1);
X! 				alu16(STA16,sreg,0);
X  				cycles=7;
X  				break;
X  
X***************
X*** 231,237 ****
X  				tmp=extendcalc(pcr-2);
X  				ureg=readbus(tmp)<<8;
X  				ureg|=readbus(tmp+1);
X! 				alu16(STA16,ureg);
X  				cycles=6;
X  				break;
X  
X--- 229,235 ----
X  				tmp=extendcalc(pcr-2);
X  				ureg=readbus(tmp)<<8;
X  				ureg|=readbus(tmp+1);
X! 				alu16(STA16,ureg,0);
X  				cycles=6;
X  				break;
X  
X***************
X*** 240,246 ****
X  				tmp=extendcalc(pcr-2);
X  				xreg=readbus(tmp)<<8;
X  				xreg|=readbus(tmp+1);
X! 				alu16(STA16,xreg);
X  				cycles=6;
X  				break;
X  
X--- 238,244 ----
X  				tmp=extendcalc(pcr-2);
X  				xreg=readbus(tmp)<<8;
X  				xreg|=readbus(tmp+1);
X! 				alu16(STA16,xreg,0);
X  				cycles=6;
X  				break;
X  
X***************
X*** 249,255 ****
X  				tmp=extendcalc(pcr-2);
X  				yreg=readbus(tmp)<<8;
X  				yreg|=readbus(tmp+1);
X! 				alu16(STA16,yreg);
X  				cycles=7;
X  				break;
X  
X--- 247,253 ----
X  				tmp=extendcalc(pcr-2);
X  				yreg=readbus(tmp)<<8;
X  				yreg|=readbus(tmp+1);
X! 				alu16(STA16,yreg,0);
X  				cycles=7;
X  				break;
X  
X***************
X*** 256,262 ****
X  			case 0x74:
X  				pcr+=3;
X  				tmp=extendcalc(pcr-2);
X! 				writebus(tmp,alu(SHR,readbus(tmp)));
X  				cycles=7;
X  				break;
X  
X--- 254,260 ----
X  			case 0x74:
X  				pcr+=3;
X  				tmp=extendcalc(pcr-2);
X! 				writebus(tmp,alu(SHR,readbus(tmp),0));
X  				cycles=7;
X  				break;
X  
X***************
X*** 263,269 ****
X  			case 0x70:
X  				pcr+=3;
X  				tmp=extendcalc(pcr-2);
X! 				writebus(tmp,alu(NEG,readbus(tmp)));
X  				cycles=7;
X  				break;
X  
X--- 261,267 ----
X  			case 0x70:
X  				pcr+=3;
X  				tmp=extendcalc(pcr-2);
X! 				writebus(tmp,alu(NEG,readbus(tmp),0));
X  				cycles=7;
X  				break;
X  
X***************
X*** 284,290 ****
X  			case 0x79:
X  				pcr+=3;
X  				tmp=extendcalc(pcr-2);
X! 				writebus(tmp,alu(ROL,readbus(tmp)));
X  				cycles=7;
X  				break;
X  
X--- 282,288 ----
X  			case 0x79:
X  				pcr+=3;
X  				tmp=extendcalc(pcr-2);
X! 				writebus(tmp,alu(ROL,readbus(tmp),0));
X  				cycles=7;
X  				break;
X  
X***************
X*** 291,297 ****
X  			case 0x76:
X  				pcr+=3;
X  				tmp=extendcalc(pcr-2);
X! 				writebus(tmp,alu(ROR,readbus(tmp)));
X  				cycles=7;
X  				break;
X  
X--- 289,295 ----
X  			case 0x76:
X  				pcr+=3;
X  				tmp=extendcalc(pcr-2);
X! 				writebus(tmp,alu(ROR,readbus(tmp),0));
X  				cycles=7;
X  				break;
X  
X***************
X*** 313,319 ****
X  				pcr+=3;
X  				tmp=extendcalc(pcr-2);
X  				writebus(tmp,acca);
X! 				alu(STA,acca);
X  				cycles=5;
X  				break;
X  
X--- 311,317 ----
X  				pcr+=3;
X  				tmp=extendcalc(pcr-2);
X  				writebus(tmp,acca);
X! 				alu(STA,acca,0);
X  				cycles=5;
X  				break;
X  
X***************
X*** 321,327 ****
X  				pcr+=3;
X  				tmp=extendcalc(pcr-2);
X  				writebus(tmp,accb);
X! 				alu(STA,accb);
X  				cycles=5;
X  				break;
X  
X--- 319,325 ----
X  				pcr+=3;
X  				tmp=extendcalc(pcr-2);
X  				writebus(tmp,accb);
X! 				alu(STA,accb,0);
X  				cycles=5;
X  				break;
X  
X***************
X*** 330,336 ****
X  				tmp=extendcalc(pcr-2);
X  				writebus(tmp,acca);
X  				writebus(tmp+1,accb);
X! 				alu(STA16,acca*256+accb);
X  				cycles=6;
X  				break;
X  
X--- 328,334 ----
X  				tmp=extendcalc(pcr-2);
X  				writebus(tmp,acca);
X  				writebus(tmp+1,accb);
X! 				alu(STA16,acca*256+accb,0);
X  				cycles=6;
X  				break;
X  
X***************
X*** 339,345 ****
X  				tmp=extendcalc(pcr-2);
X  				writebus(tmp,sreg>>8);
X  				writebus(tmp+1,sreg&0xff);
X! 				alu(STA16,sreg);
X  				cycles=7;
X  				break;
X  
X--- 337,343 ----
X  				tmp=extendcalc(pcr-2);
X  				writebus(tmp,sreg>>8);
X  				writebus(tmp+1,sreg&0xff);
X! 				alu(STA16,sreg,0);
X  				cycles=7;
X  				break;
X  
X***************
X*** 348,354 ****
X  				tmp=extendcalc(pcr-2);
X  				writebus(tmp,ureg>>8);
X  				writebus(tmp+1,ureg&0xff);
X! 				alu(STA16,ureg);
X  				cycles=6;
X  				break;
X  
X--- 346,352 ----
X  				tmp=extendcalc(pcr-2);
X  				writebus(tmp,ureg>>8);
X  				writebus(tmp+1,ureg&0xff);
X! 				alu(STA16,ureg,0);
X  				cycles=6;
X  				break;
X  
X***************
X*** 357,363 ****
X  				tmp=extendcalc(pcr-2);
X  				writebus(tmp,xreg>>8);
X  				writebus(tmp+1,xreg&0xff);
X! 				alu(STA16,xreg);
X  				cycles=6;
X  				break;
X  
X--- 355,361 ----
X  				tmp=extendcalc(pcr-2);
X  				writebus(tmp,xreg>>8);
X  				writebus(tmp+1,xreg&0xff);
X! 				alu(STA16,xreg,0);
X  				cycles=6;
X  				break;
X  
X***************
X*** 366,372 ****
X  				tmp=extendcalc(pcr-2);
X  				writebus(tmp,yreg>>8);
X  				writebus(tmp+1,yreg&0xff);
X! 				alu(STA16,yreg);
X  				cycles=7;
X  				break;
X  
X--- 364,370 ----
X  				tmp=extendcalc(pcr-2);
X  				writebus(tmp,yreg>>8);
X  				writebus(tmp+1,yreg&0xff);
X! 				alu(STA16,yreg,0);
X  				cycles=7;
X  				break;
X  
X***************
X*** 396,402 ****
X  			case 0x7d:
X  				pcr+=3;
X  				tmp=extendcalc(pcr-2);
X! 				alu(STA,readbus(tmp));
X  				cycles=7;
X  				break;
X  
X--- 394,400 ----
X  			case 0x7d:
X  				pcr+=3;
X  				tmp=extendcalc(pcr-2);
X! 				alu(STA,readbus(tmp),0);
X  				cycles=7;
X  				break;
X  
X*** s_immediat.c.orig	Mon Oct 12 13:21:34 1992
X--- s_immediat.c	Mon Nov 16 16:56:47 1992
X***************
X*** 1,9 ****
X  #include "alu.h"
X  #include "main.h"
X  #include "misc.h"
X! #include "simulate.h"
X! #define FALSE 0
X! #define TRUE 1
X  /*
X  	Execute in IMMEDIAT mode.
X  */
X--- 1,7 ----
X  #include "alu.h"
X  #include "main.h"
X  #include "misc.h"
X! 
X  /*
X  	Execute in IMMEDIAT mode.
X  */
X***************
X*** 71,77 ****
X  
X  			case 0x85:
X  				pcr+=2;
X! 				alu(STA,alu(AND,acca,readbus(pcr-1)));
X  				cycles=2;
X  				break;
X  
X--- 69,75 ----
X  
X  			case 0x85:
X  				pcr+=2;
X! 				alu(STA,alu(AND,acca,readbus(pcr-1)),0);
X  				cycles=2;
X  				break;
X  
X***************
X*** 150,156 ****
X  			case 0x86:
X  				pcr+=2;
X  				acca=readbus(pcr-1);
X! 				alu(STA,acca);
X  				cycles=2;
X  				break;
X  
X--- 148,154 ----
X  			case 0x86:
X  				pcr+=2;
X  				acca=readbus(pcr-1);
X! 				alu(STA,acca,0);
X  				cycles=2;
X  				break;
X  
X***************
X*** 157,163 ****
X  			case 0xc6:
X  				pcr+=2;
X  				accb=readbus(pcr-1);
X! 				alu(STA,accb);
X  				cycles=2;
X  				break;
X  
X--- 155,161 ----
X  			case 0xc6:
X  				pcr+=2;
X  				accb=readbus(pcr-1);
X! 				alu(STA,accb,0);
X  				cycles=2;
X  				break;
X  
X***************
X*** 165,171 ****
X  				pcr+=3;
X  				acca=readbus(pcr-2);
X  				accb=readbus(pcr-1);
X! 				alu16(STA16,acca*256+accb);
X  				cycles=3;
X  				break;
X  
X--- 163,169 ----
X  				pcr+=3;
X  				acca=readbus(pcr-2);
X  				accb=readbus(pcr-1);
X! 				alu16(STA16,acca*256+accb,0);
X  				cycles=3;
X  				break;
X  
X***************
X*** 173,179 ****
X  				pcr+=4;
X  				sreg=(readbus(pcr-2))<<8;
X  				sreg|=readbus(pcr-1);
X! 				alu16(STA16,sreg);
X  				cycles=4;
X  				break;
X  
X--- 171,177 ----
X  				pcr+=4;
X  				sreg=(readbus(pcr-2))<<8;
X  				sreg|=readbus(pcr-1);
X! 				alu16(STA16,sreg,0);
X  				cycles=4;
X  				break;
X  
X***************
X*** 181,187 ****
X  				pcr+=3;
X  				ureg=(readbus(pcr-2))<<8;
X  				ureg|=readbus(pcr-1);
X! 				alu16(STA16,ureg);
X  				cycles=3;
X  				break;
X  
X--- 179,185 ----
X  				pcr+=3;
X  				ureg=(readbus(pcr-2))<<8;
X  				ureg|=readbus(pcr-1);
X! 				alu16(STA16,ureg,0);
X  				cycles=3;
X  				break;
X  
X***************
X*** 189,195 ****
X  				pcr+=3;
X  				xreg=(readbus(pcr-2))<<8;
X  				xreg|=readbus(pcr-1);
X! 				alu16(STA16,xreg);
X  				cycles=3;
X  				break;
X  
X--- 187,193 ----
X  				pcr+=3;
X  				xreg=(readbus(pcr-2))<<8;
X  				xreg|=readbus(pcr-1);
X! 				alu16(STA16,xreg,0);
X  				cycles=3;
X  				break;
X  
X***************
X*** 197,203 ****
X  				pcr+=4;
X  				yreg=(readbus(pcr-2))<<8;
X  				yreg|=readbus(pcr-1);
X! 				alu16(STA16,yreg);
X  				cycles=4;
X  				break;
X  
X--- 195,201 ----
X  				pcr+=4;
X  				yreg=(readbus(pcr-2))<<8;
X  				yreg|=readbus(pcr-1);
X! 				alu16(STA16,yreg,0);
X  				cycles=4;
X  				break;
X  
X*** s_indexed.c.orig	Mon Sep 21 09:15:18 1992
X--- s_indexed.c	Mon Nov 16 16:56:52 1992
X***************
X*** 1,8 ****
X  #include "alu.h"
X  #include "main.h"
X! #include "simulate.h"
X! #define FALSE 0
X! #define TRUE 1
X  /*
X  	Execute in INDEXED mode
X  */
X--- 1,6 ----
X  #include "alu.h"
X  #include "main.h"
X! 
X  /*
X  	Execute in INDEXED mode
X  */
X***************
X*** 10,16 ****
X  int simulate_indexed()
X  {
X  	int errflag=TRUE;
X! 	unsigned int opcode,tmp;
X  
X  	opcode=readbus(pcr);
X  	if(opcode==0x10||opcode==0x11)
X--- 8,14 ----
X  int simulate_indexed()
X  {
X  	int errflag=TRUE;
X! 	unsigned opcode,tmp;
X  
X  	opcode=readbus(pcr);
X  	if(opcode==0x10||opcode==0x11)
X***************
X*** 73,79 ****
X  				pcr+=2;
X  				cycles=6;
X  				tmp=indexcalc();
X! 				writebus(tmp,alu(SHL,readbus(tmp)));
X  				break;
X  
X  			case 0xa5:
X--- 71,77 ----
X  				pcr+=2;
X  				cycles=6;
X  				tmp=indexcalc();
X! 				writebus(tmp,alu(SHL,readbus(tmp),0));
X  				break;
X  
X  			case 0xa5:
X***************
X*** 94,100 ****
X  				pcr+=2;
X  				cycles=6;
X  				tmp=indexcalc();
X! 				writebus(tmp,alu(CLR));
X  				break;
X  
X  			case 0xa1:
X--- 92,98 ----
X  				pcr+=2;
X  				cycles=6;
X  				tmp=indexcalc();
X! 				writebus(tmp,alu(CLR,0,0));
X  				break;
X  
X  			case 0xa1:
X***************
X*** 150,156 ****
X  				pcr+=2;
X  				cycles=6;
X  				tmp=indexcalc();
X! 				writebus(tmp,alu(COM,readbus(tmp)));
X  				break;
X  
X  			case 0x6a:
X--- 148,154 ----
X  				pcr+=2;
X  				cycles=6;
X  				tmp=indexcalc();
X! 				writebus(tmp,alu(COM,readbus(tmp),0));
X  				break;
X  
X  			case 0x6a:
X***************
X*** 157,163 ****
X  				pcr+=2;
X  				cycles=6;
X  				tmp=indexcalc();
X! 				writebus(tmp,alu(DEC,readbus(tmp)));
X  				break;
X  
X  			case 0xa8:
X--- 155,161 ----
X  				pcr+=2;
X  				cycles=6;
X  				tmp=indexcalc();
X! 				writebus(tmp,alu(DEC,readbus(tmp),0));
X  				break;
X  
X  			case 0xa8:
X***************
X*** 178,184 ****
X  				pcr+=2;
X  				cycles=6;
X  				tmp=indexcalc();
X! 				writebus(tmp,alu(INC,readbus(tmp)));
X  				break;
X  
X  			case 0x6e:
X--- 176,182 ----
X  				pcr+=2;
X  				cycles=6;
X  				tmp=indexcalc();
X! 				writebus(tmp,alu(INC,readbus(tmp),0));
X  				break;
X  
X  			case 0x6e:
X***************
X*** 199,211 ****
X  			case 0xa6:
X  				pcr+=2;
X  				cycles=4;
X! 				acca=alu(STA,readbus(indexcalc()));
X  				break;
X  
X  			case 0xe6:
X  				pcr+=2;
X  				cycles=4;
X! 				accb=alu(STA,readbus(indexcalc()));
X  				break;
X  
X  			case 0xec:
X--- 197,209 ----
X  			case 0xa6:
X  				pcr+=2;
X  				cycles=4;
X! 				acca=alu(STA,readbus(indexcalc()),0);
X  				break;
X  
X  			case 0xe6:
X  				pcr+=2;
X  				cycles=4;
X! 				accb=alu(STA,readbus(indexcalc()),0);
X  				break;
X  
X  			case 0xec:
X***************
X*** 212,218 ****
X  				pcr+=2;
X  				cycles=5;
X  				tmp=indexcalc();
X! 			accb=alu16(STA16,readbus(tmp)*256+readbus(tmp+1));
X  				acca=accb>>8;
X  				accb&=0xff;
X  				break;
X--- 210,216 ----
X  				pcr+=2;
X  				cycles=5;
X  				tmp=indexcalc();
X! 			accb=alu16(STA16,readbus(tmp)*256+readbus(tmp+1),0);
X  				acca=accb>>8;
X  				accb&=0xff;
X  				break;
X***************
X*** 221,227 ****
X  				pcr+=3;
X  				cycles=6;
X  				tmp=indexcalc();
X! 			sreg=alu16(STA16,readbus(tmp)*256+readbus(tmp+1));
X  				break;
X  
X  			case 0xee:
X--- 219,225 ----
X  				pcr+=3;
X  				cycles=6;
X  				tmp=indexcalc();
X! 			sreg=alu16(STA16,readbus(tmp)*256+readbus(tmp+1),0);
X  				break;
X  
X  			case 0xee:
X***************
X*** 228,234 ****
X  				pcr+=2;
X  				cycles=5;
X  				tmp=indexcalc();
X! 			ureg=alu16(STA16,readbus(tmp)*256+readbus(tmp+1));
X  				break;
X  
X  			case 0xae:
X--- 226,232 ----
X  				pcr+=2;
X  				cycles=5;
X  				tmp=indexcalc();
X! 			ureg=alu16(STA16,readbus(tmp)*256+readbus(tmp+1),0);
X  				break;
X  
X  			case 0xae:
X***************
X*** 235,241 ****
X  				pcr+=2;
X  				cycles=5;
X  				tmp=indexcalc();
X! 			xreg=alu16(STA16,readbus(tmp)*256+readbus(tmp+1));
X  				break;
X  
X  			case 0x10ae:
X--- 233,239 ----
X  				pcr+=2;
X  				cycles=5;
X  				tmp=indexcalc();
X! 			xreg=alu16(STA16,readbus(tmp)*256+readbus(tmp+1),0);
X  				break;
X  
X  			case 0x10ae:
X***************
X*** 242,248 ****
X  				pcr+=3;
X  				cycles=6;
X  				tmp=indexcalc();
X! 			yreg=alu16(STA16,readbus(tmp)*256+readbus(tmp+1));
X  				break;
X  
X  			case 0x32:
X--- 240,246 ----
X  				pcr+=3;
X  				cycles=6;
X  				tmp=indexcalc();
X! 			yreg=alu16(STA16,readbus(tmp)*256+readbus(tmp+1),0);
X  				break;
X  
X  			case 0x32:
X***************
X*** 273,279 ****
X  				pcr+=2;
X  				cycles=6;
X  				tmp=indexcalc();
X! 				writebus(tmp,alu(SHR,readbus(tmp)));
X  				break;
X  
X  			case 0x60:
X--- 271,277 ----
X  				pcr+=2;
X  				cycles=6;
X  				tmp=indexcalc();
X! 				writebus(tmp,alu(SHR,readbus(tmp),0));
X  				break;
X  
X  			case 0x60:
X***************
X*** 280,286 ****
X  				pcr+=2;
X  				cycles=6;
X  				tmp=indexcalc();
X! 				writebus(tmp,alu(NEG,readbus(tmp)));
X  				break;
X  
X  			case 0xaa:
X--- 278,284 ----
X  				pcr+=2;
X  				cycles=6;
X  				tmp=indexcalc();
X! 				writebus(tmp,alu(NEG,readbus(tmp),0));
X  				break;
X  
X  			case 0xaa:
X***************
X*** 301,307 ****
X  				pcr+=2;
X  				cycles=6;
X  				tmp=indexcalc();
X! 				writebus(tmp,alu(ROL,readbus(tmp)));
X  				break;
X  
X  			case 0x66:
X--- 299,305 ----
X  				pcr+=2;
X  				cycles=6;
X  				tmp=indexcalc();
X! 				writebus(tmp,alu(ROL,readbus(tmp),0));
X  				break;
X  
X  			case 0x66:
X***************
X*** 308,314 ****
X  				pcr+=2;
X  				cycles=6;
X  				tmp=indexcalc();
X! 				writebus(tmp,alu(ROR,readbus(tmp)));
X  				break;
X  
X  			case 0xa2:
X--- 306,312 ----
X  				pcr+=2;
X  				cycles=6;
X  				tmp=indexcalc();
X! 				writebus(tmp,alu(ROR,readbus(tmp),0));
X  				break;
X  
X  			case 0xa2:
X***************
X*** 406,412 ****
X  				pcr+=2;
X  				cycles=6;
X  				tmp=indexcalc();
X! 				alu(STA,readbus(tmp));
X  				break;
X  
X  			default:
X--- 404,410 ----
X  				pcr+=2;
X  				cycles=6;
X  				tmp=indexcalc();
X! 				alu(STA,readbus(tmp),0);
X  				break;
X  
X  			default:
X*** s_inherent.c.orig	Mon Sep 21 09:15:29 1992
X--- s_inherent.c	Mon Nov 16 16:56:59 1992
X***************
X*** 1,9 ****
X  #include "alu.h"
X  #include "main.h"
X  #include "misc.h"
X! #include "simulate.h"
X! #define FALSE 0
X! #define TRUE 1
X  /*
X  	Execute in INHERENT mode
X  */
X--- 1,7 ----
X  #include "alu.h"
X  #include "main.h"
X  #include "misc.h"
X! 
X  /*
X  	Execute in INHERENT mode
X  */
X***************
X*** 11,17 ****
X  int simulate_inherent()
X  {
X  	int errflag=TRUE;
X! 	unsigned int opcode,tmp,mask;
X  
X  		opcode=readbus(pcr);
X  		if (opcode==0x10||opcode==0x11)
X--- 9,15 ----
X  int simulate_inherent()
X  {
X  	int errflag=TRUE;
X! 	unsigned opcode,tmp,mask;
X  
X  		opcode=readbus(pcr);
X  		if (opcode==0x10||opcode==0x11)
X***************
X*** 27,63 ****
X  
X  			case 0x48:
X  				++pcr;
X! 				acca=alu(SHL,acca);
X  				cycles=2;
X  				break;
X  
X  			case 0x58:
X  				++pcr;
X! 				accb=alu(SHL,accb);
X  				cycles=2;
X  				break;
X  
X  			case 0x4f:
X  				++pcr;
X! 				acca=alu(CLR);
X  				cycles=2;
X  				break;
X  
X  			case 0x5f:
X  				++pcr;
X! 				accb=alu(CLR);
X  				cycles=2;
X  				break;
X  
X  			case 0x43:
X  				++pcr;
X! 				acca=alu(COM,acca);
X  				cycles=2;
X  				break;
X  
X  			case 0x53:
X  				++pcr;
X! 				accb=alu(COM,accb);
X  				cycles=2;
X  				break;
X  
X--- 25,61 ----
X  
X  			case 0x48:
X  				++pcr;
X! 				acca=alu(SHL,acca,0);
X  				cycles=2;
X  				break;
X  
X  			case 0x58:
X  				++pcr;
X! 				accb=alu(SHL,accb,0);
X  				cycles=2;
X  				break;
X  
X  			case 0x4f:
X  				++pcr;
X! 				acca=alu(CLR,0,0);
X  				cycles=2;
X  				break;
X  
X  			case 0x5f:
X  				++pcr;
X! 				accb=alu(CLR,0,0);
X  				cycles=2;
X  				break;
X  
X  			case 0x43:
X  				++pcr;
X! 				acca=alu(COM,acca,0);
X  				cycles=2;
X  				break;
X  
X  			case 0x53:
X  				++pcr;
X! 				accb=alu(COM,accb,0);
X  				cycles=2;
X  				break;
X  
X***************
X*** 68,104 ****
X  
X  			case 0x4a:
X  				++pcr;
X! 				acca=alu(DEC,acca);
X  				cycles=2;
X  				break;
X  
X  			case 0x5a:
X  				++pcr;
X! 				accb=alu(DEC,accb);
X  				cycles=2;
X  				break;
X  
X  			case 0x4c:
X  				++pcr;
X! 				acca=alu(INC,acca);
X  				cycles=2;
X  				break;
X  
X  			case 0x5c:
X  				++pcr;
X! 				accb=alu(INC,accb);
X  				cycles=2;
X  				break;
X  
X  			case 0x44:
X  				++pcr;
X! 				acca=alu(SHR,acca);
X  				cycles=2;
X  				break;
X  
X  			case 0x54:
X  				++pcr;
X! 				accb=alu(SHR,accb);
X  				cycles=2;
X  				break;
X  
X--- 66,102 ----
X  
X  			case 0x4a:
X  				++pcr;
X! 				acca=alu(DEC,acca,0);
X  				cycles=2;
X  				break;
X  
X  			case 0x5a:
X  				++pcr;
X! 				accb=alu(DEC,accb,0);
X  				cycles=2;
X  				break;
X  
X  			case 0x4c:
X  				++pcr;
X! 				acca=alu(INC,acca,0);
X  				cycles=2;
X  				break;
X  
X  			case 0x5c:
X  				++pcr;
X! 				accb=alu(INC,accb,0);
X  				cycles=2;
X  				break;
X  
X  			case 0x44:
X  				++pcr;
X! 				acca=alu(SHR,acca,0);
X  				cycles=2;
X  				break;
X  
X  			case 0x54:
X  				++pcr;
X! 				accb=alu(SHR,accb,0);
X  				cycles=2;
X  				break;
X  
X***************
X*** 112,124 ****
X  
X  			case 0x40:
X  				++pcr;
X! 				acca=alu(NEG,acca);
X  				cycles=2;
X  				break;
X  
X  			case 0x50:
X  				++pcr;
X! 				accb=alu(NEG,accb);
X  				cycles=2;
X  				break;
X  
X--- 110,122 ----
X  
X  			case 0x40:
X  				++pcr;
X! 				acca=alu(NEG,acca,0);
X  				cycles=2;
X  				break;
X  
X  			case 0x50:
X  				++pcr;
X! 				accb=alu(NEG,accb,0);
X  				cycles=2;
X  				break;
X  
X***************
X*** 129,153 ****
X  
X  			case 0x49:
X  				++pcr;
X! 				acca=alu(ROL,acca);
X  				cycles=2;
X  				break;
X  
X  			case 0x59:
X  				++pcr;
X! 				accb=alu(ROL,accb);
X  				cycles=2;
X  				break;
X  
X  			case 0x46:
X  				++pcr;
X! 				acca=alu(ROR,acca);
X  				cycles=2;
X  				break;
X  
X  			case 0x56:
X  				++pcr;
X! 				accb=alu(ROR,accb);
X  				cycles=2;
X  				break;
X  
X--- 127,151 ----
X  
X  			case 0x49:
X  				++pcr;
X! 				acca=alu(ROL,acca,0);
X  				cycles=2;
X  				break;
X  
X  			case 0x59:
X  				++pcr;
X! 				accb=alu(ROL,accb,0);
X  				cycles=2;
X  				break;
X  
X  			case 0x46:
X  				++pcr;
X! 				acca=alu(ROR,acca,0);
X  				cycles=2;
X  				break;
X  
X  			case 0x56:
X  				++pcr;
X! 				accb=alu(ROR,accb,0);
X  				cycles=2;
X  				break;
X  
X***************
X*** 172,178 ****
X  			case 0x1d:
X  				++pcr;
X  				acca=(accb>127)?255:0;
X! 				alu16(STA16,acca*256+accb);
X  				cycles=2;
X  				break;
X  
X--- 170,176 ----
X  			case 0x1d:
X  				++pcr;
X  				acca=(accb>127)?255:0;
X! 				alu16(STA16,acca*256+accb,0);
X  				cycles=2;
X  				break;
X  
X***************
X*** 229,241 ****
X  
X  			case 0x4d:
X  				++pcr;
X! 				alu(STA,acca);
X  				cycles=2;
X  				break;
X  
X  			case 0x5d:
X  				++pcr;
X! 				alu(STA,accb);
X  				cycles=2;
X  				break;
X  
X--- 227,239 ----
X  
X  			case 0x4d:
X  				++pcr;
X! 				alu(STA,acca,0);
X  				cycles=2;
X  				break;
X  
X  			case 0x5d:
X  				++pcr;
X! 				alu(STA,accb,0);
X  				cycles=2;
X  				break;
X  
X*** s_relative.c.orig	Mon Sep 21 09:15:41 1992
X--- s_relative.c	Mon Nov 16 16:57:06 1992
X***************
X*** 1,7 ****
X  #include "main.h"
X! #include "simulate.h"
X! #define FALSE 0
X! #define TRUE 1
X  /*
X  	Execute in RELATIVE MODE
X  */
X--- 1,5 ----
X  #include "main.h"
X! 
X  /*
X  	Execute in RELATIVE MODE
X  */
X***************
X*** 9,15 ****
X  int simulate_relative()
X  {
X  	int errflag=TRUE;
X! 	unsigned int opcode;
X  
X  		opcode=readbus(pcr);
X  		if (opcode==0x10)
X--- 7,13 ----
X  int simulate_relative()
X  {
X  	int errflag=TRUE;
X! 	unsigned opcode;
X  
X  		opcode=readbus(pcr);
X  		if (opcode==0x10)
X*** welcome.c.orig	Thu Nov  5 17:37:42 1992
X--- welcome.c	Mon Nov 16 09:46:07 1992
X***************
X*** 2,9 ****
X--- 2,12 ----
X  	Affiche le message de bienvenue
X  */
X  #include <curses.h>
X+ #include "main.h"
X+ 
X  #define HAUTEUR 12
X  #define LARGEUR 40
X+ 
X  welcome()
X  {
X  	WINDOW *win;
X***************
X*** 11,17 ****
X  	char *message[5]= { "S I M 0 9",
X  			    "B Y :", "Benoit Archambault",
X  			    "(C)opyright 1992", "Version 0.1"  };
X- 	extern unsigned int couleur;
X  
X  	win= newwin(HAUTEUR, LARGEUR, 6, 20);
X  
X--- 14,19 ----
END_OF_FILE
if test 56422 -ne `wc -c <'sim.patch'`; then
    echo shar: \"'sim.patch'\" unpacked with wrong size!
fi
# end of 'sim.patch'
fi
if test -f 'makefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'makefile'\"
else
echo shar: Extracting \"'makefile'\" \(1715 characters\)
sed "s/^X//" >'makefile' <<'END_OF_FILE'
X#  ----------------------------------------------------------
X#  SunOS gnu MAKEFILE to build sim09
X#  ----------------------------------------------------------
X
CC	= gcc
CFLAGS	= -g -O -I/usr/5include
X
LIB1	= /usr/5lib
LIB2	= /usr/lib
X
LIBS	= 
X
LD	= $(CC)
LDFLAGS	= 
X
X#  ----------------------------------------------------------
X#  Application Name
X#  ----------------------------------------------------------
X
CDATA_APPL   = sim09
X
sim09 : alu.o breakpoint.o cshell.o d_direct.o d_extended.o d_immediat.o \
X	d_indexed.o d_inherent.o d_relative.o execute.o file.o main.o \
X	mainmenu.o menu.o misc.o mode.o monitor.o operand.o s_direct.o \
X	s_extended.o s_immediat.o s_indexed.o s_inherent.o s_relative.o \
X	welcome.o
X	$(LD) $(LDFLAGS) -o sim09 alu.o breakpoint.o cshell.o d_direct.o \
X		d_extended.o d_immediat.o d_indexed.o d_inherent.o \
X		d_relative.o execute.o file.o main.o mainmenu.o menu.o misc.o \
X		mode.o monitor.o operand.o s_direct.o s_extended.o \
X		s_immediat.o s_indexed.o s_inherent.o s_relative.o welcome.o \
X		/usr/5lib/libcurses.a
X
alu.o : main.h alu.h
X
breakpoint.o : main.h
X
cshell.o : main.h
X
d_direct.o : main.h
X
d_extended.o : main.h
X
d_immediat.o : main.h operand.h
X
d_indexed.o : main.h
X
d_inherent.o : main.h
X
d_relative.o : main.h operand.h
X
execute.o : main.h mode.h
X
file.o : main.h
X
main.o : main.h mode.h
X
mainmenu.o : main.h
X
menu.o : main.h
X
misc.o : main.h misc.h
X
mode.o : main.h mode.h
X
monitor.o : main.h mode.h
X
operand.o : main.h operand.h
X
s_direct.o : alu.h main.h
X
s_extended.o : alu.h main.h
X
s_immediat.o : alu.h main.h misc.h
X
s_indexed.o : alu.h main.h
X
s_inherent.o : alu.h main.h misc.h
X
s_relative.o : main.h
X
welcome.o : main.h
END_OF_FILE
if test 1715 -ne `wc -c <'makefile'`; then
    echo shar: \"'makefile'\" unpacked with wrong size!
fi
# end of 'makefile'
fi
echo shar: End of shell archive.
exit 0
Newsgroups: comp.sys.m6809