Google
 

Trailing-Edge - PDP-10 Archives - decuslib20-06 - decus/20-153/div11.mac
There are 7 other files named div11.mac in the archive. Click here to see a list.
TITLE	DIV11 FOR RPGLIB %1
SUBTTL	SINGLE-PRECISION DIVIDE		AL BLACKINGTON/CAM/RBC

;USED TO BE
;COPYRIGHT 1974, DIGITAL EQUIPMENT CORP., MAYNARD, MA.
;BUT CONVERTED TO RPGII VERSION 24-NOV-75

	HISEG

ENTRY DIV.11

;CALLING SEQUENCE:
;	MOVE	16,[Z AC,OPERAND]
;	PUSHJ	17,DIV.11

;ENTER WITH DIVIDEND IN ACCUMULATOR AC.
;EXIT WITH QUOTIENT IN ACCUMULATOR AC, REMAINDER IN AC+2

DIV.11:	SKIPN	RS,0(PA)	;IS DIVISOR ZERO?
	JRST	OVRFLO		;YES--TROUBLE
	TLZ	RS,1B18		;NO--IS IT 2**-35?
	JUMPE	RS,OVRFLO	;YES--TROUBLE (IF JUMP)

	LDB	RS,[POINT 4,PA,12]; GET OPERAND AC
	MOVE	TA,0(RS)	;GET OPERAND

	JOV	.+1		;CLEAR OVERFLOW FLAG
	IDIV	TA,0(PA)	;DO THE DIVIDE

	MOVEM	TA,0(RS)	;STASH QUOTIENT
	MOVEM	TA+1,2(RS)	;STASH REMAINDER

	JOV	OVRFLO		;SET ANY OVERFLOW INDICATION

	POPJ	PP,

OVRFLO:	OUTSTR	[ASCIZ /Arithmetic overflow during DIVide
/]
	POPJ	PP,



TA=13	;TEMPORARY (2 AC'S)
RS=15	;RESULT AC ADDRESS
PA=16	;ADDRESS OF DIVISOR
PP=17	;PUSH-DOWN POINTER

END