*** dptosp
*	Double precision to single precision
*	for Alcyon C
*
*	long dptosp(d)
*	double d;
*
*	Copyright Atari Corp. 1987,1988
*
*	MDJohnson       2/15/88
***

	.include fpmacro

; dptosp(x)
	fpinit	dptosp
	fpidle			; wait for idle state
	move.w	#$5400,FPCMD		; x -> 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	#$0003,FPCMD		; FINTRZ FP0,FP0

	fpidle

	move.w	#$6400,FPCMD		; fp0 -> single
	ckcir	#$B104			; ready for single
	move.l	FPOP,d0			; get single
	rts

