Google
 

Trailing-Edge - PDP-10 Archives - SRI_NIC_PERM_SRC_1_19910112 - 6-sources/helper.mac
There are 58 other files named helper.mac in the archive. Click here to see a list.
TITLE .HELPR	SUBROUTINE TO OUTPUT SYS:??????.HLP  %7D(52)
SUBTTL	A.W.LYONS/AWL/PFC/BPK/LCR/PY	8-Jan-82


;***COPYRIGHT 1971,1981,1984 DIGITAL EQUIPMENT CORP., MAYNARD,MASS.***

;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.

VERSION==7			; MAJOR VERSION NO
VMINOR==4			; MINOR VERSION NO
EDITNO==52			; EDIT NUMBER
VWHO==0				; WHO LAST EDITED

%HELPR==:BYTE(3)VWHO(9)VERSION(6)VMINOR(18)EDITNO	; SET HELPER VERSION #
	PAGE

	COMMENT	~

REVISION HISTORY


%4(35) JAN 1972

36	(10-9713) Handle sequenced files and I/O errors
37	(10-11567) Handle HLP:
40	Add alternate entry 'HELPER' for FORTRAN/COBOL
41	Expand sorry message

%5(41) Dec, 73
42			BPK
	JSYSize HELPER and other assorted sundries.

43			BPK
	Create label HLPVER to store helper version instead
	of using .JBVER
44			BPK
	Search universal HLP20 for definition of TOPS20

45			BPK
	Implement new JSYS convention (ie. jsys%)

46			BPK
	Replace HLPVER with %HELPR and make it accessible
	to LINK.

47			PY	18-Aug-81
	Change the version number to match SCAN and WILD. Remove
	the reference to HLPR20, use an IFNDEF to default TOPS-10
	version. Change to more informative edit history style.

50			LCR
	If HLP: does not exist, try SYS: before giving error
	message. Note: This edit was originally installed as
	edit 42 in 1974.

51			LCR
	Use monitor supplied /MESSAGE setting. Note: This edit
	was installed as edit 43 in 1974.

52			PY	6-Oct-81
	Re-install the previous two edits, which were lost about
	eight years ago. Also change edit history format retroactive
	to start of this version, and indicate edit level and date
	last version was shipped.

%7D(52) JAN, 1982

*** END REVISION HISTORY
	~
	PAGE

	COMMENT	~

HELPER is a subroutine used to output help texts(HLP:/SYS:??????.HLP)
onto device TTY.  It was designed as a tool for the various
modules of the MULTI-PROGRAMMING-BATCH project.

Entered with the sixbit module name in AC1 via:

	PUSHJ	P,.HELPR
	return to here at end of HELPER

or	MOVEI	16,[,,['module']]
	PUSHJ	17,HELPER

HELPER requires eight locations (ten in -20 native mode) on
the push-down list on which to store and from which to
restore user AC'S.  In -20 mode these locations are also used
for the text buffer during I/O.
	~

PAGE
SUBTTL	ASSIGNMENTS
;ACCUMULATORS

T1=1	;AC1
T2=2	;AC2
T3=3	;AC3
T4=4	;AC4
T5=5	;AC5
AP=16	;ARG LIST POINTER
P=17	;STACK POINTER

;DEVICE CHANNELS

DSK=0

ENTRY	.HELPR,HELPER

SALL

IFNDEF	TOPS20,<TOPS20==0>	;[47] DEFAULT TO TOPS-10 STYLE

IFE TOPS20,<SEARCH MACTEN,UUOSYM> ; GET -10 MONITOR SYMBOLS
IFN TOPS20,<SEARCH MACSYM,MONSYM> ; GET -20 MONITOR SYMBOLS


.BCOPY
COPYRIGHT (C) DIGITAL EQUIPMENT CORPORATION 1971,1984.
.ECOPY

IFE TOPS20,<
	TWOSEG
	RELOC	400000>

	PAGE
SUBTTL	TOPS-10 HELPER CODE
IFE TOPS20,<			;START -10 NATIVE HELPER

HELPER:	MOVE	T1,@(AP)	;FETCH FIRST ARG

.HELPR:	PUSH	P,T2		;SAVE ACS THAT ARE USED
	PUSH	P,T3
	PUSH	P,T4
	PUSH	P,.JBFF		;SAVE .JBFF
	MOVE	T2,.JBREL	;GET ACTUAL CORE SIZE
	HRLM	T2,(P)		;SAVE FOR RESTORATION
	SETZ	T2,		;TO LOAD BUFFER HEADER INTO PDL
	PUSH	P,T2		; LOAD UP 4 ZEROED LOCATIONS
	PUSH	P,T2
	PUSH	P,T2
	PUSH	P,T2

GETHLP:	SKIPA	T3,['HLP   ']	;GET HLP:
GETSYS:	MOVSI	T3,'SYS'	;OR GET SYS:
	HRRZI	T4,-2(P)	;ADDRESS OF INPUT BUFFER
	OPEN	DSK,T2		;OPEN THE DEVICE CHANNEL
	  JRST	AGAIN		;[50] LOSE...
	MOVSI	T2,'HLP'	;EXTENSION (FILE NAME IN T1)
	SETZB	T3,T4
	LOOKUP	DSK,T1		;LOOKUP 'MODULE'.HLP
	  TLZA	T2,-1		;CLEAR JUNK, WE BLEW IT
	JRST	MORE		;GOOD--GO READ FILE
	CAIE	T2,ERSNF%	;SFD NOT FOUND?
	CAIN	T2,ERSLE%	;SEARCH LIST EMPTY?
	JRST	AGAIN		;ONE OF THE ABOVE
	CAILE	T2,ERIPP%	;INCORRECT PPN OR FILE NOT FOUND?
	JRST	SORRY		;HORRIBLE DISK ERROR
AGAIN:	SETZM	T2		;CLEAR PHYSICAL BIT
	AOS	T3,-3(P)	;TRY NEXT CASE
	TRNE	T3,1		;SEE IF ODD
	TXO	T2,UU.PHS	;YES--TRY PHYSICAL ONLY
	JRST	@[GETHLP	;TRY HLP: AGAIN
		  GETSYS	;THEN LOGICAL SYS:
		  GETSYS	;THEN PHYSICAL SYS:
		  SORRY]-1(T3)	;THEN GIVE UP

MORE:	IN	DSK,		;GET A BUFFER
	  JRST	GETCHR		;OUTPUT THE STUFF
	STATZ	DSK,IO.ERR	;SEE IF ERRORS
	  JRST	IOERR		;YES--ISSUE MESSAGE
	STATZ	DSK,IO.EOF	; YET?
	  JRST	DONE		;YES, ALL DONE!

GETCHR:	SOSGE	T2,(P)		;
	JRST	MORE
	IBP	-1(P)		;INCR CHAR POINTER
	MOVE	T1,@-1(P)	;GET THIS WORD
	TRNE	T1,1		;SEE IF SEQUENCE NUMBER
	JRST	[AOS   -1(P)	;YES--SKIP 5 MORE CHARS
		 MOVNI T1,5	; ..
		 ADDM  T1,(P)	; ..
		 JRST  GETCHR]
	LDB	T1,-1(P)
	OUTCHR	T1
	JRST	GETCHR

IOERR:	PJSP	T1,HLRERR	;[51] ISSUE ERROR
	ASCIZ	/IOE/		;[51]
	ASCIZ	\ I/O error reading help file\ ;[51]
 
SORRY:	PJSP	T1,HLRERR	;[51] ISSUE ERROR
	ASCIZ	/NHF/		;[51]
	ASCIZ / No .HLP file on SYS:/ ;[51]
 
HLRERR:	OUTSTR	[ASCIZ /%/]	;[51] ISSUE WARNING
	GTMSG.	T2		;[51] GET /MESSAGE LEVEL
	TXNE	T2,JW.WPR	;[51] SEE IF PREFIX
	OUTSTR	[ASCIZ /HLR/]	;[51] YES--INDICATE FROM HELPER
	TXNE	T2,JW.WPR	;[51] SEE IF PREFIX
	OUTSTR	(T1)		;[51] YES--GIVE ACTUAL MESSAGE PREFIX
	TXNN	T2,JW.WFL	;[51] SEE IF FIRST
	JRST	DONE		;[51] NO--SKIP TEXT
	OUTSTR	1(T1)		;[51] YES--ISSUE MESSAGE
	OUTSTR	[ASCIZ/; I'm sorry, I can't help you/]

DONE:	OUTSTR	[ASCIZ/
/]
	RELEAS	DSK,
	SUB	P,[4,,4]	;RESTORE PDL
	POP	P,T1		;RETRIEVE .JBFF IN "T1"
	HRRZM	T1,.JBFF	;RESTORE .JBFF
	HLRZ	T1,T1		;RETRIEVE .JBCOR
	CORE	T1,
	  JFCL			;IGNORE ERROR
	POP	P,T4
	POP	P,T3
	POP	P,T2
	POPJ	P,		;RETURN TO CALLER

	XLIST		;LITERALS
	LIT
	LIST
	RELOC
	>			;END OF -10 NATIVE HELPER

	PAGE
SUBTTL	TOPS-20 HELPER CODE
IFN TOPS20,<			; START -20 NATIVE HELPER

HELPER:	MOVE	T1,@(AP)	; FETCH FIRST ARG

.HELPR:	PUSH	P,T2		; SAVE ACS
	PUSH	P,T3
	PUSH	P,T4
	PUSH	P,T5
	MOVEI	T5,6		; MAX NUMBER OF CHARS IN FILE NAME
	MOVE	T2,[POINT 6,T1]	; POINTER TO SIXBIT FILE NAME
	MOVE	T3,[POINT 7,FILENM]	; POINTER TO ASCII DESTINATION
GETASC:	ILDB	T4,T2		; GET A SIXBIT CHAR.
	ADDI	T4,40		; MAKE IT ASCII
	IDPB	T4,T3		; AND PUT IT IN THE ASCII BUFFER
	SOJG	T5,GETASC	; DO IT TILL ALL ARE DONE
	SETZ	T4,
	IDPB	T4,T3		; PUT IN A ZERO BYTE
	SETZB	T2,T3		; ZERO THESE ACS
	PUSH	P,T2		; WE WILL USE THESE 6 WORDS ON THE
	PUSH	P,T2		; STACK AS THE BUFFER TO CONSERVE
	PUSH	P,T2		; SPACE (THIS DOES NOT CHANGE SPECS.)
	PUSH	P,T2
	PUSH	P,T2
	PUSH	P,T2
	MOVX	T4,GJ%OLD	; JUST AN EXISTING FILE
	MOVEM	T4,GTJBLK	; PUT IT IN THE GTJFN BLOCK
	MOVEI	T3,4		; NUMBER OF ATTEMPTS AT FINDING FILE
GETHLP:	MOVE	T4,[POINT 7,[ASCIZ/HLP:/]] ; GET THE HLP: POINTER
	MOVEM	T4,GTJBLK+2	; PUT IT IN THE GTJFN BLOCK
	JRST	GETIT
GETSYS:	MOVE	T4,[POINT 7,[ASCIZ/SYS:/]] ; GET THE SYS: POINTER
	MOVEM	T4,GTJBLK+2	; PUT IT IN THE GTJFN BLOCK
GETIT:	HRROI	T2,FILENM	; GET POINTER TO MODULE NAME IN T2
	MOVEI	T1,GTJBLK	; LONG FORM GTJFN BLOCK
	GTJFN%			;[45] GET THE FILE
	JRST	AGAIN		; LOSE TEMPORARILY
	HRRM	T1,JFN		; SAVE THE JFN
	MOVE	T2,[FLD(7,OF%BSZ)!OF%RD] ; BYTE SIZE OF 7 AND READ ONLY
	OPENF%			;[45] OPEN THE FILE FOR READ ACCESS
	JRST	IOERR		; SOMETHING WEIRD HAPPENED

PRINT:	MOVE	T1,JFN		; GET JFN
	HRROI	T2,-5(P)	; POINTER FOR TEXT BUFFER
	MOVEI	T3,^D25		; HELP TEXT BUFFER SIZE * 5
	SIN%			;[45] GET 5 WORDS
	ERJMP	DONE		; DON'T CARE ABOUT THIS ERROR
	SETZ	T1,		; NEED A ZERO BYTE
	IDPB	T1,T2		; MAKE SURE ZERO THE LAST BYTE
	HRROI	T1,-5(P)
	PSOUT%			;[45] OUTPUT ASCIZ STRING
	JRST	PRINT		; IF THERE'S MORE, GO GET IT

AGAIN:	MOVE	T4,GTJBLK	; GET THE FLAGS
	TXOE	T4,GJ%PHY	; TURN ON PHYSICAL DEVICE BIT
	TXZ	T4,GJ%PHY	; CLEAR PHYSICAL BIT
	MOVEM	T4,GTJBLK	; PUT IT BACK IN GTJFN BLOCK
	SOJLE	T3,SORRY	; SEE IF ANY DEVICES LEFT
	CAIG	T3,2		; TIME TO TRY SYS:?
	JRST	GETSYS		; YES, USE SYS:
	JRST	GETHLP		; NO, USE HLP:

DONE:	SETZ	T1,		; NEED A ZERO BYTE
	IDPB	T1,T2		; MAKE SURE ZERO THE LAST BYTE
	HRROI	T1,-5(P)
	PSOUT%			;[45] OUTPUT ASCIZ STRING
	HRROI	T1,CRLF		; OUTPUT CRLF
	PSOUT%			;[45]
	MOVE	T1,JFN
	CLOSF%			;[45] GET RID OF THE JFN
	JFCL			; NOT LIKELY
LEAVE:	SUB	P,[6,,6]	; FIX UP STACK POINTER
	POP	P,T5		; RESTORE ACS
	POP	P,T4
	POP	P,T3
	POP	P,T2
	POPJ	P,		; AND RETURN TO CALLER

IOERR:	HRROI	T1,[ASCIZ/%HLREOH Error opening help file/]
	PSOUT%			;[45]
	MOVE	T1,JFN		; WE STILL HAVE TO RELEASE THE JFN
	CLOSF%			;[45]
	JFCL			; NOT LIKELY
	JRST	SORRYX		; FINISH WITH SORRY MESSAGE
SORRY:	HRROI	T1,[ASCIZ/%HLRNHF No .HLP file on SYS:/]
	PSOUT%			;[45]
SORRYX:	HRROI	T1,[ASCIZ/; I'm sorry I can't help you/]	
	PSOUT%			;[45]
	HRROI	T1,CRLF
	PSOUT%			;[45]
	JRST	LEAVE		; WE FAILED, BUT NOTHING ELSE TO DO

CRLF:	ASCIZ	/
/
FILENM:	BLOCK	2
JFN:	0
GTJBLK: 0			; FLAGS
	.NULIO,,.NULIO
	POINT	7,[ASCIZ/HLP:/]	; POINTER TO DEVICE
	0
	0
	POINT	7,[ASCIZ/HLP/]	; POINTER TO EXTENSION
	0
	0
	0

	XLIST		;LITERALS
	LIT
	LIST
	>			; END OF -20 NATIVE HELPER

	END