.MCALL .MODULE .MODULE DIV60,VERSION=04,COMMENT=,IDENT=NO,LIB=YES ; 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. .SBTTL DIV60 AND DIVTK - SYSLIB service routines ; ; ; DIVIDES (R0,R1) BY 60, LEAVING THE REMAINDER IN R3. ; DESTROYS R4 ; CALLING SEQUENCE JSR PC,$DIV60 ; $DIVTK DOES SAME BUT WITH NUMBER OF TICKS IN SECOND ; $DIVNN DOES SAME BUT WITH NUMBER passed in R4 ; ; Input Output ; R0 high order dividend high order quotient ; R1 low order dividend low order quotient ; R2 ??? saved ; R3 ignored remainder ; R4 divisor ($DIVNN only) divisor (50., 60. or supplied) ; R5 ??? saved ; ; Quotient and divisor must be positive. ; Zero divisor is survived. ; ; MAS, JFW .PSECT SYS$I .GLOBL $GVAL .ENABL LSB $DIVTK::MOV #50.,R4 ;ASSUME A 50 CYCLE CLOCK MOV R0,-(SP) ;SAVE INPUT TO THIS SUBR MOV #300,R0 ;SEE IF WE HAVE A 50 OR 60 CYCLE CLOCK JSR PC,$GVAL ;GET CONFIG WORD VALUE IN R0 BIT #40,R0 ;LOOK IN CONFIG WORD BNE 40$ ;BRANCH 50 CYCLE CLOCK ASSUMPTION RIGHT MOV (SP)+,R0 $DIV60::MOV #60.,R4 ;SET FOR DIVIDE BY 60 $DIVNN:: 10$: CLR R3 ;ZERO REMAINDER MOV #32.,-(SP) ;BIT COUNT 20$: ASL R1 ;STANDARD SHIFT-AND-SUBTRACT ROL R0 ;DIVISION ROL R3 CMP R3,R4 BLO 30$ SUB R4,R3 INC R1 30$: DEC @SP BNE 20$ TST (SP)+ ;REMOVE 0 FROM STACK RETURN 40$: MOV (SP)+,R0 ;RESTORE IT BR 10$ .DSABL LSB .END