Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-10 - 43,50517/seekit.mac
There is 1 other file named seekit.mac in the archive. Click here to see a list.
	TITLE SEEKIT - LOOKUP FILES FOR COBOL


T1=1
T2=2
T3=3
T4=4
T5=5
T6=6

J=16
P=17

CHAN==17	;USE CHAN 17 WITH DEC STANDARD LIBOL

	ENTRY	SEEKIT

SEEKIT:	PUSH	P,T1
	PUSH	P,T2
	PUSH	P,T3
	PUSH	P,T4
	PUSH	P,T5
	PUSH	P,T6

	MOVE	T6,@(J)		;GET TABLE ADDRESS IN T6
	MOVE	T2,(T6)		;GET THE DEVICE
	JUMPN	T2,OPENIT	;JUMP IF NOT DEFAULT DEVICE
	MOVSI	T2,'DSK'	;ASSUME "DSK"
OPENIT:	MOVEI	T1,17		;BINARY DUMP
	SETZ	T3,		;NO BUFFERS
	OPEN	CHAN,T1		;CHANNEL 0 IS FREE BY DEFINITION
	  JRST	NODEV
	MOVE	T1,3(T6)	;PROJECT #
	PUSHJ	P,ADJUST
	HRL	T4,T3
	SETZ	T3,
	MOVE	T1,4(T6)	;PROGRAMMER #
	PUSHJ	P,ADJUST
	HRR	T4,T3
	MOVE	T1,1(T6)	;GET FILE NAME
	MOVE	T2,2(T6)	;AND EXT
	SETZB	T3,T5		;CLEAR FLAG
	LOOKUP	CHAN,T1		;LOOKUP FILE
	  SETO	T5,
	MOVE	T1,[POINT 6,5(T6)]	;POINTER TO FLAG
	MOVEI	T2,21		;ASSUME "YES"
	SKIPE	T5		;WAS I RIGHT?
	MOVEI	T2,20		;OF COURSE NOT
	IDPB	T2,T1		;DEPOSIT ANSWER
	RELEAS	CHAN,		;RELEASE THE I/O CHANNEL

	POP	P,T6
	POP	P,T5
	POP	P,T4
	POP	P,T3
	POP	P,T2
	POP	P,T1
	POPJ	P,		;RETURN

ADJUST:	IDIVI	T1,^D10		;DIVIDE BY 10
	JUMPE	T1,.+4
	PUSH	P,T2
	PUSHJ	P,ADJUST
	POP	P,T2
	IMULI	T3,10		;MULTIPLY BY 8
	ADD	T3,T2		;AND ADD
	POPJ	P,

NODEV:	OUTSTR	[ASCIZ/SEEKIT CANNOT OPEN DEVICE
/]
	EXIT


	END