Google
 

Trailing-Edge - PDP-10 Archives - bb-h138e-bm_tops20_v6_1_distr - galaxy-sources/d60unv.mac
There are 62 other files named d60unv.mac in the archive. Click here to see a list.
; [116] 14-JAN-82	RLS	Flush H$HPR,H$HLN
;GCO 4.2.1015	enter current version in alu library.
; [115] 28-OCT-81	RLS	Add variables to handle list for poll time est.
; [114] 06-OCT-81	RLS	Transform D60JSY data base to statically allocated
; [113] 15-JUN-81	RLS	Add TOPS-20 version 5 protocol definitions
; [112] 26-MAY-81	RLS	Add parameter CDBFN=number of card images to
;				buffer, and CDBSZ=handle list entry containing
;				size of CDBUF in bytes.
; [111]	12-May-81	WEM	Add D6IAB, D6OAB error returns
; [110] 3-NOV-80	RLS	ADD DEVICE OFFLINE TIMEOUT THRESHOLDS. ADD IOTIM
;				TO DEVICE HANDLE LIST ENTRY TO KEEP TIME OF LAST
;				SUCCESSFUL IO TO THE DEVICE.
; [107]	29-SEP-80	RLS	ADD H$NOD TO HANDLE LIST TO HOLD NODE NAME.
;				ELIMINATE H$THR.
; [106] 09-SEP-80	RLS	ADD H$ONL FLAG,FLUSH H$DLY,ADD H$HSN,ADD EN$xxx
;				MASKS,ADD LC.SON LINE COMMAND
; [105] 13-AUG-80	RLS	ADD D6SON ERROR CODE: SIGNON FAILURE.
; [104] 5-AUG-80	RLS	ADD INPUT CARD DEVICE DATA BASE TO HANDLE ENTRY
; [103] 27-MAY-80	RLS	ADD H$ENB FLAG TO H$STS (HANDLE LIST)
;				FLUSH H$RTI
; [102] 12-MAY-80	RLS	ADD DEFINITIONS OF  LINE STATUS FLAGS: BITS 4-9
; [101] 1-MAY-80	RLS	ADD TOPS10 CONDITIONAL D60 ERROR
;				MESSAGES.
;<DN65-DEVELOPMENT>D60UNV.MAC.8, 4-Dec-79 10:45:02, Edit by JENNESS
;<DN65-DEVELOPMENT>D60UNV.MAC.5, 21-Oct-79 11:42:18, Edit by JENNESS
; Add SLHWA, SLCSD, SLSWL definitions for IBMCON.
;<DN65-DEVELOPMENT>D60UNV.MAC.2, 18-Oct-79 15:12:53, Edit by JENNESS
; Decoupled from D60JSY.MAC to remove deadly embrace with QSRMAC.
 
;   D60UNV - Universal definitions for DN60 communications
 
;
;
;			COPYRIGHT (c) 1979, 1980, 1981,1982
;		     DIGITAL EQUIPMENT CORPORATION
;
;     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	which  is  not supplied by
;     DIGITAL.
;
	UNIVERSAL D60UNV universal symbol file
	SUBTTL	Values of interest for linkage
 
	SALL				; Make nice clean listing
 
	SEARCH	GLXMAC			; GALAXY macro/symbol definitions
 
; Version
 
	D6UVER==4			; Version number
	D6UMIN==2			; Minor version number
	D6UEDT==116			; Edit number
	D6UWHO==0			; Who edited last (DEC=0)

; parameters

	xp	MAXHND,^D100		; maximum number of handles which can
					; be allocated

	XP	.EOLPT,^D60*3		; emulation lpt offline if silent this long
	XP	.EOCDR,^D60*3		; emulation cdr offline if silent this long
	XP	.EOCDP,^D60*3		; emulation cdp offline if silent this long
	XP	.TOLPT,^D60*3		; termination lpt offline if silent this long
	XP	.TOCDR,^D60*3		; termination cdr offline if silent this long
	XP	.TOCDP,^D60*3		; termination cdp offline if silent this long

; console devices are never offline

	XP	.POSGN,^D1*3		; fixed poll interval for signon device
	XP	.POCON,^D5*3		; fixed poll interval for console device
	XP	.POTM0,^D1*3		; initial poll interval for data devices
	XP	.POMIN,^D1*3		; minimum poll interval for data device
	XP	.POLMX,^D3*3		; maximum poll interval for data devices
; Error codes
 
	XP	$ER1ST, 660000		; First error number to allocate
 
 
; Function codes for D60OPR
 
	XP	.MORQI, 76		; Request I/O on device
	XP	.MOABT, 75		; Set I/O transfer abort for device
 
; Function codes for D60CND
 
	XP	.CNENB, 1		; Enable the line
	XP	.CNDIS, 2		; Disable the line (hang-up)
 
; Function codes for D60STS
 
	XP	.STDEV, 0		; Device status
	XP	.STPRT, 1		; Port activity status
	XP	.STLIN, 2		; Line status flags
 
; Device codes for D60OPN
 
	XP	.OPLPT, 1		; Line printer
	XP	.OPCDP, 2		; Card punch
	XP	.OPCDR, 3		; Card reader
	XP	.OPCIN, 4		; Console input
	XP	.OPCOU, 5		; Console output
	XP	.OPSGN, 6		; Signon device
	SUBTTL	Universal error symbol definitions
 
; Macro - D60ERR
;
; Function - To define a set of macro calls (to D6ERRS) that will then define
;	the error return value set for the D60JSY calls.
;
; Use -
;
;	A macro called D6ERRS must be defined that has two parameters
;
;	NAM	Error value name
;	TXT	Error text, describes the error.
;
;	A default macro is defined that will assign the proper values to
;	the error names and does not user the error text in any way.
 
	Define D60ERR(ASSTXT,FIRST)
 
<	DEFINE	D6ERRS(CODE,TEXT),<XLIST
	CODE=.Z.			;;DEFINE THE ERROR CODE
IFNB	<ASSTXT>,<EXP	[ASCIZ\TEXT\]>	;;DEFINE THE TEXT FOR IT
	.Z.==.Z.+1			;;BUMP ERROR CODE COUNTER
	LIST>

IFB	<FIRST>,<.Z.==$ER1ST>		;;DEFAULT STARTING VALUE
IFNB	<FIRST>,<.Z.==FIRST>		;;USERS STARTING VALUE

	D6ERRS (D6HEAD,<D6HEAD>)

	D6ERRS (D6AUT,<Port/line/dev/unit already used by this process>)
	D6ERRS (D6AUA,<Port/line/dev/unit already in use by another process>)
	D6ERRS (D6NSP,<No such port>)
	D6ERRS (D6NSL,<No such line on the port>)
	D6ERRS (D6NSD,<No such device on the station>)
	D6ERRS (D6NSU,<No such unit number of the specified device type>)
	D6ERRS (D6PLD,<Process lacks DTE I/O priviledges>)
	D6ERRS (D6DNR,<DN60 not running>)
	D6ERRS (D6PIU,<Port is useless to us, but it's running>)
	D6ERRS (D6COF,<Can't open a front end for use>)
	D6ERRS (D6UNS,<Unit number specified on non-HASP station>)
	D6ERRS (D6UND,<Unknown device type or unit>)
	D6ERRS (D6NBR,<Non-Blocking I/O Return>)
	D6ERRS (D6EOF,<End of file encountered while reading in data>)
	D6ERRS (D6NSH,<No such handle exists, call D60OPN first>)
	D6ERRS (D6CNN,<Byte count not negative>)
	D6ERRS (D6DOL,<Device offline>)
	D6ERRS (D6DCI,<Device can't do input>)
	D6ERRS (D6DCO,<Device can't do output>)
	D6ERRS (D6CGO,<Can't get output permission>)
	D6ERRS (D6FNI,<Function not implemented>)
	D6ERRS (D6IOE,<Unknown I/O error occurred>)
	D6ERRS (D6CTF,<Can't talk to front end>)
	D6ERRS (D6LGA,<Line gone away, either hung up or hardware failure>)
	D6ERRS (D6DNU,<DSR not up, line is not connected>)
	D6ERRS (D6REJ,<IO rejected>)
	D6ERRS (D6SON,<signon failure>)
	D6ERRS (D6IAB,<input abort occurred>)
	D6ERRS (D6OAB,<output abort occurred>)
	D6ERRS (D6FRE,<D60JSY free space exhausted - can't allocate handle>)
TOPS10<	D6ERRS (D6BAD,<crufty .C11QU function code or bad args>)>
TOPS20<	D6ERRS (D6BAD,<crufty args in DN60 BOOT jsys>)>
TOPS20< D6ERRS (D6DTE,<DTE select error>)>

	D6ERRS (D6TAIL,<D6TAIL>)
    > ;End D60ERR definition
	SUBTTL	Internal definitions for D60JSY
 
; Fields in PDD (packed device descriptor)
 
	XP	PD$PRT, 777b8		; Port number
	XP	PD$LIN, 777b17		; Line number
	XP	PD$DEV, 777b26		; Device number
	XP	PD$UNT, 777b35		; Unit number
	SUBTTL	Definitions -- Handle list
 
; Definition - Handle list
;
; Function - This list stores all the data needed for using the handle that is
;	given to the user.
;
; Entries -
;
;	H$LNK	link to next handle
;	H$PDD	Unique descriptor of a device for list searching
;	 H$DEV	 Device type on 2780/3780/HASP station.
;	 H$UNT	 Unit number of multiple device on HASP station.
;	 H$PRT	 Port number that comm. to device is done on.
;	 H$LIN	 Line number that station is off port (11).
;	 H$HDV	 Unique device code (RCB for HASP stations)
;	H$CDV	Device number used when talking to 11
;	H$STS	Status of this entry.
;	 H$TEM	 Termination (0,default)/Emulation (1) bit
;	 H$MSG	 Number of bytes maximum for message
;	 H$STY	 Station type (1=3780,2=2780,3=HASP)
;	 H$IOM	 Input/output I/O mode
;	 H$SON	 Station signon has been validated (or ignored).
;	 H$SPN	 Signon pending .. suppress some request timeouts
 
	SYSPRM	H$SIZ,HNDLSZ,HNDLSZ	; Size of handle table entry in words
 
	MSKSTR	(H$LNK,0,FWMASK)	; link to next handle - o offset used implicitly
	MSKSTR	(H$PDD,1,FWMASK)	; Packed device descriptor
	 MSKSTR  (H$PRT,1,PD$PRT)	;  Port number
	 MSKSTR  (H$LIN,1,PD$LIN)	;  Line number
	 MSKSTR  (H$DEV,1,PD$DEV)	;  Device type code
	 MSKSTR  (H$UNT,1,PD$UNT)	;  Unit number
	MSKSTR  (H$HDV,2,377b35)	;  8 bits of device num. (RCB for HASP)
	MSKSTR	(H$CDV,2,LHMASK)	; Communication device number
	MSKSTR	(H$STS,3,FWMASK)	; Status and other needed values
	 MSKSTR  (H$TEM,3,1b1)		;  Termination/Emulation mode flag
	 DEFSTR  (H$STY,3,^d9,^d8)	;  Station type code
	 MSKSTR  (H$IOM,3,1b10) 	;  Input/output device mode
	 MSKSTR  (H$RUN,3,1b11) 	;  Permission given/gotten, I/O going
	 DEFSTR  (H$BPM,3,^d27,^d16)	;  Number of bytes max per message
	 MSKSTR  (H$ONL,3,1B31) 	;  remote object online - BISYNC is up
	 MSKSTR  (H$ENB,3,1B32) 	;  ENABLE in progress
	 MSKSTR  (H$SPN,3,1b33) 	;  Signon pending
	 MSKSTR  (H$SON,3,1b34) 	;  Station signed on
	MSKSTR	(H$HSN,4,RHMASK)	; signon device handle
	MSKSTR	(H$NOD,5,FWMASK)	; sixbit node name from signon file
 
 
	LSTPNT==6			; Pointer to next byte in output
	NBXFRD==7			; Number of bytes transfered so far
	NBTXFR==10			; Number of bytes yet to transfer
	CDPTR==11			; current cdbuf i/o ptr
	CDCNT==12			; current cdbuf i/o cnt
					;	neg cnt = doing input to cdbuf
					;	zero cnt = empty cdbuf
					;	pos cnt = doing output to user
	 CDBFN==^D10			; number of card images to buffer
	CDBUF==13			; card image buffer
	CDBSZ==14			; size of CDBUF in bytes
	CDERM==15			; last error returned to SINCD
	IOTIM==16			; last time io successfully done to device
	POTIM==17			; last time polled and did io
	IOPOL==20			; last poll interval estimate
	IOAMT==21			; last io amount done at IOTIM
	IOPRV==22			; previous IOAMT
	OFLTIM==23			; device silence tolerance

HNDLSZ==OFLTIM+1			; size of handle list entry

;********  remember to change hndlsz above when adding words to handle list entry ********
 
	SUBTTL	FELOG symbols
 
	XP	LH10SZ, ^d9		; Length of total header for TOPS10
	XP	LH20SZ, ^d6		; Length of total header for TOPS20
	SYSPRM	FIXLEN,LH10SZ,LH20SZ	; Length of header for this system
 
	XP	LOGENA, 1b0		; Enable logging
	XP	PHSBEF, 1b1		; "BEFORE" phase flag
	XP	PHSAFT, 1b2		; "AFTER" phase flag
	XP	PHSMRK, 1b3		; "MARK" entry flag
	XP	PHSSKD, 1b4		; "SCHEDULER" entry flag
	SUBTTL	Argument block for front end I/O
 
; Definition - Argument block format for front end I/O routines
;
; Function - To pass the parameters to the front end I/O routines
 
	MSKSTR	(ARG$FC,0,FWMASK)	; Function code (.C11QU code)
	MSKSTR	(ARG$BC,1,FWMASK)	; Byte count to transfer
	MSKSTR	(ARG$PT,2,FWMASK)	; Byte pointer to input/output string
	MSKSTR	(ARG$XF,3,FWMASK)	; Number of bytes actually transfered
	MSKSTR	(ARG$RC,4,FWMASK)	; Result code
 
; Definition - Command string format for the line and device command routines
 
	XP	CMD$WD, 5		; Full word here for command string
 
	DEFSTR	(CMD$FC,5,^d7,^d8)	; Function code
	DEFSTR	(CMD$1B,5,^d15,^d8)	; Single byte data value for command
	DEFSTR	(CMD$2B,5,^d23,^d16)	; 2 byte data value for command
 
	XP	ARGSIZ, 6		; Number of words in arg block
	SUBTTL	Argument block for D60CND (condition line)
 
; Definition - Argument block structure for D60CND condition line global
;	routine
 
	MSKSTR	(CN$PRT,0,LHMASK)	; Port number to operate on
	MSKSTR	(CN$LIN,0,RHMASK)	; Line to start station on
	MSKSTR	(CN$TRA,1,1b15) 	; Transparent flag
	MSKSTR	(CN$MAP,1,3b17) 	; Mode and protocol fields
	 MSKSTR (CN$PSP,1,1b16) 	;  Primary/secondary protocol
	 MSKSTR (CN$ETF,1,1b17) 	;  Emulation/termination flag
	MSKSTR	(CN$TYP,1,RHMASK)	; Station type
	MSKSTR	(CN$CTS,2,FWMASK)	; Clear to send delay
	MSKSTR	(CN$WRN,3,FWMASK)	; Silo warning area
	MSKSTR	(CN$BPM,4,FWMASK)	; Number of bytes/message
	MSKSTR	(CN$RPM,5,FWMASK)	; Number of records/message
	MSKSTR	(CN$SIG,6,FWMASK)	; Line signature	- obsolete
 
	XP	CN$SIZ, 7		; Length of condition argument block
 
	SUBTTL	argument block for line enable command
 
	MSKSTR	(EN$FLG,0,377B35)	; line flags to set at enable time
	 MSKSTR (EN$MAP,0,3B35) 	; mode and protocol fields
	 MSKSTR (EN$PSP,0,1B34) 	; primary/secondary protocol
	 MSKSTR (EN$ETF,0,1B35) 	; emulation/termination flag
	 MSKSTR (EN$SON,0,1B33) 	; signon flag(set => station signed on)
	 MSKSTR (EN$TRA,0,1B32) 	; transparency flag
	MSKSTR	(EN$TYP,0,377B27)	; station type field
	SUBTTL	Argument block format for D60OPN
 
; Definition - This is the argument block format for the D60OPN device open
;	routine
 
	MSKSTR	(OP$DEV,0,FWMASK)	; Unique device specification
	 MSKSTR (OP$TYP,0,LHMASK)	;  Device type
	 MSKSTR (OP$UNT,0,RHMASK)	;  Unit number
	MSKSTR	(OP$STA,1,FWMASK)	; Unique station specification
	 MSKSTR (OP$PRT,1,LHMASK)	;  Port number
	 MSKSTR (OP$LIN,1,RHMASK)	;  Line number
	MSKSTR	(OP$SIG,2,FWMASK)	; Line signature	- obsolete
 
	XP	OP$SIZ, 3		; Open block size
	SUBTTL	TOPS-20 version 5 DN60 protocol


;port enqueues are not necessary - BOOT will mediate use of port.
;one call will perform an entire io transaction similar to CAL11. uuo.
;if the error return is taken, BT6ERR will contain both a history of the
;transaction up to time of a fatal error(left half flags) as well a specific
;error flags(right half).

.BTD60==16				;DN60 protocol operation - BOOT JSYS
.VND60==2				;DN60 protocol type

;BTD60 ARG BLOCK

	DEFSTR	(BT6DTE,0,35,36)	;DTE number
	DEFSTR	(BT6ERR,1,35,36)	;returned error flags
					;protocol flags
	 D6.BSY==1B0			;port is busy - sign bitness is used in testing
	 D6.QHD==1B1			;header has been queued
	 D6.HDD==1B2			;to -11 done for header seen
	 D6.NDT==1B3			;this is a no-data-transfer operation
	 D6.RED==1B4			;this is a read data type operation
	 D6.QDT==1B5			;data has been queued(for write fcn)
	 D6.DTD==1B6			;to -11 done for write data seen
	 D6.RBL==1B7			;to -10 doorbell for response header seen
	 D6.RDN==1B8			;to -10 done for response header seen
	 D6.DBL==1B9			;to -10 doorbell for read data seen
	 D6.DDN==1B10			;to -10 done for read data seen
	 D6.FDN==1B11			;to -10 done for read data was faked
					;error flags
	 D6.BDP==1B30			;bad data byte ptr
	 D6.ARD==1B31			;11 attempted to send read data when
					; when none was expected
	 D6.TRS==1B32			;timed out waiting for response header
	 D6.TDT==1B33			;timed out waiting for read data

	 D6.TPO==1B34			;timed out waiting for port to be free
	 D6.NT6==1B35			;not a DN60 front end

	 D6.SER==D6.BDP!D6.ARD!D6.TRS!D6.TDT!D6.TPO!D6.NT6 ;all errors

	DEFSTR	(BT6HBC,2,17,18)	;DN60 header byte count
	DEFSTR	(BT6HDR,2,35,18)	;DN60 header address(begins on word)
	DEFSTR	(BT6DBC,3,35,36)	;data byte count
					;	positive => write data mode
					;	zero     => no data transfer
					;	negative => read data mode
	DEFSTR	(BT6PTR,4,35,36)	;data byte ptr
					;the following are returned for timing analysis
	DEFSTR	(BT6TMR,5,35,36)	;time of request
	DEFSTR	(BT6TAS,6,35,36)	;TIME DTE ASSIGNED
	DEFSTR	(BT6THQ,7,35,36)	;time header queued to 11
	DEFSTR	(BT6TRD,10,35,36)	;time of -10 done for response header
	DEFSTR	(BT6TDD,11,35,36)	;time of -10 done for data
	DEFSTR	(BT6TFR,12,35,36)	;time finished request

BT6SIZ==13				;size of BOOT arg block

;DN60 header definitions

	DEFSTR	(D6FCN,XMTHDR+0,15,16)		;xmitted function code
	 DEFSTR	(D6RSP,XMTHDR+0,7,8)		;returned response code
	 DEFSTR	(D6FCD,XMTHDR+0,15,8)		;returned function code
	DEFSTR	(D6ADR,XMTHDR+0,31,16)		;address for examine/deposit
	DEFSTR	(D6DAT,XMTHDR+1,15,16)		;data from examine/for deposit
	DEFSTR	(D6LIN,XMTHDR+0,23,8)		;line number
	DEFSTR	(D6DEV,XMTHDR+0,31,8)		;device code
	DEFSTR	(D6CNT,XMTHDR+1,15,16)		;requested byte count to transfer
					;end of original header definitons
					;begin extended header
	DEFSTR	(D6AR3,XMTHDR+1,31,16)		;reserved
	DEFSTR	(D6DST,XMTHDR+2,31,32)		;returned device status
	DEFSTR	(D6LST,XMTHDR+3,31,32)		;returned line status

D6HWSZ==4				;number of 36 bit words in header
D6HBSZ==4*D6HWSZ			;number of 8 bit bytes in header
	SUBTTL	.C11QU function of CAL11. UUO
 
; Calling sequence of CAL11. UUO
;
;	MOVE	AC,[XWD length,addr]
;	CAL11.	AC,
;	 error return
;	normal return
;
;
; addr: XWD	port #, .C11QU (=2)
;	XWD	line #, device #
;	XWD	# of bytes, .C11QU subfunction code
;	XWD	length of buffer (36 bit words), buffer address
;	BYTE	(12) # bytes/word (24) byte position of 1st byte in buffer
;	XWD	# of bytes transfered, result code
 
; Definition - CAL11. argument block definitions
 
 
	MSKSTR	(C$PRT,0,LHMASK)	; Port number
	MSKSTR	(C$FNC,0,RHMASK)	; CAL11. function code
	MSKSTR	(C$LIN,1,LHMASK)	; Line number
	MSKSTR	(C$DEV,1,RHMASK)	; Device number
	MSKSTR	(C$NBT,2,LHMASK)	; Number of bytes to be transfered
	MSKSTR	(C$FC,2,RHMASK) 	; Subfunction code to .C11QU CAL11. UUO
	MSKSTR	(C$BFS,3,LHMASK)	; Buffer size
	MSKSTR	(C$BFA,3,RHMASK)	; Buffer address
	MSKSTR	(C$BPW,4,-1B11) 	; Number of bytes per word
	MSKSTR	(C$PFB,4,77777777)	; Position of first byte in buffer
	MSKSTR	(C$BXF,5,LHMASK)	; Number of bytes transfered
	MSKSTR	(C$RC,5,RHMASK) 	; Result code
 
	XP	C$SIZ,	6		; Length of a CAL11. block
	SUBTTL	TOPS20 Receive/transmit header structures
 
; Definition - TOPS20 Receive/transmit headers
;
; Function - To define the bytes in the I/O headers for communication with
;	the 11's hung off a TOPS20 system.  These headers are the first things
;	sent (before the data) and the first received (on input).  They also
;	contain the result (receive) code that comes from any I/O operation.
 
	MSKSTR	(RCVRC,RCVHDR,377b7)	; Receive (result) code
	MSKSTR	(RCVFC,RCVHDR,377b15)	; Function code receiving result from
	MSKSTR	(RCVLN,RCVHDR,377b23)	; Line number receiving from
	MSKSTR	(RCVDV,RCVHDR,377b31)	; Device-type number
	MSKSTR	(RCVBC,RCVHDR+1,-1b15)	; # bytes transfered
	 MSKSTR  (RCVHB,RCVHDR+1,377b7)  ; High order # of bytes transfered
	 MSKSTR  (RCVLB,RCVHDR+1,377b15) ; Low order # of bytes transfered
 
 
	MSKSTR	(XMTFC,XMTHDR,377b15)	; Function for output
	MSKSTR	(XMTLN,XMTHDR,377b23)	; Line number transmitting to
	MSKSTR	(XMTDV,XMTHDR,377b31)	; Device-type transmitting out to.
	MSKSTR	(XMTBC,XMTHDR+1,-1b15)	; Number of bytes to transfer
	 MSKSTR  (XMTHB,XMTHDR+1,377b7)  ; High order # of bytes to output
	 MSKSTR  (XMTLB,XMTHDR+1,377b15) ; Low order # of bytes to output.
 
;
; Generic header definitions
;
	MSKSTR	(HDRRC,0,377b7) 	; Result code
	MSKSTR	(HDRFC,0,377b15)	; Function code
	MSKSTR	(HDRLN,0,377b23)	; Line number
	MSKSTR	(HDRDV,0,377b31)	; Device-type number
	MSKSTR	(HDRBC,1,-1b15) 	; # bytes in transfer
	 MSKSTR  (HDRHB,1,377b7)	;  High order # of bytes
	 MSKSTR  (HDRLB,1,377b15)	;  Low order # of bytes
	SUBTTL	CAL11. UUO symbol definitions
 
; Function codes
 
	XP	.C11DP, 0	; Deposit function
	XP	.C11EX, 1	; Examine function
	XP	.C11QU, 2	; Queue request function
	XP	.C11NM, 3	; Return name of 11 program running
	XP	.C11UP, 4	; Return 0 if PDP11 is down
				; Return 1 if PDP11 is up
 
 
; Error return codes from CAL11. UUO
 
	XP	C11NP%, 1	; Caller does not have poke privileges
	XP	C11UF%, 2	; Undefined function for this type of FE
	XP	C11ND%, 3	; Invalid DL10 port number
	XP	C11IU%, 4	; CAL11. in use (try again later)
	XP	C11NA%, 5	; No answer from FE after 1-2 seconds
	XP	C11TS%, 6	; Queue entry too short (DC76 only)
	XP	C11NE%, 7	; Not enough arguments
	XP	C11AI%, 10	; Examine/deposit address was invalid (more
				;  than 16 bits in address/data, or FE flagged
				;  it as bad)
	XP	C11OR%, 11	; Illegal function code to .C11QU
				;  Address check, illegal byte size, byte
				;  offset is outside buffer, or buffer is too
				;  large (requires more than 16 DL10 pointers)
	XP	C11FC%, 12	; On a DN61-S, DTESER can't get any free core
	XP	C11DN%, 13	; On a DN61-S, the reload bit is set or primary
				;  protocol is not running.  This means that
				;  front end is down.
	XP	C11FU%, 14	; On a DN61-S, there will never be enough Exec
				;  Virt Mem to process req.
 
; Under TOPS20, error codes with bits 18 and 19 set (600000) are JSYS errors.
 
; DN60 .C11QU subfunction codes
;
; Note - notice that the reads are odd and the writes are even values.
 
	XP	FC.RD,	1	; Read data from device
	XP	FC.WD,	2	; Write data to device
	XP	FC.RDS, 3	; Read device status
	XP	FC.WDC, 4	; Write device command
	XP	FC.RLS, 5	; Read line status
	XP	FC.WLC, 6	; Write line command
	XP	FC.R6S, 7	; Read DN60 status
	XP	FC.W6C, 10	; Write DN60 command
	XP	FC.EXM, 11	; Examine memory in -11
	XP	FC.DEP, 12	; Deposit into -11 memory
 
; DN60 .C11QU result codes
 
	XP	RC.SUC, 1	; Operation was successful
	XP	RC.DLY, 2	; Operation was delayed
	XP	RC.REJ, 3	; Operation was rejected
 
; DN60 .C11QU device commands
 
	XP	DC.SC,	1	; Set device characteristics
				; byte 1 = device type:
				;	0 = unknown
				;	1 = printer
				;	2 = punch
				;	3 = card reader
				;	4 = console input
				;	5 = console output
				;	6-255 reserved.
	XP	DC.REC, 2	; Set max logical records/transmission
				; Bytes 1 and 2 = max records
				;	0 = no limit
				;	2 for 2780 w/o multi-record feature.
				;	7 for 2780 w/ MRF
				;	0 for 3780.
	XP	DC.DOB, 3	; Dump output buffers (used for SIGNON)
	XP	DC.CIP, 4	; Clear input permission was requested
;	XP	DC.???, 5	; Reserved
	XP	DC.SCI, 6	; Set "Interpret carriage control on input"
				;  (simulate a printer)
	XP	DC.CCI, 7	; Clear "Interpret carriage control on input"
	XP	DC.SCO, ^d8	; Set "Interpret carriage control on output"
	XP	DC.CCO, ^d9	; Clear "Interpret carriage control on output"
;	XP	DC.???, ^d10	; Reserved
;	XP	DC.???, ^d11	; Reserved
	XP	DC.SCC, ^d12	; Specify output component
				;  byte 1 = component code
	XP	DC.DCC, ^d13	; Don't do output component selection
	XP	DC.SLC, ^d14	; Set printer line counter and enable for over-
				;  flow.  Bytes 1-2 = value of line counter
	XP	DC.CLC, ^d15	; Disable printer line counter overflow
	XP	DC.SBS, ^d16	; Set max transmission block size (bytes 1-2)
	XP	DC.SSC, ^d17	; Do space compression on output
	XP	DC.CSC, ^d18	; Don't do space compression on output
	XP	DC.S27, ^d19	; Use old BSC protocol (IUS, ETB and ETX imply
				;  IRS, overprinting is ignored, card output
				;  is padded to 80 characters with spaces)
	XP	DC.C27, ^d20	; Don't use old protocol
	XP	DC.ROP, ^d21	; Request output permission
	XP	DC.GIP, ^d22	; Grant input permission
	XP	DC.SOE, ^d23	; Signal output EOF
	XP	DC.COE, ^d24	; Clear output EOF complete flag
	XP	DC.SOA, ^d25	; Signal output abort
	XP	DC.COA, ^d26	; Clear output abort complete
	XP	DC.CIE, ^d27	; Clear input EOF complete
	XP	DC.SIA, ^d28	; Signal input abort
	XP	DC.CIA, ^d29	; Clear input abort complete
	XP	DC.SPD, ^d30	; Suspend device (HASP only)
	XP	DC.USD, ^d31	; Unsuspend device (HASP only)
	XP	DC.BPR, ^d32	; Set bytes per record
 
; DN60 .C11QU line commands
 
	XP	LC.EL,	1	; Enable line and set characteristics
				;  byte 1 = terminal type: 0 = unknown,
				;   1 = 3780, 2 = 2780, 3 = HASP
				;  byte 2 = flags:
				;	bit 0 set = simulate
				;	      clear = support
				;	bit 1 set = primary BSC station (1 sec)
				;	      clear = secondary BCS station (3)
				;   usually primary & support or sec & sim,
				;   this sets the bid time for line different
				;   on each end of the line
	XP	LC.DTR, 2	; Set DTR (data terminal ready), allow answer
				;  of modem and receipt of data
	XP	LC.ABT, 3	; Abort all data transfers and clear DTR
	XP	LC.DIS, 4	; Disable the line
	XP	LC.CSD, 5	; Clear to send delay in jiffies (bytes 1-2)
	XP	LC.WAR, 6	; Number of bytes in warning silo (FIFO) area.
				;  (bytes 1-2)
	XP	LC.STR, 7	; Set output transparency
	XP	LC.CTR, ^d8	; Clear output transparency
	XP	LC.BPM, ^d9	; Set max number of bytes per message
	XP	LC.RPM, ^d10	; Set number of records per message
	XP	LC.SLS, ^d11	; Set line signature	- obsolete
	XP	LC.SON, ^D12	; set station signed on flag
 
; Number of bytes returned while reading .C11QU status'

	XP	D6.BYT, ^d79+1	; DN60 status
	XP	LS.BYT, ^d69+1	; Line status
	XP	DS.BYT, ^d13+1	; Device status
 
	MAX	<D6.BYT,LS.BYT,DS.BYT>,STSMAX	; Largest status buffer size
	SUBTTL	Macros -- STSBYT, BIT11
 
; Macro - STSBYT
;
; Function - To define a pointer to an entry in the status string.
;
; Parameters -
;
;	$%MNE	Mnemonic name to be given to the field
;	$%1ST	First byte in the field (lowest order)
;	$%LEN	Length of field in bytes.
;
;	Note: this assumes that the status string is in 8 bit bytes, which
;		is normal.
 
	Define STSBYT ($%MNE,$%1ST,$%LEN)
 
<	%$LEN==$%LEN			;; Save length of field for BIT11
	%$LM==MOD.(<^d<$%1ST>*^d8>,^d32) ;; Left most bit in word
	%$WID==^d<$%LEN>*^d8		;; Width of mask in bits
	%$RM==%$LM+%$WID-1		;; Right most bit in word
	DEFSTR ($%MNE,STSBUF+^d<$%1ST>/4,%$RM,%$WID);; offset from port status buffers
    > ;End STSBYT definition
 
 
; Macro - BIT11
;
; Function - To define mnemonic names that map PDP11 bit values (or masks)
;	into a 10/20 36 bit word.
;
; Parameters -
;
;	$%MNE	Mnemonic name to be given to the field
;	$%RM	Bit to be assigned (or rightmost bit in the mask field)
;	$%VAL	Optional value that has it's LSB as $%RM.
;
;	%$LEN	Length of field in bytes (from STSBYT)
 
Define BIT11 ($%MNE,$%RM,$%VAL<1>) <$%MNE==<$%VAL>b<35-<%$LEN-1-$%RM/8>*8-MOD.($%RM,8)>>
 
 

	SUBTTL	CAL11. status strings
 
; The status strings are returned as 8 bit byte string packed 4 bytes left
;  justified in a 36 bit word.	In each byte the bit numbering is bit 0 to
;  the right (LSB) and bit 7 to the left (MSB).
; Any 16 bit values that are returned have the 8bit bytes that make it up
;  swapped. So before these bits defined below are valid, the bytes have to
;  be swapped back again.
 
 
;	 7	 0 15	   8 7	     0 15      8	Bit no.'s in -11's word
;	 !	 ! !	   ! !	     ! !       !
;	+------------------------------------------+
;	! byte 0  ! byte 1  ! byte 2  ! byte 3	!  !	Byte no. in -11
;	+------------------------------------------+
;	 !    word 0	   ! !	    word 1     !  !	Word no. in -11
;	 0		  15 16 	      31  35	Bit no.'s in -10's word
 
 
; DN60 port status string  [ 80 (8 bit) bytes, 20 (36 bit) words ]
;
; Byte		Meaning
; ----		-------
;
; 0-7		DN60 version number
; 8-9		window version number (must match D60SER)
; 10-11 	Current number of free "chunks" in the DN60
; 12-13 	Number of lines on this DN60
; 14-15 	Number of bytes of data in a chunk
; 16-17 	Translation options avaiable:
;		 Bit 0 = IBM 3780/2780
;		 Bit 1 = HASP multileaving
;		 Bit 2 = IBM 3270
; 18-25 	KMC11 microcode version number
; 26-27 	Error code of last error that occurred
; 28-29 	Line number that last error occurred on
; 30-31 	Device that last error occurred on
; 32-33 	Bit	Meaning
;		 0-5	 Reserved
;		 6	 Console output data ready
;		 7	 Console input data ready
;		 8	 CDR0 has data ready (active)
;		  up to
;		 15	 CDR7 has data ready
; 34-35 	Bit	Meaning
;		 0	 LPT0 has is active
;		  up to
;		 7	 LPT7 is ready for data
;		 8	 CDP0 is ready for data
;		  up to
;		 15	 CDP7 is ready for data
;
; Repeat bytes 32-35 5 more times for a total of 6 lines.
;	32-35	line 0
;	36-39	line 1
;	40-43	line 2
;	44-47	line 3
;	48-51	line 4
;	52-55	line 5
 
	STSBYT	(S6LIN,12,1)		; Maximum line number on DN60
	STSBYT	(S6TRN,16,1)		; Translation options on DN6x
	 BIT11	 TR$X78, 0		;  Translate to 2780/3780 stations
	 BIT11	 TR$HSP, 1		;  Translate to HASP stations
	 BIT11	 TR$327, 2		;  Translate to 3270 stations
	 BIT11	 TR$IBM, 0,7		;  Any IBM translation
	XP	S6ACT,	^d8		; Offset to start of active flags
	XP	S6ALN,	^d12		; Length of active flag area (in words)

PRTSIZ==S6ACT+6*S6ALN			;max size of a port status
; Line status  [ 70 (8 bit) bytes, 18 (36 bit) words ]
;
; Byte		Meaning
; ----		-------
;
; 0		Terminal type: 0 = unknown, 1 = 3780, 2 = 2780, 3 = HASP
; 1-2		Flags:	bit 0 set = simulate, clear = support
;			bit 1 set = primary BSC protocol, clear = secondary
;			bit 2 set = signed on
;			bit 3 set = transparent
;			bit 4 set = disable in progress
;			bit 5 set = line enable in progress
;			bit 6 set = line abort complete
;			bit 7 set = off line (2780/3780 only)
;			bit 8 set = line disable complete
;			bit 9 set = disable done by DTE failure
;			bit 10 set = Line aborted by hardware failure
;			bit 11 set = Communications established
; 3		Line info:
;			bit 0 set = line is enabled
;			bit 1 set = DTR (data terminal ready)
;			bit 2 set = DSR (data set ready)
; 4-5		Count of DQ11/DUP11 error interrupts
; 6-7		DQ11/DUP11 status register 1 at last error
; 8-9		DQ11/DUP11 status register 2 at last error
; 10-11 	Count of times receiver wasn't fast enough
; 12-13 	Count of times transmitter wasn't fast enough
; 14-15 	Count of CTS (clear to send) failures
; 16-17 	Count of message sent and ACK'ed
; 18-19 	Count of NAK's received (+wrong acknowledge after timeout)
; 20-21 	Count of invalid responses to TTD
; 22-23 	Count of invalid responses to messages
; 24-25 	Count of TTD's sent
; 26-27 	Count of WACK's received in response to messages
; 28-29 	Count of EOT's (aborts) in response to messages
; 30-31 	Count of invalid bids of responses to bids
; 32-33 	Count of RVI's received while transmitting
; 34-35 	Count of message received ok
; 36-37 	Count of bad BCC's
; 38-39 	Count of NAK's sent in response to data messages
; 40-41 	Count of WACK's sent
; 42-43 	Count of TTD's received
; 44-45 	Count of EOT's sent or received which abort the stream
; 46-47 	Count of messages ignored (out of chunks, unrecognizable or
;		 timeout)
; 48-49 	Count of transparent msg with an invalid character after DLE
; 50-51 	Count of attempts to change between transparent and normal mode
;		 in a blocked message
; 52-53 	Count of transmitter timeouts
; 54-55 	Clear to send delay in jiffies
; 56-57 	Count of silo overflows
; 58-59 	Number of bytes in silo warning area (usually 64, must be even)
; 60-61 	Max number of bytes used in silo warning area since set last
; 62-63 	Max bytes per message
; 64-65 	Number of records per message
; 66-67 	Line signature	- obsolete
; 68-69 	Line driver type: 1 = DQ11, 2 = KMC11/DUP11, 3 = DUP11 w/o KMC
 
	STSBYT	(SLTYP,0,1)		; Translation type (type of station)
	 XP	 SL378, 1		;  IBM 3780
	 XP	 SL278, 2		;  IBM 2780
	 XP	 SLHSP, 3		;  IBM HASP
	STSBYT	(SLFLG,1,2)		; Line flags (term/emul)
	 BIT11	 SLETF, 0		;  Emulation(set)/termination(clear)
	 BIT11	 SLPRO, 1		;  Primary/secondary protocol
	 BIT11	 SLSON, 2		;  Station is signed on
	 BIT11	 SLTRA, 3		;  Transparent mode flag
	 BIT11	 SLDIP, 4		;  disable in progress
	 BIT11	 SLEIP, 5		;  line enable in progress
	 BIT11	 SLLAC, 6		;  line abort complete
	 BIT11	 SLOFL, 7		;  off line (2780/3780 only)
	 BIT11	 SLLDC, 8		;  line disable complete
	 BIT11	 SLDTF, 9		;  disable done by DTE failure
	 BIT11	 SLHWA, 10		;  Hardware abort
	 BIT11	 SLCME, 11		;  Communications established
	STSBYT	(SLINF,3,1)		; Line info (DTR, DSR, enabled)
	 BIT11	 SLLEN, 0		;  Line enable flag
	 BIT11	 SLDTR, 1		;  DTR flag (data terminal ready)
	 BIT11	 SLDSR, 2		;  DSR flag (data set ready)
	STSBYT	(SLCSD,54,2)		; Clear to send delay
	STSBYT	(SLSWL,58,2)		; Silo warning level
	STSBYT	(SLBPM,62,2)		; Maximum bytes per message
	STSBYT	(SLRPM,64,2)		; Records per message
;	STSBYT	(SLSIG,66,2)		; Line signature	- obsolete
	STSBYT	(SLDRV,68,2)		; line driver type

LINSIZ==^D70/4				; size of line status in words
; Device status string	[ 14 (8 bit) bytes, 3 (36 bit) words ]
;
; Byte		Meaning
; ----		-------
;
; 0		Device type (2780/3780) 0 = unknown, 1 = printer, 2 = punch
;		 3 = reader. (HASP) 1 = console-in, 2 = console-out
; 1		Component selection code
; 2-3		Printer line counter
; 4-7		Flags:
;		 Bits	0-3	reserved
;			4	interpret input carriage control
;			5	interpret output carriage control
;			6	reserved
;			7	do component selection
;			8	do compress/expand
;			9	page counter has overflowed
;			10	page counter interrupts enabled
;			11	old BSC protocol
;			12	output buffers being dumped
;			13-15	reserved
;			16	output permission requested
;			17	output permission granted
;			18	output running
;			19	output EOF signaled
;			20	output EOF complete
;			21	output abort started
;			22	output abort completed
;			23	input permission requested
;			24	input permission granted
;			25	input running
;			26	input abort started
;			27	input abort completed
;			28	input EOF completed
;			29	input permission was requested
; 8-9		Device record size
; 10-11 	Line flags: (duplicate of line status flags)
;			bit 0 set = simulate, clear = support
;			bit 1 set = primary BSC protocol, clear = secondary
;			bit 2 set = signed on
;			bit 3 set = transparent
;			bit 4 set = disable in progress
;			bit 5 set = line enable in progress
;			bit 6 set = line abort complete
;			bit 7 set = off line (2780/3780 only)
;			bit 8 set = line disable complete
;			bit 9 set = disable done by DTE failure
;			bit 10 set = line aborted by hardware failure
;			bit 11 set = communication established
; 12-13 	Line signature	- obsolete
 
	STSBYT	(SDDEV,0,1)		; Device type
	 XP	 SDLPT, 1		;  Line printer
	 XP	 SDCDP, 2		;  Card punch
	 XP	 SDCDR, 3		;  Card reader
	STSBYT	(SDCSD,1,1)		; Component selction code (HASP only)
	 XP	 SDREQ, 220		;  Req output permission (DN65 does it)
	 XP	 SDCOU, 221		;  Console output
	 XP	 SDCIN, 222		;  Console input
	 XP	 SDCR1, 223		;  Card reader 1
	 XP	 SDLP1, 224		;  Line printer 1
	 XP	 SDCP1, 225		;  Card punch 1
	 XP	 SDPRG, 240		;  Grant intput per. (DN65 does it)
	 XP	 SDSGN, 360		;  Signon device
	STSBYT	(SDFLG,4,4)		; Device flags
	 BIT11	 SDIIC, 4		;  Interpret input carriage control
	 BIT11	 SDIOC, 5		;  Interpret output carriage control
	 BIT11	 SDCSL, 7		;  Do component selection
	 BIT11	 SDDCE, 8		;  Do compression/expansion
	 BIT11	 SDPCO, 9		;  Page count has overflowed
	 BIT11	 SDPCI, 10		;  Page counter interrupts enabled
	 BIT11	 SDOBP, 11		;  Old BSC protocol
	 BIT11	 SDOBB, 12		;  Output buffers being dumped
	 BIT11	 SDIPH, 13		;  Send input permisson to HASP
	 BIT11	 SDIOM, 14		;  I/O mode of device (1=input, HASP)
	 BIT11	 SDDEP, 15		;  Dump or EOF in progress (if on)
	 BIT11	 SDOPR, 16		;  Output permission requested - pending
	 BIT11	 SDOPG, 17		;  Output permission granted - response to SDOPG
	 BIT11	 SDORN, 18		;  Output running
	 BIT11	 SDEOS, 19		;  Output EOF signaled
	 BIT11	 SDEOC, 20		;  Output EOF complete
	 BIT11	 SDOAS, 21		;  Output abort started
	 BIT11	 SDOAC, 22		;  Output abort complete
	 BIT11	 SDIPR, 23		;  Input permission requested - pending(2/3 sec)
	 BIT11	 SDIPG, 24		;  Input permission granted - response to SDIPR
	 BIT11	 SDIRN, 25		;  Input running
	 BIT11	 SDIAS, 26		;  Input abort started
	 BIT11	 SDIAC, 27		;  Input abort complete
	 BIT11	 SDIEC, 28		;  Input EOF complete
	 BIT11	 SDIPW, 29		;  Input permission was requested - SDIPR was set
	 BIT11	 SDOPW, 30		;  Output permission was requested - SDOPR was set
	 BIT11	 SDSUS, 31		;  Device suspended (HASP only)
	STSBYT	(SDLFG,10,2)		; Line flags
	 BIT11	 SDETF, 0		;  Emulation/termination flag
	 BIT11	 SDPRO, 1		;  Primary/secondary protocol
	 BIT11	 SDSON, 2		;  Station is signed on
	 BIT11	 SDTRA, 3		;  Transparent mode flag
	 BIT11	 SDDIP, 4		;  disable in progress
	 BIT11	 SDEIP, 5		;  line enable in progress
	 BIT11	 SDLAC, 6		;  line abort complete
	 BIT11	 SDOFL, 7		;  off line (2780/3780 only)
	 BIT11	 SDLDC, 8		;  line disable complete
	 BIT11	 SDDTF, 9		;  disable done by DTE failure
	 BIT11	 SDHWA, 10		;  Hardware abort
	 BIT11	 SDCME, 11		;  Communcations established
	STSBYT	(SDSIG,12,2)		; Signature of line device is on	- obsolete

DEVSIZ==^D13				; size of a device status message
 
	END				; End of D60JSY universal file
 
; Local Modes:
; Mode:Fundamental
; Comment Column:40
; Comment Start:; 
; Auto Save Mode:2
; Word Abbrev Mode:1
; End: