          TITLE    'CRD - CRASH DUMP OVERLAY'                                   
          SYSTEM   SIG5P                                                        
         SYSTEM   OPTIONS                                                       
          DEF      A:CRD,CRDXIT                                                 
OLAYFLAG EQU      'CRD'                                                         
         TITLE    'PROCS AND STUFF FOR CRD'                                     
*                                                                               
*                                                                               
OPENIT   CNAME    1                                                             
WRITE    CNAME    1                                                             
SETINDEX CNAME    1                                                             
WEOFF    CNAME    1                                                             
REWINDE  CNAME    1                                                             
READ     CNAME    1                                                             
CLOSEIT  CNAME    1                                                             
SKIP     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 THE SE OPLABEL AND OUTPUTS A FORMATED DUMP ON                      
* THE LINE PRINTER.  THE SE DATA BASE MUST BE AS BUILT BY                       
* THE CRS OVERLAY                                                               
*                                                                               
CRD      RES      0                                                             
A:CRD    EQU      CRD                                                           
         PUSH     R15                                                           
*                                                                               
         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   FPT1-TTTT,R7      FIX UP FPTS                                 
         AWM,R7   FPT2-TTTT,R7                                                  
         AWM,R7   FPT3-TTTT,R7                                                  
         AWM,R7   FPT4-TTTT,R7                                                  
         AWM,R7   FPT5-TTTT,R7                                                  
         AWM,R7   FPT5A-TTTT,R7                                                 
         AWM,R7   FPT6-TTTT,R7                                                  
         AWM,R7   FPT7-TTTT,R7                                                  
         AWM,R7   SKIPFPT-TTTT,R7                                               
*                                                                               
          STB,R6   R7                RESTORE LENGTH IN R7                       
*                                                                               
*                                                                               
         SETINDEX FPT1              SET CR DCB TO SE OPLABEL                    
*                                                                               
         OPENIT   FPT2              OPEN SE OPLABEL                             
*                                                                               
         LI,R1    REWINDE                                                       
         STW,R1   ERRADDR-TTTT,R7   SET ERROR AND ABN ADDR UP                   
*                                                                               
         LI,R1    0                                                             
         BAL,R5   FINDBB            GET PTR TO BB PTR IN R15                    
         B        CLOSE2            CANT GET A BB                               
*                                                                               
         PRINT,TOP TOPMSG                                                       
         PRINT    SYMHEAD                                                       
         REWINDE  FPT6              AND REWIND SE OPLABEL                       
*                                                                               
         LW,R14   *R15              GET BLOCKING BUFFER PTR                     
         AND,R14  M24               MASK OUT ADDR                               
         STW,R14  BUFPTR-TTTT,R7    AND PUT IN FPT                              
*                                                                               
         READ     FPT3              READ IN SYMBOL TABLE                        
*                                                                               
         LI,R6    1                 PTR TO FIRST SYMBOL                         
LOOP0    LI,R5    4                 NUMBER OF SYMBOLS/LINE                      
         LI,R4    SYMHEAD-TTTT+1    POINTER TO SYMBOL PRINT BUFF                
LOOP1    LCI      3                 SYMBOL SIZE                                 
         LM,R1    *R14,R6           GET SYMBOL                                  
         LCI      2                                                             
         STM,R1   *R7,R4            STORE NAME PART                             
         AI,R4    2                                                             
         BAL,R0   CONVERT2          CONVERT VALUE TO EBCDIC                     
         LCI      2                                                             
         STM,R2   *R7,R4            STORE VALUE                                 
         AI,R4    3                                                             
*                                                                               
         AI,R6    3                 INCREMENT SYMBOL PTR                        
         CW,R6    *R14              IS THIS THE LAST SYMBOL                     
         BG       SYMDONE           YES                                         
         BDR,R5   LOOP1             NO, LOOP                                    
*                                                                               
         PRINT    SYMHEAD           PRINT EACH LINE AS DONE                     
*                                                                               
         LW,R5    Y04                                                           
         CW,R5    K:CTST            WAS INTERRUPT BUTTON PUSHED                 
         BAZ      LOOP0             IF NOT LOOP                                 
         LI,R4    0                 IF SO, RESET FLAG                           
         STS,R4   K:CTST                                                        
         B        STARTDMP          AND START DUMP                              
***************************************************************                 
SYMDONE  RES      0                                                             
*                                                                               
         PRINT    SYMHEAD           PRINT LAST SYMBOL LINE                      
*                                                                               
STARTDMP PRINT,TOP TOPMSG                                                       
         PRINT    HEXHEAD                                                       
         PRINT    FILLER                                                        
*                                                                               
         PAGE                                                                   
*                                                                               
* THIS PART DUMPS CORE                                                          
*                                                                               
         LW,R8    LOLIMIT-TTTT,R7   GET LO LIMIT                                
         SLS,R8   -8                GET LO BLOCK                                
*                                                                               
         SKIP     SKIPFPT           SKIP FORWARD                                
*                                                                               
         SLS,R8   8                 GET STARTING ADDR                           
*                                                                               
LOOP3    READ     FPT3              READ A HALF PAGE                            
         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       FINISHED                                                      
*                                                                               
         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     REWINDE           IF SO, STOP HERE                            
         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                                                                   
FINISHED RES      0                                                             
         PRINT    DONEMSG                                                       
*                                                                               
REWINDE  RES      0                                                             
         LI,R5    CLOSE1                                                        
         STW,R5   ERRADDR-TTTT,R7   SET UP ERROR ADDR                           
*                                                                               
         REWINDE  FPT6              REWIND                                      
         WEOFF    FPT5A                                                         
*                                                                               
CLOSE1    LW,R6    R15               RELEASE BB                                 
          BAL,R11  RELADBUF                                                     
*                                                                               
CLOSE2   RES      0                                                             
         LI,R5    FREE                                                          
         STW,R5   ERRADDR-TTTT,R7   SET UP ERR ADDR                             
*                                                                               
         CLOSEIT  FPT7              CLOSE SE                                    
*                                                                               
FREE     RES      0                                                             
RELEASE  BAL,R8   RELTEMP           RELEASE TEMP SPACE                          
*                                                                               
STOPP    PULL     R15                                                           
CRDXIT    B        *R15              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                          
*                                                                               
FPT1     GEN,8,1,23 8,1,SEDCB-TTTT  SET INDEX TO SEDCB                          
         DATA     P2                                                            
         DATA     '  SE'                                                        
*                                                                               
FPT2     FPT      X'14',SEDCB-TTTT  OPEN SEDCB                                  
         DATA     P1+P2                                                         
         DATA     ERRABN,ERRABN                                                 
*                                                                               
FPT3     FPT      X'10',SEDCB-TTTT  READ FROM SE OPLABEL                        
         DATA     P1+P2+P3+F3                                                   
         DATA     ERRABN,ERRABN                                                 
BUFPTR   DATA     0                                                             
*                                                                               
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                           
*                                                                               
FPT5     FPT      2,SEDCB-TTTT+BIT8 WRITE END OF FILE                           
         DATA     F3                                                            
*                                                                               
FPT5A    FPT      2,LODCB-TTTT+BIT8 WEOF LO DEVICE                              
         DATA     F3                                                            
*                                                                               
FPT6     FPT      1,SEDCB-TTTT+BIT8 REWIND                                      
         DATA     F3                                                            
*                                                                               
FPT7     FPT      X'15',SEDCB-TTTT  CLOSE SE OPLABEL                            
         DATA     P1+P2                                                         
         DATA     ERRABN,ERRABN                                                 
*                                                                               
SKIPFPT  FPT      X'1D',SEDCB-TTTT  SKIP RECORD FPT                             
         DATA     P1+P2+BIT28       REC COUNT,ABN,WAIT                          
         DATA     X'80000008'       *R8                                         
         DATA     ERRABN                                                        
*                                                                               
ERRADDR  DATA     FREE              ERROR/ABNORMAL ADDRESS                      
*                                                                               
         TITLE    'MESSAGES'                                                    
*                                                                               
*                                                                               
SYMHEAD  TEXTC    '   SYMBOL.....VALUE    SYMBOL.....VALUE',;                   
                 '    SYMBOL.....VALUE    SYMBOL.....VALUE'                     
*                                                                               
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     REWINDE,REWINDE                                               
*                                                                               
*                                                                               
SEDCB    FPT      5,BINARY+OPLBL                                                
         FPT      10,13             NRT,CRINDEX                                 
         DATA     0                                                             
         GEN,15,17 1024,REWINDE     RSZ,ERA                                     
         DATA     REWINDE           ABA                                         
*                                                                               
LFLAG    DATA     1                 MULTIPLE ZERO FLAG                          
LINECNT  DATA     0                 LINE COUNTER                                
*                                                                               
LOLIMIT  DATA     0                                                             
HILIMIT  DATA     0                                                             
*                                                                               
TEMPEND  RES      0                                                             
*                                                                               
         OLAYEND                                                                
*                                                                               
         END                                                                    
