         PAGE                                                                   
         PSYS      0                                                            
OLAYFLAG EQU      'DBS2'                                                        
         SYSTEM   OPTIONS                                                       
         DO       #DEBUG                                                        
         SYSTEM   CPRMON                                                        
         PSYS     0                                                             
         SYSTEM   OLAYBASE                                                      
         DEF      A:DBS2            DEBUG SCAN PART 2                           
         DEF      :#DOINIT                                                      
         DEF      :#DOTRAP                                                      
         DEF      :#DOSNAP                                                      
         DEF      :#TRAPEX                                                      
         DEF      CSEARCH                                                       
         DEF      OSEARCH                                                       
         DEF      USEARCH                                                       
         DEF      :#DORET                                                       
         DEF      SNAPOUT1          OVERLAY OUTAGE                              
         DEF      SNAPOUT2          OVERLAY OUTAGE                              
         DEF      SEARCHEX          RETURN FROM SEARCHING                       
         DEF      TRAPOUT           OVERLAY OUTAGE                              
         DEF      TRAPINEX          OVERLAY OUTAGE TO TRAPIN                    
*        REF      :#SCAN,:#WKSQZ    OVERLAY-S1                                  
*        REF      :#BRNCH           OVERLAY-S3                                  
*        REF      :#MODFY,:#INSRT   OVERLAY-C1                                  
*        REF      :#NAME,:#SNAP     OVERLAY-C1                                  
*        REF      :#LOOK,:#SNAPIT   OVERLAY-C1                                  
*        REF      :#CONSG,:#ASSGN   OVERLAY-C2                                  
*        REF      :#EXCT,:#TINIT    OVERLAY-C2                                  
*        REF      :#PATCH,:#QUIT    OVERLAY-C2                                  
*        REF      :#REMOV,:#TRAPIN  OVERLAY-C2                                  
*        REF      :#DUMP            OVERLAY-C3                                  
         ORG      0                                                             
         PAGE                                                                   
*************************                                                       
*    SEARCH ROUTINES     *                                                      
*************************                                                       
         PAGE                                                                   
USEARCH  RES      0                                                             
         STW,R8   :#SERET,R2                                                    
         LW,R7    :#FRSYM,R2        POINTER   TO FIRST USER :#SYMBL             
USERLP   BE       USERU             END OF :#SYMBLS UNDEFINED                   
         LW,R14   4,R7              GET FIRST PART OF :#SYMBL                   
         LW,R9    5,R7              GET LAST PART                               
         CW,R14   :#SYMBL,R2        SEE IF MATCH                                
         BNE      %+3                                                           
         CW,R9    :#SYMBL+1,R2                                                  
         BE       USERFD            :#SYMBL FOUND                               
         LW,R7    2,R7              GET NEXT :#SYMBL POINTER                    
         B        USERLP            CONTINUE SEARCH                             
USERFD   LW,R8    3,R7              GET VALUE                                   
         LI,R7    0                 DO :#RETRN                                  
         B        SERETOUT                                                      
USERU    RES      0                                                             
         LW,R8    :#SYMBL,R2        GET FIRST HALF OF SYMBOL                    
         LW,R9    :#SYMBL+1,R2      GET SECOND HALF OF SYMBOL                   
         BAL,R7   CPRSYMBL          GO LOOK FOR A CPR SYMBOL                    
         B        USERVU            UN-DEFINED SYMBOL                           
*                                   CPR SYMBOL NOW IN R8                        
         LI,R7    0                 SET FOUND FLAG                              
         B        SERETOUT          AND EXIT                                    
*                                                                               
USERVU   RES      0                                                             
         LW,R14   BLANKS                                                        
         LW,R9    BLANKS                                                        
         LI,R7    1                 SET UNDEFINED FLAG                          
         B        SERETOUT          AND EXIT                                    
         PAGE                                                                   
OSEARCH  RES      0                                                             
         STW,R8   :#SERET,R2                                                    
         LI,R7    1                                                             
         LI,R5    0                 FIND NUM OF CHAR IN SYM                     
         LI,R3    X'40'             BLANK                                       
CHCTLP   LW,R9    :#SBLPT,R2                                                    
         CB,R3    *R9,R5                                                        
         BE       GOTCT                                                         
         AI,R5    1                                                             
         CI,R5    8                                                             
         BL       CHCTLP            CONTINUE LOOK AT :#SYMBL                    
GOTCT    CI,R5    2                 FIND CORRECT OP TABLE                       
         BLE      OP2               1 OR 2 CHAR                                 
         CI,R5    4                 3 OR 4 CHAR                                 
         BLE      OP4                                                           
         B        OP8               5,6,7,8, CHAR                               
         PAGE                                                                   
OP2      LI,R5    TOP2X             ADDRESS OF VALUE   TABLE                    
         LH,R3    TOP2              TABLE   SIZE                                
         LW,R9    :#SBLPT,R2        GET TWO CHAR                                
         LH,R9    *R9                                                           
OP2LP    CH,R9    TOP2,R3                                                       
         BE       OPFND             OP CODE FOUND                               
         BDR,R3   OP2LP             CONTINUE SEARCH                             
         B        OPSRTU                                                        
OPFND    LH,R8    *R5,R3            GET VALUE                                   
         LI,R7    0                 SET FOUND :#RETRN                           
         B        SERETOUT                                                      
OPSRTU   LI,R7    1                 SET UNDEFINED :#RETRN                       
         B        SERETOUT                                                      
         PAGE                                                                   
OP4      RES      0                 SEARCH TOP4                                 
         LI,R5    TOP4X                                                         
         LW,R3    TOP4                                                          
         LW,R9    :#SYMBL,R2                                                    
OP4LP    CW,R9    TOP4,R3                                                       
         BE       OPFND                                                         
         BDR,R3   OP4LP                                                         
         B        OPSRTU                                                        
         PAGE                                                                   
OP8      LI,R5    TOP8X                                                         
         LW,R3    TOP8              GET TABLE   SIZE                            
         LW,R8    :#SYMBL,R2                                                    
         LW,R9    :#SYMBL+1,R2                                                  
OP8LP    CD,R8    TOP8,R3                                                       
         BE       OPFND                                                         
         BDR,R3   OP8LP                                                         
         B        OPSRTU                                                        
         PAGE                                                                   
*************************                                                       
*       COMMAND SEARCH     *                                                    
*************************                                                       
CSEARCH  STW,R8   :#SERET,R2                                                    
         LH,R3    CMTB              GET TABLE   SIZE                            
         LW,R9    :#SBLPT,R2        GET COMMAND                                 
         LH,R9    *R9                                                           
CSEALP   CH,R9    CMTB,R3           COMPARE TO TABLE                            
         BE       COMFND            MATCH FOUND                                 
         BDR,R3   CSEALP                                                        
         LI,R7    1                 SET UNDEFINED FLAG                          
         B        SERETOUT                                                      
COMFND   LB,R8    CMTBHX,R3         GET VALUE                                   
         LI,R7    0                 SEARCH COMPLETE-:#RETRN                     
SERETOUT LW,R9    :#SERET,R2       PICKUP RETURN                                
SEARCHEX B        *R9                                                           
         PAGE                                                                   
*************************                                                       
*         TABLES         *                                                      
*************************                                                       
         PAGE                                                                   
*************************                                                       
*      COMMAND TABLE     *                                                      
*************************                                                       
*        THE COMMAND TABLE   WILL BE A SERIES   OF TWO BYTE COMMANDS.           
*                 THE FIRST HALFWORD OF THE TABLE   WILL BE THE                 
*                 NUMBER   OF ENTRIES.                                          
CMTB     RES      0                                                             
         DATA,2   HA(CMTBE)-HA(CMTB)-1   SIZE OF TABLE                          
         DATA,2   'A ','CA','CD','CE','M '                                      
         DATA,2   'IB','IA','IR','N ','NL','NP'                                 
         DATA,2   'SC','S ','P ','PE'                                           
         DATA,2   'R ','RS','RI','RN','B ','BM'                                 
         DATA,2   'L ','EB','EH','DL','D '                                      
         DATA,2   'Q ','QJ','W '                                                
CMTBE    RES      0                                                             
*        THE PARALLEL HEX VALUE   TABLE   WILL CONTAIN A BYTE FOR               
*                 EACH COMMAND. THE LOW  ORDER   5 BITS WILL                    
*                 CONTAIN A COMMAND TYPE INDEX. THIS WILL BE                    
*                 USED AS A BRANCH TABLE   INDEX. THE HIGH ORDER                
*                 3 BITS  IS A SUB-TYPE IDENTIFIER   AND IS PASSED              
*                 TO THE MAIN COMMAND HANDLER                                   
*                                   THE FIRST BYTE IS IGNORED                   
         BOUND    4                                                             
CMTBHX   DATA,1   BA(CMTBHXE)-BA(CMTBHX)-1         SIZE OF TABLE                
         DATA,1   X'00',X'21',X'41',X'61',X'02'                                 
         DATA,1   X'23',X'43',X'63',X'24',X'44',X'64'                           
         DATA,1   X'25',X'45',X'26',X'46'                                       
         DATA,1   X'28',X'48',X'68',X'88',X'29',X'49'                           
         DATA,1   X'0A',X'2B',X'4B',X'2C',X'4C'                                 
         DATA,1   X'2D',X'4D',X'07'                                             
CMTBHXE  RES      0                                                             
         PAGE                                                                   
*************************                                                       
*      OP-CODE TABLE     *                                                      
*************************                                                       
*        THE OP-CODE TABLE   IS REALLY THREE SEPARATE TABLES.                   
*                 TOP2 CONTAINS OP CODES WITH 1 OR 2                            
*                   CHARACTERS                                                  
*                 TOP4 CONTAINS OP CODES WITH 3 OR 4                            
*                   CHARACTERS                                                  
*                 TOP8 CONTAINS OP CODES WITH 5,6,7,OR 8                        
*                   CHARACTERS                                                  
*        THE PARALLEL VALUE   TABLE   ALWAYS CONTAINS A HALFWORD                
*                 FOR EACH ENTRY                                                
*                 THE LOW ORDER   4 BITS (12-15) GIVE THE CLASS                 
*                                                                               
*                 CLASS   0 OP,R    *A,X     ALL OTHERS                         
*                 CLASS   1 OP,R    VALU     LI,AI,.......                      
*                 CLASS   2 OP      *A,X     B,BNE,EXU,......                   
*                 CLASS   3 OP,R    VALU,X   SAS,SLS,......                     
*                 CLASS   4 OP      CC,FC    LCI,LCFI,......                    
*                 CLASS   5 OP,VALU *A,X     MTW,MTB,......                     
*                 CLASS   6 OP,R    *A       MMC                                
*                 THE HIGH ORDER   BYTE (0-7) GIVES THE CODE                    
*                 FOR ALL CLASSES                                               
*                 THE MID 4 BITS (8-11) GIVES THE TYPE                          
*                 FOR CLASSES   2,3,4,6                                         
*                 BITS 8-11 GIVE THE SIZE OF THE ADDRESS                        
*                 FIELD - 16 FOR CLASSES   0,1,5                                
         BOUND    4                                                             
TOP2     DATA,2   HA(TOP2E)-HA(TOP2)-1   *TABLE   OF 1-2 BYTE OPCODE MNEMONICS  
*                                                                               
         DATA,2   'LI','LB','LH','LW','LD','LS','LM','LC','LF','XW'             
         DATA,2   'AI','AH','AW','AD','SH','SW','SD','MI','MH','MW'             
         DATA,2   'DH','DW','CI','CB','CH','CW','CD','CS','OR','S '             
         DATA,2   'B ','BE','BG','BL','BC','RD','WD'                            
TOP2E    RES      0                                                             
*                                                                               
         BOUND    4                                                             
TOP2X    DATA,2   HA(TOP2XE)-HA(TOP2X)-1                                        
         DATA,2   X'2241',X'7210',X'5210',X'3210',X'1210',X'4A10'               
         DATA,2   X'2A10',X'7022',X'7012',X'4610',X'2041',X'5010'               
         DATA,2   X'3010',X'1010',X'5810',X'3810',X'1810',X'2341'               
         DATA,2   X'5710',X'3710',X'5610',X'3610',X'2141',X'7110'               
         DATA,2   X'5110',X'3110',X'1110',X'4510',X'4910',X'2510'               
         DATA,2   X'6802',X'6832',X'6922',X'6912',X'6982',X'6C10'               
         DATA,2   X'6D10'                                                       
TOP2XE   RES      0                 TABLE   END                                 
*                                                                               
         BOUND    4                                                             
TOP4     DATA,4   (TOP4E-TOP4)-1   *TABLE   OF 3-4 BYTE OPCODE MNEMONICS        
*                                                                               
         DATA,4   'LCH ','LAH ','LCW ','LAW ','LCD ','LAD ','LCFI'              
         DATA,4   'LCF ','STB ','STH ','STW ','STD ','STS ','STM '              
         DATA,4   'STCF','ANLZ','INT ','AWM ','MTB ','MTH ','MTW '              
         DATA,4   'CLR ','CLM ','EOR ','AND ','SLS ','SLD ','SCS '              
         DATA,4   'SCD ','SAS ','SAD ','CVA ','CVS ','PSW ','PLW '              
         DATA,4   'PSM ','PLM ','MSP ','EXU ','BCS ','BCR ','BIR '              
         DATA,4   'BDR ','BAL ','BGE ','BLE ','BNE ','BEZ ','BNEZ'              
         DATA,4   'BGZ ','BGEZ','BLZ ','BLEZ','BAZ ','BANZ','BOV '              
         DATA,4   'BNOV','BNC ','BWP ','BDP ','BEV ','BOD ','BSU '              
         DATA,4   'BNSU','BSE ','BSNE','BSF ','BSNF','BSO ','BNSO'              
         DATA,4   'CAL1','CAL2','CAL3','CAL4','LPSD','XPSD','LRP '              
         DATA,4   'MMC ','WAIT','NOP ','SIO ','HIO ','TIO ','TDV '              
         DATA,4   'AIO ','PZE ','LCI '                                          
TOP4E    RES      0                 TABLE   END                                 
*                                                                               
         BOUND    4                                                             
TOP4X    DATA,2   HA(TOP4XE)-HA(TOP4X)-1                                        
         DATA,2   X'5A10',X'5B10',X'3A10',X'3B10',X'1A10',X'1B10'               
         DATA,2   X'0234',X'7032',X'7510',X'5510',X'3510',X'1510'               
         DATA,2   X'4710',X'2B10',X'7402',X'4410',X'6B10',X'6610'               
         DATA,2   X'7315',X'5315',X'3315',X'3910',X'1910',X'4810'               
         DATA,2   X'4B10',X'2503',X'2513',X'2523',X'2533',X'2543'               
         DATA,2   X'2553',X'2910',X'2810',X'0910',X'0810',X'0B10'               
         DATA,2   X'0A10',X'1310',X'6702',X'6910',X'6810',X'6510'               
         DATA,2   X'6410',X'6A10',X'6812',X'6822',X'6932',X'6832'               
         DATA,2   X'6932',X'6922',X'6812',X'6912',X'6822',X'6842'               
         DATA,2   X'6942',X'6942',X'6842',X'6882',X'6842',X'6942'               
         DATA,2   X'6882',X'6982',X'6922',X'68A2',X'6912',X'6812'               
         DATA,2   X'6942',X'68F2',X'6982',X'6882',X'0410',X'0510'               
         DATA,2   X'0610',X'0710',X'0E10',X'0F10',X'2F02',X'6F16'               
         DATA,2   X'2E02',X'6902',X'4C10',X'4F10',X'4D10',X'4E10'               
         DATA,2   X'6E10',X'0002',X'0224'                                       
TOP4XE   RES      0                 TABLE   END                                 
*                                                                               
         BOUND    8                                                             
TOP8     DATA     DA(TOP8E)-DA(TOP8)-1    *TABLE   OF 5-6 BYTE OPCODE MNEMONIC> 
         DATA     0                                                             
         DATA,8   'BNCNO   ','BIOAR   ','BIOANR  ','BIODO   ',;                 
                  'BIODNO  ','BIOSP   ','BIOSNP  ','BIOSS   ',;                 
                  'BIOSNS  '                                                    
TOP8E    RES      0                 TABLE   END                                 
*                                                                               
         BOUND    4                                                             
TOP8X    DATA,2   HA(TOP8XE)-HA(TOP8X)-1                                        
         DATA,2   X'68C2',X'6882',X'6982',X'6942',X'6842',X'6842',;             
                  X'6942',X'6842',X'6942'                                       
TOP8XE   RES      0                 TABLE   END                                 
         TITLE    '***  :#USRIN5 ***'                                           
         PAGE                                                                   
*************************                                                       
*         :#USRIN5       *                                                      
*************************                                                       
*  REGISTERS     USED                                                           
*  R2,R3,R4,R6,R7,R8,R9,R10                                                     
*************************                                                       
*          :#USRIN5      *                                                      
*************************                                                       
:#USRIN5 RES      0                                                             
         LW,R1    :#TBFLAG,R2       TEST FOR PENDING TRAP/BREAK                 
         BEZ      UIN51             N0 -                                        
         LW,R9    :#INTODB,R2       RESTORE TRAP CODITION CODES                 
         B        TRAPINEX          AND PROCESS                                 
UIN51    RES      0                                                             
         LW,R8    DLINK                                                         
         STW,R8   :#CALERR,R2                                                   
         LW,R7    R2                                                            
         AI,R7    :#INBF            POINTER TO COMMAND BUFFER                   
         LI,R6    79                INDEX TO LAST CHARACTER TO READ             
         LI,R8    ' '                                                           
         STB,R8   *R7,R6                                                        
         BDR,R6   %-1               BLANK OUT THE BUFFER                        
         STB,R8   *R7                                                           
         LW,R10   :#PRTBF,R2        GET PROMPT                                  
         SLS,R10  -24               RIGHT JUSTIFY FOR READ W/PROMPT             
         CAL1,1   :#RDFPT,R2        REQUEST INPUT FROM THE TELETYPE             
*                                                                               
         LW,R6    :#WRFPT,R2        WRITE DCB ADDRESS                           
         LW,R7    :#RDFPT,R2        READ DCB ADDRESS                            
         LD,R8    CORESPND          GET CORRESPONDANCE FPT                      
         CAL1,1   R8                TEST FOR CORRESPONDENCE                     
         CI,R8    1                 SAME DEVICE?                                
         BE       DECODEU           YES, DONT ECHO                              
*                                   NO, ECHO                                    
         SETBUF   :#INBF,80                                                     
         CAL1,1   :#WRFPT,R2                                                    
         PAGE                                                                   
*************************                                                       
*         DECODE         *                                                      
*************************                                                       
*  REGISTERS     USED                                                           
*   R7,R8,R9,R10                                                                
DECODEU  RES      0                 BUFFER   IN CORE-DECODE ON LINE INPUT       
         :#SCAN   :#GETCOM          GET COMMAND                                 
         GETSTS                     GET STATUS BYTE                             
         BE       :#USRIN5          NULL FIELD                                  
         CI,R6    6                                                             
         BNE      COMER1            SYNTAX ERROR                                
         SLD,R8   -5                GET SUB CODE IN R8                          
         SLS,R9   -27               GET MAIN CODE IN R9                         
         LW,R7    R9                                                            
CKOPN    B        COMBTB,R7         :#BRNCH   TO ROUTINE                        
DRCBIT   DATA     X'400'                                                        
*                                                                               
COMER1   RES      0                                                             
         :#DBERR5 X'62'             INVALID COMMAND                             
BATER1   :#DBERR5 X'64'             COMMAND ILLEGAL FOR BATCH                   
*                                                                               
         BOUND    8                                                             
CORESPND GEN,1,7,24 1,X'2B',R6      *R6                                         
         GEN,1,31   1,R7            *R7                                         
         PAGE                                                                   
COMBTB   RES      0                 T:#ABLE OF :#BRNCHES   TO ENTER   THE DEBUG 
*                                     SUBROUTINES                               
         B        :#ASSGN           ASSIGN                                      
         B        :#CONSG           CONTROL SEGMENTS                            
         B        :#MODFY           MODIFY                                      
         B        :#INSRT           :#INSRT                                     
         B        :#NAME            NAME                                        
         B        :#SNAP            SNAPSHOT                                    
         B        :#PATCH                                                       
BATCM    RES      0                                                             
OPNCM    B        :#WKSQZ                                                       
         B        :#REMOV           :#REMOV                                     
         B        :#BRNCH           BRANCH                                      
         B        :#LOOK            LOOK                                        
         B        :#EXCT            EXECUTE                                     
         B        :#DUMP            DUMP                                        
         B        :#QUIT            QUIT                                        
         TITLE    '***  :#DORET   ***'                                          
:#DORET  RES      0                                                             
         LI,R4    0                                                             
         STW,R4   :#OLSNP,R2                                                    
         LCI      13                RESTORE   REGISTERS                         
         LM,R3    :#REG0+3,R2                                                   
         LW,R0    :#CCSV,R2                                                     
         SLS,R0   4                                                             
         OR,R0    :#FLSV,R2                                                     
         SLS,R0   24                                                            
         LW,R1    :#TBFLAG,R2       TEST IF TRAP OR BREAK PENDING               
         BNEZ     :#USRIN5          YES -                                       
         STW,R1   :#INTODB,R2       NO - CLEAR IN DEBUG FLAG                    
         STW,R0   :#CCSV,R2                                                     
         LW,R0    :#REG0,R2                                                     
         LW,R1    :#REG0+1,R2                                                   
         MTW,0    :#SNPSV,R2        SEE IF OLD CONTENTS SHOULD BE EXECUTED      
         BL       BSNRT             RETURN  FROM SNAP                           
SNAPOUT1 B        :#SNPOUT,R2       RETURN                                      
BSNRT    MTW,1    :#SNPSV,R2        :#BRNCH   TO NEXT LOC                       
SNAPOUT2 B        :#SNPOUT+3,R2                                                 
         PAGE                                                                   
*        PROCESS  SNAP ELEMENT                                                  
:#DOSNAP RES      0                                                             
*                                                                               
* PUT IN CODE TO READ PSD AND SAVE IT                                           
*        THIS IS NECESSARY TO GET CC,FLT,MAP,WP,:#REG                           
*                                                                               
         STW,R2   :#INTODB,R2       SET FLAG FOR DEBUG ENTRY                    
         STW,R3   :#SNPSV,R2        SAVE LOCATION OF PATCH EL                   
         BAL,R3   :#SVRCF           SAVE REG AND CONTROLS                       
         B        :#SNAPIT                                                      
         PAGE                                                                   
:#SVRCF  RES      0                 SAVE REG 0-14,CC,FLT                        
*SAVE REGISTERS                                                                 
         STW,R0   :#REG0,R2                                                     
         STW,R1   :#REG0+1,R2                                                   
*CODE TO :#STORE CC AND FLT                                                     
         LI,R1    :#QCCSV                                                       
         LB,R0    *R2,R1            GET SAVED CC - FLT CTRLS                    
         SLD,R0   -4                                                            
         STW,R0   :#CCSV,R2                                                     
         SLS,R1   -28               GET FLT                                     
         STW,R1   :#FLSV,R2                                                     
         LCFI     12,0              SAVE REGISTERS                              
         STM,R4   :#REG0+4,R2                                                   
         B        *R3               RRETURN                                     
         PAGE                                                                   
DLINK    DATA     :#DBERR5                                                      
ULINK    DATA     :#USRIN5                                                      
:#DOINIT RES      0                 LINKUPWITH TRAP INIT.                       
         LW,R8    DLINK                                                         
         STW,R8   :#DBERR,R2                                                    
         LW,R8    ULINK                                                         
         STW,R8   :#USRIN,R2                                                    
         STW,R2   :#INTODB,R2                                                   
         DO1      UTS=1                                                         
         B        :#USRIN5                                                      
         B        :#TINIT                                                       
*                                                                               
         TITLE    '***  :#DOTRAP  ***'                                          
:#DOTRAP RES      0                 PROCESS TRAP CONDITION                      
         STB,R10  R9                 SAVE CC IN R9                              
         LW,R0    TRTYCAL                                                       
         LW,R1    TRTYCAL+1                                                     
         LW,R7    :#TBFLAG,R2       TEST IF MULTIPLE TRAP/BREAK                 
         BNEZ     TRAPOUT           YES - WAIT ON TRAP PENDING                  
         LW,R3    *PCBPOINT         SET STACK POINTER AND PICK                  
         LW,R8    -18,R3            UP TRAPING ADDRESS                          
         LW,R7    *R3               ALSO TRAP TYPE AND SAVE                     
         STB,R7   R8                TOGETHER                                    
         STW,R8   :#TBFLAG,R2                                                   
         LW,R7    :#INTODB,R2       TEST IF ALREADY IN DEBUG                    
         BEZ      DOTP1             NO -                                        
         AW,R9    R2                OTHERWISE - SAVE CC OF TRAP                 
         STW,R9   :#INTODB,R2                                                   
*        LB,R7    R8                                                            
*        CI,R7    X'51'             IS THIS A BREAKIN                           
*        BE       TRAPOUT           YES - WAIT TO BE PROCESSED                  
         B        TRAPINEX          NO  - THEN PROCESS NOW                      
DOTP1    STW,R8   :#INTODB,R2       FLAG INTERNAL TO DEBUG                      
TRAPINEX B        :#TRAPIN          AND PROCESS TRAP DIRECTLY                   
*                                                                               
*                                                                               
:#TRAPEX RES      0                                                             
         LW,R0    TRTNCAL           PREPARE TO EXIT                             
         LI,R1    0                                                             
         STW,R2   :#INTODB,R2                                                   
         STW,R1   :#TBFLAG,R2                                                   
*        CW,R9    R8                TEST INTERNAL/EXTERNAL TRAP/BREAK           
*        BE       R0                EXTERNAL, RETURN THIS OVERLAY               
         B        R0                                                            
TRAPOUT  B        R0                INTERNAL, RETURN ANOTHER OVERLAY            
TRTNCAL  CAL1,9   5                 TRAP RETURN CAL                             
TRTYCAL  CAL1,7   1                                                             
         DATA     X'5E000000'                                                   
         TITLE    '***  :#CNIFX ***'                                            
*************************                                                       
*         :#CNIFX        *                                                      
*************************                                                       
         PAGE                                                                   
*  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                                                          
         PAGE                                                                   
:#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                              
         TITLE    '***  :#CNIFD ***'                                            
*************************                                                       
*         :#CNIFD        *                                                      
*************************                                                       
         PAGE                                                                   
*  CONVERT   INTERNAL FORMAT TO DECIMAL CHARACTERS                              
*        CALL IS  BAL,R8 :#CNIFD                                                
*                 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. LEADING ZEROS   WILL BE                    
*                    REPLACED BY CHARACTER   ZEROS.                             
*   REGISTERS     USED                                                          
*    R4,R5,R6,R7,R8,R9                                                          
         PAGE                                                                   
:#CNIFD  RES      0                                                             
         LI,R4    ' '                                                           
         CI,R9    0                 SEE IF NUMBER IS +OR -                      
         BGE      %+3               WORD IS +                                   
         LCW,R9   R9                                                            
         LI,R4    '-'                                                           
         STB,R4   *R7                                                           
         LI,R6    11                                                            
         LW,R5    R9                                                            
CNDLP    LI,R4    0                                                             
         DW,R4    :#KA              DEVIDE BY 10                                
         AI,R4    X'F0'                                                         
         STB,R4   *R7,R6                                                        
         BDR,R6   CNDLP             CONTINUE FOR 12 CHAR                        
         B        *R8               GET LEADING ZEROS   AUTOMATICALLY           
:#KA     DATA     10                                                            
         TITLE    '***  :#DBERR5 ***'                                           
*************************                                                       
*         :#DBERR5       *                                                      
*************************                                                       
         PAGE                                                                   
*                                   R7 CONTAINS THE ERROR   NUMBER              
*                                   R10 BYTE CONTAINS THE FIELD                 
*                                       SCANNED   NUMBER                        
*                                   THE ROUTINE WILL OUTPUT THE FIELD           
*                                       AND ERROR   CODE AND BRANCH TO          
*                                       :#USRIN                                 
*  REGISTERS     USED                                                           
*   R7,R8,R9,R10                                                                
         PAGE                                                                   
:#DBERR5 RES      0                                                             
         LI,R0    :#ERBF            SHIFT MESSAGE FORMAT                        
         AW,R0    R2                                                            
         CI,R7    X'FF'             TEST IF I/O ERROR                           
         BLE      %+3               SKIP IF NOT                                 
         LB,R8    R10               OTHERWISE, SAVE TYC                         
         STW,R8   :#FLDCT,R2                                                    
         LCI      6                                                             
         LM,R10   ERRTEXT                                                       
         STM,R10  *R0                                                           
         LW,R9    R7                CONVERT   ERROR NUMBER TO DECCHAR           
         :#CNIFX  :#CONVL                                                       
         LW,R9    :#CONVL+1,R2      GET LOW CHARACTERS                          
         LI,R7    X'40'             BLANK                                       
         STB,R7   R9                                                            
         STW,R9   :#ERNTX,R2                                                    
         LW,R9    :#FLDCT,R2                                                    
         :#CNIFD  :#CONVL                                                       
         LW,R9    :#CONVL+2,R2      GET CHARACTERS                              
         LI,R6    :#ERFTX                                                       
         AW,R6    R2                                                            
         STH,R9   *R6                                                           
         SETBUF   :#ERBF,ERBFS                                                  
         LW,R9    DLINK                                                         
         STW,R9   :#CALERR,R2                                                   
         CAL1,1   :#WRFPT,R2        DO OUTPUT                                   
         B        :#USRIN5          REQUEST NEW INPUT LINE                      
*                                                                               
ERRTEXT  TEXT     'ERR      IN FIELD     '                                      
ENDTEXT  RES      0                                                             
ERBFS    EQU      BA(ENDTEXT)-BA(ERRTEXT)                                       
A:DBS2   RES      0                                                             
         OLAYEND                                                                
         FIN      #DEBUG                                                        
         END                                                                    
