Trailing-Edge
-
PDP-10 Archives
-
LCG_Integration_Tools_Clearinghouse_T20_v7_30Apr86
-
tools/phone20/hlp.mac
There are 3 other files named hlp.mac in the archive. Click here to see a list.
TITLE HLP -- DRIVER FOR HLPR20
SEARCH MONSYM,MACSYM,CMD,HLPUNV
SALL
.DIRECTIVE FLBLST
.REQUEST SYS:MACREL
.REQUIRE SYS:CMD
.REQUIRE HLPR20
HLPWHO==0 ;WHO LAST..
HLPVER==1 ;MAJOR VERSION
HLPMIN==0 ;MINOR VERSION (A,B...)
HLPEDT==1 ;EDIT NUMBER
%%%HLP==:<BYTE (3)HLPWHO (9)HLPVER (6)HLPMIN (18)<HLPEDT&377777>>
LPDL==1K
BUFSIZ==^D<132+4>/5
TABLEN==^D300 ;MAX ITEMS IN A TOPIC TABLE
DEFHDR(600) ;DEFINE HEADER ITEMS
DEFINE CRTMSG (TXT) <
HRROI 1,[ASCIZ
TXT]
PSOUT
>;CRTMSG
PDL: -LPDL,,.
BLOCK LPDL
LINBUF: BLOCK BUFSIZ ;TEMP LINE BUFFER FOR GETLIN
TOPIC: BLOCK BUFSIZ ;TEMP TOPIC BUFFER FOR GETSTR
NLEVEL: BLOCK 1 ;INDEX LEVEL FOR TOPIC
CURLVL: BLOCK 1 ;CURRENT TOPIC LEVEL
CMDSTG ;DEFINE STORAGE FOR "CMD"
SUBTTL PURITY
CMDTAB: XWD CMDLEN,CMDLEN
T DUMP
T EXIT
T HELP
T INDEX
CMDLEN==.-CMDTAB-1
EVEC: JRST START
JRST START
%%%HLP
START: RESET
MOVE P,PDL
TMSG <HLP %>
MOVE A,[%%%HLP]
CALL TYOVER
TMSG <, Using HLPR20 %>
MOVE A,[%%%H20##]
CALL TYOVER
CALL TYCRLF
CALL CMDINI
;<
LOOP: PROMPT (HLP>)
SETO A,
CLOSF
TRN
MOVEI A,[FLDDB. .CMKEY,,CMDTAB]
CALL RFIELD
HRRZ B,(B)
CALL (B)
JRST LOOP
DMPBLK: GJ%OLD
0
-1,,[ASCIZ 'HLP'] ;DEV
0 ;DIR
0 ;NAME
-1,,[ASCIZ 'INDEX'] ;EXT
BLOCK 3
.DUMP: STKVAR <IDXJFN>
NOISE (INDEX FILE)
MOVE A,[DMPBLK,,CJFNBK]
BLT A,CJFNBK+10
MOVEI A,[FLDDB. .CMFIL]
CALL RFIELD
MOVEM B,IDXJFN
CONFRM
MOVE A,IDXJFN
MOVEI B,OF%RD
OPENF
JSERR ;*****
SIZEF ;GET FILE SIZE
JSERR
MOVSI A,(A) ;JFN,,PAGE 0
MOVE B,[.FHSLF,,MAPPAG] ;US,,PAGE
TLO C,(PM%CNT!PM%RD)
PMAP ;MAP IN
MOVE A,$NAME ;GET HEADER WORD
CAMN A,[SIXBIT /HLPR20/]
IFSKP.
TMSG <%Bad Index file header>
JRST DMPDON
ENDIF.
TMSG <HLP Version: >
MOVE A,$VERSION
CALL TYOVER
CRTMSG <HLPR20 version: >
MOVE A,$H20VER
CALL TYOVER
CRTMSG <Index built on: >
MOVEI A,.PRIOU
MOVE B,$DATIME
SETZ C,
ODTIM
CRTMSG <Text file date: >
MOVEI A,.PRIOU
MOVE B,$FILEDATE
SETZ C,
ODTIM
CRTMSG <Origin: >
MOVE B,$ORIGIN
CALL TYOOCT
CRTMSG <Root Node: >
MOVE B,$ROOT
CALL TYOOCT
CRTMSG <Last word: >
MOVE B,$LAST
CALL TYOOCT
CALL TYCRLF
SKIPE A,$FREE ;HAVE A FREE LIST?
CALL DMPFRE
SKIPE A,$ROOT
CALL DMPNOD
DMPDON: MOVE A,IDXJFN
SIZEF
JSHLT
SETO A,
MOVE B,[.FHSLF,,MAPPAG]
TLO C,(PM%CNT)
PMAP
MOVE A,IDXJFN
CLOSF
JSHLT
RET
DMPFRE: ACVAR <FP>
FRELOP: MOVEM A,FP
JUMPE A,CPOPJ
CRTMSG <Free block at: >
MOVEI B,(FP)
CALL TYOOCT
TMSG <, Length: >
HLRZ B,(FP) ;GET SIZE
CALL TYODEC
HRRZ A,(FP) ;GET NEXT
JRST FRELOP
ENDAV.
DMPNOD: ACVAR <NP>
MOVEM A,NP
CALL TYCRLF
CRTMSG <Node at: >
MOVE B,NP
CALL TYOOCT
CRTMSG <File position: >
MOVE B,$NDTXT(NP)
CALL TYODEC
MOVEI A,"."
PBOUT
CRTMSG <Topic table: >
SKIPN B,$NDTBL(NP)
IFSKP.
CALL TYOOCT
MOVE A,$NDTBL(NP)
CALL DMPTBL
ELSE.
TMSG <none>
ENDIF.
CRTMSG <--->
CALL TYCRLF
RET
ENDAV.
DMPTBL: ACVAR <TP,EP>
MOVEM A,TP
CALL TYCRLF
CRTMSG <Table at: >
MOVE B,TP
CALL TYOOCT
CRTMSG <Max entries: >
HRRZ B,(TP)
CALL TYODEC
CRTMSG <Cur entries: >
HLRZ B,(TP)
CALL TYODEC
CALL TYCRLF
HLLZ EP,(TP)
MOVN EP,EP
HRRI EP,1(TP)
TBLLOP: CRTMSG <Entry at: >
MOVEI B,(EP)
CALL TYOOCT
CRTMSG <Key: >
HLRO A,(EP)
PSOUT
CRTMSG <Node: >
HRRZ B,(EP)
SKIPN B
IFSKP.
CALL TYOOCT
MOVE A,B
CALL DMPNOD
ELSE.
TMSG <none>
ENDIF.
TBLBOT: AOBJN EP,TBLLOP
RET
ENDAV.
.EXIT: NOISE (TO SUPERIOR)
CONFRM
HALTF
RET
.HELP: NOISE (ON SUBJECT)
HRROI A,[ASCIZ 'HLP:*.HLP']
CALL HLPWLD##
TRNA
RET
HRROI A,[ASCIZ 'No help available for that subject']
ESOUT
RET
IDXBLK: GJ%OLD
0
-1,,[ASCIZ 'HLP'] ;DEV
0 ;DIR
0 ;NAME
-1,,[ASCIZ 'HLP'] ;EXT
BLOCK 3
.INDEX: TRVAR <HLPJFN,IDXJFN>
NOISE (HELP FILE)
MOVE A,[IDXBLK,,CJFNBK]
BLT A,CJFNBK+10
MOVEI A,[FLDDB. .CMFIL]
CALL RFIELD
MOVEM B,HLPJFN
CONFRM
MOVE A,HLPJFN
MOVE B,[FLD(7,OF%BSZ)!OF%RD]
OPENF
JSHLT
HRROI A,LINBUF
MOVE B,HLPJFN ;GET .HLP FILE JFN
MOVE C,[<BYTE(3)1,1,1>!JS%PAF] ;DEVICE, DIR, NAME
JFNS
HRROI B,[ASCIZ '.INDEX']
SETZ C,
SOUT
SETZ B,
IDPB B,A
MOVSI A,(GJ%SHT!GJ%FOU)
HRROI B,LINBUF
GTJFN
JSHLT ;****
MOVEM A,IDXJFN
MOVEI B,OF%RD!OF%WR
OPENF
JSHLT ;****
MOVSI A,(A) ;JFN,,PAGE 0
MOVE B,[.FHSLF,,MAPPAG]
MOVE C,[PM%RD!PM%WR!PM%CNT!MAPLEN]
PMAP
MOVE A,[SIXBIT /HLPR20/]
MOVEM A,$NAME
GTAD
MOVEM A,$DATIME
MOVE A,[%%%HLP]
MOVEM A,$VERSION
MOVE A,[%%%H20##]
MOVEM A,$H20VER
MOVEI A,MAPADR
MOVEM A,$ORIGIN
MOVEI A,$DATA
MOVEM A,$LAST
MOVE A,HLPJFN
MOVE B,[1,,.FBCRE]
MOVEI C,$FILEDATE
GTFDB
MOVEI A,$HDRLEN
MOVEM A,$ENTRIES
SETZ A,
CALL DOLVL
MOVEM A,$ROOT
MOVEI A,$NDLEN
CALL ALLOC
MOVE B,$ROOT ;GET LEVEL ZERO TABLE
SETZM $NDTXT(A) ;START AT 0
MOVEM B,$NDTBL(A) ;STORE TABLE
MOVEM A,$ROOT ;STORE ROOT HELP NODE
SETO A,
MOVE B,[.FHSLF,,MAPPAG]
MOVE C,[PM%CNT!MAPLEN]
PMAP
MOVE A,IDXJFN
CLOSF
JSHLT
MOVE A,HLPJFN
CLOSF
JSHLT
RET
; INDEX-ER ROUTINE
; A/ LEVEL NUMBER
; CALL DOLVL
; A/ ^TABLE
DOLVL: ACVAR <LVL,TAB,LST,LEN>
STKVAR <B4,SAVED,NEW>
SETZM B4
MOVEM A,LVL
MOVEM A,CURLVL ;SAVE FOR OUTSIDE WORLD
SETZB TAB,LST
SETZ LEN,
DO. ;LEVEL LOOP
MOVE A,HLPJFN
RFPTR
JSHLT
MOVEM B,B4
CALL GETSTR ;GET A TOPIC LINE
EXIT. ; END...
MOVEM A,SAVED ;SAVE TOPIC ADDR
CAME LVL,NLEVEL ;SAME LEVEL
IFSKP.
CAIE TAB,0 ;GOT A TABLE?
IFSKP.
MOVEI LEN,^D20 ;STARTING LENGTH
MOVEI A,1(LEN) ;MAKE ROOM FOR COUNT
CALL ALLOC
MOVEM A,TAB ;SAVE
HRRZM LEN,(TAB) ;EMPTY
ENDIF.
MOVEI A,$NDLEN
CALL ALLOC
MOVS B,SAVED ;GET TOPIC,,0
HRRI B,(A)
MOVEM A,LST ;SAVE NODE
SETZM $NDTBL(LST) ;NO SUB-TOPICS...
MOVE A,TAB ;GET TABLE
MOVEM B,SAVED ;SAVE ENTRY...
TBADD
IFJER.
MOVEI A,(LEN) ;GET OLD LENGTH
IMULI A,2 ;DOUBLE
ADDI A,1 ;MAKE ROOM FOR HEADER
CALL ALLOC ;GET THE CORE
MOVEM A,NEW ;SAVE ADDR
MOVE A,TAB ;GET OLD TABLE
MOVE B,NEW ;GET NEW TABLE
MOVEI C,1(LEN) ;GET COUNT
CALL COPY
MOVE A,TAB ;GET OLD TABLE
MOVEI B,1(LEN) ;GET LENGTH
CALL FREE ;TOSS OLD TABLE
MOVE TAB,NEW ;SET TO NEW TABLE
IMULI LEN,2 ;DOUBLE LEN
HRRM LEN,(TAB) ;STORE NEW MAX
MOVE A,TAB ;GET NEW TABLE
MOVE B,SAVED ;GET ENTRY TO ADD
TBADD ;HERE WE GO AGAIN!
ENDIF.
MOVE A,HLPJFN ;GET JFN
RFPTR ;GET PTR TO START OF TEXT
JSHLT ; LOSE
MOVEM B,$NDTXT(LST) ;SAVE TEXT POINTR
LOOP.
ENDIF.
CAML LVL,NLEVEL
IFSKP.
CAIN LST,0
HALT .
MOVE A,HLPJFN
MOVE B,B4
SFPTR
JSERR
MOVE A,NLEVEL ;DO NEW LEVEL
CALL DOLVL ;GO TOIT!
MOVEM A,$NDTBL(LST) ;SAVE TABLE FOR THIS NODE
MOVEM LVL,CURLVL ;RESTORE CURRENT LEVEL
ENDIF.
CAMG LVL,NLEVEL
LOOP.
OD.
MOVE A,HLPJFN
MOVE B,B4
SFPTR
JSHLT
MOVE A,TAB
CAIG LEN,0
RET
HLRZ C,(TAB) ;GET USED
HRRZ B,(TAB) ;GET MAX
SUBI B,(C) ;GET FREE
;;; CAIGE B,^D10 ;TOO MUCH TO WASTE?
;;; RET ; NAHHH
HRRM C,(TAB) ;MAKE ZERO FREE
ADDI A,1(C) ;GET ADDR OF FLASH
CALL FREE
MOVE A,TAB
RET
ENDAV.
GETSTR: DO. ;LOOP FOR LINES WITH STARS
CALL GETLIN ;GET A LINE
RET ; PASS EOF
MOVE A,[POINT 7,LINBUF]
ILDB B,A
CAIE B,"*"
LOOP.
OD. ;STARS LOOP
MOVEI C,^D10
NIN ;GET LEVEL NUMBER
IFJER.
MOVE B,CURLVL ;STAY AT SAME LEVEL
;;; SETZ B,
ENDIF.
MOVEM B,NLEVEL ;SAVE LEVEL
SETO C, ;-1
ADJBP C,A ;BACKUP BP
MOVE A,C ;GET BACK!
MOVE B,[POINT 7,TOPIC]
DO. ;COPY TOPIC
ILDB C,A ;GET A BYTE
CAIG C," " ;PRINTING?
EXIT. ; NO, QUIT
IDPB C,B ;STORE A BYTE
LOOP. ;...LOOP
OD. ;COPY TOPIC
SETZ C,
IDPB C,B ;TIE OFF STRING
MOVEI A,1(B) ;GET LEN
SUBI A,TOPIC
CALL ALLOC
MOVE D,A ;SAVE ADDR
HRLI A,(POINT 7,) ;MAKE BP
MOVE B,[POINT 7,TOPIC]
DO. ;COPY TOPIC2
ILDB C,B
IDPB C,A
JUMPN C,TOP.
OD. ;COPY TOPIC2
MOVE A,D
JRST CPOPJ1
GETLIN: MOVE A,HLPJFN
HRROI B,LINBUF
MOVEI C,BUFSIZ*5-1
MOVEI D,"J"-100
SIN
SETZ A,
IDPB A,B
SUBI C,BUFSIZ*5-1
SKIPE C
CPOPJ1: AOS (P)
CPOPJ: RET
TYOOCT: SKIPA C,[10]
TYODEC: MOVEI C,^D10
MOVEI A,.PRIOU
NOUT
JSHLT
RET
TYOVER: ACVAR <V>
MOVEM A,V
TRZE V,400000 ;STUPID DECIMAL FORMAT?
JRST TYODVR ; YEP..
LDB B,[POINTR V,VI%MAJ]
CALL TYOOCT
LDB A,[POINTR V,VI%MIN]
IDIVI A,^D27
ADDI A,"A"-1
CAIE A,"A"-1
PBOUT
MOVEI A,"A"-1(B)
CAIE A,"A"-1
PBOUT
LDB B,[POINTR V,VI%WHO]
CAIN B,0
IFSKP.
MOVEI A,"-"
PBOUT
CALL TYOOCT
ENDIF.
LDB B,[POINTR V,VI%EDN]
CAIN B,0
IFSKP.
MOVEI A,"("
PBOUT
CALL TYOOCT
MOVEI A,")"
PBOUT
ENDIF.
RET
TYODVR: LDB B,[POINTR V,VI%MAJ]
CALL TYODEC
LDB B,[POINTR V,VI%MIN]
CAIN B,0
IFSKP.
MOVEI A,"."
PBOUT
CALL TYODEC
ENDIF.
LDB B,[POINTR V,VI%WHO]
CAIN B,0
IFSKP.
MOVEI A,"-"
PBOUT
MOVEI A,"0"(B)
PBOUT
ENDIF.
LDB B,[POINTR V,VI%EDN]
CAIN B,0
IFSKP.
MOVEI A,"("
PBOUT
CALL TYODEC
MOVEI A,")"
PBOUT
ENDIF.
RET
ENDAV.
TYCRLF: TMSG <
>
RET
ALLOC: SKIPN B,$FREE ;HAVE A FREE LIST?
JRST MALLOC ; NO, GET FRESH MEMORY
DO.
HLRZ C,(B) ;GET BLOCK SIZE
CAIG A,(C) ;LARGE ENUF?
EXIT. ; YES!
HRRZ B,(B) ;NO, GET NEXT BLOCK
JUMPE B,MALLOC ;NO MORE BLOX, GET NEW CORE
LOOP.
OD.
PUSH P,B ;SAVE BLOCK ADDR
HRRZ D,(B) ;GET NEXT FREE BLOCK
MOVEM D,$FREE ;REMOVE US FROM CHAIN
SUBI C,(A) ;GET LEFT OVER AMT
ADDI A,(B) ;GET ADDR OF FLASH
MOVEI B,(C) ;GET AMT OF FLASH
CALL FREE ;PUT BLOCK BACK
POP P,A ;RESTORE BLOCK ADDR
RET
MALLOC: ADD A,$LAST
EXCH A,$LAST
RET
FREE: CAIN B,0 ;ZERO LENGTH?
RET ; YES, QUIT
MOVSM B,(A) ;SAVE LENGTH IN <LH>
MOVE B,$FREE ;GET FREE LIST
HRRM B,(A) ;STORE FREE LIST PTR IN <RH>
MOVEM A,$FREE ;MAKE US THE FIRST ITEM
RET
; A/ FROM
; B/ TO
; C/ COUNT
COPY: MOVSI A,(A) ;GET FROM,,0
HRRI A,(B) ;GET FROM,,TO
ADDI B,-1(C) ;GET END
BLT A,(B) ;COPY!
RET
END 3,,EVEC