;-------------------------fptdiv routine begins--------------------------+
; from BLUEBOOK OF ASSEMBLY ROUTINES FOR IBM PC & XT.
;         page : 86
;
; NAME FPTDIV
; ROUTINE FOR DIVISION OF TEMPORARY FLOATING POINT NUMBER BY 10
;
; FUNCTION: This routine divides a temporary binary floating point
; number by 10.
;
; INPUT: Upon entry DS:DI points to a temporary binary floating point
; number.
;
; OUTPUT: Upon exit DS:DI points to a temporary binary floating
; point number.
;
; REGISTERS USED:  AX,CX,DX and DI are modified.  DI must point to the
; input.
;
; SEGMENTS REFERENCED:  The data segment must contain the temporary
; binary floating point number.
;
; ROUTINES CALLED:  None
; SPECIAL NOTES: Equates are used to shorten address fields.  This is a
; near procedure needed by FPIN.
;
; ROUTINE TO DIVIDE TEMP FLOATING POINT NUMBER BY 10.  RESULT IS NOT
; NORMALIZED.
;
fptdiv	proc	near
;
; shift mantissa by 4 places
	mov	cx,4		; for a count of four
fptdiv1:
	sal	diword+0,1	; shift left all digits
	rcl	diword+2,1	; carry on
	rcl	diword+4,1
	rcl	diword+6,1
	rcl	diword+8,1
	dec	diword+11	
	loop	fptdiv1
;
; divide mantissa by 10
	mov	cx,5		; 5 words in number
	mov	dx,0		; previous remainder
	add	di,8		; point to end
;
fptdiv2:
	push	cx		; save count
	mov	ax,[di]		; get 16-bit digit
	mov	cx,10		; divisor of 10
	div	cx		; divide
	mov	[di],ax		; put 16-digit back
	sub	di,2		; next 16-bit digit
	pop	cx		; restore count
	loop	fptdiv2
;
	ret			; return
;	
fptdiv	endp
;-------------------------fptdiv routine ends---------------------------+
