Google
 

Trailing-Edge - PDP-10 Archives - tops20-v7-ft-dist1-clock - 7-sources/ddbsym.mac
There are 4 other files named ddbsym.mac in the archive. Click here to see a list.
UNIVERSAL DDBSYM -- MACRO programming environment

;
;	COPYRIGHT (C) DIGITAL EQUIPMENT CORPORATION 1984, 1986.
;	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.
;

SUBTTL Standard register definitions

T0==0
T1==1
T2==2
T3==3
T4==4
T5==5
P1=6
P2=7
P3=10
P4=11
P5=12
P6=13
P7=14
F=15
CX=16
P=17

;   Define a standard version number word
	DEFINE VERS. (MAJVER, MINVER, EDIT, VCUST)
	    <BYTE (3)VCUST(9)MAJVER(6)MINVER(18)EDIT>
;   Macro to redefine a register.  This should be the only way in which alternate
;   names are assigned to registers.  This macro prevents you from
;   referring to a register by two names in the same section of code.

;   The section of code using the altername name FOO for register P1 should
;   be bracketed as follows:

;	REGDEF P1, FOO
;	. . .
;	UN$FOO

;   All the new register names used in a single program should be unique in the
;   first 3 characters.

DEFINE REGDEF (OLD, NEW) <
    IF1, <IFDEF NEW, <PRINTX Attempted redefinition of NEW as register OLD>>
    NEW==OLD
    IF2, <PURGE OLD>
    DEFINE UN$'NEW <
	OLD==NEW
	IF2, <PURGE NEW>>>
;   Standard byte-pointer field masks
BP%ADR==37777777		;Address part of byte pointer
BP%POS==77B5			;# of unused bits in word
BP%SIZ==77B11			;Size of bytes
BP%2WD==1B12			;[55] Set if two-word format
SUBTTL Utility macros and definitions

;   STRIP -- remove one level of angle-brackets from one param, then call
;   another macro.

DEFINE STRIP (MAC, ARGS) <
	MAC ARGS
>;END DEFINE

;   An extension to the names for non-printing characters defined in MACSYM
.CHSP==40			;Space

;   Job data area definitions
.JBINT==134			;Interrupt block address

;   Subroutine call and return macros.

OPDEF CALL [PUSHJ P,]
OPDEF RET [POPJ P,]
DEFINE RETSKP <JRST SKPRET##>	;Support routine in STKRET
SUBTTL STKVAR -- Temporary storage on the stack

;   This routine replaces the one in MACSYM, assuming that you search 
;   DDBSYM first.  This routine is considerably better than the one in
;   MACSYM, but will only run on a KL processor.

;   This routine requires the support routine STKRET.

;   STKVAR is called with a single parameter, which is a list of pairs
;   of item-name, length.  Length may be omitted and defaults to one word.

;   Space is allocated at the top of the stack, the names specified are
;   defined to reference the items (memory reference), and a special return
;   is set up so that the items are removed on a RET or RETSKP.

DEFINE STKVAR (VAR) <
    CNT==1
    IRP VAR, <
	STRIP .STKV1, VAR>
    ADJSP P, CNT-1
    PUSH P, [<0,,-CNT>]
    PUSH P, [STKRET##]
    PURGE CNT, ..X1
>;END DEFINE

DEFINE .STKV1 (VAR, SIZ<1>) <
    CNT==CNT+SIZ
    ..X1==10
    RADIX ^D8
    .STKV2 VAR, \CNT
    RADIX ..X1
>;END DEFINE

DEFINE .STKV2 (VAR, OFF) <
    DEFINE VAR <-^O'OFF(P)>
    $'VAR==<Z VAR>
>;END DEFINE
SUBTTL Standard Calling Sequence (COBOL/FORTRAN) definitions

;   Standard calling sequence argument list
.SCCNT==-1			;Position in list for arg count
SC%TYP==17B12			;Argument type
    .SCCMP==2			;One-word computational
    .SC2C==11			;Two-word computational
    .SCC1==4			;One-word floating point (comp-1)
    .SCDIS==15			;Display
    .SCRTN==7			;Procedure name

;   Details of 2-word descriptor for display items
.SCBP==0			;First word of descriptor is byte pointer
.SCDES==1			;Second word is description
    SC%NUM==1B0			;Numeric flag
    SC%DTP==17B4		;Type of display (6, 7, 9, C3)
	.STUN==0		;Unspecified type
	.STD6==1		;Display-6
	.STD7==2		;Display-7
	.STD9==3		;Display-9
	.STC3==4		;Comp-3
    SC%SGN==1B1			;Sign flag
    SC%FIG==1B2			;Figurative constant flag
    SC%P==1B12			;Flag for P's preceding decimal point in PICTURE
    SC%SCL==37B17		;Scale or number of P's
    SC%SIZ==777777		;Size of item in bytes
SUBTTL SCENT -- entry for routine using standard calling sequence

;   Names for bit patterns used in specifying allowable types
SC%ACM==1B<^D35-.SCCMP>
SC%AC1==1B<^D35-.SCC1>
SC%A2C==1B<^D35-.SC2C>
SC%ADS==1B<^D35-.SCDIS>
SC%APR==1B<^D35-.SCRTN>

;   Names for bit patterns used in specifying allowable display
;   sub-types.
SC%AUN==1B<^D35-.STUN>
SC%AD6==1B<^D35-.STD6>
SC%AD7==1B<^D35-.STD7>
SC%AD9==1B<^D35-.STD9>
SC%AC3==1B<^D35-.STC3>

;   Macro to define an entry point to a subroutine using the standard calling
;   sequence.  This entry provides for optional checking of the number and type
;   of arguments passed.  Checking is implemented by the external subroutine
;   SCCHK.

;   Parameters to SCENT are:
;	ENAM	Name for entry point.  This is declared as an entry and a label
;	MNPRM	Minimum allowable number of parameters
;	MXPRM	Maximum allowable number of parameters (negative for no max)
;	WNA	Statement to execute when wrong number of arguments passed
;		(must generate exactly one word of code and cause transfer of
;		control)
;	WTA	Statement to execute when wrong type argument is passed
;		(must generate exactly one word of code and cause transfer of
;		control)
;	RTCHK	Set non-zero to compile code with run-time checking.  Set zero
;		or nonexistent to suppress this code.
;	CLIST	List of descriptors of blocks of allowable parameters.  Each block
;		is of the form <<list of allowable params>, repeat>, where
;		the repeat count defaults to 1.

;		The list of allowable parameters is a bracketed list of pairs of
;		bit patterns, where the first specifies the allowable data
;		types, and the second specifies the allowable display sub-types
;		(and need not be present unless display is listed as valid in
;		the first of the pair).

;		Example of CLIST:
;		<<<<SC%ACM!SC%ADS,SC%AUN!SC%AD6>,<SC%APR>>,5>,<<<SC%ACM>>>>

;   The table produced is of the following form:
.CERTN==0			;Address of ASCIZ of name of routine whose
				;arguments we are checking
.CEMIN==1			;- Min # arguments
.CEMAX==2			;- Max # arguments ( >0 indicates no max)
.CEWNA==3			;Instruction for wrong number of arguments
.CEWTA==4			;Instruction for wrong type of argument
.CEBL1==5			;-Repeat count,,0 for first block
;	6	Valid types,,Valid subtypes
;	...	Further parameters in the block
;	n	-Repeat count,,0 for second block
;	   ...
;	m	0,,0 to indicate end of control list

DEFINE SCENT (ENAM,MINPRM,MAXPRM,WNA,WTA,RTCHK,CLIST) <
    IFDEF RTCHK, <
	IFN RTCHK, <
	    ..SCE==.
	    [ASCIZ /ENAM/]
	    EXP -MINPRM,-MAXPRM
	    WNA
	    WTA
	    IRP CLIST, <
		STRIP SCE2, CLIST
	    >;END IRP CLIST
	    XWD 0, 0
	>;END IFN RTCHK
    >;END IFDEF RTCHK

    ENTRY ENAM
    ENAM:

    IFDEF RTCHK, <
	IFN RTCHK, <
	    MOVX T1, ..SCE
	    CALL SCCHK##	;External support routine
	>;END IFN RTCHK
    >;END IFDEF RTCHK
    PURGE ..SCE

>;END DEFINE SCENT

DEFINE SCE2 (VALTPS, REPEAT<1>) <
    XWD -REPEAT, 0
    IRP VALTPS, <
	STRIP SCE3, VALTPS
    >;END IRP VALTPS
>;END DEFINE SCE2

DEFINE SCE3 (VALTYP, VALDSP) <
    XWD VALTYP, VALDSP
>;END DEFINE SCE3
SUBTTL $IF macros -- IF -- THEN -- ELSE for any condition

;   This macro, when called as below, defines a series of $IF macros which may
;   be called as follows:

;	$IFLE COND, THEN, ELSE

DEFINE $DIF (QUALIF) <
	IRP QUALIF, <
	    DEFINE $IF'QUALIF (EXPR, THEN, ELSE) <
		..EX==EXPR
		..TMP==1
		IF'QUALIF ..EX, <
		    THEN
		    ..TMP==0>

		IFN ..TMP, <ELSE>
		PURGE ..EX, ..TMP>>>

	$DIF <E,N,G,GE,L,LE,DEF,NDEF,IDN,DIF>
	PURGE $DIF

	END