Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-01 - 43,50161/mmul.mp
There are no other files named mmul.mp in the archive.
	TITLE MMULT
	EXTERN MSHIFT,MNORM
	ENTRY MMULT
MMULT:	Z
	MOVEM 17,STORE+17	;SAVE
	MOVEI 17,STORE		;THE
	BLT 17,STORE+16		;AC'S
	MOVE 1,(16)	;AC1=ADDR OF FIRST CHARACTERISTIC WORD
	MOVE 2,1(16)	;AC2=ADDR OF SEC. CHARACTERISTIC WORD
	MOVE 3,@2(16)	;AC3=PRECISION
	MOVE 4,3(16)	;AC4=ADDR OF RESULT CHARACTERISTIC WORD
	SETZB 10,11
	MOVE 12,(1)	;AC12=FIRST CHARACTERISTIC WORD
	MOVE 15,(2)	;AC15=SECOND CHARACTERISTIC WORD
	JUMPGE 12,.+3
	SETO 10,	;IF WORD NEG., SET AC10
	MOVN 12,12	;AC12=POSITIVE VALUE FIRST CHAR WORD
	JUMPGE 15,.+3
	SETO 11,	;IF WORD NEG., SET AC11
	MOVN 15,15	;AC15=POSITIVE VALUE SEC. CHAR WORD
	HRLZI 16,200000	;SUB 2**34 FROM ONE CHAR
	SUB 15,16
	JFCL 17,.+1
	ADD 15,12	;IF SUM OF CHAR WORDS GREATER THAN 2**35-1
	JOV ERROR	;TAKE THE ERROR RETURN
	CAME 10,11	;IF AC10=AC11, THEN RESULT IS POSITIVE
	MOVN 15,15	;IF NOT EQUAL, THEN RESULT IS NEGATIVE
	MOVEM 15,(4)	;STORE NEW CHARACTERISTIC WORD
	MOVE 5,1
	ADD 5,3		;AC5=ADDR OF NTH WORD, FIRST NUMBER
	MOVEI 7,TEMP
	ADD 7,3		;AC7=ADDR OF NTH. FRAC IN TEMP STORAGE
	SETZM 0,TEMP
	HRLI 17,TEMP
	HRRI 17,TEMP+1
	BLT 17,(7)	;ZERO THE TEMP STORAGE
	MOVE 13,2
XXX:	AOJ 13,		;AC13 AND AC6 ARE POINTERS CONTAINING ADDRS
	MOVE 6,13	;FOR MULTIPLYING OF THE SEC. NO.
	SETZ 12,0
	MOVE 14,7
XX:	SETZ 11,
	MOVE 10,(5)	;AC10=1 WORD OF FIRST NO.
	MUL 10,(6)	;AC10=A PARTIAL PRODUCT
	MOVEI 15,2
	MOVE 17,11	;AC17=EITHER THE LOW OR HIGH ORDER BITS TO ADD
ADD:	MOVE 16,(14)	;AC16=PART OF THE PARTIAL PRODUCT
	JFCL 17,.+1
	ADD 16,17
	ADD 16,12	;AC12=ANY CARRIES THAT MIGHT OCCUR
	JOV .+3
	SETZ 12,0
	JRST .+2	;IF NO CARRY SET AC12=0
	MOVEI 12,1	;IF A CARRY SET AC12=1
	TLZ 16,400000	;MAKE SURE SIGN BIT 0
	MOVEM 16,(14)	;RESTORE NEW PARTIAL PRODUCT
	SOJE 15,CARRY
	MOVE 17,10
	SOJ 14,0
	JRST ADD
CARRY:	JUMPE 12,HERE
	MOVE 17,14
LOOP1:	SOJ 17,0
	JFCL 17,.+1
	AOS 0,(17)
	JOV .+2
	JRST HERE
	SETZ 10,0
	DPB 10,[POINT 1,(17),0]
	JRST LOOP1
HERE:	SOJ 6,0
	CAME 6,2
	JRST XX
	SOJ 5,0
	CAME 5,1
	JRST XXX
	MOVE 10,(7)
	TLZN 10,200000	;TEST FOR POSSIBLE ROUNDING REQUIRED
	JRST AROND
	MOVE 14,7
LOOP:	SOJ 14,0
	JFCL 17,.+1
	AOS 0,(14)
	JOV .+2
	JRST AROND
	SETZ 10,0
	DPB 10,[POINT 1,(14),0]
	JRST LOOP
AROND:	MOVE 5,4
	ADD 5,3		;AC5=ADDR OF (N+1)TH WORD OF RESULT
	MOVE 6,4
	AOJ 6,0		;AC6=ADDR OF FIRST FRACTIONAL WORD OF RESULT
	HRLZI 17,TEMP
	HRR 17,6
	BLT 17,(5)	;TRANSFER TEMP STORAGE TO RESULT
	MOVEM 4,GO+1
GO:	JSA 16,MNORM
	EXP 0,3
	HRLZI 17,STORE
	BLT 17,17	;RESTORE THE AC'S
	JRA 16,5(16)	;TAKE NORMAL RETURN
ERROR:	HRLZI 17,STORE
	BLT 17,17	;RESTORE THE AC'S
	JRA 16,4(16)	;TAKE ERROR RETURN
STORE:	BLOCK 20
TEMP:	BLOCK 200
	END