*M*      TICROOT  ROOT SEGMENT OF TIC MODULE OF TP
         TITLE    'TIC - TICROOT'
*P*  NAME:        TICROOT
*P*  PURPOSE:     SERVES AS DRIVER SEGMENT FOR TERMINAL INTERFACE
*P*               CONTROLLER (TIC) OF TP.
*P*  DESCRIPTION: THIS MODULE CONTAINS ENTRY POINT OF START OF TIC
*P*               EXECUTION. IT ISSUES SEG LOAD CALS TO BRING IN
*P*               SEGMENTS AS THEY ARE NEEDED. TICROOT CONTAINS ALL
*P*               P.T. 0 CSECTS USED BY THE TIC IN ADDITION TO UTILITY
*P*               ROUTINES USED BY THE SPECIAL TIC PROCS (SEE TICPROCS)
*P*               AND DCBS.
*P*  REFERENCE:   CP-V TP REFERENCE MANUAL, 90 31 12
         PCC       0
*
*
*
         SYSTEM    SIG7                                                 TIC00010
         SYSTEM   TPPROCS
RD,RB0,RB1 M:PT   1                 PROTECT TYPE 1 FOR SYS BPM FPTS
:RD      EQU      RD
*
         DEF      RB0               TICROOT BPM PT 0 CSECT
         DEF      RB1               TICROOT BPM PT 1 CSECT
         DEF      RD,:RD            TICROOT DATA CSECT
         DEF      RP                TICROOT PROCEDURE CSECT
*
*  THE FOLLOWING REFS EXIST ONLY TO MOVE THE DEFS
*  TO THE ROOT REF/DEF STACK
*
*  THE IDEA IS TO GET DELTA-USEABLE SYMBOLS FOR CSECT
*  BASES OF OVERLAY MODULES INTO THE ROOT SYMBOL TABLE.
*
         REF      :IB0              TICINIT BPM PT 0 CSECT
         REF      :IB1              TICINIT BPM PT 1 CSECT
         REF      :ID               TICINIT DATA
         REF      :IP               TICINIT PROCEDURE
         REF      :KB0              TICKEYIN BPM PT 0 CSECT
         REF      :KB1              TICKEYIN BPM PT 1 CSECT
         REF      :KD               TICKEYIN DATA
         REF      :KP               TICKEYIN PROCEDURE
         REF      :LB0              TICLABOR BPM PT 0 CSECT
         REF      :LB1              TICLABOR BPM PT 1 CSECT
         REF      :LD               TICLABOR DATA CSECT
         REF      :LP               TICLABOR PROCEDURE CSECT
*
         DEF      IB0               TICINIT BPM PT 0 CSECT
         DEF      IB1               TICINIT BPM PT 1 CSECT
         DEF      ID                TICINIT DATA
         DEF      IP                TICINIT PROCEDURE
         DEF      KB0               TICKEYIN BPM PT 0 CSECT
         DEF      KB1               TICKEYIN BPM PT 1 CSECT
         DEF      KD                TICKEYIN DATA
         DEF      KP                TICKEYIN PROCEDURE
         DEF      LB0               TICLABOR BPM PT 0 CSECT
         DEF      LB1               TICLABOR BPM PT 1 CSECT
         DEF      LD                TICLABOR DATA CSECT
         DEF      LP                TICLABOR PROCEDURE CSECT
*
IB0      EQU      :IB0              TICINIT BPM PT 0 CSECT
IB1      EQU      :IB1              TICINIT BPM PT 1 CSECT
ID       EQU      :ID               TICINIT DATA
IP       EQU      :IP               TICINIT PROCEDURE
KB0      EQU      :KB0              TICKEYIN BPM PT 0 CSECT
KB1      EQU      :KB1              TICKEYIN BPM PT 1 CSECT
KD       EQU      :KD               TICKEYIN DATA
KP       EQU      :KP               TICKEYIN PROCEDURE
LB0      EQU      :LB0              TICLABOR BPM PT 0 CSECT
LB1      EQU      :LB1              TICLABOR BPM PT 1 CSECT
LD       EQU      :LD               TICLABOR DATA CSECT
LP       EQU      :LP               TICLABOR PROCEDURE CSECT
         SYSTEM   TICPROCS
*
         PAGE
         DEF      #TIC#INT          WHERE CONTROL IS TRANSFERRED IN
*,*  THE EVENT OF CONSOLE INTERRUPT OR ATTENTION CHARACTER ACTIVATION
         DEF      #TIC#WAIT#CHAIN   TIC'S WAIT CHAIN ENTRY (TWCE) IW
         REF      OPERATORPROMPT    ENTRY POINT IN TICKEYIN WHERE
*,*  CONTROL IS TRANSFERRED IF INTERRUPT WAS FROM CONSOLE
         DEF      ZEROANDNINE       CONSTANTS
         DEF      #TFDI#GRANULE#KEY#CHAIN  CHAIN-OF-KEYS HEAD FOR F:TFDX
         DEF      #STAI#GRANULE#KEY#CHAIN  CHAIN-OF-KEYS HEAD FOR F:STAX
         DEF      #DELI#GRANULE#KEY#CHAIN  CHAIN-OF-KEYS HEAD FOR F:DELX
         DEF      #BIGGEST#MDL#TASK TASK NO. OF THE BIGGEST MDL TASK WE
*,*               HAVE; A NEGATIVE NO.
         DEF      #DEV#RECORD#BA#IW  POINTER TO ARRAY TABLE OF
*,*  STORAGE POINTERS TO BUFFERS FOR DEVICE I/O
         DEF      #DEV#RECORD#LENGTH#IW  POINTER TO ARRAY TABLE
*,*  OF LENGTHS OF RECORDS IN THE BUFFERS POINTED TO BY #DEV#RECORD#BA
         DEF      #DEV#RECORD#STATUS#IW  POINTER TO ARRAY TABLE OF
*,*  STATUS BITS WHICH INDICATE ERRORS IN THE STATION'S DEVICE I/O
         DEF      #DEV#EVENT#PTR#IW  POINTER TO ARRAY TABLE OF POINTERS
*,*  TO ECBS--EACH POSSIBLY ONE A TASK IS WAITING ON
         DEF      #DEV#DCB#POINTER#IW  POINTER TO ARRAY TABLE WHICH
*,*  IDENTIFIES THE DCB ASSOCIATED WITH THE STATION OR LINE
         DEF      #DEV#CURRENT#IO#IW  POINTER TO ARRAY TABLE USED
*,*  TO KEEP TRACK OF THE CURRENT DEVICE I/O OF A STATION; ENTRIES IN
*,*  THE #DEV#CURRENT#IO TABLE CONTAIN BITS AS FOLLOWS:
*,*    BIT 25- ON IF THE I/O HAS BEEN COMPLETED (BUT NOT CHECKED);
*,*      SEE #CIO#COMP
*,*    BIT 26- ON IF THE I/O HAS BEEN INITIATED (BUT NOT CHECKED);
*,*      SEE #CIO#INIT
*,*    BIT 27- ON IF THE I/O HAS BEEN REQUESTED (BUT NOT INITIATED);
*,*      SEE #CIO#REQD
*,*    BIT 30- ON IF THE I/O IS A READ (OR WRITE-THEN-READ);
*,*      SEE #CIO#READ
*,*    BIT 31- ON IF THE I/O IS A WRITE (OR WRITE-THEN-READ);
*,*      SEE #CIO#WRITE
         DEF      #DEV#INPUT#TRL#IW  POINTER TO ARRAY TABLE OF
*,*  INTEGERS WHICH INDICATE THE MAXIMUM NO. OF (TEXT) CHARACTERS
*,*  THAT CAN BE RECEIVED FROM THE STATION OR LINE
         DEF      #DEV#OUTPUT#TRL#IW  POINTER TO ARRAY TABLE OF
*,*  INTEGERS WHICH INDICATE THE MAXIMUM NO. OF (TEXT) CHARACTERS
*,*  THAT SHOULD BE SENT TO A STATION OR LINE
         DEF      #MDL#WAKEUP#ECB#IW  POINTER TO ARRAY TABLE CONTAINING
*,*  AN ECB FOR EACH MDL-TASK; THIS TABLE ENTRY IS POSTED BY THE
*,*  TIC-I/O HANDLER MODULE
         DEF      #MDL#FIXED#BUFFERS#IW  POINTER TO ARRAY TABLE OF
*,*                                 UNDYNAMIC MDL BUFFERS
         DEF      #MDL#TASK#ORDER#IW POINTER TO ARRAY TABLE OF
*,*                                 MDL TRAMSMISSION SEQUENCING DATA
         DEF      #DEV#COMMAND#LINE#RECORD#BA#IW  POINTER TO ARRAY TABLE
*,*  OF DYNAMIC STORAGE POINTERS TO BUFFERS CONTAINING THE CURRENT
*,*  'COMMAND LINE'
         DEF      #DEV#COMMAND#LINE#RECORD#LENGTH#IW  POINTER TO ARRAY
*,*  TABLE OF LENGTHS OF CURRENT 'COMMAND LINES'
         DEF      #DEV#LINE#IDENTIFIER#IW  POINTER TO ARRAY TABLE
*,*  OF LINE IDENTIFICATION OF STATIONS;
*,*  FOR MDL-TASK (NEGATIVE LINE NO.) HOLDS LINE-ID (2ND FIELD OF
*,*               ACQUIRE/TABLE RECORDS)
*,*  FOR POINT-TO-POINT STATIONS HOLDS LINE-ID (2ND FIELD OF
*,*               ACQUIRE/TABLE RECORDS)
*,*  FOR STATIONS ON MULTIPOINT LINES HOLDS PHYSICAL ADDRESS OF THE
*,*               STATION (3RD FIELD OF ACQUIRE/TABLE RECORDS)
         DEF      #DEV#MULTIPOINT#INDEX#IW  POINTER TO ARRAY TABLE OF
*,*  M:LIST INDICES OF STATIONS OR LINES
         DEF      #DEV#LINE#STATUS#BITS#IW  POINTER TO ARRAY TABLE
*,*  OF BITS/FLAGS CONCERNING WHAT STATIONS ARE DOING; BITS IN THE
*,*  ENTRIES ARE DEFINED AS FOLLOWS:
*,*  #LINE#UNACQUIRED- SET IF THE LINE IS ONLY TABLED; BIT 31
*,*  #LINE#MESSAGED- SET IF THERE IS AN OUTSTANDING MESSAGE FOR THE
*,*                  STATION; BIT 30
*,*  #LINE#REGULATED- SET IF THE LINE HAS JUST BEEN REGULATED; BIT 29
*,*  #LINE#ATTENTION- SET WHEN AN ATTENTION IS RECEIVED; BIT 28
*,*  #LINE#AWAITING#ATTENTION- SET WHEN THE STATION IS DORMANT; BIT 27
*,*  #LINE#AWAITING#REPORT- SET WHEN THE STATION IS WAITING FOR A
*,*      REPORT DUE TO DMODE OUT OR DMODE ONE; BIT 26
*,*  #LINE#AWAITING#ACQUIRE- SET IF I/O ERROR TABLED THE LINE; BIT 25
*,*  #LINE#CANNOT#OUTPUT- SET IF OUTPUT-ONLY; BIT 24
*,*  #LINE#CANNOT#INPUT- SET IF OUTPUT ONLY; BIT 23
*,*  #LINE#REESTABLISH- SET IF RE-SETUP (MDL) LINE; BIT 22
         DEF      #LINE#CANNOT#OUTPUT  SEE #DEV#LINE#STATUS#BITS
         DEF      #LINE#CANNOT#INPUT   SEE #DEV#LINE#STATUS#BITS
         DEF      #LINE#REGULATED   SEE #DEV#LINE#STATUS#BITS
         DEF      #LINE#ATTENTION   SEE #DEV#LINE#STATUS#BITS
         DEF      #LINE#AWAITING#ATTENTION  SEE #DEV#LINE#STATUS#BITS
         DEF      #DEV#TYPE#INDEX#IW  POINTER TO ARRAY TABLE IN WHICH THE
*,*  VARIOUS TYPES OF TERMINALS SUPPORTED BY THE TIC ARE GIVEN
*,*  NUMBERS BEGINNING WITH 2.  1 IS RESERVED FOR AN INSTALLATION'S
*,*                                 TERMINAL TYPES(S).
*,*                             0 MEANS 'NOT YET ASSIGNED A TYPE
*,*                                 NUMBER'.
*,*                   CURRENTLY 2 = UNIT RECORD
*,*                             3 = TTY
*,*                             4 = 3270
         DEF      #DEV#TYPE#INDEX#UNIT#RECORD  VALUE GIVEN TO UNIT
*,*  RECORD DEVICES IN #DEV#TYPE#INDEX TABLE; =2
         DEF      #DEV#REGULATION#IW  POINTER TO ARRAY TABLE WHICH
*,*  HOLDS BITS INDICATING WHAT FUNCTIONS OF THE STATION HAVE BEEN
*,*  REGULATED OFF BY THE OPERATOR; BITS ARE DEFINED AS FOLLOWS:
*,*               #REGULATE#QUESTION ON FOR ?-REGULATION
*,*               #REGULATE#AT ON FOR @-REGULATION
*,*               #REGULATE#CRUNCH ON FOR #-REGULATION
         DEF      #DEV#STATION#TYPE#IW  POINTER TO ARRAY TABLE WHICH
*,*  HOLDS THE 2-CHARACTER STATION TYPES
         DO       HOWMANYXMITSBREAK>1
         DEF      #DEV#XMIT#COUNT#IW  POINTER TO ARRAY TABLE WHICH
*,*  HOLDS THE XMIT/BREAK COUNT; BUILT ONLY WHEN HOWMANYXMITSBREAK>1
         FIN
         DEF      #DEV#ECB#IW       POINTER TO ARRAY TABLE WHICH
*,*                                 HOLDS POSSIBLE ECBS
         DEF      #DCB#TABLE#IW  POINTER TO TABLE OF DCB ADDRESSES
*,*  BUILT IN DYNAMIC SPACE BY INITIALIZATION; POINTS TO WA
*,*  OF ZERO'TH ENTRY AND TABLE IS OF FORMAT:
*,*
*,*                   WA OF DCB OF 2ND MULTIPOINT LINE
*,*                   WA OF DCB OF 1ST MULTIPOINT LINE
*,*  ZERO'TH ENTRY-->              UNUSED
*,*                   WA OF DCB OF A POINT-TO-POINT LINE
*,*                   WA OF DCB OF A POINT-TO-POINT LINE
*,*                   WA OF DCB OF A POINT-TO-POINT LINE
*,*                                 ETC.
         DEF      ECBLISTMAXSIZE    LENGTH OF WHERE TO BUILD ECB LIST
         DEF      ECBLISTWA         LOCATION OF WHERE TO BUILD ECB LIST
         DEF      #BIGGEST#TIC#TASK CONSTANT TO CONTROL DO-LOOPS THROUGH
*,*                                 #DEV TABLES
         DO       DO#CHECKOUT
         DEF      #TS#TEST          FLAG; 0=SPECIAL ON-LINE CHECKOUT
         FIN
         DEF      TICINTREPLY       STORAGE AREA USED FOR HOLDING
*,*                                 OPERATOR'S REPLY TO M:KEYIN CAL
         DEF      #CURRENT#PROCESS#DEV  CONTAINS TIC-TASK NO. OF TASK
*,*                                 THAT IS CURRENTLY RUNNING
         DEF      ABORTCOUNT        HOLDS COUNT OF NO. OF #ABORTS ALLOWED
*,*  MINUS NO. OF #ABORTS THAT HAVE OCCURRED
         DEF      #MESSAGE#CHAIN    CHAIN OF PENDING MESSAGES
         DEF      TICINTOPERATORLATER  FLAG TO INDICATE WHETHER OPERATOR
*,*  OR ATTN KEYINS ARE ALLOWED;  1=LATER,  0=ALLOWED
         DEF      SEG#              SEG; 0=PATCH; 1=ROOT; 2=INIT;
*,*                                 3=KEYIN; 4=LABOR
         DEF      #NET#ECB          EVENT CONTROL BLOCK USED TO CONTROL
*,*                                 ALL TIC DEVICE I/O
         DEF      #X#ED             FLAG TO SHOW IF TIC HAS BEEN X'ED
*,*  (I.E., SHUT DOWN) BY THE OPERATOR; 1 MEANS X'ED
         DEF      INITTFDNEXTBUF4WA  POINTER INTO INITBUF4
         DEF      INITTFDNTH        COUNT OF F:TFDX FILE RECORDS READ
         DEF      INITTFDTFDFWA     WA OF TFD RECORD
         DEF      INITTFDPRIMFWA    WA OF 1ST WD OF CURRENT PRIMITIVE
         DEF      #CIO#REQD         BIT 27 OF #DEV#CURRENT#IO TABLE
*,*  ENTRY; ON IF THE I/O HAS BEEN REQUESTED (BUT NOT INITIATED)
         DEF      #CIO#READ         BIT 30 OF #DEV#CURRENT#IO TABLE
*,*  ENTRY; ON IF THE I/O IS A READ (OR WRITE-THEN-READ)
         DEF      #CIO#COMP         BIT 25 OF #DEV#CURRENT#IO TABLE
*,*  ENTRY; ON IF THE I/O IS A WRITE (OR WRITE-THEN-READ)
         DEF      #LINE#REESTABLISH  BIT 22 OF #DEV#LINE#STATUS#BITS
*,*  ENTRY; SET IF RE-SETUP (MDL LINE)
         DEF      #TIMESUP#ECB      EVENT CONTROL BLOCK USED BY THE
*,*  DISPATCHER TO AWAKEN INDEFINITE WAITERS
         REF      #MDLADR           ENTRY POINT IN TICLABOR FOR
*,*  MULTIPOINT LINE TASK AFTER M:SEGLD HAS BEEN ISSUED
*,*                                 ROUTINE
         DEF      #INFOBLOCK#TFDI   POINTER TO HEAD OF KEY CHAIN FOR
*,*  INTERNAL VERSION OF TFD FILE
         DEF      GATEOBTAININTERNALCOUNT  FLAG TO SHOW WHETHER THE
*,*  OBTAININTERNALFILERECORD ROUTINE IS IN USE;  1=IN USE
         DEF      GATEOBTAININTERNALECB  ECB USED TO INDICATE THAT A
*,*  RECORD HAS BEEN READ FROM AN INTERNAL FILE
         DEF      #INFOBLOCK#DELI   POINTER TO HEAD OF KEY CHAIN FOR
*,*  INTERNAL VERSION OF DELIVERIES FILE
         DEF      #INFOBLOCK#STAI   POINTER TO HEAD OF KEY CHAIN FOR
*,*  INTERNAL VERSION OF STATION NAMES FILE
         DEF      #DEV#LOGON#BLOCK#IW  POINTER TO #DEV#LOGON#BLOCK TABLE
*,*  WHICH HOLDS THE FOLLOWING STRUCTURE-TYPE TABLE ENTRIES FOR A
*,*  LOGGED ON STATION:
*,*    #DEV#DMODE, BYTE 0 OF #DEV#LOGON#BLOCK, HOLDS BITS WHICH DEFINE
*,*      THE STATION'S CURRENT DMODE; BITS IN THE ENTRY ARE DEFINED
*,*      AS FOLLOWS:  DMODE@IN, BIT 0, ON IF DMODE=IN
*,*                   DMODE@OUT, BIT 1, ON IN DMODE=OUT
*,*                   DMODE@ALT, BIT 2, ON IF DMODE=ALT
*,*                   DMODE@ONE, BIT 3, ON IF DMODE=ONE
*,*    #DEV#DOING, BYTE 1 OF #DEV#LOGON#BLOCK, HOLDS AN INTEGER WHICH
*,*      DEFINES WHAT THE STATION'S CURRENT ACTIVITY IS; ACTIVITIES
*,*      HAVE BEEN DEFINED AS FOLLOWS:  ENTRY   MEANS
*,*                                       0     IDLE
*,*                                       1     DORMANT
*,*                                       2     WAITING
*,*                                       3     TRANSACTION INPUTTING
*,*                                       4     REPORT DELIVERY
*,*                                       5     COMMAND LEVEL
*,*    #DEV#GET#LIST#ID, BYTES 2-3 OF #DEV#LOGON#BLOCK, HOLDS THE
*,*      SQM'S IDENTIFIER OF THE GET-LIST THAT DEFINES THE REPORTS
*,*      THAT ARE DELIVERABLE TO THE STATION; CONTAINS THE INTEGER
*,*      LIST-ID OR CONTAINS ZERO IF THERE IS NO LIST
*,*    #DEV#USING#TFD, BYTES 4-7 OF #DEV#LOGON#BLOCK, POINTS TO THE
*,*      IN-CORE TFD CURRENTLY BEING USED TO PROCESS THE STATION'S
*,*      REPORT OR TRANSACTION
*,*    #DEV#GET#LIST#LENGTH, BYTES 12-15 OF #DEV#LOGON#BLOCK, HOLDS A
*,*      COUNT OF THE NUMBER OF CRITERIA IN THE STATION'S GET LIST
*,*    #DEV#DOLLARS#LAL, BYTES 16-19 OF #DEV#LOGON#BLOCK, POINTS TO THE
*,*      %-TYPE RESTRICTIONS THAT WERE DEFINED BY THE STATION'S STATION
*,*      NAMES RECORD; 1ST BYTE CONTAINS THE NO. OF %-TYPE RESTRICTIONS;
*,*      THE REST OF THE ITEM CONTAINS THE WORD ADDR OF A BLOCK OF
*,*      3-WORD RESTRICTIONS
*,*    #DEV#QUESTIONS#LAL, BYTES 20-23 OF #DEV#LOGON#BLOCK, POINTS
*,*      TO THE ?-TYPE RESTRICTIONS THAT WERE DEFINED BY THE STATION'S
*,*      STATION NAMES RECORD; 1ST BYTE CONTAINS THE NO. OF ?-TYPE
*,*      RESTRICTIONS; THE REST OF THE ITEM CONTAINS THE WORD ADDR OF A
*,*      BLOCK OF 3-WORD RESTRICTIONS
*,*    #DEV#AT#NAME#LAL, BYTES 24-27 OF #DEV#LOGON#BLOCK, POINTS TO
*,*      THE STATION'S ORIGINATING STATION NAME; CONTAINS LENGTH
*,*      (BYTE 0) & BA (BYTES 1-3) OF A STRING '@NAME'; ZERO BYTE
*,*      FOLLOWS THE STRING; FORMAT IS SUITABLE FOR A SQM GET-LIST
*,*    #DEV#CRUNCH#NAME#LALS, BYTES 28-31 OF #DEV#LOGON#BLOCK; THIS
*,*      WD & SUCCESSIVE WDS HOLD THE STATION'S CRITERIA OBTAINED
*,*      FROM THE DELIVERIES FILE
         DEF      #DOING#ACCEPT     VALUE OF 3 IN #DEV#DOING ENTRY
         DEF      #DOING#REPORT     VALUE OF 4 IN #DEV#DOING ENTRY
         REF      #TIC#INITIALIZE   ENTRY POINT FOR INITIALIZATION
         DEF      MBS678CODE        ENTRY POINT USED BY MBS678 PROC
         DEF      SIGNALATTENTIONCODE  ENTRY POINT USED BY
*,*                                 SIGNALATTENTION PROC
         DO       DO#CHECKOUT
         DEF      #SNAP#CODE        ENTRY POINT USED BY #SNAP PROC
         FIN
         DEF      #TYPE89#CODE      ENTRY POINT USED BY #TYPE89 PROC
         DEF      #GET#MAIN#BYTES#CODE  ENTRY POINT USED BY
*,*                                 #GET#MAIN#BYTES#CODE
         DEF      #FREE#DEV#BUFFER#CODE  ENTRY POINT USED BY
*,*                                 #FREE#DEV#BUFFER PROC
         DEF      #INITIATE#READ#CODE  ENTRY POINT USED BY
*,*                                 #INITIATE#READ PROC
         DEF      #INITIATE#WRITE#CODE  ENTRY POINT USED BY
*,*                                 #INITIATE#WRITE PROC
         DEF      #INITIATE#WRITE#READ#CODE  ENTRY POINT USED BY
*,*                                 #INITIATE#WRITE#READ PROC
         DEF      #CHECK#CODE       ENTRY POINT USED BY #CHECK PROC
         DEF      #WAIT#ON#CODE     ENTRY POINT USED BY #WAIT#ON PROC
         DEF      #GO#TO#ON#CODE    ENTRY POINT USED BY #GO#TO#ON PROC
         DEF      #EXIT#CODE        ENTRY POINT USED BY #EXIT PROC
         REF      #BEGIN            ENTRY POINT IN TICLABOR
         DEF      #TIC#BEGIN        ENTRY POINT USED BY TICINIT
         DEF      #DEV#TYPE#INDEX#BIGGEST  CONSTANT; MAX. TERMINAL NO.
         DEF      #GET#MAIN#WORDS#SPECIAL#CODE#CLEAR  ENTRY POINT;
*,*                                 SEE #ENTRY#SPACE#CLEAR PROC
         DEF      #FREE#MAIN#WORDS#SPECIAL#CODE   ENTRY POINT;
*,*                                 SEE #EXIT#SPACE PROC
         DEF      #GET#MAIN#WORDS#SPECIAL#CODE  ENTRY POINT;
*,*                                 SEE #ENTRY#SPACE PROC
         DEF      FOURWORDSFORMTIME  4-WD BLOCK FOR M:TIME CAL
         DEF      TICINTECB         WORD; ECB STORAGE FOR M:KEYIN
*,*                                 IN TICKEYIN
         DEF      PATCH             256 WD BLOCK FOR PATCHES
         DEF      #TIC#STACK        TEMP STACK USED BY #PUSH & #PULL
*                                                                       TIC00120
*                                                                       TIC00130
*                                                                       TIC00140
         REF       M:SI                                                 TIC00150
         REF      M:DO
*                                                                       TIC00160
         SREF      M:EI,M:EO
*                                                                       TIC00200
         SREF      F:3000,F:3001,F:3002,F:3003,F:3004
         SREF      F:3005,F:3006,F:3007,F:3008,F:3009
         SREF      F:3010,F:3011,F:3012,F:3013,F:3014
         SREF      F:3015,F:3016,F:3017,F:3018,F:3019
         SREF      F:3020,F:3021,F:3022,F:3023,F:3024
         SREF      F:3025,F:3026,F:3027,F:3028,F:3029
*                                                                       TIC00310
         SREF      F:4000,F:4001,F:4002,F:4003,F:4004
         SREF      F:4005,F:4006,F:4007,F:4008,F:4009
*                                                                       TIC00420
         DEF      #DCB#SREFS
         DEF      #DCB#SREFS#WLIST
*
         REF       #FIND#DWS,#HIDE#DWS                                  TIC00170
*
         SREF      O:LOGONPASSWORDPROMPT
         SREF      O:COMMANDLEVELPROMPT
         SREF      O:LOGONNAMEPROMPT
         SREF      O:SETOUTPUTFIELD
*
         SREF      T:MYPRIM
         SREF      T:LOGON                                              TIC00190
         DEF      #LINE#UNACQUIRED  SEE #DEV#LINE#STATUS#BITS
         DEF      COCLINEABN        ABNORMAL I/O RETURN FOR CXXX LINES
         DEF      COCLINEERR        I/O ERROR RETURN FOR CXXX LINES
         DEF      FIELD6789POINTTOSTRINGCODE  ENTRY POINT USED WITH
*,*                                 FIELD6789POINTTOSTTRING PROC
         DEF      FIELD6789LOADAAAACODE  ENTRY POINT USED WITH
*,*                                 FIELD6789LOADAAAA PROC
         DEF      FIELD6789LOADAAAAAAAACODE  ENTRY POINT USED WITH
*,*                                 FIELD6789LOADAAAAAAAA PROC
         DEF      INITDELNTH        COUNT OF F:DELX RECORDS
         DEF      INITGRANULE       CURRENT TIC GRANULE NO.
         DEF      INITCOUNTING      FLAG; >0 IF COUNTING GRANULES
         DEF      INITSTANTH        COUNT OF F:STAX RECORDS
         DEF      MOCLINEABN        ABNORMAL I/O RETURN FOR MXXX STATIONS
         DEF      MOCLINEERR        I/O ERROR RETURN FOR MXXX STATIONS
         DEF      #INIT#PRE#SECTION  FIND/HIDE SPACE FOR INITIALIZATION
         DEF      #FREE#MAIN#BYTES#CODE  ENTRY POINT USED BY
*,*                                 #FREE#MAIN#BYTES PROC
         DEF      #FREE#MAIN#BYTES#IF#CODE  ENTRY POINT USED BY
*,*                                 #FREE#MAIN#BYTES#IF PROC
         DEF      #LINE#AWAITING#ACQUIRE  SEE #DEV#LINE#STATUS#BITS
         DEF      #LINE#AWAITING#REPORT  SEE #DEV#LINE#STATUS#BITS
         DEF      #REGULATE#AT      BIT 6 OF 1-BYTE #DEV#REGULATION
*,*  ENTRY; ON FOR @-REGULATION
         DEF      #REGULATE#QUESTION  BIT 7 OF 1-BYTE #DEV#REGULATION
*,*  ENTRY; ON FOR ?-REGULATION
         DEF      #REGULATE#CRUNCH    BIT 5 OF 1-BYTE #DEV#REGULATION
*,*  ENTRY; ON FOR #-REGULATION
         DEF      HEXTABLE          CONSTANT
         DEF      TCQCC1            TEXTC 'CC1 SET AFTER M:QUEUE CALL'
         DEF      #CIO#WRITE    BIT 7 OF 1-BYTE #DEV#CURRENT#IO ENTRY
         DEF      #WAIT#ON#DEVICE#CODE  ENTRY POINT USED BY
*,*                                 #WAIT#ON#DEVICE PROC
         DEF      ABORTCODE         ENTRY POINT USED BY #ABORT PROC
         DO1      DO#DEV#RECORD#BA#PUT#CHECK
         DEF      LOST#BUF          ENTRY WHEN #DEV#RECORD#BA OVERLAYED
         DEF      SIGNALATTENTIONCODECFTWO  ENTRY POINT USED BY
*,*                                 IFATTENTION PROC
         DEF      SGLDTRTN          ENTRY POINT WHERE EXECUTION IS RESUMED
*,*  FOLLOWING THE SERVICING OF AN OPERATOR COMMAND.
         DO       DO#3270
         DEF      #DEV#PLATEN#R#IW  POINTER TO ARRAY TABLE OF MAX ROWS
         DEF      #DEV#PLATEN#C#IW  POINTER TO ARRAY TABLE TO MAX COLS
         DEF      #DEV#TC#RETRY#IW  POINTER TO ARRAY TABLE OF RETRY
*,*  COUNTS FOR 3275 STATIONS;  INCREMENTED WHEN ERROR CODE X'3270'
*,*  HAS STATUS BYTES SHOWING TC/BCC (TRANSMISSION CHECK) BIT ON;
*,*  MAX COUNT=5 BEFORE FREEING STATION.
         FIN
         DEF      #DEV#MDL#RETRY#IW  POINTER TO ARRAY TABLE OF RETRY
*,*  COUNTS FOR STATIONS ON MULTI-POINT LINES;  MAX COUNT=3 BEFORE FREEING
*,*  THE MDL STATION
         PAGE
*        SPECIAL ERROR CODES WHICH ARE DEFINED INTERNALLY WITHIN
*        THE VARIOUS TIC MODULES (PRIMARILY TICROOT & TICLABOR) AND
*        USED TO DENOTE I/O RELATED ERROR CONDITIONS.
         SPACE    5
*  X'1FF'  ...  DCB NOT OPEN     ==>   FOR 3270'S THIS IMPLIES THAT
*                                      EITHER THE STATION HAS NOT BEEN
*                                      ACQUIRED OR IT HAS BEEN KNOCKED
*                                      OFF-LINE, FOR EXAMPLE; DUE TO
*                                      I/O ERRORS.
         SPACE    2
*  X'3FF'  ...  TIC X'ED         ==>   OPERATOR ABORTED THE TIC.
         SPACE    2
*  X'5FF'  ...  STATION DROPPED  ==>   STATION HAS JUST BEEN DROPPED DUE
*                                      FOR EXAMPLE; TO EXCESSIVE LINE
*                                      ERRORS.
         SPACE    2
*  X'7FF'  ... 3270 ERROR        ==>   SENSE STATUS FOUND TO BE X'40C1'
         PAGE                                                           TIC00530
*        REGISTER UTILIZATION BY THE TIC                                TIC00540
*                                                                       TIC00550
*        THE TIC-EXECUTIVE 'OWNS' THREE REGISTERS, NAMELY               TIC00560
*        REGISTERS ONE, TWO, AND THREE.  THEY ARE EQU'ED BELOW.         TIC00570
*                                                                       TIC00580
*        TIC-TASKS SHOULD NOT USE THESE REGISTERS.                      TIC00590
*                                                                       TIC00600
*        REGISTER '#DEV' CONTAINS THE LOGICAL DEVICE NUMBER             TIC00610
*        THAT THE TIC-TASK IS WORKING ON.  SEVERAL PROCEDURES           TIC00620
*        (E.G. #T#GET) ASSUME THAT IT IS CORRECT!                       TIC00630
*                                                                       TIC00640
#DEV     EQU       1                                                    TIC00650
#ERR     EQU       2                   HOLDS STATUS ON #CHECK RETURN    TIC00660
#ARG     EQU       2                   ARGUMENT TO PROC REGISTER        TIC00670
#BAL     EQU       3                   REGISTER WE BAL ON INTO TIC EXEC TIC00680
#OWN     EQU       4                   REG THAT POINTS TO SUB LOCAL STORTIC00690
         PAGE                                                           TIC00700
*        TIC TABLE NAMES ARE DEFINED WITH LISTS FOR                     TIC00710
*        FLEXIBLIITY.  FOR NOW, THE LIST CONSISTS OF THE                TIC00720
*        ADDRESS OF THE INDIRECT WORD THAT POINTS TO THE                TIC00730
*        TABLE AND THE LENGTH OF A TABLE ENTRY IN BYTES.                TIC00740
*                                                                       TIC00750
#DEV#RECORD#BA SET #DEV#RECORD#BA#IW,4                                  TIC00760
#DEV#RECORD#LENGTH SET #DEV#RECORD#LENGTH#IW,4                          TIC00780
#DEV#RECORD#STATUS SET #DEV#RECORD#STATUS#IW,4                          TIC00800
#DEV#EVENT#PTR SET #DEV#EVENT#PTR#IW,4                                  TIC00810
*                                                                       TIC00830
#DEV#DCB#POINTER SET #DEV#DCB#POINTER#IW,2                              TIC00840
#DEV#CURRENT#IO SET #DEV#CURRENT#IO#IW,1                                TIC00850
#DEV#INPUT#TRL SET #DEV#INPUT#TRL#IW,2                                  TIC00860
#DEV#OUTPUT#TRL SET #DEV#OUTPUT#TRL#IW,2                                TIC00870
#DEV#MDL#RETRY SET #DEV#MDL#RETRY#IW,1
*                                                                       TIC00880
#MDL#WAKEUP#ECB              SET       #MDL#WAKEUP#ECB#IW,8             TIC00890
         DO        DO#FIXEDMDLBUFFERS
#MDL#FIXED#BUFFERS SET #MDL#FIXED#BUFFERS#IW,4
         FIN
*
#MDL#TASK#ORDER SET #MDL#TASK#ORDER#IW,4
*                                                                       TIC00910
#DEV#COMMAND#LINE#RECORD#BA SET #DEV#COMMAND#LINE#RECORD#BA#IW,4        TIC00920
#DEV#COMMAND#LINE#RECORD#LENGTH SET #DEV#COMMAND#LINE#RECORD#LENGTH#IW,2TIC00930
*                                                                       TIC00940
#DEV#LINE#IDENTIFIER         SET       #DEV#LINE#IDENTIFIER#IW,4        TIC00950
#DEV#MULTIPOINT#INDEX        SET       #DEV#MULTIPOINT#INDEX#IW,1       TIC00960
#DEV#LINE#STATUS#BITS        SET       #DEV#LINE#STATUS#BITS#IW,2
#DEV#REGULATION    SET #DEV#REGULATION#IW,1                             TIC00980
*
#DEV#TYPE#INDEX    SET       #DEV#TYPE#INDEX#IW,1
*                                                                       TIC00990
#DEV#STATION#TYPE SET #DEV#STATION#TYPE#IW,2                            TIC01000
*                                                                       TIC01010
         DO       DO#3270
#DEV#PLATEN#R  SET  #DEV#PLATEN#R#IW,1
#DEV#PLATEN#C  SET  #DEV#PLATEN#C#IW,1
#DEV#TC#RETRY  SET #DEV#TC#RETRY#IW,1
         FIN
         DO        HOWMANYXMITSBREAK>1
#DEV#XMIT#COUNT    SET       #DEV#XMIT#COUNT#IW,1
         FIN
*
#DEV#ECB SET        #DEV#ECB#IW,8                                       TIC01020
*                                                                       TIC01021
*                                                                       TIC01022
*                                                                       TIC01023
#DCB#TABLE                   SET       #DCB#TABLE#IW,4                  TIC01024
*                                                                       TIC01030
*                                                                       TIC01040
*                                                                       TIC01050
#DEV#LOGON#BLOCK SET #DEV#LOGON#BLOCK#IW,4,0                            TIC01060
*                                                                       TIC01070
*        THE FOLLOWING FIELDS ARE IN THE BLOCK                          TIC01080
*        POINTED TO BY THE ABOVE.                                       TIC01090
*                                                                       TIC01100
#DEV#GET#LIST#LENGTH SET #DEV#LOGON#BLOCK#IW,4,3,4                      TIC01110
#DEV#DMODE         SET #DEV#LOGON#BLOCK#IW,4,0,1                        TIC01120
#DEV#USING#TFD     SET #DEV#LOGON#BLOCK#IW,4,1,4                        TIC01130
#DEV#DOING         SET #DEV#LOGON#BLOCK#IW,4,1,1                        TIC01140
#DEV#GET#LIST#ID   SET #DEV#LOGON#BLOCK#IW,4,1,2                        TIC01150
#DEV#DOLLARS#LAL   SET #DEV#LOGON#BLOCK#IW,4,4,4                        TIC01160
#DEV#QUESTIONS#LAL SET #DEV#LOGON#BLOCK#IW,4,5,4                        TIC01170
#DEV#AT#NAME#LAL     SET #DEV#LOGON#BLOCK#IW,4,6,4                      TIC01180
#DEV#CRUNCH#NAME#LALS SET #DEV#LOGON#BLOCK#IW,4,7,4                     TIC01190
         PAGE
         USECT    RD                GO TO TICROOT DATA CSECT
#DCB#SREFS RES     0                                                    TIC87940
         GEN,32    F:3000                                               TIC87950
         GEN,32    F:3001                                               TIC87960
         GEN,32    F:3002                                               TIC87970
         GEN,32    F:3003                                               TIC87980
         GEN,32    F:3004                                               TIC87990
         GEN,32    F:3005                                               TIC88000
         GEN,32    F:3006                                               TIC88010
         GEN,32    F:3007                                               TIC88020
         GEN,32    F:3008                                               TIC88030
         GEN,32    F:3009                                               TIC88040
         GEN,32    F:3010
         GEN,32    F:3011
         GEN,32    F:3012
         GEN,32    F:3013
         GEN,32    F:3014
         GEN,32    F:3015
         GEN,32    F:3016
         GEN,32    F:3017
         GEN,32    F:3018
         GEN,32    F:3019
         GEN,32    F:3020
         GEN,32    F:3021
         GEN,32    F:3022
         GEN,32    F:3023
         GEN,32    F:3024
         GEN,32    F:3025
         GEN,32    F:3026
         GEN,32    F:3027
         GEN,32    F:3028
         GEN,32    F:3029
         GEN,32    -1                  SIGNIFIES TABLE END.             TIC88050
*        DCBS WITH LISTS ATTAAHED:
#DCB#SREFS#WLIST RES 0
         GEN,32    F:4000
         GEN,32    F:4001
         GEN,32    F:4002
         GEN,32    F:4003
         GEN,32    F:4004
         GEN,32    F:4005
         GEN,32    F:4006
         GEN,32    F:4007
         GEN,32    F:4008
         GEN,32    F:4009
         GEN,32    -1                                                   TIC88180
#TYPE89#BUFFER  RES  18
INITCOUNTING DATA  1                   >0 IF COUNTING GRANULES.
INITGRANULE DATA   0                   CURRENT TICI GRANULE NUMBER.
INITTFDNTH DATA    0                                                    TIC88260
INITTFDTFDFWA DATA 0                                                    TIC88290
INITTFDPRIMFWA DATA 0                  WA OF FIRST WORD OF CURRENT PRIM.
INITTFDNEXTBUF4WA DATA -1              WILL POINT INTO INITBUF4.
*                                                                       TIC88300
INITSTANTH DATA    0                                                    TIC88310
*                                                                       TIC88330
INITDELNTH DATA    0                                                    TIC88340
*                                                                       TIC88370
INTREENT DATA     -1                M:INT RE-ENTRANCY FLAG
TICINTOPERATORLATER DATA 1             1 = LATER   0 = ALLOWED.
SEG#     DATA     0                 SEG; 0=PATCH; 1=ROOT; 2=INIT;
*                                   3=KEYIN; 4=LABOR
ABORTCOUNT GEN,32  TICABORTCOUNT                                        TIC24980
TICINTREPLY RES    20
TICINTECB RES     1
FOURWORDSFORMTIME RES 4
         BOUND    8
#INIT#PRE#SECTION RES 100              DEFINE FINE/HIDE SPACE FOR INIT.
PRINTCODESTAR ;
         TEXTC    '                     IN TIC AT          +          '
         DO       DO#CHECKOUT
PRINTCODEARRAY RES 0
         GEN,8,24 95,'*  '
         RES      24                NOTE WORD OF BLANKS IS PLACED
*                                   INTO WORD 24 OF THIS RES
*                                   AND THEN NOT PRINTED
         FIN
PATCH    EQU      %                 256 WORDS OF ZEROED PATCH SPACE
         LIST     0
         DO1      128
         DATA     ,
         LIST     1
         TITLE     'TIC - TABLES'
*
*        THE TIC-STACK IS DEFINED HERE.  IT IS USED                     TIC17520
*        BY MEANS OF THE #PUSH AND #PULL PROCEDURES.                    TIC17530
*        NOTE THAT A TIC-TASK CANNOT HAVE ENTRIES IN THE                TIC17540
*        STACK WHEN IT DOES AN #EXIT, EITHER EXPLICIT                   TIC17550
*        OR IMPLICIT (AS IN #CHECK).                                    TIC17560
*                                                                       TIC17570
         BOUND     8                                                    TIC17580
#TIC#STACK RES     0                                                    TIC17590
         GEN,32    #TIC#STACK#RES
#TIC#STACK#SIZE SET 100             SIZE OF TIC'S STACK
         GEN,16,16 #TIC#STACK#SIZE,0 2ND WORD OF SPD
#TIC#STACK#RES RES #TIC#STACK#SIZE  STACK AREA
         PAGE                                                           TIC17630
*        THE TIC WAIT-CHAIN IS THE CHAIN THAT ALL TIC-TASKS THAT        TIC17640
*        ARE (OR WERE SHORTLY AGO) WAITING FOR SOMETHING                TIC17650
*        TO HAPPEN FIND THEMSELVES.  WHENEVER A TIC-TASK                TIC17660
*        GIVES UP THE CPU (BY DOING AN #EXIT), THIS                     TIC17670
*        CHAIN IS SEARCHED FOR SOMEONE WHO IS                           TIC17680
*        WAITING FOR AN EVENT THAT HAS OCCURRED.                        TIC17690
*                                                                       TIC17700
*        IF SUCH AN ENTRY IS FOUND, IT IS REMOVED FROM                  TIC17710
*        THE CHAIN AND CONTROL IS DISPATCHED TO WHERE                   TIC17720
*        THE ENTRY INDICATES.  OTHERWISE, THE TIC-EXECUTIVE             TIC17730
*        GOES INTO A WAIT (AN XOS WAIT) ON THE EVENTS IN THE            TIC17740
*        CHAIN THAT ARE XOS EVENTS PLUS ANY EXEC-LOCAL EVENTS           TIC17750
*        (E.G. WAITS ON MULTIDROP LINES).                               TIC17760
*                                                                       TIC17770
*        THE ENTRIES IN THIS CHAIN ARE TWENTY WORDS LONG -- WORDS       TIC17780
*        OBTAINED FROM DYNAMIC MEMORY.  THE FIRST WORD OF EACH          TIC17790
*        ENTRY POINTS TO THE NEXT.  THE END IS INDICATED                TIC17800
*        BY A ZERO POINTER VALUE.                                       TIC17810
*                                                                       TIC17820
*        THE CHAIN BEGINS AT THE FOLLOWING WORD:                        TIC17830
*                                                                       TIC17840
#TIC#WAIT#CHAIN DATA 0                                                  TIC17850
*                                                                       TIC17860
*                                                                       TIC17870
*                                                                       TIC17880
*        THE ENTRIES CHAINED ON THIS CHAIN ARE KNOWN AS                 TIC17890
*        TIC-WAIT-CHAIN-ENTRIES, OR TWCE'S.  THE CONTENT OF AN ENTRY    TIC17900
*        IS DEFICED SYMBOLICALLY BELOW:                                 TIC17910
*                                                                       TIC17920
#TWCE#FLINK EQU    0                    POINTER TO NEXT TWCE OR ZERO    TIC17930
#TWCE#LOCATION EQU 2                   LOCATION TO GO TO ON EVENT       TIC17940
#TWCE#ECW EQU      3                   EVENT POINTER                    TIC17950
#TWCE#REGISTERS EQU 4                  SIXTEEN SAVED REGISTERS          TIC17960
#TWCE#LENGTH EQU   20                   LENGTH OF A TWCE                TIC17970
         PAGE                                                           TIC17980
*                                                                       TIC17990
*        LOCAL STORAGE USED BY THE TIC NUCLEUS                          TIC18000
*                                                                       TIC18010
#CURRENT#PROCESS#DEV DATA              0                                TIC18020
*                                                                       TIC18030
*                                                                       TIC18040
*                                                                       TIC18050
         DO        DO#CORETFDS
@TFD@CHAIN DATA    0                    IN-CORE TFD CHAIN HEAD          TIC18100
         FIN
*                                                                       TIC18110
*                                                                       TIC18120
*                                                                       TIC18130
#MESSAGE#CHAIN DATA 0                  CHAIN OF PENDING MESSAGES.       TIC18140
*                                                                       TIC18150
*                                                                       TIC18160
*                                                                       TIC18170
#BIGGEST#TIC#TASK DATA 5               CONTROLS DO-LOOPS THRU #DEV TABLETIC18180
#BIGGEST#MDL#TASK DATA 0               (WILL HOLD MDL-TASK #, IE NEGATIVTIC18190
*                                                                       TIC18200
*                                                                       TIC18210
*                                                                       TIC18220
*                                                                       TIC18230
#X#ED    DATA      0                   ON IF OPERATIR 'X'.              TIC18240
*
*
*                                                                       TIC18250
ECBLISTWA DATA     0                   LOCATION AND LENGTH OF
ECBLISTMAXSIZE DATA 0                   WHERE TO BUILD ECB LIST.
*                                                                       TIC18260
*
*
         BOUND     4                                                    TIC18270
#INFOBLOCK#TFDI RES 0                                                   TIC18280
#TFDI#GRANULE#KEY#CHAIN DATA 0                                          TIC18290
         DATA       17                                                  TIC18310
*                                                                       TIC18320
*                                                                       TIC18330
*                                                                       TIC18340
         BOUND     4                                                    TIC18350
#INFOBLOCK#STAI RES 0                                                   TIC18360
#STAI#GRANULE#KEY#CHAIN DATA 0                                          TIC18370
          DATA      8                                                   TIC18390
*                                                                       TIC18400
*                                                                       TIC18410
*                                                                       TIC18420
         BOUND      4                                                   TIC18430
#INFOBLOCK#DELI RES 0                                                   TIC18440
#DELI#GRANULE#KEY#CHAIN DATA 0         CHAIN-OF-KEYS HEAD.              TIC18450
         DATA      8                    CHAR COUNT OF 'KEYS' OF RECORD. TIC18470
*                                                                       TIC18480
*                                                                       TIC18490
*                                                                       TIC18500
*                                                                       TIC18510
*                                                                       TIC18520
*                                                                       TIC18530
         BOUND     8                                                    TIC18540
#NET#ECB GEN,32    X'30000000'
         GEN,32    0                                                    TIC18560
*
         BOUND     8
GETMAINECB GEN,32  X'30000000'
         GEN,32    0
*
         BOUND     8
#TIMESUP#ECB GEN,32 X'30000000'
         GEN,32    0
*
*
*
         DO        DO#GATEOBTAININTERNAL
         BOUND     8
GATEOBTAININTERNALECB DATA X'80000000'
                      DATA 0
GATEOBTAININTERNALCOUNT DATA 0
         FIN
*                                                                       TIC18570
*                                                                       TIC18580
*                                                                       TIC18590
         DO        DO#CHECKOUT
#TS#TEST DATA      1                   ZERO IF SPECIAL ON-LINE CHECKOUT.TIC18600
         FIN
         PAGE                                                           TIC18610
*        TIC TABLES EXIST HERE FOR CHECKOUT.  EVENTUALLY THEY           TIC18620
*        WILL BE BUILT IN DYNAMIC MENORY BY TIC-INIT.                   TIC18630
*                                                                       TIC18640
         BOUND     4                                                    TIC18650
#DEV#RECORD#BA#IW  GEN,32 %+1
         BOUND     4                                                    TIC18790
#DEV#RECORD#LENGTH#IW GEN,32 %+1
         BOUND     4                                                    TIC18900
#DEV#RECORD#STATUS#IW GEN,32 %+1
         BOUND     4                                                    TIC18970
#DEV#EVENT#PTR#IW  GEN,32 %+1
         BOUND     4                                                    TIC19090
#DEV#COMMAND#LINE#RECORD#BA#IW GEN,32 %+1                               TIC19100
         BOUND     4                                                    TIC19140
#DEV#COMMAND#LINE#RECORD#LENGTH#IW GEN,32 %+1                           TIC19150
         BOUND     4                                                    TIC19240
#DEV#DCB#POINTER#IW GEN,32 %+1                                          TIC19250
         BOUND     4                                                    TIC19290
#DEV#CURRENT#IO#IW GEN,32 %+1                                           TIC19300
*        BITS IN THE ABOVE TABLE ARE AS FOLLOWS:                        TIC19340
#CIO#REQD EQU      16                                                   TIC19350
#CIO#INIT EQU      32                                                   TIC19360
#CIO#COMP EQU      64                                                   TIC19370
#CIO#WRITE EQU     1                                                    TIC19380
#CIO#READ EQU      2                                                    TIC19390
#CIO#WANDR EQU     3                                                    TIC19400
#CIO#ATTN EQU      8                                                    TIC19410
*                                                                       TIC19420
         BOUND     4                                                    TIC19430
#MDL#WAKEUP#ECB#IW GEN,32 -100
*                                                                       TIC19480
         BOUND     4                                                    TIC19490
#MDL#FIXED#BUFFERS#IW GEN,32 -100
*
#MDL#TASK#ORDER#IW DATA -100
*                                                                       TIC19540
         BOUND     4                                                    TIC19550
#DEV#INPUT#TRL#IW  GEN,32 %+1
         BOUND     4                                                    TIC19620
#DEV#OUTPUT#TRL#IW GEN,32 %+1
         BOUND     4                                                    TIC19690
#DEV#LINE#IDENTIFIER#IW GEN,32 %+1                                      TIC19700
         BOUND     4                                                    TIC19740
#DEV#MULTIPOINT#INDEX#IW GEN,32 -100                                    TIC19750
*                                      (NO TS TESTING OF MDL'S)         TIC19760
*                                                                       TIC19770
         BOUND     4                                                    TIC19780
#DEV#LOGON#BLOCK#IW GEN,32 %+1                                          TIC19790
*        VALUES IN #DEV#DOING ENTRY:                                    TIC19822
*                                                                       TIC19823
#DOING#ACCEPT      EQU 3                                                TIC19824
#DOING#REPORT      EQU 4                                                TIC19825
*
*
*
          BOUND     4                                                   TIC19830
#DEV#STATION#TYPE#IW GEN,32 %+1                                         TIC19840
         DO       DO#3270
         BOUND    4
#DEV#PLATEN#R#IW  GEN,32  %+1
         BOUND 4
#DEV#PLATEN#C#IW  GEN,32  %+1
         BOUND    4
#DEV#TC#RETRY#IW   GEN,32  %+1
         FIN
         BOUND    4
#DEV#MDL#RETRY#IW  GEN,32  %+1
*
         DO        HOWMANYXMITSBREAK>1
         BOUND     4
#DEV#XMIT#COUNT#IW GEN,32 %+1
         FIN
*
         BOUND     4
#DEV#ECB#IW GEN,32 %+1                                                  TIC19900
        BOUND     4                                                     TIC19940
#DEV#LINE#STATUS#BITS#IW GEN,32 %+1                                     TIC19950
*        BITS IN ABOVE TABLE:                                           TIC19990
*                                                                       TIC20000
#LINE#UNACQUIRED EQU 1                                                  TIC20010
#LINE#MESSAGED EQU 2                                                    TIC20020
#LINE#REGULATED EQU 4                                                   TIC20030
#LINE#ATTENTION EQU 8                                                   TIC20040
#LINE#AWAITING#ATTENTION EQU 16                                         TIC20050
#LINE#AWAITING#REPORT EQU 32                                            TIC20060
#LINE#AWAITING#ACQUIRE EQU 64          ON IF I/O ERROR TABLED THE LINE.
#LINE#CANNOT#OUTPUT EQU 128            ON IF INPUT-ONLY.
#LINE#CANNOT#INPUT EQU 256             ON IF OUTPUT-ONLY.
#LINE#REESTABLISH EQU 512              ON TO RE-SETUP (MDL) LINE.
#LINE#SWITCHABLE EQU 1024              TS-OR-TP LINE.
#LINE#SWITCH#DONT EQU 2048             TIC SHOULDN'T TRY FOR LINE.
#QD#FOR#INT EQU   X'1000'           SET IF THIS LINE IS CURRENTLY
*  PROCESSING AT THE M:INT LEVEL, OR IS Q'D FOR M:PURGE/SIGNALATTENTION
*  BECAUSE OF M:INT ENTRY; BIT 19
*
*
*
         BOUND     4
#DEV#TYPE#INDEX#IW GEN,32 %+1
*        VALUES IN ABOVE TABLE:
*
#DEV#TYPE#INDEX#OWNCODE EQU 1
#DEV#TYPE#INDEX#UNIT#RECORD EQU 2
#DEV#TYPE#INDEX#TTY EQU 3
#DEV#TYPE#INDEX#3270 EQU 4
#DEV#TYPE#INDEX#BIGGEST EQU 4
*                                                                       TIC20070
*                                                                       TIC20080
*                                                                       TIC20090
         BOUND     4                                                    TIC20100
#DEV#REGULATION#IW GEN,32 %+1                                           TIC20110
*        BITS IN ABOVE TABLE:                                           TIC20150
*                                                                       TIC20160
#REGULATE#QUESTION EQU 1                                                TIC20170
#REGULATE#AT       EQU 2                                                TIC20180
#REGULATE#CRUNCH   EQU 4                                                TIC20190
*                                                                       TIC20200
*                                                                       TIC20210
*                                                                       TIC20220
         BOUND     4                                                    TIC20230
#DCB#TABLE#IW GEN,32 %+3                                                TIC20240
*                                                                       TIC20290
*                                                                       TIC20300
*                                                                       TIC20310
F:TFDX   DSECT     1                                                    TIC20330
F:TFDX   M:DCB    (FILE,'TFDS',8),(CONSEC),(SEQUEN),(IN),(SN,1)
F:TICI   DSECT     1
F:TICI   M:DCB    (FILE,'TICTICI',8),(RANDOM),(OUTIN),(SN,1)
F:STAX   DSECT     1                                                    TIC20420
F:STAX   M:DCB    (FILE,'STATIONNAMES',8),(CONSEC),(SEQUEN),;
                  (IN),(SN,1)
F:STAK   DSECT     1                                                    TIC20460
F:STAK   M:DCB    (FILE,'RMASTAK',8),(KEYED),(DIRECT),(OUTIN),;
                  (SN,1)
F:DELX   DSECT     1                                                    TIC20480
F:DELX   M:DCB    (FILE,'DELIVERIES',8),(CONSEC),(SEQUEN),(IN),(SN,1)
F:MYSI   DSECT     1                                                    TIC20520
F:MYSI   M:DCB    (FILE,'RMAMYSI',8),(CONSEC),(SEQUEN),(OUTIN),(SN,1)
F:JRNL   DSECT     1                                                    TIC20540
F:JRNL   M:DCB    (JRNL,'JOURNAL',':SYS',8),(CONSEC),;
                  (SEQUEN),(OUT),(SAVE)
         PAGE
RP       CSECT    1
*                                                                       TIC36370
HEXTABLE DATA      '0123'                                               TIC43470
         DATA      '4567'                                               TIC43480
         DATA      '89AB'                                               TIC43490
         DATA     'CDEF'
*                                                                       TIC36320
         BOUND     8                                                    TIC36330
ZEROANDNINE GEN,32 X'F0'                                                TIC36340
         GEN,32    X'F9'                                                TIC36350
TCQCC1   TEXTC    'CC1 SET AFTER M:QUEUE CALL'
         TITLE     'TIC - NUCLEUS'
*
*        THIS ROUTINE IS ENTERED VIA THE #SNAP PROCEDURE.               TIC09340
*        IT PRINTS THE CALLER'S MESSAGE AND THE SIXTEEN                 TIC09350
*        REGISTERS OUT ON THE 'OUT' DEVICE.                             TIC09360
*                                                                       TIC09370
#SNAP#CODE RES     0                                                    TIC09390
         LI,8      1                                                    TIC09400
         SLS,8     *#ARG                                                TIC09410
         CW,8      SNAPSWITCHES        SEE IF SNAP # ENABLED.           TIC09420
         BAZ       SNAPRETURN          OVER IF NOT                      TIC09430
*                                                                       TIC09440
         BAL,5    ERRHDR            PRINT ERROR HEADER
         LI,6     #BAL              L/ADR OF TEXTC POINTER
         LW,6     0,6               L/POSS ADR OF TEXTC
         LB,5     *6                L/BC OF TEXTC
         BEZ      %-2               B/BC 0; CHAIN THRU TO TEXTC
         M:WRITE  M:DO,(BUF,*6),(BTD,1),(SIZE,*5),(WAIT)
*                                                                       TIC09470
*                                                                       TIC09480
*        BELOW WE CONVERT THE REGISTERS THAT WERE                       TIC09490
*        STUFFED INTO THE STACK BY THE #PRINT PROC INTO                 TIC09500
*        HEX AND PRINT THEM.  TWO LINES OF EIGHT                        TIC09510
*        REGISTERS.                                                     TIC09520
*                                                                       TIC09530
         LW,15     ='    '             SEPARATOR BETWENN REGISTERS ON   TIC09540
         LI,14     2                   NUMBER OF LINES                  TIC09550
*                                                                       TIC09560
         LW,10     #TIC#STACK          GENERATE WA OF THE PUSHED        TIC09570
         AI,10     -15                  REGISTERS IN THE STACK          TIC09580
*                                                                       TIC09590
PRINTCODENEWLINE RES 0                                                  TIC09600
         LI,4      PRINTCODEARRAY+1    RES WHERE WE BUILD LINE IMAGE    TIC09610
         LI,13     8                   NUMBER OF REGS PER LINE          TIC09620
PRINTCODENEWWORD RES 0                                                  TIC09630
         LW,7      *10                 GET A WORD TO CONVERT            TIC09640
*        CONVERT WORD IN R7 TO HEX IN                                   TIC09650
*        R8 AND R9.  USES R5 THROUGH R9.                                TIC09660
         LI,5      8                   BYTES PER WORD                   TIC09670
         LI,6      0                   CLEAR REGISTER SIX               TIC09680
         SLD,6     4                   AND SHIFT A BYTE IN              TIC09690
         LB,6     HEXTABLE,6        CONVERT IT TO HEX
         SLD,8     8                   SHIFT CONVERTED STRING           TIC09710
         OR,9      6                   AND INSERT NEW CHARACTER         TIC09720
         BDR,5     %-5                 CONVERT ALL EIGHT BYTES          TIC09730
*                                                                       TIC09740
         STW,8     0,4                 COPY THE CONVERTED WORD          TIC09750
         STW,9     1,4                  INTO THE LINE IMAGE             TIC09760
         STW,15    2,4                   AND ADD BLANK SEPATATOR        TIC09770
         AI,4      3                   BUMP IMAGE POINTER UP            TIC09780
         AI,10     1                   BUMP REG-IN-STACK POINTER UP     TIC09790
         BDR,13    PRINTCODENEWWORD    AND BACK FOR ANOTHER REGISTER    TIC09800
*                                                                       TIC09810
         LB,5     PRINTCODEARRAY    L/BC OF MSG
         M:WRITE  M:DO,(BUF,PRINTCODEARRAY),(BTD,1),(SIZE,*5),(WAIT)
         BDR,14    PRINTCODENEWLINE    AND BACK FOR THE OTHER LINE      TIC09830
*                                                                       TIC09840
SNAPRETURN RES     0                                                    TIC09850
         LB,5      *#BAL               GET THE BYTE COUNT OF THE TEXTC  TIC09860
         AI,5      4                   ROUND UP AND                     TIC09870
         SLS,5     -2                  CONVERT TO WORD COUNT            TIC09880
         B         *#BAL,5             AND RETURN OVER THE TEXTC        TIC09890
*                                                                       TIC09900
*                                                                       TIC09910
*                                                                       TIC09920
         PAGE
SNAPSWITCHES DATA X'FFFFFFFA'       SWITCHES ARE 0->35, RIGHT TO LEFT
*
*
*  #SNAP CF(2) CODES:               (IN ORDER OF APPEARANCE)
*
*  CODE  MODULE   MESSAGE
*
*   5    TICROOT  GETMAINBLACK -- NO STORAGE
*   0    TICROOT  IN #INITIATE#READ#CODE
*   0    TICROOT  IN #INITIATE#WRITE#CODE
*   0    TICROOT  #CHECK#CODE
*   1    TICROOT  IN #CHECK#CODE WITH AN ERROR
*  26    TICROOT  DOING AN M:QUEUE/PURGE
*  10    TICROOT  ABOUT TO M:EXIT
*  24    TICROOT  DOING AN M:PURGE *R8
*   0    TICROOT  IN DISPATCHER AT SOMETHINGTODO
*  25    TICROOT  IMPOSSIBLE BREAK IGNORED
*  24    TICROOT  DOING AN M:PURGE *R5
*  24    TICROOT  DOING AN M:PURGE *R5 AT M:INT EXIT'
*
*   3    TICLABOR XED
*   2    TICLABOR AT TSOIOERROR
*   2    TICLABOR AT TSIIOERROR
*  30    TICLABOR GOT A ZERO FROM GETID
*  27    TICLABOR JRNL WRITE ERR
*  30    TICLABOR TFD NOT IN TFD CHAIN
*  22    TICLABOR ERR/ABN READING INTERNAL FILE
*  26    TICLABOR DOING AN M:QUEUE/PURGE
*  26    TICLABOR DOING AN M:QUEUE/DEFINELIST
*  12    TICLABOR NO DELIVERIES RECORD
*  15    TICLABOR ILLEGAL NPS ENCOUNTERED BY LOGON
*  28    TICLABOR CC1 SET ON M:QUEUE/STATUS; TRYING AGAIN
*
*  10    TICINIT  ENTERING TIC INITIALIZATION
*  15    TICINIT  BAD +-TYPE NPS -- RECORD IGNORED
*
*  29    ANYWHERE CC1 SET AFTER M:QUEUE CALL  (#QCHK PROC)
*
*  31    ANYWHERE 31'S ARE UNCONDITIONAL, AND APPEAR IN VARIOUS PLACES
*
*
*
         PAGE
ERRHDR   ;
         #PUSH,5,9                  PUSH R5 -> R9
         M:TIME   PRINTCODESTAR+1   GET CURRENT TIME
         LW,7     #BAL              L/BAL ADR
         LW,5     SEG#              L/CURRENT SEGMENT #
         CW,7     SEGADRS,5         C/BAL ADR W/OV START ADR
         BGE      EH050             BGE; WE'RE IN AN OVERLAY
         LI,5     1                 L/1; ROOT 'SEGMENT' INDEX
         CW,7     SEGADRS,5         C/BAL ADR W/ROOT PROCEDURE START ADR
         BGE      EH050             BGE; WE'RE IN ROOT
         LI,5     0                 L/0; PATCH AREA 'SEGMENT' INDEX
EH050    SW,7     SEGADRS,5         (BAL ADR) - (SEG START ADR)
         LD,8     SEGNAMES,5        L/NAME OF SEG
         LCI      2                 L/CC'S FOR STM
         STM,8    PRINTCODESTAR+8   S/SEG NAME INTO PRINT BUFFER
         LI,5     BA(PRINTCODESTAR)+43  L/BA OF 1ST HEX BYTE IN BUF
         LI,8     4                 L/# OF BYTES OF HEX TO CREATE
         STH,7    7                 LJ/4 DIGITS OF HEX
EH100    LI,6     0                 CLEAR R6
         SLD,6    4                 SHIFT 1 DIGIT INTO R6
         LB,6     HEXTABLE,6        L/BYTE OF EBCDIC HEX TEXT
         STB,6    0,5               S/BYTE INTO PRINT BUF
         AI,5     1                 INC BUF PNTR
         BDR,8    EH100             BDR/CONVERT NEXT BYTE
         LB,5     PRINTCODESTAR     L/BC OF MSG
         M:WRITE  M:DO,(BUF,PRINTCODESTAR),(BTD,1),(SIZE,*5),(WAIT)
         #PULL,5,9                  PULL R5 -> R9
         B        0,5               RETURN
         PAGE
*
*        ENTERED VIA THE #TYPE89 PROC.
*
*        TYPES CALLER'S MESSAGE AND R8 & R9 TO OPERATOR.
*
#TYPE89#CODE RES   0
         #PUSH,4,12                    SAVE SOME REGISTERS.
         BAL,5    ERRHDR            PRINT ERROR HEADER
*
         LB,5      *#BAL               GET CALLER'S TEXTC COUNT.
*
         SLS,#BAL  2                   POINT #BAL
         AI,#BAL   1                    TO TEXT.
*
         LI,4      BA(#TYPE89#BUFFER)+1
         LB,10     0,#BAL              COPY CALLER'S
         STB,10    0,4                  TEXTC TO
         AI,#BAL   1                     OUR BUFFER.
         AI,4      1
         BDR,5     %-4
*
         LI,10     ' '                 A BLANK FOLLOWS
         STB,10    0,4                  CALLER'S TEXT.
         AI,4      1
*
         LI,11     2                   TWO REGISTERS.
#TYPE89#J RES      0
         CW,8      =X'FF000000'        SEE IF SHOULD BE EBCDIC.
         BAZ       #TYPE89#X           OVER FOR HEX PRINTOUT.
*
#TYPE89#M RES      0                   HERE FOR EBCDIC PRINTOUT.
         LI,12     4                   FOUR CHARACTERS PER REGISTER.
         SCD,8     8                   STORED
         STB,9     0,4                  INTO
         AI,4      1                     BUFFER.
         BDR,12    %-3
         B         #TYPE89#N
*
#TYPE89#X RES      0
         LI,12     8                   EIGHT HEX DIGITS.
#TYPE89#K SCD,8    4
         LI,7      X'F'                PRINT OUT
         AND,7     9                    REGISTERS
         LB,10     HEXTABLE,7            IN HEX ...
         STB,10    0,4
         AI,4      1
         BDR,12    #TYPE89#K
*
#TYPE89#N RES      0
         LI,10     ' '                 ( A BLANK
         STB,10    0,4                  SEPARATES
         AI,4      1                     REGISTERS)
         BDR,11    #TYPE89#J
*
         AI,4      -BA(#TYPE89#BUFFER)-1 COMPUTE OUR
         STB,4     #TYPE89#BUFFER         TEXTC COUNT.
*
         M:TYPE    (MESS,#TYPE89#BUFFER)
         M:WRITE  M:DO,(BUF,#TYPE89#BUFFER),(BTD,1),(SIZE,*4),(WAIT)
*
         AI,#BAL   3                   ROUND TO WORD FOLLOWING
         SLS,#BAL  -2                   THE CALLER'S TEXTC.
*
         #PULL,4,12                    RESTORE REGISTERS.
         #SNAP,31 'REGISTERS AT TIME OF THE ABOVE ERROR:'
         DEF      SCT89             SUPER-CLOSE IN #TYPE89
SCT89    M:SUPCLS                   CLOSE SYMBIONT FILES
         B         0,#BAL               AND RETURN.
*
         PAGE                                                           TIC10070
*        CODING WHICH HANDLES GETTING AND FREEING OF                    TIC10080
*        DYNAMIC MEMORY FOR TIC-TASKS.  REACHED BY A                    TIC10090
*        BAL FROM WITHING THE #GET#MAIN#BYTES AND                       TIC10100
*        #FREE#MAIN#BYTES PROCEDURES.                                   TIC10110
*                                                                       TIC10120
#GET#MAIN#BYTES#CODE RES 0                                              TIC10130
         AI,#ARG   0                   TEST FOR ZERO REQUEST.           TIC10140
         BEZ       0,#BAL              IMMEDIATE RETURN IF SO.          TIC10150
*                                                                       TIC10160
         #PUSH,#BAL,15                 SAVE REGISTERS                   TIC10170
         #PUSH,#ARG,#ARG                SAME A GOTOON.                  TIC10180
         #PUSH,#BAL,#BAL               SAVE CALLER'S LOCATION.          TIC10190
         LW,5      #ARG                COPY USER'S BYTE COUNT.          TIC10200
         AI,5      7+12                ROUND UP AND ADD THREE WORDS.    TIC10210
         SLS,5     -3                  CONVERT BA TO DA.                TIC10220
*                                                                       TIC10230
         BAL,#BAL  #FIND#DWS           GET THE WORDS.                   TIC10240
*                                                                       TIC10250
         AI,4      0                   SEE IF WE GOT SPACE.             TIC10260
         BEZ       GETMAINBLOCK        OUT IF DIDN'T GET SPACE.         TIC10270
*                                                                       TIC10280
         STD,4     0,4                 SAVE THE DWA & DWS.              TIC10290
*                                                                       TIC10300
         LW,#ARG   #DEV                GET DEV-TASK NUMBER              TIC10310
         SLS,#ARG  16                   AND BUILD THE                   TIC10320
         OR,#ARG   4                     BYTE POINTER                   TIC10330
         SLS,#ARG  3                      THAT WE RETURN                TIC10340
         AI,#ARG   12                      TO THE CALLER.               TIC10350
         OR,#ARG   =X'80000000'             (H.O.B. = DYNAMIC STORAGE)  TIC10360
*                                                                       TIC10370
*        NOTE THAT WE USE THE FIRST THREE WORDS OF THE AREA             TIC10380
*        THAT WE GET FROM XOS FOR OUR OWN PURPOSES:                     TIC10390
*                  WORD 0: DA OF THE BLOCK (I.E. DA(%))                 TIC10400
*                  WORD 1: NUMBER OF DOUBLEWORDS IN BLOCK.              TIC10410
*                  WORD 2:  CHECKOUT COPY OF #BAL                       TIC10420
*        WE USE WORDS 0 & 1 FOR FREEING THE BLOCK IN                    TIC10430
*        #FREE#MAIN#BYTES#CODE.  SINCE THERE WE ARE                     TIC10440
*        REFERENCING RELATIVE TO THE (WA) START OF THE                  TIC10450
*        USER'S BLOCK, THE ABOVE WORDS ARE WORDS -3, -2, & -1.          TIC10460
*                                                                       TIC10470
         #PULL,#BAL,#BAL               RESTORE CALLER'S LOCATION.       TIC10480
         SLS,4     1                   MAKE WA OF THE SPACE.            TIC10490
         STW,#BAL  2,4                 STORE #BAL FOR CHECKOUT.         TIC10500
*                                                                       TIC10510
         #PULL,#BAL,#BAL               DO NOT RESTORE #ARG.             TIC10520
         #PULL,#BAL,15                 RESTORE REGISTERS.               TIC10530
         B         0,#BAL              AND RETURN                       TIC10540
*                                                                       TIC10550
*                                                                       TIC10560
*                                                                       TIC10570
*        ROUTINES CALLED BY THE #ENTRY#SPACE PROCS.
*
#GET#MAIN#WORDS#SPECIAL#CODE#CLEAR RES 0
         OR,#BAL   =X'80000000'        INDICATE THIS ENTRY.
*
#GET#MAIN#WORDS#SPECIAL#CODE RES 0                                      TIC10580
         #PUSH,#BAL,15                 SAVE REGISTERS SAME              TIC10590
         #PUSH,#ARG,#ARG                AS GOTOON -- MUST               TIC10600
         #PUSH,#BAL,#BAL                MATCH PUSHES IN GETMAINBYTES.   TIC10610
         LI,5      3+16+1              19 MORE THAN REQUESTED & ROUND.  TIC10620
         AW,5      #ARG                INTO THE RIGHT REGISTER AND      TIC10630
         SLS,5     -1                  CONVERTED TO DOUBLEWORDS.        TIC10640
*                                                                       TIC10650
         BAL,#BAL  #FIND#DWS           GET THE SPACE.                   TIC10660
*                                                                       TIC10670
         AI,4      0                   SEE IF WE GOT SPACE.             TIC10680
         BEZ       GETMAINBLOCK         OUT IF WE DIDN'T.               TIC10690
*                                                                       TIC10700
         STD,4     0,4                 SET WORD 0 TO DA(%).             TIC10710
*                                                                       TIC10720
         LI,#ARG   X'FFFF'             CREATE A BARE WA POINTER         TIC10730
         AND,#ARG  4                    TO THE SPACE WE GOT             TIC10740
         SLS,#ARG  1                     (DA TO WA)                     TIC10750
*                                                                       TIC10760
         #PULL,#BAL,#BAL               THROW AWAY A #BAL.               TIC10770
         #PULL,#BAL,#BAL               GET CALLER'S #ARG.
         STW,#BAL  2,#ARG              AND REMEMBBER FOR POSSIBLE CLEARIN
         #PULL,#BAL,15                 RESTORE REGISTERS.               TIC10790
*                                                                       TIC10820
         LCI       0                   STORE ALL THE CALLER'S REGISTERS TIC10830
         STM,0     3,#ERR               AT THE BEGINNING OF THE STOREGE TIC10840
         LW,#OWN   #ERR                RETRIEVE THE STORAGE OOINTER     TIC10850
         AI,#OWN   3+16                 ADJUST TO POINT TO CALLER'S OWN TIC10860
         LW,#ARG   2-3-16,#OWN         LOAD CALLER'S #ARG.
         STW,#BAL  2-3-16,#OWN         STORE #BAL FOR DEBUGGING.
         AI,#BAL   0                   SEE IF WE SHOULD CLEAR WORDS.
         BGEZ      *#BAL               RETURN IF NOT.
*
*        #ARG HAS CALLER'S WORD COUNT.
*
         #PUSH,#ARG,#OWN               PUSH R2, R3, R4.
         LI,#BAL   0                   MAKE A ZERO.
         STW,#BAL  0,#OWN              ZERO OUT
         AI,#OWN   1                    THE CALLER'S
         BDR,#ARG  %-2                   LOCAL WORDS.
         #PULL,#ARG,#OWN               PULL R2, R3, AND R4.
         B         *#BAL               AND RETURN.
*                                                                       TIC10880
*                                                                       TIC10890
*                                                                       TIC10900
GETMAINBLOCK RES   0                   HERE TO WAIT FOR STORAGE.        TIC10910
         #CLEAR#ECB GETMAINECB         CLEAR ECB TO WAIT ON.            TIC10920
         #PULL,10,10                   RETRIEVE CALLER'S BAL LOC+1.     TIC10930
*                                                                       TIC10940
         #SNAP,5   'GETMAINBLOCK -- NO STORAGE'                         TIC10950
         AI,10     -1                  PUSH R10 BACK TO BAL LOCATION.   TIC10960
         LI,11     GETMAINECB          LOAD ECB POINTER.                TIC10970
*                                                                       TIC10980
*        TRICKY CODE HERE.                                              TIC10990
*                                                                       TIC11000
*        REGISTERS #BAL-15 AND #ARG ARE IN THE STACK.                   TIC11010
*        THIS IS JUST AS GOTOONCODEMAIN WANTS THEM.  BUT                TIC11020
*        THE #BAL IN THE STACK NEEDS TO BE ADJUSTED TO POINT            TIC11030
*        TO US RATHER THAN TO THE CALLER'S BAL+1.                       TIC11040
*                                                                       TIC11050
         LW,4      #TIC#STACK          POINT TO #ARG IN THE STACK.      TIC11060
         LI,5      %+3                 POINT TO US.                     TIC11070
         STW,5     #BAL-16,4           FAKE A BAL
         B         GOTOONCODEMAIN       TO GOTOON.                      TIC11090
         #EXIT                           AND EXIT.                      TIC11100
         PAGE                                                           TIC11160
*        HERE TO FREE THE STORE THAT IS                                 TIC11170
*        POINTED TO BY THE POINTER IN #DEV#RECORD#BA                    TIC11180
*        TABLE.  IF NO SUCH STORE, NO ERROR.  THIS ENTRY                TIC11190
*        IS NORMALLY USED TO FREE THE DYNAMIC BUFFER                    TIC11200
*        ACQUIRED BY #INITIATE#READ - AS WHEN SUCH A READ               TIC11210
*        IS FOLLOWED BY THE WRITE OF SOMETHING LOCAL.                   TIC11220
#FREE#DEV#BUFFER#CODE RES 0                                             TIC11230
         #PUSH,#BAL,8                  SAVE SOME REGISTERS.             TIC11240
*                                                                       TIC11250
         LI,#ARG   0                   CLEAR AND GET THE                TIC11260
         #T#XCA,#ARG #DEV#RECORD#BA     BUFFER POINTER.                 TIC11270
         BEZ       FREERETURN           OVER IF NONE                    TIC11280
         BGZ       FREERETURN            OVER IF NOT DYNAMIC            TIC11290
         B         FREESTORAGE         OVER TO FREE IT                  TIC11300
*                                                                       TIC11310
*                                                                       TIC11320
*                                                                       TIC11330
#FREE#MAIN#BYTES#IF#CODE RES 0
         AI,#ARG   0                   SEE IF 'DYNAMIC'.
         BGEZ      0,#BAL               IF NOT, IMMEDIATE RETURN.
*                                        IF SO, FALL THRU TO FREE BLOCK.
*
#FREE#MAIN#BYTES#CODE RES 0                                             TIC11340
         #PUSH,#BAL,8                  SAVE SOME REGISTERS.             TIC11350
FREESTORAGE RES    0                                                    TIC11360
         LI,6      X'7FFFF'            GET A CLEAN COPY                 TIC11370
         AND,6     #ARG                 OF THE CALLER'S BA.             TIC11380
         CI,6      3                   MAKE SURE EVEN WA                TIC11390
         BANZ      FREESTORAGEXX       BA WASN'T A WA.                  TIC11400
         AI,6      -12                 BACK TO START-OF-BLOCK.          TIC11410
         SLS,6     -3                  CONVERT BA TO A DA.              TIC11420
*                                                                       TIC11430
FREESTORAGEOK RES  0                                                    TIC11440
         LD,4      0,6                 RETRIEVE CHECKING INFO.          TIC11450
         CW,4      6                   ADDRESS MUST AGREE.              TIC11460
         BE        FREESTORAGEDO       OVER IF IT AGREES.               TIC11470
FREESTORAGEXX B    -1                  IMPOSSIBLE FREE REQUEST.
FREESTORAGEDO RES  0                                                    TIC11490
         BAL,#BAL  #HIDE#DWS           FREE THE DOUBLEWORDS.            TIC11500
FREERETURN RES     0                                                    TIC11510
         #POST#ECB GETMAINECB          ANNOUNCE WE FREED SOMETHING.     TIC11520
         #PULL,#BAL,8                  RESTORE SOME REGISTERS.          TIC11530
         B         0,#BAL              AND RETURN                       TIC11540
*                                                                       TIC11550
*                                                                       TIC11560
*                                                                       TIC11570
#FREE#MAIN#WORDS#SPECIAL#CODE RES 0                                     TIC11580
         #PUSH,#OWN,#OWN               SAVE POINTER TO SPACE            TIC11590
         #PUSH,#BAL,#BAL               SAVE LINKAGE REGISTER            TIC11600
         LCI       0                   RESTORE                          TIC11610
         LM,0      -16,#OWN            16 REGS                          TIC11620
         #PULL,#BAL,#BAL               RETRIEVE LINKAGE REGISTER        TIC11630
         #PULL,#ERR,#ERR               RETRIEVE STOREGE POINTER (NEW REGTIC11640
         #PUSH,#BAL,8                  SAVE SOME REGISTERS.             TIC11650
         LI,6      -3-16               CREATE THE CORRECT WA OF         TIC11660
         AW,6      #ERR                 THE STORAGE TO RELEASE          TIC11670
         SLS,6     -1                  CONVERT WA TO A DA.              TIC11680
         B         FREESTORAGEOK       AND GO RELEASE IT                TIC11690
         PAGE                                                           TIC11700
*        THIS CODE INITIATES A TAM READ FOR THE CALLER.                 TIC11710
*        CALLED BY USE OF THE '#INITIATE#READ' PROCEDURE.               TIC11720
*        THE DEVICE/LINE INFORMATION USED TO DO THE READ IS             TIC11730
*        OBTAINED FROM THE TABLES USING THE CONTENTS OF                 TIC11740
*        THE '#DEV' REGISTER.                                           TIC11750
*                                                                       TIC11760
*        (NOTE THAT ALL 'INITIATE' ROUTINES USE COMMON RETURN           TIC11770
*        AND COMMON ERROR ROUTINE AND THEREFORE IT IS IMPORTANT         TIC11780
*        THAT THEY ALL PUSH THE SAME REGISTERS AT ENTRANCE)             TIC11790
*                                                                       TIC11800
#INITIATE#READ#CODE RES 0                                               TIC11810
         #PUSH,#BAL,15                                                  TIC11820
*                                                                       TIC11830
         #T#GET,8  #DEV#RECORD#STATUS  SEE IF OUTSTANDING ERROR.        TIC11840
         BNEZ      INITIATERETURN      DO NUTTIN IF SO.                 TIC11850
*
         BAL,15    INITIATEACQUIREDCHECK MAKE SURE STATION IS ACQUIRED.
*                                                                       TIC11860
INITIATEREAD200 RES 0
         LI,4      #CIO#REQD+#CIO#READ COPY TO TABLE                    TIC11870
         #T#PUT,4  #DEV#CURRENT#IO     WHAT WE ARE DOING                TIC11880
*                                                                       TIC11890
         #T#GET,4  #DEV#DCB#POINTER    GET POINTER TO POINTER           TIC11900
         BGZ       INITIATEREADGETDCB  OVER IF NORMAL                   TIC11910
         AI,#DEV   0                   SEE IF SERVICING A MDL-TASK      TIC11920
         BLZ       INITIATEREADGETDCB  OVER IF SO - STILL NORNAL        TIC11930
*                                                                       TIC11940
*        HERE ON CALL FROM A DEV-TASK WHOSE DCB POINTER                 TIC11950
*        INDICATES IT IS SERVICING A MULTI-DROP STATION                 TIC11960
*                                                                       TIC11970
         #T#CLEAR  #DEV#ECB            CLEAR AND
         #T#GWA,8  #DEV#ECB             POINT TO THE
         #T#PUT,8  #DEV#EVENT#PTR        STATION'S ECB.
         B         INITIATERETURN                                       TIC11990
*                                                                       TIC12000
INITIATEREADGETDCB RES 0               HERE ON NORMAL LINE              TIC12010
         LW,5      *#DCB#TABLE#IW,4    GET LOCATION OF DCB              TIC12020
*                                                                       TIC12030
         #T#GET,8  #DEV#INPUT#TRL      GET MAX TRANSFER LENGTH          TIC12040
*                                                                       TIC12050
         DO        DO#FIXEDMDLBUFFERS
         AI,#DEV   0                   SEE IF MDL-TASK
         BGZ       INITIATEREAD250     OVER IF NOT.
         #T#GET,7  #MDL#FIXED#BUFFERS  RETRIEVE BA OF MDL BUFFER.
         B         INITIATEREAD270     (IF USING FIXED ONES)
         FIN
*
INITIATEREAD250 RES 0
         LW,#ARG   8                   GET A LONG ENOUGH                TIC12060
         #GET#MAIN#BYTES                BUFFER FOR THE READ             TIC12070
         LW,7      #ARG                  COPY THE BA OF BUFFER          TIC12080
INITIATEREAD270 RES 0
         #T#PUT,7  #DEV#RECORD#BA         FOR READ AND FOR LATER        TIC12090
*                                                                       TIC12100
         #T#GWA,6  #DEV#EVENT#PTR       ARE LOADED INTO THE REGISTERS   TIC12110
*                                                                       TIC12140
         #SNAP     'IN #INITIATE#READ#CODE'                             TIC12150
         BAL,#BAL  INITIATEDCBCHECK                                     TIC12160
*                                                                       TIC12170
         SLS,7     -2                  CORRECT (BUF) TO A WA.           TIC12180
         #T#GWA,9  #DEV#ECB            GET LOCATION OF AN ECB.          TIC12190
         #T#PUT,9  #DEV#EVENT#PTR      INDICATE WE'RE USING IT.         TIC12200
*                                                                       TIC12210
         LW,#ARG   =X'80000000'        SPECIAL ECB
         STW,#ARG  *9                   CLEAN-UP.
*
*        NOTE THAT WE DO SLAVE COC READS AND
*        MULTI-POINT READS THRU THE SAME CAL.
*        THIS IS OK AS (AUTO) IS IGNORED
*        WHEN IT IS NOT APPLICABLE.
*
         M:READ    *5,(BUF,*7),(BTD,0),(SIZE,*8),(ECB,*9),(AUTO)        TIC12420
*                                                                       TIC12430
INITIATEREADEND RES 0                                                   TIC12440
INITIATERETURN RES 0                                                    TIC12450
         #PULL,#BAL,15                                                  TIC12460
         B         0,#BAL              AND RETURN                       TIC12470
        PAGE                                                            TIC12480
#INITIATE#WRITE#CODE RES 0                                              TIC12490
         #PUSH,#BAL,15                                                  TIC12500
*                                                                       TIC12510
         #T#GET,8  #DEV#RECORD#STATUS  SEE IF OUTSTANDING ERROR.        TIC12520
         BNEZ      INITIATERETURN      DO NUTTIN IF SO.                 TIC12530
*
         BAL,15    INITIATEACQUIREDCHECK MAKE SURE STATION IS ACQUIRED.
*                                                                       TIC12540
         LI,4      #CIO#REQD+#CIO#WRITE REMEMBER TYPE OF                TIC12550
         #T#PUT,4  #DEV#CURRENT#IO      THE INPUT/OUTPUT                TIC12560
*                                                                       TIC12570
INITIATEWRITE234 RES 0                                                  TIC12580
         #T#GET,4  #DEV#DCB#POINTER    GET POINTER TO POINTER           TIC12590
         BGZ       INITIATEWRITEGETDCB  OVER IF VERY NORMAL             TIC12600
         AI,#DEV   0                   SEE IF MULTI-DROP                TIC12610
         BLZ       INITIATEWRITEGETDCB  OVER IF NORMAL MDL              TIC12620
*                                                                       TIC12630
*        HERE ON CALL FROM A DEV-TASK WHOSE DCB POINTER                 TIC12640
*        INDICATES IT IS SERVICING A MULTI-DROP STATION                 TIC12650
*                                                                       TIC12660
         #T#CLEAR  #DEV#ECB            CLEAR AND
         #T#GET,8,4 #MDL#TASK#ORDER
         AI,8     1                 INC MDL TASK SEQUENCING VALUE
         #T#PUT,8,4 #MDL#TASK#ORDER
         #T#GET,12 #DEV#RECORD#LENGTH L/REC SIZE
         CI,12    50                C/SIZE W/50; PREFER SMALL WRITES
         BLE      %+2               BLE; GIVE IT PRIORITY
         OR,8     =X'40000000'      SET LOW PRIO BIT
         #T#PUT,8 #MDL#TASK#ORDER   S/SEQUENCE VALUE FOR DEV-TASK
         #T#GWA,8  #DEV#ECB             POJNT TO THE
         #T#PUT,8  #DEV#EVENT#PTR        STATION'S ECB.
*
         #T#POST,#ARG,4 #MDL#WAKEUP#ECB WAKEUP THE MDL-TASK             TIC12680
         B         INITIATERETURN       THAT'S ALL                      TIC12690
*                                                                       TIC12700
INITIATEWRITEGETDCB RES 0              HERE ON NORMAL COURSE            TIC12710
         LW,5      *#DCB#TABLE#IW,4    GET LOCATION OF DCB              TIC12720
*                                                                       TIC12730
         #SNAP     'IN #INITIATE#WRITE#CODE'                            TIC12830
         BAL,#BAL  INITIATEDCBCHECK                                     TIC12840
*                                                                       TIC12850
         #T#GET,11 #DEV#RECORD#BA      GET RECORD BA.                   TIC12860
         LI,10     X'7FFFF'            COPY TO R10 THE                  TIC12870
         AND,10    11                   CLEAN BA OF THE RECORD          TIC12880
         SLS,10    -2                    AND MAKE IT A WA               TIC12890
         AND,11    =X'3'                  AND BYTE-IN-WORD.             TIC12900
*                                                                       TIC12910
         #T#GET,12 #DEV#RECORD#LENGTH  GET RECORD SIZE.                 TIC12920
*                                                                       TIC12930
         #T#GWA,9  #DEV#ECB            GET LOCATION OF AN ECB.          TIC12940
         #T#PUT,9  #DEV#EVENT#PTR      INDICATE WE'RE USING IT.         TIC12950
*                                                                       TIC12960
         LW,#ARG   =X'80000000'        SPECIAL ECB                      TIC13100
         STW,#ARG  *9                   CLEAN-UP.                       TIC13110
         M:WRITE   *5,(BUF,*10),(BTD,*11),(SIZE,*12),(ECB,*9)           TIC13120
         B         INITIATERETURN                                       TIC13130
         PAGE                                                           TIC13140
#INITIATE#WRITE#READ#CODE RES 0                                         TIC13150
         #PUSH,#BAL,15                 SAVE REGS LIKE ALL 'INITIATE'S   TIC13160
*                                                                       TIC13170
         #T#GET,8  #DEV#RECORD#STATUS  SEE IF OUTSTANDING ERROR.        TIC13180
         BNEZ      INITIATERETURN      DO NUTTIN IF SO.                 TIC13190
*
         BAL,15    INITIATEACQUIREDCHECK MAKE SURE STATION IS ACQUIRED.
*
         #T#GET,#ARG #DEV#RECORD#LENGTH IF NULL PROMPT,
         BEZ       INITIATEREAD200     GO DIRECTLY TO READ.
*                                                                       TIC13200
         LI,4      #CIO#REQD+#CIO#WRITE+#CIO#READ SET IN TABLE          TIC13210
         #T#PUT,4  #DEV#CURRENT#IO      WHAT WE ARE DOING               TIC13220
*                                                                       TIC13230
         B         INITIATEWRITE234    AND GO DO THE WRITE.             TIC13240
         PAGE                                                           TIC13250
#CHECK#CODE RES    0                                                    TIC13260
         #PUSH,4,15                                                     TIC13270
         #PUSH,#BAL,#BAL                                                TIC13280
*                                                                       TIC13290
         #T#GET,4 #DEV#DCB#POINTER  GET POINTER TO DCB POINTER
         LW,5     *#DCB#TABLE#IW,4  GET LOCATION OF DCB
         #T#GET,#ERR #DEV#RECORD#STATUS SEE IF THE I/O IS ALREADY BAD
         BNEZ     CHECKCODE230      B/ IF I/O NOT INITIATED
*
         AI,#DEV   0                   SEE IF STATION
         BLZ       %+3                  ON MULTI-POINT LINE.
         AI,4      0                     IF SO, DON'T DOOSTUFF
         BLZ       CHECKCODE345           DOME BY THE MDL-TASK.
*                                                                       TIC13350
         #T#GET,6  #DEV#EVENT#PTR      GET ECB LOCATION.                TIC13360
*                                                                       TIC13370
         M:CHECK   *5,(ECB,*6),(INDX,13),;
                   (ERR,COCLINEERR),(ABN,COCLINEABN)
CHECKCODE230 RES   0                                                    TIC13470
*                                                                       TIC13480
*        RELEASE CORE IF APPROPRIATE.  IT IS                            TIC13490
*        APPROPRIATE IF THE CORE IS 'DYNAMIC' AND                       TIC13500
*        WAS BEING USED FOR OUTPUT:                                     TIC13510
         #T#GET,#ARG #DEV#CURRENT#IO   GET I/O TYPE.                    TIC13520
        CI,#ARG   #CIO#WRITE          WAS IT A WRITE?                   TIC13530
         BAZ       CHECKDONTFREE       OVER IF NOT.                     TIC13540
         #FREE#DEV#BUFFER              OTHERWISE FREE ANY DYN. BUFFER.  TIC13550
CHECKDONTFREE RES  0                                                    TIC13560
*                                                                       TIC13570
         LW,12     4,5                                                  TIC13580
         SLS,12    -17                 RIGHT JUSTIFY 'ARS'.             TIC13590
         #T#PUT,12 #DEV#RECORD#LENGTH  STORE CHAR COUNT OF READ         TIC13600
*
CHECKCODE345 RES   0
CHECKCODEQUICKEXIT RES 0                                                TIC13620
         #SNAP     'IN #CHECK#CODE'                                     TIC13630
*                                                                       TIC13640
         #PULL,#BAL,#BAL                                                TIC13650
         STB,13    #BAL                COPY IND INTO #BAL FOR MDL       TIC13660
         #PULL,4,15                                                     TIC13670
         LI,#ERR   0                   CLEAR AND                        TIC13680
         #T#XCA,#ERR #DEV#RECORD#STATUS OBTAIN STATUS                   TIC13690
         BNEZ      CHECKCODEERRORRETURN OVER IF BAD.                    TIC13700
*                                                                       TIC13710
        #T#GET,#ARG #DEV#CURRENT#IO   GET I/O TYPE BITS.                TIC13720
        CI,#ARG   #CIO#REQD+#CIO#WRITE+#CIO#READ SE IF W-THEN-R.        TIC13730
        BNE       CHECKCODEGOODRETURN                                   TIC13740
*                                                                       TIC13750
*        FALL THRU ON POINT-TO-POINT WRITE-THEN-READ.                   TIC13760
*        (MULTI-POINT DOESN'T FALL THRU BECAUSE THE MDL-TASK            TIC13770
*        THAT DID THE I/O CHANGED #DEV#CURRENT#IO APPROPRIATELY.)       TIC13780
*                                                                       TIC13790
        AI,#BAL   -3                  PUSH RETURN REGISTER BACK TO      TIC13800
*                                      POINT TO THE START-1 OF          TIC13810
*                                       THE #CHECK PROC.                TIC13820
*                                                                       TIC13830
         B         #INITIATE#READ#CODE AND GO DO THE READ HALF.         TIC13840
*                                                                       TIC13850
*                                                                       TIC13860
*                                                                       TIC13870
CHECKCODEGOODRETURN RES 0                                               TIC13880
*
*        IF WE ARE PROCESSING MDL, MAKE
*        POSSIBLE CHECKS LATER, WHEN
*        DEV-TASK COMES THROUGGH HERE:
*
         AI,#DEV   0
         BLZ       CHECKCODEGOOD300
*
*        ONLY READS GET CHECKS HERE:
*
         #T#GET,#ARG #DEV#CURRENT#IO
         CI,#ARG   #CIO#READ
         BAZ       CHECKCODEGOOD300
*
*        IF 3270 STATION, CHECK FOR 3270 ATTN:
*
         DO        DO#3270
         #PUSH,#BAL,#BAL
         #EXU#ON#TYPE#INDEX
         B         CHECKCODEGOOD107    UNKNOWN.
         B         CHECKCODEGOOD107    OWN-CODE.
         B         CHECKCODEGOOD107    UNIT RECORD.
         B         CHECKCODEGOOD107    TTY.
         B         CHECKCODEGOOD103    3270.
CHECKCODEGOOD103 RES 0
         #T#GET,#ARG #DEV#RECORD#BA    START OF RECORD.
         LB,#ARG   0,#ARG              FIRST BYTE OF RECORD.
         CI,#ARG   X'6E'               PA2 IS ATTENTION.
         BE        CHECKCODEGOOD106    SIGNAL IF SO.
         CI,#ARG   X'6D'               CLEAR IS ATTENTION.
         BNE      CHECKCODEGOOD106E OVER IF NOT.
CHECKCODEGOOD106 RES 0
         SIGNALATTENTION
CHECKCODEGOOD106E RES 0
         #PULL,#BAL,#BAL
         B        CHECKCODEGOOD300
CHECKCODEGOOD107 RES 0
         #PULL,#BAL,#BAL
         FIN
*                                                                       TIC13890
*        BEFORE RETURNING TO CALLER, IF IT WAS A READ,                  TIC13900
*        WE MUST SCAN FOR UP-ARROWS:                                    TIC13910
*                                                                       TIC13920
         DO        DO#XMISSIONUPARROWS
         #PUSH,#BAL,8                  SINCE WE ALREADY PULLED OUR
*                                      REGISTERS FOR OUR EXIT, WE MUST  TIC13980
*                                      GO PUSH SOME TO GAIN BACK        TIC13990
*                                      REGISTERS TO WORK IN.            TIC14000
*                                                                       TIC14010
CHECKCODEGOOD110 RES 0                                                  TIC14020
*
         #T#GET,7  #DEV#RECORD#BA      DSP OF RECORD.
         AND,7     =X'7FFFF'           CLEAN BA OF RECORD.
*
CHECKCODEGOOD113 RES 0                 HERE TO CONTINUE UP-ARROW SCAN.
         #T#GET,8  #DEV#RECORD#LENGTH  GET NUMBER OF BYTES.             TIC14030
         AI,8      -2                  DON'T SCAN LAST TWO (SINCE THE   TIC14040
*                                       UP-ARROW SEQUENCES ARE THREE    TIC14050
*                                         CHARACTERS LONG).             TIC14060
         BLEZ      CHECKCODEGOOD190    IF NOT 3 BYTES, CAN'T BE SEQUENCETIC14070
*                                                                       TIC14080
         LW,6      TTBSUPARROW         TTBS WORD FOR UP-ARROW SEARCH.   TIC14120
*                                                                       TIC14130
CHECKCODEGOOD120 RES 0                                                  TIC14140
         #T#GET,8  #DEV#RECORD#BA      (CALCULATE LENGTH
         AND,8     =X'7FFFF'            OF STRING TO CHECK)
         #T#GET,#ARG #DEV#RECORD#LENGTH
         AW,8      #ARG
         SW,8      7
         AI,8      -2
         BLEZ      CHECKCODEGOOD190    (OVER IF NONE LEFT TO CHECK)
*
         TTBS678                       DO A (POSSIBLY LONG, MULTIPLE) TTTIC14150
         BCR,1     CHECKCODEGOOD190    OVER IF NONE / NO MORE.          TIC14160
*                                                                       TIC14170
         LW,5      7                   COPY BA OF UP-ARROW.             TIC14180
         AI,5      1                   TO NEXT CHARACTER.               TIC14190
         LB,4      0,5                 GET THAT CHARACTER.              TIC14200
         AI,5      1                   TO STILL NEXT CHARACTER.         TIC14210
         LB,5      0,5                 GET IT TOO.                      TIC14220
         SLS,4     8                   PUT THE TWO CHARACTERS           TIC14230
         OR,4      5                    TOGETHER FOR COMPARISON.        TIC14240
*                                                                       TIC14250
         LI,5      4                   COMPARE WITH FOUR HALFWORDS.     TIC14260
         CH,4      CHECKUPARROWGUYS,5  COMPARE.                         TIC14270
         BE        CHECKCODEGOOD150    OVER IF MATCH.                   TIC14280
         BDR,5     %-2                                                  TIC14290
*                                                                       TIC14300
*        FALL THROUGH ON NO MATCH.                                      TIC14310
*                                                                       TIC14320
         SLD,4     -8                  CREATE
         EOR,4     =X'F0'               HEX
         CI,4      X'F0'                 BYTE
         BAZ       %+2                    FROM
         AI,4      9-48                    NEXT
         STW,4     6                        TWO
         LI,4      0                         CHARS
         SLD,4     8                          WITHOUT
         EOR,4     =X'F0'                      CHECKING
         CI,4      X'F0'                        FOR
         BAZ       %+2                           ILLEGALS.
         AI,4      9-48
         SLS,6     4
         OR,6      4
*                                                                       TIC14340
         B         CHECKCODEGOOD172                                     TIC14350
*                                                                       TIC14360
*                                                                       TIC14370
*                                                                       TIC14380
CHECKCODEGOOD150 RES 0                 HERE ON FOUND MATCH WITH TABLE.  TIC14390
         B         %,5                                                  TIC14400
         B         CHECKCODEGOOD160    GO BREAK.                        TIC14410
         B         CHECKCODEGOOD160    GO BREAK.                        TIC14420
         B         CHECKCODEGOOD160    GO BREAK.                        TIC14430
         B         CHECKCODEGOOD170    GO INSERT NEW-LINE.              TIC14440
*                                                                       TIC14450
         BOUND     4                                                    TIC14460
CHECKUPARROWGUYS GEN,16 0                                               TIC14470
         GEN,16    'XX'                                                 TIC14480
         GEN,16    'AT'                                                 TIC14490
         GEN,16    'BK'                                                 TIC14500
         GEN,16    'NL'                                                 TIC14510
         BOUND     4                                                    TIC14520
*                                                                       TIC14530
*                                                                       TIC14540
*                                                                       TIC14550
CHECKCODEGOOD160 RES 0                 HERE ON UP-ARROW FOR ATTENTION.  TIC14560
         SIGNALATTENTION                                                TIC14570
*                                                                       TIC14590
*        MUST DELETE THE THREE-CHARACTER                                TIC14600
*        SEQUENCE FROM THE INPUT BUFFER.                                TIC14610
*                                                                       TIC14620
*        BA OF UP-ARROW IS IN R7.                                       TIC14630
*                                                                       TIC14640
*        R8 HAS (#CHARS AFTER UP-ARROW)-2.                              TIC14650
*                                                                       TIC14660
         LW,6      7                   'SOURCE' IS THREE                TIC14670
         AI,6      3                    PAST UP-ARROW.                  TIC14680
*                                                                       TIC14690
         LW,4      7                   REMEMBER IN R4 BA OF NEXT CHAR.
*
         LI,5      3                   COUNT OF KILLED CHARACTERS.
*
         B         CHECKCODEGOOD176    GO COMPACT THE RECORD.
*                                                                       TIC14770
CHECKCODEGOOD170 RES 0                 HERE TO INSERT A NEW-LINE.       TIC14780
         LI,6      X'15'               THE THING WE ARE TO INSERT       TIC14790
*                                                                       TIC14800
CHECKCODEGOOD172 RES 0                 HERE TO REPLACE SEQUENCE WITH RG.TIC14810
*                                                                       TIC14820
*                  BA OF UP-ARROW IS IN R7.                             TIC14830
*                                                                       TIC14840
*                  R8 HAS (#CHARS AFTER UP-ARROW)-2.                    TIC14850
*                                                                       TIC14860
         STB,6     0,7                 NEW CHAR OVER UP-ARROW.          TIC14870
*                                                                       TIC14880
         AI,7      1                   MOVE TO JUST PAST NEW CHAR.      TIC14890
*
         LW,4      7                   REMEMBER IN R4 BA OF NEXT CHAR.
*
         LW,6      7                   MOVE FROM JUST PAST              TIC14900
         AI,6      2                    THREE CHAR SEQUENCE.            TIC14910
*                                                                       TIC14920
         LI,5      2                   COUNT OF NET CHARACTERS LOST.
*
CHECKCODEGOOD176 RES 0
         #T#GET,8  #DEV#RECORD#BA      (CALCULATE LENGTH
         AND,8     =X'7FFFF'            OV STRING TO MOVE)
         #T#GET,#ARG #DEV#RECORD#LENGTH
         AW,8      #ARG
         SW,8      6
*
         MBS678                        COMPACT THE RECORD.              TIC14930
*                                                                       TIC14940
         #T#GET,8  #DEV#RECORD#LENGTH  THEN                             TIC14950
         SW,8      5                    SHORTEN
         #T#PUT,8  #DEV#RECORD#LENGTH    RECORD.                        TIC14970
*                                                                       TIC14980
         LW,7      4                   POINT TO NEXT CHAR TO DO.
         B         CHECKCODEGOOD113    AND CONTINUE SCAN.
*                                                                       TIC15030
CHECKCODEGOOD190 RES 0                                                  TIC15040
         #PULL,#BAL,8                  RESTORE UP-ARROW WORKING REGS.
CHECKCODEGOOD200 RES 0                                                  TIC15060
         FIN
*
CHECKCODEGOOD300 RES 0                                                  TIC15070
        LI,#ARG   0                   INDICATE NO I/O HAPPENING.        TIC15080
        #T#PUT,#ARG #DEV#CURRENT#IO    IN THE TABLE.                    TIC15090
        LI,#ARG   0                   RE-SSTABLISH NO ERRORS (IN CC TOO TIC15100
         B         *#BAL               AND RETURN.                      TIC15110
*                                                                       TIC15120
*                                                                       TIC15130
*                                                                       TIC15140
CHECKCODEERRORRETURN RES 0                                              TIC15150
         DO        DO#ARESNAPS
         CI,#ARG   X'5906'             SPECIAL TEST FOR PERFECTLY
         BNE       %+3                  O.K. MOC 'ERROR' RETURN
         AI,#ARG   0                     SO WE DON'T CLUTTER
         B         0,#BAL                 UP THE TIC'S LO.
         FIN
*
         #SNAP,1   'IN #CHECK#CODE WITH AN ERROR'                       TIC15160
         AI,#ERR   0                   RESTORE THE CC                   TIC15170
         B         0,#BAL              AND RETURN TO CALLER             TIC15180
         PAGE                                                           TIC15190
*
*        SPECIAL CODE HERE TO CHECK AND SEE IF THE DCB                  TIC15200
*        IS OPEN, SINCE THAT FACT IS NOT REPORTED BACK                  TIC15210
*        TO ANY ERR/ABN EXIT:                                           TIC15220
*
INITIATEDCBCHECK RES 0                                                  TIC15230
         LW,#ARG   0,5                 OBTAIN DCB BIT WORD.             TIC15240
         CW,#ARG   =X'00200000'        IS THE DCB OPEN?                 TIC15250
         BAZ       INITIATEERROR       OUT IF NOT                       TIC15260
         B         0,#BAL              OK: BACK TO INITIATE SOMETHING   TIC15270
*
*        CODE TO ERROR ATTEMPTED I/O IF
*        THE STATION IS UNACQUIRED.
*
INITIATEACQUIREDCHECK RES 0
         #T#GET,#ARG #DEV#LINE#STATUS#BITS
         CI,#ARG   #LINE#UNACQUIRED    SEE IF ACQUIRED.
         BAZ       *15                 CONTINUE IF ACQUIRED.
*
*        FALL THRU TO GIVE X'01FF' ERROR ON UNACQUIRED.
*                                                                       TIC15280
INITIATEERROR RES  0                                                    TIC15290
         LI,#ARG   X'1FF'              DCB-NOT-OPEN 'CODE'
         #T#PUT,#ARG #DEV#RECORD#STATUS INTO STATUS WORD.
*                                                                       TIC15330
         LI,#ERR   0                   SET THE WHOLE I/O AS COMPLETE    TIC15340
         #T#PUT,#ERR #DEV#EVENT#PTR    BY SETTING THE WAIT-ECB POINTER  TIC15350
*                                                                       TIC15360
         B         INITIATERETURN                                       TIC15370
         PAGE                                                           TIC15380
*        CODE HERE HANDLES THE 'WAIT' PROCS.  THEY ARE                  TIC15390
*        JUST LIKE THE 'GOTO' PROCS FOLLOWED BY AN 'EXIT'.              TIC15400
*                                                                       TIC15410
#WAIT#ON#DEVICE#CODE RES 0
         #T#GET,#ARG #DEV#EVENT#PTR OBTAIN EVENT POINTER
#WAIT#ON#CODE RES  0                                                    TIC15420
         LC       *#ARG             L/ECB BITS
         BCS,12   1,#BAL            B/ECB POSTED OR WAITING; SKIP NONSENSE
         #PUSH,#BAL,15                 SAVE REGS SAME AS GOTO'S DO.     TIC15430
         #PUSH,#ARG,#ARG               SPECIAL #ARG SAVE FOR GETMAINBLOCTIC15440
*                                                                       TIC15450
         LW,10     #BAL                 GET ULTIMATE RETURN POINTER.    TIC15460
         AI,10     1                   BUMP PAST BAL-TO-EXIT IN PROC.   TIC15470
         LW,11     #ARG                COPY THE EVENT POINTER.          TIC15480
*                                                                       TIC15490
         B         GOTOONCODEMAIN      AND JOIN NORMAL GOTO PROCESSING  TIC15500
         PAGE                                                           TIC15630
#GO#TO#ON#CODE RES 0                                                    TIC15640
         #PUSH,#BAL,15                 SAVE A LOT OF REGISTERS.         TIC15650
         #PUSH,#ARG,#ARG               SPECIAL #ARG SAVE FOR GETMAINBLOCTIC15660
*                                                                       TIC15670
         STD,4     10                  COPY ARGS FAR OUT OF THE WAY.    TIC15680
         B         GOTOONCODEMAIN                                       TIC15690
*                                                                       TIC15700
*                                                                       TIC15710
#GO#TO#ON#CODE#B RES 0                 HERE ON PROC WITH ARGUMENTS      TIC15720
         AI,#BAL   2                   ADJUST TO RETURN PAST ARGS.      TIC15730
         #PUSH,#BAL,15                 SAVE A LOT OF REGISTERS.         TIC15740
         #PUSH,#ARG,#ARG               SPECIAL #ARG SAVE FOR GETMAINBLOCTIC15750
         LW,10     -2,#BAL             GET FIRST ARGUMENT.              TIC15760
         LW,11     -1,#BAL             GET SECOND ARGUMENT.             TIC15770
*                                                                       TIC15780
*                                                                       TIC15790
GOTOONCODEMAIN RES 0                                                    TIC15800
         LI,5      (#TWCE#LENGTH+1)/2  DOUBLEWORDS IN TWCE.             TIC15810
*                                                                       TIC15820
         BAL,#BAL  #FIND#DWS           GET 'TWCE' WORTH OF WORDS.       TIC15830
*                                                                       TIC15840
         AI,4      0                   SEE IF WE GOT SPACE.             TIC15850
         BEZ       -1                  ABORT IF NOT.                 ***TIC15860
*                                                                       TIC15870
         LW,#ARG   4                   GET THE (DA) ADDRESS OF THE SPACETIC15880
         SLS,#ARG  1                   DA TO WA.                        TIC15890
         STW,10    #TWCE#LOCATION,#ARG SAVE LOCATION ARG.               TIC15900
         STW,11    #TWCE#ECW,#ARG      SAVE EVENT POINTER ARG.          TIC15910
*                                                                       TIC15920
         #PULL,6,6                     RELOAD SPECIAL SAVED #ARG.       TIC15930
         STW,6     #TWCE#REGISTERS+#ARG,#ARG AND REMEMBER IT.           TIC15940
         #PULL,#BAL,15                 RELOAD THE OTHER REGISTERS.      TIC15950
         LCI       #ARG-0              REMEMBER REGISTERS               TIC15960
         STM,0     #TWCE#REGISTERS+0,#ARG BELOW #ARG.                   TIC15970
         LCI       15-#ARG             REMEMBER REGISTERS               TIC15980
         STM,#ARG+1 #TWCE#REGISTERS+#ARG+1,#ARG ABOVE #ARG.             TIC15990
*                                                                       TIC16000
         LW,6      #TIC#WAIT#CHAIN     NOW CHAIN THIS ENTRY             TIC16010
         STW,6     #TWCE#FLINK,#ARG     ONTO THE CHAIN OF               TIC16020
         STW,#ARG  #TIC#WAIT#CHAIN       WAITING TIC-TASKS.             TIC16030
*                                                                       TIC16040
*        (NOTE THAT THE NEW ENTRY IS PLACED                             TIC16050
*        AT THE FRONT OF THE TWCE CHAIN)                                TIC16060
*                                                                       TIC16070
         LW,6      6+#TWCE#REGISTERS,#ARG RESTORE REGISTER SIX.         TIC16080
         B         0,#BAL              AND RETURN TO CALLER             TIC16090
         PAGE
*
*
*
FIELD6789LOADAAAACODE RES 0
*
         BAL,#ARG  FIELD6789PREFIX     MAYBE SKIP LEADING BYTES.
*
         LI,8      0                   CLEAR ANSWER REGISTER.
*
         OR,#BAL   =X'04000000'        LOOP COUNT INTO HOB OF #BAL.
*
FIELD6789LOADAAAALOOP RES 0
         CW,6      7                   GET
         BGE       1,#BAL               A
         LB,9      0,6                   CHAR.
         CI,9      ' '                 DONE IF
         BE        1,#BAL               A BLANK.
*
         CI,9      X'6A'               SEE IF UP ARROW.
         BNE       FIELD6789LOADAAAANORM OVER IF NOT.
         AI,6      2                   SEE IF TWO CHARS PAST
         CW,6      7                    THE UP-ARROW AND
         BGE       0,#BAL                SAY NO FIELD IF NOT.
         AI,6      -1
         LB,9      0,6                 COMBINE
         EOR,9     =X'F0'               CHARS
         CI,9      X'F0'                 TO
         BAZ       %+2                    MAKE
         AI,9      9-48                    HEX
         SLS,8     4                        GUY.
         OR,8      9
         AI,6      1
         LB,9      0,6
         EOR,9     =X'F0'
         CI,9      X'F0'
         BAZ       %+2
         AI,9      9-48
         SLS,8     4
         OR,8      9
         B         %+3
*
FIELD6789LOADAAAANORM RES 0
         SLS,8     8                   OR IN NORMAL
         OR,8      9                    CHARACTER.
         AI,6      1
*
         SW,#BAL   =X'01000000'        END OF FOUR
         CW,#BAL   =X'0F000000'         CHARACTER
         BANZ      FIELD6789LOADAAAALOOP LOOP.
*
         B         %+2
*
         AI,6      1
         CW,6      7                   AND SKIP
         BGE       1,#BAL               TRAILING
         LB,9      0,6                   NON-BLANKS
         CI,9      ' '                    ON EXIT.
         BNE       %-5
*
         B         1,#BAL
         PAGE
*
*
*
FIELD6789LOADAAAAAAAACODE RES 0
*
         BAL,#ARG  FIELD6789PREFIX     MAYBE SKIP LEADING BYTES.
         LW,#ARG   9                   (THIS ROUTINE WORKS WITH #ARG)
*
         LI,8      0
         LI,9      0
         B         FIELD6789LOADAAAAAAAATERM
*
FIELD6789LOADAAAAAAAALOOP RES 0
         CW,8      =X'FF000000'
         BANZ      FIELD6789LOADAAAAAAAAORED
*
         CI,#ARG   X'6A'
         BNE       FIELD6789LOADAAAAAAAANORM
*
         AI,6      2
         CW,6      7
         BGE       0,#BAL
         AI,6      -1
         LB,#ARG   0,6
         EOR,#ARG  =X'F0'
         CI,#ARG   X'F0'
         BAZ       %+2
         AI,#ARG   9-48
         SLD,8     4
         OR,9      #ARG
         AI,6      1
         LB,#ARG   0,6
         EOR,#ARG  =X'F0'
         CI,#ARG   X'F0'
         BAZ       %+2
         AI,#ARG   9-48
         SLD,8     4
         OR,9      #ARG
         B         FIELD6789LOADAAAAAAAAORED
*
FIELD6789LOADAAAAAAAANORM RES 0
         SLD,8     8
         OR,9      #ARG
FIELD6789LOADAAAAAAAAORED RES 0
         AI,6      1
         CW,6      7
         BGE       FIELD6789LOADAAAAAAAADONE
*
         LB,#ARG   0,6
FIELD6789LOADAAAAAAAATERM RES 0
         CI,#ARG   ' '
         BE        FIELD6789LOADAAAAAAAADONE
         CI,#ARG   X'0D'
         BE        FIELD6789LOADAAAAAAAADONE
         CI,#ARG   X'15'
         BNE       FIELD6789LOADAAAAAAAALOOP
*
FIELD6789LOADAAAAAAAADONE RES 0
         AI,9      0                   IF R9 STILL ZERO, WE
         BEZ       0,#BAL               HIT IMMEDIATE TERMINATOR.
         CW,8      =X'FF000000'
         BANZ      1,#BAL
*
         SLD,8     8
         OR,9      =X'40'
         B         %-4
         PAGE
*
*
*
FIELD6789POINTTOSTRINGCODE RES 0
*
         BAL,#ARG  FIELD6789PREFIX     MAYBE SKIP LEADING BYTES.
*
         LW,8      6
*
FIELD6789POINTTOSTRINGTEST RES 0
         CI,9      ''''
         BNE       FIELD6789POINTTOSTRINGNORM
*
         AI,6      1                   HERE WHEN QUOTE ENCOUNTERED.
         CW,6      7                   WE SCAN UP TO
         BGE       0,#BAL               THE NEXT QUOTE.
         LB,9      0,6                   (BAD STRING IF NO QUOTE)
         CI,9      ''''
         BNE       %-5
         B         FIELD6789POINTTOSTRINGBUMP
*
FIELD6789POINTTOSTRINGNORM RES 0
         CI,9      ' '
         BE        FIELD6789POINTTOSTRINGGOOD
         CI,9      X'15'
         BE        FIELD6789POINTTOSTRINGGOOD
         CI,9      X'0D'
         BE        FIELD6789POINTTOSTRINGGOOD
*
FIELD6789POINTTOSTRINGBUMP RES 0
         AI,6      1                   BUMP TO NEXT CHAR.
         CW,6      7                   SEE IF STILL IN THE STRING.
         BGE       FIELD6789POINTTOSTRINGGOOD OVER IF NOT.
*
         LB,9      0,6                 GET THE NEXT CHAR IN THE STRING.
         B         FIELD6789POINTTOSTRINGTEST AND GO SEE ABOUT IT.
*
FIELD6789POINTTOSTRINGGOOD RES 0       HERE WHEN DELIMITER FOUND.
         LW,9      6                   COMPUTE FIELD
         SW,9      8                    LENGTH IN R9.
         BEZ       0,#BAL              (BAD EXIT ON IMMEDIATE DELIMINATO
         B         1,#BAL                AND TAKE GOOD EXIT.
*
*
*
FIELD6789PREFIX RES 0                  EACH 'FIELD6789...' BALS HERE ...
         CW,6      7                   NO FIELD EXIT (FROM PARENT ROUTIN
         BGE       0,#BAL               IF OFF END.
*
         LB,9      0,6                 SKIP
         CI,9      X'11'                ANY
         BNE       %+3                   FIELD
         AI,6      3                      DEFINER.
         B         FIELD6789PREFIX
*
         CI,9      ' '                 AND
         BNE       0,#ARG               SKIP
         AI,6      1                     BLANKS.
         B         FIELD6789PREFIX
         PAGE
*
*        CODE REACHED VIA THE SIGNALATTENTION PROC:
*
SIGNALATTENTIONCODE RES 0
         #PUSH,7,11                    SAVE SOME REGISTERS.
         LW,7      #DEV                COPY TASK-NUMBER OF TASK
*                                       TO SIGNAL ATTENTION TO.
         B         SIGNALATTENTIONMAINLINE
*
SIGNALATTENTIONCODECFTWO RES 0
         #PUSH,7,11                    SAVE SOME REGISTERS.
         LW,7      #ARG                COPY THE TASK-NUMBER OF THE TASK
*                                       THAT WE ARE SIGNALING ATTENTION.
*
SIGNALATTENTIONMAINLINE RES 0
         LW,11     #BAL                SAVE RETURN REGISTER.
*
         #T#GET,8,7 #DEV#LINE#STATUS#BITS GET STATUS INFO.
         OR,8      =#LINE#ATTENTION    INDICATE ATTENTION.
         #T#PUT,8,7 #DEV#LINE#STATUS#BITS AND RE-TABLE STATUS INFO.
*
         CI,8      #LINE#AWAITING#ATTENTION SEE IF TASK WAITING FOR ATTN
         BAZ       SIGNALATTENTION2235 OVER IF NOT.
         AND,8     =(-#LINE#AWAITING#ATTENTION-1) IF WAS WAITING FOR
         #T#PUT,8,7 #DEV#LINE#STATUS#BITS ATTN, CLEAR FLAG AND
         #T#POST,9,7 #DEV#ECB          POST HIS ECB TO AWAKE HIM.
*
SIGNALATTENTION2235 RES 0
         CI,8      #LINE#AWAITING#REPORT SEE IF TASK AWAITING REPORT.
         BAZ       SIGNALATTENTION4900 DONE IF NOT.
*
         #T#GET,9,7 #DEV#GET#LIST#ID   WAS AWAITING REPORT, SO PURGE
         BEZ      SIGNALATTENTION4900 B/NO LIST ID
         #SNAP,26 'DOING AN M:QUEUE/PURGE *R9'
         M:QUEUE   *9,PURGE            HIS LIST TO END THAT WAIT.
         #QCHK    SIGNALATTENTION2445,;   GOOD
                  SIGNALATTENTION4900,;   WAIT
                  SIGNALATTENTION4900     INTERRUPTED
         B         SIGNALATTENTION4900
SIGNALATTENTION2445 RES 0
         LI,8      0                   ON GOOD PURGE, INDICATE
         #T#PUT,8,7 #DEV#GET#LIST#ID   NO MORE LIST FOR THIS TASK.
*
SIGNALATTENTION4900 RES 0
         LW,#BAL   11                  RESTORE BAL REGISTER.
         #PULL,7,11                    RESTORE CLALER'S REGISTERS.
         B         *#BAL               AND RETURN.
         PAGE
*
*        MOVES C(R8) CHARACTERS FROM C(R6) TO C(R7).
*        BAL'ED TO ON #BAL.
*
         AI,8      -255
         OR,7      =255*256*256*256
         MBS,6     0
MBS678CODE CI,8    255
         BG        %-4
         STB,8     7
         MBS,6     0
         B         *#BAL
         DO       DO#DEV#RECORD#BA#PUT#CHECK
*
*        #DEV#RECORD#BA FOUND NON-ZERO ON A #T#PUT
*                 SNAP AND THEN ABORT THE TIC
*
LOST#BUF EQU      %
         #SNAP,31 '#DEV#RECORD#BA FOUND NON-ZERO ON #T#PUT'
         M:XXX                      ABORT THE TIC
         FIN
         TITLE     'TIC - ABORT TASK'
*                                                                       TIC24800
*                                                                       TIC24810
*                                                                       TIC24820
ABORTCODE RES      0                                                    TIC24830
         LW,8      #DEV                COPY WHO AND WHERE TO R8
         LW,9      #BAL                 AND R9 AND TELL OPERATOR:
*O*  MESSAGE:     'ABORTING DEV-TASK - NUMBER AND LOCATION:'
*O*  ACTION:      CHECK ACTIVITY FOR LOGICAL DEVICE NO. IN R8.
*O*  MEANING:     TIC-TASK OR NUCLEUS OF TIC HAS DETECTED MACHINE
*O*               ERROR OR TIC LOGIC ERROR.
         #TYPE89   'ABORTING DEV-TASK - NUMBER AND LOCATION:'
         DEF      SCABORT           SUPER-CLOSE IN #ABORT
SCABORT  M:SUPCLS                   CLOSE SYMBIONT FILES
*                                                                       TIC24850
         CW,#DEV   #CURRENT#PROCESS#DEV MAKE SURE CORRECT TIC-TASK.     TIC24860
         BNE       -1                  IF NOT, WE'RE REALLY LOST.
*                                                                       TIC24880
         MTW,-1    ABORTCOUNT          SEE IF TOO MANY TIMES HERE       TIC24890
         BLEZ      -1                  TRUE ABORT IF SO.
*                                                                       TIC24910
         #EXIT                                                          TIC24920
*                                                                       TIC24950
*                                                                       TIC24960
*                                                                       TIC24970
*        THE #EXIT PROCEDURE RETURNS CONTROL TO THE                     TIC16110
*        TIC 'DISPATCHER' ENDING THE CURRENT INVOKATION                 TIC16120
*        OF THE TIC-TASK.                                               TIC16130
#EXIT#CODE RES     0                                                    TIC16140
         LI,#DEV   0                   SET NO-ONE RUNNING               TIC16150
         STW,#DEV  #CURRENT#PROCESS#DEV AND SET INTO LOCAL STORAGE      TIC16160
DISPATCHER RES     0                                                    TIC16170
*                                                                       TIC16180
*        FOLLOW THE WAIT CHAIN TO FIND                                  TIC16190
*        SOMETHING FOR THE TIC TO DO:                                   TIC16200
*                                                                       TIC16210
*        (THE CODE IMMEDIATELY BELOW WILL FAIL                          TIC16220
*        IF THE FORWARD POINTER IN EACH TWCE ENTRY                      TIC16230
*        IS NOT THE FIRST WORD OF THE ENTRY.  SO:)                      TIC16240
         ERROR,1,#TWCE#FLINK>0 'BAD TWCE FLINK POINTER'                 TIC16250
*                                                                       TIC16260
*                                                                       TIC16270
*                                                                       TIC16280
*        WE SCAN DOWN THE ENTIRE CHAIN OF PROCESSES                     TIC16290
*        THAT ARE WAITING, AND FOR ALL THAT HAVE THEIR EVENT            TIC16300
*        POSTED, MARK WHEM BY ZEROING OUT THE ECB POINTER.              TIC16310
*        WE DO THIS SO THAT SEVERAL TASKS CAN WAIT ON                   TIC16320
*        ONE ECB.  WITHOUT THIS MARKING, IF TASKS A AND B               TIC16330
*        WERE BOTH WAITING ON THE SAVE ECB (OF OURS) WE                 TIC16340
*        WOULD GET INTO THE FOLLOWING PROBLEM:  TASK A                  TIC16350
*        AND TASK B ARE WAITING; THE EVENT OCCURS; TASK                 TIC16360
*        A IS ACTIVATED AND RUNS AND RESETS THE ECB; TASK               TIC16370
*        A RETURNS TO DISPATCHER; DISPATCHER LOOKS AND                  TIC16380
*        FINDS IT SHOULDN'T RUN TASK B.                                 TIC16390
*                                                                       TIC16400
         LI,9      0                   A ZERO FOR ZEROING BELOW         TIC16410
         LI,6      #TIC#WAIT#CHAIN     SET OT SCAN CHAIN                TIC16420
SCANCHAIN RES      0                                                    TIC16430
         LW,6      #TWCE#FLINK,6       GET A CHAIN ENTRY                TIC16440
         BEZ       SCANDONE            OVER IF AT END OF CHAIN          TIC16450
         LW,7      #TWCE#ECW,6         GET EVENT POINTER                TIC16460
         CI,7      X'1FFFF'            IS IT ALREADY ZERO               TIC16470
         BAZ       SCANCHAIN           YES, PROCESS NEXT                TIC16480
         LW,8      0,7                 NO, GET THE ECB                  TIC16490
         BGEZ      SCANCHAIN           BACK IF NOT POSTED.              TIC16500
         STW,9     #TWCE#ECW,6         YES, ZERO ECW POINTER            TIC16510
         B         SCANCHAIN           AND BACK                         TIC16520
SCANDONE RES       0                                                    TIC16530
*                                                                       TIC16540
*                                                                       TIC16550
*                                                                       TIC16560
         LI,6      #TIC#WAIT#CHAIN     SET TO START THE CHAIN           TIC16570
AGAINCHAIN RES     0                                                    TIC16580
         LW,5      6                   REMEMBER POINTER TO THIS ENTRY   TIC16590
         LW,6      #TWCE#FLINK,6       GET A CHAIN ENTRY                TIC16600
         BEZ       MUSTWAIT            OUT IF AT END                    TIC16610
*                                                                       TIC16620
         LW,7      #TWCE#ECW,6         GET EVENT POINTER OF ENTRY       TIC16630
         CI,7      X'1FFFF'            IS POINTER ZERO; IF SO THE       TIC16640
         BAZ       SOMETHINGTODO       EVENT HAS HAPPENED (BY DEFINE)   TIC16650
*                                                                       TIC16660
         LW,8      0,7                 OTHERWISE, GET THE ECB           TIC16670
         CW,8      =X'40000000'        SEE IF IT IS SET TO HAPPENED     TIC16680
         BANZ      SOMETHINGTODO       IF SO, GO DO IT                  TIC16690
*                                                                       TIC16700
         B         AGAINCHAIN                                           TIC16710
*                                                                       TIC16720
MUSTWAIT RES       0                                                    TIC16730
DISPCREATEMWAIT RES 0                                                   TIC16820
         LI,10     0                   TO COUNT ECBS IN                 TIC16830
         LI,11     0                   TO COUNT DEV-TASK ECBS IN.
         LI,6      #TIC#WAIT#CHAIN     SCAN DOWN THE CHAIN              TIC16840
DISPCOUNTNEXT LW,6 #TWCE#FLINK,6        AND JUST COUNT TO SEE           TIC16850
         BEZ       DISPCOUNTED           HOW MANY ECBS WE WILL          TIC16860
*
         AI,10     1                   YES: COUNT IT                    TIC16870
*
         MTW,0     #TWCE#REGISTERS+#DEV,6 SEE IF A DEV-TASK.
         BLEZ      DISPCOUNTNEXT       COUNTINUE ECB COUNT IF NOT.
         AI,11     1                   OR BUMP DEV-TASK COUNT
         B         DISPCOUNTNEXT        AND CONTINUE COUNTING           TIC16880
*                                                                       TIC16890
*                                      WHEN WE GET HERE WE HAVE         TIC16900
*                                      A COUNT OF HOW MANY ECBS         TIC16910
*                                      WE WILL BE WAITING ON IN R10.    TIC16920
DISPCOUNTED RES    0                                                    TIC16960
         AI,11     0                   SEE IF ANY DEV-TASKS.
         BGZ       DISPCOUNTEDSOME     OVER IF ARE SOME
         #SNAP,10  'ABOUT TO M:EXIT'   IF NOT, EVERYONE X'ED.
         M:EXIT                        SO TIC IS DONE.
*
DISPCOUNTEDSOME RES 0
         CW,10     ECBLISTMAXSIZE      SEE IF SOMEHOW TOO MANY
         BG        -1                  ABORT IF SO.
*
         LW,5      ECBLISTWA           GET WHERE TO PUT ECB POINTERS.
*                                                                       TIC16980
*                                      HAVING GOTTEN THE SPACE, WE      TIC16990
*                                      RE-SCAN THE CHAIN AND PUT        TIC17000
*                                      THE ECB POINTERS INTO            TIC17010
*                                      THE SPACE:                       TIC17020
*                                                                       TIC17030
         LW,4      5                   PTR TO WHERE ECB PTRS GO         TIC17040
         LI,6      #TIC#WAIT#CHAIN     START                            TIC17050
DISPCREATENEXT LW,6 #TWCE#FLINK,6       DOWN                            TIC17060
         BEZ       DISPCREATED           CHAIN                          TIC17070
         LW,7      #TWCE#ECW,6         GET ECB POINTER                  TIC17080
         STW,7     0,4                 STORE XOS ECB PTR INTO LIST      TIC17090
         AI,4      1                   BUMP THE LIST POINTER            TIC17100
         B         DISPCREATENEXT                                       TIC17110
*
*
*
DISPCREATED RES    0                                                    TIC17120
         DEF      TIC#WAIT#TIME     SLEEP TIME FOR M:CHECKECB
,FPCE    M:CHECKECB (ECBL,*5,*10),(TIME,4)
TIC#WAIT#TIME EQU FPCE+2
*
*
*
*        FALL THRU AND ATTEMPT SPECIAL ACQUIRING OF
*        LINES THAT ARE SWITCHABLE BETWEEN TIMESHARING AND TP:
*
         LW,4     #BIGGEST#TIC#TASK
DISPTS200 RES      0
         #T#GET,10,4 #DEV#LINE#STATUS#BITS
         CI,10     #LINE#UNACQUIRED
         BAZ       DISPTS400
         CI,10     #LINE#SWITCHABLE    IS LINE SPECIFIED AS SWITCHED
         BAZ       DISPTS400            NO SWITCH IF NOT.
         CI,10     #LINE#SWITCH#DONT   HAS LINE BEEN FREED
         BANZ      DISPTS400            NO SWITCH IF SO.
*
         #T#GWA,9,4 #DEV#LINE#IDENTIFIER
         M:GETLINE  *9
         BCR,8     DISPTS400
         #T#GET,5,4  #DEV#DCB#POINTER
         LW,8     *#DCB#TABLE#IW,5
         M:OPEN    *8,(LINE,*9),(ERR,DISPTS380),(ABN,DISPTS380)
         M:SETDCB *8,(ERR,COCLINEERR),(ABN,COCLINEABN)
         #SNAP,24 'DOING AN M:PURGE *R8'
         M:PURGE  *8                CLEAR OUT ANY TYPE-AHEAD.
*
         AND,10    =(-#LINE#UNACQUIRED-1)
         #T#PUT,10,4 #DEV#LINE#STATUS#BITS
         B         DISPTS400
*
DISPTS380 RES      0
         M:RLSLINE *9
DISPTS400 BDR,4    DISPTS200
         #POST#ECB #TIMESUP#ECB        (TO AWAKE INDEFINITE WAITERS)
         B         DISPATCHER                                           TIC17150
         PAGE                                                           TIC17180
*                                                                       TIC17190
*                                                                       TIC17200
*                                                                       TIC17210
SOMETHINGTODO RES  0                                                    TIC17220
         LW,9      #TWCE#FLINK,6        MOVE FORWARD POINTER TO         TIC17230
         STW,9     #TWCE#FLINK,5        POINT AROUND THIS ENTRY         TIC17240
*                                                                       TIC17250
         #PUSH,6,6                     SAVE ENTRY POINTER               TIC17260
         LCI       0                   RESTORE ALL THE                  TIC17270
         LM,0      #TWCE#REGISTERS,6    QUEUED REGISTERS                TIC17280
*
         #PULL,#BAL,#BAL               RETRIEVE ENTRY POINTER (INTO #BAL
         #PUSH,#ARG,#ARG               REMEMBER TASK'S #ARG.
         LW,#ARG   #BAL                COPY POINTER TO #ARG.
         LW,#BAL   #TWCE#LOCATION,#ARG RETRIEVE WHERE TO GO TO.
*
         #SNAP     'IN DISPATCHER AT SOMETHINGTODO'                     TIC17320
*                                                                       TIC17330
         #PUSH,0,15                    SAVE REGS (INCLUDING BAD #ARG)
         LW,4      #ERR                COPY ADDRESS OF SPACE.           TIC17350
         SLS,4     -1                  (WA TO DA)                       TIC17360
         LI,5      (#TWCE#LENGTH+1)/2  HOW MANY DW WE GOT.              TIC17370
         BAL,#BAL  #HIDE#DWS           RETURN THAT MANY.                TIC17380
*
         #PULL,0,15                    RESTORE REGS (INCLUDING BAD #ARG)
         #PULL,#ARG,#ARG               RESTORE TASK'S #ARG.
*                                                                       TIC17400
         STW,#DEV  #CURRENT#PROCESS#DEV REMEMBER WHO IS RUNNING         TIC17410
         B         0,#BAL              BRANCH TO WHERE WE SHOULD        TIC17420
*                                                                       TIC20820
COCLINEERR RES     0                                                    TIC20850
COCLINEABN RES     0                                                    TIC20860
MOCLINEERR RES     0                                                    TIC20870
MOCLINEABN RES     0                                                    TIC20880
*                                                                       TIC20890
         CW,#DEV   #CURRENT#PROCESS#DEV SEE IF #DEV IS VALID            TIC20900
         BNE       %                   ABORT TIC IF NOT.
*                                                                       TIC20930
         #T#GET,9  #DEV#RECORD#STATUS  SEE IF PREVIOUS ERROR.           TIC20940
         BNEZ      TAMABNRETURN         OVER IF SO                      TIC20950
*                                                                       TIC20960
         LW,9      10                  COPY SUB-CODE
         SLS,9     8                   ALIGN SUB-CODE
         SLS,9     -9                   INTO SECOND BYTE.
         SCS,10    8                   COPY CODE
         STB,10    9                    INTO FIRST BYTE.
         SCS,10    24                    (AND RESTORE R10)
         SLS,9     -16                 RIGHT JUSTIFY.
         #T#PUT,9  #DEV#RECORD#STATUS   AND STORE IT.
*                                                                       TIC20990
TAMABNRETURN RES   0                                                    TIC21000
         B         *8                  AND BACK.                        TIC21010
         TITLE     'TIC - MULTI-POINT LINE TASK'
         BOUND    8
SEGNAMES TEXT     'PATCH'
         TEXT     'TICROOT'
         TEXT     'TICINIT'
         TEXT     'TICKEYIN'
         TEXT     'TICLABOR'
*
SEGADRS  DATA     PATCH
         DATA     RP
         DATA     IP
         DATA     KP
         DATA     LP
#TIC#START RES    0
         M:SEGLD  'TICINIT'
         M:TRAP   (IGNORE,FX)       IGNORE FIXED POINT ARITH TRAPS (3270)
         LI,8     2                 L/TICINIT SEG INDEX
         STW,8    SEG#              S/CURRENT SEG INDEX
         B        #TIC#INITIALIZE
#TIC#BEGIN  RES   0
         MTW,-1    TICINTOPERATORLATER ALLOW OPERATOR INTERRUPTIONS.
*
         M:SEGLD  'TICLABOR'
         LI,8     4                 L/TICLABOR SEG INDEX
         STW,8    SEG#              S/CURRENT SEG INDEX
         B        #BEGIN
*                                                                       TIC23820
#TIC#INT RES      0
         LW,7      1                   COPY POINTER TO THE PDD.         TIC23850
         LW,2      *0                  GET CURRENT STACK POINTER.       TIC23860
         LW,8      0,2                 AND GET -1 OR LINEID FROM END.   TIC23870
         CI,8      -1                  SEE IF -1 = OPERATOR INTERRUPT.  TIC23880
         BNE      TICINT203
*
*
*
*        HERE ON OPERATOR INTERRUPT ...
*
         MTW,0    TICINTOPERATORLATER  SEE IF TOO EARLY FOR REENTRANCE.
         BEZ      #TIC#INT4         OVER IF NOT.
         M:TYPE   (MESS,LATER)      TELL 'EM TO TRY LATER.
         M:TRTN                     AND GET OUT OF THIS TRAP-TIME.
#TIC#INT4 RES     0
         M:SEGLD  'TICKEYIN'
         LI,8     3                 L/TICKEYIN SEG INDEX
         STW,8    SEG#              S/CURRENT SEG INDEX
         B        OPERATORPROMPT    GO TO TICKEYIN.
LATER    TEXTC    'LATER'
SGLDTRTN RES      0
         M:SEGLD  'TICLABOR'
         LI,8     4                 L/TICLABOR SEG INDEX
         STW,8    SEG#              S/CURRENT SEG INDEX
         M:TRTN
*                                                                       TIC23900
*                                                                       TIC23910
*                                                                       TIC23920
*        HERE ON SLAVE LINE BREAK ...
*
*        HAVE LINEID IN R8.                                             TIC23930
*        SCAN TO SEE WHICH DEV-TASK TO GIVE ATTENTION TO.               TIC23940
*                                                                       TIC23950
TICINT203 RES     0
         LW,#DEV   #BIGGEST#TIC#TASK   DO LOOP FOR ALL DEVS.            TIC23960
TICINT205 #T#GET,9 #DEV#LINE#IDENTIFIER GET LINEID.                     TIC23970
         CW,9      8                   IS IT THE SAME?                  TIC23980
         BE        TICINT220           OUT IF SO.                       TIC23990
         BDR,#DEV  TICINT205           LOOP IF NOT.                     TIC24000
*                                                                       TIC24010
*        FALL THROUGH IF BREAK NOT FROM ONE                             TIC24020
*        OF OUR POINT-TO-POINT LINES.                                   TIC24030
*                                                                       TIC24040
*        THIS IS IMPOSSIBLE.                                            TIC24050
*                                                                       TIC24060
         #SNAP,25  'IMPOSSIBLE BREAK IGNORED'                           TIC24070
         M:TRTN                                                         TIC24080
*                                                                       TIC24090
TICINT220 RES      0                   HERE TO SIGNAL BREAK - #DEV GOOD.TIC24100
*                                                                       TIC24110
         #T#GET,4  #DEV#DCB#POINTER    POINT TO COC LINE'S DCB.         TIC24120
         BLEZ      TICINTMTRTN         (WE MUST BE >0 HERE)             TIC24130
         #T#GET,5 #DEV#LINE#STATUS#BITS
         OR,5     =(#QD#FOR#INT)    SET Q'D FOR INTERRUPT PROCESSING
         #T#PUT,5 #DEV#LINE#STATUS#BITS
         MTW,1    INTREENT          CHECK FOR RE-ENTERING TIC VIA M:INT
         BGZ      TICINTMTRTN       RE-ENTERED; EXIT
         LW,5      *#DCB#TABLE#IW,4    GET DCL LOCATION.                TIC24140
         #SNAP,24 'DOING AN M:PURGE *R5'
         M:PURGE   *5                  AND GET RID OF BUFFERS.          TIC24150
*                                                                       TIC24160
         SIGNALATTENTION                                                TIC24170
         #T#GET,5 #DEV#LINE#STATUS#BITS
         AND,5    =(-#QD#FOR#INT-1) RESET Q'D FOR INTERRUPT
         #T#PUT,5 #DEV#LINE#STATUS#BITS
TICINT23 LI,4     0                 L/0
         STW,4    INTREENT          RESET RE-ENT COUNTER
         LW,#DEV  #BIGGEST#TIC#TASK L/MAX # OF TIC TASKS
TICINT24 #T#GET,5 #DEV#LINE#STATUS#BITS
         CW,5     =(#QD#FOR#INT)
         BAZ      TICINT28          B/TASK NOT Q'D FOR INTERRUPT
         #T#GET,4 #DEV#DCB#POINTER  L/DCB POINTER
         BLEZ     TICINT28          B/MDL-CONNECTED TASK
         #T#GET,5,4 #DCB#TABLE      L/DCB ADR
         #SNAP,24 'DOING AN M:PURGE *R5 AT M:INT EXIT'
         M:PURGE  *5                PURGE TERMINAL IO BUFFERS
         SIGNALATTENTION
TICINT28 BDR,#DEV TICINT24          BDR/CHECK NEXT TASK
         LW,4     INTREENT          L/RE-ENTRANCY COUNTER
         BGZ      TICINT23          B/WE WERE RE-ENTERED
         MTW,-1   INTREENT          CLEAR RE-ENTRANCY COUNTER
TICINTMTRTN RES    0                                                    TIC24180
         M:TRTN                                                         TIC24190
         PAGE                                                           TIC20570
*                                                                       TIC20580
*        TABLE USED IN CONNECTION WITH TIBS INSTRUCTION.                TIC20590
*                                                                       TIC20600
I        DO        255                                                  TIC20610
TTBSLIST(I) SET    0                                                    TIC20620
         FIN                                                            TIC20630
*                                                                       TIC20640
*        RIGHT-MOST BIT IS USED FOR FINDING UP-ARROWS:                  TIC20650
*                                                                       TIC20660
TTBSLIST(X'6A') SET TTBSLIST(X'6A')+1                                   TIC20670
*                                                                       TIC20680
*        WORD TO LOAD FOR UP-ARROW SEARCH:                              TIC20690
*                                                                       TIC20700
TTBSUPARROW GEN,8,24 1,BA(TTBSTABLE)                                    TIC20710
*                                                                       TIC20720
*                                                                       TIC20730
*                                                                       TIC20740
         BOUND     4                                                    TIC20750
TTBSTABLE GEN,8    0                                                    TIC20760
I        DO        255                                                  TIC20770
         GEN,8     TTBSLIST(I)                                          TIC20780
         FIN                                                            TIC20790
         END      #TIC#START

