**********
* Program ARITH_8 (6811)
*
* Fragments illustrate use of ADD, SUB and MUL
*
* P. H. Anderson, MSU, 26 Sept 91
**********

PSCT	EQU  $C000
DSCT	EQU  $D000
IDSCT	EQU  $D300

STACKTP		EQU  $0045
REG_BASE	EQU $1000

PORTB	EQU  $04
PORTC	EQU  $03
DDRC	EQU  $07

	ORG PSCT

	LDS #STACKTP

*	Note this is a fragment with no I/O.  Assume locations
*	Q1 and Q2 have been loaded by some other means.

	LDAA Q1 	* add Q1 and Q2, any carry ignored
	ADDA Q2
	STAA R1 	* save in result R1

	LDAA Q1 	* R2 = Q1 - Q2
	SUBA Q2
	STAA R2

* Note that A and B form a double accumulator; A is upper, B is lower

	LDAA Q1 	* R3 = Q1 * Q2
	LDAB Q2
	MUL
	STD R3

	SWI

	ORG IDSCT

Q1	FCB 100
Q2	FCB 90

	ORG DSCT

R1	RMB 1
R2	RMB 1
R3	RMB 2


