Trailing-Edge
-
PDP-10 Archives
-
decus_20tap2_198111
-
decus/20-0064/mafia.mac
There are 2 other files named mafia.mac in the archive. Click here to see a list.
TITLE MAFIA
SUBTTL MAG-TAPE-FILER-ADVANCED; AUTHORS:M.RICHTER, H.-P.ROTHER
;
IFNDEF OLDSW,<OLDSW=0> ;5 SERIES MONITOR: OLDSW = 0
;4 SERIES MONITOR: OLDSW = 1
;
;FLAGS IN AC F
;
;SWITCHES:
ZEROFL=1B35 ;ZERO-FLAG LH /Z
LISTFL=1B34 ;LIST-FLAG LH /L
REWOFL=1B33 ;REWIND-FLAG FOR OUTPUT-DEVICE LH /W
GENFL=1B32 ;GENERATE-DIRECTORY-FLAG LH /G
COPYFL=1B31 ;COPY-FLAG LH /X
ENDFL=1B30 ;END-FLAG (EXIT) LH /E
DELFL=1B29 ;DELETE-FLAG LH /D
RENFL=1B28 ;RENAME-FLAG LH /R
NTAOFL=1B27 ;NEW-TAPE-FLAG FOR OUTPUT-DEVICE LH /N
FILIFL=1B24 ;FILENAME LISTING (SHORT DIR.) FLAG RH /F
;COMCOD CONTROL:
LAFL=1B26 ;LEFT-ARROW-FLAG LH
DEVFL=1B25 ;DEVICE-FLAG LH
FIFL=1B24 ;FILE-FLAG LH
ASTFL=1B23 ;ASTERIX-FLAG LH
OEXAST=1B22 ;OUTPUT-EXTENSION-ASTERIX-FLAG LH
OFIAST=1B21 ;OUTPUT-FILE-ASTERIX-FLAG LH
CRFL=1B20 ;CARRIAGE-RETURN-FLAG LH
SWFL=1B19 ;SWITCH-FLAG LH
NWIC=1B18 ;FLAG TO MARK THAT INPUT-COUNTER WAS INCREMENTED LH
PROFL=1B23 ;PROTECTION FLAG RH
QUEFL=1B21 ;QUESTION MARK FLAG RH
;IO FLAGS
MOUT=1B35 ;MAGTAPE FOR OUTPUT FLAG RH
MOD1=1B34 ;MAGTAPE FOR OUTPUT DIRECTORY FLAG, 1=DIR1, 0=DIR2 RH
MIN=1B33 ;MAGTAPE FOR INPUT FLAG RH
MID1=1B32 ;MAGTAPE FOR INPUT DIRECTORY FLAG, 1=DIR1, 0=DIR2 RH
DOUT=1B31 ;DTA OR DSK FOR OUTPUT FLAG RH
DIN=1B30 ;DTA OR DSK FOR INPUT FLAG RH
ASCIOU=1B29 ;OUTPUT CHANNEL IN ASCII MODE FLAG RH
ASCIN=1B28 ;INPUT CHANNEL IN ASCII MODE FLAG RH
FIDEL=1B27 ;MARK THAT "FILES DELETED:" WAS WRITTEN ALREADY RH
DSKIN=1B26 ;DISK FOR INPUT FLAG RH
DSKOUT=1B25 ;DISK FOR OUTPUT FLAG RH
LPTOUT=1B22 ;LPT FOR OUTPUT FLAG RH
PAGE
;ERROR BIT DEFINITIONS
IOIMPM=1B18 ;IMPROPER MODE
IODERR=1B19 ;HARDWARE ERROR
IODTER=1B20 ;CHECKSUM OR PARITY ERROR
IOBKTL=1B21 ;BLOCK TOO LARGE OR DTA FULL
IOEOF=1B22 ;END OF FILE
IOEOT=1B25 ;END OF TAPE
PAGE
;AC-DEFINITIONS
AC0=0 ;TEMPOR. ACS
AC1=1
AC2=2
AC3=3
AC4=4
AC5=5
AC6=6
AC7=7
AC8=10
CC=11 ;CHARACTER-COUNTER
C=12 ;TEMPORARY-CHARACTER-BUFFER
IC=13 ;INPUT-COUNTER
CP=14 ;CHARACTER-BUFFER-POINTER
CB=15 ;CHARACTER-BUFFER
F=16 ;FLAG
PDP=17 ;PUSH-DOWN-POINTER
;CHANNEL DEFINITIONS
OCH=1 ;OUTPUT-CHANNEL
ICH=2 ;INPUT-CHANNEL
OCHD=3 ;OUTPUT-CHANNEL FOR DIRECTORY
ICHD=4 ;INPUT-CHANNEL FOR DIRECTORY
; EXTERN JOBFF,JOBSA,JOBREN
SEARCH JOBDAT ;JOBXXX BECOMES .JBXXX
IFNDEF ICMAX,<ICMAX=^D16> ;MAXIMUM NUMBER OF INPUT-FILES
IFNDEF MDIRFN,<MDIRFN=^D500> ;MAX. NUMBER OF FILES IN MAGTAPE-DIRECTORY
DIRLEN=MDIRFN*3+1 ;LENGTH OF MAGTAPE-DIRECTORY
PAGE
;PROGRAMM-START
;COMMAND-DECODER
MAFIA: CALLI 0 ;RESET SYSTEM
SETZB IC,CB ;CLEAR IC, CB
MOVEI C,ICMAX ;SET UP MAXNUMBER OF INPUT-FILES FOR ERROR-MESSAGE
IDIVI C,12
ADDI IC,60
ADDI C,60
CAIN C,60
MOVEI C,40
MOVE CP,[POINT 7,ICMASC]
IDPB C,CP
IDPB IC,CP
IDPB CB,CP
SETOM MDIR10 ;SET DIRECTORY-HEADER = -1
SETOM MDIR20
MOVEI AC0,COMRET-1 ;CHANGE START-ADDR. TO COMRET-1
HRRM AC0,.JBSA
HRRM AC0,.JBREN ;ALSO FOR REENTER
SETZ AC8,
COMRET: JUMPN AC8,COMRT1 ;TTY INPUT ALREADY READ ?
TTCALL 5,C ;NO, READ IN A LINE AND CLEAR ^O
SKIPA
SETO AC8, ;MARK THAT A LINE IS READ IN
COMRT1: MOVE PDP,[IOWD ^D10,PDL] ;SET UP PUSH-DOWN-POINTER
MOVE CP,P6QB ;SET UP QUESTION-MARK-BUFFER-POINTER
MOVEM CP,QP
MOVE CP,P6CB ;SET UP CHARACTER-BUFFER-POINTER
MOVNI IC,ICMAX ;RESET COUNTER FOR INPUT DEVICES + FILES
MOVEI CC,6 ;RESET CHARACTER-COUNTER
SETZM ODEV ;RESET BUFFERS
MOVE F,[ODEV,,OFIL]
BLT F,QB
SETZB F,CB ;RESET FLAGS AND CHARACTER-BUFFER
PAGE
TTCALL 1,["*"] ;TYPE *
SKIPN AC8 ;TTY INPUT ALREADY DONE ?
TTCALL 4,C ;NO, GET 1ST CHAR.
SETZ AC8, ;CLEAR FLAG FOR TTY COMMAND-INPUT
CAIE C,15 ;ONLY CR ?
JRST GTNXT1 ;NO, GO ON
TTCALL 0,C ;YES, GET LF
JRST COMRET ;START AGAIN
GETNXT: TTCALL 0,C ;GET NEXT CHAR.
GTNXT1: CAIE C," " ;IGNORE BLANKS AND TABS
CAIN C,11
JRST GETNXT
CAIN C,"/" ;"/" ?
JRST SLASH ;YES
CAIN C,"_" ;"_" ?
JRST LARROW ;YES
CAIN C,":" ;":" ?
JRST COLON ;YES
CAIN C,"." ;"." ?
JRST DOT ;YES
CAIN C,15 ;CR ?
JRST CARRY ;YES
CAIN C,"," ;"," ?
JRST COMMA ;YES
CAIN C,"<" ;"<" ?
JRST BRA ;YES
CAIN C,"*" ;"*" ?
JRST ASTER ;YES
TLNE F,ASTFL ;ASTERIX PENDING ?
JRST ERRASN ;YES, ERROR
SOJL CC,ERRSIX ;INCREMENT CHAR.-COUNT, MORE THAN 6 CHARS. ?
CAIN C,"?" ;NO, "?" ?
JRST QUEM ;YES
CAIL C,60 ;NO, IS THIS REALLY A CHAR. OR A NUMBER ?
CAILE C,132
JRST ERRILC ;NO, ERROR
CAIL C,101
JRST CHAROK ;YES
CAILE C,71
JRST ERRILC ;NO, ERROR
CHAROK: SUBI C,40 ;CONVERT TO SIXBIT
IDPB C,CP ;STORE CHAR.
SETZ C, ;CLEAR C
IDPB C,QP ;STORE 6 BIT 0 IN "?"-BUFFER
JRST GETNXT ;GET NEXT CHARACTER
QUEM: TLNN F,LAFL ;"?" ON OUTPUT SIDE ?
JRST ERRQLA ;YES, ERROR
TLNE F,ASTFL ;NO, * ALREADY GIVEN ?
JRST ERRQAS ;YES, ERROR
TRO F,QUEFL ;NO, SET "?"-FLAG
SUBI C,40 ;CONVERT "?" TO SIXBIT AND STORE IT
IDPB C,CP
SETO C, ;C = -1
IDPB C,QP ;STORE 6 BIT 1 IN "?"-BUFFER
JRST GETNXT ;GET NEXT CHARACTER
PAGE
;HERE WHEN CHARACTER = /
SLASH: TLOE F,SWFL ;FIRST SWITCH ?
JRST SLAWN ;NO, LOOK FOR W OR N
TTCALL 0,C ;YES, SWFL SET, GET NEXT CHAR.
CAIN C,"Z" ;Z ?
JRST ZSW ;YES
CAIN C,"L" ;L ?
JRST LSW ;YES
CAIN C,"W" ;W ?
JRST WSW ;YES
CAIN C,"G" ;G ?
JRST GSW ;YES
CAIN C,"X" ;X ?
JRST XSW ;YES
CAIN C,"E" ;E ?
JRST ESW ;YES
CAIN C,"D" ;D ?
JRST DSW ;YES
CAIN C,"F" ;F ?
JRST FSW ;YES
CAIN C,"N" ;N ?
JRST NSW ;YES
CAIE C,"R" ;R ?
JRST ERRSWI ;NO, ERROR
TLOA F,RENFL ;YES, SET RENAME-FLAG=1 AND SKIP ALWAYS
ZSW: TLO F,ZEROFL ;SET ZERO-FLAG=1
JRST GETNXT ;GET NEXT CHARACTER
LSW: TLOA F,LISTFL ;SET LIST-FLAG=1 AND SKIP ALWAYS
ESW: TLO F,ENDFL ;SET END-FLAG (EXIT) =1
JRST GETNXT ;GET NEXT CHARACTER
GSW: TLOA F,GENFL ;SET GENERATE-FLAG=1 AND SKIP ALWAYS
XSW: TLO F,COPYFL ;SET COPY-FLAG=1
JRST GETNXT ;GET NEXT CHARACTER
FSW: TROA F,FILIFL ;SET FILENAME LISTING FLAG = 1
DSW: TLO F,DELFL ;SET DELETE-FLAG=1
JRST GETNXT ;GET NEXT CHARACTER
SLAWN: TTCALL 0,C ;GET NEXT CHARACTER
CAIN C,"W" ;W ?
JRST WSW1 ;YES
CAIE C,"N" ;N ?
JRST ERRSLA ;NO, ERROR
SKIPA
NSW: TLZ F,SWFL ;SET ZERO SWITCH FLAG
TLNE F,LAFL ;YES, FOR OUTPUT-DEVICE ?
JRST NSWI ;NO
TLO F,NTAOFL ;YES, SET NEW-TAPE-OUTPUT-FLAG = 1
JRST GETNXT ;GET NEXT CHARACTER
NSWI: TLNN F,DEVFL ;INPUT-COUNTER ALREADY INCREMENTED ?
TLNE F,FIFL ;INPUT-COUNTER ALREADY INCREMENTED ?
JRST NSWI1 ;YES
TLON F,NWIC ;NO, ALREADY REWIND FOR THIS INPUT-DEVICE ?
AOJG IC,ERRIC ;NO, INCREMENT INPUT-COUNTER, >ICMAX ?
NSWI1: HLLOS IEXASN+ICMAX-1(IC) ;YES, SET NEW-TAPE-INPUT-FLAG = -1
JRST GETNXT ;GET NEXT CHARACTER
WSW: TLZ F,SWFL ;SET ZERO SWITCH FLAG
WSW1: TLNE F,LAFL ;REWIND FOR OUTPUT-DEVICE ?
JRST WSWI ;NO
TLO F,REWOFL ;YES, SET REWIND-OUTPUT-DEVICE-FLAG = 1
JRST GETNXT ;GET NEXT CHARACTER
WSWI: TLNN F,DEVFL ;INPUT-COUNTER ALREADY INCREMENTED ?
TLNE F,FIFL ;INPUT-COUNTER ALREADY INCREMENTED ?
JRST WSWI1 ;YES
TLON F,NWIC ;NO, ALREADY NEW-TAPE-FLAG FOR THIS INPUT-DEVICE ?
AOJG IC,ERRIC ;NO, INCREMENT INPUT-COUNTER, >ICMAX ?
WSWI1: HLLOS IFIASW+ICMAX-1(IC) ;YES, SET INPUT-REWIND-FLAG = 1
JRST GETNXT ;GET NEXT CHARACTER
PAGE
;HERE WHEN CHARACTER = <
BRA: TLNE F,LAFL ;FOR OUTPUT FILE ?
JRST ERRPR ;NO, ERROR
TROE F,PROFL ;YES, FIRST PROTECTION ?
JRST ERRPR ;NO, ERROR
MOVEM CB,SAVAC ;YES, SAVE CHAR.-BUFFER
MOVEM CP,SAVAC+1 ;SAVE CHAR.-BUFFER-POINTER
SETZB CB,CP ;CLEAR CB, CP
MOVNI AC0,3 ;COUNTER => AC0
BRA1: TTCALL 0,C ;GET NEXT CHARACTER => C
CAIL C,60 ;NUMBER < 8 ?
CAILE C,67
JRST ERRPR ;NO, ERROR
SUBI C,60 ;YES, CONVERT TO BINARY
PUSH PDP,C ;SAVE IT TEMP.
AOJL AC0,BRA1 ;3 CHAR. DONE ?
TTCALL 0,C ;YES, GET NEXT CHAR. => C
CAIE C,">" ;">" ?
JRST ERRPR ;NO, ERROR
MOVNI AC0,3 ;YES, COUNTER => AC0
BRA2: POP PDP,CP ;GET NUMBERS BACK
LSHC CP,-3 ;SHIFT IT INTO CHARACTER-BUFFER
AOJL AC0,BRA2 ;3 TIMES DONE ?
EXCH CB,PROTEC ;SAVE IT IN PROTEC AND CLEAR CHAR.-BUFFER
MOVE CB,SAVAC ;RESTORE CB AND CP
MOVE CP,SAVAC+1
JRST GETNXT ;GET NEXT CHARACTER
PAGE
;HERE WHEN CHARACTER = _
LARROW: TLCE F,LAFL ;FIRST LEFT-ARROW ?
JRST ERRLAR ;NO, ERROR
TLZE F,DEVFL ;YES, SET LEFT-ARROW-FLAG=1, CLEAR DEVICE FLAG
;OUTPUT-DEVICE ALREADY GIVEN ?
JRST LARFIL ;YES
MOVE C,SIXDSK ;NO, STORE SIXBIT/DSK/ IN ODEV
MOVEM C,ODEV
LARFIL: TLZE F,FIFL ;CLEAR FILE-FLAG, WAS A FILENAME ALREADY STORED ?
JRST LAREXT ;YES
TLZE F,ASTFL ;NO, CLEAR ASTFL, WAS AN ASTERIX GIVEN ?
JRST LAROFA ;YES
EXCH CB,OFIL ;NO, STORE OUTPUT-FILENAME AND CLEAR CHAR.-BUFFER
RESCB: MOVEI CC,6 ;SET CHAR.-COUNT=6
MOVE CP,P6QB ;SET UP QUESTION-MARK-BUFFER-POINTER
MOVEM CP,QP
MOVE CP,P6CB ;RESTORE CHAR.-POINTER
JRST GETNXT ;GET NEXT CHAR.
LAREXT: TLZE F,ASTFL ;CLEAR ASTFL, WAS AN ASTERIX GIVEN ?
JRST LAROEA ;YES
CAIGE CC,3 ;NO, MORE THAN 3 CHARS. ?
JRST ERRTHR ;YES, ERROR
EXCH CB,OEXT ;NO, STORE OUTPUT-EXTENSION
; AND CLEAR CHAR.-BUFFER
JRST RESCB ;GO TO RESET CHAR.-BUFFER
LAROFA: TLOA F,OFIAST ;SET OUTPUT-FILENAME-AST.-FLAG=1
LAROEA: TLO F,OEXAST ;SET OUTPUT-EXTENT.-AST.-FLAG=1
JRST GETNXT ;GET NEXT CHAR.
PAGE
;HERE WHEN CHARACTER = :
COLON: TLCE F,DEVFL ;SET DEVICE-FLAG=1
; IS IT A 2ND COLON WITHOUT _ OR , BETWEEN ?
JRST ERRCOL ;YES, ERROR
TLNE F,ASTFL ;NO, IS AN ASTERIX WITHIN THE DEVICE-NAME ?
JRST ERRASD ;YES, ERROR
TRNE F,QUEFL ;NO, "?" GIVEN ?
JRST ERRQDE ;YES, ERROR
TLNE F,LAFL ;NO, INPUT-DEVICE ?
JRST COLIN ;YES
EXCH CB,ODEV ;NO, STORE OUTPUT-DEVICE-NAME AND CLEAR CHAR.-BUFFER
JRST RESCB ;RESET CHAR.-BUFFER
COLIN: TLNN F,NWIC ;IC ALREADY INCREMENTED ?
AOJG IC,ERRIC ;NO, INCREMENT INPUT-COUNT, >ICMAX ?
EXCH CB,IDEV+ICMAX-1(IC) ;NO, STORE INPUT-DEVICE-NAME
; AND CLEAR CHAR.-BUFFER
JRST RESCB ;RESET CHAR.-BUFFER
PAGE
;HERE WHEN CHARACTER = .
DOT: TLCE F,FIFL ;ANOTHER . WITHIN THE EXTENSION ?
JRST ERRFIL ;YES, ERROR
TLNE F,LAFL ;NO, SET FILE-FLAG, INPUT FILENAME ?
JRST DOTIN ;YES
TLZN F,ASTFL ;NO, CLEAR ASTERIX-FLAG, ASTERIX FOR FILENAME ?
JRST DOTOUT ;NO
TLO F,OFIAST ;YES, SET OUTPUT-FILENAME-ASTERIX-FLAG=1
JRST GETNXT ;GET NEXT CHARACTER
DOTOUT: EXCH CB,OFIL ;STORE OUTPUT-FILENAME AND CLEAR CHAR.-BUFFER
JRST RESCB ;RESET CHAR.-BUFFER
DOTIN: TLZE F,DEVFL ;CLEAR DEVICE-FLAG, WAS A DEVICE STORED ALREADY ?
JRST DOTAST ;YES
TLNN F,NWIC ;NO, IC ALREADY INCREMENTED ?
AOJG IC,ERRIC ;NO, INCREMENT INPUT-COUNT, >ICMAX ?
CAME IC,MINUIC ;NO, 1ST INPUT-FILENAME ?
SKIPA C,IDEV+ICMAX-2(IC) ;NO, GET OLD DEVICE-NAME
MOVE C,SIXDSK ;YES, GET SIXBIT/DSK/
MOVEM C,IDEV+ICMAX-1(IC) ;STORE DEVICE-NAME
DOTAST: TLZE F,ASTFL ;ASTERIX FOR INPUT-FILENAME ?
JRST DOTFA ;YES
EXCH CB,IFIL+ICMAX-1(IC) ;STORE INPUT-FILENAME AND CLEAR CHAR.-BUFFER
EXCH CB,QB ;STORE MASK FOR "?" AND CLEAR QB
EXCH CB,QFMASK+ICMAX-1(IC)
TRZ QUEFL ;CLEAR "?"-FLAG
JRST RESCB ;RESET CHAR.-BUFFER
DOTFA: HRROS IFIASW+ICMAX-1(IC) ;SET INPUT-FILENAME-ASTERIX-FLAG=-1
JRST GETNXT ;GET NEXT CHAR.
PAGE
;HERE WHEN CHARACTER = *
ASTER: TLOE F,ASTFL ;1ST * WITHIN A NAME ?
JRST ERRAST ;NO, ERROR
CAIE CC,6 ;YES, SET ASTERIX-FLAG=1, FIRST CHAR. OF A NAME ?
JRST ERRASN ;NO, ERROR
JRST GETNXT ;YES, GET NEXT CHAR.
PAGE
;HERE WHEN CHARACTER = CARRIAGE-RETURN
CARRY: TLO F,CRFL ;SET CRFLAG=1
TTCALL 0,C ;GET NEXT CHAR.
CAIE C,12 ;LF ?
JRST ERRCR ;NO, ERROR
;HERE WHEN CHARACTER = ,
COMMA: TLNN F,LAFL ;YES, COMMA OR CR ON RIGHT SIDE ?
JRST EX ;NO, CHECK FOR /E
TLZE F,FIFL ;YES, CLEAR FILE-FLAG, FILENAME ALREADY STORED ?
JRST COMEXA ;YES
TLZE F,DEVFL ;NO, CLEAR DEVICE-FLAG, DEVICE-NAME ALREADY STORED ?
JRST COMFIA ;YES
TLNN F,NWIC ;NO, IC ALREADY INCREMENTED ?
AOJG IC,ERRIC ;NO, INCREMENT INPUT-COUNT, >ICMAX ?
CAME IC,MINUIC ;NO, FIRST INPUT FILENAME ?
SKIPA C,IDEV+ICMAX-2(IC) ;NO, GET OLD DEVICE-NAME
MOVE C,SIXDSK ;YES, GET SIXBIT/DSK/
MOVEM C,IDEV+ICMAX-1(IC) ;STORE DEVICE-NAME
COMFIA: TLZN F,ASTFL ;CLEAR ASTERIX-FLAG, ASTERIX FOR FILENAME ?
JRST COMFI ;NO
HRROS IFIASW+ICMAX-1(IC) ;YES, SET INPUT-FILENAME-ASTERIX-FLAG=-1
JRST COMCR ;CHECK FOR CRFL
COMFI: EXCH CB,IFIL+ICMAX-1(IC) ;STORE INPUT-FILENAME AND CLEAR CHAR.-BUFFER
EXCH CB,QB ;STORE MASK FOR "?" AND CLEAR QB
EXCH CB,QFMASK+ICMAX-1(IC)
TRZ QUEFL ;CLEAR "?"-FLAG
JRST COMRES ;RESTORE CHAR.-POINTER
COMEXA: TLZN F,ASTFL ;CLEAR ASTERIX-FLAG, ASTERIX FOR EXTENSION ?
JRST COMCC ;NO
HRROS IEXASN+ICMAX-1(IC) ;SET INPUT-EXT.-ASTERIX-FLAG=-1
JRST COMCR ;CHECK FOR CRFL
COMCC: CAIGE CC,3 ;MORE THAN 3 CHAR. FOR EXTENSION ?
JRST ERRTHR ;YES, ERROR
EXCH CB,IEXT+ICMAX-1(IC) ;NO, STORE INPUT-EXTENSION
; AND CLEAR CHAR.-BUFFER
EXCH CB,QB ;STORE MASK FOR "?" AND CLEAR QB
EXCH CB,QEMASK+ICMAX-1(IC)
TRZ QUEFL ;CLEAR "?"-FLAG
COMRES: MOVEI CC,6 ;SET CHAR.-COUNT = 6
MOVE CP,P6QB ;SET UP QUESTION-MARK-BUFFER-POINTER
MOVEM CP,QP
MOVE CP,P6CB ;RESTORE CHAR. POINTER
COMCR: TLZ F,NWIC ;RESET NWIC-FLAG
TLZN F,CRFL ;END OF STRING ?
JRST GETNXT ;NO, GET NEXT CHAR.
ADDI IC,ICMAX ;YES
MOVEM IC,ICSAV ;SAVE INPUT-COUNTER
SETZ IC, ;CLEAR INPUT-COUNTER
PAGE
TLNE F,ENDFL ;/E ?
JRST EX ;YES
MOVE 0,ODEV ;NO, GET OUTPUT-DEVICE-NAME FOR INIT
MOVEM 0,INIODV ;STORE IT
PUSHJ PDP,INIO ;INIT
INRET: MOVE 0,IDEV(IC) ;GET INPUT-DEVICE-NAME FOR INIT
MOVEM 0,INIIDV ;STORE IT
PUSHJ PDP,INII ;INIT
SETZM ODATE ;CLEAR OUTPUT DATE
TLZE F,NTAOFL ;NEW OUTPUT TAPE ? (CLEAR FLAG)
PUSHJ PDP,NTAOUT ;YES
MOVE 0,IEXASN(IC) ;NO, NEW INPUT TAPE ?
TRNE 0,-1
PUSHJ PDP,NTAIN ;YES
TLZE F,REWOFL ;NO, OUTPUT-TAPE REWIND ? (CLEAR FLAG)
PUSHJ PDP,REWOUT ;YES
MOVE 0,IFIASW(IC) ;NO, REWIND INPUT TAPE ?
TRNE 0,-1
PUSHJ PDP,REWIN ;YES
TLNE F,LISTFL ;NO, LIST DIRECTORY ?
JRST LIST ;YES
TRNE F,FILIFL ;NO, LIST FILENAMES ?
JRST LIST ;YES
TLNE F,ZEROFL ;NO, ZERO THE DIRECTORY ?
JRST ZERO ;YES
TLNE F,GENFL ;GENERATE TAPE ?
JRST GENER ;YES
TLNE F,DELFL ;DELETE FILES ?
JRST DELETE ;YES
TLNE F,RENFL ;RENAME FILES ?
JRST ERRSWI ;YES
PAGE
;HERE FOR IO
SETZB AC7,AC6 ;YES, CLEAR AC7, RETURN ADDR. FOR *
MOVEI AC3,ODEV ;ADDR. OF ODEV => AC3
PUSHJ PDP,DEVCHE ;CHECK FOR OUTPUT DEVICE
JRST I1 ;NO MTA, DTA OR DSK FOR OUTPUT
JRST DO1 ;DTA OR DSK FOR OUTPUT
JUMPE AC0,MO1 ;MTA FOR OUTPUT, DIRECTORY IN CORE ?
MTAPE OCH,1 ;NO, REWIND TAPE
PUSHJ PDP,NTAOUW ;READ IN DIRECTORY
MO1: TRO F,MOUT ;SET MTA FOR OUTPUT FLAG = 1
CAIE AC3,MFILP2 ;MAGTAPE DIR2 FOR OUTPUT ?
TRO F,MOD1 ;NO, SET MAGTAPE DIR FOR OUTPUT FLAG = 1
JRST I1
DO1: TRO F,DOUT ;SET DTA OR DSK FOR OUTPUT FLAG = 1
TRZ F,DSKOUT ;CLEAR DISK FOR OUTPUT FLAG
SKIPN AC1 ;DISK FOR OUTPUT ?
TRO F,DSKOUT ;YES, SET DISK FOR OUTPUT FLAG = 1
I1: TRZ F,MIN+MID1+DIN ;CLEAR MTA FOR INPUT, MTA FOR INPUT DIR1
; AND DTA OR DSK FOR INPUT FLAGS
MOVEI AC3,IDEV(IC) ;ADDR. OF IDEV(IC) => AC3
PUSHJ PDP,DEVCHE ;CHECK FOR INPUT DEVICE
JRST I2 ;NO MTA, DTA OR DSK FOR INPUT
JRST DI1 ;DTA OR DSK FOR INPUT
JUMPE AC0,MI1 ;MTA FOR INPUT, DIRECTORY IN CORE ?
MTAPE ICH,1 ;NO, REWIND TAPE
PUSHJ PDP,NTAINW ;READ IN DIRECTORY
MI1: TRO F,MIN ;YES, SET MTA FOR INPUT FLAG = 1
CAIE AC3,MFILP2 ;MTA DIR2 FOR INPUT ?
TRO F,MID1 ;NO, SET MTA DIR FOR INPUT FLAG = 1
JRST I2
DI1: TRO F,DIN ;SET DTA OR DSK FOR INPUT FLAG = 1
TRZ F,DSKIN ;CLEAR DSK FOR INPUT FLAG
SKIPN AC1 ;DSK FOR INPUT ?
TRO F,DSKIN ;YES, SET DISK FOR INPUT FLAG = 1
I2: TRNE F,DIN ;NO, DTA OR DSK FOR INPUT ?
JRST DI2 ;YES
TRNE F,MIN ;NO, MTA FOR INPUT ?
JRST MI2 ;YES
TRNE F,DOUT ;NO, DTA OR DSK FOR OUTPUT ?
JRST DO2 ;YES
TRNE F,MOUT ;NO, MTA FOR OUTPUT ?
JRST MO2 ;YES
JRST IO ;NO, MAKE IO
PAGE
;IO ROUTINE
IO: SETZM MTERR4 ;MARK THAT NOT EOT
MOVE AC0,INIIDV ;YES, CAN INPUT DEVICE PERFORM INPUT ?
CALL AC0,SIXDCH
TLNN AC0,1B34
JRST ERRIDV ;NO, ERROR
MOVE AC0,INIODV ;NO, CAN OUTPUT DEVICE PERFORM OUTPUT ?
CALL AC0,SIXDCH
TLNN AC0,1B35
JRST ERRODV ;NO, ERROR
TRNE F,ASCIOU ;YES, OUTPUT IN ASCII MODE ?
JRST IO1 ;YES
TRNN F,ASCIN ;NO, INPUT IN ASCII MODE ?
JRST IO3 ;NO, MAKE IO
JRST IO2 ;YES
IO1: TRNE F,ASCIN ;INPUT IN ASCII MODE ?
JRST IO3 ;YES, MAKE IO
TLNE F,COPYFL ;NO, /X ?
JRST IO01 ;YES
JUMPE IC,IO01 ;NO, 1ST DEVICE ?
TLNE AC0,1B32 ;NO, OUTPUT-DEVICE TTY ?
JRST IO01 ;YES
TLNN AC0,1B21 ;NO, LPT ?
JRST ERRMIX ;NO, ERROR
IO01: PUSHJ PDP,RELI ;YES, RELEASE INPUT CHANNEL
PUSHJ PDP,INII1 ;INIT INPUT IN ASCII MODE
LOOKUP ICH,LOOK ;LOOKUP AGAIN
JRST ERRLOO ;FILENAME NOT FOUND
JRST IO3 ;MAKE IO
IO2: TLNN F,COPYFL ;/X ?
JUMPN IC,ERRMIX ;NO, 1ST DEVICE ?
PUSHJ PDP,RESYS ;YES, RESET SYSTEM
PUSHJ PDP,INIO1 ;INIT OUTPUT IN ASCII MODE
ENTER OCH,ENT ;ENTER AGAIN
JRST ERRENT ;ERROR
PUSHJ PDP,INII ;INIT INPUT AGAIN
IO3: PUSHJ PDP,INP ;IO
JRST IO4 ;EOF
PUSHJ PDP,OUTP ;OUTPUT WORD
JRST IO03 ;ERROR
JRST IO3 ;GO ON
IO03: SKIPE MTERR ;MTA FOR OUTPUT ?
SETOM MTERR4 ;YES, MARK THAT EOT
JRST ERROUT ;NO
IO4: CLOSE ICH, ;CLOSE INPUT-CHANNEL
TLNN F,COPYFL ;/X ?
JRST IO8 ;NO
IO5: TRNN F,DSKOUT ;YES, DSK FOR OUTPUT ?
JRST IO7 ;NO
TRNE F,PROFL ;YES, PROTECTION GIVEN ?
JRST IO6 ;YES
TLNN F,COPYFL ;NO, /X ?
JRST IO7 ;NO
TRNN F,DSKIN ;YES, DISK FOR INPUT ?
JRST IO7 ;NO
IO6: RENAME OCH,RENA ;YES, SET PROTECTION
JRST ERRPRO ;ERROR
IO7: CLOSE OCH, ;CLOSE OUTPUT-CHANNEL
STATZ OCH,IOEOT ;END OF TAPE ?
JRST IO03 ;YES
SETZM MTERR ;NO, CLEAR MTERR, MTERR1, MTERR2, MTERR3, MTERR4
PUSHJ PDP,SETZMT
JUMPN AC7,(AC7) ;NO, RETURN IF *
PUSHJ PDP,RELI ;RELEASE INPUT CHANNEL
AOJ IC, ;ALL INPUT DONE ?
CAMGE IC,ICSAV
JRST INRET ;NO, LOOK FOR MORE
PUSHJ PDP,RELO ;YES, RELEASE OUTPUT-CHANNEL
JRST COMRET ;RETURN TO COMMAND DECODER
IO8: JUMPN AC7,(AC7) ;RETURN IF *
AOJ IC, ;ALL INPUT DONE ?
CAMN IC,ICSAV
JRST IO9 ;YES
PUSHJ PDP,RELI ;NO, RELEASE INPUT-CHANNEL
JRST INRET ;LOOK FOR MORE INPUT
IO9: CAIN IC,1 ;ONLY 1 DEVICE FOR INPUT ?
JRST IO5 ;YES, LOOK FOR PROTECTION
TRNN F,DSKOUT ;NO, DISK FOR OUTPUT ?
JRST IO7 ;NO
TRNE F,PROFL ;YES, PROTECTION GIVEN ?
JRST IO6 ;YES
JRST IO7 ;NO
PAGE
;DTA OR DSK FOR OUTPUT
DO2: TLNE F,COPYFL ;/X ?
JRST DO02 ;YES
JUMPN IC,IO ;NO, 1ST DEVICE ?
SKIPE FIRFIL ;YES, FIRST FILE ?
JRST IO ;NO
SETOM FIRFIL ;YES, MARK IT
DO02: MOVE AC0,OFIL ;STORE FILENAME AND EXTENSION FOR ENTER
MOVEM AC0,ENT ; AND FOR RENAME
MOVEM RENA
MOVE AC0,OEXT
MOVEM AC0,ENT+1
MOVEM AC0,RENA+1
MOVE AC0,ODATE ;STORE OUTPUT DATE FOR ENTER AND RENAME
MOVEM AC0,ENT+2
TRNN F,PROFL ;PROTECTION GIVEN ?
JRST DO3 ;NO
TLZ AC0,777000 ;YES, SET PROTECTION
ADD AC0,PROTEC
DO3: MOVEM AC0,RENA+2
ENTER OCH,ENT ;ENTER
JRST ERRENT ;DIR. FULL
JRST IO ;MAKE IO
;DTA OR DSK FOR INPUT
DI2: JSR DAS ;MAKE LOOKUP
TLNN F,COPYFL ;/X ?
JRST DI6 ;NO
TRNN F,DSKIN ;YES, DSK FOR INPUT ?
JRST DI4 ;NO, DTA
MOVE AC0,LOOK+2 ;YES, SETUP OLD PROTECTION IN ODATE
JRST DI5
DI4: HRRZ AC0,LOOK+2 ;YES, STORE DATE IN ODATE
TRZ AC0,770000
DI5: MOVEM AC0,ODATE
MOVE AC0,IFIL(IC) ;STORE FILENAME AND EXTENSION IN OFIL, OEXT
MOVEM AC0,OFIL
MOVE AC0,IEXT(IC)
MOVEM AC0,OEXT
DI6: TRNE F,MOUT ;MTA FOR OUTPUT ?
JRST MO2 ;YES
TRNE F,DOUT ;NO, DTA OR DSK FOR OUTPUT ?
JRST DO2 ;YES
JRST IO ;NO, MAKE IO
PAGE
;MTA FOR OUTPUT
MO2: TLNE F,COPYFL ;/X ?
JRST MO02 ;YES
JUMPN IC,IO ;NO, 1ST FILE ?
SKIPE FIRFIL ;YES, 1ST FILE ?
JRST IO ;NO
SETOM FIRFIL ;YES, MARK IT
MO02: TRNN F,MOD1 ;DIRECTORY 1 ?
JRST MO3 ;NO, DIR2
MOVE AC1,PMDI11 ;YES, FILENAME POINTER => AC1
MOVEI AC4,MFILP1 ;ADDR. OF FILE POSITION => AC4
JRST MO4
MO3: MOVE AC1,PMDI21 ;SAME FOR DIR2
MOVEI AC4,MFILP2
MO4: SKIPN (AC1) ;LOOK FOR FREE FILE
JRST MO5 ;FOUND
AOBJN AC1,MO4 ;THROUGH ?
JRST ERRMFU ;YES, NO ROOM
MO5: HLRO AC2,AC1 ;GET FILENUMBER => AC2
ADDI AC2,MDIRFN+1
LSH AC2,1
SUB AC2,(AC4) ;NUMBER OF FILES TO SKIP => AC2
ADDM AC2,(AC4) ;FILE POSITION (FILENUMBER+2) => MFILP
AOS (AC4)
AOS (AC4)
JUMPL AC2,ERRFIP ;NUMBER OF FILES TO SKIP < 0 ?
JUMPE AC2,MO7 ;NO, = 0 ?
MOVNS AC2 ;NO, MAKE IT NEGATIVE
MO6: MTAPE OCH,16 ;SKIP FORWARD 1 FILE
MTAPE OCH,0 ;WAIT
AOJL AC2,MO6 ;DONE ?
MO7: MOVE AC3,(AC4) ;YES, FILE NUMBER => AC3
SOJ AC3,
SETZ AC5, ;CLEAR 1ST BYTE COUNTER
MO8: IDIVI AC3,^D10 ;CONVERT FILE NUMBER TO DECIMAL ASCII
ADDI AC4,60
PUSH PDP,AC4 ;STORE IT
AOJ AC5, ;INCREMENT 1ST BYTE COUNTER
JUMPN AC3,MO8 ;DONE ?
MOVNI AC3,5 ;YES, 2ND BYTE COUNTER AC3 <= -5
HLL AC1,PMDI12 ;GET FILENUMBER POINTER => AC1
MO9: POP PDP,AC0 ;GET FILE NUMBER BYTE => AC0
IDPB AC0,AC1 ;STORE IT IN DIR
AOJ AC3, ;INCREMENT 2ND BYTE COUNTER
SOJG AC5,MO9 ;DECREMENT 1ST BYTE COUNTER, NUMBER STORED ?
AOJE AC3,MO09 ;YES, GT 1000 ?
MOVEI AC0,"." ;NO, STORE ASCII/.TAB/ IN DIR
IDPB AC0,AC1
MO09: MOVEI AC0,11
IDPB AC0,AC1
MO10: AOJGE AC3,MO11 ;DIR. WORD FILLED ?
SETZ AC0, ;NO, FILL REST WITH 0
IDPB AC0,AC1
JRST MO10
MO11: MOVE AC0,(AC1) ;YES, GET WORD BACK INTO AC0
PUSHJ PDP,OUTP ;WRITE IT ON TAPE
JRST EREOT3 ;ERROR
ADDI AC1,MDIRFN ;AC1 <= ADDR. OF CORRESPONDING FILENAME
SKIPN AC2,OFIL ;GET OUTPUT FILENAME, = 0 ?
JRST MO17 ;YES, ERROR
MOVE AC0,AC2
MOVEM AC0,(AC1) ;NO, STORE IT IN DIR
PUSHJ PDP,OUTP ;WRITE IT ON TAPE
JRST EREOT2 ;ERROR
ADDI AC1,MDIRFN ;AC1 <= ADDR. OF CORRESPONDING EXTENSION
CALLI AC0,14 ;GET DATE => AC0
SKIPE ODATE ;ODATE ?
MOVE AC0,ODATE ;NO, STORE ODATE => AC0
HLL AC0,OEXT ;YES, AC0 <= <EXTENSION,,DATE>
MOVEM AC0,(AC1) ;STORE IT IN DIR
MOVEM AC1,MTERR ;STORE ADDR. OF EXT. IN MTA DIR. IN MTERR
PUSHJ PDP,OUTP ;WRITE IT ON TAPE
JRST EREOT1 ;ERROR
CLOSE OCH, ;CLOSE OUTPUT CHANNEL, WRITE 2 EOF
STATZ OCH,IOEOT ;END OF TAPE ?
JRST EREOT1 ;YES
HRRZ AC5,AC1 ;SAVE EXTENSION ADDR. IN AC5
TRNN F,MOD1 ;DIR1 ?
JRST MO12 ;NO, DIR2
MOVE AC1,PMD1F ;YES, GET FILENAME POINTER => AC1
MOVEI AC2,MDIRE1 ;GET ADDR. OF EXTENSION => AC2
JRST MO13
MO12: MOVE AC1,PMD2F ;SAME FOR DIR2
MOVEI AC2,MDIRE2
MO13: MOVE AC0,OFIL ;OUTPUT FILENAME => AC0
HLLZ AC3,OEXT ;OUTPUT EXTENSION => AC3
PUSHJ PDP,SETZMT ;CLEAR MTERR1, MTERR2, MTERR3, MTERR4
MO14: CAMN AC0,(AC1) ;OUTPUT FILENAME = DIR FILENAME ?
JRST MO16 ;YES
MO15: AOJ AC2, ;NO, INCR. EXTENSION ADDR.
AOBJN AC1,MO14 ;INCREMENT FILENAME POINTER, THROUGH ?
JRST IO ;YES
MO16: HLLZ AC4,(AC2) ;OUTPUT EXTENSION = DIR EXT ?
CAME AC3,AC4
JRST MO15 ;NO
HRRZ AC4,AC2 ;YES, FILE JUST WRITTEN ?
CAMN AC5,AC4
JRST MO15 ;YES
MOVEM AC2,MTERR1 ;STORE EXTENSION POINTER FOR ERROR
MOVEM AC0,MTERR2 ;STORE ALSO FILE.EXT
MOVE AC5,(AC2)
MOVEM AC5,MTERR3
SETZM (AC1) ;NO, ZERO FILENAME AND EXTENSION IN DIR
SETZM (AC2)
JRST IO
MO17: SUBI AC1,MDIRFN ;HERE ON ZERO FILENAME
SETZM (AC1) ;ZERO FILENUMBER IN DIR.
PUSHJ PDP,EOT ;RESET FILEPOSITION AND DELETE HEADERFILE
JRST ERRZFI
PAGE
;MTA FOR INPUT
MI2: JSR MAS ;NO, GET FILE
TLNN F,COPYFL ;/X ?
JRST MI4 ;NO
HRRZ AC5,(AC2) ;YES, STORE DATE IN ODATE
MOVEM AC5,ODATE
MOVE AC0,IFIL(IC) ;INPUT FILE.EXT => OFIL.OEXT
MOVEM AC0,OFIL
MOVE AC0,IEXT(IC)
MOVEM AC0,OEXT
MI4: HLRO AC0,AC1 ;GET FILE NUMBER => AC0
ADDI AC0,MDIRFN+1
LSH AC0,1
AOJ AC0,
SUB AC0,(AC3) ;GET NUMBER OF FILES TO SKIP => AC0
ADDM AC0,(AC3) ;SET MFILP TO RIGHT FILENUMBER
AOS (AC3)
MOVEM AC3,SAVAC+12 ;SAVE AC3
JUMPLE AC0,MI6 ; > 0 ?
MOVNS AC0 ;YES, MAKE IT NEGATIVE
MI5: MTAPE ICH,16 ;SKIP FORWARD 1 FILE
MTAPE ICH,0 ;WAIT
AOJL AC0,MI5 ;DONE ?
JRST MI8 ;YES, MAKE IO
MI6: JUMPE AC0,MI8 ;SKIP BACK ?
SOJ AC0, ;YES, SKIP OVER EOF
MI7: MTAPE ICH,17 ;SKIP BACK 1 FILE
MTAPE ICH,0 ;WAIT
AOJL AC0,MI7 ;DONE ?
JRST MI5 ;YES, SKIP OVER EOF
MI8: TRNE F,MOUT ;MTA FOR OUTPUT ?
JRST MI9 ;YES
TRNE F,DOUT ;NO, DTA OR DSK FOR OUTPUT ?
JRST DO2 ;YES
JRST IO ;NO, MAKE IO
MI9: MOVE AC0,ODEV ;SAME MTA# FOR INPUT AND OUTPUT ?
CAME AC0,IDEV(IC)
JRST MO2 ;NO
MOVEI AC1,MFILP2 ;YES, ERROR, SET FILEPOSITION AGAIN
TRNE F,MID1 ;DIRECTORY 1 ?
MOVEI AC1,MFILP1 ;YES
SOS (AC1)
JRST ERRMM
PAGE
;HERE ON /N (NEW TAPE) FOR OUTPUT-DEVICE
NTAOUT: MOVEI AC3,ODEV ;ADDR. OF ODEV => AC3
PUSHJ PDP,DEVCHE ;CHECK FOR DEVICE, MTA ?
JRST ERRDSW ;NO, ERROR
JRST ERRDSW ;NO, ERROR
MTAPE OCH,1 ;YES, REWIND TAPE
NTAOUW: MOVE 0,INIODV ;STORE DEVICE NAME INTO INIT FOR DIR.-READIN
MOVEM 0,INIIDD
MTAPE OCH,0 ;WAIT FOR REWIND
PUSHJ PDP,RESYS ;RELEASE INPUT AND OUTPUT CHANNELS
PUSHJ PDP,INIID ;INIT FOR INPUT DIRECTORY
PUSHJ PDP,INDIR ;GET FIRST WORD OF DIRECTORY => AC0
JRST ERRDIM ;END OF FILE, ERROR
CAME 0,MDIR1W ;IS IT A MTA WITH DIRECTORY ?
JRST ERRDIM ;NO, ERROR
HRL AC4,AC1 ;CLEAR DIRECTORY
HRR AC4,AC1
HRRZ AC5,AC4
AOJ AC4,
ADDI AC5,DIRLEN-1
SETZM (AC1)
BLT AC4,(AC5)
MOVEM 0,(AC1) ;YES, STORE IT IN CORE
AOBJN AC1,NTGMDO ;INCREMENT POINTER
NTGMDO: PUSHJ PDP,INDIR ;GET NEXT DIRECTORY-WORD FROM TAPE => AC0
JRST ERRDID ;ERROR
MOVEM 0,(AC1) ;STORE IT IN CORE
AOBJN AC1,NTGMDO ;GET NEXT WORD
MOVEI 0,2 ;SET FILEPOSITION = 2
MOVEM 0,(AC3)
PUSHJ PDP,RELID ;RELEASE INPUT-DIRECTORY-CHANNEL
PUSHJ PDP,INIO ;INIT FOR OUTPUT AND INPUT AGAIN
PUSHJ PDP,INII
POPJ PDP, ;RETURN
;HERE ON /N (NEW TAPE) FOR INPUT-DEVICE
NTAIN: MOVEI AC3,IDEV(IC) ;ADDR. OF IDEV(IC) => AC3
PUSHJ PDP,DEVCHE ;CHECK FOR DEVICE, MTA ?
JRST ERRDSW ;NO, ERROR
JRST ERRDSW ;NO, ERROR
MTAPE ICH,1 ;YES, REWIND TAPE
NTAINW: MTAPE ICH,0 ;WAIT FOR REWIND
PUSHJ PDP,INP ;GET FIRST DIRECTORY-WORD FROM TAPE => AC0
JRST ERRDIM ;END OF FILE, ERROR
CAME 0,MDIR1W ;IS IT A MTA WITH DIRECTORY ?
JRST ERRDIM ;NO, ERROR
HRL AC4,AC1 ;CLEAR DIRECTORY
HRR AC4,AC1
HRRZ AC5,AC4
AOJ AC4,
ADDI AC5,DIRLEN-1
SETZM (AC1)
BLT AC4,(AC5)
MOVEM 0,(AC1) ;YES, STORE IT IN CORE
AOBJN AC1,NTGMDI ;INCREMENT POINTER
NTGMDI: PUSHJ PDP,INP ;GET NEXT DIRECTORY-WORD FROM TAPE => AC0
JRST ERRDIN ;ERROR
MOVEM 0,(AC1) ;STORE IT IN CORE
AOBJN AC1,NTGMDI ;GET NEXT WORD
MOVEI 0,2 ;SET FILE POSITION = 2
MOVEM AC0,(AC3)
PUSHJ PDP,RELI
PUSHJ PDP,INII
POPJ PDP, ;RETURN
ERRDIM: SETZM -1(AC1) ;CLEAR MTA-NUMBER AND "MTADI"
SETZM (AC1) ; IN MTA DIRECTORY TO MARK THAT NO DIRECTORY THERE
JRST ERRDI ;TYPE ERROR MESSAGE
PAGE
;HERE ON /W (REWIND TAPE) FOR OUTPUT-DEVICE
; IF COMMAND "MTA#:/W_" IS GIVEN, WRITE OUT DIRECTORY ON TAPE
REWOUT: MOVEI AC3,ODEV ;ADDR. OF ODEV => AC3
PUSHJ PDP,DEVCHE ;CHECK FOR DEVICE, MTA ?
POPJ PDP, ;NO, JUST RETURN
POPJ PDP, ;NO, JUST RETURN
MTAPE OCH,1 ;YES, REWIND TAPE
JUMPE AC0,REWOU1 ;DIRECTORY IN CORE ?
SETOM -1(AC1) ;NO, SET DIRECTORY-HEADER = -1 AGAIN
MOVE AC4,INIODV ;RESTORE ODEV
MOVEM AC4,ODEV
REWOU1: MOVEI AC4,1 ;SET MAGTAPE FILE POSITION = 1
MOVEM AC4,-2(AC1)
MTAPE OCH,0 ;WAIT FOR REWIND
MOVE AC4,IDEV(IC) ;LOOK FOR "MTA#:/W_"
MOVE AC5,ICSAV ;MORE THEN 1 INPUT DEVICE ?
CAIN AC5,1
SKIPGE IFIASW(IC) ;NO, * FOR INPUT FILENAME ?
POPJ PDP, ;YES, RETURN
SKIPL IEXASN(IC) ;NO, * FOR INPUT EXTENSION ?
SKIPE IFIL(IC) ;NO, INPUT FILENAME NON ZERO ?
POPJ PDP, ;YES, RETURN
SKIPN IEXT(IC) ;NO, INPUT EXTENSION NON ZERO ?
CAME AC4,SIXDSK ;NO, INPUT DEVICE NON DISK ?
POPJ PDP, ;YES, RETURN
MOVEI AC3,ODEV ;NO, HERE ON "MTA#:/W_", ADDR. OF ODEV => AC3
PUSHJ PDP,DEVCHE ;CHECK FOR OUTPUT DEVICE AGAIN, MTA ?
POPJ PDP, ;NO, RETURN
POPJ PDP, ;NO, RETURN
JUMPE AC0,REWOU2 ;YES, DIR IN CORE ?
PUSHJ PDP,NTAINW ;NO, GET IT INTO CORE
JRST REWOU3 ;RETURN
REWOU2: MOVE AC0,(AC1) ;YES, GET DIR WORD
PUSHJ PDP,OUTP ;WRITE IT ON TAPE
JRST ERROUT ;ERROR
AOBJN AC1,REWOU2 ;ALL DONE ?
OUT OCH, ;YES, OUTPUT LAST BUFFER
SKIPA
JRST ERROUT ;ERROR
REWOU3: PUSHJ PDP,EX2 ;SKIP BACK DIRECTORY
JRST COMRET ;RETURN TO COMMAND DECODER
;HERE ON /W (REWIND TAPE) FOR INPUT DEVICE
REWIN: MOVEI AC3,IDEV(IC) ;ADDR. OF IDEV(IC) => AC3
PUSHJ PDP,DEVCHE ;CHECK FOR DEVICE, MTA ?
POPJ PDP, ;NO, JUST RETURN
POPJ PDP, ;NO, JUST RETURN
MTAPE ICH,1 ;YES, REWIND TAPE
JUMPE AC0,REWIN1 ;DIRECTORY IN CORE ?
SETOM -1(AC1) ;NO, SET DIRECTORY HEADER = -1 AGAIN
MOVE AC0,INIIDV ;RESTORE IDEV(IC)
MOVEM AC0,IDEV(IC)
REWIN1: MOVEI AC0,1 ;SET MAGTAPE FILE POSITION = 1
MOVEM AC0,-2(AC1)
MTAPE ICH,0 ;WAIT FOR REWIND
POPJ PDP, ;RETURN
PAGE
;HERE ON /L (LIST DIRECTORY) AND /F (LIST FILENAMES, SHORT DIRECTORY)
LIST: MOVE 0,ODEV ;GET OUTPUT-DEVICE-NAME
IFE OLDSW,< CALLI 0,64 ;GET DEVICE-NAME
JUMP
HLLZS 0
CAMN 0,SIXTTY ;TTY ?
JRST LIST1 ;YES
CAME 0,SIXLPT ;NO, LPT ?
>
IFN OLDSW,< CALL 0,SIXDCH
TLNE 0,1B32
JRST LIST1
TLNN 0,1B21
>
JRST ERRLTL ;NO, ERROR, ONLY TTY OR LPT FOR OUTPUT
TRO F,LPTOUT ;YES, MARK THAT LPT FOR OUTPUT
LIST1: MOVEI AC3,IDEV(IC) ;ADDR. OF IDEV(IC) => AC3
PUSHJ PDP,DEVCHE ;CHECK FOR DEVICE
JRST ERRDI ;NO MTA, DTA OR DSK FOR INPUT, ERROR
JRST LISTD ;DTA OR DSK FOR INPUT
;LIST MTA DIRECTORY
JUMPE 0,LISTM1 ;MTA, DIRECTORY IN CORE ?
MTAPE ICH,1 ;NO, REWIND TAPE
PUSHJ PDP,NTAINW ;GET DIRECTORY
LISTM1: PUSHJ PDP,RELI ;YES, RELEASE INPUT CHANNEL
MOVE AC1,-4(AC3) ;AC1 <= <-MDIRFN,,MDIR1+1 OR MDIR2+1>
SETZ AC0, ;CLEAR AC0, FREE FILE COUNTER
LISTM2: SKIPN (AC1) ;GET FILE-NO, = 0 ?
AOJ AC0, ;YES, INCREMENT FREE FILE COUNTER
AOBJN AC1,LISTM2 ;NO, INCREMENT FILE-NUMBER-POINTER, DONE ?
PUSHJ PDP,CRLF ;PRINT CRLF
PUSHJ PDP,LISTAS ;YES, PRINT OUT THE NUMBER OF FREE FILES
MOVE AC1,PMFITX ;PRINT OUT ASCII TEXT
PUSHJ PDP,LISTTX
MOVE AC1,-3(AC3) ;AC1 <= ASCII POINTER FOR FILE NUMBERS
MOVE AC2,-2(AC3) ;AC2 <= SIXBIT POINTER FOR FILENAMES
MOVE AC3,-1(AC3) ;AC3 <= SIXBIT POINTER FOR EXTENSION
HRRM AC3,LISTM4 ;STORE ADDR. OF MDIRE1-1 OR MDIRE2-1
SOS LISTM4 ; FOR COMPARE
LISTM3: SKIPN (AC2) ;FILENAME ZERO ?
JRST LISTM4-1 ;YES
PUSHJ PDP,SAVEAC ;NO, SAVE AC0-AC5
MOVE AC1,(AC2) ;FILENAME => AC1
HLLZ AC4,(AC3) ;EXTENSION => AC4
TDZ AC1,QFMASK(IC) ;MASK OUT "?" BITS
TDZ AC4,QEMASK(IC)
SKIPL IFIASW(IC) ;* FOR FILENAME ?
JRST LSTM45 ;NO
SKIPGE IEXASN(IC) ;YES, * FOR EXTENSION TOO ?
JRST LSTM25 ;YES
JRST LSTM15 ;NO
LSTM45: SKIPGE IEXASN(IC) ;* FOR EXT ?
JRST LSTM05 ;YES
SKIPN IFIL(IC) ;NO, FILENAME ZERO ?
JRST LSTM25 ;YES
LSTM05: MOVE AC5,IFIL(IC) ;NO, INPUT FILENAME => AC5
TDZ AC5,QFMASK(IC) ;MASK OUT "?" BITS
CAME AC1,AC5 ;INPUT FILENAME=DIR FILENAME ?
JRST LSTM35 ;NO, DON'T PRINT IT
SKIPGE IEXASN(IC) ;YES, * FOR EXT ?
JRST LSTM25 ;YES
LSTM15: HLLZ AC5,IEXT(IC) ;NO, INPUT EXT => AC5
TDZ AC5,QEMASK(IC) ;MASK OUT "?" BITS
CAME AC4,AC5 ;INPUT EXT = DIR EXT ?
JRST LSTM35 ;NO, DON'T PRINT IT
LSTM25: MOVE AC1,(AC2) ;YES, GET CORRECT FILENAME.EXT
MOVE AC4,(AC3)
EXCH AC1,SAVAC+3 ;GET OLD AC1, AC4
EXCH AC4,SAVAC+6
MOVNI AC4,5 ;BYTE COUNTER
LISTM5: ILDB AC0,AC1 ;FILENUMBER ASCII-TEXT => AC0
PUSHJ PDP,OUTP ;PRINT IT OUT
JRST ERROUT ;ERROR
AOJL AC4,LISTM5 ;DONE ?
HRLI AC1,440700 ;YES, RESTORE LEFT HALF OF FILENUMBER POINTER
EXCH AC1,SAVAC+3
EXCH AC4,SAVAC+6
PUSHJ PDP,PRFIEX ;PRINT OUT FILE.EXT
TRNN F,FILIFL ;YES, ONLY FILENAME LISTING ?
PUSHJ PDP,LIMDAT ;NO, LIST DATE TOO
PUSHJ PDP,CRLF ;YES, PRINT CR LF
SKIPA
LSTM35: PUSHJ PDP,RESTAC ;RESTORE AC0-AC5 IF NO PRINT
HRRZ AC4,AC2
LISTM4: CAIN AC4, ;RIGHT HALF SET OBOVE, ALL DONE ?
JRST MOREIN ;YES
AOJ AC1, ;NO, INCREMENT FILENUMBER POINTER
AOJ AC2, ;INCREMENT FILENAME POINTER
AOJA AC3,LISTM3 ;INCREMENT EXTENSION POINTER AND GO ON
MOREIN: AOJ IC, ;YES, INCREMENT INPUT COUNTER
CAME IC,ICSAV ;ALL INPUT DONE ?
JRST INRET ;NO
PUSHJ PDP,RELI ;YES, RELEASE INPUT AND OUTPUT CHANNEL
PUSHJ PDP,RELO
JRST COMRET ;RETURN TO COMMAND DECODER
LIMDAT: PUSHJ PDP,TWOSPA ;PRINT 2 SPACES
HRRZ AC0,(AC3) ;GET CREATION DATE OF FILE => AC0
TRZ AC0,770000
PUSHJ PDP,DATE ;LIST DATE
POPJ PDP, ;RETURN
PAGE
;LIST DTA DIRECTORY
LISTD: JUMPE AC1,LISTDS ;DEVICE DTA ?
PUSHJ PDP,DTADIR ;YES, READ DTA DIRECTORY INTO CORE
MOVE AC2,PDIR ;GET DIR.-BLOCK POINTER => AC2
SETZ AC0, ;CLEAR FREE BLOCK COUNTER
LISDT2: CAMN AC2,PEODB ;END OF DIR.-BLOCK ?
JRST LISDT3 ;YES
ILDB AC1,AC2 ;GET BLOCK-BYTE => AC1
JUMPN AC1,LISDT2 ;ZERO ?
AOJA AC0,LISDT2 ;YES, INCREMENT FREE BLOCK COUNTER
LISDT3: PUSHJ PDP,CRLF ;PRINT CR LF
PUSHJ PDP,LISTAS ;CONVERT TO ASCII AND PRINT
MOVE AC1,PBLKTX ;GET BLOCK-TEXT POINTER
PUSHJ PDP,LISTTX ;PRINT OUT TEXT
MOVE AC1,PDIRF ;POINTER TO FILENAMES => AC1
MOVEI AC2,DIRE ;POINTER TO EXTENSIONS => AC2
LISDT8: SKIPN (AC1) ;FILENAME ZERO ?
JRST LISDT9 ;YES
PUSHJ PDP,SAVEAC ;NO, SAVE AC0-AC5
MOVE AC6,(AC1) ;FILENAME => AC1 + AC6
MOVE AC1,AC6
HLLZ AC4,(AC2) ;EXT,,0 => AC4
TDZ AC1,QFMASK(IC) ;MASK OUT "?" BITS
TDZ AC4,QEMASK(IC)
SKIPL IFIASW(IC) ;* FOR FILENAME ?
JRST LSDT48 ;NO
SKIPGE IEXASN(IC) ;YES, * FOR EXTENSION TOO ?
JRST LSDT28 ;YES
JRST LSDT18 ;NO
LSDT48: SKIPGE IEXASN(IC) ;* FOR EXT ?
JRST LSDT08 ;YES
SKIPN IFIL(IC) ;NO, FILENAM ZERO ?
JRST LSDT28 ;YES
LSDT08: MOVE AC7,IFIL(IC) ;NO, INPUT FILENAME => AC7
TDZ AC7,QFMASK(IC) ;MASK OUT "?" BITS
CAME AC1,AC7 ;INPUT FILENAME = DIR FILENAME ?
JRST LSDT38 ;NO, DON'T PRINT IT
SKIPGE IEXASN(IC) ;YES, * FOR EXT ?
JRST LSDT28 ;YES
LSDT18: HLLZ AC7,IEXT(IC) ;NO, INPUT EXT => AC7
TDZ AC7,QEMASK(IC) ;MASK OUT "?" BITS
CAME AC4,AC7 ;INPUT EXT = DIR EXT ?
JRST LSDT38 ;NO, DON'T PRINT IT
LSDT28: MOVE AC1,AC6 ;YES, GET OLD FILENAME.EXT
HLLZ AC4,(AC2)
PUSHJ PDP,PRFIEX ;PRINT IT OUT
TRNN F,FILIFL ;YES, ONLY FILENAME LISTING ?
PUSHJ PDP,LIDDAT ;NO, LIST BLOCK NUMBERS AND DATE TOO
SETO AC3, ;MARK THAT NO TTCALL
PUSHJ PDP,CRLF ;YES, PRINT CRLF
SKIPA
LSDT38: PUSHJ PDP,RESTAC ;RESTORE AC0-AC5 IF NO PRINT
LISDT9: AOJ AC2, ;INCREMENT POINTERS
AOBJN AC1,LISDT8 ;ALL DONE ?
JRST MOREIN ;YES, LOOK FOR MORE INPUT
;ROUTINE TO LIST BLOCK NUMBERS AND CREATION DATES FOR DTA DIRECTORY
LIDDAT: MOVE AC3,PDIR ;BLOCK POINTER => AC3
SETZ AC0, ;CLEAR BLOCK COUNTER AC0
HRRZ AC5,AC1 ;FILENUMBER => AC5
SUBI AC5,DIRF-1
LIDDA1: CAMN AC3,PEODB ;DONE ?
JRST LIDDA2 ;YES
ILDB AC4,AC3 ;NO, GET BLOCK SLOT => AC4
CAMN AC4,AC5 ;= FILE NUMBER ?
AOJA AC0,LIDDA1 ;YES, INCREMENT BLOCK COUNTER, GO ON
JRST LIDDA1 ;NO, GO ON
LIDDA2: PUSHJ PDP,LISTAS ;PRINT OUT BLOCK COUNTER
MOVEI AC0,11 ;PRINT TAB
PUSHJ PDP,OUTP
JRST ERROUT ;ERROR
HRRZ AC0,(AC2) ;GET DATE => AC0
TRZ AC0,770000
PUSHJ PDP,DATE ;LIST DATE
POPJ PDP, ;RETURN
PAGE
;LIST DISK DIRECTORY
LISTDS: CALLI AC0,24 ;GET PROJ.-PROGR. NUMBER => AC0
MOVEM AC0,LOOK ; TO GET UFD
MOVE AC0,SIXUFD ;SIXBIT/UFD/ => LOOK+1
MOVEM AC0,LOOK+1
MOVE AC0,PP11 ;SETUP PRO,PRO NO 1,1
MOVEM AC0,LOOK+3
MOVE AC0,SIXDSK ;INIT ICH ON DSK
MOVEM AC0,INIIDV
PUSHJ PDP,RELI
PUSHJ PDP,INII
LOOKUP ICH,LOOK ;GET UFD
JRST ERRDIN ;ERROR
TRNE F,FILIFL ;SHORT DIRECTORY ?
JRST LSTDS1 ;YES
MOVE AC1,PDSDIR ;NO, TEXT POINTER => AC1
PUSHJ PDP,LISTTX ;PRINT "DIRECTORY"
CALLI AC2,24 ;GET PROJ.-PROGR. NUMBER
HLRZ AC1,AC2
PUSHJ PDP,LISTOC ;PRINT PROJ.,,PROGR.
MOVEI AC0,","
PUSHJ PDP,OUTP
JRST ERROUT
HRRZ AC1,AC2
PUSHJ PDP,LISTOC
MOVEI AC0,11 ;PRINT TAB
PUSHJ PDP,OUTP
JRST ERROUT
CALLI AC0,23 ;GET TIME => AC0
PUSHJ PDP,TIME ;PRINT IT OUT
MOVEI AC0,11 ;PRINT TAB
PUSHJ PDP,OUTP
JRST ERROUT
CALLI AC0,14 ;DATE => AC0
PUSHJ PDP,DATE ;PRINT IT OUT
PUSHJ PDP,CRLF ;PRINT CR LF
MOVE AC1,PDSTXT
TRNE F,LPTOUT ;LPT FOR OUTPUT ?
PUSHJ PDP,LISTTX ;YES, PRINT OUT DIRECTORY HEADER
MOVE AC0,SIXDSK ;NO, INIT DISK ON DIR.-CHANNEL TOO
MOVEM AC0,INIIDD
PUSHJ PDP,INIID
SETZM DSKBLK ;CLEAR TOTAL DISK BLOCK LOC.
LSTDS1: SETO AC3,
PUSHJ PDP,CRLF ;PRINT CR LF
LSDS31: PUSHJ PDP,INP ;GET FILENAME
JRST LSTDS2 ;END OF FILE
JUMPE AC0,LSDS31 ;FILENAME = 0 ?
MOVE AC1,AC0 ;NO, FILENAME => AC1
MOVEM AC1,LOOKD ;FILENAME => LOOKD
PUSHJ PDP,INP ;GET EXTENSION
JRST ERRIN ;ERROR
HLLZ AC4,AC0 ;EXT,,0 => AC4
MOVEM AC4,LOOKD+1 ;EXT. => LOOKD+1
TDZ AC1,QFMASK(IC) ;MASK OUT "?" BITS
TDZ AC4,QEMASK(IC)
SKIPL IFIASW(IC) ;* FOR FILENAME ?
JRST LSDS41 ;NO
SKIPGE IEXASN(IC) ;YES, * FOR EXTENSION TOO ?
JRST LSDS21 ;YES
JRST LSDS11 ;NO
LSDS41: SKIPGE IEXASN(IC) ;* FOR EXT ?
JRST LSDS01 ;YES
SKIPN IFIL(IC) ;NO, FILENAME ZERO ?
JRST LSDS21 ;YES
LSDS01: MOVE AC6,IFIL(IC) ;NO, INPUT FILENAME => AC6
TDZ AC6,QFMASK(IC) ;MASK OUT "?" BITS
CAME AC1,AC6 ;INPUT FILENAME = DIR FILENAME ?
JRST LSDS31 ;NO, DON'T PRINT IT
SKIPGE IEXASN(IC) ;YES, * FOR EXT ?
JRST LSDS21 ;YES
LSDS11: HLLZ AC6,IEXT(IC) ;NO, INPUT EXT => AC6
TDZ AC6,QEMASK(IC) ;MASK OUT "?" BITS
CAME AC4,AC6 ;INPUT EXT = DIR EXT ?
JRST LSDS31 ;NO, DON'T PRINT IT
LSDS21: MOVE AC1,LOOKD ;YES, GET CORRECT FILENAME.EXT
HLLZ AC4,LOOKD+1
PUSHJ PDP,PRFIEX ;PRINT IT OUT
TRNE F,FILIFL ;SHORT DIR. ?
JRST LSTDS1 ;YES, GO ON
LOOKUP ICHD,LOOKD ;NO, LOOKUP FILE.EXT
JRST ERRDIN ;ERROR
MOVEI AC0,11 ;PRINT TAB
PUSHJ PDP,OUTP
JRST ERROUT ;ERROR
SKIPL LOOKD+3 ;- WORD COUNT ?
JRST LSTDS3 ;NO, BLOCK NUMBER
HLRO AC0,LOOKD+3 ;YES, MAKE IT POSITIVE
MOVN AC0,AC0
SETZ AC1,
LSHC AC0,-7 ;DIVIDED BY 128
SKIPE AC1
AOJ AC0, ;ROUND IT
ADDM AC0,DSKBLK ;ADD IT TO TOTAL DISK BLOCK
PUSHJ PDP,LISTAS ;PRINT IT OUT
JRST LSTDS4 ;GO ON
LSTDS3: HLRZ AC0,LOOKD+3 ;GET BLOCK NUMBER
ADDM AC0,DSKBLK ;ADD IT TO TOTAL DISK BLOCK
PUSHJ PDP,LISTAS ;PRINT IT OUT
LSTDS4: MOVEI AC0,11 ;PRINT TAB
PUSHJ PDP,OUTP
JRST ERROUT ;ERROR
MOVEI AC0,"<" ;PRINT "<"
PUSHJ PDP,OUTP
JRST ERROUT ;ERROR
MOVNI AC2,3 ;COUNTER => AC2
MOVE AC1,LOOKD+2 ;GET PROTECTION => AC0
LSTDS5: SETZ AC0, ;CLEAR AC0
LSHC AC0,3
ADDI AC0,60 ;CONVERT IT TO ASCII
PUSHJ PDP,OUTP ;PRINT IT OUT
JRST ERROUT ;ERROR
AOJL AC2,LSTDS5 ;DONE ?
MOVEI AC0,">" ;YES, PRINT ">"
PUSHJ PDP,OUTP
JRST ERROUT
MOVEI AC0,11 ;PRINT TAB
PUSHJ PDP,OUTP
JRST ERROUT ;ERROR
TRNN F,LPTOUT ;LPT FOR OUTPUT ?
JRST LSTDS7 ;NO, SHORT FOR TTY
HRRZ AC0,LOOKD+1 ;YES, GET DATE => AC0
TRZ AC0,770000
PUSHJ PDP,DATE
MOVEI AC0,11 ;PRINT TAB
PUSHJ PDP,OUTP
JRST ERROUT ;ERROR
MOVE AC1,LOOKD+2 ;GET TIME => AC0
LSHC AC0,^D13
SETZ AC0,
LSHC AC0,^D11
PUSHJ PDP,TIME1 ;PRINT IT OUT
MOVEI AC0,11 ;PRINT TAB
PUSHJ PDP,OUTP
JRST ERROUT ;ERROR
LSTDS7: HRRZ AC0,LOOKD+2 ;CREATION DATE => AC0
TRZ AC0,770000
PUSHJ PDP,DATE ;PRINT IT OUT
TRNN F,LPTOUT ;LPT FOR OUTPUT ?
JRST LSTDS1 ;NO, SHORT FOR TTY
MOVEI AC0,11 ;YES, PRINT TAB
PUSHJ PDP,OUTP
JRST ERROUT ;ERROR
MOVE AC2,LOOKD+2 ;MODE =>AC1
LSHC AC1,^D9
SETZ AC1,
LSHC AC1,4
PUSHJ PDP,LISTOC ;TYPE IT OUT
JRST LSTDS1 ;GO ON
LSTDS2: PUSHJ PDP,CRLF
TRNE F,FILIFL ;SHORT DIR. ?
JRST LSTDS6 ;YES
MOVE AC1,PBKTXT
PUSHJ PDP,LISTTX ;PRINT "TOTAL BLOCKS"
MOVE AC0,DSKBLK ;GET TOTAL DISK BLOCKS
PUSHJ PDP,LISTAS ;PRINT IT OUT
PUSHJ PDP,CRLF ;PRINT CR LF
PUSHJ PDP,RELID ;RELEASE DIRECTORY-INPUT-CHANNEL
LSTDS6: PUSHJ PDP,RELI ;RELEASE INPUT CHANNEL
JRST MOREIN ;LOOK FOR MORE INPUT
PAGE
;HERE ON /Z (ZERO THE DIRECTORY)
ZERO: MOVEI AC3,ODEV ;ADDR. OF ODEV => AC3
PUSHJ PDP,DEVCHE ;CHECK FOR DEVICE
JRST ERRDI ;NO MTA, DTA OR DSK FOR OUTPUT, ERROR
JRST ZERODT ;DTA OR DSK
MTAPE OCH,1 ;MTA, REWIND TAPE
MOVE 0,MDIR1W ;MARK THAT MAGTAPE HAS A DIRECTORY
MOVEM 0,(AC1)
AOJ AC1,
SETZB 0,(AC1) ;ZERO DIRECTORY IN CORE
HRLS AC2,AC1
AOJ AC1,
ADDI AC2,DIRLEN-2
BLT AC1,(AC2)
MOVNI AC1,DIRLEN
MOVE 0,MDIR1W ;GET DIRECTORY IDENTIFICATION WORD (ASCII/MTADI/)
MTAPE OCH,0 ;WAIT FOR REWIND
PUSHJ PDP,OUTP ;STORE IT ON TAPE
JRST ZERO2 ;END OF TAPE, ERROR
SETZ AC0,
ZEROM2: PUSHJ PDP,OUTP ;ZERO DIRECTORY ON TAPE
JRST ZERO2 ;END OF TAPE, ERROR
AOJL AC1,ZEROM2 ;ALL DONE ?
CLOSE OCH, ;YES, WRITE 2 END OF FILES
MOVEI AC0,2 ;SET FILE POSITION = 2
MOVEM AC0,(AC3)
JRST ZERO1 ;RELEASE CHANNELS
ZERODT: JUMPE AC1,ERRNZD ;DTA ?
CALL OCH,[SIXBIT/UTPCLR/] ;YES, CLEAR DTA-DIRECTORY
ZERO1: PUSHJ PDP,RELI ;RELEASE INPUT AND OUTPUT CHANNELS
PUSHJ PDP,RELO
TTCALL 3,[ASCIZ/ZERO DIRECTORY !
/]
JRST COMRET ;ALL DONE
ZERO2: MOVEI AC0,1 ;ERROR, SET FILEPOSITION = 1
MOVEM AC0,(AC3)
JRST ERROUT
PAGE
;HERE ON /E (WRITE OUT DIRECTORY ON TAPES, REWIND TAPES AND EXIT)
EX: TLNN F,ENDFL ;/E ?
JRST ERRCMA ;NO, ERROR
SKIPL AC1,MDIR10 ;DIR1 IN CORE ?
PUSHJ PDP,EXD1 ;YES, WRITE IT OUT
SKIPGE AC1,MDIR20 ;NO, DIR2 IN CORE ?
CALLI 12 ;NO, JUST EXIT TO MONITOR
PUSHJ PDP,EXNU ;YES, INIT TAPE AND REWIND
EXD2L: MOVE AC0,MDIR2(AC1) ;GET DIR2-WORD => AC0
PUSHJ PDP,OUTP ;WRITE IT ON TAPE
JRST ERROUT ;ERROR
AOBJN AC1,EXD2L ;ALL DONE ?
PUSHJ PDP,EX1 ;YES, REWIND TAPE, RELEASE CHANNEL
CALLI 12 ;EXIT TO MONITOR
;WRITE DIRECTORY 1 ONTO TAPE
EXD1: PUSHJ PDP,EXNU ;INIT TAPE AND REWIND IT
EXD1L: MOVE AC0,MDIR1(AC1) ;GET DIR1 WORD => AC0
PUSHJ PDP,OUTP ;WRITE IT ON TAPE
JRST ERROUT ;ERROR
AOBJN AC1,EXD1L ;ALL DONE ?
PUSHJ PDP,EX1 ;YES, REWIND TAPE, RELEASE CHANNEL
POPJ PDP, ;RETURN
;INIT TAPE FOR OUTPUT AND REWIND IT
EXNU: ADDI AC1,17 ;SIXBIT MTA NUMBER => AC1
LSH AC1,^D12 ;STORE SIXBIT/MTA#/ FOR INIT
HLL AC1,SIXMTA
MOVEM AC1,INIODV
PUSHJ PDP,INIO ;INIT OUTPUT
MTAPE OCH,1 ;REWIND TAPE
MOVNI AC1,DIRLEN ;<-DIRLEN,,0> => AC1
HRLZS AC1
MTAPE OCH,0 ;WAIT FOR REWIND
POPJ PDP, ;RETURN
;OUTPUT LAST BUFFER, SKIP BACK AND RELEASE SYSTEM
EX1: OUT OCH, ;OUTPUT LAST BUFFER
JRST EX2
JRST ERROUT ;ERROR
EX2: MTAPE OCH,17 ;SKIP BACK DIRECTORY
MTAPE OCH,0 ;WAIT
PUSHJ PDP,RESYS ;RELEASE OUTPUT CHANNEL
POPJ PDP, ;RETURN
PAGE
;HERE ON /D (DELETE FILES)
DELETE: PUSHJ PDP,RELI ;RELEASE INPUT CHANNEL
SETO AC6, ;MARK THAT DELETE IS WANTED
SKIPL IFIASW(IC) ;* FOR INPUT FILENAME ?
JRST DEL1 ;NO
SKIPGE IEXASN(IC) ;YES, * FOR INPUT EXTENSION ?
JRST DEL2 ;YES, ZERO DIRECTORY
DEL1: TRON F,FIDEL ;NO, WAS "FILES DELETED:" WRITTEN ALREADY ?
TTCALL 3,[ASCIZ/FILES DELETED :
/]
MOVEI AC3,ODEV ;YES, ADDR. OF ODEV => AC3
PUSHJ PDP,DEVCHE ;CHECK FOR DEVICE
JRST ERRDI ;NO MTA, DTA OR DSK
JSR DAS ;DTA OR DSK DELETE
JUMPE AC0,MAS+1 ;MTA, DIRECTORY IN CORE ?
MTAPE OCH,1 ;NO, REWIND TAPE
PUSHJ PDP,NTAOUW ;GET DIRECTORY
JSR MAS ;DELETE FILES
;HERE FOR DELETE *.*
DEL2: MOVEI AC3,ODEV ;ADDR. OF ODEV => AC3
PUSHJ PDP,DEVCHE ;CHECK FOR DEVICE
JRST ERRDI ;ERROR, DEVICE HAS NO DIR.
SKIPA ;DTA OR DSK
JSR MAS ;MTA
JUMPN AC1,ZERO ;DTA
JRST DEL1 ;DISK
PAGE
;ROUTINE TO HANDLE ASTERIX FOR FILENAME AND EXTENSION AND TO DELETE FILES
; FOR MAGTAPES
MAS: 0 ;ENTER BY JSR MAS
MOVE AC1,-5(AC3) ;FILENAME POINTER => AC1
HRRZ AC2,-1(AC3) ;ADDR. OF MDIRE => AC2
SKIPGE IFIASW(IC) ;* FOR FILENAME ?
JRST MAS5 ;YES
SKIPGE IEXASN(IC) ;NO, * FOR EXTENSION ?
JRST MAS13 ;YES
SKIPN AC4,IFIL(IC) ;NO, INPUT FILENAME => AC4, = 0 ?
JRST ERRZFI ;YES, ERROR
SKIPN QFMASK(IC) ;NO, QUESTION MARK WITHIN FILENAME OR EXTENSION ?
SKIPE QEMASK(IC)
JRST MQ ;YES
MOVE AC0,IEXT(IC) ;NO, INPUT EXTENSION => AC0
MAS1: CAMN AC4,(AC1) ;INPUT FILENAME = DIR FILENAME ?
JRST MAS3 ;YES
MAS2: AOJ AC2, ;NO, INCREMENT EXTENSION ADDR.
AOBJN AC1,MAS1 ;INCREMENT FILENAME POINTER, THROUGH ?
JRST ERRLOO ;YES, FILENAME NOT FOUND
MAS3: HLLZ AC5,(AC2) ;INPUT EXT = DIRECTORY EXT ?
CAME AC0,AC5
JRST MAS2 ;NO, GO ON
JUMPE AC6,@MAS ;YES, DELETE ?
;HERE FOR DELETE FILE.EXT ON MTA
PUSHJ PDP,TYDEF1 ;YES, TYPE OUT DELETED FILE
JRST DASRET ;LOOK FOR MORE INPUT
;HERE ON *. FOR FILES ON MTA
MAS5: SKIPGE IEXASN(IC) ;*.* ?
JRST MAS21 ;YES
MOVEI AC4,12 ;NO, STORE * IN IFIL
HRLZM AC4,IFIL(IC)
MAS6: MOVE AC0,IEXT(IC) ;EXTENSION => AC0
HLLZ AC5,(AC2) ;INPUT EXTENSION = DIR. EXT ?
TDZ AC0,QEMASK(IC) ;MASK OUT "?"-BITS
TDZ AC5,QEMASK(IC)
CAMN AC0,AC5 ;INPUT EXTENSION = DIR. EXTENSION ?
JRST MAS9 ;YES
MAS7: AOJ AC2, ;NO, INCREMENT POINTER FOR EXT. AND FILENAME
AOBJN AC1,MAS6 ;THROUGH ?
MAS8: JRST ERRLOO ;YES, INSTRUCTION CHANGED
MAS9: MOVE AC4,(AC1) ;FILENAME => AC4
JUMPE AC4,MAS7 ;FILENAME ZERO ?
MOVEM AC4,IFIL(IC) ;NO, STORE IT IN IFIL
MOVE AC5,(AC2) ;SET UP CORRECT EXTENSION
HLLZM AC5,IEXT(IC)
MOVEI AC4,MAS12 ;CHANGE JRST IN MAS8
HRRM AC4,MAS8
JUMPN AC6,MAS11 ;DELETE ?
JSR MTSAV ;NO, DO INPUT
JRST MAS7 ;GO ON
;HERE FOR DELETE *. ON MTA
MAS11: PUSHJ PDP,TYDEF1 ;TYPE OUT DELETED FILE
JRST MAS7
MAS12: MOVEI AC3,ERRLOO ;YES, RESTORE ERROR JRST IN MAS8
HRRM AC3,MAS8
JRST DASRET ;LOOK FOR MORE INPUT
;HERE FOR .* ON MTA
MAS13: MOVEI AC4,12 ;STORE * IN IEXT
HRLZM AC4,IEXT(IC)
MAS14: SKIPN AC4,IFIL(IC) ;FILENAME ZERO ?
JRST ERRZFI ;YES, ERROR
MOVE AC5,(AC1) ;NO, DIR FILENAME => AC5
JUMPE AC5,MAS15 ;FILENAME = 0 ?
TDZ AC5,QFMASK(IC) ;NO, MASK OUT "?" BITS
TDZ AC4,QFMASK(IC)
CAMN AC4,AC5 ;INPUT FILENAME = DIR. FILENAME ?
JRST MAS17 ;YES
MAS15: AOJ AC2, ;NO, INCREMENT POINTERS FOR EXT. AND FILENEME
AOBJN AC1,MAS14 ;THROUGH ?
MAS16: JRST ERRLOO ;YES, INSTRUCTION CHANGED
MAS17: MOVE AC0,(AC2) ;EXTENSION => IEXT
HLLZM AC0,IEXT(IC)
MOVE AC5,(AC1) ;STORE CORRECT FILENAME
MOVEM AC5,IFIL(IC)
MOVEI AC0,MAS20 ;CHANGE JRST IN MAS16
HRRM AC0,MAS16
JUMPN AC6,MAS19 ;DELETE ?
JSR MTSAV ;NO, DO INPUT
JRST MAS15 ;GO ON
;HERE FOR DELETE FILES .* ON MTA
MAS19: PUSHJ PDP,TYDEF1 ;TYPE OUT DELETED FILE
JRST MAS15
MAS20: MOVEI AC3,ERRLOO ;RESTORE ERROR JRST IN MAS16
HRRM AC3,MAS16
JRST DASRET ;LOOK FOR MORE INPUT
;HERE FOR *.* ON MTA
MAS21: JUMPN AC6,MAS27 ;INPUT ?
SKIPE AC4,(AC1) ;YES, FILENAME ZERO ?
JRST MAS24 ;NO
MAS22: AOJ AC2, ;YES, INCREMENT POINTERS
AOBJN AC1,MAS21 ;THROUGH ?
MAS23: JRST ERRZDI ;YES, INSTRUCTOIN CHANGED
MAS24: MOVEI AC0,MAS26 ;CHANGE ERROR JRST IN MAS23
HRRM AC0,MAS23
MOVEM AC4,IFIL(IC) ;STORE FILE.EXT IN IFIL AND IEXT
MOVE AC0,(AC2)
HLLZM AC0,IEXT(IC)
JRST MAS22 ;GO ON
MAS26: MOVEI AC0,ERRZDI ;RESTORE ERROR JRST IN MAS23
HRRM AC0,MAS23
JRST DASRET ;LOOK FOR MORE INPUT
;HERE FOR DELETE *.* ON MTA
MAS27: SKIPE AC4,(AC1) ;FILENAME ZERO ?
JRST MAS29 ;NO
MAS28: AOJ AC2, ;YES, INCREMENT POINTERS
AOBJN AC1,MAS27 ;THROUGH ?
JRST DASRET ;YES
MAS29: MOVEM AC4,IFIL(IC) ;STORE FILE.EXT IN IFIL AND IEXT
HLLZ AC4,(AC2)
MOVEM AC4,IEXT(IC)
PUSHJ PDP,TYDEF1 ;TYPE IT OUT
JRST MAS28 ;GO ON
;HERE FOR "?" WITHIN FILENAME OR EXTENSION WITHOUT "*" FOR MTA
MQ: SKIPN AC4,IFIL(IC) ;INPUT FILENAME => AC4, = 0 ?
JRST ERRZFI ;YES, ERROR
MOVE AC0,(AC1) ;DIR FILENAME => AC0, = 0 ?
JUMPE AC0,MQ1
TDZ AC0,QFMASK(IC) ;NO, MASK OUT "?" BITS
TDZ AC4,QFMASK(IC)
CAMN AC0,AC4 ;INPUT FILENAME = DIR FILENAME ?
JRST MQ3 ;YES
MQ1: AOJ AC2, ;INCREMENT POINTERS FOR FILENAME AND EXT
AOBJN AC1,MQ ;THROUGH ?
MQ2: JRST ERRLOO ;YES, INSTRUCTION CHANGED
MQ3: HLLZ AC0,IEXT(IC) ;INPUT EXT => AC0
HLLZ AC4,(AC2) ;DIR EXT => AC4
TDZ AC0,QEMASK(IC) ;MASK OUT "?" BITS
TDZ AC4,QEMASK(IC)
CAME AC0,AC4 ;INPUT EXT = DIR EXT ?
JRST MQ1 ;NO, GO ON
MOVE AC0,(AC1) ;YES, STORE CORRECT FILENAME.EXT
HLLZ AC4,(AC2)
MOVEM AC0,IFIL(IC)
MOVEM AC4,IEXT(IC)
MOVEI AC4,MQ5 ;CHANGE JRST IN MQ2
HRRM AC4,MQ2
JUMPN AC6,MQ4 ;DELETE ?
JSR MTSAV ;NO, DO INPUT
JRST MQ1 ;GO ON
;HERE FOR DELETE FILES WITH "?" WITHOUT "*"
MQ4: PUSHJ PDP,TYDEF1 ;TYPE OUT DELETED FILES
JRST MQ1 ;GO ON
MQ5: MOVEI AC3,ERRLOO ;RESTORE JRST IN MQ2
HRRM AC3,MQ2
JRST DASRET ;LOOK FOR MORE INPUT
;ROUTINE TO SAVE AC1 + AC2 THEN DO INPUT AND RESTORE AC1, AC2 + AC3
MTSAV: 0 ;ENTER BY JSR MTSAV
MOVEM AC1,SAVAC+10 ;INPUT, SAVE AC1, AC2
MOVEM AC2,SAVAC+11
MOVEI AC7,MTSAV1 ;RETURN ADDR. => AC7
JRST @MAS ;MAKE INPUT
MTSAV1: MOVE AC1,SAVAC+10 ;RESTORE AC1, AC2 AND AC3
MOVE AC2,SAVAC+11
MOVE AC3,SAVAC+12
JRST @MTSAV ;RETURN
PAGE
;ROUTINE TO HANDLE ASTERIX FOR FILENAME AND EXTENSION AND DELETE FILES FOR DTA AND DSK
DAS: 0 ;ENTER BY JSR
MOVEI AC0,12 ;* => AC0
SKIPGE IFIASW(IC) ;* FOR FILENAME ?
JRST DAS2 ;YES
SKIPGE IEXASN(IC) ;NO, * FOR EXTENSION ?
JRST DAS3 ;YES
SKIPN QFMASK(IC) ;NO, "?" WITHIN FILENAME OR EXTENSION ?
SKIPE QEMASK(IC)
JRST DQ ;YES
MOVE AC0,IFIL(IC) ;NO, STORE INPUT FILENAME AND EXT FOR LOOKUP
MOVEM AC0,LOOK
MOVE AC0,IEXT(IC)
MOVEM AC0,LOOK+1
TLNE F,DELFL ;DELETE ?
JRST DAS1 ;YES
LOOKUP ICH,LOOK ;NO, LOOKUP FOR INPUT
JRST ERRLOO ;ERROR
JRST @DAS ;RETURN
;HERE FOR DELETE FILES WITHOUT * ON DTA AND DISK
DAS1: JUMPN AC1,DTAS23 ;DTA ?
LOOKUP OCH,LOOK ;NO, DSK, LOOKUP FOR DELETE
JRST ERRLOO ;FILENAME NOT FOUND
SETZM RENA ;CLEAR FILENAME FOR RENAME (DELETE)
RENAME OCH,RENA ;DELETE
JRST ERRPRO ;ERROR
DAS01: PUSHJ PDP,TYDEF2 ;TYPE OUT DELETED FILE
JRST MOREIN ;LOOK FOR MORE INPUT
;HERE FOR DELETE FILE WITHOUT * ON DTA
DTAS23: PUSHJ PDP,DTADI1 ;GET DTA DIRECTORY
MOVE AC4,IEXT(IC) ;IEXT => AC4
SKIPN AC3,IFIL(IC) ;IFIL => AC3, = 0 ?
JRST ERRZFI ;YES, ERROR
DTAS24: CAMN AC3,(AC1) ;NO, IFIL = DIR. FILE ?
JRST DTAS26 ;YES
DTAS25: AOJ AC2, ;NO, INCREMENT POINTERS
AOBJN AC1,DTAS24 ;THROUGH ?
JRST ERRLOO ;YES, ERROR
DTAS26: HLLZ AC5,(AC2) ;IEXT = DIR EXT ?
CAME AC5,AC4
JRST DTAS25 ;NO, GO ON
PUSHJ PDP,DELDTA ;YES, DELETE FILE.EXT IN DIR
PUSHJ PDP,DTDIOU ;WRITE OUT NEW DIR
JRST DAS01 ;TYPE IT OUT
;HERE FOR DTA OR DSK FILES WITH *
DAS2: HRLZM AC0,IFIL(IC) ;STORE * IN IFIL
SKIPA
DAS3: HRLZM AC0,IEXT(IC) ;STORE * IN IEXT
JUMPE AC1,DSAS1 ;DEVICE DTA ?
PUSHJ PDP,DTADI1 ;YES, GET DIR
SKIPGE IFIASW(IC) ;* FOR FILENAME ?
JRST DTAS10 ;YES
SKIPN IFIL(IC) ;NO, FILNAME ZERO ?
JRST ERRZFI ;YES, ERROR
DTAS4: MOVE AC3,IFIL(IC) ;NO, FILENAME => AC3
MOVE AC5,(AC1) ;DIR FILENAME => AC5
JUMPE AC5,DTAS40 ;FILENAME = 0 ?
TDZ AC3,QFMASK(IC) ;NO, MASK OUT "?" BITS
TDZ AC5,QFMASK(IC)
CAMN AC3,AC5 ;INPUT FILENAME = DIR. FILENAME ?
JRST DTAS6 ;YES
DTAS40: AOJ AC2, ;INCREMENT FILENAME AND EXT. POINTERS
AOBJN AC1,DTAS4 ;THROUGH ?
DTAS5: JRST ERRLOO ;YES, INSTRUCTION CHANGED
DTAS6: HLLZ AC4,(AC2) ;EXTENSION => AC4
MOVE AC3,(AC1) ;STORE CORRECT FILENAME
MOVEM AC3,IFIL(IC)
MOVEM AC3,LOOK ;STORE FILE.EXT FOR LOOKUP
MOVEM AC4,LOOK+1
MOVEM AC4,IEXT(IC) ;STORE EXTENSION IN IEXT
MOVEI AC3,DTAS9 ;CHANGE JRST IN DTAS5
HRRM AC3,DTAS5
JUMPN AC6,DTAS8 ;DELETE ?
JSR DTSAV ;NO, DO INPUT
JRST DTAS40 ;GO ON
;HERE FOR DELETE .* ON DTA
DTAS8: PUSHJ PDP,DELDTA ;DELETE FILE.EXT IN DIR
PUSHJ PDP,TYDEF1 ;TYPE OUT DELETED FILE
JRST DTAS40
DTAS9: MOVEI AC3,ERRLOO ;RESTORE ERROR JRST IN DTAS5
HRRM AC3,DTAS5
JUMPE AC6,DASRET ;DELETE ?
PUSHJ PDP,DTDIOU ;YES, WRITE OUT NEW DIR
DASRET: JUMPN AC6,MOREIN ;HERE FROM INPUT ?
SETZ AC7, ;CLEAR AC7 (RETURN ADDR.)
JRST IO8 ;LOOK FOR MORE INPUT
;HERE ON * FOR FILENAME ON DTA
DTAS10: SKIPGE IEXASN(IC) ;*.* ?
JRST DTAS18 ;YES
DTAS11: HLLZ AC3,IEXT(IC) ;NO, EXTENSION => AC3
HLLZ AC0,(AC2) ;INPUT EXT. = DIR. EXT. ?
TDZ AC0,QEMASK(IC) ;MASK OUT "?" BITS
TDZ AC3,QEMASK(IC)
CAMN AC0,AC3
JRST DTAS14 ;YES
DTAS12: AOJ AC2, ;INCREMENT FILENAME AND EXT. POINTERS
AOBJN AC1,DTAS11 ;THROUGH ?
DTAS13: JRST ERRLOO ;YES
DTAS14: MOVE AC4,(AC1) ;FILENAME => AC4
JUMPE AC4,DTAS12 ;FILENAME ZERO ?
MOVEM AC4,IFIL(IC) ;NO, STORE IT IN IFIL
MOVEM AC4,LOOK ;STORE FILE.EXT FOR LOOKUP
HLLZ AC3,(AC2) ;STORE CORRECT EXTENSION
MOVEM AC3,IEXT(IC)
MOVEM AC3,LOOK+1
MOVEI AC3,DTAS17 ;CHANGE JRST IN DTAS13
HRRM AC3,DTAS13
JUMPN AC6,DTAS16 ;DELETE ?
JSR DTSAV ;NO, DO INPUT
JRST DTAS12 ;GO ON
;HERE FOR DELETE *. ON DTA
DTAS16: PUSHJ PDP,DELDTA ;DELETE FILE.EXT IN DIR
PUSHJ PDP,TYDEF1 ;TYPE OUT DELETED FILE
JRST DTAS12
DTAS17: MOVEI AC3,ERRLOO ;RESTORE ERROR JRST IN DTAS13
HRRM AC3,DTAS13
JUMPE AC6,DASRET ;DELETE ?
PUSHJ PDP,DTDIOU ;YES, WRITE OUT NEW DIR.
JRST DASRET ;LOOK FOR MORE INPUT
;HERE ON *.* FOR DTA
DTAS18: SKIPE AC3,(AC1) ;HERE ON *.*, FILENAME ZERO ?
JRST DTAS20 ;NO
AOJ AC2, ;YES, INCREMENT POINTERS
AOBJN AC1,DTAS18 ;THROUGH ?
DTAS19: JRST ERRZDI ;YES, INSTRUCTION CHANGED
DTAS20: MOVE AC0,(AC2) ;STORE FILE.EXT IN IFIL, IEXT AND FOR LOOKUP
MOVEM AC3,IFIL(IC)
MOVEM AC3,LOOK
MOVEM AC0,IEXT(IC)
MOVEM AC0,LOOK+1
MOVEI AC0,DTAS22 ;CHANGE ERROR JRST IN DTAS19
HRRM AC0,DTAS19
JSR DTSAV ;DO INPUT
AOJ AC2, ;INCREMENT POINTERS
AOBJN AC1,DTAS18 ;THROUGH ?
DTAS22: MOVEI AC3,ERRZDI ;YES, RESTORE JRST IN DTAS19
HRRM AC3,DTAS19
JRST DASRET ;LOOK FOR MORE INPUT
;HERE FOR "?" WITHIN FILENAME OR EXTENSION WITHOUT "*" ON DTA
DQ: JUMPE AC1,DSQ ;DEVICE DTA ?
PUSHJ PDP,DTADI1 ;YES, GET DTA DIRECTORY
DTQ1: SKIPN AC3,IFIL(IC) ;INPUT FILENAME => AC3, = 0 ?
JRST ERRZFI ;YES, ERROR
MOVE AC0,(AC1) ;NO, DIR FILENAME => AC0, = 0 ?
JUMPE AC0,DTQ2
TDZ AC0,QFMASK(IC) ;NO, MASK OUT "?" BITS
TDZ AC3,QFMASK(IC)
CAMN AC0,AC3 ;INPUT FILENAME = DIR FILENAME ?
JRST DTQ4 ;YES
DTQ2: AOJ AC2, ;NO, INCREMENT POINTERS
AOBJN AC1,DTQ1 ;THROUGH ?
DTQ3: JRST ERRLOO ;YES, INSTRUCTION CHANGED
DTQ4: HLLZ AC4,(AC2) ;DIR EXT => AC4
HLLZ AC5,IEXT(IC) ;INPUT EXT => AC5
TDZ AC4,QEMASK(IC) ;MASK OUT "?" BITS
TDZ AC5,QEMASK(IC)
CAME AC4,AC5 ;INPUT EXT = DIR EXT ?
JRST DTQ2 ;NO, GO ON
MOVE AC3,(AC1) ;YES, STORE CORRECT FILENAME.EXT
HLLZ AC4,(AC2)
MOVEM AC3,IFIL(IC)
MOVEM AC3,LOOK
MOVEM AC4,IEXT(IC)
MOVEM AC4,LOOK+1
MOVEI AC3,DTQ6 ;CHANGE JRST IN DTQ3
HRRM AC3,DTQ3
JUMPN AC6,DTQ5 ;DELETE ?
JSR DTSAV ;NO, DO INPUT
JRST DTQ2 ;GO ON
;HERE TO DELETE FILES WITH "?" BUT WITHOUT "*" FOR DTA
DTQ5: PUSHJ PDP,DELDTA ;DELETE FILE.EXT IN DIR
PUSHJ PDP,TYDEF1 ;TYPE OUT DELETED FILE.EXT
JRST DTQ2 ;GOON
DTQ6: MOVEI AC3,ERRLOO ;RESTORE JRST IN DTQ3
HRRM AC3,DTQ3
JUMPE AC6,DASRET ;DELETE ?
PUSHJ PDP,DTDIOU ;YES, WRITE OUT NEW DIRECTORY
JRST DASRET ;DOOK FOR MORE INPUT
;ROUTINE TO MAKE LOOKUP, SAVE AC1+AC2, MAKE INPUT AND RESTORE AC1+AC2
DTSAV: 0 ;ENTER BY JSR DTSAV
LOOKUP ICH,LOOK ;LOOKUP FOR INPUT
JRST ERRLOO ;ERROR
MOVEI AC7,DTSAV1 ;RETURN ADDR. => AC7
MOVEM AC1,SAVAC+10 ;SAVE AC1, AC2
MOVEM AC2,SAVAC+11
JRST @DAS ;MAKE INPUT
DTSAV1: MOVE AC1,SAVAC+10 ;RESTORE AC1, AC2
MOVE AC2,SAVAC+11
JRST @DTSAV ;RETURN
PAGE
;HERE FOR DSK
DSAS1: JSR DSDI ;INIT DIRECTORY INPUT
SKIPGE IFIASW(IC) ;* FOR FILENAME ?
JRST DSAS8 ;YES
SKIPN IFIL(IC) ;NO, FILENAME ZERO ?
JRST ERRZFI ;YES, ERROR
DSAS2: MOVE AC3,IFIL(IC) ;NO, FILENAME => AC3
TDZ AC3,QFMASK(IC) ;MASK OUT "?" BITS
DSAS4: PUSHJ PDP,INDIR ;GET DIR. FILENAME => AC0
DSAS3: JRST ERRLOO ;END OF FILE, INSTRUCTION CHANGED
JUMPE AC0,DSAS4 ;NO, FILENAME ZERO ?
MOVE AC5,AC0 ;SAVE FILENAME IN AC5
TDZ AC0,QFMASK(IC) ;MASK OUT "?" BITS
CAMN AC3,AC0 ;NO, INPUT FILENAME = DIR. FILENAME ?
JRST DSAS5 ;YES
PUSHJ PDP,INDIR ;NO, GET EXTENSION
JRST ERRDIN ;ERROR
JRST DSAS2 ;GO ON
DSAS5: PUSHJ PDP,INDIR ;GET EXTENSION => AC0
JRST ERRDIN ;ERROR
MOVEM AC0,IEXT(IC) ;STORE EXTENSION IN IEXT
MOVEM AC5,IFIL(IC)
MOVEM AC5,LOOK ;STORE FILE.EXT FOR DELETE
MOVEM AC0,LOOK+1
MOVEI AC3,DSAS7 ;CHANGE JRST IN DSAS3
HRRM AC3,DSAS3
JUMPN AC6,DSAS6 ;INPUT ?
LOOKUP ICH,LOOK ;YES, LOOKUP FOR INPUT
JRST ERRLOO ;ERROR
MOVEI AC7,DSAS2 ;RETURN ADDR. => AC7
JRST @DAS ;RETURN
;HERE FOR DELETE FILES .* ON DSK
DSAS6: SETZM RENA
LOOKUP OCH,LOOK ;LOOKUP
JRST ERRLOO ;ERROR
RENAME OCH,RENA ;DELETE
JRST ERRPRO ;ERROR
PUSHJ PDP,TYDEF2 ;TYPE OUT DELETED FILE
JRST DSAS2 ;GO ON
DSAS7: MOVEI AC3,ERRLOO ;RESTORE ERROR JRST IN DSAS3
HRRM AC3,DSAS3
JRST DSAS17 ;RELEASE DIR.-INPUT CHANNEL
;HERE ON * FOR FILENAME ON DSK
DSAS8: SKIPGE IEXASN(IC) ;* ALSO FOR EXTENSION ?
JRST DSAS14 ;YES, ZERO DIRECTORY
DSAS9: HLLZ AC3,IEXT(IC) ;NO, EXTENSION => AC3
TDZ AC3,QEMASK(IC) ;MASK OUT "?" BITS
DSAS11: PUSHJ PDP,INDIR ;GET FILENAME
DSAS10: JRST ERRLOO ;END OF FILE, INSTRUCTION CHANGED
JUMPE AC0,DSAS11 ;FILENAME ZERO ?
MOVE AC1,AC0 ;NO, FILENAME => AC1
PUSHJ PDP,INDIR ;GET DIR. EXTENSION
JRST ERRDIN ;ERROR
HLLZS AC0
MOVE AC5,AC0 ;SAVE EXT IN AC5
TDZ AC0,QEMASK(IC) ;MASK OUT "?" BITS
CAME AC0,AC3 ;INPUT EXT. = DIR. EXT. ?
JRST DSAS9 ;NO, GO ON
MOVEM AC1,IFIL(IC) ;YES, STORE FILENAME IN IFIL
MOVEM AC1,LOOK ;STORE FILE.EXT FOR DELETE
MOVEM AC5,IEXT(IC) ;STORE CORRECT EXT
MOVEM AC5,LOOK+1
MOVEI AC3,DSAS13 ;CHANGE JRST IN DSAS10
HRRM AC3,DSAS10
JUMPN AC6,DSAS12 ;INPUT ?
LOOKUP ICH,LOOK ;YES, LOOKUP FOR INPUT
JRST ERRLOO ;ERROR
MOVEI AC7,DSAS9 ;RETURN ADDR. => AC7
JRST @DAS ;RETURN
;HERE FOR DELETE *. ON DSK
DSAS12: SETZM RENA
LOOKUP OCH,LOOK ;LOOKUP
JRST ERRLOO ;ERROR
RENAME OCH,RENA ;DELETE
JRST ERRPRO ;ERROR
PUSHJ PDP,TYDEF2 ;TYPE OUT DELETED FILE
JRST DSAS9 ;GO ON
DSAS13: MOVEI AC3,ERRLOO ;RESTORE ERROR JRST IN DSAS10
HRRM AC3,DSAS10
JRST DSAS17 ;RELEASE DIR. INPUT CHANNEL
;HERE FOR *.* ON DSK
DSAS14: PUSHJ PDP,INDIR ;GET FILENAME => AC0
JRST DSAS17 ;END OF FILE
JUMPE AC0,DSAS14 ;FILENAME ZERO ?
MOVEM AC0,IFIL(IC) ;NO
MOVEM AC0,LOOK
PUSHJ PDP,INDIR ;EXTENSION => AC0
JRST ERRIND ;ERROR
MOVEM AC0,IEXT(IC)
MOVEM AC0,LOOK+1
JUMPN AC6,DSAS16 ;INPUT ?
LOOKUP ICH,LOOK ;YES, LOOKUP FOR INPUT
JRST ERRLOO ;ERROR
MOVEI AC7,DSAS14 ;RETURN ADDR. => AC7
JRST @DAS ;RETURN
;HERE FOR ZERO DSK DIRECTORY VIA /D_*.*
DSAS16: SETZM RENA
LOOKUP OCH,LOOK ;LOOKUP
JRST ERRLOO ;ERROR
RENAME OCH,RENA ;DELETE
JRST ERRPRO ;ERROR
PUSHJ PDP,TYDEF2 ;TYPE OUT DELETED FILENAME
JRST DSAS14 ;GO ON
DSAS17: PUSHJ PDP,RELID ;RELEASE DIRECTORY INPUT
JRST DASRET ;LOOK FOR MORE INPUT
;HERE FOR "?" WITHIN FILENAME OR EXTENSION BUT WITHOUT "*" ON DSK
DSQ: JSR DSDI ;INIT DSK DIRECTORY INPUT
DSQ1: SKIPN AC3,IFIL(IC) ;INPUT FILNAME => AC3, = 0 ?
JRST ERRZFI ;YES, ERROR
TDZ AC3,QFMASK(IC) ;NO, MASK OUT "?" BITS
DSQ2: PUSHJ PDP,INDIR ;DIR FILENAME => AC0
DSQ3: JRST ERRLOO ;END OF FILE, INSTRUCTION CHANGED
JUMPE AC0,DSQ2 ;FILENAME = 0 ?
MOVE AC5,AC0 ;NO, SAVE FILENAME IN AC5
TDZ AC0,QFMASK(IC) ;MASK OUT "?" BITS
CAMN AC0,AC3 ;INPUT FILENAME = DIR FILENAME ?
JRST DSQ4 ;YES
PUSHJ PDP,INDIR ;NO, READ IN EXT
JRST ERRDIN ;ERROR
JRST DSQ1 ;GO ON
DSQ4: PUSHJ PDP,INDIR ;DIR EXT => AC0
JRST ERRDIN ;ERROR
HLLZS AC3,AC0 ;SAVE EXT IN AC3
TDZ AC0,QEMASK(IC) ;MASK OUT "?" BITS
HLLZ AC4,IEXT(IC) ;INPUT EXT => AC4
TDZ AC4,QEMASK(IC) ;MASK OUT "?" BITS
CAME AC0,AC4 ;INPUT EXT = DIR EXT ?
JRST DSQ1 ;NO, GO ON
MOVEM AC5,IFIL(IC) ;YES, STORE FILE.EXT
MOVEM AC5,LOOK
MOVEM AC3,IEXT(IC)
MOVEM AC3,LOOK+1
MOVEI AC3,DSQ6 ;CHANGE JRST IN DSQ3
HRRM AC3,DSQ3
JUMPN AC6,DSQ5 ;DELETE ?
LOOKUP ICH,LOOK ;NO, DO INPUT
JRST ERRLOO ;ERROR
MOVEI AC7,DSQ1 ;RETURN ADDR. => AC7
JRST @DAS ;MAKE INPUT
;HERE TO DELETE FILES WITH "?" BUT WITHOUT "*" ON DSK
DSQ5: SETZM RENA ;CLEAR FILENAME IN RENA FOR DELETE
LOOKUP OCH,LOOK ;OPEN FILE
JRST ERRLOO ;ERROR
RENAME OCH,RENA ;DELETE
JRST ERRPRO ;ERROR
PUSHJ PDP,TYDEF2 ;TYPE OUT DELETED FILE
JRST DSQ1 ;GO ON
DSQ6: MOVEI AC3,ERRLOO ;RESTORE JRST IN DSQ3
HRRM AC3,DSQ3
JRST DSAS17 ;LOOK FOR MORE INPUT
;ROUTINE TO INIT DSK DIRECTORY INPUT
DSDI: 0 ;ENTER BY JSR DSDI
MOVE AC0,SIXDSK ;STORE DEVICE NAME DSK FOR DIR. INIT
MOVEM AC0,INIIDD
PUSHJ PDP,INIID ;INIT DIRECTORY INPUT
CALLI AC0,24 ;GET PROJ. PROGR. NUMBER
MOVEM AC0,LOOKD ;STORE IT FOR DIR. INPUT
MOVE AC0,SIXUFD
MOVEM AC0,LOOKD+1
MOVE AC0,PP11 ;SETUP PRO,PRO NO 1,1
MOVEM AC0,LOOKD+3
LOOKUP ICHD,LOOKD ;GET DIRECTORY
JRST ERRDIN ;ERROR
JRST @DSDI ;;RETURN
PAGE
;ROUTINE TO CLEAR MTA-FILENAMES AND EXTENSION
; AND TO TYPE OUT DELETED FILE.EXT
; SAVE AC0-AC5
TYDEF1: SETZM (AC1) ;CLEAR FILENAME AND EXTENSION IN DIRECTORY
SETZM (AC2)
TYDEF2: PUSHJ PDP,SAVEAC ;SAVE AC0-AC5
MOVE AC1,IFIL(IC) ;TYPE OUT DELETED FILES
SETZ AC3,
MOVNI AC2,6 ;CHAR. COUNTER
PUSHJ PDP,SIXASC
HLLZ AC1,IEXT(IC)
JUMPE AC1,TYDEF3 ;EXTENSION ZERO ?
HRRI AC1,"N" ;NO, TYPE .
ROT AC1,-6
MOVNI AC2,4
PUSHJ PDP,SIXASC
TYDEF3: PUSHJ PDP,TCRLF
PUSHJ PDP,RESTAC ;RESTORE AC0-AC5
POPJ PDP, ;RETURN
;ROUTINE TO READ DTA DIRECTORY INTO CORE
DTADIR: USETI ICH,144 ;GET DIRECTORY
MOVNI AC1,200 ;DIR. LENGTH => AC1
HRLZS AC1
IN ICH, ;INPUT 1 BUFFER, ERROR ?
SOSA AC2,IBUF+1 ;NO, DECREMENT POINTER, => AC2
JRST ERRDIN ;YES
DTAD: ILDB AC0,AC2 ;GET WORD
MOVEM AC0,DIR(AC1) ;STORE IT IN CORE
AOBJN AC1,DTAD ;DONE ?
PUSHJ PDP,RELI ;YES, RELEASE INPUT CHANNEL
POPJ PDP, ;RETURN
;ROUTINE TO READ IN DTA DIRECTORY
DTADI1: JUMPE AC6,DTADI2 ;INPUT ?
PUSHJ PDP,RELI ;NO, RESET SYSTEM
PUSHJ PDP,RELO
MOVE AC0,INIODV ;STORE DTA# FOR INPUT
MOVEM AC0,INIIDV
PUSHJ PDP,INII ;INIT DTA FOR INPUT
DTADI2: PUSHJ PDP,DTADIR ;GET DIRECTORY
JUMPN AC6,DTADI3 ;INPUT ?
PUSHJ PDP,INII ;YES, INIT INPUT CHANNEL AGAIN
SKIPA
DTADI3: PUSHJ PDP,INIO ;NO, INIT DTA FOR OUTPUT AGAIN
MOVE AC1,PDIRF ;FILENAME-POINTER => AC1
MOVEI AC2,DIRE ;EXT.-POINTER => AC2
POPJ PDP, ;RETURN
;ROUTINE TO DELETE FILE.EXT IN DTA DIRECTORY IN CORE
DELDTA: SETZM (AC1) ;CLEAR FILENAME AND EXTENSION
SETZB AC0,(AC2)
PUSHJ PDP,SAVEAC ;SAVE AC0-AC5
SUBI AC2,DIRE-1 ;FILENUMBER => AC2
MOVE AC1,PDIR ;DIR. BLOCK NUMBER POINTER => AC1
DELDT1: CAMN AC1,PEODB ;THROUGH ?
JRST DELDT2 ;YES
ILDB AC3,AC1 ;GET BLOCK NUMBER
CAMN AC3,AC2 ;= FILENUMBER ?
DPB AC0,AC1 ;YES, CLEAR BLOCKNUMBER
JRST DELDT1 ;NO, GO ON
DELDT2: PUSHJ PDP,RESTAC ;RESTORE AC0-AC5
POPJ PDP, ;RETURN
;ROUTINE TO WRITE DIRECTORY ON DTA
DTDIOU: USETO OCH,144 ;OUTPUT ON BLOCK 100.
MOVNI AC1,200 ;COUNTER => AC1
HRLZS AC1
HRRZ AC2,OBUF ;ADDR. OF OUTPUT-BUFFER+2 => AC2
AOJ AC2,
DTDIO1: MOVE AC0,DIR(AC1) ;DIRECTORY WORD => AC0
MOVEM AC0,(AC2) ;STORE IT INTO OUTPUT-BUFFER
AOJ AC2, ;INCREMENT POINTERS
AOBJN AC1,DTDIO1 ;DONE ?
HRRZS OBUF ;RESET USE BIT
SETZM OBUF+2 ;YES, CLEAR BYTE-COUNTER
SETZM OBUF+1 ; AND BYTE POINTER
OUT OCH, ;WRITE IT OUT
POPJ PDP, ;RETURN
JRST ERROUT ;ERROR
PAGE
;ROUTINE TO GENERATE THE DIRECTORY OF A MTA FROM THE FILE-HEADERS
; STORES IT IN CORE AND WRITE IT ON TAPE .
GENER: MOVEI AC3,ODEV ;OUTPUTDEVICE NAME => AC3
PUSHJ PDP,DEVCHE ;CHECK FOR OUTPUT DEVICE
JRST ERRDSW ;NO MTA, ERROR
JRST ERRDSW ;NO MTA, ERROR
MTAPE OCH,1 ;REWIND TAPE
HRL AC4,AC1 ;CLEAR DIRECTORY
HRR AC4,AC1
HRRZ AC5,AC1
AOJ AC4,
ADDI AC5,DIRLEN-1
SETZM (AC1)
BLT AC4,(AC5)
MOVEI AC4,1 ;SET FILEPOSITION = 1
MOVEM AC4,(AC3)
MOVE AC4,INIODV
MOVEM AC4,INIIDV
MTAPE OCH,0 ;WAIT FOR REWIND
PUSHJ PDP,RESYS ;RESET SYSTEM
PUSHJ PDP,INII ;INIT MTA FOR INPUT
PUSHJ PDP,INP ;GET 1ST WORD OF MTA DIRECTORY
JRST ERRDI ;ERROR
CAME AC0,MDIR1W ;MTA WITH DIRECTORY ?
JRST ERRDI ;NO, ERROR
MOVEM AC0,(AC1) ;YES, STORE IT IN CORE
AOBJN AC1,.+1 ;INCREMENT POINTER
CLOSE ICH, ;CLOSE INPUT
MTAPE ICH,16 ;SKIP EOF
MTAPE ICH,0 ;WAIT
GEN1: PUSHJ PDP,INP ;GET 1ST WORD OF FILE HEADER
JRST GEN2 ;EOF, = LOGICAL END OF TAPE
MOVEM AC0,(AC1) ;STORE IT
PUSHJ PDP,INP ;GET FILENAME
JRST ERRIN ;ERROR
MOVEM AC0,MDIRFN(AC1) ;STORE IT
PUSHJ PDP,INP ;GET EXTENSION
JRST ERRIN ;ERROR
MOVEM AC0,MDIRFN+MDIRFN(AC1) ;STORE IT
CLOSE ICH, ;CLOSE INPUT
MTAPE ICH,16 ;SKIP FORWARD 2 FILES
MTAPE ICH,0 ;WAIT
AOBJN AC1,GEN1 ;DIRECTORY FILLED ?
GEN2: MTAPE ICH,1 ;YES, REWIND TAPE
MTAPE ICH,0 ;WAIT
PUSHJ PDP,RESYS ;RESET SYSTEM
PUSHJ PDP,INIO ;INIT OUTPUT AGAIN
MOVNI AC1,DIRLEN ;DIR.-POINTER => AC1
HRLS AC1
HRRI AC1,2(AC3)
JRST REWOU2 ;WRITE DIRECTORY ON TAPE
PAGE
;ROUTINE TO CHECK IF DEVICE-NAME FOR MAGTAPE IS LEGAL
; STORE THEN MAGTAPE-NUMBER+1 INTO AC1
; AC0/ <0,,LEFT HAND HALF OF DEVICE-NAME>
; AC1/ <0,,RIGHT HAND HALF OF DEVICE-NAME (MTA-NUMBER)>
COMMTA: CAIE 0,556441 ;NAME LEGAL (SIXBIT/MTA/) ?
JRST ERRMTA ;NO, ERROR
TRNE AC1,7777 ;MAYBE, MTA-NO 0-7 ?
JRST ERRMTA ;NO, ERROR
CAIL AC1,200000
CAIL AC1,300000
JRST ERRMTA ;NO, ERROR
LSH AC1,-^D12 ;YES, GET NUMBER+1 INTO AC1
SUBI AC1,17
POPJ PDP, ;RETURN
;ROUTINE TO STORE MAGTAPE-NUMBER+1 INTO DIRECTORY-HEADER
; AND TO STORE DIRECTORY-POINTER INTO AC1
; IF TAPE IS NEW (NO DIRECTORY FOR THIS TAPE IN CORE) SET AC0=-1
; OTHERWISE AC0=0
; SET AC3 <= <MFILP1 OR MFILP2>
; AC1/ <MAGTAPE-NUMBER+1>
MTANUM: SETZ 0, ;CLEAR AC0
CAMN AC1,MDIR20 ;DIRECTORY FOR THIS MAGTAPE IN CORE ?
JRST MND2A ;YES, DIRECTORY 2
SKIPL MDIR10
JRST MND2 ;MAYBE
MOVEM AC1,MDIR10 ;NO, STORE MTA-NO+1 INTO DIR1-HEADER
SETO 0, ;MARK THAT DIR IS NOT IN CORE, AC0=-1
MND1: MOVNI AC1,DIRLEN ;GET DIRECTORY1-POINTER INTO AC1
HRLS AC1
HRRI AC1,MDIR1
MOVEI AC3,MFILP1
POPJ PDP, ;RETURN
MND2: CAMN AC1,MDIR10 ;DIRECTORY FOR THIS MAGTAPE IN CORE ?
JRST MND1 ;YES, DIRECTORY 1
MOVEM AC1,MDIR20 ;NO, STORE MTA-NO+1 INTO DIR2-HEADER
SETO AC0, ;MARK THAT DIR IS NOT IN CORE, AC0=-1
MND2A: MOVNI AC1,DIRLEN ;GET DIRECTORY2-POINTER INTO AC1
HRLS AC1
HRRI AC1,MDIR2
MOVEI AC3,MFILP2
POPJ PDP, ;RETURN
PAGE
;ROUTINE TO CHECK FOR DEVICE
; INPUT: AC3/ ADDR. OF ODEV OR IDEV(IC)
; 1ST RETURN DEVICE IS NOT A MTA, DTA OR DSK
; 2ND RETURN: AC1 = -1 DEVICE IS A DTA
; AC1 = 0 DEVICE IS A DSK
; 3RD RETURN: DEVICE IS A MTA
; AC0 = -1 DIRECTORY IS NOT IN CORE
; AC0 = 0 DIRECTORY IS IN CORE
; AC1/ <-DIRLEN,,ADDR. OF MDIR1 OR MDIR2>
; AC3/ ADDR. OF MFILP1 OR MFILP2
DEVCHE: MOVE 0,(AC3) ;GET DEVICE-NAME => AC0
HRRZ AC1,0 ;RIGHT HAND HALF OF DEVICE-NAME (MTA-N0) => AC1
CAIL AC1,1 ;MTA WITH DIRECTORY IN CORE ?
CAIL AC1,11
JRST DEVC1 ;NO
JRST DEVCM ;YES
DEVC1: CALL 0,SIXDCH ;GET DEVICE CHARACTERISTICS
TLNE 0,1B33 ;DEVICE WITH DIRECTORY ?
JRST DEVCD ;YES
TLNN 0,1B31 ;NO, MTA ?
POPJ PDP, ;NO, 1ST RETURN
HLRZ 0,(AC3) ;YES, LEFT HAND HALF OF DEVICE-NAME => AC0
PUSHJ PDP,COMMTA ;CHECK FOR CORRECT NAME, MTA-NO+1 => AC1
MOVEM AC1,(AC3) ;MTA-NO+1 => ODEV OR IDEV(IC)
DEVCM: PUSHJ PDP,MTANUM ;STORE MTA-NO+1 INTO DIR.-HEADER, DIR.-POINTER => AC1
AOS (PDP) ;INCREMENT RETURN ADDR. BY 2 FOR 3RD RETURN
AOS (PDP)
POPJ PDP, ;3RD RETURN
DEVCD: AOS (PDP) ;INCREMENT RETURN ADDR. BY 1 FOR 2ND RETURN
SETZ AC1, ;CLEAR AC1
TLNN AC0,1B29 ;DTA ?
POPJ PDP, ;NO, DSK, 2ND RETURN
SETO AC1, ;YES, -1 => AC1
POPJ PDP, ;2ND RETURN
PAGE
;INITIALISATION-ROUTINES
INIO: MOVE 0,INIODV ;STORE DEVICE-NAME FOR ASCII MODE
MOVEM 0,INIO2
PUSHJ PDP,TTYLPT ;DEVICE TTY OR LPT ?
INIT OCH,13 ;NO, INIT FOR OUTPUT IN IMAGE-BINARY-MODE
INIODV: 0 ;DEVICE-NAME
OBUF,,0
JRST NOTAVO ;ERROR, DEVICE NOT AVAILABLE
JRST INIO3
INIO1: INIT OCH,0 ;INIT FOR OUTPUT IN ASCII MODE
INIO2: 0 ;DEVICE-NAME
OBUF,,0
JRST NOTAVO ;ERROR, DEVICE NOT AVAILABLE
TRO F,ASCIOU ;SET OUTPUT IN ASCII MODE FLAG = 1
INIO3: MOVE 0,.JBFF ;SAVE .JBFF
MOVEM 0,SVJFO
OUTBUF OCH,2 ;SET UP A BUFFER-RING OF 2 BUFFERS
POPJ PDP, ;RETURN
INIOD: INIT OCHD,13 ;INIT FOR OUTPUT-DIRECTORY IN IMAGE-BINARY-MODE
INIODD: 0 ;DEVICE-NAME
OBUFD,,0
JRST NTAVOD ;ERROR, DEVICE NOT AVAILABLE
MOVE 0,.JBFF ;SAVE .JBFF
MOVEM 0,SVJFOD
OUTBUF OCHD,2 ;SET UP A BUFFER-RING OF 2 BUFFERS
POPJ PDP, ;RETURN
INII: MOVE 0,INIIDV ;STORE DEVICE-NAME FOR ASCII MODE
MOVEM 0,INII2
PUSHJ PDP,TTYLPT ;DEVICE TTY OR LPT ?
INIT ICH,13 ;NO, INIT FOR INPUT IN IMAGE-BINARY-MODE
INIIDV: 0 ;DEVICE-NAME
0,,IBUF
JRST NOTAVI ;ERROR, DEVICE NOT AVAILABLE
JRST INII3
INII1: INIT ICH,0 ;INIT FOR INPUT IN ASCII MODE
INII2: 0 ;DEVICE-NAME
0,,IBUF
JRST NOTAVI ;ERROR, DEVICE NOT AVAILABLE
TRO F,ASCIN ;SET INPUT IN ASCII MODE FLAG = 1
INII3: MOVE 0,.JBFF ;SAVE .JBFF
MOVEM 0,SVJFI
INBUF ICH,2 ;SET UP A BUFFER-RING OF 2 BUFFERS
POPJ PDP, ;RETURN
INIID: INIT ICHD,13 ;INIT FOR INPUT-DIRECTORY IN IMAGE-BINARY-MODE
INIIDD: 0 ;DEVICE-NAME
0,,IBUFD
JRST NTAVID ;ERROR, DEVICE NOT AVAILABLE
MOVE 0,.JBFF ;SAVE .JBFF
MOVEM 0,SVJFID
INBUF ICHD,2 ;SET UP A BUFFER-RING OF 2 BUFFERS
POPJ PDP, ;RETURN
TTYLPT:
IFE OLDSW,< CALLI 0,64 ;GET DEVICE-NAME
JUMP
HLLZS 0
CAMN 0,SIXTTY ;TTY ?
JRST TTLP1 ;YES
CAME 0,SIXLPT ;NO, LPT ?
>
IFN OLDSW,< CALL 0,SIXDCH
TLNE 0,1B32
JRST TTLP1
TLNN 0,1B21
>
POPJ PDP, ;NO, INIT DEVICE IN IMAGE-BINARY-MODE
TTLP1: MOVEI 0,5 ;YES, INIT DEVICE IN ASCII-MODE, INCREMENT RETURN-ADDR.
ADDM 0,(PDP)
POPJ PDP, ;RETURN
NOTAVO: MOVE AC1,INIODV ;DEVICE-NAME => AC1
JRST NOTAVL
NTAVOD: MOVE AC1,INIODD
JRST NOTAVL
NOTAVI: MOVE AC1,INIIDV
JRST NOTAVL
NTAVID: MOVE AC1,INIIDD
NOTAVL: TTCALL 3,[ASCIZ/?DEVICE: /]
SETZ AC3,
MOVNI AC2,6
PUSHJ PDP,SIXASC ;TYPE DEVICE NAME
TTCALL 3,[ASCIZ/ NOT AVAILABLE ?
/]
PUSHJ PDP,RELID
PUSHJ PDP,RELOD
PUSHJ PDP,RESYS
JRST COMRET
PAGE
;OUTPUT-ROUTINES FOR CONTENTS OF AC0
OUTP: SOSG OBUF+2 ;DECREMENT BYTE-COUNTER, BUFFER FULL ?
JRST OUTPBU ;YES, OUTPUT BUFFER
OUTPWR: IDPB 0,OBUF+1 ;NO, STORE CONTENTS OF AC0 INTO OBUF
AOS (PDP) ;INCREMENT RETURN-ADDR.
POPJ PDP, ;NORMAL RETURN
OUTPBU: OUT OCH, ;OUTPUT BUFFER, ERROR ?
JRST OUTPWR ;NO, GO ON
STATZ OCH,IOEOT ;YES
POPJ PDP, ;END OF TAPE, ERROR RETURN
JRST ERROUT ;OUTPUT ERROR
OUTDIR: SOSG OBUFD+2 ;DIRECTORY OUTPUT,DECREMENT BYTE COUNTER, BUFFER FULL ?
JRST OUDIBU ;YES, OUTPUT BUFFER
OUDIWR: IDPB 0,OBUFD+1 ;NO, STORE CONTENTS OF AC0 INTO OBUFD
AOS (PDP) ;INCREMENT RETURN ADDR.
POPJ PDP, ;NORMAL RETURN
OUDIBU: OUT OCHD, ;OUTPUT BUFFER, ERROR ?
JRST OUDIWR ;NO, GO ON
STATZ OCHD,IOEOT ;YES
POPJ PDP, ;END OF TAPE, ERROR RETURN
JRST ERROUD ;OUTPUT ERROR
ENT: 0 ;ENTER
0
0
0
PAGE
;INPUT-ROUTINES, FILL AC0
INP: SOSG IBUF+2 ;DECREMENT BYTE-COUNTER, BUFFER EMPTY ?
JRST INPBUF ;YES, GET NEXT BUFFER
INPWRD: ILDB 0,IBUF+1 ;NO, GET NEXT WORD INTO AC0
AOS (PDP) ;INCREMENT RETURN ADDR.
POPJ PDP, ;NORMAL RETURN
INPBUF: IN ICH, ;INPUT BUFFER, ERROR ?
JRST INPWRD ;NO, GO ON
STATZ ICH,IOEOF ;YES
POPJ PDP, ;END OF FILE, ERROR RETURN
JRST ERRIN ;INPUT ERROR
INDIR: SOSG IBUFD+2 ;DIRECTORY INPUT,DECREMENT BYTE-COUNTER, BUFFER EMPTY ?
JRST INDIBU ;YES, GET NEXT BUFFER
INDIWR: ILDB 0,IBUFD+1 ;NO, GET NEXT WORD INTO AC0
AOS (PDP) ;INCREMENT RETURN ADDR.
POPJ PDP, ;NORMAL RETURN
INDIBU: IN ICHD, ;INPUT BUFFER, ERROR ?
JRST INDIWR ;NO, GO ON
STATZ ICHD,IOEOF ;YES
POPJ PDP, ;END OF FILE, ERROR RETURN
JRST ERRIND ;INPUT ERROR
LOOK: 0 ;LOOKUP
0
0
0
LOOKD: 0
0
0
0
RENA: 0 ;RENAME
0
0
0
PAGE
;RELEASE-ROUTINES
RELO: RELEAS OCH, ;RELEASE OUTPUT-CHANNEL
MOVE 0,SVJFO ;RESTORE .JBFF
MOVEM 0,.JBFF
POPJ PDP, ;RETURN
RELOD: RELEAS OCHD, ;RELEASE OUTPUT-DIRECTORY-CHANNEL
MOVE 0,SVJFOD ;RESTORE .JBFF
MOVEM 0,.JBFF
POPJ PDP, ;RETURN
RELI: RELEAS ICH, ;RELEASE INPUT-CHANNEL
MOVE 0,SVJFI ;RESTORE .JBFF
MOVEM 0,.JBFF
POPJ PDP, ;RETURN
RELID: RELEAS ICHD, ;RELEASE INPUT-DIRECTORY-CHANNEL
MOVE 0,SVJFID ;RESTORE .JBFF
MOVEM 0,.JBFF
POPJ PDP, ;RETURN
RESYS: CALLI 0 ;RESET SYSTEM WITHOUT CLOSE
MOVE AC0,SVJFO ;RESET .JBFF
MOVEM AC0,.JBFF
POPJ PDP, ;RETURN
PAGE
;ROUTINE TO SAVE AC0-AC5
SAVEAC: MOVEM AC0,SAVAC+2
MOVE AC0,BLTSVA
BLT AC0,SAVAC+7
MOVE AC0,SAVAC+2
POPJ PDP, ;RETURN
;ROUTINE TO RESTORE AC0-AC5
RESTAC: MOVS AC0,BLTSVA
BLT AC0,AC5
MOVE AC0,SAVAC+2
POPJ PDP, ;RETURN
BLTSVA: AC1,,SAVAC+3 ;BLT POINTER FOR SAVEAC AND RESTAC
;ROUTINE TO CLEAR MTERR1, MTERR2, MTERR3, MTERR4
SETZMT: SETZM MTERR1
SETZM MTERR2
SETZM MTERR3
SETZM MTERR4
POPJ PDP,
PAGE
;ROUTINE TO PRINT OUT CR LF
CRLF: MOVEM AC0,SAVAC ;SAVE AC0
MOVEI 0,15 ;CR => AC0
PUSHJ PDP,OUTP ;PRINT IT OUT
JRST ERROUT ;ERROR
MOVEI 0,12 ;LF => AC0
PUSHJ PDP,OUTP ;PRINT IT OUT
JRST ERROUT ;ERROR
MOVE AC0,SAVAC ;RESTORE AC0
POPJ PDP, ;RETURN
TCRLF: TTCALL 3,[ASCIZ/
/]
POPJ PDP, ;RETURN
;ROUTINE TO PRINT OUT TO SPACES
TWOSPA: MOVEI AC0," " ;ASCII SPACE => AC0
PUSHJ PDP,OUTP ;PRINT IT OUT
JRST ERROUT ;ERROR
PUSHJ PDP,OUTP ;PRINT IT OUT AGAIN
JRST ERROUT ;ERROR
POPJ PDP, ;RETURN
;ROUTINE TO PRINT OUT FILENAME AND EXTENSION
; AC0 DESTROYED
; AC1 FILENAME
; AC2, AC3 DESTOYED
; AC4 EXT,,0
PRFIEX: SETO AC3, ;MARK THAT NO TTCALL
MOVNI AC2,6
PUSHJ PDP,SIXASC ;PRINT OUT FILENAME
MOVNI AC2,6
SKIPE AC1,AC4 ;EXTENSION ZERO ?
HRRI AC1,16 ;NO, PRINT .EXT
ROT AC1,-6
PUSHJ PDP,SIXASC ;PRINT OUT EXTENSION
PUSHJ PDP,RESTAC ;RESTORE AC0-AC5
POPJ PDP, ;RETURN
PAGE
;ROUTINE TO TYPE OUT SIXBIT TEXT FROM AC1
; AC2/-NUMBER OF SIXBIT BYTES TO BE TYPED
; AC3 = 0 :TTCALL
; = 1 :OUTPUT
; AC0 IS USED
SIXASC: SETZ AC0, ;CLEAR AC0
LSHC AC0,6 ;FIRST BYTE => AC0
ADDI AC0,40 ;CONVERT TO ASCII
JUMPE AC3,SIXAS1 ;TTCALL ?
PUSHJ PDP,OUTP ;NO
JRST ERROUT ;ERROR
SKIPA ;SKIP ALWAYS
SIXAS1: TTCALL 1,AC0
AOJL AC2,SIXASC ;ALL DONE ?
POPJ PDP, ;YES, RETURN
PAGE
;ROUTINE TO CONVERT CONTENTS OF AC0 TO ASCII AND PRINT IT OUT
LISTAS: MOVEM AC1,SAVAC ;SAVE AC1, AC2
MOVEM AC2,SAVAC+1
SETZB AC2,AC1 ;CLEAR AC2 AND AC1
LISTA1: IDIVI AC0,^D10 ;CONVERT CONTENTS OF AC0 TO ASCII DEC.
ADDI AC1,60
PUSH PDP,AC1
AOJ AC2,
JUMPN AC0,LISTA1 ;DONE ?
LISTA2: POP PDP,AC0 ;GET ASCII BLOCK COUNTER
PUSHJ PDP,OUTP ;PRINT IT OUT
JRST ERROUT
SOJG AC2,LISTA2 ;DONE ?
MOVE AC1,SAVAC ;RESTORE AC1, AC2
MOVE AC2,SAVAC+1
POPJ PDP, ;RETURN
;ROUTINE TO TYPE OUT CONTENTS OF AC1 IN OCTAL
LISTOC: JUMPN AC1,LISOC1 ;AC1 = 0 ?
MOVEI AC0,40 ;YES, PRINT " 0"
PUSHJ PDP,OUTP
JRST ERROUT
MOVEI AC0,60
PUSHJ PDP,OUTP
JRST ERROUT
POPJ PDP, ;RETURN
LISOC1: SETZ AC0, ;NO, CLEAR AC0
ROTC AC0,3 ;3 BIT-BYTE => AC0
JUMPE AC0,LISOC1 ;AC0 = 0 ?
JRST LISOC3
LISOC2: SETZ AC0, ;CLEAR AC0
ROTC AC0,3 ;3 BIT BYTE => AC0
LISOC3: ADDI AC0,60 ;NO, CONVERT TO ASCII
PUSHJ PDP,OUTP ;PRINT IT OUT
JRST ERROUT ;ERROR
JUMPN AC1,LISOC2 ;DONE ?
LISOC4: POPJ PDP, ;YES, RETURN
;ROUTINE TO TYPE OUT ASCIZ TEXT FOUND VIA POINTER IN AC1
LISTTX: ILDB AC0,AC1 ;PRINT OUT TEXT
JUMPE AC0,LISTT1
PUSHJ PDP,OUTP
JRST ERROUT
JRST LISTTX
LISTT1: POPJ PDP, ;RETURN
PAGE
;ROUTINE TO LIST THE DATE FROM AC0
DATE: PUSHJ PDP,SAVEAC ;SAVE AC0-AC5
MOVE AC1,AC0 ;DATE => AC1
IDIVI AC1,^D31 ;DAY-1 => AC2
AOJ AC2,
IDIVI AC2,^D10 ;CONVERT TO ASCII
ADDI AC3,60
ADDI AC2,60
MOVE AC0,AC2 ;LIST DAY
PUSHJ PDP,OUTP
JRST ERROUT ;ERROR
MOVE AC0,AC3
PUSHJ PDP,OUTP
JRST ERROUT ;ERROR
IDIVI AC1,^D12 ;MONTH => AC2
MOVNI AC4,5 ;CHAR. COUNTER => AC4
MOVE AC5,PMONLI ;POINTER TO MONTH-LIST => AC5
DATE1: ILDB AC0,AC5 ;GET ASCII BYTE => AC0
PUSHJ PDP,OUTP ;LIST IT
JRST ERROUT ;ERROR
AOJL AC4,DATE1 ;DONE ?
MOVEI AC0,^D64(AC1) ;YES, YEAR-1900 => AC0
PUSHJ PDP,LISTAS ;LIST IT
PUSHJ PDP,RESTAC ;RESTORE AC0-AC5
POPJ PDP, ;RETURN
PAGE
;ROUTINE TO TYPE OUT TIME FROM AC0
TIME: MOVEM AC1,SAVAC ;SAVE AC1 AND AC2
MOVEM AC2,SAVAC+1
IDIVI AC0,^D60000
TIME1: IDIVI AC0,^D60 ;HOURS => AC0
MOVE AC2,AC1 ;MIN => AC2
IDIVI AC0,^D10 ;CONVERT HOURS => ASCII
ADDI AC0,60
ADDI AC1,60
PUSHJ PDP,OUTP ;PRINT IT OUT
JRST ERROUT ;ERROR
MOVE AC0,AC1
PUSHJ PDP,OUTP
JRST ERROUT ;ERROR
MOVEI AC0,":" ;PRINT ":"
PUSHJ PDP,OUTP
JRST ERROUT ;ERROR
MOVE AC0,AC2
IDIVI AC0,^D10 ;CONVERT MIN => ASCII
ADDI AC0,60
ADDI AC1,60
PUSHJ PDP,OUTP ;PRINT IT OUT
JRST ERROUT ;ERROR
MOVE AC0,AC1
PUSHJ PDP,OUTP
JRST ERROUT ;ERROR
MOVE AC1,SAVAC ;RESTORE AC'S
MOVE AC2,SAVAC+1
POPJ PDP, ;RETURN
PAGE
;ERROR TEXT
COMERR: ASCIZ/?COMMAND ERROR. /
ERRQAS: PUSHJ PDP,ERRC
TTCALL 3,[ASCIZ/"*" AND "?" DON'T MATCH/]
JRST ERRCOM
ERRQLA: PUSHJ PDP,ERRC
TTCALL 3,[ASCIZ/"?" ONLY FOR INPUT/]
JRST ERRCOM
ERRQDE: PUSHJ PDP,ERRC
TTCALL 3,[ASCIZ/"?" WITHIN DEVICE NAME/]
JRST ERRCOM
ERRASN: PUSHJ PDP,ERRC
TTCALL 3,[ASCIZ/* WITHIN NAME/]
JRST ERRCOM
ERRSIX: PUSHJ PDP,ERRC
TTCALL 3,[ASCIZ/MORE THAN 6 CHARS. FOR A NAME/]
JRST ERRCOM
ERRILC: PUSHJ PDP,ERRC
TTCALL 3,[ASCIZ/ILLEGAL CHAR./]
JRST ERRCOM
ERRSLA: PUSHJ PDP,ERRC
TTCALL 3,[ASCIZ/ONLY ONE SWITCH ALLOWED/]
JRST ERRCOM
ERRSWI: PUSHJ PDP,ERRC
TTCALL 3,[ASCIZ/ILLEGAL SWITCH/]
JRST ERRCOM
ERRLAR: PUSHJ PDP,ERRC
CALL 3,[ASCIZ/ONLY ONE _ ALLOWED/]
JRST ERRCOM
ERRTHR: PUSHJ PDP,ERRC
TTCALL 3,[ASCIZ/MORE THAN 3 CHARS. FOR EXT./]
JRST ERRCOM
ERRCOL: PUSHJ PDP,ERRC
TTCALL 3,[ASCIZ/ONLY ONE : FOR ONE DEVICE/]
JRST ERRCOM
ERRASD: PUSHJ PDP,ERRC
TTCALL 3,[ASCIZ/* WITHIN DEVICE-NAME/]
JRST ERRCOM
ERRIC: PUSHJ PDP,ERRC
TTCALL 3,[ASCIZ/ONLY /]
TTCALL 3,ICMASC
TTCALL 3,[ASCIZ/ INPUT-FILES ALLOWED/]
JRST ERRCOM
ICMASC: 0
ERRFIL: PUSHJ PDP,ERRC
TTCALL 3,[ASCIZ/. WITHIN EXT./]
JRST ERRCOM
ERRAST: PUSHJ PDP,ERRC
TTCALL 3,[ASCIZ/ONLY ONE * FOR FILENAME OR EXT. ALLOWED/]
JRST ERRCOM
ERRCR: PUSHJ PDP,ERRC
TTCALL 3,[ASCIZ/CR WITHOUT LINE-FEED/]
JRST ERRCOM
ERRCMA: PUSHJ PDP,ERRC
TTCALL 3,[ASCIZ/NO _ OR , ON LEFT SIDE/]
JRST ERRCOM
ERRODV: PUSHJ PDP,ERRC ;OUTPUT DEVICE CAN'T DO OUTPUT
PUSHJ PDP,ODTYP ;TYPE OUTPUT DEVICE NAME
TTCALL 3,[ASCIZ/ CAN'T DO OUTPUT/]
JRST ERR2
ERRIDV: SETZ AC5, ;MARK THAT INPUT CHANNEL ICH
SKIPE AC1,MTERR ;MTA FOR OUTPUT ?
PUSHJ PDP,MTAERR ;YES, DELETE FILE
PUSHJ PDP,ERRC ;NO, TYPE COMMAND ERROR AND CLEAR ^O
PUSHJ PDP,IDTYP ;TYPE OUT INPUT-DEVICE-NAME
TTCALL 3,[ASCIZ/ CAN'T DO INPUT/]
JRST ERR2
IDTYP: MOVE AC1,INIIDV ;TYPE INPUT DEVICE-NAME FROM ICH
SKIPE AC5
MOVE AC1,INIIDD ;DEVICE-NAME FROM ICHD
MOVNI AC2,6
SETZ AC3,
PUSHJ PDP,SIXASC
POPJ PDP, ;RETURN
EREOT1: SETZM -MDIRFN-MDIRFN(AC1) ;END OF TAPE, CLEAR WRITTEN NAMES IN DIR.
EREOT2: SETZM -MDIRFN(AC1)
EREOT3: SETZM (AC1)
SETOM MTERR4 ;MARK THAT EOT
PUSHJ PDP,EREOT4
JRST ERR2
ERREOT: MTAPE OCH,17 ;SKIP BACK ONE FILE
EREOT4: PUSHJ PDP,EOT
SKIPN MTERR4 ;EOT ?
POPJ PDP, ;NO
PUSHJ PDP,ERR1 ;YES, TYPE MTA#
PUSHJ PDP,ODTYP
TTCALL 3,[ASCIZ/ END OF TAPE, TAPE FULL/]
POPJ PDP, ;RETURN
EOT: MTAPE OCH,17 ;DELETE FILE ON TAPE
MOVEI AC1,MFILP2 ;RESET FILEPOSITION POINTER
TRNE F,MOD1
MOVEI AC1,MFILP1
MTAPE OCH,0
SOS (AC1)
SOS (AC1)
SETZM MTERR ;CLEAR MTERR
CLOSE OCH,
STATZ OCH,740000+IOEOT ;ERROR ?
JRST ERROUT ;YES
POPJ PDP, ;NO, RETURN
ERRLOO: SKIPE AC1,MTERR ;MTA FOR OUTPUT ?
PUSHJ PDP,MTAERR ;YES, DELETE FILE
PUSHJ PDP,ERR1 ;NO, FILENAME NOT FOUND
PUSHJ PDP,IFITYP ;TYPE OUT FILE.EXT
TTCALL 3,[ASCIZ/ NOT FOUND/]
ERLOO1: TTCALL 3,QUEMAR
PUSHJ PDP,RESYS
PUSHJ PDP,INIO
JRST MOREIN ;LOOK FOR MORE INPUT
IFITYP: MOVE AC1,IFIL(IC)
SETZ AC3,
MOVNI AC2,6
PUSHJ PDP,SIXASC ;TYPE OUT FILE.EXT
MOVE AC1,IEXT(IC)
MOVNI AC2,4
SKIPE AC1
HRRI AC1,"N"
ROT AC1,-6
PUSHJ PDP,SIXASC
POPJ PDP, ;RETURN
ERRPRO: PUSHJ PDP,ERR1 ;FILE IS WRITE-PROTECTED
PUSHJ PDP,IFITYP ;TYPE OUT FILE.EXT
TTCALL 3,[ASCIZ/ EXISTS ALREADY OR IS WRITE PROTECTED/]
JRST ERLOO1
ERROUD: SETO AC5, ;MARK THAT DIRECTORY OUTPUT CHANNEL OCHD
SKIPA
ERROUT: SETZ AC5, ;MARK THAT OUTPUT CHANNEL OCH
SKIPE AC1,MTERR ;MTA FOR OUTPUT ?
PUSHJ PDP,MTAERR ;YES, DELETE FILE
SKIPE MTERR4 ;NO, EOT ?
JRST ERR2 ;YES
PUSHJ PDP,ERR1 ;NO
PUSHJ PDP,ODTYP ;TYPE OUT OUTPUT DEVICE NAME
TTCALL 3,[ASCIZ/ OUTPUT ERROR/]
TRZ F,MIN ;CLEAR MAGTAPE FOR INPUT FLAG
JUMPE AC5,ERROU1 ;OCHD ?
GETSTS OCHD,AC1 ;YES, GET STATUS OF OCHD => AC1
JRST ERRIO
ERROU1: GETSTS OCH,AC1 ;NO, GET STATUS OF OCH => AC1
JRST ERRIO
ERRIND: SETO AC5, ;MARK THAT DIRECTORY INPUT CHANNEL ICHD
SKIPA
ERRIN: SETZ AC5, ;MARK THAT INPUT CHANNEL ICH
SKIPE AC1,MTERR ;MTA FOR OUTPUT ?
PUSHJ PDP,MTAERR ;YES, DELETE FILE
PUSHJ PDP,ERR1 ;NO, INPUT ERROR
PUSHJ PDP,IDTYP ;TYPE OUT INPUT DEVICE NAME
TTCALL 3,[ASCIZ/ INPUT ERROR/]
TRZ F,MOUT ;ZERO MTA FOR OUTPUT FLAG
JUMPE AC5,ERRIN1 ;ICHD ?
GETSTS ICHD,AC1 ;YES, GET STATUS OF ICHD => AC1
JRST ERRIO
ERRIN1: GETSTS ICH,AC1 ;NO, GET STATUS OF ICH => AC1
ERRIO: SETZ AC4, ;CLEAR TEXT POINTER
TRNE AC1,IOIMPM ;IMPROPER MODE ?
JRST ERRIO1 ;YES
MOVEI AC4,2 ;NO, SET TEXT POINTER AC4 = 2
TRNE AC1,IODERR ;HARDWARE ERROR ?
JRST ERRIO2 ;YES
AOJ AC4, ;NO, SET TEXT POINTER AC4 = 3
TRNE AC1,IODTER ;CHECKSUM OR PARITY ERROR ?
JRST ERRIO2 ;YES
AOJ AC4, ;NO, SET TEXT POINTER AC4 = 4
TRNN AC1,IOBKTL ;BLCK TOO LARGE OR DTA FULL ?
AOJA AC4,ERRIO2 ;NO, SET TEXT POINTER AC4 = 5
JRST ERRIO2 ;YES
ERRIO1: TRNE F,MOUT ;MTA FOR OUTPUT ?
AOJA AC4,ERRIO2 ;YES, SET TEXT POINTER AC4 = 1
TRNE F,MIN ;NO, MTA FOR INPUT ?
AOJ AC4, ;YES, SET TEXT POINTER AC4 = 1
ERRIO2: MOVE AC1,IOERTX(AC4) ;NO, ADDR. OF ERROR TEXT => AC1
CAIE AC4,5 ;AC4 = 5 ?
TTCALL 3,(AC1) ;NO, LIST ERROR TEXT
JRST ERR2 ;YES, DON'T LIST ANY MORE
ERRMFU: PUSHJ PDP,ERR1 ;MTA DIRECTORY FULL
PUSHJ PDP,ODTYP ;TYPE OUT OUTPUT DEVICE NAME
TTCALL 3,[ASCIZ/ TAPE DIRECTORY FULL/]
JRST ERR2
ERRFIP: PUSHJ PDP,ERR1 ;FILEPOSITION ERROR
MTAPE OCH,1 ;REWIND TAPE
MOVEI AC1,1 ;SET FILEPOSITION = 1
MOVEM AC1,(AC4)
PUSHJ PDP,ODTYP ;TYPE OUTPUT-DEVICE NAME
TTCALL 3,[ASCIZ/ FILE POSITION ERROR, TAPE REWINDED, TRY AGAIN/]
MTAPE OCH,0 ;WAIT FOR REWIND
JRST ERR2
ODTYP: MOVE AC1,INIODV
MOVNI AC2,6
SETZ AC3,
PUSHJ PDP,SIXASC ;TYPE OUT MTA #
POPJ PDP, ;RETURN
ERRMM: PUSHJ PDP,ERRC ;SAME MTA FOR IO
TTCALL 3,[ASCIZ/DON'T USE SAME MTA FOR IN-AND OUTPUT SIMULT./]
JRST ERR2
ERRDID: SETO AC5, ;MARK THAT INPUT CHANNEL ICHD
SKIPA
ERRDIN: SETZ AC5, ;MARK THAT INPUT CHANNEL ICH
PUSHJ PDP,ERR1 ;BAD DIRECTORY
TTCALL 3,[ASCIZ/? BAD DIRECTORY DEVICE:/]
PUSHJ PDP,IDTYP ;TYPE INPUT DEVICE NAME
PUSHJ PDP,TCRLF ;TYPE CR LF
JRST ERR2
ERRDI: PUSHJ PDP,ERRC ;DEVICE HAS NO DIRECTORY
TTCALL 3,[ASCIZ/DEVICE HAS NO DIRECTORY/]
JRST ERR2
ERRDSW: PUSHJ PDP,ERRC
TTCALL 3,[ASCIZ/DEVICE AND SWITCH DON'T MATCH/]
JRST ERR2
ERRMTA: PUSHJ PDP,ERRC
TTCALL 3,[ASCIZ/DON'T USE LOGICAL NAME FOR MTA/]
JRST ERR2
ERRLTL: PUSHJ PDP,ERRC
TTCALL 3,[ASCIZ/DIR. LISTING ONLY ON TTY OR LPT/]
JRST ERR2
ERRZFI: PUSHJ PDP,ERRC
TTCALL 3,[ASCIZ/INPUT-FILENAME ZERO/]
JRST ERLOO1
ERRENT: SKIPE AC1,MTERR ;MTA FOR OUTPUT ?
PUSHJ PDP,MTAERR ;YES, DELETE FILE
PUSHJ PDP,ERR1 ;NO, DIR. FULL OR WRITE PROT.
TRNN F,MIN ;MTA FOR INPUT ?
JRST ERENT1 ;NO
MOVEI AC1,MFILP2 ;YES, RESET FILEPOSITION
TRNE F,MID1 ;DIRECTORY 1 ?
MOVEI AC1,MFILP1 ;YES
SOS (AC1)
ERENT1: PUSHJ PDP,ODTYP ;TYPE OUT OUTPUT DEVICE NAME
TTCALL 3,[ASCIZ/: /]
MOVNI AC2,6
SETZ AC3,
MOVE AC1,ENT
PUSHJ PDP,SIXASC ;TYPE OUT OUTPUT DEVICE NAME
HLLZ AC1,ENT+1
JUMPE AC1,ERENT2 ;EXTENSION ZERO ?
MOVNI AC2,4 ;NO
HRRI AC1,"N"
ROT AC1,-6
PUSHJ PDP,SIXASC
ERENT2: TTCALL 3,[ASCIZ/ DIR. FULL OR WRITE PROTECTION/]
JRST ERR2
ERRPR: PUSHJ PDP,ERRC ;ERROR DURING PROTECTION
TTCALL 3,[ASCIZ/ILLEGAL PROTECTION/]
JRST ERRCOM
ERRMIX: SKIPE AC1,MTERR ;MTA FOR OUTPUT ?
PUSHJ PDP,MTAERR ;YES, DELETE FILE
PUSHJ PDP,ERRC ;NO, MIXED IO-MODES
TTCALL 3,[ASCIZ/MIXED IO MODES/]
CLOSE OCH,
JRST ERR2
ERRNZD: PUSHJ PDP,ERRC ;NO /Z FOR DISK
TTCALL 3,[ASCIZ"NO /Z FOR DSK"]
JRST ERLOO1
ERRZDI: PUSHJ PDP,ERR1 ;DIRECTORY ZERO
TTCALL 3,[ASCIZ/? DIRECTORY ZERO/]
JRST ERLOO1
MTAERR: SETZM (AC1) ;DELETE FILE.EXT IN DIR.
SETZM -MDIRFN(AC1)
SETZM -MDIRFN-MDIRFN(AC1)
SETZM MTERR ;CLEAR MTERR
SKIPN AC2,MTERR1 ;OLD FILENAME DELETED ?
JRST MTAER1 ;NO
MOVE AC0,MTERR2 ;YES, STORE FILE.EXT AGAIN
MOVEM AC0,-MDIRFN(AC2)
MOVE AC0,MTERR3
MOVEM AC0,(AC2)
MTAER1: PUSHJ PDP,ERREOT ;DELETE FILE ON TAPE
POPJ PDP, ;RETURN
ERRCOM: SETZ AC8, ;CLEAR COMMAND INPUT STRING FLAG
TLNE F,CRFL ;END OF STRING ?
JRST ERR2 ;YES, GO TO START AGAIN
TTCALL 0,C ;NO, GET NEXT CHAR.
CAIN C,15 ;CR ?
JRST ERR3 ;YES
CAIN C,12 ;NO, LF ?
JRST ERR2 ;YES
ERRLOP: TTCALL 0,C ;NO, GET NEXT CHAR.
CAIE C,15 ;CR ?
JRST ERRLOP ;NO
ERR3: TTCALL 0,C ;YES, GET LF
ERR2: TTCALL 3,QUEMAR
PUSHJ PDP,RESYS ;RESET SYSTEM WITHOUT CLOSE
JRST COMRET ;START AGAIN
ERR1: TTCALL 5,C ;CLEAR ^O
SKIPA
SETO AC8, ;MARK THAT A LINE IS READ IN
POPJ PDP, ;RETURN
ERRC: TTCALL 5,C ;CLEAR ^O
SKIPA
SETO AC8, ;MARK THAT A LINE IS READ IN
TTCALL 3,COMERR ;TYPE COMMAND ERROR
POPJ PDP, ;RETURN
IOERTX: IMPM ;ADDR. OF IO ERROR TEXT FOR ERRIN, ERROUT
IMPMT
DERR
DTER
BKTL
;IO ERROR TEXT
IMPM: ASCIZ/, IMPROPER MODE/
IMPMT: ASCIZ/, WRITE LOCK OR ILLEGAL OPERATION/
DERR: ASCIZ/, HARDWARE ERROR/
DTER: ASCIZ/, CHECKSUM OR PARITY ERROR/
BKTL: ASCIZ/, BLOCK TOO LARGE OR DTA FULL/
PAGE
MINUIC: -ICMAX+1 ;MINUS MAX. NUMBER OF INPUT FILES
P6CB: POINT 6,CB ;CHARACTER-BUFFER-POINTER
P6QB: POINT 6,QB ;QUESTION-MARK-BUFFER-POINTER
QP: 0
PDIR: POINT 5,DIR ;DECTAPE BLOCK NUMBER POINTER
PEODB: 010500,,DIRF-1 ;DECTAPE POINTER AT END OF BLOCK
PDIRF: -^D22,,DIRF ;DECTAPE FILENAME POINTER
PBLKTX: POINT 7,BLKTXT ;ASCII TEXT POINTERS
PMFITX: POINT 7,MFILTX
PDSDIR: POINT 7,DSKDIR
PDSTXT: POINT 7,DSKTXT
PBKTXT: POINT 7,BKTXT
PMONLI: POINT 7,MONLST(AC2)
MDIR1W: ASCII/MTADI/
PP11: 1,,1
SIXUFD: SIXBIT/UFD/
SIXDCH: SIXBIT/DEVCHR/
SIXDSK: SIXBIT/DSK/
SIXMTA: SIXBIT/MTA/
SIXTTY: SIXBIT/TTY/
SIXLPT: SIXBIT/LPT/
QUEMAR: ASCIZ/ ?
/
BLKTXT: ASCIZ/. FREE BLOCKS LEFT
/
MFILTX: ASCIZ/. FREE FILES ON TAPE LEFT
/
DSKDIR: ASCIZ/DIRECTORY /
DSKTXT: ASCIZ/
FILE PROTECTION ACCESS CREATION
NAME EXT BLKS DATE TIME DATE MODE
/
BKTXT: ASCIZ/TOTAL BLOCKS /
MONLST: ASCII /-JAN-/
ASCII /-FEB-/
ASCII /-MAR-/
ASCII /-APR-/
ASCII /-MAY-/
ASCII /-JUN-/
ASCII /-JUL-/
ASCII /-AUG-/
ASCII /-SEP-/
ASCII /-OCT-/
ASCII /-NOV-/
ASCII /-DEC-/
SVJFO: 0 ;SAVED .JBFFS
SVJFOD: 0
SVJFI: 0
SVJFID: 0
PAGE
ODEV: 0 ;OUTPUT DEVICE NAME
OFIL: 0 ;OUTPUT FILE NAME
OEXT: 0 ;OUTPUT FILE EXTENSION
ODATE: 0 ;OUTPUT DATE
MTERR: 0 ;ADDR. OF EXT. IN MTA-DIR. FOR ERRORS
MTERR1: 0 ;ADDR. OF DELETED EXT. IN MTA-DIR. FOR ERROR
MTERR2: 0 ;DELETED FILE IN MTA DIR. FOR ERROR
MTERR3: 0 ;DELETED EXT,,CREATION-TIME IN MTA-DIR FOR ERROR
MTERR4: 0 ; = 1 IF EOT FOR ERROR
DSKBLK: 0 ;TOTAL DISK BLOCKS
PROTEC: 0 ;PROTECTION FOR OUTPUT-FILE
FIRFIL: 0 ;MARK FOR FIRST FILE FOR OUTPUT = 1
ICSAV: 0 ;INPUT FILE AND DEVICE COUNTER SAVED
IDEV: BLOCK ICMAX ;INPUT DEVICE NAMES
IFIL: BLOCK ICMAX ;INPUT FILE NAMES
IEXT: BLOCK ICMAX ;INPUT EXTENSIONS
IFIASW: BLOCK ICMAX ;<INPUT-FILENAME-ASTERIX-FLAG=-1,,INPUT-REWIND-FLAG=-1>
IEXASN: BLOCK ICMAX ;<INPUT-EXT.-ASTERIX-FLAG =-1,,INPUT-NEW-TAPE-FLAG =-1>
QFMASK: BLOCK ICMAX ;MASK FOR QUESTION MARK CONSTRUCTION IN FILENAMES
QEMASK: BLOCK ICMAX ;MASK FOR QUESTION MARK CONSTRUCTION IN EXTENSION
QB: 0 ;QUESTION MARK BUFFER
PMD1F: -MDIRFN,,MDIRF1 ;FILENAME POINTER
PMDI11: -MDIRFN,,MDIR1+1 ;FILE NUMBER POINTER
PMDI12: POINT 7,MDIR1+1 ;FILE NUMBER ASCII POINTER
PMDIF1: POINT 6,MDIRF1 ;FILENAME SIXBIT POINTER
PMDIE1: POINT 6,MDIRE1 ;EXTENSION SIXBIT POINT
MFILP1: 0 ;FILE POSITION
MDIR10: 0 ;MTA-NUMBER+1
MDIR1: 0 ;ASCII/MTADI/
BLOCK MDIRFN ;FILE NUMBERS IN ASCII/###.TAB/
MDIRF1: BLOCK MDIRFN ;FILENAMES IN SIXBIT
MDIRE1: BLOCK MDIRFN ;<EXTENSIONS IN SIXBIT,,DATE>
PMD2F: -MDIRFN,,MDIRF2 ;SAME FOR DIR2
PMDI21: -MDIRFN,,MDIR2+1
PMDI22: POINT 7,MDIR2+1
PMDIF2: POINT 6,MDIRF2
PMDIE2: POINT 6,MDIRE2
MFILP2: 0
MDIR20: 0
MDIR2: 0
BLOCK MDIRFN
MDIRF2: BLOCK MDIRFN
MDIRE2: BLOCK MDIRFN
DIR: BLOCK ^D83 ;DECTAPE BLOCK NUMBERS
DIRF: BLOCK ^D22 ;DECTAPE FILENAMES IN SIXBIT
DIRE: BLOCK ^D23 ;DECTAPE <EXTENSIONS IN SIXBIT,,DATE>
OBUF: BLOCK 3 ;OUTPUT AND INPUT BUFFER HEADERS
OBUFD: BLOCK 3
IBUF: BLOCK 3
IBUFD: BLOCK 3
SAVAC: BLOCK 20 ;SAVED ACS
PDL: BLOCK ^D11 ;PUSH DOWN LIST
PAGE
END MAFIA