Google
 

Trailing-Edge - PDP-10 Archives - cuspmar86binsrc_2of2_bb-fp63a-sb - 10,7/swil/swimsc.mac
There are 4 other files named swimsc.mac in the archive. Click here to see a list.
	TITLE	.MISC	SWIL miscellaneous support routines
	SUBTTL	Robert Houk/RDH

	SEARCH	SWIDEF,	SWIL		;SWIL PACKAGE DEFINITIONS
	SEARCH	JOBDAT,	MACTEN,	UUOSYM	;STANDARD DEFINITIONS

	SALL				;PRETTY LISTINGS
	.DIREC	FLBLST			;PRETTIER LISTINGS

	TWOSEG	400000


	COMMENT	\

COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1984,1986.  ALL RIGHTS RESERVED.


THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED
ONLY  IN  ACCORDANCE  WITH  THE  TERMS  OF  SUCH LICENSE AND WITH THE
INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE OR ANY  OTHER
COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF THE  SOFTWARE  IS  HEREBY
TRANSFERRED.

THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT  NOTICE
AND  SHOULD  NOT  BE  CONSTRUED  AS A COMMITMENT BY DIGITAL EQUIPMENT
CORPORATION.

DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY  OF  ITS
SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.

\
	SUBTTL	Version and Revision History

MAJVER==13	;MAJOR VERSION LEVEL
MINVER==0	;MINOR (MAINTENANCE RELEASE) LEVEL
CSTVER==0	;CUSTOMER VERSION (WHO LAST . . .)
EDTVER==1022	;EDIT LEVEL

%%MISC==:<BYTE (3)CSTVER(9)MAJVER(6)MINVER(18)EDTVER>
%%SWIL==:%%SWIL	;SHOW (AND SYNCHRONIZE) SWIL VERSION

IF2,<	PURGE	CSTVER,MAJVER,MINVER,EDTVER>



;INITIAL CREATION

;1000	RDH	01-Jan-84
;	Incorporate into SWIL %12(1000), sync edit level at 1000.

;1006	RDH
;	Run in non-zero PC sections.

;1011	DRB	24-Jan-85
;	Put .POPJ and .POPJ1 into a separately loadable module to avoid
;	conflicts with copies that may have already been loaded.

;1022	LEO	09-Sep-85
;	Do Copyrights.


	PRGEND
	TITLE	.MNET	SWIL miscellaneous network routines
	SUBTTL

	SEARCH	SWIDEF,	SWIL		;SWIL PACKAGE DEFINITIONS
	SEARCH	JOBDAT,	MACTEN,	UUOSYM	;STANDARD DEFINITIONS

	SALL				;PRETTY LISTINGS
	.DIREC	FLBLST			;PRETTIER LISTINGS

	TWOSEG	400000

;COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1984,1986.  ALL RIGHTS RESERVED.

	COMMENT	\

COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1984,1986.  ALL RIGHTS RESERVED.


THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED
ONLY  IN  ACCORDANCE  WITH  THE  TERMS  OF  SUCH LICENSE AND WITH THE
INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE OR ANY  OTHER
COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF THE  SOFTWARE  IS  HEREBY
TRANSFERRED.

THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT  NOTICE
AND  SHOULD  NOT  BE  CONSTRUED  AS A COMMITMENT BY DIGITAL EQUIPMENT
CORPORATION.

DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY  OF  ITS
SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.

\
	SUBTTL	NDNAM	Return node name based on node specification

;NDNAM  --  TRY TO MAKE A NAME OUT OF A NODE SPECIFIER
;CALL IS:
;
;	MOVX	T3,<NODE>
;	PUSHJ	P,NDNAM
;	RETURN
;
;WHERE <NODE> IS SIXBIT NODE NAME, SIXBIT NODE NUMBER, OR OCTAL NODE NUMBER.
;
;ON RETURN T1 WILL HAVE THE NODE NAME IF <NODE> IS MEANINGFUL, OTHERWISE
;T1 WILL HAVE <NODE>, ASSUMING WHOEVER WANTS TO USE IT WILL BE BETTER
;SITUATED TO COMPLAIN ABOUT NO SUCH NODE. T2 WILL HAVE THE NODE NUMBER
;ASSOCIATED WITH THE NAME IN T1, OR -1 IF THE NODE SPEC WAS UNIDENTIFIABLE.
;
;USES T1 - T4.

	ENTRY	.NDNAM

.NDNAM:	PUSH	P,T3		;SAVE INPUT
	CAMN	T3,.MYNOD##	;LOCAL (KNOWN) NAME?
	JRST	NDNAM5		;YES, THEN ALL SET
	TLNN	T3,770000	;SIXBIT OF SOME SORT?
	JRST	NDNAM3		;NO, MUST BE OCTAL NODE NUMBER
	MOVE	T1,[.NDRNN,,T2]	;YES, MAY BE SIXBIT NODE NUMBER
	MOVEI	T2,2		;SO ASK MONITOR FOR OCTAL NODE NUMBER
	NODE.	T1,		;SINCE WE CAN'T TELL THE DIFFERENCE
	 JRST	NDNAM5		;JUNK, PRESERVE INPUT
	MOVE	T3,T1		;SET UP NODE NUMBER
NDNAM3:	MOVE	T1,[.NDRNN,,T2]	;ARG POINTER
	MOVEI	T2,2		;AND ARG BLOCK LENGTH
	NODE.	T1,		;TO READ NODE NAME GIVEN NODE NUMBER
NDNAM5:	 MOVE	T1,0(P)		;NO SUCH NODE, RETURN INPUT SPECIFIER
	PUSH	P,T1		;SAVE NODE NAME
	MOVE	T3,T1		;POSITION NAME IN T3
	MOVE	T1,[.NDRNN,,T2]	;ARG POINTER
	MOVEI	T2,2		;AND ARG BLOCK LENGTH
	NODE.	T1,		;TO READ NODE NUMBER FOR NAME
	 SETO	T1,		;NONE KNOWN
	MOVE	T2,T1		;RETURN NODE NUMBER IN T2
	POP	P,T1		;AND NODE NAME IN T1
	POP	P,T3		;ADJUST STACK
	POPJ	P,		;AND RETURN
	SUBTTL	HST6W	Return host node name

;HST6W  --  RETURN HOST NAME IN SIXBIT
;Call is:
;
;	PUSHJ	P,HST6W
;	 ERROR RETURN
;	NORMAL RETURN
;
;The error return is taken if no networks exist.
;
;On normal return the host name (in sixbit) is in T1.
;
;All acs are preserved.

	ENTRY	.HST6W

.HST6W:	PUSHJ	P,.SAVE2##	;NEED A COUPLA SCRATCH ACS
	MOVEI	P1,2		;LENGTH 2
	MOVSI	P2,'CTY'	;IDENTIFY HOST
	WHERE	P2,UU.PHY	;BY TRADITIONAL MEANS
	 JRST	HST6W8		;NO NETWORKS
	ANDI	P2,-1		;REDUCE TO ONLY NODE NUMBER
	MOVE	T1,[.NDRNN,,P1]	;NODE. ARG BLOCK TO
	NODE.	T1,		;GET HOST NAME IN SIXBIT
	 JRST	HST6W8		;NO NETWORKS
	JRST	.POPJ1##	;SUCCESSFUL RETURN

HST6W8:	MOVX	M0,$EFNNS	;NO NETWORK SOFTWARE
	SETO	T1,		;MAKE JUNK NAME
	POPJ	P,		;RETURN ERROR
	XLIST			;THE LITERALS
	LIT
	LIST

	PRGEND
	TITLE	.MCODE	SWIL "code" searching and dispatch routines
	SUBTTL

	SEARCH	SWIDEF,	SWIL		;SWIL PACKAGE DEFINITIONS
	SEARCH	JOBDAT,	MACTEN,	UUOSYM	;STANDARD DEFINITIONS

	SALL				;PRETTY LISTINGS
	.DIREC	FLBLST			;PRETTIER LISTINGS

	TWOSEG	400000

;COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1984,1986.  ALL RIGHTS RESERVED.

	COMMENT	\

COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1984,1986.  ALL RIGHTS RESERVED.


THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED
ONLY  IN  ACCORDANCE  WITH  THE  TERMS  OF  SUCH LICENSE AND WITH THE
INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE OR ANY  OTHER
COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF THE  SOFTWARE  IS  HEREBY
TRANSFERRED.

THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT  NOTICE
AND  SHOULD  NOT  BE  CONSTRUED  AS A COMMITMENT BY DIGITAL EQUIPMENT
CORPORATION.

DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY  OF  ITS
SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.

\
	SUBTTL	CDISP	Dispatch on code value

;CDISP  --  DISPATCH ON CODE
;Call is:
;
;	MOVX	T2,<CODE>
;	JSP	T4,CDISP
;		DISP1,,CODE1
;		DISP2,,CODE2
;		   . . .
;		DISPN,,CODEN
;		0
;	NO DISPATCH
;
;Where <CODE> is the code upon which to dispatch. CODE1, CODE2, . . .,
;CODEN are the possible codes to match, and DISP1, DISP2, . . ., DISPN
;are the dispatch addresses if the code matches.
;
;If no matching code is found the "NO DISPATCH" return is taken.
;
;Uses acs T1, T4.

	ENTRY	.CDISP

.CDISP:	MOVE	T1,(T4)		;GET FIRST TABLE ENTRY
	JRST	CDISP4		;AND START LOOKING THERE
CDISP2:	SKIPN	T1,(T4)		;END OF TABLE YET?
	JRST	1(T4)		;YES, TAKE "NO DISPATCH" RETURN
CDISP4:	CAIE	T2,(T1)		;CODES MATCH?
	AOJA	T4,CDISP2	;NO, SEARCH REST OF TABLE
	HLRZ	T1,(T4)		;GET DISPATCH ADDRESS
	JRST	(T1)		;AND DISPATCH AS DIRECTED
	SUBTTL	CFIND	Return value based on code

;CFIND  --  FIND A CONTROL CODE IN A TABLE
;Call is:
;
;	MOVX	T2,<CODE>
;	MOVEI	T4,<TABL>
;	PUSHJ	P,CFIND
;	 ERROR RETURN
;	NORMAL RETURN
;
;Where <TABL> is a table a la CDISP above (codes in right half of words,
;return value in left half of words, table terminated by a 0 word)
;and <CODE> is the code to match.
;
;On error return, <CODE> was not in the table.
;
;On normal return, T4 will point to the table entry that matched, and
;T1 will contain the matching value for <CODE>.
;
;Uses acs T1, T4.

	ENTRY	.CFIND

.CFIND:	MOVE	T1,(T4)		;GET FIRST TABLE ENTRY
	JRST	CFIND4		;AND START LOOKING THERE
CFIND2:	SKIPN	T1,(T4)		;END OF TABLE YET?
	POPJ	P,		;YES, TAKE ERROR RETURN
CFIND4:	CAIE	T2,(T1)		;CODES MATCH?
	AOJA	T4,CFIND2	;NO, SEARCH REST OF TABLE
	HLRZ	T1,(T4)		;GET RETURN VALUE
	JRST	.POPJ1##	;SUCCESSFUL RETURN
	XLIST			;THE LITERALS
	LIT
	LIST

	PRGEND
	TITLE	.BYBLT	SWIL byte "BLT" routines
	SUBTTL

	SEARCH	SWIDEF,	SWIL		;SWIL PACKAGE DEFINITIONS
	SEARCH	JOBDAT,	MACTEN,	UUOSYM	;STANDARD DEFINITIONS

	SALL				;PRETTY LISTINGS
	.DIREC	FLBLST			;PRETTIER LISTINGS

	TWOSEG	400000

;COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1984,1986.  ALL RIGHTS RESERVED.

	COMMENT	\

COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1984,1986.  ALL RIGHTS RESERVED.


THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED
ONLY  IN  ACCORDANCE  WITH  THE  TERMS  OF  SUCH LICENSE AND WITH THE
INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE OR ANY  OTHER
COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF THE  SOFTWARE  IS  HEREBY
TRANSFERRED.

THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT  NOTICE
AND  SHOULD  NOT  BE  CONSTRUED  AS A COMMITMENT BY DIGITAL EQUIPMENT
CORPORATION.

DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY  OF  ITS
SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.

\
	SUBTTL	BYBLT	Byte "BLT" routine

;.BYBLT  --  "BLT" A BYTE STRING
;Call is:
;
;	MOVX	T2,<CNT>
;	MOVX	T3,<SRC>
;	MOVX	T4,<DST>
;	PUSHJ	P,BYBLT
;	 error return
;	normal return
;
;Where <CNT> is the number of bytes to "BLT"; <SRC> and <DST> are the
;source and destination byte pointers respectively (must be single
;word byte pointers, they may use indexing (with, e.g., register IO)
;for global addressing).
;
;The error return is not used (if a non-positive count is supplied then
;BYBLT will STOPCD).
;
;On successful return, the byte string will have been moved as directed
;with T2 returned 0, and T4 pointing to the last byte copied (e.g.,
;ready for consecutive use in multiple calls to BYBLT used to gather
;multiple independent byte strings).
;
;Uses T1, T2, T3, T4.

	ENTRY	.BYBLT

.BYBLT:	JUMPG	T2,BYBLT2	;OK IF REALLY SOMETHING TO DO
	JUMPE	T2,.POPJ1##	;DONE SUCCESSFULLY IF NOTHING TO DO
	STOPCD	<BYBLT called with negative byte count>

;Now here is a good place for a really nifty routine. For now though . . .

BYBLT2:	ILDB	T1,T3		;GET A SOURCE BYTE
	IDPB	T1,T4		;AND MAKE IT A DESTINATION BYTE
	SOJG	T2,BYBLT2	;LOOP FOR ENTIRE SOURCE STRING
	JRST	.POPJ1##	;SUCCESSFUL RETURN
	XLIST			;THE LITERALS
	LIT
	LIST

	PRGEND
	TITLE	.XTYIO	SWIL "command" input/output redirection
	SUBTTL

	SEARCH	SWIDEF,	SWIL		;SWIL PACKAGE DEFINITIONS
	SEARCH	JOBDAT,	MACTEN,	UUOSYM	;STANDARD DEFINITIONS

	SALL				;PRETTY LISTINGS
	.DIREC	FLBLST			;PRETTIER LISTINGS

	TWOSEG	400000

;COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1984,1986.  ALL RIGHTS RESERVED.

	COMMENT	\

COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1984,1986.  ALL RIGHTS RESERVED.


THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED
ONLY  IN  ACCORDANCE  WITH  THE  TERMS  OF  SUCH LICENSE AND WITH THE
INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE OR ANY  OTHER
COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF THE  SOFTWARE  IS  HEREBY
TRANSFERRED.

THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT  NOTICE
AND  SHOULD  NOT  BE  CONSTRUED  AS A COMMITMENT BY DIGITAL EQUIPMENT
CORPORATION.

DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY  OF  ITS
SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.

\
	SUBTTL	XTYPI	Coroutine to redirect command input

;XTYPI  --  SET TYPEIN STREAM ROUTINE
;Call is:
;
;	MOVX	T1,<ADDR>
;	PUSHJ	P,XTYPI
;	RETURN
;
;Where <ADDR> is the address of the routine to call to perform "typein".
;
;On normal return all command input requests will be redirected to the
;specified routine.
;
;When the caller returns, typein will be automatically restored to the
;previous state. If the previous state is top level (no previous calls
;to XTYPI) then the input service will be cleaned down in such a fashion
;as to keep SCAN happy.
;
;Uses T1.

	ENTRY	.XTYPI

.XTYPI:	PUSHJ	P,.TYPRE##	;SELECT PRE-EMPTIVE INPUT SERVICE
	PUSH	P,T1		;SAVE OLD ROUTINE
	PUSHJ	P,@-1(P)	;CALL OUR CALLER
	 CAIA			;NON-SKIP RETURN
	AOS	-2(P)		;SKIP RETURN
	POP	P,T1		;RESTORE PREVIOUS STATE OF INPUT
	JUMPN	T1,XTYPI4	;AND SIMPLY UN-NEST IF NESTED
	XMOVEI	T1,XTYPI7	;OTHERWISE MOMENTARILY SUPPLY OUR VERY OWN
	PUSHJ	P,.TYPRE##	;EOL INPUT SERVICE
	PUSHJ	P,.CLEOL##	;MAKE SURE SCAN AT NICE END OF LINE STATE
	SETZ	T1,		;NOW CLEAR OUT PRE-EMPTIVE SERVICE
XTYPI4:	PUSHJ	P,.TYPRE##	;SET NEW INPUT SERVICE
	POP	P,T1		;ADJUST STACK
	POPJ	P,		;RETURN AS APPROPRIATE

;SUPPLY EOL TO .TI---

XTYPI7:	MOVEI	CH,.CHLFD	;A NICE JUICY EOL CHARACTER
	POPJ	P,		;EASY AS COULD BE
	SUBTTL	XTYPO	Coroutine to redirect command output

;XTYPO  --  SET TYPEOUT STREAM ROUTINE
;Call is:
;
;	MOVX	T1,<ADDR>
;	PUSHJ	P,XTYPO
;	RETURN
;
;Where <ADDR> is the address of the routine to call to perform "typeout".
;
;On normal return the typeout will be directed to the addressed routine.
;When the caller returns the original typeout routine in effect before
;the call to XTYPO will be restored.
;
;Preserves all acs.

	ENTRY	.XTYPO

.XTYPO:	PUSHJ	P,.TYOCH##	;SET TYPEOUT ROUTINE
	PUSH	P,T1		;SAVE PREVIOUS ROUTINE
	PUSHJ	P,@-1(P)	;CALL OUR CALLER
	 CAIA			;NON-SKIP RETURN
	AOS	-2(P)		;SKIP RETURN
	POP	P,T1		;ORIGINAL TYPEOUT ROUTINE
	POP	P,(P)		;JUNK ADDRESS
	PJRST	.TYOCH##	;RESTORE ORIGINAL TYPEOUT ROUTINE
	SUBTTL	XERRT	Coroutine to process [SCAN] error interception

;XERRT  --  SET SCAN ERROR INTERCEPTION
;Call is:
;
;	MOVX	T1,<ADDR>
;	PUSHJ	P,XERRT
;	RETURN
;
;Where <ADDR> is the address of the routine to call on error detection.
;
;On normal return, the caller can call SCAN routines, and if any fatal
;syntax errors occur, the caller's specified routine will be called rather
;than aborting. The specified error intercept routine will be entered
;with the stack "phased" to immediately after the caller's call to .XERRT.
;
;Preserves all acs.

	ENTRY	.XERRT

.XERRT:	PUSH	P,T1		;SAVE CALLER'S NEW ERROR INTERCEPT ROUTINE
	PUSH	P,NFTERP##	;SAVE PRE-CALLER ERROR STACK POINTER
	PUSH	P,NFTERT##	;SAVE PRE-CALLER ERROR INTERCEPT
	PUSHJ	P,XERRT1	;PSEUDOINCESTOUSLY CALL OURSELF
	 CAIA			;NON-SKIP RETURN
	AOS	-4(P)		;SKIP RETURN
	POP	P,NFTERT##	;RESTORE PRE-CALLER ERROR INTERCEPT
	POP	P,NFTERP##	;RESTORE PRE-CALLER ERROR STACK
	POP	P,(P)		;PITCH CALLER'S INTERCEPT ADDRESS
	POP	P,(P)		;JUNK ADDRESS
	POPJ	P,		;NON/SKIP AS APPROPRIATE

XERRT1:	MOVEM	P,NFTERP##	;REMEMBER PRE-INTERCEPT STACK
	XMOVEI	T1,XERRT7	;PROVIDE AN INTERMEDIATE ERROR INTERCEPT
	MOVEM	T1,NFTERT##	;SO THAT CALLER GETS CALLED WITH GOOD STACK
	PJRST	@-4(P)		;FINALLY WEND OUR WAY BACK TO THE CALLER

XERRT7:	MOVE	P,NFTERP##	;RESTORE STACK TO KNOWN CONDITION
	PJRST	@-3(P)		;CALL CALLER'S INTERCEPT ROUTINE
	XLIST		;THE LITERALS
	LIT
	LIST

	PRGEND
	TITLE	.LKNAM	SWIL Table lookup with abbreviations
	SUBTTL

	SEARCH	SWIDEF,	SWIL		;SWIL PACKAGE DEFINITIONS
	SEARCH	JOBDAT,	MACTEN,	UUOSYM	;STANDARD DEFINITIONS

	SALL				;PRETTY LISTINGS
	.DIREC	FLBLST			;PRETTIER LISTINGS

	TWOSEG	400000

;COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1984,1986.  ALL RIGHTS RESERVED.

	COMMENT	\

COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1984,1986.  ALL RIGHTS RESERVED.


THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED
ONLY  IN  ACCORDANCE  WITH  THE  TERMS  OF  SUCH LICENSE AND WITH THE
INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE OR ANY  OTHER
COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF THE  SOFTWARE  IS  HEREBY
TRANSFERRED.

THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT  NOTICE
AND  SHOULD  NOT  BE  CONSTRUED  AS A COMMITMENT BY DIGITAL EQUIPMENT
CORPORATION.

DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY  OF  ITS
SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.

\
	SUBTTL	LKNAM	Lookup name in table with abbreviations

;.LKNAM -- LOOKUP NAME IN TABLE ALLOWING FOR UNIQUE ABBREVIATIONS
;ALWAYS CHECK FOR EXACT MATCH FIRST.
;CALL:	MOVE	T1,[IOWD LENGTH,START OF TABLE]
;	MOVE	T2,NAME
;	PUSHJ	P,.LKNAM
;	ERROR RETURN IF UNKNOWN OR DUPLICATE
;	AND WITH T1.LT.0 IF NOT MATCH, .GT.0 IF SEVERAL MATCHES
;	SKIP RETURN IF FOUND WITH T1 POINTING TO ENTRY
;	AND WITH LH(T1)=0 IF ABBREVIATION, OR T1.LT.0 IF EXACT MATCH
;USES T3, T4
;PRESERVES T2

	ENTRY	.LKNAM

.LKNAM:	JUMPGE	T1,[SETOM T1	;FLAG UNKNOWN
		    POPJ P,]	;ERROR RETURN
	PUSHJ	P,.SAVE2##	;SAVE P1, P2
	PUSH	P,T1		;SAVE ARGUMENT
	MOVE	T3,T2		;SET ARG TO MASK MAKER
	PUSHJ	P,.MKMSK	;MAKE MASK
	MOVE	T2,T3		;RESTORE NAME
	MOVE	P1,T1		;SAVE FOR MATCHING
	POP	P,T1		;RECOVER ARGUMENT
	SETOM	P2		;SET ABBREVIATION MATCH COUNTER
	AOS	T1		;POSITION POINTER
NAME1:	MOVE	T3,(T1)		;FETCH TABLE ENTRY
	TLNE	T3,(3B1)	;NOTE THAT * IS 12 IN SIXBIT
	JRST	NAME2		;NOT FORCED MATCH
	LSH	T3,6		;SEE IF IT MATCHES
	XOR	T3,T2		;EVEN IN AN ABBR.
	TRZ	T3,77		;CLEAR LAST CHAR SINCE WE DON'T KNOW IT
	AND	T3,P1		; ..
	JUMPE	T3,.POPJ1##	;YES--GIVE MATCH RETURN
	JRST	NAME3		;NO--LOOP
NAME2:	XOR	T3,T2		;SEE IF EXACT MATCH
	JUMPE	T3,.POPJ1##	;YES--A WINNER
	AND	T3,P1		;SEE IF A SUITABLE ABBREVIATION
	JUMPN	T3,NAME3	;NO--LOOP BACK FOR MORE
	MOVE	T4,T1		;SALT AWAY THE LOCATION JUST IN CASE
	AOS	P2		;YES--COUNT 
NAME3:	AOBJN	T1,NAME1	;ADVANCE--LOOP IF NOT DONE YET
	HRRZ	T1,T4		;RESTORE LOCATION OF A WINNER
	JUMPE	P2,.POPJ1##	;DONE--JUMP IF ONE ABBREVIATION
	MOVE	T1,P2		;GIVE FLAG TO CALLER
	POPJ	P,		;NONE OR TWO, SO FAIL
;.MKMSK -- MAKE MASK CORRESPONDING TO NON-BLANKS IN SIXBIT WORD
;CALL:	MOVE	T3,WORD
;	PUSHJ	P,.MKMSK
;RETURN WITH MASK IN T1
;USES T2

	ENTRY	.MKMSK

.MKMSK:	MOVEI	T1,0		;CLEAR MASK
	MOVSI	T2,(77B5)	;START AT LEFT END
MAKMS1:	TDNE	T3,T2		;SEE IF SPACE HERE
	IOR	T1,T2		;NO--IMPROVE MASK
	LSH	T2,-6		;MOVE RIGHT ONE CHAR
	JUMPN	T2,MAKMS1	;LOOP UNTIL DONE
	POPJ	P,		;RETURN
	XLIST		;THE LITERALS
	LIT
	LIST

	PRGEND
	TITLE	.GTPUT	SWIL "GET" and "PUT" list entry routines
	SUBTTL

	SEARCH	SWIDEF,	SWIL		;SWIL PACKAGE DEFINITIONS
	SEARCH	JOBDAT,	MACTEN,	UUOSYM	;STANDARD DEFINITIONS

	SALL				;PRETTY LISTINGS
	.DIREC	FLBLST			;PRETTIER LISTINGS

	TWOSEG	400000

;COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1984,1986.  ALL RIGHTS RESERVED.

	COMMENT	\

COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1984,1986.  ALL RIGHTS RESERVED.


THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED
ONLY  IN  ACCORDANCE  WITH  THE  TERMS  OF  SUCH LICENSE AND WITH THE
INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE OR ANY  OTHER
COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF THE  SOFTWARE  IS  HEREBY
TRANSFERRED.

THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT  NOTICE
AND  SHOULD  NOT  BE  CONSTRUED  AS A COMMITMENT BY DIGITAL EQUIPMENT
CORPORATION.

DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY  OF  ITS
SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.

\
	SUBTTL	INVWD	Initialization vector manipulation

;INVWD  --  READ A WORD FROM A VECTOR
;Call is:
;
;	PUSHJ	P,INVWD
;	RETURN
;
;The next vector word is returned in T1 unless the vector is exhausted,
;in which case 0 is returned.
;
;To initialize, call INVWI with T2 containing the base address of the
;vector. The first word of the vector is the length of the vector, ex-
;cluding itself. INVWI sets P1 to be the length word and P2 to be the
;current address.
;
;uses T1, P1, P2.

	ENTRY	.INVWI,	.INVWD

.INVWI:	MOVE	P1,0(T2)	;LENGTH OF THE VECTOR
	AOS	P2,T2		;ADDRESS OF REST OF THE VECTOR
	PUSHJ	P,.INVWD	;READ VERSION WORD
	CAMN	T1,['NS',,102030]  ;MATCH OUR "SPECIAL" VERSION?
	POPJ	P,		;RETURN ALL SET UP
	OUTSTR	[ASCIZ/? Version incompatibility/]
	EXIT


.INVWD:	SOSGE	P1		;COUNT DOWN, ANY WORDS LEFT?
	TDZA	T1,T1		;NO, RETURN 0
	MOVE	T1,(P2)		;YES, READ NEXT WORD FROM VECTOR
	AOJA	P2,.POPJ##	;RETURN WITH VALUE IN T1
;.GTWRD -- SUBROUTINE TO GET NEXT WORD FROM USER'S PARAMETER LIST
;CALL:	MOVE	T1,ADDRESS OF TABLE
;	MOVE	T2,COUNTER OF LENGTH TO GO
;	PUSHJ	P,.GTWRD
;RETURNS WITH T1 INCREMENTED, T2 DECREMENTED, T3=CONTENTS OR 0

	ENTRY	.GTWRD

.GTWRD:	SOJL	T2,GETWRX	;DECREMENT COUNTER--CHECK OVERRUN
	SKIPA	T3,(T1)		;GET USER'S VALUE
GETWRX:	MOVEI	T3,0		;GET 0 DUE TO OVERRUN
	AOS	T1		;ADVANCE POINTER FOR NEXT TIME
	POPJ	P,		;RETURN



;.PTWRD -- STORE WORD IN USER PARAMETER AREA IF ROOM
;CALL:	MOVE	T1,LOCATION (WILL BE INCREMENTED BY ONE)
;	MOVE	T2,LENGTH TO GO (WILL BE DECREMENTED BY ONE)
;	MOVE	T3,DATA ITEM
;	PUSHJ	P,.PTWRD
;RETURNS WITH T1=T1+1, T2=T2-1, WORD STORED (OLD T1) IF OLD T2.GT.0

	ENTRY	.PTWRD

.PTWRD:	SOSL	T2		;DECREMENT COUNT
	MOVEM	T3,(T1)		;STORE VALUE
	AOS	T1		;ADVANCE LOCATION
	POPJ	P,		;RETURN
	XLIST		;THE LITERALS
	LIT
	LIST

	PRGEND
	TITLE	.ISLGI	SWIL check for logged-in
	SUBTTL

	SEARCH	SWIDEF,	SWIL		;SWIL PACKAGE DEFINITIONS
	SEARCH	JOBDAT,	MACTEN,	UUOSYM	;STANDARD DEFINITIONS

	SALL				;PRETTY LISTINGS
	.DIREC	FLBLST			;PRETTIER LISTINGS

	TWOSEG	400000

;COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1984,1986.  ALL RIGHTS RESERVED.

	COMMENT	\

COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1984,1986.  ALL RIGHTS RESERVED.


THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED
ONLY  IN  ACCORDANCE  WITH  THE  TERMS  OF  SUCH LICENSE AND WITH THE
INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE OR ANY  OTHER
COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF THE  SOFTWARE  IS  HEREBY
TRANSFERRED.

THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT  NOTICE
AND  SHOULD  NOT  BE  CONSTRUED  AS A COMMITMENT BY DIGITAL EQUIPMENT
CORPORATION.

DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY  OF  ITS
SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.

\
	SUBTTL	ISLGI	Check if job is logged in

;.ISLGI -- ROUTINE TO SEE IF JOB IS LOGGED IN
;CALL:	PUSHJ	P,.ISLGI
;	RETURN +1 IF NOT (1/-1) OR UNKNOWN (1/1)
;	RETURN +2 IF KNOWN LOGGED IN

	ENTRY	.ISLGI

.ISLGI:	PJOB	T1,		;GET JOB NUMBER
	MOVNS	T1		;COMPLEMENT
	JOBSTS	T1,		;GET OUT STATUS
	  JRST	[MOVEI T1,1	;DOESN'T WORK--INDICATE PROBLEM
		 POPJ  P,]	;ERROR RETURN
	TXNE	T1,JB.ULI	;SEE IF LOGGED IN
	AOSA	(P)		;YES--GIVE SKIP RETURN
	SETOM	T1		;NO--INDICATE NOT
	POPJ	P,		;RETURN
	XLIST			;THE LITERALS
	LIT
	LIST

	PRGEND
	TITLE	.SAVE	SWIL "AC" save and restore coroutines
	SUBTTL

	SEARCH	SWIDEF,	SWIL		;SWIL PACKAGE DEFINITIONS
	SEARCH	JOBDAT,	MACTEN,	UUOSYM	;STANDARD DEFINITIONS

	SALL				;PRETTY LISTINGS
	.DIREC	FLBLST			;PRETTIER LISTINGS

	TWOSEG	400000

;COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1984,1986.  ALL RIGHTS RESERVED.

	COMMENT	\

COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1984,1986.  ALL RIGHTS RESERVED.


THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED
ONLY  IN  ACCORDANCE  WITH  THE  TERMS  OF  SUCH LICENSE AND WITH THE
INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE OR ANY  OTHER
COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF THE  SOFTWARE  IS  HEREBY
TRANSFERRED.

THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT  NOTICE
AND  SHOULD  NOT  BE  CONSTRUED  AS A COMMITMENT BY DIGITAL EQUIPMENT
CORPORATION.

DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY  OF  ITS
SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.

\
	SUBTTL	SAVEn	Coroutine to save/restore the "P" registers

;SAVEn  --  COROUTINE TO SAVE THE "Pn" REGISTERS
;Call is:
;
;	PUSHJ	P,.SAVE1/.SAVE2/.SAVE3/.SAVE4
;
;The .SAVEn coroutines save the Pn registers and coroutine back to the
;caller. When the caller returns (either non-skip or skip-of-1) the Pn
;registers will be restored and the return (non/skip) propagated.

	ENTRY	.SAVE1

.SAVE1:	PUSH	P,P1		;SAVE P1
	PUSHJ	P,@-1(P)	;COROUTINE BACK TO OUR CALLER
	 JRST	NRET1		;NON-SKIP RETURN
	JRST	SRET1		;SKIP RETURN



;.SAVE2 -- COROUTINE TO SAVE P1 AND P2

	ENTRY	.SAVE2

.SAVE2:	PUSH	P,P1		;SAVE P1
	PUSH	P,P2		;SAVE P2
	PUSHJ	P,@-2(P)	;COROUTINE BACK TO OUR CALLER
	 JRST	NRET2		;NON-SKIP RETURN
	JRST	SRET2		;SKIP RETURN



;.SAVE3 -- COROUTINE TO SAVE P1, P2 AND P3

	ENTRY	.SAVE3

.SAVE3:	PUSH	P,P1		;SAVE P1
	PUSH	P,P2		;SAVE P2
	PUSH	P,P3		;SAVE P3
	PUSHJ	P,@-3(P)	;COROUTINE BACK TO OUR CALLER
	 JRST	NRET3		;NON-SKIP RETURN
	JRST	SRET3		;SKIP RETURN
;.SAVE4 -- COROUTINE TO SAVE P1, P2, P3, AND P4

	ENTRY	.SAVE4

.SAVE4:	PUSH	P,P1		;SAVE P1
	PUSH	P,P2		;SAVE P2
	PUSH	P,P3		;SAVE P3
	PUSH	P,P4		;SAVE P4
	PUSHJ	P,@-4(P)	;COROUTINE BACK TO OUR CALLER
.SAVX4:: JRST	NRET4		;NON-SKIP RETURN
SRET4:	POP	P,P4		;RESTORE P4
SRET3:	POP	P,P3		;RESTORE P3
SRET2:	POP	P,P2		;RESTORE P2
SRET1:	POP	P,P1		;RESTORE P1
	ADJSP	P,-1		;POP OFF NO-LONGER-NEEDED CALLER PC
	JRST	.POPJ1##	;AND PROPAGATE THE CALLER'S SKIP RETURN


;THE NON-SKIP .SAVE? RETURNS

NRET4:	POP	P,P4		;RESTORE P4
NRET3:	POP	P,P3		;RESTORE P3
NRET2:	POP	P,P2		;RESTORE P2
NRET1:	POP	P,P1		;RESTORE P1
	ADJSP	P,-1		;POP OFF NO-LONGER-NEEDED CALLER PC
	POPJ	P,		;AND PROPAGATE THE CALLER'S NON-SKIP RETURN
	SUBTTL	Pxx4T	PUSH/POP the 4 "T" registers

;.PSH4T -- PUSH T1-T4 ONTO STACK
;.POP4T -- POP T1-T4 FROM STACK
;CALL:	PUSHJ	P,.PSH4T/.POP4T
;USES NO ACS

	ENTRY	.PSH4T,	.POP4T

.PSH4T:	PUSH	P,T2		;SAVE T2
	PUSH	P,T3		;SAVE T3
	PUSH	P,T4		;SAVE T4
	EXCH	T1,-3(P)	;SAVE T1/GET RETURN
	PUSH	P,T1		;PUT INTO SAFE PLACE
	MOVE	T1,-4(P)	;RESTORE T1
	POPJ	P,		;RETURN

.POP4T:	POP	P,T1		;GET RETURN
	POP	P,T4		;RESTORE T4
	POP	P,T3		;RESTORE T3
	POP	P,T2		;RESTORE T2
	EXCH	T1,(P)		;RESTORE T1/SAVE RETURN
	POPJ	P,		;RETURN
	SUBTTL	SACIO	Save IO and setup I/O context from T1

;SACIO  --  SAVE AND SETUP IO
;Call is:
;
;	MOVX	T1,<CDB>
;	PUSHJ	P,SACIO
;	RETURN
;
;Register IO will be preserved and setup to point at the I/O CDB address
;in T1. T1 will be automatically restored on return from the current IO
;(he who calls SACIO must not destroy IO!)

	ENTRY	.SACIO

.SACIO:	PUSH	P,IO		;SAVE OLD IO
	MOVE	IO,T1		;SET IO FROM T1
	PUSHJ	P,@-1(P)	;CALL OUR CALLER
	 CAIA			;NON-SKIP RETURN
	AOS	-2(P)		;SKIP RETURN
	MOVE	T1,IO		;RESTORE ORIGINAL T1
	POP	P,IO		;RESTORE IO REGISTER
	POP	P,(P)		;RESTORE STACK (OUR CALLERS ADDRESS)
	POPJ	P,		;RETURN
	SUBTTL	TSAVn	Coroutine to save and restore the "T" registers

;TSAVMN  --  SAVE TEMP ACS T<M> TO T<N>
;Call is:
;
;	PUSHJ	P,TSAVMN
;	RETURN
;
;On return the acs are saved on the stack. The caller may reference
;the saved acs via "-Tn(P)" construction.

	ENTRY	TSAV11,	TSAV12,	TSAV13,	TSAV14

TSAV11:	PUSH	P,T1		;SAVE T1
	PUSHJ	P,@-1(P)	;CALL OUR CALLER
	 CAIA			;RETURN CPOPJ0
	AOS	-2(P)		;RETURN CPOPJ1
	POP	P,T1		;RESTORE T1
	POP	P,(P)		;JUNK ADDRESS
	POPJ	P,		;RETURN FROM CALLER AS INDICATED

TSAV12:	PUSH	P,T2		;SAVE T2
	PUSH	P,T1		;SAVE T1
	PUSHJ	P,@-2(P)	;CALL OUR CALLER
	 CAIA			;RETURN CPOPJ0
	AOS	-3(P)		;RETURN CPOPJ1
	POP	P,T1		;RESTORE T1
	POP	P,T2		;RESTORE T2
	POP	P,(P)		;JUNK ADDRESS
	POPJ	P,		;RETURN FROM CALLER AS INDICATED

TSAV13:	PUSH	P,T3		;SAVE T3
	PUSH	P,T2		;SAVE T2
	PUSH	P,T1		;SAVE T1
	PUSHJ	P,@-3(P)	;CALL OUR CALLER
	 CAIA			;RETURN CPOPJ0
	AOS	-4(P)		;RETURN CPOPJ1
	POP	P,T1		;RESTORE T1
	POP	P,T2		;RESTORE T2
	POP	P,T3		;RESTORE T3
	POP	P,(P)		;JUNK ADDRESS
	POPJ	P,		;RETURN FROM CALLER AS INDICATED

TSAV14:	PUSH	P,T4		;SAVE T4
	PUSH	P,T3		;SAVE T3
	PUSH	P,T2		;SAVE T2
	PUSH	P,T1		;SAVE T1
	PUSHJ	P,@-4(P)	;CALL OUR CALLER
	 CAIA			;RETURN CPOPJ0
	AOS	-5(P)		;RETURN CPOPJ1
	POP	P,T1		;RESTORE T1
	POP	P,T2		;RESTORE T2
	POP	P,T3		;RESTORE T3
	POP	P,T4		;RESTORE T4
	POP	P,(P)		;JUNK ADDRESS
	POPJ	P,		;RETURN FROM CALLER AS INDICATED
	XLIST			;THE LITERALS
	LIT
	LIST

	PRGEND
	TITLE	.POPJ	SWIL .POPJ and .POPJ1 Routines
	SUBTTL

	SEARCH	SWIDEF,	SWIL		;SWIL PACKAGE DEFINITIONS
	SEARCH	JOBDAT,	MACTEN,	UUOSYM	;STANDARD DEFINITIONS

	SALL				;PRETTY LISTINGS
	.DIREC	FLBLST			;PRETTIER LISTINGS

	TWOSEG	400000

;COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1984,1986.  ALL RIGHTS RESERVED.

	COMMENT	\

COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1984,1986.  ALL RIGHTS RESERVED.


THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED
ONLY  IN  ACCORDANCE  WITH  THE  TERMS  OF  SUCH LICENSE AND WITH THE
INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE OR ANY  OTHER
COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF THE  SOFTWARE  IS  HEREBY
TRANSFERRED.

THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT  NOTICE
AND  SHOULD  NOT  BE  CONSTRUED  AS A COMMITMENT BY DIGITAL EQUIPMENT
CORPORATION.

DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY  OF  ITS
SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.

\
	SUBTTL	.POPJ	Standard .POPJ and .POPJ1 Exits

	ENTRY	.POPJ,	.POPJ1

.POPJ1:	AOS	(P)		;INCREMENT PC			[521]
.POPJ:	POPJ	P,		;RETURN
	END