
      HED HELLO 
* THE HELLO COMMAND IS USED TO LOG A USER ON TO THE SYSTEM. IT
* PERFORMS THE FOLLOWING FUNCTIONS: 
*     1) IF A USER IS ALREADY ON, HE IS LOGGED OFF. 
*     2) READ USER ID AND PASSWORD, AND ENTER INTO TTY TABLE. 
      SPC 2 
      ORG LIBRA 
      CLA 
      STA HFLG
      STA HTYPE 
      LDA MLINK+1   SET HELID TO
      ADA .+?ID-?LINK POINT TO USER'S 
      STA HELID     ID. 
      ADA .+?TIME-?ID SET POINTER TO
      STA HELTP       STARTING TIME.
      ADA HELST     COMPUTE PORT NUMBER.
      CLB 
      DIV .+TTY01-TTY00 
      STA HELPT     SAVE IT.
      CPB HELID,I   TEST FOR USER IN CORE.
      JMP HEL7      GO INPUT IDT. 
* 
**
*** LOG OFF OLD USER FIRST
**
* 
* READ IN FUSS TABLE, ZERO OUT USER'S ENTRY, AND RETURN TO DISC 
* 
      LDA M2000     INPUT FUSS TABLE
      STA MWORD 
      LDA FUSS
      LDB LIBDI 
      JSB DISCZ,I 
      JSB SICKP,I   IT'S STUCK ON THE DISC
* 
      LDA HELPT     COMPUTE LOCATION
      ALF,ALS         OF USER'S 
      ADA LIBD          FUSS TABLE
      STA LTEMP           ENTRY 
* 
      CLA           ZERO OUT HIS SECTION. 
      LDB M32 
      STA LTEMP,I 
      ISZ LTEMP 
      INB,SZB 
      JMP *-3 
* 
      LDA FUSS      WRITE BACK TO 
      LDB LIBD       DISC.
      JSB DISCZ,I 
      JSB SICKP,I   IT'S STUCK IN CORE
* 
      LDB MLINK+1 
      ADB .+?TNUM-?LINK 
      LDA 1,I       TELL 2114 THAT
      IOR NUC         NEW USER CALLED 
      JSB S14SC,I 
* 
* IF NECESSARY, DISCONNECT USER FROM LINE PRINTER 
* 
HEL7  EQU * 
      LDA HELID,I   GET CURRENT ID. 
      SZA,RSS       IF 0, NO LOGOFF IS NECESSARY. 
      JMP HEL1
* 
* 
      LDA MLINK+1       DOES THIS 
      ADA .+?TNUM-?LINK   USER HAVE 
      CPA PRIST             THE LINE
      RSS                     PRINTER?
      JMP HEL7A     NO
      LDA LPD       YES - GET OPCODE
      JSB S14SC,I   TELL I/O PROCESSOR
      CLA           REMOVE
      STA PRIST       USER
* 
* UPDATE TIME USED
* 
HEL7A ISZ NACTP     DECREMENT # OF ACTIVE PORTS CNTR
      DLD HELTP,I   GET STARTING TIME            [B]
      CMA,INA       MAKE BOTH PARTS NEGATIVE. 
      CMB,INB 
      DST HELTM     SAVE. 
      DLD DATIM     GET CURRENT TIME. 
      ADA HELTM     COMPUTE DIFFERENCES:A=#OF HRS,
      CLE           B=# OF 100 MS UNITS,
      ADB HELTM+1    E INDICATES SIGN OF B. 
      STB HELTM+1   SAVE UNITS. 
      MPY D60       CHANGE HRS TO MINS. 
      STA HELTM 
      LDA HELTM+1   GET UNIT COUNT. IF E=0
      SEZ,RSS       THEN COUNT AS NEGATIVE. 
      CCB 
      DIV D600      CHANGE TO MINUTES.
      ADA HELTM     ADD PREVIOUS COMPUTATION +1 
      STA HELTM 
* 
      LDA HELID,I   SET UP LOGOFF 
      IOR BIT15      ENTRY. 
      JSB HELOG 
* 
      JSB GCID,I    READ IN PROPER TRACK OF IDT 
* 
      ADB .+5       COMPUTE NEW TOTAL TIME. 
      CLE 
      LDA 1,I 
      ADA HELTM 
      SEZ           IF OVERFLOW, USE MAXIMUM. 
      CCA 
      STA 1,I 
* 
      LDA IDTAD     => DISC ADDRESS 
      LDB LIBD        AND CORE OUTPUT ADDRESS 
      JSB DISCZ,I       REWRITE TO DISC 
      JSB SLVAG,I   TRY TO SALVAGE
* 
      STA HELID,I   REMOVE USER'S ID FROM TABLE.
* 
* CONVERT ID OF NEW USER
* 
HEL1  JSB GETID     TRANSLATE ID. 
      RSS 
      JMP GTFER     ERROR--NO COMMA 
      CPA .+54B 
      RSS 
      JMP GTFER     ERROR--NO COMMA.
* 
      JSB SIDTP,I 
      SZB,RSS 
      JMP HELF      NOT THERE.
* 
* CHECK FOR PROPER PASSWORD 
* 
      LDA .-3       CHECK PASSWORD. 
      STA HELC
      STB HELP
HEL3  ISZ HELP      BUMP TO NEXT PASSWORD ENTRY.
      LDB HFLG
      SZB           COMMA ENCOUNTERED PREVIOUSLY? 
      JMP HEL3C     YES.
      JSB LCHAR     NO. GET 1ST CHAR. 
      JMP HEL3C     CR. 
      CLB,INB       NO CR.
      CPA .+54B     COMMA?
      RSS 
      JMP HEL3G     NO. 
      STB HFLG      YES. SET FLAG.
HEL3C EQU * 
      CLA 
HEL3G EQU * 
      ALF,ALF       FIRST CHAR. ON LEFT.
      STA HELGT 
      LDB HFLG
      SZB           COMMA ENCOUNTERED PREVIOUSLY? 
      JMP HEL3D     YES.
      JSB LCHAR     NO. GET 2ND CHAR. 
      JMP HEL3D     CR. 
      CLB,INB       NO CR.
      CPA .+54B     COMMA?
      RSS 
      JMP HEL3H     NO. 
      STB HFLG      YES. SET FLAG.
HEL3D EQU * 
      CLA 
HEL3H EQU * 
      ADA HELGT 
      CPA HELP,I    COMPARE.
      RSS 
      JMP HELF      DOES NOT COMPARE. 
      ISZ HELC      COMPARES. BUMP CHAR. COUNTER. 
      JMP HEL3      GET NEXT CHAR.
* 
      LDB HFLG
      SZB           COMMA ENCOUNTERED PREVIOUSLY? 
      JMP HEL3F     YES.
      JSB LCHAR     NO. GET NEXT CHAR.
      JMP HEL3A     CR - SUBTYPE 0
      CPA .+54B     NO CR. COMMA? 
      RSS 
      JMP GTFER     NO. ERROR!
* 
* CHECK FOR TERMINAL TYPE 
* 
HEL3F EQU * 
      JSB LCHAR     GET NEXT CHARACTER           [B]
      JMP GTFER     CR - ERROR                   [B]
      ADA M65B      CHECK FOR                    [B]
      SSA,RSS                                    [B]
      JMP GTFER       DIGIT IN                   [B]
      ADA .+5                                    [B]
      SSA               THE RANGE                [B]
      JMP GTFER                                  [B]
      STA HTYPE           0 TO 5                 [B]
      JSB LCHAR     GET NEXT CHARACTER           [B]
      RSS           CARRIAGE RETURN              [B]
      JMP GTFER     ERROR                        [B]
HEL3A EQU *         SUBTYPE IS ZERO              [B]
      LDA HTYPE     GET SUBTYPE AND              [B]
      ALF,RAL         ROTATE INTO POSITION       [B]
      IOR STP       MERGE OPCODE                 [B]
      LDB MLINK+1                                 [B
      ADB .+?TNUM-?LINK                          [B]
      IOR B,I       ADD PORT #                   [B]
      JSB S14SC,I   TELL IOP TO SETUP NEW DELAYS [B]
* 
* CHECK FOR AVAILABLE TIME
* 
      ISZ HELP      COMPUTE 
      DLD HELP,I     ALLOWED TIME-TIME TO DATE. 
      CMA,CLE,INA 
      ADA 1 
      SEZ 
      JMP HELG      NO TIME LEFT. 
* 
      LDB MLINK+1 
      ADB .-?LINK   B=> ?FLAG 
      LDA CBFLG     CLEAR 
      CMA             CBFLG 
      AND B,I 
      STA B,I           BIT.
* 
      INB           B=> ?TNUM 
      LDA 1,I       TELL 2114 
      IOR ULO         THAT USER 
      JSB S14SC,I       LOGGED ON 
* 
      LDA ID        MAKE LOG ENTRY. 
      JSB HELOG 
* 
      DLD DATIM      SET STARTING TIME AND ID 
      DST HELTP,I     INTO TABLE. 
      LDA ID        INSERT NEW ID AND CLEAR 
      CLB            NAME.
      DST HELID,I 
* 
      LDA PBUFF     ALSO SCRATCH
      LDB MLINK+1 
      ADB .+?PROG-?LINK 
      STA 1,I 
* 
      CCA           INCREMENT NUMBER             [B]
      ADA NACTP       OF ACTIVE PORTS            [B]
      STA NACTP         COUNTER                  [B]
* 
      DLD Z999      MOVE SETUP FOR HELLO
      DST LTEMP       PROGRAM INTO LTEMP(0:3) 
      DLD HELM+1
      DST LTEMP+2 
* 
      JSB DLOKP,I   SEARCH FOR PROGRAM IN LIBRARY 
      JMP HEL6      FOUND IT. 
* 
* 
HEL4  LDA .-6       OUTPUT READY MESSAGE
      LDB READY 
      JMP LIBER 
HELG  LDA .-14      PRINT "NO TIME LEFT"
      LDB HELH        ERROR 
      JMP LIBER         MESSAGE 
HELF  LDA .-16      PRINT ILLEGAL                [B]
      LDB HELK        ACCESS MESSAGE             [B]
      JMP LIBER                                  [B]
* 
* 
*     SET UP USER TO RUN HELLO PROGRAM. 
* 
HEL6  LDB LTEMP+5 
      ADB .+4       IS HELLO PROGRAM
      LDA B,I         ILL-STORED? 
      SSA 
      JMP HEL4      YES 
      ADB .-2       NO, TEST FOR FILE 
      LDA 1,I 
      SSA 
      JMP HEL4
* 
      INB           => THIRD WORD OF NAME 
      LDA 1,I       SAVE SEMI-
      STA LIBSC       COMPILED FLAG 
      INB 
      LDA 1,I       SAVE START-OF-
      ELA,CLE,ERA 
      STA LIBSP       PROGRAM POINTER 
      ADB .+4       GET 
      DLD B,I         PROGRAM 
      DST HELDI         DISC ADDRESS
      LDB LTEMP+5   GET 
      ADB .+11        PROGRAM 
      LDB B,I           LENGTH
      STB HELC      STORE LENGTH. 
      CMB,INB       COMPUTE FIRST 
      ADB LIBSP       UNUSED WORD 
      STB LIBPB 
      CMB,INB       TEST FOR OVERFLOW.
      LDA LIBSC 
      SSA,RSS       SEMI-COMPILED?
      JMP HEL12     NO
      ADB LWAUS 
      SSB,RSS 
      JMP HEL13     OK
      JMP HEL4      TOO BIG 
HEL12 EQU * 
      ADB LW97
      SSB 
      JMP HEL4
* 
* 
HEL13 EQU * 
      JSB RDPRG     READ IN FIXED AREA. 
      LDB HELC      GET HELLO PROGRAM LENGTH
      STB MWORD     NO, STORE WORD COUNT FOR DISC 
      LDB LIBSP     GET START OF PROGRAM POINTER
      ADB BIT15       AND READ BIT
      LDA HELDP     GET POINTER TO DISK ADDRESS 
      JSB DISCZ,I 
      JMP HEL4      DISK ERROR
      JSB SEMIC 
      CLF 0         PLAY SAFE.
      LDB MLINK+1 
      ADB .-?LINK 
      LDA 1,I       SET 
      IOR HFLAG       HELLO 
      STA 1,I           FLAG
      ADB .+?STAT 
      LDA %SYNT+1   SET STATUS TO RUN.
      STA 1,I 
      ISZ TIMEF     SET FLAG FOR TIMING.
      LDB SPROG 
      CPB PBPTR     NULL PROGRAM
      JMP HELRT,I   YES 
      STB PRGCT 
      LDA .+40B 
      STA BLANK 
      STF 0         INTERRUPT BACK ON.
      JMP *+1,I 
      DEF CMP14 
* 
HELOG NOP           MAKE ENTRY IN LOG TABLE.
      LDB LOGCT     WAIT UNTIL
      CPB .+32        THERE'S ROOM
      JMP *-2 
      LDB LOGP2     SET POINTER TO NEXT LOC.
      INB            IN LOG QUEUE.
      CPB LOGND 
      LDB LOGBG 
      CLF 0         INHIBIT INTERRUPT.
      STB LOGP2 
      STA LOGP2,I   ENTER ID. 
      LDA DATIM     GET DAY COUNT.
      CLB           GET HOURS OF TODAY. 
      DIV .+24
      LDA 1 
      MPY D60       CONVERT TO MINS.
      STA HELGT     SAVE. 
      LDA DATIM+1   GET UNIT COUNTER. 
      ADA D36K      ADJUST. 
      DIV D600      GET IN MINUTES. 
      ADA HELGT 
      ISZ LOGP2     PUT IN QUEUE. 
      ALF,RAL 
      IOR HELPT     MERGE IN PORT NUMBER
      STA LOGP2,I 
      ISZ LOGCT     BUMP COUNT
      STF 0         INTERRUPT BACK ON.
      JMP HELOG,I   RETURN. 
HELST ABS -TTY00-?TIME
HELRT DEF EXIT3 
HELDP DEF HELDI     => DISK ADDRESS 
Z999  OCT 65747     USER NUMBER Z999
HELM  ASC 3,HELLO 
HFLG  OCT 0         TERMINAL-TYPE FLAG
HTYPE OCT 0         TERMINAL TYPE 
M65B  OCT -65                                    [B]
HELPT EQU LTEMP+1   USER'S PORT NUMBER
HELID EQU LTEMP+6   => USER'S ID
HELTP EQU LTEMP+7   USER'S STARTING TIME
HELTM EQU LTEMP+8   USED IN 
*                         LTEMP+9     TIME CHECK
HELC  EQU LTEMP+10
HELP  EQU LTEMP+11
HELGT EQU LTEMP+12
HELDI EQU LTEMP+14  DISC
*                         LTEMP+15    ADDRESS 
* 
* LTEMP, LTEMP+2, LTEMP+3, LTEMP+5, AND LTEMP+13 ARE ALSO USED
* 
$HEL  EQU * 
      HED BYE 
* THE BYE COMMAND IS USED TO LOG A USER OFF. BYE MUST PERFORM THE 
* FOLLOWING FUNCTIONS:
*     1) DETERMINE AMOUNT OF CONSOLE TIME USED
*     2) UPDATE USER'S CLOCK IN ID-TABLE
*     3) SET FLAG FOR SYSTEM TO UNHOOK. 
*     4) OUTPUT TERMINATION MESSAGE 
      SPC 2 
      ORG LIBRA 
      LDA MLINK+1       DOES THIS 
      ADA .+?TNUM-?LINK   USER HAVE 
      CPA PRIST             THE LINE
      RSS                     PRINTER?
      JMP BYE1      NO                           [B]
      LDA LPD       YES-GET OPCODE
      JSB S14SC,I   TELL I/O PROCESSOR
      CLA           REMOVE
      STA PRIST       USER
BYE1  LDB MLINK+1 
      ADB .+?FLAG-?LINK  B => FLAG WORD 
      LDA OUTWT     REMOVE
      CMA             OUTWT BIT 
      AND 1,I           FROM
      STA 1,I             STATUS. 
      ADB .+?ID-?FLAG 
      LDA 1,I       GET ID
      SZA,RSS       IF ID=0, USER NEVER 
      JMP BYBY        LOGGED ON, SO EXIT
      STB BYEID     SAVE POINTER TO ID
      ISZ NACTP     DECREMENT # OF ACTIVE PORTS CNTR
      ADB .+?FLAG-?ID                            [B]
      LDA B,I       ARE THERE FILES              [B]
      AND DFCHK       WHOSE LCDS NEED            [B]
      SZA,RSS           TO BE UPDATED?           [B]
      JMP BYE2      NO                           [B]
      JSB RDPRG     YES, READ IN USER            [B]
      LDA FCNTR     GET NUMBER OF FILES          [B]
      CMA,INA         AND NEGATE                 [B]
      LDB BYEID     B => ?ID                     [B]
      JSB BYLCD,I   GO UPDATE LCDS               [B]
      NOP                                        [B]
BYE2  LDA M2000     INPUT FUSS TABLE             [B]
      STA MWORD 
      LDA FUSS
      LDB LIBDI 
      JSB DISCZ,I 
      JSB SICKP,I   IT'S STUCK ON THE DISC
* 
      LDA MLINK+1   COMPUTE USER'S PORT NO. 
      ADA BYESP 
      CLB 
      DIV .+TTY01-TTY00 
      STA BYEPT 
* 
      ALF,ALS       COMPUTE LOCATION OF USER'S FUSS 
      ADA LIBD
      STA LTEMP+1 
      LDA M32       CLEAR USER'S FUSS 
      STB LTEMP+1,I 
      ISZ LTEMP+1 
      INA,SZA 
      JMP *-3 
* 
      LDA FUSS      WRITE FUSS
      LDB LIBD        BACK TO DISC
      JSB DISCZ,I 
      JSB SICKP,I   IT'S STUCK IN CORE
* 
* 
      LDA MLINK+1 
      ADA .+?TIME-?LINK  SET POINTER TO START TIME. 
      DLD 0,I          GET STARTING TIME. 
      CMA,INA       SET BOTH PARTS NEGATIVE.
      CMB,INB 
      DST BYETM     SAVE
      DLD DATIM     NOW GET CURRENT TIME
      ADA BYETM     COMPUTE DIFFERENCES: A=# OF HRS,
      CLE           B=# OF 100 MS UNITS,
      ADB BYETM+1    E INDICATES SIGN OF B. 
      STB BYETM+1   SAVE UNITS. 
      MPY D60       CHANGE HRS TO MINS. 
      STA BYETM 
      LDA BYETM+1   GET UNIT COUNT. IF E=0
      SEZ,RSS       THEN COUNT AS NEGATIVE. 
      CCB 
      DIV D600      CHANGE TO MINUTES.
      ADA BYETM     ADD PREVIOUS COMPUTATION PLUS 
      STA BYETM 
* 
      LDA LOGCT     CHECK FOR ROOM IN LOG TABLE 
      CPA .+32
      JMP *-2 
      LDA LOGP2     SET LOGP2 TO NEXT LOCATION IN 
      INA            LOG TABLE. 
      CPA LOGND 
      LDA LOGBG 
      STA LOGP2 
      LDA BYEID,I   PLACE ID IN LOG TABLE AND 
      IOR BIT15      SAY LOGOFF.
      STA LOGP2,I 
      ISZ LOGP2 
      DLD DATIM     COMPUTE TIME OF DAY.
      STB BYETM+1   SAVE UNIT COUNTER.
      CLB           GET # OF HRS IN B BY MOD'ING
      DIV .+24       OFF THE DAY COUNT. 
      LDA 1 
      MPY D60       CONVERT TO MINS.
      STA BYET      SAVE THAT.
      LDA BYETM+1   GET UNIT COUNTER. 
      ADA D36K      ADJUST
      DIV D600       GET MINUTES. 
      ADA BYET      PACK TOGETHER AND PUT IN LOG
      ALF,RAL 
      IOR BYEPT 
      STA LOGP2,I    TABLE. 
      ISZ LOGCT     BUMP COUNTER. 
* 
      JSB GCID,I    READ IDT TRACK
* 
      ADB .+5       COMPUTE NEW TOTAL TIME. 
      CLE 
      LDA 1,I 
      ADA BYETM 
      SEZ           IF OVERFLOW, USE MAXIMUM. 
      CCA 
      STA 1,I 
* 
      LDA IDTAD     => DISC ADDRESS 
      LDB LIBD
      JSB DISCZ,I     AND WRITE OUT MODIFIED TRACK
      JSB SLVAG,I   TRY TO SALVAGE
* 
      CLA           REMOVE USER'S ID
      STA BYEID,I    FROM TABLE 
* 
      LDA .+12B 
      JSB LOUT
* 
      LDA BYETM 
      CLB           OUTPUT # OF MINUTES.
      DIV .100
      STB BYET
      ADA .+60B 
      JSB LOUT      HUNDREDS
      LDA BYET
      CLB 
      DIV .+10
      STB BYET
      ADA .+60B 
      JSB LOUT      TENS
      LDA BYET
      ADA .+60B 
      JSB LOUT      UNITS.
* 
      LDA .-25      OUTPUT THE REST OF
      LDB BYEM       THE MESSAGE. 
      JSB LTYPE 
BYBY  EQU * 
      LDB MLINK+1 
      ADB .+?TNUM-?LINK 
      LDA 1,I 
      IOR WTP       ASK FOR TERMINAL TYPE.
      JSB S14SC,I 
      SFS CH2 
      JMP *-1 
      LIA CH2       GET TYPE. 
      SZA           WHICH?
      JMP BYE3
      LDA 1,I       TYPE#1. TURN ECHO ON. 
      IOR ECO 
      JMP BYE4
BYE3  EQU * 
      LDA 1,I       TYPE#2. TURN ECHO OFF.
      IOR ECF 
BYE4  EQU * 
      JSB S14SC,I 
      LDA 1,I       DISCONNECT
      IOR HUU 
      JSB S14SC,I     USER
      ADB .-?TNUM   B=> ?FLAG 
      LDA B30M      CLEAR CBFLG AND 
      CMA 
      AND B,I 
      STA B,I       PBFLG BITS. 
      JMP LLEND 
* 
BYEID BSS 1         => USER'S ID                 [B]
BYETM EQU LTEMP+1   TRIPLE WORD 
*                         LTEMP+2     FOR USER'S
BYET  EQU LTEMP+3       TIME CHECK
BYEPT EQU LTEMP+4   USER PORT NUMBER
BYLCD DEF LCD                                    [B]
* 
BYEM  DEF *+1 
      ASC 13, MINUTES OF TERMINAL TIME. 
BYESP ABS -TTY00-?LINK
$BYE  EQU * 
      HED KILL
* THE KILL ROUTINE IS USED TO DELETE A PROGRAM FROM THE USER
* LIBRARY. THE PROCESS IS AS FOLLOWS: 
*     1) CHECK FORMAT AND DETERMINE PROGRAM NAME. 
*     2) SEARCH DIRECTORY FOR ENTRY.
*     3) OBTAIN LOCATION AND LENGTH.
*     4) COLLAPSE DIRECTORY.
*     5) UPDATE ADT AND IDT.
      SPC 1 
      ORG LIBRA 
      SPC 1 
      CLA           INITIALIZE FLAG TO INDICATE A 
      STA KILTS       PROGRAM IS TO BE KILLED 
      LDA MLINK+1   GET USER'S ID.
      ADA .+?ID-?LINK 
      LDA 0,I 
      STA LTEMP     STORE IN LTEMP. 
      LDA DLTEM     SET UP POINTER FOR
      INA           NAME. 
      STA KILP
      LDA .-3       SET UP COUNTER. 
      STA KILC
KIL1  JSB LCHAR     GET LEFT CHAR.
      LDA .+40B     BLANK IF NONE.
      ALF,ALF 
      STA KILP,I
      JSB LCHAR     GET RIGHT CHAR. 
      LDA .+40B 
      IOR KILP,I
      STA KILP,I
      ISZ KILP      BUMP POINTER. 
      ISZ KILC      ANY MORE? 
      JMP KIL1      YES.
      LDA LTEMP+1 
      CPA ASCBB 
      JMP KIL2      NO CHARS--ERROR.
      JSB LCHAR     TEST FOR TOO MANY.
      JMP KIL3      O.K.
* 
KIL2  LDB *+3 
      LDA .-13
      JMP LIBER 
      DEF *+1 
      OCT 5111
      ASC 6,LLEGAL NAME 
* 
KIL3  EQU * 
      JSB DLOKP,I   SEARCH DIRECTORY FOR PROGRAM
      JMP KIL10     FOUND.
* 
KILER LDA .-14
      LDB *+2 
      JMP LIBER 
      DEF *+1 
      OCT 5116
      ASC 6,O SUCH ENTRY
* 
* FOUND ENTRY. NOW REMOVE IT. 
* 
KIL10 LDB KILPD     GET LOCATION OF DISC ADDRESS. 
      STB MOVED 
      ADB .+8       B => DISC ADDRESS 
      DLD B,I       AB = DISK ADDRESS 
      DST KILDI     SAVE DISK ADDRESS 
      LDB KILPD     B => DIR ENTRY
      ADB .+11      B => LENGTH 
      LDA B,I       A = LENGTH OF FILE OR PROGRAM 
      SSA,RSS       SKIP IF LENGTH IN WORDS (NEGATIVE)
      JMP KIL11     LENGTH IS POSITIVE BLOCK COUNT
      CCB           PROGRAM LENGTH IS IN WORDS
      ASR 8         / 256 TO GET DISC BLOCK COUNT 
      CMA,INA       MAKE INTO POSITIVE COUNT
KIL11 EQU * 
      STA KILN      SAVE LENGTH 
* 
      LDB KILPD     TEST FOR FILE.
      ADB .+2 
      LDA 1,I 
      SSA,RSS 
      JMP KIL18     NOT A FILE. 
      ISZ KILTS     FLAG SET FOR FILE KILL
* 
      LDA M2000     INPUT FUSS TABLE
      STA MWORD 
      STA KILC      SAVE IN KILC ALSO.
      LDA FUSS
      LDB LIBDI 
      JSB DISCZ,I 
      JSB SICKP,I   IT'S STUCK ON THE DISC
* 
      LDA MLINK+1   COMPUTE USER'S
      ADA .+?TNUM-?LINK 
      LDA A,I       USER # IN BITS 12 - 8 
      ALF,ALF       RIGHT JUSTIFY USER NUMBER 
      ALF,RAL       COMPUTE LOCATION OF 
      ADA LIBD       USER'S FUSS. 
      STA KILDF     ZERO OUT USER'S FUSS. 
      LDA M32 
      STB KILDF,I 
      ISZ KILDF 
      INA,SZA 
      JMP *-3 
* 
*     SEARCH FUSS TABLE TO SEE IF FILE IS BEING USED
* 
      LDB LIBD      B => BEGINNING OF TABLE 
      STB KILC
      DLD KILDI     GET DISK ADDRESS TO AB
KILAD EQU * 
      CPA KILC,I    ARE THE UPPER WORDS EQUAL?
      JMP KILAF     YES, CHECK LOWER WORDS
      IOR BIT15     PLUG IN WRITE PROTECT BIT AND 
      CPA KILC,I    CHECK FOR THAT EQUAL
      JMP KILAF     EQUAL, CHECK LOWER WORD 
      ISZ KILC
KILAE EQU * 
      ISZ KILC      ADVANCE POINTER TO NEXT ENTRY 
      LDA L1024     GET ENDING ADDRESS AND
      CPA KILC        SEE IF WE ARE THERE YET 
      JMP KILAJ     NOT IN FUSS TABLE 
      LDA KILDI     MUST SEARCH ON, RESTORE UPPER WORD
      JMP KILAD 
* 
KILAF EQU * 
      ISZ KILC      ADVANCE TO SECOND WORD
      CPB KILC,I    CHECK LOWER WORD
      JMP KIL19     CAN'T KILL - - FILE IS IN USE 
      JMP KILAE     GO TRY NEXT ENTRY 
KILAJ EQU * 
* 
      LDA FUSS      WRITE BACK FUSS TABLE 
      LDB LIBD
      JSB DISCZ,I 
      JSB SICKP,I   IT'S STUCK IN CORE
      JSB DLOKP,I   RETRIEVE DIRECTORY TRACK
      RSS 
      JMP KILER     ERROR CONDITION 
      LDB KILPD     RESTORE 
      STB MOVED 
      ADB .+8         THE 
      DLD B,I           FILE
      DST KILDI           DISC ADDRESS
      JMP KIL18     GO KILL 
* 
KIL19 LDA .-12
      LDB *+2 
      JMP LIBER 
      DEF *+1 
      OCT 5106      LF-F
      ASC 5,ILE IN USE
* 
KIL18 LDB KILPD     SET UP PARAMETERS FOR MOVE. 
      ADB .+12
      STB MOVES 
      ADB KILP,I
      ADB MLIBD     B = -# OF WORDS TO MOVE 
      JSB MOVEW 
* 
      LDA KILP,I    REDUCE DIRECTORY LENGTH BY 8. 
      ADA .+12
      STA KILP,I
      STA MWORD     WRITE DIRECTORY BACK OUT
      LDA KILP
      INA 
      STA MOVED 
      ADA .+4 
      STA KILRD 
      LDB LIBD
      STB MOVES 
      JSB DISCZ,I 
      JMP KILRC 
* 
      LDA KILP      ADJUST WORDS 1-4 OF DIREC.
      INA 
      STA MOVED 
      LDB .-4 
      JSB MOVEW 
* 
      JSB GCID,I    READ IN IDT 
      LDA KILN      GET PROGRAM LENGTH. 
      CMA,INA 
      ADB .+7       ADJUST IDT
      ADA B,I 
      STA 1,I 
      LDA IDTAD     RESTORE UPDATED 
      STA KILRD 
      LDB LIBD        IDT TO
      JSB DISCZ,I       THE DISC
      JMP KILRC 
* 
*     NOW RESTORE THE DISK SPACE TO THE APPROPRIATE 
*     DISK ADT
* 
      JSB FADTP,I   FIND THE CORRECT DISK 
* 
      LDA KILDF,I   GET LENGTH OF DISK ADT
      STA MWORD     SET FOR DISC DRIVER 
      DLD KILD,I    GET DISC ADDRESS
      IOR B 
      SZA,RSS       CHECK FOR EXISTANCE 
      JMP LLEND     NO SUCH ADT 
      LDA KILD      RETURN A TO => DISC ADDRESS 
      LDB LIBDI     GET CORE ADDRESS AND INPUT BIT
      JSB DISCZ,I   READ IN THE ADT 
      JMP KILCS     CAN'T, FORGET ABOUT RETURNING IT
      JSB RBAD,I    PUT SPACE FOR THIS ENTRY BACK 
      LDA KILD      A => DISC ADDRESS 
      LDB LIBD
      JSB DISCZ,I   WRITE OUT UPDATED ADT 
      JMP KILDM     CAN'T, REMOVE ADT 
KILCS EQU * 
* 
      LDA KILTS     DID WE JUST KILL A
      SZA,RSS        FILE?
      JMP LLEND     NO. 
      JSB RDPRG     IF WE DID, WE HAVE TO DECOMPILE 
      JSB DCMPL      THE GUY TO MAKE SURE HE DOESN'T
      LDA MLINK+1     USE IT. 
      ADA .-?LINK   LEAVE USER IN CORE. 
      STA MAIN
      JMP LLEND     TERMINATE.
* 
KILRC LDB .-4 
      JSB MOVEW     RESET DIRECTORY 
      JSB SLVAG,I   TRY TO SALVAGE
* 
KILDM CLA 
      CLB 
      STA KILDF,I   MAKE ADT
      DST KILD,I      DISAPPEAR 
      JMP KILCS 
KILRD BSS 1 
KILP  EQU LTEMP+4   => DIREC ENTRY
KILPD EQU LTEMP+5   => DIRECTORY ENTRY
KILTS EQU LTEMP+6   FILE INDICATOR
KILC  EQU LTEMP+10
KILDF EQU LTEMP+11
KILD EQU LTEMP+12 
KILN  EQU LTEMP+13  PROGRAM LENGTH
KILDI EQU LTEMP+14  DISC
*                         LTEMP+15    ADDRESS 
* 
* LTEMP, LTEMP+1, LTEMP+2 AND LTEMP+3 ARE ALSO USED 
* 
$KIL  EQU * 
