         PSYS    0                                                              
OLAYFLAG EQU     'DBC1'                                                         
         SYSTEM   OPTIONS                                                       
         DO       #DEBUG                                                        
         SYSTEM   CPRMON                                                        
         PSYS     0                                                             
         SYSTEM   OLAYBASE                                                      
         PAGE                                                                   
         DEF      A:DBC1            DEBUG COMMANDS PART 1                       
         DEF      :#DUMP                                                        
         DEF      :#INSRT                                                       
         DEF      :#NAME                                                        
         DEF      :#SNAP                                                        
         DEF      :#SNAPIT                                                      
         DEF      :#LOOK                                                        
         DEF      :#DMPRET                                                      
         DEF      GODUMPIT          OUTAGE TO OVERLAY-DBC3                      
         DEF      DOVALEXT          OUTAGE TO OVERLAY-DBC3                      
         DEF      DBERR1            OUTAGE TO OVERLAY-DBS2                      
         DEF      USRIN1            OUTAGE TO OVERLAY-DBS2                      
         DEF      SNAPEXIT          OUTAGE TO OVERLAY-DBS2                      
*        REF      :#SCAN             OVERLAY-S1                                 
*        REF      :#DORET           OVERLAY-S2                                  
*        REF      :#SCNDR,:#SCNLCX   OVERLAY-S3                                 
*        REF      :#SCNLWX,:#SCNWDX  OVERLAY-S3                                 
*        REF      :#DODMP,:#DOVAL    OVERLAY-C3                                 
         ORG      0                                                             
:#DBERR1 LW,R8    :#DBERR,R2                                                    
DBERR1   B        *R8                                                           
:#USRIN1 LW,R8    :#USRIN,R2                                                    
USRIN1   B        *R8                                                           
ERRETN   DATA     :#DBERR1          POINTER FOR CAL ERRORS                      
*                                                                               
*                                                                               
:#DMPRET B        *R3               RETURN FROM DUMP                            
GODUMPIT B        :#DODMP           EXIT FOR DUMP OUTPUT                        
         TITLE    '***  :#DUMP   ***'                                           
*************************                                                       
*          :#DUMP        *                                                      
*************************                                                       
* COMMAND SYNTAX                                                                
* D LOC1(,LOC2(,FORMAT)(,OP LABEL))/:#DUMP2                                     
* DS LOC1(,SIZE(,FORMAT)(,OP LABEL))/:#DUMP2                                    
* :#DUMP   FORMAT                                                               
*                 HEX    8-8 DIGIT VALUES   PER   LINE                          
*                 EBCDIC 8-4 DIGIT VALUES   PER   LINE                          
*                 DECIMAL  4-10 DIGIT VALUES   PER   LINE                       
*                 BINARY  2-32 DIGIT VALUES   PRR LINE                          
*REGISTERS     USED BY :#DODMP                                                  
*  R1,R2,R3,R4,R5,R6,R7,R8,R9,R10,R11,R12,R15                                   
         PAGE                                                                   
:#DUMP   RES      0                 TAKE A DUMP COMMAND AND DO THE              
*                                    OUTPUT                                     
         AI,R8    -1                0 FOR D MODE                                
         STW,R8   :#DMPMD,R2        1 FOR DS MODE                               
DUMP1    RES      0                                                             
         LW,R8    :#TBFLAG,R2       TEST FOR INTERVENING TRAP/BREAK             
         BNEZ     :#USRIN1          YES - EXIT                                  
         BAL,R8   :#SCNDR           NO - GET NEXT DUMP REQUEST                  
         B        :#DBERR1                                                      
         CW,R8    :#Y01             CHECK FOR EMPTY REQUEST                     
         BNE      STRTDMP           NOT EMPTY-DO :#DUMP                         
         CI,R7    ' '               EMPTY-CHECK DELIM                           
         BE       DMPNX             BLANK-:#DUMP NEXT LOC IN HEX                
         CI,R7    '/'               LEADING /  GO TO :#SCNDR   AGAIN            
         BE       DUMP1                                                         
         CI,R7    NL                                                            
         BE       DMPNX             SAME AS BLANK FIELD                         
         :#DBERR1 X'91'             INVALID LEADING DELIM                       
DMPNX    RES      0                                                             
         LW,R8    :#DMPLC,R2        GET LOC TO :#DUMP                           
         LW,R9    :#DMPLC,R2                                                    
STRTDMP  RES      0                                                             
         STW,R7   :#DMPDL,R2        SAVE DELIMITER                              
         BAL,R6   GODUMPIT          DO ACTUAL OUTPUT                            
         LW,R7    :#DMPDL,R2        GET DELIMITER                               
         CI,R7    '/'                                                           
         BE       DUMP1                                                         
         B        :#USRIN1                                                      
         TITLE    '***  :#INSRT  ***'                                           
*************************                                                       
*        :#INSRT         *                                                      
*************************                                                       
*  COMMAND SYNTAX                                                               
*  I (B,A,R)  LOC/WORD1/WORD2/     1WORDON                                      
*  CORE IS CHANGED TO A BRANCH   TO THE :#INSRT                                 
*        ROUTINE                                                                
*        THE NEW CODE IS EXECUTED AND A RETURN                                  
*        TO THE USERS   CODE IS DONE                                            
*        THE CONTENTS IS PUT INTO THE PATCH                                     
*        TABLE                                                                  
         PAGE                                                                   
:#INSRT  RES      0                                                             
         STW,R8   :#INTYP,R2        SAVE SUB CODE                               
         LI,R1    2                 BASIC SIZE                                  
         BAL,R8   :#SCNLWX          FILL :#MDBF WITH LOC AND WORDS              
         B        :#DBERR1                                                      
         AI,R1    2                 SET TO FINAL SIZE                           
         LI,R5    X'1F'             GET TYPE                                    
         AW,R5    :#INTYP,R2        SET TYPE FOR :#INSRT  ELEMENT               
         STB,R5   R12                                                           
         LI,R5    3                                                             
         STB,R1   R12,R5                                                        
         STW,R12  :#MDBF,R2                                                     
         LW,R6    :#MDBF+1,R2       CHECK LOC FOR REGISTER                      
         CI,R6    16                                                            
         BL       ILIER1                                                        
         LW,R3     :#MDBF+1,R2      GENERATE   BRANCH   BACK                    
         OR,R3    :#BR                                                          
         AI,R3    1                 SET PROPER   RETURN                         
         LW,R9    :#MDBF+1,R2       GET OLD CONTENTS                            
         LW,R9    *R9                                                           
         LI,R0    :#MDBF-2                                                      
         AW,R0    R2                                                            
         MTW,-2   :#INTYP,R2        CHECK TYPE OF :#INSRT                       
         BL       INSBF                                                         
         BE       INSAF                                                         
         STW,R3   *R0,R1            PUT BRANCH   BACK IN N+1                    
         AI,R0    1                                                             
         XW,R9    *R0,R1            PUT OLD CONT IN N+2                         
         B        INSOT                                                         
INSAF    LW,R14   R1                                                            
         AI,R14   -2                :#MOVE NEW WORDS                            
         :#MOVE   *R14,:#MDBF+2,:#MDBF+3                                        
         XW,R9    :#MDBF+2,R2       OLD CONTENTS-SP 1                           
        AI,R0     1                                                             
         STW,R3   *R0,R1            BRANCH   BACK-N+2                           
         B        INSOT                                                         
INSBF    XW,R9    *R0,R1            OLD CONT- N+1                               
         AI,R0    1                                                             
         STW,R3   *R0,R1            BRANCH   BACK-N+2                           
INSOT    RES      0                                                             
         LW,R7    :#MDBF+1,R2       GET LOC                                     
         BAL,R6   :#CKSI            CHECK FOR :#INSRT  OF SNAP                  
         B        %+2                                                           
         B        ILIER2            :#INSRT OR SNAP RRESENT                     
         :#GTSPC  *R1                                                           
         LW,R9    :#BR              SET REPLACEMENT FOR USER   CODE             
         AW,R9    R7                                                            
         AI,R9    2                 SET TO FIRST :#INSRT                        
         LW,R4    :#MDBF+1,R2                                                   
         STW,R9   *R4                                                           
         :#MOVE   *R1,:#MDBF,*R7    MOVE INTO PATCH SPACE                       
         B        :#USRIN1          DONE                                        
ILIER1   :#DBERR1  X'B1'            NO :#INSRTS TO REGISTERS                    
ILIER2   :#DBERR1  X'B2'                                                        
         TITLE    '***  :#NAME ***'                                             
*************************                                                       
*          :#NAME        *                                                      
*************************                                                       
*COMMAND  SYNTAX                                                                
*N(L)  (SYMBOL,)  WORD                                                          
*N  SETS A USER   SYMBOL  ENTRY                                                 
*NL PRINTS THE VALUE   OF THE WORD                                              
*  A SYMBOL  ELEMENT HAS THE FOLLOWING FORMAT                                   
* 0      TYPE IDENTIFIER                                                        
* 1      POINTER   TO LAST SYMBOL                                               
* 2      POINTER   TO NEXT SYMBOL                                               
* 3      VALUE                                                                  
* 4      FIRST PART OF SYMBOL                                                   
* 5      LAST PART OF SYMBOL                                                    
         PAGE                                                                   
:#NAME   RES      0                                                             
         CI,R8    2                                                             
         BGE      DOVAL                                                         
         :#SCAN   :#GETEB           SET USER   SYMBOL  VALUE                    
         GETERR                                                                 
         BNE      ILSER1                                                        
         GETDLM                                                                 
         CI,R6    '/'               CHECK FOR /                                 
         BNE      ILDER1            ILLEGAL DELIMITER NOT /                     
         STW,R8   :#MDBF+4,R2                                                   
         STW,R9   :#MDBF+5,R2                                                   
         BAL,R8   :#SCNWDX                                                      
         B        :#DBERR1                                                      
         GETEMF                                                                 
         BNE      STREL             FIELD NOT EMPTY                             
         :#DBERR1 X'F2'             EMPTY FIELD ERROR                           
STREL    STW,R8   :#MDBF+3,R2                                                   
         LI,R7    X'10'             SET-UP SIGNAL WORD                          
         OR,R6    :#K6                                                          
         STB,R7   R6                SET TYPE                                    
         STW,R6   :#MDBF,R2                                                     
         LI,R6    0                                                             
         STW,R6   :#MDBF+2,R2       SET NEXT SYMBOL  POINTER                    
         LW,R7    :#FRSYM,R2        POINTER   TO FIRST USER SYMBOL              
USERLP   BE       USERU             END OF SYMBOLS  UNDEFINED                   
         LW,R14   4,R7              GET FIRST PART OF SYMBOL                    
         LW,R15   5,R7              GET LAST PART                               
         CW,R14    :#MDBF+4,R2      SEE IF MATCH                                
         BNE      %+3                                                           
         CW,R15   :#MDBF+5,R2                                                   
         BE       USERFD            SYMBOL  FOUND                               
         LW,R7    2,R7              GET NEXT SYMBOL  POINTER                    
         B        USERLP            CONTINUE SEARCH                             
USERFD   STW,R8   3,R7              SHANGE VALUE                                
         B        :#USRIN1                                                      
USERU    :#GTSPC  6                                                             
         LW,R4    :#CUSYM,R2                                                    
         BE       STRTB             FIRST IN TABLE                              
         STW,R7   2,R4              SET TO POINT TO NEXT SYMBOL                 
         STW,R4   :#MDBF+1,R2                                                   
STBF     STW,R7   :#CUSYM,R2                                                    
         :#MOVE   6,:#MDBF,*R7                                                  
         B        :#USRIN1                                                      
STRTB    STW,R7   :#FRSYM,R2        INITIALIZE TOP OF CHAIN                     
         LI,R6    0                 SET TO INDICATE FIRST SYMBOL                
         STW,R6   :#MDBF+1,R2                                                   
         B        STBF                                                          
DOVAL    RES      0                 PRINT VALUE   OF WORD                       
DOVALEXT B        :#DOVAL           (EXIT OVERLAY)                              
*                                                                               
*                                                                               
ILDER1   :#DBERR1 X'F3'             ILLEGAL DELIM                               
ILSER1   :#DBERR1 X'F1'             SCAN ERROR                                  
         TITLE    '***  :#SNAP ***'                                             
*************************                                                       
*          :#SNAP        *                                                      
*************************                                                       
* COMMAND SYNTAX                                                                
* S (B)  LOC  CONDITIONS  'MESSAGE'   DUMP   REQUESTS                           
* CORE IS CHANGED TO A BRANCH    TO THE SNAP                                    
*        ELEMENT IN THE PATCH TABLE                                             
*        THE FOLLOWING INSTRUCTIONS ARE EXECUTED                                
*        STW,R8   :#REG0+8                                                      
*        LI,R8    ELEMENT START     INDICATE SNAP                               
*        B        DOSNAP            PROCESS SNAP                                
         PAGE                                                                   
:#SNAP   RES      0                 SETUP SNAPSHOT ELEMENT                      
         STW,R8   :#SNPTP,R2                                                    
         LI,R1    5                 SET MINIMUM SIZE                            
         BAL,R8   :#SCNLCX          GET LOC                                     
         B        :#DBERR1                                                      
         STW,R8   :#MDBF+1,R2                                                   
         STW,R7   R4                SAVE DELIM                                  
         LW,R7    R8                SEE IF SNAP PRESENT                         
         BAL,R6   :#CKSI                                                        
         B        SNP                                                           
         :#DBERR1 X'C4'             SNAP OE INSERT ALREADY PRESENT              
SNP      LW,R7    R4                GET DELIM                                   
         GETEMF                                                                 
         BE       ILLER1                                                        
         CI,R8    16                                                            
         BL       ILLER2                                                        
         CI,R7    ','                                                           
         BE       SCCN              :#SCAN CONDITIONS                           
CKMSG    CI,R7    ''''                                                          
         BE       :#SCMSG           :#SCAN MESSAGE                              
CKDMP    CI,R7    '/'                                                           
         BE       SCDUMP            :#SCAN DUMP REQUESTS                        
         CI,R7    ' '                                                           
         BE       SNDN              SNAP COMMAND DONE                           
         CI,R7    NL                                                            
         BE       SNDN                                                          
         :#DBERR1 X'C3'             ILLEGAL DELIM   AFTER LOC                   
         PAGE                                                                   
SNDN     LI,R12   0                                                             
         LW,R5    :#SNPTP,R2                                                    
         AI,R5    X'2F'             GENERATE   TYPE                             
         OR,R12   R1                OR WITH SIZE                                
         STB,R5   R12               :#STORE IN TYPE                             
         STW,R12  :#MDBF,R2                                                     
         LW,R12    :#MDBF+1,R2      GET OLD CONTENTS                            
         LW,R12   *R12                                                          
         STW,R12    :#MDBF+2,R2                                                 
         LW,R12   R2                                                            
         AW,R12   SNPSTD             ADJUST BASE TABLE ADD.                     
         STW,R12  :#MDBF+3,R2                                                   
         LW,R12   SNPBAL                                                        
         AW,R12   R2                                                            
         STW,R12  :#MDBF+4,R2                                                   
         :#GTSPC  *R1                                                           
         LW,R9    :#BR                                                          
         AW,R9    R7                                                            
         AI,R9    3                 SET TO STW INSTRUCTION                      
         LW,R4    :#MDBF+1,R2                                                   
         STW,R9   *R4                                                           
         :#MOVE   *R1,:#MDBF,*R7    PUT ELEMENT INTO PATCH TABLE                
         B        :#USRIN1                                                      
         PAGE                                                                   
:#SCMSG  RES      0                 :#SCAN FOR MESSAGE                          
         :#DBERR1 X'CE'             NOT IMPLEMENTED YET                         
         PAGE                                                                   
SCDUMP   RES      0                 BUILD DUMP SUB-ELEMENT                      
         LI,R8    1                                                             
         STW,R8   :#DMPMD,R2        SET DUMP   MODE TO                          
         LW,R0    R1                SAVE PLACE WHERE   TYPE GOES                
         AI,R1    1                 LEAVE SPACE FOR TYPE CODE                   
GETDR    BAL,R8   :#SCNDR           CHECK ONE REQUEST                           
         B        :#DBERR1                                                      
         CW,R8    :#Y01                                                         
         BE       DODTP             EMPYT-NO DUMPS                              
         LI,R3    :#MDBF                                                        
         AW,R3    R2                                                            
         STW,R8   *R3,R1            BUILD SNAP SUB-ELEMENT                      
         AI,R1    1                                                             
         STW,R9   *R3,R1                                                        
         AI,R1    1                                                             
         STW,R10  *R3,R1                                                        
         AI,R1    1                                                             
         CI,R1    :#MDBFS                                                       
         BL       GETDR1                                                        
         :#DBERR1 X'C5'             TOO MANY DUMP REQUESTS                      
GETDR1   RES      0                                                             
         CI,R7    '/'                                                           
         BE       GETDR                                                         
         B        DODTP                                                         
         PAGE                                                                   
DODTP    LW,R3    R0                GET PLACE FOR TYPE                          
         LW,R4    R0                SAVE PLACE FOR TYPE                         
         SW,R3    R1                SET DUMP   TYPE WORD                        
         LCW,R3   R3                MAKE NUMBER   +                             
         LW,R14   R3                                                            
         DW,R3    :#K3              FIND NUMBER   OF REQUESTS                   
         SLS,R3   8                 :#MOVE TO BYTE 3 POSITION                   
         OR,R14   DTYPE                                                         
         OR,R14   R3                                                            
         LI,R3    :#MDBF                                                        
         AW,R3    R2                                                            
         STW,R14  *R3,R4                                                        
         B        SNDN              DO SNAP END                                 
*                                                                               
SCCN     :#DBERR1 X'CF'             BUILD CONDITION SUB ELEMENT                 
*                                   NONE ALLOWED YET                            
         PAGE                                                                   
:#SNAPIT RES      0                 PROCESS SNAP                                
         LW,R15   :#SNPSV,R2                                                    
         LW,R1    R15               CURRENT SNAP ELEMENT POSITION               
         AI,R15   -5                GET PLACE WHERE   BREAK   WAS               
         LW,R14   R15               TOP OF SNAP ELEMENT                         
         LB,R5    *R1               CHECK SNAP SUBELEMENTS                      
         CI,R5    X'32'                                                         
         BE       DOCOND                                                        
* GET TASK AND SEGMENT ID-ALSO GET LOC                                          
DOID     RES      0                 IDENTIFY BREAKPOINT                         
         STW,R14  R7                                                            
         LW,R9    1,R7              GET LOC                                     
         STW,R9   :#SNPSV,R2        PLACE WHERE   SNAP AS-RETURN                
         STW,R9   :#OLSNP,R2                                                    
         LW,R8    2,R7              GET OLD INSTRUCTION                         
         STW,R8   :#OLINS,R2                                                    
         LI,R8    X'80'             SET BIT 0 OF :#SNPSV TO FORCE               
         LI,R7    :#SNPSV           EXECUTION OF INSTRUCTION BEFORE RET         
         AW,R7    R2                                                            
         STB,R8   *R7                                                           
         LW,R8    R9                                                            
         AI,R8    1                                                             
         STW,R8   :#LOCSV,R2        PLACE TO :#MOVE SNAP TO-DEFAULT             
         :#CNIFS  :#IDLOC                                                       
         SETBUF   :#IDBF,:#IDSZ                                                 
         LW,R8    ERRETN                                                        
         STW,R8   :#CALERR,R2                                                   
         CAL1,1   :#WRFPT,R2                                                    
         LB,R5    *R1               GET SUB TYPE                                
         CI,R5    X'34'                                                         
         BE       DOMSG                                                         
DCKDP    CI,R5    X'36'                                                         
         BE       SNPDMP                                                        
DSDN     LB,R3    *R14              SEE IF BREAK   OR CONTINUE                  
         CI,R3    X'30'                                                         
         BNE      :#USRIN1          GET INPUT FROM USER                         
SNAPEXIT B        :#DORET                                                       
* RETURN    TO USER SAME AS B WOULD                                             
*                                                                               
DOMSG    RES      0                 OUTPUT USERS   MESSAGE                      
         B        %                 NOT IN YET                                  
*                                                                               
DOCOND   B        %                 DO CONDITION NOT DONE YET                   
         PAGE                                                                   
SNPDMP   RES      0                 OUTPUT ALL DUMP   REQUESTS                  
         LI,R3    2                                                             
         LB,R13   *R1,R3            GET NUMBER   OF REQUESTS                    
         AI,R1    1                                                             
         STW,R14  :#TEMP1,R2        SAVE TOP OF ELEMENT                         
DRLP     LW,R8    0,R1                                                          
         LW,R9    1,R1                                                          
         LW,R10   2,R1                                                          
         STW,R1   R0                SAVE ELEMENT POSITION                       
         BAL,R6   GODUMPIT                                                      
         LW,R1    R0                                                            
         AI,R1    3                                                             
         BDR,R13  DRLP                                                          
         LW,R14   :#TEMP1,R2        GET TOP OF ELEMENT                          
         B        DSDN              DONE WITH REQUESTS                          
         PAGE                                                                   
DTYPE    DATA     X'36000000'                                                   
SNPSTD   STD,R2   :#REG0+2                                                      
SNPBAL   BAL,R3   :#SNAPIN                                                      
SNAPBAL  EQU      SNPBAL                                                        
ILLER1   :#DBERR1  X'C1'            EMPTY LOC IS NOT VALID                      
ILLER2   :#DBERR1  X'C2'            NO SNAP FOR REGISTERS                       
         PAGE                                                                   
*************************                                                       
*        CONSTANTS       *                                                      
*************************                                                       
:#M4     EQU      M4                                                            
:#M17    EQU      M17                                                           
:#MK1    EQU      M32                                                           
:#K3     EQU      X3                                                            
:#K6     EQU      X6                                                            
:#K20    EQU      X20                                                           
:#K30    EQU      X30                                                           
:#KF0    EQU      XF0                                                           
:#Y01    EQU      Y01                                                           
:#YFFFE  EQU      YFFFE                                                         
:#BR     B        0                                                             
         PAGE                                                                   
*:#REGISTERS   USED                                                             
*  R4,R6,R7,R14,R15                                                             
:#CKSI   RES      0                                                             
         LW,R14   *R7               GET B INSTRUCTION                           
         LW,R15   :#YFFFE           SEE IF B INST                               
         CS,R14   :#BR                                                          
         BNE      *R6                                                           
         LW,R5    R14               GET ELEMENT POINTER                         
         AI,R5    -2                SEE IF INSERT-GET   TOP OF ELEMENT          
         LB,R14   *R5               GET BYTE 0                                  
         LI,R15   X'F0'             CHECK ONLY TOP 4 BITS OF BYTE               
         CS,R14   :#K20                                                         
         BE       CKSRT             INSERT   FOUND                              
         AI,R5    -1                CHECK FOR SNAP                              
         LB,R14   *R5                                                           
         CS,R14   :#K30                                                         
         BNE      *R6               NOT SNAP                                    
CKSRT    AI,R6    1                 FOUND RETURN                                
         B        *R6                                                           
         TITLE    ':#LOOK'                                                      
*************************                                                       
*         :#LOOK         *                                                      
*************************                                                       
* COMMAND SYNTAX                                                                
* L START,END/WORD1/WORD2                                                       
* THE ROUTINE WILL SEARCH WITHIN                                                
*    THE SPECIFIED MEMORY FOR A WORD                                            
*    THAT WHEN MASKED BY WORD2 IS                                               
*    EQUAL TO WORD1.                                                            
* THE DEFAULT FOR WORD2 IS X'FFFFFFFF'                                          
         PAGE                                                                   
:#LOOK   RES      0                                                             
         LW,R15   :#MK1                                                         
         SETBUF   :#LOKBF,:#LOKBS                                               
         BAL,R8   :#SCNLCX          GET START LOC                               
         B        :#DBERR1                                                      
         BAL,R9   CKEMF                                                         
         CI,R7    ','                                                           
         BNE      ILWDER1                                                       
         STW,R8   R12               SAVE START                                  
         BAL,R8   :#SCNLCX                                                      
         B        :#DBERR1                                                      
         BAL,R9   CKEMF                                                         
         CI,R7    '/'                                                           
         BNE      ILWDER1                                                       
         STW,R8   R13               SAVE END                                    
         BAL,R8   :#SCNWDX          GET WORD                                    
         B        :#DBERR1                                                      
         BAL,R9   CKEMF                                                         
         STW,R8   R14               SAVE WORD                                   
         CI,R7    '/'                                                           
         BE       GETMSK                                                        
         CI,R7    NL                                                            
         BE       DOLOK                                                         
         CI,R7    ' '                                                           
         BE       DOLOK                                                         
ILWDER1  :#DBERR1 X'E2'             ILLEGAL DELIM AFTER WOOD                    
         PAGE                                                                   
GETMSK   XW,R14   R15                                                           
         BAL,R8   :#SCNWDX                                                      
         B        :#DBERR1                                                      
         XW,R14   R15                                                           
         GETEMF                                                                 
         BE       DOLOK                                                         
         STW,R8   R15               SAVE MASK                                   
DOLOK    LW,R1    R12               SEARCH AND PRINT OUT MATCHES                
LOKLP    RES      0                 TEST ENDING                                 
         CW,R1    R13                                                           
         BG       :#USRIN1          DONE WITH SEARCH                            
         CI,R1    16                CHECK FOR REGISTERS                         
         BGE      NOTRG                                                         
         LW,R9    :#REG0,R1         GET REGISTER CONTENTS                       
         B        %+2                                                           
NOTRG    LW,R9    *R1               GET CONTENTS                                
         LW,R8    R9                SAVE ORIGINAL CONTENTS IN R9                
         AND,R8   R15               DO MASK                                     
         CW,R8    R14                                                           
         BE       DOOUT                                                         
         AI,R1    1                 GET NEXT LOC                                
         B        LOKLP                                                         
DOOUT    :#CNIFX  :#CONVL           OUTPUT WORD-GET WORD TO EBCDIC              
         LW,R4    :#CONVL,R2                                                    
         LW,R5    :#CONVL+1,R2                                                  
         STW,R4   :#LOKWD,R2                                                    
         STW,R5   :#LOKWD+1,R2                                                  
         LW,R9    R1                GET ADDRESS                                 
         :#CNIFS  :#LOKBF                                                       
         LW,R8    ERRETN                                                        
         STW,R8   :#CALERR,R2                                                   
         CAL1,1   :#WRFPT,R2                                                    
         AI,R1    1                 GET NEXT LOCATION                           
         B        LOKLP                                                         
         PAGE                                                                   
CKEMF    GETEMF                                                                 
         BNE      *R9                                                           
         :#DBERR1 X'E1'             START OR END IS EMPTY                       
         PAGE                                                                   
*************************                                                       
*        :#GTSPC         *                                                      
*************************                                                       
*        CALL IS  BAL,R8  :#GTSPC                                               
*                 R7 CONTAINS THE SIZE OF THE AREA TO BE RESERVED               
*                                                                               
*                 ON RETURN  R7 CONTAINS THE FWA OF THE SPACE TO BE             
*                 USED                                                          
*REGISTERS     USED                                                             
* R5,R6,R7,R8,R9                                                                
CUR      EQU      0                                                             
END      EQU      1                                                             
LASTST   EQU      2                                                             
NEXTST   EQU      3                                                             
MAXTYPE  EQU      X'40'                                                         
         PAGE                                                                   
:#GTSPC  RES      0                                                             
         STW,R8   :#SPCRT,R2                                                    
         LW,R6    :#WTAB,R2         GET ACTIVE BUFFER   ADDRESS                 
         LW,R5    CUR,R6            GET CURRENT END                             
         AW,R7    R5                FIND NEW END                                
         CW,R7    END,R6            SEE IF PAST LAST WORD                       
         BG       GETMEM            WONT FIT                                    
         XW,R7    CUR,R6            WILL FIT-SAVE NEW CUR-GET SPACE STRT        
         LW,R8    :#SPCRT,R2        RETURN                                      
         B        *R8                                                           
GETMEM   RES      0                                                             
         :#DBERR1 X'71'             FIRST WORK SPACE FULL                       
         PAGE                                                                   
* CALLED BY THE :#STORE PROC                                                    
* REGISTERS USED                                                                
* R5,R6,R7,R8                                                                   
:#STORE  RES      0                                                             
         AI,R5    -1                                                            
         STW,R7   *R6,R5                                                        
         CI,R5    0                                                             
         BG       :#STORE           CONTINUE TO STORE                           
         B        *R8                                                           
         PAGE                                                                   
*  CALLED BY THE :#MOVE PROC                                                    
*  REGISTERS USED                                                               
*  R4,R5,R6,R7,R8                                                               
:#MOVE   RES      0                                                             
         AI,R4    -1                                                            
         LW,R7    *R5,R4                                                        
         STW,R7   *R6,R4                                                        
         CI,R4    0                                                             
         BG       :#MOVE                                                        
         B        *R8                                                           
         TITLE    ':#CNIFS'                                                     
*************************                                                       
*         :#CNIFS       *                                                       
*************************                                                       
*  CHANGE ADDRESS IN INTERNAL FORMAT TO SYMBOL + HEX                            
*    STORE CHARACTERS INTO SPECIFIED BUFFER                                     
*        CALL IS  BAL,R8   :#CNIFS                                              
*                 R7 CONTAINS THE BUFFER WHERE THE CHARACTERS ARE STORED        
*                 R9 CONTAINS THE VALUE TO BE VONVERTED                         
*                 ON RETURN *R7 CONTAINS A STRING SSSSSSSS+.NNNNN               
*                 WHERE THE S REPRESENT THE CLOSEST SYMBOL                      
*                 BELOW THE ADDRESS AND N REPRESENTS THE                        
*                 DISPLACEMENT FROM THE SYMBOL                                  
*                 THE R7 BUFFER MUST BE 4 WORDS LONG                            
*   REGISTERS USED  R4,R5,R6,R7,R8,R9                                           
*                                                                               
*                                                                               
         PAGE                                                                   
:#CNIFS  RES      0                                                             
         AND,R9   M17               MASK OFF ADDRESS PART                       
         LI,R6    0                 RESET ADDRESS VALUE                         
         STW,R6   :#CSMVL,R2                                                    
         LW,R6    PCBPOINT          GET START OF TASK                           
         AND,R6   :#M17                                                         
         LW,R4    :#PCBVPT,R2                                                   
         STW,R6   *R4               STORE IN SYMBOL TABLE                       
         LW,R6    :#FRSYM,R2        FIND CLOSEST SYMBOL                         
         BE       SERDON            SYMBOL TABLE END                            
CKSYM    CW,R9    3,R6                                                          
         BGE      SAVESYM                                                       
GETNX    LW,R6    2,R6              GET NEXT SYMBOL                             
         BE       SERDON                                                        
         B        CKSYM                                                         
SAVESYM  LW,R5    3,R6                                                          
         CW,R5    :#CSMVL,R2                                                    
         BL       GETNX                                                         
         STW,R6   :#CSMAD,R2                                                    
         STW,R5   :#CSMVL,R2                                                    
         B        GETNX                                                         
         PAGE                                                                   
SERDON   RES      0                 BUILD OUTPUT BUFFER                         
         LW,R6    :#CSMAD,R2        GET ADDRESS FO SYMBOL                       
         LCI      2                                                             
         LM,R4    4,R6              GET SYMBOL CHARACTERS                       
         STM,R4   0,R7              SET INTO BUFFER                             
         SW,R9    :#CSMVL,R2        GET VALUE TO OUTPUT                         
         STW,R8   :#CSMAD,R2        SAVE RETURN                                 
         STW,R7   :#CSMVL,R2        SAVE BUFFER                                 
         :#CNIFX  :#CONVL           CONVERT DISPLACMENT                         
         LW,R7    :#CSMVL,R2                                                    
         LW,R4    :#CONVL,R2        GET HIGH ORDER CHARACTER                    
         AND,R4   M8                MASK OFF ONE DIGIT                          
         AW,R4    SERD1             ADD IN BLANK,PLUS,PERIOD                    
         STW,R4   2,R7                                                          
         LW,R4    :#CONVL+1,R2      GET LOW 4 CHAR                              
         STW,R4   3,R7                                                          
         LW,R6    :#CSMAD,R2        RETURN                                      
         B        *R6                                                           
SERD1    DATA,1   ' ','+','.',0     BLANK,PLUS,PERIOD,ZERO                      
         TITLE    '***  :#CNIFX ***'                                            
*************************                                                       
*         :#CNIFX        *                                                      
*************************                                                       
*  CONVERT   INTERNAL FORMAT TO HEX CHARACTERS                                  
*        CALL IS  BAL,R8 :#CNIFX                                                
*                 R7 CONTAINS THE ADDRESS WHERE   THE                           
*                    CHARACTERS   ARE TO BE PUT                                 
*                 R9 CONTAINS THE VALUE   TO BE CONVERTED                       
*                 ON RETURN  *R7  CONTAINS THE CHARACTERS                       
*                    RIGHT ADJUSTED WITH LEADING ZERO                           
*                    CHARACTERS                                                 
*  REGISTERS     USED                                                           
*    R4,R5,R6,R7,R8,R9                                                          
:#CNIFX  RES      0                                                             
         LI,R6    7                                                             
         LW,R4    R9                                                            
CNXLP    SLD,R4   -4                                                            
         SLS,R5   -28                                                           
         CI,R5    10                                                            
         BGE      %+3                                                           
         AI,R5    X'F0'             CONVERT   TO NUMERIC CHARACTER              
         B        %+2                                                           
         AI,R5    X'B7'             CONVERT   TO ALF CHARACTER                  
         STB,R5   *R7,R6                                                        
         AI,R6    -1                                                            
         BGE      CNXLP             CONTINUE CONVERSION                         
         B        *R8               DONE-DO RETURN                              
A:DBC1   RES      0                                                             
         OLAYEND                                                                
         FIN      #DEBUG                                                        
         END                                                                    
