      HED  PROCESS OUTPUT CHARACTER ROUTINE 
* 
**
***    PROCESS OUTPUT CHARACTER 
**
* q{
*   THE OUTCR ROUTINE SENDS CHARACTERS TO POC WHICH IN TURN 
*   PLACES THEM IN THE USER'S BUFFER.  THE CALLING SEQUENCE 
*   FOR OUTCR IS: 
* 
*             JSB OUTCR,I      A = CHARACTER TO BE OUTPUT 
* 
*   THE CALLING SEQUENCE FOR POC IS:
* 
*             JSB POCR,I       A = CHARACTER TO BE OUTPUT 
*                              B = TTY TABLE ADDRESS
* 
*   POC HANDLES THE FOLLOWING TWO SPECIAL CASES:
*        1) STATUS IS INPUT - THE USER'S STATUS IS CHANGED TO 
*           OUTPUT AND A SYNCHRONIZING SIGNAL IS SENT TO THE
*           USER'S TELETYPE.
* *q
*        2) BUFFER IS FULL - THE USER IS PLACED IN OUTPUT WAIT
*           STATUS AND A TRANSFER IS MADE INTO THE SCHEDULER IN 
*           ORDER TO DELETE THE USER FROM THE QUEUE.
* 
      SPC 1 
POC   NOP 
      CLF 0         TURN OFF INTERRUPT SYSTEM 
      AND B177      MASK CHARACTER TO 
      STA OCHAR       7 BITS AND SAVE 
      STB OTNUM     SAVE TTY TABLE POINTER
      ADB .+?TSTA 
      LDA B,I       IS USER IN
      AND IOBT        OUTPUT MODE?
      SZA 
      JSB OINIT     NO - GO INITIALIZE FOR OUTPUT 
      LDB OTNUM 
      ADB .+?BSTR   B => BUFFER TAIL
      LDA B,I 
      INA           A = LOCATION FOR THIS CHARACTER 
      ADB .+?BEND-?BSTR 
      CPA B,I       IF A => BEYOND END OF BUFFER, 
      ADA MBLEN 
      ADB .+?BSTR-?BEND 
      STA B,I       SET NEW POINTER VALUE 
      LDB A         B = CHARACTER ADDRESS 
      CLE,ERB       B = WORD ADDRESS
      LDA B,I       A = DESTINATION WORD
      SEZ,RSS       IF HIGH CHARACTER,
      ALF,ALF         ROTATE TO BOTTOM
      AND HIMSK     CLEAR LOWER 8 BITS
      IOR OCHAR     MERGE WITH NEW CHARACTER
      SEZ,RSS       IF HIGH CHARACTER,
      ALF,ALF         ROTATE BACK 
      STA B,I       STORE BACK IN BUFFER
      LDB OTNUM 
      INB 
      CCA           INCREMENT 
      ADA B,I         CHARACTER 
      STA B,I           COUNT 
      CPA MAXBL     IS BUFFER FULL? 
      JMP OBF       YES 
      STF 0         NO - TURN ON INTERRUPT SYSTEM 
      JMP POC,I     RETURN
* 
*    OUTPUT BUFFER FULL 
* 
OBF   ADB .+?STAT-?CCNT 
      LDA B,I       A = USER'S SYSTEM STATUS
      SSA           IF USER ABORTED, GO 
      JMP SUSP        DIRECTLY TO SUSPEND 
      ADB .+?PLEV-?STAT  MOVE STATUS
      STA B,I              TO PLEV AND
      ADB .+?STAT-?PLEV      SET STATUS TO
      LDA %OUTW                OUTPUT WAIT
      STA B,I 
      LDA POC          SET
      ADB .+?RSTR-?STAT  RETURN 
      STA B,I              ADDRESS
      JMP SUSP
      SPC 1 
* 
**   OUTPUT INITIALIZATION ROUTINE
* 
OINIT NOP 
      XOR B,I       REMOVE 'INPUT MODE' BIT 
      STA B,I 
      ADB .+?CCNT-?TSTA 
      CLA           SET CHARACTER 
      STA B,I         COUNT TO ZERO 
      ADB .+?BGIN-?CCNT 
      LDA B,I       A = POINTER TO BUFFER HEAD
      ADB .+?BPNT-?BGIN 
      STA B,I       RESET ALL BUFFER
      INB 
      STA B,I         POINTERS TO BEGINNING 
      INB 
      STA B,I           OF USER'S BUFFER
      ADB .+?TSTA-?BHED 
      LDA B,I       A = USER'S I/O STATUS 
      IOR NIBT      IS PORT SETUP 
      CPA B,I         FOR OUTPUT? 
      JMP OINT1     YES 
      STA B,I       NO - SET 'NO INPUT ALLOWED' BIT 
      ADB .+?RPRM-?TSTA 
      LDA B,I 
      AND NECHO     MAKE SURE 
      LDB OTNUM,I     USER'S ECHO 
      JSB MUXR,I        IS TURNED OFF 
OINT1 LDB OTNUM 
      ADB .+?CDLY   GET CARRIAGE
      LDA B,I         RETURN DELAY
      INA               IF ANY
      SSA,RSS 
      JMP OINT2     NO DELAY
      ADB .+?DCNT-?CDLY 
      STA B,I       STORE DELAY 
      CCA             AND INCREMENT 
      ADB .+?CCNT-?DCNT  CHARACTER
      STA B,I              COUNT
      INB 
      LDA B,I       A = CHARACTER POINTER 
      INA           INCREMENT 
      INB             CHARACTER 
      STA B,I           POINTER 
OINT2 LDA SYNCC     GET SYNC CHARACTER
      LDB OTNUM,I     AND PORT# 
      JSB MUXR,I    OUTPUT THEM 
      JMP OINIT,I 
      SPC 2 
OTNUM BSS 1 1l
OCHAR BSS 1 1 
      HED COMMAND TABLE 
*  COMMAND TABLE -- THIS TABLE CONSISTS OF 2 PARTS. PART 1 CONTAINS 
*  THE ENCODED SYMBOLIC COMMANDS. THESE ARE CODED AS 3 BYTES, EACH
*  BYTE BEING OF LENGTH 5 BITS AND OF VALUE 101(OCTAL) LESS THAN THE
* OCTAL VALUE OF THE CHARACTER. THE THREE BYTES ARE IN BIT POSI-
*  TIONS 14-10,9-5, AND 4-0, RESPECTIVELY. BIT 15 IS SET TO 1 FOR 
*  COMMANDS THAT ARE LEGAL FOR THE SYSTEM CONSOLE.
* 
*  PART 1 IS ITSELF DIVIDED INTO 3 SECTIONS. COMMANDS IN SECTION 1
*  ARE THOSE COMMANDS WHICH ARE HANDLED IMMEDIATELY BY THE EXECUTIVE
*  WITHOUT ANY DISC ACCESS. THOSE IN SECTION 2 ARE COMPILER COMMANDS
*  WHICH ARE RESIDENT BUT WHICH REQUIRE THE PROGRAM TO BE LOADED
*  FROM DISC. COMMANDS IN SECTION 3 ARE SYSTEM COMMANDS WHICH ARE 
*  DISC RESIDENT. ALL SYSTEM COMMANDS ARE OF THIS TYPE AND
* MUST BE LOCATED AFTER COM4. 
* qq
*  PART 2 OF THE COMMAND TABLE CONTAINS THE CORE STARTING ADDRESSES 
* FOR THOSE COMMANDS IN SECTIONS 1 AND 2, AND THE DISC ADDRESSES OF 
*  THOSE IN SECTION 3.
* 
*  PART I 
* 
*  SECTION I
* 
COM1  OCT 44121     SCRATCH 
SCR   EQU COM1
      OCT 46017     TAPE
      OCT 24230     KEY 
* 
*  SECTION II 
* 
COM2  OCT 43215     RUN 
LIS   OCT 26422     LIST
PUN   OCT 37215     PUNCH 
XPUN  OCT 56764     XPUNCH
CTAPR OCT -1        USED FOR TAPE ERROR PRINTOUT. 
* *q
*  SECTION III
* 
COM3  OCT -1        FOR LENGTH SECTION
      OCT -1        FOR FUSS TABLE. 
      OCT -1        FOR FILES.
COMCH OCT -1        FOR CHAIN 
SAVE  OCT 44025 
SAVO  OCT -1        SAVE OVERLAY
      OCT 14223     GET 
      OCT 757       APPEND
HELLO OCT 16213     HELLO 
      OCT -1        HELLO OVERLAY 
BYE   OCT 3404      BYE 
      OCT 24413     KILL
      OCT 42215     RENUMBER
      OCT 32014     NAME
CAT   OCT 4023      CATALOG 
LIBRY OCT 26401 
      OCT  6213     DELETE
      OCT 46414     TIME
      OCT 6422      DISC (USER DISC SPACE)
      OCT 30222     MESSAGE 
      OCT 37056     PROTECT 
      OCT 50657     UNPROTECT 
      OCT 34744     OPEN
      OCT -1        OPEN OVERLAY
      OCT 26215     LENGTH
      OCT 10107     ECHO
COM4  OCT 142217    REPORT
      OCT 106421    DIRECTORY 
ROS   OCT 142722    ROSTER
      OCT 142222    RESET 
      OCT 144744    SPEED 
      OCT 136721    PORT
      OCT 104340    CHANGE
      OCT 100655    ANNOUNCE
      OCT 144544    SLEEP 
      OCT -1          PLUS
      OCT -1            OVERLAYS
      OCT 132226    NEWID 
      OCT 124413,-1 KILLID
      OCT 130725    MOVE
      OCT -1        MOVE OVERLAY
      OCT -1       2ND MOVE OVERLAY 
      OCT 137221,-1 PURGE 
      OCT 136356    PHONES
      OCT 106422,-1 DISC
* qq
START OCT -1        SYSTEM START UP 
      OCT -1        AUTO RESTART
      OCT -1        TO SAVE LIBR. ROUTINE CODE
* *q
* 
* 
*  PART II -- STARTING ADDRESSES
* qq
COM5  DEF #SCR
      DEF #TAP
      DEF SCH20     KEY 
* 
      DEF CMPLE 
      DEF LIST
      DEF PUNCH 
      DEF XPNCH 
      DEF TAPER 
* 
*  DISC ADDRESSES -- TO BE FILLED BY THE LOADER.
* 
COM6  BSS COM5-COM3 
FILIB EQU COM6+2    FILES DISC ADDRESS. 
CHLIB EQU COM6-COM3+COMCH    CHAIN DISC ADDRESS         [X] 
TSBLB EQU COM6-COM3+START   START UP ADDR.
* 
RSLIB EQU COM6-COM3+START+1   AUTO RESTART ADDR.
* 
SWLIB EQU COM6-COM3+START+2   SAVE LIBRARY ADDR.
* qq
DSERA BSS 6         DISC ADDRESSES FOR ERROR MESS. X] 
LOGGR BSS 32
      HED LIBRARY SUBROUTINES 
* DLOOK SEARCHES THE DISC DIRECTORY FOR A PARTICULAR ENTRY. THE 
* DESIRED ENTRY IS DEFINED BY LTEMP(0:3). 
* *q
* IF THE ENTRY IS FOUND, DLOOK RETURNS TO P+1. THE FOLLOWING VARIA- 
* BLES ARE SET: 
*     (LTEMP+4)=POINTER TO DIREC ENTRY. 
*     (LTEMP+5)=MEMORY ADDRESS OF ENTRY.
* THE APPROPRIATE DIRECTORY TRACK IS IN CORE. 
* 
* IF THE ENTRY IS NOT FOUND, DLOOK RETURNS TO P+2. THE POINTERS 
* ARE SET TO POINT AT THE LAST ENTRY LESS THAN THE GIVEN ENTRY. 
      SPC 1 
DLOOK NOP           ENTRY POINT.
      LDB LTEMP+4    LOAD DIRECTORY POINTER           [X] 
      LDA LIBD      INITIALIZE
      ADA .-8         MEMORY
      STA LTEMP+5       ADDRESS 
      LDA LTEMP    CHECK IF SEARCH               X] 
      SSA,RSS      A GIVEN TRACKCH               X] 
      LDB DIRD3                                  X] 
DLOK3 STB LTEMP+4    DIRECTORY TRACK. 
      LDA LTEMP+4,I TEST FOR EMPTY TRACK. 
      SZA A;
      JMP DLOK1     NOT EMPTY.
DLOK2 LDB LTEMP+4   BUMP BACK TO
      ADB .-7        NEXT TRACK.
      JMP DLOK3 3W
DLOK1 INB           COMPARE FIRST TRACK ENTRY 
      LDA DLTEM      TO DESIRED ENTRY.
      JSB DIRCM 
      JMP DL.2     NOT ON THIS TRACK             X] 
       NOP          FOUND THE RIGHT TRACK.
      LDA LTEMP+4,I 
*                                                                B] 
      CMA,INA       SET UP INITIAL POINTER FOR
      ADA LIBD       TRACK SCAN.
      ADA .-8 
      STA LTEMP+5 
      LDA LTEMP+4  GET DIRECTORY
      ADA .+6      DISK ADDRESS.
      LDA 0,I 
      CPA DIRWD     CHECK FOR THIS TRACK IN CORE. 
      JMP DLOK4    TRACK ALREADY IN CORE. 
      LDA DIRWD     CHECK FOR DIR. TRACK IN CORE. 
      SZA,RSS      SKIP IF SO.
      JMP DLOKB    OTHERWISE, JUST READ IN NEW TRACK
      LDB LIBD     OUTGOING CORE ADDRESS. 
      JSB DISCL    WRITE PREVIOUS TRACK OUT 
DLOKB EQU * *.
      CLA           CLEAR TRACK 
      STA DIRWD       INDICATOR 
      LDA LTEMP+4,I SET UP DISC                  B] 
      STA WORD        TRANSFER LENGTH            B] 
      LDA LTEMP+4   GET DIRECTORY 
      ADA .+6        DISC ADDRESS.
      LDA 0,I 
      LDB LIBDI 
      JSB DISCL     READ DIRECTORY. 
* NOW SEARCH DIRECTORY FOR DESIRED ENTRY. A BINARY SEARCH IS USED,
* WITH LTEMP(14:15) USED AS POINTERS TO THE FIRST AND LAST OF ALL 
* UNTESTED ENTRIES. 
* 
DLOK4 LDA LIBD      SET POINTER TO BEGINNING OF 
      STA LTEMP+14   DIRECTORY. 
      LDA DLTEM     TEST LAST ENTRY IN TRACK. 
      LDB LTEMP+5 
      JSB DIRCM 
      JMP DLOK5     LAST ENTRY TOO BIG--START CHOP. 
      RSS          NO FOUND, TOO SMALL           X] 
      JMP DLOOK,I  FOUND IT          L           X] 
DL.2  LDA LTEMP    CHECK IF 1 TRACK SEARCH       X] 
      SSA                                        X] 
      JMP DL.1     YES, FAIL EXIT                X] 
      LDB LTEMP+4  FULL CHECK                    X] 
      CPB DIRD0    ARE WE DONE?                  X] 
      RSS          YES                           X] 
      JMP DLOK2    NO, NEXT RACK                 X] 
DL.1  ISZ DLOOK    FAILURE EXIT                  X] 
      JMP DLOOK,I                                X] 
* 
DLOK5 LDA LTEMP+5   SET END POINTER.
      STA LTEMP+15
      LDA LTEMP+14  COMPUTE DIFFERENCE BETWEEN FIRST
DLOK6 CMA,INA        AND LAST ENTRIES.
      ADA LTEMP+15
      ARS           DIVIDE BY TWO.
      AND .-8       ROUND TO A VALID MULTIPLE OF 8. 
      ADA LTEMP+14  GET ADDRESS OF MIDDLE ENTRY.
      STA LTEMP+5   SET INTO RESULT LOCATION. 
      LDB DLTEM     SETUP FOR JSB DIRCM.
      CPA LTEMP+14  TEST FOR ONLY 2 ENTRIES LEFT. 
      JMP DLOK8     THERE ARE--WE'VE GOT THE RESULT.
* 
      JSB DIRCM     TEST MIDWAY ENTRY.
      JMP DLOK7     TOO SMALL--GO RESET LTEMP(14).
      JMP DLOK5     TOO BIG--GO RESET LTEMP(15).
      JMP DLOOK,I   EQUAL--RETURN.
* 
DLOK7 LDA LTEMP+5   RESET LTEMP(14).
      STA LTEMP+14
      JMP DLOK6 6H
* 
DLOK8 CPA LIBD      IF LTEMP(14)<>LTEMP, WE KNOW
      JSB DIRCM      IT'S LESS, SO WE SKIP TEST.
      JMP DL.2      NO ON THIS TRACK
      NOP 
      JMP DLOOK,I   EQUAL TO ENTRY. 
DIRWD OCT 0        TELLS WHAT DIRECTORY TRACK 
* T35CQ IS USED BY LIBRARY PROGRAMS TO SCAN THE TTY35 INPUT BUFFER. 
* EACH TIME IT IS CALLED, IT FETCHES THE NEXT CHARACTER, BUT SKIPS
* BLANKS. THE CHARACTER IS LEFT IN T35LC, AND IN A. WHEN A RETURN IS
* ENCOUNTERED, T35CQ RETURNS TO P+1; OTHERWISE TO P+2. IT IS INITI- 
* ALIZED BY THE MONITOR BEFORE THE LIBRARY ROUTINE IS CALLED. 
* 
T35CQ NOP           ENTRY POINT.
      LDA T35LC     GET LAST CHARACTER. 
      CPA .+15B     IF CR,
      JMP T35CQ,I    RETURN IMMEDIATELY.
T35C0 EQU * 
      LDB T35CP     GET CHARACTER POINTER IN B+ 
      CLE,ERB        ADJUST.
      LDA 1,I       FETCH 
      SEZ,RSS        CHAR.
      ALF,ALF 
      AND B177
      STA T35LC     SAVE IT.
      ISZ T35CP     BUMP POINTER. 
      CPA .+15B     IF CR.
      JMP T35CQ,I    RETURN IMMEDIATELY.
      CPA .+40B     IF BLANK, 
T35C1 EQU * 
      JMP T35C0     IGNORE
      ISZ T35CQ     OTHERWISE 
      JMP T35CQ,I    RETURN NORMAL. 
MOVEW NOP           MOVES -B WORDS FROM MOVES,I TO
      SSB,INB,RSS    MOVED,I
      JMP MOVEW,I 
      LDA MOVES,I   GET A WORD
      STA MOVED,I   STORE IT. 
      ISZ MOVES     BUMP
      ISZ MOVED      POINTERS.
      JMP MOVEW+1   NO. 
* 
* RDPRG READS THE CURRENT USER INTO CORE. 
* 
RDPRG NOP 
      LDB MLINK+1   GET PROGRAM BOUND POINTER.
      ADB .+?PROG-?LINK 
      LDA 1,I       GET PROGRAM BOUND 
      STA PBPTR 
      CMA           COMPUTE LENGTH. 
      ADA USE 
      STA WORD
      ADB .+?DISC-?PROG 
      LDA 1,I       GET DISC ADDRESS. 
      CLB           BLOCK 
      STB DCLC1,I    SCHEDULER. 
      LDB USEI      PERFORM 
      JSB DISCL      TRANSFER.
      LDA DCLC2,I   UNBLOCK SCHEDULER.
      STA DCLC1,I 
      JMP RDPRG,I   RETURN
* 
* DATE COMPUTES A WORD CONTAINING THE YEAR IN ITS 7 HIGH ORDER BITS 
* AND THE DAY IN ITS 9 LOW ORDER BITS.
* qq
DATE  NOP 
      LDA DATIM     GET HOUR OF YEAR. 
      CLB           DIVIDE BY 24 TO 
      DIV .+24       GET THE DAY. 
      LSL 7         POSITION ON LEFT. 
      LDB YEAR      POSITION THE YEAR 
      LSR 7 
      JMP DATE,I
* 
*     FIND ID ENTRY IN ID TABLE 
*       <P+1>: SUCCESS RETURN 
*       <P+2>: FAIL RETURN
*       A: CORE ADDRESS OF ENTRY (SUCCESS)
*          OR FIRST ENTRY PAST THE REQUESTED ENTRY (FAIL) 
*       IDTRA: POINTER TO TRACK ADDRESS 
*       IDTLA: POINTER TO TRACK LENGTH
* 
FIDT  NOP 
      LDB LIBD      SET POINTER 
      CLA             AND COUNTER 
      STA IDCNT         IN CASE NO ID'S 
      LDA IDTTA     INITIALIZE
      STA IDTRA       TRACK ADDRESS 
      LDA IDTRL       AND 
      STA IDTLA       TRACK LENGTH
FIDT4 EQU * 
      LDA IDTLA,I   LOAD TRACK LENGTH 
      SZA           IF ZERO, GO BACK TO NEXT TRACK
      JMP FIDT1     #O. CHECK IT
FIDT2 EQU * 
      LDA IDTTA     ALL 
      ADA .+3         ID TRACKS 
      CPA IDTRA         EMPTY?
      JMP FIDT3     YES SO
      ISZ IDTRA 
      ISZ IDTLA 
      JMP FIDT4 
* 
FIDT1 STA WORD      READ ID TRACK 
      ARS,ARS       DIVIDE LENGTH BY 8
      ARS             TO GET NUMBER OF ENTRIES
      STA IDCNT 
      LDA IDTRA,I     FROM DISC 
      LDB LIBDI 
      JSB DISCL 
      LDB LIBD
      LDA LIBD,I    LOAD 1ST ID 
      CMA,INA         IS REQUESTED ID ON THIS 
      ADA ID            TRACK?
      SSA 
      JMP FIDT2     NO - TRY NEXT TRACK 
      LDB LIBD      SET UP TO SCAN
      LDA ID          ID TABLE FOR ENTRY
      CMA,INA 
      STA MID 
FIDT5 LDA B,I       LOAD ENTRY
      ADA MID         IS IT THE ONE WE'RE 
      SSA,RSS         LOO KING FOR
      JMP FIDT3     FOUND THE SPOT
      ADB .+8       NOT THIS ONE - TRY NEXT ONE 
      ISZ IDCNT     IF TABLE ALL DONE THEN ENTRY
*                                    BELONGS AT END 
      JMP FIDT5 
FIDT3 SZA           DID WE FIND ENTRY?
      ISZ FIDT        NO - FAIL RETURN
      JMP FIDT,I
      SKP 
* 
* DIRCM COMPARES THE 4 WORD ENTRIES POINTED TO BY A AND B.
* BIT 15 IS NOT USED. IT RETURNS AS FOLLOWS:
*     P+1: A<B
*     P+2: A>B
*     P+3 A=B 
DIRCM NOP 
      STA DIRC2 mm
      LDA .-4       SET COUNTER.
      STA DIRC1 1O
      STB DIRC5 
DIRC3 LDA DIRC5,I   SUBTRACT WORD FROM B
      ELA,CLE,ERA 
      CMA,INA       FROM WORD FROM A
      LDB DIRC2,I 
      ELB,CLE,ERB 
      ADA 1 
      SZA           TEST FOR EQUAL. 
      JMP DIRC4     NOT EQUAL-GO RETURN.
      ISZ DIRC5     BUMP
      ISZ DIRC2      POINTERS.
      ISZ DIRC1     TEST FOR FINISHED.
      JMP DIRC3 
      ISZ DIRCM     DOUBLE ISZ FOR EQUAL. 
DIRC4 SSA,RSS 
      ISZ DIRCM     ONE ISZ IF A>B
      JMP DIRCM,I    NONE IF A<B. 
DIRC5 EQU T35CQ 
DIRC1 EQU FIDT
DIRC2 EQU DATE
LOUT  NOP      OUTPUT CHAR. IN A TO USERS TELETYPE. 
      LDB MLINK+1 
      ADB .-?LINK 
      JSB POCR,I
      JMP LOUT,I
* qq
LTYPR NOP           OUTPUT -A CHARS TO USER'S TTY;
      STA LTYP1  B POINTS TO BUFFER.
      STB LTYP2 
LTYP3 LDA LTYP2,I   GET FIRST 
      ALF,ALF        CHARACTER OF WORD
      JSB LOUT        OUT.
      ISZ LTYP1     ANY MORE? 
      RSS            YES
      JMP LTYPR,I   NO. 
      LDA LTYP2,I   SEND 2ND
      JSB LOUT       CHAR.
      ISZ LTYP2     BUMP POINTER. 
      ISZ LTYP1     ANY MORE? 
      JMP LTYP3     YES 
      JMP LTYPR,I 
LTYPE NOP           SAME AS LTYPR BUT WITH CRLF.
      JSB LTYPR 
      LDA .-2 
      LDB ?ABP2 
      JSB LTYPR 
      JMP LTYPE,I 
LTYP1 EQU DIRCM 
LTYP2 EQU FIDT
* 
LCHAR NOP      GET NEXT INPUT CHAR.--SKIP RETURN
      LDA LCHCR    CHECK IF WE ARE AT CR CHARACTER  [X] 
      CPA .+15B                                      [X]
      JMP LCHAR,I                                   [X] 
      LDB MLINK+1   UNLESS CR, SKIP BLANKS. 
      ADB .+?BHED-?LINK 
      STB LTYP1 
      ADB .+?BEND-?BHED  SET UP ENDOFBUFFER POINTER 
      STB LTYP2 zz
LCHR1 LDB LTYP1,I   GET BUFFER POINTER
      CLE,ERB 
      LDA 1,I       GET WORD. 
      SEZ,RSS       ROTATE IF 
      ALF,ALF        NECESSARY
      AND B177      MASK IT.
      CPA .+15B     RETURN IF 
      JMP LCHAR,I    CR 
      LDB LTYP1,I   GET BUFFER POINTER
      INB           BUMP TO NEXT CHAR.
      CPB LTYP2,I   IF END OF BUFFER, 
      ADB MBLEN       MOVE TO START.
      STB LTYP1,I 
      STA LCHCR    SET LAST CHARACTER FLAG          [X] 
      CPA .+40B     SKIP
LCHR2 EQU * 
      JMP LCHR1 
      ISZ LCHAR 
      ADA M96       TAPE
      SSA,RSS         CARE OF 
      ADA M32           LOWER 
      ADA .140              CASE
      JMP LCHAR,I 
T35SP NOP           OUTPUT TO TT35 AND WAIT.
      JSB TTY35,I   FIRST OUTPUT. 
      CLF 0 
      LDA T35SP     MOVE RETURN ADDRESS 
      STA T35RS     INTO TABLE. 
      LDA T35ST     MOVE STATUS INTO PRIORITY 
      STA T35PR 
      LDA %OUTW     SET STATUS TO OUTWAIT.
      STA T35ST 
      JMP *+1,I     GO HANG 
      DEF SUSP
LLEND LDA .+12B 
      JSB LOUT
      JMP SCHEN,I I
DISCL NOP 
      JSB DISC,I
      LDA ENDSK 
      SZA 
      JMP *-2 
      JMP DISCL,I 
MOVEB NOP           MOVE BACKWARD -B WORDS FROM 
      SSB,INB,RSS    MOVES TO MOVED.
      JMP MOVEB,I 
      LDA MOVES,I 
      STA MOVED,I 
      CCA           UPDATE POINTERS.
      ADA MOVED 
      STA MOVED 
      CCA FF
      ADA MOVES 
      STA MOVES 
      JMP MOVEB+1 
* LEND OUTPUTS A LINE FEED ON THE SYSTEM TELETYPE 
* AND THEN TERMINATES THE PROGRAM.
LEND  LDA ONEI      OUTPUT THE
      LDB DEH        LINE FEED. 
LEND2 JSB TTY35,I 
LENDR CLF 0 
      CLA 
      STA T35F2 
      JMP SCHEN,I 
* 
* LFRER PRINTS AN ILLEGAL FORMAT MESSAGE ON THE SYSTEM
* TELETYPE AND THEN TERMINATES THE PROGRAM. 
LFRER LDA .+9 
      LDB *+2 
      JMP LEND2 
LFRDF DEF *+1 
      OCT 51111
      ASC 4,LL FRMT 
