
      HED PHONES LOGIC
* 
**
***   DATA SET CONTROL BOARD #1                                  [B]
**
* 
DSCBX NOP 
      CLF 0 
      STA PHNA      S   A,
      STB PHNB       A   B, 
      ERA             V   AND 
      STA PHNE         E   E
      LDA DSCBX     SETUP RETURN
      STA DSCRA       ADDRESS WORD
      LIA DSCB1     LOAD AND SAVE NEW 
      STA NSTAX       PHONES STATUS BITS
      ALF,RAL 
      RAL 
      AND .+15      A = PORT# 
      ADA TTYTP 
      LDB A,I       B => TTY TABLE
      ADB .+?PPRM 
      LDA B,I       A = PHONES PARAM
      AND .+3       ISOLATE AND SAVE OLD
      STA OSTAX       PHONES STATUS BITS
      LDA NSTAX     STORE NEW PHONES
      STA B,I         STATUS AND OUTPUT 
      OTA DSCB1         IT TO PHONES BOARD
      CLF DSCB1 
      ADB .+?STAT-?PPRM    B => ?STAT 
      AND .+3       ISOLATE NEW STATUS BITS 
      XOR OSTAX     IF INTERRUPT WAS
      SZA,RSS         CAUSED BY NOISE,
      JMP EXIT          EXIT IMMEDIATELY
      SLA           DID DSR CHANGE? 
      JMP DSCX2     YES 
      AND OSTAX     NO
      JMP DSCX1 
      SPC 2 
* 
**
***   DATA SET CONTROL BOARD #2                                  [B]
**
* 
DSCBY NOP 
      CLF 0 
      STA PHNA      S   A,
      STB PHNB       A   B, 
      ERA             V   AND 
      STA PHNE         E   E
      LDA DSCBY     SETUP RETURN
      STA DSCRA       ADDRESS WORD
      LIA DSCB2     LOAD AND SAVE NEW 
      STA NSTAY       PHONES STATUS BITS
      ALF,RAL 
      RAL 
      AND .+15      A = PORT# 
      ADA .+16      CONVERT TO UPPER SET OF PORTS 
      ADA TTYTP 
      LDB A,I       B => TTY TABLE
      ADB .+?PPRM 
      LDA B,I       A = PHONES PARAM
      AND .+3       ISOLATE AND SAVE OLD
      STA OSTAY       PHONES STATUS BITS
      LDA NSTAY     STORE NEW PHONES
      STA B,I         STATUS AND OUTPUT 
      OTA DSCB2         IT TO PHONES BOARD
      CLF DSCB2 
      ADB .+?STAT-?PPRM    B => ?STAT 
      AND .+3       ISOLATE NEW STATUS BITS 
      XOR OSTAY     IF INTERRUPT WAS
      SZA,RSS         CAUSED BY NOISE,
      JMP EXIT          EXIT IMMEDIATELY
      SLA           DID DSR CHANGE? 
      JMP DSCY1     YES 
      AND OSTAY     NO
      SPC 2 
* 
**    CARRIER STATUS CHANGED
* 
DSCX1 RAR,SLA 
      JMP DSC 
* 
*   CONNECTION MADE OR CONNECTION RESTORED WITHIN 
*   LINE DROP-OUT TIMING
*         DSR(OLD)=1     CARRIER(OLD)=0 
*         DSR(NEW)=1     CARRIER(NEW)=1 
* 
      LDA B,I       REMOVE LINE 
      AND LDNBT       DROP-OUT BIT
      JMP SEXIT         FROM STATUS 
* 
*   LINE DROP-OUT OR HANG UP
*         DSR(OLD)=1     CARRIER(OLD)=1 
*         DSR(NEW)=1     CARRIER(NEW)=0 
* 
DSC   LDA B,I       LOG TIMING, LINE
      AND PLTLD       DROP-OUT, OR PHONE
      SZA               DISCONNECT BIT SET? 
      JMP EXIT      YES, EXIT 
      LDA B,I       NO, SET LINE
      IOR LDBT        DROP-OUT BIT
      STA B,I 
      ADB .+?PHON-?STAT 
      LDA .-20      SET FOR TWO 
      JMP SEXIT       SECONDS TIMING
      SKP 
* 
**    DATA SET READY CHANGED
* 
DSCX2 AND OSTAX 
      RSS 
DSCY1 AND OSTAY 
      SLA 
* 
*   HERE'S JOE COOL ANSWERING THE PHONE - 
*   RATS, WRONG NUMBER! 
* 
*     DSR(OLD)=1     CARRIER(OLD)=0 OR =1 
*     DSR(NEW)=0     CARRIER(NEW)=0    =0 
* 
      JMP DSC 
* 
*   PHONE JUST ANSWERED OR HARD WIRED TERMINAL CONNECTED
*     DSR(OLD)=0     CARRIER(OLD)=0 OR =0 
*     DSR(NEW)=1     CARRIER(NEW)=0    =1 
* 
      LDA B,I       LOG TIMING OR 
      AND LTLDB       LINE DROP-OUT 
      SZA               BIT SET?
      JMP EXIT      YES, EXIT 
      LDA B,I       NO, SET LOG 
      IOR LTBT        TIMING BIT
      STA B,I 
      ADB .+?PHON-?STAT 
      LDA PHR       STORE LOG-ON TIME 
      SPC 1 
* 
**    EXIT
* 
SEXIT STA B,I       STORE 
EXIT  LDA PHNE      RESTORE 
      ELA 
      LDA PHNA        REGISTERS 
      LDB PHNB
      STF 0 
      JMP DSCRA,I 
      SPC 2 
DSCE  EQU *                                      [B]
      HED SELECTRIC INPUT CONVERSION
* 
*  ENTER WITH A=INPUT CHAR. AND B=?TYPE 
*  ?TYPE MUST HAVE BEEN STORED IN "XTYPE" 
*  PRIOR TO ENTRY.
* 
ICNVR NOP 
      AND B77       MASK OFF PARITY BIT(=BIT#6).
      STA XCHAR     SAVE CHARACTER. 
      RBR,SLB       CODE DETERMINED?
      JMP SELN1     YES.
* 
*  CODE DETERMINATION.
* 
      LDB XCHAR     NO. B=INPUT CHAR. 
      LDA XBPNT,I   B=> ?BPNT 
      CPA XBGIN,I   IST INPUT CHAR.?
      RSS 
      JMP SCK01     NO. 
      LDA XTYPE,I   YES. A=?TYPE
      IOR DIBT
      CPA XTYPE,I   "CIRCLE D" RECEIVED?
      JMP SELN2 
      STA XTYPE,I   NO. SET DIBT AND OUT. 
      JMP SCK11 
SELN2 EQU * 
      CPB LC        YES. ="LC"? 
      JMP SCK13     YES.
      CPB UC        NO. ="UC"?
      JMP SCK12     YES.
      CPB B46       NO. ="H" IN CALL/360? 
      JMP SELN3     YES.
      CPB B7        NO. ="H" IN EBCD? 
      RSS 
      JMP SELN3     NO. ASSUME CALL/360.
      RAR,CLE,ELA   YES. EBCD! CLEAR BIT0 AND 
      CCE           SET BIT#15. 
      RAL,ERA 
      JMP SELN4 
SELN3 EQU * 
      LDA XTYPE,I   SET BIT#0 AND 
      RAL,CLE,ERA   CLEAR BIT#15. 
      CCE 
      RAR,ELA 
SELN4 EQU * 
      STA XTYPE,I 
      JMP SCK03 
SELN1 EQU * 
      LDB A         B= INPUT CHAR.
      LDA XTYPE,I   "CIRCLE D" RECEIVED?
      IOR DIBT
      CPA XTYPE,I 
      JMP SCK01     YES.
      STA XTYPE,I   NO. SET DIBT AND OUT. 
      JMP SCK11 
SCK01 EQU * 
      LDA XTYPE,I   A= ?TYPE
* 
* 
* 
*  COME HERE WITH A=?TYPE  & B=CHARACTER(PARITY BIT 
*  MASKED OFF!).
*  POINTER TO ?TYPE MUST HAVE BEEN STORED IN "XTYPE". 
* 
      CPB UC        ="UC"?
      JMP SCK12     YES.
      CPB LC        NO. ="LC"?
      JMP SCK13     YES.
      CPB CIRCC     NO. ="CIRCLE C"?
      JMP SCK10     YES.
SCK03 EQU * 
      CPB B55       NO. ="NL"?
      JMP SCK11     YES.
      AND XNBIT     NO. CLEAR XBIT. 
      STA XTYPE,I 
      SLA,RSS       WHAT CODE?
      JMP SCK21     EBCD! 
****************************************************
***CHECK OF INPUT FROM CALL1360 TERMINAL.***********
      AND UCBT      CALL/360. 
      SZA,RSS       "US" BIT SET? 
      JMP SCK02     NO. 
      LDA XTYPE,I   YES.
      CPB CENT1     ="CENT"?
      JMP SCK71     YES.
      CPB UNDL1     NO. ="UNDERLINE"? 
      JMP SCK91     YES.
      JMP INPTC     NO. 
****************************************************
* 
SCK02 EQU * 
      LDA XTYPE,I 
      CPB CCHR1     ="C"? 
      JMP SCK81     YES.
* 
* 
* 
*  INPUT CONVERSION ENTRY.
* 
*  ENTER WITH A=?TYPE & B=CHARACTER.
*  POINTER TO ?TYPE MUST HAVE BEEN STORED IN "XTYPE". 
* 
INPTC EQU * 
      SLA           WHICH CODE? 
      JMP *+3 
      ADB CTB2,I    EBCD. 
      RSS 
      ADB CTBP1     CALL/360. 
      AND UCBT
      SZA           "US" BIT SET? 
      ADB BIT6      YES.LET B POINT TO UPPER PART.
      LDA B,I       A= CONVERTED CHAR.
      ALF,ALF       ROTATE INTO LOWER.
      AND B177      ISOLATE.
      LDB XTYPE,I   B=?TYPE 
      RBR,RBR       "CENTC" BIT IN BIT0.
      RBR,RBR 
      SLB,RSS       CONTROL CHAR. BEING INPUT?
      JMP INPC3     NO. 
      STA B         YES. SAVE CONVERTED CHAR. 
      ADA NBT6      SUBTRACT 101B.
      SSA,RSS       BETWEEN A & Z?
      JMP INPC1     MAY BE. 
INPC2 EQU * 
      LDA XTYPE,I   NO. A=?TYPE 
      AND NCCC      CLEAR "CENT" & "CENTC" BIT. 
      JMP SCK14 
INPC1 EQU * 
      LDA B         A=CONVERTED CHAR. 
      ADA M133B     SUBTRACT 133B.
      SSA,RSS       BETWEEN A & Z?
      JMP INPC2     NO. 
      LDA XTYPE,I   YES. A= ?TYPE 
      AND NCCC      CLEAR "CENT" & "CENTC" BIT. 
      STA XTYPE,I 
      LDA B         A=CONVERTED CHAR. 
      CPA XCONT     ="X"? 
      JMP INPC6     YES.
      AND NBT6      NO. MAKE CONTROL CHAR.
      JMP ICNVR,I   RETURN TO MUX.
* 
INPC6 EQU * 
      LDA XTYPE,I 
      IOR XBIT      SET XBIT. 
      STA XTYPE,I 
      CLA           A=0.
      JMP ICNVR,I   RETURN TO MUX.
INPC3 EQU * 
      RBL           "CENT" BIT IN BIT0. 
      SLB,RSS       "CENT" + OTHER CHAR. BEING INPUT? 
      JMP ICNVR,I   NO. RETURN TO MUX.
* 
      CLB           YES. B=0. 
      CPA B47       ="SINGLE QUOTE"?
      LDB B140      YES. B="ACCENT GRAVE" 
      CPA B50       NO. ="("? 
      LDB B133      YES. B="LEFT BRACKET" 
      CPA B51       NO. =")"? 
      LDB B135      YES. B="RIGHT BRACKET"
      CPA B57       NO. ="/"? 
      LDB B134      YES. B="REV. SLASH" 
      CPA B104      NO. ="D"? 
      LDB B177      YES. B="DELETE" 
      CPA B105      NO. ="E"? 
      LDB B33       YES. B="ESCAPE" 
      CPA B117      NO. ="O"? 
      LDB B173      YES. B="LEFT BRACE" 
      CPA B123      NO. ="S"? 
      LDB B175      YES. B="RIGHT BRACE"
      CPA B124      NO. ="T"? 
      LDB B176      YES. B="TILDE"
      CPA B106      NO. ="F"? 
      LDB UC        YES. B="FS".
      CPA B107      NO. ="G"? 
      LDB B35       YES. B="GS".
      CPA B122      NO. ="R"? 
      LDB B36       YES. B="RS".
      CPA B125      NO. ="U"? 
      LDB B37       YES. B="US".
      CPA B101      NO. ="A"? 
      JMP INPC5     YES.
INPC4 EQU * 
      LDA XTYPE,I   NO. CLEAR "CENT" BIT. 
      AND NBT3
      STA XTYPE,I 
      LDA B         A=CHAR. OR =0.
      JMP ICNVR,I   RETURN TO MUX.
* 
INPC5 EQU * 
      LDA XTYPE,I   A= ?TYPE
      SLA           WHAT CODE?
      JMP INPC4     CALL/360. 
      LDB B136      EBCD. B="CARET" 
      JMP INPC4 
* 
* 
* 
* 
****************************************************
***CHECK OF INPUT FROM EBCD TERMINAL.***************
* 
SCK21 EQU * 
      AND UCBT
      SZA           "US" BIT SET? 
      JMP *+3 
      LDA XTYPE,I   NO. 
      JMP INPTC 
      LDA XTYPE,I   YES.
      CPB CENT2     ="CENT"?
      JMP SCK71     YES.
      CPB CCHR2     NO. ="C"? 
      JMP SCK81     YES.
      CPB UNDL2     NO. ="UNDERLINE"? 
      JMP SCK91     YES.
      JMP INPTC     NO. 
****************************************************
SCK71 EQU * 
      AND CNBT
      SZA           "CENT" BIT SET? 
      JMP SCK72     YES.
      LDA XTYPE,I   NO. SET "CENT" BIT. 
      IOR CNBT
      JMP SCK14     RETURN TO MUX.
* 
SCK72 EQU * 
      LDA XTYPE,I 
      AND CCBT
      SZA           "CENTC" BIT SET?
      JMP SCK73     YES.
      LDA XTYPE,I   NO. 
SCK74 EQU * 
      AND CNNBT     CLEAR "CENT" BIT. 
      JMP SCK14     RETURN TO MUX.
* 
SCK73 EQU * 
      LDA XTYPE,I   CLEAR "CENT" & "CENTC" BIT. 
      AND NCCC
      JMP SCK14     RETURN TO MUX.
* 
* 
SCK81 EQU * 
      AND CCBT
      SZA           "CENTC" BIT SET?
      JMP SCK32     YES.
      LDA XTYPE,I   NO. IS "CENT" BIT SET?
      AND CNBT
      SZA,RSS 
      JMP SCK32     NO. 
      LDA XTYPE,I   YES. SET "CENTC" BIT. 
      IOR CCBT
      JMP SCK14     RETURN TO MUX.
* 
SCK91 EQU * 
      AND CCBT
      SZA           "CENTC" BIT SET?
      JMP SCK73     YES.
      LDA XTYPE,I   NO. 
      AND CNBT
      SZA,RSS       "CENT" BIT SET? 
      JMP SCK32     NO. 
      LDA XTYPE,I   YES.
      JMP SCK74 
* 
* 
* 
SCK32 EQU * 
      LDA XTYPE,I   A= ?TYPE
      LDB XCHAR     B=INPUT CHAR. 
      JMP INPTC     GO TO CONVERSION. 
* 
* 
* 
*  ENTRIES FOR RETURN TO MUX. 
* 
SCK10 EQU * 
      AND UCDCC     CLEAR US,CENT,CENTC & DIBT
      STA B         SAVE ?TYPE
      AND XBIT
      SZA           XBIT SET? 
      JMP SCK15     YES.
      STB XTYPE,I   NO. RESTORE ?TYPE 
      LDA .+13      A=CR. 
      JMP ICNVR,I   RETURN TO MUX.
* 
SCK15 EQU * 
      LDA B         AV?TYPE 
      AND XNBIT     CLEAR XBIT. 
      IOR BIT8      SET CIRCLE D BIT. 
      STA XTYPE,I 
      LDA XSTAT,I 
      IOR ICBT      SET "INPUT CONFIGURATION" BIT.
      STA XSTAT,I 
      LDA CANCL     A="CONTROL X" 
      JMP ICNVR,I   RETURN TO MUX.
* 
SCK12 EQU * 
      IOR UCBT      SET "US" BIT. 
SCK14 EQU * 
      STA XTYPE,I   RESTORE ?TYPE.
SCK11 EQU * 
      CLA           A=0 
      JMP ICNVR,I   RETURN TO MUX.
* 
* 
SCK13 EQU * 
      AND UCNBT     CLEAR "US" BIT. 
      JMP SCK14 
      HED SELECTRIC OUTPUT CONVERSION 
* 
*  ENTER WITH B= ?TYPE
*  ?TYPE POINTER MUST HAVE BEEN STORED IN 
*  "XTYPE" AND OUTPUT CHAR. IN "XCHAR" PRIOR
*  TO ENTRY.
* 
OCNVR NOP 
      LDA B         A= ?TYPE
      AND TRINT     DO "TRANSMIT INTERRUPT"?
      SZA,RSS 
      JMP SEL10 
      LDA B         SET UP NEXT TRANSMIT
      AND NBT12       INTERRUPT CHARACTER.
      CPA B 
      RSS 
      JMP SEL21     SPACE 
      AND NBT11 
      CPA B 
      RSS 
      JMP SEL21     SPACE 
      AND NBT10 
      CPA B 
      RSS 
      JMP SEL21     SPACE 
      AND NBT9
      CPA B 
      JMP SEL20 
      STA XTYPE,I 
      LDA SYNCR 
      JMP SEL22     SYNC
SEL20 EQU * 
      AND NBT8
      STA XTYPE,I 
      LDA CRCLD 
      JMP SEL22     CIRCLE D
* 
SEL21 EQU * 
      STA XTYPE,I 
      LDA SPACE 
SEL22 EQU * 
      LDB XTNUM,I   OUTPUT
      JSB IMUXR,I        CHARACTER
      JMP PMPXP,I 
* 
* 
SEL10 EQU * 
      LDA B         A= ?TYPE
      LDB XCHAR     B= OUTPUT CHAR. 
      CPB B133      ="LEFT BRACKET"?
      JMP SEL03     YES.
      CPB B135      NO. ="RIGHT BRACKET"? 
      JMP SEL03     YES.
      CPB B134      NO. ="REVERSE SLASH"? 
      JMP SEL03     YES.
      CPB B173      NO. ="LEFT BRACE"?
      JMP SEL03     YES.
      CPB B175      NO. ="RIGHT BRACE"? 
      JMP SEL03     YES.
      CPB B140      NO. ="GRAVE ACCENT"?
      JMP SEL03     YES.
      CPB B176      NO. ="TILDE"? 
      JMP SEL03     YES.
      CPB .+15B     NO. ="CR"?
      JMP SEL04     YES.
      CPB .+12B     NO. ="LF"?
      JMP SEL05     YES.
      SLA           NO. WHICH CODE? 
      JMP SEL07     CALL/360. 
      CPB B136      EBCD. ="CARET"? 
      JMP SEL03     YES.
SEL07 EQU * 
      LDA XTYPE,I   A= ?TYPE
      JSB SLCNV     CONVERT.
      BLF,BLF       BIT#7 INTO BIT#15.
      AND UCBT
      SSB,RSS       LOWER OR UPPER CASE CHAR.?
      JMP SEL09     LOWER CASE CHAR.! 
      SZA,RSS       UPPER CASE CHAR.! MODE? 
      JMP SEL11     LOWER CASE MODE!
****************************************************
*               UPPER CASE CHAR. & UPPER CASE MODE
* 
*               OR
* 
*               LOWER CASE CHAR. & LOWER CASE MODE
* 
SEL08 EQU * 
      BLF,BLF       RESTORE B.
      LDA XTYPE,I   CLEAR "CENT" & "CENTC" BIT
      AND NCCC
      STA XTYPE,I 
      LDA B         A=CONVERTED CHAR. 
      CLB           ONE CHARACTER 
      RSS 
SEL12 EQU * 
      CLB,INB       MULTI-CHARACTER 
      IOR BIT7      SET STOP BIT
      JMP OCNVR,I   RETURN TO MULTIPLEXER LOGIC 
* 
****************************************************
* 
SEL09 EQU * 
      SZA,RSS       LOWER CASE CHAR.! MODE? 
      JMP SEL08     LOWER CASE MODE!
* 
*************** LOWER CASE CHAR. & UPPER CASE MODE. 
* 
      LDA XTYPE,I   CLEAR "US" BIT. 
      AND UCNBT 
      STA XTYPE,I 
      LDA LC        A="LC". 
      JMP SEL12 
* 
****************UPPER CASE CHAR. & LOWER CASE MODE. 
* 
SEL11 EQU * 
      LDA XTYPE,I   SET "US" BIT. 
      IOR UCBT
      STA XTYPE,I 
      LDA UC        A="UC". 
      JMP SEL12 
* 
****************************************************
* 
*                   TWO CHARACTER SEQUENCE PROC.
* 
SEL03 EQU * 
      AND CCBT
      SZA           "CENTC" BIT SET?
      JMP SEL07     YES. OUTPUT CHAR. 
      LDA XTYPE,I   NO. "CENT" BIT SET? 
      AND CNBT
      SZA 
      JMP SEL02     YES.
      LDA XTYPE,I   NO. "US" BIT SET? 
      AND UCBT
      SZA 
      JMP SEL01     YES.
      JMP SEL11     NO. "UC" CODE FOR "CENT" CHAR.
*                   NOT SENT YET! SET "US" BIT AND
*                   SEND "UC".
* 
* 
SEL01 EQU * 
      LDA XTYPE,I   SET "CENT" BIT. 
      IOR CNBT
      STA XTYPE,I 
      LDB A         B= ?TYPE
      LDA CENT2     RETURN
      SLB                TO 
      LDA CENT3              MUX. 
      JMP SEL12     WITH PROPER "CENT" CHAR.
* 
* 
SEL02 EQU * 
      LDA XTYPE,I   SET "CENTC" BIT.
      IOR CCBT
      STA XTYPE,I   OUTPUT EITHER CHAR. OR "UC" OR
      JMP SEL07     "LC" CODE.
* 
* 
********************CR PROCESSING*******************
* 
SEL04 EQU * 
      AND CRBT
      SZA           "CR" BIT SET? 
      JMP SEL07     YES. OUTPUT "CR". 
      LDA XTYPE,I   NO. SET "CR" BIT. 
      IOR CRBT
      STA XTYPE,I   OUTPUT EITHER "CR" OR "UC"
      JMP SEL07     OR "LC" CODE. 
* 
****************************************************
* 
* 
********************LF PROCESSING*******************
* 
SEL05 EQU * 
      AND CRBT
      SZA,RSS       "CR" BIT SET? 
      JMP SEL07     NO. OUTPUT "LF".
* 
      LDA XTYPE,I   YES. CLEAR "CR" BIT.
      AND CRNBT 
      STA XTYPE,I 
      CLB           OUTPUT "NULL" INSTEAD.
      STB XCHAR 
      JMP SEL07 
* 
* 
* 
* 
* 
****************************************************
* 
* 
* 
* 
*  SUBROUTINE TO CONVERT AN OUTPUT CHAR.
*  ENTER WITH B=OUTPUT CHAR. AND A= ?TYPE.
*  ON EXIT B=CONVERTED CHAR.
* 
SLCNV NOP 
      SLA           WHICH CODE? 
      JMP *+3 
      ADB CTB2,I    EBCD. 
      RSS 
      ADB CTBP1     CALL/360. 
      LDA B,I       A=CONVERTED CHAR. 
      AND B377
      LDB A         B=CONVERTED CHAR. 
      LDA XTYPE,I   A= ?TYPE
      JMP SLCNV,I   RETURN. 
* 
* 
ICVRE EQU * 
      SKP 
