;-------------------------decnorm routine begins--------------------------+
; from BLUEBOOK OF ASSEMBLY ROUTINES FOR IBM PC & XT.
;         page : 99
;
; NAME  DECNORM
;
; ROUTINE FOR Normalization of Temporary Decimal Floating Point
;
; FUNCTION: This routine normalizes a temporary decimal floating point
; nuumber.
;
; INPUT: Upon entry DS:DI points to a temporary decimal floating point
; number.
;
; OUTPUT: Upon exit the temporary floating point number is normalized.
;
; REGISTERS USED:  AX, CX, and DI are modified.
;
; SEGMENTS REFERENCED:  The data segment contains storage for a temporary
; decimal floating point number
;
; ROUTINES CALLED:  None
;
; SPECIAL NOTES: Equates are used to shorten address fields.
;
decnorm	proc	near
;
; check top + 1 digit
	cmp	dibyte+22,0	; is it already zero ?
	je	decnorm2	; if so exit
;
; round up starting with bottom digit
	mov	al,[di]		; first digit
	add	al,al		; double it for roundup
	mov	ah,0		; prepare carry
	aaa			; adjust for decimal
;
; now shift the rest
	mov	cx,24		; for a count of 24
decnorm1:
	mov	al,[di+1]	; get next digit
	add	al,ah		; add carry
	mov	ah,0		; prepare next carry
	aaa			; adjust for decimal
	mov	[di],al		; put digit into place
	inc	di		; point to next digit
	loop	decnorm1
;
	inc	deexp		; incrememt decimal exponent
;
decnorm2:
;
	ret			; return
;
decnorm	endp
;-------------------------decnorm routine ends---------------------------+
