Trailing-Edge
-
PDP-10 Archives
-
bb-d549g-sb
-
help.mac
There are 10 other files named help.mac in the archive. Click here to see a list.
TITLE HELP %6(72) CUSP TO TYPE OUT HELPFUL DOCUMENTATION.
SUBTTL MLB(ADR)/PFC/DIB/RDH 29-DEC-78
;COPYRIGHT (C) 1972,1974,1978,1979 BY
;DIGITAL EQUIPMENT CORPORATION, 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.
; FOR OPERATING INSTRUCTIONS READ HELP.HLP. THERE ARE NO SPECIAL
; COMPILE, LOAD OR SAVE INSTRUCTIONS.
; A NULL FILENAME IS CONSIDERED TO BE HELP.HLP BY DEFAULT.
; HELP *, LISTS ALL *.HLP FILES WHICH COULD BE LISTED BY HELP FOO.
SEARCH JOBDAT,MACTEN,UUOSYM ;GET SYMBOLS NEEDED
; COLS IS NUMBER OF COLUMNS / LINE WHEN LISTING HELP *
; DEFAULT COLS==^D8
ND COLS,^D8
VWHO==0 ;WHO LAST EDITTED
VERSIN==6 ;VERSION NUMBER
VPATCH==0 ;VERSION LETTER
VEDIT==72 ;EDIT NUMBER
;NONE OF THE FOLLOWING ACS ARELOCATION DEPENDENT,
; THEY CAN BE MOVED TO ANY POSITION IF NECESSARY.
F=0
T=1
T1=T+1
T2=T1+1
T3=T2+1
CH=5 ; CONTAINS CURRENT CHARACTER
EOL=6 ; -1 IF END OF LINE SEEN. 0 OTHERWISE
STS=7 ; LAST GETSTS INFO.
D=10 ; COUNTS # OF NAMES PER LINE (COLUMN ROUTINE)
;11-16 ARE FREE; NOTE THAT 11-14 ARE USED IN NEW SORT ROUTINE
P=17
;I/O CHANNELS
DSK==1
TTY==2
FIL==3
PDLSIZ==10 ;LENGTH OF PUSH DOWN LIST
TWOSEG
LOC 137
BYTE (3)VWHO (9)VERSIN (6)VPATCH (18)VEDIT
RELOC 400000
;REVISION HISTORY
;%3(34) RELEASED FEB, 1972
;35 REMOVE SPECIAL TEST FOR 175 (ALTMODE)
;36 CORRECT ERROR IN PRINTING "ILLEGAL CHAR" MESSAGE
;37 USE JOBSTS TO DETERMINE IF LOGGED IN
;40 SKIP REST OF COMMAND ON COMMAND ERRORS
;41 USE DEFAULT NUMBER OF DISK BUFFERS
;42 ADD EXPLICIT DEVICE ALLOWED
;43 HANDLE HLP:,NEW:,OLD:
;44 ADD MONITOR COMMANDS TO HELP *
;45 FIX BUG WHICH OCCASIONALLY INCLUDED ONE JUNK LINE IN HELP *
;46 ONLY LIST IN HELP * THOSE FILES WHOSE PROT. CODE ALLOWS THEM
; TO BE PRINTED.
;47 HANDLE PHYSICAL UUOS IN HELP * SO THE LIST INCLUDES ALL THOSE
; FILES WHICH CAN BE LISTED.
;50 TRANSLATE COMMON WORDS, EG "HELP ME" TO "HELP HELP".
;51 CHANGE TO 8 COLS PER LINE INSTEAD OF 6
;52 REMOVE LOOKUPS INTRODUCED BY 46 UNTIL CHANCE TO CODE
; HISTORY TO MAKE SPEED ACCEPTABLE.
;53 MAKE REENTRANT
;54 EXTEND 43 TO HANDLE SYS: CORRECTLY IF /NEW ON HELP *.
;%4(54) RELEASED DEC, 1972
;55 (10-11623) HANDLE LISTS OF ONE ELEMENT
;56 REMOVE SPACE C.RET. IN SOURCE FILE ON PAGE 1
;57 (10-9710) DISCARD SEQUENCE NUMBERS IN HELP FILES
;60 ADD TTY COMMANDS TO MONITOR COMMAND LISTS
;61 ADD WATCH COMMANDS TO MONITOR COMMAND LISTS
;62 SUPPORT RUN HELP (...) STYLE COMMAND AND COMMENTS
;63 SUPPORT ERROR MESSAGE STANDARD
;64 DON'T PRINT JUNK CHARS FOR NEW 5 LETTER COMMAND AND SET TABLES
;65 CHANGE TO USE UUOSYM SYMBOLS
;66 (QARS 10-02478, 10-02495) ACCEPT ONLY DISK AS USER DEVICE.
;67 (QAR 10-02502) DONT TYPE PROTECTED FILES IF NOT LOGGED IN
;%5(67) RELEASED ???
;70 FASTER SORTING, USE TTY WIDTH, TYPE TERMINAL TYPES TABLE
;71 USE .GTIDX TABLE TO LIST CUSTOMER GETTAB VALUES ALSO
;72 TYPE 6-CHARACTER COMMAND NAMES AGAIN
;%6(72) RELEASED ???
HELP: JFCL ;DEFEND AGAINST CCL CALL
RESET
RESCAN
SETZB EOL,FWAZER
MOVE T,[FWAZER,,FWAZER+1]
BLT T,LWAZER
MOVE P,[IOWD PDLSIZ,PDL]
PJOB T, ;[67]GET MY JOB NUMBER
MOVNS T ;[67]NEGATE FOR JOBSTS
JOBSTS T, ;[67]GET STATUS
SETO T, ;[67]ASSUME YES
TLNE T,(JB.ULI) ;[67]SEE IF LOGGED IN
SETOM LOGIN ;[67]YES--FLAG
HELP0: PUSHJ P,CHAR ;SKIP UP TO FIRST ATOM
JRST DEFAULT ; SHOULDN'T SEE EOL UNTIL AFTER FIRST ATOM
JRST HELP0 ; OVER ANY SPACES,TABS, OR COMMAS
MOVE T,CH ;SAVE FOR LATER TEST [62]
HELP1: PUSHJ P,CHAR ;SKIP PAST FIRST ATOM
JRST DEFAULT ; NO FILNAME.
JRST HELP1X ;SPACE--GO SEE IF HELP [62]
CAIN CH,"(" ;SEE IF START OF ARGUMENT [62]
JRST HELP2 ;YES--GO GET IT [62]
CAIN CH,":" ;SEE IF DEVICE BEFORE NAME [62]
JRST HELP0 ;YES--START OVER [62]
JRST HELP1
HELP1X: TRZ T,40 ;FORCE SAVE TO UC [62]
CAIN T,"H" ;SEE IF "HELP" [62]
JRST HELP2 ;YES--PROCEED [62]
HELP1Y: PUSHJ P,CHAR ;NO--SKIP TO PAREN [62]
JRST DEFAULT ;IF EOL, DEFAULT [62]
JRST HELP1Y ;IF SPACE, LOOP ON [62]
CAIE CH,"(" ;SEE IF PAREN [62]
JRST HELP1Y ;NO--LOOP ON [62]
HELP2: PUSHJ P,CHAR ;AND UP TO THE SECOND ATOM.
JRST DEFAULT
JRST HELP2
CAIN CH,"(" ;SEE IF PAREN [62]
JRST HELP2 ;YES--IGNORE [62]
CAIN CH,")" ;SEE IF END OF ARG [62]
JRST DEFAULT ;YES--DEFAULT [62]
SETZM FILNAM ;CLEAR FILNAME
MOVE T,[POINT 6,FILNAM]
MOVEI T1,6 ;ONLY LOOK AT NEXT 6 CHARS.
JRST HELP4
HELP3: PUSHJ P,CHAR ;GET A CHAR.
JRST DONE ;EOL RETURN.
JRST DONE ;SPACE,TAB,OR COMMA RET
HELP4: CAIN CH,"*" ;IS CHAR A *
JRST SEARCH ;USER TYPED *--WANTS LIST OF ALL INFO
CAIN CH,":" ;SEE IF DEVICE
JRST GETDEV ;YES--STORE IT AWAY
CAIN CH,")" ;SEE IF CLOS PAREN [62]
JRST DONE ;YES--ALL DONE [62]
CAIL CH,"A"+40 ;LOWER CASE
CAILE CH,"Z"+40 ;ALPHABETIC
SKIPA ;NO.
TRZ CH,40 ;YES MAKE IT UPPER CASE.
CAIL CH,"A" ;IS IT A-Z?
CAILE CH,"Z"
SKIPA
JRST OK
CAIL CH,"0"
CAILE CH,"9" ;IS IT 0-9?
JRST E$$ILC ;NOPE--HE LOOSES
OK: SUBI CH,40 ;MAKE TO SIXBIT
SOJL T1,HELP3
IDPB CH,T
JRST HELP3
GETDEV: SKIPN DEVICE ;SEE IF ALREADY A DEVICE
SKIPN T,FILNAM ;OR NO NAME
JRST E$$IDS ;YES--ERROR
MOVEM T,DEVICE ;OK--STORE AS DEVICE
JRST HELP2 ;LOOP FOR MORE
;USER JUST TYPED HELP, PRETEND HE TYPED HELP HELP
DEFAULT:
MOVE T,[SIXBIT/HELP/]
MOVEM T,FILNAM
;READ TO END OF LINE, IF NOT ALREADY THERE
;INIT DSK FOR ASCII INPUT
;LOOKUP INFO
;INIT TTY FOR OUTPUT
;OUTPUT INFO TO TTY
DONE: PUSHJ P,CHAR ;NOPE.
JRST DONE03 ;EOL SEEN.
JRST DONE ; GO LOOK FOR IT.
JRST DONE ;KEEP LOOKING.
DONE03: MOVE T1,DEVICE ;[66] GET DEVICE TYPE
DEVTYP T1, ;[66]
JRST DONE3A ;[66] ERROR--ASSUME IT'S ALL RIGHT
ANDI T1,77 ;[66]ISOLATE DEVICE TYPE
CAIE T1,.TYDSK ;[66]IS IT A DISK?
JRST E$$IDS ;[66]NO, BOMB THE USER OFF
DONE3A: PUSHJ P,SETDEV ;OK--INITIALIZE FOR DEVICE
DONE05: MOVEI T,0 ;SET ASCII MODE
SKIPN T1,DEVICE ;SEE IF USER DEVICE
MOVE T1,(D) ;SET DEVICE
JUMPE T1,NOINF ;NO-INFO IF NOT FOUND
MOVEI T2,IBUF ;POINT TO BUFFER HEADERS
DONE07: OPEN DSK,T ;TRY TO OPEN
JRST NODEV ;SOMEONE MUST BE KIDDING
MOVSI T3,(SIXBIT/HLP/) ;EXTENSION IS .HLP
MOVEM T3,FILNAM+1 ;NOTHING ELSE IS POSSIBLE
SETZM FILNAM+2 ;CLEAR RESULTS
SETZM FILNAM+3 ;AND DIRECTORY
LOOKUP DSK,FILNAM ;LOOKUP FILE
JRST DONE7
SKIPE LOGIN ;[67]SEE IF LOGGED IN
JRST LOOKNC ;[67]YES--NO CHECKS
LDB T3,[POINT 3,FILNAM+2,8];[67]GET WORLD PROTECTION
CAILE T3,5 ;[67]CAN WE READ?
JRST DONE7 ;[67]NO
LOOKNC: INBUF DSK,0 ;[67]SETUP BUFFERS
PUSHJ P,TTYINI ;INIT TTY
PUSHJ P,CRLF ;SKIP A LINE
DONE1: PUSHJ P,INR ;GET A CHAR
JRST EXITL ;NO MORE CHARS.
PUSHJ P,OUTR ;OUTPUT CHAR.
JRST DONE1 ;GO DO IT AGAIN
DONE7: TLON T,(UU.PHS) ;SET PHYSICAL AND TRY AGAIN
JRST DONE07 ;LOOP BACK ONCE
SKIPE DEVICE ;SEE IF USER DEVICE
JRST NOINF ;ELSE, COMPLAIN
NODEV: SKIPE DEVICE ;SEE IF USER DEVICE
JRST E$$COI ;ERROR IF SO
AOJA D,DONE05 ;ELSE, TRY NEXT IN LIST
;HERE WHEN CAN NOT FIND ANYPLACE--TRY TRANSLATION
NOINF: SKIPE T,OLDNAM ;SEE IF ALREADY HERE ONCE
JRST [MOVEM T,FILNAM ;YES--RESTORE ARGUMENT
JRST E$$NIO] ;AND GIVE ERROR
MOVE T,[-TNAML,,TNAM-1]
MOVE T1,FILNAM ;GET MATCH
MOVEM T1,OLDNAM ;SAVE FOR LATER
NOINFL: AOS T ;SKIP VALUE
CAME T1,(T) ;SEE IF MATCH
AOBJN T,NOINFL ;NO--LOOP
JUMPGE T,E$$NIO ;DONE--SEE IF MATCHED
MOVE T,1(T) ;YES--GET VALUE
MOVEM T,FILNAM ;CHANGE ARGUMENT
JRST DONE03 ;AND GO DO IT AGAIN
;TABLE OF PAIRS TO TRANSLATE FROM X TO Y
DEFINE TRANS(X,Y),<XLIST
EXP <SIXBIT \X\>
EXP <SIXBIT \Y\>
LIST>
TNAM:
TRANS US,HELP
TRANS ME,HELP
TNAML==.-TNAM
;CHAR--GETS NEXT CHAR FROM TTY INPUT BUFFER
; IF END OF LINE SEEN SETS EOL TO -1
;CALL: PUSHJ P,CHAR
; EOL RETURN
; SPACE,COMMA,OR TAB RETURN
; OTHER CHARACTER RETURN
CHAR: JUMPL EOL,CHAR2 ;RETURN IF DONE
INCHSL CH ;GET A CHAR FROM TTY
JRST CHAR2 ; IF NO CHARS LEFT CONSIDER IT EOL.
JUMPE CH,CHAR ;IGNORE NULL [62]
CAIE CH,177 ;IGNORE DELETE [62]
CAIN CH,15 ;IGNORE C.RET. [62]
JRST CHAR ; .. [62]
ANDI CH,177 ;MAKE SURE IT LOOKS LIKE CHAR
AOS 0(P) ;INCR RETURN ADDR
AOS 0(P) ;TWICE
CAIN CH," " ;IS CHAR A SPACE?
SOS 0(P) ;YES. DECR RETURN ADDR.
CAIE CH," " ;IS CHAR A TAB?
CAIN CH,"," ;MAYBE ITS A COMMA?
SOS 0(P) ;DECR RET ADDR IF SO.
CAIE CH,";" ;SEE IF COMMENT [62]
CAIN CH,"!" ; OR NEW STYLE [62]
JRST CHAR3 ;YES--GO SKIP COMMENT [62]
CAIN CH,33
JRST CHAR1 ;YES.
CAIG CH,14 ;IS IT VT,FF,OR LF? [62]
CAIGE CH,12
POPJ P, ;NO.
CHAR1: SOS 0(P) ;YES. DECR RETURN ADDR
SOS 0(P) ;TWICE
CHAR2: SETOI EOL, ;SET EOL TO -1
POPJ P, ;AND GO AWAY.
;HERE IF COMMENT SEEN
CHAR3: INCHSL CH ;GET NEXT CHAR [62]
JRST CHAR1 ;ALL DONE [62]
CAIN CH,33 ;SEE IF ESCAPE [62]
JRST CHAR1 ;YES--END [62]
CAIG CH,14 ;SEE IF VT, [62]
CAIGE CH,12 ; FF, OR LF? [62]
JRST CHAR3 ;NO--LOOP [62]
JRST CHAR1 ;YES--DONE [62]
;SETDEV--INITIALIZES TO CORRECT DEFAULT LIST OF HELP DEVICES
;RETURNS WITH D POINTING TO LIST ENDED BY 0
SETDEV: MOVEI D,NOTNEW ;PRESET TO ANSWER IF NOT /NEW
MOVE T,[2,,T1] ;SETUP INVESTIGATION
MOVE T1,[.PTFRL] ;READ DEFAULT PATH
MOVEI T2,0
PATH. T,
POPJ P, ;IF NOT IMPLEMENTED, RETURN DEFAULT
TRNE T2,PT.NEW ;SEE IF /NEW
MOVEI D,YESNEW ;YES--SET ALTERNATE LIST
POPJ P, ;AND RETURN
;IN--READS BYTE OF INPUT FROM DSK, BYTE SIZE DEPENDS ON
; MODE DISK INITED IN, FOR *.HLP FILE 7 BIT ASCII, FOR
; TXTDIR.UFD FILE 36 BIT BINARY.
;
;CALL PUSHJ P,INR
; EOF RETURN
; NORMAL RETURN
; BYTE IS RETURNED IN CH.
; THERE IS NO RETURN ON AN ERROR.
INR: SOSGE IBUF+2 ;ANY CHARS LEFT IN BUFFER
JRST IN1 ;NOPE.
MOVE CH,IBUF+1 ;GET BYTE POINTER [57]
TLNN CH,(70B11) ;SEE IF BINARY [57]
JRST IN2 ;NO--GO LOOK FOR SEQ NUMBS [57]
ILDB CH,IBUF+1 ;YES--GO GET IT
IN0: AOS (P) ;AND INCR RET ADDR
POPJ P, ;RETURN.
IN1: IN DSK, ;GET NEW BUFFER.
JRST INR ;GO BACK, GET CHAR
GETSTS DSK,STS ;SOMETHING GOOFED--FIND OUT WHAT
TRNE STS,IO.ERR ;CHECK FOR ERROR BITS.
JRST E$$IDE ;YES ERROR--GIVE UP.
TRNN STS,IO.EOF ;EOF?
JRST E$$HBS ;NOT ERROR BITS OR EOF--CAN NEVER GET HERE
POPJ P, ;EOF RETURN
IN2: IBP IBUF+1 ;ASCII MODE--ADVANCE POINTER [57]
MOVE CH,@IBUF+1 ;GET THIS WORD [57]
TRNN CH,1 ;SEE IF SEQUENCED [57]
JRST IN3 ;NO--JUST RETURN NEXT CHAR [57]
AOS IBUF+1 ;YES--ADVANCE 6 CHARS [57]
MOVNI CH,5 ;ALSO COUNTER [57]
ADDM CH,IBUF+2 ; .. [57]
JRST INR ;AND TRY AGAIN [57]
IN3: LDB CH,IBUF+1 ;GET BYTE OF DATA [57]
JRST IN0 ;AND RETURN IT [57]
;TTYINI-INIT TTY FOR OUTPUT.
;CALL PUSHJ P,TTYINI
; NORMAL RETURN
; NEVER RETURNS IF ANY ERROR.
TTYINI: INIT TTY,.IOASL
SIXBIT /TTY/
XWD OBUF,0
JRST E$$COO ;NEVER GET HERE--I HOPE
OUTBUF TTY,0
MOVE T1,[2,,T2] ;[70] POINTER FOR TRMOP.
MOVEI T2,.TOWID ;[70] TO READ TTY WIDTH
MOVEI T3,TTY ;[70] OUTPUT CHANNEL
IONDX. T3, ;[70] GET TTY'S UDX
CAIA ;[70] ???
TRMOP. T1, ;[70] READ TTY WIDTH
MOVEI T1,COLS*^D8 ;[70] USE DEFAULT IF NOT TTY
IDIVI T1,^D8 ;[70] CONVERT TO NUMBER OF TAB COLUMS
MOVEM T1,NUMCOL ;[70] SAVE FOR TYPEOUT ROUTINES
POPJ P,
;OUT--OUTPUTS BYTE TO TTY. CALLED WITH BYTE IN CH.
;TAB--OUTPUTS TAB TO TTY.
;CRLF-OOUTPUTS CR-LF SEQUENCE TO TTY.
;
;CALL PUSHJ P,<ROUTINE>
; NORMAL RETURN
; THERE IS NO RETURN ON ANY ERROR.
CRLF: MOVEI CH,.CHCRT
PUSHJ P,OUTR
MOVEI CH,.CHLFD
PUSHJ P,OUTR
POPJ P,
TAB: MOVEI CH,.CHTAB ;PUT OUT TAB.
OUTR: SOSG OBUF+2 ;ROM FOR ONE MORE?
JRST OUT1 ;NO--GO MAKE ROOM
IDPB CH,OBUF+1 ;YES--PUT IT THERE
POPJ P, ;AND RETURN?
OUT1: OUT TTY, ;OUTPUT A BUFFER
JRST OUTR ;GO TRY NOW
GETSTS TTY,STS ;SOMETHING WENT WRONG--GET STATUS
TRNN STS,IO.ERR ;ERROR?
JRST E$$HBS ;SHOULDN'T GET HERE
JRST E$$ODE ;LEGIT. ERROR TELL USER.
; SEARCH--TYPE OUT LIST OF ALL AVAILABLE *.HLP FILES
; IN HELP'S DIRECTORY.
; FIRST READ PAST END OF COMMAND
; LOOKUP DIRECTORY--COMPUTE SIZE OF PDL
; NEEDED.
; READ DIRECTORY FOR ALL *.HLP FILES, PUT NAMES FOUND
; AT .JBFF
; SORT LIST
; TYPE OUT LIST.
SEARCH: PUSHJ P,CHAR ;READ TO END OF COMMAND
JRST S0
JRST SEARCH
JRST SEARCH ;KEEP LOOKING.
S0: PUSHJ P,TTYINI ;SETUP TTY
PUSHJ P,SETDEV ;SETUP DEFAULT DEVICE LIST
MOVE T,.JBFF ;SAVE INITIAL
MOVEM T,SAVFF ; .JBFF
MOVEI F,0 ;CLEAR COUNT
S0A: TLZ F,(UU.PHS) ;CLEAR PHYS BIT
MOVEI T,.IOBIN ;SET FOR BINARY MODE
S0B: SKIPN T1,DEVICE ;GET USER DEVICE IF ANY
MOVE T1,(D) ;ELSE GET NEXT DEFAULT
JUMPE T1,S2A ;EXIT WHEN ALL DONE
MOVEI T2,IBUF ;POINT TO INPUT HEADER
OPEN DSK,T ;OPEN DEVICE
JRST NODSKS ;GIVE UP.
MOVE T2,SAVFF ;GET ORIGINAL .JBFF
EXCH T2,.JBFF ;RESTORE FOR BUFFERS
INBUF DSK,0
CAMLE T2,.JBFF ;IF FIRST TIME,
MOVEM T2,.JBFF ; RESTORE UPDATED VALUE
MOVEI T2,0 ;ALSO OPEN
OPEN FIL,T ; EXTRA CHANNEL
JRST NODSKS ;UUPS
MOVE T,[DEVPPN T1,]
TLNE F,(UU.PHS)
TRO T,UU.PHY
XCT T
JRST [MOVE T1,[%LDSYS]
GETTAB T1,
MOVE T1,[1,,1]
JRST .+1]
MOVE T,[%LDNEW] ;IDENTIFY NEW:
GETTAB T,
MOVEI T,0 ;MUST NOT EXIST
CAMN T,T1 ;SEE IF WE HAVE THAT ONE
JRST [MOVS T,(D) ;YES--GET ARGUMENT
CAIN T,'SYS' ;SEE IF SYS:
SKIPE DEVICE ;AND NO USER ARGUMENT
JRST .+1 ;NO--LEAVE ALONE
MOVE T1,[%LDSYS] ;YES--CHANGE TO REAL SYS:
GETTAB T1,
MOVE T1,[1,,4]
JRST .+1] ;AND CONTINUE
MOVEM T1,FILNAM
MOVSI T,(SIXBIT/UFD/)
MOVEM T,FILNAM+1
SETZM FILNAM+2
MOVE T,[%LDMFD]
GETTAB T,
MOVE T,[XWD 1,1]
MOVEM T,FILNAM+3
LOOKUP DSK,FILNAM
JRST NOUFD ;OUCH!!! CAN'T GET UFD.
;READ DIRECTORY
S1: PUSHJ P,INR
JRST S2
MOVE T,CH
PUSHJ P,INR
JRST E$$HBS ;PRETEND EOF WILL NEVER OCCUR HERE.
HLRZS CH
CAIE CH,(SIXBIT/HLP/)
JRST S1 ; NOT A *.HLP FILE KEEP LOOKING.
MOVSI T1,'HLP' ;SET IN EXTENSION
SETZB T2,T3 ;CLEAR DIRECTORY
COMMENT \ ;EDIT 52
LOOKUP FIL,T ;LOOKUP FILE
MOVEI T,0 ;DON'T INCLUDE IF CAN'T READ IT
CLOSE FIL,CL.DAT ;DON'T KEEP ACCESS TABLE
\ ;END EDIT 52
PUSHJ P,STOR ;SAVE NAME
JRST S1 ;AND LOOP
NOUFD: SKIPE DEVICE ;SEE IF USER DEVICE
JRST E$$CLD ;YES--HE IS IN TROUBLE
NODSKS: SKIPE DEVICE ;SEE IF USER DEVICE
JRST E$$COI ;YES--ERROR
S2: SKIPE DEVICE ;SEE IF USER DEVICE
JRST S2A ;YES--ALL DONE
TLOE F,(UU.PHS) ;SET/TEST FLAG FOR PHYSICAL
AOJA D,S0A ;LOOP OVER ALL DEVICES
MOVE T,(D) ;REFETCH DEVICE NAME
DEVNAM T, ;GET PHYSICAL NAME
AOJA D,S0A ;CAN'T--GO ON TO NEXT DEVICE
CAMN T,(D) ;SEE IF SAME
AOJA D,S0A ;YES--NOT A LOGICAL NAME
MOVE T,[UU.PHS+.IOBIN] ;NO--TRY PHYSICAL
JRST S0B ; AS WELL
S2A: RELEAS DSK, ;FREE CHANNEL
RELEAS FIL, ; ..
JUMPE F,MONCMD ;SKIP ON IF NOTHING!
PUSHJ P,SORT ;ELSE GO SORT LIST
MOVEI D,[ASCIZ/
HELP is available for the following:/]
PUSHJ P,HEAD ;OUTPUT HEADING AND LIST
MONCMD: MOVEI T,.GTCOM ;POINT TO COMMAND TABLE
MOVEI D,[ASCIZ /
The monitor has the following commands:/]
PUSHJ P,MONTAB ;GET AND OUTPUT A TABLE
MOVEI T,.GTCM2 ;POINT TO SET COMMAND TABLE
MOVEI D,[ASCIZ /
The monitor has the following SET commands:/]
PUSHJ P,MONTAB ;GET AND OUTPUT THE TABLE
MOVEI T,.GTCMT ;POINT TO TTY COMMAND TABLE
MOVEI D,[ASCIZ /
The monitor has the following SET TTY commands:/]
PUSHJ P,MONTAB ;GET AND OUTPUT TABLE
MOVEI T,.GTTNM ;[70] TERMINAL TYPES TABLE
MOVEI D,[ASCIZ/
The monitor supports the following terminal types:/]
PUSHJ P,MONTAB ;[70] LIST TERMINAL TYPES
MOVEI T,.GTCMW ;POINT TO WATCH TABLE
MOVEI D,[ASCIZ /
The monitor has the following SET WATCH commands:/]
PUSHJ P,MONTAB ;GET AND OUTPUT TABLE
JRST EXITL ;GO FINISH UP
;MONTAB -- ROUTINE TO GET A MONITOR TABLE, SORT IT, AND LIST IT
;CALL: MOVSI T,TABLE NUMBER (MUST BE IN SIXBIT)
; MOVE D,[POINT 7,ASCIZ STRING FOR HEADING]
; PUSHJ P,MONTAB
MONTAB: MOVE T1,SAVFF ;RESTORE .JBFF
MOVEM T1,.JBFF ; ..
PUSH P,T ;[71] SAVE GETTAB TABLE NUMBER
MOVS T2,T ;[71] TABLE NUMBER AS INDEX
HRRI T2,.GTIDX ;[71] TO SEE WHERE TABLE STARTS
GETTAB T2, ;[71] (IN CASE CUSTOMER-DEFINED ENTRIES)
SETZ T2, ;[71] DO IT THE OLD WAY - START AT 0
HLRE T2,T2 ;[71] T2:=STARTING INDEX FOR TABLE SEARCH
MOVEI F,0 ;CLEAR COUNT
MONTB1: MOVS T1,T2 ;GET NEXT INDEX
HRR T1,0(P) ;[71] INSERT TABLE NUMBER
GETTAB T1, ;READ THIS TABLE ENTRY
JRST MONTB2 ;DONE
MOVEI T,0 ;CLEAR AC
LSHC T,6 ;GET FIRST CHAR
CAIN T,'.' ;SEE IF STARTS WITH PERIOD
SETZB T,T1 ;YES--CLEAR COMMAND
LSHC T,^D30 ;REPOSITION COMMAND
PUSHJ P,STOR ;SAVE AWAY
AOJA T2,MONTB1 ;INCREMENT ENTRY AND TRY AGAIN
MONTB2: POP P,T2 ;[71] ADJUST STACK
JUMPE F,CPOPJ ;RETURN OF NOTHING
PUSHJ P,SORT ;GO SORT TABLE
;[71] FALL INTO "OUTPUT THE WHOLE THING"
;HEAD -- ROUTINE TO OUTPUT HEADING AND THEN LIST
;CALL: MOVE D,[POINT 7,ASCIZ STRING]
; PUSHJ P,HEAD
HEAD: TLOA D,(POINT 7,) ;[71] MAKE INTO BYTE POINTER
HEAD1: PUSHJ P,OUTR
ILDB CH,D
JUMPN CH,HEAD1
NEWLIN: PUSHJ P,CRLF
MOVE D,NUMCOL ;[70] GET NUMBER OF TAB SUBCOLUMNS
SKIPA
NEXT: PUSHJ P,TAB
MOVE T3,(T)
NEXT1: MOVEI T2,0
LSHC T2,6
MOVEI CH,40(T2)
PUSHJ P,OUTR
JUMPN T3,NEXT1
NEXT2: AOBJP T,CRLF ;[70] LOOP FOR WHOLE TABLE
MOVE T3,(T) ;[70] GET NEXT ITEM
CAMN T3,1(T) ;[70] COMPARE WITH PREVIOUS ONE
JRST NEXT2 ;SAME--SKIP PRINTING
SOJG D,NEXT
JRST NEWLIN
;STOR--ROUTINE TO ADD ENTRY TO LIST
;CALL: MOVE T,ENTRY
; PUSHJ P,STOR
STOR: JUMPE T,CPOPJ ;RETURN IF BLANK ENTRY
MOVE T1,.JBFF ;SEE IF ENOUGH CORE
CAMLE T1,.JBREL ; ..
JRST [CORE T1, ; NO--GET MORE
JRST E$$CLE ;GIVE UP IF NO MORE TO BE HAD
JRST .+1]
MOVEM T,@.JBFF ;STORE NAME
AOS .JBFF ;AND ADVANCE POINTER
AOS F ;COUNT RESULT
CPOPJ: POPJ P, ;RETURN
SUBTTL SORT AN ARRAY INTO INCREASING ORDER
;[70] NEW SORT ROUTINE, GRATEFULLY STOLEN FROM LLN
;
;SORT - SORT AN ARRAY INTO INCREASING ORDER
;CALL IS:
;
; .JBFF/ END OF ARRAY + 1
; F/ LENGTH OF ARRAY
;
; PUSHJ P,SORT
; RETURN
;
;THE ALGORITHM USED HERE IS A HEAPSORT ALGORITHM, TAKEN DIRECTLY FROM
;DONALD KNUTH, THE ART OF COMPUTER PROGRAMMING, VOL. 3, SORTING AND
;SEARCHING, PP. 145-149. THE USER IS REFERRED TO THAT VOLUME FOR
;MORE THOROUGH DOCUMENTATION ON THE METHOD.
;
;RETURNS WITH T:=AOBJN POINTER TO SORTED TABLE
;
;NOTE THAT ACS 11-14 ARE USED, AS WELL AS F AND T1-T3
;AC'S ARE NAMED DIFFERENTLY HERE TO CORRESPOND TO THE VARIABLES USED
;IN KNUTH'S ALGORITHM, PP. 147-147 OF VOLUME MENTIONED ABOVE.
TEMP= F
ADDR= T1
R= T2
L= T3
RCAP= 11
K= 12
I= 13
J= 14
;THE CODE THAT FOLLOWS IS GRATEFULLY STOLEN FROM LLN.
;CAN'T DO MUCH BETTER WITHOUT RECURSION
SORT: MOVE R,F ;LENGTH OF ARRAY
MOVE ADDR,.JBFF ;ADDRESS + 1 OF END
SUBI ADDR,1(R) ;ADDR:=ADDRESS OF ARRAY (MINUS ONE)
MOVN T,R ;NEGATIVE LENGTH FOR AOBJN
MOVS T,T ;COUNT IN L.H.
HRRI T,1(ADDR) ;ADDRESS IN R.H.
MOVEI L,(R) ;INITIALIZE
CAIG R,1 ;CHECK INDEX
POPJ P, ;RETURN IF INVALID, OR =1
LSH L,-1 ;L=N/2
AOJ L,
SORT2: CAIG L,1 ;DECREASE L OR R
JRST SORT9
SOJ L, ;L POINTS TO FIRST UNCHECKED NODE
HRLI ADDR,L
MOVE RCAP,@ADDR ;GET THAT ENTRY
SORT3: MOVEI J,(L) ;PREPARE FOR SIFT-UP
SORT4: MOVEI I,(J) ;ADVANCE DOWNWARD
LSH J,1 ;J POINTS TO FIRST SON
CAMN J,R
JRST SORT6 ;JUMP IF LAST ENTRY
CAML J,R
JRST SORT8 ;J TOO HIGH--JUMP
HRLI ADDR,J ;FIND "LARGER" SON
MOVE TEMP,@ADDR
AOJ J,
CAML TEMP,@ADDR
SOJ J,
SORT6: HRLI ADDR,J ;LARGER THAN RCAP?
CAML RCAP,@ADDR
JRST SORT8
HRLI ADDR,J ;MOVE IT UP
MOVE TEMP,@ADDR
HRLI ADDR,I
MOVEM TEMP,@ADDR
JRST SORT4
SORT8: HRLI ADDR,I ;STORE R
MOVEM RCAP,@ADDR
JRST SORT2
SORT9: HRLI ADDR,R ;HAVE A HEAP NOW
MOVE RCAP,@ADDR
MOVE TEMP,1(ADDR)
MOVEM TEMP,@ADDR
SOJ R,
CAILE R,1
JRST SORT3
MOVEM RCAP,1(ADDR)
POPJ P,
EXITL: PUSHJ P,CRLF
EXITR: RELEAS TTY,
EXITRL: PUSHJ P,CHAR
JRST EXITRX
JRST EXITRL
JRST EXITRL
EXITRX: RESET
SKIPE LOGIN ;[67]SKIP IF NOT LOGGED IN
JRST [EXIT 1,
EXIT]
OUTSTR [ASCIZ/
.KJOB
./] ;NO. MAKE SURE HE KNOWS IT
LOGOUT
;ERROR AND WARNING MESSAGES
E$$ILC: PUSHJ P,ERRMSG
'ILC',,"%"
EXITX,,[ASCIZ/Illegal char: "/]
CAIGE CH,40
JRST [OUTSTR [ASCIZ /^/]
ADDI CH,100
JRST .+1]
OUTCHR CH
OUTSTR [ASCIZ/", for HELP type HELP/]
JRST EXITX
;POSSIBLE WAYS TO GOOF,
; IN OR OUT FAILED WITHOUT ANY 74B23 BITS SET.
; READ FILNAME BUT NOT EXTENSION OUT OF A DIR BLOCK.
; NOTE THAT NONE OF THESE SHOULD EVER HAPPEN.
E$$HBS: PUSHJ P,ERRMSG
'HBS',,"?"
EXITX,,[ASCIZ/Horrible bug somewhere..../]
JRST EXITR
E$$NIO: PUSHJ P,ERRMSG
'NIO',,"%"
EXITX,,[ASCIZ/No info on "/]
MOVE T1,FILNAM
NOINF1: MOVEI T,0
LSHC T,6
ADDI T,40
OUTCHR T ;PRINT IT.
JUMPN T1,NOINF1
OUTSTR [ASCIZ /"
/]
JRST EXITR ;ALL DONE.
E$$IDE: PUSHJ P,ERRMSG
'IDE',,"?"
EXITX,,[ASCIZ/Input error /]
JRST TYPSTS
E$$ODE: PUSHJ P,ERRMSG
'ODE',,"?"
EXITX,,[ASCIZ/Output error /]
TYPSTS: HRLZ T1,STS
MOVEI F,6
TYPST1: MOVEI T,0
LSHC T,3
ADDI T,"0"
OUTCHR T
SOJG F,TYPST1
JRST EXITX
E$$IDS: PUSHJ P,ERRMSG
'IDS',,"?"
EXITX,,[ASCIZ /Illegal device specification in command/]
JRST EXITX
E$$COO: PUSHJ P,ERRMSG
'COO',,"?"
EXITX,,[ASCIZ/Can't OPEN output device/]
JRST EXITX
E$$COI: PUSHJ P,ERRMSG
'COI',,"?"
EXITX,,[ASCIZ/Can't OPEN input device/]
JRST EXITX
E$$CLD: PUSHJ P,ERRMSG
'CLD',,"?"
EXITX,,[ASCIZ/Can't LOOKUP directory/]
JRST EXITX
E$$CLE: PUSHJ P,ERRMSG
'CLE',,"?"
EXITX,,[ASCIZ/Core limit exceeded/]
EXITX: OUTSTR [ASCIZ /
/]
JRST EXITR
;ERROR MESSAGE PREFIX PRINTER
ERRMSG: MOVE T2,(P) ;POINT TO ANSWERS
AOS (P) ;ADVANCE RETURN
AOS (P) ;ADVANCE RETURN
OUTCHR (T2) ;OUTPUT PREFIX CHARACTER
HRRZ T1,(T2) ;GET CHARACTER
CAIN T1,"?" ;SEE IF ?
CLRBFI ;YES--CLEAR INPUT BUFFER
HRROI T3,.GTWCH ;WATCH TABLE
GETTAB T3, ;GET IT
MOVEI T3,0 ;ZERO IF MISSING
TLNN T3,(JW.WMS) ;SEE IF SET
TLO T3,(JW.WFL+JW.WPR) ;NO--SET TO PREFIX,LINE
MOVSI T1,'HLP' ;SET OUR PREFIX
HLR T1,(T2) ;GET MESSAGE CODE
TLNE T3,(JW.WPR) ;SEE IF PREFIX SUPPRESSED
PUSHJ P,TYPSIX ;TYPE IN SIXBIT
OUTSTR [ASCIZ / /]
HRRZ T1,1(T2) ;GET ADDRESS OF TEXT
TLNE T3,(JW.WCN+JW.WFL) ;SEE IF COMMENTARY
OUTSTR @T1 ;YES--DO IT
HLRZ T1,1(T2) ;GET NOMESSAGE ADDRESS
TLNN T3,(JW.WCN+JW.WFL) ;SEE IF REST
HRRM T1,(P) ;YES--RETURN THERE INSTEAD
POPJ P, ;RETURN
TYPSIX: MOVEI T,0 ;CLEAR NEXT CHAR
LSHC T,6 ;POSITION IT
ADDI T,40 ;MAKE ASCII
OUTCHR T ;OUTPUT IT
JUMPN T1,TYPSIX ;LOOP UNTIL DONE
POPJ P, ;RETURN
NOTNEW: ;LIST OF DEVICES IF USER DOES NOT HAVE /NEW
SIXBIT /HLP/
SIXBIT /SYS/
SIXBIT /NEW/
SIXBIT /OLD/
0
YESNEW: ;LIST OF DEVICES IF USER DOES HAVE /NEW
SIXBIT /HLP/
SIXBIT /NEW/
SIXBIT /SYS/
SIXBIT /OLD/
0
XLIST ;LITERALS
LIT
LIST
RELOC ;SWITCH TO LOW SEG
;STORAGE AREA
FWAZER:! ;START OF AREA TO ZERO
OLDNAM: BLOCK 1
SAVFF: BLOCK 1
NUMCOL: BLOCK 1 ;[70] NUMBER OF TAB SUB-COLUMNS
DEVICE: BLOCK 1
FILNAM: BLOCK 4
IBUF: BLOCK 3
OBUF: BLOCK 3
PDL: BLOCK PDLSIZ
LOGIN: BLOCK 1 ;[67] -1=LOGGED IN
LWAZER==.-1 ;END
END HELP