          TITLE    'CKD2 - CRASH DUMP OVERLAY PART 2'                           
          SYSTEM   SIG5P                                                        
         SYSTEM   OPTIONS                                                       
          DEF      A:CKD2,CKD2XIT                                               
OLAYFLAG EQU      'CKD2'                                                        
         TITLE    'PROCS AND STUFF FOR CKD'                                     
*                                                                               
*                                                                               
WRITE    CNAME    1                                                             
WEOFF    CNAME    1                                                             
READ     CNAME    1                                                             
CLOSEIT  CNAME    1                                                             
         PROC                                                                   
LF       CAL1,NAME AF(1)-TTTT,R7    POINT INTO TEMP SPACE                       
         PEND                                                                   
*                                                                               
*                                                                               
* PROC TO SIMPLIFY PRINT OPERATIONS                                             
*                                                                               
PRINT    CNAME                                                                  
         PROC                                                                   
LF       RES      0                                                             
         DO       CF(2)=TOP                                                     
         LI,R13   BIT23                                                         
         AWM,R13  LODCB-TTTT,R7     SET VFC                                     
         FIN                                                                    
*                                                                               
         LI,R13   AF(1)-TTTT                                                    
         AW,R13   R7                MAKE PTR TO MSG IN TEMP                     
         AND,R13  M17               MASK                                        
         STW,R13  LOBUFPTR-TTTT,R7                                              
*                                                                               
         LB,R13   AF(1)             GET BYTE COUNT                              
         STW,R13  LOBC-TTTT,R7                                                  
*                                                                               
         WRITE    FPT4                                                          
*                                                                               
         DO       CF(2)=TOP                                                     
         LI,R13   -BIT23                                                        
         AWM,R13  LODCB-TTTT,R7     RESET VFC                                   
         FIN                                                                    
         PEND                                                                   
*                                                                               
TOP      EQU      1                                                             
*                                                                               
         SYSTEM   CPRMON                                                        
         TITLE    'CRASH DUMP OVERLAY'                                          
*                                                                               
* THIS READS A CRASH OFF THE CK AREA AND OUTPUTS A FORMATTED                    
* DUMP ON THE LINE PRINTER  (LO OP-LABEL)                                       
*                                                                               
CKD2     RES      0                                                             
A:CKD2   EQU      CKD2                                                          
         PUSH     R0                SAVE LINK                                   
*                                                                               
         LI,R7    TEMPEND-TTTT      GET SPACE FOR FPT'S                         
         BAL,R8   GETTEMP           RETURN PTR IN R7                            
         B        STOPP             CANT GET SPACE                              
*                                                                               
         ENABLE                                                                 
         LI,R6    TEMPEND-TTTT-1    MOVE FPT'S TO TEMP SPACE                    
         LW,R0    TTTT,R6                                                       
         STW,R0   *R7,R6                                                        
         BDR,R6   %-2                                                           
*                                                                               
          STW,R3   LOLIMIT-TTTT,R7   SAVE LOW LIMIT                             
          STW,R4   HILIMIT-TTTT,R7   SAVE HI LIMIT                              
*                                                                               
          LB,R6    R7                SAVE LENGTH                                
          LI,R5    0                                                            
          STB,R5   R7                CLEAR LENGTH IN R7                         
*                                                                               
         AWM,R7   FPT2-TTTT,R7                                                  
         AWM,R7   FPT3-TTTT,R7                                                  
         AWM,R7   FPT4-TTTT,R7                                                  
         AWM,R7   FPT7-TTTT,R7                                                  
*                                                                               
         LI,R1    0                                                             
         BAL,R5   FINDBB            GET PTR TO BB PTR IN R15                    
         B        CLOSE2            CANT GET A BB                               
*                                                                               
          STB,R6   R7                RESTORE LENGTH IN R7                       
         PRINT,TOP TOPMSG                                                       
         PRINT    HEXHEAD                                                       
         PRINT    FILLER                                                        
*                                                                               
         PAGE                                                                   
*                                                                               
* THIS PART DUMPS CORE                                                          
*                                                                               
*                                                                               
*                                                                               
         LW,R14   *R15              GET BLOCKING BUFFER PTR                     
         AND,R14  M24               MASK OUT ADDR                               
         STW,R14  BUFPTR-TTTT,R7    AND PUT IN FPT                              
*                                                                               
         LW,R8    LOLIMIT-TTTT,R7   GET LO LIMIT                                
         SLS,R8   -8                GET BLOCK #                                 
*                                                                               
         LI,R6    CKINDEX           INDEX OF CK AREA                            
         LB,R4    MDDISCI,R6        GET DISC INDEX, AND THEN                    
         LH,R4    DISCNWPS,R4       WORDS PER SECTOR                            
         AND,R4   M9                MASK OFF COUNT                              
         LI,R5    255                                                           
         AW,R5    R4                                                            
         DW,R5    R4                R5 IS NOW # OF SECTORS/BLOCK                
         STW,R5   SPB-TTTT,R7       SAVE SECTORS/BLOCK                          
         MW,R5    R8                SECTOR # OF BLOCK START                     
         STW,R5   KEY-TTTT,R7       TO STARTING SECTOR                          
*                                                                               
         SLS,R8   8                 ADDRESS CTR FOR BLOCK START                 
*                                                                               
LOOP3    READ     FPT3              READ A HALF PAGE                            
*                                                                               
         LW,R5    SPB-TTTT,R7       GET SECTORS/BLOCK                           
         AWM,R5   KEY-TTTT,R7       BUMP KEY                                    
*                                                                               
         LI,R6    0                 POINTER IN BUFFER                           
         LI,R9    256/8             NO OF LINES/HALF PAGE                       
LOOP4    LI,R10   8                 NO OF WORDS/LINE                            
         LI,R4    (HEXMSG-TTTT)*4+86 PTR TO FIRST EBCDIC FIELD                  
         LI,R5    (HEXMSG-TTTT)*4+2 PTR TO FIRST HEX FIELD                      
*                                                                               
         LI,R0    0                                                             
         LI,R3    7                 CHECK TO SEE IF LINE IS ZERO                
         MTW,0    LFLAG-TTTT,R7     IF ALREADY SKIPPING, CHECK 1 LINE           
         BEZ      LABEL4A           SO AS NOT TO PRINT LAST ZERO LINE           
         CI,R6    255-8             IS THIS THE END OF BUFFER                   
         BGE      LABEL4A           YES, CHECK ONE LINE ANYWAY                  
         AI,R3    8                 OTHERWISE CHECK 2 LINES                     
LABEL4A  AW,R6    R14               POINT R6 TO LINE START                      
LOOP4A   OR,R0    *R6,R3            OR UP WORDS                                 
         AI,R3    -1                                                            
         BGEZ     LOOP4A            LOOP FOR 8                                  
         SW,R6    R14               RESTORE R6                                  
*                                                                               
         LW,R3    R8                ADDRESS                                     
*                                                                               
         CW,R8    HILIMIT-TTTT,R7   CHECK UPPER LIMIT                           
         BG       DONE              EXIT WHEN DONE                              
*                                                                               
         AI,R8    8                 BUMP ADDRESS                                
*                                                                               
         CI,R0    0                 IS LINE ZERO                                
         BEZ      NULLLINE          BRANCH IF ZERO LINE                         
*                                   OTHERWISE CONVERT                           
         BAL,R0   CONVERT2                                                      
         SCD,R2   16                SHIFT OFF TWO LEADING DIGITS                
*                                                                               
         LI,R11   6                 NO OF DIGITS OF ADDRESS                     
LOOP6    LB,R0    R2                MOVE ADDRESS INTO PRINT BUFFER              
         SCD,R2   8                                                             
         STB,R0   *R7,R5                                                        
         AI,R5    1                                                             
         BDR,R11  LOOP6             LOOP FOR 6 DIGITS OF ADDR                   
*                                                                               
         AI,R5    2                 SKIP TWO FILLER AFTER ADDRESS               
*                                                                               
LOOP7    LW,R3    *R14,R6           GET A DATA WORD                             
         AI,R6    1                                                             
         LI,R11   4                 NO OF BYTES OF EBCDIC                       
*                                                                               
LOOP8    RES      0                 MOVE EBCDIC INTO BUFFER                     
         LB,R1    OKTEXT                                                        
LOOP8A   LB,R0    OKTEXT,R1         GET A PRINTABLE BYTE                        
         CB,R0    R3                IS THE TOP BYTE OF R3 OK                    
         BE       %+2               YES                                         
         BDR,R1   LOOP8A            LOOP LOOKING FOR PRIN BYTE                  
         SCS,R3   8                 ROTATE R3                                   
         STB,R0   *R7,R4                                                        
         AI,R4    1                                                             
         BDR,R11  LOOP8             LOOP FOR 4 BYTES OF EBCDIC                  
*                                                                               
         AI,R4    1                 SKIP ONE BLANK AFTER EBCDIC                 
*                                                                               
         BAL,R0   CONVERT                                                       
         LI,R11   8                 NO OF BYTES OF HEX                          
*                                                                               
LOOP9    LB,R0    R2                                                            
         SCD,R2   8                 MOVE IN HEX                                 
         STB,R0   *R7,R5                                                        
         AI,R5    1                                                             
         BDR,R11  LOOP9             LOOP FOR 8 BYTES OF HEX                     
*                                                                               
         AI,R5    1                 SKIP ONE BLANK AFTER HEX                    
         CI,R10   5                 IS THIS THE MIDDLE COLUMN                   
         BNE      %+2               NO                                          
         AI,R5    2                 YES, SKIP 2 EXTRA                           
*                                                                               
         BDR,R10  LOOP7             LOOP FOR 8 WORDS OF HEX                     
*                                                                               
         CW,R8    LOLIMIT-TTTT,R7   CHECK LOWER LIMIT                           
         BLE      LABEL4            DONT PRINT IF TOO LOW                       
*                                                                               
         MTW,1    LFLAG-TTTT,R7     RESET FLAG                                  
         LW,R13   LINECNT-TTTT,R7   GET LINE COUNT                              
         CI,R13   32                FULL PAGE                                   
         BL       %+2               NO                                          
         BAL,R13  TOPOUT            YES, TOP OF FORM                            
         MTW,1    LINECNT-TTTT,R7   BUMP LINE COUNT                             
         LW,R13   K:CTST                                                        
         CW,R13   Y04               WAS INTERRUPT BUTTON PUSHED                 
         BANZ     DONE2             IF SO, STOP NOW                             
         PRINT    HEXMSG            NO, PRINT LINE                              
*                                                                               
LABEL2   RES      0                                                             
         BDR,R9   LOOP4             LOOP BACK FOR 32 LINES                      
*                                                                               
         LW,R9    LINECNT-TTTT,R7   GET LINE COUNT                              
         CI,R9    10                IS THIS DOWN ON THE PAGE                    
         BL       LOOP3             NO, DONT TOP OF FORM                        
         MTW,0    LFLAG-TTTT,R7     AM I SKIPPING                               
         BEZ      LOOP3             YES, DONT TOP OF FORM                       
* TOP OF FORM AT PAGE BOUNDRY IF LINE # > 9                                     
* AND NOT SKIPPING                                                              
         BAL,R13  TOPOUT                                                        
         B        LOOP3             AND GET NEXT HALF PAGE                      
****************************************************************                
LABEL4   RES      0                                                             
         BDR,R9   LOOP4             LOOP FOR TOO LOW LINES                      
         B        LOOP3             AND AGAIN IF STILL TOO LOW                  
*************************************************************                   
NULLLINE RES      0                                                             
         AI,R6    8                 INCREMENT R6                                
         LI,R10   0                 ZERO LINE DETECTED                          
         XW,R10   LFLAG-TTTT,R7     TEST  MULTIPLE ZERO LINE FLAG               
         BNEZ     %+3               BRANCH IF ZERO MSG NOT YET SENT             
         MTW,0    LINECNT-TTTT,R7   IS THIS THE FIRST LINE                      
         BNEZ     LABEL2            NO, DONT PRINT ZERO LINE                    
*                                   YES, PRINT LINE ANYWAY                      
         LW,R13   LINECNT-TTTT,R7   GET LINE COUNT                              
         CI,R13   32                FULL PAGE                                   
         BL       %+2               NO                                          
         BAL,R13  TOPOUT            YES, TOP OF FORM                            
         MTW,1    LINECNT-TTTT,R7   BUMP LINE COUNT                             
         PRINT    ZEROMSG           AND PRINT ZEROS MSG                         
         B        LABEL2                                                        
         PAGE                                                                   
*                                                                               
DONE     PRINT    DONEMSG                                                       
DONE2    RES      0                                                             
         WEOFF    FPT2              WEOF LO DEVICE                              
*                                                                               
CLOSE1    LW,R6    R15               RELEASE BB                                 
          BAL,R11  RELADBUF                                                     
*                                                                               
CLOSE2   RES      0                                                             
         LI,R5    FREE                                                          
         STW,R5   ERRADDR-TTTT,R7   SET ERROR AND ABN ADDRESS                   
*                                                                               
         CLOSEIT  FPT7              CLOSE CR                                    
*                                                                               
FREE     RES      0                                                             
         BAL,R8   RELTEMP           RELEASE TEMP SPACE                          
*                                                                               
STOPP    PULL     R0                                                            
CKD2XIT   B        *R0               AND EXIT                                   
**************************************                                          
         PAGE                                                                   
*                                                                               
* ERROR AND ABNORMAL HANDLER                                                    
*                                                                               
ERRABN   RES      0                                                             
         LW,R8    ERRADDR-TTTT,R7   GET ABN RETURN                              
         B        *R8               AND RETURN                                  
         TITLE    'SUBROUTINES'                                                 
*                                                                               
* TOPOUT - TOP OF FORM OUTPUT                                                   
*                                                                               
* R13 IS LINK                                                                   
*                                                                               
TOPOUT   RES      0                                                             
         STW,R13  0,R7              SAVE R13                                    
*                                                                               
         LI,R13   0                                                             
         STW,R13  LINECNT-TTTT,R7   CLEAR LINE COUNT                            
*                                                                               
         PRINT    FILLER                                                        
         PRINT    HEXHEAD                                                       
         PRINT,TOP TOPMSG                                                       
         PRINT    HEXHEAD                                                       
         PRINT    FILLER                                                        
         LW,R13   0,R7              GET R13                                     
         B        *R13                                                          
         PAGE                                                                   
*                                                                               
* CONVERT - THIS ROUTINE CONVERTS A VALUE IN R3 TO EBCDIC IN R2/3               
*                                                                               
* NO REGISTERS ARE ALTERED AND THE LINK IS R0                                   
*                                                                               
CONVERT  RES      0                                                             
         PUSH     3,R4              SAVE WORKING SPACE                          
         LI,R6    7                 STORE INDEX                                 
         LW,R4    R3                DATA TO CONVERT                             
CLOOP    SCD,R4   -4                GET ONE DIGIT                               
         SLS,R5   -28               RIGHT JUST. AND MASK                        
         AI,R5    '0'               ADD ZONE                                    
         CI,R5    '9'               IS IT TOO BIG                               
         BLE      %+2               NO                                          
         AI,R5    'A'-'0'-10        YES, ADJUST                                 
         STB,R5   R2,R6             STORE IN RESULT                             
         AI,R6    -1                                                            
         BGEZ     CLOOP             LOOP TILL DONE                              
         PULL     3,R4              RESTORE REGISTERS                           
         B        *R0                                                           
*                                                                               
         PAGE                                                                   
*                                                                               
* CONVERT2 - THIS ROUTINE IS THE SAME AS CONVERT, BUT FILLER                    
* LEADING ZEROS                                                                 
*                                                                               
CONVERT2 RES      0                                                             
         PUSH     2,R0                                                          
         BAL,R0   CONVERT                                                       
         LI,R1    7                 COUNTER                                     
CLOOP2   LB,R0    R2                PICK UP A BYTE                              
         CI,R0    '0'               IS IT A ZERO                                
         BNE      CONVERT3          NO, FINISH UP                               
         LI,R0    ' '               PICK UP A BLANK                             
         STB,R0   R2                AND BLANK CHARACTER                         
         SCD,R2   8                 SHIFT EBCDIC                                
         BDR,R1   CLOOP2            AND LOOP TIL DONE                           
         SCD,R2   8                                                             
CONVERT4 PULL     2,R0              RESTORE REGISTERS                           
         B        *R0                                                           
************************************                                            
CONVERT3 RES      0                                                             
         AI,R1    1                                                             
         SLS,R1   3                 TIMES 8                                     
         SCD,R2   0,R1              POSITION EBCDIC                             
         B        CONVERT4          AND EXIT                                    
*                                                                               
OKTEXT   TEXTC '. ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890()/*:=-!%#%+'             
*                                                                               
         TITLE    'FPT DEFINITIONS'                                             
*                                                                               
FPT      COM,8,24 AF(1),AF(2)                                                   
*                                                                               
BINARY   EQU      X'20000'                                                      
OPLBL    EQU      3                                                             
FILE     EQU      1                                                             
         TITLE    'FPTS'                                                        
*                                                                               
TTTT     RES      1                 SPARE ONE FOR MOVE                          
*                                                                               
FPT2     FPT      2,LODCB-TTTT+BIT8 WEOF LO DEVICE                              
         DATA     F3                                                            
*                                                                               
FPT3     FPT      X'10',CKDCB-TTTT  READ CK AREA                                
         DATA     P1+P2+P3+P8+F3                                                
         DATA     ERRABN,ERRABN                                                 
BUFPTR   DATA     0                                                             
KEY      DATA     0                 KEY                                         
*                                                                               
FPT4     FPT      X'11',LODCB-TTTT  FPT TO PRINT MESSAGES                       
         DATA     P1+P2+P3+P4+P6+F3                                             
         DATA     ERRABN,ERRABN                                                 
LOBUFPTR DATA     0                 MESSAGE ADDRESS                             
LOBC     DATA     0                 MESSAGE BYTE COUNT                          
         DATA     1                 BTD FOR ALL TEXTC                           
*                                                                               
FPT7     FPT      X'15',CKDCB-TTTT  CLOSE CK AREA                               
         DATA     P1+P2                                                         
         DATA     ERRABN,ERRABN                                                 
*                                                                               
         TITLE    'MESSAGES'                                                    
*                                                                               
*                                                                               
*                                                                               
HEXMSG   TEXTC    ' AAAAAA  XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX ',;             
                         '  XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX ',;             
                   '
 EEEE EEEE EEEE EEEE EEEE EEEE EEEE EEEE '                 
*                                                                               
HEXHEAD  TEXTC    'ADDRESS    0/8      1/9      2/A      3/B    ',;             
                         '    4/C      5/D      6/E      7/F    '               
*                                                                               
FILLER   TEXTC    ' '                                                           
*                                                                               
ZEROMSG  TEXTC    ' *** ZEROS ***'                                              
*                                                                               
*                                                                               
DONEMSG  TEXTC    'DUMP COMPLETE'                                               
TOPMSG   DATA,1   3,X'F1',X'40',X'40'                                           
*                                                                               
         TITLE    'DCBS'                                                        
*                                                                               
LODCB    FPT      5,3               DCB FOR LO PRINTING                         
         FPT      10,3              NRT - 10,  OPLB - LO                        
         DATA     0                                                             
         DATA     ERRABN,ERRABN                                                 
*                                                                               
*                                                                               
CKDCB    FPT      7,BINARY+FILE                                                 
         FPT      10,CKINDEX**8     NRT,TYPE                                    
         DATA     0                                                             
         GEN,15,17 1024,ERRABN      RSZ,ERA                                     
         DATA     ERRABN            ABA                                         
         DATA     0,0               NAME                                        
*                                                                               
LFLAG    DATA     1                 MULTIPLE ZERO FLAG                          
SPB      DATA     1                 SECTORS/BLOCK                               
LINECNT  DATA     0                 LINE COUNTER                                
*                                                                               
LOLIMIT  DATA     0                                                             
HILIMIT  DATA     0                                                             
*                                                                               
ERRADDR  DATA     CLOSE1                                                        
*                                                                               
TEMPEND  RES      0                                                             
*                                                                               
         OLAYEND                                                                
*                                                                               
         END                                                                    
