Trailing-Edge
-
PDP-10 Archives
-
cuspmar86binsrc_2of2_bb-fp63a-sb
-
10,7/helper/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 %7E(55)
SUBTTL A.W.LYONS/AWL/PFC/BPK/LCR/PY 9-Aug-85
;COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1971,1981,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.
VERSION==7 ; MAJOR VERSION NO
VMINOR==5 ; MINOR VERSION NO
EDITNO==55 ; 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
53 SPR 10-34975 DRB 29-Jan-85
Use non-privileged FILOP.s to lookup the help file (unless [1,2])
so that we don't accidentally read something we shouldn't should
we be running with JACCT.
54 None BAH 9-Aug-85
Do copyrights.
55 SPR 10-35295 DRB 26-Sep-85
.RBCNT is being setup one too large.
%7E(54) AUG, 1985
*** 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 eighteen locations (ten in -20 native mode) on
the push-down list on which to store and from which to
restore user AC'S and use as FILOP. argument blocks. 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,1986. ALL RIGHTS RESERVED.
\; END COPYRIGHT MACRO
.ECOPY
IFE TOPS20,<
TWOSEG
RELOC 400000>
PAGE
SUBTTL TOPS-10 HELPER CODE
IFE TOPS20,< ;START -10 NATIVE HELPER
STKALC==1+<<.BFCTR+1>+<.FOLEB+1>+<.RBEXT+1>> ;[53] NUMBER OF STACK WORDS TO ZERO
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
MOVEI T3,STKALC ;[53] GET THE NUMBER OF STACK LOCS WE WANT
PUSH P,T2 ;[53] GET A ZEROED LOCATION
SOJG T3,.-1 ;[53] LOOP FOR ALL WE NEED
MOVEI T4,-<STKALC-1>(P) ;[53] POINT AT OUR FILOP. BLOCK
MOVX T3,%LDFFA ;[53] THEN, ASK THE MONITOR
GETTAB T3, ;[53] WHO FULL FILE ACCESS IS
MOVE T3,[1,,2] ;[53] THIS SHOULDN'T HAPPEN
GETPPN T2, ;[53] GET OUR PPN
JFCL ;[53] THIS REALLY COULD HAPPEN
CAME T2,T3 ;[53] ARE WE ALLOWED LOTS OF ACCESS?
SKIPA T2,[DSK,,.FORED] ;[53] NO, DON'T TRY FOR PRIVED READ
MOVE T2,[FO.PRV!<DSK,,.FORED>] ;[53] YES, TURN ALL OUR PRIVS ON
MOVEM T2,.FOFNC(T4) ;[53] STORE THE FUNCTION WORD
MOVX T2,.IOASC ;[53] GET THE I/O MODE
MOVEM T2,.FOIOS(T4) ;[53] STORE IN THE FILOP. BLOCK
HRRZI T2,-2(P) ;[53] POINT AT THE INPUT BUFFER HEADER
MOVEM T2,.FOBRH(T4) ;[53] STORE IT
HRRZI T2,1 ;[53] GET ONE BUFFER FOR INPUT
MOVEM T2,.FONBF(T4) ;[53] STORE IN THE FILOP. BLOCK
MOVEI T3,.FOLEB+1(T4) ;[53] POINT AT THE LOOKUP BLOCK
MOVEM T3,.FOLEB(T4) ;[53] STORE IN THE FILOP. BLOCK
MOVX T2,.RBEXT ;[53,55] GET THE LENGTH OF THE LOOKUP BLOCK
MOVEM T2,.RBCNT(T3) ;[53] STORE THE LENGTH
SETZM .RBPPN(T3) ;[53] DEFAULT THE PPN
MOVEM T1,.RBNAM(T3) ;[53] STORE THE FILENAME
HRLZI T2,'HLP' ;[53] GET THE EXTENSION
MOVEM T2,.RBEXT(T3) ;[53] STORE IT
GETHLP: SKIPA T3,['HLP '] ;GET HLP:
GETSYS: MOVSI T3,'SYS' ;OR GET SYS:
MOVEM T3,.FODEV(T4) ;[53] STORE THE DEVICE NAME
MOVE T2,T4 ;[53] COPY THE FILOP. BLOCK POINTER
HRLI T2,.FOLEB+1 ;[53] GET THE LENGTH OF THE FILOP. BLOCK
FILOP. T2, ;[53] TRY FOR THE FILE
SKIPA ;[53] CAN'T GET IT - SEE WHY NOT
JRST MORE ;GOOD--GO READ FILE
CAIE T2,ERSNF% ;SFD NOT FOUND?
CAIN T2,ERSLE% ;SEARCH LIST EMPTY?
JRST AGAIN ;ONE OF THE ABOVE
CAIN T2,ERNSD% ;[53] NO SUCH DEVICE?
JRST AGAIN ;[53] YES, TRY ANOTHER
CAILE T2,ERIPP% ;INCORRECT PPN OR FILE NOT FOUND?
JRST SORRY ;HORRIBLE DISK ERROR
AGAIN: MOVX T2,.IOASC ;[53] CLEAR PHYSICAL BIT
AOS T3,-3(P) ;TRY NEXT CASE
TRNE T3,1 ;SEE IF ODD
TXO T2,UU.PHS ;YES--TRY PHYSICAL ONLY
MOVEM T2,.FOIOS(T4) ;[53] STORE THE NEW I/O MODE WORD
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,[STKALC,,STKALC] ;[53] 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