Google
 

Trailing-Edge - PDP-10 Archives - ap-c800d-sb - handan.mac
There are 21 other files named handan.mac in the archive. Click here to see a list.
TITLE	HANDAN - HANDY, DANDY DEBUGGING ROUTINES FOR THE COBOL COMPILER.
SUBTTL	/ACK



;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
;  OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
;
;COPYRIGHT (C) 1975, 1979 BY DIGITAL EQUIPMENT CORPORATION

	SEARCH	P
	SEARCH	TABLES

COMMENT	\

	THIS MODULE IN CONJUNCTION WITH DDT ALLOWS ONE TO EXAMINE THE
COMPILER'S TABLES, EASILY.

HOW TO ENTER IT:

	EITHER SET A CONDITIONAL BREAK POINT WITH JSR TTB... AS THE
	CONDITIONAL INSTRUCTION OR DO A JSR TTB...$X TO DDT.

COMMANDS:

	D	TYPE THE DATAB ENTRY WHOSE ADDRESS OR LINK IS IN TA.
	N	TYPE THE NAMTAB ENTRY WHOSE ADDRESS OR LINK IS IN TA.
	F	TYPE THE FILTAB ENTRY WHOSE ADDRESS OR LINK IS IN TA.
	C	TYPE THE CONTAB ENTRY WHOSE ADDRESS OR LINK IS IN TA.
	L	TYPE THE LITAB ENTRY WHOSE ADDRESS OR LINK IS IN TA.
	P	TYPE THE PROTAB ENTRY WHOSE ADDRESS OR LINK IS IN TA.
	E	TYPE THE EXTAB ENTRY WHOSE ADDRESS OR LINK IS IN TA.
	V	TYPE THE VALTAB ENTRY WHOSE ADDRESS OR LINK IS IN TA.
	M	TYPE THE MNETAB ENTRY WHOSE ADDRESS OR LINK IS IN TA.

	ANY OF THE ABOVE LETTERS MAY BE IMMEDIATELY FOLLOWED BY A
SIX DIGIT OCTAL LINK OR ADDRESS WHICH WILL BE PLACED IN TA.  IF THIS
NUMBER IS OMMITED THE CURRENT CONTENTS OF TA ARE USED.

	ANY OF THE ABOVE COMMANDS MAY BE FOLLOWED BY EITHER "A" OR
"L" TO SPECIFY WHETHER WE HAVE A LINK OR AN ADDRESS.  THIS IS NECESSARY
BECAUSE WE MAY NOT BE ABLE TO DETERMINE WHICH IT IS, IN WHICH CASE
"<TAB>?" IS TYPED.

	A COMMAND ERROR OR A REQUEST FOR WHICH THE ROUTINES HAVE NOT
BEEN IMPLEMENTED YET WILL RECEIVE A RESPONSE OF "<TAB>?".

	TO REENTER DDT TYPE "DDT".

	ALL COMMANDS ARE TERMINATED BY A SPACE OR TAB.

\

	SALL

	LODSTR	TA		;DEFINE THE LOAD AND STORE MACROS.
	SUBTTL	COMMAND INTERPRETER.

	DEFINE	CHKDSP	(X, Y)<
	CAIN	TE,	"'X'"
	JRST	[JSP	TD,	GCOMT
		EXP	T'Y
		XWD	T'Y'A,T'Y'L]
>

TTB...::	Z
	PUSH	PP,	TA
	PUSH	PP,	TB
	PUSH	PP,	TC
	PUSH	PP,	TD
	PUSH	PP,	TE

GCOM:	MOVE	TA,	-4(PP)
	INCHRW	TE
	CAIN	TE,	"D"
	JRST		GCOM1
	CHKDSP	N,NAM
	CHKDSP	F,FIL
	CHKDSP	C,CON
	CHKDSP	L,LIT
	CHKDSP	P,PRO
	CHKDSP	E,EXT
	CHKDSP	V,VAL
	CHKDSP	M,MNE

GCOME:	OUTSTR	[ASCIZ	/	?/]
	JRST	GCOM

GCOM1:	INCHRW	TE
	CAIN	TE,	"D"
	JRST		GCOM2
	JSP	TD,	GCOMT+1
	EXP	TDAT
	XWD	TDATA,TDATL

GCOM2:	INCHRW	TE
	CAIN	TE,	"T"
	INCHRW	TE
	CAIE	TE,	"	"
	CAIN	TE,	" "
	JRST		RET
	JRST		GCOME
GCOMT:	INCHRW	TE
	CAIE	TE,	"	"
	CAIN	TE,	" "
	JRST		@(TD)
	CAIN	TE,	"A"
	JRST		GCOMT3
	CAIN	TE,	"L"
	JRST		GCOMT4
	SETZ	TA,
GCOMT1:	CAIG	TE,	"7"
	CAIGE	TE,	"0"
	JRST		GCOMT2
	LSH	TA,	3
	IORI	TA,	-60(TE)
	INCHRW	TE
	JRST		GCOMT1
GCOMT2:	CAIE	TE,	"	"
	CAIN	TE,	" "
	JRST		@(TD)
	SETZ	TC,
	CAIN	TE,	"A"
GCOMT3:	HLR	TC,	1(TD)
	CAIN	TE,	"L"
GCOMT4:	HRR	TC,	1(TD)
	JUMPN	TC,	(TC)
	JRST		GCOME
	SUBTTL	RETURN TO DDT

RET:	POP	PP,	TE
	POP	PP,	TD
	POP	PP,	TC
	POP	PP,	TB
	POP	PP,	TA
	JRST		@TTB...
	SUBTTL	USEFUL MACROS

	DEFINE	START	(X)<
T'X':	MOVEI	TE,	X'LOC##
	JSP	TD,	GUESS
	JRST		T'X'A
T'X'L:	ANDI	TA,	77777
	ADD	TA,	X'LOC##
T'X'A:	HRRZI	TA,	(TA)
	CAML	TA,	.JBREL##
	JRST		GCOME
	N==0
>

	DEFINE	PUTWRD<
	OUTSTR		CRLF
	MOVEI	TC,	N(TA)
	PUSHJ	PP,	HLFOUT
	OUTSTR		SLSTAB
	MOVE	TC,	N(TA)
	PUSHJ	PP,	WRDOUT
	TLZ	TA,	777777
	N==N+1
>

	DEFINE	PHRST<
	TLOE	TA,	(1B0)
	OUTSTR		STPHRS
>
	SUBTTL	TYPE A NAMTAB ENTRY.

	START	NAM
	PUTWRD
	TLZN	TC,	(1B2)
	JRST		TNAM1
	OUTSTR	[ASCIZ	/RESERVED WORD, CODE: /]
	HLRZ	TC,	TC
	PUSHJ	PP,	DECOUT
	JRST		TNAM2
TNAM1:	OUTSTR	CRLF
	PUSHJ	PP,	TPESNL
TNAM2:	OUTSTR	CRLF
	MOVEI	TC,	(TA)
	PUSHJ	PP,	TPENA1
	OUTSTR	CRLF
	JRST		GCOM
	SUBTTL	TYPE A DATAB ENTRY.

	START	DAT
	PUTWRD				;FIRST WORD.
	LOAD	TC,	DA%NAM
	SKIPE		TC
	PUSHJ	PP,	TPENAM
	HRRZ	TC,	(TA)
	SKIPE		TC
	PUSHJ	PP,	TPESNL
	PUTWRD				;SECOND WORD.
	LOAD	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TDATN:	OUTSTR		CRLF
	MOVEI	TC,	(TA)
	PUSHJ	PP,	HLFOUT
	OUTSTR		SLSTAB
	MOVE	TC,	(TA)
	PUSHJ	PP,	WRDOUT
	AOBJN	TA,	TDATN
	JRST		GCOM

	JRST		GCOM
	SUBTTL	UNIMPLEMENTED ROUTINES.

	DEFINE UNIMP	(X) <
T'X':	T'X'A:	T'X'L:	JRST	GCOME
>

	UNIMP	FIL
	UNIMP	CON
	UNIMP	LIT
	UNIMP	PRO
	UNIMP	EXT
	UNIMP	VAL
	UNIMP	MNE
	SUBTTL	MISCELLANIOUS ROUTINES.

;TRY TO GUESS WHETHER WE HAVE A LINK OR AN ADDRESS:

;CALL:
	JSP	TD,	GUESS
;ENTRY CONDITIONS:
;	(TA) = LINK OR ADDRESS.
;	(TE) = ADDRESS OF LOCATION CONTAINING THE TABLE'S STARTING ADDRESS.
;EXIT CONDITIONS:
;	IF IT LOOKS LIKE A LINK OR AN ADDRESS WE RETURN TO CALL+1 WITH
;THE ADDRESS IN TA, OTHERWISE WE RETURN TO THE COMMAND INTERPRETER'S
;ERROR ENTRY POINT.

GUESS:	TRNN	TA,	700000
	JRST		GUESS2
	HRRZ	TC,	1(TE)
	CAIGE	TC,	(TA)
	JRST		GUESS1
	HRRZ	TC,	(TE)
	CAIG	TC,	(TA)
	JRST		(TD)
GUESS1:	TRZA	TA,	700000
GUESS2:	HRRZ	TC,	(TE)
	CAIL	TC,	(TA)
	ADDI	TA,	(TC)
	HRRZ	TC,	1(TE)
	CAIGE	TC,	(TA)
	JRST		GCOME
	JRST		(TD)
;THE FOLLOWING ROUTINES ALWAYS RESTORE ANY AC'S THAT THEY USE.

;TYPE A WORD IN OCTAL:
;	(TC) = WORD TO BE TYPED.

WRDOUT:	MOVSS	TC,	TC
	PUSHJ	PP,	HLFOUT
	OUTCHR	SPACE
	MOVSS	TC,	TC
	PUSHJ	PP,	HLFOUT
	OUTCHR	TAB
CPOPJ:	POPJ	PP,

;TYPE A HALF WORD IN OCTAL:
;	RH(TC) = HALF WORD TO BE TYPED.

HLFOUT:	PUSHJ	PP,	S%CD
	HRLOS	TC,	TC
	SETZ	TD,
	LSHC	TD,	3
	ADDI	TD,	60
	OUTCHR	TD
	TRNE	TC,	-1
	JRST		.-5
	POPJ	PP,

;TYPE OUT A NUMBER IN DECIMAL.
;	(TC) = NUMBER TO BE TYPED.

DECOUT:	PUSHJ	PP,	S%BC
	PUSHJ	PP,	YORNP
	OUTCHR	DOT
	POPJ	PP,

;YE OLD RECURSIVE NUMBER PRINTER.

YORNP:	IDIVI	TC,	12
	HRLM	TB,	(PP)
	SKIPE		TC
	PUSHJ	PP,	YORNP
	HLRZ	TC,	(PP)
	ADDI	TC,	60
	OUTCHR	TC
	POPJ	PP,
;TYPE A NAME.

TPENAM:	PUSHJ	PP,	S%CD		;ENTER HERE IF (TC) = NAMTAB LINK.
	ADD	TC,	NAMLOC##
	JRST		TPENA2
TPENA1:	PUSHJ	PP,	S%CD		;ENTER HERE IF (TC) = NAMTAB ADDRESS.
TPENA2:	HRRZI	TC,	1(TC)
	HRLI	TC,	(POINT 6,0)
TPENA3:	ILDB	TD,	TC
	TRNN	TD,	60
	POPJ	PP,
	CAIN	TD,	':'
	MOVEI	TD,	'-'
	CAIN	TD,	';'
	MOVEI	TD,	'.'
	MOVEI	TD,	40(TD)
	OUTCHR	TD
	JRST		TPENA3


;TYPE A SAME NAME LINK.
;	RH(TC) = SAME NAME LINK.

TPESNL:	PUSHJ	PP,	S%ALL
	HRRZI	TA,	(TC)
	PUSHJ	PP,	LNKSET
	OUTSTR	[ASCIZ	/	SAME NAME LINK: /]
	HRRZI	TC,	(TA)
	PUSHJ	PP,	HLFOUT
	LDB	TC,	[POINT 3,-3(PP),20]
	LSH	TC,	1
	OUTSTR	[ASCIZ	/ IN /]
	OUTSTR	TBLNMS(TC)
	POPJ	PP,


;TYPE OUT THE TEXT POINTED TO BY TE FOLLOWED BY RH(TC) IF TC IS
; NOT ZERO.

PPAHLF:	OUTS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