         DEF      NSLP:
NSLP:    EQU      %
         SYSTEM   UTS
*
*
:DOT     CNAME
         PROC
         DO1      NUM(LF)=1
LF       SET      %-DOT
         GEN,8,8,8,8 AF(1),AF(2),AF(3),AF(4)
         PEND
         SPACE
:CLIST   CNAME
         PROC
         DO1      NUM(LF)=1
LF       SET      BA(%)-BA(DOT)
I        DO       NUM(AF)
         DATA,1   DA(AF(I))-DA(DOT)
         FIN      I
         PEND
         SPACE
:CDW     COM,8,24,8,8,8,8  AF(1),AF(2),AF(3),X'80',AF(4),AF(5)
*
*
         DEF      NSLP,NSLPCU
*
*
         REF      COMLIST,IOSCU,IOSERCK,IOSEREC,RE:ENT,SPECHK
         REF      ERRLOG,TIME,USECOM,CC3FAIL
         REF      DCT1,DCT7,DCT17,DCT20
         REF      IOQ4,IOQ5,IOQ8,IOQ9,IOQ11,IOQ12
         REF      MSG7,Y1,Y01,X7,YFF
*
*
*
         PAGE
R0       EQU      0
R1       EQU      1
R2       EQU      2
R3       EQU      3
R4       EQU      4
R5       EQU      5
R6       EQU      6
R7       EQU      7
R8       EQU      8
R9       EQU      9
R10      EQU      10
R11      EQU      11
R12      EQU      12
R13      EQU      13
R14      EQU      14
R15      EQU      15
         PAGE
*
BIT0     EQU      X'80000000'
BIT1     EQU      1**30
BIT2     EQU      1**29
BIT3     EQU      1**28
BIT4     EQU      1**27
BIT5     EQU      1**26
BIT6     EQU      1**25
BIT8     EQU      1**23
BIT9     EQU      1**22
BIT10    EQU      1**21
BIT11    EQU      1**20
BIT12    EQU      1**19
BIT13    EQU      1**18
BIT14    EQU      1**17
BIT15    EQU      1**16
BIT16    EQU      1**15
BIT17    EQU      1**14
BIT18    EQU      1**13
BIT20    EQU      1**11
         PAGE
*
* TYC CODES
*
TYCOK    EQU      1                 OK
TYCERR   EQU      8                 ERROR
TYCPGABT EQU      X'10'             PAGE ABORT
*
*
* FLAGS
*
FLGRETRY EQU      BIT16             RETRY
FLGINTER EQU      BIT18             INTER-OP
FLGKEYNC EQU      BIT20             KEY-IN NOC
FLGFOLOW EQU      BIT17             FOLLOW-ON
*
*
* CDW FLAG BITS
*
DCFLAG   EQU      BIT0
ICEFLAG  EQU      BIT3
HTEFLAG  EQU      BIT4
IUEFLAG  EQU      BIT5
SILFLAG  EQU      BIT6
*
NCC      EQU      (ICEFLAG+HTEFLAG+IUEFLAG+SILFLAG)**-24
DC       EQU      (DCFLAG+HTEFLAG+IUEFLAG)**-24
SENSEBUF EQU      4
TOFBUF   EQU      5
*
         PAGE
************************************
*   NS  LP PRE-PROCESSOR           *
************************************
NSLP     EQU      %
         LI,R10   DOTNSLP
         LH,R5    DCT1,R1           GET DEVICE ADDR
         LCI      0                 CLEAR CONDITION CODES FOR CC3 TEST
         TDV,R5   0,R5              GET TDV STATUS
         BCS,2    CC3FAIL           LOG ERROR AND CRASH
         CW,R5    Y1                IS LP ALREADY AT TOP OF FORM
         BAZ      COMLIST           NO,NO PROBLEM
         LH,R7    DCT7,R1           YES, GET CLIST AREA ADR
         SLS,R7   1                 MAKE IT A WORD ADR
         LW,R6    TOFBUF,R7         GET TOF MARKER
         EOR,R6   Y01               FLIP MARKER
         BAL,R0   RE:ENT
         STW,R6   TOFBUF,R7         SAVE IT
         LB,R5    IOQ5,R3           GET FUNCTION CODE
         CI,R5    FCWLPF            IS IT A PRINT WITH FORMAT
         BNE      COMLIST           NO, DONT WORRY ABOUT TOF
*                                   YES, DO WORRY
         LW,R6    IOQ8,R3           GET BUFFER PTR
         LB,R7    0,R6              GET FIRST BYTE
         CI,R7    X'F1'             IS IT A TOF COMMAND
         BNE      COMLIST           NO, NO PROBLEM
*                                   YES, MUST NOT TOP OF FORM AGAIN
         MTW,1    IOQ8,R3           BUMP BUFFER PTR
         MTH,-1   IOQ9,R3           DECREMENT BYTE COUNT
         LI,5     FCWLPWOF          PRINT WITHOUT FORMAT FUNCTION
         STB,R5   IOQ5,R3           AND PUT IT INTO CURRENT FUNCTION
         B        COMLIST           BUILD CLIST AREA
         PAGE
************************************
*   NS  LP COMMAND EXIT            *
************************************
SENSE    EQU      %
         LH,R5    DCT7,R1           GET CLIST AREA ADR
         SLS,R5   1                 MAKE IT A WORD ADR
         LI,R11   0                 PREPARE TO CLEAR SENSE BUFF
         BIF,X560 SENSE10
         LD,R8    DUMCOM            GET DUMMY COMMAND FOR SIGMA
         LW,R11   NEWFORM+1         GET DUMMY FORMAT BYTE
SENSE10  EQU      %
         BAL,R0   RE:ENT
         STW,R11  SENSEBUF,R5
         AI,R5    SENSEBUF          WORD ADR OF BUFFER
         SLS,R5   2                 BYTE ADR OF BUFFER
         OR,R8    R5                PUT BUFF ADR IN COMMAND
         B        USECOM            RETURN TO COMLIST
         PAGE
************************************
*   NS LP POST-PROCESSOR           *
************************************
NSLPCU   EQU      %
         BAL,R0   RE:ENT
         LB,R4    IOQ5,R3           GET CURRENT FUNCTION CODE
         ENABLE
         CI,R4    FCSENS1           IS IT A SENSE ORDER
         BGE      NSLP50            YES, GO TO FOLLOW-ON PROCESSING
         LW,R15   LPMASK            NO,GET MASK FOR GENERAL FAULT CHK
         BAL,R9   SPECHK            PERFORM GENERAL FAULT CHECKING
         B        NSLP10            ERRORS WERE FOUND BY LPMASK
         LC       DCT20,R1          SPECHK OVERLOOKS TDV CC2
         BCR,4    NSLP05            TDV CC2 IS   OK
         BAL,R9   IOSEREC           BAD TDV CC2;  LOG ERROR
         B        NSLPIS
*
*        EXIT FOR SUCCESSFUL I/O
*
NSLP05   EQU      %
         LI,R12   TYCOK             SET FLAG: COMPLETION OK
         B        NSLP80
         PAGE
*
*        ERROR FILTER
*
NSLP10   EQU      %
         CI,R8    X'6000'           CHK TIO FOR 'NOT OPERATIONAL'
*                                     OR 'BUSY' OR CONFUSED
         BAZ      NSLP20            NO
*
*                                   NO SENSE ORDER IF THE DEVICE IS NOT
*                                   OPERATIONAL; THE SIO WOULD BE
*                                   REJECTED
*
         LI,R12   TYCPGABT          YES,SET FLG: REPRINT FROM TOP OF PG
         BAL,R0   RE:ENT
         B        NSLPHIO
NSLP20   EQU      %
         LC       DCT20,R1          ARE TDV CC'S OK
         BCS,8+4  NSLPIS            NO
         LB,R4    IOQ5,R3           GET CURRENT FUNCTION
         STH,R5   R5                LEFT JUSTIFY TDV STATUS
         LC       R5                CHK TDV FOR RECOVERY MODE
         BCR,2    NSLP30            NOT MODE 1
         BCS,4    NSLP30            NOT MODE 1
         CI,R4    FCWLPNF           IS IT MODE 1 ON A WT WITH NEW FORMAT
         BE       NSLP35            YES,SENSE-THEN-FOLLOW WITH WLPNF
         B        NSLP45            NO,SENSE-THEN-FOLLOW WITH ORIG FUNC
NSLP30   EQU      %
         BCR,4    NSLPIS            NOT MODE 2, INCONSISTENT STATUS
         CI,R4    FCWLPWOF          MODE 2; IS CURRENT FUNCTION 'PRINT'
         BE       NSLP45            YES, USE MODE 1 RECOVERY
         CI,R4    FCFLP             NO, IS CURRENT FUNCTION 'FORMAT'
         BE       NSLPIS            YES, INCONSISTENT STATUS
         LI,R7    FCSENS1**8        ASSUME 'PRINT WITH FORMAT'
         CI,R4    FCWLPF            IS IT 'PRINT WITH FORMAT'
         BE       NSLP40            YES,SENSE-THEN-FOLLOW--NEW-FORMAT
NSLP35   EQU      %
         LI,R7    FCSENS4**8        NO, IT'S 'PRINT WITH NEW FORMAT'
NSLP40   EQU      %
         BAL,R0   RE:ENT
         STH,R7   DCT17,R1
*
*        EXIT FOR SENSE ORDER FOLLOWED BY
*        MODE 1 OR MODE 2 RECOVERY
*
NSLP45   EQU      %
         LI,R12   FLGRETRY+FLGINTER+TYCERR   SENSE AS RETRY
         CI,R5    X'C00'            CHK FOR 7446 CODE DISC ERR
         BAZ      NSLP80            NO
         LI,R13   MSG7              'CODE DISC ERR' MESSAGE
         LI,R12   FLGKEYNC          FORCE KEYIN
         B        NSLP80
*
*        EXIT FOR SENSE ORDER FOLLOWED BY
*        'INCONSISTENT STATUS' COMPLETION
*
NSLPIS   EQU      %
         BAL,R0   RE:ENT
         MTB,1    IOQ11,R3          INCR RETRY COUNT FOR A SENSE
*                                    ORDER WITHOUT FOLLOW-ON
         LI,R7    FCSENS3**8        GET RTY CODE FOR SENSE-NO-FOLLOW
         STH,R7   DCT17,R1
         LI,R12   FLGRETRY+FLGINTER+TYCERR   SENSE AS RETRY
NSLPHIO  LH,R9    DCT1,R1
         LCI      0                 CLEAR CONDITION CODES FOR CC3 TEST
         HIO,R0   *R9               HIO DEVICE
         BCS,2    CC3FAIL           LOG ERROR AND CRASH
         B        NSLP80
         PAGE
*
*        SENSE ORDER POST-PROCESSING
*
NSLP50   EQU      %
         BAL,R9   IOSERCK           EVEN THOUGH WE WILL IGNORE ERRORS
*                                   ON SENSE ORDERS, WE MUST GO TO
*                                   'IOSERCK' TO LOOK FOR SIO
*                                   FAILURE OR TIMEOUT
         B        %+1               IGNORE ERRORS
*
*        SENSE DATA LOGGING
*
         BIF,S7S9 NSLP55            NO SENSE LOGGING FOR SIGMA
         LH,R5    DCT7,R1           GET CLIST AREA ADDRESS
         SLS,R5   1                 CONVERT TO WORD ADDRESS
         LH,R7    DCT1,R1           GET CURRENT I/O ADDRESS
         OR,R7    =X'16030000'      SET CODE/COUNT
         LW,R8    TIME              GET HHMM
         LW,R9    SENSEBUF,R5       GET SENSE DATA
         LW,R6    =X'40000007'      SET NO I/O AND MSG ADR
         BAL,R0   RE:ENT
         BAL,R5   ERRLOG
*
*
NSLP55   EQU      %
         LB,R4    IOQ5,R3           GET CURRENT FUNCTION CODE
         CI,R4    FCSENS3           IS THIS A SENSE-NO-FOLLOW CLEAN-UP
         BNE      NSLP60            NO
         LI,R12   TYCPGABT          YES,SET FLG: REPRINT FROM TOP OF PG
         B        NSLP80
NSLP60   EQU      %
         CI,R4    FCSENS4           IS IT PRINT WITH NEW FORMAT
         BE       NSLP70            YES
         CI,R4    FCSENS1           IS IT MODE 2
         BE       NSLP65            YES
         LB,R7    IOQ4,R3           IT'S MODE 1
         BAL,R0   RE:ENT
         STH,R7   DCT17,R1
         B        NSLP70
*
NSLP65   EQU      %
         LW,R5    IOQ8,R3           GET BUFF ADR
         LB,R5    0,R5              GET FORMAT CODE
         SLS,R5   -4
         AND,R5   X7
         LB,R5    NEWFORM,R5        GET NEW FORMAT CODE
         STB,R5   R5                LEFT JUSTIFY
         BAL,R0   RE:ENT
         STW,R5   IOQ12,R3          NEW FORMAT TO IOQ12
         MTW,1    IOQ8,R3           INCR BYTE ADR
         MTH,-1   IOQ9,R3           DECR BYTE COUNT
NSLP70   EQU      %
         LI,R12   FLGFOLOW+FLGINTER SET FLAG FOR FOLLOW-ON
NSLP80   EQU      %
         LH,R5    DCT7,R1           SET TOF MARKER FOR OUTSYM
         SLS,R5   1
         LW,R9    TOFBUF,R5
         AND,R9   YFF
         BAL,R0   RE:ENT
         STS,R9   IOQ8,R3
         B        IOSCU
         PAGE
************************************
*   COMMAND LISTS FOR NS  LP       *
************************************
*
         BOUND    8
DOTNSLP  RES      0
DOT      SET      %
*
FCWLPNF  :DOT     NSNEWF,1,FCSENS2,FCWLPNF       0 WRITE LP, NEW FORMAT
FCWLPWOF :DOT     NSWRLP,1,FCSENS2,FCWLPWOF      1 WRITE LP W/O FORMAT
*
NSWRLP   :CLIST   NSLPW             WRITE LP
NSNEWF   :CLIST   NSLPNF            NEW FORMAT
NSWRLPF  :CLIST   NSLPWF            WRITE LP, FORMAT
NSFORM   :CLIST   NSLPF             FORMAT
*
FCWLPF   :DOT     NSWRLPF,1,FCSENS2,FCWLPF       3 WRITE LP, FORMAT
FCFLP    :DOT     NSFORM,1,FCSENS2,FCFLP         4 FORMAT LP
FCSENS1  :DOT     NSSENS,1,FCSENS1,FCWLPNF       5 SENSE,THEN MODE 2
FCSENS2  :DOT     NSSENS,1,FCSENS2,FCWLPWOF      6 SENSE,THEN MODE 1
FCSENS3  :DOT     NSSENS,1,FCSENS3,FCSENS3       7 SENSE,THEN TYCPGABT
FCSENS4  :DOT     NSSENS,1,FCSENS4,FCWLPNF       8 SENSE,THEN  WLPNF
NSSENS   :CLIST   NSLPS             SENSE
*
*
         BOUND    4
NEWFORM  EQU      %-1               TABLE TO LOCATE NEW FORMAT BYTE
         DATA,1   X'C0',X'60',X'60',X'C0'
LPMASK   DATA     X'0048007F'
*
         BOUND    8
NSLPW    :CDW     1,0,NCC,2         NS  LP WRITE
NSLPWF   :CDW     5,0,NCC,2         NS  LP WRITE, FORMAT
NSLPF    :CDW     3,0,NCC,2         NS  LP FORMAT
NSLPNF   :CDW     5,0,DC,1,1        NS  LP NEW FORMAT,1 BYTE FROM IOQ12
NSLPS    :CDW     4,SENSE,NCC,4,3   NS  LP SENSE
DUMCOM   :CDW     3,0,NCC,0,1       DUMMY 'SENSE' FOR SIGMA
         END

