Trailing-Edge
-
PDP-10 Archives
-
ap-c796e-sb
-
chain.mac
There are no other files named chain.mac in the archive.
TITLE CHAIN V.052(2) 6-OCT-71
SUBTTL NGP/RPG/WFW/DMN
ENTRY CHAIN
EXTERN .JBSYM,.JBSA,.JBREL,.JB41,.JBCHN
EXTERN DEVTB.
A= 4
B= 5
C= 6
D= 7
E= 10
F= 11
Q= 16
P= 17
;CHAIN HAS THE FOLLOWING CALLING SEQUENCE
; JSA Q, CHAIN
; EXP TYPE
; EXP DEVICE
; EXP FILE
;TYPE IS AN ARGUMENT WHICH MAY HAVE THE VALUE OF 0 OR 1. IF
;IT IS ZERO, CHAIN WILL LOAD THE NEXT LINK ON TOP OF THE CURRENT
;RESIDENT LINK. IF NON-ZERO, IT WILL PRESERVE THE CURRENT
;RESIDENT LINK AND BEGIN LOADING AT THE END OF THE RESIDENT
;LINK. DEVICE IS A NUMBER SPECIFYING THE DEVICE FROM WHICH THE
;NEXT LINK IS TO BE LOADED. FILE IS EITHER A NUMBER SPECIFYING
;THE FILE ON MAGTAPE WHERE THE LINK RESIDES, OR IT IS AN
;ASCII FILE NAME.
CHAIN: 0 ;ENTRY TO CHAIN ROUTINE
MOVEI A,17 ;RELEASE ALL DEVICES IN THIS LINK
DPB A,[POINT A,REL,12] ;TO FINISH OFF I/O
REL: RELEAS 0,
SOJGE A,REL-1 ;LOOP BACK FOR MORE CHANNELS
MOVE A,@1(Q) ;GET THE DEVICE NUMBER
MOVE B,DEVTB.(A) ;GET A SIXBIT DEVICE NAME FROM TABLE
MOVEM B,DEVNAM ;SAVE IT FOR THE INIT UUO
INIT 1,16 ;INIT DEVICE IN DUMP MODE
DEVNAM: 0 ;PLACE FOR SIXBIT DEVICE NAME
0 ;NO BUFFERS IN DUMP MODE
JRST ERROR1 ;DEVICE NOT AVAILABLE
SETZB 3,.JBSA+1 ;CLEAR THESE FOR LATER
DEVCHR B, ;GET CHARACTERISTICS OF DEV.
TLNE B,20 ;IS IT A MAGNETIC TAPE?
JRST MAGTPE ;YES,HANDLE IT DIFFERENTLY
MOVEI D,5 ;NO, CONVERT ASCII TO SIXBIT
MOVSI C,(POINT 6,0) ;POINTER TO LOOKUP BLOCK WORD
MOVE B,[POINT 7,@2(Q)] ;POINTER TO ASCII FILE NAME
SLOOP: ILDB A,B ;GET AN ASCII CHARACTER
JUMPE A,.+2 ;LEAVE ZEROES ALONE
SUBI A,40 ;MAKE IT SIXBIT
IDPB A,C ;STORE IT IN THE FILE WORD
SOJG D,SLOOP ;LOOP BACK FOR MORE
IDPB D,C ;STORE ZERO IN SIXTH POSITION
MOVEM 0,SAVNAM ;SAVE IT INCASE OF RETRY
MOVSI 1,'CHN' ;STORE FILE EXTENSION
LOOKUP 1,0 ;TRY A LOOKUP
JRST ERROR2 ;LOOKUP FAILED
COMMON: HLRZ P,.JBCHN ;ASSUME A RESIDENT LINK
SKIPN @(Q) ;CHECK THE TYPE ARGUMENT
HRRZ P,.JBCHN ;NO,THERE IS NO RESIDENT LINK
MOVEI C,-7(P) ;CALCULATE THE IOWD
SUB C,.JBREL ;LEFT HALF HAS NEG WORD COUNT
MOVEM C,CHAIN ;SAVE LENGTH
HRLI C,-7(P) ;SA-1 IN THE RIGHT HALF
MOVSM C,.JBSA ;PUT COMMAND LIST IN JOBDAT AREA
MOVE 0,-6(P) ;SAVE WORD OVERWRITTEN BY LENGTH
MOVE 1,-5(P) ;SAVE WORD OVERWRITTEN BY JOBCHN
MOVE 2,-4(P) ;SAVE WORD OVERWRITTEN BY JOBSA
MOVE 3,-3(P) ;SAVE WORD OVERWRITTEN BY JOBSYM
MOVE 4,-2(P) ;SAVE WORD OVERWRITTEN BY JOB41
MOVE 5,-1(P) ;SAVE WORD OVERWRITTEN BY JOBDDT
;FALL INTO CHNGO AND
;START THE INPUT SEQUENCE
CHNGO: INPUT 1,.JBSA
CKLEN: STATZ 1,740000 ;CHECK FOR INPUT ERRORS
JRST IOERR ;YES, I/O ERRORS OCCURED
MOVE E,-6(P) ;GET LENGTH REQUIRED
CAML E,CHAIN ;AND TOO LITTLE READ
JRST CHNIN ;FILE READ OK
HRLM E,.JBSA ;FOR RETRY
EXCH E,CHAIN ;ALSO FOR RETRY
SUB E,CHAIN ;GET OVERLAP
ADD E,.JBREL ;HOW MUCH NEEDED
CORE E, ;TRY TO GET IT
JRST CORER ;FAILED
CLOSE 1, ;SO LOOKUP WILL WIN
MTAPE 1,17 ;BACKSPACE INCASE OF MAGTAPE
MOVE E,SAVNAM ;GET THE FILE NAME
MOVSI E+1,'CHN' ;SET EXTENSION
SETZB E+2,E+3 ;CLEAR THEM
LOOKUP 1,E ;DO LOOKUP AGAIN
JRST CORER ;SHOULD NEVER HAPPEN
JRST CHNGO ;TRY AGAIN
CHNIN: EXCH 0,-6(P) ;GET LENGTH
EXCH 1,-5(P) ;NEW JOBCHN
MOVEM 1,.JBCHN
EXCH 2,-4(P) ;NEW JOBSA
MOVEM 2,.JBSA
EXCH 3,-3(P) ;NEW JOBSYM
MOVEM 3,.JBSYM
EXCH 4,-2(P) ;NEW JOB41
MOVEM 4,.JB41
EXCH 5,-1(P) ;NEW JOBDDT
SETDDT 5, ;NEED UUO TO CHANGE JOBDDT
JRST (2) ;THIS HAS JOBSA IN IT
SAVNAM: Z ;SAVE FILE NAME HERE
CORER: MOVEI C,[ASCIZ /?NOT ENOUGH CORE/]
JRST ERRFIN
IOERR: MOVEI C,[ASCIZ /?INPUT ERROR/]
JRST ERRFIN
MAGTPE: SKIPN B,@2(Q) ;IS THE FILE ARGUMENT ZERO?
JRST COMMON ;YES, LEAVE THE MAG TAPE ALONE
MTAPE 1,1 ;NO, REWIND THE MAGTAPE
LOOP: MTAPE 1,0 ;AND WAIT FOR COMPLETION
SOJLE B,COMMON ;SKIP (N-1) FILES FORWARD
MTAPE 1,16 ;...
JRST LOOP ;...
;ERROR2 IS CALLED WHEN A LOOKUP FAILS
ERROR2: MOVE A,@2(Q) ;GET FILE NAME
MOVEM A,MESS2+1 ;DEPOSIT IT IN MESSAGE
MOVEI C,MESS2 ;START OF MESSAGE
JRST ERRFIN ;AND OUTPUT IT
;ERROR1 IS CALLED WHEN THE DEVICE CANNOT BE INITIALIZED
ERROR1: MOVE 0,DEVNAM ;PICK UP NAME OF DEVICE
MOVE B,[POINT 7,MESS1+1,20] ;BYTE POINTER TO MESSG
MOVEI C,MESS1 ;OUTPUT WORD FOR MONITOR
MOVEI D,6 ;CONVERT SIXBIT NAME TO ASCII
MOVSI E,(POINT 6,0) ;BYTE POINTER TO SIXBIT NAME
ELOOP: ILDB F,E ;PICK UP A SIXBIT CHARACTER
ADDI F,40 ;CONVERT IT TO ASCII
IDPB F,B ;PUT IT IN THE ERROR MESSAGE
SOJG D,ELOOP ;LOOP BACK FOR MORE CHARACTERS
ERRFIN: DDTOUT C, ;PUBLISH THE MESSAGE
MOVEI C,[ASCIZ / - CHAIN/]
DDTOUT C,
EXIT ;GO AWAY
MESS1: ASCIZ "DEVICE NOT AVAILABLE"
MESS2: ASCII "FILE "
ASCII " "
ASCIZ " NOT FOUND"
END
;BLOCK OF CODE WHICH GETS MOVED DOWN INTO THE ACS
ACBLOCK: PHASE 0
REPEAT 3,<0>
CHNGO: INPUT 1,JOBSA
EXCH 0,-5(P) ;GET LENGTH
EXCH 1,-4(P) ;NEW JOBSA
MOVEM 1,JOBSA
EXCH 2,-3(P) ;NEW JOBSYM
EXCH 2,JOBSYM
EXCH 2,-2(P) ;NEW JOB41
EXCH 2,JOB41
EXCH 2,-1(P) ;NEW JOBDDT
CALLI 2,QJOBDD ;NEED UUO TO CHANGE JOBDDT
JRST CKLEN ;GO CHECK LENGTH OF INPUT
LASTAC: ERRMSS ;IN CASE OF ERROR
IFG <.-17>,<PRINTX RAN OUT OF AC SPACE>
DEPHASE
;SPECIAL ERROR CHECKING AND MESSAGE CODE
IMPERR: PHASE JOBCN6
CKLEN: STATO 1,740000 ;CHECK FOR INPUT ERRORS
CAMGE 0,STRLEN ;AND TOO LITTLE READ
SKIPA
JRST (1) ;THIS HAS JOBSA IN IT
CALLI LASTAC,QDDTOUT ;PRINT ERROR
CALLI QEXIT
ERRMSS: ASCIZ "CHAIN ERR"
STRLEN: 0 ;PUT LENGTH HERE
IMLG=.-CKLEN ;HOW MUCH TO BLT
DEPHASE
FILE: BLOCK 4
IBUF: BLOCK 3
END