Frankenstein Cross Assemblers, 6502 flavor, Part 2 of 2

Mark Zenier markz at ssc.UUCP
Thu Dec 6 18:21:33 AEST 1990


---- Cut Here and feed the following to sh ----
#!/bin/sh
# This is part 02 of Frankasm/As6502
# ============= as6502.y ==============
if test -f 'as6502.y' -a X"$1" != X"-c"; then
	echo 'x - skipping as6502.y (File already exists)'
else
echo 'x - extracting as6502.y (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'as6502.y' &&
X%{
X
X/*
XHEADER: 	;
XTITLE: 		Frankenstein Cross Assemblers;
XVERSION: 	2.0;
XDESCRIPTION: "	Reconfigurable Cross-assembler producing Intel (TM)
X		Hex format object records.  ";
XKEYWORDS: 	cross-assemblers, 1805, 2650, 6301, 6502, 6805, 6809, 
X		6811, tms7000, 8048, 8051, 8096, z8, z80;
XSYSTEM: 	UNIX, MS-Dos ;
XFILENAME: 	as6502.y;
XWARNINGS: 	"This software is in the public domain.  
X		Any prior copyright claims are relinquished.  
X
X		This software is distributed with no warranty whatever.  
X		The author takes no responsibility for the consequences 
X		of its use.
X
X		Yacc (or Bison) required to compile."  ;
XSEE-ALSO: 	as6502.doc,frasmain.c;	
XAUTHORS: 	Mark Zenier;
XCOMPILERS: 	Microport Sys V/AT, ATT Yacc, Turbo C V1.5, Bison (CUG disk 285)
X		(previous versions Xenix, Unisoft 68000 Version 7, Sun 3);
X*/
X/* 65xx instruction generation file */
X/* November 17, 1990 */
X
X/*
X	description	frame work parser description for framework cross
X			assemblers
X	history		February 2, 1988
X			September 11, 1990 - merge table definition
X			September 12, 1990 - short file names
X			September 14, 1990 - short variable names
X			September 17, 1990 - use yylex as external
X*/
X#include <stdio.h>
X#include "frasmdat.h"
X#include "fragcon.h"
X
X#define yylex lexintercept
X
X/*	0000.0000.0000.00xx		address mode selection bits */
X#define	ADDRESS		0x3
X#define	DIRECT		0x1
X#define	EXTENDED	0x2
X/*	0000.0000.0000.xx00		index selector bits */
X#define	INDEXMASK	0xc
X#define	INDEXX		0x4
X#define	INDEXY		0x8
X/*	0000.0xxx.0000.0000		instruction set enable bits */
X#define	INSTCMOS	0x100
X#define	INSTROCKWELL	0x200
X#define	INST21		0x400
X/*					instruction sets */
X#define	CPU65		0
X#define	CPUR65		INSTROCKWELL
X#define	CPU65C		INSTCMOS
X#define	CPUR65C		(INSTROCKWELL|INSTCMOS)
X#define	CPUR21		(INSTROCKWELL|INST21)
X#define ST_INH 0x1
X#define ST_ACCUM 0x2
X#define ST_EXPR 0x4
X#define ST_INDEX 0x8
X#define ST_PREINDEX 0x10
X#define ST_INDIR 0x20
X#define ST_POSTINDEX 0x40
X#define ST_IMMED 0x80
X#define ST_DIRREL 0x100
X	
X	int	cpuselect = CPUR65C;
X	static char	genbdef[] = "[1=];";
X	static char	genwdef[] = "[1=]y"; /* x for normal, y for byte rev */
X	char ignosyn[] = "[Xinvalid syntax for instruction";
X	char ignosel[] = "[Xinvalid operands/illegal instruction for cpu";
X
X	long	labelloc;
X	static int satsub;
X	int	ifstkpt = 0;
X	int	fraifskip = FALSE;
X
X	struct symel * endsymbol = SYMNULL;
X
X%}
X%union {
X	int	intv;
X	long 	longv;
X	char	*strng;
X	struct symel *symb;
X}
X
X%type <intv> topexpr
X%token ACCUM
X%token <intv> INDEX
X%token <intv> KOC_BDEF
X%token <intv> KOC_ELSE
X%token <intv> KOC_END
X%token <intv> KOC_ENDI
X%token <intv> KOC_EQU
X%token <intv> KOC_IF
X%token <intv> KOC_INCLUDE
X%token <intv> KOC_ORG
X%token <intv> KOC_RESM
X%token <intv> KOC_SDEF
X%token <intv> KOC_SET
X%token <intv> KOC_WDEF
X%token <intv> KOC_CHSET
X%token <intv> KOC_CHDEF
X%token <intv> KOC_CHUSE
X%token <intv> KOC_CPU
X%token <intv> KOC_opcode
X
X%token <longv> CONSTANT
X%token EOL
X%token KEOP_AND
X%token KEOP_DEFINED
X%token KEOP_EQ
X%token KEOP_GE
X%token KEOP_GT
X%token KEOP_HIGH
X%token KEOP_LE
X%token KEOP_LOW
X%token KEOP_LT
X%token KEOP_MOD
X%token KEOP_MUN
X%token KEOP_NE
X%token KEOP_NOT
X%token KEOP_OR
X%token KEOP_SHL
X%token KEOP_SHR
X%token KEOP_XOR
X%token KEOP_locctr
X%token <symb> LABEL
X%token <strng> STRING
X%token <symb> SYMBOL
X
X%token KTK_invalid
X
X%right	KEOP_HIGH KEOP_LOW
X%left	KEOP_OR KEOP_XOR
X%left	KEOP_AND
X%right	KEOP_NOT
X%nonassoc	KEOP_GT KEOP_GE KEOP_LE KEOP_LT KEOP_NE KEOP_EQ
X%left	'+' '-'
X%left	'*' '/' KEOP_MOD KEOP_SHL KEOP_SHR
X%right	KEOP_MUN
X
X
X%type <intv> expr exprlist stringlist
X
X%start file
X
X%%
X
Xfile	:	file allline
X	|	allline
X	;
X
Xallline	: 	line EOL
X			{
X				clrexpr();
X			}
X	|	EOL
X	|	error EOL
X			{
X				clrexpr();
X				yyerrok;
X			}
X	;
X
Xline	:	LABEL KOC_END 
X			{
X				endsymbol = $1;
X				nextreadact = Nra_end;
X			}
X	|	      KOC_END 
X			{
X				nextreadact = Nra_end;
X			}
X	|	KOC_INCLUDE STRING
X			{
X		if(nextfstk >= FILESTKDPTH)
X		{
X			fraerror("include file nesting limit exceeded");
X		}
X		else
X		{
X			infilestk[nextfstk].fnm = savestring($2,strlen($2));
X			if( (infilestk[nextfstk].fpt = fopen($2,"r"))
X				==(FILE *)NULL )
X			{
X				fraerror("cannot open include file");
X			}
X			else
X			{
X				nextreadact = Nra_new;
X			}
X		}
X			}
X	|	LABEL KOC_EQU expr 
X			{
X				if($1 -> seg == SSG_UNDEF)
X				{
X					pevalexpr(0, $3);
X					if(evalr[0].seg == SSG_ABS)
X					{
X						$1 -> seg = SSG_EQU;
X						$1 -> value = evalr[0].value;
X						prtequvalue("C: 0x%lx\n",
X							evalr[0].value);
X					}
X					else
X					{
X						fraerror(
X					"noncomputable expression for EQU");
X					}
X				}
X				else
X				{
X					fraerror(
X				"cannot change symbol value with EQU");
X				}
X			}
X	|	LABEL KOC_SET expr 
X			{
X				if($1 -> seg == SSG_UNDEF
X				   || $1 -> seg == SSG_SET)
X				{
X					pevalexpr(0, $3);
X					if(evalr[0].seg == SSG_ABS)
X					{
X						$1 -> seg = SSG_SET;
X						$1 -> value = evalr[0].value;
X						prtequvalue("C: 0x%lx\n",
X							evalr[0].value);
X					}
X					else
X					{
X						fraerror(
X					"noncomputable expression for SET");
X					}
X				}
X				else
X				{
X					fraerror(
X				"cannot change symbol value with SET");
X				}
X			}
X	|	KOC_IF expr 
X			{
X		if((++ifstkpt) < IFSTKDEPTH)
X		{
X			pevalexpr(0, $2);
X			if(evalr[0].seg == SSG_ABS)
X			{
X				if(evalr[0].value != 0)
X				{
X					elseifstk[ifstkpt] = If_Skip;
X					endifstk[ifstkpt] = If_Active;
X				}
X				else
X				{
X					fraifskip = TRUE;
X					elseifstk[ifstkpt] = If_Active;
X					endifstk[ifstkpt] = If_Active;
X				}
X			}
X			else
X			{
X				fraifskip = TRUE;
X				elseifstk[ifstkpt] = If_Active;
X				endifstk[ifstkpt] = If_Active;
X			}
X		}
X		else
X		{
X			fraerror("IF stack overflow");
X		}
X			}
X						
X	|	KOC_IF 
X			{
X		if(fraifskip) 
X		{
X			if((++ifstkpt) < IFSTKDEPTH)
X			{
X					elseifstk[ifstkpt] = If_Skip;
X					endifstk[ifstkpt] = If_Skip;
X			}
X			else
X			{
X				fraerror("IF stack overflow");
X			}
X		}
X		else
X		{
X			yyerror("syntax error");
X			YYERROR;
X		}
X				}
X						
X	|	KOC_ELSE 
X			{
X				switch(elseifstk[ifstkpt])
X				{
X				case If_Active:
X					fraifskip = FALSE;
X					break;
X				
X				case If_Skip:
X					fraifskip = TRUE;
X					break;
X				
X				case If_Err:
X					fraerror("ELSE with no matching if");
X					break;
X				}
X			}
X
X	|	KOC_ENDI 
X			{
X				switch(endifstk[ifstkpt])
X				{
X				case If_Active:
X					fraifskip = FALSE;
X					ifstkpt--;
X					break;
X				
X				case If_Skip:
X					fraifskip = TRUE;
X					ifstkpt--;
X					break;
X				
X				case If_Err:
X					fraerror("ENDI with no matching if");
X					break;
X				}
X			}
X	|	LABEL KOC_ORG expr 
X			{
X				pevalexpr(0, $3);
X				if(evalr[0].seg == SSG_ABS)
X				{
X					locctr = labelloc = evalr[0].value;
X					if($1 -> seg == SSG_UNDEF)
X					{
X						$1 -> seg = SSG_ABS;
X						$1 -> value = labelloc;
X					}
X					else
X						fraerror(
X						"multiple definition of label");
X					prtequvalue("C: 0x%lx\n",
X						evalr[0].value);
X				}
X				else
X				{
X					fraerror(
X					 "noncomputable expression for ORG");
X				}
X			}
X	|	      KOC_ORG expr 
X			{
X				pevalexpr(0, $2);
X				if(evalr[0].seg == SSG_ABS)
X				{
X					locctr = labelloc = evalr[0].value;
X					prtequvalue("C: 0x%lx\n",
X						evalr[0].value);
X				}
X				else
X				{
X					fraerror(
X					 "noncomputable expression for ORG");
X				}
X			}
X	|	LABEL KOC_CHSET
X			{
X				if($1 -> seg == SSG_UNDEF)
X				{
X					$1 -> seg = SSG_EQU;
X					if( ($1->value = chtcreate()) <= 0)
X					{
X		fraerror( "cannot create character translation table");
X					}
X					prtequvalue("C: 0x%lx\n", $1 -> value);
X				}
X				else
X				{
X			fraerror( "multiple definition of label");
X				}
X			}
X	|		KOC_CHUSE
X			{
X				chtcpoint = (int *) NULL;
X				prtequvalue("C: 0x%lx\n", 0L);
X			}
X	|		KOC_CHUSE expr
X			{
X				pevalexpr(0, $2);
X				if( evalr[0].seg == SSG_ABS)
X				{
X					if( evalr[0].value == 0)
X					{
X						chtcpoint = (int *)NULL;
X						prtequvalue("C: 0x%lx\n", 0L);
X					}
X					else if(evalr[0].value < chtnxalph)
X					{
X				chtcpoint = chtatab[evalr[0].value];
X				prtequvalue("C: 0x%lx\n", evalr[0].value);
X					}
X					else
X					{
X			fraerror("nonexistent character translation table");
X					}
X				}
X				else
X				{
X					fraerror("noncomputable expression");
X				}
X			}
X	|		KOC_CHDEF STRING ',' exprlist
X			{
X		int findrv, numret, *charaddr;
X		char *sourcestr = $2, *before;
X
X		if(chtnpoint != (int *)NULL)
X		{
X			for(satsub = 0; satsub < $4; satsub++)
X			{
X				before = sourcestr;
X
X				pevalexpr(0, exprlist[satsub]);
X				findrv = chtcfind(chtnpoint, &sourcestr,
X						&charaddr, &numret);
X				if(findrv == CF_END)
X				{
X			fraerror("more expressions than characters");
X					break;
X				}
X
X				if(evalr[0].seg == SSG_ABS)
X				{
X					switch(findrv)
X					{
X					case CF_UNDEF:
X						{
X				if(evalr[0].value < 0 ||
X					evalr[0].value > 255)
X				{
X			frawarn("character translation value truncated");
X				}
X				*charaddr = evalr[0].value & 0xff;
X				prtequvalue("C: 0x%lx\n", evalr[0].value);
X						}
X						break;
X
X					case CF_INVALID:
X					case CF_NUMBER:
X				fracherror("invalid character to define", 
X					before, sourcestr);
X						break;
X
X					case CF_CHAR:
X				fracherror("character already defined", 
X					before, sourcestr);
X						break;
X					}
X				}
X				else
X				{
X					fraerror("noncomputable expression");
X				}
X			}
X
X			if( *sourcestr != '\0')
X			{
X				fraerror("more characters than expressions");
X			}
X		}
X		else
X		{
X			fraerror("no CHARSET statement active");
X		}
X			
X			}
X	|	LABEL 
X			{
X			if($1 -> seg == SSG_UNDEF)
X			{
X				$1 -> seg = SSG_ABS;
X				$1 -> value = labelloc;
X				prtequvalue("C: 0x%lx\n", labelloc);
X
X			}
X			else
X				fraerror(
X				"multiple definition of label");
X			}
X	|	labeledline
X	;
X
Xlabeledline :	LABEL genline
X			{
X			if($1 -> seg == SSG_UNDEF)
X			{
X				$1 -> seg = SSG_ABS;
X				$1 -> value = labelloc;
X			}
X			else
X				fraerror(
X				"multiple definition of label");
X			labelloc = locctr;
X			}
X				
X	|	genline
X			{
X				labelloc = locctr;
X			}
X	;
X
Xgenline	:	KOC_BDEF	exprlist 
X			{
X				genlocrec(currseg, labelloc);
X				for( satsub = 0; satsub < $2; satsub++)
X				{
X					pevalexpr(1, exprlist[satsub]);
X					locctr += geninstr(genbdef);
X				}
X			}
X	|	KOC_SDEF stringlist 
X			{
X				genlocrec(currseg, labelloc);
X				for(satsub = 0; satsub < $2; satsub++)
X				{
X					locctr += genstring(stringlist[satsub]);
X				}
X			}
X	|	KOC_WDEF exprlist 
X			{
X				genlocrec(currseg, labelloc);
X				for( satsub = 0; satsub < $2; satsub++)
X				{
X					pevalexpr(1, exprlist[satsub]);
X					locctr += geninstr(genwdef);
X				}
X			}	
X	|	KOC_RESM expr 
X			{
X				pevalexpr(0, $2);
X				if(evalr[0].seg == SSG_ABS)
X				{
X					locctr = labelloc + evalr[0].value;
X					prtequvalue("C: 0x%lx\n", labelloc);
X				}
X				else
X				{
X					fraerror(
X				 "noncomputable result for RMB expression");
X				}
X			}
X	;
X
Xexprlist :	exprlist ',' expr
X			{
X				exprlist[nextexprs ++ ] = $3;
X				$$ = nextexprs;
X			}
X	|	expr
X			{
X				nextexprs = 0;
X				exprlist[nextexprs ++ ] = $1;
X				$$ = nextexprs;
X			}
X	;
X
Xstringlist :	stringlist ',' STRING
X			{
X				stringlist[nextstrs ++ ] = $3;
X				$$ = nextstrs;
X			}
X	|	STRING
X			{
X				nextstrs = 0;
X				stringlist[nextstrs ++ ] = $1;
X				$$ = nextstrs;
X			}
X	;
X
X
Xline	:	KOC_CPU STRING
X			{
X		if( ! cpumatch($2))
X		{
X			fraerror("unknown cpu type, R65C02 assumed");
X			cpuselect = CPUR65C;
X		}
X			}
X	;
Xgenline : KOC_opcode 
X			{
X		genlocrec(currseg, labelloc);
X		locctr += geninstr(findgen($1, ST_INH, cpuselect));
X			}
X	;
Xgenline : KOC_opcode  ACCUM
X			{
X		genlocrec(currseg, labelloc);
X		locctr += geninstr(findgen($1, ST_ACCUM, cpuselect));
X			}
X	;
Xgenline : KOC_opcode  topexpr
X			{
X		pevalexpr(1, $2);
X		genlocrec(currseg, labelloc);
X		locctr += geninstr( findgen( $1, ST_EXPR, 
X				  ( (evalr[1].seg == SSG_ABS 
X				&& evalr[1].value >= 0
X				&& evalr[1].value <= 255 )
X				? DIRECT : EXTENDED ) | cpuselect )
X				);
X			}
X	;
Xgenline : KOC_opcode  topexpr ',' INDEX
X			{
X		pevalexpr(1, $2);
X		genlocrec(currseg, labelloc);
X		locctr += geninstr( findgen( $1, ST_INDEX, 
X				  ( (evalr[1].seg == SSG_ABS 
X				&& evalr[1].value >= 0
X				&& evalr[1].value <= 255 )
X				? DIRECT : EXTENDED ) | cpuselect | $4 )
X				);
X			}
X	;
Xgenline : KOC_opcode  '(' topexpr ',' INDEX ')'
X			{
X		pevalexpr(1, $3);
X		genlocrec(currseg, labelloc);
X		locctr += geninstr( findgen( $1, ST_PREINDEX, 
X				  ( (evalr[1].seg == SSG_ABS 
X				&& evalr[1].value >= 0
X				&& evalr[1].value <= 255 )
X				? DIRECT : EXTENDED ) | cpuselect | $5 )
X				);
X			}
X	;
Xgenline : KOC_opcode  '(' topexpr ')'
X			{
X		pevalexpr(1, $3);
X		genlocrec(currseg, labelloc);
X		locctr += geninstr( findgen( $1, ST_INDIR, 
X				  ( (evalr[1].seg == SSG_ABS 
X				&& evalr[1].value >= 0
X				&& evalr[1].value <= 255 )
X				? DIRECT : EXTENDED ) | cpuselect )
X				);
X			}
X	;
Xgenline : KOC_opcode  '(' topexpr ')' ',' INDEX
X			{
X		pevalexpr(1, $3);
X		genlocrec(currseg, labelloc);
X		locctr += geninstr( findgen( $1, ST_POSTINDEX, 
X				  ( (evalr[1].seg == SSG_ABS 
X				&& evalr[1].value >= 0
X				&& evalr[1].value <= 255 )
X				? DIRECT : EXTENDED ) | cpuselect | $6 )
X				);
X			}
X	;
Xgenline : KOC_opcode  '#' topexpr
X			{
X		pevalexpr(1, $3);
X		genlocrec(currseg, labelloc);
X		locctr += geninstr( findgen($1, ST_IMMED, cpuselect));
X			}
X	;
Xgenline : KOC_opcode  topexpr ',' topexpr
X			{
X		pevalexpr(1, $2);
X		pevalexpr(2, $4);
X		genlocrec(currseg, labelloc);
X		locctr += geninstr( findgen($1, ST_DIRREL, cpuselect));
X			}
X	;
Xtopexpr	:	'+' expr %prec KEOP_MUN
X			{
X				$$ = $2;
X			}
X	|	'-' expr %prec KEOP_MUN
X			{
X				$$ = exprnode(PCCASE_UN,$2,IFC_NEG,0,0L,
X					SYMNULL);
X			}
X	|	KEOP_NOT expr
X			{
X				$$ = exprnode(PCCASE_UN,$2,IFC_NOT,0,0L,
X					SYMNULL);
X			}
X	|	KEOP_HIGH expr
X			{
X				$$ = exprnode(PCCASE_UN,$2,IFC_HIGH,0,0L,
X					SYMNULL);
X			}
X	|	KEOP_LOW expr
X			{
X				$$ = exprnode(PCCASE_UN,$2,IFC_LOW,0,0L,
X					SYMNULL);
X			}
X	|	expr '*' expr
X			{
X				$$ = exprnode(PCCASE_BIN,$1,IFC_MUL,$3,0L,
X					SYMNULL);
X			}
X	|	expr '/' expr
X			{
X				$$ = exprnode(PCCASE_BIN,$1,IFC_DIV,$3,0L,
X					SYMNULL);
X			}
X	|	expr '+' expr
X			{
X				$$ = exprnode(PCCASE_BIN,$1,IFC_ADD,$3,0L,
X					SYMNULL);
X			}
X	|	expr '-' expr
X			{
X				$$ = exprnode(PCCASE_BIN,$1,IFC_SUB,$3,0L,
X					SYMNULL);
X			}
X	|	expr KEOP_MOD expr
X			{
X				$$ = exprnode(PCCASE_BIN,$1,IFC_MOD,$3,0L,
X					SYMNULL);
X			}
X	|	expr KEOP_SHL expr
X			{
X				$$ = exprnode(PCCASE_BIN,$1,IFC_SHL,$3,0L,
X					SYMNULL);
X			}
X	|	expr KEOP_SHR expr
X			{
X				$$ = exprnode(PCCASE_BIN,$1,IFC_SHR,$3,0L,
X					SYMNULL);
X			}
X	|	expr KEOP_GT expr
X			{
X				$$ = exprnode(PCCASE_BIN,$1,IFC_GT,$3,0L,
X					SYMNULL);
X			}
X	|	expr KEOP_GE expr
X			{
X				$$ = exprnode(PCCASE_BIN,$1,IFC_GE,$3,0L,
X					SYMNULL);
X			}
X	|	expr KEOP_LT expr
X			{
X				$$ = exprnode(PCCASE_BIN,$1,IFC_LT,$3,0L,
X					SYMNULL);
X			}
X	|	expr KEOP_LE expr
X			{
X				$$ = exprnode(PCCASE_BIN,$1,IFC_LE,$3,0L,
X					SYMNULL);
X			}
X	|	expr KEOP_NE expr
X			{
X				$$ = exprnode(PCCASE_BIN,$1,IFC_NE,$3,0L,
X					SYMNULL);
X			}
X	|	expr KEOP_EQ expr
X			{
X				$$ = exprnode(PCCASE_BIN,$1,IFC_EQ,$3,0L,
X					SYMNULL);
X			}
X	|	expr KEOP_AND expr
X			{
X				$$ = exprnode(PCCASE_BIN,$1,IFC_AND,$3,0L,
X					SYMNULL);
X			}
X	|	expr KEOP_OR expr
X			{
X				$$ = exprnode(PCCASE_BIN,$1,IFC_OR,$3,0L,
X					SYMNULL);
X			}
X	|	expr KEOP_XOR expr
X			{
X				$$ = exprnode(PCCASE_BIN,$1,IFC_XOR,$3,0L,
X					SYMNULL);
X			}
X	|	KEOP_DEFINED SYMBOL
X			{
X				$$ = exprnode(PCCASE_DEF,0,IGP_DEFINED,0,0L,$2);
X			}
X	|	SYMBOL
X			{
X				$$ = exprnode(PCCASE_SYMB,0,IFC_SYMB,0,0L,$1);
X			}
X	|	'*'
X			{
X				$$ = exprnode(PCCASE_PROGC,0,IFC_PROGCTR,0,
X					labelloc, SYMNULL);
X			}
X	|	CONSTANT
X			{
X				$$ = exprnode(PCCASE_CONS,0,IGP_CONSTANT,0,$1,
X					SYMNULL);
X			}
X	|	STRING
X			{
X				char *sourcestr = $1;
X				long accval = 0;
X
X				if(strlen($1) > 0)
X				{
X					accval = chtran(&sourcestr);
X					if(*sourcestr != '\0')
X					{
X						accval = (accval << 8) +
X							chtran(&sourcestr);
X					}
X
X					if( *sourcestr != '\0')
X					{
X	frawarn("string constant in expression more than 2 characters long");
X					}
X				}
X				$$ = exprnode(PCCASE_CONS, 0, IGP_CONSTANT, 0,
X					accval, SYMNULL);
X			}
X	;
X
Xexpr	:	'(' topexpr ')'
X			{
X				$$ = $2;
X			}
X	|	topexpr
X	;
X
X
X
X%%
X
Xlexintercept()
X/*
X	description	intercept the call to yylex (the lexical analyzer)
X			and filter out all unnecessary tokens when skipping
X			the input between a failed IF and its matching ENDI or
X			ELSE
X	globals 	fraifskip	the enable flag
X*/
X{
X#undef yylex
X
X	int rv;
X
X	if(fraifskip)
X	{
X		for(;;)
X		{
X
X			switch(rv = yylex())
X
X			{
X			case 0:
X			case KOC_END:
X			case KOC_IF:
X			case KOC_ELSE:
X			case KOC_ENDI:
X			case EOL:
X				return rv;
X			default:
X				break;
X			}
X		}
X	}
X	else
X		return yylex();
X#define yylex lexintercept
X}
X
X
X
Xsetreserved()
X{
X
X	reservedsym("and", KEOP_AND, 0);
X	reservedsym("defined", KEOP_DEFINED,0);
X	reservedsym("eq", KEOP_EQ, 0);
X	reservedsym("ge", KEOP_GE, 0);
X	reservedsym("gt", KEOP_GT, 0);
X	reservedsym("high", KEOP_HIGH, 0);
X	reservedsym("le", KEOP_LE, 0);
X	reservedsym("low", KEOP_LOW, 0);
X	reservedsym("lt", KEOP_LT, 0);
X	reservedsym("mod", KEOP_MOD, 0);
X	reservedsym("ne", KEOP_NE, 0);
X	reservedsym("not", KEOP_NOT, 0);
X	reservedsym("or", KEOP_OR, 0);
X	reservedsym("shl", KEOP_SHL, 0);
X	reservedsym("shr", KEOP_SHR, 0);
X	reservedsym("xor", KEOP_XOR, 0);
X	reservedsym("AND", KEOP_AND, 0);
X	reservedsym("DEFINED", KEOP_DEFINED,0);
X	reservedsym("EQ", KEOP_EQ, 0);
X	reservedsym("GE", KEOP_GE, 0);
X	reservedsym("GT", KEOP_GT, 0);
X	reservedsym("HIGH", KEOP_HIGH, 0);
X	reservedsym("LE", KEOP_LE, 0);
X	reservedsym("LOW", KEOP_LOW, 0);
X	reservedsym("LT", KEOP_LT, 0);
X	reservedsym("MOD", KEOP_MOD, 0);
X	reservedsym("NE", KEOP_NE, 0);
X	reservedsym("NOT", KEOP_NOT, 0);
X	reservedsym("OR", KEOP_OR, 0);
X	reservedsym("SHL", KEOP_SHL, 0);
X	reservedsym("SHR", KEOP_SHR, 0);
X	reservedsym("XOR", KEOP_XOR, 0);
X
X	/* machine specific token definitions */
X	reservedsym("a", ACCUM, 0);
X	reservedsym("x", INDEX, INDEXX);
X	reservedsym("y", INDEX, INDEXY);
X	reservedsym("A", ACCUM, 0);
X	reservedsym("X", INDEX, INDEXX);
X	reservedsym("Y", INDEX, INDEXY);
X
X}
X
X
Xcpumatch(str)
X	char * str;
X{
X	int msub;
X
X	static struct
X	{
X		char * mtch;
X		int   cpuv;
X	} matchtab[] =
X	{
X		{"R65C", CPUR65C },
X		{"r65c", CPUR65C },
X		{"65C", CPU65C },
X		{"65c", CPU65C },
X		{"R65", CPUR65 },
X		{"r65", CPUR65 },
X		{"21", CPUR21 },
X		{"65", CPU65 },
X		{"", 0} 
X	};
X
X	for(msub = 0; matchtab[msub].mtch[0] != '\0'; msub++)
X	{
X		if(strcontains(str, matchtab[msub].mtch))
X		{
X			cpuselect = matchtab[msub].cpuv;
X			return TRUE;
X		}
X	}
X
X	return FALSE;
X}
X
X
Xstrcontains(s1, sm)
X	char * s1, *sm;
X{
X	int l1 = strlen(s1), lm = strlen(sm);
X
X	for(; l1 >= lm; l1--, s1++)
X	{
X		if(strncmp(s1, sm, lm) == 0)
X		{
X			return TRUE;
X		}
X	}
X	return FALSE;
X}
X
X/*
X	description	Opcode and Instruction generation tables
X	usage		Unix, framework crossassembler
X	history		September 25, 1987
X*/
X
X#define NUMOPCODE 124
X#define NUMSYNBLK 166
X#define NUMDIFFOP 221
X
Xint gnumopcode = NUMOPCODE;
X
Xint ophashlnk[NUMOPCODE];
X
Xstruct opsym optab[NUMOPCODE+1]
X	= {
X	{"invalid", KOC_opcode, 2, 0 },
X	{"ADC", KOC_opcode, 6, 2 },
X	{"AND", KOC_opcode, 6, 8 },
X	{"ASL", KOC_opcode, 3, 14 },
X	{"BBR0", KOC_opcode, 1, 17 },
X	{"BBR1", KOC_opcode, 1, 18 },
X	{"BBR2", KOC_opcode, 1, 19 },
X	{"BBR3", KOC_opcode, 1, 20 },
X	{"BBR4", KOC_opcode, 1, 21 },
X	{"BBR5", KOC_opcode, 1, 22 },
X	{"BBR6", KOC_opcode, 1, 23 },
X	{"BBR7", KOC_opcode, 1, 24 },
X	{"BBS0", KOC_opcode, 1, 25 },
X	{"BBS1", KOC_opcode, 1, 26 },
X	{"BBS2", KOC_opcode, 1, 27 },
X	{"BBS3", KOC_opcode, 1, 28 },
X	{"BBS4", KOC_opcode, 1, 29 },
X	{"BBS5", KOC_opcode, 1, 30 },
X	{"BBS6", KOC_opcode, 1, 31 },
X	{"BBS7", KOC_opcode, 1, 32 },
X	{"BCC", KOC_opcode, 1, 33 },
X	{"BCS", KOC_opcode, 1, 34 },
X	{"BEQ", KOC_opcode, 1, 35 },
X	{"BGE", KOC_opcode, 1, 36 },
X	{"BIT", KOC_opcode, 3, 37 },
X	{"BLT", KOC_opcode, 1, 40 },
X	{"BMI", KOC_opcode, 1, 41 },
X	{"BNE", KOC_opcode, 1, 42 },
X	{"BPL", KOC_opcode, 1, 43 },
X	{"BRA", KOC_opcode, 1, 44 },
X	{"BRK", KOC_opcode, 2, 45 },
X	{"BVC", KOC_opcode, 1, 47 },
X	{"BVS", KOC_opcode, 1, 48 },
X	{"BYTE", KOC_BDEF, 0, 0 },
X	{"CHARDEF", KOC_CHDEF, 0, 0 },
X	{"CHARSET", KOC_CHSET, 0, 0 },
X	{"CHARUSE", KOC_CHUSE, 0, 0 },
X	{"CHD", KOC_CHDEF, 0, 0 },
X	{"CLC", KOC_opcode, 1, 49 },
X	{"CLD", KOC_opcode, 1, 50 },
X	{"CLI", KOC_opcode, 1, 51 },
X	{"CLV", KOC_opcode, 1, 52 },
X	{"CMP", KOC_opcode, 6, 53 },
X	{"CPU", KOC_CPU, 0, 0 },
X	{"CPX", KOC_opcode, 2, 59 },
X	{"CPY", KOC_opcode, 2, 61 },
X	{"DB", KOC_BDEF, 0, 0 },
X	{"DEC", KOC_opcode, 3, 63 },
X	{"DEX", KOC_opcode, 1, 66 },
X	{"DEY", KOC_opcode, 1, 67 },
X	{"DW", KOC_WDEF, 0, 0 },
X	{"ELSE", KOC_ELSE, 0, 0 },
X	{"END", KOC_END, 0, 0 },
X	{"ENDI", KOC_ENDI, 0, 0 },
X	{"EOR", KOC_opcode, 6, 68 },
X	{"EQU", KOC_EQU, 0, 0 },
X	{"FCB", KOC_BDEF, 0, 0 },
X	{"FCC", KOC_SDEF, 0, 0 },
X	{"FDB", KOC_WDEF, 0, 0 },
X	{"IF", KOC_IF, 0, 0 },
X	{"INC", KOC_opcode, 3, 74 },
X	{"INCL", KOC_INCLUDE, 0, 0 },
X	{"INCLUDE", KOC_INCLUDE, 0, 0 },
X	{"INX", KOC_opcode, 1, 77 },
X	{"INY", KOC_opcode, 1, 78 },
X	{"JMP", KOC_opcode, 3, 79 },
X	{"JSR", KOC_opcode, 1, 82 },
X	{"LDA", KOC_opcode, 6, 83 },
X	{"LDX", KOC_opcode, 3, 89 },
X	{"LDY", KOC_opcode, 3, 92 },
X	{"LSR", KOC_opcode, 3, 95 },
X	{"MUL", KOC_opcode, 1, 98 },
X	{"NOP", KOC_opcode, 1, 99 },
X	{"ORA", KOC_opcode, 6, 100 },
X	{"ORG", KOC_ORG, 0, 0 },
X	{"PHA", KOC_opcode, 1, 106 },
X	{"PHP", KOC_opcode, 1, 107 },
X	{"PHX", KOC_opcode, 1, 108 },
X	{"PHY", KOC_opcode, 1, 109 },
X	{"PLA", KOC_opcode, 1, 110 },
X	{"PLP", KOC_opcode, 1, 111 },
X	{"PLX", KOC_opcode, 1, 112 },
X	{"PLY", KOC_opcode, 1, 113 },
X	{"RESERVE", KOC_RESM, 0, 0 },
X	{"RMB0", KOC_opcode, 1, 114 },
X	{"RMB1", KOC_opcode, 1, 115 },
X	{"RMB2", KOC_opcode, 1, 116 },
X	{"RMB3", KOC_opcode, 1, 117 },
X	{"RMB4", KOC_opcode, 1, 118 },
X	{"RMB5", KOC_opcode, 1, 119 },
X	{"RMB6", KOC_opcode, 1, 120 },
X	{"RMB7", KOC_opcode, 1, 121 },
X	{"RMB", KOC_RESM, 0, 0 },
X	{"ROL", KOC_opcode, 3, 122 },
X	{"ROR", KOC_opcode, 3, 125 },
X	{"RTI", KOC_opcode, 1, 128 },
X	{"RTS", KOC_opcode, 1, 129 },
X	{"SBC", KOC_opcode, 6, 130 },
X	{"SEC", KOC_opcode, 1, 136 },
X	{"SED", KOC_opcode, 1, 137 },
X	{"SEI", KOC_opcode, 1, 138 },
X	{"SET", KOC_SET, 0, 0 },
X	{"SMB0", KOC_opcode, 1, 139 },
X	{"SMB1", KOC_opcode, 1, 140 },
X	{"SMB2", KOC_opcode, 1, 141 },
X	{"SMB3", KOC_opcode, 1, 142 },
X	{"SMB4", KOC_opcode, 1, 143 },
X	{"SMB5", KOC_opcode, 1, 144 },
X	{"SMB6", KOC_opcode, 1, 145 },
X	{"SMB7", KOC_opcode, 1, 146 },
X	{"STA", KOC_opcode, 5, 147 },
X	{"STRING", KOC_SDEF, 0, 0 },
X	{"STX", KOC_opcode, 2, 152 },
X	{"STY", KOC_opcode, 2, 154 },
X	{"STZ", KOC_opcode, 2, 156 },
X	{"TAX", KOC_opcode, 1, 158 },
X	{"TAY", KOC_opcode, 1, 159 },
X	{"TRB", KOC_opcode, 1, 160 },
X	{"TSB", KOC_opcode, 1, 161 },
X	{"TSX", KOC_opcode, 1, 162 },
X	{"TXA", KOC_opcode, 1, 163 },
X	{"TXS", KOC_opcode, 1, 164 },
X	{"TYA", KOC_opcode, 1, 165 },
X	{"WORD", KOC_WDEF, 0, 0 },
X	{ "", 0, 0, 0 }};
X
Xstruct opsynt ostab[NUMSYNBLK+1]
X	= {
X/* invalid 0 */ { 0, 1, 0 },
X/* invalid 1 */ { 0xffff, 1, 1 },
X/* ADC 2 */ { ST_EXPR, 2, 2 },
X/* ADC 3 */ { ST_IMMED, 1, 4 },
X/* ADC 4 */ { ST_INDEX, 3, 5 },
X/* ADC 5 */ { ST_INDIR, 1, 8 },
X/* ADC 6 */ { ST_POSTINDEX, 1, 9 },
X/* ADC 7 */ { ST_PREINDEX, 1, 10 },
X/* AND 8 */ { ST_EXPR, 2, 11 },
X/* AND 9 */ { ST_IMMED, 1, 13 },
X/* AND 10 */ { ST_INDEX, 3, 14 },
X/* AND 11 */ { ST_INDIR, 1, 17 },
X/* AND 12 */ { ST_POSTINDEX, 1, 18 },
X/* AND 13 */ { ST_PREINDEX, 1, 19 },
X/* ASL 14 */ { ST_ACCUM, 1, 20 },
X/* ASL 15 */ { ST_EXPR, 2, 21 },
X/* ASL 16 */ { ST_INDEX, 2, 23 },
X/* BBR0 17 */ { ST_DIRREL, 1, 25 },
X/* BBR1 18 */ { ST_DIRREL, 1, 26 },
X/* BBR2 19 */ { ST_DIRREL, 1, 27 },
X/* BBR3 20 */ { ST_DIRREL, 1, 28 },
X/* BBR4 21 */ { ST_DIRREL, 1, 29 },
X/* BBR5 22 */ { ST_DIRREL, 1, 30 },
X/* BBR6 23 */ { ST_DIRREL, 1, 31 },
X/* BBR7 24 */ { ST_DIRREL, 1, 32 },
X/* BBS0 25 */ { ST_DIRREL, 1, 33 },
X/* BBS1 26 */ { ST_DIRREL, 1, 34 },
X/* BBS2 27 */ { ST_DIRREL, 1, 35 },
X/* BBS3 28 */ { ST_DIRREL, 1, 36 },
X/* BBS4 29 */ { ST_DIRREL, 1, 37 },
X/* BBS5 30 */ { ST_DIRREL, 1, 38 },
X/* BBS6 31 */ { ST_DIRREL, 1, 39 },
X/* BBS7 32 */ { ST_DIRREL, 1, 40 },
X/* BCC 33 */ { ST_EXPR, 1, 41 },
X/* BCS 34 */ { ST_EXPR, 1, 42 },
X/* BEQ 35 */ { ST_EXPR, 1, 43 },
X/* BGE 36 */ { ST_EXPR, 1, 44 },
X/* BIT 37 */ { ST_EXPR, 2, 45 },
X/* BIT 38 */ { ST_IMMED, 1, 47 },
X/* BIT 39 */ { ST_INDEX, 2, 48 },
X/* BLT 40 */ { ST_EXPR, 1, 50 },
X/* BMI 41 */ { ST_EXPR, 1, 51 },
X/* BNE 42 */ { ST_EXPR, 1, 52 },
X/* BPL 43 */ { ST_EXPR, 1, 53 },
X/* BRA 44 */ { ST_EXPR, 2, 54 },
X/* BRK 45 */ { ST_IMMED, 1, 56 },
X/* BRK 46 */ { ST_INH, 1, 57 },
X/* BVC 47 */ { ST_EXPR, 1, 58 },
X/* BVS 48 */ { ST_EXPR, 1, 59 },
X/* CLC 49 */ { ST_INH, 1, 60 },
X/* CLD 50 */ { ST_INH, 1, 61 },
X/* CLI 51 */ { ST_INH, 1, 62 },
X/* CLV 52 */ { ST_INH, 1, 63 },
X/* CMP 53 */ { ST_EXPR, 2, 64 },
X/* CMP 54 */ { ST_IMMED, 1, 66 },
X/* CMP 55 */ { ST_INDEX, 3, 67 },
X/* CMP 56 */ { ST_INDIR, 1, 70 },
X/* CMP 57 */ { ST_POSTINDEX, 1, 71 },
X/* CMP 58 */ { ST_PREINDEX, 1, 72 },
X/* CPX 59 */ { ST_EXPR, 2, 73 },
X/* CPX 60 */ { ST_IMMED, 1, 75 },
X/* CPY 61 */ { ST_EXPR, 2, 76 },
X/* CPY 62 */ { ST_IMMED, 1, 78 },
X/* DEC 63 */ { ST_ACCUM, 1, 79 },
X/* DEC 64 */ { ST_EXPR, 2, 80 },
X/* DEC 65 */ { ST_INDEX, 2, 82 },
X/* DEX 66 */ { ST_INH, 1, 84 },
X/* DEY 67 */ { ST_INH, 1, 85 },
X/* EOR 68 */ { ST_EXPR, 2, 86 },
X/* EOR 69 */ { ST_IMMED, 1, 88 },
X/* EOR 70 */ { ST_INDEX, 3, 89 },
X/* EOR 71 */ { ST_INDIR, 1, 92 },
X/* EOR 72 */ { ST_POSTINDEX, 1, 93 },
X/* EOR 73 */ { ST_PREINDEX, 1, 94 },
X/* INC 74 */ { ST_ACCUM, 1, 95 },
X/* INC 75 */ { ST_EXPR, 2, 96 },
X/* INC 76 */ { ST_INDEX, 2, 98 },
X/* INX 77 */ { ST_INH, 1, 100 },
X/* INY 78 */ { ST_INH, 1, 101 },
X/* JMP 79 */ { ST_EXPR, 1, 102 },
X/* JMP 80 */ { ST_INDIR, 1, 103 },
X/* JMP 81 */ { ST_PREINDEX, 1, 104 },
X/* JSR 82 */ { ST_EXPR, 1, 105 },
X/* LDA 83 */ { ST_EXPR, 2, 106 },
X/* LDA 84 */ { ST_IMMED, 1, 108 },
X/* LDA 85 */ { ST_INDEX, 3, 109 },
X/* LDA 86 */ { ST_INDIR, 1, 112 },
X/* LDA 87 */ { ST_POSTINDEX, 1, 113 },
X/* LDA 88 */ { ST_PREINDEX, 1, 114 },
X/* LDX 89 */ { ST_EXPR, 2, 115 },
X/* LDX 90 */ { ST_IMMED, 1, 117 },
X/* LDX 91 */ { ST_INDEX, 2, 118 },
X/* LDY 92 */ { ST_EXPR, 2, 120 },
X/* LDY 93 */ { ST_IMMED, 1, 122 },
X/* LDY 94 */ { ST_INDEX, 2, 123 },
X/* LSR 95 */ { ST_ACCUM, 1, 125 },
X/* LSR 96 */ { ST_EXPR, 2, 126 },
X/* LSR 97 */ { ST_INDEX, 2, 128 },
X/* MUL 98 */ { ST_INH, 1, 130 },
X/* NOP 99 */ { ST_INH, 1, 131 },
X/* ORA 100 */ { ST_EXPR, 2, 132 },
X/* ORA 101 */ { ST_IMMED, 1, 134 },
X/* ORA 102 */ { ST_INDEX, 3, 135 },
X/* ORA 103 */ { ST_INDIR, 1, 138 },
X/* ORA 104 */ { ST_POSTINDEX, 1, 139 },
X/* ORA 105 */ { ST_PREINDEX, 1, 140 },
X/* PHA 106 */ { ST_INH, 1, 141 },
X/* PHP 107 */ { ST_INH, 1, 142 },
X/* PHX 108 */ { ST_INH, 2, 143 },
X/* PHY 109 */ { ST_INH, 2, 145 },
X/* PLA 110 */ { ST_INH, 1, 147 },
X/* PLP 111 */ { ST_INH, 1, 148 },
X/* PLX 112 */ { ST_INH, 2, 149 },
X/* PLY 113 */ { ST_INH, 2, 151 },
X/* RMB0 114 */ { ST_EXPR, 1, 153 },
X/* RMB1 115 */ { ST_EXPR, 1, 154 },
X/* RMB2 116 */ { ST_EXPR, 1, 155 },
X/* RMB3 117 */ { ST_EXPR, 1, 156 },
X/* RMB4 118 */ { ST_EXPR, 1, 157 },
X/* RMB5 119 */ { ST_EXPR, 1, 158 },
X/* RMB6 120 */ { ST_EXPR, 1, 159 },
X/* RMB7 121 */ { ST_EXPR, 1, 160 },
X/* ROL 122 */ { ST_ACCUM, 1, 161 },
X/* ROL 123 */ { ST_EXPR, 2, 162 },
X/* ROL 124 */ { ST_INDEX, 2, 164 },
X/* ROR 125 */ { ST_ACCUM, 1, 166 },
X/* ROR 126 */ { ST_EXPR, 2, 167 },
X/* ROR 127 */ { ST_INDEX, 2, 169 },
X/* RTI 128 */ { ST_INH, 1, 171 },
X/* RTS 129 */ { ST_INH, 1, 172 },
X/* SBC 130 */ { ST_EXPR, 2, 173 },
X/* SBC 131 */ { ST_IMMED, 1, 175 },
X/* SBC 132 */ { ST_INDEX, 3, 176 },
X/* SBC 133 */ { ST_INDIR, 1, 179 },
X/* SBC 134 */ { ST_POSTINDEX, 1, 180 },
X/* SBC 135 */ { ST_PREINDEX, 1, 181 },
X/* SEC 136 */ { ST_INH, 1, 182 },
X/* SED 137 */ { ST_INH, 1, 183 },
X/* SEI 138 */ { ST_INH, 1, 184 },
X/* SMB0 139 */ { ST_EXPR, 1, 185 },
X/* SMB1 140 */ { ST_EXPR, 1, 186 },
X/* SMB2 141 */ { ST_EXPR, 1, 187 },
X/* SMB3 142 */ { ST_EXPR, 1, 188 },
X/* SMB4 143 */ { ST_EXPR, 1, 189 },
X/* SMB5 144 */ { ST_EXPR, 1, 190 },
X/* SMB6 145 */ { ST_EXPR, 1, 191 },
X/* SMB7 146 */ { ST_EXPR, 1, 192 },
X/* STA 147 */ { ST_EXPR, 2, 193 },
X/* STA 148 */ { ST_INDEX, 3, 195 },
X/* STA 149 */ { ST_INDIR, 1, 198 },
X/* STA 150 */ { ST_POSTINDEX, 1, 199 },
X/* STA 151 */ { ST_PREINDEX, 1, 200 },
X/* STX 152 */ { ST_EXPR, 2, 201 },
X/* STX 153 */ { ST_INDEX, 1, 203 },
X/* STY 154 */ { ST_EXPR, 2, 204 },
X/* STY 155 */ { ST_INDEX, 1, 206 },
X/* STZ 156 */ { ST_EXPR, 2, 207 },
X/* STZ 157 */ { ST_INDEX, 2, 209 },
X/* TAX 158 */ { ST_INH, 1, 211 },
X/* TAY 159 */ { ST_INH, 1, 212 },
X/* TRB 160 */ { ST_EXPR, 2, 213 },
X/* TSB 161 */ { ST_EXPR, 2, 215 },
X/* TSX 162 */ { ST_INH, 1, 217 },
X/* TXA 163 */ { ST_INH, 1, 218 },
X/* TXS 164 */ { ST_INH, 1, 219 },
X/* TYA 165 */ { ST_INH, 1, 220 },
X	{ 0, 0, 0 } };
X
Xstruct igel igtab[NUMDIFFOP+1]
X	= {
X/* invalid 0 */   { 0 , 0, 
X		"[Xnullentry" },
X/* invalid 1 */   { 0 , 0, 
X		"[Xinvalid opcode" },
X/* ADC 2 */   { ADDRESS , DIRECT, 
X		"65;[1=];" },
X/* ADC 3 */   { ADDRESS , EXTENDED, 
X		"6d;[1=]y" },
X/* ADC 4 */   { 0 , 0, 
X		"69;[1=];" },
X/* ADC 5 */   { ADDRESS|INDEXMASK , DIRECT|INDEXX, 
X		"75;[1=];" },
X/* ADC 6 */   { ADDRESS|INDEXMASK , EXTENDED|INDEXX, 
X		"7d;[1=]y" },
X/* ADC 7 */   { INDEXMASK , INDEXY, 
X		"79;[1=]y" },
X/* ADC 8 */   { INSTCMOS|ADDRESS , DIRECT|INSTCMOS, 
X		"72;[1=];" },
X/* ADC 9 */   { ADDRESS|INDEXMASK , DIRECT|INDEXY, 
X		"71;[1=];" },
X/* ADC 10 */   { ADDRESS|INDEXMASK , DIRECT|INDEXX, 
X		"61;[1=];" },
X/* AND 11 */   { ADDRESS , DIRECT, 
X		"25;[1=];" },
X/* AND 12 */   { ADDRESS , EXTENDED, 
X		"2d;[1=]y" },
X/* AND 13 */   { 0 , 0, 
X		"29;[1=];" },
X/* AND 14 */   { ADDRESS|INDEXMASK , DIRECT|INDEXX, 
X		"35;[1=];" },
X/* AND 15 */   { ADDRESS|INDEXMASK , EXTENDED|INDEXX, 
X		"3d;[1=]y" },
X/* AND 16 */   { INDEXMASK , INDEXY, 
X		"39;[1=]y" },
X/* AND 17 */   { INSTCMOS|ADDRESS , DIRECT|INSTCMOS, 
X		"32;[1=];" },
X/* AND 18 */   { ADDRESS|INDEXMASK , DIRECT|INDEXY, 
X		"31;[1=];" },
X/* AND 19 */   { ADDRESS|INDEXMASK , DIRECT|INDEXX, 
X		"21;[1=];" },
X/* ASL 20 */   { 0 , 0, 
X		"0a;" },
X/* ASL 21 */   { ADDRESS , DIRECT, 
X		"06;[1=];" },
X/* ASL 22 */   { ADDRESS , EXTENDED, 
X		"0e;[1=]y" },
X/* ASL 23 */   { ADDRESS|INDEXMASK , DIRECT|INDEXX, 
X		"16;[1=];" },
X/* ASL 24 */   { ADDRESS|INDEXMASK , EXTENDED|INDEXX, 
X		"1e;[1=]y" },
X/* BBR0 25 */   { INSTROCKWELL , INSTROCKWELL, 
X		"0f;[1=];[2=].Q.1+-r" },
X/* BBR1 26 */   { INSTROCKWELL , INSTROCKWELL, 
X		"1f;[1=];[2=].Q.1+-r" },
X/* BBR2 27 */   { INSTROCKWELL , INSTROCKWELL, 
X		"2f;[1=];[2=].Q.1+-r" },
X/* BBR3 28 */   { INSTROCKWELL , INSTROCKWELL, 
X		"3f;[1=];[2=].Q.1+-r" },
X/* BBR4 29 */   { INSTROCKWELL , INSTROCKWELL, 
X		"4f;[1=];[2=].Q.1+-r" },
X/* BBR5 30 */   { INSTROCKWELL , INSTROCKWELL, 
X		"5f;[1=];[2=].Q.1+-r" },
X/* BBR6 31 */   { INSTROCKWELL , INSTROCKWELL, 
X		"6f;[1=];[2=].Q.1+-r" },
X/* BBR7 32 */   { INSTROCKWELL , INSTROCKWELL, 
X		"7f;[1=];[2=].Q.1+-r" },
X/* BBS0 33 */   { INSTROCKWELL , INSTROCKWELL, 
X		"8f;[1=];[2=].Q.1+-r" },
X/* BBS1 34 */   { INSTROCKWELL , INSTROCKWELL, 
X		"9f;[1=];[2=].Q.1+-r" },
X/* BBS2 35 */   { INSTROCKWELL , INSTROCKWELL, 
X		"af;[1=];[2=].Q.1+-r" },
X/* BBS3 36 */   { INSTROCKWELL , INSTROCKWELL, 
X		"bf;[1=];[2=].Q.1+-r" },
X/* BBS4 37 */   { INSTROCKWELL , INSTROCKWELL, 
X		"cf;[1=];[2=].Q.1+-r" },
X/* BBS5 38 */   { INSTROCKWELL , INSTROCKWELL, 
X		"df;[1=];[2=].Q.1+-r" },
X/* BBS6 39 */   { INSTROCKWELL , INSTROCKWELL, 
X		"ef;[1=];[2=].Q.1+-r" },
X/* BBS7 40 */   { INSTROCKWELL , INSTROCKWELL, 
X		"ff;[1=];[2=].Q.1+-r" },
X/* BCC 41 */   { 0 , 0, 
X		"90;[1=].Q.1+-r" },
X/* BCS 42 */   { 0 , 0, 
X		"b0;[1=].Q.1+-r" },
X/* BEQ 43 */   { 0 , 0, 
X		"f0;[1=].Q.1+-r" },
X/* BGE 44 */   { 0 , 0, 
X		"b0;[1=].Q.1+-r" },
X/* BIT 45 */   { ADDRESS , DIRECT, 
X		"24;[1=];" },
X/* BIT 46 */   { ADDRESS , EXTENDED, 
X		"2c;[1=]y" },
X/* BIT 47 */   { INSTCMOS , INSTCMOS, 
X		"89;[1=];" },
X/* BIT 48 */   { ADDRESS|INDEXMASK|INSTCMOS , DIRECT|INDEXX|INSTCMOS, 
X		"34;[1=];" },
X/* BIT 49 */   { ADDRESS|INDEXMASK|INSTCMOS , EXTENDED|INDEXX|INSTCMOS, 
X		"3c;[1=]y" },
X/* BLT 50 */   { 0 , 0, 
X		"90;[1=].Q.1+-r" },
X/* BMI 51 */   { 0 , 0, 
X		"30;[1=].Q.1+-r" },
X/* BNE 52 */   { 0 , 0, 
X		"d0;[1=].Q.1+-r" },
X/* BPL 53 */   { 0 , 0, 
X		"10;[1=].Q.1+-r" },
X/* BRA 54 */   { INST21 , INST21, 
X		"80;[1=].Q.1+-r" },
X/* BRA 55 */   { INSTCMOS , INSTCMOS, 
X		"80;[1=].Q.1+-r" },
X/* BRK 56 */   { 0 , 0, 
X		"00;[1=];" },
X/* BRK 57 */   { 0 , 0, 
X		"00;" },
X/* BVC 58 */   { 0 , 0, 
X		"50;[1=].Q.1+-r" },
X/* BVS 59 */   { 0 , 0, 
X		"70;[1=].Q.1+-r" },
X/* CLC 60 */   { 0 , 0, 
X		"18;" },
X/* CLD 61 */   { 0 , 0, 
X		"d8;" },
X/* CLI 62 */   { 0 , 0, 
X		"58;" },
X/* CLV 63 */   { 0 , 0, 
X		"b8;" },
X/* CMP 64 */   { ADDRESS , DIRECT, 
X		"c5;[1=];" },
X/* CMP 65 */   { ADDRESS , EXTENDED, 
X		"cd;[1=]y" },
X/* CMP 66 */   { 0 , 0, 
X		"c9;[1=];" },
X/* CMP 67 */   { ADDRESS|INDEXMASK , DIRECT|INDEXX, 
X		"d5;[1=];" },
X/* CMP 68 */   { ADDRESS|INDEXMASK , EXTENDED|INDEXX, 
X		"dd;[1=]y" },
X/* CMP 69 */   { INDEXMASK , INDEXY, 
X		"d9;[1=]y" },
X/* CMP 70 */   { INSTCMOS|ADDRESS , DIRECT|INSTCMOS, 
X		"d2;[1=];" },
X/* CMP 71 */   { ADDRESS|INDEXMASK , DIRECT|INDEXY, 
X		"d1;[1=];" },
X/* CMP 72 */   { ADDRESS|INDEXMASK , DIRECT|INDEXX, 
X		"c1;[1=];" },
X/* CPX 73 */   { ADDRESS , DIRECT, 
X		"e4;[1=];" },
X/* CPX 74 */   { ADDRESS , EXTENDED, 
X		"ec;[1=]y" },
X/* CPX 75 */   { 0 , 0, 
X		"e0;[1=];" },
X/* CPY 76 */   { ADDRESS , DIRECT, 
X		"c4;[1=];" },
X/* CPY 77 */   { ADDRESS , EXTENDED, 
X		"cc;[1=]y" },
X/* CPY 78 */   { 0 , 0, 
X		"c0;[1=];" },
X/* DEC 79 */   { INSTCMOS , INSTCMOS, 
X		"3a;" },
X/* DEC 80 */   { ADDRESS , DIRECT, 
X		"c6;[1=];" },
X/* DEC 81 */   { ADDRESS , EXTENDED, 
X		"ce;[1=]y" },
X/* DEC 82 */   { ADDRESS|INDEXMASK , DIRECT|INDEXX, 
X		"d6;[1=];" },
X/* DEC 83 */   { ADDRESS|INDEXMASK , EXTENDED|INDEXX, 
X		"de;[1=]y" },
X/* DEX 84 */   { 0 , 0, 
X		"ca;" },
X/* DEY 85 */   { 0 , 0, 
X		"88;" },
X/* EOR 86 */   { ADDRESS , DIRECT, 
X		"45;[1=];" },
X/* EOR 87 */   { ADDRESS , EXTENDED, 
X		"4d;[1=]y" },
X/* EOR 88 */   { 0 , 0, 
X		"49;[1=];" },
X/* EOR 89 */   { ADDRESS|INDEXMASK , DIRECT|INDEXX, 
X		"55;[1=];" },
X/* EOR 90 */   { ADDRESS|INDEXMASK , EXTENDED|INDEXX, 
X		"5d;[1=]y" },
X/* EOR 91 */   { INDEXMASK , INDEXY, 
X		"59;[1=]y" },
X/* EOR 92 */   { INSTCMOS|ADDRESS , DIRECT|INSTCMOS, 
X		"52;[1=];" },
X/* EOR 93 */   { ADDRESS|INDEXMASK , DIRECT|INDEXY, 
X		"51;[1=];" },
X/* EOR 94 */   { ADDRESS|INDEXMASK , DIRECT|INDEXX, 
X		"41;[1=];" },
X/* INC 95 */   { INSTCMOS , INSTCMOS, 
X		"1a;" },
X/* INC 96 */   { ADDRESS , DIRECT, 
X		"e6;[1=];" },
X/* INC 97 */   { ADDRESS , EXTENDED, 
X		"ee;[1=]y" },
X/* INC 98 */   { ADDRESS|INDEXMASK , DIRECT|INDEXX, 
X		"f6;[1=];" },
X/* INC 99 */   { ADDRESS|INDEXMASK , EXTENDED|INDEXX, 
X		"fe;[1=]y" },
X/* INX 100 */   { 0 , 0, 
X		"e8;" },
X/* INY 101 */   { 0 , 0, 
X		"c8;" },
X/* JMP 102 */   { 0 , 0, 
X		"4c;[1=]y" },
X/* JMP 103 */   { 0 , 0, 
X		"6c;[1=]y" },
X/* JMP 104 */   { INSTCMOS|INDEXMASK , INSTCMOS|INDEXX, 
X		"7c;[1=]y" },
X/* JSR 105 */   { 0 , 0, 
X		"20;[1=]y" },
X/* LDA 106 */   { ADDRESS , DIRECT, 
X		"a5;[1=];" },
X/* LDA 107 */   { ADDRESS , EXTENDED, 
X		"ad;[1=]y" },
X/* LDA 108 */   { 0 , 0, 
X		"a9;[1=];" },
X/* LDA 109 */   { ADDRESS|INDEXMASK , DIRECT|INDEXX, 
X		"b5;[1=];" },
X/* LDA 110 */   { ADDRESS|INDEXMASK , EXTENDED|INDEXX, 
X		"bd;[1=]y" },
X/* LDA 111 */   { INDEXMASK , INDEXY, 
X		"b9;[1=]y" },
X/* LDA 112 */   { INSTCMOS|ADDRESS , DIRECT|INSTCMOS, 
X		"b2;[1=];" },
X/* LDA 113 */   { ADDRESS|INDEXMASK , DIRECT|INDEXY, 
X		"b1;[1=];" },
X/* LDA 114 */   { ADDRESS|INDEXMASK , DIRECT|INDEXX, 
X		"a1;[1=];" },
X/* LDX 115 */   { ADDRESS , DIRECT, 
X		"a6;[1=];" },
X/* LDX 116 */   { ADDRESS , EXTENDED, 
X		"ae;[1=]y" },
X/* LDX 117 */   { 0 , 0, 
X		"a2;[1=];" },
X/* LDX 118 */   { ADDRESS|INDEXMASK , DIRECT|INDEXY, 
X		"b6;[1=];" },
X/* LDX 119 */   { ADDRESS|INDEXMASK , EXTENDED|INDEXY, 
X		"be;[1=]y" },
X/* LDY 120 */   { ADDRESS , DIRECT, 
X		"a4;[1=];" },
X/* LDY 121 */   { ADDRESS , EXTENDED, 
X		"ac;[1=]y" },
X/* LDY 122 */   { 0 , 0, 
X		"a0;[1=];" },
X/* LDY 123 */   { ADDRESS|INDEXMASK , DIRECT|INDEXX, 
X		"b4;[1=];" },
X/* LDY 124 */   { ADDRESS|INDEXMASK , EXTENDED|INDEXX, 
X		"bc;[1=]y" },
X/* LSR 125 */   { 0 , 0, 
X		"4a;" },
X/* LSR 126 */   { ADDRESS , DIRECT, 
X		"46;[1=];" },
X/* LSR 127 */   { ADDRESS , EXTENDED, 
X		"4e;[1=]y" },
X/* LSR 128 */   { ADDRESS|INDEXMASK , DIRECT|INDEXX, 
X		"56;[1=];" },
X/* LSR 129 */   { ADDRESS|INDEXMASK , EXTENDED|INDEXX, 
X		"5e;[1=]y" },
X/* MUL 130 */   { INST21 , INST21, 
X		"02;" },
X/* NOP 131 */   { 0 , 0, 
X		"ea;" },
X/* ORA 132 */   { ADDRESS , DIRECT, 
X		"05;[1=];" },
X/* ORA 133 */   { ADDRESS , EXTENDED, 
X		"0d;[1=]y" },
X/* ORA 134 */   { 0 , 0, 
X		"09;[1=];" },
X/* ORA 135 */   { ADDRESS|INDEXMASK , DIRECT|INDEXX, 
X		"15;[1=];" },
X/* ORA 136 */   { ADDRESS|INDEXMASK , EXTENDED|INDEXX, 
X		"1d;[1=]y" },
X/* ORA 137 */   { INDEXMASK , INDEXY, 
X		"19;[1=]y" },
X/* ORA 138 */   { INSTCMOS|ADDRESS , DIRECT|INSTCMOS, 
X		"12;[1=];" },
X/* ORA 139 */   { ADDRESS|INDEXMASK , DIRECT|INDEXY, 
X		"11;[1=];" },
X/* ORA 140 */   { ADDRESS|INDEXMASK , DIRECT|INDEXX, 
X		"01;[1=];" },
X/* PHA 141 */   { 0 , 0, 
X		"48;" },
X/* PHP 142 */   { 0 , 0, 
X		"08;" },
X/* PHX 143 */   { INSTCMOS , INSTCMOS, 
X		"da;" },
X/* PHX 144 */   { INST21 , INST21, 
X		"da;" },
X/* PHY 145 */   { INSTCMOS , INSTCMOS, 
X		"5a;" },
X/* PHY 146 */   { INST21 , INST21, 
X		"5a;" },
X/* PLA 147 */   { 0 , 0, 
X		"68;" },
X/* PLP 148 */   { 0 , 0, 
X		"28;" },
X/* PLX 149 */   { INSTCMOS , INSTCMOS, 
X		"fa;" },
X/* PLX 150 */   { INST21 , INST21, 
X		"fa;" },
X/* PLY 151 */   { INSTCMOS , INSTCMOS, 
X		"7a;" },
X/* PLY 152 */   { INST21 , INST21, 
X		"7a;" },
X/* RMB0 153 */   { INSTROCKWELL , INSTROCKWELL, 
X		"07;[1=];" },
X/* RMB1 154 */   { INSTROCKWELL , INSTROCKWELL, 
X		"17;[1=];" },
X/* RMB2 155 */   { INSTROCKWELL , INSTROCKWELL, 
X		"27;[1=];" },
X/* RMB3 156 */   { INSTROCKWELL , INSTROCKWELL, 
X		"37;[1=];" },
X/* RMB4 157 */   { INSTROCKWELL , INSTROCKWELL, 
X		"47;[1=];" },
X/* RMB5 158 */   { INSTROCKWELL , INSTROCKWELL, 
X		"57;[1=];" },
X/* RMB6 159 */   { INSTROCKWELL , INSTROCKWELL, 
X		"67;[1=];" },
X/* RMB7 160 */   { INSTROCKWELL , INSTROCKWELL, 
X		"77;[1=];" },
X/* ROL 161 */   { 0 , 0, 
X		"2a;" },
X/* ROL 162 */   { ADDRESS , DIRECT, 
X		"26;[1=];" },
X/* ROL 163 */   { ADDRESS , EXTENDED, 
X		"2e;[1=]y" },
X/* ROL 164 */   { ADDRESS|INDEXMASK , DIRECT|INDEXX, 
X		"36;[1=];" },
X/* ROL 165 */   { ADDRESS|INDEXMASK , EXTENDED|INDEXX, 
X		"3e;[1=]y" },
X/* ROR 166 */   { 0 , 0, 
X		"6a;" },
X/* ROR 167 */   { ADDRESS , DIRECT, 
X		"66;[1=];" },
X/* ROR 168 */   { ADDRESS , EXTENDED, 
X		"6e;[1=]y" },
X/* ROR 169 */   { ADDRESS|INDEXMASK , DIRECT|INDEXX, 
X		"76;[1=];" },
X/* ROR 170 */   { ADDRESS|INDEXMASK , EXTENDED|INDEXX, 
X		"7e;[1=]y" },
X/* RTI 171 */   { 0 , 0, 
X		"40;" },
X/* RTS 172 */   { 0 , 0, 
X		"60;" },
X/* SBC 173 */   { ADDRESS , DIRECT, 
X		"e5;[1=];" },
X/* SBC 174 */   { ADDRESS , EXTENDED, 
X		"ed;[1=]y" },
X/* SBC 175 */   { 0 , 0, 
X		"e9;[1=];" },
X/* SBC 176 */   { ADDRESS|INDEXMASK , DIRECT|INDEXX, 
X		"f5;[1=];" },
X/* SBC 177 */   { ADDRESS|INDEXMASK , EXTENDED|INDEXX, 
X		"fd;[1=]y" },
X/* SBC 178 */   { INDEXMASK , INDEXY, 
X		"f9;[1=]y" },
X/* SBC 179 */   { INSTCMOS|ADDRESS , DIRECT|INSTCMOS, 
X		"f2;[1=];" },
X/* SBC 180 */   { ADDRESS|INDEXMASK , DIRECT|INDEXY, 
X		"f1;[1=];" },
X/* SBC 181 */   { ADDRESS|INDEXMASK , DIRECT|INDEXX, 
X		"e1;[1=];" },
X/* SEC 182 */   { 0 , 0, 
X		"38;" },
X/* SED 183 */   { 0 , 0, 
X		"f8;" },
X/* SEI 184 */   { 0 , 0, 
X		"78;" },
X/* SMB0 185 */   { INSTROCKWELL , INSTROCKWELL, 
X		"87;[1=];" },
X/* SMB1 186 */   { INSTROCKWELL , INSTROCKWELL, 
X		"97;[1=];" },
X/* SMB2 187 */   { INSTROCKWELL , INSTROCKWELL, 
X		"a7;[1=];" },
X/* SMB3 188 */   { INSTROCKWELL , INSTROCKWELL, 
X		"b7;[1=];" },
X/* SMB4 189 */   { INSTROCKWELL , INSTROCKWELL, 
X		"c7;[1=];" },
X/* SMB5 190 */   { INSTROCKWELL , INSTROCKWELL, 
X		"d7;[1=];" },
X/* SMB6 191 */   { INSTROCKWELL , INSTROCKWELL, 
X		"e7;[1=];" },
X/* SMB7 192 */   { INSTROCKWELL , INSTROCKWELL, 
X		"f7;[1=];" },
X/* STA 193 */   { ADDRESS , DIRECT, 
X		"85;[1=];" },
X/* STA 194 */   { ADDRESS , EXTENDED, 
X		"8d;[1=]y" },
X/* STA 195 */   { ADDRESS|INDEXMASK , DIRECT|INDEXX, 
X		"95;[1=];" },
X/* STA 196 */   { ADDRESS|INDEXMASK , EXTENDED|INDEXX, 
X		"9d;[1=]y" },
X/* STA 197 */   { INDEXMASK , INDEXY, 
X		"99;[1=]y" },
X/* STA 198 */   { INSTCMOS|ADDRESS , DIRECT|INSTCMOS, 
X		"92;[1=];" },
X/* STA 199 */   { ADDRESS|INDEXMASK , DIRECT|INDEXY, 
X		"91;[1=];" },
X/* STA 200 */   { ADDRESS|INDEXMASK , DIRECT|INDEXX, 
X		"81;[1=];" },
X/* STX 201 */   { ADDRESS , DIRECT, 
X		"86;[1=];" },
X/* STX 202 */   { ADDRESS , EXTENDED, 
X		"8e;[1=]y" },
X/* STX 203 */   { ADDRESS|INDEXMASK , DIRECT|INDEXY, 
X		"96;[1=];" },
X/* STY 204 */   { ADDRESS , DIRECT, 
X		"84;[1=];" },
X/* STY 205 */   { ADDRESS , EXTENDED, 
X		"8c;[1=]y" },
X/* STY 206 */   { ADDRESS|INDEXMASK , DIRECT|INDEXX, 
X		"94;[1=];" },
X/* STZ 207 */   { ADDRESS|INSTCMOS , DIRECT|INSTCMOS, 
X		"64;[1=];" },
X/* STZ 208 */   { ADDRESS|INSTCMOS , EXTENDED|INSTCMOS, 
X		"9c;[1=]y" },
X/* STZ 209 */   { ADDRESS|INDEXMASK|INSTCMOS , DIRECT|INDEXX|INSTCMOS, 
X		"74;[1=];" },
X/* STZ 210 */   { ADDRESS|INDEXMASK|INSTCMOS , EXTENDED|INDEXX|INSTCMOS, 
X		"9e;[1=]y" },
X/* TAX 211 */   { 0 , 0, 
X		"aa;" },
X/* TAY 212 */   { 0 , 0, 
X		"a8;" },
X/* TRB 213 */   { ADDRESS|INSTCMOS , DIRECT|INSTCMOS, 
X		"14;[1=];" },
X/* TRB 214 */   { ADDRESS|INSTCMOS , EXTENDED|INSTCMOS, 
X		"1c;[1=]y" },
X/* TSB 215 */   { ADDRESS|INSTCMOS , DIRECT|INSTCMOS, 
X		"04;[1=];" },
X/* TSB 216 */   { ADDRESS|INSTCMOS , EXTENDED|INSTCMOS, 
X		"0c;[1=]y" },
X/* TSX 217 */   { 0 , 0, 
X		"ba;" },
X/* TXA 218 */   { 0 , 0, 
X		"8a;" },
X/* TXS 219 */   { 0 , 0, 
X		"9a;" },
X/* TYA 220 */   { 0 , 0, 
X		"98;" },
X	{ 0,0,""} };
X/* end fraptabdef.c */
SHAR_EOF
true || echo 'restore of as6502.y failed'
fi
exit 0



More information about the Alt.sources mailing list