         DEF      7446IO:
7446IO:  EQU      %
*        706298   SIGMA 5/7        7446  PRINTER  HANDLER
         SYSTEM   SIG7P
*
*
:DOT     COM,8,8,8,8       BA(AF(1))-BA(DOT),AF(2),AF(3),AF(4)
:CLIST   COM,8             DA(AF(1))-DA(DOT)
:CDW     COM,8,24,8,8,8,8  AF(1),AF(2),AF(3),0,AF(4),AF(5)
*
*
         DEF      7446IO,7446CU
*
*
         REF      COMLIST,IOSCU,IOSERCK,RE:ENT
         REF      DCT1,DCT3,DCT12,DCT13,DCT17,DCT19,DCT20,DCT21
         REF      IOQ4,IOQ8,IOQ9,IOQ12
         REF      MSG2,MSG4,MSG7,MSG9,X7,Y1,IOQ5
*
*
*
R0       EQU      0
R1       EQU       1
R3       EQU       3
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
         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
*
*
* I/O STATUS BITS
*
* AIO
* TIO
TIODA    EQU      BIT3              DEVICE AUTOMATIC
TIODUE   EQU      BIT4              DEVICE UNUSUAL END
TIOICL   EQU      BIT8              INCORRECT LENGTH
TIOIOPH  EQU      BIT14             IOP HALT
*
* TDV
TDVICL   EQU      TIOICL
TDVIOPH  EQU      TIOIOPH
         PAGE
*
* BDP TAPE 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
*
* BDP LP BITS
*
TDVRM1   EQU      BIT2              RECOVERY MODE 1
TDVRM2   EQU      BIT1              RECOVERY MODE 2
*
*
*
*
************************************
*   BDP LP PRE-PROCESSOR           *
************************************
7446IO   EQU      %
         LI,R10   DOTBDPLP
         LB,R5    IOQ5,R3           GET FUNCTION CODE
         CI,R5    3                 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,
         LH,R5    DCT1,R1           GET DEVICE ADDR
         TDV,R5   0,R5              GET TDV STATUS
         BCS,12   COMLIST           FORGET IT IF LP NOT READY
         CW,R5    Y1                IS LP ALREADY AT TOP OF FORM
         BAZ      COMLIST           NO,NO PROBLEM
*                                   YES, MUST NOT TOP OF FORM AGAIN
         BAL,R0   RE:ENT            CHECK FOR RE-ENTRANCE AND INHIBIT
         MTW,1    IOQ8,R3           BUMP BUFFER PTR
         MTH,-1   IOQ9,R3           DECREMENT BYTE COUNT
         LI,5     1                 PRINT WITHOUT FORMAT FUNCTION
         STB,R5   IOQ5,R3           AND PUT IT INTO CURRENT FUNCTION
         B        COMLIST           BUILD CLIST AREA
         PAGE
************************************
*   BDP LP POST-PROCESSOR          *
************************************
7446CU   EQU      %
         BAL,R9   IOSERCK           PERFORM GENERAL FAULT ANALYSIS
         B        BDPLP10           NO
*                                   YES
BDPLP05  RES      0
         LI,R12   TYCOK
         B        IOSCU             COMPLETION OK
*
BDPLP10  RES      0
         LI,R13   MSG4              NOT OPERATIONAL MSG
         CI,R8    (BIT1+BIT2)**-16  IS DEVICE READY
         BANZ     BDPLP99           NO
*                                   YES
         LCF      DCT20,R1          TDV CC
         BCS,8    BDPLP20           TEST MODE  (CC=01--)
         BCR,4    BDPLP20           NO
*                                   YES
         LI,R13   MSG9                   TEST MODE MESSAGE
         B        BDPLP99
*
BDPLP20  RES      0
         CI,R5    TDVRM1**-16       RECOVERY MODE 1
         BAZ      BDPLP30           NO
*                                   YES
         CI,R5    TDVIOPH**-16      IOP HALT
         BAZ      BDPLP25           NO
*                                   YES
BDPLP23  RES      0
         CI,5     X'C00'            BUFFER OR CODE DISC PARITY ERROR
         BAZ      %+4               NO
         LI,12    X'4800'           YES, FORCE KEYIN
         LI,13    MSG7              CODE DISC ERR
         B        IOSCU
         LI,R12   FLGRETRY+FLGINTER+TYCERR
         B        IOSCU
*
BDPLP25  RES      0
         CI,R8    TIODA**-16        DEVICE AUTOMATIC
         BAZ      BDPLP99           NO
*                                   YES
         CI,R8    TIODUE**-16       DEVICE UNUSUAL END
         BANZ     BDPLP23           YES
*                                   NO
         B        BDPLP99
BDPLP30  RES      0
         CI,R5    TDVRM2**-16       RECOVERY MODE 2
         BANZ     BDPLP40           YES
*                                   NO
         CI,R5    TDVICL**-16       INCORRECT LENGTH
         BANZ     BDPLP05           YES, COMPLETION OK
         B        BDPLP99           NO
*                                   NO
BDPLP40  RES      0
         LB,R9    IOQ4,R3           CURRENT FUNCTION STEP
         CI,R9    3                 IS IT PRINT WITH FORMAT
         BNE      BDPLP23           NO
*                                   YES
         LW,R5    IOQ8,R3           BUFFER ADDRESS
         LB,R5    0,R5              FORMAT BYTE
         SLS,R5   -4
         AND,R5   X7
         LB,R5    NEWFORM,R5        NEW FORMAT BYTE
         STB,R5   R5                LEFT JUSTIFY
         BAL,R0   RE:ENT
         STW,R5   IOQ12,R3          TO IOQ12
*
         MTW,1    IOQ8,R3           INCREMENT BYTE ADDRESS
         MTH,-1   IOQ9,R3           DECREMENT BYTE COUNT
*
         LI,R5    0
*        LI,R5    FCWLPNF**8        WRITE LP WITH NEW FORMAT
         STH,R5   DCT17,R1
         B        BDPLP23
*
BDPLP99  RES      0
         LI,R12   TYCPGABT          PAGE ABORT COMPLETION
*
         BAL,R0   RE:ENT            CHECK FOR RE-ENTRANCE
*
         LH,R9    DCT1,R1
         HIO,R0  *R9                HIO DEVICE
*
         B        IOSCU
*
         PAGE
************************************
*   COMMAND LISTS FOR BDP LP       *
************************************
*
         BOUND    8
DOTBDPLP RES      0
DOT      SET      %
*
FCWLPNF  :DOT     BDPNEWF,1,0,0     FUNCTION CODE WRITE LP, NEW FORMAT
FCWLPWOF :DOT     BDPWRLP,1,1,0     FUNCTION CODE WRITE LP W/O FORMAT
*
BDPWRLP  :CLIST   BDPLPW            WRITE LP
BDPNEWF  :CLIST   BDPLPNF           NEW FORMAT
BDPWRLPF :CLIST   BDPLPWF           WRITE LP, FORMAT
BDPFORM  :CLIST   BDPLPF            FORMAT
*
FCWLPF   :DOT     BDPWRLPF,1,3,0    FUNCTION CODE WRITE LP, FORMAT
FCFLP    :DOT     BDPFORM,1,4,0     FUNCTION CODE FORMAT LP
*
*
NEWFORM  EQU      %-1               TABLE TO LOCATE NEW FORMAT BYTE
         DATA,1   X'C0',X'60',X'60',X'C0'
*
         BOUND    8
BDPLPW   :CDW     1,0,NCC,2         BDP LP WRITE
BDPLPWF  :CDW     5,0,NCC,2         BDP LP WRITE, FORMAT
BDPLPF   :CDW     3,0,NCC,2         BDP LP FORMAT
BDPLPNF  :CDW     5,0,DC,1,1        BDP LP NEW FORMAT,1 BYTE FORM IOQ12
         END

