         TITLE    'COBOL OBJECT TIME SUBROUTINE BLANK PAD'
         SYSTEM   SIG7FDP
* C(HECK) B(LANK) P(AD)                                                  1
* REGISTERS
R1       EQU      1                                                      2
R2       EQU      2                                                      3
R3       EQU      3                                                      3
R4       EQU      4                                                      5
R5       EQU      5                                                      6
P1       EQU      10                                                     9
L1       EQU      11
* ENTRY POINT                                                           10
         DEF      C:CBP                                                 11
*                        R2 = BA(SFLD)                                  12
*                        R3 = BA(RFLD)                                  13
*                        P1 = PSIZ: < 0 IF SFLD PAD                     14
*                                    > 0 IF RFLD PAD                    15
*                        L1 = LINK REGISTER                             16
*                        R1,R4,R5,P1 VVOLATILE                          17
C:CBP    RES      0                                                     20
         STW,R2    STR2        SAVE R2                                  C:CBP
*  THE FOLLOWING CODE WILL CALCULATE THE BYTE STRING ADDRESS            C:CBP
*  FOR THE CASES WHERE R2 DOES NOT ALREADY CONTAIN IT                   C:CBP
         LW,R4     L1   RETURN ADDRESS                                  C:CBP
         LW,R4     -4,R4       CBS INST                                 C:CBP
         CW,R4     L(X'60000000')       IS THIS A CBS INST              C:CBP
         BAZ       %+3        NO                                        C:CBP
         AND,R4    L(X'FFFFF')     REMOVE OP CODE                       C:CBP
         AW,R2     R4   CALCULATE ADDRESS OF STRING                     C:CBP
         LI,R4    2                 LOAD SFLD EXU INDEX                 24
         CI,P1    0                 CHECK PSIZ                          22
         BG       CBP02             > 0, SFLD PAD                       23
         BE       *L1
         LI,R4    3                 LOAD RFLD EXU INDEX                 21
         LAW,P1   P1                -PSIZ = +PSIZ                       25
CBP02    RES      0                                                     30
         LI,R1    2                 LOAD RPTCNT INDEX                   31
         LB,R5    P1,R1             LOAD,CHECK RPTCNT                   32
         BEZ      CBP04             = 0. NO ADDITIONAL.                 33
* RPTCNT > 0  PSIZ >  255                                               40
         AW,P1    R5                L = L+RPT CNT                       41
         CB,R5    P1,R1             COMPARE RPTCNT, NEW RPTCNT          42
         BE       CBP04             =. NO CHANGE.                       43
* NOT=, RPTCNT CHANGE.                                                  45
         AI,R5    1                 RPTCNT = RPTCNT+1                   46
         AI,P1    1                 L = L+1                             47
*                        R4 = SFLD/RFLD INDEX                           50
*                        R5 = RPTCNT                                    51
*                        P1 = L                                         52
CBP04    RES      0                                                     53
         LW,R1    *R4               R1 = R2/R3                          54
         STB,P1   R1                STORE L                             55
         AI,R5    1                 RPTCNT = RPTCNT+1                   56
         LI,P1    X'FF'             LOAD MAX:L                          57
* = SPACE                                                               63
CBP06    RES      0                                                     60
         CBS,0    BA(KBP40)         CHECK FOR SPACE                     61
         BNE      CBP08             NOT= SPACE                          62
         STB,P1   R1                STORE MAX. L                        64
         BDR,R5   CBP06             RPTCNT = RPTCNT-1                   65
* RPTCNT = 0, PAD = 0                                                   70
         LW,R2     STR2   RESTORE R2                                    C:CBP
         LCI       0      RESTORE COND CODE                             C:CBP
         B        *L1               RETURN                              71
* PAD NOT= SPACE                                                        80
CBP08    RES      0                                                     81
         LW,R2     STR2   RESTORE R2                                    C:CBP
         LC       KBP40,R4          LOAD CONDITION                      82
         B        *L1               RETURN                              83
* CONSTANTS
STR2     DATA      0                                                    C:CBP
KBP40    GEN,8,8,8,8 C' ',0,X'20',X'10' SPACE,0,CC3(=>),CC4=V<)         91
         END
