*** ldexp.s
* 	Double Precision ldexp
*	for Alcyon C
*
*	double ldexp(d,exp)
*	double d;
*	int exp;
*
*	Copyright Atari Corp. 1987,1988
*
*	MDJohnson       2/15/88
***

	.include fpmacro

; ldexp(x,y)
	fpinit	ldexp
	fpidle				; wait for idle state
	move.w	#$5011,FPCMD		; 2 ^ y -> fp0
	ckcir	#$9502			; ready for word
	move.w	12(sp),FPOP		; write word 

	fpidle				; wait for idle state
	move.w	#$5423,FPCMD		; x * (2 ^ y) -> fp0
	ckcir	#$9608			; ready for double
	move.l	4(sp),FPOP		; write first half
	move.l	8(sp),FPOP		; write second half

	fpidle				; wait for idle state
	move.w	#$7400,FPCMD		; fp0 -> double
	ckcir	#$B208			; ready for double
	move.l	FPOP,d0			; get double
	move.l	FPOP,d1
	rts

