Trailing-Edge
-
PDP-10 Archives
-
decuslib10-01
-
43,50212/lookup.mac
There are 52 other files named lookup.mac in the archive. Click here to see a list.
TITLE LOOKUP
ENTRY LOOKUP
;THIS ROUTINE LOOKS UP A FILE 'FILNAM.EXT'
;THE CALLING SEQUENCE IS CALL LOOKUP('FILNA','M.EXT')
;THE RETURN IS ALL ONES (.TRUE.) IF ITS THERE AND 0 (.FALSE.) IF NOT
ANS=0 ;AC'S
BPT=1
CTR=2
TAC=3
BPT2=4
CNT=5
FIL=6
FEL=7
CHR=10
DOT=16 ;PERIOD
D=12 ;CHANNEL
DEFINE TTYOUT (ADR)<TTCALL 3,ADR>
DEFINE TTYIN (ADR)<TTCALL 4,ADR>
LOOKUP: 0
MOVSI 1,2
HRRI 1,ACSAV
BLT 1,ACSAV+15 ;SAVE AC'S
INIT D,17
SIXBIT/DSK/
0
JRST NOTAVL
SETOM ANS ;ASSUME ITS THERE
MOVE FIL,@(16) ;GET FIRST ARG
MOVE FEL,@1(16) ;GET SECOND ARG
MOVE BPT2,[POINT 7,FIL] ;POINT TO FILENAME
MOVEI CNT,12 ;ONLY LOOK AT 10 CHARACTERS
MOVEI CTR,6 ;TO STORE SIX CHARS
MOVE BPT,[POINT 6,UFD]
CLEARM UFD ;FILNAME
CLEARM UFD+1 ;EXT
CLEARM UFD+2 ;PROTECTION
GETNAM: ILDB CHR,BPT2 ;READ CHARACTER
SUBI CHR,40 ;CONVERT TO SIXBIT
JUMPE CHR,COUNT ;SKIP BLANKS
CAIN CHR,DOT ;TEST FOR PERIOD
JRST EXT ;PERIOD--EXT FOLLOWS
SOSL CTR ;STORE ONLY LEGAL LIMIT
IDPB CHR,BPT ;ALPHANUMERIC--STORE
COUNT: SOSG CNT ;DECREMENT CHARACTER COUNTER
JRST LOOK ;DONE, GO LOOKUP FILE
JRST GETNAM ;GET NEXT CHARACTER
EXT: MOVE BPT,[POINT 6,UFD+1]
MOVEI CTR,3 ;TO STORE THREE CHARS
JRST COUNT ;GO GET EXT
LOOK: LOOKUP D,UFD ;LOOKUP FILE
SETZM ANS ;FILE NOT THERE
CLOSE D,
MOVSI 1,ACSAV
HRRI 1,2
BLT 1,17
JRA 16,(16) ;DONE
NOTAVL: TTYOUT [ASCIZ"DEVICE NOT AVAILABLE"]
CALLI 12
ACSAV: BLOCK 17
UFD: BLOCK 4
END