home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CBM Funet Archive
/
cbm-funet-archive-2003.iso
/
cpm
/
zutils
/
lbrhlp22.lbr
/
LBRHLP22.ZZ0
/
LBRHLP22.Z80
Wrap
Text File
|
1992-05-09
|
35KB
|
1,557 lines
; PROGRAM NAME:lbrhlp.z80
; AUTHOR:bOB pEDDICORD
; DATE:jAN 88
; VERSION:1.0
;
; DERIVATION: HELP53 BY rICHARD cONN
; SOME HELP ROUTINES FROM HELP52
; i WANT TO THANK sTEVE gREENBERG FOR HIS UNCRUNCH CODE
;
; vERSION 2.2 BY gENE pIZZETTA, 5/10/92.
; sEE lbrhlp.his FOR REVISION HISTORY.
VEREQU22
REVEQU' '
FALSEEQU0
NOEQUFALSE
NEQUFALSE
TRUEEQUNOT FALSE
YESEQUNOT FALSE
YEQUNOT FALSE
; sELECT DECOMPRESSION METHOD
.ACCEPT'eNTER "y" FOR UNCRUNCHING OR "n" FOR UNSQUEEZING: ',UNCR
;
; DIRECTORY OF HELP FILES IF HELP DIRECTORY NOT FOUND
;
DISKEQU'a'-'a' ; DISK
USEREQU15 ; USER
;
; ENTER/EXIT STANDOUT MODE
;
DIMEQU1
NDIMEQU2
;
; CONSTANTS
;
UDFLAGEQU4; ADDRESS OF USER/DISK FLAG
BDOSEEQU5; ADDRESS OF BDOS ENTRY POINT
FCB1EQU5CH
FCB2EQU6CH
TBUFFEQU80H; ADDRESS OF DMA BUFFER
INBUFSZEQU1; INPUT BUFFER SIZE (1 PAGE)
TABEQU9; <HT>
CREQU0DH; <CR>
LFEQU0AH; <LF>
ESCEQU1BH; ESCAPE
BELEQU'g'-'@'; ^G
FFEQU'l'-'@'; ^L = FORM FEED
CTRLZEQU'z'-'@'; ^Z
CTRLCEQU'c'-'@'; ^C
;
; HELP CONTROL CHARACTERS
;
IHCHAREQU';'; FLAG INDICATING INDEXED BY USER
SECTCHAREQU':'; DEFINED TO BE COLON
BACKUPCHAREQU'l'; BACK UP TO PREVIOUS FRAME CHAR
STRTCHAREQU's'; JUMP TO START OF INFORMATION CHAR
MENUCHAREQU'm'; CHAR TO ABORT TO MENU
CPMABORTCHAREQUCTRLC; CHAR TO EXIT
EXITCHAREQUESC; CHAR TO EXIT (ALTERNATE)
LRCHAREQU'^'; RETURN TO PREVIOUS HELP LEVEL
LRCHAR2EQU','; RETURN TO PREVIOUS HELP LEVEL (ALTERNATE)
ROOTCHAREQU'.'; RETURN TO ROOT OF HELP
PRCHAREQU'p'; PRINT CURRENT FRAME
CPRCHAREQU'p'-'@'; PRINT CURRENT INFORMATION SECTION
;
if uncr
sigrevequ20h; "SIGNIFICANT" REVISION LEVEL (COMPATIBILITY)
nopredequ0ffffh; "NO PREDECESSOR"
impredequ07fffh; pRED THAT CAN'T BE MATCHED OR BUMPED
; --- RESERVED CODES ---
eofcodequ100h; eof CODE
rstcodequ101h; aDAPTIVE RESET CODE
nulcodequ102h; nULL CODE
sprcodequ103h; sPARE CODE
endif; uncr
;______________________________________________________________________________
;
; mACROS TO FACILITATE "HORIZONTAL" MOVEMENT THROUGH THE TABLE.
; sEE "tABLE STRUCTURE" COMMENT NEAR "INITBL" FOR MORE INFORMATION.
;
right1 macro
lda,h; {$7d}
adda,10h; {$7d} MOVE "RIGHT" ONE COLUMN (SAME ROW)
ldh,a; {$7d}
endm
;
; EXTERNAL ROUTINES
;
.REQUESTZSLIB,Z3LIB,SYSLIB
;
EXTHVTINIT,HVDINIT,HVCLS,HVON,HVOFF,HPRINT,HPSTR; zslib
EXTEATSPC,GCOMNAM,COMNAM
EXTZ3INIT,Z3LOG,DIRTDU,ZSYSCHK,ZPRSFN,PUTER2; z3lib
EXTGETVID,GETCRT,GETPRT,GETWHL
EXTGETUD,PUTUD,LOGUD,SETDMA,INITFCB,BOUT,CAPS; syslib
EXTPFN2,PAFDC,F$EXIST,F$OPEN,F$READ,LUINIT,LUREAD
EXTLUOPEN,BDOS,BIOS,CAPIN,CODEND
PUBLICCIN,COUT
JPSTART
DB'z3env'
DB1
Z3EADR:DW0
;
; cONFIGURATION AREA FOR zcnfg
;
HDU:DBUSER
DBDISK; a=0,b=1 ETC.
DB'lbrhlp',VER/10+'0',VER MOD 10+'0'; FOR zcnfg
HELPDIR:
DB'help '; HELP DIR
DEFFN:DB'menu '; HELP FILE
DEFLBR:DB'hlpfiles'; DEFAULT LBR FILE NAME
DEFTYP:DB'h?p'
DEFLTYP:
DB'lbr'
PTRCHK:DB0FFH; 0FFH TO DO PRINTER-READY TEST
;
; START OF PROGRAM -- INITIALIZE ZCPR3 ENVIRONMENT
;
START:LDHL,(Z3EADR);PT TO ZCPR3 ENVIRONMENT
CALLZSYSCHK;CHECK FOR Z-SYSTEM RUNNING
RETNZ;EXIT IF NOT
LDSP,STACK; SET LOCAL STACK
CALLZ3INIT;INITIALIZE THE ZCPR3 ENV
CALLHVTINIT; INITIALIZE THE TERMINAL
LDHL,(BDOSE+1)
LD(OBUFHI),HL; PTR TO END OF BUFFER
CALLMEMBUF; sET UP POINTERS TO BURRERS
XORA; A=0
LD(HLPLVL),A; SET HELP LEVEL TO 0 (NO RETURN FILE)
LD(STDALN),A; SET TO NOT READING STANDALONE FILE
LD(SGLHDU),A; FLAG ALTERNATE DIR NOT TRIED YET
LDHL,DFTNAM; POINT TO DEFAULT NAME
CALLGCOMNAM; GET DISK NAME
LDA,(FCB1+1); GET FIRST CHAR OF FIRST ARG
CP'/'
JPNZ,NOHELP; SKIP HELP IF NOT /
;
; USAGE SCREEN
;
CALLHPRINT
DFTNAM:DB'lbrhlp '
if uncr
DB'uncr'
else; unsq
DB'unsq'
endif; uncr ELSE unsq
DB' vERSION ',VER/10+'0','.',VER MOD 10+'0'
DBREV,CR,LF
DC'uSAGE:',CR,LF,' '
LDHL,COMNAM
CALLHPSTR
CALLHPRINT
DB' {$7b}-{$7b}DIR:{$7d}LIBRARY{$7d} {$7b}{$7b}DIR:{$7d}HLPFILE{$7d}',CR,LF
DB'tHE "-" REQUIRED IF lbr IS SPECIFIED.'
DCCR,LF,' dEFAULT lbr fILE: '
LDDE,DEFLBR
CALLPLIB
CALLHPRINT
DCCR,LF,' dEFAULT hlp fILE: '
LDDE,DEFFN
CALLPLIB
CALLHPRINT
DCCR,LF,' aLTERNATE dir : '
CALLDEFDU
JRZ,HLPINF1
EXDE,HL
CALLPLIB
JRHLPINF2
HLPINF1:
LDA,B
ADDA,'a'
CALLBOUT
LDA,C
CALLPAFDC
HLPINF2:
CALLHPRINT
DB':',CR,LF
DB'iF ONLY "HLPFILE" IS GIVEN, PRECEDED BY A DIRECTORY'
DBCR,LF
DB'SPEC OR COLON, STAND-ALONE hlp FILE IS DISPLAYED.'
DBCR,LF
DC'iF FILE IS NOT FOUND, "aLTERNATE dir" IS ALSO SEARCHED.'
JPHLPEXIT
NOHELP:LDHL,TBUFF+1; GET 1ST TOKEN FROM COMMAND TAIL
CALLEATSPC; SKIP LEADING SPACES
CP'-'; LIBRARY SPECIFIED?
JRNZ,NOLIB
LD(FCB1+1),A; INDICATE THAT 1ST TOKEN WAS LBR NAME
INCHL; PT TO LBR NAME
JRNOLIB1
NOLIB:
LDL,TBUFF; h = 0
LDC,(HL)
LDB,H; b = h = 0, SO bc HAS cpir LEASH
INCHL; bUMP PAST COUNT
INCBC; gUARD AGAINST bc = 00
LDA,':'; sCAN FOR COLON
CPIR
JRNZ,NOLIB0; nO COLON, CHECK IN DEFAULT lbr
LD(STDALN),A; oTHERWISE, FLAG STANDALONE MODE
LDDE,FCB1; pOINT TO DEFAULT fcb
CALLZ3LOG; lOG IN AS PER cpr
CALLPUTUD; sAVE DIRECTORY
EXDE,HL; pOINTER TO hl
INCHL; bUMP TO NAME
LDA,(HL); gRAB FIRST CHARACTER
CP' '; bLANK?
JPZ,NOFIL; yES, USE DEFAULT HELP FILE NAME
JPYESFIL; oTHERWISE USE OURS
;
NOLIB0:LDHL,DEFLBR; PT TO DEFAULT LBR NAME
;
; LOOK IN CURRENT DIR
;
NOLIB1:LDDE,LUDFCB
XORA; DIR: BEFORE DU:
CALLZPRSFN; PARSE IN LBR NAME
ORA; a HAS COUNT OF "?"S IN ludfcb
JRNZ,LFNFND; WHICH MUST BE ZERO FOR z3pLUS
LDHL,DEFLTYP
PUSHDE
LDDE,LBRTYP; MOVE "lbr"
LDBC,3
LDIR
POPDE
CALLZ3LOG; LOG INTO FCB'S DU
XORA; CLEAR AUTO DRIVE SELECT BYTE IN FCB
LD(DE),A
CALLF$EXIST; IS LBR IN CURRENT DU?
JRNZ,LBRFND
;
; LOOK IN HELP FILE DIRECTORY
;
CALLDEFDU
CALLLOGUD
CALLF$EXIST; LOOK FOR FILE
JRNZ,LBRFND
;
; LIBRARY NOT FOUND
;
LFNFND:CALLHPRINT
DC' lIBRARY fILE '
INCDE; PT TO NAME
CALLPLIB; PRINT LIBRARY NAME
JRNZ,AMBERR
CALLHPRINT
NOTFND:DC' nOT fOUND'
JRLFNFN1
AMBERR:CALLHPRINT
DC' HAS AMBIGUOUS CHARACTERS'
LFNFN1:JPHLPEXIT1
;
; LIBRARY FOUND SO OPEN IT
;
LBRFND:LDDE,LUD
CALLLUINIT
;
; CHECK IF LBR NAME GIVEN
;
LDHL,FCB1+1; PT TO DEFAULT FCB
LDA,(HL); GET FIRST CHAR OF FILE NAME
CP' '
JRZ,NOFIL; IF NO FILE OR LIBRARY
CP'-'; WAS LBR SPECIFIED?
JRNZ,CHKFIL; NO
LDHL,FCB2+1; GET SECOND ARG
LDA,(HL)
CHKFIL:CP' '
JRZ,NOFIL
CP'?'; IS IT A WILD CARD?
JRNZ,YESFIL; IT WASN'T
; OTHERWISE LOAD DEFAULT FILENAME
NOFIL:LDHL,DEFFN; GET DEFAULT FILENAME
YESFIL:LDDE,LFCB; MOVE FILENAME IN
LDBC,8
LDIR
;
; START/RESTART HELP PROGRAM (START ON INITIAL ENTRY, RESTART ON NODE LOAD)
;
STRT1:LDSP,STACK; RESET THE STACK
LDDE,LFCB+8
LDHL,DEFTYP; GET DEFAULT TYPE
LDBC,3
LDIR; MOVE TYPE
LDHL,LFCB; PT TO FILE NAME
LDA,(STDALN)
ORA
JRNZ,STRT2
LDDE,LUD; PT TO LBR BUFFERS
CALLLUOPEN; OPEN FILE
JPZ,FILFND
JRHFNF1
STRT2:EXDE,HL
DECDE
CALLGETUD
STRT3:LDHL,TBUFF
CALLNZ,SETDMA
CALLINITFCB
CALLF$EXIST
STRT4:JRZ,HFNFND
DECA
RRCA
RRCA
RRCA
ADDA,L
LDL,A
PUSHHL
LDBC,10
ADDHL,BC
LDA,(HL)
POPHL
AND7FH
if uncr
CP'z'
else; unsq
CP'q'
endif; uncr ELSE unsq
JRZ,HFOPEN
CP'l'
JRZ,HFOPEN
LDC,18
CALLBDOS
LDHL,TBUFF
INCA
JRSTRT4
HFOPEN:LDDE,LUDFN-1
LDBC,12
PUSHDE
PUSHHL
LDIR
POPHL
LDDE,LFCB-1
LDC,12; b = 0
LDIR
POPDE
CALLINITFCB
CALLF$OPEN
JRZ,FILFND
;
; FILE NOT FOUND SO PRINT FILE NAME AND EXIT
;
HFNFND:LDHL,SGLHDU
LDA,(HL)
ORA
JRNZ,HFNF1
DEC(HL)
CALLDEFDU
CALLLOGUD
XORA
JRSTRT3
HFNF1:CALLHPRINT
HFSTR:DC' hELP fILE '
LDDE,LFCB; PT TO FILE NAME
CALLPFN2; PRINT NAME
LDHL,NOTFND
CALLHPSTR
LDA,(STDALN)
ORA
JRNZ,HFNF2
CALLHPRINT
DC' IN '
LDDE,LBRNAME
CALLPFN2
HFNF2:JRJRHLPX
;
; CHECK FILE TYPE FOR 'q' OR 'z'
; IF CRUNCHED RUN THROUGH UNCRUNCH
; OTHERWISE WRITE OUT FILE TO HELP BUFFER
;
FILFND:LDA,(LUDTYP)
AND7FH; CLEAR ANY ATTRIBUTES
if uncr
CP'z'
JPZ,UNCRIT
else; unsq
CP'q'
JPZ,UNSQIT
endif; uncr ELSE unsq
CP'l'
JRZ,NCMPRS
LDHL,HFSTR
CALLHPSTR
LDDE,LUDFN; PT TO FILE NAME
CALLPLIB; PRINT NAME
CALLHPRINT
DC' IN '
LDDE,LBRNAME
CALLPFN2
CALLHPRINT
DCCR,LF,' HAS THE UNSUPPORTED FILETYPE "'
CALLHVON
LDB,3
LDHL,LUDTYP-1
WRGTYP:LDA,(HL)
CALLCOUT
INCHL
DJNZWRGTYP
CALLHVOFF
LDA,'"'
CALLCOUT
JRHLPX:JRHLPEXIT1
;
; THIS IS USED TO EXTRACT FILES AND NOT UNSQ OR UNCR
;
NCMPRS:LDHL,(OBUFHI); GET HIGHEST AVAILABLE MEMORY
LDDE,-80H; .. MINUS 1 SECTOR
ADDHL,DE
LDC,L; MOVE TO BC
LDB,H
CALLCODEND; OUTPUT BUFFER STARTS JUST ABOVE PROGRAM
LD(OUTBUF),HL
LDDE,LUD
; READ FILE DIRECTLY INTO OUTPUT BUFFER
INLOOP:CALLSETDMA
LDA,(STDALN)
ORA
JRNZ,INLP1
CALLLUREAD; READ A SECTOR FROM LBR
JRINLP2
INLP1:LDDE,LUDFN-1
CALLF$READ
INLP2:JRNZ,HELP; DONE IF END OF FILE
LDA,B; SAVE b
LDB,80H
MASKLP:RES7,(HL); CLEAR HIGH BIT
INCHL; ..OF EACH CHARACTER READ
DJNZMASKLP
LDB,A; RESTORE b
SBCHL,BC; CHECK FOR OVERFLOW
ADDHL,BC; RESTORE VALUE IN HL WITHOUT AFFECTING FLAGS
JRC,INLOOP
JPTOOBIG
;
; START OF HELP PROGRAM
;
HELP:LDSP,STACK; INSURE GOOD STACK
LDHL,(OUTBUF); PT TO BUFFER
XORA; SET NO FRAME
LD(FRNUM),A
LD(SGLHDU),A; rESET ALTERNATE DIR FLAG
LDA,(HL); NO HEADER SECTION?
AND7FH; MASK OUT MSB
CPSECTCHAR
JRNZ,HELP1; HEADER SECTION EXISTS
INCHL; SKIP OVER SECTCHAR
CALLCLSCR; NEW SCREEN
CALLPRINFO; PRINT HELP INFO PTED TO BY HL
LDA,(HLPLVL); CHECK TO SEE IF WE ARE NOT AT LEVEL 0
ORA; 0=LEVEL 0
JPNZ,LRURN; GO TO PREVIOUS LEVEL IF NOT
;
; EXIT POINT FOR ANY EXIT FROM THE REST OF THE HELP PROGRAM
;
HLPEXIT:
XORA; CLEAR ERROR FLAG
JRHLPEXT2
HLPEXIT1:
LDA,0FFH; SET ERROR FLAG
HLPEXT2:
CALLPUTER2; SET OR CLEAR ERROR FLAG
CALLHVDINIT
RST0; REBOOT BECAUSE WE MAY HAVE OVERWRITTEN ccp
; sUBROUTINE TO RETURN "dEFAULT dir" DU IN bc REGISTER
DEFDU:LDHL,HELPDIR; LOOK FOR HELP DIRECTORY
PUSHHL
CALLDIRTDU; CONVERT TO DU IN BC
POPHL
RETNZ; LOG INTO DU IN BC IF FOUND
LDBC,(HDU); LOG INTO HELP DIRECTORY
RET
;
; PRINT HEADER INFORMATION AND SELECT AN OPTION
;
HELP1:CALLPRHEADER; PRINT HEADER
PUSHBC; SAVE C (NUMBER OF VALID SELECTIONS)
CALLCRLF1; NEW LINE
CALLHVON; GOTO DIM
CALLPRLEVEL; PRINT LEVEL NUMBER
CALLHPRINT
DC'eNTER sELECTION '
CALLPRP1; PRINT LEVEL MOVEMENT PROMPT
CALLHVOFF; GOTO BRIGHT
POPBC; GET C
CALLCIN; GET RESPONSE
CALLCAPS; CAPITALIZE
PUSHAF
CALLCLSCR; CLEAR SCREEN
POPAF
CALLCKABORT; EXIT?
JRZ,HLPEXIT
CPROOTCHAR; GO TO ROOT
JPZ,GOROOT
CALLCKLEVEL; RETURN TO PREVIOUS LEVEL?
JPZ,LRURN
LDB,A; USER INPUT IN B
LDA,(HTYPE); TYPE OF HELP FILE
CPIHCHAR; INDEXED BY USER?
JRZ,HELP5; FIND INFORMATION SECTION VIA INDEX SCAN
LDA,B; FIND INFORMATION SECITON VIA COUNT
SUB'a'-1; ADJUST FOR COUNT
LDB,A; SAVE COUNT
JRZ,BADRESPONSE
JRNC,HELP2
;
; INVALID RESPONSE
;
BADRESPONSE:
CALLSAK; RING BELL
JRHELP1
;
; VALID RESPONSE -- LOOK FOR AND PRINT INFORMATION SECTION
;
HELP2:INCC; 1 MORE THAN NUMBER OF POSSIBLE SELECTIONS
CPC; GREATER THAN NUMBER OF POSSIBLE SELECTIONS?
JRNC,BADRESPONSE
LDHL,(FIRSTENTRY); GET PTR TO FIRST ENTRY
;
; PRINT INFORMATION WHEN COUNT IS ZERO
;
HELP3:DJNZHELP4; COUNT DOWN SELECTIONS
INCHL; SKIP OVER SECTCHAR
CALLPRINFO; PRINT INFO PTED TO BY HL
JRHELP1
;
; LOCATE NEXT INFORMATION SECTION
;
HELP4:CALLFINDI; SKIP TO NEXT INFORMATION SECTION
CPCTRLZ; END OF FILE?
JRNZ,HELP3; CONTINUE LOOPING IF NOT ELSE FALL THRU TO HELPERR
;
; ERROR -- REACHED END OF HELP FILE
;
HELPERR:
CALLHPRINT
DCCR,LF,' eof ON hELP fILE'
JPHELP1
;
; LOCATE NEXT INFORMATION SECTION VIA INDEX SCAN
;
HELP5:LDHL,(FIRSTENTRY); PT TO FIRST ENTRY
;
; LOOK FOR USER INDEX
;
HELP6:PUSHHL; SAVE PTR TO THIS LINE
HELP7:INCHL; SKIP OVER SECTION CHAR
LDA,(HL); GET CHAR
CALLCAPS; CAPITALIZE
CP' '; SKIP SPACES
JRZ,HELP7
CPSECTCHAR; NEW SECTION?
JRZ,HELP8; FIND NEXT SECTION
CPCR; END OF LINE?
JRZ,HELP8; FIND NEXT SECTION
CPCTRLZ; EOF?
JRZ,HELP8
CPB; CHECK FOR USER INPUT
JRNZ,HELP7
POPHL; FOUND IT -- PRINT IT
INCHL; SKIP OVER SECTION CHAR
HELP7A:LDA,(HL); SKIP TO BEGINNING FOR 1ST LINE
INCHL; PT TO NEXT
AND7FH
CPCTRLZ; TRAP EOF
JRZ,BADRESPONSE
CPSECTCHAR; FILE SPECIFIED?
JRZ,HELP7B; PROCESS IT
CPLF; BEGIN NEW LINE
JRZ,HELP7C
CPCR; AT END OF INDEX LINE?
JRNZ,HELP7A
LDA,(HL); GET LF
AND7FH
CPLF; SKIP FOLLOWING LF IF ANY
JRNZ,HELP7C
INCHL; SKIP LF
JRHELP7C
;
; LOAD NEXT HELP LEVEL
;
HELP7B:DECHL; PT TO SECTION CHAR
;
; PROCESS HELP LEVEL OR LOAD AND PROCESS NEXT LEVEL PTED TO BY HL
;
HELP7C:CALLPRINFO; PRINT INFORMATION SECTION
JPHELP1; RESUME
HELP8:
POPHL; PT TO INFO SECTION
CALLFINDI; FIND NEXT INFO SECTION
CPCTRLZ; EOF?
JRNZ,HELP6; KEEP LOOKING
JPBADRESPONSE
;
; SKIP TO NEXT INFORMATION SECTIONS
; RETURN WITH A=SECTCHAR IF FOUND OR A=^Z IF NOT
;
FINDI:LDA,(HL); <CTRL-Z>?
AND7FH; MASK OUT MSB
INCHL; PT TO NEXT BYTE
CPCTRLZ
RETZ
CPLF; LINE FEED?
JRZ,FINDI1
CPCR; <CR>?
JRNZ,FINDI
LDA,(HL); MAKE SURE LF
AND7FH
CPLF
JRNZ,FINDI1
INCHL; SKIP OVER LF
FINDI1:LDA,(HL); GET CHAR
AND7FH; MASK OUT MSB
CPSECTCHAR; NEW SECTION?
JRNZ,FINDI; CONTINUE LOOPING
RET
;
; HELP SUPPORT ROUTINE SECTION
;
; PRINT ONE LINE OF INFO SECTION; HL PTS TO LINE UPON ENTRY;
;HL PTS TO FIRST CHAR OF NEXT LINE UPON EXIT
;
PRLINE:LDA,(HL); GET CHAR
AND7FH; MASK OUT MSB
CPCR; EOL?
JRZ,CRLF
CPLF; LINE FEED? (WS FILE)
JRZ,CRLF0
CPCTRLZ; END OF FILE?
JRZ,CRLFC; DONE IF SO
INCHL; PT TO NEXT
CPDIM; GOTO STANDOUT MODE?
JRZ,PRLDIM
CPNDIM; GOTO NORMAL MODE?
JRZ,PRLNDIM
CALLBOUT; PRINT CHAR
JRPRLINE
PRLDIM:
CALLHVON; ENTER STANDOUT MODE
JRPRLINE
PRLNDIM:
CALLHVOFF; END STANDOUT MODE
JRPRLINE
;
; PRINT CRLF, PT TO FIRST CHAR OF NEXT LINE, AND PAGE IF NECESSARY
;
CRLF:INCHL; PT TO LF
CRLF0:INCHL; PT TO 1ST CHAR OF NEXT LINE
CRLFC:CALLCRLF1; PRINT CRLF
LDA,(LCOUNT); GET LINE COUNT
DECA
LD(LCOUNT),A
RETNZ; OK -- CONTINUE
LDA,(HL); GET NEXT CHAR
AND7FH
CPSECTCHAR; NEW SECTION?
RETZ; DON'T PAGE IF SO
CPFF; FORMFEED?
RETZ
CPCTRLZ; EOF
RET Z
CRLFC1:
SET7,(HL); SET MSB OF FIRST CHAR OF NEXT LINE
CALLPRPROMPT; PRINT PROMPT AND PROCESS COMMON OPTIONS
CPBACKUPCHAR; BACK UP?
JPZ,FBACKUP
CPSTRTCHAR; JUMP TO START OF INFO
JPZ,INFOSTRT
FRESUME:
LD(STRTFRAME),HL
JPSETLCOUNT
;
; PRINT PROMPT AND PROCESS COMMON OPTIONS
;
PRPROMPT:
CALLHVON; GOTO DIM
CALLPRLEVEL; PRINT LEVEL NUMBER
LDA,(FRNUM); INCREMENT FRAME NUMBER
INCA
LD(FRNUM),A
CALLPRP1; PRINT FUNDAMENTAL LEVEL DATA PROMPT
CALLHPRINT
DBMENUCHAR,'=mENU ' ; ABORT TO MENU CHAR
DBSTRTCHAR,'=sTART ' ; JUMP TO START OF INFORMATION CHAR
DCBACKUPCHAR,'=lAST ' ; BACK UP TO PREVIOUS FRAME CHAR
CALLGETWHL
JRZ,PRPR1
CALLHPRINT
DCPRCHAR,'=pRINT ' ; PRINT CURRENT FRAME
PRPR1:CALLHVOFF; GOTO BRIGHT
CALLCAPIN; GET RESPONSE
PUSHAF
CALLCLSCR; CLEAR SCREEN
POPAF
POPDE; CLEAR STACK
CALLCKABORT; ABORT TO OS?
JPZ,HLPEXIT
LDB,A; SAVE COMMAND CHAR
CALLGETWHL
LDA,B
JRZ,PRPR2
CPPRCHAR; PRINT FRAME?
JPZ,LIST0INFO
CPCPRCHAR; PRINT INFORMATION SECTION?
JPZ,LIST1INFO
PRPR2:
CPROOTCHAR; GO TO ROOT
JPZ,GOROOT
CALLCKLEVEL; RETURN TO HIGHER LEVEL?
JPZ,LRURN
PUSHDE; RESTORE STACK
CPMENUCHAR; REDISPLY MENU?
RETNZ
LDHL,(OUTBUF); PT TO BUFFER
LDA,(HL); NO HEADER SECTION?
AND7FH; MASK OUT MSB
CPSECTCHAR
JPZ,LRURN; GO TO HIGHER LEVEL IF NO HEADER SECTION
JPHELP; ELSE START FROM HEADER SECTION AT THIS LEVEL
;
; PRINT FUNDAMENTAL LEVEL PROMPT
;
PRP1:CALLHPRINT
DC'esc=eXIT '
LDA,(HLPLVL); DON"T PRINT IF AT LEVEL 0
ORA
RETZ
CALLHPRINT
DBLRCHAR2,'=^lEVEL ' ; RETURN TO HIGHER NODE
DCROOTCHAR,'=rOOT ' ; RETURN TO ROOT
RET
;
; JUMP TO START OF INFORMATION
;
INFOSTRT:
LDHL,(STRTINFO); PT TO START OF INFO
LDA,1; RESET FRAME COUNT
LD(FRNUM),A
JPFRESUME; CONTINUE PROCESSING
;
; BACK UP TO PREVIOUS FRAME
;
FBACKUP:
CALLBOICHECK; AT BEGINNING OF INFORMATION?
JRZ,INFOSTRT
FB1:
DECHL; BACK UP UNTIL BYTE WITH MSB SET IS FOUND
BIT7,(HL)
JRZ,FB1
LDA,(FRNUM); DECREMENT FRAME NUMBER
DECA; BACK UP TO CURRENT FRAME NUMBER
DECA; BACK UP TO PREVIOUS FRAME NUMBER
LD(FRNUM),A
JPFRESUME; CONTINUE PROCESSING
;
; cLEAR SCREEN; PRINT CRLF IF NO tcap
;
CLSCR:PUSHHL
CALLGETVID
JRZ,NOCLS
PUSHDE
LDDE,17H
ADDHL,DE
LDA,(HL)
POPDE
ORA
NOCLS:POPHL
JPNZ,HVCLS
; FALL THRU TO CRLF1 IF NO CLS FUNCTION
;
; PRINT CR AND LF ONLY
;
CRLF1:LDA,CR; PRINT CR
CALLBOUT
LDA,LF; PRINT LF
JPBOUT
;
; SET LCOUNT VARIABLE TO SCREEN SIZE
;
SETLCOUNT:
PUSHHL
CALLGETCRT
INCHL; GET NUMBER OF LINES ON CRT
LDA,(HL)
DECA; 1 LESS FOR PROMPT
LD(LCOUNT),A
POPHL
RET
;
; PRINT THE HEADER SECTION AND LOAD FIRSTENTRY PTR
; ON RETURN, C=NUMBER OF POSSIBLE SELECTIONS
;
PRHEADER:
XORA; SET NO FRAME
LD(FRNUM),A
CALLSETLCOUNT
SUB3; -3 LINES FOR TOP AND BOTTOM
LD(LCOUNT),A
LDA,'a'; INIT SELECTION CHAR
LD(SELCHAR),A
CALLCLSCR; CLEAR SCREEN
CALLHPRINT
DB'lBRHLP '
DB(VER/10)+'0','.',(VER MOD 10)+'0'
DCREV,' '
LDDE,LUDFN; PT TO FCB
CALLPLIB; PRINT WITH NO SPACES
CALLHPRINT
DC' iNDEX',CR,LF,LF
LDC,0; COUNT NUMBER OF SELECTIONS
LDHL,(OUTBUF); PT TO BUFFER
LDA,(HL); GET FIRST CHAR
LD(HTYPE),A; SET TYPE OF HELP FILE
CPIHCHAR; INDEXED HELP TYPE?
JRNZ,PH1
INCHL; SKIP OVER INDEX HELP TYPE FLAG
;
; PRINT LINE UNTIL FIRST INFORMATION SECTION FOUND
;
PH1:LDA,(HL); GET CHAR
AND7FH; MASK OUT MSB
CPSECTCHAR
JRZ,PH2
CPCTRLZ; EOF? -- ABORT
JPZ,HLPEXIT
INCC; INCREMENT SELECTION COUNT
LDA,(HTYPE); CHECK FOR INDEX
CPIHCHAR
JRZ,PH1A; SKIP LETTERS IF INDEXED
LDA,(SELCHAR); DISPLAY SELECTION CHAR
CALLBOUT
INCA; INCR CHAR
LD(SELCHAR),A
CALLHPRINT
DC'. '
PH1A:CALLPRLINE; PRINT HEADER LINE
JRPH1
;
; SAVE PTR TO FIRST ENTRY
;
PH2:LD(FIRSTENTRY),HL
LDA,(LCOUNT); GET COUNT OF REMAINING LINES
LDB,A; ... IN B
ORA; ANY LEFT?
RETZ
SKIPOUT:
CALLCRLF1; NEW LINE
DJNZSKIPOUT
RET
;
; PRINT AN INFORMATION SECTION
; INFORMATION SECTION IS PTED TO BY HL
;
PRINFO:LD(STRTINFO),HL; SET START OF INFORMATION POINTER
CALLLDNOD; LOAD NEW NODE IF DUAL SECTCHAR
LD(STRTFRAME),HL; SET FRAME POINTER
SET7,(HL); SET MSB
CALLSETLCOUNT
LDA,1; A=1
LD(FRNUM),A; SET FRAME NUMBER
PI1:CALLPRLINE; PRINT LINE FROM INFO FILE
LDA,(HL); DONE?
AND7FH; MASK OUT MSB
CPCTRLZ; EOF?
JRZ,PI2
CPSECTCHAR; NEXT SECTION
JRZ,PI2
CPFF; FORM FEED?
JRNZ,PI1
INCHL; PT TO CHAR AFTER FORM FEED
CALLFORMFEED; FEED SCREEN
JRPI1
;
; FORM FEED SCREEN
;
FORMFEED:
LDA,(LCOUNT); GET LINE COUNT
LDB,A; ... IN B
ORA; 0 ALREADY?
CALLNZ,SKIPOUT; PRINT BLANK LINES IF NOT
JPCRLFC1; GO TO END OF SCREEN PROCESSING
;
; END OF INFO
;
PI2:SET7,(HL); SET MSB OF NEXT BYTE
LDA,(LCOUNT); GET LINE COUNT
ORA
LDB,A
CALLNZ,SKIPOUT
PI2MSG:
CALLHPRINT; PRINT END OF INFORMATION INDICATOR
DC'eoi '
CALLPRPROMPT; PRINT PROMPT AND PROCESS COMMON OPTIONS
CPBACKUPCHAR; BACK UP FROM EOI?
JRZ,PI2BACKUP
CPSTRTCHAR; START OF INFO?
JRZ,PI2STRT
JPSETLCOUNT; RESET LINE COUNT IN CASE OF ALL
;
; JUMP TO START OF INFO FROM EOI
;
PI2STRT:
LDHL,(STRTINFO); PT TO START OF INFO
CALLFRESUME; RESET POINTERS
LDA,1; RESET FRAME COUNT
LD(FRNUM),A
JRPI1; CONTINUE PROCESSING
;
; BACK UP TO PREVIOUS FRAME FROM EOI
;
PI2BACKUP:
CALLBOICHECK; AT BEGINNING OF INFORMATION?
JRZ,PI2STRT
PI2BACK:
CALLFB1; BACK UP TO PREVIOUS FRAME
JRPI1; CONTINUE PROCESSING
;
; CHECK FOR POSITION AT BEGINNING OF INFORMATION SECTION
; IF SO, PRINT BACKUP ERROR MSG AND RETURN W/ZERO SET
;
BOICHECK:
LDHL,(STRTINFO); START ADDRESS
EXDE,HL; ... IN DE
LDHL,(STRTFRAME); FRAME ADDRESS
LDA,D; EQUAL?
CPH
RETNZ
LDA,E
CPL
RETNZ
CALLSAK; ERROR BELL
XORA; ZERO FLAG SET
LD(FRNUM),A; SET FRAME NUMBER
RET
;
; THIS BODY OF CODE LISTS INFORMATION FROM HELP2 TO THE
; PRINTER
;
; LIST ONE LINE OF INFO SECTION; HL PTS TO LINE UPON ENTRY;
;HL PTS TO FIRST CHAR OF NEXT LINE UPON EXIT
;Z FLAG SET IF USER ABORTS
;
LISTLINE:
LDA,(HL); GET CHAR
AND7FH; MASK OUT MSB
CPCR; EOL?
JRZ,LCRLF
CPLF; LINE FEED? (WS FILE)
JRZ,LCRLF0
CPCTRLZ; END OF FILE?
JRZ,LCRLFC; DONE IF SO
INCHL; PT TO NEXT
CPTAB
JRZ,LTAB; EXPAND TAB
CPCTRLC
JRC,LISTLINE; DON'T PRINT HIGHLIGHT CONTROL CHARS
INCB; BUMP CHAR COUNT
CALLLSTOUT; PRINT CHAR
RETZ; ABORT
JRLISTLINE
;
; EXPAND TABS
;
LTAB:LDA,' '
CALLLSTOUT; PRINT A SPACE
RETZ; USER ABORT?
INCB; BUMP CHAR COUNT
LDA,B
AND7; AT TAB STOP?
JRNZ,LTAB; NO, PRINT MORE SPACES
JRLISTLINE
;
; LIST CRLF, PT TO FIRST CHAR OF NEXT LINE, AND PAGE IF NECESSARY
;
LCRLF:INCHL; PT TO LF
LCRLF0:INCHL; PT TO 1ST CHAR OF NEXT LINE
LCRLFC:CALLLCRLF1; PRINT CRLF
RETZ; ABORT
LDA,(LCOUNT); GET LINE COUNT
DECA
LD(LCOUNT),A
RETNZ; OK -- CONTINUE
CALLLFORMFEED; ADVANCE TO NEXT PAGE
SETPLC:PUSHHL; SAVE HL
CALLGETPRT; PT TO PRINTER INFO IN ENV
INCHL
INCHL; PT TO LINES OF TEXT
LDA,(HL)
LD(LCOUNT),A; SET LINE COUNT
POPHL; RESTORE HL
RET
LCRLF1:
LDA,CR; SEND <CRLF> TO PRINTER
CALLLSTOUT
RETZ; ABORT
LDA,LF; FALL THRU TO LSTOUT
;
; PRINT CHARACTER IN A ON PRINTER; AFFECT NO REGISTERS
;
LSTOUT:PUSHHL; SAVE REGS
PUSHDE
PUSHBC
LDE,A; CHAR IN E
LDC,5; BDOS PRER OUTPUT ROUTINE
CALLBDOSE
LDE,0FFH; CONDITIONAL INPUT
LDC,6; DIRECT CONSOLE I/O
CALLBDOSE
POPBC; RESTORE REGS
POPDE
POPHL
CALLCKABORT; ABORT?
RET
;
; LIST THE CURRENT INFORMATION SECTION
; INFORMATION SECTION IS PTED TO BY STRTINFO
;
; LIST0INFO -- LIST CURRENT FRAME ONLY
; LIST1INFO -- LIST CURRENT INFORMATION SECTION
;
LIST0INFO:
LDHL,(STRTFRAME); LIST CURRENT FRAME ONLY
LDA,0FFH; SET FLAG
LD(LFRFLAG),A; LIST FRAME ONLY
JRLIST2INFO
LIST1INFO:
LDHL,(STRTINFO); PREPARE TO LIST ENTIRE INFO SECTION
XORA; CLEAR FRAME LIST FLAG
LD(LFRFLAG),A
LIST2INFO:
CALLLISTINFO; DO PRINT
CALLCLSCR; CLEAR SCREEN
LDA,(FFFLG); DID WE JUST DO A FORMFEED?
ORA
CALLZ,LFORMFEED; FORM FEED PRINTER IF NOT
LDSP,STACK-2; FIX STACK POINTER
LDHL,(STRTFRAME); RETURN TO FRAME WE WERE ON
CALLFRESUME
LDA,(FRNUM); ADJUST FRAME NUMBERING
DECA
LD(FRNUM),A
JPPI1; RESUME AT PI1
;
; MAIN PRINT ROUTINE
; Z FLAG SET ON EXIT IF USER ABORTS
;
LISTINFO:
LDA,(PTRCHK); DO PRINTER CHECK?
ORA
JRZ,PRTRDY; NO, ASSUME PRINTER IS READY
LDA,15; BIOS LIST STATUS
CALLBIOS; CHECK FOR PRINTER READY
ORA
JRNZ,PRTRDY
DECA
LD(FFFLG),A; SET NO FORM FEED IF NO PRINTER...
CALLHPRINT
DBBEL
DBCR,LF,'pRINTER oFF lINE - pRESS aNY kEY tO rECHECK'
DB' (q=qUIT)',0
CALLCAPIN
CP'q'; AN ESCAPE ROUTE, IF NEEDED
JRNZ,LISTINFO; TRY AGAIN
RET
;
PRTRDY:CALLCLSCR; PRINT FRAME OR INFO SECTION
CALLHPRINT
DCCR,LF,' pRINTING '
CALLSETPLC; SET PRINTER LINE COUNT
XORA
LD(FFFLG),A; CLEAR FORMFEED FLAG
LI1:LDB,0; INIT COUNT OF CHARS ON LINE FOR TAB EXPANSION
CALLLISTLINE; LIST LINE FROM INFO FILE
RETZ; FEED PRINTER AND EXIT IF ABORT
LDA,(HL); DONE?
AND7FH; MASK OUT MSB
CPCTRLZ; EOF?
RETZ; RESUME IF AT END OF INFO
CPSECTCHAR; NEXT SECTION
RETZ; RESUME IF AT END OF INFO
CPFF; FORM FEED?
JRNZ,LI1
LDA,(LFRFLAG); LIST FRAME ONLY?
ORA; 0=NO
RETNZ
INCHL; PT TO CHAR AFTER FORM FEED
CALLLCRLFC; NEW LINE
RETZ; ABORT
LDB,10; PRINT SEPARATOR
LI2:LDA,'-'; DASHES
CALLLSTOUT
RETZ; ABORT?
DJNZLI2
CALLLCRLFC; 2 NEW LINES
RETZ
CALLLCRLFC
RETZ
JRLI1
;
; FORM FEED PRINTER
;
LFORMFEED:
CALLLCRLF1; NEW LINE
LDA,FF; OUTPUT FORM FEED
LD(FFFLG),A; SET FORMFEED FLAG
JPLSTOUT
;
; END OF BODY OF CODE WHICH LISTS INFORMATION FROM HELP2 TO
; THE PRINTER
;
; AT THE BEGINNING OF AN INFORMATION SECTION (HL PTS TO FIRST CHAR)
; CHECK TO SEE IF ANOTHER SECTCHAR FOLLOWS, AND, IF SO, LOAD THE
; SPECIFIED FILE AS A NEW NODE AND BEGIN PROCESSING IT
;
LDNOD:LDA,(HL); GET IT
AND7FH; MASK MSB
CPSECTCHAR; ANOTHER ONE?
RETNZ; PROCESS NORMALLY IF NOT
;
; WE HAVE A NEW NODE -- CHECK TO SEE IF WE CAN NEST AGAIN
;
LDA,(HLPLVL); GET CURRENT HELP LEVEL
CP25; AT MAXIMUM?
JRNZ,LDNOD1
CALLHPRINT
DCCR,LF,' nODE lEVEL lIMIT'
JPHLPEXIT1
;
; WE HAVE NOT REACHED LEVEL LIMIT, SO CONTINUE
; AT THIS TIME, A=HELP LEVEL INDEX AND HL = PTR TO CURRENT SECTION (::)
;
LDNOD1:
;
; SAVE CURRENT HELP FILE NAME FOR RETURN
;
INCHL; NOW POINTING TO FILE NAME
PUSHHL; SAVE PTR
CALLCOMPTR; HL=POINTER TO STACK ELT INDEXED BY A
EXDE,HL; DE=ADDRESS OF NEXT ELEMENT
;
; COPY CURRENT NODE ELEMENT NAME INTO NEXT STACK ELEMENT
;
LDHL,LFCB; PT TO FILE NAME
LDBC,8; 8 BYTES
LDIR
;
; INCREMENT HELP LEVEL
;
INCA; SET NEW LEVEL
LD(HLPLVL),A
;
; SET UP FCB FOR NEW FILE
;
POPHL; GET PTR TO NEW FILE NAME
LDDE,LFCB; PT TO FCB NAME
LDB,8; 8 CHARS MAX
CALLLDFCB; PLACE INTO FCB WITH ERROR CHECKING
;
; PRINT LOADING HELP FILE MESSAGE
;
PLHFM:CALLHPRINT
DCCR,LF,' lOADING help fILE '
LDDE,LFCB; PRINT FILE NAME
CALLPLIB
CALLCRLF1
JPSTRT1; LOAD NEW HELP FILE
;
; LOAD FCB PTED TO BY DE WITH "NORMAL" FILE NAME PTED TO BY HL FOR B BYTES
;
LDFCB:LDA,(HL); GET CHAR
INCHL; PT TO NEXT
CP'.'; DONE IF DECIMAL
JRZ,LDFCB2
CP' '+1; DONE IF <= <SP>
JRC,LDFCB2
CALLCAPS; CAPITALIZE
LD(DE),A; STORE CHAR
INCDE; PT TO NEXT
DJNZLDFCB
LDFCB1:
LDA,(HL); CHECK FOR ERROR
AND7FH; MASK MSB
INCHL; PT TO NEXT CHAR
CP'.'; OK IF '.'
RETZ
CP' '+1; OK IF <= <SP>
RETC
JRLDFCB1
LDFCB2:LDC,A; SAVE CHAR THAT TERMINATED STRING
LDFCB3:LDA,' '; <SP> FILL REST OF FCB
LD(DE),A; STORE <SP>
INCDE; PT TO NEXT
DJNZLDFCB3
LDA,C; GET CHAR THAT TERMINATED STRING
RET
;
; GO TO ROOT
;
GOROOT:LDA,(HLPLVL); AT ROOT?
ORA; 0=YES
JPZ,HELP; RETURN TO HELP
XORA; SET ROOT INDEX
JRGORET
;
; RETURN TO PREVIOUS HELP LEVEL
;
LRURN:LDA,(HLPLVL); ARE WE AT THE LOWEST LEVEL?
ORA; 0=YES
JRNZ,LRET
CALLSAK; ERROR BELL
JPHELP
;
; SET NEW HELP LEVEL
;
LRET:DECA; DOWN 1 AND FALL THRU TO GORET
;
; GO TO HELP LEVEL INDEXED IN A
;
GORET:LD(HLPLVL),A; SET NEW HELP LEVEL
CALLCOMPTR; HL=POINTER TO TARGET HELP FILE NAME
LDDE,LFCB; COPY ELEMENT INTO FCB
LDBC,8; 8 BYTES
LDIR
JRPLHFM; PRINT LOADING MESSAGE AND LOAD
;
; COMPUTE POINTER TO HELP NAME ENTRY INDEXED BY HELP LEVEL IN A
;
COMPTR:LDL,A; VALUE IN HL
LDH,0; COMPUTE OFFSET AS INDEX*11
ADDHL,HL; *2
ADDHL,HL; *4
ADDHL,HL; *8
LDDE,HLPNS; PT TO BASE OF HELP NAMES
ADDHL,DE; ADD IN OFFSET
RET
;
; PRINT LEVEL NUMBER
;
PRLEVEL:
LDA,(HLPLVL); DONT PRINT LEVEL 0
ORA; 0?
JRZ,PRFRAME
CALLHPRINT
DC'lEVEL '
CALLPAFDC; PRINT AS DECIMAL
LDA,(FRNUM); GET FRAME NUMBER
ORA; SET FLAGS
LDA,'/'; PREP TO PRINT SLASH
CALLNZ,BOUT; PRINT SLASH IF FRAME IS NON-ZERO
PRFRAME:
LDA,(FRNUM); GET NUMBER
ORA
LDA,' '; PREP TO PRINT SPACE ON EXIT
JPZ,BOUT
LDA,(FRNUM); GET FRAME NUMBER AGAIN
CALLPAFDC; PRINT AS DECIMAL
CALLHPRINT
DC': '
RET
;
; CHECK FOR USER ABORT VIA ^c OR esc CHARACTERS (RETURNS z IF SO)
;
CKABORT:
CPCPMABORTCHAR; ABORTING?
RETZ; (YES)
CPEXITCHAR; ABORTING VIA ALTERNATE CHARACTER?
RET
;
; CHECK FOR REQUEST TO MOVE UP A LEVEL (RETURNS z IF SO)
;
CKLEVEL:
CPLRCHAR; UP A LEVEL?
RETZ; (YES)
CPLRCHAR2; UP VIA ALTERNATE CHARACTER?
RET
;===============================
if uncr
;-------------------------------
UNCRIT:; MAIN UNCRUNCH ROUTINE
LDHL,(ENDALL)
CALLSETUP
CALLUNCREL
JPNC,HELP
DECA
JRZ,TOONEW
CALLhprint
DC' iNVALID CRUNCHED FILE'
JRERREXIT
TOONEW:
CALLhprint
DC' fILE NEEDS NEWER REVISION'
ERREXIT:
JPHLPEXIT1
;-------------------------------
else; unsq
;-------------------------------
UNSQIT:; MAIN UNSQUEEZE ROUTINE
LDHL,(ENDALL)
CALLSETUP
CALLUSQREL
JPNC,HELP
CALLhprint
DC' uNSQUEEZE eRROR: '
CP1
JRZ,DCODERR
CP3
JRZ,CHKSUMERR
CP4
JRZ,NOTSQED
CALLhprint
DC'pREMATURE eof'
JRERREXIT
DCODERR:
CALLhprint
DC'dECODE sIZE'
JRERREXIT
CHKSUMERR:
CALLhprint
DC'cHECKSUM'
ERREXIT:
JPHLPEXIT1
NOTSQED:
CALLHPRINT
DC'nOT A VALID SQUEEZED FILE'
JRERREXIT
;-------------------------------
endif; uncr ELSE unsq
;===============================
;
; "A" <-- NEXT BYTE FROM ("PHYSICAL") INPUT STREAM.
; RETURNS WITH CARRY SET ON EOF.
GETCHREQU$
GETBYTEQU$
EXX; SWITCH TO I/O REGS
ORA; BE SURE CARRY IS CLEAR
INCL; POINT TO NEXT CHAR LOC IN BUFFER
CALLZ,RDSEC; READ ANOTHER SECTOR IF AT 0
LDA,(HL); GET BYTE TO RETURN (GARBAGE IF EOF)
EXX; BACK TO NORMAL REGS & RTN
RET;
;................................
;
; SUBR FOR [ NON MULTI-] RELOAD, READS 128 BYTES TO DEFAULT DMA
;
RDSEC:PUSHDE; SAVE DE BEFORE CLOBBERING IT WITH FCB
LDA,(STDALN)
ORA
JRNZ,RDSEC1
LDDE,LUD; INPUT FCB
CALLLUREAD; READ A RECORD
JRRDSEC2
RDSEC1:LDDE,LUDFN-1
CALLF$READ
RDSEC2:POPDE; RESTORE DE TO VALUE ON ENTRY
LDHL,TBUFF
RETZ; RETURN IF SUCCESSFUL
SCF; INDICATE EOF REACHED
RET
;______________________________________________________________________________
;
; OUTPUT CHAR IN 'a' TO THE OUTPUT BUFFER.
;
OUT:EXX; SWITCH TO I/O REGS
AND7FH; CLEAR HIGH BIT
LD(DE),A; PUT BYTE INTO THE NEXT AVAIL POSITION
INCDE; PT TO NEXT POSITION IN BUFFER
PUSHHL
LDHL,(OBUFHI); HIGHEST MEMORY AVAILABLE
SBCHL,DE; COMPARE
POPHL
EXX; FLIP REGS
RETNZ; rETURN IF LIMIT NOT REACHED
TOOBIG:CALLHPRINT
DC' mEMORY oVERFLOW, fILE TOO LARGE'
JPHLPEXIT1
;-----------------------------------------------------------------------------
; ENTER WITH HL POINTING TO FIRST BYTE OF OUTPUT BUFFER AREA
; sETUP - USED TO INIT BUFFERS
SETUP:LD(OUTBUF),HL; THIS POINTS TO THE PROPER PLACE
EXX
LDHL,0FFH
LDDE,(OUTBUF)
EXX
RET
PLIB:PUSHAF
PUSHBC
PUSHDE
LDB,8; PRT 8 CHARS ONLY
PLIB1:LDA,(DE)
AND7FH
CP' '
CALLNZ,BOUT
INCDE
DJNZPLIB1
POPDE
POPBC
POPAF
RET
SAK:LDA,BEL
COUT:JPBOUT
; GET A CHAR FROM CONSOLE VIA DOS DCONIO
CIN:PUSHHL
PUSHDE
PUSHBC
CIN1:LDC,6; DIRECT CONSOLE I/O
LDE,0FFH; GET CHARACTER
CALLBDOSE
ORA; GOT A CHARACTER?
JRZ,CIN1; NO, TRY AGAIN
POPBC
POPDE
POPHL
RET
;
;===============================
if uncr
INCLUDELH-UNCR; UNCRUNCH ROUTINES
else; unsq
INCLUDELH-UNSQ; UNSQUEEZE ROUTINES
endif; uncr ELSE unsq
;===============================
;
dseg
if uncr
; THE FOLLOWING RAM LOCS MUST BE RE-INITIALIZED EACH TIME THE PROGRAM IS
; EXECUTED (FOR EACH FILE WHEN WILDCARDS ARE USED). THE AREA CALLED "SHADOW"
; IN lh-uncr.lib IS USED TO ACCOMPLISH THIS.
RAMEQU$
FULFLG:DS1; BECOMES "FF" WHEN TABLE IS FULL
LASTPR:DS2; "LAST PRED"
ENTFLG:DS1; FLAG PREVENTS DUPLICATING ENTRIES
ENTRY:DS2; CURRENT ENTRY (CODE) NUMBER.
CSAVE:DS1
CODLEN:DS1; CURRENT CODE LENGTH, IN BITS.
TRGMSK:DS1; MASK CONTAINS "1" BIT IN POS OF NEXT CODE LEN
;..............................................................................
;______________________________________________________________________________
CHAR:DS1; LAST CHAR OF THE PREVIOUSLY DECODED STRING
AVAIL:DS2; *
FFFLAG:DS1; *
DISP:DS2;
;................................
TABLE:DS1
TABLHI:DS1
EOTBL:
XLATBL:DS1
XLATBH:DS1
EXLATB:
BOTSTK:DS2
TOPSTK:
ENDALL:DS2
STKLIM:DS2
HASHER:DS2
else; unsq
TABLE:DS1
TABLHI:DS1
TABTOP:
STKBOT:DS2
STKTOP:
ENDALL:DS2
endif; uncr ELSE unsq
STDALN:DS1
SGLHDU:DS1
FFFLG:DS1; FORMFEED INDICATOR
HTYPE:DS1; TYPE OF HELP FILE (IF = IHCHAR, IT IS INDEXED BY USR)
LFRFLAG:
DS1; LIST FRAME ONLY FLAG (FOR PRINT FUNCTION)
STRTINFO:
DS2; PTR TO START OF CURRENT INFORMATION BLOCK
STRTFRAME:
DS2; PTR TO START OF CURRENT FRAME
SELCHAR:
DS1; SELECTION TABLE OPTION CHAR
FIRSTENTRY:
DS2; PTR TO FIRST ENTRY OF INFORMATION SECTION
LCOUNT:DS1; LINE COUNT BUFFER
HLPLVL:DS1; NUMBER OF HELP LEVEL CURRENT NODE IS AT (0=BOTTOM)
FRNUM:DS1; NUMBER OF CURRENT FRAME
OBUFHI:DS2; HI BYTE OF OUTPUT BUFFER
OUTBUF:DS2; PTR TO OUTPUT BUFFER
LUD:DS2; LENGTH OF DU DIR
DS2; INDEX
DS2; LENGTH OF CURRENT ENTRY
LUDFN:DS8; FILENAME
DS1; FIRST BYTE OF TYPE
LUDTYP:DS2; PTR TO TYPE FOR 'q' OR 'z'
LUDFCB:DS1
LBRNAME:
DS8
LBRTYP:DS27
LFCB:DS11; NAME OF CURRENT HELP FILE
DS22; EXTRA ROOM FOR SEARCH FIRST/NEXT CALLS
STKSAV:DS2; UNCRUNCH STACK LOCATION
HLPNS:DS200; ROOM FOR 25 HELP FILE NAMES
DS60
STACK:DS2
;
END