*****************
* Program DIVIDE (68HC11)
*
* Illustrates 16 bit divide.
*
* Dividend / divisor = integer_result plus fractional_result.
*
* Note that DIVDEND and DIVISOR must be intialized prior to
* execution.  Division by zero results in ffffh.
*
* Test cases:
*
*	f000 / 0002  =	7800.0000
*	0000 / 0002  =	0000.0000
*	0000 / 0000  =	ffff.ffff
*	ffff / 0003  =	5555.0000
*	fffe / 0003  =	5554.aaaa
*
* P. H. Anderson, MSU, 10 Jan 89, Checked 10 Jan 89; 18 Jan 93
*****************

PSCT	EQU $C000
DSCT	EQU $D000
IDSCT	EQU $D300

REG_BASE	EQU $1000
STACKTP 	EQU $0045

	ORG PSCT

	LDS #STACKTP	;initialize stack pointer

	LDD DIVIDEND
	LDX DIVISOR

	IDIV		;D/X = X (int result)
*			;    + D (remainder)

	STX I_RES	;save integer result

	LDX DIVISOR

	FDIV		;D/X = X (fract result)
*			;    + D (remainder)
	STX F_RES

	SWI

	ORG DSCT

I_RES	RMB 2
F_RES	RMB 2

	ORG IDSCT

DIVIDEND	FDB 1000
DIVISOR		FDB 50

