.SBTTL .SBTTL .SBTTL DBGMAC - Local macro definitions for DBG ;Edit 00 .SBTTL .SBTTL .IIF NDF,L$$LST,.NLIST ; Copyright (c) 1998 by Mentec, Inc., Nashua, NH. ; All rights reserved ; ; This software is furnished under a license for use only on a ; single computer system and may be copied only with the ; inclusion of the above copyright notice. This software, or ; any other copies thereof, may not be provided or otherwise ; made available to any other person except for use on such ; system and to one who agrees to these license terms. Title ; to and ownership of the software shall at all times remain ; in Mentec, Inc. ; ; The information in this document is subject to change without ; notice and should not be construed as a commitment by Digital ; Equipment Corporation, or Mentec, Inc. ; ; Digital and Mentec assume no responsibility for the use or ; reliability of its software on equipment which is not supplied ; by Digital or Mentec, and listed in the Software Product ; Description. ;++ ; Facility: DBG - A PDP-11 system independant symbolic debugger ; ; Authors: Don Bridgewater / Chuck Guldenschuh / Joe Worrall ; ; Created: Started by Chuck in 1980. ; ; Abstract: DBGMAC - Local macro definitions for all DBG modules ; ; Externals Description ; --------- ----------- ; ; Edit Who Date Description of modification ; ---- --- ---- --------------------------- ; 001 Jfw 29-Aug-88 Add conditionals to support a VM/SM ; combination for system debugging. ;-- .SBTTL Conditional assembly summary ;+ ;COND ; ; D$$DBG (1) Symbol always defined for default conditional ; assembly of undefined macro arguments. ; ; SYSTEM Operating system type: ; 0 RT-11 ; 1 RSX ; ; R$$RT (1) If SYSTEM = RT-11 ; R$$RSX (1) If SYSTEM = RSX ; ; RSTS (1) If RSTS/E support. Note that RSTS support ; can either be RSTS/RT-11 or RSTS/RSX so the ; RSTS symbol is seperate from SYSTEM. ; ; R$$PRO (1) If PRO-3xx hard i/o mode support. ; ; SD$$VM (0) Standard SD ; 1 VM/SD system debugging combination ; ; TTYPE Terminal type supported ; 0 Hardcopy only (LA36) ; 1 Graphics register display (VT100) ; ; G$$APH (1) If graphics register display is supported, ; IE: TTYPE = VT100. ; ; IOMODE Supported IO configuration: ; 0 Hard I/O ; 1 Soft I/O ; ; H$$IOM (1) If IOMODE = HARD ; S$$IOM (1) If IOMODE = SOFT ; ; S$$STB (1) If support for .STB files is included under ; a soft i/o RSX assembly. ; ; E$$TXT (1) Long error messages ; ; $$$PIC (1) PIC code support ; ; $$$ROM (1) If ROMable code supported ; ; D$$DAS (1) If I&D space is supported ; ; D$$OUT (1) If debugger out of address space is supported ; ; D$$DRV (1) If generating RT-11 SD: driver ; ; $DEBUG (1) If debugging the debugger ; ; $GLOBS (1) If all DBG routine names should be declared ; as global symbols. ;-- .SBTTL Verify option selections for legality ; Check for legal terminal type / graphics support .IF EQ, .ERROR ;Terminal type VT52 not supported - defaulting to LA36 TTYPE = LA36 .ENDC; EQ, ; Setup logical symbols for COND=x$$xxx conditionals G$$APH = 0 ;Graphics register display support S$$IOM = 0 ;Hardware I/O support H$$IOM = 0 ;Software I/O support R$$RSX = 0 ;RSX-11 support R$$RT = 0 ;RT-11 support .IIF NE,, G$$APH=1 ;Graphics support .IIF EQ,,H$$IOM=1 ;Hardware I/O support .IIF EQ,,S$$IOM=1 ;Software I/O support .IIF EQ,,R$$RT =1 ;RT-11 DBG .IIF EQ,,R$$RSX=1 ;RSX-11 DBG .IF NE, ;If RSX version .IIF NE,, .ERROR ;D$$DRV mode not supported for RSX-11 .IIF NE,<$$$PIC>, .ERROR ;PIC code not supported for RSX-11 .IF NE, ;If HARD I/O .IIF EQ,, .ERROR ;Invalid configuration of H$$IOM and D$$OUT .IIF NE,, .ERROR ;Invalid configuration of H$$IOM and S$$STB .IIF EQ,<$GLOBS>, .ERROR ;R$$RSX & H$$IOM require $GLOBS .ENDC; NE, ;If HARD I/O .IF NE, ;If I/D space .IIF EQ,<$$$ROM>, .ERROR ;I&D space support requires $$$ROM=1 .IIF EQ,, .ERROR ;I&D space support requires D$$OUT=1 .ENDC; NE, ;If I/D space .ENDC; NE, ;If RSX version .IF NE, ;If RSTS version .IIF NE,<$$$ROM>, .ERROR ;Unsupported configuration of RSTS and $$$ROM .IIF NE,, .ERROR ;Unsupported configuration of RSTS and H$$IOM .IIF NE,, .ERROR ;Unsupported configuration of RSTS and D$$DRV .IIF NE,<$$$PIC>, .ERROR ;Unsupported configuration of RSTS and $$$PIC .IIF NE,, .ERROR ;Unsupported configuration of RSTS and S$$STB .ENDC; NE, ;If RSTS version .IF NE, ;If RT-11 version .IIF NE,, .ERROR ;Invalid configuration of R$$RT and S$$STB .IF NE, ;If SD: type .IIF EQ,<$$$PIC>, .ERROR ;Must have $$$PIC support for RT-11 D$$DRV! .ENDC; NE, ;If SD: type .ENDC; NE, .IIF NE,, .ERROR ;Invalid configuration of R$$PRO and S$$IOM .IIF NDF,SD$$VM SD$$VM=0 .IF EQ, ;+ ; MUL ; This macro simulates the MUL instruction on machines which ; do not support EIS. The MUL routine which this macro calls ; only handles the destination register R0. ;- .MACRO MUL SRC,DST .IIF DIF,DST,, .ERROR Invalid arguments to MUL macro .IIF DIF,SRC,, MOV SRC,R1 ;Load source multiplicand for MUL CALL MUL ;Do the multiply simulation .ENDM MUL ;+ ; SOB ; This macro emulates the machine SOB instruction, for machines that ; do not support the EIS instruction set. ;- .MACRO SOB A,B DEC A BNE B .ENDM SOB .ENDC; EQ, ;+ ; PSECT ; This macro allows us to call psects by a resonable name ;- .IF EQ,<$DEBUG> .MACRO PSECT NAME .IF IDN , .IF NE, ;If RT/SD: .IF EQ, .PSECT SDDVR .IFF ; EQ, .PSECT VMDVR .ENDC .ENDC; NE, ;If RT/SD: .MEXIT .ENDC .IF IDN , .IF NE,<$$$ROM> ;No inline volitile data .PSECT DBG$I, RO, I .IFF; NE,<$$$ROM> ;No inline volitile data .PSECT DBG$I, RW, I .ENDC; NE,<$$$ROM> ;No inline volitile data .MEXIT .ENDC .IF IDN , .IF NE,<$$$ROM> ;No inline volitile data .PSECT DBG$PD, RO, D .IFF; NE,<$$$ROM> ;No inline volitile data .PSECT DBG$PD, RW, D .ENDC; NE,<$$$ROM> ;No inline volitile data .MEXIT .ENDC .IF IDN , .IF NE,<$$$ROM> ;No inline volitile data .PSECT DBG$PB, RO, D .IFF; NE,<$$$ROM> ;No inline volitile data .PSECT DBG$PB, RW, D .ENDC; NE,<$$$ROM> ;No inline volitile data .MEXIT .ENDC .IF IDN , .PSECT DBG$D, RW, D .MEXIT .ENDC .IF IDN , .PSECT DBG$SY, RW, D .MEXIT .ENDC .IF IDN , .PSECT DBG$SZ, RW, D .MEXIT .ENDC .IF IDN , .PSECT DBG$BD, RW, D .MEXIT .ENDC .ERROR ;Macro PSECT called with Invalid PSECT name! .ENDM PSECT .IFF; EQ,<$DEBUG> ;If not debugging DBG-11 .MACRO PSECT NAME .IF IDN , .IF NE, ;If RT/SD: .PSECT SDDVR .ENDC; NE, ;If RT/SD: .MEXIT .ENDC .IF IDN , .IF NE,<$$$ROM> ;No inline volitile data .PSECT DBA$I, RO, I .IFF; NE,<$$$ROM> ;No inline volitile data .PSECT DBA$I, RW, I .ENDC; NE,<$$$ROM> ;No inline volitile data .MEXIT .ENDC .IF IDN , .IF NE,<$$$ROM> ;No inline volitile data .PSECT DBA$PD, RO, D .IFF; NE,<$$$ROM> ;No inline volitile data .PSECT DBA$PD, RW, D .ENDC; NE,<$$$ROM> ;No inline volitile data .MEXIT .ENDC .IF IDN , .IF NE,<$$$ROM> ;No inline volitile data .PSECT DBA$PB, RO, D .IFF; NE,<$$$ROM> ;No inline volitile data .PSECT DBA$PB, RW, D .ENDC; NE,<$$$ROM> ;No inline volitile data .MEXIT .ENDC .IF IDN , .PSECT DBA$D, RW, D .MEXIT .ENDC .IF IDN , .PSECT DBA$SY, RW, D .MEXIT .ENDC .IF IDN , .PSECT DBA$SZ, RW, D .MEXIT .ENDC .IF IDN , .PSECT DBA$BD, RW, D .MEXIT .ENDC .ERROR ;Macro PSECT called with Invalid PSECT name! .ENDM PSECT .ENDC; EQ,<$DEBUG> ;If not debugging DBG-11 ;+ ; ADDR ADR,REG,PUSH,COND=D$$DBG ; Compute an address in a position-independent manner ; ; Where: ; ; 'Adr' Is the address to compute ; 'Reg' Is the register to put the result in. ; If 'SP', the address is pushed onto the stack (not loaded into SP) ; 'Push' Is a flag: ; 'Add' Adds the address to the old contents of the register ; 'Push' Pushes the old contents of the register before loading ; 'No' Use with reg=SP to allow MOV #ADDR,@SP not -(SP) ; 'Cond' Is the condition upon which the addr generates code. The default ; D$$DBG, always generates the subject code. ;- .IF NE,<$$$PIC> ;If position independant code .MACRO ADDR ADR,REG,PUSH,COND=D$$DBG .IF NE,COND .IF IDN,REG,SP .IF IDN,PUSH, MOV PC,@SP .IFF; IDN,PUSH, .IF IDN,PUSH, ADD PC,@SP .IFF; IDN,PUSH, MOV PC,-(SP) .ENDC; IDN,PUSH, .ENDC; IDN,PUSH, ADD #ADR-.,@SP .IFF; IDN REG,SP .IF B,PUSH MOV PC,REG .IFF; B,PUSH .IF IDN,PUSH, ADD PC,REG .IFF; IDN,PUSH, JSR REG,@PC .ENDC; IDN,PUSH, .ENDC; B,PUSH ADD #ADR-.,REG .ENDC; IDN,REG,SP .ENDC; NE,COND .ENDM ADDR .IFF; NE,<$$$PIC> ;If position independant code .MACRO ADDR ADR,REG,PUSH,COND=D$$DBG .IF NE,COND .IF IDN,REG,SP .IF IDN,PUSH, MOV #ADR,@SP .IFF; IDN,PUSH, .IF IDN,PUSH, ADD #ADR,@SP .IFF; IDN,PUSH, MOV #ADR,-(SP) .ENDC; IDN,PUSH, .ENDC; IDN,PUSH, .IFF; IDN REG,SP .IF B,PUSH MOV #ADR,REG .IFF; B,PUSH .IF IDN,PUSH, ADD #ADR,REG .IFF; IDN,PUSH, MOV REG,-(SP) MOV #ADR,REG .ENDC; IDN,PUSH, .ENDC; B,PUSH .ENDC; IDN,REG,SP .ENDC; NE,COND .ENDM ADDR .ENDC; NE,<$$$PIC> ;If position independant code ;+ ; ASSUME ; Verify an assumption to be correct ;- .MACRO .ASSUME A1,CND,A2 .IF CND - .IFF .ERROR ;"A1 CND A2" Is not valid! .ENDC .ENDM .ASSUME ;+ ; .BR ; Verify that one routine falls into another. The target, 'LAB', must ; immediately follow the .BR ;- .MACRO .BR LAB .IF NE LAB-. .ERROR ;"LAB" has moved! .ENDC ;NE LAB-. .ENDM .BR ;+ ;.ROM OP SRC,DST,VALUE=0,GLOBAL ; Generates in-line or separate data with instruction ; 'Op' Is the op-code of the instruction to generate ; 'Src' Is the source operand ; 'Dst' Is the destination operand ; 'Value' Is the initial value for the replaced operand ; 'Global' If 'Yes' Globalizes the generated symbol ; ; Depending on the conditional $$$rom, this macro generates in-line data ; and (pc)+ references or data in a separate psect and relative refs. ; ; If Dst is PC-relative, it is replaced. Otherwise, if Src is PC-relative, ; it is replaced and the Dst, if present, may not be immediate or relative. ; ; The word generated is .WORD 'Value', where 0 is the default. ;- .IF EQ,<$$$ROM> .MACRO .ROM OP,SRC,DST,VALUE=0,GLOBAL ...BYT = 0 ;Assume that this is not a byte instruction .IF DIF,OP, .NCHR ......,OP .IF EQ,......-4 .....1 = 0 .IRPC ......, .....1 = .....1+1 .IF EQ,.....1-4 .IIF IDN,......,, ...BYT = 1 ;Oh! But it is a byte instruction! .ENDC; EQ,.....1-4 .ENDM; ......, .ENDC; EQ,......-4 .ENDC; DIF,OP, .IF NB, .NTYPE ..TEMP,DST .IF EQ,..TEMP-67 OP SRC,(PC)+ .IF DIF,GLOBAL, DBGSYM DST .ENDC; DIF,GLOBAL, .IF IDN,GLOBAL, DST:: .WORD VALUE .IFF; IDN,GLOBAL, DST: .WORD VALUE .ENDC; IDN,GLOBAL, .MEXIT .ENDC; EQ,..TEMP-67 .IIF GE,<..TEMP&70>-60, .ERROR ;Macro .ROM -- Second argument wrong mode .IIF EQ,<..TEMP&67>-27, .ERROR ;Macro .ROM -- Second argument wrong mode .ENDC; NB, .NTYPE ..TEMP,SRC .IIF NE,..TEMP-67, .ERROR ;Macro .ROM -- First argument wrong mode .IF B, OP (PC)+ .IFF; B, OP (PC)+,DST .ENDC; B, .IF DIF,GLOBAL, DBGSYM SRC .ENDC; DIF,GLOBAL, .IF IDN,GLOBAL, SRC:: .WORD VALUE .IFF; IDN,GLOBAL, SRC: .WORD VALUE .ENDC; IDN,GLOBAL, .ENDM .ROM .IFF; EQ,<$$$ROM> .MACRO .ROM OP,SRC,DST,VALUE=0,GLOBAL ...BYT = 0 ;Assume that this is not a byte instruction .IF DIF,OP, .NCHR ......,OP .IF EQ,......-4 .....1 = 0 .IRPC ......, .....1 = .....1+1 .IF EQ,.....1-4 .IIF IDN,......,, ...BYT = 1 ;Oh! But it is a byte instruction! .ENDC; EQ,.....1-4 .ENDM; ......, .ENDC; EQ,......-4 .ENDC; DIF,OP, .IF NB, .NTYPE ..TEMP,DST .IF EQ,..TEMP-67 OP SRC,DST .SAVE .IF NE,...BYT PSECT BYTE_DATA .IF DIF,GLOBAL, DBGSYM DST .ENDC; DIF,GLOBAL, .IF IDN,GLOBAL, DST:: .BYTE VALUE .IFF; IDN,GLOBAL, DST: .BYTE VALUE .ENDC; IDN,GLOBAL, .IFF; NE,...BYT PSECT DATA .IF DIF,GLOBAL, DBGSYM DST .ENDC; DIF,GLOBAL, .IF IDN,GLOBAL, DST:: .WORD VALUE .IFF; IDN,GLOBAL, DST: .WORD VALUE .ENDC; IDN,GLOBAL, .ENDC; NE,...BYT .RESTORE .MEXIT .ENDC; EQ,..TEMP-67 .IIF GE,<..TEMP&70>-60, .ERROR ;Macro .ROM -- Second argument wrong mode .IIF EQ,..TEMP&67-27, .ERROR ;Macro .ROM -- Second argument wrong mode .ENDC; NB, .NTYPE ..TEMP,SRC .IIF NE, ..TEMP-67, .ERROR ;Macro .ROM -- First argument wrong mode .IF B, OP SRC .IFF; B, OP SRC,DST .ENDC; B, .SAVE .IF NE,...BYT PSECT BYTE_DATA .IF DIF,GLOBAL, DBGSYM SRC .ENDC; DIF,GLOBAL, .IF IDN,GLOBAL, SRC:: .BYTE VALUE .IFF; IDN,GLOBAL, SRC: .BYTE VALUE .ENDC; IDN,GLOBAL, .IFF; NE,...BYT PSECT DATA .IF DIF,GLOBAL, DBGSYM SRC .ENDC; DIF,GLOBAL, .IF IDN,GLOBAL, SRC:: .WORD VALUE .IFF; IDN,GLOBAL, SRC: .WORD VALUE .ENDC; IDN,GLOBAL, .ENDC; NE,...BYT .RESTORE .ENDM .ROM .ENDC; EQ,<$$$ROM> ;+ ; BLDTAB ; This MOBY macro generates DBG's instruction ENCODE/DECODE table. It's ; a macro so that we don't have to have a moby set of psects to store ; the data in. ;- .MACRO BLDTAB .SBTTL Instruction type definitions OP.LEN =: 4 ;Size of an opcode table entry NO =: 00*2 ;[1 word] No operands R =: 01*2 ;[1 word] R <2:0> register N3 =: 02*2 ;[1 word] N <2:0> 3-bit number CC =: 03*2 ;[1 word] CC <3:0> condition codes O8 =: 04*2 ;[1 word] XXX <7:0> 8-bit offset N6 =: 05*2 ;[1 word] NN <5:0> 6-bit number RO6 =: 06*2 ;[1 word] R,XX <8:6><5:0> reg,6-bit number N8 =: 07*2 ;[1 word] NNN <7:0> 8-bit number DD =: 10*2 ;[1,2 words] DD <5:0> destination SS =: DD ;[1,2 words] SS <5:0> source RDD =: 11*2 ;[1,2 words] R,DD <8:6><5:0> reg,destination RSS =: 12*2 ;[1,2 words] R,SS <8:6><5:0> reg,source SD =: 13*2 ;[1,2,3 words] SS,DD <11:6><5:0> source,destination IO =: 14*2 ;[? words] Unknown opcode (Filler entry) .MACRO TABBLD ; ; Instruction definition table ; ; NAME BASE CODE BYTE-FLAG ; ---- ---- ---- --------- INSTR , 000000 INSTR , 000001 INSTR , 000002 INSTR , 000003 INSTR , 000004 INSTR ,000005 INSTR , 000006 INSTR , 000007 INSTR , 000010,IO INSTR ,000100,DD ;Questionable INSTR , 000100,DD INSTR , 000200,R INSTR ,000207 INSTR , 000210,IO INSTR , 000230,N3 INSTR , 000240 INSTR , 000241,CC INSTR , 000242,CC INSTR , 000244,CC INSTR , 000250,CC INSTR , 000257 INSTR , 000260,IO ;260 = 240 (NOP) INSTR , 000261,CC INSTR , 000262,CC INSTR , 000264,CC INSTR , 000270,CC INSTR , 000277 INSTR , 000300,DD INSTR
, 000400,O8 INSTR , 001000,O8 INSTR , 001400,O8 INSTR , 002000,O8 INSTR , 002400,O8 INSTR , 003000,O8 INSTR , 003400,O8 INSTR , 004000,RDD INSTR , 004700,DD INSTR , 005000,DD, BYTE INSTR , 005100,DD, BYTE INSTR , 005200,DD, BYTE INSTR , 005300,DD, BYTE INSTR , 005400,DD, BYTE INSTR , 005500,DD, BYTE INSTR , 005600,DD, BYTE INSTR , 005700,DD, BYTE INSTR , 006000,DD, BYTE INSTR , 006100,DD, BYTE INSTR , 006200,DD, BYTE INSTR , 006300,DD, BYTE INSTR , 006400,N6 INSTR , 006500,SS INSTR , 006600,DD INSTR , 006700,DD INSTR , 007000,DD INSTR , 007100,IO INSTR , 007200,DD ;J11 only instruction INSTR , 007300,DD ;J11 only instruction INSTR , 007400,IO INSTR , 010000,SD, BYTE INSTR , 020000,SD, BYTE INSTR , 030000,SD, BYTE INSTR , 040000,SD, BYTE INSTR , 050000,SD, BYTE INSTR , 060000,SD INSTR , 070000,RSS INSTR
, 071000,RSS INSTR , 072000,RSS INSTR , 073000,RSS INSTR , 074000,RDD .IF NE, ;If FIS Instruction set support ;+ ; FIS Instruction set ; ; 5 Entries, 1 of which is a filler = 4. Instructions. ;- INSTR , 075000,R INSTR , 075010,R INSTR , 075020,R INSTR , 075030,R INSTR , 075040,IO .IFF; NE, ;If FIS Instruction set support INSTR , 075000,IO .ENDC; NE, ;If FIS Instruction set support INSTR , 077000,RO6 INSTR , 100000,O8 INSTR , 100400,O8 INSTR , 101000,O8 INSTR , 101400,O8 INSTR , 102000,O8 INSTR , 102400,O8 INSTR , 103000,O8 INSTR , 103000,O8 INSTR , 103400,O8 INSTR , 103400,O8 INSTR , 104000,N8 INSTR , 104400,N8 INSTR , 105000,IO INSTR , 106400,SS INSTR , 106500,SS INSTR , 106600,DD INSTR , 106700,DD INSTR , 107000,IO INSTR , 160000,SD INSTR , 170000,IO .ENDM TABBLD .MACRO INSTR NAME,LOLIMT,DECODE=0,BYTE .DSABL CRF .WORD LOLIMT .IF NB,BYTE .BYTE 200!DECODE .IFF; NB,BYTE .BYTE DECODE .ENDC; NB,BYTE .NCHR ..,NAME .BYTE .. .ENABL CRF .ENDM INSTR PSECT PURE_DATA DBGSYM OPTBL OPTBL: TABBLD NULWRD: .WORD 0 .MACRO INSTR NAME,LOLIMT,DECODE=0,BYTE .DSABL CRF .IF NB,NAME .ASCII \NAME\ .ENDC; NB,NAME .ENABL CRF .ENDM INSTR PSECT PURE_BYTE_DATA DBGSYM TXTTBL TXTTBL: TABBLD .ENDM BLDTAB ;+ ; .BLKW0 AMT=1,VALUE=0 ; This macro generates a number of .WORD 0's, and optionally assigns a ; value other than zero to the block of words. ;- .MACRO .BLKW0 AMT=1,VALUE=0 .NLIST BEX .REPT AMT .WORD VALUE .ENDR .LIST BEX .ENDM .BLKW0 ;+ ; .BLKB0 AMT=1,VALUE=0 ; This macro generates a number of .BYTE 0's, and optionally assigns a ; value other than zero to the block of bytes. ;- .MACRO .BLKB0 AMT=1,VALUE=0 .NLIST BEX .REPT AMT .BYTE VALUE .ENDR .LIST BEX .ENDM .BLKB0 ;+ ; SYMBOL NAME,ADDR,COND=D$$DBG ; This macro generates a in-core standard symbol table entry for DBG. ; It increments the local symbol "..SYMS" for each symbol. This allows ; the relocation routines to spin though the symbol table N times to ; relocate each symbol if DBG is built w/PIC code SUPPORT for RT-11. ;- .MACRO SYMBOL NAME,ADDR,COND=D$$DBG .IF NE,COND DBGSYM ADDR .....1 =. .IIF B,NAME, .ERROR ; Macro SYMBOL needs argument NAME .RAD50 /NAME/ .IF LE,.-.....1-2 .WORD 0 .ENDC; LE,.-.....1-2 .IIF NDF ..SYMS, ..SYMS = 0 ;Local symbol for number of perm entries ..SYMS = ..SYMS + 1 ;Increment # symbols in our table .RWORD ADDR ;Relocatable symbol address .ENDC; NE,COND .ENDM SYMBOL ;+ ; SPCSYM NAME,LABEL=NONE,VALUE=0,COND=D$$DBG ; This macro generates a in-core special symbol table entry for DBG. ; It increments the local symbol "..SPCS" for each symbol. This allows ; the symbol table search routine "ADRSYM" to know the number of special ; symbols it should skip while spinning though the in-core symbol table. ;- .MACRO SPCSYM NAME,LABEL=NONE,VALUE=0,COND=D$$DBG .IF NE,COND .IIF B,NAME, .ERROR ; Macro SPCSYM needs argument NAME .....1 =. .RAD50 /NAME/ .IF LE,.-.....1-2 .WORD 0 .ENDC; LE,.-.....1-2 .IF IDN,LABEL, .WORD VALUE .IFF; IDN,LABEL, DBGSYM LABEL LABEL: .WORD VALUE .ENDC; IDN,LABEL, .IIF NDF ..SPCS, ..SPCS = 0 ; Local symbol for number of SPC entries ..SPCS = ..SPCS + 1 ; Increment # SPC entries in our table .ENDC; NE,COND .ENDM SPCSYM ;+ ; COMM CHAR=0,ROUTINE=0,FLAGS=0,COND=D$$DBG ; This macro generates a command table entry for DBG. ;- .MACRO COMM CHAR=0,ROUTINE=0,FLAGS=0,COND=D$$DBG .IF NE,COND .IIF NDF ..CMDS, ..CMDS = 0 ; Local symbol for number commands ..CMDS = ..CMDS + 1 ; Increment # commands in table .BYTE , .RWORD ROUTINE .ENDC; NE,COND .ENDM COMM ;+ ; .RSET ADDR ; This macro sets up symbol ..RLOC to point to the address given, ; or the current address. ..RLOC is then used by .RWORD to generate ; a relocatable address, if PIC support is turned on for RT-11. ;- .IF NE,<$$$PIC> .MACRO .RSET ADDR .IF NB, ..RLOC = ADDR .IFF; NB, ..RLOC =. .ENDC; NB, .ENDM .RSET .IFF; NE,<$$$PIC> .MACRO .RSET ADDR ..RLOC = 0 .ENDM .RSET .ENDC; NE,<$$$PIC> ;+ ; .RWORD VALUE ; This macro generates a VALUE word that is either, the value ; given, if no PIC support is being generated, or a .WORD of ; the value given "-..RLOC", to allow the address to be ; relocated upon startup. PIC support in general is only for ; RT-11. ;- .MACRO .RWORD VALUE .IIF NDF ..RLOC, .ERROR ;Macro .RSET not called before macro .RWORD! .IF NB, .IF IDN,,<0> .WORD 0 .IFF; IDN,,<0> .WORD VALUE-..RLOC .ENDC; IDN,,<0> .IFF; NB, .WORD 0 .ENDC; NB, .ENDM .RWORD ;+ ; TYPE CHAR,STRING,CRLF=NO ; This macro generates the correct TRAP instruction for the ; terminal output operation given. The following operations ; are supported: ; ; TRAP formats: ; ; Low byte Action ; -------- ------ ; ; IF TRAP&200 = 0 THEN ; ; The following functions DO NOT modify C-BIT or registers ; ; 0 - 177 Types the character given in the low byte of the ; trap instruction. ; ; ELSE IF TRAP&200 <> 0 THEN ; ; The following functions DO NOT modify C-BIT or registers ; ; 240 Output low byte in user R0 ; 340 Output both bytes in user R0 ; 200 Output ASCII string -> @R0 ; 205 Type OUTBUF + CRLF, reload R4 -> OUTBUF ; 206 Type OUTBUF, reload R4 -> OUTBUF ; ;- .MACRO TYPE CHAR,STRING,CRLF=NO ...... = 0 .IF NB,CHAR .IF NB,STRING ...... = 1 .ERROR ; Macro TYPE -- Both CHAR and STRING arguments specified! .IFF; NB,STRING .IF IDN,CHAR, TRAP ^O240 ;Type one byte from user R0 ...... = 1 .IFF; IDN,CHAR, .IF IDN,CHAR, TRAP ^O340 ;Type both bytes in user R0 ...... = 1 .IFF; IDN,CHAR, .IF IDN,CHAR, .IF IDN,CRLF, TRAP ^O205 ;Type outbuf w/crlf, reload R4 -> outbuf ...... = 1 .IFF; IDN,CRLF, TRAP ^O206 ;Type outbuf w/nocrlf, reload R4 -> outbuf ...... = 1 .ENDC; IDN,CRLF, .IFF; IDN,CHAR, TRAP CHAR&177 ;Type the character given in low byte of TRAP ...... = 1 .ENDC; IDN,CHAR, .ENDC; IDN,CHAR, .ENDC; IDN,CHAR, .ENDC; NB,STRING .IFF; NB,CHAR .IF NB,STRING .IF IDN,, TRAP ^O200 ; Type string -> by user R0 ...... = 1 .IFF; IDN,, ADDR STRING,R0 ; Load user R0 with string address TRAP ^O200 ; Type string -> by user R0 ...... = 1 .ENDC; IDN,, .IFF; NB,STRING ...... = 1 .ERROR ; Neither CHAR or STRING specified on TYPE macro call! .ENDC; NB,STRING .ENDC; NB,CHAR .IIF EQ,...... .ERROR ; Invalid arguments to TYPE macro! .ENDM TYPE ;+ ; CRLF ; This macro simply does the TRAP instruction that causes a ; sequence to be output by DBG's I/O module. ; ; 300 Output a CRLF ;- .MACRO CRLF TRAP ^O300 ;Type .ENDM CRLF ;+ ; DBGFNC ; This macro generates the correct TRAP instruction for the ; internal control function given. The following functions ; are supported: ; ; TRAP formats: ; ; Low byte Action ; -------- ------ ; ; The following functions DO NOT modify C-BIT or registers ; ; 201 Get input character into DBG$CH ; 211 " w/no lower to upper case translation" ; 212 Clear OUTBUF and reload R4 -> OUTBUF ; ; The following codes MAY modify the C-BIT ; ; 202 Get input character into DBG$CH (No-wait) ; Returns status in C-BIT ; ;- .MACRO DBGFNC FUNCTION,P1,P2,P3,P4,P5,P6,P7 .IF IDN,, TRAP ^O201 ;Read one character. UPPER case only. .MEXIT .ENDC; IDN,, .IF IDN,, TRAP ^O202 ;Read one character into DBG$CH w/nowait mode I/O .MEXIT .ENDC; IDN,, .IF IDN,, TRAP ^O211 ;Read one character UPPER/LOWER case. .MEXIT .ENDC; IDN,, .IF IDN,, TRAP ^O212 ;Clear OUTBUF, re-load R4 -> OUTBUF .MEXIT .ENDC; IDN,, .ERROR ; Invalid function paramiter to macro DBGFNC! .ENDM DBGFNC ;+ ; DECODE ; Jump to command dispatcher, via a TRAP instruction ; ; 203 Reset stack and return to COMMND ; 210 Reset stack and return to RESTRT ;- .MACRO DECODE ERROR=NO .IF IDN,ERROR, TRAP ^O210 ;Return to "RESTRT" .IFF; IDN,ERROR, TRAP ^O203 ;Return to "COMMND" .ENDC; IDN,ERROR, .ENDM DECODE ;+ ; DBGSYM ; This macro declares the symbol given as global if $GLOBS is ; set <> 0. ;- .IF NE,<$GLOBS> .MACRO DBGSYM SYMBOL .GLOBL SYMBOL .ENDM DBGSYM .IFF; NE,<$GLOBS> .MACRO DBGSYM SYMBOL .ENDM DBGSYM .ENDC; NE,<$GLOBS> ;+ ; ERROR ; Type CRLF, a one element error message, optionally DUMP outbuf, then ; return to COMMAND level. ; ; 207 Print string @R0, then print OUTBUF, reset stack and ; return to COMMND. ; 204 Print string @R0, reset stack and return to COMMND ;- .MACRO ERROR STRING,OUTBUF=NO .IF B,STRING .ERROR ; Macro ERROR needs STRING argument .IFF; B,STRING .IF IDN,STRING, .IFF; IDN,STRING, ADDR STRING,R0 ;R0 -> One element error message to print .IFTF; IDN,STRING, .IF IDN,OUTBUF, TRAP ^O207 ;Print @R0,OUTBUF, get next command. .IFF; IDN,OUTBUF, TRAP ^O204 ;Print @R0, get next command "JMP COMMND" .ENDC; IDN,OUTBUF, .ENDC; IDN,STRING, .ENDC; B,STRING .ENDM ERROR ;+ ; ERRMSG ; Generate a .ASCIZ error message, in long OR short form, depending ; on symbol E$$TXT. ;- .MACRO ERRMSG LEVEL,SHORT,LONG,TERMINATOR=0,CRLF=NO,PREFIX=NO .NLIST BEX .IF IDN,CRLF, .ASCII .ENDC; IDN,CRLF, .IF IDN,PREFIX, .ASCII /?DBG-/ .ENDC; IDN,PREFIX, ...... = 0 .IRPC ..LEV., .IF EQ,...... .BYTE ''..LEV. .BYTE '- .ENDC; EQ,...... ...... = 1 .ENDM; (IRPC) .IF EQ, .ASCII ~SHORT~ .IFF; EQ, .ASCII ~LONG~ .ENDC; EQ, .BYTE TERMINATOR .LIST BEX .ENDM ERRMSG ;+ ; .COND OP,SRC,DST,COND=D$$DBG ; This macro generates the subject machine instruction dependant on ; the conditional given being defined and non-zero. ;- .MACRO .COND OP,SRC,DST,COND=D$$DBG .IF NE,COND .IF B,OP .ERROR ; Macro .COND needs atleast the argument OP! .IFF; B,OP .IF NB,SRC .IF NB,DST OP SRC,DST .IFF; NB,DST OP SRC .ENDC; NB,DST .IFF; NB,SRC OP .ENDC; NB,SRC .ENDC; B,OP .ENDC; NE,COND .ENDM .COND ;+ ; CMPPIC SRC,DST ; This macro generates a PIC version of the CMP instruction, depending ; on if PIC support is turned-on or not. ;- .IF EQ,<$$$PIC> .MACRO CMPPIC SRC,DST .IIF B,SRC .ERROR ; Macro CMPPIC needs agrument SRC! .IIF B,DST .ERROR ; Macro CMPPIC needs agrument DST! CMP #SRC,DST .ENDM CMPPIC .IFF; EQ,<$$$PIC> .MACRO CMPPIC SRC,DST .IIF B,SRC .ERROR ; Macro CMPPIC needs agrument SRC! .IIF B,DST .ERROR ; Macro CMPPIC needs agrument DST! ADDR SRC,SP CMP (SP)+,DST .ENDM CMPPIC .ENDC; EQ,<$$$PIC> ;+ ; MOVPIC SRC,DST ; This macro generates a PIC version of the MOV instruction, depending ; on if PIC support is turned-on or not. ;- .IF EQ,<$$$PIC> .MACRO MOVPIC SRC,DST .IIF B,SRC .ERROR ; Macro MOVPIC needs agrument SRC! .IIF B,DST .ERROR ; Macro MOVPIC needs agrument DST! MOV #SRC,DST .ENDM MOVPIC .IFF; EQ,<$$$PIC> .MACRO MOVPIC SRC,DST .IIF B,SRC .ERROR ; Macro MOVPIC needs agrument SRC! .IIF B,DST .ERROR ; Macro MOVPIC needs agrument DST! ADDR SRC,SP MOV (SP)+,DST .ENDM MOVPIC .ENDC; EQ,<$$$PIC> ;+ ; TRAN$ LOW=0,HIGH=177,NEXT,LABEL ; This macro generates a finite state parser table entry for the "GETNUM" ; routine. We use a macro, because of I&D support. When I&D support is ; included in DBG, TRAN$ generates the table in the PURE_DATA psect, while ; if I&D support is not required, TRAN$ generates the table in-line with ; intructions to save space. ;- .MACRO TRAN$ LOW=0,HIGH=177,NEXT,LABEL .IIF B,LABEL,.ERROR ;Macro TRAN$ must have LABEL argument! ...SUC=. ; ...SUC = Where to go if success .IIF NE,, .SAVE ;Save current .PSECT .IIF NE,, PSECT PURE_DATA LABEL: .BYTE LOW,HIGH ;Upper, lower bound for transition .IF NB,NEXT .WORD NEXT-LABEL ;Failure transition state .IFF; NB,NEXT .WORD 0 ;No next state. .ENDC; NE,NEXT .IIF NE,, .WORD ...SUC-LABEL ;Success transition state .IIF NE,, .RESTORE ;Restore last PSECT .ENDM TRAN$ ;+ ; GET DST,BYTE=NO,NOERROR=NO,POP=YES,IREGS=YES ; This macro generates the code needed to get a word or byte from ; the subject data or instruction space depending on the support ; included in DBG. ; ; D$$OUT <> 0 ;Debugger out of address space support is ON. ;- .IF EQ, .MACRO GET DST,BYTE=NO,NOERROR=NO,POP=YES,IREGS=YES CALL CHKMEM ;Return in MEMLOC real addr of item .IF DIF,NOERROR, MOVPIC NOERROR,IERR ;Setup error address .IFTF; DIF,NOERROR, .IF IDN,BYTE, MOV @MEMLOC,DST .IFF; IDN,BYTE, CLR DST BISB @MEMLOC,DST .ENDC; IDN,BYTE, .IFT; DIF,NOERROR, CLR IERR ;Reset internal error flag, clear C-BIT .ENDC; DIF,NOERROR, .IF IDN,POP, INC R5 ;Setup R5 (Save C-BIT) .IF IDN,BYTE, INC R5 ;... .ENDC; IDN,BYTE, .ENDC; IDN,POP, .ENDM GET .IFF; EQ, .MACRO GET DST,BYTE=NO,NOERROR=NO,POP=YES,IREGS=YES .IF DIF,NOERROR, .IF IDN,BYTE, .ERROR ; Macro GET does not allow BYTE=YES and NOERROR<>NO .ENDC; IDN,BYTE, .IF IDN,IREGS, .ERROR ; Macro GET does not allow IREGS=YES and NOERROR<>NO .ENDC; IDN,IREGS, CALL GETWR2 ;Get WRD, return C-BIT error status .IFF; DIF,NOERROR, .IF IDN,BYTE, .IF IDN,IREGS, .ERROR ; Macro GET does not allow IREGS=NO and BYTE=YES .ENDC; IDN,IREGS, CALL GETBYT ;Get BYT, don't trap errors .IFF; IDN,BYTE, .IF IDN,IREGS, CALL GETWRD ;Get WRD (Not from DBG I-REGS) .IFF; IDN,IREGS, CALL GETWR1 ;Get WRD (From usr or DBG I-REGS) .ENDC; IDN,IREGS, .ENDC; IDN,BYTE, .ENDC; DIF,NOERROR, .IF IDN,POP, DEC R5 ;Restore R5 (Save C-BIT) .IF IDN,BYTE, DEC R5 ;... .ENDC; IDN,BYTE, .ENDC; IDN,POP, .IF DIF,DST,<-(SP)> MOV (SP)+,DST .ENDC; DIF,DST,<-(SP)> .ENDM GET .ENDC; EQ, ;+ ; PUT SRC,BYTE=NO,POP=YES,IREGS=YES ; This macro generates the code needed to put a word or byte to ; the subject data or instruction space depending on the support ; included in DBG. ; ; D$$OUT <> 0 ;Debugger out of address space support is ON. ;- .IF EQ, .MACRO PUT SRC,BYTE=NO,POP=YES,IREGS=YES CALL CHKMEM ;MEMLOC = Real addr of item to store into .IF IDN,BYTE, MOV SRC,@MEMLOC .IFF; IDN,BYTE, MOVB SRC,@MEMLOC .ENDC; IDN,BYTE, .IF IDN,POP, INC R5 ;Setup R5 (Save C-BIT) .IF IDN,BYTE, INC R5 ;... .ENDC; IDN,BYTE, .ENDC; IDN,POP, .ENDM PUT .IFF; EQ, .MACRO PUT SRC,BYTE=NO,POP=YES,IREGS=YES .IF DIF,SRC,<(SP)+> MOV SRC,-(SP) .ENDC; DIF,SRC,<(SP)+> .IF IDN,BYTE, .IF IDN,IREGS, .ERROR ; Macro PUT does not allow IREGS=NO and BYTE=YES .ENDC; IDN,IREGS, CALL PUTBYT ;Put a BYTE from @SP .IFF; IDN,BYTE, .IF IDN,IREGS, CALL PUTWRD ;Put WRD (Not to DBG I-REGS) .IFF; IDN,IREGS, CALL PUTWR1 ;Put WRD (To usr or DBG I-REGS) .ENDC; IDN,IREGS, .ENDC; IDN,BYTE, .IF IDN,POP, .IF IDN,BYTE, DEC R5 ;Restore R5 .IFF; IDN,BYTE, DEC R5 ;Restore R5 (Save C-BIT) DEC R5 ;... .ENDC; IDN,BYTE, .ENDC; IDN,POP, .ENDM PUT .ENDC; EQ, .IIF NDF,L$$LST,.LIST .SBTTL .SBTTL .SBTTL DBGDEF - Static data definition module ;Edit 00 .SBTTL .SBTTL .IIF NDF,L$$LST,.NLIST ;**************************************************************************** ;* * ;* COPYRIGHT (c) 1983, 1986 * ;* BY DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. * ;* ALL RIGHTS RESERVED. * ;* * ;* THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED * ;* ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE * ;* INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER * ;* COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY * ;* OTHER PERSON. NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY * ;* TRANSFERRED. * ;* * ;* THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE * ;* AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT * ;* CORPORATION. * ;* * ;* DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS * ;* SOFTWARE ON EQUIPMENT THAT IS NOT SUPPLIED BY DIGITAL. * ;* * ;**************************************************************************** ;++ ; Facility: DBG - A PDP-11 system independant symbolic debugger ; ; Author: Joe Worrall ; ; Created: 06-Jul-84 ; ; Abstract: DBGDEF - Static data definition module ; ; Externals Description ; --------- ----------- ; ; Edit Who Date Description of modification ; ---- --- ---- --------------------------- ;-- .IIF NDF,L$$LST,.LIST .SBTTL .SBTTL PDP-11 Hardware register definitions .IF NE,<!> ;If HARD/DOA or SD:/DOA SR0 =: 177572 ;MMR0 - Memory managment register zero SR3 =: 172516 ;KT11 Status register 3. MODE22 =: 000020 ;22 bit addressing mode bit in SR3. PS =: 177776 ;Current PSW .ENDC; NE,<!> ;If HARD/DOA or SD:/DOA .IF NE,<!> ;If HARD/DOA or RT-11/SOFT/SD:/DOA .MACRO CRESET NAM,ADDR $$$=0 .REPT 8. CRENAM NAM,ADDR+<$$$*2>,\$$$ $$$=$$$+1 .ENDR .ENDM .MACRO CRENAM NAM,ADDR,N 'NAM''N'==: ADDR .ENDM CRESET KINAR,172340 CRESET KINDR,172300 CRESET KDSAR,172360 CRESET KDSDR,172320 CRESET SISAR,172240 CRESET SISDR,172200 CRESET SDSAR,172260 CRESET SDSDR,172220 CRESET UINAR,177640 CRESET UINDR,177600 CRESET UDSAR,177660 CRESET UDSDR,177620 .IF NE, ;If I&D space support CRESET KISAR,172360 CRESET KISDR,172320 CRESET UISAR,177660 CRESET UISDR,177620 .IFF; NE, ;If I&D space support CRESET KISAR,172340 CRESET KISDR,172300 CRESET UISAR,177640 CRESET UISDR,177600 .ENDC; NE, ;If I&D space support .ENDC; DF,<!> ;If HARD/DOA or RT-11/SOFT/SD:/DOA .TITLE DBG - A PDP-11 system independant symbolic debugger .SBTTL .SBTTL .SBTTL DBG - A PDP-11 Symbolic Debugger ;Edit 00 .SBTTL .SBTTL .IDENT /V01.00/ .SBTTL .IDENT /V01.00/ .IF NE, ; Note: The string HELLO in DBGIO must be updated along with .MODULE .MCALL .MODULE .MODULE DBG,RELEASE=V01,VERSION=00,TITLE=NO,IDENT=NO,AUDIT=NO .AUDIT .DBG,DBG$$1,DBG$$2 .ENDC; NE, ;**************************************************************************** ;* * ;* COPYRIGHT (c) 1983, 1986 * ;* BY DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. * ;* ALL RIGHTS RESERVED. * ;* * ;* THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED * ;* ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE * ;* INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER * ;* COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY * ;* OTHER PERSON. NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY * ;* TRANSFERRED. * ;* * ;* THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE * ;* AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT * ;* CORPORATION. * ;* * ;* DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS * ;* SOFTWARE ON EQUIPMENT THAT IS NOT SUPPLIED BY DIGITAL. * ;* * ;**************************************************************************** ;++ ; Facility: DBG - A PDP-11 system independant symbolic debugger ; ; Authors: Chuck Guldenschuh / Joe Worrall ; ; Created: Started by Chuck in 1980. ; ; Abstract: DBG - Definitions and command execution segment ; ; Externals Description ; --------- ----------- ; ; Edit Who Date Description of modification ; ---- --- ---- --------------------------- ;-- .IF EQ,<!<$DEBUG>> ;If non-debug RT version .DSABL GBL .IFF; EQ,<!<$DEBUG>> ;If non-debug RT version .ENABL GBL .ENDC; EQ,<!<$DEBUG>> ;If non-debug RT version ; Order the PSECTS PSECT START_DBG PSECT PURE_CODE PSECT PURE_DATA PSECT PURE_BYTE_DATA PSECT DATA PSECT SYMBOLS PSECT SYMBOLS_STOP DBGSYM SYMEND SYMEND: ;End of SYMBOLS PSECT PSECT BYTE_DATA .PSECT ZZDVR .IF NE, .PSECT VMBOOT .PSECT PAD001 .ENDC ; NE, .PSECT SETOVR .PSECT $LAST$ ;Any psect following this is ; a ROGUE psect that should be ; added to the PSECT ordering list .SBTTL DBG's .TITLE Generation logic ; Setup correct .TITLE, depending on version .....1 = SYSTEM ;0 or 1 (RT or RSX) ;2 or 3 (RESERVED ) .IIF NE,, .....1 = .....1+4 ;System type 4-7 with rsts/e code .....2 = 0 ;Setup SECOND OPTION number .IIF NE,, .....2 = .....2!1 ;1= G$$APH ;2 RESERVED ;4 RESERVED .....3 = 0 ;Setup THIRD OPTION number .IIF NE,, .....3 = .....3!1 ;1= S$$IOM .IIF NE,, .....3 = .....3!2 ;2= R$$PRO ;4 RESERVED .....4 = 0 ;Setup FORTH OPTION number .IIF NE,, .....4 = .....4!1 ;1= D$$OUT .IIF NE,, .....4 = .....4!2 ;2= D$$DAS!D$$OUT ;4= RESERVED .....5 = 0 ;Setup FIFTH OPTION number .IIF NE,<$$$ROM>, .....5 = .....5!1 ;1= $$$ROM ;2 RESERVED ;4 RESERVED .....6 = 0 ;Setup SIXTH OPTION number .IIF NE,, .....6 = .....6!1 ;1= S$$STB .IIF NE,, .....6 = .....6!2 ;2= D$$DRV ;4 RESERVED .IRP U,<\.....1> ;System type definition .IRP V,<\.....2> ;SECOND OPTION MASK DIGIT .IRP W,<\.....3> ;THIRD .IRP X,<\.....4> ;FORTH .IRP Y,<\.....5> ;FIFTH .IRP Z,<\.....6> ;SIXTH .TITLE 'U''V''W''X''Y''Z - DBG-11 A Symbolic Debugger DBG$$1 == 'U''V''W ;Define configuration mask globaly DBG$$2 == 'X''Y''Z .ENDR .ENDR .ENDR .ENDR .ENDR .ENDR .SBTTL General Comments ;+ ; DBG ; ; Execution control commands ; ; ;A * Prompt for .STB file to use for symbols ; [addr][,value];B Set/clear breakpoint ; [addr];G Start execution at addr or current PC ; [value];P Proceed from breakpoint ; [value];S Execute the next [value] instruction(s). Default ; is one. ; [value];V ** Set/Reset DBG's fielding of SST traps ; ;X *** Jump to RSX-11M/PLUS crash dump routine ($CRALT) ; ^C Return control to DBG (Rsts/e only) ; ^U Cancels current line of input ; ^W Refreshes the graphics register display ; ; Notes: * This command for DBG/RSX soft I/O only. ; ** This command valid for DBG/RSX and RT-11 ; SD: driver mode only. ; *** This command valid for DBGXDT/RSX only. ; ; Modification commands ; ; [value] Modify open addr, close addr ; [value] Modify open addr, close addr, open next addr ; [value]^ Modify open addr, close addr, open previous addr ; [value]@ Modify open addr, close addr, open last typed addr ; [value]# * Modify open addr, close addr, open last typed addr ; This differs from the "@" in I-D space, as # open's ; the last typed address in the opposite space. IE - ; if current space is D-SPACE, then addr is opened in ; I-SPACE. ; ; Notes: * Valid in the I&D space versions of DBG only. ; ; Type-out commands ; ; [isymbl];R Set default type-out radix. Default value is OCTAL. ; Possible symbolic values to specify are: ; _BIN, _DEC, _OCT or _HEX. ; ; [isymbl];T Set default type-out mode ; Possible symbolic values to specify are: ; ; _REG;T ;Turn on VT100 register display mode ; _NOREG;T ;Turn OFF VT100 register display mode ; _NOSYM;T ;Don't display DATA as symbolic ; _SYM;T ;Display DATA as symbolic (If possible) ; _NOADR;T ;Don't display addresses symbolicly ; _ADR;T ;Display addresses symbolicly (If possible) ; _RUB;T ;Turn off scope mode support ; _NORUB;T ;Turn on scope mode support ; _ESC;T ;Turn on unsupported as ;S function ; _NOESC;T ;Turn off unsupported as ;S function ; ; Single-character commands ; ; [addr]/ (I) Open addr as a instruction ; [addr][ (D) Open addr as a byte/word ; [addr]| (D) Open addr as a byte/word W/Forced non-symbolic mode ; [addr]\ (D) Open addr as a byte ; [addr]" (D) Open addr as a ASCII word/byte ; [addr]' (D) Open addr as a ASCII byte ; [addr]% (D) Open addr as a RAD50 word ; ; * Note: (I) This command forces I-SPACE if addr specified ; * Note: (D) This command forces D-SPACE if addr specified ; ; [expression]= Evaluates the expression given, and outputs the ; ABS value in the current radix. The default is ; to display the internal register "Q". ; ; Examples of the usage of "=": ; ; DBG>_OCTAL;R ;Radix = Octal (Default) ; DBG>.= 1000 ;Display last typed address ; DBG>Q= 012737 ;Display contents of "." ; DBG>MOV 1000,5000= 16767,177774,3772 ;Decode and display instruction ; ;according to current "." ; DBG>SEV!SEC= 263 ;Decode set conditions OR. ; DBG>4*<<5*4>_/2>= 50 ;Evaluate complex expression ; DBG>40!2,60*4,90*10.= 42,300,1604 ;Evaluate several expressions ; DBG>_HEX;R ;Radix = Hex ; DBG>40!2,60*4,90*10.= 22,C0,384 ;Re-evalute above expression ; ; ; Internal symbolics ; ; Internal symbols and registers are distinguished from user ; symbols and machine registers by the prefix operator "_". ; Internal registers may be accessed and modified by any of ; the OPEN commands above, except the open in instruction ; mode operator "/" which is forced to a data mode open "[". ; ; PDP-11 Machine registers are: ; ; R0 - R5 ; SP - PC ; ; . -> Last displayed address ; Q -> Contents of last displayed address ; ; _ISYMBL[ Open internal register ISYMBL as a word ; ; The following internal registers exist in the RSX user ; mode debugger (In user address space) only: ; ; _EVTFLG -> EFN that DBG uses for all exec requests ; _SSTSTK -> Top words of stack from last trap/emt and mem. prot. ; ; The following internal registers exist in ALL versions of DBG: ; ;* _MASK -> Search - Mask register ;* _LOW -> Search - Low limit ;* _HIGH -> Search - High limit ; _ADROFF -> Maximum address offset from a address symbolic ; to display. ; _DATOFF -> Maximum address offset from a data symbolic ; to display. ; ; * = Not yet implemented ; ; Memory search commands ; ; *value;= Search for values equal to value, under the mask _MASK ; *value;# Search for values not equal to value, under _MASK ; *value;E Search for effective addresses equal to value under _MASK ; ; * = Not yet implemented ; ; Utility commands ; ; [addr,]symbol: Define symbol as equal to addr ; symbol;K Delete symbol from in-core symbol table ; *[format];L List memory ; ; * = Not yet implemented ; ; Expressions ; ; Expressions are evaluated from left to right with angle brackets overiding. ; All operators (without angle brackets "<>") have equal priority. ; All addresses and most values may be specified as an expression. ; ; Binary operators ; ; + Addition ; - Subtraction ; * Multiplication ; _/ Division ; ! Logical OR ; & Logical AND ; ; Unary operators ; ; + Unary plus ; - Unary minus ; _$ Hex number follows ; _" Two ASCII characters follow ; _' One ASCII character follows ; _% Three RAD50 characters follow ; ; Instruction type in notes: ; ; DBG's instruction type-in is designed to be consistant with ; the MACRO-11 assembler. Odd address and branch/sob out of ; range checking is included in instruction syntax checking. ; Complex expressions and symbolics are fully supported. ; ; Examples of instruction type out/in: ; ; >RUN TESTDBG ; DBG vnn.nn - RSX-11M/+ ( S/U I/D ROM STB EIS ) ; DBG>;A ;Get me symbols from .STB file ; ; STB filespec:TESTDBG ; DBG>/ ;Open start address (I-SPACE) ; START / MOV SP,$SAVSP ; START+4 / SUB #SPOFF,SP SUB #SPOFF*2,SP ; DBG>SPOFF= 50 ; DBG>/ ;Re-open changed location ; START+4 / SUB #120,SP MOV SP,1001 ; ; ?Odd address ; DBG>/ ; START+4 / SUB #120,SP MOV SP,1000 ; DBG>^Z ; > ; ; General comments on the flow of DBG code execution ; ; DBG has different entry points depending upon the operating system ; type and the version of DBG running. ; ; OPERATING SYSTEM MODE ENTRY POINT ; ---------------- ---- ----------- ; RSX User $DBG ; RSX Monitor Any DBGTRP entry point ; RT-11 Driver Any DBGTRP entry point ; RSTS/E User $DBG ; ; The flow of code execution from either the $DBG entry point or any of the ; trap entry points is as follows: ; ; DBGIO/DBGTRP - The two possible entry points ; DBGCMD - Get a command from the user ; DBG - Process command via a command execution routine ; DBGIO - Return to the user or to DBGCMD for another cmd ;- .SBTTL General Symbolic definitions R6 =: %6 ;Another name for SP BS =: 010 ;ASCII TAB =: 011 ;ASCII LF =: 012 ;ASCII VT =: 013 ;ASCII CR =: 015 ;ASCII .IF NE, ;If soft-i/o RSTS/E version ESC =: 233 ;ASCII ala RSTS/E style .IFF; NE, ;If soft-i/o RSTS/E version ESC =: 033 ;ASCII .ENDC; NE, ;If soft-i/o RSTS/E version BLANK =: 040 ;ASCII SPACE =: 040 ;" " COMMA =: 054 ;ASCII ',' SEMI =: 073 ;ASCII ';' RANGLE =: 076 ;ASCII '>' RUBOUT =: 177 ;ASCII Rubout character (DELETE) CTRLO =: 017 ;ASCII CTRL/O (Stop/restart output) CTRLQ =: 021 ;ASCII CTRL/Q (ReStart I/O) CTRLS =: 023 ;ASCII CTRL/S (Stop I/O) CTRLU =: 025 ;ASCII CTRL/U (Cancel input line) CTRLW =: 027 ;ASCII CTRL/W (Graphics refresh) CTRLZ =: 032 ;ASCII CTRL/Z (Exits DBG) ; Breakpoint table definitions => BPTABL BPT.NM =: 9. BT.ADR =: 0 ;Offset to address of BPT in table ;Odd address means SUPERVISOR mode breakpoint ;in SOFT I/O versions with D-SPACE support only .ASSUME BT.ADR EQ 0 BT.CNS =: 2 ;Offset to actual contents of BPT in table BT.CNT =: 4 ;Offset to ;P count in BPT table BT.SIZ =: 6 ;Size of a breakpoint table entry PS.TBT =: 20 ;T-bit in PS ; Output flags => TYPMOD,DTYPMD TO.INI =: 004000 ;=> Initialization complete (Scope code) TO.NCR =: 002000 ;=> Don't type in OPEN TO.DAT =: 001000 ;=> Data mode TO.ADT =: 000400 ;=> No symbolic data TO.BYT =: 000200 ;=> Byte mode TO.ABS =: 000100 ;=> No symbolic addresses TO.R50 =: 000040 ;=> RAD50 mode TO.ASC =: 000020 ;=> ASCII mode TO.GPH =: 000010 ;=> Graphics mode (VT100 support only) TO.RUB =: 000004 ;=> RUBOUT mode TO.DSP =: 000002 ;=> DATA SPACE mode in effect TO.ESC =: 000001 ;=> Function (;S) enabled .ASSUME TO.DSP EQ 2 ;For MVTS$S in DBGMEM.MAC .ASSUME TO.BYT EQ 200 ;For TSTB, BMI's ;* NOTE: The following mask is bits NOT to clear when entering ;* instruction type-out mode. If you add a type-out mode. ;* make sure you're sure! TO.IMK =: PSECT BYTE_DATA DBGSYM CRADIX CRADIX: .BYTE 8. ;Current radix PRADIX =: 8. ;Permanent default radix in OCTAL PSECT DATA DBGSYM PROSNG DBGSYM PROCED DBGSYM SNGSTP DBGSYM TYPMOD DBGSYM DTYPMD PROSNG: ;Proceed/single step flag .ASSUME PROCED EQ .ASSUME PROSNG EQ PROCED PROCED: .BYTE 0 ;Preceeding after BPT flag SNGSTP: .BYTE 0 ;In single step mode TYPMOD: .WORD TO.RUB ;Type-out mode TYPDEF =: ;Default type-out for ;T w/no arguments DTYPMD: .WORD TO.RUB ;Default type-out mode DBGSYM BPTABL BPTABL: ;BPT address table .BLKB0 BPTSIZ =: . - BPTABL DBGSYM INBUF .BYTE 0 ;One byte of zero trash for RUBOUT code INBUF: .BLKB0 80. ;80. byte input buffer .BYTE 0 ;and one byte of zero trash at the end INBUFE =:.-2 ;End of our input buffer DBGSYM OUTBUF OUTBUF: .BLKB0 80.,VALUE=200 ;Output buffer OUTSIZ =:.-OUTBUF ;Size of output buffer DBGSYM STKGRD DBGSYM DBGSTE DBGSYM DBGSTK .IIF NDF STKSIZ,STKSIZ =: 100 ;Default to a 100 word stack .IIF NDF GRDPAT,GRDPAT =: 125252 ;Stack GUARD word pattern STKGRD: .WORD GRDPAT ;Stack GUARD word to check DBGSTE: ;End of DBG's personal stack space .BLKW0 STKSIZ,VALUE=152525 DBGSTK: ;Start of DBG's personal stack space PSECT PURE_CODE .SBTTL .SBTTL Command Execution Routines .SBTTL ;+ ; General comments ; ; All command execution routines are dispatched to from the module ; DBGCMD with the following inputs: ; ; R0 Copy of PARFLG ; Condition codes Setup from a TSTB R0 ; R1 EXPFLG (Expression flags from GETEXP) ; R2 Undefined ; R3 -> TYPMOD flags ; R4 -> OUTBUF ; R5 Current user PC or PAR1 if PARFLG&PAR.1 <> 0 ;- .SBTTL [expr]= - EVALUATE - Evaluate immediate mode expression(s) ;+ ; EVALUATE ; This routine types out the values in PAR1-PAR3, if they ; where typed in. If no parameters where typed, we type out ; the value of Q. ; ; R0 Copy of PARFLG ; Condition codes Setup from a TSTB R0 ; R1 EXPFLG (Expression flags from GETEXP) ; R2 Undefined ; R3 -> TYPMOD flags ; R4 -> OUTBUF ; R5 Current user PC or PAR1 if PARFLG&PAR.1 <> 0 ; PAR1-PAR3 Things to type out ; ; CALL EVALUATE ; ; Value(s) typed out, and a return is made to DBGCMD ;- DBGSYM EVALUATE EVALUA: TYPE ; ADDR PAR1,R5 ;R5 -> PAR1 MOVB R0,-(SP) ;Save PARFLG BNE 10$ ;Branch if a parameter was typed. MOV Q,@R5 ;PAR1 = Contents of "Q" INC @SP ;Pretend PAR1 typed 10$: MOV #MAXPAR,R3 ;R3 = Count of parameters to look though 20$: ASRB @SP ;Next parameter typed? MOV (R5)+,R1 ;Get the value from the parameter list BCC 30$ ;Branch if this par not typed, insert comma CALL DCD.IO ;Put the value from R1,in the buffer -> R4 30$: MOVB #,(R4)+ ;Insert typeout separator SOB R3,20$ ;Loop for MAXPAR times 40$: CMPB -(R4),# ;Write 200's over trailing ","'s BEQ 40$ ;Loop for all of them INC R4 ;Bump past good character MOVB #,(R4)+ ;Insert a over the last "," MOVB #200,@R4 ;and terminate the string TYPE OUTBUF ;Type the output buffer W/nocrlf TSTB OPNFLG ;Is there a location currently open? BNE 50$ ;Branch if so, don't do CRLF ;Else return the cursor. 50$: DECODE ;Return to COMMND, stack will be reset. .SBTTL [addr][,value];B - SCBPT - Set/Clear BPT ;+ ; SCBPT ; Set/Clear BPT ; ; Syntax: ; ; [addr][,value];B ; ; Defaults: ; ; addr 0 ; value 0 ; ; Semantics: ; ; If addr <> 0 then ; if value = 0 then ; set 1st available BPT @addr ; else ; set BPT # value @addr ; else ; if value = 0 then ; clear all BPT's ; else ; clear BPT # value ; ; INPUTS: ; R0 Copy of PARFLG ; Condition codes Setup from a TSTB R0 ; R1 EXPFLG (Expression flags from GETEXP) ; R2 Undefined ; R3 -> TYPMOD flags ; R4 -> OUTBUF ; R5 Current user PC or PAR1 if PARFLG&PAR.1 <> 0 ; ; CALL SCBPT ; ; OUTPUTS: ; Breakpoint(s) specified, set or reset ;- DBGSYM SCBPT SCBPT: ADDR BPTABL,R2 ;R2 -> breakpoint table MOV #BPT.NM,R4 ;R4 = number of BPT table entries MOV PAR2,R1 ;R1 = BPT #, if specified BEQ 30$ ;Branch if not specified or 0 NEG R1 ;Make given value negative ADD R4,R1 ;R1 = index to correct entry 10$: ADD #BT.SIZ,R2 ;Skip this entry SOB R1,10$ ;Loop until we get the correct entry BIT #PAR.1,R0 ;1st parameter specified? BEQ 20$ ;Branch if not. Clear BPT TST R5 ;Any address specified? BEQ 20$ ;Branch if 0. Clear BPT ;NOTE: Since ANY ";" command resets TYPMOD, we know that we are in I-SPACE. ; This routine might want to be a subroutine to verify R/W access. 15$: MOV R2,-(SP) ;@SP -> BPT Entry address we are poking ADDR BPTABL,R2 ;R2 -> BPTABL CALL FNDBPT ;Find R5 in BPT table if already there. BNE 16$ ;Branch if not found, OK. DECODE ;Return to COMMND, no need to setup BPT, as ;it already is! Stack will be reset. 16$: MOV (SP)+,R2 ;R2 -> Entry to poke GET -(SP),POP=NO,IREGS=NO ;Get wrd from user memory ;*I/D* PUT (SP)+,POP=NO,IREGS=NO ;Put wrd to verify R/W access ;*I/D* MOV R0,@R2 ;Store the address + super bit if applicable MOV #1,BT.CNT(R2) ;Default count of 1 BR 70$ ;Done 20$: CLR @R2 ;Clear the address BR 70$ ;Done 30$: BIT #PAR.1,R0 ;Was it specified? BEQ 40$ ;Branch if not. Clear all BPT TST R5 ;Was the address 0? BNE 50$ ;Branch if not. Set BPT 40$: CLR @R2 ;Clear the address ADD #BT.SIZ,R2 ;R2 -> next entry SOB R4,40$ ;Do them all 70$: RETURN ;and return to caller. 50$: ADD #BPTSIZ,R2 ;R2 -> Past table DEC R4 ;0'th entry is special. Don't use it 60$: SUB #BT.SIZ,R2 ;R2 -> next entry TST @R2 ;Is there anything there? BEQ 15$ ;Branch if so. Set the BPT SOB R4,60$ ;Loop ERROR STRING=NRMSTR ;Else give No room error, stack will be reset. ; .SBTTL symbol;K - KILSYM - Delete a user symbol ;+ ; KILSYM ; Deletes the symbol given from the user symbol table. ; ; Syntax: ; ; symbol;k ; ; Defaults: ; ; Symbol No default ; ; Semantics: ; ; If symbol specified ; then delete the symbol ; else error ; ; INPUTS: ; R0 Copy of PARFLG ; Condition codes Setup from a TSTB R0 ; R1 EXPFLG (Expression flags from GETEXP) ; R2 Undefined ; R3 -> TYPMOD flags ; R4 -> OUTBUF ; R5 Current user PC or PAR1 if PARFLG&PAR.1 <> 0 ; SYMADR -> Symbol entry from GETSYM ; ; CALL KILSYM ; ; OUTPUTS: ; Deletes the symbol, and returns ; This routine will not delete internal symbols since the command ; dispatcher will return an error before this routine is dispatched ; to if an internal symbol in specified. Since Q and . are special ; symbols, they are specificly checked here so they cannot be deleted. ;- DBGSYM KILSYM KILSYM: .IF NE, ;If RSX .STB file support TST SYMADR ;Make sure we don't stomp on zero! BEQ 10$ ;Branch if not a symbol address! .ENDC; NE, ;If RSX .STB file support CMP @SYMADR,#<^RQ > ;Stomping on Q? BEQ 20$ ;Branch if so, error. CMP @SYMADR,#<^R. > ;Stomping on .? BEQ 20$ ;Branch if so, error. CLR @SYMADR ;Delete the symbol!! .ASSUME SY.NAM EQ 0 10$: RETURN ;Return to caller 20$: ERROR STRING=CPESTR ;Return error, stack will be reset. ;<-Command parameters invalid> .IF NE,0 .SBTTL [value];M - SMASK - Set search mask ;+ ; SMASK ; Set search mask ; ; Syntax: ; ; [value];M ; ; Defaults: ; ; value 177777 ; ; Semantics: ; ; If value specified ; then search mask := value ; else search mask := default (-1) ; ; INPUTS: ; R0 Copy of PARFLG ; Condition codes Setup from a TSTB R0 ; R1 EXPFLG (Expression flags from GETEXP) ; R2 Undefined ; R3 -> TYPMOD flags ; R4 -> OUTBUF ; R5 Current user PC or PAR1 if PARFLG&PAR.1 <> 0 ; ; CALL SMASK ; ; OUTPUTS: ; Mask set to default or specified value ;- .ENABL LSB DBGSYM SMASK SMASK: BNE 10$ ;Branch if PARFLG <> 0 MOV #-1,R5 ;Setup default search mask 10$: .ROM MOV R5,SRHMSK ;Set the search mask RETURN ;Return to caller .DSABL LSB .ENDC; NE,0 .SBTTL [value];R - SRADIX - Set type-out radix ;+ ; SRADIX ; Set type-out radix ; ; Syntax: ; ; [value];R ; ; Defaults: ; ; value 8 ; ; Semantics: ; ; If value specified ; then type-out radix := value ; else type-out radix := default (OCTAL) ; ; INPUTS: ; R0 Copy of PARFLG ; Condition codes Setup from a TSTB R0 ; R1 EXPFLG (Expression flags from GETEXP) ; R2 Undefined ; R3 -> TYPMOD flags ; R4 -> OUTBUF ; R5 Current user PC or PAR1 if PARFLG&PAR.1 <> 0 ; ; CALL SRADIX ; ; OUTPUTS: ; Default Radix or specified radix set. ; ; Notes: ; ; 1) Valid values are 2, 8, 10, and 16. ; 2) Value is interpreted as an octal number, unless overridden. ;- DBGSYM SRADIX SRADIX: BNE 10$ ;Branch if PARFLG <> 0 MOVB #PRADIX,R5 ;Set default radix 10$: ;R5 = Radix to set, validate it! CMP R5,#2 ;Binary? BEQ 20$ ;Branch if so CMP R5,#8. ;Octal? BEQ 20$ ;Branch if so CMP R5,#10. ;Decimal? BEQ 20$ ;Branch if so CMP R5,#16. ;Hex? BNE 30$ ;Branch if not. invalid radix. Leave current 20$: MOVB R5,CRADIX ;Set the radix .COND BIC #TO.INI,@R3,COND=G$$APH ;Force initialization by scope code 30$: RETURN .SBTTL [value];T - STYPOU - Set type out mode ;+ ; STYPOU ; Set type-out mode ; ; Syntax: ; ; [value];T ; ; Defaults: ; ; value 0 ; ; Semantics: ; ; If value specified is positive ; then type-out mode bit specified := value ; else If value specified is negative ; then pos(type-out mode bit specified) is cleared ; else type-out mode := default ; ; INPUTS: ; R0 Copy of PARFLG ; Condition codes Setup from a TSTB R0 ; R1 EXPFLG (Expression flags from GETEXP) ; R2 Undefined ; R3 -> TYPMOD flags ; R4 -> OUTBUF ; R5 Current user PC or PAR1 if PARFLG&PAR.1 <> 0 ; ; CALL STYPOU ; ; OUTPUTS: ; Default mode(s) set or specified mode set/reset. ; ; Note: ; The type-out mode is bit encoded as follows: ; ; 400 => initialization has been done (Scope mode) ; 200 => graphics mode (VT100 support only) ; 100 => no symbolic data ; 040 => data mode ; 020 => byte mode (forces !140) ; 010 => RAD50 mode (forces !140, clears 020) ; 004 => ASCII mode (forces !140) ; 001 => no symbolic addresses ;- DBGSYM STYPOU STYPOU: BNE 40$ ;Branch if PARFLG <> 0 MOV #TYPDEF,@R3 ;Reset current modes MOV @R3,DTYPMD ;Reset default modes BR 60$ ; 40$: TST R5 ;R5 < 0? BMI 50$ ;Branch if so BIS R5,@R3 ;Set new bits BIS R5,DTYPMD ; Both places BR 60$ ; 50$: NEG R5 ;Get the bits to clear BIC R5,@R3 ;Clear the mode BIC R5,DTYPMD ; and new default 60$: .COND CALL DBG$TU,COND=G$$APH ;Update the screen RETURN .IF NE,<!> ;If RSX/SOFT or RT/SD: .SBTTL [value];V - RSTSST - Reset/zero SST trap table ;+ ; RSTSST ; Reset/Set RSX11 SST trap table ; ; Syntax: ; ; [value];V ; ; Defaults: ; ; No value specified, resets all trap handling to DBG ; ; ; Range: ; ; value => 0 <= 7 (RSX) ; None (RT-11) ; ; Semantics: ; ; If value specified ; then zero SSTVEC[value] ; else restore complete SSTVEC table ; ; INPUTS: ; R0 Copy of PARFLG ; Condition codes Setup from a TSTB R0 ; R1 EXPFLG (Expression flags from GETEXP) ; R2 Undefined ; R3 -> TYPMOD flags ; R4 -> OUTBUF ; R5 Current user PC or PAR1 if PARFLG&PAR.1 <> 0 ; ; CALL RSTSST ; ; OUTPUTS: ; SST table set entry(s) set or reset to defaults ; Note: ; ; The SSTVEC table entry for BPT's is ALWAYS refreshed, so that ; a user may NOT force DBG to lose T-BIT and BPT control. ;- DBGSYM RSTSST .IF NE, ;If RSX version RSTSST: BEQ 80$ ;Branch if complete restore wanted CMP R5,#7 ;Must be between 0 -> 7 BHI 100$ ;Branch if invalid ASL R5 ;R0 = Word offset into USRSST table ADDR USRSST,R5,ADD ;Add beginning of table address to wrd. offset CLR @R5 ;and clear that entry MOVPIC TRAP14,USRSST+4 ;ALWAYS reset BPT trap control! BR 100$ ;Return to caller 80$: ADDR REFSST,R0 ;R0 -> SST refresh table ADDR USRSST,R2 ;R2 -> USER SST table MOV #8.,R3 ;R3 = # Elements in the table 90$: MOV (R0)+,(R2)+ ;Restore element in table SOB R3,90$ ;For all elements 100$: RETURN ;Return to the caller .IFF; NE, ;If RSX version .ENABL LSB ; Note: R5 being 0 or 1 is enforced by DBGCMD since the arguments to ; this routine can only be internal symbols. RSTSST: BEQ 10$ ;Branch if RESET trap handling to DBG INC R5 ;0 or 1 converted to 1 or 2 BISB R5,TRPFLG ;Set requested trap handling BR 20$ ;Return to caller 10$: .ROM CLRB TRPFLG ;Reset trap handling back to DBG 20$: RETURN ;Return to the caller .DSABL LSB .ENDC; NE, ;If RSX version .ENDC; NE,<!> ;If RSX/SOFT or RT/SD: .SBTTL [addr]% - OPENR5 - Open addr as RAD50 word ;+ ; OPENR5 ; Open address as RAD50 word ; ; Syntax: ; ; [addr]% ; ; Defaults: ; ; addr current address ; ; Semantics: ; ; addr is opened as a RAD50 word ; ; INPUTS: ; R0 Copy of PARFLG ; Condition codes Setup from a TSTB R0 ; R1 EXPFLG (Expression flags from GETEXP) ; R2 Undefined ; R3 -> TYPMOD flags ; R4 -> OUTBUF ; R5 Current user PC or PAR1 if PARFLG&PAR.1 <> 0 ; ; CALL OPENR5 ; ; OUTPUTS: ; Location specified or . opened in RAD50 typeout mode ;- .ENABL LSB DBGSYM OPENR5 OPENR5: BIC #,@R3 ;Get rid of BYTE/ASCII mode, if set BIS #TO.R50,@R3 ;Set RAD50 mode MOVB #'%,TYPCHR ;Set up our lead-in character CALL SETADR ;Get address to open BIC #1,R5 ;Can't be odd MOV R5,DOT ;Save it both places BR 30$ ;Merge .SBTTL [addr]" - OPENAS - Open addr as ASCII word .SBTTL [addr]' - OPENAB - Open addr as ASCII byte ;+ ; OPENAB/OPENAS ; Open address as an ASCII byte/word ; ; Syntax: ; ; [addr]" or [addr]' ; ; Defaults: ; ; addr current address ; ; Semantics: ; ; addr is opened as an ASCII word if even, byte if odd. ; ; INPUTS: ; R0 Copy of PARFLG ; Condition codes Setup from a TSTB R0 ; R1 EXPFLG (Expression flags from GETEXP) ; R2 Undefined ; R3 -> TYPMOD flags ; R4 -> OUTBUF ; R5 Current user PC or PAR1 if PARFLG&PAR.1 <> 0 ; ; CALL OPENAB/OPENAS ; ; OUTPUTS: ; Location specified or . opened in ASCII typeout mode as a word or byte ;- DBGSYM OPENAB DBGSYM OPENAS OPENAB: BIS #TO.BYT,@R3 ;Set byte mode MOVB #'',TYPCHR ;Set up our lead in character BR 10$ ;Merge OPENAS: BIC #TO.BYT,@R3 ;Clear byte mode MOVB #'",TYPCHR ;Set up our lead in character 10$: BIC #TO.R50,@R3 ;Clear RAD50 type-out, if set BIS #TO.ASC,@R3 ;Set ASCII type-out mode CALL SETADR ;Set up the correct address TSTB @R3 ;Are we in byte mode? BPL 30$ ;Go open it, in word mode .ASSUME TO.BYT EQ 200 BR 40$ ;Go open it, in forced byte mode .SBTTL [addr]| - OPEABS - Open addr as ABS data word/byte ;+ ; OPEABS ; Open address in forced non-symbolic data byte/word mode ; ; Syntax: ; ; [addr]| ; ; Defaults: ; ; addr current address ; ; Semantics: ; ; addr is opened as a data word if even, byte if odd, but ; ALWAYS in non-symbolic mode. ; ; INPUTS: ; R0 Copy of PARFLG ; Condition codes Setup from a TSTB R0 ; R1 EXPFLG (Expression flags from GETEXP) ; R2 Undefined ; R3 -> TYPMOD flags ; R4 -> OUTBUF ; R5 Current user PC or PAR1 if PARFLG&PAR.1 <> 0 ; ; CALL OPEABS ; ; OUTPUTS: ; Location specified or . opened in non-symbolic typeout mode ;- DBGSYM OPEABS OPEABS: MOVB #'|,TYPCHR ;Set up our lead-in character BIS #TO.ADT,@R3 ;Set ABS data mode BR 20$ ;Go set byte or word mode .SBTTL [addr][ - OPENWD - Open addr as data word ;+ ; OPENWD ; Open address as a data word ; ; Syntax: ; ; [addr][ ; ; Defaults: ; ; addr current address ; ; Semantics: ; ; addr is opened as a data word if even, byte if odd ; ; INPUTS: ; R0 Copy of PARFLG ; Condition codes Setup from a TSTB R0 ; R1 EXPFLG (Expression flags from GETEXP) ; R2 Undefined ; R3 -> TYPMOD flags ; R4 -> OUTBUF ; R5 Current user PC or PAR1 if PARFLG&PAR.1 <> 0 ; ; CALL OPENWD ; ; OUTPUTS: ; Location specified or . opened in symbolic mode ;- DBGSYM OPENWD OPENWD: MOVB #'[,TYPCHR ;Set up our lead-in character BIC #TO.ADT,@R3 ;Force symbolic data mode 20$: CALL SETADR ;Get address to open in R5 and DOT BIC #,@R3 ;Get rid of ASCII or RAD50 mode 30$: BIS #TO.DAT,@R3 ;Open it as data BIT #1,R5 ;Odd address? BNE 40$ ;Branch if so. Open it as a byte BR 50$ ;Go open the word .SBTTL [addr]\ - OPENBY - Open addr as data byte ;+ ; OPENBY ; Open address as a data byte ; ; Syntax: ; ; [addr]\ ; ; Defaults: ; ; addr current address ; ; Semantics: ; ; addr is opened as a data byte ; ; INPUTS: ; R0 Copy of PARFLG ; Condition codes Setup from a TSTB R0 ; R1 EXPFLG (Expression flags from GETEXP) ; R2 Undefined ; R3 -> TYPMOD flags ; R4 -> OUTBUF ; R5 Current user PC or PAR1 if PARFLG&PAR.1 <> 0 ; ; CALL OPENBY ; ; OUTPUTS: ; Location specified opened in absolute byte mode ;- DBGSYM OPENBY OPENBY: CALL SETADR ;Get address to open MOVB #'\,TYPCHR ;Set up our lead-in character BIC #,@R3 ;Get rid of ASCII or RAD50 mode 40$: BIS #,@R3 ;Set data, byte, abs data BR 50$ .SBTTL [addr]/ - OPENIN - Open addr as instruction ;+ ; OPENIN ; Open address as an instruction ; ; Syntax: ; ; [addr]/ ; ; Defaults: ; ; addr current address ; ; Semantics: ; ; addr is opened as an instruction ; ; INPUTS: ; R0 Copy of PARFLG ; Condition codes Setup from a TSTB R0 ; R1 EXPFLG (Expression flags from GETEXP) ; R2 Undefined ; R3 -> TYPMOD flags ; R4 -> OUTBUF ; R5 Current user PC or PAR1 if PARFLG&PAR.1 <> 0 ; ; CALL OPENIN/OPENI1 ; ; OUTPUTS: ; Location specified or . opened in instruction mode ; ; Note: OPENI1 is used by DBGTRP to display an instruction after a single ; step or breakpoint entry. ;- DBGSYM OPENI1 DBGSYM OPENIN OPENI1: BIS #TO.NCR,@R3 ;No preceding the instruction CLRB OPNFLG ;Force no open location CLRB PARFLG ;Force no parameters MOV #TI.VAL,EXPFLG ;Flag non-internal register open OPENIN: CALL SETADR ;Get address to open MOVB #'/,TYPCHR ;Set up our lead-in character BIC #^C,@R3 ;Turn off all strange modes 50$: CALLR OPEN .IF NE, ;If I&D space supported .SBTTL [value]# - OPENPO - Open location @Q and switch space ;+ ; OPENPO ; Open location @Q in current mode, and reverse setting of I-D space. ; ; Syntax: ; ; [value]# ; ; Defaults: ; ; value none ; ; Semantics: ; ; If value is specified ; then store value in current location ; Open location pointed to by Q ; If currently in I-SPACE, open @Q in D-SPACE ; If currently in D-SPACE, open @Q in I-SPACE ; ; INPUTS: ; R0 Copy of PARFLG ; Condition codes Setup from a TSTB R0 ; R1 EXPFLG (Expression flags from GETEXP) ; R2 Undefined ; R3 -> TYPMOD flags ; R4 -> OUTBUF ; R5 Current user PC or PAR1 if PARFLG&PAR.1 <> 0 ; ; CALL OPENPO ; ; OUTPUTS: ; Indirect location specified or . opened in opposite space ;- DBGSYM OPENPO OPENPO: CALL MDCLS1 ;Modify current location if needed BIT #TO.DSP,@R3 ;Currently in D-SPACE ? BEQ 51$ ;Branch if not BIC #TO.DSP,@R3 ;Set us up in I-SPACE BR 52$ ;Merge with common code 51$: BIS #TO.DSP,@R3 ;Set us up in D-SPACE BR 52$ ;Merge with common code .ENDC; NE, ;If I&D space supported .SBTTL [value]@ - OPENAT - Open location @Q ;+ ; OPENAT ; Open location @Q in current mode ; ; Syntax: ; ; [value]@ ; ; Defaults: ; ; value none ; ; Semantics: ; ; If value is specified ; then store value in current location ; Open location pointed to by Q ; ; INPUTS: ; R0 Copy of PARFLG ; Condition codes Setup from a TSTB R0 ; R1 EXPFLG (Expression flags from GETEXP) ; R2 Undefined ; R3 -> TYPMOD flags ; R4 -> OUTBUF ; R5 Current user PC or PAR1 if PARFLG&PAR.1 <> 0 ; ; CALL OPENAT ; ; OUTPUTS: ; Indirect location specified or . opened in current mode ;- DBGSYM OPENAT OPENAT: CALL MDCLS1 ;Modify current location if needed 52$: CLRB IREGFL ;We are NOT opening a internal register w/@ MOV Q,R5 ;Set up location to open BIT #1,R5 ;Are we going to open a ODD location? BEQ 57$ ;Branch if not, OK. BIS #TO.BYT,@R3 ;Else FORCE byte mode in-case DATA mode. BR 57$ ;Go open the location .SBTTL [value]^ - OPENPR - Open previous location ;+ ; OPENPR ; Open previous location in current mode ; ; Syntax: ; ; [value]^ ; ; Defaults: ; ; value none ; ; Semantics: ; ; If value specified ; then store value in current location ; Open previous location ; ; INPUTS: ; R0 Copy of PARFLG ; Condition codes Setup from a TSTB R0 ; R1 EXPFLG (Expression flags from GETEXP) ; R2 Undefined ; R3 -> TYPMOD flags ; R4 -> OUTBUF ; R5 Current user PC or PAR1 if PARFLG&PAR.1 <> 0 ; ; CALL OPENPR ; ; OUTPUTS: ; Previous location opened in current mode ;- DBGSYM OPENPR OPENPR: CALL MDCLS1 ;Modify current location if needed BIT #TO.DAT,@R3 ;Data type-out? BNE 60$ ;Branch if so BIC #1,R5 ;Don't call me ODDLY! CLR -(SP) ;Make some room on stack MOV R5,DOT ;Save current address SUB #6,R5 ;Assume a 3 word instruction BCC 55$ ;Branch if no carry. R5 => 6 CLR R5 ;Start at zero if R5 was less than 6 55$: MOV R5,@SP ;Save this point CALL DECODE ;Decode the instruction DBGFNC FUNCTION=CLEAR_OUTBUF CMP R5,DOT ;Did we get back to where we started? BHIS 56$ ;Branch if so MOV @SP,R5 ;Get last address checked ADD #2,R5 ;Try again as an n-1 word instruction BR 55$ ; 60$: DEC R5 ;Back up by 1 byte TSTB @R3 ;In byte mode? .ASSUME TO.BYT EQ 200 BMI 57$ ;Branch if so. Stuff DOT and go open DEC R5 ;Else back up another byte BR 57$ ;Go stuff DOT, and do open. 56$: MOV (SP)+,R5 ;R5 -> instruction 57$: MOV R5,DOT ;Save it here, too BR 70$ ;Go do type-out, don't touch IREGFL .SBTTL [value] - OPENXT - Open next location ;+ ; OPENXT ; Open next location in current mode. ; ; Syntax: ; ; [value] ; ; Defaults: ; ; value none ; ; Semantics: ; ; If value specified ; then store value in current location ; Open next location ; ; INPUTS: ; R0 Copy of PARFLG ; Condition codes Setup from a TSTB R0 ; R1 EXPFLG (Expression flags from GETEXP) ; R2 Undefined ; R3 -> TYPMOD flags ; R4 -> OUTBUF ; R5 Current user PC or PAR1 if PARFLG&PAR.1 <> 0 ; ; CALL RSTSST ; ; OUTPUTS: ; Next location opened in current mode ;- DBGSYM OPENXT OPENXT: CALL MDCLS1 ;Modify current location, if needed .ROM MOV NXTADR,R5 ;Set up next location to open MOV R5,DOT ;Save it BIS #TO.NCR,@R3 ;No preceding the instruction 70$: CALLR OPEN1 ;Open location - don't touch IREGFL! .DSABL LSB .SBTTL [value] - MODCLS - Modify and close location ;+ ; MODCLS/MDCLS1/MDCLS2 ; Close current location and reset mode flags. ; ; Syntax: ; ; [value] ; ; Defaults: ; ; value none ; ; Semantics: ; ; If value specified ; then store value in current location ; Reset temporary type-out modes ; ; INPUTS: ; R0 Copy of PARFLG ; Condition codes Setup from a TSTB R0 ; R1 EXPFLG (Expression flags from GETEXP) ; R2 Undefined ; R3 -> TYPMOD flags ; R4 -> OUTBUF ; R5 Current user PC or PAR1 if PARFLG&PAR.1 <> 0 ; ; CALL MODCLS/MDCLS1/MDCLS2 ; ; OUTPUTS: ; Location closed, typeout flags reset. ;- DBGSYM MODCLS DBGSYM MDCLS2 DBGSYM MDCLS1 MODCLS: CALL MDCLS1 ;Close and modify the location if needed MDCLS2: ADDR TYPMOD,R3 ;R3 -> TYPMOD MOV DTYPMD,@R3 ;Reset to default type out mode CLRB OPNFLG ;Clear open location MOVB #'/,TYPCHR ;Reset lead-in character RETURN MDCLS1: BITB #PAR.1,R0 ;Parameter #1 here? BEQ 40$ ;Branch if not, assume none present. TSTB OPNFLG ;Is there an open location? BNE 10$ ;Branch if so ERROR STRING=NLOSTR ;Else give error message ; 10$: MOV DOT,R5 ;R5 -> Address to modify MOVB R0,-(SP) ;@SP = Parflgs ADDR PARS,R1 ;R1 -> Parameter list 11$: ASRB @SP ;Next parameter present? BCC 35$ ;Branch if not, done. TSTB @R3 ;Stuff in byte mode? BMI 13$ ;Branch if so .ASSUME TO.BYT EQ 200 PUT @R1 ;Stuff value into usr/dbg ;*I/D* 12$: MOV (R1)+,Q ;Update "LAST TYPED ADDRESS TOO" CALL ADRCHK ;Check internal register address bounds. BR 11$ ;Loop for next parameter 13$: PUT @R1,BYTE=YES ;Stuff value into usr/dbg ;*I/D* BR 12$ ;Update Q, loop for next parameter. 35$: MOV R5,NXTADR ;Save pointer to next location TST (SP)+ ;Clean the stack of old PARFLG 40$: CLRB OPNFLG ;Nothing is open now MOV DOT,R5 ;Make sure R5 is pointing at the correct loc RETURN PSECT PURE_BYTE_DATA NLOSTR: ERRMSG WARNING,, PSECT PURE_CODE .SBTTL [value];S - EXEINS - Execute next instruction ;+ ; EXEINS ; Execute next instruction - single step ; ; Syntax: ; ; [value];S ; ; Defaults: ; ; value 1 ; ; Semantics: ; ; The instruction pointed to by the user's PC is executed. Control ; returns to DBG. If value is specified, execute the next n ; instructions with trace. ; ; INPUTS: ; R0 Copy of PARFLG ; Condition codes Setup from a TSTB R0 ; R1 EXPFLG (Expression flags from GETEXP) ; R2 Undefined ; R3 -> TYPMOD flags ; R4 -> OUTBUF ; R5 Current user PC or PAR1 if PARFLG&PAR.1 <> 0 ; ; CALL EXEINS ; ; OUTPUTS: ; Next n instructions executed ;- DBGSYM EXEINS ; !!! If value < 0 should we execute POS(value) instructions !!! ; !!! with NO-TRACE ??? !!! EXEINS: BNE 10$ ;Branch if we have a parameter MOV #1,R5 ;Else default to 1 10$: MOV R5,BPTABL+BT.CNT;Store the single step count MOV #1*256.,PROSNG ;Set proceed and single step mode .ASSUME PROCED EQ .ASSUME PROSNG EQ PROCED BR RETUS1 ;Return to user at current PC=(...UPC) .SBTTL [addr];G - GOTO - Start execution ;+ ; GOTO ; Start execution ; ; Syntax: ; ; [addr];G ; ; Defaults: ...UPC = Address to start at ; ; addr job start address ; ; Semantics: ; ; If addr specified ; then start program execution at addr ; else start program execution at job start address ; ; INPUTS: ; R0 Copy of PARFLG ; Condition codes Setup from a TSTB R0 ; R1 EXPFLG (Expression flags from GETEXP) ; R2 Undefined ; R3 -> TYPMOD flags ; R4 -> OUTBUF ; R5 Current user PC or PAR1 if PARFLG&PAR.1 <> 0 ; ; CALL GOTO ; ; OUTPUTS: ; Program started at specified location or . ;- DBGSYM GOTO GOTO: BNE 10$ ;Branch if R5=PAR1 and specified. MOV ...UPC,R5 ;R5 -> Current PC BNE 10$ ;Branch if some address was setup ERROR STRING=NSASTR ;Else give error message ; 10$: MOV R5,...UPC ;Save user PC, PSW = Last PSW=(...UPS) BR RETUS1 ;Go return to user @R5 PSECT PURE_BYTE_DATA NSASTR: ERRMSG WARNING,, PSECT PURE_CODE .SBTTL [value];P - PROBPT - Proceed from BPT ;+ ; PROBPT ; Proceed from BPT ; ; Syntax: ; ; [value];P ; ; Defaults: ; ; value 1 ; ; Semantics: ; ; Proceed from the current BPT. Stop when the BPT is executed ; the value'th time. ; ; INPUTS: ; R0 Copy of PARFLG ; Condition codes Setup from a TSTB R0 ; R1 EXPFLG (Expression flags from GETEXP) ; R2 Undefined ; R3 -> TYPMOD flags ; R4 -> OUTBUF ; R5 Current user PC or PAR1 if PARFLG&PAR.1 <> 0 ; ; CALL PROBPT ; ; OUTPUTS: ; Program continued from last breakpoint ;- .ENABL LSB DBGSYM PROBPT PROBPT: MOV ...UPC,R5 ;R5 -> current instruction .ROM TSTB BPTNUM,VALUE=0 ;Can we proceed? BPL 20$ ;Branch if so CALL LODADR ;Load OUTBUF with address CLRB @R4 ;.ASCIZ for OUTBUF print ERROR STRING=CANSTR,OUTBUF=YES ; 20$: MOV CURBPT,R1 ;R1 -> current BPT table entry ; !!! What if value spec'ed and NOT proceeding from a BPT ??? !!! CMPPIC BPTABL,R1 ;Are we really proceeding from a BPT? BEQ RETUS1 ;Branch if not, just return to user code MOV PAR1,BT.CNT(R1) ;Get value if specified BNE 30$ ;Something was there INC BT.CNT(R1) ;Set the count to one 30$: MOVB #1,PROCED ;Say that we're proceeding from BPT .ASSUME PROCED EQ .ASSUME PROSNG EQ PROCED RETUS1: CALLR RETUSR ;Bye bye ... .DSABL LSB PSECT PURE_BYTE_DATA CANSTR: ERRMSG WARNING,,,TERMINATOR=200 PSECT PURE_CODE .SBTTL .SBTTL Command support Routines .SBTTL .SBTTL OPEN - Open a location in a specified mode ;+ ; OPEN ; This routine opens a location in the mode specified by the bits in ; TYPMOD. ; ; R3 -> TYPMOD ; R4 -> scratch output buffer ; R5 -> word to open ; ; CALL OPEN ; ; R0,R1,R2 modified ;- .ENABL LSB DBGSYM OPEN DBGSYM OPEN1 OPEN: MOV EXPFLG,R1 ;R1 = Expression flags from GETEXP BEQ OPEN1 ;Branch if none, don't touch IREGFL. .ROM CLRB IREGFL ;Reset INTERNAL REGISTER OPEN flag BIT #TI.IRG,R1 ;Is this a internal symbol open? BEQ OPEN1 ;Branch if not. MOVB #1,IREGFL ;Flag that we are opening a internal symbol CMPB #'/,TYPCHR ;Attempting to open in instruction format? BNE OPEN1 ;Branch if not. JMP OPENWD ;Else force data mode '[' OPEN1: BIT #TO.DAT,@R3 ;Data mode? BNE 1$ ;Branch if so BIC #1,R5 ;Must be even MOV R5,DOT ;Save it 1$: TSTB OPNFLG ;Is there a location already open? BNE 5$ ;Branch if so. Don't type address BIT #TO.NCR,@R3 ;Should we type a , even so? BNE 3$ ;Branch if not CRLF ;Type a 3$: BIC #TO.NCR,@R3 ;Don't do it accidently CALL LODAD3 ;Load the address into the buffer .ROM MOVB TYPCHR,(R4)+ ; and the flag character MOVB #,(R4)+ ; and a 5$: BIT #TO.DAT,@R3 ;Typing in data mode? BNE 10$ ;Branch if so CALL DECODE ;Decode the instruction BR 50$ ;Go type it out 10$: GET R1,BYTE=YES ;Get byte from usr/dbg ;*I/D* TSTB @R3 ;Byte mode? .ASSUME TO.BYT EQ 200 BMI 20$ ;Branch if so DEC R5 ;Correct R5 from BISB GET R1 ;Get word from usr/dbg ;*I/D* 20$: MOV R1,Q ;Update "LAST TYPED ADDRESS" in-case RAD or ASC BIT #TO.ASC,@R3 ;ASCII type-out? BEQ 30$ ;Branch if not CALL ASCOUT ;Convert to ASCII BR 50$ ;Type it 30$: BIT #TO.R50,@R3 ;RAD50 mode BEQ 40$ ;Branch if not CALL R50OUT ;Convert RAD50 to ASCII BR 50$ ;Type it 40$: CALL LODDAT ;Load buffer with data in R1 50$: CALL ADRCHK ;Check internal register address bounds. MOV R5,NXTADR ;Save the next location TYPE OUTBUF ;Print outbuf, reload R4 TYPE ;And a .ROM MOVB #1,OPNFLG ;Flag that we have a location open RETURN .DSABL LSB .SBTTL ADRCHK - Check on internal register address boundrys ;+ ; ADRCHK ; This routine checks the address in R5 against the internal register ; boundry's, and errors if it is out of bounds, and there is a internal ; register open. ; ; R5 = Address to check ; IREGFL <> 0 If internal registers are being accessed ; ; CALL ADRCHK ; ; Return's only if R5 is OK. ;- DBGSYM ADRCHK ADRCHK: TSTB IREGFL ;Are internal registers being accessed? BEQ 30$ ;Branch if not, OK. CMPPIC IREGS,R5 ;Check address limits BLO 20$ ;Branch if above low limit, OK. 10$: ERROR STRING=IRGSTR ;Invalid internal register ; 20$: CMPPIC IREGE,R5 ;Check upper bounds BLO 10$ ;Branch if same of higher, error. 30$: RETURN ;Return to caller, OK. PSECT PURE_BYTE_DATA IRGSTR: ERRMSG WARNING,, PSECT PURE_CODE .SBTTL SETADR - Set up the current address ;+ ; SETADR ; The current address is set to PAR1 if it was specified. It is not ; modified otherwise. ; ; CALL SETADR ; ; R5, DOT set to current address if PAR1 specified. ;- DBGSYM SETADR SETADR: BITB #PAR.1,PARFLG ;Was a value specified? BEQ 30$ ;Branch if not. R5 and DOT already correct 10$: MOV PAR1,R5 ;Get the new current address MOV R5,DOT ;Save it 30$: RETURN .IF NE,0 .SBTTL LSTMEM - List memory ;+ ; LSTMEM ; This routine list out memory, in one of two formats: Either ; a macro assembler type of listing like: ; ; Address value value value instruction ; ; or in the standard DUMP format like: ; ; Address value value value value value value value value value ; ; ; PAR0 = Start address to dump ; PAR1 = End address to stop at ; ; CALL LSTMEM ; ; All registers volitile ;- DBGSYM LSTMEM LSTMEM: MOV PAR2,-(SP) ;@SP = Ending address BNE 10$ ;Branch if something there MOV R5,@SP ;Else End = Start ; Assembler format output loop !!!R2 may be used!!! 10$: CRLF ;???!!!??? CMP R5,@SP ;At the ending address yet? BHI 50$ ;Branch if so, done. DBGFNC FUNCTION=READ_NOWAIT ;See if character typed BCC 50$ ;Branch if so, DIE. CALL LODAD2 ;Load buffer @R4 with address MOVB #,(R4)+ ;Insert a tab into buffer MOV R5,R2 ;Save current PC CALL DECODE ;Call decode here to get # words in INS SUB R2,R5 ;R5 = Length of last instruction. ASR R5 ;Make it words MOV R5,-(SP) ;Save it on the stack MOV R2,R3 ;R3 -> Instruction words 20$: MOV R5,-(SP) ;Save R5 MOV R3,R5 ;Copy it for GET GET R1,IREGS=NO ;R1 = Instruction word ;*I/D* MOV R5,R3 ;Copy it back to R3 MOV (SP)+,R5 ;Restore R5 ;R4 -> Scratch buffer CALL DCD.IO ;Put it in the output buffer MOVB #,(R4)+ ;Insert a TAB DEC @SP ;More words to print? BGT 20$ ;Branch if so. TST (SP)+ ;Clean stack NEG R5 ;Determine number of extra tabs to ADD #3,R5 ; print BEQ 40$ ;Branch if no need to print any more 30$: MOVB #,(R4)+ ;Add a TAB DEC R5 ;More to do? BGT 30$ ;Branch if so 40$: MOV R2,R5 ;Restore LAST PC CALL DECODE ;Fill buffer @R4 with instruction TYPE OUTBUF ;Spit the line out, reload R4 BR 10$ ;Loop for all of DUMP area. 50$: TST (SP)+ ;Clean the stack RETURN ;Return to caller .ENDC; NE,0 .IF NE,0 .SBTTL BAKINS - Back up an instruction ;+ ; BAKINS ; This routine backs up the current PC, until a valid ; instruction is found that places us at the current ; address input in R5. A maximum backup of three words ; is done. ; ; R5 = Current PC ; ...UPS = Current PSW ; ; CALL BAKINS ; ; R5,DOT = Updated PC ; R4 -> OUTBUF ;- DBGSYM BAKINS BAKINS: BIC #1,R5 ;Don't call me ODDLY! MOV R5,DOT ;Save current address CLR -(SP) ;Make some room on stack SUB #6,R5 ;Assume a 3 word instruction BCC 10$ ;Branch if no carry. R5 => 6 CLR R5 ;Start at zero if R5 was less than 6 10$: MOV R5,@SP ;Save this point CALL DECODE ;Decode the instruction DBGFNC FUNCTION=CLEAR_OUTBUF CMP R5,DOT ;Did we get back to where we started? BHIS 20$ ;Branch if so MOV @SP,R5 ;Get last address checked ADD #2,R5 ;Try again as an n-1 word instruction BR 10$ ; 20$: MOV (SP)+,R5 ;R5 -> instruction MOV R5,DOT ;Save it here, too RETURN .ENDC; NE,0 .SBTTL .SBTTL Math and general data type conversion routines .SBTTL .SBTTL GETNAM - 6 character ASCII to RAD50 conversion routine .SBTTL GETNM1 - 3 character ASCII to RAD50 conversion routine ;+ ; GETNAM ; This routine converts a sequence of 0 to 6 alphanumerics to RAD50. ; ; R2 -> 2 word result area ; R4 -> input string ; ; CALL GETNAM ; ; R0-R2 modified ;- .ENABL LSB DBGSYM GETNAM DBGSYM GETNM1 GETNAM: MOV R4,R1 ;R1 -> input string CALL GETNM1 ;Convert 1st 3 characters TST (R2)+ ;Point to the next word .BR GETNM1 ;Fall thru and convert 3 more characters GETNM1: MOV #3,R0 ;R0 = character count CLR @R2 ;Clear out storage word ; Conversion loop 20$: .IF EQ, ;If NOT D-SPACE space version JSR R0,50$ ;Save R0 ;R0 -> range check table .IFF; EQ, ;If NOT D-SPACE space version ADDR RADTAB,R0,PUSH ;Save R0, load R0 with address of RADTAB PSECT PURE_DATA .IFTF; EQ, ;If NOT D-SPACE space version RADTAB: .ASCII \$$\ ;Range for "$" .ASCII \..\ ;Range for "." .ASCII \09\ ;Range for numeric .ASCII \AZ\ ;Range for uc alpha .ASCII \__\ ;Range for blank fill character "_" .ASCII \az\ ;Range for lc alpha RADTA1: .WORD -11 ;RAD50 adjust for "$" .WORD -22 ;RAD50 adjust for "." .WORD -22 ;RAD50 adjust for numeric .WORD -100 ;RAD50 adjust for uc alpha .WORD -137 ;RAD50 adjust for character '_' .WORD -140 ;RAD50 adjust for lc alpha .IFF; EQ, ;If NOT D-SPACE space version PSECT PURE_CODE .ENDC; EQ, ;If NOT D-SPACE space version 50$: CLR -(SP) ;Clear space for next RAD50 character 60$: CMPB (R0)+,@R1 ;Character in this range? BHI 70$ ;Branch if not, or end of table CMPB (R0)+,@R1 ;Check other end of range BLT 60$ ;Try next set CMPB -(R0),-(R0) ;Character identified. Is it special? MOVB (R1)+,@SP ;Put the character on the stack ADD RADTA1-RADTAB(R0),@SP ;Adjust the character to RAD50 70$: ASL @R2 ;Multiply ASL @R2 ; total ASL @R2 ; by 50 ADD @R2,@SP ; to make room ASL @R2 ; for the ASL @R2 ; character ADD (SP)+,@R2 ;Add in the new character MOV (SP)+,R0 ;Get the loop count SOB R0,20$ ;Loop 'til done RETURN .DSABL LSB .SBTTL ASCOUT - Output ASCII ;+ ; ASCOUT ; ; R1 = 1 or 2 characters to move to buffer ; R4 -> output buffer ; ; CALL ASCOUT ; ; R1 modified ; R4 updated past end of ASCII character(s) ;- DBGSYM ASCOU1 DBGSYM ASCOUT ASCOU1: MOVB #'',@R4 ;Stuff a flag character. Assume byte ouput TSTB TYPMOD ;Is it byte output? .ASSUME TO.BYT EQ 200 BMI 10$ ;Branch if so MOVB #'",@R4 ;Else use a different flag 10$: INC R4 ;Skip past flag character ASCOUT: TSTB TYPMOD ;Byte mode output? .ASSUME TO.BYT EQ 200 BMI 10$ ;Branch if so. Output a byte CALL 10$ ;Else output a byte SWAB R1 ;Make high byte low 10$: BICB #200,R1 ;Clear garbage CMPB R1,#177 ;Special case? BNE 15$ ;Branch if not. BICB #100,R1 ;Make it ^? then. BR 16$ ;Merge 15$: CMPB #BLANK,R1 ;Is it a control character? BLOS 20$ ;Branch if not BISB #100,R1 ;Make it not a control 16$: MOVB #'^,(R4)+ ;Stuff the "^" 20$: MOVB R1,(R4)+ ;Store the character RETURN .SBTTL R50OUT - RAD50 to ASCII conversion routine ;+ ; R50OUT ; The RAD50 to ASCII routine converts one RAD50 word contained in R1 ; to ASCII and stores it in the area pointed to by R4. ; The unused RAD50 code (35) is converted to "?". ; ; R1 = The word to be converted ; R4 => The area to store the ASCII ; ; CALL R50OUT ; ; R0,R1 destroyed ; R4 is updated past the end of the ASCII characters ;- DBGSYM R50OU1 DBGSYM R50OUT R50OU1: MOVB #'%,(R4)+ ;Put in a leading "%" R50OUT: MOV R3,-(SP) ; and R3 ADDR DIVTAB,R3 ;Point to divisor table 10$: TST -(R3) ;Backup through table - at end? BEQ 80$ ;If equal - yes. Done MOV #-1,R0 ;Init quotient register CMP #174777,R1 ;RAD50 value too large? BLO 40$ ;Yes - output "???" 20$: INC R0 ;Divide by power of 50(8) SUB @R3,R1 ; BCC 20$ ; ADD @R3,R1 ;Restore dividend TST R0 ;Character a blank? BEQ 50$ ;Yes CMP #35,R0 ;Digit? BLO 60$ ;Branch if so BNE 30$ ;Branch if alpha, $, or "." ADD #2,R0 ;Unused. Correct to make it "?" BR 50$ ; 30$: CMP #33,R0 ;$ or "."? BLO 60$ ;Branch if "." BEQ 70$ ;Branch if $ 40$: ADD #40,R0 ;Else alpha or "?" 50$: ADD #16,R0 ; 60$: ADD #11,R0 ; 70$: ADD #11,R0 ; MOVB R0,(R4)+ ;Store converted character BR 10$ ;Yes, continue 80$: MOV (SP)+,R3 ;Restore R3 RETURN ;And return to caller PSECT PURE_DATA .WORD 0,1,50,50*50 DIVTAB: PSECT PURE_CODE .IF EQ, ;If EIS instruction set is not to be used .SBTTL MUL - Integer Multiply Routine ;+ ; MUL ; This routine multiplies two unsigned integers. It is the equivalent ; of the hardware instruction MUL R1,R0. ; ; R0 = multiplier ; R1 = multiplicand ; ; CALL MUL or MUL R1,R0 ; ; R0 = high order result ; R1 = low order result ;- DBGSYM MUL MUL: MOV R0,-(SP) ;Save R0 for adds MOV #21,-(SP) ;Set repeat count CLR R0 ;Clear high part 10$: ROR R0 ;Double right shift ROR R1 ; BCC 20$ ;If C-bit = 0, do not add ADD 2(SP),R0 ; 20$: DEC (SP) ;Decrement repeat count BGT 10$ ;If GT, more to go 30$: CMP (SP)+,(SP)+ ;Clean stack RETURN .ENDC; EQ, ;If EIS instruction set is not to be used .SBTTL DIV - Integer Divide Routine ;+ ; DIV ; The Integer Divide (magnitude) divides two words giving both a ; quotient and a remainder. ; ; R0 = dividend ; R1 = divisor ; ; CALL DIV ; ; R0 = quotient ; R1 = remainder ;- DBGSYM DIV DIV: MOV #20,-(SP) ;Set loop count MOV R1,-(SP) ;Save divisor for subtracts CLR R1 ;Clear remainder 10$: ASL R0 ;Double precision left shift ROL R1 ; CMP R1,@SP ;Subtract out divisor BLO 20$ ;Branch if not SUB @SP,R1 ;Do it INC R0 ;Add in low bit 20$: DEC 2(SP) ;Decrement loop count BGT 10$ ;If GT, more to do CMP (SP)+,(SP)+ ;Clean the stack RETURN .SBTTL SAVVR - Save R0 - R3 as a coroutine ;+ ; SAVVR ; Save R0 - R3 as a coroutine. ; ; JSR R3,SAVVR ;- DBGSYM SAVVR SAVVR: MOV R2,-(SP) ;Save R2 MOV R1,-(SP) ; and R1 MOV R0,-(SP) ; and R0 MOV R3,-(SP) ;Put caller's return address on stack MOV 10(SP),R3 ;Get real R3 back JSR PC,@(SP)+ ;Call the caller MOV (SP)+,R0 ;Restore R0 MOV (SP)+,R1 ; and R1 MOV (SP)+,R2 ; and R2 MOV (SP)+,R3 ; and R3 RETURN .SBTTL .SBTTL .SBTTL DBGMEM - Memory Access routines for DBG ;Edit 02 .SBTTL .SBTTL .IIF NDF,L$$LST,.NLIST ;**************************************************************************** ;* * ;* COPYRIGHT (c) 1983, 1986 * ;* BY DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. * ;* ALL RIGHTS RESERVED. * ;* * ;* THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED * ;* ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE * ;* INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER * ;* COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY * ;* OTHER PERSON. NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY * ;* TRANSFERRED. * ;* * ;* THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE * ;* AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT * ;* CORPORATION. * ;* * ;* DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS * ;* SOFTWARE ON EQUIPMENT THAT IS NOT SUPPLIED BY DIGITAL. * ;* * ;**************************************************************************** ;++ ; Facility: DBG - A PDP-11 system independant symbolic debugger ; ; Author: Joe Worrall ; ; Created: 07-Jul-82 ; ; Abstract: DBGMEM - Memory Access routines for DBG ; ; Externals Description ; --------- ----------- ; ; Edit Who Date Description of modification ; ---- --- ---- --------------------------- ; 001 Jrw 16-Apr-86 Don't have CHKMEM do I/O page check when ; subject address is not even in the I/O ; page! Also, set error trap around SR3 ; access in case running on a processor ; with MMU which has no SR3. (Like 11/34) ; 002 Jrw 12-May-86 Save R3 around CHKMEM calls! ;-- PSECT PURE_CODE .IIF NDF,L$$LST,.LIST .IF NE, ;If debugger out of address space .SBTTL GETWRD - Get word from user space .SBTTL GETWR1 - Get word from user or internal register .SBTTL GETWR2 - Get word from user space w/Error handling .SBTTL GETBYT - Get byte from user or internal register .SBTTL PUTWRD - Put word into user space .SBTTL PUTWR1 - Put word into user or internal register .SBTTL PUTBYT - Put byte into user or internal register ;+ ; GETWRD Get word from user space ; GETWR1 Get word from user or internal register ; GETWR2 Get word from user space w/Error handling ; GETBYT Get byte from user or internal register ; ; PUTWRD Put word into user space ; PUTWR1 Put word into user or internal register ; PUTBYT Put byte into user or internal register ; ; This collection of routines allows DBG to word in I/D space, and ; in the future will allow DBG to be totally out of the users address ; space. ; ; General inputs: ; ; TYPMOD - Current flags (I or D space) ; ...UPS - (Kernel, Super or User mode) ; R5 - Address to GET or PUT ; 2(SP) - Value to PUT (PUT ONLY) ; ; CALL GET??? ; CALL PUT??? ; ; @SP - Value gotten (GET ONLY) ; ; Any errors result in the message "?Invalid memory reference", except ; for GETWR2, which returns with the C-BIT set, and @SP=0. ;- .ENABL LSB DBGSYM GETWRD DBGSYM GETWR1 DBGSYM GETWR2 DBGSYM GETBYT DBGSYM PUTWRD DBGSYM PUTWR1 DBGSYM PUTBYT .IF NE, ;If RSX/SOFT .MCALL MVTS$S ; We assume the MVTS$ directive definitions are the following ; Task build error's will occur if any of these change, since ; DIRSYM is always pulled in by TKB. .GLOBL WS.64B ;Make TKB bring in DIRSYM to verify MVTS$ syms. MV.FUI ==: 000010 MV.FSI ==: 000011 MV.FUD ==: 000012 MV.FSD ==: 000013 MV.TUI ==: 000014 MV.TSI ==: 000015 MV.TUD ==: 000016 MV.TSD ==: 000017 M.VTAC ==: 000002 M.VTAD ==: 000004 M.VTVA ==: 000006 M.VTBF ==: 000006 .IF NE, ;If I&D space support .ASSUME TO.DSP EQ 2 ;Assumptions based for MVTS$ calls .ENDC; NE, ;If I&D space support .IFTF; NE, ;If RSX/SOFT ; MEMFLG bit definitions ME.REG =: 001 ;We are allowed to check IREGFL ME.BYT =: 002 ;Byte mode request ME.PUT =: 004 ;This is a PUT operation ME.ERR =: 010 ;We can return on ILL mem references GETWRD: CLRB -(SP) ;Get word, error ok, USER only BR 10$ ;Merge with common code GETWR1: MOVB #,-(SP) ;Get word from user/DBG, error ok. BR 10$ ;Merge with common code GETWR2: MOVB #,-(SP) ;Get word, allow errors BR 10$ ;Merge with common code GETBYT: MOVB #,-(SP) ;Get byte from user/DBG, error ok. BR 10$ ;Merge with common code PUTWRD: MOVB #,-(SP) ;Put word to user, error ok. BR 10$ ;Merge with common code PUTWR1: MOVB #,-(SP) ;Put word to user/DBG, error ok. BR 10$ ;Merge with common code PUTBYT: MOVB #,-(SP) ;Put byte to usr/DBG, error ok. 10$: MOVB (SP)+,MEMFLG ;Save away GET/PUT flags .ROM MOV (SP)+,RETADR ;Save return address here .COND CALL RSETPS,COND=<!> ;Reset previous mode bits correctly. BITB #ME.PUT,MEMFLG ;Is this a PUT operation? BEQ 20$ ;Branch if not, no value on stack .ROM MOV (SP)+,VALUE ;Else save what to PUT 20$: CALL DOMEM ;Do memory reference operation BITB #ME.PUT,MEMFLG ;Was this a PUT operation? BNE 30$ ;Branch if so, DONE, return MOV VALUE,-(SP) ;Stack return value 30$: CALLR @RETADR ;And return to caller .DSABL LSB ;+ ; DOMEM ; The work horse of the memory access routines ;- .ENABL LSB DBGSYM DOMEM DOMEM: JSR R3,SAVVR ;Save user R0-R3 .IFF; NE, ;If RSX/SOFT MOV SP,SPSAV ;Save current stack pointer .IFTF; NE, ;If RSX/SOFT CLR R0 ;Set-up for BISB .ROM BISB MEMFLG,R0 ;R0 = Our flags byte MOVPIC MEMERR,IERR ;Set error address BITB #ME.REG,R0 ;Should we check IREGFL? BEQ 20$ ;Branch if not TSTB IREGFL ;Should we access DBG, not the USER? BEQ 20$ ;Branch if not, user memory access 5$: MOV R5,R2 ;Copy -> to subject address 666$: BITB #ME.PUT,R0 ;Put operation? BEQ 10$ ;Branch if not MOVB VALUE,@R2 ;Assume byte operation ;*I/D* BITB #ME.BYT,R0 ;Really a byte operation? BNE 900$ ;Branch if so, done. MOV VALUE,@R2 ;Else PUT a word ;*I/D* BR 900$ ;Return to caller 10$: CLR VALUE ;Setup value for BISB BISB @R2,VALUE ;Assume byte GET ;*I/D* BITB #ME.BYT,R0 ;Really a byte operation? BNE 900$ ;Branch if so, done. MOV @R2,VALUE ;Else GET a word ;*I/D* BR 900$ ;Return to caller 20$: CALL CHKMEM ;See if addr in R5 is kept withen us ;R2 -> Real addr BCS 666$ ;Branch if withen is, grab it directly .COND CALL MAPMEM,COND= ;Map R2 -> Correct location BIC #1,R2 ;It MUST be even for GET/PUT ADDR MEMBUF,R3 ;R3 -> Buffer for MVTS$ .IF NE, ;If I&D space support MOV TYPMOD,R1 ;R1 = Operation flags BIC #^C,R1 ;Clear all but D-SPACE flag .IF EQ,<!> ;If MMU support BIT #040000,...UPS ;Supervisor mode PS? BEQ 655$ ;Branch if not TST ...UPS ;Really supervisor PS? BMI 655$ ;Branch if not. INC R1 ;Else setup MVTS$ flag 655$: ;INC .ASSUMES MVTS$ args never change .ENDC; EQ,<!> ;If MMU support .IFF; NE, ;If I&D space support CLR R1 ;R1 = GET .ENDC; NE, ;If I&D space support CALL 800$ ;Do MVTS$S directive, return if OK. BIT #1,R5 ;Odd address? BEQ 30$ ;Branch if not INC R3 ;R3 -> MEMBUF+1 30$: BITB #ME.PUT,R0 ;Was this a PUT operation? BNE 3188$ ;Branch if so, do it. MOV R3,R2 ;R2 -> Value to return BR 10$ ;Merge 3188$: MOVB VALUE,@R3 ;Assume byte mode PUT BITB #ME.BYT,R0 ;Really a byte operation? BNE 40$ ;Branch if so MOV VALUE,@R3 ;Else PUT a word 40$: BIS #4,R1 ;Set PUT bit BIC #1,R3 ;Buffer must be a word MOV @R3,R3 ;R3 = Contents to stuff ;Note: Can't get IE.SDP here. CALL 800$ ;Do MVTS$S directive, return if OK. BR 900$ ;And return to caller 800$: .IFT; NE, ;If RSX/SOFT BIS #10,R1 ;Action code ALWAYS has 10 bit set. MVTS$S R1,R2,R3 ;ACTION,TSKADR,BUFADR BCC 999$ ;Branch if directive succeded! TST (SP)+ ;Else clean stack of return address CMPB #IE.SDP,@#$DSW ;Was MVTS$S Invalid on this system? BEQ 5$ ;Branch if so, do it the easy way. CLR IERR ;Reset error handling .BR MEMERR ;Give memory error. .IFF; NE, ;If RSX/SOFT BIT #4,R1 ;Put operation? BEQ 820$ ;Branch if not MOV R3,-(SP) ;Stack value to stuff .IF NE, ;If I&D space support BIT #TO.DSP,R1 ;Data space put ? BEQ 810$ ;Branch if not MTPD @R2 ;Stuff data space word RETURN ;Return to caller .ENDC; NE, ;If I&D space support 810$: MTPI @R2 ;Stuff instruction word RETURN ;Return to caller 820$: .IF NE, ;If I&D space support BIT #TO.DSP,R1 ;Data space get ? BEQ 830$ ;Branch if not MFPD @R2 ;Get subject data word BR 840$ ;Merge with common code .ENDC; NE, ;If I&D space support 830$: MFPI @R2 ;Get subject instruction word 840$: MOV (SP)+,@R3 ;and save it away RETURN ;Return to the caller .IFTF; NE, ;If RSX/SOFT MEMERR: CLR VALUE ;Return ZERO on a GET error. .IFF; NE, ;If RSX/SOFT .ROM MOV SPSAV,R6 ;Restore stack pointer .ENDC; NE, ;If RSX/SOFT BITB #ME.ERR,R0 ;Should we return any error? BNE 910$ ;Branch if so, return C=1 ERROR STRING=IMRSTR ;Print error message ; 900$: CLR IERR ;Reset error handling TST (PC)+ ;Clear carry - no error. 910$: SEC ;Set carry - error. INC R5 ;Bump R5 BITB #ME.BYT,R0 ;Did we do a byte operation? BNE 999$ ;Branch if so INC R5 ;Else bump R5 by a word 999$: RETURN ;Return to caller W/C-BIT .DSABL LSB PSECT PURE_BYTE_DATA IMRSTR: ERRMSG WARNING,, PSECT DATA DBGSYM MEMBUF MEMBUF: .WORD 0 ;Memory reference buffer PSECT PURE_CODE .ENDC; NE, ;If debugger out of address space .SBTTL ILLMEM - Internal Invalid memory reference handler for DBG .SBTTL ILLME1 - Internal Invalid memory reference handler for DBG ;+ ; ILLMEM ; ILLME1 ; These routines are called if a internal memory protect violation occurs ; in DBG. They print the Invalid memory reference error string, unless ; the word IERR is non-zero, in which case it returns to the location ; contained in IERR. There are two entry points because the stack on ; entry if different for RSX-11, soft I/O mode. ; ; Entered from a TRAP25 or TRAP4 ;- DBGSYM ILLMEM ;Handles TRAP though MMUVEC DBGSYM ILLME1 ;Handles TRAP though TRAP4 vector ILLMEM: .COND ADD #6,SP,COND= ;Throw away SR1, SR2, and SR0 .IF NE,<!> ;If MMU support BIC #160000,@#SR0 ;Unfreeze MMU segment unit .ENDC; NE,<!> ;If MMU support ILLME1: BIT (SP)+,(SP)+ ;Clean PC and PSW from stack .IF EQ,<!> ;If RT-11 & .NOT. SD: driver CALL SETTRP ;Reset RT-11 trap 4 and 10 handling .ENDC; EQ,<!> ;If RT-11 & .NOT. SD: driver .ROM TST IERR ;Internal error handling enabled? .IF NE, ;If debugger out of address space BEQ INTERR ;Branch if handling not enabled FATAL! .IFF; NE, ;If debugger out of address space BEQ 10$ ;Branch if not, error out! .IFTF; NE, ;If debugger out of address space MOV IERR,-(SP) ;@SP -> User error handling routine CLR IERR ;Clear IERR again SEC ;Set the C-BIT CALLR @(SP)+ ;and return to error handling routine .IFF; NE, ;If debugger out of address space 10$: ERROR STRING=IMRSTR ;Print error message ; PSECT PURE_BYTE_DATA IMRSTR: ERRMSG WARNING,, PSECT PURE_CODE .ENDC; NE, ;If debugger out of address space .SBTTL INTERR - Internal fatal error handler ;+ ; INTERR ; We come here on all traps occuring INSIDE DBG that are totally ; unexpected. This can occur from corruption of our data structures ; by user code, or other real bad conditions. We attempt to print ; a error message, and abort. ;- DBGSYM INTERR INTERR: TYPE STRING=INTSTR ;Attempt to give internal error message ; .IF EQ,<!> ;If Soft I/O and not SD: CALLR EXIT ;Exit DBG to host operating system .IFF; EQ,<!> ;If Soft I/O and not SD: HALT ;This is THE END! BR .-2 .ENDC; EQ,<!> ;If Soft I/O and not SD: PSECT PURE_BYTE_DATA INTSTR: ERRMSG UNRECOVERABLE,,,PREFIX=YES PSECT PURE_CODE .IF NE, ;If RSX/HARD/DOA .SBTTL MAPMEM - Map address given though APR6 ;+ ; MAPMEM ; This routine maps the address given though APR6, if ; it happens to reside in APR5 or APR6. This is needed ; because DBG resides in APR5 and APR6. ; ; R2 = Address for GET/PUT ; ; .COND CALL MAPMEM,COND= ;Map R2 -> Correct location ; ; R2 = Adjusted address under APR6 bias (If needed) ; ; The caller is called back as a co-routine to allow ; us to get control again in order to restore the ; correct APR mapping. ;- DBGSYM MAPMEM MAPMEM: BIT #030000,@#PS ;Is our previous mode KERNEL? BNE 30$ ;Branch if not, don't mung this address EVER! CMP R2,#120000 ;Address lower than APR5? BLO 30$ ;Branch if so, no mapping needed. CMP R2,#160000 ;Greater than APR6 address BHIS 30$ ;Branch if at APR7 or above, no mapping. ; If address lies in APR5, adjust it to APR6 bias CMP R2,#140000 ;APR5 address? BHIS 10$ ;Branch if not, don't adjust ADD #20000,R2 ;Else adjust it. MOV @$KISA5,@#KINAR6 ;Restore APR5 saved to I-SPACE APR6 .IF NE, ;If I&D space support MOV @$KDSA5,@#KDSAR6 ;Restore APR5 saved to D-SPACE APR6 .ENDC; NE, ;If I&D space support BR 20$ ;Merge with common code ; Address was in APR6, simply restore APR6 saved values 10$: MOV @$KISA6,@#KINAR6 ;Restore APR5 saved to I-SPACE APR6 .IF NE, ;If I&D space support MOV @$KDSA6,@#KDSAR6 ;Restore APR5 saved to D-SPACE APR6 .IFTF; NE, ;If I&D space support 20$: CALL @(SP)+ ;Call the caller back MOV @$DBGI6,@#KINAR6 ;Reset APR6 D-SPACE to DBG-11 .IFT; NE, ;If I&D space support MOV @$DBGD6,@#KDSAR6 ;Reset APR6 D-SPACE to DBG-11 .ENDC; NE, ;If I&D space support 30$: RETURN ;Return to caller / or callers caller .ENDC; NE, ;If RSX/HARD/DOA .IF NE,<!> ;If MMU support .SBTTL RSETPS - Reset PS previous mode bits based on ...UPS ;+ ; RSETPS ; This routine correctly sets up the current PS, moving ; the TRAP PS current mode bits into the current PS previous ; mode bits. This sets us up correctly to do instructions ; to fetch/put memory to the right mode! This must be done ; because internal traps cause our current PS to have both ; previous and current modes = kernel. ;- DBGSYM RSETPS RSETPS: MOV ...UPS,-(SP) ;Stack TRAP PS BIC #^C140000,@SP ;Clear EVERYTHING but current mode bits CLC ;Don't load 1-bit's into this PS! ROR @SP ;Move current mode bits to previous ROR @SP ;mode bits MOV @#PS,-(SP) ;Stack current PSW BIC #^C144340,@SP ;Save only curr mode,reg set and priority BIS (SP)+,@SP ;and merge with previous mode bits MOV (SP)+,@#PS ;and stuff into current PS! RETURN ;Return to our caller. .ENDC; NE,<!> ;If MMU support .SBTTL CHKMEM - Check memory address against MEMTBL ;+ ; CHKMEM ; This routine scans MEMTBL to see if the address the user ; is requesting a get or put on is kept internally to DBG. ; If it is, the address is replaced by the real address of the item ; withen DBG. ; ; R5 = Address we are about to access ; ; CALL CHKMEM ; ; R2 = Address to really access (D$$OUT=1) ; MEMLOC = Address to really access (D$$OUT=0) ; ; C=0 Addr is not in MEMTBL ; C=1 Addr IS in MEMTBL ;- DBGSYM CHKMEM CHKMEM: MOV R3,-(SP) ;Save R3 .IF NE, ;If debugger out of address space MOV R5,R2 ;Copy address .IFF; NE, ;If debugger out of address space MOV R5,MEMLOC ;Copy address .IFTF; NE, ;If debugger out of address space .IF NE,<!> ;If MMU support CMP R5,#160000 ;Is address reference in I/O page? BLO 6$ ;Branch if not, don't check if I/O page mapped ; Check to see if PAR7 in the referenced mode is mapped to the I/O ; page. If not, don't map the I/O page references. MOV #KISAR7,R3 ;Assume kernel mode reference BIT #140000,...UPS ;Is user PS in kernel mode? BEQ 4$ ;Branch if so, check KISAR7 then. MOV #UISAR7,R3 ;Next assume user mode .IF NE, ;If I&D space support TST ...UPS ;Was user PS really in user mode? BMI 4$ ;Branch if so, check UISAR7 then MOV #SISAR7,R3 ;Else must have been supervisor mode .ENDC; NE, ;If I&D space support 4$: MOV #248.*20,-(SP) ;Assume 18-Bit I/O page. MOV IERR,-(SP) ;Save current error trapping (If any) MOVPIC 5$,IERR ;Set temporary error trap for 11/34 BIT #MODE22,@#SR3 ;Is 22-Bit addressing on? BEQ 5$ ;Branch if not MOV #4088.*20,2(SP) ;Use 22-Bit I/O page 5$: MOV (SP)+,IERR ;Restore previous error trapping CMP (SP)+,@R3 ;Are we mapped to the I/O page? BNE 99$ ;Branch if not, don't steer user wrong! 6$: .ENDC; NE,<!> ;If MMU support ADDR MEMTBL,R3 ;R3 -> MEMTBL 10$: TST @R3 ;End of MEMTBL? BEQ 99$ ;Branch if so, addr not found. CMP R5,@R3 ;Check low range BLO 50$ ;Branch if lower, get next entry CMP R5,MT.HI(R3) ;Check high range BHI 50$ ;Branch if not in range. .IFT; NE, ;If debugger out of address space SUB @R3,R2 ;R2 = Offset from start of data .IFF; NE, ;If debugger out of address space SUB @R3,MEMLOC ;MEMLOC = Offset from start of data .IFTF; NE, ;If debugger out of address space MOV MT.ADR(R3),R3 ;R3 -> Data or address of data BIT #MU.IND,R3 ;Indirection indicated? BEQ 40$ ;Branch if not. DEC R3 ;Remove indirect bit MOV @R3,R3 ;And go indirect 40$: .IFT; NE, ;If debugger out of address space ADD R3,R2 ;R2 = ABS address withen DBG .IFF; NE, ;If debugger out of address space ADD R3,MEMLOC ;MEMLOC = ABS address withen DBG .IFTF; NE, ;If debugger out of address space BR 100$ ;Return real address. 50$: ADD #MT.SIZ,R3 ;R3 -> Next MEMTBL entry BR 10$ ;Loop 99$: TST (PC)+ ;C=0 100$: SEC ;C=1 MOV (SP)+,R3 ;Restore R3 RETURN ;Return to caller .IFF; NE, ;If debugger out of address space PSECT DATA MEMLOC: .BLKW 1 ;Real address of data to put/get PSECT PURE_CODE .ENDC; NE, ;If debugger out of address space ; Data Definitions for MEMTBL .ASECT .=0 MT.LOW: .BLKW 1 ;Lower bound of item MT.HI: .BLKW 1 ;Upper bound of item MT.ADR: .BLKW 1 ;Actual address of item (!1 if indirect ref) MT.SIZ =.-MT.LOW .ASSUME MT.LOW EQ 0 ;@Rn references in DBGMEM.MAC .MACRO MEMBLD LOW,HIGH,ADDR,TYPE,COND=D$$DBG .IF NE, .WORD LOW ;ABS Low address of item we keep internally .WORD HIGH ;ABS High address of item .RWORD ADDR!TYPE ;REL Real address of item withen DBG .ENDC; NE, .ENDM MEMBLD PSECT DATA ;+ ; MEMTBL ; This table is used by DBGMEM to allow the user to examine ; and deposit into areas of user memory which DBG has it's ; own internal copy of. This prevents having to have internal ; registers and provides a better user interface. ;- ; Flag definitions for MEMTBL MU.IND = 1 ;Item's real addr is addr of addr of item DBGSYM MEMTBL MEMTBL: .RSET ;Setup for PIC relocation ; Low, High, Actual,Flags,conditional MEMBLD $DSW, $DSW+1, DSW, 0,COND= MEMBLD S$JSW, S$JSW+1, JSW, 0,COND= MEMBLD S$EERB, S$EERB+1, EERB, 0,COND= MEMBLD FIRQB, FIRQB+FQBSIZ-1, FQBSAV, 0,COND= MEMBLD XRB, XRB+XRBSIZ-1, XRBSAV, 0,COND= MEMBLD PS, PS+1, ...UPS, 0,COND=<!> .IF NE, ;If RSX/HARD/DOA MEMBLD KINAR5, KINAR5+1, $KISA5, MU.IND MEMBLD KINAR6, KINAR6+1, $KISA6, MU.IND MEMBLD KDSAR5, KDSAR5+1, $KDSA5, MU.IND,COND=D$$DAS MEMBLD KDSAR6, KDSAR6+1, $KDSA6, MU.IND,COND=D$$DAS .ENDC; NE, ;If RSX/HARD/DOA .WORD 0 ;Stopper PSECT PURE_CODE .SBTTL .SBTTL DBGSYM.MAC - Symbol table and manipulation routines ;Edit 01 .SBTTL .IIF NDF,L$$LST,.NLIST ;**************************************************************************** ;* * ;* COPYRIGHT (c) 1983, 1986 * ;* BY DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. * ;* ALL RIGHTS RESERVED. * ;* * ;* THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED * ;* ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE * ;* INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER * ;* COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY * ;* OTHER PERSON. NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY * ;* TRANSFERRED. * ;* * ;* THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE * ;* AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT * ;* CORPORATION. * ;* * ;* DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS * ;* SOFTWARE ON EQUIPMENT THAT IS NOT SUPPLIED BY DIGITAL. * ;* * ;**************************************************************************** ;++ ; Facility: DBG - A PDP-11 system independant symbolic debugger ; ; Authors: Don Bridgewater / Chuck Guldenschuh / Joe Worrall ; ; Created: Started by Chuck in 1980. ; ; Abstract: DBGSYM - Symbol table and manipulation routines ; ; Externals Description ; --------- ----------- ; ; Edit Who Date Description of modification ; ---- --- ---- --------------------------- ; 001 Jrw 12-May-86 Add _ESC and _NOESC ;-- PSECT PURE_CODE .IIF NDF,L$$LST,.LIST .SBTTL Symbol modules symbolic definitions ; In-core symbol table definitions => DBG$PS - USYMTB SY.NAM = 0 ;Offset to symbol name in symbol entry .ASSUME SY.NAM EQ 0 SY.ADR = 4 ;Offset to symbol's address in symbol entry SY.SIZ = 6 ;Size of a symbol table entry .SBTTL Permanent symbol table PSECT SYMBOLS DBGSYM DBG$PS DBGSYM DBG$RE DBG$PS: .RSET ;WARNING! Registers must be first! SYMBOL ,...UR0 ;User R0 SYMBOL ,...UR1 ;User R1 SYMBOL ,...UR2 ;User R2 SYMBOL ,...UR3 ;User R3 SYMBOL ,...UR4 ;User R4 SYMBOL ,...UR5 ;User R5 SYMBOL ,...USP ;User SP SYMBOL ,...UPC ;User PC SYMBOL ,...UPS ;User PS SYMBOL ,...USP ;Alternate name for SP SYMBOL ,...UPC ;Alternate name for PC DBG$RE: ;End of register area in symbol table ;SYMBOL ,LOW ;Search - Low-limit ;SYMBOL ,HIGH ;Search - High-limit ;SYMBOL ,SRHMSK ;Current search mask register SYMBOL ,ADROFF ;Maximum offset to print w/symbol SYMBOL ,DATOFF ;Maximum offset to print w/symbol .IF NE, ;If RSX/SOFT SYMBOL , DBG$EF ;-> DBG's event flag SYMBOL , SSTSTK ;-> Top three words of stack from traps .ENDC; NE, ;If RSX/SOFT DBG$PE: ;End of special internel registers .IF NE,<!> ;If RSX/SOFT or RT/SD: .IF NE, ;If RSX SPCSYM , VALUE=0 SPCSYM , VALUE=1 ;SPCSYM , VALUE=2 SPCSYM , VALUE=3 SPCSYM , VALUE=4 SPCSYM , VALUE=5 SPCSYM , VALUE=6 SPCSYM , VALUE=7 .IFF; NE, ;If RSX SPCSYM , VALUE=0 SPCSYM , VALUE=1 .ENDC; NE, ;If RSX .ENDC; NE,<!> ;If RSX/SOFT or RT/SD: SPCSYM , VALUE=2 SPCSYM , VALUE=10. SPCSYM , VALUE=16. SPCSYM , VALUE=8. SPCSYM , VALUE=TO.RUB SPCSYM , VALUE=-TO.RUB SPCSYM , VALUE=TO.GPH,COND=G$$APH SPCSYM , VALUE=-TO.GPH,COND=G$$APH SPCSYM , VALUE=-TO.ADT SPCSYM , VALUE=TO.ADT SPCSYM , VALUE=-TO.ABS SPCSYM , VALUE=TO.ABS SPCSYM , VALUE=TO.ESC SPCSYM , VALUE=-TO.ESC DBG$BE: ;End of special BIT def registers SPCSYM <. >,DOT ;The special symbol "." SPCSYM ,Q ;The special symbol Q .BR USYMTB ;Must be on user symbol table boundry. .SBTTL User symbol table DBGSYM USYMTB DBGSYM LSTSYM DBGSYM ENDSYM USYMTB: .REPT 20. ;Assume 20 entries .BLKW0 SY.SIZ/2 ;... .ENDR .IF EQ, ;If RT/SD: LSTSYM: .BLKW0 SY.SIZ/2,VALUE=-1 ;End of symbol table .IFF; EQ, ;If RT/SD: LSTSYM: .BLKW0 SY.SIZ/2,VALUE=-2 ;End of internal symbol table. .ENDC; EQ, ;If RT/SD: ENDSYM: ;Next location AFTER SYMBOLS psect PSECT DATA DBGSYM TMPSYM TMPSYM: .BLKW 2 ;Temporary symbol area for RAD50 convert PSECT PURE_CODE .SBTTL GETSYM - Find a symbol's value ;+ ; GETSYM ; ; R4 -> symbol (ASCIZ) ; ; CALL GETSYM ; ; R0-R3 modified ; ; Searches for symbol given in DBG's in-core table, and/or .STB file ; ; If Symbol_found then ; If Symbol_entry => Q/DOT then ; If then ; error := Symbol_not_found (We are past all internals) ; Else ; value := Symbol_Entry_value ; Endif ; Endif ; ; If Symbol_entry => Value_bit_symbols then ; If then ; value := Symbol_Entry_value ; Else ; Continue searching ; Endif ; Endif ; ; If Symbol_entry < Internal_registers then ; If then ; Continue searching ; Else ; Value := Symbol_Entry_value ; R5 := (Machine registers) ; Endif ; Else ( We are examining a internal register ) ; If then ; Value := Symbol_Entry_value ; R5 := ; Else ; Continue searching ; Endif ; Endif ; Else ; Error := Symbol not found ; Endif ; ; EX.FND set in R5 if ANY symbol found ; EX.IRG!EX.REG set in R5 if register symbol was found ; EX.IRG!EX.FND set in R5 if INTERNEL register was found ; EX.FND set if internal bit definition found if EX.PRE set on entry. ; ; @PARPTR = Symbol value if found ;- .ENABL LSB .ASSUME SY.NAM EQ 0 DBGSYM GETSYM GETSYM: ADDR TMPSYM,R3 ;R3 -> temp area for RAD50 conversion MOV R3,R2 ;Copy it CALL GETNAM ;Convert ASCII name to RAD50 MOV R3,R2 ;R2 -> RAD50 symbol name ADDR DBG$PS,R3 ;R3 -> permanent symbol table (and user) .ROM CLR SYMADR ;Last found or empty symbol entry address .COND CLR -(SP),COND= ;Setup flag on stack 10$: CMP #-1,@R3 ;At the end of the table? .IF EQ, ;If RSX STB support BEQ 90$ ;Branch if so .IFF; EQ, ;If RSX STB support BEQ 35$ ;Branch if so, try .STB file .ENDC; EQ, ;If RSX STB support .IF NE, ;If RT/SD: CMP #-2,@R3 ;Is this just the end of our internal table? BNE 15$ ;Branch if not, look at the entry MOV STSYMS,R3 ;R3 -> Possible user symbol table .IF EQ, ;If RSX STB support BEQ 90$ ;Branch if none present .IFF; EQ, ;If RSX STB support BEQ 35$ ;Branch if none, try .STB file .ENDC; EQ, ;If RSX STB support INC @SP ;Flag we are searching ST: driver! .ENDC; NE, ;If RT/SD: 15$: TST @R3 ;Is this symbol entry empty? BNE 20$ ;Branch if not MOV R3,SYMADR ;Else save -> to a empty symbol entry. (SETSYM) 20$: CMP @R2,@R3 ;Symbols match? BNE 30$ ;Branch if not CMP 2(R2),2(R3) ;Try the second word BEQ 40$ ;Branch if a match 30$: ADD #SY.SIZ,R3 ;R3 -> next symbol BR 10$ ;Try again .IF NE, ;If RSX STB support ; Check .STB file for the symbol 35$: BIT #EX.PRE,R5 ;Was this symbol pre-fixed? BNE 90$ ;Branch if so, symbol not found CALL LOCSYM ;Send message to find symbol BCS 90$ ;Branch if not found in .STB file MOV @R0,@PARPTR ;Stuff symbol value BR 85$ ;and return, saying symbol found. .ENDC; NE, ;If RSX STB support ; See if symbol was found after Q/DOT 40$: .IF NE, ;If RT/SD: TST @SP ;Are we in the user symbol table? BNE 45$ ;Branch if so, treat this symbol correctly. .ENDC; NE, ;If RT/SD: CMPPIC DBG$BE,R3 ;Are we past the internal bit registers? BHI 50$ ;Branch if not, we are farther up. ; Symbol was => Q/DOT 45$: BIT #EX.PRE,R5 ;Was this symbol pre-fixed? BNE 90$ ;Branch if so, symbol not found BR 80$ ;Else symbol found. ; See if symbol found was a BIT-TYPE internal symbol 50$: CMPPIC DBG$PE,R3 ;Are we past the internal registers? BHI 60$ ;Branch if not, we are farther up. ; Symbol was => Internal BIT registers BIT #EX.PRE,R5 ;Was this symbol prefixed? BEQ 30$ ;Branch if not, continue search. BR 80$ ;We have found symbol. ; See if symbol found was in machine register block 60$: CMPPIC DBG$RE,R3 ;Are we past the machine registers BLOS 70$ ;Branch if so, can't be a register lookup ; Symbol was in machine register block BIT #EX.PRE,R5 ;Was symbol prefixed? BNE 30$ ;Branch if so, continue symbol search BIS #,R5 ;Set internal symbol + Register found BR 80$ ;And set value, return to caller ; Symbol was in internal register block 70$: BIT #EX.PRE,R5 ;Was a prefix used? BEQ 30$ ;Branch if not, not internal register BIS #,R5 ;Set internal register found. 80$: MOV SY.ADR(R3),@PARPTR ;Set the value MOV R3,SYMADR ;Address of entry of symbol in TMPSYM (SETSYM) 85$: BIS #,R5 ;Set the "found" bit 90$: .COND TST (SP)+,COND= ;Clean stack of user symbol flag RETURN ;Return to caller. .DSABL LSB .SBTTL SETSYM - (Re)define a new symbol in DBG's in-core symbol table ;+ ; SETSYM ; (Re)define RAD50 symbol name given at address given. ; ; Syntax: ; ; [addr],symbol: ; ; Defaults: ; ; Addr DOT ; Symbol No default ; ; Semantics: ; ; If addr specified ; then symbol := addr ; else symbol := dot ; ; SYMADR -> Symbol entry being re-defined .or. free symbol entry ; DOT = Current PC ; TMPSYM = symbol name (RAD50) ; PAR1 = Address of symbol (If specified) ; ; CALLR SETSYM (Only called from GETNUM) ; ; Return is to COMMND, if no errors ; Else error is handled though "ERROR" ; ; R0, R3 modified ;- DBGSYM SETSYM SETSYM: MOV OPRPND,-(SP) ;Stack pending operationgs flag BISB NSTLEV,(SP)+ ;OR with nesting level flag for CC BEQ 10$ ;Branch if ":" is legal now ;+ ; In order to define the symbol, the above check verifies that ; the expression parser is at nesting level 0 and that no math ; operations are pending against the value we are about to use, ; if wither of these cases of not true, an error is given. ;- ERROR STRING=BXPSTR ;Else give error message ; 10$: MOV SYMADR,R3 ;R3 -> First free symbol .OR. last found symbol BNE 20$ ;Branch if some entry address set by GETSYM ERROR STRING=NRMSTR ;Else give error ; 20$: BIT #,R5 ;Internal symbol involved? BEQ 30$ ;Branch if not, go (Re)define the symbol. ERROR STRING=ISDSTR ;Else give error ; 30$: MOV TMPSYM,(R3)+ ;Store the RAD50 doubleword name pair MOV TMPSYM+2,(R3)+ ;... MOV PAR1,@R3 ;Assume address given in PAR1 BITB #PAR.1,PARFLG ;Was parameter one already specified? BNE 40$ ;Branch if so, we stuffed the correct addr MOV DOT,@R3 ;Else use current address DOT "." .ASSUME SY.NAM EQ 0 .ASSUME SY.ADR EQ 4 .ASSUME SY.SIZ EQ 6 40$: CRLF ;Spit out DECODE ERROR=YES ;Get next command - closing ANY open loc. PSECT PURE_BYTE_DATA NRMSTR: ERRMSG WARNING,, ISDSTR: ERRMSG WARNING,, PSECT PURE_CODE .SBTTL LODADR - Load buffer with a symbolic or value of address in R5 .SBTTL LODAD1 - Load buffer with a symbolic or value of address in R1 .SBTTL LODAD2 - Load buffer with a symbolic or value of address in R5 .SBTTL LODAD3 - Load buffer with a symbolic or value of address in R5 .SBTTL LODDAT - Load buffer with a symbolic or value of data in R1 ;+ ; LODADR ; LODAD1 ; LODAD2 ; LODAD3 ; LODDAT ; Loads the buffer in R4 with a symbolic or numeric value. ; ; R4 -> Scratch/Output buffer ; R1 .or. R5 = Number to type as an address or data ; ; CALL LODADR Value in R5 ; CALL LODAD1 Value in R1 ; CALL LODAD2 Value in R5 (Blank filled to 13. characters) ; CALL LODAD3 Value in R5 (Blank filled to 13. characters) ; CALL LODDAT Value in R1 ; ; R4 -> Updated buffer pointer @ a 0 byte ; R0 Destroyed ;- .ENABL LSB DBGSYM LODADR DBGSYM LODAD1 DBGSYM LODAD2 DBGSYM LODAD3 DBGSYM LODDAT LODAD3: .IF NE,<!!> ;If MMU or I&D TSTB IREGFL ;Are we displaying I-REGS? BNE 5$ ;Branch if so, don't display MODE/SPACE stuff .IFTF; NE,<!!> ;If MMU or I&D LODAD2: .IFT; NE,<!!> ;If MMU or I&D MOV #-1,R0 ;R0 is () printing flag .IF NE,<!> ;If MMU support TST ...UPS ;Was TRAP PS in user mode? BPL 1111$ ;Branch if not, try supervisor mode. INC R0 ;Flag addition MOVB #'(,(R4)+ ;Add "(U" MOVB #'U,(R4)+ ;... BR 1112$ ;Skip super check. 1111$: BIT #040000,...UPS ;Was TRAP PS in supervisor mode? BEQ 1112$ ;Branch if not INC R0 ;Flag addition MOVB #'(,(R4)+ ;Add "(S" MOVB #'S,(R4)+ ;... 1112$: .IFF; NE,<!> ;If MMU support .IF NE, ;If I&D space support BIT #040000,...UPS ;Was TRAP PS in supervisor mode? BEQ 1$ ;Branch if not TST ...UPS ;Really supervisor mode? BMI 1$ ;Branch if not INC R0 ;Flag addition MOVB #'(,(R4)+ ;Add "(S" MOVB #'S,(R4)+ ;... 1$: .ENDC; NE, ;If I&D space support .ENDC; NE,<!> ;If MMU support .IF NE, ;If I&D space support BIT #TO.DSP,TYPMOD ;Are we in D-SPACE? BEQ 3$ ;Branch if not INC R0 ;Flag addition BGT 2$ ;Branch if no "(" needed. MOVB #'(,(R4)+ ;Add "(S" 2$: MOVB #'D,(R4)+ ;... 3$: .ENDC; NE, ;If I&D space support TST R0 ;Is the post operator ")" needed? BLT 5$ ;Branch if not. MOVB #'),(R4)+ ;Insert matching paranthisis MOVB #,(R4)+ ;+ 5$: .ENDC; NE,<!!> ;If MMU or I&D MOV R4,-(SP) ;Save current buffer pointer CALL LODADR ;Fill me up MOV R4,R0 ;R0 -> First free byte in buffer SUB (SP)+,R0 ;R0 = Count of bytes in ADDRESS NEG R0 ;" Minus " ADD #13.,R0 ;R0 = # blanks to fill with for ;radix = 8.,10. or 16. 10$: MOVB #,(R4)+ ;Space fill .... SOB R0,10$ ;Until done RETURN ;Return to caller LODAD1: MOV R5,-(SP) ;Save R5 MOV R1,R5 ;Copy number to output CALL LODADR ;Output the number MOV (SP)+,R5 ;Restore R5 RETURN LODDAT: MOV R5,-(SP) ;Save R5 MOV R1,R5 ;Load up R5 with data to print MOV #,R0 ;Bit for ADRSYM to check MOV DATOFF,OFFSET ;Maximum offset value to allow symbolicly CALL ADRSYM ;Go convert it to symbolic or numeric data MOV (SP)+,R5 ;Restore R5 RETURN LODADR: MOV #TO.ABS,R0 ;Bit for ADRSYM to check MOV ADROFF,OFFSET ;Maximum offset value to allow symbolicly CALL NOBIN ;Make sure CRADIX is NOT two! (Coroutine) .BR ADRSYM ;Load address and return .DSABL LSB .SBTTL ADRSYM - Find a symbol+offset given a value ;+ ; ADRSYM ; This routine attempts to match the value given in R5 with a ; SYMBOL + a OFFSET in the current symbol table and/or .STB file. ; If the SYMBOLIC can't be found, or the offset value is larger ; than ADROFF, the value is printed as a NUMERIC in the current ; radix. ; ; R0 = Bit(s) to check in TYPMOD. (NE says type in numeric form) ; R4 -> Output/scratch buffer ; R5 = Octal value to find. ; ; CALL ADRSYM ; ; R4 -> Updated output buffer pointer ;- .ENABL LSB DBGSYM ADRSYM ADRSYM: JSR R3,SAVVR ;Save R0-R3 MOV R5,Q ;Save new Q ADDR DBG$PS-SY.SIZ,R3 ;R3 -> permanent symbol table (and user) TSTB IREGFL ;Is an internal register open? BEQ 6$ ;Branch if not, don't use permenent symbols BIT #,R0 ;Is this a LODDAT ? BNE 6$ ;Branch if so, don't use I-REG symbols CMPPIC MREGE,R5 ;Should we prefix the value? BHI 1$ ;Branch if it's a MACHINE REGISTER, don't! MOVB #'_,(R4)+ ;Prefix the symbol to show it's a IREG! 1$: MOV #MAXIOF,OFFSET ;Maximum offset value to allow symbolicly BR 5$ ;Go look for the I-REG symbol 6$: ADD #<<..SYMS/2>*SY.SIZ>,R3 ;Point R3 at DBG$PE-SY.SIZ BIT R0,TYPMOD ;Any bad bits set? BEQ 5$ ;Branch if not, try for SYMBOLIC data 4$: MOV R5,R1 ;R1 = Data or address to print out BR 40$ ;Return to caller 5$: CLR R2 ;Symbol found flag MOV R4,-(SP) ;Save output buffer pointer MOV #-1,R4 ;Starting BEST DISPLACEMENT IS MAX. 10$: ADD #SY.SIZ,R3 ;R3 -> next symbol CMPPIC DBG$PE,R3 ;Are we at first SPCSYM? BNE 15$ ;Branch if not. ADD #<<..SPCS/2>*SY.SIZ>,R3 ;Point R3 at first non-SPC symbol. 15$: CMP #-1,@R3 ;At the end of the table? BEQ 20$ ;Branch if so. .IF NE, ;If RT/SD: CMP #-2,@R3 ;Is this just the end of our internal table? BNE 16$ ;Branch if not, look at the entry MOV STSYMS,R3 ;R3 -> Possible user symbol table BEQ 20$ ;Branch if none present, the end. .ENDC; NE, ;If RT/SD: 16$: TST @R3 ;Is this entry empty? BEQ 10$ ;Branch if so, loop for next MOV SY.ADR(R3),R0 ;Get value of this symbol ;+ ; R0 = Address taken from current symbol table entry ; R2 -> Best symbol entry so far (0=None found) ; R3 -> Current symbol entry ; R4 = Displacement from address in SY.ADR(R2) to address in R5 ; R5 = Address we are looking for a match on ;- CMP R0,R5 ;Higher than the one we are looking for? BHI 10$ ;Branch if so, next MOV R5,R1 ;Calculate in R1 the new displacement SUB R0,R1 ; ... CMP R1,R4 ;Compare against last best displacement BHIS 10$ ;Branch if => last best displacement MOV R3,R2 ;Else remember the new symbol entry addr MOV R1,R4 ;Remember new best displacement BNE 10$ ; and loop unless displacement eq 0 20$: MOV R4,R3 ;Save best symbol displacement in R3 MOV (SP)+,R4 ;Restore output buffer pointer .IF EQ, ;If RSX STB support TST R2 ;Did we find a symbol to use ? BEQ 4$ ;Branch if not, print as NUMERIC .ROM CMP R3,OFFSET ;Is the displacement too big? BHI 4$ ;Branch if so, print as NUMERIC .IFF; EQ, ;If RSX STB support TST R2 ;Did we find a symbol to use ? BEQ 25$ ;Branch if not, check .STB file .ROM CMP R3,OFFSET ;Is the displacement too big? BLOS 26$ ;Branch if not, use it. 25$: MOV STBOPN,R0 ;R0 -> SNDBUF if .STB file open BEQ 4$ ;Branch if not open, do numericly MOV #C.SYMB,(R0)+ ;Function code = Find numeric MOV R5,@R0 ;Insert value to try and find CALL SNDREC ;Send info / wait for reply etc BCS 4$ ;Branch if not found at all. ;R0 -> RECBUF+2 MOV 4(R0),R3 ;R3 = Offset from symbol returned to addr R5. CMP R3,OFFSET ;Is the displacement too big? BHI 4$ ;Branch if so, do it numericly! MOV R0,R2 ;R2 -> RAD50 symbol name found .ENDC; EQ, ;If RSX STB support 26$: MOV (R2)+,R1 ;R1 = Word to convert to .ASCII CALL R50OUT ;Convert into buffer @R4 MOV @R2,R1 ;Next word to convert CALL R50OUT ;... 30$: CMPB -(R4),# ;Find trailing spaces BNE 35$ ;Branch if no more spaces MOVB #<200>,@R4 ;ZAP the trailing space BR 30$ ;Loop for all spaces 35$: INC R4 ;Bump buffer pointer past last character MOV R3,R1 ;R1 = Displacement from symbol to print BEQ 50$ ;Branch if no displacement. MOVB #'+,(R4)+ ;Insert a PLUS sign 40$: CALL DCD.IO ;Convert value in R1 to .ASCII @R4 50$: RETURN ;Return to caller .DSABL LSB .SBTTL NOBIN - Coroutine to check for binary radix ;+ ; NOBIN ; This co-routine checks to see if the current radix is TWO, and if ; so sets it to the default radix PRADIX, and calls the caller. When ; the caller returns, the radix is reset, and a return is made to ; the callers caller. ;- .ASSUME PRADIX NE 2. ;Default radix can't be two! DBGSYM NOBIN NOBIN: MOV @SP,-(SP) ;Copy return address - make room on stack MOVB CRADIX,2(SP) ;Save current radix value CMPB #2.,2(SP) ;Is it BINARY ? BNE 20$ ;Branch if not, OK. MOVB #PRADIX,CRADIX ;Else - set default radix. Can't handle BIN. 20$: CALL @(SP)+ ;Call the caller MOVB (SP)+,CRADIX ;Restore RADIX value RETURN ;Return to callers caller .SBTTL .SBTTL .SBTTL DBGCMD - Command processing routines for DBG ;Edit 01 .SBTTL .SBTTL .IIF NDF,L$$LST,.NLIST ;**************************************************************************** ;* * ;* COPYRIGHT (c) 1983, 1986 * ;* BY DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. * ;* ALL RIGHTS RESERVED. * ;* * ;* THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED * ;* ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE * ;* INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER * ;* COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY * ;* OTHER PERSON. NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY * ;* TRANSFERRED. * ;* * ;* THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE * ;* AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT * ;* CORPORATION. * ;* * ;* DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS * ;* SOFTWARE ON EQUIPMENT THAT IS NOT SUPPLIED BY DIGITAL. * ;* * ;**************************************************************************** ;++ ; Facility: DBG - A PDP-11 system independant symbolic debugger ; ; Authors: Don Bridgewater / Chuck Guldenschuh / Joe Worrall ; ; Created: Started by Chuck in 1980. ; ; Abstract: DBGCMD - Command processing routines for DBG ; ; Externals Description ; --------- ----------- ; ; Edit Who Date Description of modification ; ---- --- ---- --------------------------- ; 001 Jrw 16-Jan-86 Reset DBG stack using only one ; instruction to prevent corruption. ;-- PSECT PURE_CODE .IIF NDF,L$$LST,.LIST .SBTTL Command modules symbolic definitions ; Command table definitions => SNGCMD - DBLCMD CM.NAM =: 0 ;Offset the command text byte .ASSUME CM.NAM EQ 0 CM.FLG =: 1 ;Offset to command flags byte CM.ADR =: 2 ;Offset to command routine address CM.SIZ =: 4 ;Size of a command table entry ; Command flags => Inside of command tables .ASSUME CO.NAR EQ CO.ARG*2 CO.IRG =: 001 ;=> This command does NOT allow internal regs CO.ARG =: 002 ;=> This command requires atleast one argument CO.NAR =: 004 ;=> This command accepts NO arguments CO.BIT =: 010 ;=> This command must have internal bit arg(s) CO.ISP =: 020 ;=> This command defaults to I-SPACE CO.DSP =: 040 ;=> This command defaults to D-SPACE ; Paramiters present flags => PARFLG PAR.1 =: 1 ;=> 1st parameter typed. Set in PARFLG PAR.2 =: 2 ;=> 2nd parameter typed. Set in PARFLG PAR.3 =: 4 ;=> 3rd parameter typed. Set in PARFLG MAXPAR =: 3 ;Maximum number of parameters .SBTTL Command tables PSECT PURE_DATA ; Single character command table DBGSYM SNGCMD SNGCMD: .RSET COMM <'=>, EVALUA,CO.IRG ;Evaluate immediate mode expression COMM <'/>, OPENIN,CO.ISP ;Open in instruction mode COMM <'\>, OPENBY,CO.DSP ;Open in forced byte mode COMM <'^>, OPENPR,CO.IRG ;Open previous word or byte COMM <'[>, OPENWD,CO.DSP ;Open location in DATA mode COMM <'@>, OPENAT,CO.IRG ;Open @Q in word or byte mode COMM <'#>, OPENPO,CO.IRG,D$$DAS ;"While swapping I&D space mode" COMM <'%>, OPENR5,CO.DSP ;Open Q in WORD RAD50 mode COMM <'">, OPENAS,CO.DSP ;Open in default word mode COMM <''>, OPENAB,CO.DSP ;Open in forced byte mode COMM <'|>, OPEABS,CO.DSP ;Open Q in word/byte ABS data mode COMM , OPENXT,CO.IRG ;Open next word or byte COMM , MODCLS,CO.IRG ;Close current open location - if any .WORD 0 ;List Terminator .BR DBLCMD ;Should precede Semi-colon command table ; Semi-colon command table DBGSYM DBLCMD DBLCMD: COMM <'A>, SETSTB, CO.NAR,S$$STB ;Setup .STB filespec COMM <'B>, SCBPT, CO.IRG ;Set/clear breakpoint ;;;COMM <'E>, , CO.IRG!CO.ARG!CO.BIT ;Effective address search COMM <'G>, GOTO, CO.IRG ;Goto COMM <'K>, KILSYM, CO.IRG!CO.ARG ;Delete symbol given from symbol table ;;;COMM <'L>, LSTMEM, CO.IRG!CO.ARG!CO.BIT ;List memory ;;;COMM <'L>, LSTMEM, CO.IRG!CO.ARG ;List memory ;;;COMM <'M>, SMASK, CO.IRG ;Set search mask COMM <'P>, PROBPT, CO.IRG ;Proceed from logical breakpoint COMM <'R>, SRADIX, CO.IRG!CO.BIT ;Set default radix COMM <'S>, EXEINS, CO.IRG ;Single step instruction COMM <'T>, STYPOU, CO.IRG!CO.BIT ;Set default type-out mode COMM <'V>, RSTSST, CO.IRG!CO.BIT,> ;Restore SST table COMM <'X>, EXECRH, CO.IRG, ;Goto crash dump routine ;;;COMM <'=>, , CO.IRG!CO.ARG!CO.BIT ;Search for value = mask ;;;COMM <'#>, , CO.IRG!CO.ARG!CO.BIT ;Search for value <> mask .WORD 0 ;List Terminator PSECT DATA DBGSYM PARS DBGSYM PAR1 DBGSYM PAR2 DBGSYM PAR3 PARS: PAR1: .WORD 0 PAR2: .WORD 0 PAR3: .WORD 0 .IIF LT <<. - PARS>/2> - MAXPAR, .ERROR MAXPAR ;Too few parameters PSECT PURE_CODE .SBTTL RESTRT - Restart command driver, closing any open location .SBTTL COMMND - Command execution driver ;+ ; RESTRT ; COMMND ; These routines form the main loop of DBG. They collect the next ; valid command from the user and dispatche it to the correct ; command execution routine. ; ; GENERAL CONVENTINONS USED WHEN COMMND DISPATCHES TO EXECUTION ROUTINE: ; ; R0 = DOT or PAR1 (If <> ) ; R3 -> TYPMOD ; R4 -> Output/scratch buffer ; R5 -> Current PC ; CC'S Set from a TSTB PARFLG ; ;- .ENABL LSB DBGSYM RESTRT DBGSYM COMMND RESTRT: CALL MDCLS2 ;Stomp on the currently open location .BR COMMND ;Go get first user command COMMND: ADDR DBGSTK,R1 ;R1 -> Top of fresh stack MOV R1,R6 ;Reset our stack pointer in ONE INSTRUCTION! DBGFNC FUNCTION=CLEAR_OUTBUF ;Load R4 -> OUTBUF ; Refresh paramiter information ADDR PARS,R1 ;R1 -> Parameter list .ROM MOV R1,PARPTR ;Save -> to current parameter .REPT MAXPAR CLR (R1)+ .ENDR .ROM CLRB PARFLG ;Clear the parameter(s) typed flag .ROM MOVB #PAR.1,SETPAR ;This is the first parameter. ; Cancel CTRL/O,Setup/Update scope, type out prompt, if no open location CALL DBG$CC ;Call system dependant CTRL/O cancel routine .COND CALL DBG$TU,COND=G$$APH ;Call terminal update routine TSTB OPNFLG ;Is a location open? BNE 20$ ;Branch if so. Don't type prompt TYPE 'D ;Type out our prompt sequence. TYPE 'B ;.... TYPE 'G ;.... TYPE '> ;.... ; Read a line of input from the terminal 20$: CALL DBG$RT ;Read a full line of input from the terminal ;All registers are destroyed! DBGFNC FUNCTION=CLEAR_OUTBUF ;Load R4 -> OUTBUF ; Loop though GETEXP, until a terminator is found 30$: CLR EXPFLG ;Clear expression's past flag CALL GETEXP ;Get an expression - return EXPFLG in R5 ;R2 = Terminating character BEQ 40$ ;Branch if nothing typed in .ROM BIS R5,EXPFLG ;Keep a running sum of expression flags BMI 50$ ;Branch if we have started instruction typein .ASSUME TI.INS EQ 100000 BISB SETPAR,PARFLG ;Flag that the parameter was typed in 40$: ASLB SETPAR ;Shift flag bit ADD #2,PARPTR ;Update parameter list -> CMPB #,R2 ;Were we stopped by a comma? BNE 60$ ;Branch if not, check command lists BITB #^C,SETPAR ; Are we past MAXPAR ? BEQ 30$ ;Branch if not, get next parameter .ASSUME PAR.2 EQ .ASSUME PAR.3 EQ .ASSUME MAXPAR LE 8. .ASSUME MAXPAR EQ 3 ERROR STRING=TMPSTR ;Else give error message ; ;+ ; Call the instruction encoder. It returns the instruction value ; in PAR1-PAR3, with PARFLG bits set to the correct number of ; words in the subject instruction. ;- 50$: CALL ENCODE ;Call Mr. Bridgewater (Bunny) ;R2 = Terminating character .BR 60$ ;Find command terminator in command tables ; The terminating character from GETEXP was other then a COMMA, ; search the command tables for something to do. 60$: ADDR SNGCMD,R3 ;R3 -> single character commands CMPB #,R2 ;Semicolon stop us? BNE 70$ ;Branch if not. CRLF ;Type CALL MDCLS2 ;Stomp on open locations ADDR DBLCMD,R3 ;R3 -> semicolon commands DBGFNC FUNCTION=READ_WAIT ;R2 = New character 70$: CMPB R2,@R3 ;Is this the command? BEQ 80$ ;Branch if so CMP (R3)+,(R3)+ ;Skip the command character and routine TST @R3 ;Any commands left? BNE 70$ ;Branch if so 75$: ERROR STRING=ILCSTR ;Else give error message ; 80$: TST (R3)+ ;Skip the command character/flags TST @R3 ;Is that command implemented? BEQ 75$ ;Branch if not, invalid command. ; Check command flags to see if this form of command is valid ; and load up a standard command action routine register set .ASSUME CO.NAR EQ CO.ARG*2 90$: MOV DOT,R5 ;R5 = "." (DOT) MOVB #CO.ARG,-(SP) ;Command flag that says parameters a must MOVB PARFLG,R0 ;R0 = parameters typed flags BEQ 100$ ;Branch if no parameters typed MOV PAR1,R5 ;If parameters then R5=PAR1 ASLB @SP ;Else change flags in @SP to CO.NAR 100$: BITB (SP)+,-(R3) ;Check flags against PARFLG's BEQ 120$ ;Branch if arg's or lack of is OK. 110$: ERROR STRING=CPESTR ;Else give informative error message ; 120$: MOV EXPFLG,R1 ;R1 = Expflg value from last expressions .IF NE, ;If I&D space support BEQ 130$ ;Branch if no address expression typed BITB #,@R3 ;Does this command default I-SPACE,D-SPACE? BEQ 130$ ;Branch if not, don't modify TYPMOD BIC #TO.DSP,TYPMOD ;Assume I-SPACE command, clear D-SPACE flag BITB #CO.DSP,@R3 ;Assumption correct? BEQ 130$ ;Branch if so, OK. BIS #TO.DSP,TYPMOD ;Else set D-SPACE mode 130$: .ENDC; NE, ;If I&D space support BITB #CO.IRG,@R3 ;Are internal symbols invalid for this command? BEQ 140$ ;Branch if so, OK. BIT #TI.IRG,R1 ;Where any internal symbols used? BNE 110$ ;Branch if so, 140$: BIT #TI.PRE,R1 ;Did user use a prexfix operator (Bit!Intreg) BNE 170$ ;Branch if so, could be internal BIT DEF 150$: BITB #CO.BIT,(R3)+ ;Does this command require BIT DEF args? BEQ 180$ ;Branch if not, command is OK. 160$: TSTB R0 ;Where any arguments given? BNE 110$ ;Branch if so, error. BR 180$ ;Else command OK. 170$: BIT #TI.IRG,R1 ;Did user specify a internal register? BNE 150$ ;Branch if so, not a BIT DEF arg. BITB #CO.BIT,(R3)+ ;Does this command require BIT DEF args? BEQ 160$ ;Branch if not, Possible Error. 180$: DBGFNC FUNCTION=CLEAR_OUTBUF ;Clean OUTBUF, load R4 -> OUTBUF MOV @R3,-(SP) ;Save -> routine to process the command ADDR SNGCMD,SP,ADD,COND=$$$PIC ;@SP -> Relocated routine address ADDR TYPMOD,R3 ;R3 -> TYPMOD .COND CLRB CHRFLG,COND=H$$IOM ;Clear character found flag byte TSTB R0 ;R0,CC'S = PARFLG ;R1 = EXPFLG from GETEXP ;R2 = ??? ;R3 -> TYPMOD flags ;R4 -> OUTBUF ;R5 = DOT .or. (PAR1 If PARFLG!PAR.1<>0) CALL @(SP)+ ;Process the command DECODE ;Return for another command .DSABL LSB PSECT PURE_BYTE_DATA TMPSTR: ERRMSG WARNING,, ILCSTR: ERRMSG WARNING,, CPESTR: ERRMSG WARNING,, PSECT PURE_CODE .SBTTL .SBTTL .SBTTL DBGDEC - Instruction DECODE routines for DBG ;Edit 00 .SBTTL .SBTTL .IIF NDF,L$$LST,.NLIST ;**************************************************************************** ;* * ;* COPYRIGHT (c) 1983, 1986 * ;* BY DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. * ;* ALL RIGHTS RESERVED. * ;* * ;* THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED * ;* ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE * ;* INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER * ;* COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY * ;* OTHER PERSON. NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY * ;* TRANSFERRED. * ;* * ;* THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE * ;* AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT * ;* CORPORATION. * ;* * ;* DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS * ;* SOFTWARE ON EQUIPMENT THAT IS NOT SUPPLIED BY DIGITAL. * ;* * ;**************************************************************************** ;++ ; Facility: DBG - A PDP-11 system independant symbolic debugger ; ; Authors: Don Bridgewater/Chuck Guldenschuh/Marty Gentry/Joe Worrall ; ; Created: Started by Chuck in 1980. ; ; Abstract: DBGDEC - Instruction DECODE routines for DBG ; ; Externals Description ; --------- ----------- ; ; Edit Who Date Description of modification ; ---- --- ---- --------------------------- ;-- PSECT PURE_CODE .IIF NDF,L$$LST,.LIST .SBTTL Instruction decode table BLDTAB PSECT PURE_CODE .SBTTL DECODE - Decode an instruction ;+ ; DECODE ; This is the primary decode dispatch routine. ; ; R4 -> output buffer ; R5 -> instruction to decode ; ; CALL DECODE ; ; R5 -> next instruction ; Decoded instruction in output buffer ;- .ENABL LSB DBGSYM DECODE DECODE: JSR R3,SAVVR ;Save R0 - R3 .ROM MOV R4,R4SAVE ;Save R4 value for possible reset later (CC) GET -(SP) ;Get wrd from usr space ;*I/D* MOV @SP,R1 ;R1 = Instruction to decode CLRB BYTFLG ;Clear the byte instruction flag ASL R1 ;Shift out the byte flag bit in instruction ADCB BYTFLG ;Set the byte instruction indicator ROR R1 ;Restore the instruction ADDR OPTBL,R2 ;R2 -> opcode decode table ADDR TXTTBL,R3 ;R3 -> opcode text table 10$: ADD #OP.LEN,R2 ;R2 -> next opcode TST @R2 ;Are we done? BEQ 30$ ;Branch if so CMP R1,@R2 ;Does the instruction go here? BLO 30$ ;Branch if so 20$: CLR R0 ;Set up for MOVB BISB -1(R2),R0 ;R0 = length of opcode text ADD R0,R3 ;R3 -> next opcode text BR 10$ ;Try again 30$: MOV -2(R2),R0 ;R0 = instruction definition code TSTB R0 ;Can this be a byte instruction BMI 40$ ;Branch if so ;.ASSUME ? EQ 80 ASRB BYTFLG ;Was byte instruction flag set? BCC 40$ ;Branch if not. We've got the instruction MOV @SP,R1 ;Restore the original instruction BR 20$ ;Continue scanning table 40$: MOV R0,R1 ;Get the length of the opcode text CLRB R1 ; by clearing the definition bits SWAB R1 ; and putting length in low byte BEQ 60$ ;Branch if no mnemonic 50$: MOVB (R3)+,(R4)+ ;Move a character SOB R1,50$ ;Loop ASRB BYTFLG ;Is it a byte instruction BCC 60$ ;Branch if not MOVB #'B,(R4)+ ;Else add the "B" 60$: BIC #<^C177>,R0 ;Clear out hi-byte (length of text) MOV (SP)+,R1 ;R1 = instruction to decode .IF EQ,<$$$PIC> ;If not position independant code CALL @DECTBL(R0) ;Call processing routine .IFF; EQ,<$$$PIC> ;If not position independant code ADDR DECTBL,SP ;@SP -> DECODE's JUMP table ADD @SP,R0 ;R0 -> Correct table entry for operator ADD @R0,@SP ;@SP -> Relocated routine address to execute CALL @(SP)+ ;Call processing routine .ENDC; EQ,<$$$PIC> ;If not position independant code MOVB #200,@R4 ;Make the output ASCIZ MOV R4SAVE,R4 ;Restore R4 RETRN: RETURN .DSABL LSB PSECT PURE_DATA DBGSYM DECTBL DECTBL: .RSET .RWORD RETRN ;No operands .RWORD DCD.R ;R <2:0> register .RWORD DCD.N3 ;N <2:0> 3-bit number .RWORD DCD.CC ;CC <3:0> condition codes .RWORD DCD.O8 ;XXX <7:0> 8-bit offset .RWORD DCD.N6 ;NN <5:0> 6-bit number .RWORD DCD.RO ;R,XX <8:6><5:0> reg,6-bit number .RWORD DCD.N8 ;NNN <7:0> 8-bit number .RWORD DCD.DD ;DD <5:0> destination ;SS <5:0> source .RWORD DCD.RD ;R,DD <8:6><5:0> reg,destination .RWORD DCD.SR ;SS,R <8:6><5:0> source,reg .RWORD DCD.SD ;SS,DD <11:6><5:0> source,destination .RWORD DCD.IO ;Invalid opcode. Print as number PSECT PURE_CODE .SBTTL DCD.N% - Numeric output routines ;+ ; DCD.N3 ; DCD.N6 ; DCD.N8 ; These routines output the approriate number of bits worth of a number. ; ; R1 = number to print ; R4 -> output buffer ; ; CALL DCD.N% ; ; R0 = 0 ; R1 modified ; R4 updated past string ;- .ENABL LSB DBGSYM DCD.N3 DBGSYM DCD.N6 DBGSYM DCD.N8 DBGSYM OCTOUT DBGSYM DCD.IO DBGSYM DCDIO1 DCD.N3: BIC #<^C7>,R1 ;Leave only 3 bits DCD.N6: BIC #<^C77>,R1 ;Leave only 6 bits DCD.N8: BIC #<^C377>,R1 ;Leave only 8 bits OCTOUT: MOVB #TAB,(R4)+ ;Put in a DCD.IO: CLRB LEDFIL ;No leading zeros DCDIO1: MOV R1,R0 ;R0 = number to output 10$: MOVB CRADIX,R1 ;R1 = current radix CALL DIV ;Divide it ADDR NUMASC,R1,ADD ;Add address of number list PICLY MOVB @R1,-(SP) ;Save the character .ROM DECB LEDFIL ;Decrement the leading character count TST R0 ;Anything left to output? BNE 40$ ;Branch if so 30$: DECB LEDFIL ;Done enough digits? BLE 50$ ;Branch if so .ROM MOVB LEDCHR,(R4)+,VALUE=BLANK ;Store the lead character BR 30$ ;Check for more 40$: CALL 10$ ;Recursive call 50$: MOVB (SP)+,(R4)+ ;Put the character in the buffer RETURN ;Return to self of caller .DSABL LSB PSECT PURE_DATA NUMASC: .ASCII \0123456789ABCDEF\ PSECT PURE_CODE .SBTTL DCD.RO - Output Rn,Offset - SOB instruction ;+ ; DCD.RO ;- .ENABL LSB DBGSYM DCD.RO DCD.RO: MOV R1,-(SP) ;Save the instruction ASL R1 ;Shift the register bits ASL R1 ; into high byte SWAB R1 ; and then into low byte CALL DCD.R ;Output the register MOVB #COMMA,(R4)+ ;Put out a comma MOV (SP)+,R1 ;Get the instruction back BIC #<^C77>,R1 ;Leave only offset NEGB R1 ;It gets subtracted from current PC BR 10$ ;Go output the offset .SBTTL DCD.O8 - Print a branch offset ;+ ; DCD.O8 ; This routine outputs the target address of a branch instructions ; ; R1 = current instruction ; R5 = current PC ; ; CALL DCD.O8 ; ; R1 = branch target address ;- DBGSYM DCD.O8 DCD.O8: MOVB #TAB,(R4)+ 10$: MOVB R1,R1 ;Sign extend the offset ASL R1 ; *2 ADD R5,R1 ;Add in current PC CALLR LODAD1 ;Type the address .DSABL LSB .SBTTL DCD.R - Output a register ;+ ; DCD.R ;- .ENABL LSB DBGSYM DCD.R DCD.R: MOVB #TAB,(R4)+ ;Put a in the buffer ROUT: ROUTF: BIC #<^C7>,R1 ;Extract the register number ASL R1 ;Make it a word offset ADDR REGASC,R1,ADD ;Add address of register list PICLY MOVB (R1)+,(R4)+ ;Output the character MOVB (R1)+,(R4)+ ;Output the second character RETURN .DSABL LSB PSECT PURE_DATA REGASC: .ASCII \R0R1R2R3R4R5SPPC\ PSECT PURE_CODE .SBTTL DCD.RD - Output reg,dst DBGSYM DCD.RD DCD.RD: MOVB #TAB,(R4)+ ;Put a in the buffer MOV R1,-(SP) ;Save the instruction ASL R1 ;Get register in high byte ASL R1 ; and then SWAB R1 ; into low byte CALL ROUTF ;Output the register name MOVB #COMMA,(R4)+ ;Put in the comma MOV (SP)+,R1 ;Restore the instruction BR DDOUT ;Output the destination .SBTTL DCD.SR - Output src,reg DBGSYM DCD.SR DCD.SR: MOV R1,-(SP) ;Save the instruction 10$: CALL DCD.DD ;Print the source 20$: MOVB #COMMA,(R4)+ ;Put in a comma MOV (SP)+,R1 ;Get the instruction again ASL R1 ;Shift the register ASL R1 ; into the high byte SWAB R1 ; and then to the low byte BR ROUTF ; and output the register and return .SBTTL DCD.SD - Output src,dst DBGSYM DCD.SD DCD.SD: MOV R1,-(SP) ;Save the instruction ASL R1 ;Get the source ASL R1 ; into the high byte SWAB R1 ; and then into the low byte CALL DCD.DD ;Output the source MOVB #COMMA,(R4)+ ;Put in a comma MOV (SP)+,R1 ;Get the instruction back BR DDOUT ;Output the destination .SBTTL DCD.DD - Output src or dst DBGSYM DCD.DD DBGSYM DDOUT DCD.DD: MOVB #TAB,(R4)+ ;Put a in the buffer DDOUT: BIC #<^C77>,R1 ;Leave only MOV R1,-(SP) ;Save it BIC #<^C7>,R1 ;Leave only the register CMP R1,#7 ;Is it the PC? BNE 40$ ;Branch if not BIT #20,@SP ;Mode 2, 3, 6 or 7? BEQ 40$ ;Branch if not ;+ ; Register is PC, mode is 2, 3, 6 or 7. We type the subject ; instruction word as data or as address based on the following: ; ; Mode Displayed as Example instruction R0 at 30$ ; ---- ------------ ------------------- --------- ; 27 Data MOV #FOO,xxx -1 ; 37 Address MOV @#FOO,xxx 0 ; 67 Address MOV FOO,xxx 0 ; 77 Addesss MOV @FOO,xxx 1 ; ;- CLR R0 ;R0 is address vs data flag (R0 < 0)=Data BIT #10,@SP ;Mode 3 or 7? BEQ 10$ ;Branch if not MOVB #'@,(R4)+ ;Output the '@' INC R0 ;Increment flag - definitly ADDRESS 10$: BIT #40,@SP ;Mode 2 or 3? BNE 20$ ;Branch if not MOVB #'#,(R4)+ ;Output the '#' DEC R0 ;Decrement flag - May not be an address 20$: GET R1 ;Get wrd from usr space ;*I/D* BIT #40,(SP)+ ;Mode 6 or 7? BEQ 30$ ;Branch if not ADD R5,R1 ;Else it's PC relative 30$: TST R0 ;Defaulting to address type out? BGE 35$ ;Branch if so CALLR LODDAT ;Load buffer with data in R1 35$: CALLR LODAD1 ;Load buffer with address in R1 40$: BIT #10,@SP ;Mode 1, 3, 5 or 7? BEQ 50$ ;Branch if not MOVB #'@,(R4)+ ;Output the '@' 50$: BIT #40,@SP ;Mode 4, 5, 6 or 7? BEQ 70$ ;Branch if not CMP @SP,#60 ;Mode 4 or 5? BGE 60$ ;Branch if not MOVB #'-,(R4)+ ;Output '-' BR 70$ ; ; 60$ is for NON-PC register, mode 6 and 7 only ; therefore we consider the value to be data. 60$: GET R1 ;Get wrd from usr space ;*I/D* CALL LODDAT ;Type it out 70$: MOV @SP,R1 ;Get the register again CMP @SP,#20 ;Mode 2 - 7? BLT 80$ ;Branch if not MOVB #'(,(R4)+ ;Output the '(' 80$: CALL ROUT ;Output the register CMP @SP,#20 ;Mode 2 - 7? BLT 90$ ;Branch if not MOVB #'),(R4)+ ;Store the ')' 90$: BIT #20,@SP ;Mode 2, 3, 6 or 7? BEQ 100$ ;Branch if not CMP @SP,#40 ;Mode 2 or 3? BGE 100$ ;Branch if not MOVB #'+,(R4)+ ;Output the '+' 100$: TST (SP)+ ;Clean stack RETURN .SBTTL DCD.CC - Condition code printer ;+ ; DCD.CC ; This routine handles printing the condition code instructions ; in a sane format. ; ; R1 = Instruction value to decode ; R4 -> Output buffer ; ; CALL DCD.CC ; ; R4 -> Updated output buffer pointer ; R0-R3 Destroyed ; BYTFLG Destroyed ;- .ENABL LSB DBGSYM DCD.CC DCD.CC: MOV R4SAVE,R4 ;Restore R4 -> beginning of buffer ADDR CLSTR+1,R2 ;Assume CLx ;R2 -> 'CL' BIT #20,R1 ;Is it really? BEQ 10$ ;Branch if so ADD #SESTR-CLSTR,R2 ;Point to the 'SEx' string 10$: ADDR CCSTR,R3 ;R3 -> condition code string MOVB #-1,BYTFLG ;Reset the 'or' flag CALL @PC ;Do following code 2 times CALL @PC ; Make that 4, please ASR R1 ;Is condition code bit on? BCC 30$ ;Branch if not MOV R2,R0 ;R0 -> instruction string 20$: MOVB (R0)+,(R4)+ ;Store the character BPL 20$ ;Branch if more to come DEC R4 ;Back up one place MOVB @R3,(R4)+ ;Store the condition code .ROM INCB BYTFLG ;Indicate 'or' condition possible BNE 30$ ;Branch if not first time thru DEC R2 ;Back up instruction string pointer 30$: INC R3 ;R3 -> text of next condition code RETURN .DSABL LSB PSECT PURE_BYTE_DATA .NLIST BEX CLSTR: .ASCII \!CL\<200> ;Strings for condition code instructions SESTR: .ASCII \!SE\<200> ; ** These must be kept together ** CCSTR: .ASCII \CVZN\ ; .LIST BEX PSECT PURE_CODE .SBTTL .SBTTL .SBTTL DBGENC - Instruction ENCODE routines for DBG ;Edit 00 .SBTTL .SBTTL .IIF NDF,L$$LST,.NLIST ;**************************************************************************** ;* * ;* COPYRIGHT (c) 1983, 1986 * ;* BY DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. * ;* ALL RIGHTS RESERVED. * ;* * ;* THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED * ;* ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE * ;* INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER * ;* COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY * ;* OTHER PERSON. NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY * ;* TRANSFERRED. * ;* * ;* THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE * ;* AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT * ;* CORPORATION. * ;* * ;* DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS * ;* SOFTWARE ON EQUIPMENT THAT IS NOT SUPPLIED BY DIGITAL. * ;* * ;**************************************************************************** ;++ ; Facility: DBG - A PDP-11 system independant symbolic debugger ; ; Authors: Don Bridgewater / Chuck Guldenschuh / Joe Worrall ; ; Created: Started by Chuck in 1980. ; ; Abstract: DBGENC - Instruction ENCODE routines for DBG ; ; Externals Description ; --------- ----------- ; ; Edit Who Date Description of modification ; ---- --- ---- --------------------------- ;-- PSECT PURE_CODE .IIF NDF,L$$LST,.LIST .SBTTL CHKINS - Determine if a symbol is an instruction ;+ ; CHKINS ; ; R4 -> text string (ASCIZ) ; ; CALL CHKINS ; ; R5 = EX.INS!R5 if symbol is a instruction w/arguments ; R5 = EX.SYM!EX.FND!R5 if symbol is a instruction w/noargs ; @PARPTR = basic or whole instruction value ; ; All registers preserved ; ; C-BIT = 0 Symbol is some sort of instruction ; C-BIT = 1 Symbol is NOT a instruction ;- .ENABL LSB DBGSYM CHKINS CHKINS: JSR R3,SAVVR ;Save R0-R3 MOV R5,-(SP) ;Save R5 ADDR OPTBL,R2 ;R2 -> opcode decode table ADDR TXTTBL,R3 ;R3 -> opcode text table 10$: MOV R4,R1 ;R1 -> possible instruction CLRB BYTFLG ;Clear the byte instruction flag MOVB 3(R2),R0 ;Get length of instruction text ( < 128. ) BEQ 40$ ;Can't be this one 20$: MOVB (R1)+,R5 ;Get next character - End of test string? BEQ 40$ ;Branch if so. No match BICB #40,R5 ;Make it upper case CMPB R5,(R3)+ ;Do they match? BNE 30$ ;Branch if not SOB R0,20$ ;Check all of the characters MOVB (R1)+,R5 ;Get next character - Any more here? BEQ 60$ ;Branch if not. A match! BICB #40,R5 ;Make it upper case CMPB #'B,R5 ;Is it a byte instruction? BNE 40$ ;Branch if not. MOVB 2(R2),BYTFLG ;Can this be a byte instruction? BPL 40$ ;Branch if not. TSTB @R1 ;End of the string? BEQ 60$ ;Branch if so. A match. 30$: DEC R0 ;Zero base TXTTBL byte count 40$: ADD #OP.LEN,R2 ;Point to the next instruction decode entry TST @R2 ;Anything left to check? BEQ 110$ ;Branch if not. Not an instruction - done. TST R0 ;Were any characters left over? BLE 10$ ;Branch if not. Go check next instruction 50$: TSTB (R3)+ ;Skip the character SOB R0,50$ ;Loop BR 10$ 60$: MOV (R2)+,@PARPTR ;Return the instruction code value .ROM MOVB @R2,ENCFLG ;Save the encode flags byte BEQ 70$ ;Branch if a no operand instruction CMPB @R2,#CC ;Was this a condition code operator? BNE 80$ ;Branch if not, instruction has operands. 70$: BIS #,@SP ;Pretend it's a symbol, and found. BR 100$ ;Return saying it's an instruction 80$: TSTB BYTFLG ;Byte instruction? BPL 90$ ;Branch if not BIS #100000,@PARPTR ;Make it a byte instruction 90$: BIS #EX.INS,@SP ;Set the instruction flag 100$: TST (PC)+ ;Clear carry - it was some sort of instruction 110$: SEC ;Error - symbol was NOT some instruction MOV (SP)+,R5 ;Restore R5 RETURN .DSABL LSB .SBTTL ENCODE - ENCODE AN INSTRUCTION ;+ ; ENCODE ; THIS IS THE PRIMARY ENCODE DISPATCH ROUTINE ; ; PARPTR <- PAR1 ; @PARPTR CONTAINS BASIC INSTRUCTION VALUE ; ENCFLG CONTAINS INSTRUCTION TYPE AND BYTE ENABLE BIT ; BYTFLG <> 0 If base operand typed was a byte instruction ; DOT CONTAINS CURRENT LOCATION ; R2 = Terminating character from GETEXP via COMMND ; ; CALL ENCODE ; ; PARFLG =1 IF 1 WORD INSTRUCTION ; =3 IF 2 WORD INSTRUCTION ; =7 IF 3 WORD INSTRUCTION ; PARPTR <- PARPTR + 2*(NUMBER OF WORDS IN INSTRUCTION) ; PAR1 CONTAINS 1ST WORD OF INSTRUCTION ; PAR2 CONTAINS 2ND WORD OF INSTRUCTION ; PAR3 CONTAINS 3RD WORD OF INSTRUCTION ; R2 = Character that ENCODE terminated on ; ; ; IN THE FOLLOWING ROUTINES THESE REGISTERS ARE USED EXCLUSIVELY AS FOLLOWS: ; ; R2 IS USED AS 'INSMOD' ; R3 IS USED AS THE INSTRUCTION'S EFFECTIVE PC ; (IT IS PRE-INCREMENTED AS IT WOULD BE IF THE ; INSTRUCTION WERE ACTUALLY BEING EXECUTED) ; R4 IS A POINTER TO THE NEXT AVAILABLE CHARACTER IN ; THE INPUT BUFFER ;- .ENABL LSB DBGSYM ENCODE ENCODE: ; Check the sepperator between the instruction and operands, it ; should only be a space, if not, this is currently a syntax ; error. !!! Should we just return the BASIC value if not? !!! CMPB #,R2 ;Is the terminating character a ? BNE SYNTAX ;Branch if not, syntax error. MOV BUFPTR,R4 ;COPY INPUT BUFFER PTR FOR EFFICIENCY ADD #2,PARPTR ;POINT TO NEXT UNUSED PARAMETER MOVB #1,PARFLG ;INDICATE THAT THERE IS 1 PARAMETER MOV DOT,R3 ;GET CURRENT LOCATION ADD #2,R3 ;FOR AN INSTRUCTION, PC IS PRE-INCREMENTED CLR R1 ;MUST BE CLEAR FOR NUMERIC OPR ROUTINES .ROM MOVB BYTFLG,ODDFLG ;Save a copy of the byte instruction typed flag MOVB ENCFLG,R0 ;GET INSTRUCTION TYPE INDEX BIC #177600,R0 ;GET RID OF BYTE ENABLE BIT AND SIGN EXT. .IF EQ,<$$$PIC> ;If position independant code CALL @ENCTBL(R0) ;Call processing routine .IFF; EQ,<$$$PIC> ;If position independant code ADDR ENCTBL,SP ;@SP -> ENCODE's JUMP table ADD @SP,R0 ;R0 -> Correct table entry for operator ADD @R0,@SP ;@SP -> Relocated routine address to execute CALL @(SP)+ ;Call processing routine .ENDC; EQ,<$$$PIC> ;If position independant code ENCRET: MOV R4,BUFPTR ;Reset BUFPTR to the end of the instruction DBGFNC FUNCTION=READ_WAIT ;Do READ_WAIT to get terminator -> R2/DBG$CH RETURN ;Return to caller @COMMND .DSABL LSB PSECT PURE_DATA ENCTBL: .RSET .RWORD ENCRET ;NO OPERANDS, SO JUST RETURN .RWORD ENC.R ;R <2:0> REGISTER .RWORD ENC.N3 ;N <2:0> 3-BIT NUMBER ; ; CONDITION CODES HAVE NO OPERANDS, SO JUST RETURN ; .RWORD ENCRET ;CC <3:0> CONDITION CODES .RWORD ENC.O8 ;XXX <7:0> 8-BIT OFFSET .RWORD ENC.N6 ;NN <5:0> 6-BIT NUMBER .RWORD ENC.RO ;R,XX <8:6><5:0> REG,6-BIT NUMBER .RWORD ENC.N8 ;NNN <7:0> 8-BIT NUMBER .RWORD ENC.DD ;DD <5:0> DESTINATION ;SS <5:0> SOURCE .RWORD ENC.RD ;R,DD <8:6><5:0> REG,DESTINATION .RWORD ENC.SR ;SS,R <8:6><5:0> SOURCE,REG .RWORD ENC.SD ;SS,DD <11:6><5:0> SOURCE,DESTINATION .RWORD SYNTAX ;Invalid opcode PSECT PURE_CODE DBGSYM SYNTAX SYNTAX: ERROR STRING=ISESTR ;Instruction syntax error. PSECT PURE_BYTE_DATA ISESTR: ERRMSG WARNING,, PSECT PURE_CODE .SBTTL ENC.RD - ENCODE A REGISTER, DESTINATION INSTRUCTION ;+ ; THE FOLLOWING 4 ROUTINES ARE CLOSELY COUPLED AND DO THE FOLLOWING: ; ; ENC.RD - ENCODE A REG,DEST INSTRUCTION ; REGCOM - ENCODE A REGISTER IN BITS 8 TO 6 OF INSTRUCTION AND EAT A COMMA ; EATCOM - EAT THE NEXT INPUT CHARACTER. IF IT IS NOT A COMMA, GIVE ERROR ; REGPAR - INPUT A REGISTER PUTTING VALUE IN BITS 2 TO 0 OF R0, AND EAT A ; RIGHT PARENTHESIS ;- .ENABL LSB DBGSYM ENC.RD DBGSYM REGCOM DBGSYM EATCOM DBGSYM REGPAR ENC.RD: ADDR ENC.DD,SP ;GO TO 'ENC.DD' AFTER 'REGCOM' ; I.E., ENCODE REGISTER IN BITS 8 TO 6 OF ; INSTRUCTION WORD, AND ENCODE A DESTINATION ; OPERAND IN BITS 5 TO 0. REGCOM: CALL R8TO6 ;ASSEMBLE REGISTER VALUE INTO BITS 8 TO 6 EATCOM: CMPB #COMMA,(R4)+ ;EAT A COMMA BR 10$ REGPAR: INC R4 ;POINT TO NEXT INPUT CHARACTER CALL REGERR ;GET REGISTER VALUE IN R0 OR ERROR CMPB #'),(R4)+ ;EAT A RIGHT PAREN 10$: BNE SYNTAX ;IF NOT, THEN AN ERROR RETURN ;RETURN TO CALLER .DSABL LSB .SBTTL ENC.SR - ENCODE A SOURCE, REGISTER INSTRUCTION ;+ ; THE FOLLOWING 3 ROUTINES ARE CLOSELY COUPLED AND DO THE FOLLOWING: ; ; ENC.SR - ENCODE A SRC, REG INSTRUCTION ; R8TO6 - ENCODE A REG IN BITS 8 TO 6 OF INSTRUCTION ; REGERR - GET REG VALUE IN BITS 2 TO 0 OF R0. IF NOT A REG, THEN ERROR. ;- .ENABL LSB DBGSYM ENC.SR DBGSYM R8TO6 DBGSYM REGERR ENC.SR: CALL ENC.DD ;ASSEMBLE SOURCE OPERAND IN BITS 5 TO 0 OF ; INSTRUCTION WORD 5$: CALL EATCOM ;EAT A COMMA, ELSE ERROR .DSABL LSB R8TO6: ADDR P13TO6,SP ;GO TO 'P13TO6' AFTER 'REGERR' ; 'P13TO6' PUTS REG VALUE GOTTEN BY 'REGERR' ; INTO BITS 8 TO 6 OF THE INSTRUCTION WORD .BR REGERR REGERR: CALL GETREG ;GET REGISTER VALUE IN R0 BCS SYNTAX ;IF BAD REGISTER, THEN ERROR RETURN .SBTTL GEXP & GETREG - GET EXPRESSION AND GET REGISTER ROUTINES ;+ ; GEXP - GETS AN EXPRESSION, ELSE ERRORS. ; GETREG - GETS A REGISTER OR EXPRESSION, ELSE ERRORS. ; IF A REGISTER, THE REGISTER VALUE IS RETURNED IN R0 ; AND REGVAL WITH C=0. ; IF AN EXPRESSION, THE EXPRESSION VALUE IS RETURNED IN ; @PARPTR WITH C=1. ;- DBGSYM GEXP GEXP: CALL GETREG ;GET AN EXPRESSION OR REGISTER BCC SYNTAX ;C=0 -> REGISTER, SO ERROR RETURN ;C=1 -> A NON-REG, NON-INS EXPRESSION DBGSYM GETREG GETREG: MOV @PARPTR,-(SP) ;'EXPREG' MODIFIES @PARPTR VIA 'GETEXP' CALL EXPREG ;GET AN EXPRESSION VALUE. R5 IS EXP FLAGS BIT #TI.REG,R5 ;Was a register expression found? BEQ 1$ ;Branch if not. MOV @PARPTR,R0 ;COMPUTE REAL REGISTER .IF EQ,<$$$PIC> ;If position independant code SUB #<...UR0>,R0 ;If PIC=NO .IFF; EQ,<$$$PIC> ;If position independant code ADDR <...UR0>,SP ;@SP -> ...UR0 SUB (SP)+,R0 ;Subtract from address returned .ENDC; EQ,<$$$PIC> ;If position independant code ASR R0 ; OF USERS REGISTERS. ;+ ; NOTE - BECAUSE ADDRESSES ARE WORD ALIGNED THE ABOVE ASR CLEARS ; THE CARRY BIT (C=0) AND THE FOLLOWING MOV AND MOVB ; INSTRUCTIONS LEAVE IT CLEARED. ;- 10$: MOVB R0,REGVAL ;SAVE A COPY OF REGISTER VALUE MOV (SP)+,@PARPTR ;RESTORE @PARPTR RETURN ;C=0 MEANS WE GOT A REGISTER IN REGVAL AND R0 1$: COM (SP)+ ;WE FOUND AN EXPRESSION SO USE NEW @PARPTR ;C=1 SO CALLER KNOWS EXPRESSION WAS NOT RETURN ; A REGISTER. RETURN .SBTTL EXPREG - GETS AN EXPRESSION OR INTERNAL REGISTER ;+ ; EXPREG - GETS AN EXPRESSION OR INTERNAL REGISTER (R0-R7) AND PUTS VALUE ; IN @PARPTR. IF EXPRESSION IS NULL OR AN INSTRUCTION, THEN ; GIVE A SYNTAX ERROR. R5 CONTAINS EXPRESSION FLAGS UPON RETURN. ;- DBGSYM EXPREG EXPREG: JSR R3,SAVVR ;SAVE R0 - R3 MOV R4,BUFPTR ;UPDATE GLOBAL INPUT BUFFER POINTER MOVB -(R4),DBG$CH ;PUT CURRENT CHARACTER IN DBG$CH DBGFNC FUNCTION=CLEAR_OUTBUF ;Load R4 -> OUTBUF CALL GETEXP ;@PARPTR <- VALUE OF EXPR IN INPUT BUFFER BEQ SYNTAX ;NULL EXPRESSION IS AN ERROR BIT #TI.INS,R5 ;DID WE GET AN INSTRUCTION? BNE SYNTAX ;NE -> INSTRUCTION, SO ERROR MOV BUFPTR,R4 ;UPDATE OUR PRIVATE DEC R4 ; BUFFER POINTER RETURN ;RESTORE R0 - R3 AND RETURN .SBTTL ENC.SD & ENC.DD - GETS SOURCE AND/OR DESTINATION OPERANDS ;+ ; ENC.SD - GETS A SOURCE OPERAND IN BITS 11 TO 6 OF INSTRUCTION WORD, EATS A ; COMMA, AND GETS A DESTINATION OPERAND IN BITS 5 TO 0 OF INSTRUC- ; TION WORD. IF AN OPERAND REQUIRES AN EXTRA WORD, THE APPROPRIATE ; VALUE IS PLACED IN @PARPTR AND PARPTR IS INCREMENTED BY 2 ; ENC.DD - INPUT A DESTINATION OPERAND IN BITS 5 TO 0 OF INSTRUCTION WORD. ; IF THE OPERAND REQUIRES AN EXTRA WORD, THE APPROPRIATE VALUE IS ; PLACED IN @PARPTR AND PARPTR IS INCREMENTED BY 2. ;- DBGSYM ENC.SD DBGSYM ENC.DD ENC.SD: CALL GETSRC ;ASSEMBLE SOURCE OPERAND CALL EATCOM ;EAT A COMMA, ELSE ERROR ENC.DD: ADDR PUTOPR,SP ;GO TO 'PUTOPR' AFTER 'GETOPR' .BR GETOPR .SBTTL GETOPR - GET AN OPERAND AND GENERATED AN EXTRA WORD IF REQUIRED ;+ ; GETOPR - INPUT A SOURCE OR DESTINATION OPERAND, GENERATE THE APPROPRIATE ; MODE AND REGISTER FIELDS IN BITS 5 TO 3 AND BITS 2 TO 0 OF R0, ; RESPECTIVELY. IF THE OPERAND REQUIRES AN EXTRA WORD, THE APPRO- ; PRIATE VALUE IS GENERATED AND STORED IN @PARPTR AND PARPTR IS ; INCREMENTED BY 2. ; ; INSMOD (R2) HAS 12. POSSIBLE VALUES WHEN THE COMMON CODE AT 80$ IS ; PROCESSED. THESE ARE: ; ; -6 IMMEDIATE MODE (PC AUTO-INCREMENT MODE WITH INLINE OPERAND) ; -5 ABSOLUTE MODE (PC AUTO-INCREMENT DEFERRED MODE ; WITH INLINE OPERAND) ; -2 RELATIVE MODE (PC INDEX MODE WITH INLINE OPERAND) ; -1 RELATIVE DEFERRED MODE (PC INDEX DEFERRED MODE ; WITH INLINE OPERAND) ; 0 REGISTER MODE ; 1 REGISTER DEFERRED MODE ; 2 AUTO-INCREMENT MODE ; 3 AUTO-INCREMENT DEFERRED MODE ; 4 AUTO-DECREMENT MODE ; 5 AUTO-DECREMENT DEFERRED MODE ; 6 INDEX MODE ; 7 INDEX DEFERRED MODE ; ; IF INSMOD<0, INSMOD+8 IS THE REAL OPERAND MODE. ; NOTE - INSMOD IS REALLY R2 ;- .ENABL LSB DBGSYM GETOPR GETOPR: CLR R2 ;MODE OF CURRENT OPERAND IS 0 (REGISTER) .ROM MOVB #7,REGVAL ;DEFAULT REG IS PC CLR @PARPTR ;DEFAULT EXTRA WORD IS 0 CMPB #'@,@R4 ;IS NEXT CHAR AN '@'? BNE 10$ ;IF NOT, THEN TRY A '#' INC R4 ;SKIP PTR OVER FOUND '@' INC R2 ;INSMOD (R2) IS 1 (REGISTER DEFERRED) ; ; NOTE - INSMOD (R2) MUST BE EITHER 0 OR 1 HERE. (1 MEANS '@' SPECIFIED) ; 10$: CMPB #'#,(R4)+ ;IS NEXT CHARACTER A '#' BNE 20$ ;IF NOT A '#', SEE IF IT IS A '(' CALL GEXP ;GET AN EXPRESSION VALUE SUB #6,R2 ;MAKE INSMOD (R2) EITHER -6 (IMMEDIATE) ; OR -5 (ABSOLUTE) BR 80$ ;DO COMMON OPERAND PROCESSING ; ; NOTE - INSMOD (R2) MUST BE EITHER 0 OR 1 HERE. (1 MEANS '@' SPECIFIED) ; 20$: CMPB #'(,-(R4) ;IS NEXT CHAR A LEFT PAREN? BNE 50$ ;NE -> TRY A MINUS CALL REGPAR ;BUMP INPUT PTR, GET REG VALUE, AND EAT ')' CMPB #'+,@R4 ;IS NEXT CHARACTER A PLUS BNE 30$ ;NE -> NO, SO OPERAND IS EITHER ; REGISTER DEFERRED OR INDEX DEFERRED INC R4 ;BUMP INPUT PTR PAST '+' BR 40$ ;MAKE INSMOD (R2) EITHER 2 (AUTO-INCREMENT) ; OR 3 (AUTO-INCREMENT DEFERRED) ; ; OPERAND IS EITHER REGISTER DEFERRED OR INDEX DEFERRED ; FIND OUT WHICH ; ; NOTE - INSMOD (R2) IS EITHER 0 OR 1 HERE. (1 MEANS '@' SPECIFIED) ; 30$: DEC R2 ;WAS '@' SPECIFIED? BNE 40$ ;NE -> NO, SET INSMOD (R2) TO 1 (REGISTER ; DEFERRED) MOV #5,R2 ;MAKE INSMOD (R2) 7 (INDEX DEFFERED) WITH ; IMPLIED INDEX OF 0 40$: ADD #2,R2 BR 80$ ;DO COMMON OPERAND PROCESSING ; ; NOTE - INSMOD (R2) IS EITHER 0 OR 1 HERE. (1 MEANS '@' SPECIFIED) ; 50$: CMPB #'-,@R4 ;IS NEXT CHAR A MINUS? BNE 60$ ;IF NOT MINUS, THEN TRY A REGISTER VALUE CMPB #'(,1(R4) ;GOT A MINUS, NOW A LEFT PAREN? BNE 60$ ;IF NOT A LEFT PAREN, THEN TRY A REG. VALUE ADD #4,R2 ;MAKE INSMOD (R2) EITHER 4 (AUTO-DECREMENT) ; OR 5 (AUTO-DECREMENT DEFERRED) INC R4 ;BUMP PTR PAST '-' BR 75$ ;SKIP '(', GET REG AND ')', AND FINISH UP 60$: CALL GETREG ;GET A REGISTER VALUE OR AN EXPRESSION BCC 80$ ;C=0 -> REGISTER VALUE IN R0 AND REGVAL ;C=1 -> NON-REGISTER EXPRESSION IN @PARPTR ; ; NOTE - INSMOD (R2) IS EITHER 0 OR 1 HERE. (1 MEANS '@' SPECIFIED) ; 220$: SUB #2,R2 ;INSMOD (R2) IS EITHER -2 (RELATIVE) ; OR -1 (RELATIVE DEFERRED) CMPB #'(,@R4 ;EAT LEFT PAREN BNE 80$ ;IF NO LEFT PAREN, THEN GO DO COMMON CODE ADD #8.,R2 ;INSMOD (R2) IS EITHER 6 (INDEX) ; OR 7 (INDEX DEFERRED) 75$: CALL REGPAR ;BUMP INPUT PTR, GET REG VALUE, AND EAT ')' 80$: TST R2 ;Have to generate an extra word for sure? BMI 83$ ;Branch if so CMP R2,#6 ;INSMOD 6 or 7 have to also BLT 100$ ;Branch if not 6 or 7, no extra words here. 83$: ADD #2,R3 ;Bump PC TST R2 ;INSMOD negative? Is instruction PC reltive? BPL 90$ ;Branch if not ADD #2,R2 ;Is operand of the instruction PC Relative? BMI 85$ ;Branch if not, not -1 or -2 SUB R3,@PARPTR ;GENERATE RELATIVE VALUE 85$: ADD #6,R2 ;CONVERT PSEUDO-MODE TO INSTRUCTION MODE ;+ ; Register is PC, mode could be 2, 3, 6 or 7. For all modes except ; mode 27, we do a sanity check here to verify that the SRC or ; DST effective address is not odd if the instruction is NOT a ; byte instruction. ; ; Mode Example instruction Odd address check? ; ---- ------------------- ------------------ ; 27 OPR #FOO,xxx No ; 37 OPR @#FOO,xxx Yes ; 67 OPR FOO,xxx Yes ; 77 OPR @FOO,xxx Yes ; ;- CMP R2,#2 ;Is this operand mode 2? BEQ 90$ ;Branch if so, don't odd address check. BIT #1,@PARPTR ;Operand generated ODD? BEQ 90$ ;Branch if not, OK. TSTB ODDFLG ;Was a byte instruction typed? BPL ODDADR ;Branch if not, ODD address error. 90$: SEC ;INDICATE THAT THERE IS ANOTHER PARAMETER ROLB PARFLG ; SHIFT FLAGS IN PARFLG LEFT AND SET BIT 0 ADD #2,PARPTR ;POINT TO NEXT AVAILABLE PARAMETER 100$: MOV R2,R0 ;PUT OPERAND MODE BITS IN R0 ASL R0 ;SHIFT THEM ASL R0 ; TO BITS ASL R0 ; 5 TO 3 BISB REGVAL,R0 ;PUT REG BITS IN BITS 2 TO 0 OF R0 RETURN ;Return to caller .DSABL LSB .SBTTL ENC.N% - NUMERIC INPUT ROUTINES ;+ ; ENC.N8 ; ENC.N6 ; ENC.N3 ; THESE ROUTINES INPUT THE APPRORIATE NUMBER OF BITS WORTH OF A NUMBER ; AND ASSEMBLE IT WITH THE BASIC INSTRUCTION VALUE ; ; R1 =0 ; ; CALL ENC.N% ; ; R0 DESTROYED ; R1 CONTAINS APPROPRIATE NUMBER OF BITS OF A NUMBER ;- .ENABL LSB DBGSYM ENC.N8 DBGSYM ENC.N6 DBGSYM ENC.N3 ENC.N8: BIS #377,R1 ;ALLOW 8 BITS ENC.N6: BIS #77,R1 ;ALLOW 6 BITS ENC.N3: BIS #7,R1 ;ALLOW 3 BITS CALL GEXP ;INPUT AN EXPRESSION MOV @PARPTR,R0 ;PUT EXPRESSION VALUE IN R0 CMP R1,R0 ;WILL VALUE FIT IN # OF BITS ALLOWED? BR 10$ ;LO -> WON'T FIT, TRUNCATION ERROR ;HIS -> VALUE FITS, PLACE IN INSTRUCTION ; AND RETURN .SBTTL ENC.RO - INPUT RN,OFFSET - SOB INSTRUCTION ;+ ; ENC.RO ;- DBGSYM ENC.RO ENC.RO: CALL REGCOM ;PUT REGISTER VALUE IN INSTRUCTION ; AND EAT COMMA CALL GEXP ;GET AN EXPRESSION MOV R3,R0 ;GET INSTRUCTION'S EFFECTIVE PC IN R0 SUB @PARPTR,R0 ;SUBTRACT ABSOLUTE EXPRESSION FROM IT ASR R0 ;MAKE WORD OFFSET FROM BYTE OFFSET BCS ODDADR ;C=1 -> ODD ADDRESS ERROR CMP #63.,R0 ;WILL OFFSET FIT IN 6 BITS? 10$: BLO TRCERR ;NO, TRUNCATION ERROR BR PUTOPR ;PLACE OFFSET IN INSTRUCTION AND RETURN .DSABL LSB .SBTTL ENC.R - INPUT A REGISTER AND PLACE VALUE IN INSTRUCTION BITS 2 TO 0 ;+ ; ENC.R - INPUT A REGISTER AND PLACE VALUE IN INSTRUCTION WORD BITS 2 TO 0 ;- DBGSYM ENC.R ENC.R: CALL REGERR ;GET REGISTER VALUE IN R0 OR ERROR BR PUTOPR ;PUT REGISTER VALUE IN INSTRUCTION AND ; RETURN .SBTTL GETSRC, P13TO6, AND PUTOPR ROUTINES ;+ ; GETSRC - INPUT A SOURCE OPERAND VIA 'GETOPR' AND PLACE THE RESULTING ; MODE AND REGISTER BITS IN 11 TO 6 OF THE INSTRUCTION WORD. ; IF AN EXTRA WORD IS REQUIRED, THE APPROPRIATE VALUE IS STORED ; IN @PARPTR AND PARPTR IS INCREMENTED BY 2. ; P13TO6 - MOVES BITS 7 TO 0 OF R0 INTO BITS 13 TO 6 OF R0 AND SETS THE ; RESULTING 'ON' BITS IN THE INSTRUCTION WORD. ; R0 MUST HAVE ITS HIGH BYTE CLEARED UPON ENTRY TO 'P13TO6'. ; PUTOPR - BIT SETS R0 INTO INSTRUCTION WORD. ;- DBGSYM GETSRC DBGSYM P13TO6 DBGSYM PUTOPR GETSRC: CALL GETOPR P13TO6: SWAB R0 ;PUT BITS 7 TO 0 OF R0 ROR R0 ; INTO BITS 13 TO 6 ROR R0 ; OF R0 AND PUTOPR: BIS R0,PAR1 ; INTO INSTRUCTION RETURN .SBTTL ENC.O8 - INPUT A BRANCH OFFSET ;+ ; ENC.O8 ; THIS ROUTINE INPUTS AN EXPRESSION AND COMPUTES A SIGNED WORD OFFSET ; FROM DOT + 2 WHICH IT STUFFS INTO THE INSTRUCTION WORD ;- DBGSYM ENC.O8 ENC.O8: CALL GEXP ;GET AN EXPRESSION VALUE MOV @PARPTR,R0 ; IN R0 SUB R3,R0 ;COMPUTE A SIGNED OFFSET FROM EFFECTIVE PC ASR R0 ;MAKE A WORD OFFSET FROM BYTE OFFSET BCS ODDADR ;IF BYTE OFFSET WAS ODD, THEN ERROR CMP #-128.,R0 ;-128. <= WORD OFFSET <= 127.? BGT TRCERR ;NO, ERROR CMP #127.,R0 BLT TRCERR ;NO, ERROR BISB R0,PAR1 ;PLACE OFFSET INTO INSTRUCTION RETURN ;RETURN TO CALLER DBGSYM TRCERR DBGSYM ODDADR TRCERR: ERROR STRING=TRCSTR ;Give truncation error ODDADR: ERROR STRING=ODDSTR ;Give ODD address error PSECT PURE_BYTE_DATA TRCSTR: ERRMSG WARNING,, ODDSTR: ERRMSG WARNING,, PSECT PURE_CODE .SBTTL .SBTTL .SBTTL DBGEXP - Expression evaluation routines ;Edit 00 .SBTTL .SBTTL .IIF NDF,L$$LST,.NLIST ;**************************************************************************** ;* * ;* COPYRIGHT (c) 1983, 1986 * ;* BY DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. * ;* ALL RIGHTS RESERVED. * ;* * ;* THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED * ;* ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE * ;* INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER * ;* COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY * ;* OTHER PERSON. NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY * ;* TRANSFERRED. * ;* * ;* THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE * ;* AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT * ;* CORPORATION. * ;* * ;* DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS * ;* SOFTWARE ON EQUIPMENT THAT IS NOT SUPPLIED BY DIGITAL. * ;* * ;**************************************************************************** ;++ ; Facility: DBG - A PDP-11 system independant symbolic debugger ; ; Authors: Don Bridgewater / Chuck Guldenschuh / Joe Worrall ; ; Created: Started by Chuck in 1980. ; ; Abstract: DBGEXP - Expression evaluation routines ; ; Externals Description ; --------- ----------- ; ; Edit Who Date Description of modification ; ---- --- ---- --------------------------- ;-- PSECT PURE_CODE .IIF NDF,L$$LST,.LIST .SBTTL Expression modules symbolic definitions ; Flags used internally by the expression routines. EX.SYM = 000020 ;=> Symbolic type-in EX.NUM = 000040 ;=> Some sort of number typed EX.ASC = 000100 ;=> ASCII constant typed in EX.R50 = 000200 ;=> RAD50 constant typed in EX.VAL = ;=> Something found mask EX.HEX = 000400 ;=> HEXADECIMAL radix number typed EX.DEC = 001000 ;=> DECIMAL radix number typed EX.FND = 002000 ;=> Symbol was found by GETSYM EX.OPR = 004000 ;=> GETEXP/CHKOPR found a operator EX.NST = EX.OPR ;=> A nested expression was found EX.PRE = 010000 ;=> GETNUM found a "_" prefix operator EX.IRG = 020000 ;=> The symbol found was a internal register EX.REG = 040000 ;=> The symbol found was a register EX.INS = 100000 ;=> Instruction type-in .ASSUME EX.INS EQ 100000 ; Expression flags returned by GETEXP TI.VAL = 004000 ;=> GETEXP found some sort of valid expression TI.PRE = 010000 ;=> GETNUM found a "_" prefix operator TI.IRG = 020000 ;=> The symbol found was a internal register TI.REG = 040000 ;=> The symbol found was a register TI.INS = 100000 ;=> Instruction type-in TI.MSK = ;=> Valid TI.nnn flags mask .ASSUME EX.PRE EQ TI.PRE .ASSUME EX.IRG EQ TI.IRG .ASSUME EX.REG EQ TI.REG .ASSUME EX.INS EQ TI.INS .ASSUME TI.INS EQ 100000 .SBTTL OPNEG - Expression negation routine ;+ ; OPNEG ; ; @PARPTR = operand ; ; CALL OPNEG (?MUST BE A ONE-WORD INSTRUCTION TO WORK!) ; ; @PARPTR = result ; R0 modified ;- DBGSYM OPNEG OPNEG: NEG @PARPTR ;Negate the operand MOV (SP)+,R0 ;Save return address TST @SP ;Another operation to perform now? BNE XEQOPR ;Branch if yes MOV R0,@SP ;Restore return address RETURN XEQOPR: JMP -(R0) .SBTTL GETEXP - Get an expression ;+ ; GETEXP ; This routine handles expression evaluation. ; ; R4 -> Output/scratch buffer ; PARPTR -> Word in which to store expression value if found ; ; CALL GETEXP ; ; DBG$CH,R2 = Terminating character from GETNUM ; ; R5 = Return flags: ; ; 0 => No expression value was typed in. ; TI.VAL => Some expression value is being returned. ; This flag just says we collected some ; valid value from the user. ; TI.PRE => The expression value goten contains ; a internal register or bit register ; value. ; TI.IRG => The expression value goten contains ; a internal register or machine register ; value. ; TI.REG => The expression value goten contains ; a machine register value only. ; TI.INS => The expression value goten is the ; base operand of a machine instruction. ; (More processing is required) ; ; R0-R3 Destroyed ; ; NOTE: ; The following flags are used by the expresssion routines, some ; of them are global to modules external to the expression routines, ; while others are only used internally. Those flags marked with a ; "*" are only used internally by the expression routines, and never ; returned to the caller. ; ; ; EX.SYM (*) ;=> Symbolic type-in ; EX.NUM (*) ;=> Numeric type-in ; EX.ASC (*) ;=> ASCII constant typed in ; EX.R50 (*) ;=> RAD50 constant typed in ; EX.VAL (*) ;=> Bit mask to check for SOMETHING found. ; EX.HEX (*) ;=> HEXADECIMAL number typed in ; EX.DEC (*) ;=> DECIMAL number typed in ; EX.FND (*) ;=> Symbol found by GETSYM ; EX.OPR (*) ;=> GETEXP found a operator ; EX.NST (*) ;=> GETEXP found a nested expression ; EX.PRE ;=> GETNUM found a "_" prefix operator ; EX.IRG ;=> The symbol found was a internal register ; EX.REG ;=> The symbol found was a machine register ; EX.INS ;=> The symbol found was an instruction operand ; ;- .ENABL LSB .ASSUME EX.INS EQ 100000 DBGSYM GETEXP .IIF NDF,MAXNST, MAXNST =: 6 ;Default maximum expression depth GETEXP: CLR R5 ;Clear type in expresstion flag .ROM CLRB NSTLEV ;Clear expression nesting depth CALL 10$ ;Call ourselves to allow LEVEL-0 detection BIT #,R5 ;Have we gotten a register or instr? BEQ 1$ ;Branch if not BIT #,R5 ;Was a operator or nested exp. found? BNE 64$ ;Branch if so, not allowed! 1$: BIT #EX.VAL,R5 ;Was ANYTHING found by GETNUM? BEQ 2$ ;Branch if nothing here. BIS #TI.VAL,R5 ;Else set expression value returned flag 2$: BIC #^C,R5 ;Clear all but valid TI.nnn bits 100$: TST OPRPND ;Is there still a operation pending ? BNE 64$ ;Branch if so, error (Bad expression) TST R5 ;Set condition codes based on EXPFLG ;R2 = Terminating character RETURN ;Return to next upper level 10$: CLR OPRPND ;Clear operation pending flag 20$: MOV R5,-(SP) ;Save EXPFLG's around GETNUM call CALL GETNUM ;Get a number - TINFLG returns in R0 MOV (SP)+,R5 ;Restore R5 TST R0 ;Check returned flags BEQ 60$ ;Branch if we got nothing BIS R0,R5 ;and save updated GETEXP flags 30$: CALL CHKOPR ;See if there's a trailing operator .ROM TST OPRPND ;Is there an operation pending? BEQ 50$ ;Branch if not 40$: MOV OPRPND,-(SP) ;Save it MOV R0,OPRPND ;Save the new operation, if any CALL @(SP)+ ;Execute the pending operation MOV OPRPND,R0 ;R0 = next operation or 0 50$: MOV R0,OPRPND ;Save the new operation, if any BEQ 60$ ;Branch if none. Check terminating character MOV @PARPTR,-(SP) ;Save the 1st operand BR 20$ ;Go get second operand and execute operation 60$: MOVB DBG$CH,R2 ;Get the terminating character CMPB #'-,R2 ;"-" after null term? BEQ 605$ ;Branch if so; make it "0-" CMPB #'+,R2 ;"+" after null term? BEQ 605$ ;Branch if so; make it "0+" CMPB #'<,R2 ;Check for other nest operator too BNE 100$ ;Branch if not, done 600$: INCB NSTLEV ;Bump the nesting depth CMPB NSTLEV,#MAXNST ;Have we exceeded MAXIMUM nesting depth? BLE 61$ ;Branch if not. ERROR STRING=MNDSTR ;Else give error message ; 605$: CALL CHKUNI ;Get effective unary operator BR 20$ ;Go process it 61$: TST OPRPND ;Is there a operation pending right now? BNE 63$ ;Branch if so, value already stacked. ;+ ; There was NO operation pending. Therefore R5 should be zero, ; indicating that no operands have been typed. This takes care ; of input like DBG>4<4>= ;- TST R5 ;Any expression flags set? BNE 64$ ;Branch if so, a definite error. MOV @PARPTR,-(SP) ;Save the current return value 63$: MOV OPRPND,-(SP) ;Save the pending operation BIS #EX.NST,R5 ;Set nested expression found flag MOV R5,-(SP) ;Save current expression flags CLR R5 ;Zap expression flags CALL 10$ ;Call ourselves recursivly! BEQ 64$ ;Branch if null expression typed CMPB #'>,R2 ;Check for other nest operator too BEQ 65$ ;Branch if so 64$: ERROR STRING=BXPSTR ;Else give error message ; 65$: BIS (SP)+,R5 ;Propagate the expression flags word DECB NSTLEV ;Decrement the nesting depth TST @SP ;Previous pending operation to perform ? BEQ 66$ ;Branch if not CALL @(SP)+ ;Execute the pending operation BR 67$ ;Get terminator, and check for operator ; At level 0, clean stack, get one character, and return to check OPR. 66$: BIT (SP)+,(SP)+ ;Clean the stack of old OPRPND and @PARPTR 67$: DBGFNC FUNCTION=READ_WAIT BR 30$ ;Go see if it's an operator - OPRPND=0 .DSABL LSB PSECT PURE_BYTE_DATA BXPSTR: ERRMSG WARNING,, MNDSTR: ERRMSG WARNING,, PSECT PURE_CODE .SBTTL GETNUM - Get a value from type in ;+ ; GETNUM ; ; R4 -> output/scratch buffer ; PARPTR -> word in which to store value ; ; CALL GETNUM ; ; R0 = Return flags (Documented in routine GETEXP) ; ; DBG$CH = Terminating character ;- .ENABL LSB DBGSYM GETNUM GETNUM: CLR R5 ;Initial flags = Zero CLR @PARPTR ;ZAP the current TERM value MOV R4,R1 ;R1 -> scratch buffer ADDR PSTAT0,R3 ;R3 -> First PREFIX operator state BR 90$ ;Begin state table TRAN$ LOW='_,HIGH='_,NEXT=RSTAT0,LABEL=PSTAT0 ADDR PSTAT1,R3 ;R3 -> Next PREFIX operator state BR 90$ ;Continue state table TRAN$ LOW='$,HIGH='$,NEXT=PSTAT2,LABEL=PSTAT1 BIS #,R5 ;Set hex number type in mode BR 70$ ;Continue scanning TRAN$ LOW='",HIGH='",NEXT=PSTAT3,LABEL=PSTAT2 CALL 30$ ;Get a character BR 10$ ;Get the second character and return TRAN$ LOW='',HIGH='',NEXT=PSTAT4,LABEL=PSTAT3 10$: BIS #EX.ASC,R5 ;Set ASCII type in mode CALL 30$ ;Get a character 20$: CLR R3 ;R3 = Null state BR 90$ ;Done. Go finish up 30$: DBGFNC FUNCTION=READ_WAIT_NOTRAN MOVB R2,(R1)+ ;Save it CLRB @R1 ;Zero the next byte RETURN ;Return to the caller TRAN$ LOW='%,HIGH='%,NEXT=PSTAT5,LABEL=PSTAT4 BIS #EX.R50,R5 ;Set RAD50 type in mode BR 60$ ;Continue scanning ; We now know that the "_" operator MUST have been a pre-fix ; for a internal register/symbol. We therefore set the EX.PRE ; flag saying a prefix was typed, and EX.SYM, saying that what ; follows must be a RAD50 six character symbol name. TRAN$ LOW='A,HIGH='Z,NEXT=PSTATF,LABEL=PSTAT5 BIS #EX.SYM!EX.PRE,R5 ;Set prefix operator and RAD50 symbol flg's BR 50$ ;Accept the character TRAN$ LABEL=PSTATF ;Failure transition from all PSTATn's SUB #2,BUFPTR ;BUFPTR -> "_" character in INBUF BR 20$ ;Setup null state, read "_" and die. TRAN$ LOW='A,HIGH='Z,NEXT=RSTAT1,LABEL=RSTAT0 BR 40$ ;RAD50 or symbol. Merge with common code TRAN$ LOW='$,HIGH='$,NEXT=RSTAT2,LABEL=RSTAT1 .BR 40$ 40$: BIT #EX.R50,R5 ;Working on a RAD50 string BNE 50$ ;Branch if so BIS #EX.SYM,R5 ;Set the symbol flag BR 50$ ;Go store character and set next state TRAN$ LOW='.,HIGH='.,NEXT=DSTAT1,LABEL=DSTAT0 BIT #EX.NUM,R5 ;Doing a number? BEQ 40$ ;Branch if not. "." is part of symbol BIT #EX.HEX,R5 ;Is it hex? BNE 120$ ;Branch if so, terminate on the "." (Error) BIS #EX.DEC,R5 ;Say that we're doing a decimal number BR 20$ ;Load R3 -> null state, and finish up. TRAN$ LOW='_,HIGH='_,LABEL=DSTAT1 BIT #EX.R50,R5 ;Doing _%xxx RAD50 input? _%A_B BEQ 120$ ;Branch if not, error. BR 50$ ;Else allow it in the RAD50 constant TRAN$ LOW='A,HIGH='F,NEXT=RSTAT2,LABEL=HSTAT0 SUB #7,R2 ;Part of hex number. Adjust its value BR 50$ ;Merge with common code TRAN$ LOW='0,HIGH='9,NEXT=DSTAT0,LABEL=RSTAT2 .BR 50$ 50$: MOVB R2,(R1)+ ;Save the character 60$: ADDR RSTAT0,R3 ;R3 -> 1st RAD50/symbol state BIT #,R5 ;Symbol or RAD50? BNE 90$ ;Branch if so, continue scanning ADDR RSTAT2,R3 ;Else must be number, R3 -> 1st number state BIS #EX.NUM,R5 ;Set the number flag BIT #EX.HEX,R5 ;Is it hex? BEQ 80$ ;Branch if not. Continue scanning 70$: ADDR HSTAT0,R3 ;R3 -> 1st hex state BR 90$ ;Go get next character 80$: CMPB R2,#'7 ;Decimal number? BLOS 90$ ;Branch if unknown BIS #EX.DEC,R5 ;Else set the flag 90$: DBGFNC FUNCTION=READ_WAIT ;R2 = Character read in 100$: TST R3 ;Any state table here to check? BEQ 120$ ;Branch if not. TST @R3 ;Any more characters to check? BEQ 120$ ;Branch if not. We're done here CMPB R2,@R3 ;Char GE low end of range? BLT 110$ ;Branch if not CMPB R2,1(R3) ;Char below high end? BGT 110$ ;Branch if not, next state please. .IF EQ, ;If I&D space support CMP (R3)+,(R3)+ ;Skip range and length .IFF; EQ, ;If I&D space support ADD 4(R3),R3 ;R3 -> Routine to handle *TRUE* value .ENDC; EQ, ;If I&D space support JMP @R3 ;Go to *TRUE* action routine 110$: MOV R3,R0 ;Save current -> in R0 ADD 2(R3),R3 ;R3 -> next set to check CMP R3,R0 ;Did we find another state? BNE 100$ ;Branch if so, go execute it. .BR 120$ 120$: CLRB @R1 ;Mark the end of any accumulated string BIT #EX.ASC,R5 ;ASCII constant input? BEQ 130$ ;Branch if not MOV @R4,@PARPTR ;Save the input from ( _"xx or _'x ) BR 220$ ;Return to caller 130$: BIT #EX.R50,R5 ;RAD50 constant input? BEQ 140$ ;Branch if not ADDR TMPSYM,R3 ;R3 -> temp area for RAD50 conversion MOV R3,R2 ;Copy it CALL GETNAM ;Convert string @R4 in ASCIZ to RAD50 @R2 MOV @R3,@PARPTR ;Save the first three RAD50 chars from (_%xxx) BR 220$ ;and return to caller 140$: BIT #EX.NUM,R5 ;Is it a number? BEQ 190$ ;Branch if not MOV R4,R1 ;Copy pointer to string CLR R2 ;Clear the accumulator 150$: MOVB (R1)+,R0 ;Get the character BEQ 180$ ;Branch if done SUB #'0,R0 ;Make it binary CLR -(SP) ;Put a zero on the stack BIT #EX.DEC,R5 ;Decimal? BEQ 160$ ;Branch if not MOV R2,@SP ;Store the accumulator value 160$: ASL R2 ;*2 ASL R2 ;*4 ADD (SP)+,R2 ;*5 or +0 ASL R2 ;*8 or *10 BIT #EX.HEX,R5 ;Hex? BEQ 170$ ;Branch if not ASL R2 ;*16 170$: ADD R0,R2 ;Add in new value BR 150$ ;Go get next char 180$: MOV R2,@PARPTR ;Save the value BR 220$ ;Return ; R2 = Terminating character from DBG$CH 190$: TST R5 ;Was any value typed ? BEQ 220$ ;Branch if not, just a terminating character BIT #EX.PRE,R5 ;Was a internal prefix operator found? BNE 200$ ;Branch if so, it's NOT a instruction! CALL CHKINS ;Assume it's an instruction BCC 220$ ;Branch if it's an instruction 200$: BIS #EX.SYM,R5 ;It's got to be a symbol CALL GETSYM ;See if it can be found CMPB DBG$CH,#': ;Is the command the (re)definition operator? BNE 210$ ;Branch if not CALLR SETSYM ;Else (re)define the symbol 210$: BIT #EX.FND,R5 ;Was the symbol found? BNE 220$ ;Branch if so, OK. CRLF ERROR STRING=UDSSTR,OUTBUF=YES ;Else give error message ; 220$: MOV R5,R0 ;Return flags in R0, set condition codes RETURN .DSABL LSB PSECT PURE_BYTE_DATA UDSSTR: ERRMSG WARNING,,,TERMINATOR=200 PSECT PURE_CODE .SBTTL CHKOPR - Determine if the current character(s) form an operator ;+ ; CHKOPR ; This routine looks at the terminating character in DBG$CH, ; and determines if it is a trailing operator. If so, the ; correct expression routine address is returned. ; ; DBG$CH = Terminating character ; ; CALL CHKOPR ; ; R0 -> Routine to handle pending operation ; R5 = R5!EX.OPR if operator found ; ; R0 = 0 if no operator was found. ; ; R1,R2 Destroyed ;- .ENABL LSB DBGSYM CHKOPR DBGSYM CHKUNI CHKUNI: CLR -(SP) ;Indicate no '-' has been seen BR 3$ ;Scan for '+' or '-' 1$: COM @SP ;Indicate that a '-' has been found 2$: DBGFNC FUNCTION=READ_WAIT ;Get next input character in DBG$CH 3$: CMPB DBG$CH,#'- ;Is character a '-'? BEQ 1$ ;Yes. Set indicators and continue CMPB DBG$CH,#'+ ;Is character a '+'? BEQ 2$ ;Yes. Set indicators and continue TST (SP)+ ;Is effective unary operator '+' or '-'? BEQ 4$ ;Branch if operation is equivalent to '+' MOV #7,R1 ;Set up R1 for '-' CALL 25$ ;Get address of operator routine in R0 MOV @SP,R1 ;Save return addr to make room for ; NEG operator address on stack MOV OPRPND,@SP ;Stack the addr of pending operation routine MOV R0,OPRPND ;Make NEG operator the pending operator MOV R1,-(SP) ;Restore return address 4$: DEC BUFPTR ;Adjust buffer -> to last input character RETURN CHKOPR: ADDR OPRTBL,SP ;@SP -> Operator table MOV @SP,R1 ;Copy table address 10$: MOVB (R1)+,R0 ;R0 = Operator to check for BEQ 30$ ;Branch if end of operator table - R0=0 CMPB DBG$CH,R0 ;Is this it? BNE 10$ ;Branch if not, loop for the next MOVB @R1,R0 ;Was it the divide operator "_" ? BNE 20$ ;Branch if not. ;R0 = 0 ! ; Since DIVIDE is the only binary operator using TWO characters, ; we must look ahead in the buffer and see if thats it. CMPB @BUFPTR,#'/ ;Was it really a divide operator ? BNE 30$ ;Branch if not, oper. not found. R0=0! INC BUFPTR ;Bump buffer -> to next character input 20$: SUB (SP)+,R1 ;R1 = Offset into expression routine list 25$: BIS #EX.OPR,R5 ;Set operator found flag .IF EQ,<$$$PIC> ;If not position independant code ASL R1 ;*2 for word offset MOV OPRADR-2(R1),R0 ;R0 -> Correct expresssion routine .IFF; EQ,<$$$PIC> ;If not position independant code DEC R1 ;Zero base the offset ASL R1 ;*2 for word offset ADDR OPRADR,SP ;@SP -> Expression handling table -2 ADD @SP,R1 ;R1 -> Correct table entry for operator MOV @R1,R0 ;R0 -> Non-relocated routine address ADD (SP)+,R0 ;Relocate routine address .ENDC; EQ,<$$$PIC> ;If not position independant code RETURN 30$: TST (SP)+ ;Clean the stack RETURN .DSABL LSB PSECT PURE_BYTE_DATA DBGSYM OPRTBL OPRTBL: .ASCIZ /+-*&!_/ PSECT PURE_DATA DBGSYM OPRADR OPRADR: .RSET .RWORD OPADD .RWORD OPSUB .RWORD OPMUL .RWORD OPAND .RWORD OPOR .RWORD OPDIV .RWORD OPNEG PSECT PURE_CODE .SBTTL OPMUL - Expression multiply routine ;+ ; OPMUL ; ; 2(SP) = 1st operand ; @PARPTR = 2nd operand ; ; CALL OPMUL ; ; @PARPTR = result ; R0, R1 modified ;- .ENABL LSB DBGSYM OPMUL OPMUL: MOV @PARPTR,R0 ;Get multiplier MUL 2(SP),R0 ;Multiply by multiplicand in 2(SP) MOV R1,R0 ;Save low order result BR 10$ ; .SBTTL OPDIV - Expression divide routine ;+ ; OPDIV ; ; 2(SP) = 1st operand ; @PARPTR = 2nd operand ; ; CALL OPDIV ; ; @PARPTR = result ; R0, R1 modified ;- DBGSYM OPDIV OPDIV: MOV 2(SP),R0 ;Get dividend MOV @PARPTR,R1 ;Get the divisor CALL DIV ;Divide it 10$: MOV R0,@PARPTR ;Save quotient/result MOV (SP)+,R0 ;Get return address TST (SP)+ ;Clean the stack BR 20$ ; .SBTTL OPAND - Expression logical AND routine ;+ ; OPAND ; ; 2(SP) = 1st operand ; @PARPTR = 2nd operand ; ; CALL OPAND ; ; @PARPTR = result ; R0, R1 modified ;- DBGSYM OPAND OPAND: MOV (SP)+,R0 ;Save return address COM @SP ;Make it an AND mask BIC (SP)+,@PARPTR ;AND it BR 20$ ; .SBTTL OPOR - Expression logical OR routine ;+ ; OPOR ; ; 2(SP) = 1st operand ; @PARPTR = 2nd operand ; ; CALL OPOR ; ; @PARPTR = result ; R0, R1 modified ;- DBGSYM OPOR OPOR: MOV (SP)+,R0 ;Save return address BIS (SP)+,@PARPTR ;OR in the value BR 20$ ; .SBTTL OPSUB - Expression subtraction routine ;+ ; OPSUB ; ; 2(SP) = 1st operand ; @PARPTR = 2nd operand ; ; CALL OPSUB ; ; @PARPTR = result ; R0, R1 modified ;- DBGSYM OPSUB OPSUB: NEG @PARPTR ;Negate the subtrahend .BR OPADD .SBTTL OPADD - Expression addition routine ;+ ; OPADD ; ; 2(SP) = 1st operand ; @PARPTR = 2nd operand ; ; CALL OPADD ; ; @PARPTR = result ; R0, R1 modified ;- DBGSYM OPADD OPADD: MOV (SP)+,R0 ;Save return address ADD (SP)+,@PARPTR ;Add/subtract the value 20$: MOV R0,-(SP) ;Put return address on stack RETURN .DSABL LSB .SBTTL .SBTTL .SBTTL DBGIIO - System-independant I/O routines for DBG ;Edit 00 .SBTTL .SBTTL .IIF NDF,L$$LST,.NLIST ;**************************************************************************** ;* * ;* COPYRIGHT (c) 1983, 1986 * ;* BY DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. * ;* ALL RIGHTS RESERVED. * ;* * ;* THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED * ;* ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE * ;* INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER * ;* COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY * ;* OTHER PERSON. NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY * ;* TRANSFERRED. * ;* * ;* THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE * ;* AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT * ;* CORPORATION. * ;* * ;* DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS * ;* SOFTWARE ON EQUIPMENT THAT IS NOT SUPPLIED BY DIGITAL. * ;* * ;**************************************************************************** ;++ ; Facility: DBG - A PDP-11 system independant symbolic debugger ; ; Authors: Don Bridgewater / Chuck Guldenschuh / Joe Worrall ; ; Created: Started by Chuck in 1980. ; ; Abstract: DBGIIO - System-independant I/O routines for DBG ; ; Externals Description ; --------- ----------- ; ; Edit Who Date Description of modification ; ---- --- ---- --------------------------- ;-- PSECT PURE_CODE .IIF NDF,L$$LST,.LIST .SBTTL DBG$ER - Print CRLF, string @R0, then return to COMMND ;+ ; DBG$ER ; ; This routine handles printing a one element error message ; and returning to the command parser. ; ;- DBGSYM DBG$ER DBG$ER: TST (PC)+ ;Clear carry - Don't print outbuf DBG$E1: SEC ; Set carry - Print outbuf too CRLF ;Output *C* MOV R0,-(SP) ;Save address of message to output *C* ROR -(SP) ;Save C-BIT TYPE STRING=PRESTR ;Prefix error message with ?DBG- ROL (SP)+ ;Restore C-BIT MOV (SP)+,R0 ;Restore message address to output *C* TYPE STRING=R0 ;Type string @R0 *C* BCC 10$ ;Branch if no OUTBUF to print TYPE OUTBUF ;Type outbuf, assumed .ASCIZ 10$: DECODE ERROR=YES ;Return to RESTRT PSECT PURE_BYTE_DATA PRESTR: .ASCII /?DBG-/<200> PSECT PURE_CODE .SBTTL DBG$DB - Dump OUTBUF to terminal W/CRLF .SBTTL DBG$D1 - Dump OUTBUF to terminal. W/NOCRLF ;+ ; DBG$DB ; DBG$D1 ; These two routines DUMP the buffer OUTBUF to the terminal, with or ; without a sequence. The user R4, is then re-loaded the ; address of OUTBUF ; ; OUTBUF = String to type ; ; TYPE OUTBUF (No crlf) ; TYPE OUTPUT,CRLF=YES (w/ crlf) ; ; USER R4 -> OUTBUF+0 ; OUTBUF reloaded with all <200>'s ;- .ENABL LSB DBGSYM DBG$DB DBGSYM DBG$D1 DBGSYM DBG$CB DBG$DB: CALL DBG$D1 ;Output and ZAP outbuf CRLF ;Output RETURN ;Return to caller DBG$CB: MOV R0,-(SP) ;Save USER R0 ADDR OUTBUF,R0 ;R0 -> Output buffer BR 5$ ;Do some common code DBG$D1: MOV R0,-(SP) ;Save USER R0 ADDR OUTBUF,R0 ;R0 -> Output/scratch buffer TYPE STRING=R0 ;Type it out 5$: MOV R0,-(SP) ;Save -> Outbuf MOV #OUTSIZ,R4 ;R4= # bytes in OUTBUF 10$: MOVB #<200>,(R0)+ ;Clear buffer to <200>'s SOB R4,10$ ;Loop for whole buffer MOV (SP)+,R4 ;USER R4 -> Outbuf MOV (SP)+,R0 ;Restore user R0 RETURN ;Return to caller .DSABL LSB .SBTTL DBG$RT - Read a line of input from terminal with terminators ;+ ; DBG$RT ; This routine calls GETCHR until a terminator is ; found that matchs a character in the terminator ; table "TERTAB". We allow line mode input of up ; to 80. decimal bytes, after which we error "LTL - Line too long". ; Scope and hardcopy runout support are also implemented ; in this routine. ; ; CALL DBG$RT ; ; All registers are volitle! ; INBUF has string + terminator + zero byte to end. ;- .ENABL LSB DBGSYM DBG$RT DBG$RT: CLR R5 ;Clear instruction found flag ADDR INBUF,R3 ;R3 -> INBUF .ROM MOV R3,BUFPTR ;Reset BUFPTR to point to -> INBUF CLRB -(R3) ;First byte is always ZERO for first rubout .ROM CLRB SNGFLG ;Clear ";S" pretend flag ADDR TERTAB,SP ;@SP -> Terminator table 10$: CALL GETCHR ;Get character in R0 20$: INC R3 ;Increment buffer position MOVB R0,@R3 ;Save the character CMPPIC INBUFE,R3 ;Are we at the end of the buffer? BLOS 180$ ;Branch if so, give error. CLRB 1(R3) ;Clear next input byte for .ASCIZ string TYPE R0 ;Echo character being typed in MOV @SP,R1 ;R1 -> Beginning of terminator table BNE 110$ ;Branch if not in terminating sequence 170$: TST (SP)+ ;Clean stack of TERTAB address RETURN ;Return to caller, line collected 110$: MOVB (R1)+,R2 ;R2 = Terminator to check for BGT 120$ ;Branch if another terminator to check BMI 10$ ;Branch if end of terminator table TST R5 ;Do we have a MACRO instruction here? BNE 10$ ;Branch if so, don't check for @ or # CMPB #'#,R0 ;Is it a #"Number sign"? BEQ 121$ ;Branch if so, could be a terminator MOVB #'@,R2 ;Check for @ sign too. 120$: CMPB R2,R0 ;Is this a terminator? BNE 110$ ;Branch if not ;+ ; At this point,we think we have a terminator, because of the ; type in sequence _"xx and _'x, we need to be sure, as these ; allow input of ANY ASCII characters, and we should NOT consider ; them to be terminators. Also the characters "'/% are NOT considered ; terminators IF preceded by a "_". ;- 121$: CMPB -1(R3),#'_ ;Was the last character a underscore? BNE 130$ ;Branch if not, not special case #999 SUB @SP,R1 ;R1 = position count into TERTAB CMP R1,#SPCTER ;Are we past the special _ characters? BLE 10$ ;Branch if not, NOT a terminator. 130$: MOV BUFPTR,R0 ;R0 -> First character in buffer 140$: CMPB (R0)+,#'_ ;Find first token of ASCII constant seq BEQ 150$ ;Branch if we have found first token. CMP R0,R3 ;Have we checked the whole buffer yet? BLO 140$ ;Branch if not, loop for token. ;+ ; We now know we have a terminator. One last special case exists! ; A SEMI-COLON terminator must have one more character following ; it. ;- CMPB @R3,# ;Was the TERMINATOR a SEMI-COLON? BNE 170$ ;Branch if not, don't get last character MOV R3,-(SP) ;Save position in buffer CALL GETCHR ;Get one more character from the terminal CMP (SP)+,R3 ;Did buffer position change - IE:(RUBOUT) BNE 20$ ;Branch if so, don't terminate! CLR @SP ;Else flag this as a DEFINITE terminator BR 20$ ;Stuff it, echo it, and return. 150$: MOV @SP,R1 ;R1 -> Beginning of terminator table CMPB @R0,(R1)+ ;Next character a ' ? BEQ 160$ ;Branch if so, found a ascii constant CMPB @R0,(R1)+ ;How about a " ? BNE 140$ ;Branch if not, next "_" please. INC R0 ;R0 -> ASCII constant typed CMP R0,R3 ;Was this the address we terminated on? BEQ 10$ ;Branch if so, NOT a terminator 160$: INC R0 ;R0 -> ASCII constant typed CMP R0,R3 ;Was this the address we terminated on? BEQ 10$ ;Branch if so, NOT a terminator BR 140$ ;Else look for first token again. ; Error message if line typed is > 79. characters 180$: ERROR STRING=LTLSTR ;Give LINE-TOO-LONG error message ; .DSABL LSB PSECT PURE_BYTE_DATA DBGSYM TERTAB ;+ ; TERTAB ; Special line input terminator table. ; ; Note: !'"/%! MUST be first and in that order !!! ;- TERTAB: .ASCII !'"/%! ;Characters not terminators prefixed by "_" SPCTER =.-TERTAB ;# special terminators .ASCIZ !;=:[^\|! ;General terminators .BYTE 200 ;Special post terminator LTLSTR: ERRMSG WARNING,, PSECT PURE_CODE .SBTTL DBG$GC - Get an input character - Upper-case only .SBTTL DBG$G1 - Get an input character - Upper/lower case ;+ ; DBG$GC ; DBG$G1 ; These routines gets an input character from the line mode buffer. ; the alternate routine DBG$G1 gets a character with no upper lower ; case translation. ; ; BUFPTR -> Next character in line-input buffer ; ; CALL DBG$G? ; ; DBG$CH,R2 = Input character ; ; ERRORS: Buffer empty. (Should NEVER happen) ;- .ENABL LSB DBGSYM DBG$GC DBGSYM DBG$G1 DBG$GC: TST (PC)+ ;Clear carry - Map lowercase to uppercase DBG$G1: SEC ; Set carry - Don't do translation MOVB @BUFPTR,R2 ;Any character in our buffer to return? BNE 10$ ;Branch if so, return it IOT ;Else internal error occured ! ;<-Fatal internal error> 10$: BCS 20$ ;Branch if no lower/upper convertion wanted CMPB R2,#'a ;See if character in lower-case range BLT 20$ ;Branch if lower - not lower case CMPB R2,#'z ;Check high range too BGT 20$ ;Branch if too high BICB #40,R2 ;Make it upper case. 20$: .ROM MOV R2,DBG$CH ;Save character here. INC BUFPTR ;Bump to next character RETURN ;Return it to caller, no-echo ! .DSABL LSB .SBTTL .SBTTL .SBTTL DBGIRG - Internal register block data for DBG ;Edit 00 .SBTTL .SBTTL .IIF NDF,L$$LST,.NLIST ;**************************************************************************** ;* * ;* COPYRIGHT (c) 1983, 1986 * ;* BY DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. * ;* ALL RIGHTS RESERVED. * ;* * ;* THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED * ;* ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE * ;* INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER * ;* COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY * ;* OTHER PERSON. NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY * ;* TRANSFERRED. * ;* * ;* THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE * ;* AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT * ;* CORPORATION. * ;* * ;* DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS * ;* SOFTWARE ON EQUIPMENT THAT IS NOT SUPPLIED BY DIGITAL. * ;* * ;**************************************************************************** ;++ ; Facility: DBG - A PDP-11 system independant symbolic debugger ; ; Author: Joe Worrall ; ; Created: 18-Dec-81 ; ; Abstract: DBGIRG - Internal register block data for DBG ; ; Externals Description ; --------- ----------- ; ; Edit Who Date Description of modification ; ---- --- ---- --------------------------- ;-- PSECT PURE_CODE .IIF NDF,L$$LST,.LIST .SBTTL IREGS - Start of internal register block data ;+ ; IREGS ; This block of data, between IREGS and IREGE is here to keep it ; in ONE place, so that DBG may determine WHEN a internal register ; is accessed, and to prevent a user from accidently modifying DBG ; itself. Be VERY carefull about adding or removing data from this ; section. ;- PSECT DATA DBGSYM IREGS DBGSYM MREGE DBGSYM IREGE DBGSYM ADROFF IREGS: ...UR0: .WORD 0 ;User R0 ...UR1: .WORD 0 ;User R1 ...UR2: .WORD 0 ;User R2 ...UR3: .WORD 0 ;User R3 ...UR4: .WORD 0 ;User R4 ...UR5: .WORD 0 ;User R5 ...USP: .WORD 0 ;User SP ...UPC: .WORD 0 ;User PC ...UPS: .WORD 0 ;User PS MREGE: ;End of MACHINE REGISTER BLOCK ;LOW: .WORD 0 ;Low search limit ;HIGH: .WORD 177776 ;High search limit ;SRHMSK: .WORD 177777 ;Search mask ADROFF: .WORD 1000 ;Max offset to display with address symbol DATOFF: .WORD 100 ;Max offset to display with data symbol .IF NE, ;If RSX/SOFT DBGSYM DBG$EF DBGSYM SSTSTK DBG$EF: .WORD 28. ;Default EFN to use. SSTSTK: .BLKW0 3. ;Top three words of stack on user TRAPS .ENDC; NE, ;If RSX/SOFT .SBTTL IREGE - End of internal register block data IREGE: .BLKW 1 ;Internal register boundry buffer word ;+ ; -- End of internal register block only section -- ;- DBGSYM MAXIOF .IF NE, ;If RSX/SOFT MAXIOF = <<3.*2>-2>+1 ;Maximum I-REG offset = _SSTSTK .IFF; NE, ;If RSX/SOFT MAXIOF = 1 ;Maximum I-REG offset = R0+1 .ENDC; NE, ;If RSX/SOFT PSECT PURE_CODE .SBTTL .SBTTL .SBTTL DBGITR - Internal TRAP dispatcher for DBG ;Edit 00 .SBTTL .SBTTL .IIF NDF,L$$LST,.NLIST ;**************************************************************************** ;* * ;* COPYRIGHT (c) 1983, 1986 * ;* BY DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. * ;* ALL RIGHTS RESERVED. * ;* * ;* THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED * ;* ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE * ;* INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER * ;* COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY * ;* OTHER PERSON. NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY * ;* TRANSFERRED. * ;* * ;* THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE * ;* AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT * ;* CORPORATION. * ;* * ;* DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS * ;* SOFTWARE ON EQUIPMENT THAT IS NOT SUPPLIED BY DIGITAL. * ;* * ;**************************************************************************** ;++ ; Facility: DBG - A PDP-11 system independant symbolic debugger ; ; Authors: Don Bridgewater / Chuck Guldenschuh / Joe Worrall ; ; Created: Started by Chuck in 1980. ; ; Abstract: DBGITR - Internal TRAP dispatcher for DBG ; ; Externals Description ; --------- ----------- ; ; Edit Who Date Description of modification ; ---- --- ---- --------------------------- ;-- PSECT PURE_CODE .IIF NDF,L$$LST,.LIST .SBTTL INTTRP - Internal TRAP dispatch ;+ ; INTTRP ; This routine gets control when a TRAP instruction occurs, and ; DBG is in control. Many functions are provided and done by a ; single TRAP instruction. This is one of the biggest code savers ; implemented for DBG. ; ; TRAP NNN ;Internal TRAP ; ; (SP) -> Trap instruction + 2 that was executed ; 2(SP) -> PSW ; ; Function completed, and condition codes set, ; return is to TRAP instruction +2 ; ; TRAP formats: ; ; Low byte Action ; -------- ------ ; ; IF TRAP&200 = 0 THEN ; ; The following codes leave the condition codes and registers alone ; ; 0 - 177 Types the character given in the low byte of the ; trap instruction. ; ; ELSE IF TRAP&200 <> 0 THEN ; ; Output ASCII string -> @R0 (200) ; Get character. Upper case only (201) ; Get character w/nowait mode I/O (202) ; Return to COMMND (203) ; Print ,string @R0, goto commnd (204) ; Dump OUTBUF to terminal W/ (205) ; Dump OUTBUF to terminal W/ (206) ; Do DBG$ER, print outbuf, next commnd. (207) ; Return to COMMND, though RESTRT (210) ; Get character. Upper/lower case (211) ; Clear OUTBUF, re-load R4 (212) ; Output low byte in user R0 (240) ; Output a (300) ; Output both bytes in user R0 (340) ; ;- .ENABL LSB DBGSYM INTTRP INTTRP: .IF NE, ;If HARD I/O MOV @SP,-(SP) ;Duplicate return address SUB #2,@SP ;Point to TRAP instruction .IF NE, ;If debugger out of address space MFPI @(SP)+ ;@SP = Subject TRAP instruction ;;; MOV 4(SP),@#PS ;Set correct previous mode bits in PS ;;; MOVB (SP)+,-(SP) ;Sign extend and get the low byte TSTB @SP ;Set condition codes based on trap number type .IFF; NE, ;If debugger out of address space MOVB @(SP)+,-(SP) ;@SP = Low byte of subject trap instruction ;and set condition codes based on trap number .ENDC; NE, ;If debugger out of address space .IFF; NE, ;If HARD I/O .IF NE, ;If RT-11 MOV @SP,-(SP) ;Duplicate return address SUB #2,@SP ;Point to TRAP instruction MOVB @(SP)+,-(SP) ;@SP = Low byte of subject trap instruction ;and set condition codes based on trap number .IFF; NE, ;If RT-11 .IF NE, ;If RSX ;@SP = Low byte of trap instruction * 2 ASR @SP ;@SP = Low byte of trap instruction ;;; MOVB (SP)+,-(SP) ;Sign extend and get the low byte TSTB @SP ;Set condition codes based on trap number type .ENDC; NE, ;If RSX .ENDC; NE, ;If RT-11 .ENDC; NE, ;If HARD I/O BMI 10$ ;Branch if not one character output - ie: ;TRAP's greater than 177 MOVB @SP,DBG$CO ;Move the character to DBG's output buffer BR 30$ ; and go do it! 10$: BITB #^C<340>,@SP ;Output character(s) instruction given ? BNE 40$ ;Branch if not, special TRAP's function CMPB @SP,#<300> ;Special Trap ? BNE 15$ ;Branch if not CLRB DBG$CO ;Setup for output string ;Next BITB will BEQ and print null string. 15$: BITB #<40>,@SP ;Output contents of R0? BEQ 30$ ;Branch if not, output string @R0 MOVB R0,DBG$CO ;First byte to output ASLB @SP ;Output two bytes? BPL 30$ ;Branch if not MOV R0,DBG$CO ;Output both bytes! 30$: ADDR 999$,SP,PUSH=NO ;Cram address of 999$ on stack CALLR DBG$SO ;Output string @R0, return to RTI ;+ ; The TRAP was either: ; ; TRAP 201-237 ; or ; TRAP 301-337 ;- 40$: BIC #<177640>,@SP ;Leave only 01-37 or 101-137 BIT #<100>,@SP ;Upper dispatch range set? BEQ 50$ ;Branch if not SUB #101-40,@SP ;Make range 40-77 50$: CMP @SP,#HI$TRP ;Invalid internal trap ? BLE 60$ ;Branch if not, OK. IOT ;Else internal DBG error. Escape with IOT ;<-Fatal internal error> ; Range of @SP is now ( 01 - HI$TRP ) 60$: ASL @SP ;Word index for table ADDR TRPDIS-2,SP,ADD ;Add location of Jump table PICLY MOV @(SP)+,-(SP) ;@SP -> Non-relocated routine address to call ADDR TRPDIS,SP,ADD,COND=$$$PIC ;@SP -> Relocated routine address .ROM MOVB 4(SP),CBTFLG ;Save low byte of PSW here for MUNGING CALL @(SP)+ ;Call correct routine MOVB CBTFLG,2(SP) ;Restore low byte of user PSW. 999$: RTI ;Return from the TRAP .DSABL LSB PSECT PURE_DATA DBGSYM TRPDIS DBGSYM HI$TRP TRPDIS: .RSET .RWORD DBG$GC ;Get character. Upper case only (201) .RWORD DBG$CI ;Get character w/nowait mode I/O (202) .RWORD COMMND ;Return to COMMND (203) .RWORD DBG$ER ;Print ,string @R0, goto commnd (204) .RWORD DBG$DB ;Dump OUTBUF to terminal W/ (205) .RWORD DBG$D1 ;Dump OUTBUF to terminal W/ (206) .RWORD DBG$E1 ;Do DBG$ER, print outbuf, next commnd. (207) .RWORD RESTRT ;Return to COMMND, though RESTRT (210) .RWORD DBG$G1 ;Get character. Upper/lower case (211) .RWORD DBG$CB ;Clear OUTBUF, re-load R4 (212) HI$TRP = <.-TRPDIS>/2 PSECT PURE_CODE .SBTTL .SBTTL .SBTTL DBGGRH - Graphics register display routines for DBG ;Edit 00 .SBTTL .SBTTL .IIF NDF,L$$LST,.NLIST ;**************************************************************************** ;* * ;* COPYRIGHT (c) 1983, 1986 * ;* BY DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. * ;* ALL RIGHTS RESERVED. * ;* * ;* THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED * ;* ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE * ;* INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER * ;* COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY * ;* OTHER PERSON. NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY * ;* TRANSFERRED. * ;* * ;* THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE * ;* AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT * ;* CORPORATION. * ;* * ;* DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS * ;* SOFTWARE ON EQUIPMENT THAT IS NOT SUPPLIED BY DIGITAL. * ;* * ;**************************************************************************** ;++ ; Facility: DBG - A PDP-11 system independant symbolic debugger ; ; Authors: Don Bridgewater / Chuck Guldenschuh / Joe Worrall ; ; Created: Started by Chuck in 1980. ; ; Abstract: DBGGRH - Graphics register display routines for DBG ; ; Externals Description ; --------- ----------- ; ; Edit Who Date Description of modification ; ---- --- ---- --------------------------- ;-- PSECT PURE_CODE .IIF NDF,L$$LST,.LIST .IF NE, ;If graphics register display support .SBTTL DBG$TI - Terminal initialization ;+ ; DBG$TI ; This routine outputs the register display header, if the terminal is in ; register display mode. In all other cases, it is a NOP. ; ; CALL DBG$TI ; ; R0 modified ;- DBGSYM DBG$TI DBG$TI: BIT #TO.GPH,TYPMOD ;Are we in register display mode? BEQ 70$ ;Branch if not. No initialization to do TYPE STRING=CLRSCR ;Clear screen ;.IF EQ, ADDR DRAW,R1 ;R1 -> parameter table CLR -(SP) ;Flag first time thru loop TYPE STRING=GPHON ;Turn on VT100 graphics character set 10$: MOVB (R1)+,ROW ;Move the row number to the positioning cmd BEQ 40$ ;Branch if done MOVB (R1)+,COL ;Move in column number TYPE STRING=POSIT1 ;Position the cursor MOV #6,R2 ;Loop for number of regions to print CLR R3 ;Clear register counter MOVB (R1)+,R0 ;Get first character of line TYPE R0 ;Output the character 20$: TYPE STRING=Q5 ;Output some lines MOV Q5,R0 ;Assume this is not first time thru TST @SP ;Is it? BNE 30$ ;Branch if not MOV R3,R0 ;Get the register number SWAB R0 ;Put it in the high byte ADD #<'0*256.+'R>,R0 ;Make it ASCII and put in a "R" 30$: TYPE R0+R0 ;Output 2 characters TYPE STRING=Q5 ;Output some more lines MOVB @R1,R0 ;Get the intersection character TYPE R0 ;Type it INC R3 ;Bump the register counter SOB R2,20$ ;Do all of them INC R1 ;Bump R1 to end of line character MOVB (R1)+,R0 ;Get the character SWAB R0 ;Put it in the high byte BISB #8.,R0 ;Put in a backspace TYPE R0+R0 ;Type it INC @SP ;Flag that we've done the first line BR 10$ ;Try the next line 40$: TST (SP)+ ;Clean off the stack MOV #'2,R1 ;R1 = row positioner character MOV #3,R2 ;R2 = line loop count 50$: MOV #6,R3 ;R3 = region loop counter MOVB R1,ROW ;Setup row position MOVB #'1,COL ;Set up column position TYPE STRING=POSIT1 ;Position the cursor TYPE CHAR='x ;Put in vertical line 60$: TYPE STRING=LIN234 ;Output the line SOB R3,60$ ;Do it some more INC R1 ;Bump to next row SOB R2,50$ ;Loop for next line TYPE STRING=PCLINE ;Output the PC/stack line ;.ENDC; EQ, 70$: ADDR ...UR0,R0 ;R0 -> user's registers ADDR SAVTBL,R2 ;R2 -> saved copy for screen updates MOV #8.,R1 ;R1 = loop count for registers 80$: MOV @R0,@R2 ;Move in user's current value COM @R2 ; and make it different CMP (R0)+,(R2)+ ;Skip to next value SOB R1,80$ ;Loop MOV #4,R1 ;R1 = loop count for TOS MOV ...USP,R5 ;R5 -> user's stack 90$: .IF NE, ;If I&D support MOV TYPMOD,-(SP) ;Save old TYPMOD BIS #TO.DSP,TYPMOD ;Force D-SPACE mode .IFTF; NE, ;If I&D support GET @R2,IREGS=NO,NOERROR=95$ ;Get a usr stack word ;*I/D* 95$: ;C-BIT set if BAD address ;*C-BIT* .IFT; NE, ;If I&D support MOV (SP)+,TYPMOD ;Restore saved TYPMOD flags .ENDC; NE, ;If I&D support COM (R2)+ ; and make it different SOB R1,90$ ;Loop BIS #TO.INI,DTYPMD ;Remember that we've been initialized BIS #TO.INI,TYPMOD ;Set initialized flag in BOTH flag words CLRB OPNFLG ;Force a new prompt RETURN .SBTTL DBG$TU - Terminal update ;+ ; DBG$TU ; This routine updates the register display if it is turned on. ; ; R4 -> Output scratch buffer ; ; CALL DBG$TU ; ;- DBGSYM DBG$TU DBG$TU: JSR R3,SAVVR ;Save R0-R3 MOV R5,-(SP) ;Save R5 BIT #TO.GPH,TYPMOD ;Are we in graphics mode? BNE 5$ ;Branch if so, OK BIT #TO.INI,TYPMOD ;Did we get initialized before? BEQ 999$ ;Branch if not, no need to do cleanup TYPE STRING=CLNUP ;Spit out cleanup string BIC #TO.INI,TYPMOD ;Flag that cleanup has been done. BIC #TO.INI,DTYPMD ;Clear the other copy too. BR 999$ ;and exit 5$: BIT #TO.INI,TYPMOD ;Have we been initialized? BNE 10$ ;Branch if so CALL DBG$TI ;Initialize the screen 10$: ;.IF EQ, TYPE STRING=SAVCUR ;Save the cursor position ADDR SAVTBL,R2 ;R2 -> saved data ADDR FMTABL,R3 ;R3 -> output formatting data ADDR ...UR0,R5 ;R5 -> user's registers MOV #8.,R1 ;R1 = loop count for registers 20$: CMP @R5,@R2 ;Has this register changed? BEQ 30$ ;Branch if not MOV @R5,@R2 ;Store new value CALL UPDREG ;Update the display 30$: CMP (R2)+,(R5)+ ;Skip to next register ADD #,R3 ;Skip to the next format entry CMP R1,#2 ;Doing PC or SP? BGT 35$ ;Branch if not SUB #,R3 ;SP and PC entries are smaller 35$: SOB R1,20$ ;Do all registers MOV #4,R1 ;R1 = loop count for TOS display MOV ...USP,R5 ;R5 -> user's stack 40$: .IF NE, ;If I&D support MOV TYPMOD,-(SP) ;Save old TYPMOD BIS #TO.DSP,TYPMOD ;Force D-SPACE mode .IFTF; NE, ;If I&D support GET R0,IREGS=NO,NOERROR=45$ ;Get a usr stack word ;*I/D* 45$: ;C-BIT set if BAD address ;*C-BIT* BCC 46$ ;Branch if GET was OK CLR R0 ;Else VALUE=0 46$: .IFT; NE, ;If I&D support MOV (SP)+,TYPMOD ;Restore saved TYPMOD flags .ENDC; NE, ;If I&D support CMP R0,@R2 ;Has it changed? BEQ 50$ ;Branch if not MOV R0,@R2 ;Save the new value CALL UPDREG ;Update the display 50$: TST (R2)+ ;Skip to next old register ADD #FMT.SZ,R3 ;Skip to next entry SOB R1,40$ ;Loop TYPE STRING=RESCUR ;Restore the cursor ;.ENDC; EQ, 999$: MOV (SP)+,R5 ;Restore R5 RETURN UPDREG: JSR R3,SAVVR ;Save R0-R3 CALL NOBIN ;Don't allow CRADIX to be BINARY(Coroutine) 1$: CALL POSIT ;Generate the cursor positioning string MOV R4,-(SP) ;Save this in case field is left justified MOVB (R3)+,R0 ;Get number of blanks to store 10$: MOVB #,(R4)+ ;Store the blank filler SOB R0,10$ ; MOVB (R3)+,R0 ;Get the number of lead zero characters BEQ 30$ ;Branch if none. MOVB #'0,R1 ;Assume the fill character is "0" CMPB #10.,CRADIX ;Current radix = 10 BGE 25$ ;Branch if radix = 8 or 10 ASR R0 ;HACK!! R0 = 7 or 4. We want 5 or 3 ADC R0 ;ASR give 3 w/C-bit or 2. ADC gives 4 or 2 INC R0 ;INC gives 5 or 3 ADD #2,@SP ;Fix starting point for output 25$: BNE 20$ ;Branch if radix = 8 or 16 CMP R0,#4 ;Byte mode output? BEQ 20$ ;Branch if so MOVB #,R1 ;Use a space for fill if word mode 20$: MOVB R0,LEDFIL ;Save lead count. MOVB R1,LEDCHR ;Save the lead character 30$: MOV (SP)+,R4 ;Restore R4 .IF EQ,<$$$PIC> ;If position independent code JSR PC,@(R3)+ ;Call the output routine .IFF; EQ,<$$$PIC> ;If position independent code MOV (R3)+,-(SP) ;@SP -> Non-relocated routine address to call ADDR FMTABL,SP,ADD ;@SP -> Relocated routine address to call CALL @(SP)+ ;Call the output routine .ENDC; EQ,<$$$PIC> ;If position independent code TST (R3)+ ;Is there more formatting for this register? BNE 1$ ;Branch if so. Go do it TYPE OUTBUF ;Output the update RETURN POSIT: ;.IF EQ, MOVB CRADIX,-(SP) ;Save current radix MOVB #10.,CRADIX ;VT100 uses decimal numbers MOVB #,(R4)+ ;Store an MOVB #'[,(R4)+ ;And an "[" MOVB (R3)+,R1 ;Get the row position CALL DCD.IO ;Put it in the buffer MOVB #SEMI,(R4)+ ;Put in the separator MOVB (R3)+,R1 ;Get the column position CALL DCD.IO ;Put it the buffer MOVB #'H,(R4)+ ;Put in the terminator MOVB (SP)+,CRADIX ;Restore current radix ;.ENDC; EQ, RETURN ;.IF EQ, .NLIST BEX PSECT DATA SAVTBL: .BLKW 12. ;Register, TOS save area PSECT PURE_DATA FMT.SZ = 10 FMTABL: .RSET ..C = 0 .REPT 6 .BYTE 2, ..C+8., 6, 7 .RWORD WDOUT .WORD 1 .BYTE 3, ..C+7., 7, 4 .RWORD BYOUT .WORD 1 .BYTE 4, ..C+2., 7, 0 .RWORD ASOUT .WORD 1 .BYTE 4, ..C+10.,4, 0 .RWORD R5OUT .WORD 0 ..C = ..C + 13. .ENDR ..C = 0 ..A = -13. .REPT 6 .BYTE 6, ..C-..A+8., 6, 7 .RWORD WDOUT .WORD 0 ..A = -..A .IIF LT ..A, ..A=0 ..C = ..C + 13. .ENDR PSECT BYTE_DATA POSIT1: .ASCII \[\ ;Cursor positioning command ROW: .ASCII \0;\ COL: .ASCII \0H\<200> PSECT PURE_BYTE_DATA CLRSCR: ;Screen initialization sequence .ASCII \<\\[?6l\\[H\\[J\\[8;24r\ .ASCII \[8;1H\\7\ .BYTE 200 GPHON: .ASCII \(0\<200> SAVCUR: .ASCII \7\<200> ;Save cursor. RESCUR: .ASCII \8\<200> ;Restore cursor. DRAW: .ASCII \11lwk\ ;Line drawing parameters .ASCII \51tnu\ .ASCII \71mvj\ .BYTE 0 PCLINE: .ASCII \[6;1HxPC = xSP = x(SP) = x\ .ASCII \2(SP)= x4(SP)= x6(SP)= x\\[8;1H\ .ASCII \(B\<200> LIN234: .ASCII \ x\<200> CLNUP: .ASCII \7\\[0;24r\\8\<200> PSECT PURE_DATA Q5: .ASCII \qqqqq\<200> ;NOTE: Must start on word boundary .LIST BEX PSECT PURE_CODE ;.ENDC; EQ, .ENABL LSB WDOUT: MOV @R2,R1 ;Get the word to output BR 10$ ;Merge for call to DCDIO1 BYOUT: MOV R0,-(SP) ;Save lead 0 count MOV @R2,R1 ;Get the byte to output BIC #^C<377>,R1 ;Make it truly a byte CALL DCDIO1 ;Output it MOVB #,(R4)+ ;Store the "," MOVB (SP)+,LEDFIL ;Restore the lead fill count MOVB 1(R2),R1 ;Get the high byte BIC #^C<377>,R1 ;Make it truly a byte 10$: CALLR DCDIO1 ;Output it and return to caller ASOUT: MOV TYPMOD,-(SP) ;Save the type-out mode flag BIC #TO.BYT,TYPMOD ;Make sure we do words MOV @R2,R1 ;Get the word to output CALL ASCOU1 ;Output it as ASCII CMPB (R4)+,(R4)+ ;Skip over a couple of blanks to wipe prev cnts MOV (SP)+,TYPMOD ;Restore the type-out mode flag RETURN R5OUT: MOV @R2,R1 ;Get the word to output CALLR R50OU1 ;Output it as RAD50 and return to caller .DSABL LSB .ENDC; NE, ;If graphics register display support .SBTTL .SBTTL .SBTTL DBGRLC - PIC relocation routine for DBG ;Edit 00 .SBTTL .SBTTL .IIF NDF,L$$LST,.NLIST ;**************************************************************************** ;* * ;* COPYRIGHT (c) 1983, 1986 * ;* BY DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. * ;* ALL RIGHTS RESERVED. * ;* * ;* THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED * ;* ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE * ;* INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER * ;* COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY * ;* OTHER PERSON. NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY * ;* TRANSFERRED. * ;* * ;* THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE * ;* AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT * ;* CORPORATION. * ;* * ;* DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS * ;* SOFTWARE ON EQUIPMENT THAT IS NOT SUPPLIED BY DIGITAL. * ;* * ;**************************************************************************** ;++ ; Facility: DBG - A PDP-11 system independant symbolic debugger ; ; Authors: Don Bridgewater / Chuck Guldenschuh / Joe Worrall ; ; Created: Started by Chuck in 1980. ; ; Abstract: DBGRLC - PIC relocation routine for DBG ; ; Externals Description ; --------- ----------- ; ; Edit Who Date Description of modification ; ---- --- ---- --------------------------- ;-- PSECT PURE_CODE .IIF NDF,L$$LST,.LIST .IF NE,<$$$PIC> ;If position independant code .SBTTL RELOC - Relocate non-relocatable data in DBG ;+ ; RELOC ; This routine relocates all data that is references instruction ; or data that may have been moved via relocation. Currently, ; relocation is only supported under RT-11, but code here is ; included for RSX-11, for future special applications. ;- DBGSYM RELOC RELOC: .ROM INCB FIRST,VALUE=-1 ;Is this the first time in? BGT 99$ ;Branch if not, don't repeat thyself ; Relocate permenent symbol table address entries ADDR DBG$PS,R0 ;R0 -> Permenent symbol table start MOV R0,R1 ;Copy start of table MOV #..SYMS/2,R2 ;R2 = # permenent symbols 1$: ADD R1,SY.ADR(R0) ;Make it a actual address ADD #SY.SIZ,R0 ;R0 -> Next entry SOB R2,1$ ;Loop for all perm entries .IF EQ,<&> ;If .NOT. RT/HARD ADDR SSTVEC,R2 ;R2 -> SST table for relocation MOV R2,R0 ;Copy table start address MOV #8.,R1 ;R1 = Cound of trap vectors in table 10$: TSTB (R0)+ ;Anything to relocate here? BNE 20$ ;Branch if so INC R0 ;R0 -> Next trap to look at BR 40$ ;Loop for next 20$: TSTB (R0)+ ;Is there a doubleword save area? BEQ 30$ ;Branch if not R0 ->.RWORD,.RWORD BIT (R0)+,(R0)+ ;Move to .RWORD pair 30$: ADD R2,(R0)+ ;Relocate the doubleword ADD R2,(R0)+ ;... 40$: SOB R1,10$ ;Loop for next .ENDC; EQ,<&> ;If .NOT. RT/HARD ; Relocate DBGMEM's special memory access table ADDR MEMTBL,R0 ;R0 -> Table start MOV R0,R1 ;Copy start of table 50$: TST @R0 ;Last entry? BEQ 99$ ;Branch if so, done. ADD R1,MT.ADR(R0) ;Relocate .RWORD item ADD #MT.SIZ,R0 ;R0 -> Next entry BR 50$ ;Loop 99$: RETURN ;Return to the caller .ENDC; NE,<$$$PIC> ;If position independant code .SBTTL .SBTTL .SBTTL DBGTRP - Trap Handlers for DBG ;Edit Level 00 .SBTTL .SBTTL .IIF NDF,L$$LST,.NLIST ;**************************************************************************** ;* * ;* COPYRIGHT (c) 1983, 1986 * ;* BY DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. * ;* ALL RIGHTS RESERVED. * ;* * ;* THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED * ;* ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE * ;* INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER * ;* COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY * ;* OTHER PERSON. NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY * ;* TRANSFERRED. * ;* * ;* THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE * ;* AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT * ;* CORPORATION. * ;* * ;* DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS * ;* SOFTWARE ON EQUIPMENT THAT IS NOT SUPPLIED BY DIGITAL. * ;* * ;**************************************************************************** ;++ ; Facility: DBG - A PDP-11 system independant symbolic debugger ; ; Authors: Don Bridgewater / Chuck Guldenschuh / Joe Worrall ; ; Created: Started by Chuck in 1980. ; ; Abstract: DBGTRP - Trap Handlers for DBG ; ; Externals Description ; --------- ----------- ; ; Edit Who Date Description of modification ; ---- --- ---- --------------------------- ;-- PSECT PURE_CODE .IIF NDF,L$$LST,.LIST .SBTTL TRAP4 - Handle traps to 4 .ENABL LSB DBGSYM TRAP4 TRAP4: MOV #"T4,ERRMSG ;Setup error message BR 15$ ;Join common code .SBTTL TRAP20 - Handle traps to 20 (IOT) DBGSYM TRAP20 TRAP20: MOV #"IO,ERRMSG ;Setup error message BR 10$ ;Join common code .IF NE, ;If RSX .SBTTL TRAP24 - Handle FPP traps @244 (11/40 FIS) DBGSYM TRAP24 TRAP24: MOV #"FP,ERRMSG ;FIS error BR 10$ ;Join common code .SBTTL TRAP30 - Handle unknown EMT traps DBGSYM TRAP30 TRAP30: .COND MOV (SP)+,SSTSTK+0,COND= ;Save Top of stack MOV #"EM,ERRMSG ;Setup error message BR 10$ ;Join common code .ENDC; NE, ;If RSX .IF NE,<!!> ;If RSX or RT/SD: or RT/RSTS .SBTTL TRAP25 - Handle traps though MMUVEC @250 DBGSYM TRAP25 TRAP25: .IF NE,<!> ;If MMU support BIC #160000,@#SR0 ;Unfreeze MMU segment unit .ENDC; NE,<!> ;If MMU support .COND MOV (SP)+,SSTSTK+4,COND= ;SR1 to $E+4 .COND MOV (SP)+,SSTSTK+2,COND= ;SR2 to $E+2 .COND MOV (SP)+,SSTSTK+0,COND= ;SR0 to $E MOV #"MP,ERRMSG ;Setup error message BR 20$ ;Join common code .ENDC; NE,<!!> ;If RSX or RT/SD: or RT/RSTS .IF NE, ;If RSTS/SOFT .SBTTL TRAPCC - Handle control-C traps on RSTS/E DBGSYM TRAPCC TRAPCC: MOV #"CC,ERRMSG ;Setup error message BR 10$ ;Merge with common code .ENDC; NE, ;If RSTS/SOFT .SBTTL TRAP34 - Handle traps to 34 (TRAP) DBGSYM TRAP34 TRAP34: .COND MOV (SP)+,SSTSTK+0,COND= ;Save Top of stack MOV #"TR,ERRMSG ;Setup error message 10$: CLRB BPTNUM ;Flag ";P" is OK. BR TRAP14 ;Join common code .SBTTL TRAP10 - Handle traps to 10 DBGSYM TRAP10 DBGSYM TRAPSO TRAP10: MOV #"T1,ERRMSG ;Setup error message 15$: .IF EQ, ;If NOT RSX-11M Hard I/O mode CMP SP,#400 ;Stack overflow? BLOS TRAPSO ;Branch if so, flag it as such! .ENDC; EQ, ;If NOT RSX-11M Hard I/O mode .COND CALL TRPCHK,COND= ;Call RT-11 trap checking routine ;If we return, we know that TRAP4/10 ;could not be fielded to the user. BR 20$ ;Merge with common code TRAPSO: MOV #"SO,ERRMSG ;Flag stack overflow .BR 20$ ;Merge with common code 20$: MOVB #-1,BPTNUM ;Flag no proceeding beyond this point .BR TRAP14 ;Join common code .DSABL LSB .SBTTL TRAP14 - Handle breakpoint traps ;+ ; TRAP14 ; This routine can be entered several ways: ; ; 1) User set BPT ; 2) T-bit trap when ; a) in single step mode ; b) proceeding from a BPT ; 3) Random BPT encountered (?BE error) ; 4) Traps to 4 or 10 (ERRMSG <> 0) ;- .ENABL LSB DBGSYM TRAP14 TRAP14: MOV (SP)+,...UPC ;Save the trap PC MOV (SP)+,...UPS ;Save the trap PS CALL SAVURG ;Save rest of user registers ;R5 -> User PC from trap ;R4 -> Output buffer CALL DBG$CC ;Reset CTRL/O ADDR BPTABL,R2 ;R2 -> BPTABL .ROM TST ERRMSG ;AST or SST other than BPT get us here? BNE 80$ ;Branch if so TST PROSNG ;Proceeding from BPT or single step? BEQ 20$ ;Branch if not .ASSUME PROCED EQ .ASSUME PROSNG EQ PROCED .ROM CMP R5,TRPC ;PC different than last time BEQ 10$ ;Branch if not. Try again TSTB PROCED ;Proceeding after BPT? BEQ 20$ ;Branch if not CLRB PROCED ;Clear flag 10$: CALLR RETUSR ;Return to user @R5 20$: CLR R3 ;Clear index into BPTABL ; !!! The following TWO checks should be reversed some time. !!! TSTB SNGSTP ;In single step mode? BNE 50$ ;Branch if so BIT #PS.TBT,...UPS ;Did we get here from a T-BIT trap? BEQ 30$ ;Branch if not MOV #"TE,ERRMSG ;T-BIT set by user or operating system BR 70$ ;Enter bad entry code. 30$: SUB #2,R5 ;BPT is -2 from current PC MOV R5,...UPC ;Update the user PC MOV R5,DOT ;Update the current address ; !!! @R5 should NOT be a BPT instruction !!! ; !!! if it is, then it's a BE: !!! CALL FNDBPT ;See if address in R5 is in BPT table ;R3 = -1 if not found. 50$: MOVB R3,BPTNUM ;Save entry number. Flag BPT did (not) occur BGE 90$ ;Branch if we found it MOV #"BE,ERRMSG ;Set up the error code 70$: CLRB BPTNUM ;Allow proceed from TE: or BE: 80$: .COND CALL DBG$TU,COND=G$$APH ;Update the screen before printing anything ;incase we have not done a init yet! CRLF ;Return the cursor ALWAYS! .ROM MOV R2,CURBPT ;Use single step BPTABL entry as current MOV ERRMSG,R0 ;Get the 2 character error message in R0 CLR ERRMSG ;ZAP error message flag back to zero TYPE R0+R0 ;Print it out CMP R0,#"T1 ;Was it a trap to 10? BNE 81$ ;Branch if not. TYPE '0 ;Else say so! 81$: TYPE ': ;Type address sepperator CALL LODAD2 ;Load MODE/SPACE + Address into buffer TYPE OUTBUF,CRLF=YES ;Type out address and CLR PROSNG ;We are not single steping or proceeding now .ASSUME PROCED EQ .ASSUME PROSNG EQ PROCED DECODE ;Return to command level (STACK DIRTY) 90$: MOV R2,CURBPT ;Save -> BPT table entry DEC BT.CNT(R2) ;Completed requested number? BEQ 100$ ;Branch if so DBGFNC FUNCTION=READ_NOWAIT ;Did user type something? BCC 100$ ;Branch if so TSTB SNGSTP ;In single step mode? BNE 110$ ;Branch if so. MOVB #1,PROCED ;We are proceeding from this breakpoint BR 10$ ;Go return to user code 100$: CLRB SNGSTP ;No more single steps for you. INC BT.CNT(R2) ;Fix the count 110$: TYPE STRING=BPTSTR ;Type "BPT" MOV R3,R0 ;Get the BPT number BIS #,R0 ;Add in the ">" and make the number ASCII TYPE R0+R0 ;Type it out ADDR TYPMOD,R3 ;R3 -> TYPMOD flag word CALL OPENI1 ;Type the instruction .COND CALL DBG$TU,COND=G$$APH ;Update the screen TSTB SNGSTP ;In single step mode? BEQ 120$ ;Branch if not. Get out CRLF ;Else type a BR 10$ ; And keep going 120$: DECODE ;Return to command dispatcher .DSABL LSB PSECT PURE_BYTE_DATA BPTSTR: .ASCII \BPT\<200> ;BPT entry text PSECT PURE_CODE .SBTTL FNDBPT - Search breakpoint table for address given ;+ ; FNDBPT ; This routine searches the breakpoint table in order to find ; the address passed. ; ; R2 -> BPTABL ; R5 -> Address to find in breakpoint table ; ; CALL FNDBPT ; ; R0 -> > ; R2 -> BPTABL entry if found, else junk ; R3 -> Breakpoint number if found, else -1 ; ; z = 1 Address found, R2 -> BPTABL entry (IE: BEQ FOUND) ; z = 0 Entry not found, R3 = -1 (IE: BNE NOTFOUND) ;- DBGSYM FNDBPT FNDBPT: MOV R5,R0 ;Copy breakpoint address .IF NE, ;If I&D space support .IF EQ,<!> ;If MMU support BIT #040000,...UPS ;Current PS in supervisor mode? BEQ 35$ ;Branch if not TST ...UPS ;Current PS really supervisor mode? BMI 35$ ;Branch if not INC R0 ;Else fixup address to allow search HIT .ENDC; EQ,<!> ;If MMU support .ENDC; NE, ;If I&D space support 35$: MOV #BPT.NM,R3 ;R3 = number of BPT table entries 40$: CMP R0,@R2 ;Is this the breakpoint? .ASSUME BT.ADR EQ 0 BEQ 41$ ;Branch if so ADD #BT.SIZ,R2 ;R2 -> next entry SOB R3,40$ ;Try again DEC R3 ;Make R3 negative. We didn't find it 41$: RETURN ;Return to caller Z-bit has results .SBTTL .SBTTL .SBTTL DBGIO - I/O and major system dependant routines for DBG ;Edit 03 .SBTTL .SBTTL .IIF NDF,L$$LST,.NLIST ;**************************************************************************** ;* * ;* COPYRIGHT (c) 1983, 1986 * ;* BY DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. * ;* ALL RIGHTS RESERVED. * ;* * ;* THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED * ;* ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE * ;* INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER * ;* COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY * ;* OTHER PERSON. NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY * ;* TRANSFERRED. * ;* * ;* THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE * ;* AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT * ;* CORPORATION. * ;* * ;* DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS * ;* SOFTWARE ON EQUIPMENT THAT IS NOT SUPPLIED BY DIGITAL. * ;* * ;**************************************************************************** ;++ ; Facility: DBG - A PDP-11 system independant symbolic debugger ; ; Authors: Don Bridgewater / Chuck Guldenschuh / Joe Worrall ; ; Created: Started by Chuck in 1980. ; ; Abstract: DBGIO - Major system dependant routines for DBG ; ; Externals Description ; --------- ----------- ; ; Edit Who Date Description of modification ; ---- --- ---- --------------------------- ; 001 Jrw 16-Jan-86 Reset DBG stack using only one ; instruction to prevent corruption. ; 002 Jrw 16-Jan-86 Add new fixed offset definition ; to find I.TRAP and TRAPLC. ; 003 Jrw 12-May-86 Support enable/disable of unsupported ; function. ;-- PSECT PURE_CODE .IIF NDF,L$$LST,.LIST .SBTTL MCALL's to system macro libraries .IF EQ, .IF EQ, .IF EQ, .MCALL .EXIT,.GVAL,.TRPSET .IFF; EQ, .MCALL .EXIT,.TRPSET .ENDC; EQ, .ENDC; EQ, .IF EQ, .IF EQ, .MCALL .TTYIN,.RCTRLO,.TTINR,.TTYOUT,.PRINT .ENDC; EQ, .ENDC; EQ, .IFF; EQ, .IF EQ,<!> .IF EQ, .MCALL DIR$, DSAR$S, ENAR$S, EXIT$S, QIOW$, TTSYM$, WSIG$S TTSYM$ ; Define special TERMINAL symbols .IF NE, .MCALL CSM$ .ENDC; NE, .IFF; EQ, .MCALL DIR$, EXIT$S .ENDC; EQ, .ENDC; EQ,<!> .ENDC; EQ, .IF NE, FIRQB = 402 ;RSTS/E specific definitions FQBSIZ = 040 XRB = 442 XRBSIZ = 016 .ASSUME FIRQB+FQBSIZ EQ XRB ;Save and restore routines in DBGIO.MAC OPNFQ = 02 ;Open terminal function CLSFQ = 00 ;Close terminal function XRLEN = 00 ;Length of transfer XRBC = 02 ;Returned count XRLOC = 04 ;Buffer address XRCI = 06 ;Channel number XRBLKM = 07 ;MSB of block number XRBLK = 10 ;LSB of block number XRTIME = 12 ;Wait time XRMOD = 14 ;Modifier FQFUN = 03 ;Firkbee definitions FQFIL = 04 ;... FQDEV = 30 ; .... .IF EQ, .MACRO .READ EMT 377 EMT 2 .ENDM .READ .MACRO .WRITE EMT 377 EMT 4 .ENDM .WRITE .MACRO .TTRST EMT 377 EMT 26 .ENDM .TTRST .MACRO CALFIP EMT 377 EMT 0 .ENDM CALFIP .IFF; EQ, CALFIP = EMT+0 .READ = EMT+2 .WRITE = EMT+4 .TTRST = EMT+26 .ENDC; EQ, .ENDC; NE, .SBTTL Symbolic definitions S$T4 = 004 ;Trap to 4 vector S$T10 = 010 ;Trap to 10 vector S$BPT = 014 ;BPT vector S$IOT = 020 ;IOT vector S$EMT = 030 ;EMT vector S$TRAP = 034 ;TRAP vector S$FLT = 244 ;Floating point trap vector S$MEMM = 250 ;Memory managment trap vector .IF EQ, CONFIG = 300 ;Configuration word (01) offset from RMON FBMON$= 000001 ;FB or XM monitor running @CONFIG XMMON$= 010000 ;XM configuration bit @CONFIG CONFG2 = 370 ;Configuration word (02) offset from RMON PRO$ = 20000 ;PRO/3xx configuration bit @CONFG2 .IF EQ, S$JSW = 044 ;Job status word S$EERB = 052 ;EMT error byte JS.TTN = 000100 ;TT No wait mode bit @JSW JS.SPC = 010000 ;Special mode .TTYIN bit @JSW JS.LWC = 040000 ;Allow lower case bit @JSW .ENDC; EQ, .IF NE, SYSPTR = 054 ;-> Low base of RMON SYSGEN = 372 ;System generation word offset from RMON LOWMAP = 326 ;-> System low core protection table PNPTR = 404 ;-> $PNAME table of device drivers $TRPLS = 434 ;-> XM TRPLST table $TRPPC = $TRPLS+6 ;= I.TRAP in FB/XM and TRAPLC in SJ SYSVER = 276 ;-> System version as .BYTE major,.BYTE minor .ENDC; NE, .ENDC; EQ, .SBTTL General Text and Data PSECT PURE_BYTE_DATA DBGSYM HELLO .NLIST BEX HELLO: .ASCII \DBG V01.00 - \ .IF EQ, .ASCII \RT-11\ .IFF; EQ, .IF EQ, .ASCII \RSX-11M/+\ .ENDC; EQ, .ENDC; EQ, .ASCII \ (\ ;Generate "(" .IIF NE,, .ASCII \ HARD \ ;Hard I/O support .IIF NE,, .ASCII \ SOFT \ ;Soft I/O support .IF NE, ;If RT/SD: .ASCII \ PRO \ ;PROFESSIONAL-3xx support .IFF; NE, ;If RT/SD: .IIF NE,, .ASCII \ PRO \ ;PROFESSIONAL-3xx support .ENDC; NE, ;If RT/SD: .IIF NE,, .ASCII \ RSTS/E \ ;RSTS/E support .IIF NE,, .ASCII \ I/D \ ;I/D space sepperation support .IIF NE,, .ASCII \ STB \ ;.STB file support .IIF NE,, .ASCII \ SD: \ ;RT-11 SD: driver .IIF NE,, .ASCII \ GRH \ ;VT100 graphics support .IIF NE,<$$$ROM>, .ASCII \ ROM \ ;PURE I-CODE supported .ASCIZ \)\ ;Terminate option area .LIST BEX .SBTTL I/O modules local data PSECT DATA .IF NE, DBGSYM DSW DSW: .BLKW 1 ;Saved user $DSW .ENDC; NE, .IF NE, DBGSYM JSW DBGSYM EERB JSW: .BLKW 1 ;Saved user S$JSW EERB: .BLKW 1 ;Saved user S$EERB .ENDC; NE, .IF NE, DBGSYM FQBSAV DBGSYM XRBSAV FQBSAV: .BLKW /2 ;The FIRKBEE and XRB save areas XRBSAV: .BLKW /2 ;MUST stay in contiguous and in THIS ORDER!! .ENDC; NE, .IF EQ, DBGSYM DBG$RS DBGSYM DBG$RB DBGSYM DBG.PS DBGSYM DBG$PB .IIF NDF KB.CSR,KB.CSR = 177560 ;Address of console keyboard CSR .IIF NDF LP.CSR,LP.CSR = 177514 ;Address of line-printer CSR DBG$RS: .WORD KB.CSR ;-> keyboard CSR DBG$RB: .WORD KB.CSR+2 ;-> keyboard buffer DBG.PS: .WORD KB.CSR+4 ;-> printer CSR DBG$PB: .WORD KB.CSR+6 ;-> printer buffer .ENDC; EQ, .IF EQ,<<!>&<!>> .IF EQ, DBGSYM IOSTAT DBGSYM EMAREA IOSTAT: ;I/O status double word EMAREA: .BLKW 3 ;General EMT context save area .ENDC; EQ,<<!>&<!>> .ENDC; EQ, .IF NE, DBGSYM SCCUSR SCCUSR: .BLKW 1 ;Saved user .SCCA address .ENDC; NE, DBGSYM DBG$PR .IF EQ,<&> DBG$PR: .WORD 340 ;Standard PR7 PSW in KERNEL/KERNEL mode .IFF; EQ,<&> DBG$PR: .WORD 170000 ;Standard PR0 PSW in USER/USER Mode .ENDC; EQ,<&> PSECT PURE_CODE .IF EQ,<!> .SBTTL DBG - DBG's transfer address ;+ ; DBG ; Main system dependant entry point for DBG. This routine sets up ; volitile debugger data, saves the incoming user registers, does ; PIC relocation (If supported). ;- ;!!! We assume the stack is valid on entry !!! $DBG:: CALL DBG$IN ;Call OS initialization routine CALL SAVURG ;Save user registers, setup trap vectors etc. TYPE STRING=HELLO ;Output HELLO message DECODE ERROR=YES ;Start command processing @RESTRT .SBTTL DBG$IN - System dependent initialization code ;+ ; DBG$IN ; This routine is called on startup of DBG to initialize ; all relocatable and run time data. ; ; CALL DBG$IN ; ; All registers saved ;- .ENABL LSB DBGSYM DBG$IN ; !!! Need's some thought about ...UPS and DBG$SA, DBG$PR !!! DBG$IN: JSR R3,SAVVR ;Save R0-R3 .COND ASL .ODTL1,COND= .IF EQ, .ROM MOV DBG$SA,R0,GLOBAL=YES ;R0 = Starting user address (...UPC) .IFTF; EQ, MOV R0,...UPC ;Setup initial user PC .COND CALL RELOC,COND=$$$PIC ;Relocate DBG if relocation enabled .ENDC; EQ, .IF EQ,<!> ;+ ; DETERMINE CORRECT PSW **NOTE WELL** ; Under RT-11, we must determine the correct PS to use ; when starting this user, and also for stuffing the ; suedo-vectors with. In XM, the mode MUST be USER, ; where as in SJ or FB, the mode MUST be KERNEL. ; Save the correct PSW in DBG$PR. ;- ADDR EMAREA+2,R0 ;R0 -> Scratch space for .GVAL MOV #CONFIG,-(R0) ;Fill in word that we want .GVAL R0 ;Fetch it BIT #XMMON$,R0 ;Running under the XM monitor ? BEQ 60$ ;Branch if not BIS #170000,DBG$PR ;Else OR in USER/USER mode 60$: .ENDC; EQ,<!> MOV DBG$PR,...UPS ;Set initial user PS CMP #ENDSYM,#SYMEND ;Are user symbols appended to PSECT DBG$SY? ;Note: This does NOT have to be PIC. BHIS 70$ ;Branch if not, or LINKED in wrong order. CLR LSTSYM ;Else ZAP last USYMTB entry free. 70$: RETURN ;Return to caller .DSABL LSB .ENDC; EQ,<!> .SBTTL GETCHR - Get a character, and wait if nessasary ;+ ; GETCHR ; This routine grabs ONE character from the user, and ; deposits it in R0. ; ; R3 -> Last character inserted in input buffer ; R5 -> Blank after macro instruction typed, else 0 ; ; CALL GETCHR (Only called from DBG$RT routine) ; ; R0 Character gotten ; ; DBG$CH Random (RSX11=Char, RT11,HARD I/O=Not touched) ; ; R1-R2 Destroyed ;- .ENABL LSB DBGSYM GETCHR GETCHR: TSTB SNGFLG ;Are we in a pretend ";S" sequence? BEQ 10$ ;Branch if not MOVB #'S,R0 ;Load up the "S" BR 60$ ;and return to the caller 10$: .IF EQ, 20$: CALL XONOFF ;Do protocal, return non XON/XOFF character BCS 20$ ;If no character, loop until we get one. ;R0 = Character&177 CLRB CTOFLG ;Make dam sure CTRL/O flag is clear. .IFF; EQ, .IF EQ, .IF EQ, BIC #JS.TTN,@#S$JSW ;Clear no wait bit. We'll wait BIS #JS.LWC!JS.SPC,@#S$JSW ;Set special mode bit+Lower case .RCTRLO ;Make sure the system knows we changed it .TTYIN ;Get a character in R0 .IFF; EQ, .IF EQ, MOV #IO.RST!TF.RNE,R0 ;R0 = Read-no-echo function code CALL DOQIO ;Do the RSX-QIO. BCS EXIT ;Exit on IE.EOF or other input errors. MOVB DBG$CH,R0 ;R0 = Character gotten TST IOSTAT+2 ;Did we get a character? BNE 25$ ;Branch if so MOVB IOSTAT+1,R0 ;Else get terminating character read. .ENDC; EQ, .ENDC; EQ, .IFF; EQ, CALL CLXRB ;Setup for RSTS/E I/O .READ ;Read the one character MOVB DBG$CH,R0 ;R0 = Character read .ENDC; EQ, 25$: BIC #<^C177>,R0 ;Clear ugly bits .IF EQ,<!> CMP STKGRD,#GRDPAT ;Has our stack gone overboard ? BEQ 40$ ;Branch if not. TYPE STRING=STKSTR ;Print stack error message ; BR EXIT ;Go exit DBG .IFF; EQ,<!> .BR 40$ .ENDC; EQ,<!> .ENDC; EQ, ; Check for JUNK input, if so, eat it! 40$: ADDR CHRTBL,R2 ;R2 -> List of acceptable characters 41$: MOVB (R2)+,R1 ;R1 = Character to check for BEQ 50$ ;Branch if at the end of character list CMPB R1,R0 ;Is this character acceptable? BNE 41$ ;Branch if not, try next ADDR CHRTBL,R1 ;R1 -> List of acceptable characters SUB R1,R2 ;R2 = Jump table index/2 ASL R2 ;R2 = Word index for table ADDR CHRACT-2,R2,ADD ;Add location of Jump table PICLY MOV @R2,R2 ;R2 -> Non-relocated routine address to call ADDR CHRACT,R2,ADD,COND=$$$PIC ;R2 -> Relocated routine to call CMPPIC ACTRU,R2 ;About to dispatch a ? BEQ 42$ ;Branch if so, don't reset flag CALL 60$ ;Check for end of rubout sequence 42$: CALLR @R2 ;And dispatch to it 50$: CMPB R0,# ;Was character inspected above blank? BLE GETCHR ;Branch if not, EAT IT! 60$: TSTB RUBFLG ;Were we in a rubout sequence? BEQ 80$ ;Branch if not, return. TYPE '\ ;Else flag end of sequence 80$: CLRB RUBFLG ;Allow echoing of '\char' on 's RETURN ;Return to caller .DSABL LSB .SBTTL ACT??? - Character input action routines for DBG ;+ ; ACT??? ; These routines are called by a jump table from GETCHR. They ; do take care of special character handling for the following ; special cases: ; ; R0 = Current character typed ; R3 -> Last character inserted in input buffer ; R5 -> Blank after macro instruction typed, else 0 ; ; CALLR ACT??? ; ; Under RT11: ; IF then *eat and echo a ; ; Under RSX11: ; IF then echo a ; ; Under all operating systems: ; ; IF then echo a ; IF then Convert it to a , do blank supp. ;* IF then Exit to host operating system ; IF then cancel input line ; IF then refresh scope display if G$$APH<>0 ; IF then Rubout the last character typed ; IF then Do blank suppression code ; ; * Note: Action only taken if SOFT I/O mode version. ;- ACTCR: .IF EQ, .IF EQ,<!> .TTYIN ;If so, eat the char coming after it .TTYOUT ;Echo the character MOVB #,R0 ;Reset character to .IFF; EQ,<!> TYPE ;Echo if .ENDC; EQ,<!> .IFF; EQ, TYPE ;and echo it too .ENDC; EQ, RETURN ;Return to the caller ACTLF: TYPE ;Echo a RETURN ;Return to the caller ACTCW: .COND BIC #TO.INI,DTYPMD,COND=G$$APH ;Force register display refresh .BR ACTCU ;Merge with common code ACTCU: CRLF ;Print DECODE ERROR=YES ;On CTRL/U/W, kill open location, re-prompt. ACTES: BIT #TO.ESC,TYPMOD ;Unsupported ESCAPE function enabled? BEQ GETCHR ;Branch if not, ignore the character MOVB #,R0 ;For escape, pretend we get a ";S" INCB SNGFLG ;Flag we are pretending to see ";S" RETURN ;Return to the caller ACTTA: MOVB #,R0 ;Convert 's to spaces .BR ACTBL ;Fall into blank suppression code ACTBL: TSTB @R3 ;Any previous character in the buffer? BEQ GETCHR ;Branch if not, ignore it. CMPB R0,@R3 ;Was this the second ? BNE 10$ ;Branch if not. CMPB -1(R3),#'" ;Are we in a ASCII constant typein? BNE GETCHR ;Branch if not, ignore it. 10$: TST R5 ;Have we already found an instruction? BNE 20$ ;Branch if so, don't have to HACK at string. MOV BUFPTR,R4 ;R4 -> .ASCIZ String we have accumulated CALL CHKINS ;See if current string makes an instruction BCS 20$ ;Branch if nogo, stuff and echo character MOV R3,R5 ;R5 -> Last character of instruction 20$: RETURN ;Return to the caller .ENABL LSB ACTRU: BIT #TO.RUB,TYPMOD ;Running on a CRT? BNE 10$ ;Branch if so .ROM TSTB RUBFLG,VALUE=0 ;Echo backslash? BEQ 5$ ;Branch if so, first rubout in sequence! TSTB @R3 ;Any character to rubout? BNE 6$ ;Branch if so, type it. CLRB RUBFLG ;Else zap rubout in progress flag BR ACTCU ;and act like a 5$: TSTB @R3 ;Any character to rubout? BEQ GETCHR ;Branch if nothing here to rubout, punt INCB RUBFLG ;Flag no '\' echo on until good TYPE '\ ;Type BACKSLASH 6$: MOVB @R3,R0 ;R0 = Character to echo in RUBOUT sequence TYPE R0 ;and character that got rubbed. BR 20$ ;Update R3 and collect another character 10$: TSTB @R3 ;Any characters in buffer? BEQ GETCHR ;Branch if not, ignore character TYPE STRING=RUBSTR ;Type CRT rubout string 20$: CLRB @R3 ;Zap the offending character DEC R3 ;Decrement the buffer pointer -> Last character CMP R3,R5 ;Did we just RUBOUT the blank after a ; MACRO instruction? BNE GETCHR ;Branch if not, don't ZAP R5 CLR R5 ;Else clear MACRO instruction found flag BR GETCHR ;and collect another character. .DSABL LSB PSECT PURE_BYTE_DATA RUBSTR: .ASCII <10><10><200> ;CRT rubout sequence PSECT PURE_CODE PSECT PURE_BYTE_DATA .IF EQ,<!> STKSTR: ERRMSG UNRECOVERABLE,,,CRLF=YES,PREFIX=YES .ENDC; EQ,<!> CHRTBL: .BYTE ;Characters below that are OK .BYTE .BYTE .COND .BYTE ,COND=G$$APH .IF EQ,<!> .BYTE .ENDC; EQ,<!> .BYTE .BYTE .BYTE .BYTE <&177> .BYTE 0 ;Table terminator PSECT PURE_DATA CHRACT: .RSET .RWORD ACTCR ;Character action routines .RWORD ACTLF .RWORD ACTCU .COND .RWORD ACTCW,COND=G$$APH .IF EQ,<!> .RWORD EXIT .ENDC; EQ,<!> .RWORD ACTTA .RWORD ACTBL .RWORD ACTRU .RWORD ACTES PSECT PURE_CODE .IF EQ,<!> .SBTTL EXIT - System dependant exit routine ;+ ; EXIT ; Return to the host operating system. This routine exists ; in SOFT I/O mode only. ;- DBGSYM EXIT EXIT: .IF EQ, BIC #TO.GPH,TYPMOD ;Clear grahics mode CALL DBG$TU ;Cleanup the screen if needed .ENDC; EQ, .IF EQ, CLR R0 ;HARD exit - close all channels .EXIT ;Exit to monitor .IFF; EQ, .IF EQ, EXIT$S ;Exit to monitor .ENDC; EQ, .ENDC; EQ, .ENDC; EQ,<!> .SBTTL DBG$CI - Check for input character available ;+ ; DBG$CI ; This routine checks to see if an input character is available. ; If a character is available, the C-BIT is returned clear. Any ; characters goten are eaten. ; ; CALL DBG$CI ; ;- .ENABL LSB DBGSYM DBG$CI DBG$CI: JSR R3,SAVVR ;Save R0-R3 BISB #1,CBTFLG ;Assume no character will be ready. .IF EQ, TSTB CHRFLG ;Was some character eaten? BNE 5$ ;Branch if so, return C=0 CALL XONOFF ;Do protocal, return non XON/XOFF character BCS 10$ ;Branch if we got no other characters 5$: CLRB CHRFLG ;Clear character found flag .IFF; EQ, .IF EQ, .IF EQ, BIS #,@#S$JSW ;Set special mode and no wait .RCTRLO ;Make sure the system knows we changed it .TTINR ;Get a character if there is one in R0 BCS 10$ ;Branch if none .TTINR ;If we got one, try and EAT another too! .IFF; EQ, .IF EQ, MOV #SF.GMC,R0 ;R0 = Function code GET-MULTIPLE-CHARS MOV #2,GENQIO+Q.IOPL+2 ;Set buffer size to TWO MOV #+<0*400>,DBG$CH ;Setup function code CALL DOQI1 ;Return me the number please BCS 10$ ;Branch if no can do. TSTB DBG$CH+1 ;Any characters waiting to be eatten? BEQ 10$ ;Branch if not, return C-BIT=1 MOV #IO.RST!TF.RNE,R0 ;R0 = Read-no-echo function code CALL DOQIO ;Eat the subject character! .ENDC; EQ, .ENDC; EQ, .IFF; EQ, CALL CLXRB ;Setup for RSTS/E I/O BIS #8192.,@#XRB+XRMOD ;No wait I/O mode .READ ;Attempt to read the one character MOV @#XRB+XRBC,R0 ;R0 = # characters read BEQ 10$ ;Branch if null .ENDC; EQ, .ENDC; EQ, BICB #1,CBTFLG ;Reset user C-BIT, character found! 10$: RETURN ;Return to caller. .DSABL LSB .SBTTL DBG$CC - Cancel CTRL/O ;+ ; DBG$CC ; This routine cancels any current CTRL/O state, any terminal output ; following to break though if the user had typed CTRL/O on his terminal. ; ; CALL DBG$CC ; ;- DBGSYM DBG$CC DBG$CC: .IF EQ, .IF EQ, .IF EQ, .RCTRLO ;Do system function cancel CTRL/O .IFF; EQ, .IF EQ, BIS #TF.CCO,WRTFNC ;Setup CANCEL CTRL/O function bits. .ENDC; EQ, .ENDC; EQ, .IFF; EQ, .TTRST ;Reset CTRL/O mode .ENDC; EQ, .IFF; EQ, .ROM CLRB CTOFLG ;Clear CTRL/O in progress flag. .ENDC; EQ, RETURN ;Return to caller .IF EQ, .SBTTL DBG$PC - Output a character w/no translation ;+ ; DBG$PC ; This routine outputs a single character. ; ; R0 = Character to output ; ; CALL DBG$PC ( Print character w/notranslation ) ; ; R0,R1,R2 are volitile ; No SAVVR is done. It must be done by upper level routine. ;- .ENABL LSB DBGSYM DBG$PC DBG$PC: TSTB CTOFLG ;Is CTRL/O in progress? BNE 20$ ;Branch if so, don't print the character MOV R0,-(SP) ;Save character to output CALL XONOFF ;Do XON/XOFF protocal, flag that any other ; characters have been gotten. BCS 5$ ;Branch if we did not EAT a random char. .ROM INCB CHRFLG ;Else tell DBG$CI that some char gotten. 5$: MOV (SP)+,R0 ;Restore character to output 10$: TSTB @DBG.PS ;Ready for output? BPL 10$ ;Branch if not MOVB R0,@DBG$PB ;Print it 11$: TSTB @DBG.PS ;Ready for output? BPL 11$ ;Branch if not CMPB R0,# ;Did we just output a ? BNE 20$ ;Branch if not CLR R0 ;Output ten nulls for every MOV #10,R2 ;Loop count 15$: CALL DBG$PC ;Call ourselves recursivly SOB R2,15$ ;... 20$: RETURN ;Return to caller .DSABL LSB .ENDC; EQ, .SBTTL DBG$SO - Output a string ;+ ; DBG$SO ; This routine outputs a string of characters. If the string ends in a 0 ; byte, a is appended to the string. If the string ends in a 200 ; byte, no is appended. All strings are output with no translation. ; ; DBG$CO <> .BYTE 200,200 THEN DBG$CO = String ; DBG$CO = .BYTE 200,200 THEN R0 -> string ; ; CALL DBG$SO ; ; All registers saved ;- .ENABL LSB DBGSYM DBG$SO DBGSYM DBG$S1 DBG$SO: JSR R3,SAVVR ;Save R0-R3 CMP DBG$CO,(PC)+ ;Is address of string in R0 ? .BYTE 200,200 BEQ DBG$S1 ;Branch if so, OK ADDR DBG$CO,R0 ;Else it's really the string DBG$CO DBG$S1: .IF NE, ;If SOFT I/O mode .IF EQ, .IF EQ, .PRINT ;Print the string @R0 .IFF; EQ, .IF EQ, ADDR GENQIO+Q.IOPL,R2 ;R2 -> QIOW$ + I/O buffer address 10$: CLR -(SP) ;@SP = CRLF flag MOV R0,R3 ;R3 -> String to print 11$: TSTB (R3)+ ;Find end of string BGT 11$ ;Loop till the end BMI 12$ ;Branch if no CRLF wanted INC @SP ;Else set CRLF flag 12$: SUB R0,R3 ;R3 = # characters to print MOV R0,@R2 ;Insert string address MOV R3,2(R2) ;Insert # characters to print MOV WRTFNC,R0 ;R0 = Write function code bits CALL DOQI2 ;Print the string, ignore errors ADDR CRLF,R0 ;R0 -> <200> TST (SP)+ ;Do we need a ? BNE 10$ ;Branch if so. 13$: .ENDC; EQ, .ENDC; EQ, .IFF; EQ, 14$: CLR -(SP) ;@SP = CRLF flag CALL CLXRB ;Setup for RSTS/E I/O MOV R0,R3 ;R3 -> String to print 15$: CLR R1 ;Setup for BISB BISB (R3)+,R1 ;R1 = Next character in string BGT 15$ ;Loop for the end BMI 16$ ;Branch if no CRLF wanted INC @SP ;Else set CRLF flag 16$: CMPB R1,# ;Is it ? BEQ 15$ ;Branch if so, don't terminate on it SUB R0,R3 ;R3 = # characters to print MOV R0,@#XRB+XRLOC ;Setup string address MOV R3,@#XRB+XRLEN ;Insert # characters to print MOV R3,@#XRB+XRBC ;Insert buffer length here too! .WRITE ;Spit out our buffer ADDR CRLF,R0 ;R0 -> <200> TST (SP)+ ;Do we need a ? BNE 14$ ;Branch if so. .ENDC; EQ, .IFF; NE, ;If SOFT I/O mode MOV R0,R3 ;R3 -> string to output 20$: MOVB (R3)+,R0 ;Get character with sign extension BMI 60$ ;Branch if no requested BEQ 40$ ;Branch if requested CALL DBG$PC ;Print the character with no translation BR 20$ ;Get the next one 40$: ADDR CRLF,R3 ;R3 -> <200> BR 20$ ;Go print it 60$: .ENDC; NE, ;If SOFT I/O mode MOV #100200,DBG$CO ;Reset character buffer to default. ; , (.BYTE 200,200) RETURN .DSABL LSB PSECT DATA DBGSYM DBG$CO DBG$CO: .BYTE 200,200,200,200 ;Word alined storage for up to a three byte ; string. PSECT PURE_BYTE_DATA DBGSYM CRLF CRLF: .ASCII <200> ; sequence PSECT PURE_CODE .IF EQ,<!> .SBTTL DBGTRP - Trap to 4, 10 entry point for RT-11 soft I/O .SBTTL SETTRP - Do RT-11 .TRPSET to hook T4 and T10 ;+ ; DBGTRP ; This routine is entered whenever a trap to 4 or 10 occurs. It dispatches ; to the appropriate routine to handle the trap ; ; C-bit = 1 => trap to 10 ; = 0 => trap to 04 ; ; SETTRP ; This routine does the .TRPSET EMT to hook trap locations 4 and 10 ; into DBG ; ;- DBGSYM DBGTRP DBGSYM SETTRP DBGTRP: BCS 20$ ;Branch if trap to 10 TSTB DBG$FL ;What stack are we on ? BGE 10$ ;Branch if trap is internal to DBG CALLR TRAP4 ;Else Trap to 4 from USER code 10$: CALLR ILLME1 ;Was Invalid memory reference from inside us. 20$: TSTB DBG$FL ;What stack are we on ? BGE 30$ ;Branch if trap is internal to DBG CALLR TRAP10 ;Else Trap to 10 from USER code 30$: CALLR INTERR ;Internal error if TRAP to 10 ! SETTRP: MOV R0,-(SP) ;Save R0 around .TRPSET .IF NE,<$$$PIC> ADDR TRPBLK+2,R0 ;R0 -> EMT block + 2 MOVPIC DBGTRP,-(R0) ;Fill in action routine address .IFF; NE,<$$$PIC> ADDR TRPBLK,R0 ;R0 -> EMT block for .TRPSET .ENDC; NE,<$$$PIC> .TRPSET R0 ;Setup TRAP10 and TRAP4 handling .IF NE, .MCALL .SCCA .SCCA #EMAREA,#1 ;Pass CTRL/Z's to us! .ENDC; NE, MOV (SP)+,R0 ;Restore R0 RETURN ;Return to caller .ENDC; EQ,<!> .IF EQ, .SBTTL ITRSET - Setup for internal DBG trap handling ;+ ; ITRSET ; This routine sets up the system trap vectors to point to internal ; trap handling routines while running in DBG. This allows internal ; TRAPS to be handled as such, in the context of the debugger. ; ; RT-11 non-driver mode ; ; (04/06) Setup via .TRPSET ; (10/12) Setup via .TRPSET ; (14/16) BPT trap vector - Stuffed ; (20/22) IOT trap vector - Saved / Stuffed ; (30/32) EMT trap vector - NOT AFFECTED ; (34/36) TRAP trap vector - Saved / Stuffed ; (244/246) FPP trap vector - NOT AFFECTED ; (250/252) MMU trap vector - NOT AFFECTED (Real RT-11) ; (250/252) MMU trap vector - Stuffed (RT-11 RSTS/E only) ; ; RT-11 Driver mode (SD: driver hack) ; ; (04/06) T04 trap vector - Stuffed ; (10/12) T10 trap vector - Stuffed ; (14/16) BPT trap vector - Stuffed ; (20/22) IOT trap vector - Saved / Stuffed ; (30/32) EMT trap vector - NOT AFFECTED ; (34/36) TRAP trap vector - Saved / Stuffed ; (244/246) FPP trap vector - NOT AFFECTED ; (250/252) MMU trap vector - Stuffed (XM/D$$OUT only) ; ; RSX-11M soft I/O mode ; ; A switch to DBG's SST table is done. ; ; RSX-11M hard I/O mode (??: driver) ; ; (04/06) T04 trap vector - Stuffed ; (10/12) T10 trap vector - Stuffed ; (14/16) BPT trap vector - Stuffed ; (20/22) IOT trap vector - Stuffed ; (30/32) EMT trap vector - Stuffed ; (34/36) TRAP trap vector - Stuffed (Only on RSX-11M) ; (244/246) FPP trap vector - Stuffed ; (250/252) MMU trap vector - Stuffed ;- DBGSYM ITRSET DBGSYM TRPSET ITRSET: TST (PC)+ ;Clear carry, Change to internal trap handling TRPSET: SEC ; Set carry, Change to user trap handling JSR R3,SAVVR ;Save R0-R3 .IF NE, ADDR TRAPCC,R0 ;Assume user trap setting BCS 1$ ;Branch if true ADDR RESTRT,R0 ;Else set CTRL/C trap to restart 1$: .IF EQ, ROR -(SP) ;Save state of C-BIT .SETCC = EMT+362 .SETCC ;Setup RSTS/E CTRL/C traps ROL (SP)+ ;Reclaim the C-BIT .IFF; EQ, .IF EQ, MOV R0,@#24 ;Setup RSTS/E RSX CTRL/C trap vector. .ENDC; EQ, .ENDC; EQ, .ENDC; NE, .IF NE, ADDR DBGSVT,SP ;Push address of SVDB$ directive for DBGSST BCC 10$ ;Branch if call was to ITRSET ADDR USRSVT,SP,PUSH=NO ;Push address of SVDB$ directive for USRSST 10$: DIR$ ;Setup correct SST debugger table RETURN ;Return to caller .IFF; NE, ROR -(SP) ;Save state of C-BIT .IF EQ,<!> CALL SETTRP ;Do RT-11 .SETTRP to hook T4 and T10 .ENDC; EQ,<!> ADDR SSTVEC,R0 ;R0 -> SST vector table MOV #8.,R1 ;R1 = # entries in SST table 20$: CLR R2 ;Setup R2 for BISB BISB (R0)+,R2 ;R2 = Possible trap vector to stuff/restore BNE 30$ ;Branch if entry is not null INC R0 ;Else bump pointer BR 92$ ;Loop for all entries 30$: MOV R0,R3 ;Save current pointer into TRAP data struc. TSTB (R0)+ ;Are there RESTORE/SAVE entries to process? .IF EQ, BNE 50$ ;Branch if so .IFTF; EQ, TST @SP ;Save or restore ? BPL 55$ ;Branch if save operation TST (R0)+ ;Bump R0 to point to RESTORE PC to use .IFF; EQ, .BR 55$ ;Stuff PC-PS, loop for next .IFT; EQ, BR 55$ ;Stuff PC-PS, loop for next 50$: TST @SP ;Save or restore ? BPL 70$ ;Branch if save operation MOV (R0)+,@R2 ;Stuff vector PC for restore operation BNE 60$ ;Branch if something was saved earlyer BIT (R0)+,(R0)+ ;R0 -> Second .RWORD entry (TRAPnn) .IFTF; EQ, 55$: MOV (R0)+,(R2)+ ;Stuff correct address ;***PIC*** MOV DBG$PR,@R2 ;Stuff correct PSW .IFF; EQ, .BR 90$ ;Loop for next entry .IFT; EQ, BR 90$ ;Loop for next entry 60$: MOV (R0)+,2(R2) ;Stuff saved PSW too BR 90$ ;Loop for next 70$: MOV (R2)+,(R0)+ ;Save VECTOR PC MOV @R2,(R0)+ ;Save VECTOR PS MOV DBG$PR,@R2 ;Stuff new PS MOV (R0)+,-(R2) ;Stuff new PC ;***PIC*** .ENDC; EQ, 90$: TSTB (R3)+ ;Were there save/restore entry words? BEQ 91$ ;Branch if not BIT (R3)+,(R3)+ ;R3 -> .RWORD entries 91$: BIT (R3)+,(R3)+ ;R3 -> Next TRAP entry MOV R3,R0 ;R0 -> " " 92$: SOB R1,20$ ;Next trap entry please TST (SP)+ ;Clear junk from stack RETURN ;Return to caller, done. .ENDC; NE, PSECT DATA .IF EQ, .IF EQ, DBGSYM SSTVEC SSTVEC: .RSET .BYTE 0,0 ;Odd address T4:nnnnnn .IF EQ, .BYTE 0,0 ;Segment fault MP:nnnnnn .IFF; EQ, .BYTE S$MEMM,0 ;Segment fault MP:nnnnnn .RWORD ILLMEM ;MP Internal MP handler .RWORD TRAP25 ;MP User MP handler .ENDC; EQ, .BYTE S$BPT,0 ;BPT BE:nnnnnn .RWORD INTERR ;BPT Internal BPT handler .RWORD TRAP14 ;BPT User BPT handler .BYTE S$IOT,1 ;IOT IO:nnnnnn .WORD 0,0 ;Save IOT vector/PS .RWORD INTERR ;IOT Internal IOT handler .RWORD TRAP20 ;IOT User IOT handler .BYTE 0,0 ;Invalid inst. T1:nnnnnn .BYTE 0,0 ;EMT EM:nnnnnn .BYTE S$TRAP,1 ;TRAP TR:nnnnnn .WORD 0,0 ;Saved TRAP vector/PS .RWORD INTTRP ;TRAP Internal TRAP handler .RWORD TRAP34 ;TRAP User TRAP handler .BYTE 0,0 ;FPP FP:nnnnnn DBGSYM TRPBLK TRPBLK: .BLKW 1 ;.TRPSET EMT prefix ID stuffed here .WORD DBGTRP ; -> RT-11 .TRPSET routine .IFF; EQ, DBGSYM SSTVEC SSTVEC: .RSET .BYTE S$T4,0 ;Odd address T4:nnnnnn .RWORD ILLME1 ;T4 Internal T4 handler .RWORD TRAP4 ;T4 User T4 handler .IF EQ, .BYTE 0,0 ;Segment fault MP:nnnnnn .IFF; EQ, .BYTE S$MEMM,0 ;Segment fault MP:nnnnnn .RWORD ILLMEM ;MP Internal MP handler .RWORD TRAP25 ;MP User MP handler .ENDC; EQ, .BYTE S$BPT,0 ;BPT BE:nnnnnn .RWORD INTERR ;BPT Internal BPT handler .RWORD TRAP14 ;BPT User BPT handler .BYTE S$IOT,1 ;IOT IO:nnnnnn .WORD 0,0 ;Save IOT vector/PS .RWORD INTERR ;IOT Internal IOT handler .RWORD TRAP20 ;IOT User IOT handler .BYTE S$T10,0 ;Invalid inst. T1:nnnnnn .RWORD INTERR ;T10 Internal T10 handler .RWORD TRAP10 ;T10 User T10 handler .BYTE 0,0 ;EMT EM:nnnnnn .BYTE S$TRAP,1 ;TRAP TR:nnnnnn .WORD 0,0 ;Saved TRAP vector/PS .RWORD INTTRP ;TRAP Internal TRAP handler .RWORD TRAP34 ;TRAP User TRAP handler .BYTE 0,0 ;FPP FP:nnnnnn .ENDC; EQ, .ENDC; EQ, .IF EQ,<!> .IF NE,<$DEBUG> .MCALL SVTK$ USRSVT: SVTK$ USRSST,8. ;SST setup DPB for running with USER DBGSVT: SVTK$ DBGSST,8. ;SST setup DPB for running in DBG .IFF; NE,<$DEBUG> .MCALL SVDB$ USRSVT: SVDB$ USRSST,8. ;SST setup DPB for running with USER DBGSVT: SVDB$ DBGSST,8. ;SST setup DPB for running in DBG .ENDC; NE,<$DEBUG> DBGSYM USRSST USRSST: .RSET ;SST vector table while USER is running .RWORD TRAP4 ; Trap to 4 .RWORD TRAP25 ; Memory protection violation .RWORD TRAP14 ; BPT .RWORD TRAP20 ; IOT .RWORD TRAP10 ; Trap to 10 .RWORD TRAP30 ; EMT .RWORD TRAP34 ; TRAP .RWORD TRAP24 ; FPP DBGSYM REFSST REFSST: .RSET ;SST vector table to refresh above with .RWORD TRAP4 ; Trap to 4 .RWORD TRAP25 ; Memory protection violation .RWORD TRAP14 ; BPT .RWORD TRAP20 ; IOT .RWORD TRAP10 ; Trap to 10 .RWORD TRAP30 ; EMT .RWORD TRAP34 ; TRAP .RWORD TRAP24 ; FPP DBGSYM DBGSST DBGSST: .RSET ;SST vector table while in DBG .RWORD ILLME1 ; Trap to 4 .RWORD ILLMEM ; Memory protection violation .RWORD RESTRT ; BPT .RWORD INTERR ; IOT .RWORD INTERR ; Trap to 10 .RWORD INTERR ; EMT .RWORD INTTRP ; TRAP (Internal special functions) .RWORD INTERR ; FPP .ENDC; EQ,<!> .ENDC; EQ, PSECT PURE_CODE .SBTTL SAVURG - Save user's registers ;+ ; SAVURG ; This co-routine saves/restores the user's registers. ; ; Under RT-11, this routine saves, then hooks the following ; trap locations: ; ; (14/16) BPT trap vector - Always refreshed, never restored ; (20/22) IOT trap vector - Refreshed, restored if org <> 0 ; (30/32) EMT trap vector - NOT AFFECTED ; (34/36) TRAP trap vector - Refreshed, restored if org <> 0 ; (244/246) FPP trap vector - NOT AFFECTED ; (250/252) MMU trap vector - NOT AFFECTED ; ; Under RSX-11M, this routine switches SST VECTOR tables from ; the USRSST table to the DBGSST vector table. This allows ; DBG to use the TRAP instruction for internal functions. ; An attempt is made to attach the terminal. The status of the ; attach attempt is saved to determine if we should detach the ; terminal when returning to the user. AST's are disabled, and ; the status is saved to determine if we should re-enable AST's ; before returning to the user. ; ; Also, all system context is saved. Things such as $DSW under ; RSX-11, and the JSW/EERB under RT-11. ; ; ...UPC Trap PC ; ...UPS Trap PS ; ; CALL SAVURG ; ; SP -> our stack ; R4 -> Output scratch buffer ; R5 -> User PC from ...UPC ; TYPMOD = Setup for I-SPACE ; ; Returned registers are RANDOM, SP -> Our stack ; ;- .ENABL LSB DBGSYM SAVURG SAVURG: .IF EQ,<!> .ROM CLRB DBG$FL,VALUE=-1 ;Flag we are in DBG! .ENDC; EQ,<!> .IF EQ,<!> ; If under RSX-11M - Disable AST's, and save returned $DSW MOV @#$DSW,DSW ;Save $DSW if under RSX-11 .IF EQ, DSAR$S ;Disable AST's .ROM MOVB @#$DSW,DSAFLG ;Save disable status here .ENDC; EQ, .ENDC; EQ,<!> ADDR ...UR0,R0,PUSH ;Get address of user register save area MOV (SP)+,(R0)+ ;Save R0 MOV R1,(R0)+ ; and R1 MOV R2,(R0)+ ; and R2 MOV R3,(R0)+ ; and R3 MOV R4,(R0)+ ; and R4 MOV R5,(R0)+ ; and R5 MOV (SP)+,R4 ;Save the return address .IF NE,<!> ;Don't need CALL RSETPS here! MFPI SP ;Get user SP on the stack (Can't FAIL!) MOV (SP)+,(R0)+ ;Save user SP value .ROM MOV SP,KNLSP ;Save KERNEL SP for restore later .IFF; NE,<!> MOV SP,(R0)+ ;Save user's SP .ENDC; NE,<!> MOV (R0)+,DOT ;Save the current address from ...UPC CLRB IREGFL ;Clear internal register access flag ADDR DBGSTK,R0 ;Set up our own Stack @DBGSTK MOV R0,R6 ;Setup stack using ONE INSTRUCTION! MOV R4,-(SP) ;Put return address on stack ; Save system status area's .IF EQ, .ROM MOVB @DBG$RS,KSTAT ;Save keyboard status .ROM MOVB @DBG.PS,PSTAT ; and the printer status CLRB @DBG.PS ;Turn off output interrupt enable CLRB @DBG$RS ;Turn off input interrupt enable 771$: TSTB @DBG.PS ;Output ready? BPL 771$ ;Branch if not .IFF; EQ, .IF EQ, MOV @#S$JSW,JSW ;Save the job status word MOV @#S$EERB,EERB ;Save the EMT error byte .IF NE, .MCALL .SCCA MOV #50,R0 ;R0 -> EMT block to use (!!! USER HIGH ADDR !!!) MOV @R0,-(SP) ;Save location 50 MOV #52,2(R0) ;Fill in terminal status word addr .SCCA R0 MOV R0,SCCUSR ;Save USER address set if any. MOV (SP)+,@#50 ;Restore location 50 (!!! USER HIGH ADDR !!!) .ENDC; NE, .ENDC; EQ, .ENDC; EQ, ; If running under RSTS/E save the damm FIRKBEE and the XRB .IF NE, MOV #FIRQB,R0 ;R0 -> Start of area to SAVE ADDR FQBSAV,R1 ;R1 -> Area to save RSTS/E stuff too MOV #/2,R2 ; R2 = # words to save 777$: MOV (R0)+,(R1)+ ;Save it all ... SOB R2,777$ ;Loop for it all. .ENDC; NE, .IF NE,<!> .IF EQ, ; Setup trap vectors to internal DBG trap handling CALL ITRSET ;Setup for internal TRAP handling .ENDC; EQ, .IFTF; NE,<!> 10$: TST PROSNG ;Proceeding from BPT or single step? BNE 30$ ;Branch if so. BPT's already gone ADDR BPTABL,R0 ;R0 -> BPT table MOV #BPT.NM,R1 ;R1 -> max BPT + 1 20$: ADD #BT.SIZ,R0 ;R0 -> next BPT entry DEC R1 ;Count down BEQ 30$ ;Branch if done MOV @R0,R5 ;Get address of BPT BEQ 20$ ;Branch if none .IF NE, BIC #TO.DSP,TYPMOD ;Must be I-SPACE .IF EQ,<!> MOV ...UPS,-(SP) ;Save current PS value BIT #1,R5 ;Address ODD ? BEQ 21$ ;Branch if not MOV #040000,...UPS ;Set supervisor mode for PUT routine 21$: BIC #1,R5 ;Be sure it's even .ENDC; EQ,<!> .ENDC; NE, PUT BT.CNS(R0),IREGS=NO ;Remove the BPT ;*I/D* .IF NE, .IF EQ,<!> MOV (SP)+,...UPS ;Restore PS value .ENDC; EQ,<!> .ENDC; NE, BR 20$ ;Loop for next 30$: .IFF; NE,<!> ; Setup trap vectors to internal DBG trap handling CALL ITRSET ;Setup for internal TRAP handling .ENDC; NE,<!> .IF EQ, .IF EQ,<!> ; Under RSX-11M, attempt to attach the terminal, and save attach ; status, to determine if we should later DETACH the terminal MOV #IO.ATT,R0 ;R0 = Function code to execute on terminal CALL DOQIO ;Do the QIOW$ .ROM MOVB @R0,ATTFLG ;Save attach status here .ENDC; EQ,<!> .IFF; EQ, CALL CLFQB ;Clear the FIRQB MOVB #OPNFQ,@#FIRQB+FQFUN ;Open function MOVB .ODTL1,@#FIRQB+FQFIL ;On This Channel MOV #"TI,@#FIRQB+FQDEV ;Device kb: MOV #100045,@#FIRQB+22 ;Nocrlf+XON/OFF+BIN CALFIP ;Do the open, assume it worked. .ENDC; EQ, .IF NE, BIC #TO.DSP,TYPMOD ;Force I-SPACE to begin with .ENDC; NE, MOV ...UPC,R5 ;R5 -> PC trap occured at DBGFNC FUNCTION=CLEAR_OUTBUF ;Load R4 -> OUTBUF RETURN ;Return to the caller .DSABL LSB .SBTTL RETUSR - Restore context and return to USER ;+ ; RETUSR ; This routine restores the users context, and returns to ; the users code. ; ; Additionally: ; ; Under RT-11, this routine restores some trap vectors that ; are optionally under control of the user program. See ; SAVURG description. ; ; Under RSX-11M, this routine switches SST VECTOR tables from ; the DBGSST table to the USRSST vector table. This returns ; total flexable trap control to the user using the debugger. ; The terminal is detached, if attached when we came into DBG. ; ; CALLR RETUSR ; ; SP -> our stack ;- .ENABL LSB DBGSYM RETUSR RETUSR: .IF EQ,<!> ; Setup trap vectors to trap USER/MONITOR traps CALL TRPSET ;Setup standard traps .IFTF; EQ,<!> TST PROSNG ;Should we put BPT's back? BNE 50$ ;Branch if not. Proceeding or single step ADDR BPTABL,R0 ;R0 -> BPT table MOV #BPT.NM,R1 ;R1 -> max BPT + 1 40$: ADD #BT.SIZ,R0 ;R0 -> next BPT entry DEC R1 ;Count down BEQ 50$ ;Branch if done MOV @R0,R5 ;Get address of BPT BEQ 40$ ;Branch if none .IF NE, BIC #TO.DSP,TYPMOD ;Force I-SPACE for BPTs .IF EQ,<!> MOV ...UPS,-(SP) ;Save current PS value BIT #1,R5 ;Address ODD ? BEQ 41$ ;Branch if not MOV #040000,...UPS ;Force supervisor mode PS 41$: BIC #1,R5 ;Be sure it's even .ENDC; EQ,<!> .ENDC; NE, GET BT.CNS(R0),IREGS=NO,POP=NO ;Get contents ;*I/D* PUT #BPT,IREGS=NO ;Insert a BPT ;*I/D* .IF NE, .IF EQ,<!> MOV (SP)+,...UPS ;Restore PS value .ENDC; EQ,<!> .ENDC; NE, BR 40$ ;Loop for next breakpoint 50$: .IFF; EQ,<!> ; Setup trap vectors to trap USER/MONITOR traps .IF EQ, CALL TRPSET ;Setup standard traps .ENDC; EQ, .ENDC; EQ,<!> .IF EQ, .IF EQ,<!> ; If under RSX-11M - swap SST table to USRSST and enable AST's ; Detach the terminal, if when we came into DBG, the terminal ; was not attached. TSTB ATTFLG ;Did attach function fail on entry? BMI 60$ ;Branch if so, do not re-attach it. MOV #IO.DET,R0 ;R0 = Function code to execute on terminal CALL DOQIO ;Do the QIOW$ 60$: .ENDC; EQ,<!> .IFF; EQ, CALL CLFQB ;Clear the FIRQB MOVB #CLSFQ,@#FIRQB+FQFUN ;Close channel func. MOVB .ODTL1,@#FIRQB+FQFIL ;On this channel*2 CALFIP ;Close it! .ENDC; EQ, .IF EQ, 2$: TSTB @DBG.PS ;Printer ready? BPL 2$ ;Branch if not BIT #4000,@DBG$RS ;Input busy? BEQ 4$ ;Branch if not 3$: TSTB @DBG$RS ;Input ready? BPL 3$ ;Branch if not 4$: MOVB PSTAT,@DBG.PS ;Restore printer CSR MOVB KSTAT,@DBG$RS ; and the keyboard CSR .IFF; EQ, .IF EQ, .IF NE, MOV #50,R0 ;R0 -> EMT block to use (!!! USER HIGH ADDR !!!) MOV @R0,-(SP) ;Save location 50 MOV SCCUSR,2(R0) ;Fill in terminal status word addr .SCCA R0 MOV (SP)+,@#50 ;Restore location 50 (!!! USER HIGH ADDR !!!) .ENDC; NE, MOV JSW,@#S$JSW ;Restore the job status word MOV EERB,@#S$EERB ;Restore the EMT error byte .ENDC; EQ, .ENDC; EQ, ; If running under RSTS/E restore the damm FIRKBEE and XRB .IF NE, MOV #FIRQB,R0 ;R0 -> Start of area to RESTORE ADDR FQBSAV,R1 ;R1 -> Area to obtain RSTS/E stuff MOV #/2,R2 ; R2 = # words to restore 767$: MOV (R1)+,(R0)+ ;Restore it all SOB R2,767$ ;Loop for it all. .ENDC; NE, ADDR ...USP+2,R0 ;R0 -> register save area .IF NE,<!> MOV -(R0),-(SP) ;Stack users stack pointer value CALL RSETPS ;Reset previous mode bits in current PS. MTPI SP ;Restore users stack pointer MOV KNLSP,R6 ;Restore KERNEL stack pointer .IFF; NE,<!> MOV -(R0),R6 ;Restore user's SP value .ENDC; NE,<!> MOV -(R0),R5 ; and R5 MOV -(R0),R4 ; and R4 MOV -(R0),R3 ; and R3 MOV -(R0),R2 ; and R2 MOV -(R0),R1 ; and R1 MOV -(R0),R0 ; and R0 MOV ...UPS,-(SP) ;Put user priority back on stack BIC #PS.TBT,@SP ;Clear T-BIT by default TST PROSNG ;Are we proceding from a BPT, or ";S"? BEQ 500$ ;Branch if we are not BIS #PS.TBT,@SP ;Set the T-BIT in the user PSW 500$: MOV ...UPC,-(SP) ;Put user PC back on stack MOV @SP,TRPC ;-> PC Save location for 11/40's and the like .IF EQ,<!> DECB DBG$FL ;Flag that we are now on the users stack .ENDC; EQ,<!> .IF EQ,<!> .IF EQ, TSTB DSAFLG ;Did DSAR$S fail on entry? BMI 70$ ;Branch if so, was disabled on entry ENAR$S ;Else enable AST's .ENDC; EQ, 70$: MOV DSW,@#$DSW ;Restore $DSW under M .ENDC; EQ,<!> DBGSYM DBGRTT DBGRTT: .IF NE, BIT #140000,2(SP) ;Are we returning to user mode ? BGT 80$ ;Branch if not, must be SUPER mode. .IFTF; NE, .IF EQ, ;+ ; The following .word is a JMP (PC)+ instruction in discuise, as ; macro would flag this with a "Z" error. We do this instruction ; to find out if we are running on a machine with a "RTT" ; instruction. PDP-11/5/10/15/20's do not have a "RTT" instruction. ;- .WORD 127 ;Do the JMP (PC)+ instruction RTT ;Return from trap RTI ;Return from interrupt .IFF; EQ, JMP @$RTN ;Return through ICB pool code. .ENDC; EQ, .IFT; NE, 80$: CLR -(SP) ;Push address of supervisor mode ; entry vector CSM$ (SP)+ ; and enter supervisor mode HALT ;BYE-F if we hit this! .ENDC; NE, .DSABL LSB .IF EQ,<<!>!> .SBTTL DOQIO - Issue QIOW$ directive ;+ ; DOQIO ; Issue a QIO directive, and wait for it ; ; R0 = QIO function code ; ; CALL DOQIO ; ; R0 -> I/O status block (IOSTAT) ; R1 -> GENQIO ; C=0 if QIOW successful ; C=1 if error ; ;- DBGSYM DOQIO DBGSYM DOQI1 DBGSYM DOQI2 .ASSUME Q.IOFN EQ 2 .ASSUME Q.IOLU EQ Q.IOFN+2 .ASSUME Q.IOEF EQ Q.IOLU+2 DOQIO: MOV #1,GENQIO+Q.IOPL+2 ;Stuff buffersize of ONE DOQI1: MOVPIC DBG$CH,GENQIO+Q.IOPL ;Stuff buffer address DOQI2: ADDR GENQIO+Q.IOEF+1,R1 ;R1 -> QIOW$+Q.IOEF MOVB DBG$EF,-(R1) ;Set event flag to use in QIOW$ block .IF EQ,<$DEBUG> .ROM MOV .ODTL1,-(R1),GLOBAL=YES,VALUE=1 ;Set TI: LUN to use .IFF; EQ,<$DEBUG> .ROM MOV .ODTL1,-(R1),GLOBAL=NO,VALUE=1 ;Set TI: LUN to use .ENDC; EQ,<$DEBUG> MOV R0,-(R1) ;Set function code in QIOW$ block TST -(R1) ;R1 -> GENQIO DPB+0 10$: DIR$ R1 ;Issue RSX directive MOV Q.IOSB(R1),R0 ;R0 -> I/O status block (Relocated) BCS 20$ ;Return on error TSTB @R0 ;I/O done - any errors? BPL 30$ ; No - done (C=0) CMPB @R0,#IE.NOD ; Yes - need more dynamic memory? BNE 20$ ;Branch if not WSIG$S ;Wait for event BR 10$ ;Try again ... 20$: SEC ;Set flag for error 30$: .ROM BIC #TF.CCO,WRTFNC,VALUE=IO.WAL ;Clear CTRL/O flag from FNC RETURN ;Return to caller PSECT DATA DBGSYM GENQIO GENQIO: QIOW$ ,,,,IOSTAT,,<0,0,0> ; Non-relocatable QIOW$ PSECT PURE_CODE .ENDC; EQ,<<!>!> .IF NE, .SBTTL XONOFF - XON/XOFF support routine for hard I/O mode ;+ ; XONOFF ; This routine supports the XON/XOFF protocall during terminal ; input and output in DBG. Half-Duplex operation is assumed during ; terminal output. ; ; CALL XONOFF ; ; CC R0 = Character gotten, not a CTRL-S or a CTRL-Q ; CS No character waiting when called ; ; R1 Destroyed ;- DBGSYM XONOFF XONOFF: CLR R1 ;R1 is our XON/XOFF flag 10$: TSTB @DBG$RS ;Is there a character available? (DL CSR) BMI 20$ ;Branch if there is TST R1 ;Are we X'ED OFF ? BNE 10$ ;Branch if so, loop until we get a character BR 40$ ;Else return w/c-bit set 20$: MOVB @DBG$RB,R0 ;Get the character .IF NE, ;If PRO support .IF NE, TST PROFLG ;Running on a PRO/3xx series? BEQ 25$ ;Branch if not, ok. .IFTF; NE, MOV #115,@#173202 ;Clear the pending interrupt. 25$: .ENDC; NE, .ENDC; NE, ;If PRO support BIC #^C<177>,R0 ;Clear the junk from it CMPB R0,# ;Was it a STOP I/O ? BNE 30$ ;Branch if not INC R1 ;Set XOFF flag BR 10$ ;and loop for a CTRL/Q 30$: CMPB R0,# ;Was it a ReStart I/O ? BEQ XONOFF ;Branch if so, EAT IT, reset XON/XOFF flag TST R1 ;Still X'ED OFF? BNE 10$ ;Branch if so, eat the character CMPB R0,# ;Was it cancel output ? BNE 35$ ;Branch if not COMB CTOFLG ;Flip CTRL/O in progress flag. BR 10$ ;Look for another character 35$: TST (PC)+ ;Clear carry - character in R0 40$: SEC ;Set carry - No character available RETURN ;Return to caller .ENDC; NE, .IF NE, .SBTTL CLFQB - Clear the RSTS/E FIRQB .SBTTL CLXRB - Clear the RSTS/E XRB ;+ ; CLXRB , CLFQB ; These routines clear out the RSTS/E FIRQB and XRB areas for ; monitor calls. ; ;- DBGSYM CLFQB DBGSYM CLXRB .IF EQ, .CLRFQB = EMT+370 ;Define special EMT's .CLRXRB = EMT+371 ;... CLFQB: .CLRFQB ;Clear the FIRKBEE RETURN ;Return to the caller CLXRB: .CLRXRB ;Clear the XRB INC @#XRB+XRLEN ;Read one character MOVPIC DBG$CH,@#XRB+XRLOC ;Into DBG$CH MOV .ODTL1,@#XRB+XRCI ;Channel to use RETURN ;Return to the caller .IFF; EQ, .ENABL LSB CLFQB: MOV R0,-(SP) ;Save regs we use. MOV R1,-(SP) MOV #FIRQB,R0 MOV #FQBSIZ/2,R1 BR 10$ ;Join common code. CLXRB: MOV R0,-(SP) ;Save regs we use. MOV R1,-(SP) MOV #XRB,R0 MOV #XRBSIZ/2,R1 10$: CLR (R0)+ SOB R1,10$ MOV (SP)+,R1 ;Restore regs. MOV (SP)+,R0 INC @#XRB+XRLEN ;Buffersize = one character MOVPIC DBG$CH,@#XRB+XRLOC ;Into DBG$CH MOV .ODTL1,@#XRB+XRCI ;Channel to use RETURN .DSABL LSB .ENDC; EQ, PSECT DATA .ODTL1::.WORD 15.*2 ;Default channel to use for terminal I/O PSECT PURE_CODE .ENDC; NE, .SBTTL .SBTTL .SBTTL DBGEND - End module for assembly of DBG ;Edit 03 .SBTTL .SBTTL .IIF NDF,L$$LST,.NLIST ;**************************************************************************** ;* * ;* COPYRIGHT (c) 1983, 1986 * ;* BY DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. * ;* ALL RIGHTS RESERVED. * ;* * ;* THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED * ;* ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE * ;* INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER * ;* COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY * ;* OTHER PERSON. NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY * ;* TRANSFERRED. * ;* * ;* THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE * ;* AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT * ;* CORPORATION. * ;* * ;* DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS * ;* SOFTWARE ON EQUIPMENT THAT IS NOT SUPPLIED BY DIGITAL. * ;* * ;**************************************************************************** ;++ ; Facility: DBG - A PDP-11 system independant symbolic debugger ; ; Authors: Don Bridgewater / Chuck Guldenschuh / Joe Worrall ; ; Created: Started by Chuck in 1980. ; ; Abstract: DBGEND - End module for assembly of DBG ; ; Externals Description ; --------- ----------- ; ; Edit Who Date Description of modification ; ---- --- ---- --------------------------- ; 001 Jrw 16-Jan-86 Correct .SET SD CSR=x command. ; Set hard error if SD is entered on ; an I/O request. ; 002 Jrw 28-Feb-86 Replace $PNAME search routines with ; physical .DSTAT requests. Allow SET ; SD NOSYSGEN. ; 003 Jrw 12-May-86 Add SET SD [NO]ESC to enable/disable ; unsupported feature. ; 004 Jfw 29-Aug-88 Changes for VD (VM/SD) debugging ; system device handler. ;-- PSECT PURE_CODE .IIF NDF,L$$LST,.LIST .IF NE, ;If RT/SD: .SBTTL SD: Handler set routines and installation code .MCALL .DRDEF,.PRINT,.ADDR,.DREND .IF EQ, ;If not VM/SD combo .IIF NE,, MMG$T=1 ;XM support .IIF NE,, TIM$IT=1 ;Default on XM is timer support .IF NE, ;If HARD I/O .DRDEF SD,62,,0,KB.CSR,0 .IFF; NE, ;If HARD I/O .DRDEF SD,62,,0,0,0 .ENDC; NE, ;If HARD I/O .DRPTR FETCH=*NO*,LOAD=LOAD,UNLOAD=UNLOAD .DREST CLASS=DVC.PS ;+ ; SDINST ; This is the simple installation code for SD:. We allow installation ; of SD: as a data device ONLY, as SD: can clearly never be a SYSTEM ; HANDLER! Also, this code verifies that the correct version of RT-11 ; is running and that the correct monitor for this version of DBG is ; running. ;- .DRINS SD SDINST: BR 10$ ;OK to install as data device BR 20$ ;Error, can't install as system device. 10$: CALL MONCHK ;Verify correct monitor and version BCS 20$ ;Branch on mismatch TST (PC)+ ;C=0, ok to install. 20$: SEC ;C=1, Error, invalid system. RETURN ;Return to KMON ;+ ; MONCHK ; This routine checks the type and version of the currently running ; monitor to verify if this version of DBG should work. ; ; CALL MONCHK ; ; R0 -> $RMON ; C=0 Monitor type and version match ; C=1 Monitor type or version mismatch ;- .ENABL LSB MONCHK: MOV @#SYSPTR,R0 ;R0 -> $RMON CMPB SYSVER(R0),#5 ;Version 5? BNE 10$ ;Branch if not, error. CMPB SYSVER+1(R0),#4 ;Version 5.4? BNE 10$ ;Branch if not, also an error. .IF NE, ;If XM or HARD I/O BIT #10,SYSGEN(R0) ;Running under RTEM? BNE 10$ ;Branch if so, no hard I/O or XM allowed! .ENDC; NE, ;If XM or HARD I/O BIT #XMMON$,CONFIG(R0) ;Running under XM ? .IF NE, ;If XM BEQ 10$ ;Branch if not, error. .IFF; NE, ;If XM BNE 10$ ;Branch if so, error. .ENDC; NE, ;If XM 5$: TST (PC)+ ;C=0, ok to install. 10$: SEC ;C=1, Error, invalid system. RETURN ;Return to KMON .IF NE, ;If HARD I/O O.CSR2: CMP R0,R3 ;Is CSR in range? (>160000) BLO 10$ ;Nope... MOV R0,DISCSR ;Set CSR for RESORC display MOV R0,INSCSR ;Set CSR for installation check ADDR CSRTMP,R2 ;R2 -> Temporary CSR storage area before .LOAD MOV #4,R1 ;R1 = Loop counter 20$: MOV R0,(R2)+ ;Stuff CSR ADD #2,R0 ;Increment CSR address SOB R1,20$ ;Loop for the rest BR 5$ ;Return to KMON, all ok. .ENDC; NE, ;If HARD I/O .DSABL LSB .ASSUME . LE 356 ;Must be below this. .DRSET ADROFF,-1,O.ADR,OCT .DRSET BREAK,-1,DOBRK .DRSET DATOFF,-1,O.DAT,OCT .DRSET REG,ON.REG,O.REG,NO .DRSET ESC,ON.ESC,O.REG,NO .DRSET SYSGEN,-1,SETSGN,NO .IF NE, ;If HARD I/O .DRSET CSR, 160000, O.CSR, OCT O.CSR: BR O.CSR2 .ENDC; NE, ;If HARD I/O O.REG: NOP BR 10$ BIC R3,REGFLG ;Clear function indicated BR O.GOOD 10$: BIS R3,REGFLG ;Set function indicated BR O.GOOD O.ADR: MOV R0,ADRTMP ;Save new value in block 0 BR O.GOOD ;Exit. O.DAT: MOV R0,DATTMP ;Save new value in block 0 BR O.GOOD .SBTTL SETSGN - Auto-configure set option for the SD: handler ;+ ; SETSGN ; Auto-configures DBG for the current system configuration. ;- DBGSYM SETSGN SETSGN: NOP CLR R3 ;-> Flag SET ST SYSGEN (R3=0) ;-> SET ST NOSYSGEN (R3 = -1) CALL MONCHK ;Check current monitor type and version BCS O.BAD ;Branch if bad news for user ;R0 -> Base of RMON MOVB SYSGEN(R0),60 ;R0 = Configuration bits that matter to hndlr TST R3 ;SET ST SYSGEN? BEQ O.GOOD ;Branch if so, ok. COMB 60 ;Else prevent future handler installs BR O.GOOD ;Return success .SBTTL DOBRK - Breakpoint DBG for user ;+ ; DOBRK ; This routine allows a simple way to enter SD:, by doing a BPT. The ; user can then continue using the ";P" command. ;- DBGSYM DOBRK DOBRK: CALL SLOT ;Make sure SD: or JD: is loaded! BPT ;Breakpoint us here O.GOOD: TST (PC)+ ;Clear carry O.BAD: SEC ;Set carry, error. RETURN ;Return to KMON .ENDC ; EQ, ;If not VM/SD combo .SBTTL SLOT - Find DBG, in $PNAME table ;+ ; SLOT ; This routine finds DBG, installed as the "SD" device in RT-11. ; ; CALL SLOT ; ; R2 -> Beginning of handler in high memory ;;; R0 -> Base of RMON ;- DBGSYM SLOT .DSTATUS =: 342 ;EMT Code for .DSTATUS request SLOT: MOV #<^RSD>,R2 ;Attempt to find SD first 1$: ADDR 70$,R0 ;R0 -> Device name MOV R2,@R0 ;Stuff device name to find ADDR 60$+1,SP ;(SP)-> .DSTATUS info area(+physical) EMT .DSTATUS ;*** (.DSTAT #DAREA+1,#DEVNAM) *** BCS 10$ ;Branch if not found TST 60$+4 ;Handler loaded? BNE 20$ ;Branch if loaded 10$: CMP #<^RJD>,R2 ;Already tried debug version? BEQ 40$ ;Branch if so, return error MOV #<^RJD>,R2 ;Attempt to find debug version now BR 1$ 20$: MOV 60$+4,R2 ;R2 -> Handler in memory BIT (R2)+,(R2)+ ;R2 -> .DRBEG entry point for handler TST (PC)+ ;C=0 40$: SEC ;C=1 BCC 50$ ;Branch if OK ADDR 80$,R0 ;R0 -> "?SD-F-Handler not loaded" .PRINT ;Give error message TST (SP)+ ;Skip callers return, C=0 50$: ;;; MOV @#SYSPTR,R0 ;R0 -> $RMON RETURN ;Return to caller, or callers caller. 60$: .BLKW 4 ;.DSTAT Information block 70$: .BLKW 1 ;Device name to find 80$: .ASCIZ /?SD-F-Handler must be loaded/ .EVEN .IF EQ, .ASSUME . LE 1000 .SBTTL .DRBEG of SD: handler ;**************** .DRBEG SD DBGSYM SDSTRT DBGSYM ZERO ZERO =.-2 ;Account for new NOP instruction MOV SDCQE,R4 ;Get pointer to current queue element BIS #HDERR$,@-(R4) ;Set hard error bit in channel .DRFIN SD ;Exit to completion .IFF ; EQ, .GLOBL ZERO ;Get location from VM handler .IIF NDF MMG$T, MMG$T=0 .IIF NDF ERL$G, ERL$G=0 .IIF NDF TIM$IT, TIM$IT=0 .ENDC ; EQ, STSYMS: .WORD 0 ;-> ST driver symbols (If in memory) ;**************** SAVTRP: .WORD 0,0 ;BPT .WORD 0,0 ;IOT .WORD 0,0 ;TRAP .COND .WORD 0,0,COND=D$$OUT ;MMU T4SAVE: .WORD 0,0 ;T4 .WORD 0,0 ;T10 ; .WORD 0,0 ;EMT ; .WORD 0,0 ;FPP DBGSYM ADRTMP DBGSYM DATTMP DBGSYM REGFLG ADRTMP: .WORD 1000 ;Default initial value for _ADROFF DATTMP: .WORD 100 ;Default initial value for _DATOFF REGFLG: .WORD 0 ;Flags for _REG and _ESC;T default ON.REG = 1 ;_REG ON.ESC = 2 ;_ESC .IF NE, ;If HARD I/O + PRO support DBGSYM PROFLG PROFLG: .WORD 0 ;<> 0 Says we are running on a PRO/3xx .ENDC; NE, ;If HARD I/O + PRO support .IF NE, ;If HARD I/O CSRTMP: .WORD KB.CSR ;-> keyboard CSR .WORD KB.CSR+2 ;-> keyboard buffer .WORD KB.CSR+4 ;-> printer CSR .WORD KB.CSR+6 ;-> printer buffer .ENDC; NE, ;If HARD I/O .SBTTL TRPCHK - Check to see if we can field a TRAP4 or TRAP10 ;+ ; TRPCHK ; This routine attempts to see if a TRAP4 or TRAP10 can be fielded ; to the user. This routine determines if the user has done a ; .TRPSET directive and if so, fields the trap to the user if ; the user has requested DBG to do so via the ;V command. ;- DBGSYM TRPCHK CNTXT = 320 ;Context fixed offset in FB & XM TRPCHK: MOV R0,-(SP) ;Save USER R0 MOV #1,R0 ;Assume T4 CMP ERRMSG,#"T1 ;Was the trap through vector 10 ? BNE 10$ ;Branch if not, was T4 INC R0 ;Else R0 = 2 for T10 10$: BIT R0,TRPFLG ;Should we handle this? BEQ 60$ ;Branch if not, return and let DBG Handle it MOV @#SYSPTR,R0 ;R0 -> Base of RMON MOV $TRPPC(R0),-(SP) ;@SP = I.TRAP under FB/XM or -> TRAPLC under SJ BIT #FBMON$,CONFIG(R0) ;Running under FB/XM ? BEQ 20$ ;Branch if not, already have pointer to .TRPSET ;routine. ADD CNTXT(R0),@SP ;@SP -> I.TRAP cell in job context 20$: TST @(SP)+ ;Any user traps set? BEQ 60$ ;Branch if not, let DBG handle it. MOV (SP)+,R0 ;Restore USER R0 TST (SP)+ ;Clean our return address, not needed. CMP ERRMSG,#"T1 ;Was the trap through vector 10 ? BEQ 50$ ;branch if so, SET C-BIT TST (PC)+ ;Clear C-BIT for TRAP4 50$: SEC ; Set C-BIT for TRAP10 MOV #0,ERRMSG ;ZAP ERRMSG, save state of C-BIT JMP @T4SAVE ;Go to monitor routine to field the trap. 60$: MOV (SP)+,R0 ;Restore USER R0 RETURN ;Return to let DBG handle the trap. .IF EQ, SDINT:: ;Fake interrupt entry for reference only .SBTTL Fake .DREND to pretend were a RT-11 handler W/ALL options DBGSYM SD$END .DREND SD,FORCE=5,PSECT=ZZDVR .PSECT SETOVR DBGSYM SETOVR SETOVR: .SBTTL SETUP - SET SD: RUN/NORUN option handler for RT-11 SD: debug handler ;+ ; LOAD/UNLOAD ; These routine handles taking over the RT-11 trap vectors after the handler ; has been loaded, and restoring before the handler is un-loaded. ;- .ENABL LSB ; Entry for .LOAD SD .IFF ; EQ, VDLOAD:: .IFT ; EQ, LOAD: TST (PC)+ ;Clear carry - setup ; Entry for .UNLOAD SD UNLOAD: SEC ;Set carry - reseting ROR (PC)+ ;Save state of C-BIT 10$: .WORD 0 ; MOV R5,R0 ;R0 -> $ENTRY table entry for this handler SUB R2,R0 ;R0 -> $PNAME table entry for this handler CMP @R0,#^RSD ;Load/Unload of SD:? BEQ 20$ ;Branch if so, ok. CMP @R0,#^RJD ;Load/Unload of JD:? (Debug copy) BEQ 20$ ;Branch if so, also ok. JSR R0,ERRPRT ;Print error message that follows .ASCIZ /?SD-F-Handler must be named SD/ .EVEN 20$: MOV @R5,R2 ;Save -> xxLQE BIT (R2)+,(R2)+ ;-> Beginning of handler data .IFF ; EQ, .ADDR #ZERO,R2 ;-> Beginning of handler data .IFTF ; EQ, MOV R2,-(SP) ;Save it .IFT ; EQ,SD$$VM> TST 10$ ;Was the command .LOAD BMI 40$ ;Branch if not, was .UNLOAD CALL SLOT1 ;Find ST handler if loaded BCS 30$ ;Branch if not found. MOV STSYMS-ZERO(R2),R1 ;R1 -> First symbol in ST handler MOV @SP,R2 ;R2 -> SD:'s base MOV R1,STSYMS-ZERO(R2) ;Stuff our pointer to ST symbols 30$: MOV @SP,R2 ;R2 -> SD:'s base ; Check if we should SAVE or RESTORE vectors TST T4SAVE-ZERO(R2) ;Did we already do a SAVE? BNE 130$ ;Branch if so, DONE .IFTF ; EQ, ; Setup LOWMAP correctly (140000=20), (001400=34) MOV @#SYSPTR,R0 ;R0 -> $RMON BIS #141400,LOWMAP(R0) ;Take control of IOT and TRAP vectors ..IT0 == .-4 ;**PATCH** Change to ZERO to prevent ;setting protection on IOT and TRAP vec's .IFT ; EQ, BR 50$ ;Go do save 40$: TST T4SAVE-ZERO(R2) ;Did we already do a SAVE? BEQ 130$ ;Branch if not, ignore the request. MOV @#SYSPTR,R0 ;R0 -> $RMON BIC #141400,LOWMAP(R0) ;Reset control of IOT and TRAP vectors ..IT1 == .-4 ;**PATCH** Change to ZERO to prevent ;clearing protection on IOT and TRAP vec's 50$: .IFTF ; EQ, ADD #SAVTRP-ZERO,R2 ;R2 -> Trap save area ADDR VECLST,R0 ;R0 -> Vector list table 60$: MOV (R0)+,R1 ;R1 -> Next vector to save/restore BEQ 80$ ;Branch if at the end .IFT ; EQ, TST 10$ ;Restore or save? BMI 70$ ;Restore, go do it. .IFTF ; EQ, MOV (R1)+,(R2)+ ;Save the vector PS & PC MOV @R1,(R2)+ ;... BR 60$ ;Loop for all .IFT ; EQ, 70$: MOV @R2,(R1)+ ;Restore vector PC and PS CLR (R2)+ ;Clear saved copy MOV @R2,@R1 ;... CLR (R2)+ ;Clear saved copy BR 60$ ;Loop for all .IFTF ; EQ, 80$: MOV @SP,R2 ;Restore R2 .IFT ; EQ, TST 10$ ;Unload? BPL 90$ ;Branch if not BIT #TO.INI,TYPMOD-ZERO(R2) ;Did graphics get initialized? BEQ 120$ ;Branch if not, ok. MOV R2,R0 ;R0 -> ZERO ADD #CLNUP-ZERO,R0 ;R0 -> Graphics cleanup escape sequence BR 110$ ;Go do it. .IFTF ; EQ, 90$: CALL SCOPE ;Modify DBG for scope/non-scope terminal CALL DATMOV ;Move SET SD xxx data into resident DBG .IF NE, ;If HARD I/O + PRO support CLR PROFLG-ZERO(R2) ;Assume NOT running on PRO/3xx MOV @#SYSPTR,R0 ;R0 -> $RMON BIT #PRO$,CONFG2(R0) ;Running on a PRO/3xx series? BEQ 100$ ;Branch if not, ok. INC PROFLG-ZERO(R2) ;Else flag this is a PRO .ENDC; NE, ;If HARD I/O + PRO support 100$: CALL RELOC-ZERO(R2) ;Call RELOCATION routine MOV @SP,R2 ;Restore R2 CALL TRPSET-ZERO(R2) ;Stuff trap vectors MOV @SP,R0 ;R0 -> ZERO ADD #HELLO-ZERO,R0 ;R0 -> DBG IDENT string 110$: .PRINT ;Print the version of DBG and exit. 120$: .COND MOV @SP,R2,COND=D$$OUT ;R2 -> ZERO .COND CALL FIXXMT,COND=D$$OUT ;Fixup XM's FIXTRP routine 130$: TST (SP)+ ;Clean stack. C=0 .IFT ; EQ, CLR R0 ;Don't print and .UNLOAD messages RETURN ;Return to KMON. .IFF ; EQ, BPT ;Enter SD HALT ;Go not from this place BR .-2 ;And return if attempted .IFT ; EQ, ERRPRT: TST 10$ ;Was the command .LOAD? BMI 140$ ;Branch if not, was .UNLOAD .PRINT ;Print error message in -> R0 140$: CLR R0 ;Don't print a .UNLOAD message TST (SP)+ ;Clean stack of saved R0 C=0 RETURN .ENDC ; EQ, .DSABL LSB ;+ ; SCOPE ; This routine modifies the default for _[NO]RUB;T depending ; on the console terminal setting of .SET TT SCOPE .SET TT NOSCOPE. ;- TTCNFG = 424 ;Offset to console terminal config word pointer SCOPE: MOV @#SYSPTR,R0 ;R5 => RMON TST @TTCNFG(R0) ;.SET TT SCOPE in effect? BPL 10$ ;Branch if not. BIS #,TYPMOD-ZERO(R2) BIS #,DTYPMD-ZERO(R2) BR 20$ 10$: BIC #,TYPMOD-ZERO(R2) BIC #,DTYPMD-ZERO(R2) 20$: BIT #ON.REG,REGFLG-ZERO(R2) ;Should we enable graphics register display? BEQ 30$ ;Branch if not. BIS #,TYPMOD-ZERO(R2) BIS #,DTYPMD-ZERO(R2) BR 40$ 30$: BIC #,TYPMOD-ZERO(R2) BIC #,DTYPMD-ZERO(R2) 40$: BIC #,TYPMOD-ZERO(R2) BIT #ON.ESC,REGFLG-ZERO(R2) ;Should we enable as ;S? BEQ 50$ ;Branch if not. BIS #,TYPMOD-ZERO(R2) BIS #,DTYPMD-ZERO(R2) BR 60$ 50$: BIC #,TYPMOD-ZERO(R2) BIC #,DTYPMD-ZERO(R2) 60$: RETURN ;+ ; DATMOV ; This routine moves setup data in DBG resident block 0 to the appointed ; locations withen DBG - driven from a data block called DATDAT. ;- DATMOV: ADDR DATDAT,R0 ;R0 -> Driver data 10$: MOV (R0)+,R1 ;R1 -> Where to get data - non-relocated BEQ 20$ ;Branch if done. SUB #ZERO,R1 ;R1 -> Where to get data - as an offset ADD R2,R1 ;R1 -> Where to get data - ABS MOV (R0)+,-(SP) ;@SP -> Where to move data - non-relocated SUB #ZERO,@SP ;@SP -> Where to move data - as an offset ADD R2,@SP ;@SP -> Where to move data - ABS MOV @R1,@(SP)+ ;Move data to new location BR 10$ ;Loop for more 20$: RETURN ;Return to caller. DATDAT: .WORD ADRTMP,ADROFF .WORD DATTMP,DATOFF .IF NE, ;If HARD I/O .WORD CSRTMP,DBG$RS .WORD CSRTMP+2,DBG$RS+2 .WORD CSRTMP+4,DBG$RS+4 .WORD CSRTMP+6,DBG$RS+6 .ENDC; NE, ;If HARD I/O .WORD 0 ;Trailer entry. .IF NE, ;If XM ;+ ; FIXXMT ; This routine sets/resets the routine FIXTRP's trap vector ; table, to the values currently in the respective trap ; vectors. This allows DBG total control when running. ; ; R2 -> ZERO ; VECLST = List of vectors to pull values from ; ; CALL FIXXMT ; ; R0,R1,R2,R3 Destroyed ;- FIXXMT: MOV @#SYSPTR,R0 ;R0 => RMON MOV $TRPLS(R0),R2 ;R2 => TRPLST in XMSUBS BEQ 20$ ;Branch if address not available ADDR VECLST,R0 ;R0 -> Vector list table MOV #4,R3 ;# Vectors in table to stuff 10$: MOV (R0)+,R1 ;R1 -> Next vector to get values from MOV (R1)+,(R2)+ ;Save the vector PS & PC MOV @R1,(R2)+ ;... SOB R3,10$ ;Loop for all 20$: RETURN ;Return to caller .ENDC; EQ, ;If XM ;+ ; VECLST ; This is the list of vectors that we save/restore when the SD: ; handler is turned on or off. It IS ORDER DEPENDANT, and the order ; MUST match that of the routine FIXTRP's table of vectors. FIXTRP ; can be found in XMSUBS.MAC. ;- VECLST: .WORD S$BPT,S$IOT ;Vector address table for save/restore .WORD S$TRAP .COND .WORD S$MEMM,COND=D$$OUT .WORD S$T4,S$T10 ; .WORD S$EMT,S$FLT .WORD 0 .IF EQ, .SBTTL SLOT1 - Find ST handler in $PNAME table ;+ ; SLOT1 ; This routine finds the ST handler in the system handler tables. ; ; CALL SLOT1 ; ; C-BIT clear R2 -> Beginning of handler in high memory ; C-BIT set Handler not found in memory. ; ; R0 -> Base of RMON ;- .ENABL LSB SLOT1: ADDR 70$,R0 ;R0 -> Device name ADDR 60$+1,SP ;(SP)-> .DSTATUS info area(+physical) EMT .DSTATUS ;*** (.DSTAT #DAREA+1,#DEVNAM) *** BCS 40$ ;Branch if not found MOV 60$+4,R2 ;R2 -> Handler load address BEQ 40$ ;Branch if not loaded BIT (R2)+,(R2)+ ;R2 -> .DRBEG entry point TST (PC)+ ;C=0 40$: SEC ;C=1 50$: MOV @#SYSPTR,R0 ;R0 -> Base of RMON RETURN ;Return to caller, or callers caller. 60$: .BLKW 4 ;.DSTAT Information block 70$: .RAD50 /ST / ;Device name to find .ASSUME . LT SETOVR+2000 .ENDC ; EQ, .DSABL LSB .ENDC; NE, ;If RT/SD: .IIF NE,, .END $DBG .IIF EQ,, .END