.NLIST TOC,SYM .TITLE $DDIV .SBTTL ULBLIB 037 - Double Precision Divide .IDENT \V01.00\ .PSECT .LIBC. .ENABL LC,GBL ; Copyright (c) 1998 by Mentec, Inc., Nashua, NH. ; All rights reserved ; ; This software is furnished under a license for use only on a ; single computer system and may be copied only with the ; inclusion of the above copyright notice. This software, or ; any other copies thereof, may not be provided or otherwise ; made available to any other person except for use on such ; system and to one who agrees to these license terms. Title ; to and ownership of the software shall at all times remain ; in Mentec, Inc. ; ; The information in this document is subject to change without ; notice and should not be construed as a commitment by Digital ; Equipment Corporation, or Mentec, Inc. ; ; Digital and Mentec assume no responsibility for the use or ; reliability of its software on equipment which is not supplied ; by Digital or Mentec, and listed in the Software Product ; Description. ;+ ; $DDIV ; This routine divides a double precision dividend by a single precision ; divisor yielding a double precision quotient and a single precision ; remainder. All are unsigned. ; ; R0 = single precision divisor ; R1 = hi-order part of double precision dividend ; R2 = lo-order part of double precision dividend ; ; JSR PC,$DDIV ; ; R0 = single precision remainder ; R1 = hi-order part of double precision quotient ; R2 = lo-order part of double precision quotient ;- $DDIV:: MOV R3,-(SP) ;Save R3 MOV #32.,R3 ;Set iteration count in R3 MOV R0,-(SP) ;Put divisor on stack CLR R0 ;Set remainder to zero 1$: ASL R2 ;Shift the entire dividend... ROL R1 ;... one bit to the left and ... ROL R0 ;... into the remainder CMP R0,(SP) ;Is remainder .GE. divisor? BLO 2$ ;No, skip to iteration control SUB (SP),R0 ;Yes, subtract divisor out INC R2 ; and increment the quotient 2$: DEC R3 ;Repeat as long as necessary BGT 1$ ; TST (SP)+ ;Purge divisor from stack MOV (SP)+,R3 ;Restore R3 RETURN .END