Google
 

Trailing-Edge - PDP-10 Archives - klad_sources - klad.sources/dskak1.mac
There are no other files named dskak1.mac in the archive.
EXIT:	DROPDV			;CLOSE LOGICAL OUTPUT FILE
	EXIT

PGMNAM:	ASCIZ	%
DECSYSTEM 2020 BASIC INSTRUCTION DIAGNOSTIC [DSKAK]
MULTIPLY & DIVIDE
%

;INITIALIZE SUBROUTINES

START:	PGMINT
	MOVE	[ASCIZ/AK/]
	MOVEM	TLET

STARTA:	JRST	PART1		;GO PERFORM DIAGNOSTIC
SUBTTL	DIAGNOSTIC SECTION - MPY TEST - ZERO PRODUCT

	ADR=3000
	AC=14
	E=<AC-2>&17

PART1:	SAVEAC	(1,1)

;MULTIPLY 0 BY 0 TO GET PRODUCT OF 0
	MOP1	(\ADR,0,-1,0,0,0)

	AC=13
	E=<AC-2>&17
	SAVEAC	(1,1)
	XX=0

	REPEAT	^D36,<
	ADR=ADR+1
	XX=XX+XX
	IFE	XX,<XX=1>

;MULTIPLY RIPPLED 1 BY 0 TO GET PRODUCT OF 0
	MOP1	(\ADR,0,-1,XX,0,0)>
	AC=12
	E=<AC-2>&17
	SAVEAC	(1,1)
	XX=0

	REPEAT	^D36,<
	ADR=ADR+1
	XX=XX+XX+1
	IFE	<XX-1>,<XX=-2>

;MULTIPLY RIPPLED 0 BY 0 TO GET PRODUCT OF 0
	MOP1	(\ADR,0,-1,XX,0,0)>
	ADR=ADR+1
	AC=14
	E=<AC-2>&17
	SAVEAC	(1,1)

;MULTIPLY -1 BY 0 TO GET PRODUCT OF 0
	MOP1	(\ADR,0,-1,-1,0,0)
SUBTTL	DIAGNOSTIC SECTION - MULTIPLICATION ALGORITHM

	AC=13
	E=<AC-2>&17
	SAVEAC	(1,1)

	XX=-1

	REPEAT	^D16,<			;MULTIPLICAND=1	
;TEST MULTIPLICATION ALGORITHM
;VERIFY THAT (-MPY SHIFT) WORKS AS SPECIFIED IN THE
;KI10 MULTIPLICATION ALGORITHM. I.E., THE TWO LEAST
;SIGNIFICANT BITS OF THE MULTIPLIER (C(AC)) ARE
;EXAMINED AND THEN THE MULTIPLICAND (C(E)) IS MULTIPLIED BY THEM.
;THIS PROCESS IS REPEATED 18 TIMES IN ORDER
;TO MULTIPLY ALL 36 BITS OF THE AC.  THIS TEST IS
;EXECUTED 16 TIMES WITH C(AC)=0,1,3,4,..., 17 AND
;C(E)=1.  IT IS EXECUTED ANOTHER 16 TIMES AS ABOVE
;EXCEPT C(E)=-1 TO VERIFY THAT THE ALGORITHM IS INDEPENDENT
;OF C(E).

	ADR=ADR+1
	XX=XX+1

	MOP1	(\ADR,XX,-1,1,0,XX)>
	AC=12
	E=<AC-2>&17
	SAVEAC	(1,1)

	XX=-1

	REPEAT	^D16,<			;MULTIPLICAND=-1 
;TEST MULTIPLICATION ALGORITHM
;VERIFY THAT (-MPY SHIFT) WORKS AS SPECIFIED IN THE
;KI10 MULTIPLICATION ALGORITHM, I.E., THE TWO LEAST
;SIGNIFICANT BITS OF THE MULTIPLIER (C(AC)) ARE
;EXAMINED AND THEN THE MULTIPLICAND (C(E)) IS MULTIPLIED BY THEM.
;THIS PROCESS IS REPEATED 18 TIMES IN ORDER
;TO MULTIPLY ALL 36 BITS OF THE AC.  THIS TEST IS
;EXECUTED 16 TIMES WITH C(AC)=0, 1,2,3,4, . . ., 17 AND
;C(E)=1.  IT IS EXECUTED ANOTHER 16 TIMES AS ABOVE
;EXCEPT C(E)=-1 TO VERIFY THAT THE ALGORITHM IS INDEPENDENT
;OF C(E).

	ADR=ADR+1
	XX=XX+1
	MX=-XX
	IFE	XX,<
	V1=-1
	V2=0>
	IFN	XX,<
	V1=0
	V2=-1>
	MOP1	(\ADR,XX,V1,-1,V2,MX)>
SUBTTL	DIAGNOSTIC SECTION - MPY TEST - ZERO PRODUCT

	AC=11
	E=<AC-2>&17
	SAVEAC	(1,1)
	XX=0

	REPEAT	^D36,<
	ADR=ADR+1
	XX=XX+XX
	IFE	XX,<XX=1>

;MULTIPLY 0 BY RIPPLED 1 TO GET PROD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