Frankenstein Cross Assemblers, Intel 8051 Flavor, Part 1 of 1

Mark Zenier markz at ssc.UUCP
Wed Dec 5 17:15:15 AEST 1990


---- Cut Here and feed the following to sh ----
#!/bin/sh
# This is Frankasm/As8051, a shell archive (shar 3.43)
# made 12/04/1990 08:46 UTC by markz at ssc.uucp
# Source directory /usr/mark/frank.shar
#
# existing files will NOT be overwritten unless -c is specified
# This format requires very little intelligence at unshar time.
# "if test", "echo", "true", and "sed" may be needed.
#
# This shar contains:
# length  mode       name
# ------ ---------- ------------------------------------------
#    952 -r--r----- as8051.1
#   4578 -r--r----- as8051.doc
#   3427 -r--r----- as8051.tst
#   6753 -r--r----- as8051.tut
#  38580 -r--r--r-- as8051.y
#
# ============= as8051.1 ==============
if test -f 'as8051.1' -a X"$1" != X"-c"; then
	echo 'x - skipping as8051.1 (File already exists)'
else
echo 'x - extracting as8051.1 (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'as8051.1' &&
X.TH AS8051 1L
X.SH NAME
Xas8051 \- cross assembler for microcomputers
X.SH SYNOPSIS
Xas8051 [-p cpu] [-l listfile] [-o hexfile] [-d] [-s symbolfile] input
X.SH DESCRIPTION
XThe as8051 command assembles the input file into a
Xtext output file representing the program memory for a microcomputer.
X
XOptions
X.IP "-p cpu"
XIgnored by this program.
X.IP "-l listfile"
XOutput a file formated with the memory address, data, and source input lines.
X.IP "-o hexfile"
XOutput the memory data image in a form accepted by most prom programmers.
X.IP "-h hexfile"
XSame as \-o.
X.IP \-d
XSave the intermediate data file (see FILE) and abort the execution at the
Xend of processing.
X.IP "-s symbolfile"
XPrint the symbol table values and names, one per line in the specified file.
X.SH FILES
X/usr/tmp/frtXXXXXX
X.SH SEE ALSO
XFrankenstein Cross Assemblers Users Manual (file base.doc)
XAppendix for as8051 Frankenstein Assembler (file as8051.doc)
X.SH NOTES
XThere is only one input file.
SHAR_EOF
true || echo 'restore of as8051.1 failed'
fi
# ============= as8051.doc ==============
if test -f 'as8051.doc' -a X"$1" != X"-c"; then
	echo 'x - skipping as8051.doc (File already exists)'
else
echo 'x - extracting as8051.doc (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'as8051.doc' &&
X.HM A 1 1 1 1 1 1
X.H 1 "Appendix for as8051 Frankenstein Assembler"
X.H 2 "Pseudo Operations"
X.H 3 "Standard Pseudo Operation Mnemonics"
X.VL 40 5 1
X.LI "End"
XEND
X.LI "File Inclusion"
XINCL
XINCLUDE
X.LI "If"
XIF
X.LI "Else"
XELSE
X.LI "End If"
XENDI
X.LI "Equate"
XEQU
X.LI "Set"
XSET
X.LI "Org"
XORG
X.LI "Reserve Memory"
XRESERVE
XRMB
X.LI "Define Byte Data"
XBYTE
XDB
XFCB
X.LI "Define Word Data"
XDW
XFDB
XWORD
X.LI "Define String Data"
XFCC
XSTRING
X.LI "Define Character Set Translation"
XCHARSET
X.LI "Define Character Value"
XCHARDEF
XCHD
X.LI "Use Character Translation"
XCHARUSE
X.LE
X.H 3 "Machine Dependent Pseudo Operations"
X.H 4 "Define Word Data"
XThe Define Word Data pseudo-operations generate the byte reversed form
Xfor 16 bit constants.
XThe first byte is the low order half, followed by the high order byte.
X.H 2 "Instructions"
X.H 3 "Instruction List"
X.TS H
X;
Xl l l.
XOpcode	Syntax	Selection Criteria
X.sp
X.TH
X.sp
XACALL	expr
X.sp
XADD	A ',' '#' expr	
XADD	A ',' '@' REG	R01
XADD	A ',' REG	R07
XADD	A ',' expr	
X.sp
XADDC	A ',' '#' expr	
XADDC	A ',' '@' REG	R01
XADDC	A ',' REG	R07
XADDC	A ',' expr	
X.sp
XAJMP	expr
X.sp
XANL	A ',' '#' expr	
XANL	A ',' '@' REG	R01
XANL	A ',' REG	R07
XANL	A ',' expr	
XANL	C ',' '/' bit	
XANL	C ',' '/' expr	
XANL	C ',' bit	
XANL	C ',' expr	
XANL	expr ',' '#' expr
XANL	expr ','A
X.sp
XCJNE	A ',' '#' expr ',' expr	
XCJNE	A ',' expr ',' expr	
XCJNE	'@' REG ',' '#' expr ',' expr	R01
XCJNE	REG ',' '#' expr ',' expr	R07
X.sp
XCLR	A	
XCLR	C	
XCLR	bit
XCLR	expr
X.sp
XCPL	A	
XCPL	C	
XCPL	bit
XCPL	expr
X.sp
XDA	A	
X.sp
XDEC	'@' REG	R01
XDEC	A	
XDEC	REG	R07
XDEC	expr
X.sp
XDIV	AB	
X.sp
XDJNZ	REG ',' expr	R07
XDJNZ	expr ',' expr
X.sp
XINC	'@' REG	R01
XINC	A	
XINC	DPTR	
XINC	REG	R07
XINC	expr
X.sp
XJB	bit ',' expr
XJB	expr ',' expr
X.sp
XJBC	bit ',' expr
XJBC	expr ',' expr
X.sp
XJC	expr
X.sp
XJMP	'@' A '+' DPTR	
X.sp
XJNB	bit ',' expr
XJNB	expr ',' expr
X.sp
XJNC	expr
X.sp
XJNZ	expr
X.sp
XJZ	expr
X.sp
XLCALL	expr
X.sp
XLJMP	expr
X.sp
XMOV	'@' REG ',' '#' expr	R01
XMOV	'@' REG ',' A	R01
XMOV	'@' REG ',' expr	R01
XMOV	A ',' '#' expr	
XMOV	A ',' '@' REG	R01
XMOV	A ',' REG	R07
XMOV	A ',' expr	
XMOV	C ',' bit	
XMOV	C ',' expr	
XMOV	DPTR ',' '#' expr	
XMOV	REG ',' A	R07
XMOV	REG ',' '#' expr	R07
XMOV	REG ',' expr	R07
XMOV	bit ',' C	
XMOV	expr ',' '#' expr
XMOV	expr ',' '@' REG	R01
XMOV	expr ',' A	
XMOV	expr ',' C	
XMOV	expr ',' REG	R07
XMOV	expr ',' expr
X.sp
XMOVC	A ',' '@' A '+' DPTR	
XMOVC	A ',' '@' A '+' PC	
X.sp
XMOVX	'@' DPTR ',' A	
XMOVX	'@' REG ',' A	R01
XMOVX	A ',' '@' DPTR	
XMOVX	A ',' '@' REG	R01
X.sp
XMUL	AB	
X.sp
XNOP	
X.sp
XORL	A ',' '#' expr	
XORL	A ',' '@' REG	R01
XORL	A ',' REG	R07
XORL	A ',' expr	
XORL	C ',' '/' bit	
XORL	C ',' '/' expr	
XORL	C ',' bit	
XORL	C ',' expr	
XORL	expr ',' '#' expr
XORL	expr ',' A	
X.sp
XPOP	expr
X.sp
XPUSH	expr
X.sp
XRET	
X.sp
XRETI	
X.sp
XRL	A	
X.sp
XRLC	A	
X.sp
XRR	A	
X.sp
XRRC	A	
X.sp
XSETB	C	
XSETB	bit
XSETB	expr
X.sp
XSJMP	expr
X.sp
XSUBB	A ',' '#' expr	
XSUBB	A ',' '@' REG	R01
XSUBB	A ',' REG	R07
XSUBB	A ',' expr	
X.sp
XSWAP	A	
X.sp
XXCH	A ',' '@' REG	R01
XXCH	A ',' REG	R07
XXCH	A ',' expr	
X.sp
XXCHD	A ',' '@' REG	R01
X.sp
XXRL	A ',' '#' expr	
XXRL	A ',' '@' REG	R01
XXRL	A ',' REG	R07
XXRL	A ',' expr	
XXRL	expr ',' '#' expr
XXRL	expr ',' A	
X.TE
X.H 3 "Selection Criteria Keywords"
X.VL 25 5 
X.LI R01
XOnly the reserved symbols R0 and R1 (or r0, r1) are acceptable as
Xthe REG operand.
X.LI R07
XAll the reserved symbols R0 thru R7 are acceptable as the REG operand.
X.LE
X.H 3 "Bit Operands"
XBit Addresses can be in two forms.
X.P
XOne form is "expression.constant" where expression gives an address for a 
Xbit addressable register and constant (in the range of 0 to 7) gives the 
Xbit number in the byte.
XExpression values must be either in the range of 20h to 2fh, or
Xthe multiples of 8 between 80h and f8h, and defined in the first pass.
X.P
XThe second form is an symbolic expression with value between 0 and 255.
XThe value of the expression is placed in the operand field of the
Xinstruction without modification.
X.H 3 "Apostrophes"
XThe apostrophes in the syntax field are a notation used for the
Xparser generator and are not put in the assembler source statement.
X.H 2 "Notes"
X.H 3 "Address Spaces"
XThe Four address spaces, Program Memory, Internal Data Memory, Bit Numbers, 
Xand External Data Memory are not differentiated in the symbol table.
XWhich address space a symbol refers to is determined by the context of
Xthe instruction operands it appears in.
X.H 3 "Reserved Symbols"
X.H 4 "Machine Dependent Reserved Symbols"
XA
XAB
XC
XDPTR
XPC
XR0
XR1
XR2
XR3
XR4
XR5
XR6
XR7
Xa
Xab
Xc
Xdptr
Xpc
Xr0
Xr1
Xr2
Xr3
Xr4
Xr5
Xr6
Xr7
X.H 4 "Standard Reserved Symbols"
XAND
XDEFINED
XEQ
XGE
XGT
XHIGH
XLE
XLOW
XLT
XMOD
XNE
XNOT
XOR
XSHL
XSHR
XXOR
Xand
Xdefined
Xeq
Xge
Xgt
Xhigh
Xle
Xlow
Xlt
Xmod
Xne
Xnot
Xor
Xshl
Xshr
Xxor
X.TC 1 1 7
SHAR_EOF
true || echo 'restore of as8051.doc failed'
fi
# ============= as8051.tst ==============
if test -f 'as8051.tst' -a X"$1" != X"-c"; then
	echo 'x - skipping as8051.tst (File already exists)'
else
echo 'x - extracting as8051.tst (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'as8051.tst' &&
Xbit	equ 	$88
Xdirbit	equ	$8d
Xdirect	equ	$44
Ximmed	equ	$55
Xsrcdirect	equ	$33
X	acall	addr
X	add	a, #immed
X	add	a, @ r0
X	add	a, @ r1
X	add	a, direct
X	add	a, r0
X	add	a, r1
X	add	a, r2
X	add	a, r3
X	add	a, r4
X	add	a, r5
X	add	a, r6
X	add	a, r7
X	addc	a, #immed
X	addc	a, @ r0
X	addc	a, @ r1
X	addc	a, direct
X	addc	a, r0
X	addc	a, r1
X	addc	a, r2
X	addc	a, r3
X	addc	a, r4
X	addc	a, r5
X	addc	a, r6
X	addc	a, r7
X	ajmp	addr
X	anl	a, #immed
X	anl	a, @ r0
X	anl	a, @ r1
X	anl	a, direct
X	anl	a, r0
X	anl	a, r1
X	anl	a, r2
X	anl	a, r3
X	anl	a, r4
X	anl	a, r5
X	anl	a, r6
X	anl	a, r7
X	anl	c, /bit.5
X	anl	c, /dirbit
X	anl	c, bit.5
X	anl	c, dirbit
X	anl	direct, # immed
X	anl	direct, a
X	cjne	@ r0, # immed, addr
X	cjne	@ r1, # immed, addr
X	cjne	a, #immed, addr
X	cjne	a, direct, addr
X	cjne	r0, # immed, addr
X	cjne	r1, # immed, addr
X	cjne	r2, # immed, addr
X	cjne	r3, # immed, addr
X	cjne	r4, # immed, addr
X	cjne	r5, # immed, addr
X	cjne	r6, # immed, addr
X	cjne	r7, # immed, addr
X	clr	a
X	clr	bit.5
X	clr	c
X	clr	dirbit
X	cpl	a
X	cpl	bit.5
X	cpl	c
X	cpl	dirbit
X	da	a
X	dec	@ r0
X	dec	@ r1
X	dec	a
X	dec	direct
X	dec	r0
X	dec	r1
X	dec	r2
X	dec	r3
X	dec	r4
X	dec	r5
X	dec	r6
X	dec	r7
X	div	ab
X	djnz	direct, addr
X	djnz	r0, addr
X	djnz	r1, addr
X	djnz	r2, addr
X	djnz	r3, addr
X	djnz	r4, addr
X	djnz	r5, addr
X	djnz	r6, addr
X	djnz	r7, addr
X	inc	@ r0
X	inc	@ r1
X	inc	a
X	inc	direct
X	inc	dptr
X	inc	r0
X	inc	r1
X	inc	r2
X	inc	r3
X	inc	r4
Xaddr	inc	r5
X	inc	r6
X	inc	r7
X	jb	bit.5, addr
X	jb	dirbit, addr
X	jbc	bit.5, addr
X	jbc	dirbit, addr
X	jc	addr
X	jmp	@a+dptr
X	jnb	bit.5, addr
X	jnb	dirbit, addr
X	jnc	addr
X	jnz	addr
X	jz	addr
X	lcall	addr
X	ljmp	addr
X	mov	@ r0, # immed
X	mov	@ r0, a
X	mov	@ r0, direct
X	mov	@ r1, # immed
X	mov	@ r1, a
X	mov	@ r1, direct
X	mov	a, #immed
X	mov	a, @ r0
X	mov	a, @ r1
X	mov	a, direct
X	mov	a, r0
X	mov	a, r1
X	mov	a, r2
X	mov	a, r3
X	mov	a, r4
X	mov	a, r5
X	mov	a, r6
X	mov	a, r7
X	mov	bit.5, c
X	mov	c, bit.5
X	mov	c, dirbit
X	mov	dirbit, c
X	mov	direct, # immed
X	mov	direct, @ r0
X	mov	direct, @ r1
X	mov	direct, a
X	mov	direct, r0
X	mov	direct, r1
X	mov	direct, r2
X	mov	direct, r3
X	mov	direct, r4
X	mov	direct, r5
X	mov	direct, r6
X	mov	direct, r7
X	mov	direct, srcdirect
X	mov	dptr, #immed
X	mov	r0, # immed
X	mov	r0, a
X	mov	r0, direct
X	mov	r1, # immed
X	mov	r1, a
X	mov	r1, direct
X	mov	r2, # immed
X	mov	r2, a
X	mov	r2, direct
X	mov	r3, # immed
X	mov	r3, a
X	mov	r3, direct
X	mov	r4, # immed
X	mov	r4, a
X	mov	r4, direct
X	mov	r5, # immed
X	mov	r5, a
X	mov	r5, direct
X	mov	r6, # immed
X	mov	r6, a
X	mov	r6, direct
X	mov	r7, # immed
X	mov	r7, a
X	mov	r7, direct
X	movc	a, @a+dptr
Xsaddr	movc	a, @a+pc
X	movx	@dptr, a
X	movx	@r0, a
X	movx	@r1, a
X	movx	a, @ r0
X	movx	a, @ r1
X	movx	a, @dptr
X	mul	ab
X	nop
X	orl	a, #immed
X	orl	a, @ r0
X	orl	a, @ r1
X	orl	a, direct
X	orl	a, r0
X	orl	a, r1
X	orl	a, r2
X	orl	a, r3
X	orl	a, r4
X	orl	a, r5
X	orl	a, r6
X	orl	a, r7
X	orl	c, /bit.5
X	orl	c, /dirbit
X	orl	c, bit.5
X	orl	c, dirbit
X	orl	direct, # immed
X	orl	direct, a
X	pop	direct
X	push	direct
X	ret
X	reti
X	rl	a
X	rlc	a
X	rr	a
X	rrc	a
X	setb	bit.5
X	setb	c
X	setb	dirbit
X	sjmp	saddr
X	subb	a, #immed
X	subb	a, @ r0
X	subb	a, @ r1
X	subb	a, direct
X	subb	a, r0
X	subb	a, r1
X	subb	a, r2
X	subb	a, r3
X	subb	a, r4
X	subb	a, r5
X	subb	a, r6
X	subb	a, r7
X	swap	a
X	xch	a, @ r0
X	xch	a, @ r1
X	xch	a, direct
X	xch	a, r0
X	xch	a, r1
X	xch	a, r2
X	xch	a, r3
X	xch	a, r4
X	xch	a, r5
X	xch	a, r6
X	xch	a, r7
X	xchd	a, @ r0
X	xchd	a, @ r1
X	xrl	a, #immed
X	xrl	a, @ r0
X	xrl	a, @ r1
X	xrl	a, direct
X	xrl	a, r0
X	xrl	a, r1
X	xrl	a, r2
X	xrl	a, r3
X	xrl	a, r4
X	xrl	a, r5
X	xrl	a, r6
X	xrl	a, r7
X	xrl	direct, # immed
X	xrl	direct, a
SHAR_EOF
true || echo 'restore of as8051.tst failed'
fi
# ============= as8051.tut ==============
if test -f 'as8051.tut' -a X"$1" != X"-c"; then
	echo 'x - skipping as8051.tut (File already exists)'
else
echo 'x - extracting as8051.tut (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'as8051.tut' &&
X00000088 bit              0000008d dirbit           00000044 direct           
X00000055 immed            00000033 srcdirect        00000098 addr             
X00000124 saddr            
X 0x88                   bit	equ 	$88
X 0x8d                   dirbit	equ	$8d
X 0x44                   direct	equ	$44
X 0x55                   immed	equ	$55
X 0x33                   srcdirect	equ	$33
X0000 11 98 			acall	addr
X0002 24 55 			add	a, #immed
X0004 26 			add	a, @ r0
X0005 27 			add	a, @ r1
X0006 25 44 			add	a, direct
X0008 28 			add	a, r0
X0009 29 			add	a, r1
X000a 2a 			add	a, r2
X000b 2b 			add	a, r3
X000c 2c 			add	a, r4
X000d 2d 			add	a, r5
X000e 2e 			add	a, r6
X000f 2f 			add	a, r7
X0010 34 55 			addc	a, #immed
X0012 36 			addc	a, @ r0
X0013 37 			addc	a, @ r1
X0014 35 44 			addc	a, direct
X0016 38 			addc	a, r0
X0017 39 			addc	a, r1
X0018 3a 			addc	a, r2
X0019 3b 			addc	a, r3
X001a 3c 			addc	a, r4
X001b 3d 			addc	a, r5
X001c 3e 			addc	a, r6
X001d 3f 			addc	a, r7
X001e 01 98 			ajmp	addr
X0020 54 55 			anl	a, #immed
X0022 56 			anl	a, @ r0
X0023 57 			anl	a, @ r1
X0024 55 44 			anl	a, direct
X0026 58 			anl	a, r0
X0027 59 			anl	a, r1
X0028 5a 			anl	a, r2
X0029 5b 			anl	a, r3
X002a 5c 			anl	a, r4
X002b 5d 			anl	a, r5
X002c 5e 			anl	a, r6
X002d 5f 			anl	a, r7
X002e b0 8d 			anl	c, /bit.5
X0030 b0 8d 			anl	c, /dirbit
X0032 82 8d 			anl	c, bit.5
X0034 82 8d 			anl	c, dirbit
X0036 53 44 55 			anl	direct, # immed
X0039 52 44 			anl	direct, a
X003b b6 55 5a 			cjne	@ r0, # immed, addr
X003e b7 55 57 			cjne	@ r1, # immed, addr
X0041 b4 55 54 			cjne	a, #immed, addr
X0044 b5 44 51 			cjne	a, direct, addr
X0047 b8 55 4e 			cjne	r0, # immed, addr
X004a b9 55 4b 			cjne	r1, # immed, addr
X004d ba 55 48 			cjne	r2, # immed, addr
X0050 bb 55 45 			cjne	r3, # immed, addr
X0053 bc 55 42 			cjne	r4, # immed, addr
X0056 bd 55 3f 			cjne	r5, # immed, addr
X0059 be 55 3c 			cjne	r6, # immed, addr
X005c bf 55 39 			cjne	r7, # immed, addr
X005f e4 			clr	a
X0060 c2 8d 			clr	bit.5
X0062 c3 			clr	c
X0063 c2 8d 			clr	dirbit
X0065 f4 			cpl	a
X0066 b2 8d 			cpl	bit.5
X0068 b3 			cpl	c
X0069 b2 8d 			cpl	dirbit
X006b d4 			da	a
X006c 16 			dec	@ r0
X006d 17 			dec	@ r1
X006e 14 			dec	a
X006f 15 44 			dec	direct
X0071 18 			dec	r0
X0072 19 			dec	r1
X0073 1a 			dec	r2
X0074 1b 			dec	r3
X0075 1c 			dec	r4
X0076 1d 			dec	r5
X0077 1e 			dec	r6
X0078 1f 			dec	r7
X0079 84 			div	ab
X007a d5 44 1b 			djnz	direct, addr
X007d d8 19 			djnz	r0, addr
X007f d9 17 			djnz	r1, addr
X0081 da 15 			djnz	r2, addr
X0083 db 13 			djnz	r3, addr
X0085 dc 11 			djnz	r4, addr
X0087 dd 0f 			djnz	r5, addr
X0089 de 0d 			djnz	r6, addr
X008b df 0b 			djnz	r7, addr
X008d 06 			inc	@ r0
X008e 07 			inc	@ r1
X008f 04 			inc	a
X0090 05 44 			inc	direct
X0092 a3 			inc	dptr
X0093 08 			inc	r0
X0094 09 			inc	r1
X0095 0a 			inc	r2
X0096 0b 			inc	r3
X0097 0c 			inc	r4
X0098 0d 		addr	inc	r5
X0099 0e 			inc	r6
X009a 0f 			inc	r7
X009b 20 8d fa 			jb	bit.5, addr
X009e 20 8d f7 			jb	dirbit, addr
X00a1 10 8d f4 			jbc	bit.5, addr
X00a4 10 8d f1 			jbc	dirbit, addr
X00a7 40 ef 			jc	addr
X00a9 73 			jmp	@a+dptr
X00aa 30 8d eb 			jnb	bit.5, addr
X00ad 30 8d e8 			jnb	dirbit, addr
X00b0 50 e6 			jnc	addr
X00b2 70 e4 			jnz	addr
X00b4 60 e2 			jz	addr
X00b6 12 00 98 			lcall	addr
X00b9 02 00 98 			ljmp	addr
X00bc 76 55 			mov	@ r0, # immed
X00be f6 			mov	@ r0, a
X00bf a6 44 			mov	@ r0, direct
X00c1 77 55 			mov	@ r1, # immed
X00c3 f7 			mov	@ r1, a
X00c4 a7 44 			mov	@ r1, direct
X00c6 74 55 			mov	a, #immed
X00c8 e6 			mov	a, @ r0
X00c9 e7 			mov	a, @ r1
X00ca e5 44 			mov	a, direct
X00cc e8 			mov	a, r0
X00cd e9 			mov	a, r1
X00ce ea 			mov	a, r2
X00cf eb 			mov	a, r3
X00d0 ec 			mov	a, r4
X00d1 ed 			mov	a, r5
X00d2 ee 			mov	a, r6
X00d3 ef 			mov	a, r7
X00d4 92 8d 			mov	bit.5, c
X00d6 a2 8d 			mov	c, bit.5
X00d8 a2 8d 			mov	c, dirbit
X00da 92 8d 			mov	dirbit, c
X00dc 75 44 55 			mov	direct, # immed
X00df 86 44 			mov	direct, @ r0
X00e1 87 44 			mov	direct, @ r1
X00e3 f5 44 			mov	direct, a
X00e5 88 44 			mov	direct, r0
X00e7 89 44 			mov	direct, r1
X00e9 8a 44 			mov	direct, r2
X00eb 8b 44 			mov	direct, r3
X00ed 8c 44 			mov	direct, r4
X00ef 8d 44 			mov	direct, r5
X00f1 8e 44 			mov	direct, r6
X00f3 8f 44 			mov	direct, r7
X00f5 85 33 44 			mov	direct, srcdirect
X00f8 90 00 55 			mov	dptr, #immed
X00fb 78 55 			mov	r0, # immed
X00fd f8 			mov	r0, a
X00fe a8 44 			mov	r0, direct
X0100 79 55 			mov	r1, # immed
X0102 f9 			mov	r1, a
X0103 a9 44 			mov	r1, direct
X0105 7a 55 			mov	r2, # immed
X0107 fa 			mov	r2, a
X0108 aa 44 			mov	r2, direct
X010a 7b 55 			mov	r3, # immed
X010c fb 			mov	r3, a
X010d ab 44 			mov	r3, direct
X010f 7c 55 			mov	r4, # immed
X0111 fc 			mov	r4, a
X0112 ac 44 			mov	r4, direct
X0114 7d 55 			mov	r5, # immed
X0116 fd 			mov	r5, a
X0117 ad 44 			mov	r5, direct
X0119 7e 55 			mov	r6, # immed
X011b fe 			mov	r6, a
X011c ae 44 			mov	r6, direct
X011e 7f 55 			mov	r7, # immed
X0120 ff 			mov	r7, a
X0121 af 44 			mov	r7, direct
X0123 93 			movc	a, @a+dptr
X0124 83 		saddr	movc	a, @a+pc
X0125 f0 			movx	@dptr, a
X0126 f2 			movx	@r0, a
X0127 f3 			movx	@r1, a
X0128 e2 			movx	a, @ r0
X0129 e3 			movx	a, @ r1
X012a e0 			movx	a, @dptr
X012b a4 			mul	ab
X012c 00 			nop
X012d 44 55 			orl	a, #immed
X012f 46 			orl	a, @ r0
X0130 47 			orl	a, @ r1
X0131 45 44 			orl	a, direct
X0133 48 			orl	a, r0
X0134 49 			orl	a, r1
X0135 4a 			orl	a, r2
X0136 4b 			orl	a, r3
X0137 4c 			orl	a, r4
X0138 4d 			orl	a, r5
X0139 4e 			orl	a, r6
X013a 4f 			orl	a, r7
X013b a0 8d 			orl	c, /bit.5
X013d a0 8d 			orl	c, /dirbit
X013f 72 8d 			orl	c, bit.5
X0141 72 8d 			orl	c, dirbit
X0143 43 44 55 			orl	direct, # immed
X0146 42 44 			orl	direct, a
X0148 d0 44 			pop	direct
X014a c0 44 			push	direct
X014c 22 			ret
X014d 32 			reti
X014e 23 			rl	a
X014f 33 			rlc	a
X0150 03 			rr	a
X0151 13 			rrc	a
X0152 d2 8d 			setb	bit.5
X0154 d3 			setb	c
X0155 d2 8d 			setb	dirbit
X0157 80 cb 			sjmp	saddr
X0159 94 55 			subb	a, #immed
X015b 96 			subb	a, @ r0
X015c 97 			subb	a, @ r1
X015d 95 44 			subb	a, direct
X015f 98 			subb	a, r0
X0160 99 			subb	a, r1
X0161 9a 			subb	a, r2
X0162 9b 			subb	a, r3
X0163 9c 			subb	a, r4
X0164 9d 			subb	a, r5
X0165 9e 			subb	a, r6
X0166 9f 			subb	a, r7
X0167 c4 			swap	a
X0168 c6 			xch	a, @ r0
X0169 c7 			xch	a, @ r1
X016a c5 44 			xch	a, direct
X016c c8 			xch	a, r0
X016d c9 			xch	a, r1
X016e ca 			xch	a, r2
X016f cb 			xch	a, r3
X0170 cc 			xch	a, r4
X0171 cd 			xch	a, r5
X0172 ce 			xch	a, r6
X0173 cf 			xch	a, r7
X0174 d6 			xchd	a, @ r0
X0175 d7 			xchd	a, @ r1
X0176 64 55 			xrl	a, #immed
X0178 66 			xrl	a, @ r0
X0179 67 			xrl	a, @ r1
X017a 65 44 			xrl	a, direct
X017c 68 			xrl	a, r0
X017d 69 			xrl	a, r1
X017e 6a 			xrl	a, r2
X017f 6b 			xrl	a, r3
X0180 6c 			xrl	a, r4
X0181 6d 			xrl	a, r5
X0182 6e 			xrl	a, r6
X0183 6f 			xrl	a, r7
X0184 63 44 55 			xrl	direct, # immed
X0187 62 44 			xrl	direct, a
X ERROR SUMMARY - ERRORS DETECTED 0
X               -  WARNINGS       0
SHAR_EOF
true || echo 'restore of as8051.tut failed'
fi
# ============= as8051.y ==============
if test -f 'as8051.y' -a X"$1" != X"-c"; then
	echo 'x - skipping as8051.y (File already exists)'
else
echo 'x - extracting as8051.y (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'as8051.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: 	as8051.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: 	as8051.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/* 8051 structured 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.0xxx   register value */
X#define REGVALMASK	0x7
X/*	0xxx.xxxx.0000.0000	register and special select bits */
X#define REGSEL_ALL	0x7f00
X#define REG2NDSHFT	8
X#define REGSEL_ACC	0x100
X#define REGSEL_AB	0x200
X#define REGSEL_C	0x400
X#define REGSEL_DPTR	0x800
X#define REGSEL_PC	0x1000
X#define REGSEL_R01	0x2000
X#define REGSEL_R07	0x4000
X#define REG2SEL_ACC	0x1
X#define REG2SEL_AB	0x2
X#define REG2SEL_C	0x4
X#define REG2SEL_DPTR	0x8
X#define REG2SEL_PC	0x10
X#define REG2SEL_R01	0x20
X#define REG2SEL_R07	0x40
X#define ST_INH 0x1
X#define ST_UOP01 0x2
X#define ST_UOP02 0x4
X#define ST_UOP03 0x8
X#define ST_UOP04 0x10
X#define ST_UOP05 0x20
X#define ST_ALU01 0x1
X#define ST_ALU02 0x2
X#define ST_ALU02E 0x4
X#define ST_ALU03 0x8
X#define ST_ALU04 0x10
X#define ST_ALU05 0x20
X#define ST_ALU06 0x40
X#define ST_ALU07 0x80
X#define ST_ALU08 0x100
X#define ST_ALU09 0x200
X#define ST_ALU10 0x400
X#define ST_MOV01 0x1
X#define ST_MOV02 0x2
X#define ST_MOV03 0x4
X#define ST_MOV04 0x8
X#define ST_MOV05 0x10
X#define ST_MOV06 0x20
X#define ST_MOV07 0x40
X#define ST_MOV08 0x80
X#define ST_MOV09 0x100
X#define ST_MOV10 0x200
X#define ST_MOV11 0x400
X#define ST_MOV12 0x800
X#define ST_MOV13 0x1000
X#define ST_MOV14 0x2000
X#define ST_CJNE1 0x1
X#define ST_CJNE2 0x2
X#define ST_CJNE3 0x4
X	
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";
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%token <intv> REG
X%type <intv> bit
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_opcode
X%token <intv> KOC_aluop
X%token <intv> KOC_mov
X%token <intv> KOC_cjne
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
Xgenline : KOC_opcode 
X			{
X		genlocrec(currseg, labelloc);
X		locctr += geninstr(findgen($1, ST_INH,  0));
X			}
X	;
Xgenline : KOC_opcode  '@' REG
X			{
X		genlocrec(currseg, labelloc);
X		evalr[1].value = ( $3 & REGVALMASK);
X		locctr += geninstr(findgen($1, ST_UOP01,  ($3 & REGSEL_ALL)));
X			}
X	;
Xgenline : KOC_opcode  REG
X			{
X		genlocrec(currseg, labelloc);
X		evalr[1].value = ( $2 & REGVALMASK);
X		locctr += geninstr(findgen($1, ST_UOP02,  ($2 & REGSEL_ALL)));
X			}
X	;
Xgenline : KOC_opcode  bit
X			{
X		genlocrec(currseg, labelloc);
X		evalr[1].value = $2;
X		locctr += geninstr(findgen($1, ST_UOP03,  0));
X			}
X	;
Xgenline : KOC_opcode  expr
X			{
X		genlocrec(currseg, labelloc);
X		pevalexpr(1,$2);
X		locctr += geninstr(findgen($1, ST_UOP04,  0));
X			}
X	;
Xgenline : KOC_opcode  '@' REG '+' REG
X			{
X		genlocrec(currseg, labelloc);
X		locctr += geninstr(findgen($1, ST_UOP05, ($3 & REGSEL_ALL) 
X			| (($5 & REGSEL_ALL) >> REG2NDSHFT) ));
X			}
X	;
Xgenline : KOC_aluop  REG ',' '#' expr
X			{
X		genlocrec(currseg, labelloc);
X		evalr[1].value = ( $2 & REGVALMASK);
X		pevalexpr(2,$5);
X		locctr += geninstr(findgen($1, ST_ALU01,  ($2 & REGSEL_ALL)));
X			}
X	;
Xgenline : KOC_aluop  REG ',' '/' bit
X			{
X		genlocrec(currseg, labelloc);
X		evalr[1].value = ( $2 & REGVALMASK);
X		evalr[2].value = $5;
X		locctr += geninstr(findgen($1, ST_ALU02,  ($2 & REGSEL_ALL)));
X			}
X	;
Xgenline : KOC_aluop  REG ',' '/' expr
X			{
X		genlocrec(currseg, labelloc);
X		evalr[1].value = ( $2 & REGVALMASK);
X		pevalexpr(2,$5);
X		locctr += geninstr(findgen($1, ST_ALU02E,  ($2 & REGSEL_ALL)));
X			}
X	;
Xgenline : KOC_aluop  REG ',' '@' REG
X			{
X		genlocrec(currseg, labelloc);
X		evalr[1].value = ( $2 & REGVALMASK);
X		evalr[2].value = ( $5 & REGVALMASK);
X		locctr += geninstr(findgen($1, ST_ALU03,  ($2 & REGSEL_ALL) 
X			| (($5 & REGSEL_ALL) >> REG2NDSHFT)));
X			}
X	;
Xgenline : KOC_aluop  REG ',' REG
X			{
X		genlocrec(currseg, labelloc);
X		evalr[1].value = ( $2 & REGVALMASK);
X		evalr[2].value = ( $4 & REGVALMASK);
X		locctr += geninstr(findgen($1, ST_ALU04,  ($2 & REGSEL_ALL) 
X			| (($4 & REGSEL_ALL) >> REG2NDSHFT)));
X			}
X	;
Xgenline : KOC_aluop  REG ',' bit
X			{
X		genlocrec(currseg, labelloc);
X		evalr[1].value = ( $2 & REGVALMASK);
X		evalr[2].value = $4;
X		locctr += geninstr(findgen($1, ST_ALU05,  ($2 & REGSEL_ALL)));
X			}
X	;
Xgenline : KOC_aluop  REG ',' expr
X			{
X		genlocrec(currseg, labelloc);
X		evalr[1].value = ( $2 & REGVALMASK);
X		pevalexpr(2,$4);
X		locctr += geninstr(findgen($1, ST_ALU06,  ($2 & REGSEL_ALL)));
X			}
X	;
Xgenline : KOC_aluop  bit ',' expr
X			{
X		genlocrec(currseg, labelloc);
X		evalr[1].value = $2;
X		pevalexpr(2,$4);
X		locctr += geninstr(findgen($1, ST_ALU07,  0));
X			}
X	;
Xgenline : KOC_aluop  expr ',' '#' expr
X			{
X		genlocrec(currseg, labelloc);
X		pevalexpr(1,$2);
X		pevalexpr(2,$5);
X		locctr += geninstr(findgen($1, ST_ALU08,  0));
X			}
X	;
Xgenline : KOC_aluop  expr ',' REG
X			{
X		genlocrec(currseg, labelloc);
X		pevalexpr(1,$2);
X		evalr[2].value = ( $4 & REGVALMASK);
X		locctr += geninstr(findgen($1, ST_ALU09,  ($4 & REGSEL_ALL)));
X			}
X	;
Xgenline : KOC_aluop  expr ',' expr
X			{
X		genlocrec(currseg, labelloc);
X		pevalexpr(1,$2);
X		pevalexpr(2,$4);
X		locctr += geninstr(findgen($1, ST_ALU10,  0));
X			}
X	;
Xgenline : KOC_mov  '@' REG ',' '#' expr
X			{
X		genlocrec(currseg, labelloc);
X		evalr[1].value = ( $3 & REGVALMASK);
X		pevalexpr(2,$6);
X		locctr += geninstr(findgen($1, ST_MOV01,  ($3 & REGSEL_ALL)));
X			}
X	;
Xgenline : KOC_mov  '@' REG ',' REG
X			{
X		genlocrec(currseg, labelloc);
X		evalr[1].value = ( $3 & REGVALMASK);
X		evalr[2].value = ( $5 & REGVALMASK);
X		locctr += geninstr(findgen($1, ST_MOV02,  ($3 & REGSEL_ALL) 
X			| (($5 & REGSEL_ALL) >> REG2NDSHFT)));
X			}
X	;
Xgenline : KOC_mov  '@' REG ',' expr
X			{
X		genlocrec(currseg, labelloc);
X		evalr[1].value = ( $3 & REGVALMASK);
X		pevalexpr(2,$5);
X		locctr += geninstr(findgen($1, ST_MOV03,  ($3 & REGSEL_ALL)));
X			}
X	;
Xgenline : KOC_mov  REG ',' '#' expr
X			{
X		genlocrec(currseg, labelloc);
X		evalr[1].value = ( $2 & REGVALMASK);
X		pevalexpr(2,$5);
X		locctr += geninstr(findgen($1, ST_MOV04,  ($2 & REGSEL_ALL)));
X			}
X	;
Xgenline : KOC_mov  REG ',' '@' REG
X			{
X		genlocrec(currseg, labelloc);
X		evalr[1].value = ( $2 & REGVALMASK);
X		evalr[2].value = ( $5 & REGVALMASK);
X		locctr += geninstr(findgen($1, ST_MOV05,  ($2 & REGSEL_ALL) 
X			| (($5 & REGSEL_ALL) >> REG2NDSHFT)));
X			}
X	;
Xgenline : KOC_mov  REG ',' '@' REG '+' REG
X			{
X		genlocrec(currseg, labelloc);
X		locctr += geninstr(findgen($1, ST_MOV06,  (($2&$5) & REGSEL_ALL)
X			| (($7 & REGSEL_ALL) >> REG2NDSHFT)));
X			}
X	;
Xgenline : KOC_mov  REG ',' REG
X			{
X		genlocrec(currseg, labelloc);
X		evalr[1].value = ( $2 & REGVALMASK);
X		evalr[2].value = ( $4 & REGVALMASK);
X		locctr += geninstr(findgen($1, ST_MOV07,  ($2 & REGSEL_ALL) 
X			| (($4 & REGSEL_ALL) >> REG2NDSHFT)));
X			}
X	;
Xgenline : KOC_mov  REG ',' bit
X			{
X		genlocrec(currseg, labelloc);
X		evalr[1].value = ( $2 & REGVALMASK);
X		evalr[2].value = $4;
X		locctr += geninstr(findgen($1, ST_MOV08,  ($2 & REGSEL_ALL)));
X			}
X	;
Xgenline : KOC_mov  REG ',' expr
X			{
X		genlocrec(currseg, labelloc);
X		evalr[1].value = ( $2 & REGVALMASK);
X		pevalexpr(2,$4);
X		locctr += geninstr(findgen($1, ST_MOV09,  ($2 & REGSEL_ALL)));
X			}
X	;
Xgenline : KOC_mov  bit ',' REG
X			{
X		genlocrec(currseg, labelloc);
X		evalr[1].value = $2;
X		evalr[2].value = ( $4 & REGVALMASK);
X		locctr += geninstr(findgen($1, ST_MOV10,  ($4 & REGSEL_ALL)));
X			}
X	;
Xgenline : KOC_mov  expr ',' '#' expr
X			{
X		genlocrec(currseg, labelloc);
X		pevalexpr(1,$2);
X		pevalexpr(2,$5);
X		locctr += geninstr(findgen($1, ST_MOV11,  0));
X			}
X	;
Xgenline : KOC_mov  expr ',' '@' REG
X			{
X		genlocrec(currseg, labelloc);
X		pevalexpr(1,$2);
X		evalr[2].value = ( $5 & REGVALMASK);
X		locctr += geninstr(findgen($1, ST_MOV12,  ($5 & REGSEL_ALL)));
X			}
X	;
Xgenline : KOC_mov  expr ',' REG
X			{
X		genlocrec(currseg, labelloc);
X		pevalexpr(1,$2);
X		evalr[2].value = ($4 & REGVALMASK);
X		locctr += geninstr(findgen($1, ST_MOV13,  ($4 & REGSEL_ALL)));
X			}
X	;
Xgenline : KOC_mov  expr ',' expr
X			{
X		genlocrec(currseg, labelloc);
X		pevalexpr(1,$2);
X		pevalexpr(2,$4);
X		locctr += geninstr(findgen($1, ST_MOV14,  0));
X			}
X	;
Xgenline : KOC_cjne  REG ',' expr ',' expr
X			{
X		genlocrec(currseg, labelloc);
X		evalr[1].value = ( $2 & REGVALMASK);
X		pevalexpr(2,$4);
X		pevalexpr(3,$6);
X		locctr += geninstr(findgen($1, ST_CJNE1,  ($2 & REGSEL_ALL)));
X			}
X	;
Xgenline : KOC_cjne  REG ',' '#' expr ',' expr
X			{
X		genlocrec(currseg, labelloc);
X		evalr[1].value = ( $2 & REGVALMASK);
X		pevalexpr(2,$5);
X		pevalexpr(3,$7);
X		locctr += geninstr(findgen($1, ST_CJNE2,  ($2 & REGSEL_ALL)));
X			}
X	;
Xgenline : KOC_cjne  '@' REG ',' '#' expr ',' expr
X			{
X		genlocrec(currseg, labelloc);
X		evalr[1].value = ( $3 & REGVALMASK);
X		pevalexpr(2,$6);
X		pevalexpr(3,$8);
X		locctr += geninstr(findgen($1, ST_CJNE3,  ($3 & REGSEL_ALL)));
X			}
X	;
Xbit	:	expr '.' CONSTANT
X		{
X			int	bitaddr;
X
X			pevalexpr(0, $1);
X			if(evalr[0].seg == SSG_ABS)
X			{
X				switch((int)(evalr[0].value))
X				{
X				case 0x20:
X				case 0x21:
X				case 0x22:
X				case 0x23:
X				case 0x24:
X				case 0x25:
X				case 0x26:
X				case 0x27:
X				case 0x28:
X				case 0x29:
X				case 0x2a:
X				case 0x2b:
X				case 0x2c:
X				case 0x2d:
X				case 0x2e:
X				case 0x2f:
X					bitaddr = (evalr[0].value - 0x20)
X							<< 3;
X					break;
X
X				case 0x80:
X				case 0x88:
X				case 0x90:
X				case 0x98:
X				case 0xa0:
X				case 0xa8:
X				case 0xb0:
X				case 0xb8:
X				case 0xc0:
X				case 0xc8:
X				case 0xd0:
X				case 0xd8:
X				case 0xe0:
X				case 0xe8:
X				case 0xf0:
X				case 0xf8:
X					bitaddr = evalr[0].value;
X					break;
X
X				default:
X					fraerror(
X					"location is not bit addressable");
X					evalr[0].value = 0;
X					break;
X				}
X			}
X			else
X			{
X				fraerror(
X			"noncomputable expression in bit address");	
X				evalr[0].value = 0;
X			}
X			
X			if($3 < 0 || $3 > 7)
X			{
X				fraerror("bit number invalid");
X			}
X
X			$$ = bitaddr + $3;
X		}
X	;
X
Xexpr	:	'+' 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	|	'(' expr ')'
X			{
X				$$ = $2;
X			}
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", REG, REGSEL_ACC);
X	reservedsym("ab", REG, REGSEL_AB);
X	reservedsym("c", REG, REGSEL_C);
X	reservedsym("dptr", REG, REGSEL_DPTR);
X	reservedsym("pc", REG, REGSEL_PC);
X	reservedsym("r0", REG, REGSEL_R01|REGSEL_R07|0);
X	reservedsym("r1", REG, REGSEL_R01|REGSEL_R07|1);
X	reservedsym("r2", REG, REGSEL_R07|2);
X	reservedsym("r3", REG, REGSEL_R07|3);
X	reservedsym("r4", REG, REGSEL_R07|4);
X	reservedsym("r5", REG, REGSEL_R07|5);
X	reservedsym("r6", REG, REGSEL_R07|6);
X	reservedsym("r7", REG, REGSEL_R07|7);
X
X	reservedsym("A", REG, REGSEL_ACC);
X	reservedsym("AB", REG, REGSEL_AB);
X	reservedsym("C", REG, REGSEL_C);
X	reservedsym("DPTR", REG, REGSEL_DPTR);
X	reservedsym("PC", REG, REGSEL_PC);
X	reservedsym("R0", REG, REGSEL_R01|REGSEL_R07|0);
X	reservedsym("R1", REG, REGSEL_R01|REGSEL_R07|1);
X	reservedsym("R2", REG, REGSEL_R07|2);
X	reservedsym("R3", REG, REGSEL_R07|3);
X	reservedsym("R4", REG, REGSEL_R07|4);
X	reservedsym("R5", REG, REGSEL_R07|5);
X	reservedsym("R6", REG, REGSEL_R07|6);
X	reservedsym("R7", REG, REGSEL_R07|7);
X
X}
X
Xcpumatch(str)
X	char * str;
X{
X	return TRUE;
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 68
X#define NUMSYNBLK 107
X#define NUMDIFFOP 125
X
Xint gnumopcode = NUMOPCODE;
X
Xint ophashlnk[NUMOPCODE];
X
Xstruct opsym optab[NUMOPCODE+1]
X	= {
X	{"invalid", KOC_opcode, 2, 0 },
X	{"ACALL", KOC_opcode, 1, 2 },
X	{"ADD", KOC_aluop, 4, 3 },
X	{"ADDC", KOC_aluop, 4, 7 },
X	{"AJMP", KOC_opcode, 1, 11 },
X	{"ANL", KOC_aluop, 9, 12 },
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	{"CJNE", KOC_cjne, 3, 21 },
X	{"CLR", KOC_opcode, 3, 24 },
X	{"CPL", KOC_opcode, 3, 27 },
X	{"DA", KOC_opcode, 1, 30 },
X	{"DB", KOC_BDEF, 0, 0 },
X	{"DEC", KOC_opcode, 3, 31 },
X	{"DIV", KOC_opcode, 1, 34 },
X	{"DJNZ", KOC_aluop, 2, 35 },
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	{"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, 37 },
X	{"INCL", KOC_INCLUDE, 0, 0 },
X	{"INCLUDE", KOC_INCLUDE, 0, 0 },
X	{"JB", KOC_aluop, 2, 40 },
X	{"JBC", KOC_aluop, 2, 42 },
X	{"JC", KOC_opcode, 1, 44 },
X	{"JMP", KOC_opcode, 1, 45 },
X	{"JNB", KOC_aluop, 2, 46 },
X	{"JNC", KOC_opcode, 1, 48 },
X	{"JNZ", KOC_opcode, 1, 49 },
X	{"JZ", KOC_opcode, 1, 50 },
X	{"LCALL", KOC_opcode, 1, 51 },
X	{"LJMP", KOC_opcode, 1, 52 },
X	{"MOV", KOC_mov, 13, 53 },
X	{"MOVC", KOC_mov, 1, 66 },
X	{"MOVX", KOC_mov, 2, 67 },
X	{"MUL", KOC_opcode, 1, 69 },
X	{"NOP", KOC_opcode, 1, 70 },
X	{"ORG", KOC_ORG, 0, 0 },
X	{"ORL", KOC_aluop, 9, 71 },
X	{"POP", KOC_opcode, 1, 80 },
X	{"PUSH", KOC_opcode, 1, 81 },
X	{"RESERVE", KOC_RESM, 0, 0 },
X	{"RET", KOC_opcode, 1, 82 },
X	{"RETI", KOC_opcode, 1, 83 },
X	{"RL", KOC_opcode, 1, 84 },
X	{"RLC", KOC_opcode, 1, 85 },
X	{"RMB", KOC_RESM, 0, 0 },
X	{"RR", KOC_opcode, 1, 86 },
X	{"RRC", KOC_opcode, 1, 87 },
X	{"SET", KOC_SET, 0, 0 },
X	{"SETB", KOC_opcode, 3, 88 },
X	{"SJMP", KOC_opcode, 1, 91 },
X	{"STRING", KOC_SDEF, 0, 0 },
X	{"SUBB", KOC_aluop, 4, 92 },
X	{"SWAP", KOC_opcode, 1, 96 },
X	{"WORD", KOC_WDEF, 0, 0 },
X	{"XCH", KOC_aluop, 3, 97 },
X	{"XCHD", KOC_aluop, 1, 100 },
X	{"XRL", KOC_aluop, 6, 101 },
X	{ "", 0, 0, 0 }};
X
Xstruct opsynt ostab[NUMSYNBLK+1]
X	= {
X/* invalid 0 */ { 0, 1, 0 },
X/* invalid 1 */ { 0xffff, 1, 1 },
X/* ACALL 2 */ { ST_UOP04, 1, 2 },
X/* ADD 3 */ { ST_ALU01, 1, 3 },
X/* ADD 4 */ { ST_ALU03, 1, 4 },
X/* ADD 5 */ { ST_ALU04, 1, 5 },
X/* ADD 6 */ { ST_ALU06, 1, 6 },
X/* ADDC 7 */ { ST_ALU01, 1, 7 },
X/* ADDC 8 */ { ST_ALU03, 1, 8 },
X/* ADDC 9 */ { ST_ALU04, 1, 9 },
X/* ADDC 10 */ { ST_ALU06, 1, 10 },
X/* AJMP 11 */ { ST_UOP04, 1, 11 },
X/* ANL 12 */ { ST_ALU01, 1, 12 },
X/* ANL 13 */ { ST_ALU02, 1, 13 },
X/* ANL 14 */ { ST_ALU02E, 1, 14 },
X/* ANL 15 */ { ST_ALU03, 1, 15 },
X/* ANL 16 */ { ST_ALU04, 1, 16 },
X/* ANL 17 */ { ST_ALU05, 1, 17 },
X/* ANL 18 */ { ST_ALU06, 2, 18 },
X/* ANL 19 */ { ST_ALU08, 1, 20 },
X/* ANL 20 */ { ST_ALU09, 1, 21 },
X/* CJNE 21 */ { ST_CJNE1, 1, 22 },
X/* CJNE 22 */ { ST_CJNE2, 2, 23 },
X/* CJNE 23 */ { ST_CJNE3, 1, 25 },
X/* CLR 24 */ { ST_UOP02, 2, 26 },
X/* CLR 25 */ { ST_UOP03, 1, 28 },
X/* CLR 26 */ { ST_UOP04, 1, 29 },
X/* CPL 27 */ { ST_UOP02, 2, 30 },
X/* CPL 28 */ { ST_UOP03, 1, 32 },
X/* CPL 29 */ { ST_UOP04, 1, 33 },
X/* DA 30 */ { ST_UOP02, 1, 34 },
X/* DEC 31 */ { ST_UOP01, 1, 35 },
X/* DEC 32 */ { ST_UOP02, 2, 36 },
X/* DEC 33 */ { ST_UOP04, 1, 38 },
X/* DIV 34 */ { ST_UOP02, 1, 39 },
X/* DJNZ 35 */ { ST_ALU06, 1, 40 },
X/* DJNZ 36 */ { ST_ALU10, 1, 41 },
X/* INC 37 */ { ST_UOP01, 1, 42 },
X/* INC 38 */ { ST_UOP02, 3, 43 },
X/* INC 39 */ { ST_UOP04, 1, 46 },
X/* JB 40 */ { ST_ALU07, 1, 47 },
X/* JB 41 */ { ST_ALU10, 1, 48 },
X/* JBC 42 */ { ST_ALU07, 1, 49 },
X/* JBC 43 */ { ST_ALU10, 1, 50 },
X/* JC 44 */ { ST_UOP04, 1, 51 },
X/* JMP 45 */ { ST_UOP05, 1, 52 },
X/* JNB 46 */ { ST_ALU07, 1, 53 },
X/* JNB 47 */ { ST_ALU10, 1, 54 },
X/* JNC 48 */ { ST_UOP04, 1, 55 },
X/* JNZ 49 */ { ST_UOP04, 1, 56 },
X/* JZ 50 */ { ST_UOP04, 1, 57 },
X/* LCALL 51 */ { ST_UOP04, 1, 58 },
X/* LJMP 52 */ { ST_UOP04, 1, 59 },
X/* MOV 53 */ { ST_MOV01, 1, 60 },
X/* MOV 54 */ { ST_MOV02, 1, 61 },
X/* MOV 55 */ { ST_MOV03, 1, 62 },
X/* MOV 56 */ { ST_MOV04, 3, 63 },
X/* MOV 57 */ { ST_MOV05, 1, 66 },
X/* MOV 58 */ { ST_MOV07, 2, 67 },
X/* MOV 59 */ { ST_MOV08, 1, 69 },
X/* MOV 60 */ { ST_MOV09, 3, 70 },
X/* MOV 61 */ { ST_MOV10, 1, 73 },
X/* MOV 62 */ { ST_MOV11, 1, 74 },
X/* MOV 63 */ { ST_MOV12, 1, 75 },
X/* MOV 64 */ { ST_MOV13, 3, 76 },
X/* MOV 65 */ { ST_MOV14, 1, 79 },
X/* MOVC 66 */ { ST_MOV06, 2, 80 },
X/* MOVX 67 */ { ST_MOV02, 2, 82 },
X/* MOVX 68 */ { ST_MOV05, 2, 84 },
X/* MUL 69 */ { ST_UOP02, 1, 86 },
X/* NOP 70 */ { ST_INH, 1, 87 },
X/* ORL 71 */ { ST_ALU01, 1, 88 },
X/* ORL 72 */ { ST_ALU02, 1, 89 },
X/* ORL 73 */ { ST_ALU02E, 1, 90 },
X/* ORL 74 */ { ST_ALU03, 1, 91 },
X/* ORL 75 */ { ST_ALU04, 1, 92 },
X/* ORL 76 */ { ST_ALU05, 1, 93 },
X/* ORL 77 */ { ST_ALU06, 2, 94 },
X/* ORL 78 */ { ST_ALU08, 1, 96 },
X/* ORL 79 */ { ST_ALU09, 1, 97 },
X/* POP 80 */ { ST_UOP04, 1, 98 },
X/* PUSH 81 */ { ST_UOP04, 1, 99 },
X/* RET 82 */ { ST_INH, 1, 100 },
X/* RETI 83 */ { ST_INH, 1, 101 },
X/* RL 84 */ { ST_UOP02, 1, 102 },
X/* RLC 85 */ { ST_UOP02, 1, 103 },
X/* RR 86 */ { ST_UOP02, 1, 104 },
X/* RRC 87 */ { ST_UOP02, 1, 105 },
X/* SETB 88 */ { ST_UOP02, 1, 106 },
X/* SETB 89 */ { ST_UOP03, 1, 107 },
X/* SETB 90 */ { ST_UOP04, 1, 108 },
X/* SJMP 91 */ { ST_UOP04, 1, 109 },
X/* SUBB 92 */ { ST_ALU01, 1, 110 },
X/* SUBB 93 */ { ST_ALU03, 1, 111 },
X/* SUBB 94 */ { ST_ALU04, 1, 112 },
X/* SUBB 95 */ { ST_ALU06, 1, 113 },
X/* SWAP 96 */ { ST_UOP02, 1, 114 },
X/* XCH 97 */ { ST_ALU03, 1, 115 },
X/* XCH 98 */ { ST_ALU04, 1, 116 },
X/* XCH 99 */ { ST_ALU06, 1, 117 },
X/* XCHD 100 */ { ST_ALU03, 1, 118 },
X/* XRL 101 */ { ST_ALU01, 1, 119 },
X/* XRL 102 */ { ST_ALU03, 1, 120 },
X/* XRL 103 */ { ST_ALU04, 1, 121 },
X/* XRL 104 */ { ST_ALU06, 1, 122 },
X/* XRL 105 */ { ST_ALU08, 1, 123 },
X/* XRL 106 */ { ST_ALU09, 1, 124 },
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/* ACALL 2 */   { 0 , 0, 
X		"[1=].Q.2+.f800&-.bI~.3}.e0&.11|;!.ff&;" },
X/* ADD 3 */   { REGSEL_ACC , REGSEL_ACC, 
X		"24;[2=];" },
X/* ADD 4 */   { REGSEL_ACC|REG2SEL_R01 , REGSEL_ACC|REG2SEL_R01, 
X		"26.[2#]|;" },
X/* ADD 5 */   { REGSEL_ACC|REG2SEL_R07 , REGSEL_ACC|REG2SEL_R07, 
X		"28.[2#]|;" },
X/* ADD 6 */   { REGSEL_ACC , REGSEL_ACC, 
X		"25;[2=].8I;" },
X/* ADDC 7 */   { REGSEL_ACC , REGSEL_ACC, 
X		"34;[2=];" },
X/* ADDC 8 */   { REGSEL_ACC|REG2SEL_R01 , REGSEL_ACC|REG2SEL_R01, 
X		"36.[2#]|;" },
X/* ADDC 9 */   { REGSEL_ACC|REG2SEL_R07 , REGSEL_ACC|REG2SEL_R07, 
X		"38.[2#]|;" },
X/* ADDC 10 */   { REGSEL_ACC , REGSEL_ACC, 
X		"35;[2=].8I;" },
X/* AJMP 11 */   { 0 , 0, 
X		"[1=].Q.2+.f800&-.bI~.3}.e0&.01|;!.ff&;" },
X/* ANL 12 */   { REGSEL_ACC , REGSEL_ACC, 
X		"54;[2=];" },
X/* ANL 13 */   { REGSEL_C , REGSEL_C, 
X		"b0;[2#];" },
X/* ANL 14 */   { REGSEL_C , REGSEL_C, 
X		"b0;[2=].8I;" },
X/* ANL 15 */   { REGSEL_ACC|REG2SEL_R01 , REGSEL_ACC|REG2SEL_R01, 
X		"56.[2#]|;" },
X/* ANL 16 */   { REGSEL_ACC|REG2SEL_R07 , REGSEL_ACC|REG2SEL_R07, 
X		"58.[2#]|;" },
X/* ANL 17 */   { REGSEL_C , REGSEL_C, 
X		"82;[2#];" },
X/* ANL 18 */   { REGSEL_ACC , REGSEL_ACC, 
X		"55;[2=].8I;" },
X/* ANL 19 */   { REGSEL_C , REGSEL_C, 
X		"82;[2=].8I;" },
X/* ANL 20 */   { 0 , 0, 
X		"53;[1=].8I;[2=];" },
X/* ANL 21 */   { REGSEL_ACC , REGSEL_ACC, 
X		"52;[1=].8I;" },
X/* CJNE 22 */   { REGSEL_ACC , REGSEL_ACC, 
X		"b5;[2=].8I;[3=].Q.1+-r" },
X/* CJNE 23 */   { REGSEL_ACC , REGSEL_ACC, 
X		"b4;[2=];[3=].Q.1+-r" },
X/* CJNE 24 */   { REGSEL_R07 , REGSEL_R07, 
X		"b8.[1#]|;[2=];[3=].Q.1+-r" },
X/* CJNE 25 */   { REGSEL_R01 , REGSEL_R01, 
X		"b6.[1#]|;[2=];[3=].Q.1+-r" },
X/* CLR 26 */   { REGSEL_ACC , REGSEL_ACC, 
X		"e4;" },
X/* CLR 27 */   { REGSEL_C , REGSEL_C, 
X		"c3;" },
X/* CLR 28 */   { 0 , 0, 
X		"c2;[1#];" },
X/* CLR 29 */   { 0 , 0, 
X		"c2;[1=].8I;" },
X/* CPL 30 */   { REGSEL_ACC , REGSEL_ACC, 
X		"f4;" },
X/* CPL 31 */   { REGSEL_C , REGSEL_C, 
X		"b3;" },
X/* CPL 32 */   { 0 , 0, 
X		"b2;[1#];" },
X/* CPL 33 */   { 0 , 0, 
X		"b2;[1=].8I;" },
X/* DA 34 */   { REGSEL_ACC , REGSEL_ACC, 
X		"d4;" },
X/* DEC 35 */   { REGSEL_R01 , REGSEL_R01, 
X		"16.[1#]|;" },
X/* DEC 36 */   { REGSEL_ACC , REGSEL_ACC, 
X		"14;" },
X/* DEC 37 */   { REGSEL_R07 , REGSEL_R07, 
X		"18.[1#]|;" },
X/* DEC 38 */   { 0 , 0, 
X		"15;[1=].8I;" },
X/* DIV 39 */   { REGSEL_AB , REGSEL_AB, 
X		"84;" },
X/* DJNZ 40 */   { REGSEL_R07 , REGSEL_R07, 
X		"d8.[1#]|;[2=].Q.1+-r" },
X/* DJNZ 41 */   { 0 , 0, 
X		"d5;[1=].8I;[2=].Q.1+-r" },
X/* INC 42 */   { REGSEL_R01 , REGSEL_R01, 
X		"06.[1#]|;" },
X/* INC 43 */   { REGSEL_ACC , REGSEL_ACC, 
X		"04;" },
X/* INC 44 */   { REGSEL_R07 , REGSEL_R07, 
X		"08.[1#]|;" },
X/* INC 45 */   { REGSEL_DPTR , REGSEL_DPTR, 
X		"a3;" },
X/* INC 46 */   { 0 , 0, 
X		"05;[1=].8I;" },
X/* JB 47 */   { 0 , 0, 
X		"20;[1#];[2=].Q.1+-r" },
X/* JB 48 */   { 0 , 0, 
X		"20;[1=].8I;[2=].Q.1+-r" },
X/* JBC 49 */   { 0 , 0, 
X		"10;[1#];[2=].Q.1+-r" },
X/* JBC 50 */   { 0 , 0, 
X		"10;[1=].8I;[2=].Q.1+-r" },
X/* JC 51 */   { 0 , 0, 
X		"40;[1=].Q.1+-r" },
X/* JMP 52 */   { REGSEL_ACC|REG2SEL_DPTR , REGSEL_ACC|REG2SEL_DPTR, 
X		"73;" },
X/* JNB 53 */   { 0 , 0, 
X		"30;[1#];[2=].Q.1+-r" },
X/* JNB 54 */   { 0 , 0, 
X		"30;[1=].8I;[2=].Q.1+-r" },
X/* JNC 55 */   { 0 , 0, 
X		"50;[1=].Q.1+-r" },
X/* JNZ 56 */   { 0 , 0, 
X		"70;[1=].Q.1+-r" },
X/* JZ 57 */   { 0 , 0, 
X		"60;[1=].Q.1+-r" },
X/* LCALL 58 */   { 0 , 0, 
X		"12;[1=]x" },
X/* LJMP 59 */   { 0 , 0, 
X		"02;[1=]x" },
X/* MOV 60 */   { REGSEL_R01 , REGSEL_R01, 
X		"76.[1#]|;[2=];" },
X/* MOV 61 */   { REGSEL_R01|REG2SEL_ACC , REGSEL_R01|REG2SEL_ACC, 
X		"f6.[1#]|;" },
X/* MOV 62 */   { REGSEL_R01 , REGSEL_R01, 
X		"a6.[1#]|;[2=].8I;" },
X/* MOV 63 */   { REGSEL_ACC , REGSEL_ACC, 
X		"74;[2=];" },
X/* MOV 64 */   { REGSEL_DPTR , REGSEL_DPTR, 
X		"90;[2=]x" },
X/* MOV 65 */   { REGSEL_R07 , REGSEL_R07, 
X		"78.[1#]|;[2=];" },
X/* MOV 66 */   { REGSEL_ACC|REG2SEL_R01 , REGSEL_ACC|REG2SEL_R01, 
X		"e6.[2#]|;" },
X/* MOV 67 */   { REGSEL_ACC|REG2SEL_R07 , REGSEL_ACC|REG2SEL_R07, 
X		"e8.[2#]|;" },
X/* MOV 68 */   { REGSEL_R07|REG2SEL_ACC , REGSEL_R07|REG2SEL_ACC, 
X		"f8.[1#]|;" },
X/* MOV 69 */   { REGSEL_C , REGSEL_C, 
X		"a2;[2#];" },
X/* MOV 70 */   { REGSEL_ACC , REGSEL_ACC, 
X		"e5;[2=].8I;" },
X/* MOV 71 */   { REGSEL_C , REGSEL_C, 
X		"a2;[2=].8I;" },
X/* MOV 72 */   { REGSEL_R07 , REGSEL_R07, 
X		"a8.[1#]|;[2=].8I;" },
X/* MOV 73 */   { REGSEL_C , REGSEL_C, 
X		"92;[1#];" },
X/* MOV 74 */   { 0 , 0, 
X		"75;[1=].8I;[2=];" },
X/* MOV 75 */   { REGSEL_R01 , REGSEL_R01, 
X		"86.[2#]|;[1=].8I;" },
X/* MOV 76 */   { REGSEL_ACC , REGSEL_ACC, 
X		"f5;[1=].8I;" },
X/* MOV 77 */   { REGSEL_C , REGSEL_C, 
X		"92;[1=].8I;" },
X/* MOV 78 */   { REGSEL_R07 , REGSEL_R07, 
X		"88.[2#]|;[1=].8I;" },
X/* MOV 79 */   { 0 , 0, 
X		"85;[2=].8I;[1=].8I;" },
X/* MOVC 80 */   { REGSEL_ACC|REG2SEL_DPTR , REGSEL_ACC|REG2SEL_DPTR, 
X		"93;" },
X/* MOVC 81 */   { REGSEL_ACC|REG2SEL_PC , REGSEL_ACC|REG2SEL_PC, 
X		"83;" },
X/* MOVX 82 */   { REGSEL_DPTR|REG2SEL_ACC , REGSEL_DPTR|REG2SEL_ACC, 
X		"f0;" },
X/* MOVX 83 */   { REGSEL_R01|REG2SEL_ACC , REGSEL_R01|REG2SEL_ACC, 
X		"f2.[1#]|;" },
X/* MOVX 84 */   { REGSEL_ACC|REG2SEL_DPTR , REGSEL_ACC|REG2SEL_DPTR, 
X		"e0;" },
X/* MOVX 85 */   { REGSEL_ACC|REG2SEL_R01 , REGSEL_ACC|REG2SEL_R01, 
X		"e2.[2#]|;" },
X/* MUL 86 */   { REGSEL_AB , REGSEL_AB, 
X		"a4;" },
X/* NOP 87 */   { 0 , 0, 
X		"00;" },
X/* ORL 88 */   { REGSEL_ACC , REGSEL_ACC, 
X		"44;[2=];" },
X/* ORL 89 */   { REGSEL_C , REGSEL_C, 
X		"a0;[2#];" },
X/* ORL 90 */   { REGSEL_C , REGSEL_C, 
X		"a0;[2=].8I;" },
X/* ORL 91 */   { REGSEL_ACC|REG2SEL_R01 , REGSEL_ACC|REG2SEL_R01, 
X		"46.[2#]|;" },
X/* ORL 92 */   { REGSEL_ACC|REG2SEL_R07 , REGSEL_ACC|REG2SEL_R07, 
X		"48.[2#]|;" },
X/* ORL 93 */   { REGSEL_C , REGSEL_C, 
X		"72;[2#];" },
X/* ORL 94 */   { REGSEL_ACC , REGSEL_ACC, 
X		"45;[2=].8I;" },
X/* ORL 95 */   { REGSEL_C , REGSEL_C, 
X		"72;[2=].8I;" },
X/* ORL 96 */   { 0 , 0, 
X		"43;[1=].8I;[2=];" },
X/* ORL 97 */   { REGSEL_ACC , REGSEL_ACC, 
X		"42;[1=].8I;" },
X/* POP 98 */   { 0 , 0, 
X		"d0;[1=].8I;" },
X/* PUSH 99 */   { 0 , 0, 
X		"c0;[1=].8I;" },
X/* RET 100 */   { 0 , 0, 
X		"22;" },
X/* RETI 101 */   { 0 , 0, 
X		"32;" },
X/* RL 102 */   { REGSEL_ACC , REGSEL_ACC, 
X		"23;" },
X/* RLC 103 */   { REGSEL_ACC , REGSEL_ACC, 
X		"33;" },
X/* RR 104 */   { REGSEL_ACC , REGSEL_ACC, 
X		"03;" },
X/* RRC 105 */   { REGSEL_ACC , REGSEL_ACC, 
X		"13;" },
X/* SETB 106 */   { REGSEL_C , REGSEL_C, 
X		"d3;" },
X/* SETB 107 */   { 0 , 0, 
X		"d2;[1#];" },
X/* SETB 108 */   { 0 , 0, 
X		"d2;[1=].8I;" },
X/* SJMP 109 */   { 0 , 0, 
X		"80;[1=].Q.1+-r" },
X/* SUBB 110 */   { REGSEL_ACC , REGSEL_ACC, 
X		"94;[2=];" },
X/* SUBB 111 */   { REGSEL_ACC|REG2SEL_R01 , REGSEL_ACC|REG2SEL_R01, 
X		"96.[2#]|;" },
X/* SUBB 112 */   { REGSEL_ACC|REG2SEL_R07 , REGSEL_ACC|REG2SEL_R07, 
X		"98.[2#]|;" },
X/* SUBB 113 */   { REGSEL_ACC , REGSEL_ACC, 
X		"95;[2=].8I;" },
X/* SWAP 114 */   { REGSEL_ACC , REGSEL_ACC, 
X		"c4;" },
X/* XCH 115 */   { REGSEL_ACC|REG2SEL_R01 , REGSEL_ACC|REG2SEL_R01, 
X		"c6.[2#]|;" },
X/* XCH 116 */   { REGSEL_ACC|REG2SEL_R07 , REGSEL_ACC|REG2SEL_R07, 
X		"c8.[2#]|;" },
X/* XCH 117 */   { REGSEL_ACC , REGSEL_ACC, 
X		"c5;[2=].8I;" },
X/* XCHD 118 */   { REGSEL_ACC|REG2SEL_R01 , REGSEL_ACC|REG2SEL_R01, 
X		"d6.[2#]|;" },
X/* XRL 119 */   { REGSEL_ACC , REGSEL_ACC, 
X		"64;[2=];" },
X/* XRL 120 */   { REGSEL_ACC|REG2SEL_R01 , REGSEL_ACC|REG2SEL_R01, 
X		"66.[2#]|;" },
X/* XRL 121 */   { REGSEL_ACC|REG2SEL_R07 , REGSEL_ACC|REG2SEL_R07, 
X		"68.[2#]|;" },
X/* XRL 122 */   { REGSEL_ACC , REGSEL_ACC, 
X		"65;[2=].8I;" },
X/* XRL 123 */   { 0 , 0, 
X		"63;[1=].8I;[2=];" },
X/* XRL 124 */   { REGSEL_ACC , REGSEL_ACC, 
X		"62;[1=].8I;" },
X	{ 0,0,""} };
X/* end fraptabdef.c */
SHAR_EOF
true || echo 'restore of as8051.y failed'
fi
exit 0



More information about the Alt.sources mailing list