         SYSTEM   SIG7P
         DEF      HSPM:             FOR XDELTA SYMBOL
HSPM:    EQU      %
*
*
*M*      HSPM     IRBT RECORD COMPRESSOR - MAPPED PART OF HASPIO
*
*
*P*      NAME:    HSPM
*P*
*P*      PURPOSE: HASP COMPRESSOR FOR IRBT BOUND RECORDS
*P*
*P*      DESCRIPTION:
*P*               HSPM CONTAINS THE ROUTINE H%CMP WHICH IS CALLED BY
*P*               COOP (OR OPNLD AT H%CMP1) TO HASP COMPRESS RECORDS
*P*               FOR STREAMS BEING OUTPUT TO IRBTS.  IT ALSO SUPPLIES
*P*               THE SRCB (SUB-RECORD-CONTROL-BYTE) FOR STREAMS
*P*               WHICH HAVE SRCB=P,C OR X.  THE COMPRESSION IS DONE
*P*               FROM AN MPOOL DIRECTLY INTO THE COOP BUFFER.  HSPM
*P*               IS ACTUALLY PART OF THE HASPIO HANDLER BUT IS A
*P*               SEPARATE MODULE BECAUSE IT RUNS MAPPED AND MUST BE
*P*               BELOW X'8000' IN THE ROOT.
*P*
*P*      REFERENCE:
*P*               HSPM IS CALLED BY COOP AND OPNLD.  THE HASP COMP-
*P*               RESSION SCHEME AND THE SRCB'S ARE DESCRIBED IN THE
*P*               REMOTE PROCESSING REF. MANUAL
*P*
*
*
*
*
*
         DEF      H%CMP             MAIN IRBT COMPRESSION AND SRCB
*,*                                 CONSTRUCTION ENTRY PIONT
         DEF      H%CMP1            SPECIAL IRBT COMPRESSION AND SRCB
*,*                                 CONSTRUCTION ENTRY POINT (DEV FLAGS
*,*                                 ALREADY IN R5).
         REF      HASPIO            JUST TO MAKE SURE HASPIO GETS INTO
*,*                                 MONSTK
         REF      HASPCU            JUST TO MAKE SURE HASPCU GETS
*,*                                 INTO MONSTK
         REF      JIT               INPUT: JIT ADDRESS USED TO CHECK FOR
*,*                                 UNMAPPED OPERATION (RBSWITCH)
         REF      J:BASE            INPUT:  J:BASE+3 CONTAINS ADDRESS
*,*                                 OF COOP CONTEXT BLOCK WHEN CALLED
*,*                                 BY COOP.
         REF      SCDEVTYP          INPUT:  DISPLACEMENT INTO COOP CONTEXT
*,*                                 OF DEVICE TYPE AND FLAGS
         REF      SCDCDA            I/O: DISPLACEMENT INTO COOP CONTEXT
*,*                                 WHERE SUPRESS SPACE FLAG IS KEPT
         REF      TSTACK            I/O:  TO PUSH AND PULL
         REF      Y02               INPUT: VFC BIT IN FC R8 BYTE 0
         REF      M5                INPUT:  ANDS OUT COUNT AND BIT
*,*                                 WHICH SAYS SPACE OR SKIP FROM VFC
*
*
*
*
*
*
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
****************************************************
A1       LB,4     *15,4
*
*
*
*F*      NAME:    H%CMP (H%CMP1)
*F*
*F*      PURPOSE: SUBROUTINE OF COOP ONLY PRESENT IN IRBT SYSTEMS.
*F*               HASP COMPRESSES RECORDS BOUND FOR IRBT DEVICES.
*F*               BUILDS APPROPRIATE SRCB'S AS THE FIRST BYTE OF EACH
*F*               RECORD
*F*
*
*
H%CMP    EQU      %
         LW,R5    J:BASE+3
         LW,R5    SCDEVTYP,R5
H%CMP1   EQU      %
         LI,10    -1
         PSW,R15  TSTACK
         PSW,R3   TSTACK
         CI,R5    CMPU
         BAZ      SRCBC
         LB,R12   *R15,R4
         B        SRCBIN
SRCBC    EQU      %
         LI,R12   X'81'
         CW,R8    Y02
         BAZ      SRCBIN1
         LB,R13   *R15,R4
         CI,R5    CMPP
         BANZ     SRCBP
         AI,R12   BINSRCB-X'20'
         LI,R13   0
SRCBP    EQU      %
         CI,R5    X'4000'
         BAZ      SRCBIN1
         CI,R13   X'60'
         BNE      %+3
         LI,R12   X'A1'
         B        SRCBP40
         CLM,R13  INHLMS
         BCR,9    %+2
         LI,R10   0
         AND,R13  M5
         CI,R13   X'10'
         BANZ     SRCBP2
SRCBP1   EQU      %
         CI,R13   2
         BLE      SRCBP2
         MTB,-3   *R15,R4
         LI,R13   3
SRCBP15  EQU      %
         OR,R13   VFCM
         AI,R11   1
         LI,R5    3
         LI,R2    3
SRCBP3   EQU      %
         LB,R1    R13,R5
         STB,R1   *R14,R3
         AI,R3    1
         BDR,R5   SRCBP3
         B        COUT1
SRCBP2   EQU      %
         CI,R5    CMPC
         BAZ      SRCBP35
         AI,R13   0
         BEZ      SRCBIN
         LI,R12   X'C0'
         STB,R12  *R15,R4
         B        SRCBP15
SRCBP40  EQU      %
         BAL,R13  GCXT
         AW,R12   SCDCDA,R5
         B        SRCBIN
GCXT     EQU      %
         LW,R5    JIT
         BEZ      GCIO
         LW,R5    J:BASE+3
         B        *R13
GCIO     AI,R13   1
         B        *R13
SRCBP35  EQU      %
         AW,R12   R13
         AI,R12   X'20'
         CI,R12   X'10'
         BAZ      SRCBP40
         AI,R12  -1
SRCBIN   EQU      %
         BAL,R13  GCXT
         STW,R10  SCDCDA,R5
         AI,R1    -1
         AI,R4    1
SRCBIN1  EQU      %
         STB,R12  *R14,R3
         AI,R3    1
         AI,R2    -1
COMP     EQU      %
         LW,5     3
         ANLZ,4   A1
         XW,1     4
         AI,2     -2
         AW,2     3
C1       LI,15    63
         LI,10    2
C2       EQU      %
         CW,3     2
         BGE      COUT
C25      EQU      %
         LB,13    0,1
         CB,13    *14,3
         BE       C5
         LI,10    2
C3       AI,3     1
         STB,13   *14,3
         BDR,4    C35
CEOR     EQU      %
         AI,3     1
         AI,15    -64
         LCW,15   15
         AI,15    SRCBMSK
         BAL,12   C4
         B        COUT
C35      EQU      %
         AI,1     1
         BDR,15   C2
         LI,12    C1
         LI,15    NCSRCB
         AI,3     1
C4       XW,3     5
         STB,15   *14,3
         LW,3     5
         B        *12
C5       EQU      %
         CW,3     5
         BE       C3
         BDR,10   C3
         AI,3     -1
         AI,15    -61
         BEZ      C55
         LCW,15   15
         AI,15    SRCBMSK
         BAL,12   C4
         AI,3     1
C55      EQU      %
         LI,15    29
         CW,15    4
         BLE      %+2
         LW,15    4
         STB,15   1
         CBS,0    55
         LB,12    1
         SW,15    12
         SW,4     15
         AI,15    BLNKSRCB+2
         CI,13    ' '
         BE       %+3
         AI,15    NBDUP
         AI,3     1
         BAL,12   C4
         AI,4     0
         BGZ      C1
COUT     EQU      %
         LI,1     0
         STB,1    *14,3
         AI,3     1
COUT1    EQU      %
         PLW,2    TSTACK
         SW,2     3
         LCW,2    2
         PLW,15   TSTACK
         B        *R11
CMPU     EQU      X'40000'
CMPC     EQU      X'20000'
CMPP     EQU      X'10000'
BINSRCB  EQU      X'10'
BLNKSRCB EQU      X'80'
SRCBMSK  EQU      X'C0'
NBDUP    EQU      X'20'
NCSRCB   EQU      X'FF'
X22      DATA     X'22'
VFCM     DATA     X'000081A0'
         BOUND    8
INHLMS   DATA     X'D0'
         DATA     X'EF'
         END

