Trailing-Edge
-
PDP-10 Archives
-
ap-c796e-sb
-
alcfil.mac
There are no other files named alcfil.mac in the archive.
TITLE ALCFIL - FILE ALLOCATION PROGRAM 20-OCT-74 V007A(5)
;COPYRIGHT 1971,1974, DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
VALCFL==007 ;MAJOR VERSION NUMBER
VEDIT==5 ;EDIT NUMBER
VMINOR==1 ;MINOR VERSION NUMBER
VWHO==0 ;WHO LAST EDITED
LOC 137
BYTE (3)VWHO(9)VALCFL(6)VMINOR(18)VEDIT
RELOC
;ACCUMULATORS
F=0 ;FLAGS
A=1 ;WORK REGISTERS
B=2
C=3
M=4 ;MESSAGE ADDRESS AND TEMPORARY AC
WD=5
WD1=6
CH=7
P=17 ;PUSH DOWN POINTER
;FLAGS
DOTF==1 ;PERIOD SEEN IN COMMAND STRING
TYO==2
;ARGUMENT LIST
EXLLEN==26 ;LENGTH OF ARGUMENT LIST FOR EXTENDED LOOKUP, ENTER
EXLPPN==1 ;DIRECTORY NAME
EXLNAM==2 ;FILE NAME
EXLEXT==3 ;EXT
EXLPRV==4 ;PROTECTION AND CREATION DATE/TIME(LOW ORDER PART)
EXLALC==11 ;BLOCKS ALLOCATED
EXLPOS==12 ;POSITION ON PHYSICAL UNIT TO ALLOCATE NEW BLOCKS
EXLERR==3 ;WORD CONTAINING ERROR CODE FOR ENTER ERRORS
TTY==0 ;CHANNEL FOR TTY
STR==1 ;CHANNEL FOR FILE
IFNDEF PURESW,<PURESW==0>
;STORAGE MACROS
DEFINE U(A)<UU(A,1)>
.ZZ==140
IFN PURESW,<
HISEG ;FOR THE LOADER
DEFINE UU(A,B)<
A==.ZZ
.ZZ==.ZZ+B
> ;END MACRO DEFINITION OF UU
> ;END CONDITIONAL ON PURESW
IFE PURESW,<
DEFINE UU(A,B)<
A: BLOCK B
.ZZ==.ZZ+B
> ;END MACRO DEFINITION OF UU
> ;END CONDITIONAL ON PURESW
ALCFIL: JFCL
CALLI 0 ;RESET
MOVE P,PDP
INIT TTY, ;OPEN TELETYPE
SIXBIT .TTY.
XWD OBUF,IBUF
CALLI 12 ;EXIT IF NO TTY
MOVEI M,[ASCIZ .
/H FOR HELP.]
PUSHJ P,MSG
FILAL1: MOVEI M,[ASCIZ .
FILE? .]
PUSHJ P,MSG
PUSHJ P,GETNAM ;READ FILE TO ALLOCATE SPACE FOR
MOVEI A,17 ;USE DUMP MODE SO CLOSE WONT DUMP BUFFERS
SETZ C,
SKIPN B,STRNAM
MOVSI B,(SIXBIT .DSK.) ;DSK IS DEFAULT CASE
OPEN STR,A ;OPEN STR
JRST BADFIL
MOVEI WD,EXLLEN-1 ;LENGTH OF ARGUMENT LIST FOR EXTENDED LOOKUP
MOVEM WD,LOOKBF
MOVE WD,FILE
MOVEM WD,LOOKBF+EXLNAM
HLLZ WD,EXT
MOVEM WD,LOOKBF+EXLEXT
MOVE WD,PPN
MOVEM WD,LOOKBF+EXLPPN
LOOKUP STR,LOOKBF ;EXTENDED LOOKUP OF ILE
JRST NOBLOK ;NO FILE YET, ALLOCATED BLOCKS=0
SKIPG WD,LOOKBF+EXLALC ;SKIP IF ALREADY SOME BLOCKS ALLOCATED
JRST NOBLOK ;NONE
PUSHJ P,DECPNT ;TELL USER HOW MANY ALLOCATED
MOVEI M,[ASCIZ . BLOCKS ALREADY ALLOCATED
.]
PUSHJ P,MSG
NOBLOK: MOVEI M,[ASCIZ .ALLOCATE? .]
PUSHJ P,MSG
PUSHJ P,DECRD ;GET TOTAL NUMBER OF BLOCKS TO ALLOCATE
MOVEM WD,A ;SAVE ALLOCATION REQUESTED
SETZ B, ;CLEAR POSITION ON UNIT
CAIGE CH,40 ;SKIP IF MORE INPUT COMING
JRST SETALC ;NO POSITION SPECIFIED
CAIE CH,"," ;COMMA, MUST SEPARATE
JRST BADALC ;TOO BAD
PUSHJ P,DECRD ;GET POSITION TO ALLOCATE NEW BLOCKS
CAIL CH,40 ;NOT SUPPOSED TO BE ANYTHING ELSE
JRST BADALC ;PITY
MOVE B,WD
SETALC: CAMG A,LOOKBF+EXLALC ;SKIP IF HE WANTS MORE BLOCKS
SETZ B, ;NO NEW BLOCKS - MAKE SURE POS=0
MOVEM B,LOOKBF+EXLPOS
MOVEM A,LOOKBF+EXLALC ;STORE NEW ALLOCATION
HLLZ WD,EXT ;GE EXT AGAIN
MOVEM WD,LOOKBF+EXLEXT ;AND SAVE IT, CLEARING HI PART OF DATE
HRLI WD,777000 ;GET MASK FOR PROTECTION
ANDM WD,LOOKBF+EXLPRV ;AND SAVE IT, CLEARING LO PART OF DATE
ENTER STR,LOOKBF ;NEW ALLOCATION
JRST NOALC ;DIDN'T MAKE IT
MOVEI M,[ASCIZ .
ALLOCATED.] ;OK
JRST NOALC1
NOALC: HRRZ WD,LOOKBF+EXLERR ;GET ERROR CODE
MOVE M,ERRLST(WD) ;GET ADDRESS OF ERROR MESSAGE
JRST NOALC1
GETNAM: SETZM STRNAM
SETZM FILE
SETZM EXT
SETZM PPN
TRZ F,DOTF
NAM0: PUSHJ P,SIXAN
CAIE CH,":"
JRST NAM1
MOVEM WD,STRNAM
JRST NAM0
NAM1: CAIE CH,"."
JRST NAM2
TRO F,DOTF
MOVEM WD,FILE
JRST NAM0
NAM2: CAIE CH,"["
JRST NAM3
TRNE F,DOTF
MOVEM WD,EXT
TRNN F,DOTF
MOVEM WD,FILE
PUSHJ P,OCTRD
CAIE CH,","
JRST FILERR
HRLZM WD,PPN
PUSHJ P,OCTRD
CAIE CH,"]"
JRST FILERR
HRRM WD,PPN
PUSHJ P,TTI
CAIGE CH,40
POPJ P,
NAM3: CAIE CH,"/"
JRST NAM4
PUSHJ P,TTI
CAIN CH,"X"
CALLI 12
CAIN CH,"H"
JRST HELPMS
JRST FILERR
NAM4: CAIL CH,40
JRST FILERR
TRNE F,DOTF
MOVEM WD,EXT
TRNN F,DOTF
MOVEM WD,FILE
POPJ P,
FILERR: MOVEI M,[ASCIZ .?BAD FILE NAME SYNTAX.]
JRST NOALC1
PUSHJ P,TTI
HELPMS: CAIE CH,12
JRST .-2
MOVEI M,HLPM
JRST NOALC1
HLPM: ASCIZ \
ALCFIL IS A PROGRAM WHICH ALLOCATES SPACE ON A FILE STRUCTURE FOR A FILE
IT FIRST ASKS FILE?
THE RESPONSE SHOULD BE STR:FILE.EXT[PROJ,PROG]
IF STR IS OMITTED,DSK IS ASSUMED, 0 ASSUMED OTHERWISE
IT THEN ASKS ALLOCATE?
THE RESPONSE SHOULD BE N OR N,M (BOTH DECIMAL NUMBERS)
N IS THE TOTAL NUMBER OF BLOCKS TO BE ALLOCATED FOR THE FILE
M IF SPECIFIED IS THE POSITION ON THE PHYSICAL UNIT WHERE
NEW BLOCKS ARE TO BE ALLOCATED. THIS ARGUMENT IS NOT NECESSARY.
/H TYPES THIS TEXT
/X EXITS TO MONITOR
\
BADFIL: MOVE M,[ASCIZ .?CANT OPEN STR
.]
JRST NOALC1
BADALC: MOVEI M,[ASCIZ .?ILLEGAL SPECIFICATION.]
NOALC1: CLOSE STR,4 ;KEEP NEW ALLOCATION
RELEASE STR,
PUSHJ P,MSG
OUTPUT TTY,
JRST FILAL1
SIXAN: SETZ WD,
MOVE M,[POINT 6,WD]
PUSHJ P,SSP
JRST .+2
SIXANL: PUSHJ P,TTI
CAIG CH,"Z"
CAIGE CH,"0"
POPJ P,
CAIGE CH,"A"
CAIG CH,"9"
JRST .+2
POPJ P,
SUBI CH,40
TLNE M,770000
IDPB CH,M
JRST SIXANL
SSP: PUSHJ P,TTI
CAIE CH,11
CAIN CH,40
JRST SSP
POPJ P,
DECRD: SETZ WD,
DECRD1: PUSHJ P,TTI
CAIGE CH,"0"
POPJ P,
CAILE CH,"9"
POPJ P,
IMULI WD,12
ADDI WD,-60(CH)
JRST DECRD1
OCTRD: SETZ WD,
OCTRD1: PUSHJ P,TTI
CAIGE CH,"0"
POPJ P,
CAILE CH,"7"
POPJ P,
LSH WD,3
ADDI WD,-60(CH)
JRST OCTRD1
TTI: TRZE F,TYO
OUTPUT TTY,
SOSLE IBUF+2
JRST TTIOK
INPUT TTY,
STATZ TTY,740000
JRST
TTIOK: ILDB CH,IBUF+1
JUMPE CH,TTI
CAIE CH,15 ;IGNORE CARRIAGE RETURNS
CAIN CH,177
JRST TTI ;IGNORE RIBOUTS
CAIL CH,175 ;CONVERT TO STANDARD ALTMODE
MOVEI CH,33
CAIL CH,140 ;LOWER CASE TO UPPER CASE
TRC CH,40
POPJ P,
MSG: HRLI M,440700
MSG1: ILDB CH,M
JUMPE CH,CPOPJ
PUSHJ P,TTO
JRST MSG1
DECPNT: SKIPA A,[12] ;DECIMAL RADIX
OCTPNT: MOVEI A,10 ;OCTAL RADIX
RDXPNT: IDIVI WD,(A)
HRLM WD1,(P)
SKIPE WD
PUSHJ P,RDXPNT
HLRZ CH,(P)
ADDI CH,"0"
TTO: TRO F,TYO
SOSG OBUF+2
OUTPUT TTY,
IDPB CH,OBUF+1
CPOPJ: POPJ P,
ERRLST: [ASCIZ /
FILE NOT FOUNT/]
[ASCIZ /
INCORRECT PROJECT, PROGRAMMER NUMBER/]
[ASCIZ /
PROTECTION FAILURE/]
[ASCIZ /
FILE BEING MODIFIED/]
REPEAT 8,<0
>
[ASCIZ /
NO ROOM/]
[ASCIZ /
WRITE LOCK ERROR/]
[ASCIZ /
NOT ENOUGH MONITOR SPACE/]
[ASCIZ /
PARTIAL ALLOCATION ONLY/]
[ASCIZ /
BLOCK NOT FREE/]
PDP: IOWD 10,PDLIST
XLIST
LIT
LIST
UU(PDLIST,10)
UU(IBUF,3)
UU(OBUF,3)
UU(LOOKBF,EXLLEN)
U(PPN)
U(STRNAM)
U(FILE)
U(EXT)
ALCEND: END ALCFIL