.TITLE SHOW .IDENT "V1.7" ; ; Author: D. Mischler 14-JUN-87 ; ; This module implements the SHOW command. ; HST.IN = 1 ; SHOW HISTORY/INSTRUCTIONS bit. HST.RE = 2 ; SHOW HISTORY/REGISTERS bit. .PAGE .SBTTL Top-level dispatch .PSECT CODE,I,RO ; ; Dispatch on SHOW keyword. ; SHOW:: CALL U$FNXT ; Find primary keyword, OK? BCS MISARG ; No, complain. MOV #SHOTBL,R1 ; Point to SHOW keyword table. CALL U$DCOD ; Decode keyword, OK? BCS ERRXIT ; No, complain. CALL TRMATT ; Attach the terminal. CALL (R2) ; Process keyword. CALLR TRMDET ; Detach the terminal. ; SHOW command keyword is missing. MISARG: MOV #E.RAMS,R1 ; Point to error message. ERRXIT: CALLR ERROR ; Display error message. .PAGE .SBTTL Show mode ; ; Show mode parameter settings. ; SHOMOD: MOV #TRMBUF,R0 ; Point to start of terminal buffer. MOV NCFLGS,R5 ; Get numeric conversion flags. MOVB R5,R1 ; Get conversion radix. MOV #RDXTBL,R2 ; Point to radix name table. CALL BUFNAM ; Buffer radix name, OK? BCS ERRXIT ; No, complain. MOVB #' ,(R0)+ ; Delimit radix string. MOV R5,R1 ; Copy conversion flags. BIC #^C,R1 ; Leave only the sign bit. MOV #SGNTBL,R2 ; Point to signed conversion table. CALL BUFNAM ; Buffer signed value keyword. MOVB #' ,(R0)+ ; Delimit signed conversion string. MOV R5,R1 ; Copy conversion flags again. BIC #^C,R1 ; Leave only the leading zeroes bit. MOV #LDZTBL,R2 ; Point to table of leading zero strings. CALL BUFNAM ; Buffer keyword only if enabled. CALL U$RMTB ; Remove possible trailing blank. MOVB #' ,(R0)+ ; Delimit last keyword displayed. MOV SINGLE,R1 ; Get single value output flag. MOV #SNGLTB,R2 ; Point to keyword table. CALL BUFNAM ; Buffer keyword only if enabled. CALL U$RMTB ; Remove possible trailing blank. MOVB #' ,(R0)+ ; Delimit last keyword displayed. MOV CNMODE,R1 ; Get value conversion pointer. MOV #CNVTBL,R2 ; Point to table of keyword values. CALL BUFNAM ; Buffer symbolic/nosymbolic keyword. CALL U$RMTB ; Remove possible trailing blank. MOVB #' ,(R0)+ ; Delimit last keyword displayed. MOV SIMENB,R1 ; Get instruction simulation enable flag. MOV #SIMTBL,R2 ; Point to keyword table. CALL BUFNAM ; Buffer keyword only if enabled. CLRB (R0) ; Terminate output buffer. MOV #TRMBUF,R1 ; Point to mode parameters text. CALLR LINOUT ; Display data and exit. .PAGE .SBTTL Show output ; ; Show output parameter settings. ; SHOOUT: MOV #TRMBUF,R0 ; Point to start of terminal buffer. MOV ATTENB,R1 ; Get output attachment enable flag. MOV #ATTKTB,R2 ; Point to keyword table. CALL BUFNAM ; Buffer appropriate keyword. MOVB #' ,(R0)+ ; Space out to next field. MOV LOGENB,R1 ; Get log enable flag. MOV #LOGKTB,R2 ; Point to keyword table. CALL BUFNAM ; Buffer appropriate keyword. MOVB #' ,(R0)+ ; Space out to next field. MOV TRMENB,R1 ; Get terminal output enable flag. MOV #TRMKTB,R2 ; Point to keyword table. CALL BUFNAM ; Buffer appropriate keyword. MOVB #' ,(R0)+ ; Space out to next field. MOV VFYENB,R1 ; Get verification enable flag. MOV #VFYKTB,R2 ; Point to keyword table. CALL BUFNAM ; Buffer appropriate keyword. CLRB (R0) ; Terminate output buffer. MOV #TRMBUF,R1 ; Point to output parameters text. CALLR LINOUT ; Display data and exit. .PAGE .SBTTL Show type ; ; Show default data type parameter setting. ; SHOTYP: MOV #TRMBUF,R0 ; Point to start of terminal buffer. MOV DSPTYP,R1 ; Get current default display type. MOV #TYPTBL,R2 ; Point to type keyword name table. CALL BUFNAM ; Buffer name, OK? BCS ERRXIT ; No, complain. CLRB (R0) ; Terminate output buffer. MOV #TRMBUF,R1 ; Point to mode parameters text. CALLR LINOUT ; Display data and exit. .SBTTL Show symbol table ; ; Show symbol table. ; SHOSYM: MOV #SYMTBL,R5 ; Point to symbol table head. MOV NCFLGS,R3 ; Get numeric conversion flags. ASH #-11.,R3 ; Position field width. BIC #^C<37>,R3 ; Mask to field width. ADD #7,R3 ; Account for symbol name and plus sign. NEG R3 ; Negate maximum field width. ADD #TRMBUF+76.,R3 ; Produce end of line pointer. 10$: MOV #TRMBUF,R0 ; Point to terminal buffer. 20$: MOV (R5),R5 ; Get address of next symbol entry, zero? BEQ 30$ ; Yes, finish up. MOVB #' ,(R0)+ ; Delimit next value. MOVB #' ,(R0)+ MOV S.NAME(R5),R1 ; Get first word of name. CALL C$R50 ; Convert it to ASCII. MOV S.NAME+2(R5),R1 ; Get second word of name. CALL C$R50 ; Convert it to ASCII too. MOVB #'=,(R0)+ ; Delimit name from value. MOV S.VALU(R5),R1 ; Get symbol value. CALL C$NUM ; Convert it to a numeric. CMP R0,R3 ; Will another value fit on this line? BLO 20$ ; Yes, buffer it. ; Display the line. 30$: MOV #TRMBUF,R1 ; Point to start of line. CMP R0,R1 ; Is line empty? BEQ 40$ ; Yes, all finished. CLRB (R0) ; Terminate line buffer. CALL LINOUT ; Display line. BR 10$ ; Begin a new line. ; Empty line indicates completion. 40$: RETURN .PAGE .SBTTL Show break, trace and watchpoints ; ; Show breakpoints. ; SHOBRK: MOV #BRKLST,R5 ; Point to breakpoint list head. BR .SHPNT ; Enter common code. ; ; Show tracepoints. ; SHOTRC: MOV #TRCLST,R5 ; Point to tracepoint list head. BR .SHPNT ; Enter common code. ; ; Show watchpoints. ; SHOWCH: MOV #WCHLST,R5 ; Point to watchpoint list head. .SHPNT: MOV NCFLGS,R3 ; Get numeric conversion flags. ASH #-11.,R3 ; Position field width. BIC #^C<37>,R3 ; Mask to field width. ADD #7,R3 ; Account for symbol name and plus sign. NEG R3 ; Negate maximum field width. ADD #TRMBUF+76.,R3 ; Produce end of line pointer. 10$: MOV #TRMBUF,R0 ; Point to terminal buffer. 20$: MOV (R5),R5 ; Get address of next point list entry, zero? BEQ 30$ ; Yes, finish up. MOVB #' ,(R0)+ ; Delimit next value. MOVB #' ,(R0)+ MOV P.ADDR(R5),R1 ; Get break/watch point address. CALL C$SYMB ; Display it as symbolically as possible. CMP R0,R3 ; Will another value fit? BLO 20$ ; Yes, buffer it. ; Display the line. 30$: MOV #TRMBUF,R1 ; Point to start of line. CMP R0,R1 ; Is line empty? BEQ 40$ ; Yes, all finished. CLRB (R0) ; Terminate line buffer. CALL LINOUT ; Display line. BR 10$ ; Begin a new line. ; Empty line indicates completion. 40$: RETURN .PAGE .SBTTL Show profile ranges and/or counters. ; ; SHOW PROFILE and SHOW PROFILE/COUNTERS. ; SHOPRO: CALL U$FNXT ; Is there a following keyword? BCS 20$ ; No, just show all profile ranges. CMPB #'/,-1(R0) ; Is keyword delimiter a slash? BNE 20$ ; No, show all profile ranges. MOV #PROTBL,R1 ; Point to SHOW PROFILE keyword table. CALL U$DCOD ; Decode keyword, OK? BCS 10$ ; No, complain. CALLR (R2) ; Process keyword. ; Complain about unknown keyword. 10$: CALLR ERROR ; Complain and exit. ; Show all profile ranges. 20$: MOV #PROLST,R5 ; Point to profile range list header. 30$: MOV (R5),R5 ; Point to next profile range, OK? BEQ 40$ ; No, all finished. MOV #TRMBUF,R0 ; Point to start of terminal buffer. MOV PR.BAS(R5),R1 ; Get base address of range. CALL C$VALU ; Display it. MOVB #':,(R0)+ ; Delimit range values. MOV PR.BAS(R5),R1 ; Get base address again. ADD PR.RNG(R5),R1 ; Add range size. SUB #2,R1 ; Get top address of range. CALL C$VALU ; Display it. MOVB #' ,(R0)+ ; Separate range from compression factor. MOVB #' ,(R0)+ MOV PR.CMP(R5),R1 ; Get compression factor. CALL C$NUM ; Display it. CLRB (R0) ; Terminate buffer. MOV #TRMBUF,R1 ; Point to message buffer. CALL LINOUT ; Display it. BR 30$ ; Do next profile range block. 40$: RETURN ; ; Show profile counters. ; SHOPRC: MOV #PROLST,R5 ; Point to profile range list header. 10$: MOV (R5),R5 ; Point to next profile range, OK? BEQ 20$ ; No, all finished. MOV R5,-(SP) ; Save R5. CALL DSPRC ; Display counters for this range. MOV (SP)+,R5 ; Restore range block address. BR 10$ ; Try next range. 20$: RETURN .PAGE ; ; Subroutine to display profile counters for a single range. ; DSPRC: MOV R5,R3 ; Copy profile range block address. MOV PR.BAS(R3),R5 ; Get base address. MOV PR.CMP(R3),R4 ; Get compression factor. ASL R4 ; Double to get bytes per counter. MOV PR.RNG(R3),-(SP); Push range size. ADD R5,(SP) ; Make it top address + 2. ADD #PR.CNT,R3 ; Point to the first counter. 10$: MOV #TRMBUF,R0 ; Point to terminal buffer. CALL U$ADDR ; Load symbolic address into buffer. MOV R3,R1 ; Copy counter address. CLR R2 ; Suppress leading zeroes. CALL $CDDMG ; Convert long value to decimal. MOVB #'.,(R0)+ ; Indicate value is always decimal. CLRB (R0) ; Terminate buffer. MOV #TRMBUF,R1 ; Point to message. CALL LINOUT ; Display it. ADD #4,R3 ; Point to next counter. ADD R4,R5 ; Bump address for next counter. CMP R5,(SP) ; All done with this range? BLO 10$ ; No, keep going. TST (SP)+ ; Clean up stack. RETURN .PAGE .SBTTL Show history ; ; Show history buffer. ; SHOHST: MOV NCFLGS,-(SP) ; Save numeric conversion flags. CLR -(SP) ; Zero action mask. 10$: CALL U$FNXT ; Is there a following keyword? BCS 30$ ; No, perform requsted action. CMPB #'/,-1(R0) ; Is keyword delimiter a slash? BNE 30$ ; No, time to perform. MOV #HSTTBL,R1 ; Point to SHOW HISTORY keyword table. CALL U$DCOD ; Decode keyword, OK? BCS 20$ ; No, complain. BIS R2,(SP) ; Or keyword into action mask. BR 10$ ; Get next keyword. ; Unknown keyword detected. 20$: CMP (SP)+,(SP)+ ; Clean up stack. CALLR ERROR ; Output error message. ; Keywords have been processed: perform desired action. 30$: TST (SP) ; Display history buffer size (default)? BNE 40$ ; No, display history data. MOV #TRMBUF,R0 ; Point to terminal output buffer. MOV HSTSIZ,R1 ; Get size of buffer in entries. CALL C$NUM ; Convert it to a numeric in current radix. CLRB (R0) ; Terminate output buffer. CMP (SP)+,(SP)+ ; Clean up stack. MOV #TRMBUF,R1 ; Point to output line. CALLR LINOUT ; Display history size line and exit. ; Display history buffer. 40$: CMPB #2,RADIX ; Some joker have radix set to binary? BNE 50$ ; No, it's OK. MOV OCTFMT,NCFLGS ; Make it octal. 50$: MOV HSTPTR,R4 ; Point to last used entry, zero? BEQ 100$ ; Yes, there is no history buffer. CALL XPRESS ; Is there a count parameter? BCS 60$ ; No, display the whole buffer. TST R1 ; Is count zero? BEQ 60$ ; Yes, display entire buffer. CMP R1,HSTSIZ ; Is count greater than buffer size? BHIS 60$ ; Yes, display entire buffer. SUB HSTBUF,R4 ; Produce buffer offset to current pointer. MUL #18.,R1 ; Multiply count by entry size. SUB R1,R4 ; Back up history buffer offset, too far? BMI 55$ ; Yes, offset backwards from end of buffer. ADD HSTBUF,R4 ; Produce history buffer pointer. BR 60$ ; Display specified part of history buffer. ; History buffer offset is negative. 55$: ADD HSTEND,R4 ; Produce history buffer pointer. ; Loop to display all history entries. 60$: BIT #HST.RE,(SP) ; Display registers? BEQ 70$ ; No, check for instruction. CALL HSTREG ; Display registers from history buffer. 70$: BIT #HST.IN,(SP) ; Display instruction? BEQ 80$ ; No, just bump pointer. CALL HSTINS ; Display instruction from history buffer. 80$: ADD #18.,R4 ; Point to next history entry. CMP R4,HSTEND ; Reached end of history buffer? BLO 90$ ; No, pointer is OK. MOV HSTBUF,R4 ; Point to start of history buffer. 90$: CMP R4,HSTPTR ; All entries displayed? BNE 60$ ; No, do another. 100$: TST (SP)+ ; Clean up stack. MOV (SP)+,NCFLGS ; Restore original conversion flags. RETURN .PAGE ; ; Routine to display registers from history entry pointed to by R4. ; HSTREG: MOV #TRMBUF,R0 ; Point to terminal output buffer. MOV NCFLGS,-(SP) ; Save numeric conversion flags. BIS #NC.LDS,NCFLGS ; Force leading spaces. ADD #NC.WID*2,NCFLGS ; Add 2 spaces per word. MOV R4,R5 ; Copy history entry address. MOV #9.,R3 ; Get number of registers in entry. 10$: MOV (R5)+,R1 ; Get a register. CALL C$NUM ; Convert it to ASCII. SOB R3,10$ ; Convert 'em all. CLRB (R0) ; Terminate output buffer. MOV (SP)+,NCFLGS ; Restore numeric conversion flags. MOV #TRMBUF,R1 ; Point to output line. CALLR LINOUT ; Dump line and return. ; ; Routine to show the instruction for history entry pointed to by R4. ; HSTINS: MOV TC.PC(R4),R5 ; Get instruction address. MOV #TRMBUF,R0 ; Point to start of terminal buffer. CALL U$ADDR ; Buffer instruction address. CALL DISASM ; Disassemble the instruction. CLRB (R0) ; Terminate the buffer. MOV #TRMBUF,R1 ; Point to output line. CALLR LINOUT ; Dump line and return. .PAGE .SBTTL Buffer name of keyword value ; ; Subroutine to buffer the name associated with a keyword value. ; ; On entry: R0 points to buffer, R1 contains value, R2 points to table. ; On exit: R0 points after buffered name, R2 is destroyed. ; The carry will be set if the value is not found (R1 -> error). ; BUFNAM: TST (R2)+ ; End of table? BEQ 100$ ; Yes, indicate failure. CMP R1,(R2)+ ; Found the appropriate entry? BNE BUFNAM ; No, keep looking. MOV -4(R2),R2 ; Get keyword name address. 10$: MOVB (R2)+,(R0)+ ; Buffer the keyword name, done? BNE 10$ ; No, continue. DEC R0 ; Back up over terminator. CLC ; Indicate success. RETURN ; Failed to locate value. 100$: MOV #E.ICCF,R1 ; Get error code. SEC ; Indicate failure. RETURN .PAGE .SBTTL Keyword dispatch tables .PSECT RODATA,D,RO ; ; Top-level SHOW keyword table. ; SHOTBL: KEYWRD BREAK,SHOBRK ; Breakpoint list. KEYWRD HISTORY,SHOHST ; History. ; KEYWRD LOG,SHOLOG ; Log file name. KEYWRD MODE,SHOMOD ; Mode parameters. KEYWRD OUTPUT,SHOOUT ; Output parameters. KEYWRD PROFILE,SHOPRO ; Profile. KEYWRD SYMBOL,SHOSYM ; Symbol table. KEYWRD TRACE,SHOTRC ; Tracepoint list. KEYWRD TYPE,SHOTYP ; Display type. KEYWRD WATCH,SHOWCH ; Watchpoint list. .WORD 0 .PAGE .SBTTL Parameter name tables ; ; Table of OUTPUT ATTACH keywords. ; ATTKTB: KEYWRD ATTACH,1 KEYWRD NOATTACH,0 .WORD 0 ; ; Table of symbolic keyword values. ; CNVTBL: KEYWRD SYMBOLIC,C$SYMB KEYWRD NOSYMBOLIC,C$NUM .WORD 0 ; ; Table of SHOW HISTORY keywords. ; HSTTBL: KEYWRD INSTRUCTIONS,HST.IN KEYWRD REGISTERS,HST.RE .WORD 0 ; ; Table of leading zeroes keyword strings. ; LDZTBL: KEYWRD LEADING,NC.LDZ .WORD 0 ; ; Table of OUTPUT LOG keywords. ; LOGKTB: KEYWRD LOG,1 KEYWRD NOLOG,0 .WORD 0 ; ; Table of SET PROFILE keywords. ; PROTBL: KEYWRD COUNTERS,SHOPRC .WORD 0 ; ; Table of radix names. ; RDXTBL: KEYWRD BINARY,2 KEYWRD OCTAL,8. KEYWRD DECIMAL,10. KEYWRD HEXADECIMAL,16. .WORD 0 .PAGE ; ; Table of signed conversion keyword strings. ; SGNTBL: KEYWRD SIGNED,NC.SGN KEYWRD UNSIGNED,0 .WORD 0 ; ; Table for simulation mode string. ; SIMTBL: KEYWRD SIMULATE,-1 .WORD 0 ; ; Table for single value mode string. ; SNGLTB: KEYWRD SINGLE,-1 .WORD 0 ; ; Table of OUTPUT TERM keywords. ; TRMKTB: KEYWRD TERM,1 KEYWRD NOTERM,0 .WORD 0 ; ; Table of OUTPUT VERIFY keywords. ; VFYKTB: KEYWRD VERIFY,1 KEYWRD NOVERIFY,0 .WORD 0 .END