
* 
* 
*  CONSTANTS & STORAGE FOR SELECTRIC CONVERSION.
* 
* 
UNDL2 EQU .+1       "UNDERLINE" IN EBCD(UPPER)
CENT2 EQU .+2       "CENT" IN EBCD(UPPER) 
B33   OCT 33
UC    OCT 34        "UPPER CASE" IN BOTH CODES. 
LC    EQU B37       "LOWER CASE" IN BOTH CODES. 
B35   OCT 35
B36   OCT 36
B46   OCT 46
B47   OCT 47
B50   OCT 50
B51   OCT 51
B55   OCT 55        "NL" IN BOTH CODES. 
B57   OCT 57
UNDL1 OCT 63        "UNDERLINE".IN CALL/360(UPPER!) 
CCHR2 EQU UNDL1     "C" IN EBCD(UPPER!) 
CENT1 OCT 72        "CENT" IN CALL/360(UPPER) 
CCHR1 EQU CENT1     "C" IN CALL/360(LOWER)
CENT3 OCT 172       "CENT" IN CALL/360(OUTPUT)
CIRCC OCT 74        "CIRCLE C" IN BOTH CODES. 
B77   OCT 77
B101  OCT 101 
B104  OCT 104 
B105  OCT 105 
B106  OCT 106 
B107  OCT 107 
B117  OCT 117 
B122  OCT 122 
B123  OCT 123 
B124  OCT 124 
B125  OCT 125 
B133  OCT 133 
B134  OCT 134 
B135  OCT 135 
B140  OCT 140 
B173  OCT 173 
B175  OCT 175 
B176  OCT 176 
M133B OCT 177645
UCDCC OCT 157743    CLEAR US,CENT,CENTC & DIBT
NCCC  OCT 177747    TO CLEAR "CENT" & "CENTC" BIT.
SPACE EQU BIT14 
SYNCR OCT 77777 
XCONT OCT 130 
      HED SELECTRIC CONVERSION TABLES 
****************************************************
***CALL/360 CONVERSION TABLE.***********************
* 
*  INPUT=HIGH PART. 
*  OUTPUT=LOW PART. 
* 
CTBP1 DEF *+1 
      OCT 020075    000 
      OCT 036475    001 
      OCT 052075    002 
      OCT 045075    003 
      OCT 032174    004 
      OCT 047475    005 
      OCT 046075    006 
      OCT 000075    007 
      OCT 032535    010 
      OCT 024457    011 
      OCT 042556    012 
      OCT 050075    013 
      OCT 000075    014 
      OCT 000155    015 
      OCT 000075    016 
      OCT 000075    017 
      OCT 031075    020 
      OCT 027075    021 
      OCT 047114    022 
      OCT 025054    023 
      OCT 055117    024 
      OCT 000075    025 
      OCT 000075    026 
B136  OCT 000136    027 
      OCT 033035    030 
      OCT 044475    031 
      OCT 045475    032 
      OCT 050475    033 
      OCT 000075    034 
      OCT 004075    035 
      OCT 000075    036 
      OCT 000075    037 
      OCT 030500    040 
      OCT 046742    041 
      OCT 054220    042 
      OCT 043645    043 
      OCT 030252    044 
      OCT 051724    045 
      OCT 044344    046 
      OCT 054640    047 
      OCT 033553    050 
      OCT 051111    051 
      OCT 042023    052 
      OCT 024067    053 
      OCT 000073    054 
      OCT 000267    055 
      OCT 000121    056 
      OCT 004623    057 
      OCT 031544    060 
      OCT 053040    061 
      OCT 052420    062 
      OCT 043160    063 
      OCT 034404    064 
      OCT 053410    065 
      OCT 041130    066 
      OCT 025550    067 
      OCT 034070    070 
      OCT 040464    071 
      OCT 041721    072 
      OCT 026273    073 
      OCT 000360    074 
      OCT 000001    075 
      OCT 000350    076 
      OCT 000261    077 
      OCT 020371    100 
      OCT 036571    101 
      OCT 052166    102 
      OCT 000172    103 
      OCT 000052    104 
      OCT 047512    105 
      OCT 046163    106 
      OCT 000043    107 
      OCT 000046    110 
      OCT 024431    111 
      OCT 042503    112 
      OCT 057032    113 
      OCT 000106    114 
      OCT 000141    115 
      OCT 000122    116 
      OCT 000105    117 
      OCT 021013    120 
      OCT 035133    121 
      OCT 047051    122 
      OCT 027445    123 
      OCT 022402    124 
      OCT 000062    125 
      OCT 000061    126 
      OCT 000165    127 
      OCT 000142    130 
      OCT 044547    131 
      OCT 045524    132 
      OCT 050553    133 
      OCT 000223    134 
      OCT 004111    135 
      OCT 000213    136 
      OCT 000363    137 
      OCT 023640    140 
      OCT 046571    141 
      OCT 020566    142 
      OCT 043572    143 
      OCT 023052    144 
      OCT 021512    145 
      OCT 044163    146 
      OCT 054443    147 
      OCT 037046    150 
      OCT 051031    151 
      OCT 022103    152 
      OCT 034032    153 
      OCT 000106    154 
      OCT 000141    155 
      OCT 000122    156 
      OCT 004505    157 
      OCT 036013    160 
      OCT 037533    161 
      OCT 052451    162 
      OCT 057445    163 
      OCT 076002    164 
      OCT 053462    165 
      OCT 041061    166 
      OCT 026565    167 
      OCT 000142    170 
      OCT 040147    171 
      OCT 000124    172 
      OCT 035505    173 
      OCT 000264    174 
      OCT 000045    175 
      OCT 000002    176 
      OCT 000177    177 
* 
****************************************************
      SPC 3 
****************************************************
***EBCD CONVERSION TABLE.***************************
* 
*  INPUT=HIGH PART. 
*  OUTPUT=LOW PART. 
* 
CTBP2 DEF *+1 
      OCT 020075    000 
      OCT 026475    001 
      OCT 040075    002 
      OCT 023075    003 
      OCT 034174    004 
      OCT 070475    005 
      OCT 074475    006 
      OCT 064075    007 
      OCT 032135    010 
      OCT 066457    011 
      OCT 072556    012 
      OCT 062075    013 
      OCT 000075    014 
      OCT 000155    015 
      OCT 000075    016 
      OCT 000075    017 
      OCT 031075    020 
      OCT 065475    021 
      OCT 071514    022 
      OCT 061054    023 
      OCT 030117    024 
      OCT 000075    025 
      OCT 000075    026 
      OCT 000136    027 
      OCT 033075    030 
      OCT 067475    031 
      OCT 073475    032 
      OCT 063075    033 
      OCT 000075    034 
      OCT 004075    035 
      OCT 000075    036 
      OCT 000075    037 
      OCT 030500    040 
      OCT 065365    041 
      OCT 027664    042 
      OCT 060464    043 
      OCT 034565    044 
      OCT 071350    045 
      OCT 075103    046 
      OCT 064730    047 
      OCT 032744    050 
      OCT 067324    051 
      OCT 073204    052 
      OCT 062703    053 
      OCT 000166    054 
      OCT 000001    055 
      OCT 000067    056 
      OCT 004542    057 
      OCT 031524    060 
      OCT 066040    061 
      OCT 072020    062 
      OCT 061560    063 
      OCT 021410    064 
      OCT 022150    065 
      OCT 026130    066 
      OCT 027070    067 
      OCT 033404    070 
      OCT 070144    071 
      OCT 074210    072 
      OCT 063760    073 
      OCT 000220    074 
      OCT 000240    075 
      OCT 000270    076 
      OCT 000342    077 
      OCT 020002    100 
      OCT 057643    101 
      OCT 000223    102 
      OCT 025763    103 
      OCT 025213    104 
      OCT 050753    105 
      OCT 054733    106 
      OCT 044273    107 
      OCT 035207    110 
      OCT 046747    111 
      OCT 052741    112 
      OCT 042321    113 
      OCT 000261    114 
      OCT 000311    115 
      OCT 000251    116 
      OCT 000231    117 
      OCT 036371    120 
      OCT 045705    121 
      OCT 051645    122 
      OCT 041322    123 
      OCT 024662    124 
      OCT 000312    125 
      OCT 000252    126 
      OCT 000232    127 
      OCT 023772    130 
      OCT 047706    131 
      OCT 053646    132 
      OCT 043344    133 
      OCT 000142    134 
      OCT 004324    135 
      OCT 000243    136 
      OCT 000001    137 
      OCT 036566    140 
      OCT 045043    141 
      OCT 037423    142 
      OCT 040563    143 
      OCT 024013    144 
      OCT 051153    145 
      OCT 055133    146 
      OCT 044473    147 
      OCT 022407    150 
      OCT 047147    151 
      OCT 053141    152 
      OCT 042521    153 
      OCT 000061    154 
      OCT 000111    155 
      OCT 000051    156 
      OCT 004431    157 
      OCT 035571    160 
      OCT 046105    161 
      OCT 052045    162 
      OCT 041522    163 
      OCT 021062    164 
      OCT 020512    165 
      OCT 076052    166 
      OCT 000032    167 
      OCT 037172    170 
      OCT 050106    171 
      OCT 054046    172 
      OCT 043631    173 
      OCT 000366    174 
      OCT 000322    175 
      OCT 000262    176 
      OCT 000213    177 
* 
****************************************************
      HED TBG LOGIC 
* 
TBGEN NOP 
      STA TBGA      SAVE
      STB TBGB
      ERA 
      STA TBGE      REGISTERS.
      LDB NPORT     GET NR. OF PORTS. 
      CMB           MAKE -(NPORT+1).
      STB TBGCN     SAVE. 
      LDB TTY       B=> ?TNUM OF TTY00
TBG1  EQU * 
      STB TTYN
      ADB .+?STAT 
      STB TPONT     SAVE IT.
      LDA B,I       A= ?STAT
      AND PLDHE 
      SZA,RSS       SOMETHING GOING ON? 
      JMP TBG6      NO. 
      LDA B,I       YES. A= ?STAT 
      AND PDBT
      SZA           PDBT BIT SET? 
      JMP TBG2      YES.
      LDA B,I       NO. A= ?STAT
      AND ENBT
      SZA           ENBT BIT SET? 
      JMP TBG4      YES.
      JMP TBG3      NO. 
TBG5  EQU * 
      LDA B,I       NO. A= ?STAT
      AND HLTLD 
      SZA,RSS       LTBT OR LDBT OR HUBT BIT SET? 
      JMP TBG6      NO. 
TBG3  EQU * 
      LDA B,I       YES. A= ?STAT 
      AND HUBT
      SZA           HUBT BIT SET? 
      JMP TBG7      YES.
TBG14 EQU * 
      ADB .+?PHON-?STAT  NO. LTBT OR LDBT SET.
      ISZ B,I       BUMP TIMING COUNTER.
      JMP TBG6      NOT = 0 YET 
      ADB .+?STAT-?PHON  B=> ?STAT
      LDA B,I       A= ?STAT
      AND LTBT
      SZA           LTBT BIT SET? 
      JMP TBG15     YES. MUST BE LOG-ON TIMING OUT. 
* 
*                   NO. LDBT SET! 
* 
      LDA TTYN,I    A = TTY#
      IOR UHU       MERGE WITH OPCODE.
      JSB IOMTM,I   TELL OTHER MACHINE. 
      LDB TPONT     B=> ?STAT 
      LDA LDNBT     REMOVE LDBT 
      AND NIEBT     AND ENBT+ICBT BITS. 
      AND B,I 
      JSB TBG11 
      JMP TBG6
* 
* 
TBG2  EQU * 
      XOR B,I       REMOVE PDBT BIT.
      STA B,I 
      ADB .+?PPRM-?STAT  B=> ?PPRM
      LDA B,I       A= ?PPRM
      ELA,CLE,ERA   STOP SCANNING.
      JSB TBG10 
      LDB TTYN,I    B= ?TNUM
      BLF,SLB       1ST OR 2ND BOARD? 
      JMP *+3 
      LIA DSCB1     1ST. GET STATUS.
      RSS 
      LIA DSCB2     2ND. GET STATUS.
      AND .+3       ISOLATE STATUS BITS.
      IOR DTRON     TURN ON "DTR" AND "RQS".
      JSB TBG10 
      LDB TTYN
      ADB .+?RPRM 
      LDA B,I       A= ?RPRM
      LDB TTYN,I    B= ?TNUM
      JSB IMUXR,I   OUTPUT PARAMETER
      STF 0 
      JMP TBG6
* 
TBG4  EQU * 
      ADB .+?CCNT-?STAT  B=> ?CCNT
      LDA B,I 
      SZA,RSS       NR. OF OUTPUT CHARS.=0? 
      JMP TBG12     YES.
TBG13 EQU * 
      LDB TPONT     NO. B=> ?STAT 
      JMP TBG5
TBG12 EQU * 
      ADB .+?TIMO-?CCNT  B => ?TIMO 
      ISZ B,I       UPDATE TIMING COUNTER.
      JMP TBG13     NOT =0 YET! 
      LDB TPONT     TIME IS UP
      LDA B,I       REMOVE "ENTER 
      AND ENNBT       TIMING" BIT AND 
      IOR NIBT          SET "NO INPUT 
      STA B,I             ALLOWED" BIT
      ADB .+?TYPE-?STAT 
      LDA B,I       IF THE DUDE HAS 
      SZA,RSS         A SELECTRIC, SET
      JMP *+3           HIM UP FOR A
      IOR TRINT           TRANSMIT INTERRUPT
      STA B,I 
      ADB .+?RPRM-?TYPE 
      LDA B,I       TURN OFF THE
      AND NECHO       USER'S ECHO 
      LDB TTYN,I
      JSB IMUXR,I 
      LDA TTYN      DOES THIS USER
      CPA TLSUP       HAVE THE LP?
      CLB,RSS 
      JMP TBG8      NO
      STA LPTTY     YES - RESTORE LP AND CLEAR
      STB TLSUP       TEMPORARY LP SUSPENSION FLAG
TBG8  LDA TTYN,I    TELL THE SYSTEM 
      IOR ETO         THAT ENTER HAS
      JSB IOMTM,I       TIMED OUT 
      JMP TBG6
* 
TBG7  EQU * 
      ADB .+?CCNT-?STAT  B"> ?CCNT
      LDA B,I       A= ?CCNT
      SZA,RSS       NR. OF OUTPUT CHARS.=0? 
      JMP TBG9      YES.
      ADB .+?STAT-?CCNT  B=> ?STAT
      LDA B,I       A= ?STAT
      AND LTLDB 
      SZA           LTBT OR LDBT BIT SET? 
      JMP TBG14     YES.
      JMP TBG6      NO. 
* 
TBG9  EQU * 
      ADB .+?STAT-?CCNT  B=> ?STAT
TBG15 EQU * 
*  REMOVE LTBT,LDBT AND HUBT BITS.
      LDA HLTLD 
      CMA 
      AND B,I 
*  SET PDBT BIT.
      IOR PDBT
      JSB TBG11 
*  HANG PHONE UP. 
      ADB .+?PPRM-?SCNT   B=> ?PPRM 
      LDA B,I       A= ?PPRM
      AND .+3       ISOLATE STATUS BITS.
      IOR DTROF     TURN OFF "DTR" AND "RQS". 
      JSB TBG10 
* 
TBG6  EQU * 
      ISZ TBGCN     BUMP COUNTER. 
      RSS 
      JMP TBG16     DONE. GET OUT.
      LDB TTYN
      ADB .+TTY01-TTY00   NOT DONE YET. 
      JMP TBG1      GO BACK.
* 
*  EXIT.
* 
TBG16 EQU * 
      LDA TBGE      RESTORE 
      ELA 
      LDA TBGA
      LDB TBGB      REGISTERS.
      CLF TBASE     ENABLE NEXT INTERRUPT.
      JMP TBGEN,I   RETURN. 
      SPC 2 
* 
*  ENTER WITH A=PARAM.
*  EXIT WITH A= PARAM 
* 
TBG10 NOP 
      LDB TTYN,I    B = TTY#
      BLF,CLE,ERB 
      RBR 
      IOR B         MERGE UNIT NR.
      LDB TPONT     B=> ?STAT 
      ADB .+?PPRM-?STAT  B=> ?PPRM
      STA B,I       STORE.
      SEZ,RSS       SKIP IF SECOND BOARD         [B]
      OTA DSCB1     1ST, OUTPUT PARAMETER        [B]
      SEZ                                        [B]
      OTA DSCB2     2ND. OUTPUT PARAM.
      JMP TBG10,I   RETURN. 
* 
* 
* ENTER WITH NEW STATUS IN (A) AND
* B=> ?STAT 
* 
TBG11 NOP 
      IOR IOBT      SET IOBT BIT. 
      STA B,I       SET NEW STATUS. 
      ADB .+?TYPE-?STAT  B=> ?TYPE
      LDA B,I       A= ?TYPE
      SZA,RSS       TYPE 0? 
      JMP *+3       YES.
      CLA,INA       NO. RESET TO CALL/360.
      STA B,I 
      CLA 
      ADB .+?CCNT-?TYPE  B=> ?CCNT
      STA B,I       SET ?CCNT=0 
      ADB .+?DCNT-?CCNT 
      STA B,I       SET ?DCNT=0 
      INB 
      STA B,I       SET ?SCNT=0 
      JMP TBG11,I   RETURN. 
TBGED EQU * 
      HED INITIALIZATION SECTION
* 
INIF  EQU *         SYSTEM UPDATE ENTRY.
      LDA RCODE     GET INPUT.
      ALF,ALF 
      AND B37       EXTRACT (NR. OF PORTS-1). 
      STA NNPRT     SAVE IT.
      CLB           CLEAR 
INIF2 EQU * 
      CLC 0,C            MUX
      CLC 0,C 
      ISZ B                   BOARDS. 
      JMP INIF2 
      CPA NPORT     EQUAL TO ORIGINAL NR.?
      JMP INIFC     YES.
      CMA,INA       NO. NEGATE. 
      ADA NPORT 
      SSA,RSS       LESS THAN?
      JMP INIF1     YES.
      LDA NPORT     NO. GREATER THAN! 
      INA           INITIALIZE
      LDB NNPRT          EXCESS 
      JSB ISUBA               PORTS.
INIF1 EQU * 
      LDA NNPRT     DISABLE 
      CPA B37 
      JMP INIFC       REST
      INA 
      JSB ISUBB         OF PORTS. 
* 
INIFC EQU * 
      LDA .40 
      STA STEMP     SET COUNTER.
      LDB TTCC      B=> ?CCNT OF TTY00. 
INIFD EQU * 
      CLA 
      STA B,I       SE ?CCNT=0
      ADB .+?BGIN-?CCNT  B=> ?BGIN
      LDA B,I       A= ?BGIN
      ADB .+?BPNT-?BGIN  B=> ?BPNT
      STA B,I       SET ?BPNT=?BGIN 
      INB           B=> ?BSTR 
      STA B,I       SET ?BSTR=?BGIN 
      INB           B=> ?BHED 
      STA B,I       SET ?BHED=?BGIN 
      ADB .+?STAT-?BHED  B=> ?STAT
      LDA IOBT      SET STATUS TO INPUT 
      STA B,I 
      CLA 
      ADB .+?DCNT-?STAT  B=> ?DCNT
      STA B,I       SET ?DCNT=0 
      INB           B=> ?SCNT 
      STA B,I       SET ?SCNT=0 
      ADB .+TTY01-TTY00+?CCNT-?SCNT     MOVE TO NEXT
      ISZ STEMP     DONE? 
      JMP INIFD     NO. 
* 
* 
*                   START UP LOWER TTYS.
* 
      LDA NNPRT 
      ADA .-16
      LDB NNPRT 
      SSA,RSS       MORE THAN 16 PORTS? 
      LDB .+15      YES.
      CMB           NO. 
      STB STEMP     SET COUNTER.
      LDB TTRP      B=> ?RPRM OF TTY00. 
INFE1 EQU * 
      LDA B,I       A=> ?RPRM 
      INB           B=> ?SPRM 
      STB NTEMP     SAVE IT.
      ADB .+?TNUM-?SPRM  B=> ?TNUM
      LDB B,I       B= ?TNUM
      STB NPORT     SAVE IT                      [B]
      JSB IMUXR,I   OUTPUT PARAMETER             [B]
      LDA NTEMP,I   GET SEND PARAMETER           [B]
      LDB NPORT       AND THE UNIT #             [B]
      JSB IMUXR,I   OUTPUT THEM                  [B]
      LDB NTEMP     B=> ?SPRM 
      ADB .+?PPRM-?SPRM  B=> ?PPRM
      LDA B,I       A= ?PPRM
      OTA DSCB1     OUTPUT ?PPRM
      ADB .+TTY01-TTY00+?RPRM-?PPRM  MOVE TO NEXT.
      ISZ STEMP     DONE? 
      JMP INFE1     NO. GO BACK.
      LDA NNPRT 
      ADA .-16
      SSA           ONE OR TWO BOARDS?
      JMP INFE6     ONE.
*                   TWO. START UP UPPER TTYS. 
* 
      CMA 
      STA STEMP     SET COUNTER.
INFE3 EQU * 
      LDA B,I       A= ?RPRM
      INB           B=> ?SPRM 
      STB NTEMP     SAVE IT.
      ADB .+?TNUM-?SPRM  B=> ?TNUM
      LDB B,I       B= ?TNUM
      STB NPORT     SAVE IT                      [B]
      JSB IMUXR,I   OUTPUT PARAMETER             [B]
      LDA NTEMP,I   GET SEND PARAMETER           [B]
      LDB NPORT       AND THE UNIT #             [B]
      JSB IMUXR,I   OUTPUT THEM                  [B]
      LDB NTEMP     B=> ?SPRM 
      ADB .+?PPRM-?SPRM  B=> ?PPRM
      LDA B,I       A= ?PPRM
      OTA DSCB2     OUTPUT ?PPRM
      ADB .+TTY01-TTY00+?RPRM-?PPRM  MOVE TO NEXT.
      ISZ STEMP     DONE? 
      JMP INFE3     NO. GO BACK.
* 
* 
INFE6 EQU * 
      ISZ CKFLG     SET FLAG TO BE USED BY
      LDA NNPRT     SET NEW NR. OF TTYS.
      STA NPORT 
      ADA .-16      MORE THAN                    [B]
      SSA             16 PORTS?                  [B]
      JMP *+3       NO                           [B]
      STC MPY,C     YES, INITIALIZE 2ND          [B]
      STC DSCB2,C     MUX AND 2ND DSC BOARDS     [B]
      LDA .+3 
      OTA TBASE 
      STC TBASE,C   INITIALIZE TBG. 
      STC MPX,C     INITIALIZE 1ST MUX BOARD. 
      STC DSCB1,C   INITIALIZE 1ST DSC BOARD. 
      JSB LPCLR,I                                [B]
      JMP INI1
* 
* 
* 
INI   EQU *         SYSTEM GENERATION ENTRY.
      CLA           RESET FLAG TO BE USED 
      STA CKFLG     BY POWERFAIL ROUTINE. 
INI2  CLC 0,C       SOFTWARE CLEAR OF MUX        [B]
      CLC 0,C         BOARDS NECESSITATED        [B]
      ISZ A             BY HARDWARE ERROR        [B]
      JMP INI2
      LDB B37       SET NR. OF TTYS.
      STB NPORT 
      JSB ISUBA     INITIALIZE ALL 32 PROTS      [B]
      LDA M1200     SET PNONES TIMING 
      STA PHR       TO 120 SEC. 
INI1  EQU * 
      CLC C2        INITIALIZE
      STF C2        SEND CHANNEL. 
* 
      STC C1,C      INITIALIZE RECEIVE CHANNEL. 
* 
      STC 4,C       INITIALIZE POWER FAIL.
* 
      CLA                                        [B]
      STA XFLAG     INITIALIZE                   [B]
      STA YFLAG       MUX FLAGS                  [B]
      SPC 1 
* 
**    CONSTANTS 
* 
NTEMP BSS 1 
NNPRT BSS 1 
RPINT OCT 131202    INITIAL RECEIVE PARAMETER 
SPINT OCT 171202    INITIAL SEND PARAMETER
DTROF OCT 140314    DATA TERMINAL READY OFF 
DTRON OCT 140374    DATA TERMINAL READY ON
      SKP 
