Trailing-Edge
-
PDP-10 Archives
-
BB-AE97C-BM
-
sources/dap-macros.req
There are 15 other files named dap-macros.req in the archive. Click here to see a list.
!Macros to do the usual DAP things
! COPYRIGHT (C) DIGITAL EQUIPMENT CORPORATION 1981, 1985.
! 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: FTS DAP Macros
!
! ABSTRACT: These macros perform common functions needed to implement DAP
! using the DECnet Interface.
!
!
! ENVIRONMENT: BLISS DECnet Interface
!
! AUTHOR: Andrew Nourse, CREATION DATE: 29-Dec-81
!
! MODIFIED BY:
!
! , : VERSION
! 01 - The beginning
!--
!
! TABLE OF CONTENTS:
!
! EXTR
! UNREF
! GET_BYTE
! GET_2BYTE
! GET_HEADER
! GET_EXTENSABLE
! GET_VARIABLE
! BACK
! PUT_BYTE
! PUT_2BYTE
! PUT_HEADER
! PUT_EXTENSABLE
! PUT_VARIABLE
! SET_EXTENSION_BITS
! COPY_ASCIZ_ASCIC
! COPY_ASCIC_ASCIZ
!
! MACROS:
!
!Define '$' as a reference to the start of any block
!So we don't need to worry if this is a real block or a REF of one
MACRO $=0,0,0,0 %;
!Require file containing system-dependant DAP macros, structure defs,etc.
MACRO CHAR8[C1,C2,C3,C4]=((C1 AND 255)^28)
+(((C2+0) AND 255)^20)
+(((C3+0) AND 255)^12)
+(((C4+0) AND 255)^4) %;
!Pack 4 8-bit bytes per word
MACRO ANYSET[EXF]=(.EXF<27,9> NEQ 0) %;
!This macro returns 1 if any bits in an extensible field are set
!assuming that extension bits are set up (see SET_EX_BITS,SETEXB)
MACRO NLB$H_BYTES=NLB$H_UNITS %; ! For documentation purposes
! we want this alternate name because
! BYTES ARE NOT ALWAYS ADDRESSABLE UNITS
MACRO $DAP$INCR(IND,STA,FIN)[]=BEGIN
COMPILETIME IND=STA; !Set index counter
%IF IND LEQ FIN
%THEN
%REMAINING;
$DAP$INCR(IND,STA+1,FIN,%REMAINING)
%FI
END%;
MACRO CLEARV[VAR]= BEGIN
COMPILETIME SIZ=%ALLOCATION(VAR)-1;
BEGIN
MAP VAR: VECTOR;
%IF (SIZ-7) LSS 0
%THEN $DAP$INCR(I,0,SIZ,(VAR[I]=0))
%ELSE
INCR I FROM 0 TO SIZ DO VAR[.I]=0
%FI
END
END %;
MACRO EXTR[RTN]= %IF NOT %DECLARED(RTN)
%THEN EXTERNAL ROUTINE RTN
%FI %;
MACRO UNREF(X)=X %;
MACRO INIT_MESSAGE(DD)=
(BIND DESC=DD: $DAP_DESCRIPTOR;
DESC[DAP$$V_MFLAGS_1]=DESC[DAP$$V_MFLAGS_2]
=DESC[DAP$$V_MFLAGS_3]=0) %;
MACRO GET_BYTE(DD)=(EXTR( D$GBYT );
D$GBYT(UNREF(DD))) %;
MACRO GET_2BYTE(DD)=(EXTR( D$G2BY );
D$G2BY(UNREF(DD))) %;
MACRO PUT_BYTE(DD,DATA)=(EXTR( D$PBYT );
D$PBYT(UNREF(DD),DATA)) %;
MACRO PUT_2BYTE(DD,DATA)=(EXTR( D$P2BY );
D$P2BY(UNREF(DD),DATA)) %;
MACRO GET_LONGWORD(DD)=(EXTR( D$GLWD );
D$GLWD(UNREF(DD))) %;
MACRO PUT_LONGWORD(DD,VALUE)=(EXTR( D$PLWD );
D$PLWD(UNREF(DD),VALUE)) %;
MACRO GET_EXTENSABLE(DD,ADDR,MAXLEN)=(EXTR(D$GEXT);
D$GEXT(UNREF(DD),UNREF(ADDR),MAXLEN)) %;
MACRO PUT_EXTENSABLE(DD,ADDR)= (EXTR(D$PEXT);
D$PEXT(UNREF(DD),UNREF(ADDR))) %;
MACRO GET_VARIABLE_STRING(DD,PTR,MAXLEN)=(EXTR(D$GVST);
D$GVST(UNREF(DD),UNREF(PTR),MAXLEN))
%;
MACRO PUT_VARIABLE_STRING(DD,PTR)=(EXTR(D$PVST);
D$PVST(UNREF(DD),UNREF(PTR))) %;
MACRO GET_VARIABLE_COUNTED(DD,PTR,MAXLEN)=(EXTR(D$GVCT);
D$GVCT(UNREF(DD),UNREF(PTR),MAXLEN))
%;
MACRO PUT_VARIABLE_COUNTED(DD,PTR)=(EXTR(D$PVCT);
D$PVCT(UNREF(DD),UNREF(PTR))) %;
MACRO GET_HEADER(DD)=
(EXTR( D$GHDR );
D$GHDR(UNREF(DD))) %;
MACRO PUT_HEADER(DD)=
(EXTR( D$PHDR );
D$PHDR(UNREF(DD))) %;
MACRO PUT_BYTES(DD,DESC)=
(EXTR (D$PSTR);
D$PSTR(DD,DESC)) %;
MACRO PUT_STRING(DD,DESC)=
(EXTR (D$PSTR);
D$PSTR(DD,DESC)) %;
%BLISS36(
MACRO
DAP$PUT_MESSAGE=D$PMSG %,
DAP$GET_MESSAGE=D$GMSG %,
DAP$PUT_HEADER=D$PHDR %,
DAP$GET_HEADER=D$GHDR %,
DAP$PUT_CONFIG=D$PCFG %,
DAP$PUT_ATTRIBUTES=D$PATT %,
DAP$$PUT_ATTRIBUTES=D$$PAT %,
DAP$PUT_ACCESS=D$PACC %,
DAP$PUT_NAME=D$PNAM %,
DAP$PUT_CONTROL=D$PCTL %,
DAP$PUT_ACCESS_COMPLETE=D$PACM %,
DAP$GET_CONFIG=D$GCFG %,
DAP$GET_ATTRIBUTES=D$GATT %,
DAP$$GET_ATTRIBUTES=D$$GAT %,
DAP$GET_STATUS=D$GSTS %,
DAP$GET_DATE=D$GDTM %,
DAP$PUT_DATE=D$PDTM %,
DAP$GET_ACK=D$GACK %,
DAP$UNGET_BYTE=D$UBYT %,
DAP$UNGET_HEADER=D$UHDR %,
DAP$ERROR_DAP_RMS=D$ERDR %,
DAP$ERROR_RMS_DAP=D$ERRD %;
MACRO
DAP$GET_BITVECTOR=D$GBIT %,
DAP$PUT_BITVECTOR=D$PBIT %,
DAP$SIZE_BITVECTOR=D$SIZB %,
DAP$GET_STRING=D$GSTR %,
DAP$GET_VARIABLE_STRING=D$GVST %,
DAP$GET_LONGWORD=D$GLWD %,
DAP$GET_BYTE=D$GBYT %,
DAP$GET_2BYTE=D$G2BY %,
DAP$GET_EXTENSABLE=D$GEXT %,
DAP$GET_VARIABLE_COUNTED=D$GVCT %,
DAP$PUT_STRING=D$PSTR %,
DAP$PUT_VARIABLE_STRING=D$PVST %,
DAP$PUT_LONGWORD=D$PLWD %,
DAP$PUT_BYTE=D$PBYT %,
DAP$PUT_2BYTE=D$P2BY %,
DAP$PUT_EXTENSABLE=D$PEXT %,
DAP$PUT_VARIABLE_COUNTED=D$PVCT %;
)
MACRO ! The following are used only by FAL
DAP$GET_CONTROL=D$GCTL %, !
DAP$GET_ACCESS=D$GACC %, !
DAP$PUT_ACK=D$PACK %, !
DAP$GET_ACCESS_COMPLETE=D$GACM %, !
DAP$PUT_STATUS=D$PSTS %; !
MACRO SEND_STATUS(DD,MACCODE,MICCODE)=
(EXTR (DAP$PUT_STATUS,DAP$PUT_MESSAGE);
BIND STS$$DD=DD: $DAP_DESCRIPTOR;
DAP$PUT_STATUS(STS$$DD[$],MACCODE,MICCODE);
DAP$PUT_MESSAGE(STS$$DD[$])) %;
MACRO $DAP_MOVE_BITS(SOURCE,SPFX,DEST,DPFX)[ITEM]=
%IF %DECLARED(%NAME(SPFX,ITEM)) AND %DECLARED(%NAME(DPFX,ITEM))
%THEN DEST[%NAME(DPFX,ITEM)]=.SOURCE[%NAME(SPFX,ITEM)]; %FI; %;
COMPILETIME DAP$K_DEFAULT_VALUE=-1;
MACRO $DAP_TRANSLATE_VALUE(VALUE,SPFX,DPFX)=
(SELECT VALUE OF
SET
$DAP$$TRANSLATE_VALUE(SPFX,DPFX,%REMAINING);
TES)
%;
MACRO $DAP$$TRANSLATE_VALUE(SPFX,DPFX)[ITEM]=
[%IF %DECLARED(%NAME(SPFX,ITEM))
%THEN %NAME(SPFX,ITEM)
%ELSE DAP$K_DEFAULT_VALUE
%FI]: %IF %DECLARED(%NAME(DPFX,ITEM))
%THEN %NAME(DPFX,ITEM)
%ELSE DAP$K_DEFAULT_VALUE
%FI
%;
MACRO SET_EX_BITS[EXF]=(EXTR(SETEXB);SETEXB(EXF,%ALLOCATION(EXF)*4)) %;
MACRO SET_EX_BITS_A[EXF]=(EXTR(SETEXB);SETEXB(EXF,4)) %;
MACRO $DAP_SIZE_BITVECTOR[BVEC,MAX]=
0+DAP$SIZE_BITVECTOR(BVEC,MAX,1) %;
MACRO PP(STR)=CH$PTR(UPLIT(%ASCIZ %STRING(STR))) %;
MACRO FIND_SUBSTRING(TARGET,PATTERN)=(EXTR( FSUBAZ );
FSUBAZ(TARGET,PATTERN)) %;
MACRO
SET_ACCESS_INFO(NLB,NODE)=(EXTR( SETAI );
LOCAL NDESC: $STR_DESCRIPTOR(CLASS=BOUNDED);
ASCIZ_TO_DESCRIPTOR(NODE,NDESC);
SETAI(NLB,NDESC)) %;
MACRO
ASCIZ_LEN(ASCIZ)=(LOCAL TPTR;
TPTR=ASCIZ;
INCR I FROM 0
DO IF CH$RCHAR_A(TPTR) EQL 0 THEN EXITLOOP .I) %;
MACRO ASCIZ_STR(ASCIZ)=(ASCIZ_LEN(ASCIZ),ASCIZ) %;
MACRO STR_EXCLUDE(DESC,CHARS)=
(DESC[STR$A_POINTER]=CH$PLUS(.DESC[STR$A_POINTER],CHARS);
DESC[STR$H_PFXLEN]=.DESC[STR$H_PFXLEN]+1) %;
MACRO STR_INCLUDE(DESC,CHARS)=
(DESC[STR$H_LENGTH]=.DESC[STR$H_LENGTH]+1) %;
MACRO STR_PREFIX(DESC)=
(.DESC[STR$H_PFXLEN],CH$PLUS(.DESC[STR$A_POINTER],-.DESC[STR$H_PFXLEN])) %;
MACRO STR_STRING_PLUS_PREFIX(DESC)=
(.DESC[STR$H_PFXLEN]+.DESC[STR$H_LENGTH],
CH$PLUS(.DESC[STR$A_POINTER], -.DESC[STR$H_PFXLEN])) %;
MACRO STR_STRING_PLUS_REMAINDER(DESC)=
(.DESC[STR$H_MAXLEN]-.DESC[STR$H_PFXLEN],
.DESC[STR$A_POINTER]) %;
MACRO STR_REMAINDER(DESC)=
(.DESC[STR$H_MAXLEN]-(.DESC[STR$H_LENGTH]+.DESC[STR$H_PFXLEN]),
CH$PLUS(.DESC[STR$A_POINTER], .DESC[STR$H_LENGTH])) %;
MACRO
ASCIZ_TO_DESCRIPTOR(ASCIZ,DESC)=$STR_DESC_INIT(DESCRIPTOR=DESC,
STRING=(ASCIZ_LEN(ASCIZ),
ASCIZ),
CLASS=BOUNDED) %;
MACRO ASCIZ_TO_FIXED_DESCRIPTOR(ASCIZ,DESC)=
$STR_DESC_INIT(DESCRIPTOR=DESC,
STRING=(ASCIZ_LEN(ASCIZ), ASCIZ),
CLASS=FIXED) %;
MACRO DAPCODE=3,16 %; ! Extract DAP code from condition code
!Fake out our error routine to act as if we were invoked by JSYS
MACRO $$ERROR(OPER,BLK,STS,STV)=
(LOCAL VEC: VECTOR[3];
VEC[0]=%NAME('RMS$K_',OPER,'_VALUE')
+RMS$K_INITIAL_JSYS+%O'104000000000';
$$ERRRTN(BLK,0,VEC[2])) %;
! Differing concepts of bucket numbers
MACRO RMS_VBN_TO_DAP(RMSVBN)=(LOCAL RMSNUM;
RMSNUM=RMSVBN;
IF .RMSNUM NEQ 0
THEN ((.RMSNUM-1)*4)+1
ELSE 0) %;
MACRO DAP_VBN_TO_RMS(DAPVBN)=(LOCAL DAPNUM;
DAPNUM=DAPVBN;
IF .DAPNUM NEQ 0
THEN ((.DAPNUM-1)/4)+1
ELSE 0) %;
MACRO GET_VBN(DD)=DAP_VBN_TO_RMS(GET_LONGWORD(DD)) %;
MACRO PUT_VBN(DD,VBN)=PUT_LONGWORD(DD,RMS_VBN_TO_DAP(VBN)) %;
!
! STRUCTURE DEFINITIONS
!
STRUCTURE EX[BT;SIZE]= !DAP extensible field
[(SIZE+3)/4] !Note that size is in bytes
(EX+(BT/32))<(BT MOD 8)+27-(((BT MOD 32)/8)*9),1,0>;
!This is to reconcile the fact that on both the -11 and the -10
!number bits from right to left (in the hardware, at least)
!but the -10 numbers and stores bytes from left to right.
!The bits in a word are numbered by this structure as follows:
!X 07 06 05 04 03 02 01 00 X 15 14 13 12 11 10 09 08 (left half)
!X 23 22 21 20 19 18 17 16 X 31 30 29 28 27 26 25 24 (right half)
STRUCTURE BYTE8VECTOR[I;SIZE]=
[(SIZE+3)/4]
(BYTE8VECTOR+(I/4))<28-((I MOD 4)*8),8,0>;
!4 8-bit bytes per word, left justified, just as ILDB would want
!
! Non-standard Linkages
!
LINKAGE
rms_ercal = PUSHJ (REGISTER = 1) : LINKAGE_REGS (15, 14, 1);