
      HED DIRECTORY - SYSTEM CONSOLE
* THE DIRECTORY COMMAND IS A SYSTEM COMMAND WHICH CAUSES THE
* CONTENTS OF THE DISC DIRECTORY TO BE PRINTED ON THE SYSTEM
* CONSOLE.  THE FORMAT OF THE PRINTOUT IS AS FOLLOWS: 
* 
* <ID> <NAME> <PURGE DATE> <FLAGS> <LENGTH> <DISC ADR>
* 
* THE PURGE DATE IS PRINTED AS A 3-DIGIT INTEGER INDICATING THE DAY 
* OF THE YEAR AND A 2-DIGIT INTEGER INDICATING THE YEAR.
* THE DISC ADDRESS IS A LOGICAL BLOCK NUMBER. 
* THE LENGTH IS IN WORDS FOR PROGRAMS, RECORDS FOR FILES. 
* THESE ARE ALL PRINTED IN DECIMAL. 
* TYPING DIR-ID WILL START THE LISTING WITH THAT ID.
      SPC 2 
      ORG LIBRA 
* 
* TEST FOR SPECIFIED ID 
* 
      CLA,INA       START WITH ID OF 1 - 1
      STA ID        IN CASE WE DON'T GO TO GETID. 
      JSB T35CH,I   SEE WHAT FIRST CHARACTER IS 
      JMP DIRNI     CR - - START AT BEGINNING OF DIRECTORY
      CCA           A _ - 1 
      ADA T35CP     MOVE BACK BUFFER POINTER. 
      STA T35CP 
      JSB GETID     GET STARTING ID CODE
      JMP LFRER     SHOULD END WITH CR
* 
* PRINT HEADING 
* 
DIRNI EQU * 
      CCA           A _ - 1 
      ADA ID        LOOK FOR PREVIOUS ID WITH 
      STA T35BF+35  NAME OF INFINITY. 
      JSB HDBFA,I   PRINT HEADING 
      JSB T35SP       AND SUSPEND 
      LDA DIR1      MOVE HEADING TO 
      STA MOVES      PRINT BUFFER.
      LDA T35B1 
      STA MOVED 
      LDB .-19
      JSB MOVEW 
      LDA .+38      PRINT 
      LDB T35B1      HEADING AND
      JSB T35SP       SUSPEND.
* 
* SEARCH INITIALIZATION 
* 
      LDA INF       SET UP LTEMP(0:3) FOR 
      STA LTEMP+1     INITIAL DIRECTORY SEARCH .
      STA LTEMP+2 
      STA LTEMP+3 
      LDA T35BF+35  GET SAVED STARTING ID.
      STA LTEMP 
* 
* SEARCH FOR ENTRY
* 
DIR2  JSB DLOKP,I   PERFORM DIRECTORY SEARCH FOR
      NOP            LAST ENTRY.
      LDA LTEMP+5   MOVE POINTER UP TO
      ADA .+12       NEXT ENTRY 
      STA LTEMP+5 
      ADA LTEMP+4,I TEST FOR END OF TRACK.
      ADA MLIBD 
      SZA 
      JMP DIR9      NOT END OF TRACK
* 
      LDB LTEMP+4   BUMP TRACK POINTER TO NEXT
      ADB .+7        TRACK. 
      CPA 1,I       LOOP IF EMPTY.
      JMP *-2 
* 
* FOUND NEXT NON-EMPTY TRACK--WANT TO READ IT IN. 
* 
      STB LTEMP+4 
      LDA 1,I       SET WORD LENGTH.
      STA MWORD 
      ADB .+5 
      LDA B         A => DISC ADDRESS 
      LDB LIBDI 
      JSB DISCZ,I   READ TRACK
      JMP DIRFM     CAN'T, TELL OPERATOR
* 
      LDA LIBD      SET POINTER TO ENTRY. 
      STA LTEMP+5 
* 
* THE ENTRY HAS BEEN LOCATED
* 
DIR9  LDA LTEMP+5,I  GET USER ID
      STA T35BF+35 LEAVE IN BUFFER; 
      CPA .-1       IF NEGATIVE, WE'RE AT END OF
      JMP LEND       DIRECTORY, SO TERMINATE. 
      CPA LTEMP     IF ID SAME AS LAST TIME, GO PUT 
      JMP DIR4      BLANKS IN.
* 
* PRINT ID
* 
      AND B1777     GET NUMERICAL PART OF ID. 
      CLB 
      DIV .100      GET FIRST DIGIT IN A,LAST 2 IN B
      STA T35BF     SAVE FIRST DIGIT. 
      LDA LTEMP+5,I GET ID AGAIN. 
      RAR,RAR       POSITION LETTER.
      AND DIRMS     KEEP ONLY THOSE 5 BITS. 
      ADA T35BF     ADD IN DIGIT. 
      ADA DIRFX     CONVERT TO ASCII. 
      STA T35BF 
      LDA 1 
      JSB DIRNM     CONVERT LAST 2 DIGITS TO
      JMP *+3        ASCII AND STORE IN BUFFER. 
* 
DIR4  LDA T35BF+2   PLACE BLANKS IN ID POSITION IN
      STA T35BF      BUFFER.
      STA T35BF+1 
* 
* PRINT PROGRAM/FILE NAME 
* 
      ISZ LTEMP+5   MOVE PROGRAM NAME INTO BUFFER.
      LDA LTEMP+5,I 
      STA T35BF+3 
      ISZ LTEMP+5 
      DLD LTEMP+5,I 
      DST T35BF+4 
* 
* PRINT THE LAST DATE ACCESSED
* 
      LDB LTEMP+5   SET POINTER TO DATE LOCATION. 
      ADB .+3 
      STB LTEMP+5 
      LDA LTEMP+5,I GET DATE. 
      AND B777      GET DAY OF YEAR.
      CLB 
      DIV .+10      SET A=1ST 2 DIGITS, B=LAST ONE. 
      BLF,BLF       POSITION LAST DIGIT IN LEFT 
      ADB DIR0S      HALF AND MERGE IN ASCII. 
      STB T35BF+8   STORE IN BUFFER.
      JSB DIRNM     CONVERT 1ST 2 DIGITS AND STORE
      STA T35BF+7    IN BUFFER. 
      LDA LTEMP+5,I GET YEAR. 
      ALF,ALF       POSITION. 
      RAR 
      AND B177      MASK, 
      JSB DIRNM      CONVERT, 
      STA T35BF+9     STORE.
* 
* PRINT DISC ADDRESS
* 
      ISZ LTEMP+5   BUMP POINTER
      ISZ LTEMP+5     TO
      ISZ LTEMP+5       DISC ADDRESS
      LDB LTEMP+5,I  GET HIGH PART IN B 
      ISZ LTEMP+5 
      LDA LTEMP+5,I  GET LOW PART IN A
      DIV DVSRS     GET FIRST 2 DIGITS IN A 
      STB T35BF+17  SAVE THE REST 
      JSB DIRNM     CONVERT TO ASCII
      STA T35BF+16  STORE IN BUFFER 
      LDA T35BF+17  RETRIEVE REST OF DIGITS 
      CLB           GET DIGITS 3 AND 4
      DIV .100        INTO A
      STB T35BF+18  SAVE 5 AND 6
      JSB DIRNM     CONVERT TO ASCII
      STA T35BF+17  STORE IN BUFFER 
      LDA T35BF+18  GET DIGITS 5 AND 6
      JSB DIRNM     CONVERT TO ASCII
      STA T35BF+18  STORE IN BUFFER 
* 
* PRINT LENGTH
* 
      ISZ LTEMP+5   BUMP POINTER TO LENGTH. 
      ISZ LTEMP+5 
      LDA LTEMP+5,I GET LENGTH. 
      SSA 
      CMA,INA       MAKE POSITIVE IF NECESSARY
      CLB           GET FIRST DIGIT IN A, LAST 4
      DIV DVSRS       IN B
      ADA ASCB0     CONVERT FIRST TO ASCII
      STA T35BF+12  STORE IN BUFFER 
      LDA B         GET DIGITS 2 - 5
      CLB           GET DIGITS 2 - 3 IN A, 4 - 5
      DIV .100       IN B.
      STB T35BF+14  SAVE LAST TWO 
      JSB DIRNM     CONVERT 2 AND 3 TO ASCII
      STA T35BF+13  STORE IN BUFFER 
      LDA T35BF+14  GET LAST TWO
      JSB DIRNM     CONVERT TO ASCII
      STA T35BF+14  STORE IN BUFFER 
      LDA T35BF+2   BLANK OUT 
      STA T35BF+15    NEXT TWO COLUMNS
* 
* CHECK FOR FILE
* 
      LDB LTEMP+5 
      ADB .-9       => SECOND WORD OF NAME
      LDA 1,I 
      INB           BUMP POINTER TO THIRD WORD
      SSA,RSS       FILE? 
      JMP DIR5      NO
      LDA DASCF     YES, GET AN F 
      JMP DIR6
* 
* CHECK SEMI-COMPILED FLAG
* 
DIR5  LDA B,I 
      SSA,RSS       SEMI-COMPILED?
      JMP *+3       NO
      LDA DASCC     YES, GET A C
      RSS 
      LDA .+40B     GET A SPACE 
* 
* CHECK PROTECT BIT 
* 
DIR6  ADB .-2       => FIRST WORD OF NAME 
      ALF,ALF       MOVE CHARACTER TO HIGH 8 BITS 
      LDB B,I 
      SSB,RSS       PROTECTED?
      JMP *+3       NO
      IOR DASCP     MERGE IN A P
      RSS 
      IOR .+40B     MERGE IN A SPACE
      STA T35BF+11  STORE IN BUFFER 
      LDA .+38      PRINT THE LINE
      LDB T35B1 
      JSB T35SP     SUSPEND.
* 
      LDA T35BF+35  SET UP LTEMP(0:3) IN ORDER TO 
      LDB T35BF+3 
      DST LTEMP     FIND NEXT PROGRAM 
      DLD T35BF+4 
      DST LTEMP+2 
      JMP DIR2      LOOP FOR NEXT OUTPUT. 
* 
* 
* 
DIRNM NOP           CONVERT A # <100 TO ASCII.
      CLB 
      DIV .+10
      ALF,ALF 
      ADA 1 
      ADA ASC00 
      JMP DIRNM,I 
* 
* 
DIRFM EQU * 
      LDA DIRSO 
      STA MOVES 
      LDA T35B1 
      STA MOVED 
      LDB DIRSP 
      BRS 
      JSB MOVEW 
      LDA DIRSP 
      CMA,INA 
      LDB DIRSO 
      JMP LEND2 
DIRSO DEF *+1 
      OCT 5103
      ASC 13,AN'T READ DIRECTORY TRACK
DIRSP EQU .+DIRSO-*+DIRSO-*+2 
DIR1  DEF *+1 
      OCT 5040      LF-BLANK
      ASC 9,ID    NAME    DATE
      ASC 9,     LENGTH   DISC
DIRMS OCT 17400 
DIRFX ASC 1,@0
DIR0S ASC 1,0/
DASCC OCT 103 
DASCF OCT 106 
DASCP OCT 120 
DASCS OCT 40
ASCB0 ASC 1, 0
* 
* LTEMP, LTEMP+1, LTEMP+2, LTEMP+3, LTEMP+4, LTEMP+5, LTEMP+12, 
*   LTEMP+13, LTEMP+14, LTEMP+15 ARE USED HERE
* 
$DIR  EQU * 
      HED STATUS - SYSTEM CONSOLE 
*  THE STATUS COMMAND PRINTS A SUMMARY OF THE SYSTEM RESOURCES, 
* AND THE EXTENT OF THEIR UTILIZATION, ON THE SYSTEM TELETYPE.
      ORG LIBRA 
      JSB HDBFA,I   PRINT HEADING 
      JSB T35SP       AND SUSPEND 
      LDA T35B2     INITIALIZE
      STA STABF       BUFFER POINTER
* 
*  PRINT THE SELECT CODE, IF ANY, OF THE MAG TAPE UNIT. 
* 
      JSB STAST     PRINT LF,MAG= 
      OCT 5115
      ASC 2,AG= 
      NOP 
      LDA MAGSC     PRINT MAGSC.
      JSB STAOC 
* 
* PRINT THE SELECT CODE, IF ANY, OF THE LINE PRINTER.  AN APPENDED
*   * => 2610 OR 2614; ** => 2767.
* 
      JSB STAST 
      ASC 9,   LINE PRINTER = 
      OCT 0 
      LDA LPS       GET THE LINE
      JSB S14SC,I     PRINTER STATUS
      SFS CH2           FROM THE I/O
      JMP *-1             PROCESSOR 
      LIA CH2       A = STATUS
      STA LTEMP 
      AND B77       A = SELECT CODE 
      JSB STAOC     PUT THE SC IN THE BUFFER
      LDA .+52B     A = '*' 
      LDB LTEMP     B = LP STATUS 
      SSB           CHECK FOR 2610A LP
      JSB STACH     YES - PUT '*' IN THE BUFFER 
      LDA .+52B     A = '*' 
      LDB LTEMP 
      RBL 
      SSB           CHECK FOR 2767A LP
      JSB STACH     YES - PUT '*' IN THE BUFFER 
* 
* USER = THE PORT NUMBER OF THE USER CONNECTED TO THE LINE PRINTER. 
* 
      JSB STAST 
      ASC 5,   USER = 
      OCT 0 
      LDB PRIST     GET USER INDICATOR AND
      SZB,RSS         CHECK FOR USE 
      JMP STLP      NO
      LDA B,I       YES 
      ALF,ALF         OUTPUT
      JSB STA2D         USER TTY# 
STLP  JSB STAPR     PRINT THE BUFFER
* 
* FOR EACH DISC IN THE SYSTEM, THE FOLLOWING INFORMATION IS GIVEN:
*     1) LOGICAL UNIT NUMBER
*     2) SELECT CODE
*     3) PHYSICAL UNIT NUMBER 
*     4) FIRST BLOCK AVAILABLE
*     5) LAST BLOCK AVAILABLE 
* 
* 
      JSB STAST 
      OCT 5104      LF-D
      ASC 2,ISCS
      OCT 11415     XOFF-CR 
      OCT 5040      LF-BLANK
      ASC 19, LOGICAL  SELECT   UNIT   FIRST   LAST 
      OCT 0 
      JSB STAPR     FIRST LINE OF DISC HEADING
      JSB STAST 
      ASC 20,   UNIT     CODE   NUMBER  BLOCK   BLOCK 
      OCT 0 
      JSB STAPR     SECOND LINE OF DISC HEADING 
      CLA           FOR LOGICAL 
      STA STAV1       DISC 0
STADI EQU * 
      LDA STAV1     FINISHED
      CPA .+8         ALL DISCS?
      JMP STALT     YES 
      MPY .+6       NO
      ADA MHAD
      ADA .+2 
      LDB A,I       GET SELECT CODE 
      LDB B,I 
      SZB,RSS 
      JMP STALT-2   SKIP IF ZERO
      STA LTEMP+1   SAVE SELECT CODE/UNIT 
      JSB STAST     4 BLANKS
      ASC 2,
      OCT 0 
      LDA .+40B     BLANK 
      JSB STACH 
      LDA STAV1     LOGICAL DISC NUMBER 
      JSB STADG 
      JSB STAST     6 BLANKS
      ASC 3,
      OCT 0 
      LDA .+40B     BLANK 
      JSB STACH 
      LDA LTEMP+1,I 
      LDA A,I 
      ALF,ALF 
      AND B77 
      JSB STAOC     DISC SELECT CODE
      JSB STAST     6 BLANKS
      ASC 3,
      OCT 0 
      LDA LTEMP+1,I 
      LDA A,I 
      AND .+3 
      JSB STADG     UNIT NUMBER 
      JSB STAST     4 BLANKS
      ASC 2,
      OCT 0 
      LDA .+40B     BLANK 
      JSB STACH 
      LDA LTEMP+1   GET SECTOR
      ADA .-2 
      LDB A,I         ADDRESS OF
      INA 
      LDA A,I           THIS DISC 
      CLE,ERB       CONVERT 
      ERA,CLE         TO BLOCKS 
      ADA .+4       FIRST AVAILABLE 
      SEZ             BLOCK IS #4 
      INB 
      JSB STA6D     FIRST BLOCK 
      JSB STAST     2 BLANKS
      ASC 1,
      OCT 0 
      LDA LTEMP+1   GET SECTOR
      ADA .+4 
      LDB A,I         ADDRESS OF
      INA 
      LDA A,I           NEXT DISC 
      CLE,ERB       CONVERT 
      ERA,CLE         TO BLOCKS 
      ADA .-1       LAST BLOCK
      SEZ,RSS         IS 1 LESS 
      ADB .-1 
      JSB STA6D     LAST BLOCK
      JSB STAPR     PRINT IT
      ISZ STAV1 
      JMP STADI 
* 
* BLOCKS AND/OR RANGES OF BLOCKS WHICH HAVE BEEN LOCKED 
* 
STALT EQU * 
      JSB STAST 
      OCT 5114
      ASC 9,OCKED DISC BLOCKS 
      OCT 0 
      JSB STAPR 
      CLA 
      STA LTEMP+3 
      LDA MHAD      => FIRST DISC 
STALV EQU * 
      STA STAV1 
      LDA LIBD      INITIALIZE
      STA STAV2       BUFFER POINTER
      LDA STAV1 
      ADA .+2 
      LDB A,I       GET SELECT CODE 
      LDB B,I 
      SZB,RSS 
      JMP STALX     DISC NOT PRESENT
STALY EQU * 
      DLD STAV1,I   COMPUTE 
      CLE,ERA 
      ERB,CLE         ADDRESS 
      ADB .+3 
      SEZ               OF BAD
      INA 
      DST LTEMP           BLOCKS
      LDA M256
      STA MWORD 
      LDA DLTEM 
      LDB LIBDI 
      JSB DISCZ,I   READ BAD BLOCKS 
      JMP DDERR 
      CLA           PUT ZERO AT 
      STA STAQV,I     BUFFER END
STALZ EQU * 
      LDA STAV2,I   GET LOCKED BLOCK ADDRESS
      SZA,RSS 
      JMP STALX     IF ZERO, FINISHED TABLE 
      DLD STAV1,I   COMPUTE 
      CLE,ERA 
      ERB,CLE         LOGICAL 
      ADB STAV2,I 
      SEZ               BLOCK 
      INA 
      SWP                 ADDRESS 
      DST LTEMP 
      JSB STA6D     FIRST BLOCK 
      ISZ STAV2 
      CCA 
      ADA STAV2,I 
      SZA,RSS       IF ONLY ONE BLOCK, DON'T
      JMP STAPZ       PRINT SECOND ADDRESS
      STA LTEMP+2 
      LDA .+55B     '-' 
      JSB STACH 
      DLD LTEMP     COMPUTE 
      CLE             LAST
      ADA LTEMP+2       BLOCK 
      SEZ                 ADDRESS 
      INB 
      JSB STA6D     OUTPUT IT 
      CLA,INA       UPDATE
STAPZ EQU * 
      INA             COUNT OF
      ADA LTEMP+3 
      STA LTEMP+3       ENTRIES ON LINE 
      ISZ STAV2 
      ADA .-8 
      SSA,RSS 
      JMP STAPL     PRINT FULL LINE 
      JSB STAST     2 BLANKS
      ASC 1,
      OCT 0 
      JMP STALZ 
STAPL EQU * 
      JSB STAPR 
      CLA           RESET ENTRY 
      STA LTEMP+3     COUNTER 
      JMP STALY 
STALX EQU * 
      LDA STAV1 
      ADA .+6       NEXT DISC 
      LDB MHAD
      ADB .+48
      CPA B         FINISHED ALL 8? 
      RSS           YES 
      JMP STALV     NO
      LDA LTEMP+3 
      SZA 
      JSB STAPR     DUMP REST OF BUFFER 
      CLF 0 
      ISZ T35ST     CHANGE STATUS TO OVERLAY
      LDA #LIB#     RESTART AT LIBRA
      JMP STAPR+2   PRINT THE LINE AND SUSPEND
      SKP 
      ORG LIBRA+512-100 
* 
* STALN PRINTS A 4-DIGIT DISC AREA WORD LENGTH => STAV1 
* 
STALN NOP 
      LDA .+45      OUTPUT
      JSB STACH       A '-' 
      LDA STAV1,I   OUTPUT THE
      CMA,INA 
      CLB             LENGTH
      DIV .100
      STB LTEMP+7 
      JSB STA2D           IN
      LDA LTEMP+7 
      JSB STA2D             WORDS 
      JSB STAST     OUTPUT
      ASC 1,          TWO 
      OCT 0             BLANKS
      JMP STALN,I 
* 
* STAPR PRINTS THE BUFFER.
* 
STAPR NOP 
      LDA STAPR     SAVE RETURN ADDRESS.
      STA T35SP 
      LDA T35B2     COMPUTE # OF CHARS. 
      CMA,INA 
      ADA STABF 
      LDB T35B2     RESET BUFFER
      STB STABF      POINTER. 
      LDB T35B1 
      JMP T35SP+1   OUTPUT. 
* 
* STAST OUTPUTS A STRING
* 
STAST NOP 
      LDA STAST,I   GET CHAR. PAIR
      SZA,RSS 
      JMP STAST,I 
      ALF,ALF       OUTPUT LEFT CHAR. 
      JSB STACH 
      LDA STAST,I   OUTPUT RIGHT CHAR.
      JSB STACH 
      ISZ STAST     BUMP POINTER. 
      JMP STAST+1   LOOP. 
* 
* STA2D OUTPUTS A 2 DIGIT NUMBER. 
* 
STA2D NOP 
      CLB 
      DIV .+10
      JSB STADG 
      JSB STADG 
      JMP STA2D,I 
* 
* STAOC OUTPUTS A 2-DIGIT OCTAL INTEGER.
* 
STAOC NOP 
      CLB 
      DIV .+8 
      JSB STADG 
      JSB STADG 
      JMP STAOC,I 
* 
* STADG OUTPUTS A DIGIT.
* 
STADG NOP 
      ADA .+60B 
      JSB STACH 
      JMP STADG,I 
* 
* STA6D OUTPUTS A 6-DIGIT NUMBER
* 
STA6D NOP 
      DIV DVSRS 
      STB LTEMP+7 
      JSB STA2D     FIRST TWO DIGITS
      LDA LTEMP+7 
      CLB 
      DIV .100
      STB LTEMP+7 
      JSB STA2D     SECOND TWO DIGITS 
      LDA LTEMP+7 
      JSB STA2D     THIRD TWO DIGITS
      JMP STA6D,I 
* 
* STACH INSERTS A CHARACTER INTO THE BUFFER.
* 
STACH NOP 
      STB LTEMP+8   SAVE B-REG. 
      AND B177      CLEAR TOP BITS. 
      LDB STABF     GET BUFFER POINTER. 
      CLE,ERB 
      SEZ,RSS 
      ALF,SLA,ALF   CHARACTER ON LEFT.
      IOR 1,I       CHARACTER ON RIGHT. 
      STA 1,I 
      ISZ STABF     BUMP POINTER. 
      LDA LTEMP+8   RESTORE OLD B-REG.INTO A. 
      JMP STACH,I 
* 
* STA3D OUTPUTS A 3-DIGIT NUMBER. 
* 
STA3D NOP 
      CLB 
      DIV .100      GET 1ST DIGIT IN A, LAST 2 IN B.
      JSB STADG     OUTPUT FIRST DIGIT. 
      JSB STA2D     OUTPUT LAST TWO.
      LDA .+40B 
      JSB STACH     OUTPUT BLANK. 
      JMP STA3D,I 
STAD6 DEF DIREC 
STADU DEF DIREU 
STAD1 DEF ADTAT 
STAD2 DEF DKTBL 
STAQV DEF LIBUS+256 
STAID DEF IDEC+1
STASW DEF TTY00+?DISC 
STAUS DEF TTY32+?DISC 
$STA  EQU * 
