*M*      NSLP     LINE PRINTER HANDLER FOR MODELS 3463-66,7446,7463-66
*
*P*      NAME:    NSLP
*P*
*P*      PURPOSE: TO HANDLE I/0 FOR LINE PRINTERS, WHICH HAVE
*P*               CONTROLLERS CAPABLE OF REPORTING MODE I AND
*P*               MODE II ERROR TYPES AND (OPTIONALLY) CAPABLE
*P*               OF REPORTING DETAILED DIAGNOSTIC STATUS IN
*P*               RESPONSE TO A SENSE ORDER.
*P*
*P*               MODE I AND MODE II ERROR TYPES:
*P*               A PRINT FUNCTION CAN HAVE UP TO THREE DISTINCT
*P*               SUBFUNCTIONS -- PRE-PRINTING UPSPACE,THE PRINTING
*P*               ITSELF, AND POST-PRINTING UPSPACE. A MODE I ERROR
*P*               IS DEFINED AS AN ERROR WHICH IS DISCOVERED BY THE
*P*               CONTROLLER BEFORE ANY SUBFUNCTION HAS BEEN
*P*               EXERCISED AT THE PRINTER. A MODE II ERROR IS
*P*               DISCOVERED AFTER SUCCESSFUL PRE-PRINTING UPSPACE
*P*               BUT BEFORE PRINTING HAS OCCURRED.
*P*
*P*      DESCRIPTION:    THE PRE-PROCESSOR PERFORMS FOUR TASKS:
*P*               1) FLIPS THE TOF MARKER FOR 'OUTSYM' IF PAPER
*P*                  IS AT TOP-OF-FORM.
*P*               2) SUPPRESSES TOF COMMANDS THAT WOULD CAUSE
*P*                  UNWANTED BLANK PAGES.
*P*               3) CALLS 'COMLIST' IN THE 'BASHANDL' MODULE TO
*P*                  BUILD A COMMAND LIST FOR THE REQUESTED FUNCTION.
*P*               4) FOR SENSE ORDERS, COMPLETES THE COMMAND LIST
*P*                  FOR 3000 SERIES PRINTERS OR MODIFIES THE COMMAND
*P*                  LIST FOR SIGMA PRINTERS.
*P*
*P*               THE POST PROCESSOR DOES THE FOLLOWING:
*P*               IF THE FUNCTION WAS A SENSE, LOG THE SENSE DATA
*P*               AND CONTINUE WITH ONE OF THE THREE POSSIBLE
*P*               RECOVERY SEQUENCES:  MODE I RECOVERY, MODE II
*P*               RECOVERY, OR ABORT TO LAST TOP-OF-FORM.  IF THE
*P*               FUNCTION WAS NOT A SENSE, ANALYZE THE AIO, TIO,
*P*               AND TDV STATUS BYTES. IF NO ERRORS ARE FOUND, EXIT.
*P*               IF ERRORS ARE FOUND, ISSUE A SENSE ORDER.
*P*
*P*      REFERENCE:    THE RECOVERY PROCEDURES USED IN THIS MODULE
*P*               ARE DESCRIBED IN 'TAURUS/XEROX 530 LINE PRINTER
*P*               FAULT RECOVERY EXTERNAL SPECIFICATION',
*P*               DRAWING 703237.
*P*
         DEF      NSLP:             EXECUTIVE DELTA PATCHING SYMBOL
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              PRE-PROCESSOR (BEFORE SIO) ENTRY
*,*                                 POINT.
         DEF      NSLPCU            POST-PROCESSOR (AFTER INTERRUPT)
*,*                                 ENTRY POINT.
*
*
         REF      COMLIST           ROUTINE IN 'BASHANDL' MODULE.
*,*                                 CALLED FROM PRE-PROCESSOR TO
*,*                                 BUILD COMMAND LIST.
         REF      ERRLOG            IN 'ERHNDLR' MODULE. CALLED FROM
*,*                                 POST-PROCESSOR FOR SENSE DATA
*,*                                 ERROR LOGGING.
         REF      IOSERCK           ROUTINE IN 'BASHANDL' MODULE.
*,*                                 CALLED FROM POST-PROCESSOR TO
*,*                                 CHECK FOR SIO FAILURE OR
*,*                                 TIME-OUT ON A SENSE ORDER.
         REF      IOSEREC           SUBROUTINE IN 'BASHANDL' MODULE.
*,*                                 CALLED FROM POST-PROCESSOR TO
*,*                                 LOG AN ERROR IF TDV CC2 IS SET.
         REF      IOSCU             ROUTINE IN 'IOQ' MODULE.
*,*                                 POST-PROCESSOR EXITS TO THIS
*,*                                 ROUTINE FOR GENERAL I/O CLEAN-UP.
         REF      RE:ENT            ROUTINE IN 'BASHANDL' MODULE.
*,*                                 CALLED FROM PRE-PROCESSOR AND
*,*                                 POST-PROCESSOR TO CHECK FOR
*,*                                 REENTRANCE BEFORE MODIFYING
*,*                                 AN INTERRUPT ALTERABLE TABLE.
         REF      SPECHK            ENTRY POINT INTO 'IOSERCK' ROUTINE.
*,*                                 CALLED FROM POST-PROCESSOR TO
*,*                                 CHECK FOR AND LOG SIO FAILURE,
*,*                                 TIME-OUT, AND ALL GENERAL ERRORS
*,*                                 (EXCEPT TDV CC2 FAIL AND
*,*                                 ERRORS ON SENSE ORDERS).
         REF      USECOM            ENTRY POINT INTO 'COMLIST' ROUTINE.
*,*                                 RETURN TO 'COMLIST' FROM
*,*                                 PRE-PROCESSOR WITH BYTE ADDRESS
*,*                                 OF SENSE DATA BUFFER.
         REF      DCT1              DEVICE ADDRESS: FOR ISSUING TDV AND
*,*                                 HIO INSTRUCTIONS; ALSO FOR TYPE
*,*                                 16 ERROR LOG ENTRY.
         REF      DCT7              ADDRESS OF CLIST AREA:  TO ACCESS
*,*                                 TOF MARKER AND SENSE DATA BUFFER.
         REF      DCT17             RETRY AND FOLLOW-ON CODES:  CHANGED
*,*                                 IN POST-PROCESSOR (FROM THOSE
*,*                                 GIVEN IN DOT TABLE) ACCORDING
*,*                                 TO THE REQUIREMENTS OF THE
*,*                                 RECOVERY SEQUENCES.
         REF      DCT20             TDV CONDITION CODES: RETRIEVED BY
*,*                                 POST-PROCESSOR TO CHECK FOR
*,*                                 TDV CC2 FAILURE.
         REF      IOQ4              ORIGINAL FUNCTION CODE:  RETRY FOR
*,*                                 MODE I RECOVERY (AFTER SENSE
*,*                                 DATA ERROR LOGGING).
         REF      IOQ5              CURRENT FUNCTION CODE: DIRECTS FLOW
*,*                                 THROUGH THE POST-PROCESSOR;
*,*                                 USED TO DETERMINE APPROPRIATE
*,*                                 RECOVERY SEQUENCE.
         REF      IOQ8              FLAGS AND BUFFER ADDRESS:  TOF
*,*                                 FLAG IS PASSED TO 'OUTSYM'.
*,*                                 THE BUFFER ADDRESS IS MODIFIED
*,*                                 TO PREVENT UNWANTED DOUBLE TOF
*,*                                 (BLANK PAGES) AND TO ALLOW MODE II
*,*                                 RECOVERY WITHOUT CHANGING THE
*,*                                 USER'S BUFFER.
         REF      IOQ9              BYTE COUNT:  MODIFIED TO PREVENT
*,*                                 DOUBLE TOF AND TO ALLOW MODE II
*,*                                 RECOVERY WITHOUT CHANGING THE
*,*                                 USER'S BUFFER.
         REF      IOQ12             SPECIAL BUFFER:  NEW FORMAT CODE
*,*                                 IS STORED HERE TO ALLOW MODE II
*,*                                 RECOVERY WITHOUT CHANGING THE
*,*                                 USER'S BUFFER.
         REF      MSG7              'CODE DISC ERR' MESSAGE FOR 7446
*,*                                 PRINTER. FORCES OPERATOR
*,*                                 INTERVENTION TO PREVENT S/C 79.
         REF      Y1                MASK FOR TOF BIT IN TDV STATUS.
         REF      Y04               TOF BIT FOR OUTSYM
         REF      M21               CDW DA MASK
         REF      YC                DA MASK FROM IOQ8
         REF      X7                MODE II RECOVERY, NEW FORMAT MASK.
         REF      YFF               MASK FOR TOF MARKER IN CLIST AREA.
*K*      TOF      TOP OF FORM
*
*
*
         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      17                PAGE ABORT TYC
*
*
* 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           *
************************************
*
7446IO   EQU      %
*
         DEF      7446IO
*
NSLP     EQU      %
         LI,R10   DOTNSLP
         LB,R9    IOQ5,R3           GET CURRENT FUNCTION STEP
         CI,R9    FCWLPF            IS PRINT-WITH-FORMAT COMMAND
         BNE      COMLIST           NOPE
         LH,R6    DCT1,R1           GET OUR DEVICE ADDRESS
         TDV,R7   0,R6              COLLECT TDV STATUS
         LW,R6    IOQ8,R3           BUFFER BA
         LB,R9    0,R6              FIRST BYTE OF BUFFER
         BAL,R0   RE:ENT
         CI,R9    X'C0'             IF X'C0', PRINT SINGLE
         BE       NSLP01              LINE WITHOUT FORMATTING.
         CI,R9    X'F1'             USER'S VFC BYTE SAY TOF
         BNE      COMLIST           NOPE
         CW,R7    Y1                IS LP AT T-O-F NOW...
         BAZ      COMLIST           NO-> BUT THIS VFC WILL GET IT THERE
NSLP01   EQU      %
         LH,R5    IOQ9,R3           GET # OF BYTES TO WRITE
         AI,R5    -1                ADJUST TO COVER UP VFC BYTE
         BLEZ     COMLIST           ITS A ONE-BYTE VFC WRITE
         MTW,1    IOQ8,R3           STEP BUF BA PAST VFC BYTE
         MTH,-1   IOQ9,R3           AND COVER UP BYTE CNT
         LI,R5    FCWLPWOF          CHANGE CURRENT STEP TO
         STB,R5   IOQ5,R3           PRINT-WITHOUT-FORMAT CODE
         B        COMLIST           GO BUILD COMMAND LISTS
         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           *
************************************
*
7446CU   EQU      %
*
         DEF      7446CU
*
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
         BANZ     NSLPIS            YES
NSLP20   EQU      %
         LC       DCT20,R1          ARE TDV CC'S OK
         BCS,8+4  NSLPIS            NO
         LB,R4    IOQ5,R3           GET CURRENT FUNCTION
         CI,R5    X'2000'           IS MODE 1 RCVRY BIT SET
         BANZ     NSLP45            YUP--> GO
         CI,R5    X'4000'           IS MODE 2 RCVRY BIT SET
         BAZ      NSLPIS            NOPE-> SENSE THEN ABORT PAGE
         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
         LI,R7    FCSENS3           GET CODE FOR SENSE-NO-FOLLOW
         STH,R7   DCT17,R1
         LI,R12   FLGFOLOW+FLGINTER   SENSE AS FOLLOW-ON
NSLPHIO  LH,R9    DCT1,R1
         HIO,R0   *R9               HIO DEVICE
         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,R9    SENSEBUF,R5       GET SENSE DATA
         LI,R6    7               POINT TO ERROR MSG LOCATION
         BAL,R5   ERRLOG          AND RECORD IT
*
*
NSLP55   EQU      %
         LB,R4    IOQ5,R3           GET CURRENT FUNCTION CODE
         LB,R4    SENSEV,R4         GET COMPLETION POINT INDEX
         B        NSLPCU,R4         AND DISPATCH COMPLETION ROUTINE
*
NSLP56   EQU      %
         LI,R12   TYCPGABT          SIGNAL RESTART PAGE TO OUTSYM
         B        IOSCU
*
NSLP57   EQU      %
         LB,R7    IOQ4,R3           GET ORIG FUNC CODE TO DO AGAIN
         BAL,R0   RE:ENT
         STH,R7   DCT17,R1
         B        NSLP70
SENSEV   EQU      %-1
         DATA,1   NSLPIS-NSLPCU,;   FC 4
                  NSLP65-NSLPCU,;   FC 5
                  NSLP57-NSLPCU,;   FC 6
                  NSLP56-NSLPCU,;   FC 7
                  NSLP70-NSLPCU     FC 8
         BOUND    4
         PAGE
*
*        CURRENT STEP = SENSE FROM MODE 2 RECOVERY -- NOW FOLLOW
*        ON TO WRITE LP W/NEW FORMAT
*
NSLP65   EQU      %
         LW,R4    IOQ8,R3           GET BA OF CURRENT BUFFER
         CW,R4    YC                TEST FOR ANY KIND OF DA STUFF
         BAZ      NSLP66            NONE OF THE ABOVE
         LD,R4    1,R4              GET NEXT CDW FROM LIST OF EM
NSLP66   EQU      %
         LB,R5    0,R4              GET FIRST BYTE OF BUF VIA BA OF IT.
         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
         LH,R5    IOQ9,R3           GET BYTE COUNT
         AI,R5    -1                DECREMENT TO COVER FORMAT BYTE
         BLEZ     NSLP70            LEAVE EVERYTHING AS IS...
         MTH,-1   IOQ9,R3
         MTW,1    IOQ8,R3
NSLP70   EQU      %
         LI,R12   FLGFOLOW+FLGINTER SET FLAG FOR FOLLOW-ON
NSLP80   EQU      %
         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

