.MCALL .MODULE .MODULE INDDMP,VERSION=03,COMMENT= ; 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. .ENABL GBL,LC .SBTTL Macro and data definitions .MCALL .PRINT .MCALL DEFIN$, RT5DF$ DEFIN$ ;Definitions for IND files RT5DF$ ;RT specific definitions OPSECT INDDMP ;+ ;Commands for DUMP directive (in ASCII) ;- .NLIST BEX STYPE: .ASCIZ /GLOBAL/ ;Display global symbols .ASCIZ /LOCAL/ ;Display local symbols .ASCIZ /SPECIAL/ ;Display special symbols .BYTE 0 ;End of command table .EVEN .LIST BEX ;+ ;Entry points for commands listed above. ;- STABL: .WORD GLOBAL ;Entry point to display global symbols .WORD LOCAL ;Entry point to display local symbols .WORD SPCIAL ;Entry point to display special symbols .SBTTL DUMP - Display contents of symbol table ;+ ;DUMP ;The following is the entry point to the dump routine. Point to the ;symbol type word in the DUMP command. If there is no symbol type word ;all three symbol types are dumped. A match causes execution of the ;specific subroutine. ;- .ENABL LSB DUMP:: CALL $GNBLK ;Get next non-blank character BCC 1$ ;Branch if not end of line CALL ALL ;Display all three types of symbols BR 3$ ;Complete display ;+ ;Determine symbol type to display. ;- 1$: TSTB -(R0) ;Point to start of subject MOV #STYPE,R2 ;Point to table of symbol types CALL TBSRC ;Identify command BCC 2$ ;Branch if symbol type is found TRAP ERSYN ;Syntax error ;+ ;Goto specific routine and display the symbols. ;- 2$: .PRINT #BNDRY ;Print boundry CALL @STABL(R1) ;Goto appropriate command 3$: .PRINT #BNDRY ;Print boundry JMP INDRD ;Go get another command line .DSABL LSB .SBTTL ALL - Subroutine to dump all symbols ;+ ;ALL ;This routine displays all symbols. It first displays the special symbols, ;followed by all global and all local symbols. ;- ALL: .PRINT #BNDRY ;Print boundry CALL SPCIAL ;Display special symbols CALL GLOBAL ;Display global symbols CALL LOCAL ;Display local symbols RETURN .SBTTL SPCIAL - Display special symbols ;+ ;SPCIAL ;Update certain special symbols incase they have been changed.Then display ;all special symbols. ;- .ENABL LSB SPCIAL: .PRINT #SPCHDR ;Print header MOV SYMND,R1 ;Get start of local symbol table SUB SYMFR,R1 ;Minus end of global symbols to get # of free ;bytes in symbol table MOV R1,SEVAL+SPACE ;Store the value CALL TIMDAT ;Get new time and date before displaying MOV #SPCTAB,R5 ;Point to start of special table MOV #SPCEND,R4 ;Point to end of table CALL DMPSYM ;Display symbols TST (R4)+ ;Point to FILSPC entry MOV R4,R5 ;Point to filespec CALL 1$ ;Display the FILSPC symbol entry MOV #SPSDEV,R5 ;Point to 1$: CLR R4 ;Clear end of list pointer BISB SELEN(R5),R4 ;Get the string length ADD R5,R4 ;Add in base ADD #SEVAL+1,R4 ;Add enough for start of string plus 1 for end BIC #1,R4 ;Round off CALL DMPSYM ;Display the file spec RETURN .DSABL LSB .SBTTL GLOBAL - Display global symbols ;+ ;GLOBAL ;Subroutine to display all global symbols. ;- .ENABL LSB GLOBAL: .PRINT #GLBHDR ;Print the global symbol header MOV SYMTB,R5 ;R5 -> start of global symbol table MOV SYMFR,R4 ;R4 -> end of global symbol table CMP R4,R5 ;Any to display? BEQ 1$ ;Branch if no CALL DMPSYM ;Display the symbols BR 2$ ;Exit through common return 1$: .PRINT #NOGBL ;Inform of fact 2$: RETURN .DSABL LSB .SBTTL LOCAL - Display all local symbols ;+ ;LOCAL ;Subroutine to display all local symbols. ;- .ENABL LSB LOCAL: .PRINT #LCLHDR ;Print the local symbol header MOV SYMND,R5 ;R5 -> start of local symbol table MOV LSYME,R4 ;R4 -> end of local symbol table 1$: CMP R5,R4 ;Any local symbols? BEQ 2$ ;Branch if no CALL DMPSYM ;Display the symbols BR 3$ ;Exit through common return 2$: .PRINT #NOLCL ;Print message 3$: RETURN .DSABL LSB .SBTTL DMPSYM - Display symbols ;+ ;DMPSYM ;The following subroutine finds the symbol in the table, generates a text ;string and prints the symbol information. ; ;Input: R4 -> end of symbol table to display ; R5 -> start of symbol table to display ;- .ENABL LSB DMPSYM: MOV #TERM,R0 ;Point to area to store symbol and contents MOV @R5,R1 ;Get first word of symbol name CALL $C5TA ;Convert to ASCII and store MOV 2(R5),R1 ;Get second word of symbol name CALL $C5TA ;Convert to ASCII and store ;+ ;After storing the symbol name, determine the symbol type and store its type ;in the string. ;- MOVB #,(R0)+ ;Move in open paren MOVB #'L,@R0 ;Assume logical MOVB SETYP(R5),-(SP) ;Get symbol type BITB #,@SP ;String or numeric symbol? BEQ 1$ ;Branch if no, L has been stored MOVB #'S,@R0 ;Assume string symbol BITB #,@SP ;Do we have a string symbol? BNE 1$ ;Branch if yes MOVB #'O,@R0 ;Assume an octal numeric BIT #1,@SP ;Do we have an octal symbol? BEQ 1$ ;Branch if yes MOVB #'D,@R0 ;Store a D for decimal symbol 1$: TSTB (R0)+ ;Point to next byte in string MOVB #,(R0)+ ;Store close paren MOVB #,(R0)+ ;Use colon MOVB #,(R0)+ ;and space for end of symbol name and type ;+ ;Store contents of symbol. If the symbol type is string surround the ;contents with double quotes. ;- BITB #,@SP ;String symbol? BEQ 4$ ;Branch if no MOVB #,(R0)+ ;Start string with quote ADD #SEVAL,R5 ;Point to start of string MOVB -1(R5),R3 ;Get string length BEQ 3$ ;Branch if blank string 2$: MOVB (R5)+,(R0)+ ;Move in a character DECB R3 ;Decreament the count BNE 2$ ;Branch if not done 3$: MOVB #,(R0)+ ;End string with quote BIT #1,R5 ;Left on an odd boundry? BEQ 9$ ;No need to round up INC R5 ;Round up BR 9$ ;End string ;+ ;OCTAL or DECIMAL value. ;- 4$: BITB #,@SP ;Numerical symbol? BEQ 7$ ;No, treat as a logical symbol MOV SEVAL(R5),R1 ;Get numeric value CLR R2 ;Suppress leading zeros BITB #<1>,@SP ;Decimal value? BNE 5$ ;Branch if yes CALL $CBOMG ;Convert to octal ASCII BR 6$ ;Branch around decimal conversion 5$: CALL $CBDMG ;Convert to decimal conversion MOVB #,(R0)+ ;Add trailing . 6$: ADD #10,R5 ;Point to next symbol BR 9$ ;End string and print ;+ ;Logical. ;- 7$: MOVB #<'T>,(R0)+ ;Default to true TSTB @SP ;Logical true? BEQ 8$ ;Yes MOVB #<'F>,-1(R0) ;Symbol is set FALSE 8$: ADD #6,R5 ;Point to next symbol 9$: TST (SP)+ ;Throw away symbol type CLRB @R0 ;End of text string .PRINT #TERM ;Display the symbol and its contents CMP R5,R4 ;Are there any local symbols? BNE DMPSYM ;Branch around if there are 10$: RETURN .DSABL LSB ROUNDUP ;Check for overflow and roundup .END