UNIVERSAL DTEPRM - PARAMETERS FOR DTE20 PROTOCOL - V062
SUBTTL E. SOCCI/EVS/EGF/VJB/SSG 23-DEC-86
;THIS UNIVERSAL FILE IS ASSEMBLED BEFORE COMDEV OR DTESER IS
; ASSEMBLED. IT CONTAINS SYMBOL AND MACRO DEFINITIONS RELATED
; TO THE OPERATION OF DTESER. MACROS FROM DTEPRM ARE
; CALLED FROM COMDEV TO GENERATE THE COMMUNICATIONS REGION AND
; THE DTE CONTROL BLOCKS.
;DEFINITIONS ADDED FOR QUEUED PROTOCOL VERSION 2 ON 11 JUL 80
SEARCH F,S
;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
; OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
;
.CPYRT<1976,1986>
;COPYRIGHT (C) 1976,1977,1978,1979,1980,1982,1984,1986
;BY DIGITAL EQUIPMENT CORP., MAYNARD, MASS.
;ALL RIGHTS RESERVED.
;
;
VDTPRM==063 ;VERSION OF DTEPRM GOES IN UNIVERSAL SYMBOL TABLE
;NOTE:
; BE SURE TO INCREMENT THIS VERSION NUMBER EVERY TIME THE FILE IS
; CHANGED TO ENSURE THAT ALL MODULES REQUIRING THE CHANGE WILL
; SEE THE PROPER VERSION NUMBER

SUBTTL 10/11 DTE COMMUNICATIONS REGION
IFDEF TTDBUG,< XLIST>
;MACRO TO COMPUTE THE WIDTH OF A MASK
; "WID" RETURNS THE LENGTH OF THE LEFTMOST STRING OF
; CONSECUTIVE ONES IN THE WORD.
DEFINE WID(MASK),<<^L<-<<MASK>_<^L<MASK>>>-1>>>
;MACRO TO COMPUTE THE POSITION OF A MASK
DEFINE POS(MASK),<<^L<MASK>+^L<-<<MASK>_<^L<MASK>>>-1>-1>>
;MACRO TO BUILD A POINTER TO A MASKED QUANTITY
; POINTR LOCATION,MASK
DEFINE POINTR(LOC,MASK),<<POINT WID(MASK),LOC,POS(MASK)>>
;MACRO TO BUILD A MASK "WID" BITS WIDE, WITH ITS RIGHTMOST BIT
; IN THE BIT POSITION "POS". (I.E. A MASK FOR THE BYTE
; POINTED TO BY THE BYTE POINTER "POINT WID,LOC,POS")
DEFINE MASK.(WID,POS),<<<<1_<WID>>-1>B<POS>>>
;MACRO TO DEFINE A SYMBOL WITH ONLY ONE BIT ON, IN THE SAME POSITION AS
; THE RIGHTMOST BIT IN "MASK" (OR 0, IF "MASK" = 0)
DEFINE RGHBT.(MASK),<<<MASK>&-<MASK>>>

SUBTTL DTE 10/11 COMMUNICATIONS REGION
;MACRO TO DEFINE A DATA STRUCTURE FOR A GIVEN FIELD.
; CALL IS: FIELD.(NAME,WIDTH,POSITION,<OPTIONAL VALUE>,<OPTIONAL LOCATION>
; ARGUMENTS:
; NAME SIX CHARACTER DATA STRUCTURE NAME
; WIDTH SIZE OF FIELD IN BITS.
; POSITION POSITION OF RIGHTMOST BIT OF FIELD, DECIMAL
; VALUE OPTIONAL, IF SPECIFIED WILL GENERATE A LOCATION
; IF USED WITH EWORD., WITH VALUE "VALUE".
; LOCATION OPTIONAL, IF SPECIFIED WILL GENERATE A LOCATION
; IF USED WITH EWORD., WITH "VALUE"
; AS THE CONTENTS
;
; FIELDS OF GREATER THAN LENGTH 1 (BYTE MASKS) CALL DEFST. TO DEFINE
; A MACRO THAT CAN BE USED WITH LOAD./STOR.
;
; FIELDS OF LENGTH 1 DO NOT USE DEFST., BUT DIRECTLY ASSIGN THE 36
; BIT VALUE OF THE BIT POSITION TO THE SYMBOL "NAME". THIS IS BECAUSE
; THE "TX" MACROS CANNOT BE USED, BECAUSE THEY DO NOT HANDLE EXTERNAL
; SYMBOLS CORRECTLY AND WOULD HAVE TO BE MIXED WITH REGULAR TEST INSTRUCTIONS.
; THEREFORE, DO NOT USE LOAD./STOR. FOR SINGLE BIT VALUES! USE LOAD./STOR.
; TO FETCH THE WORD, AND DO A REGULAR TEST INSTRUCTION USING THE BIT
; VALUE. IF THE VALUE IS IN THE LEFT HALF, USE "()" TO SWAP IT.
; ALTERNATIVELY, ONE CAN DEFINE WORD NAMES (EXAMPLE, ETDSTS) IN ORDER
; TO DO "TDXX" INSTRUCTIONS.
;
; THE SYMBOL ZZ00 (LEVEL 0, TEMP SYMBOL 0) IS USED TO ACCUMULATE
; VALUES FOR A GIVEN WORD. THE MACRO EWORD. WILL CAUSE THESE ACCUMULATED
; VALUES TO BE PLACED IN A LOCATION. IF NO FIELD. MACRO GENERATED A VALUE
; FOR THE CURRENT WORD, THEN EWORD. WILL GENERATE A "BLOCK 1". SEE
; THE EWORD. MACRO FOR FURTHER DETAILS.
;
; "LOCATION" IS USED ONLY FOR BYTE FIELDS AS AN ARGUMENT TO DEFST.
; FIELDS OF LENGTH 1 (BIT ASSIGNMENTS) ARE SIMPLY DEFINED AS VALUES
DEFINE FIELD.(NAME,WID,POS,VAL,LOC),<MLIST.(S,S) ;LEVEL 0
IFB <LOC> <ZZ01==.>
IFNB <LOC> <ZZ01==LOC>
ZZ02==MASK.(^D'WID,^D'POS)
IFN ^D'WID-1,< DEFST.(NAME,\ZZ01,\ZZ02)>;ONLY FOR FIELDS GREATER THAN 1 BIT
IFE ^D'WID-1,< NAME==ZZ02>;FOR SINGLE BITS, JUST THE BIT NAME
IFNB <VAL> <IF2,<PDEBUG(*NAME='VAL)>>
IFNB <VAL> <
IFNDEF ZZ00,<ZZ00==0>
ZZ00==ZZ00+<VAL>B<POS>>;END IFNB <VAL>
MLIST.(R)
>;END FIELD. MACRO DEFINITION

;MACRO TO END A WORD WITHIN A DATA STRUCTURE
; ASSUMES ACCUMULATED VALUES HAVE BEEN STORED IN VARIABLE ZZ00
; (LEVEL 0, VARIABLE 0). IF NO VALUES HAVE BEEN ACCUMULATED FOR A WORD,
; THEN A "BLOCK 1" IS GENERATED.
IFDEF ZZ00,<
PURGE ZZ00 ;ASSUMPTION IS MADE THAT IF ZZ00
>;END IFDEF ZZ00
; IS DEFINED, THEN A VALUE FOR A FIELD HAS BEEN SPECIFIED (EVEN IF
; THAT VALUE IS ZERO) SO WE MUST PURGE ZZ00 TO MAKE SURE ITS NOT
; DEFINED THE FIRST TIME EWORD. IS USED. ZZ00 IS PURGED AFTER EVERY
; CALL TO EWORD. LISTING CONTROL MACRO MLIST. IS USED TO SUPPRESS
; EWORD. MACRO EXPANSION IN LISTING, AND OLD LISTING CONTROL IS RESTORED
; AFTER MACRO DOES ITS WORK.
; EWORD. IS USED IN CONJUNCTION WITH FIELD.
DEFINE EWORD.<MLIST.(S,S) ;LEVEL 0
IFNDEF ZZ00,<BLOCK 1>
IFDEF ZZ00,< ZZ00>
IFDEF ZZ00,<PURGE ZZ00>
MLIST.(R)
>
;MACRO TO CONVERT FROM A BYTE COUNT OF ONE SIZE TO A BYTE COUNT
; OF ANOTHER SIZE. DEFAULT ORIGINAL SIZE IS 8 BITS. NEW SIZE MUST
; BE LARGER THAN ORIGINAL SIZE.
;
;MACRO GENERATES VALUE OF NEW BYTE COUNT
DEFINE SIZE(THING,NEWSIZ,OLDSIZ<8>)
<<THING+<^D'NEWSIZ/^D'OLDSIZ-1>>/<^D'NEWSIZ/^D'OLDSIZ>>

.EMHDL==<.-ETMBEG>*<^D36/^D8> ;LENGTH OF ENTIRE HEADER IN
; 8 BIT BYTES
DEPHASE
IFDEF TTDBUG,<LIST>
;NEGATIVE FUNCTIONS USED ONLY BY DTESER FOR INTERNAL COMMUNICATION
; TO DRIVERS. SYMBOLS ARE 18 BIT NEGATIVE, FOR MOVEI.
.EMXML==-1&777777 ;SAYS THAT THE FRONT END HAS CRASHED
; WHILE A DRIVER WAS WAITING FOR INDIRECT
; DATA, THUS POSSIBLY NEEDS TO DEALLOCATE
; A BUFFER

SUBTTL DECNET DEFINTIONS
;THE FOLLOWING VALUE OF MAXIMUM MESSAGE BLOCK LENGTH (KNOWN AS THE USER
; DATA SEGMENT TO DECNET-36) MUST BE THE SAME AS THE VALUE IN D36COM.
UBLSIZ==^D590/4 ;MAXIMUM SIZE IS 590 BYTES

SUBTTL SYMBOL GENERATION
.XCREF
;GENERATE FRONT END DEVICE CONTROL BLOCKS FIRST, DTE CONTROL BLOCKS
; POINT TO THEM
FEDGEN
;GENERATE COMM REGION SYMBOLS BY CALLING THEIR MACROS
; FOR A CONFIGURATION OF ONE TEN AND ONE ELEVEN.
ETHEAD
ETREGN(0,0)
;NOW GENERATE SYMBOLS FOR DTE CONTROL BLOCK BY CALLING THE MACRO ONCE
ETDGEN
.CREF
PURGE ETCRGN,ETCSIZ,ETCHED ;SO NO ERRORS IN DTESER.
PURGE M.CPU,M.AT01,DTE0NM ; GET RID OF PHONEY CONFIG SYMBOLS
; DTEDEV DEFINES THESE
; FOR REAL
END