Google
 

Trailing-Edge - PDP-10 Archives - BB-JR93N-BB_1990 - 10,7/mon/scaprm.mac
There are 8 other files named scaprm.mac in the archive. Click here to see a list.
UNIVERSAL SCAPRM - PARAMETERS FOR SYSTEMS COMMUNICATION ARCHITECTURE	V25
SUBTTL	JOSEPH A. DZIEDZIC/JAD	17 APR 90

	SEARCH	F,S,KLPPRM,MACSYM
	SALL


;THIS UNIVERSAL FILE CONTAINS DEFINITIONS OF DATA STRUCTURES USED BY
;SCA.  DEFINITIONS FOR THE PHYSICAL PORT DRIVER ARE FOUND IN KLPPRM.


;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED
;  OR COPIED ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
;
;COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1984,1986,1988,1990.
;ALL RIGHTS RESERVED.

.CPYRT<1984,1990>,.


XP	VSCAPR,25
	SUBTTL	ABBREVIATIONS USED IN THE WORLD OF SCA


COMMENT	|

SB      System Block - describes a unique node on the CI bus.

PB      Path Block - describes a unique path to a node on the CI bus.

PCB     Port Control Block - contains queues  and  data  relating  to  a
        single port, shared by both the physical port and the software.

SBI     System Block Index - an index into the  packed  list  of  System
        Blocks.

PBI     Path Block Index - an index into the packed list of Path Blocks.

CID     Source Connect Identifier - something useful

PPD     Physical Port Driver - the  software  which  controls  the  port
        hardware.

|; END OF COMMENT
	SUBTTL	FEATURE TESTS IN SCA


XP	FTOPS10,1		;TOPS-10
XP	FTOPS20,0		;NOT TOPS-20

XP	FTINFO,-1		;PRINT LOTS OF INFO ON PATH STATE CHANGES
	SUBTTL	CONSTANTS


	C%BINV==^D11		;SIZE OF INVISIBLE SPACE BEFORE ALL BUFFERS

	C%MGSZ==^D52		;SIZE OF MESSAGE BUFFER
	C%MGPG==PAGSIZ/<C%MGSZ+C%BINV> ;NUMBER OF MESSAGE BUFFERS IN A PAGE
	C%DGSZ==^D158		;SIZE OF DATAGRAM BUFFER
	C%DGPG==PAGSIZ/<C%DGSZ+C%BINV> ;NUMBER OF DATAGRAM BUFFERS IN A PAGE

	C%OVHD==^D12		;OVERHEAD BYTE COUNT FOR APPLICATION MSG/DG
	C%OVHW==<C%OVHD+3>/4	;OVERHEAD WORD COUNT FOR APPLICATION MSG/DG

	C%PPDL==2		;LENGTH IN BYTES OF PPD FIELD

	C%CIDL==<PAGSIZ/2>	;LENGTH OF CONNECT ID TABLE
	C%PNMN==^D16		;MAXIMUM LENGTH (BYTES) OF PROCESS NAME
	C%PNLW==<C%PNMN+3>/4	;LENGTH IN WORDS
	C%CDMN==^D16		;MAXIMUM LENGTH (BYTES) OF CONNECT DATA
	C%CDLW==<C%CDMN+3>/4	;LENGTH IN WORDS
	C%SDTL==^D16		;SEND DATA LENGTH (BYTES)
	C%SDTW==<C%SDTL+3>/4	;LENGTH IN WORDS
	C%DATL==^D16		;LENGTH OF CONNECTION DATA (BYTES)
	C%DTLW==<C%DATL+3>/4	;LENGTH IN WORDS

;LENGTHS OF EVENT QUEUE BLOCKS (FOR SCS. UUO/JSYS)

	C%VCCL==.EBCOD+2	;VC CLOSED
	C%CTLL==.EBCOD+5	;CONNECT TO LISTEN
	C%CRAL==.EBCOD+5	;CONNECTION ACCEPT
	C%CRRL==.EBCOD+2	;CONNECTION REJECT
	C%MSCL==.EBCOD+2	;MESSAGE/DATAGRAM SEND COMPLETE
	C%LCLL==.EBCOD+2	;LITTLE CREDIT LEFT
	C%OSDL==.EBCOD+1	;OK TO SEND DATA
	C%RIDL==.EBCOD+1	;REMOTE INITIATED DISCONNECT
	C%PBCL==.EBCOD+2	;PORT BROKE CONNECTION
	C%CIAL==.EBCOD+3	;CREDIT IS AVAILABLE

;THESE CONSTANTS TWEAK THE BUFFER MANAGEMENT PARAMETERS.  THEY CONTROL
;THRESHOLD AND OTHER FACTORS THAT COULD VERY SIGNIFICANTLY AFFECT SCA
;PERFORMANCE.  BE SURE OF WHAT YOU ARE DOING BEFORE YOU CHANGE THESE.

	C%MBPP==C%MGPG		;NUMBER OF MESSAGE BUFFERS PER PB
	C%MBCR==^D2		;NUMBER OF MESSAGE BUFFERS TO QUEUE BEFORE
				; WE SEND A CREDIT REQUEST ABOUT THEM
	C%MGTR==<C%PBLL*2>+^D10	;THRESHOLD FOR MESSAGE BUFFERS, IF WE HAVE LESS
				; THAN THIS AT ALLOCATE TIME ASK FOR SOME MORE
	C%DGTR==C%PBLL+^D20	;THRESHOLD FOR DATAGRAM BUFEFERS, IF WE HAVE LESS
				; THAN THIS AT ALLOCATE TIME ASK FOR SOME MORE

	C%DBPP==C%DGPG*2	;NUMBER OF DATAGRAM BUFFERS PER PB 

	C%LGRQ==^D3		;A BUFFER REQUEST LARGER THAN THIS IS A LARGE
				; REQUEST AND WILL NOT BE HONORED IF IT PUTS
				; US UNDER THE THRESHOLD

	C%TMGT==^D5		;TIMEOUT FOR TIMED MESSAGES

	C%BYTM==<C%MGSZ+3>*4	;SIZE OF MAXIMUM MESSAGE (BYTES)
	C%WORM==C%MGSZ		;SIZE OF MAXIMUM MESSAGE (WORDS)
	C%BYTD==<C%DGSZ+3>*4	;SIZE OF MAXIMUM DATAGRAM (BYTES)
	C%WORD==C%DGSZ		;SIZE OF MAXIMUM DATAGRAM (WORDS)

	C%SBLL==MAXNDS		;SIZE OF SYSTEM BLOCK LIST
	C%PBLL==C%SBLL*6	;SIZE OF PATH BLOCK LIST (MAX OF 1 CI PER CPU)

	C%BHDN==<PAGSIZ/.BHSIZ>	;NUMBER OF BUFFER HEADER DESCRIPTORS
	C%BSDN==C%BHDN*2	;NUMBER OF BUFFER SEGMENT DESCRIPTORS

	C%MXBF==^D100		;MAXIMUM NUMBER OF USER BUFFERS WHICH MAY
				; BE QUEUED FOR THE SCS. UUO/JSYS
	SUBTTL	SYSTEM BLOCK FORMAT


	PHASE	0	;DEFINE AS OFFSETS

.SBDPN:!BLOCK	1	;DESTINATION PORT NUMBER (CI NODE NUMBER)
	MSKSTR	(SBDPN,.SBDPN,<0,,-1>)	;DESTINATION PORT NUMBER

.SBIDX:!BLOCK	1	;INDICES
	MSKSTR	(SBSBI,.SBIDX,<0,,-1>)	;THIS SYSTEM BLOCK INDEX

.SBPIN:!BLOCK	1	;PATH INFORMATION
	MSKSTR	(SBPBI,.SBPIN,<-1,,0>)	;INDEX OF FIRST PATH BLOCK
	MSKSTR	(SBDPC,.SBPIN,<0,,-1>)	;NUMBER OF PATH BLOCKS

;BLOCK FILLED IN WITH BLT FROM RECEIVED START DATAGRAM

			;*** DO NOT SEPARATE OR RE-ARRANGE THE FOLLOWING ***
.SBDSA:!BLOCK	2	;DESTINATION SYSTEM ADDRESS
.SBMMS:!BLOCK	1	;MAXIMUM  MESSAGE,,DATAGRAM  LENGTH
	MSKSTR	(SBMXMG,.SBMMS,<-1,,0>)	;MAXIMUM MESSAGE SIZE
	MSKSTR	(SBMXDG,.SBMMS,<0,,-1>)	;MAXIMUM DATAGRAM SIZE
.SBDST:!BLOCK	1	;DESTINATION SOFTWARE TYPE
.SBDSV:!BLOCK	1	;DESTINATION SOFTWARE VERSION
.SBDSE:!BLOCK	2	;DESTINATION SOFTWARE EDIT
.SBDHT:!BLOCK	1	;DESTINATION HARDWARE TYPE
.SBDHV:!BLOCK	3	;DESTINATION HARDWARE VERSION
.SBNNM:!BLOCK	2	;DESTINATION NODE NAME
.SBDTD:!BLOCK	2	;DESTINATION TIME OF DAY FROM START PACKET
.SBBLE:!		;END OF BLT
			;*** END OF DO NOT SEPARATE OR RE-ARRANGE ***

.SBLEN:!		;LENGTH OF A SYSTEM BLOCK

	DEPHASE
	SUBTTL	PATH BLOCK FORMAT


	PHASE	0	;DEFINE AS OFFSETS

.PBPCB:!BLOCK	1	;PORT CONTROL BLOCK ADDRESS

.PBDPN:!BLOCK	1	;DESTINATION PORT NUMBER (CI NODE NUMBER)
	MSKSTR	(PBDPN,.PBDPN,<0,,-1>)	;DESTINATION PORT NUMBER

.PBIDX:!BLOCK	1	;INDICES
	MSKSTR	(PBPBI,.PBIDX,<777700,,0>)	;THIS PATH BLOCK INDEX
	MSKSTR	(PBNPI,.PBIDX,<77,,770000>)	;NEXT PATH BLOCK INDEX
	MSKSTR	(PBSBI,.PBIDX,<0,,007777>)	;SYSTEM BLOCK INDEX

.PBVCS:!BLOCK	1	;VIRTUAL CIRCUIT STATE
	MSKSTR	(PBVCST,.PBVCS,7)	;VIRTUAL CIRCUIT STATE
		VC.CLO==0		;CLOSED
		VC.STS==1		;START-SENT
		VC.STR==2		;START-RECEIVED
		VC.OPN==3		;OPENED

.PBFLG:!BLOCK	1	;FLAGS
	PB.TMG==1B0		;TIMED MESSAGE
	PB.OVC==1B1		;VC NEEDS TO BE OPENED
	PB.OFL==1B2		;NODE OFFLINE
	PB.NTC==1B18		;VC NEEDS TO BE CLOSED
	PB.OKO==1B19		;OK TO OPEN VC
	PB.WFI==1B20		;WAITING FOR NEW IDREC

.PBSST:!BLOCK	1	;START SEQUENCE TIMER

.PBTIM:!BLOCK	1	;TIME LAST MESSAGE RECEIVED

.PBTWQ:!BLOCK	1	;FLINK FOR SCA WORK QUEUE FOR THIS PATH BLOCK
.PBBWQ:!BLOCK	1	;BLINK FOR SCA WORK QUEUE FOR THIS PATH BLOCK

.PBCLC:!BLOCK	1	;COUNT OF LOCKED CONNECTIONS

.PBOBB:!BLOCK	1	;SAVED BUFFER TO USE IN SC.SNM

.PBFCB:!BLOCK	1	;POINTER TO FIRST CONNECTION BLOCK
.PBLCB:!BLOCK	1	;POINTER TO LAST CONNECTION BLOCK

.PBDPC:!BLOCK	1	;DESTINATION PORT CHARACTERISTICS
.PBDCR:!BLOCK	1	;DESTINATION CODE REVISION
.PBDPF:!BLOCK	1	;DESTINATION PORT FUNCTIONALITY
.PBDPS:!BLOCK	1	;DESTINATION PORT STATE

IFN FTMP,<
.PBCPU:!BLOCK	1	;CPU WHICH OWNS THIS PATH BLOCK
>; END IFN FTMP

.PBLEN:!		;LENGTH OF A PATH BLOCK

	DEPHASE
	SUBTTL	WORKING QUEUE HEADER


;THIS HEADER RESIDES IN THE SECTION OF THE PACKET WHERE THE CI PPD
;HEADER WILL GO.  SINCE THERE IS NO DATA STORED THERE BY THE PPD,
;WE MAY USE IT TO STORE OVERHEAD DATA ABOUT THE WORKING QUEUE.

	PHASE	0	;DEFINE AS OFFSETS

.WQANB:!BLOCK	1	;ADDRESS OF NEXT BUFFER

.WQLEN:!BLOCK	1	;FLAGS AND LENGTH
	MSKSTR	(WQFLG,.WQLEN,<-1,,0>)	;FLAGS
	MSKSTR	(WQLEN,.WQLEN,<0,,-1>)	;PACKET LENGTH

.WQPRI:!BLOCK	1	;PRIORITY INFORMATION
	MSKSTR	(WQPRI,.WQPRI,<0,,-1>)	;MESSAGE SEND PRIORITY

.WQSTS:!BLOCK	1	;STATES
	MSKSTR	(WQBST,.WQSTS,<-1,,0>)	;NEW BLOCK STATE
	MSKSTR	(WQCST,.WQSTS,<0,,-1>)	;NEW CONNECTION STATE

.WQRSV:!BLOCK	1	;RESERVED - USE ONLY IN DESPERATION

	DEPHASE
	SUBTTL	CONFIGURATION DATA BLOCK FORMAT


;THIS IS THE FORMAT OF DATA RETURNED BY A CALL TO SC.RSB.

	PHASE	0	;DEFINE AS OFFSETS

.RSPIN:!BLOCK	1	;PATH INFORMATION
	MSKSTR	(RSPBI,.RSPIN,<777700,,0>)	;FIRST PATH BLOCK INDEX
	MSKSTR	(RSDPC,.RSPIN,<77,,770000>)	;DESTINATION PORT COUNT
	MSKSTR	(RSDPN,.RSPIN,<0,,7777>)	;DESTINATION PORT NUMBER

;BLOCK FILLED IN WITH BLT FROM SYSTEM BLOCK

			;*** DO NOT SEPARATE OR RE-ARRANGE THE FOLLOWING ***
.RSDSA:!BLOCK	2	;DESTINATION SYSTEM ADDRESS
.RSMMS:!BLOCK	1	;MAXIMUM  MESSAGE,,DATAGRAM  LENGTH
	MSKSTR	(RSMXMG,.RSMMS,<-1,,0>)	;MAXIMUM MESSAGE SIZE
	MSKSTR	(RSMXDG,.RSMSS,<0,,-1>)	;MAXIMUM DATAGRAM SIZE
.RSDST:!BLOCK	1	;DESTINATION SOFTWARE TYPE
.RSDSV:!BLOCK	1	;DESTINATION SOFTWARE VERSION
.RSDSI:!BLOCK	2	;DESTINATION SOFTWARE INCARNATION
.RSDHT:!BLOCK	1	;DESTINATION HARDWARE TYPE
.RSDHV:!BLOCK	3	;DESTINATION HARDWARE VERSION
.RSDNN:!BLOCK	2	;DESTINATION NODE NAME
.RSDTD:!BLOCK	2	;DESTINATION TIME OF DAY FROM START PACKET
.RSBLE:!		;END OF BLT
			;*** END OF DO NOT SEPARATE OR RE-ARRANGE ***

.RSLEN:!		;LENGTH OF BLOCK RETURNED BY SC.RSB

	DEPHASE
;THIS IS THE FORMAT OF DATA RETURNED BY A CALL TO SC.RPB.

	PHASE	0	;DEFINE AS OFFSETS

.RPSTS:!BLOCK	1	;VIRTUAL CIRCUIT STATUS AND DESTINATION PORT
	MSKSTR	(RPVCST,.RPSTS,<-1,,0>)	;VIRTUAL CIRCUIT STATE
	MSKSTR	(RPDPN,.RPSTS,<0,,-1>)	;DESTINATION PORT NUMBER

.RPIDX:!BLOCK	1	;INDICES
	MSKSTR	(RPNPI,.RPIDX,<-1,,0>)	;NEXT PATH BLOCK INDEX
	MSKSTR	(RPSBI,.RPIDX,<0,,-1>)	;SYSTEM BLOCK INDEX

.RPDPC:!BLOCK	1	;DESTINATION PORT CHARACTERISTICS
.RPDCR:!BLOCK	1	;DESTINATION CODE REVISION
.RPDPF:!BLOCK	1	;DESTINATION PORT FUNCTIONALITY
.RPDPS:!BLOCK	1	;DESTINATION PORT STATE

.RPLEN:!		;LENGTH OF BLOCK RETURNED BY SC.RPB

	DEPHASE
;THIS IS THE FORMAT OF DATA RETURNED BY A CALL TO SC.CSP.

	PHASE	0	;DEFINE AS OFFSETS

.CDCST:!BLOCK	1	;STATUS INFO
	MSKSTR	(CDCST,.CDCST,<0,,-1>) ;CONNECT STATE

.CDDCI:!BLOCK	1	;DESTINATION CONNECT ID
.CDSCI:!BLOCK	1	;SOURCE CONNECT ID

.CDNOD:!BLOCK	1	;DESTINATION NODE NUMBER

.CDDPN:!BLOCK	C%PNLW	;DESTINATION PROCESS NAME

.CDREA:!BLOCK	1	;DISCONNECT REASONS
	MSKSTR	(CDSREA,.CDREA,<-1,,0>) ;SOURCE DISCONNECT REASON
	MSKSTR	(CDDREA,.CDREA,<0,,-1>) ;DESTINATION DISCONNECT REASON

.CDLEN:!		;LENGTH OF A CONNECTION STATE DATA BLOCK

	DEPHASE
	SUBTTL	CONNECTION BLOCK FORMAT


	PHASE	0	;DEFINE AS OFFSETS

.CBANB:!BLOCK	1	;ADDRESS OF NEXT CONNECTION BLOCK
.CBAPB:!BLOCK	1	;ADDRESS OF PREVIOUS CONNECTION BLOCK

.CBPBK:!BLOCK	1	;ADDRESS OF PATH BLOCK

.CBSTS:!BLOCK	1	;STATUS INFO
	MSKSTR	(CBBKST,.CBSTS,<-1,,0>)	;BLOCK STATE
	MSKSTR	(CBCNST,.CBSTS,<0,,-1>)	;CONNECTION STATE

.CBFLG:!BLOCK	1	;FLAGS
	CB.NNC==1B0		;NEEDS CREDIT NOTIFY
	CB.JSY==1B1		;CB IS FOR JSYS CONNECTION
	CB.ABT==1B2		;CB HAS BEEN ABORTED
	CB.RAP==1B3		;CB IS TO BE REAPED
	CB.DCL==1B4		;THIS WAS A DON'T CARE LISTENER
	CB.KIL==1B5		;FORK HAS BEEN KILLED
	CB.MDC==1B6		;MAINTENANCE DATA CB
	CB.CVC==1B7		;VC WAS CLOSED
	CB.SOB==1B8		;STUCK ON BUFFERS
	CB.PTC==1B9		;PROTOCOL COMPLETE
	CB.ERR==1B10		;SC.ERR DEFERRED
	CB.DIS==1B11		;SC.DIS DEFERRED
	CB.DRQ==1B12		;SC.DRQ DEFERRED
	CB.SNM==1B13		;SC.SNM DEFERRED
	CB.DEF==CB.ERR!CB.DIS!CB.DRQ!CB.SNM ;ALL DEFERRED BITS

.CBSCI:!BLOCK	1	;SOURCE CONNECT ID
.CBDCI:!BLOCK	1	;DESTINATION CONNECT ID

.CBADR:!BLOCK	1	;ADDRESS OF ROUTINE TO CALL ON CONDITION CHANGES

.CBBUF:!BLOCK	1	;BUFFER REQUESTS
	MSKSTR	(CBIMB,.CBBUF,<-1,,0>) ;NUMBER OF MESSAGE BUFFERS TO QUEUE
	MSKSTR	(CBIDB,.CBBUF,<0,,-1>) ;NUMBER OF DATAGRAM BUFFERS TO QUEUE

.CBNWQ:!BLOCK	1	;ADDRESS OF NEXT ENTRY ON WORK QUEUE

.CBSPN:!BLOCK	C%PNLW	;SOURCE PROCESS NAME
.CBDPN:!BLOCK	C%PNLW	;DESTINATION PROCESS NAME

.CBDTA:!BLOCK	C%DTLW	;CONNECTION DATA

.CBREA:!BLOCK	1	;DISCONNECT/REJECT REASONS
	MSKSTR	(CBDDRE,.CBREA,<-1,,0>)	;DESTINATION DISCONNECT REASON
	MSKSTR	(CBSDRE,.CBREA,<0,,-1>)	;SOURCE DISCONNECT REASON

.CBRSP:!BLOCK	1	;EXPECTED RESPONSE
	MSKSTR	(CBEXPR,.CBRSP,<-1,,0>) ;EXPECTED RESPONSE TO SCS MESSAGE SENT

.CBMCD:!BLOCK	1	;MINIMUM CREDIT INFORMATION
	MSKSTR	(CBMNSC,.CBMCD,<-1,,0>)	;MINIMUM SEND CREDIT
	MSKSTR	(CBMNRC,.CBMCD,<0,,-1>)	;MINIMUM RECEIVE CREDIT

.CBSCD:!BLOCK	1	;SEND CREDIT

.CBRCD:!BLOCK	1	;RECEIVE CREDIT

.CBPRC:!BLOCK	1	;PENDING RECEIVE CREDIT

.CBRQC:!BLOCK	1	;CREDITS OUTSTANDING IN CDT_REQ

.CBRTC:!BLOCK	1	;RETURN CREDIT

.CBNPO:!BLOCK	1	;NUMBER OF PACKETS (MSG OR DG) ON PORT COMMAND QUEUE

.CBDGR:!BLOCK	1	;NUMBER OF DG BUFFERS ON HARDWARE QUEUE

.CBCDD:!BLOCK	1	;NUMBER OF DROPPED DATAGRAMS

.CBLCK:!BLOCK	1	;INTERLOCK WORD

.CBPND:!BLOCK	1	;FLAG WORD FOR CREDIT_REQUEST IN PROGRESS

.CBJNB:!BLOCK	1	;ADDRESS OF NEXT CB IN THE JOB LIST
.CBJPB:!BLOCK	1	;ADDRESS OF PREVIOUS CB IN THE JOB LIST

.CBMGJ:!BLOCK	1	;NUMBER OF JSYS MESSAGE RECEIVE BUFFERS QUEUED
.CBDGJ:!BLOCK	1	;NUMBER OF DG BUFFERS IN USER SPACE

.CBJCH:!BLOCK	1	;JOB,,JCH OF WHO OWNS CONNECTION
	MSKSTR	(CBJCH,.CBJCH,<0,,-1>)	;JCH OF CONNECT OWNER
	MSKSTR	(CBJOB,.CBJCH,<-1,,0>)	;JOB OF CONNECT OWNER

.CBTMQ:!BLOCK	1	;POINTER TO TOP OF MESSAGE PENDING QUEUE
.CBBMQ:!BLOCK	1	;POINTER TO BOTTOM OF MESSAGE PENDING QUEUE

.CBTDQ:!BLOCK	1	;POINTER TO TOP OF DATAGRAM AVAILABLE QUEUE
.CBBDQ:!BLOCK	1	;POINTER TO BOTTOM OF DATAGRAM AVAILABLE QUEUE

.CBTXQ:!BLOCK	1	;POINTER TO TOP OF DATA REQUEST COMPLETE QUEUE
.CBBXQ:!BLOCK	1	;POINTER TO BOTTOM OF DATA REQUEST COMPLETE QUEUE

.CBTEQ:!BLOCK	1	;POINTER TO TOP OF EVENT QUEUE
.CBBEQ:!BLOCK	1	;POINTER TO BOTTOM OF EVENT QUEUE

.CBTBQ:!BLOCK	1	;POINTER TO FIRST BUFFER LIST DESCRIPTOR BLOCK
.CBBBQ:!BLOCK	1	;POINTER TO LAST BUFFER LIST DESCRIPTOR BLOCK

.CBLEN:!		;LENGTH OF A CONNECTION BLOCK

	DEPHASE

IF2,<IFL <C%MGSZ-.CBLEN>,<PRINTX ?SCAPRM: Connection block too long for a message buffer>>

	DEPHASE
	SUBTTL	BUFFER HEADER & BUFFER SEGMENT DESCRIPTOR BLOCK FORMATS


;                          BUFFER HEADER DESCRIPTOR
;
;          +================+==========================+==+==+==+
;          |00<---------->15|16<------------------->|32|33|34|35|
; .BHKEY   |      KEY       |            MBZ        |P |V |E |W |     0
;          +----------------+--------------------------+--+--+--+
;          |00<------->11|12<-------------------------------->35|
; .BHBSA   |     MBZ     | FIRST BUFFER SEGMENT DESCRIPTOR ADDR |--+  1
;          +-------------+--------------------------------------+  |
;          |00<---------------------------------------------->35|  |
; .BHLEN   |                    LENGTH                          |  |  2
;          +----------------------------------------------------+  |
;          |                   RESERVED                         |  |  3
;          +----------------------------------------------------+  |
;                                 V                                |
;                                 V                                |
;                                 V                                |
;                        BUFFER SEGMENT DESCRIPTOR  # 1            |
;          +-------+-------+-------+----------------------------+  |
;          |00<->05|06<->07|08<->11|12<---------------------->35|<-+
; .BSADR   |  MBZ  |  MODE |  MBZ  | BUFFER SEGMENT  BASE  ADDR |     0
;          |-------+-------+--+----+----------------------------+
;          |00<------------>11|12<--------------------------->35|
; .BSNXT   |        MBZ       | NEXT BUFFER SEGMENT DESCRIPTOR  |--+  1
;          |------------------+---------------------------------+  |
;          |00<---------------------------------------------->35|  |
; .BSLEN   |                    SEGMENT LENGTH                  |  |  2
;          |----------------------------------------------------+  |
;          |                   RESERVED                         |  |  3
;          +====================================================+  |
;                                 V                                |
;                                 V                                |
;                                 V                                |
;                        BUFFER SEGMENT DESCRIPTOR # n             |
;          +=======+=======+=======+============================+  |
;          |00<->05|06<->07|08<->11|12<---------------------->35|<-+
; .BSADR   |  MBZ  |  MODE |  MBZ  | BUFFER SEGMENT  BASE  ADDR |     0
;          +-------+-------+-------+----------------------------+  
;          |00<------------>11|12<--------------------------->35|
; .BSNXT   |        MBZ       | NEXT BUFFER SEGMENT DESCRIPTOR  |     1
;          |------------------+---------------------------------+
;          |00<---------------------------------------------->35|
; .BSLEN   |                    SEGMENT LENGTH                  |     2
;          |----------------------------------------------------+
;          |                    RESERVED                        |     3
;          +====================================================+
;
;BUFFER HEADER DESCRIPTOR

	BHPIDX==^D31	;POSITION OF INDEX INTO BDT FIELD
	BHSIDX==^D16	;SIZE OF INDEX INTO BDT FIELD

	PHASE	0	;DEFINE AS OFFSETS

.BHKEY:!BLOCK	1	;KEY AND VALIDITY BITS
	BHPKEY==^D15	;POSITION OF KEY FIELD
	BHSKEY==^D16	;SIZE OF KEY FIELD

	BH.PRE==1B32	;KLIPA MICROCODE SHOULD PRESERVE BH.VAL
	BH.VAL==1B33	;BHD CONTAINS VALID DATA
	BH.ERR==1B34	;SOME ERROR
	BH.WRT==1B35	;DATA ADDRESSED BY BSDS IS WRITABLE

.BHBSA:!BLOCK	1	;PHYSICAL ADDRESS OF FIRST BUFFER SEGMENT DESCRIPTOR

.BHLEN:!BLOCK	1	;LENGTH (IN NIBBLES) OF ENTIRE TRANSFER

.BHRSV:!BLOCK	1	;RESERVED

.BHSIZ:!		;SIZE OF A BHD

	DEPHASE

IFN .BHSIZ&3,<PRINTX ?BHD LENGTH MUST BE A MULTIPLE OF 4 WORDS>

	DEPHASE


;BUFFER SEGMENT DESCRIPTOR

	PHASE	0	;DEFINE AS OFFSETS

.BSADR:!BLOCK	1	;ADDRESS OF SEGMENT AND MODE BITS
	BSPMOD==^D7	;POSITION OF MODE FIELD
	BSSMOD==^D2	;SIZE OF MODE FIELD
	BS.ICM==0B7	;INDUSTRY COMPATIBLE MODE
	BS.CDM==1B7	;CORE-DUMP MODE
	BS.HDM==2B7	;HIGH DENSITY MODE
	BS.ASM==3B7	;7-BIT ASCII MODE (NOT AVAILABLE ON KLIPA)

.BSNXT:!BLOCK	1	;PHYSICAL ADDRESS OF NEXT BSD (OR ZERO IF LAST BSD)

.BSLEN:!BLOCK	1	;LENGTH (IN NIBBLES) OF THIS SEGMENT

.BSRSV:!BLOCK	1	;RESERVED

.BSSIZ:!		;SIZE OF A BSD

	DEPHASE

IFN .BSSIZ&3,<PRINTX ?BSD LENGTH MUST BE A MULTIPLE OF 4 WORDS>

	DEPHASE


;NIBBLES/WORD FOR VARIOUS TRANSFER MODES

	CDNPW==12	;NIBBLES/WORD IN CORE DUMP MODE
	HDNPW==11	;NIBBLES/WORD IN HIGH DENSITY MODE
	SUBTTL	QUEUE POINTER ADDRESS BLOCK FORMAT


;THIS BLOCK IS USED TO PASS THE ADDRESSES OF QUEUES BETWEEN ROUTINES
;IN SCSUUO.  SEE SCSDEQ IN SCSUUO.MAC.

	PHASE	0	;DEFINE AS OFFSETS

.TOPCQ:!BLOCK	1	;ADDRESS OF CONNECT QUEUE HEAD POINTER
.BOTCQ:!BLOCK	1	;ADDRESS OF CONNECT QUEUE TAIL POINTER

.TOPFQ:!BLOCK	1	;ADDRESS OF JCH QUEUE HEAD POINTER
.BOTFQ:!BLOCK	1	;ADDRESS OF JCH QUEUE TAIL POINTER

.JBUFF:!BLOCK	1	;COUNT OF THESE JSYS BUFFERS

QLEN:!			;LENGTH OF THIS BLOCK

	DEPHASE
	SUBTTL	JSYS PACKET BUFFER INVISIBLE DATA AREA BLOCK FORMAT


;THIS IS THE FORMAT OF THE "INVISIBLE DATA AREA" APPEARING BEFORE
;EVERY SCA PROVIDED BUFFER.

.JHFLG==-2		;FLAGS
	JH%DGB==1B0	;THIS IS A DATAGRAM BUFFER
.JHAUB==-1		;ADDRESS OF USER BUFFER
	SUBTTL	JSYS BUFFER LIST DESCRIPTOR BLOCK FORMAT


;THIS BLOCK IS USED TO MAINTAIN A LIST OF BUFFERS QUEUED BY THE USER.

	PHASE	0	;DEFINE AS OFFSETS

.BDNXT:!BLOCK	1	;ADDRESS OF NEXT BUFFER SEGMENT DESCRIPTOR BLOCK
.BDPRE:!BLOCK	1	;ADDRESS OF PREVIOUS BUFFER SEGMENT DESCRIPTOR BLOCK

.BDFFD:!BLOCK	1	;ADDRESS OF FIRST FREE BLOCK
.BDLFD:!BLOCK	1	;ADDRESS OF LAST FREE BLOCK

.BDFMG:!BLOCK	1	;ADDRESS OF FIRST MESSAGE BUFFER BLOCK
.BDLMG:!BLOCK	1	;ADDRESS OF LAST MESSAGE BUFFER BLOCK

.BDFDG:!BLOCK	1	;ADDRESS OF FIRST DATAGRAM BUFFER BLOCK
.BDLDG:!BLOCK	1	;ADDRESS OF LAST DATAGRAM BUFFER BLOCK

.BDBDB:!		;OFFSET TO FIRST BUFFER DESCRIPTOR BLOCK


;LIST BLINKS MUST ALL BE THE SAME OFFSET FROM LIST FLINKS IF
;SCSLUB IS GOING TO WORK.  THIS OFFSET IS DEFINED BELOW:

XP	.BDF2B,1	;OFFSET FROM LIST FLINK TO LIST BLINK


;FORMAT OF BUFFER DESCRIPTOR BLOCKS

	PHASE	0	;DEFINE AS OFFSETS

.BBNXT:!BLOCK	1	;NEXT BLOCK IN LIST
.BBUVA:!BLOCK	1	;USER VIRTUAL ADDRESS

.BBLEN:!		;LENGTH OF AN ENTRY

C%NBSD==<C%DGSZ-.BDBDB>/<.BBLEN+1> ;NUMBER OF BSDS IN A LONG DATAGRAM BUFFER

	DEPHASE
	SUBTTL	Block formats -- Named buffer list block


;THIS BLOCK IS USED TO KEEP TRACK OF BUFFER NAMES ASSOCIATED WITH
;A CONTEXT.

	PHASE	0	;DEFINE AS OFFSETS

.XNNXT:!BLOCK	1	;ADDRESS OF NEXT ENTRY
.XNPRV:!BLOCK	1	;ADDRESS OF PREVIOUS ENTRY

.XNNAM:!BLOCK	1	;32-BIT BUFFER NAME

.XNLEN:!		;LENGTH OF AN ENTRY

	DEPHASE
	SUBTTL	Block formats -- Map descriptor block


;The following is the format of the descriptor block handed to
;PPDMAP as an argument.
;
;
;	 !=======================================================!
; .MDNXT !    Address of next buffer in chain or zero if none    !
;	 !-------------------------------------------------------!
; .MDFLG !			   Flags			 !
;	 !-------------------------------------------------------!
; .MDSSD !               Length of buffer segment 0              !
;	 !-------------------------------------------------------!
;	 !            Physical address of the segment 0          !
;	 !-------------------------------------------------------!
; 	 \                                                       \
;	 \                                                       \
;	 \                segment descriptor pairs               \
;	 \                                                       \
;	 \                                                       \
;	 !-------------------------------------------------------!
;	 !               Length of buffer segment #n             !
;	 !-------------------------------------------------------!
; 	 !            Physical address of the segment #n         !
;	 !-------------------------------------------------------!
;	 !         		     0				 !
;	 !=======================================================!


	PHASE	0	;DEFINE AS OFFSETS

.MDNXT:!BLOCK	1	;LINK TO NEXT DESCRIPTOR BLOCK
.MDFLG:!BLOCK	1	;FLAGS WORD
	MSKSTR (MD%FLG,<>,<17B35>) ;MASK OF DEFINED FLAG VALUES
	MSKSTR (MD%DMD,<>,<3B35>) ;MASK FOR MODE VALUE
		 MD%DIC==0	;INDUSTRY COMPATIBLE MODE
		 MD%DCD==1	;CORE DUMP MODE (UNSUPPORTED)
		 MD%DHD==2	;HIGH DENSITY MODE

;THE FOLLOWING TWO DEFINITIONS ARE DEFINED IN MONSYM. ENTERED HERE
;FOR REFERENCE.

		SQ%CVD==:1B32	;DO NOT CLEAR VALID BIT
		SQ%WRT==:1B33	;ALLOW WRITING OF BUFFER

.MDSSD:!		;START OF SEGMENT DESCRIPTORS

	DEPHASE

	PHASE	0	;DEFINE AS OFFSETS

.MDLEN:!BLOCK	1	;LENGTH OF SEGMENT
.MDADR:!BLOCK	1	;PHYSICAL ADDRESS OF SEGMENT
.MDLSD:!		;LENGTH OF SEGMENT DESCRIPTORS

	DEPHASE
	SUBTTL	COMMON QUEUE HEADER BLOCK FORMAT


;THIS BLOCK DEFINES THE FORMAT OF THE QUEUE ENTRY HEADER THAT IS COMMON
;TO ALL QUEUES (MESSAGE, DATAGRAM, DMA, AND EVENT QUEUES).

	PHASE	0	;DEFINE AS OFFSETS

.MEANC:!BLOCK	1	;ADDRESS OF NEXT ENTRY FOR THIS CONNECTION
.MEAPC:!BLOCK	1	;ADDRESS OF PREVIOUS ENTRY FOR THIS CONNECTION

.MEANF:!BLOCK	1	;ADDRESS OF NEXT ENTRY FOR THIS JCH
.MEAPF:!BLOCK	1	;ADDRESS OF PREVIOUS ENTRY FOR THIS JCH

.MEJCH:!BLOCK	1	;JCH,,LENGTH
	MSKSTR	(MEJCH,.MEJCH,<-1,,0>)	;JCH
	MSKSTR	(MELEN,.MEJCH,<0,,-1>)	;LENGTH OF PACKET

.METYP:!BLOCK	1	;FLAGS AND BLOCK TYPE
	MSKSTR	(MEFLG,.METYP,<-1,,0>) 	;FLAGS
	MSKSTR	(METYP,.METYP,<0,,-1>)	;BLOCK TYPE
		.ETMSG==1	;MESSAGE BUFFER
		.ETDG==2	;DATAGRAM BUFFER
		.ETEVT==3	;EVENT BLOCK
		.ETDMA==4	;DMA COMPLETION

.MECID:!BLOCK	1	;CONNECT ID

	DEPHASE
	SUBTTL	EVENT CODE BLOCK HEADER FORMAT


	PHASE	.MECID+1 ;THESE FOLLOW THE COMMON QUEUE HEADER

.EBCOD:!BLOCK	1	;LENGTH OF BLOCK,,EVENT CODE
	MSKSTR	(EBLEN,.EBCOD,<-1,,0>)	;LENGTH
	MSKSTR	(EBCOD,.EBCOD,<0,,-1>)	;EVENT CODE

.EBDAT:!		;START OF CODE DEPENDANT DATA AREA

	DEPHASE
	SUBTTL	DMA QUEUE BLOCK HEADER FORMAT


	PHASE	.MECID+1 ;THESE FOLLOW THE COMMON QUEUE HEADER

.DMNAM:!BLOCK	1	;NAME OF BUFFER

.DMLEN:!		;LENGTH OF THIS BLOCK

	DEPHASE
	SUBTTL	MACROS - DISPATCH TABLE GENERATOR


;THIS MACRO DEFINES THE ORDER FOR THE MESSAGE/DATAGRAM DISPATCH TABLE.
;WHEN A MESSAGE IS RECEIVED, ONE SIMPLY INDEXES INTO THIS TABLE TO FIND
;THE ADDRESS OF THE ROUTINE TO HANDLE SAID MESSAGE.  CARE MUST BE TAKEN
;HERE TO BE SURE THIS TABLE IS IN THE CORRECT ORDER.  THE TABLE IS BUILT
;IN THE ORDER THAT ENTRIES APPEAR HERE.  THE OFFSETS ARE GIVEN TO MAKE
;SURE THINGS HAPPEN IN THE RIGHT ORDER.

DEFINE $DISPA,<

	...FOO==0		;;INIT THE ORDER CHECKER VARIABLE

	$ENT (.STORQ,SC.ORQ)	;;CONNECT REQUEST
	$ENT (.STORS,SC.ORS)	;;CONNECT RESPONSE
	$ENT (.STARQ,SC.ARQ)	;;ACCEPT REQUEST
	$ENT (.STARS,SC.ARS)	;;ACCEPT RESPONSE
	$ENT (.STRRQ,SC.RRQ)	;;REJECT REQUEST
	$ENT (.STRRS,SC.RRS)	;;REJECT RESPONSE
	$ENT (.STDRQ,SC.DRQ)	;;DISCONNECT REQUEST
	$ENT (.STDRS,SC.DRS)	;;DISCONNECT RESPONSE
	$ENT (.STCRQ,SC.CRQ)	;;CREDIT REQUEST
	$ENT (.STCRS,SC.CRS)	;;CREDIT RESPONSE
	$ENT (.STAMG,SC.AMG)	;;APPLICATION MESSAGE
	$ENT (.STADG,SC.ADG)	;;APPLICATION DATAGRAM

>; END $DISPA DEFINITION

;THIS MACRO DEFINES ONE ENTRY IN $DISPA

DEFINE $ENT(OFFSET,ADDR),<

IFN ...FOO,<
IFN <OFFSET-...FOO-1>,<IF2 <PRINTX ?Dispatch table out of order! (OFFSET)>>
> ;END IFN ...FOO

	...FOO==OFFSET		;;GET THE CURRENT VALUE OF OFFSET

	XALL			;;LIST THE RESULT
	IFIW	ADDR		;ROUTINE TO PROCESS MESSAGE TYPE OFFSET
	SALL

> ;END $ENT DEFINITION
	SUBTTL	FUNCTION CODES RETURNED BY SCA


;THE FOLLOWING PAGES DEFINE THE FUNCTION CODES RETURNED TO MONITOR
;MODULES WHICH HAVE INVOKED SCA.
;
;FORMAT OF RETURNED INFORMATION:
;	T1/	FUNCTION CODE
;	T2/	FUNCTION CODE DEPENDENT ADDITIONAL DATA
;	T3/	FUNCTION CODE DEPENDENT ADDITIONAL DATA
;	T4/	FUNCTION CODE DEPENDENT ADDITIONAL DATA
;
;WHERE T2, T3, AND T4 CONTAIN ADDITIONAL DATA DEPENDING ON THE
;FUNCTION CODE.

;FUNCTIONS WHICH RETURN A CONNECT ID *ALWAYS* RETURN THE ID IN
;T2 TO MAKE THINGS MORE CONSISTENT.
;Datagram received. SCA is indicating that the CI has filled one of the buffers
;queued for datagram reception with a datagram. 
;	T1/	.SSDGR
;	T2/	Connect ID
;	T3/	Address of datagram buffer
;	T4/	<FLAGS>B6 ! <Addr of routine to return buffer>B35
;		(See F.RTB and friends for flag definitions)
;
; .MHPKL word of datagram buffer/
;		Length of the packet (Bytes for industry compatable, words
;					for high density)

	.SSDGR==:0

;Message received. SCA is indicateing that you have received a message from the
;CI.
;	T1/	.SSMGR
;	T2/	Connect ID
;	T3/	Address of message buffer
;	T4/	<FLAGS>B6 ! <Addr of routine to return buffer>B35
;		(See F.RTB and friends for flag definitions)
;
; .MHPKL word of msg buffer/
;		Length of the packet (Bytes for industry compatable, words
;					for high density)

	.SSMGR==:1

;Port broke connection. The port hardware detected a fatal error for the
;port virtual circuit on which you had a connection. Thus it broke your
;connection.
;	T1/	.SSPBC
;	T2/	Connect ID
;	T3/	Unused
;	T4/	Unused

	.SSPBC==:2

;Connection to listen. The listen for either anyone, or a particular process 
;name has had a connection request from a remote node.
;	T1/	.SSCTL
;	T2/	Connect ID
;	T3/	Pointer to connection data from remote system
;		(The pointer to the connection data is only guaranteed 
;                valid for the duration of the callback.)
;	T4/	Unused

	.SSCTL==:3
;Connection response available. The system to which you sent a connect message 
;has responded.
;	T1/	.SSCRA
;	T2/	Connect ID
;	T3/	-1 for accepted, 0 for rejected connection
;	T4/	Reject code (If rejected), pointer to connect data if accepted
;		(The pointer to the connection data is only guaranteed 
;                valid for the duration of the callback.)

	.SSCRA==:4

;Message/datagram Send complete. The message/datagram which you requested be 
;sent, has been. The "buffer address" is the address of the buffer you gave 
;SCA to send.
;	T1/	.SSMSC
;	T2/	Connect ID
;	T3/	Address of buffer
;	T4/	Unused
;
	.SSMSC==:5

;Datagram dropped. A datagram was received and there were no buffers
;queued to place it.  The buffer is relinked to the port's datagram 
;free queue.
;	T1/	.SSDDG
;	T2/	Connect ID
;	T3/	Unused
;	T4/	Unused
;
	.SSDDG==:6

;Little credit left. You have just received a message that put you under
;receive credit threshold. It is suggested that you queue at least some buffers
;if you expect to get more messages. Note that you will receive one of these
;calls every time you receieve a message after which you are under threshold.
;	T1/	.SSLCL
;	T2/	Connect ID
;	T3/	Number of credits needed to get you over threshold
;	T4/	Unused
;	
	.SSLCL==7
;Node came online. You requested to be told of nodes coming online.
;It happened and now your being told.
;
;	T1/	.SSNCO
;	T2/	PBI of system that has come online
;	T3/	Unused
;	T4/	Unused
;
	.SSNCO==10

;OK to send data. The connection has been completed to a remote system and is
;now in the OPEN state. Messages and datagram may be sent...
;
;	T1/	.SSOSD
;	T2/	Connect ID
;	T3/	Unused
;	T4/	Unused
;
	.SSOSD==11

;Remote initiated disconnect. The host at the other end of your connection
;doesn't want to talk to you anymore and has completed an orderly shutdown of
;your connection.
;
;	T1/	.SSRID
;	T2/	Connect ID
;	T3/	Disconnect reason code
;	T4/	Unused
;
	.SSRID==12

;Credit is available. Your message send failed for lack of credit. There is
;now more credit available for your send...
;
;	T1/	.SSCIA
;	T2/	Connect ID
;	T3/	Current send credit
;	T4/	Current receive credit
;
	.SSCIA==13
;DMA operation complete. The DMA operation you requested has been completed.
;Note that you will NOT be told about the completion of passive requests. I.E.
;you will not be notified when a request/send data done by a remote completes.
;
;	T1/	.SSDMA
;	T2/	Connect ID of connection DMA was cone for
;	T3/	32 bit buffer name of DMA buffer
;	T4/	Unused
;
	.SSDMA==14

	.SSAFT==.SSDMA		;Last defined code
	SUBTTL	CONNECTION STATES, BLOCK STATES, CONNECTION MANAGEMENT SYMBOLS


;STATES OF A CONNECTION.  NAMES IN PARENS ARE FROM CORPORATE SCA SPEC.

	.CSCLO==1		;CLOSED (CLOSED)
	.CSLIS==2		;LISTENING (LISTENING)
	.CSCSE==3		;CONNECT REQUEST WAS SENT (CONNECT_SENT)
	.CSCRE==4		;CONNECT REQUEST WAS RECEIVED (CONNECT_REC)
	.CSCAK==5		;CONNECT RESPONSE WAS RECEIVED (CONNECT_ACK)
	.CSACS==6		;ACCEPT REQUEST WAS SENT (ACCEPT_SENT)
	.CSRJS==7		;REJECT REQUEST WAS SENT (REJECT_SENT)
	.CSOPN==10		;CONNECTION IS OPEN (OPEN)
	.CSDSE==11		;DISCONNECT REQUEST WAS SENT (DISCONNECT_SENT)
	.CSDRE==12		;DISCONNECT REQUEST RECEIVED (DISCONNECT_REC)
	.CSDAK==13		;DISCONNECT RESPONSE RECEIVED (DISCONNECT_ACK)
	.CSDMC==14		;WAITING FOR DISCONNECT RESPONSE (DISCONNECT_MATCH)

	MXCNST==14		;MAXIMUM CONNECT STATE


;CONNECTION BLOCK STATES

	.BSFRE==:1		;FREE
	.BSALL==:2		;ALLOCATE
	.BSCNP==:3		;CONNECT PENDING
	.BSACP==:4		;ACCEPT PENDING
	.BSRPN==:5		;REJECT PENDING
	.BSCRP==:6		;CREDIT PENDING
	.BSDPN==:7		;DISCONNECT PENDING


;CONNECTION MANAGEMENT SYMBOLS

	.CMCMT==^D1		;A MATCH FOUND FOR THE CONNECT_REQUEST
	.CMCNM==^D10		;NO MATCH WAS FOUND FOR THE CONNECT_REQUEST
	.CMNRE==^D18		;NO RESOURCES TO PROCESS THE CONNECT_REQUEST
	.CMNDS==^D26		;CONNECTION HAS BEEN BROKEN
	.CMNRV==^D34		;RESERVED
	SUBTTL	SCA ERROR CODES PASSED TO CALLERS OF SCASER


	.SCFAF==3	;ALLOCATION FAILURE
	.SCFBC==4	;SUBROUTINE CALLED WITH INVALID ARGUMENTS
	.SCFIC==5	;INVALID CONNECT ID
	.SCFNE==6	;NO ENTRY FOR SPECIFIED SBI
	.SCFNS==7	;NO SLOTS AVAILABLE IN CID TABLE
	.SCIID==10	;INVALID CONNECT ID
	.SCIPI==11	;INVALID PBI
	.SCISI==12	;INVALID SBI
	.SCNEB==13	;NOT ENOUGH BUFFERS
	.SCNEC==14	;NOT ENOUGH CREDITS
	.SCNRT==15	;NOTICE TABLE FULL
	.SCPTL==16	;PACKET TOO LONG
	.SCSWS==17	;CONNECTION IN WRONG STATE
	SUBTTL	SCA MESSAGE TYPES AND LENGTHS


	.STORQ==0	;CONNECT REQUEST
	.LNORQ==^D64

	.STORS==1	;CONNECT RESPONSE
	.LNORS==^D16

	.STARQ==2	;ACCEPT REQUEST
	.LNARQ==^D64

	.STARS==3	;ACCEPT RESPONSE
	.LNARS==^D16

	.STRRQ==4	;REJECT REQUEST
	.LNRRQ==^D16

	.STRRS==5	;REJECT RESPONSE
	.LNRRS==^D12

	.STDRQ==6	;DISCONNECT REQUEST
	.LNDRQ==^D16

	.STDRS==7	;DISCONNECT RESPONSE
	.LNDRS==^D12

	.STCRQ==10	;CREDIT REQUEST
	.LNCRQ==^D12

	.STCRS==11	;CREDIT RESPONSE
	.LNCRS==^D12

	.STAMG==12	;APPLICATION MESSAGE

	.STADG==13	;APPLICATION DATAGRAM

	.STLST==.STADG+1 ;HIGHEST TYPE +1
	SUBTTL	PPD PACKET MESSAGE FORMATS


	PHASE	0	;DEFINE AS OFFSETS

.PKFLI:!BLOCK	1	;FORWARD LINK (FLINK)
.PKBLI:!BLOCK	1	;BACKWARD LINK (BLINK)
.PKVRT:!BLOCK	1	;VIRTUAL ADDRESS OF THE PACKET (RESERVED TO SOFTWARE)
		PK.SRB==77B5		;THE SOFTWARE RESPONSE BITS
		PK.DRV==1B0		;RETURN PACKET TO KLIPA DRIVER
		PK.SCA==1B1		;SCA SFOTWARE RESPONSE BIT
	DEFSTR	(PKVRT,.PKVRT,35,30)	;PACKET VIRTUAL ADDRESS
.PKSTS:!BLOCK	1	;STATUS/OPCODE/FLAGS/NODE NUMBER

;FIELDS IN .PKSTS

	PKPSTS==^D7	;POSITION OF STATUS FIELD
	PKSSTS==^D8	;SIZE OF STATUS FIELD
	PKPFLG==^D15	;POSITION OF FLAGS FIELD
	PKSFLG==^D8	;SIZE OF FLAGS FIELD
	PKPOP==^D23	;POSITION OF OPCODE FIELD
	PKSOP==^D8	;SIZE OF OPCODE FIELD
	PKPNOD==^D31	;POSITION OF NODE FIELD
	PKSNOD==^D8	;SIZE OF NODE FIELD

;BITS AND STUFF IN STATUS FIELD

	PS.ERR==1B0	;COMPOSITE ERROR BIT
	PS.PAE==1B1	;PATH A ERROR
	PS.PBE==1B2	;PATH B ERROR

;VALUES IN STATUS FIELD (MINUS ERROR BIT)

	PS.IBN==2	;INVALID BUFFER NAME
	PS.NRA==104	;NO RESPONSE ON PATH A
	PS.NRB==44	;NO RESPONSE ON PATH B
	PS.NRE==144	;NO RESPONSE ON EITHER PATH

;STATUS BITS WHEN PS.ERR IS OFF

	PS.CLO==1B1	;CLOSED THE PATH
	PS.AKA==1B2	;PACKET WAS ACKED ON PATH A
	PS.NKA==1B3	;PACKET WAS NAKED AT LEAST ONCE ON PATH A
	PS.NOA==1B4	;PACKET GOT NO RESPONSE AT LEAST ONCE ON PATH A
	PS.AKB==1B5	;PACKET WAS ACKED ON PATH B
	PS.NKB==1B6	;PACKET WAS NAKED AT LEAST ONCE ON PATH B
	PS.NOB==1B7	;PACKET GOT NO RESPONSE AT LEAST ONCE ON PATH B
;FLAGS IN FLAGS FIELD

	PF.SIZ==1B8	;(BLOCK DATA SERVICE) 0 IF 512 BYTES, 1 IF 576 BYTES
	PF.FMT==1B8	;(DATAGRAM/MESSAGE) 0 IF IND. COMPAT., 1 IF HIGH DENSITY
	PF.FRC==1B8	;(RESET REMOTE) FORCE RESET
	PF.DSA==1B8	;(START REMOTE) USE DEFAULT STARTING ADDRESS
	PF.CPE==1B12	;CNTRD GENERATED BY PORT (CRAM PARITY ERROR)
	PF.PTH==3B14	;PATH SELECT, 0=AUTO, 1=PATH 0, 2=PATH 1
	PF.PT0==1B14	;USE PATH A
	PF.PT1==2B14	;USE PATH B
	PF.RSP==1B15	;RESPONSE REQUESTED

.PKHDR:!		;LENGTH OF GENERAL PACKET HEADER
;DATAGRAM/MESSAGE SPECIFIC

	PHASE	.PKHDR	;FOLLOW GENERAL HEADER

.PKLEN:!BLOCK	1	;LENGTH OF DATAGRAM/MESSAGE
	PKPPPD==^D15	;POSITION OF PPD BYTE FIELD
	PKSPPD==^D16	;SIZE OF PPD BYTE FIELD
	PKPLEN==^D35	;POSITION OF LENGTH FIELD
	PKSLEN==^D20	;SIZE OF LENGTH FIELD

;PPD FIELD TYPES

	PP.STA==0	;START
	PP.STK==1	;STACK
	PP.ACK==2	;ACK
	PP.DG==3	;DATAGRAM
	PP.MSG==4	;MESSAGE
	PP.ERP==5	;ERROR PACKET
	PP.SHT==6	;SHUTDOWN
	PP.MAX==6	;MAXIMUM PPD BYTE


;BLOCK DATA SERVICE

	PHASE	.PKHDR	;FOLLOW GENERAL HEADER

.PKXID:!BLOCK	2	;TRANSACTION ID (2 WORDS)
.PKXLN:!BLOCK	1	;TRANSACTION LENGTH
.PKSNM:!BLOCK	1	;SENDER'S BUFFER NAME
.PKSOF:!BLOCK	1	;SENDER'S BUFFER OFFSET
.PKRNM:!BLOCK	1	;RECEIVER'S BUFFER NAME
.PKROF:!BLOCK	1	;RECEIVER'S BUFFER OFFSET


;READ REGISTER

	PHASE	.PKHDR	;FOLLOW GENERAL HEADER

.PKREG:!BLOCK	1	;REGISTER TO READ
	PKPREG==^D23	;POSITION OF REGISTER TO READ FIELD
	PKSREG==^D8	;SIZE OF REGISTER TO READ FIELD
	PKPDTA==^D7	;POSITION OF RETURNED DATA FIELD
	PKSDTA==^D8	;SIZE OF RETURNED DATA FIELD

;REGISTER TYPES

	.RGNOD==14	;OUR NODE NUMBER
;ID RECEIVED

	PHASE	.PKHDR	;FOLLOW GENERAL HEADER

.PKXID:!BLOCK	2	;TRANSACTION ID (2 WORDS)
.PKMID:!BLOCK	1	;MAINTENANCE ID
	PKPID==^D31	;POSITION OF PORT ID FIELD
	PKSID==^D16	;SIZE OF PORT ID FIELD

;ID FIELD TYPES

	ID.HSC==4	;HSC-50
	ID.KL==6	;KL-10

.PKCOD:!BLOCK	1	;CODE REVISION LEVEL
.PKFUN:!BLOCK	1	;PORT FUNCTIONALITY
	PK.SMD==1B17	;PORT SUPPORTS RECEIPT OF A SNTMDAT
	PK.RMD==1B19	;PORT SUPPORTS RECEIPT OF A MDATREQ
.PKPST:!BLOCK	1	;PORT STATE
	PKPPST==^D22	;POSITION OF PORT STATE FIELD
	PKSPST==^D2	;SIZE OF PORT STATE FIELD
	PKPRST==^D23	;POSITION OF COMPOSITE MAINTENANCE AND PORT STATE FIELDS
	PKSRST==^D3	;SIZE OF COMPOSITIE MAINTENANCE AND PORT STATE FIELDS
	PKPRND==^D31	;POSITION OF RESETTING NODE FIELD
	PKSRND==^D8	;SIZE OF RESETTING NODE FIELD

;PORT STATE FIELD TYPES

	PS.ENB==2	;PORT IS ENABLED

;COMPOSITE MAINTENANCE AND PORT STATE FIELDS

	PS.UMS==1	;PORT IS DISABLED AND IN MAINTENANCE MODE


;START REMOTE SYSTEM

	PHASE	.PKHDR	;FOLLOW GENERAL HEADER

.PKXID:!BLOCK	2	;TRANSACTION ID
.PKSAD:!BLOCK	1	;START ADDRESS IF NOT USING DEFAULT
;START/STACK BLOCK

	PHASE	.PKHDR	;FOLLOW GENERAL HEADER

.PKLEN:!BLOCK	1	;LENGTH
.SRSSY:!BLOCK	1	;SENDING SYSTEM
.SRRSV:!BLOCK	1	;RESERVED
	DEFSTR (SRMBZ,.SRRSV,7,8)	;MUST BE ZERO
	DEFSTR (SRVRS,.SRRSV,15,8)	;PROTOCOL VERSION
.SRMMS:!BLOCK	1	;MAXIMUM  MESSAGE,,DATAGRAM  SIZE
.SRSWT:!BLOCK	1	;SOFTWARE TYPE
.SRSWV:!BLOCK	1	;SOFTWARE VERSION
.SRSWI:!BLOCK	2	;SOFTWARE INCARNATION
.SRHWT:!BLOCK	1	;HARDWARE TYPE
.SRHWV:!BLOCK	3	;HARDWARE VERSION
.SRNNM:!BLOCK	2	;NODE NAME IN ASCII
.SRTOD:!BLOCK	2	;TIME OF DAY IN VAX FORMAT
.SRLEN:!		;LENGTH OF START PACKET

SR.LEN==<.SRLEN-.SRSSY>*4	;LENGTH (BYTES) OF START/STACK
SR.ALN==4			;LENGTH (BYTES) OF ACK
;SETCKT

	PHASE	.PKHDR	;FOLLOW GENERAL HEADER

.PKXID:!BLOCK	2	;TRANSACTION ID (2 WORDS)
.PKCKT:!BLOCK	1	;CIRCUIT PARAMETERS

;FLAGS IN CIRCUIT PARAMETERS

	CK.LST==1B0	;LOAD CST, NR, NS
	CK.CST==1B1	;CIRCUIT STATE, 0=VC CLOSED, 1=VC OPENED
	CK.LPT==1B4	;LOAD PATH STATUS
	CK.PBA==1B5	;PATH B ALLOWED
	CK.PAA==1B6	;PATH A ALLOWED


;CLOSE BUFFER COMMAND

	PHASE	.PKHDR	;FOLLOW GENERAL HEADER

.PKBNM:!BLOCK	1	;BUFFER NAME

	DEPHASE
;SET PERFORMANCE COUNTERS

	PHASE	.PKHDR	;FOLLOW GENERAL HEADER

.PKXID:!BLOCK	2	;TRANSACTION ID (2 WORDS)
.PKMSK:!BLOCK	1	;MASK FOR ENABLES/CLEARS, TARGET NODE
.PKPND:!BLOCK	1	;TARGET NODE
	PKPCND==^D31	;POSITION OF TARGET NODE FIELD
	PKSCND==^D8	;SIZE OF TARGET NODE FIELD


;READ PERFORMANCE COUNTERS

	PHASE	.PKHDR	;FOLLOW GENERAL HEADER

.PKXID:!BLOCK	2	;TRANSACTION ID (2 WORDS)
.PKPDA:!		;START OF DATA RETURNED IN PACKET
.PKUCD:!BLOCK	1	;MICROCODE VERSION
.PKPAA:!BLOCK	1	;PATH A ACKS
.PKPAN:!BLOCK	1	;PATH A NACKS
.PKANR:!BLOCK	1	;PATH A NO-RESPONSES
.PKPBA:!BLOCK	1	;PATH B ACKS
.PKPBN:!BLOCK	1	;PATH B NACKS
.PKBNR:!BLOCK	1	;PATH B NO-RESPONSES
.PKDGD:!BLOCK	1	;DATAGRAMS DISCARDED
.PKPXM:!BLOCK	1	;PACKETS TRANSMITTED
.PKPRC:!BLOCK	1	;PACKETS RECEIVED
.PKDPT:!BLOCK	1	;DESTINATION PORT
.PKCRC:!BLOCK	1	;PACKETS RECEIVED WITH CRC ERRORS
.PKEW1:!BLOCK	1	;ERROR WORD 1
.PKEW2:!BLOCK	1	;ERROR WORD 2
.PKEW3:!BLOCK	1	;ERROR WORD 3
.PKEW4:!BLOCK	1	;ERROR WORD 4
.PKEW5:!BLOCK	1	;ERROR WORD 5
.PKEW6:!BLOCK	1	;ERROR WORD 6
IFN NOSTCT-<.PKEW6-<.PKPDA-1>>,<PRINTX ?Performance counters defined incorrectly>
	SUBTTL	MESSAGE FORMATS - MESSAGE HEADER


;NOTE:  THE APPLICATION MESSAGE AND APPLICATION DATAGRAM DO NOT INCLUDE
;THE LAST WORD LISTED HERE (.MHSTS).  HENCE WHEN DEALING WITH A MESSAGE
;OR DATAGRAM THIS WORD IS NOT A PART OF THE HEADER BUT IS INSTEAD THE
;FIRST WORD OF THE MESSAGE/DATAGRAM TEXT.


	PHASE	.PKLEN+1 ;FOLLOW LENGTH BYTE

.MHTYP:!BLOCK	1	;MESSAGE TYPE AND CREDIT
	MSKSTR	(MH$CDT,.MHTYP,<-1,,0>)	;CREDIT FIELD
	MSKSTR	(MH$MSG,.MHTYP,<0,,-1>)	;MESSAGE TYPE FIELD

.MHDCI:!BLOCK	1	;DESTINATION CONNECT ID
.MHSCI:!BLOCK	1	;SOURCE CONNECT ID

.MHSTS:!BLOCK	1	;STATUS AND MINIMUM RECEIVE CREDIT
	MSKSTR	(MH$STS,.MHSTS,<-1,,0>)	;STATUS INFO
	MSKSTR	(MH$MCR,.MHSTS,<0,,-1>)	;MINIMUM RECEIVE CREDIT

.MHLEN:!		;LENGTH OF THE MESSAGE HEADER

	DEPHASE

.MHPKL==.MHSCI		;WORD WHERE PACKET LENGTH IS RETURNED TO SYSAP

.MHUDA==.MHSCI+1	;START OF USER DATA IN APPLICATION MSG AND DG

.MHLNW==<.MHSCI-.PKLEN>	;LENGTH OF APPLICATION PACKET HEADER IN WORDS
.MHLNB==<.MHSCI-.MHTYP+1>*4 ;LENGTH OF APPLICATION PACKET HEADER IN BYTES


;Size of largest message we can handle (in bytes) is:
;	<MSG BUFFER - PORT OVERHEAD> * 4 + SIZE OF PPD BYTE

	C%MXMP==<<C%MGSZ-<.PKLEN+1>>*4>+2	;MAXIMUM MESSAGE SIZE

;Size of largest datagram we can handle (in bytes) is:
;	<DG BUFFER - PORT OVERHEAD> * 4 + SIZE OF PPD BYTE

	C%MXDP==<<C%DGSZ-<.PKLEN+1>>*4>+2	;MAXIMUM DATAGRAM SIZE
	SUBTTL	MESSAGE FORMATS - CONNECT AND ACCEPT REQUESTS


	PHASE	.MHSTS+1 ;FOLLOW STATUS WORD

.MGDPN:!BLOCK	<C%PNMN/4> ;DESTINATION PROCESS NAME
.MGSPN:!BLOCK	<C%PNMN/4> ;SOURCE PROCESS NAME

.MGSDT:!		;FIRST DATA WORD IN MESSAGE

	DEPHASE

.MSCRQ==.MGSDT+<C%SDTL/4> ;SIZE OF THE CONNECT REQUEST DATAGRAM

	DEPHASE
	SUBTTL	SCS-PPD INTERFACE FLAGS


	F.RTB==1B0	;1 = RETURN MESSAGE SEND BUFFER TO SCA
			;0 = RETURN MESSAGE SEND BUFFER TO FREE QUEUE

	F.SPM==1B1	;1 = SEND MESSAGE/DATAGRAM IN HIGH DENSITY MODE
			;0 = SEND MESSAGE/DATAGRAM IN INDUSTRY COMPATIBLE MODE

	F.RSP==1B2	;1 = PACKET WAS GENERATED LOCALLY
			;0 = PACKET CAME FROM CI (REMOTELY GENERATED)


	C%FLGM==77B5	;MASK FOR FLAGS (OTHER 30 BITS FOR PC)
	SUBTTL	MESSAGE PRIORITIES


;THE FOLLOWING PRIORITIES ARE DEFINED FOR SENDING MESSAGES

	KLPHI==0		;HIGH
	KLPMED==1		;MEDIUM
	KLPLOW==2		;LOW
	KLPDRG==3		;DREGS

	MSCPRI==KLPMED		;PRIORITY USED IN MSCP DRIVERS AND SERVERS
	SCSPRI==KLPLOW		;PRIORITY USED IN SCS. UUO
	SUBTTL	CONNECT ID FORMAT


;THE CONNECT ID CONTAINS THREE FIELDS.  THE FIRST HAS BITS SETTABLE
;BY THE SYSAP.  THIS COMES IN HANDY FOR CONNECTION MANAGEMENT.  THE
;SECOND HAS UNIQUENESS BITS SO REUSED SLOTS IN THE CID TABLE AREN'T
;CONFUSED WITH OLD MESSAGES.  THE LAST HAS THE CID TABLE INDEX.

	MSKSTR	(SID,<>,<770000,,0>)	;BITS SETTABLE BY THE SYSAP
	MSKSTR	(UBITS,<>,<7777,,760000>) ;MASK FOR THE UNIQUENESS BITS
	MSKSTR	(INDEX,<>,<0,,17760>)	;INDEX INTO CONNECT ID TABLE

	C%RMBU==^D13		;RIGHT SHIFT TO JUSTIFY THE UNIQUENESS BITS


;MACRO TO LOAD THE CONNECTION BLOCK ADDRESS INTO AC GIVEN THE CID.

DEFINE	$LDCID(AC,ADDR),<

IF2,<IFNDEF CIDTAB,<EXTERN CIDTAB>> ;;MAKE IT GLOBAL IF NOT DEFINED

	LOAD	AC,INDEX,ADDR	;;GET THE INDEX FROM THE CID SOURCE
	ADD	AC,CIDTAB	;;ADD THE BASE ADDRESS OF THE CB ADDRESS TABLE
	MOVE	AC,0(AC)	;;GET THE ADDRESS OF CONNECTION BLOCK

>; END DEFINE $LDCID
	SUBTTL	MACROS -- GENERATE WORD ALIGNED 8-BIT ASCII


;THIS MACRO WILL GENERATE WORD ALIGNED 8-BIT ASCII.  SIMPLY FEED
;IT THE STRING AND OUT COMES 8 BIT ASCII, FOUR BYTES PER WORD.

DEFINE ASCI8(STRNG),<

	..CNT.==3		;INIT THE COUNTER
	..STR.==0		;INIT THE STRING

IRPC STRNG,<

	..CHR.=="STRNG"		;GET THE CURRENT CHARACTER
	..CHR.==..CHR._<^D8*..CNT.+4> ;SHIFT IT INTO THE RIGHT PLACE
	..STR.==..STR.!..CHR.	;ADD IT TO THE CURRENT
	..CNT.==..CNT.-1	;DECREMENT THE FOUR WORD BLOCK COUNTER

IFL ..CNT.,<
	EXP ..STR.		;GENERATE A WORD OF WHAT IS LEFT
	..CNT.==3		;INIT THE FOUR CHAR CHUNK COUNTER
	..STR.==0		;INIT THE STRING
>; END IFL ..CNT.

>; END IPRC STRNG

IFN ..STR.,	EXP ..STR.	;IF THERE ARE CHARACTERS LEFT OVER, OUTPUT THEM

>; END ASCI8 DEFINITION	
	SUBTTL	RANDOM MACROS


;MACROS TO DISABLE/ENABLE SCA BUFFER MANAGEMENT

DEFINE	CIOFF,<
IF2,<IFNDEF SC.POF,<EXTERN SC.POF>>
	PUSHJ	P,SC.POF	;;TURN PI'S OFF
>; END DEFINE CIOFF

DEFINE	CION,<
IF2,<IFNDEF SC.PON,<EXTERN SC.PON>>
	PUSHJ	P,SC.PON	;;TURN PI'S ON
>; END DEFINE CION


;MACRO TO RETURN AN ERROR CODE

IFN FTOPS10,<			;TOPS-20 HAS THIS IN PROLOG
DEFINE	RETBAD(ERN,EXTRA)<
	IFNB	<ERN'EXTRA>,<
		JRST	[EXTRA
			 IFNB <ERN>,<MOVEI T1,ERN>
			 POPJ P,]
	>
	IFB	<ERN'EXTRA>,<
		POPJ	P,
	>
>; END DEFINE RETBAD
>; END IFN FTOPS10
SUBTTL	SCS. -- SYSTEM COMMUNICATIONS SERVICE INTERFACE


; SYSTEM COMMUNICATION SERVICES UUO
; CALL:	MOVEI	AC,ADR
;	SCS.	AC,
;	  <NON-SKIP>
;	<SKIP>

; ARGUMENT BLOCK

.SQFNC==0		;FUNCTION CODE WORD
   SS.CPU==7B8		   ;CPU NUMBER (ONLY USED IN CERTAIN FUNCTIONS)
   SS.LEN==777B17	   ;LENGTH OF BLOCK (INCLUDING THIS WORD)
   SS.FNC==777777B35	   ;FUNCTION CODE
	.SSCON==0		;REQUEST A CONNECTION
	.SSLIS==1		;LISTEN FOR A CONNECTION
	.SSREJ==2		;REJECT A CONNECTION REQUEST
	.SSDIS==3		;DISCONNECT AND CLOSE A CONNECTION
	.SSSDG==4		;SEND A DATAGRAM
	.SSQRD==5		;QUEUE BUFFER(S) TO RECEIVE DATAGRAM
	.SSSMG==6		;SEND A MESSAGE
	.SSQRM==7		;QUEUE BUFFER(S) TO RECEIVE MESSAGE
	.SSCSP==10		;RETURN INFORMATION ABOUT STATUS OF
				; A CONNECTION
	.SSRCD==11		;RETURN CONFIGURATION DATA FOR A
				; REMOTE SYSTEM
	.SSSTS==12		;RETURN INFORMATION ABOUT STATUS OF
				; A CONNECTION (.SSCSP IN BRIEF)
	.SSRMG==13		;RECEIVE A MESSAGE
	.SSMAP==14		;MAP A BUFFER FOR DMA TRANSFER
	.SSUMP==15		;UNMAP A BUFFER FOR DMA TRANSFER
	.SSSND==16		;SEND DATA TO REMOTE HOST
	.SSREQ==17		;REQUEST DELIVERY OF DATA
;	.SSAIC==20		;ADD INTERRUPT CHANNEL
	.SSRDG==22		;RECEIVE A DATAGRAM
	.SSACC==23		;ACCEPT A CONNECTION REQUEST
	.SSGDE==24		;RETURN ENTRY FROM DATA REQUEST
				; COMPLETE QUEUE
	.SSEVT==25		;RETURN ENTRY FROM EVENT QUEUE
	.SSCRD==26		;CANCEL DATAGRAM RECEIVE
	.SSCRM==27		;CANCEL MESSAGE RECEIVE
	.SSGLN==30		;GET LOCAL NODE NUMBER
	.SSRBS==35		;RETURN MINIMUM BUFFER SIZES
	.SSRPS==36		;RETURN PATH STATUS
;ARGUMENTS FOR FUNCTION .SSCON

.SQSPN==1		;BYTE POINTER TO SOURCE PROCESS NAME
.SQDPN==2		;BYTE POINTER TO DESTINATION PROCESS NAME
.SQSYS==3		;NODE NUMBER,,CONNECT ID BITS
.SQCDT==4		;ADDRESS OF INITIAL CONNECTION DATA
.SQAMC==5		;ADDRESS OF MESSAGE BUFFER CHAIN
.SQADC==6		;ADDRESS OF DATAGRAM BUFFER CHAIN
.SQRCI==7		;RETURNED CONNECT ID

;ARGUMENTS FOR FUNCTION .SSLIS

.SQSPN==1		;BYTE POINTER TO SOURCE PROCESS NAME
.SQDPN==2		;BYTE POINTER TO DESTINATION PROCESS NAME
.SQSYS==3		;NODE NUMBER,,CONNECT ID BITS
.SQLCI==4		;RETURNED CONNECT ID

;ARGUMENTS FOR FUNCTION .SSREJ

.SQCID==1		;CONNECT ID
.SQREJ==2		;REJECTION REASON CODE

;ARGUMENTS FOR FUNCTION .SSDIS

.SQCID==1		;CONNECT ID
.SQDIS==2		;DISCONNECT REASON CODE

;ARGUMENTS FOR FUNCTIONS .SSSDG/.SSSMG

.SQCID==1		;CONNECT ID
.SQAPT==2		;ADDRESS OF DATAGRAM/MESSAGE TEXT
.SQLPT==3		;LENGTH OF DATAGRAM/MESSAGE TEXT
.SQFLG==4		;FLAGS AND OPTIONAL PATH SPEC
   SC%FLG==7777777777B29   ;RESERVED FOR FLAGS
   SC%MOD==1B1		   ;MODE FLAG (HIGH DENSITY IF SET, INDUS. COMPAT. IF NOT)
   SC%OPS==77B35	   ;OPTIONAL PATH SPEC MASK
	.SSAPS==0		;AUTO PATH SELECT
	.SSPTA==1		;USE PATH A
	.SSPTB==2		;USE PATH B
;ARGUMENTS FOR FUNCTION .SSQRD/.SSQRM

.SQCID==1		;CONNECT ID
.SQAFB==2		;ADDRESS OF FIRST BUFFER IN CHAIN - FIRST WORD OF EACH
			; BUFFER IS POINTER TO NEXT OR ZERO

;ARGUMENTS FOR FUNCTION .SSCSP

.SQCID==1		;CONNECT ID
.SQCST==2		;CONNECTION STATE
.SQDCI==3		;DESTINATION CONNECT ID
.SQBDN==4		;BYTE POINTER TO DESTINATION PROCESS NAME
.SQNOD==5		;NODE NUMBER
.SQREA==6		;SOURCE,,DESTINATION  DISCONNECT CODES

;ARGUMENTS FOR FUNCTION .SSRCD

.SQCID==1		;CONNECT ID (OR ZERO TO USE NODE NUMBER)
.SQOND==2		;NODE NUMBER (USED IF .SQCID IS ZERO)
.SQVCS==3		;VIRTUAL CIRCUIT STATE,,DESTINATION NODE NUMBER
.SQSAD==4		;SYSTEM ADDRESS (2 WORDS)
.SQMDD==6		;MAXIMUM DATAGRAM SIZE AT DESTINATION
.SQMDM==7		;MAXIMUM MESSAGE SIZE AT DESTINATION
.SQDST==10		;SOFTWARE TYPE CODE AT DESTINATION
.SQDSV==11		;SOFTWARE VERSION AT DESTINATION
.SQDSE==12		;SOFTWARE EDIT LEVEL AT DESTINATION (2 WORDS)
.SQDHT==14		;HARDWARE TYPE CODE AT DESTINATION
.SQDHV==15		;HARDWARE VERSION AT DESTINATION (3 WORDS)
.SQNNM==20		;DESTINATION NODE NAME (2 WORDS)
.SQPCW==22		;PORT CHARACTERISTICS
.SQLPN==23		;LOCAL CHANNEL NUMBER

;ARGUMENTS FOR FUNCTION .SSSTS

.SQCID==1		;CONNECT ID
.SQFST==2		;STATUS FLAGS,,CONNECTION STATE
   SC%MSA==1B0		   ;MESSAGE AVAILABLE
   SC%DGA==1B1		   ;DATAGRAM AVAILABLE
   SC%DTA==1B2		   ;DMA TRANSFER COMPLETE
   SC%EVA==1B3		   ;EVENT PENDING
.SQSBR==3		;DESTINATION NODE NUMBER
;ARGUMENTS FOR FUNCTIONS .SSRMG/.SSRDG

.SQCID==1		;CONNECT ID
.SQARB==2		;ADDRESS OF RETURNED BUFFER
.SQDFL==3		;FLAGS AND NODE NUMBER OF REMOTE SYSTEM
			; (SEE .SSSDG FOR DEFINITION OF FLAG BITS)
.SQLRP==4		;LENGTH OF RETURNED MESSAGE/DATAGRAM
			; (WORDS IF HIGH DENSITY, BYTES IF INDUSTRY COMPATIBLE)

;ARGUMENTS FOR FUNCTION .SSMAP

.SQXFL==1		;FLAGS
   SQ%DMD==3B35		   ;MASK FOR MODE FIELD
	SQ%DIC==0		;INDUSTRY COMPATIBLE
	SQ%DCD==1		;CORE DUMP MODE
	SQ%DHD==2		;HIGH DENSITY MODE
   SQ%CVD==1B32		   ;DO NOT CLEAR THE VALID BIT IF SET
   SQ%WRT==1B33		   ;IF SET, HOST MEMORY IS WRITABLE
.SQBNA==2		;RETURNED BUFFER NAME

;BUFFER LENGTH AND ADDRESS PARTS:

.SQBLN==0		;LENGTH OF BUFFER SEGMENT
.SQBAD==1		;ADDRESS OF BUFFER SEGMENT

;ARGUMENTS FOR FUNCTION .SSUMP

.SQNAM==1		;BUFFER NAME

;ARGUMENTS FOR FUNCTIONS .SSSND/.SSREQ

.SQCID==1		;CONNECT ID
.SQSNM==2		;SEND BUFFER NAME
.SQRNM==3		;RECEIVE BUFFER NAME
.SQOFS==4		;TRANSMIT,,RECEIVE  BUFFER OFFSETS

;ARGUMENTS FOR FUNCTION .SSACC

.SQCID==1		;CONNECT ID
.SQCDA==2		;POINTER TO CONNECTION DATA

;ARGUMENTS FOR FUNCTION .SSGDE

.SQCID==1		;CONNECT ID
.SQBID==2		;BUFFER ID OFFSET
;ARGUMENTS FOR FUNCTION .SSEVT

.SQCID==1		;CONNECT ID
.SQESB==2		;NODE NUMBER OF REMOTE SYSTEM
.SQEVT==3		;EVENT CODE
	.SEVCC==1		;VC BROKEN
				; .SQDTA CONTAINS THE NODE NUMBER
	.SECTL==2		;CONNECT TO LISTEN
				; .SQDTA CONTAINS FIRST FOUR WORDS OF CONNECTION
				; DATA FROM REMOTE NODE
	.SECRA==3		;CONNECTION WAS ACCEPTED
				; .SQDTA CONTAINS THE REMOTE'S CONNECTION DATA
	.SECRR==4		;CONNECTION WAS REJECTED
   				;.SQDTA CONTAINS THE REASON CODE
	.SEMSC==5		;MESSAGE/DATAGRAM SEND COMPLETE
				; .SQDTA CONTAINS ADDRESS OF BUFFER
	.SELCL==6		;LITTLE CREDIT LEFT
				; .SQDTA CONTAINS NUMBER OF CREDITS TO GET YOU
				; BACK OVER THRESHOLD
	.SENWO==7		;NODE WENT OFFLINE
				; .SQDTA CONTAINS NODE NUMBER OF SYSTEM WHICH
				; WENT OFFLINE
	.SENCO==10		;NODE CAME ONLINE
				; .SQDTA CONTAINS NODE NUMBER OF SYSTEM WHICH
				; CAME ONLINE
	.SEOSD==11		;OK TO SEND DATA
	.SERID==12		;REMOTE INITIATED DISCONNECT
	.SEPBC==13		;PORT BROKE CONNECTION
	.SECIA==14		;CREDIT IS AVAILABLE
	.SEMDC==15		;MAINTENANCE DATA TRANSFER COMPLETE
				; .SQDTA CONTAINS BUFFER NAME
.SQDTA==4		;OFFSET TO EVENT DATA (ZERO TO FOUR WORDS)
;ARGUMENTS FOR FUNCTIONS .SSCRD/.SSCRM

.SQCID==1		;CONNECT ID
.SQADB==2		;ADDRESS OF BUFFER TO DEQUEUE

;ARGUMENTS FOR FUNCTION .SSGLN

.SQLNN==1		;(RETURNED) LOCAL NODE NUMBER

;ARGUMENTS FOR FUNCTION .SSRBS

.SQLMG==1		;LENGTH OF MESSAGE BUFFER
.SQLDG==2		;LENGTH OF DATAGRAM BUFFER

;ARGUMENTS FOR FUNCTION .SSRPS

.SQRPN==1		;NODE NUMBER
.SQRPS==2		;PATH STATUS (A,,B)
;SCS. UUO ERROR CODES

SSNPV%==0		;NOT PRIVILEGED
SSIFC%==1		;ILLEGAL FUNCTION CODE
SSARG%==2		;BAD ARGUMENT LIST LENGTH
SSACR%==3		;ADDRESS CHECK READING ARGUMENTS
SSACS%==4		;ADDRESS CHECK STORING DATA
SSCPN%==5		;CPU NUMBER OUT OF RANGE
SSNPC%==6		;NO CI PORT ON SPECIFIED CPU
SSNNK%==7		;CPU'S CI NODE NUMBER NOT KNOWN
SSINN%==10		;INVALID CI NODE NUMBER
SSNFC%==11		;NO FREE CORE
SSVNO%==12		;VIRTUAL CIRCUIT NOT OPEN
SSICI%==13		;INVALID CONNECT ID
SSRQE%==14		;RECEIVE QUEUE EMPTY
SSNBQ%==15		;NO BUFFER QUEUED FOR PACKET RECEPTION
SSRCF%==16		;REJECT CONNECTION FAILED
SSDCF%==17		;DISCONNECT CONNECTION FAILED
SSNFB%==20		;NO FREE BUFFERS TO SEND PACKET
SSQBF%==21		;QUEUE BUFFERS FAILED
SSCBF%==22		;CANCEL BUFFERS FAILED
SSPSF%==23		;PACKET SEND FAILED
SSDQE%==24		;DATA ENTRY QUEUE EMPTY
SSEQE%==25		;EVENT QUEUE EMPTY
SSCRB%==26		;CAN'T REMOVE BUFFER FROM DATABASE
SSCUB%==27		;CAN'T UNMAP BUFFER
SSNSB%==30		;NO SUCH BUFFER NAME
SSTMS%==31		;TOO MANY BUFFER SEGMENT DESCRIPTORS
SSIDM%==32		;ILLEGAL DATA MODE
SSSCP%==33		;SEGMENT CROSSES PAGE BOUNDARY
SSSTL%==34		;SEGMENT TOO LONG (GREATER THAN 1 PAGE)
	SUBTTL	THE END


	END