Google
 

Trailing-Edge - PDP-10 Archives - BB-J724A-SM_1980 - sources/d60unv.mac
There are 62 other files named d60unv.mac in the archive. Click here to see a list.
;<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
;                    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

	D6UEDT==100			; Edit number
	D6UVER==1			; Version number
	D6UMIN==0			; Minor version number
	D6UWHO==0			; Who edited last (DEC=0)

; 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
	XP	.MOTHR,	74		; Set device off line threshold

; 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 ERRS) that will then define
;	the error return value set for the D60JSY calls.
;
; Use -
;
;	A macro called ERRS 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

<	ERRS (D6AUT,<Port/line/dev/unit already used by this process>)
	ERRS (D6AUA,<Port/line/dev/unit already in use by another process>)
	ERRS (D6NSP,<No such port>)
	ERRS (D6NSL,<No such line on the port>)
	ERRS (D6NSD,<No such device on the station>)
	ERRS (D6NSU,<No such unit number of the specified device type>)
	ERRS (D6PLD,<Process lacks DTE I/O priviledges>)
	ERRS (D6NJA,<No JFN's available to open logical FE: on>)
	ERRS (D6DNR,<DN60 not running>)
	ERRS (D6PIU,<Port is useless to us, but it's running>)
	ERRS (D6COF,<Can't open a front end for use>)
	ERRS (D6UNS,<Unit number specified on non-HASP station>)
	ERRS (D6UND,<Unknown device type or unit>)
	ERRS (D6NBR,<Non-Blocking I/O Return>)
	ERRS (D6EOF,<End of file encountered while reading in data>)
	ERRS (D6NSH,<No such handle exists, call D60OPN first>)
	ERRS (D6CNN,<Byte count not negative>)
	ERRS (D6DOL,<Device seems to be offline>)
	ERRS (D6DCI,<Device can't do input>)
	ERRS (D6DCO,<Device can't do output>)
	ERRS (D6EEO,<Error while sending EOF, stream aborted>)
	ERRS (D6CGO,<Can't get output permission>)
	ERRS (D6FNI,<Function not implemented>)
	ERRS (D6IOE,<Unknown I/O error occured>)
	ERRS (D6CTF,<Can't talk to front end, SIN/SOUT or BOOT JSYS failed>)
	ERRS (D6BLS,<Bad line signature specified on open>)
	ERRS (D6LGA,<Line gone away, either hung up or hardware failure>)
	ERRS (D6DNU,<DSR not up, line is not connected>)
    > ;End D60ERR definition
	SUBTTL	Macros -- ERRS

; Macro - ERRS
;
; Function - To define a common method of allocating sequential error numbers.
;
; Parameters -
;
;	$%NAM	Mnemonic name of error
;	$%TXT	Text describing the error
;
; Use -
;
;	ERRS	(ERNAM,<This is the text describing ERNAM>)

	Define ERRS ($%NAM,$%TXT)

<IF1,<	IFNDEF $ERNXT,<$ERNXT==$ER1ST>	; If 1st time called .. init 1st value
	$ERNXT==$ERNXT+1		; Increment the error counter
	$%NAM=$ERNXT-1>		; Assign symbol to value (show value)

 IF2,<	IFG $ERNXT,<$ERNXT==-$ER1ST>	; If 1st time in pass2 .. init negative
	$ERNXT==$ERNXT-1		; Increment error counter
	$%NAM=-$ERNXT-1>		; Assign symbol value
    >; End ERRS 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$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$HAN	Handle identifier for this list entry
;	 H$HDV	 Unique device code (RCB for HASP stations)
;	 H$HPR	 Port number that line is on
;	 H$HLN	 Line number from port to station
;	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$RTI	 Return immediate flag. If delay occurs .. return.
;	 H$SON	 Station signon has been validated (or ignored).
;	 H$SPN	 Signon pending .. suppress some request timeouts
;	H$SIG	Signature of line device is on

	XP	H$ASS,	1b0		; Flag to say that handle is assigned
	SYSPRM	H$SIZ,5,11		; Size of handle table entry in words

	MSKSTR	(H$PDD,0,FWMASK)	; Packed device descriptor
	 MSKSTR	 (H$PRT,0,PD$PRT)	;  Port number
	 MSKSTR	 (H$LIN,0,PD$LIN)	;  Line number
	 MSKSTR	 (H$DEV,0,PD$DEV)	;  Device type code
	 MSKSTR	 (H$UNT,0,PD$UNT)	;  Unit number
	MSKSTR	(H$HAN,1,RHMASK)	; Handle is in the RH
	 MSKSTR	 (H$HPR,1,37b22)	;  5 bits of port number
	 MSKSTR	 (H$HLN,1,37b27)	;  5 bits of line number
	 MSKSTR	 (H$HDV,1,377b35)	;  8 bits of device num. (RCB for HASP)
	MSKSTR	(H$CDV,1,LHMASK)	; Communication device number
	MSKSTR	(H$STS,2,FWMASK)	; Status and other needed values
	 MSKSTR	 (H$TEM,2,1b1)		;  Termination/Emulation mode flag
	 DEFSTR	 (H$STY,2,^d9,^d8)	;  Station type code
	 MSKSTR	 (H$IOM,2,1b10)		;  Input/output device mode
	 MSKSTR	 (H$RUN,2,1b11)		;  Permission given/gotten, I/O going
	 DEFSTR	 (H$BPM,2,^d27,^d16)	;  Number of bytes max per message
	 MSKSTR	 (H$SPN,2,1b33)		;  Signon pending
	 MSKSTR	 (H$SON,2,1b34)		;  Station signed on
	 MSKSTR	 (H$RTI,2,1b35)		;  Return immediately if delay occurs
	MSKSTR	(H$THR,3,LHMASK)	; Threshold of delays to off-line
	MSKSTR	(H$DLY,3,RHMASK)	; Count of consecutive delayed CAL11.s
	MSKSTR	(H$SIG,4,RHMASK)	; Line signature

TOPS20 <
	LSTPNT==5			; Pointer to next byte in output
	NBXFRD==6			; Number of bytes transfered so far
	NBTXFR==7			; Number of bytes yet to transfer
	NBSDLY==10			; Bytes output since last delay

    > ;End of TOPS20 dependant handle list data
	SUBTTL	SONSTR signon string storage block

; This block is used by D60CND to store the signon string and object
;	descriptor.  D60OPN and D60SIN use it to determine whether
;	signon is required for a particular node.  If signon is
;	being done, the signon string read from the card-reader
;	is compared against the string stored here.
;
; Note - this is only used for termination nodes.  IBMSPL handles
;	all signon processing for emulation.


;	!=======================================================!
;	!                      Object type                      !
;	!-------------------------------------------------------!
;	!                  Object unit number                   !
;	!-------------------------------------------------------!
;	!                   Object node name                    !
;	!-------------------------------------------------------!
;	!                                                       !
;	\                  ASCIZ signon string                  \
;	!                                                       !
;	!=======================================================!

	XP	SONTYP,	0		; Object type
	XP	SONUNT,	1		; Unit number
	XP	SONNOD,	2		; Node name
	XP	SONTXT,	3		; Start of actual signon string

	XP	SNBLEN,	<^d82/5>+1+3	; Length of block
	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

	XP	CN$SIZ,	7		; Length of condition argument block
	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

	XP	OP$SIZ,	3		; Open block size
	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	C11??%,	12	; On a DN61-S, DTESER can't get any free core
;	XP	C11??%,	13	; On a DN61-S, the reload bit is set or primary
				;  protocol is not running.  This means that
				;  front end is down.
;	XP	C11??%,	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

; 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)
    > ;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 occured
; 28-29		Line number that last error occured on
; 30-31		Device that last error occured 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 11 more times for a total of 12 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
;	56-59	line 6
;	60-63	line 7
;	64-67	line 8
;	68-71	line 9
;	72-75	line 10
;	76-79	line 11

	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)
; 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 complete
;			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
; 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/termination flag
	 BIT11	 SLPRO,	1		;  Primary/secondary protocol
	 BIT11	 SLSON,	2		;  Station is signed on
	 BIT11	 SLTRA,	3		;  Transparent mode flag
	 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
; 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 complete
;			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

	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	 SDSON,	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		;  Input permisson sent to HASP (if 0)
	 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
	 BIT11	 SDOPG,	17		;  Output permission granted
	 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
	 BIT11	 SDIPG,	24		;  Input permission granted
	 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
	 BIT11	 SDOPW,	30		;  Output permission was requested
	 BIT11	 SDSUS,	31		;  Device suspended (HASP only)
	STSBYT	(SDLFG,10,2)		; Line flags
	 BIT11	 SDHWA,	10		;  Hardware abort
	 BIT11	 SDCME,	11		;  Communcations established
	STSBYT	(SDSIG,12,2)		; Signature of line device is on

	END				; End of D60JSY universal file
; Local Modes:
; Mode:Fundamental
; Comment Column:40
; Comment Start:;
; Auto Save Mode:2
; Word Abbrev Mode:1
; End: