Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-10 - 43,50517/magneg.mac
There are 7 other files named magneg.mac in the archive. Click here to see a list.
	TITLE	MAGNEG FOR RPGLIG %1
	SUBTTL	GET MAGNITUDE AND NEGATIVE OF TWO-WORD COMP 	/CAM/BOB CURRIER


;COPYRIGHT DIGITAL EQUIPMENT CORPORATION, MAYNARD, MA.

	HISEG

;MODIFIED FROM LIBOL 5(223) VERSION TO RPGII VERSION BY BOB CURRIER 10/23/75

	ENTRY	MAG.			; GET MAGNITUDE
	ENTRY	NEG.			; GET NEGATIVE
	ENTRY	NEG.A			; FOR USE BY OTHER ROUTINES

;CALLING SEQUENCE:
;	MOVE	PA,[Z AC,ADDRESS]
;	PUSHJ	PP,MAG./NEG.

;RESULT WILL BE LEFT IN ACCUMULATOR SPECIFIED BY "AC"

MAG.:	MOVE	TB,1(PA)		; GET LOW-PART
	SKIPL	TA,0(PA)		; GET HIGH PART - IS IT NEGATIVE?
	JRST	NEG.B			; NO - NO NEED FOR NEGATION

	TLO	TB,1B18			; YES - MAKE SURE LOW-PART IS NEGATIVE
	JRST	NEG.A

NEG.:	MOVE	TA,0(PA)		; GET HIGH-PART
	MOVE	TB,1(PA)		; GET LOW_PART

NEG.A:	SETCA	TA,			; COMPLEMENT HI-PART
	MOVNS	TB			; NEGATE LOW-PART
	TLZ	TB,1B18			; CLEAR SIGN BIT OF LOW-PART
	SKIPN	TB			; IF LOW-PART IS ZERO,
	ADDI	TA,1			; 	BUMP HIGH PART

	SKIPGE	TA			; BE SURE SIGN OF
	TLOA	TB,1B18			;   LOW PART AGREES
NEG.B:	TLZ	TB,1B18			;   WITH HIGH-PART

	LDB	TC,[POINT 4,PA,12]	; GET RESULT LOCATION
	MOVEM	TA,0(TC)		; STORE
	MOVEM	TB,1(TC)		;   RESULT

	POPJ	PP,			; EXIT

TA==6
TB==10
TC==11
PA==16
PP==17


	END