; PROGRAM: HELPC ; AUTHOR: Howard Goldstein ; date: November 28, 1990 ; version: 1.0 ; .comment \ HELPC is a Z-System help utility. It is similar to HELP53 except that it can handle crunched files whereas HELP53 handled squeezed files. Although similar in function to HELP53, HELPC was actually depived from LBRHLP by Bob Peddicord because the source code for HELP53 was not avail- able. HELPC thus contains all the fixes that were recently made to LBRHLP plus the following new features: o Wheel byte control of print options o Configuration via ZCNFG \ ver equ 10 rev equ ' ' z3env equ 0fe00h ; directory of help files if help directory not found ; disk equ 'A'-'A' ; disk user equ 15 ; user ; ; enter/exit standout mode ; dim equ 1 ndim equ 2 ; ; constants ; bdose equ 5 ; address of bdos entry point fcb1 equ 5ch tbuff equ 80h ; address of dma buffer tab equ 9 ; cr equ 0dh ; lf equ 0ah ; bel equ 'G'-'@' ; ^g ff equ 'L'-'@' ; ^l = form feed ctrlz equ 'Z'-'@' ; ^z ctrlc equ 'C'-'@' ; ^c ; ; help control characters ; ihchar equ ';' ; flag indicating indexed by user sectchar equ ':' ; defined to be colon backupchar equ 'L' ; back up to previous frame char strtchar equ 'S' ; jump to start of information char menuchar equ 'M' ; char to abort to menu cpmabortchar equ ctrlc ; char to exit lrchar equ '^' ; return to previous help level rootchar equ '.' ; return to root of help prchar equ 'P' ; print current frame cprchar equ 'P'-'@' ; print current information section ; ; vlib routines ; ext tinit,dinit,z3vinit,cls,stndout,stndend ; ; z3lib routines ; ext z3log,dirtdu,prtname,puter2 ext getcrt,getprt,getwhl ; ; syslib routines ; ext logud,getud,putud,setdma ext bout,caps,pafdc,eprint ext f$open,f$read,f$close,initfcb,bdos ; ; from uncrel.rel (link this last) ; ext uncrel,endu public cout,getbyt,out jp start db 'Z3ENV' ;this is a zcpr3 utility db 1 ;external environment descriptor z3eadr: dw z3env ; Configuration area for ZCNFG ; hdu: db user db disk ; A=0,B=1 etc. db 'HELPC',(VER/10)+'0',(VER MOD 10)+'0',0 helpdir: db 'HELP ' ; help dir deffn: db 'HELP ' ; help file deftyp: db 'H?P' ; ; start of program -- initialize zcpr3 environment ; start: ld sp,stack ; set local stack ld hl,(z3eadr) ;pt to zcpr3 environment call z3vinit ;initialize the zcpr3 env and the vlib env call tinit ; initialize the terminal ld hl,(bdose+1) ld (obufhi),hl ; ptr to end of buffer xor a ; a=0 ld (hlplvl),a ; set help level to 0 (no return file) ld a,(fcb1+1) ; get first char of first arg cp '/' jp nz,nohelp ; skip help if not / helpinf: call eprint db 'HELPC, Version ',[ver/10]+'0','.',[ver mod 10]+'0' db rev,cr,lf db ' Syntax: ',0 call prtname call eprint db ' [dir:][helpfn]',cr,lf db ' Default Filename : ',0 ld de,deffn call pnam call eprint db cr,lf,' Alternate DIR : ',0 ld hl,helpdir ex de,hl call dirtdu ; see if help dir exists jr z,hlpinf1 call pnam jr hlpinf2 hlpinf1: ld hl,(hdu) ld a,h add a,'A' call bout ld a,l call pafdc hlpinf2: call eprint db ':',cr,lf,0 jp hlpexit nohelp: cp ' ' jr nz,filspec ; ; Move in default file name ; ld de,fcb1+1 ld hl,deffn ld bc,8 ldir filspec: ld de,fcb1 call z3log ; log into fcb's du call putud ; save this du xor a ld (de),a ; zero auto-select byte inc de ; point to file name ex de,hl ld bc,8 ld a,'?' cpir ; check for wildcard jr nz,strt0 ; call eprint db ' AFN Not Allowed',0 jp hlpexit1 strt0: ex de,hl ; DE points to fcb1+9 ld hl,deftyp ; get default type ld c,3 ldir ; move type ; ; start/restart help program (start on initial entry, restart on node load) ; strt1: ld sp,stack ; reset the stack ; look in current dir ; call getud ld de,fcb1 ld c,17 ; search first call bdos ; is file in current du? jp p,filfnd ; ; look in help file directory ; ld hl,helpdir ; look for help directory call dirtdu ; convert to du in bc jr nz,loghlp ; log into du in bc if found ld bc,(hdu) ; log into help directory loghlp: call logud ld c,17 call bdos ; look for file jp p,filfnd ; ; file not found so print file name and exit ; fnf: call eprint db cr,lf,' Help File ',0 inc de ; pt to file name call pnam ; print name call eprint db ' Not Found',0 jr hlpexit1 ; ; Move file name found by Search Firstinto working FCB. The reason for ; the Search First, by the way, is the need to avoid wildcard opens ; for compatibility with CP/M+. ; filfnd: rrcA ; multiply dir code by 32 rrca rrca add tbuff+1 ld l,a ; point to file name ld h,0 ld de,hlpfcb+1 ld bc,11 ldir ; Initialimze FCB and open file ; ld de,hlpfcb call initfcb call f$open jr nz,fnf ; ; check file type for 'Z' ; if crunched run through uncrunch ; otherwise write out file to help buffer ; ld a,(hlpfcb+10) cp 'Z' jp z,uncrit ; ; this is used to extract files and not uncrunch ld hl,(obufhi) ; get highest available memory ld de,-80h ; N. minus 1 sector add hl,de ld c,l ; move to bc ld b,h ld hl,endu ; output buffer starts just above program ld (outbuf),hl ; read file directly into output buffer inloop: call setdma ld de,hlpfcb call f$read ; read a sector from lbr jr nz,exloop ; done if end of file ld de,80h ; bump to location for next sector add hl,de sbc hl,bc ; check for overflow add hl,bc ; restore value in hl without affecting flags jp nc,toobig jr inloop exloop: call f$close ld hl,tbuff call setdma ; reset DMA address ; ; start of help program ; help: ld sp,stack ; insure good stack ld hl,(outbuf) ; pt to buffer xor a ; set no frame ld (frnum),a ld a,(hl) ; no header section? and 7fh ; mask out msb cp sectchar jr nz,help1 ; header section exists inc hl ; skip over sectchar call cls ; new screen call prinfo ; print help info pted to by hl ld a,(hlplvl) ; check to see if we are not at level 0 or a ; 0=level 0 jp nz,lrurn ; go to previous level if not ; ; exit point for any exit from the rest of the help program ; hlpexit: xor a ; clear error flag jr hlpext2 hlpexit1: ld a,0ffh ; set error flag hlpext2: call puter2 ; set or clear error flag call dinit rst 0 ; reboot because we may have over ; written CCP ; ; print header information and select an option ; help1: call prheader ; print header push bc ; save c (number of valid selections) call crlf1 ; new line call stndout ; goto dim call prlevel ; print level number call eprint db 'Enter Selection ',0 call prp1 ; print level movement prompt call stndend ; goto bright pop bc ; get c call cin ; get response call caps ; capitalize push af call cls ; clear screen pop af cp ctrlc ; exit jr z,hlpexit cp rootchar ; go to root jp z,goroot cp lrchar ; return to previous level jp z,lrurn ld b,a ; user input in b ld a,(htype) ; type of help file cp ihchar ; indexed by user? jr z,help5 ; find information section via index scan ld a,b ; find information seciton via count sub 'A'-1 ; adjust for count ld b,a ; save count jr z,badresponse jr nc,help2 ; ; invalid response ; badresponse: call sak ; ring bell jr help1 ; ; valid response -- look for and print information section ; help2: inc c ; 1 more than number of possible selections cp c ; greater than number of possible selections? jr nc,badresponse ld hl,(firstentry) ; get ptr to first entry ; ; print information when count is zero ; help3: djnz help4 ; count down selections inc hl ; skip over sectchar call prinfo ; print info pted to by hl jr help1 ; ; locate next information section ; help4: call findi ; skip to next information section cp ctrlz ; end of file? jr nz,help3 ; continue looping if not else fall thru to helperr ; ; error -- reached end of help file ; helperr: call eprint db cr,lf,' EOF on Help File',0 jp help1 ; ; locate next information section via index scan ; help5: ld hl,(firstentry) ; pt to first entry ; ; look for user index ; help6: push hl ; save ptr to this line help7: inc hl ; skip over section char ld a,(hl) ; get char call caps ; capitalize cp ' ' ; skip spaces jr z,help7 cp sectchar ; new section? jr z,help8 ; find next section cp cr ; end of line? jr z,help8 ; find next section cp ctrlz ; eof? jr z,help8 cp b ; check for user input jr nz,help7 pop hl ; found it -- print it inc hl ; skip over section char help7a: ld a,(hl) ; skip to beginning for 1st line inc hl ; pt to next and 7fh cp ctrlz ; trap eof jr z,badresponse cp sectchar ; file specified? jr z,help7b ; process it cp lf ; begin new line jr z,help7c cp cr ; at end of index line? jr nz,help7a ld a,(hl) ; get lf and 7fh cp lf ; skip following lf if any jr nz,help7c inc hl ; skip lf jr help7c ; ; load next help level ; help7b: dec hl ; pt to section char ; ; process help level or load and process next level pted to by hl ; help7c: call prinfo ; print information section jp help1 ; resume help8: pop hl ; pt to info section call findi ; find next info section cp ctrlz ; eof? jr nz,help6 ; keep looking jp badresponse ; ; skip to next information sections ; return with a=sectchar if found or a=^z if not ; findi: ld a,(hl) ; ? and 7fh ; mask out msb inc hl ; pt to next byte cp ctrlz ret z cp lf ; line feed? jr z,findi1 cp cr ; ? jr nz,findi ld a,(hl) ; make sure lf and 7fh cp lf jr nz,findi1 inc hl ; skip over lf findi1: ld a,(hl) ; get char and 7fh ; mask out msb cp sectchar ; new section? jr nz,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: ld a,(hl) ; get char and 7fh ; mask out msb cp cr ; eol? jr z,crlf cp lf ; line feed? (ws file) jr z,crlf0 cp ctrlz ; end of file? jr z,crlfc ; done if so inc hl ; pt to next cp dim ; goto standout mode? jr z,prldim cp ndim ; goto normal mode? jr z,prlndim call bout ; print char jr prline prldim: call stndout ; enter standout mode jr prline prlndim: call stndend ; end standout mode jr prline ; ; print crlf, pt to first char of next line, and page if necessary ; crlf: inc hl ; pt to lf crlf0: inc hl ; pt to 1st char of next line crlfc: call crlf1 ; print crlf ld a,(lcount) ; get line count dec a ld (lcount),a ret nz ; ok -- continue ld a,(hl) ; get next char and 7fh cp sectchar ; new section? ret z ; don't page if so cp ff ; formfeed? ret z cp ctrlz ; eof ret z crlfc1: set 7,(hl) ; set msb of first char of next line call prprompt ; print prompt and process common options cp backupchar ; back up? jp z,fbackup cp strtchar ; jump to start of info jp z,infostrt fresume: ld (strtframe),hl jp setlcount ; ; print prompt and process common options ; prprompt: call stndout ; goto dim call prlevel ; print level number ld a,(frnum) ; increment frame number inc a ld (frnum),a call prp1 ; print fundamental level data prompt call eprint db menuchar,'=Menu ' ; abort to menu char db strtchar,'=Start ' ; jump to start of information char db backupchar,'=Last ' ; back up to previous frame char db 0 call getwhl jr z,prpr1 call eprint db prchar,'=Print ' ; print current frame db 0 prpr1: call stndend ; goto bright call cin ; get response call caps push af call cls ; clear screen pop af pop de ; clear stack cp menuchar ; abort? jp z,help ; start over if so cp cpmabortchar ; abort to os jp z,hlpexit ld b,a ; save command char call getwhl ld a,b jr z,prpr2 cp prchar ; print frame? jp z,list0info cp cprchar ; print information section? jp z,list1info prpr2: cp rootchar ; go to root jp z,goroot cp lrchar ; return to higher level jp z,lrurn push de ; restore stack ret ; ; print fundamental level prompt ; prp1: ld a,(hlplvl) ; don"t print if at level 0 or a ret z call eprint db lrchar,'=Level ' ; return to higher node db rootchar,'=Root ' ; return to root db 0 ret ; ; jump to start of information ; infostrt: ld hl,(strtinfo) ; pt to start of info ld a,1 ; reset frame count ld (frnum),a jp fresume ; continue processing ; ; back up to previous frame ; fbackup: call boicheck ; at beginning of information? jr z,infostrt fb1: dec hl ; back up until byte with msb set is found bit 7,(hl) jr z,fb1 ld a,(frnum) ; decrement frame number dec a ; back up to current frame number dec a ; back up to previous frame number ld (frnum),a jp fresume ; continue processing ; ; print cr and lf only ; crlf1: ld a,cr ; print cr call bout ld a,lf ; print lf jp bout ; ; set lcount variable to screen size ; setlcount: push hl call getcrt inc hl ; get number of lines on crt ld a,(hl) dec a ; 1 less for prompt ld (lcount),a pop hl ret ; ; print the header section and load firstentry ptr ; on return, c=number of possible selections ; prheader: xor a ; set no frame ld (frnum),a call setlcount sub 3 ; -3 lines for top and bottom ld (lcount),a ld a,'A' ; init selection char ld (selchar),a call cls ; clear screen call eprint db 'HELPC ' db (ver/10)+'0','.',(ver mod 10)+'0' db rev,' ',0 ld de,fcb1+1 ; pt to fcb call pnam ; print with no spaces call eprint db ' Index',cr,lf,cr,lf,0 ld c,0 ; count number of selections ld hl,(outbuf) ; pt to buffer ld a,(hl) ; get first char ld (htype),a ; set type of help file cp ihchar ; indexed help type? jr nz,ph1 inc hl ; skip over index help type flag ; ; print line until first information section found ; ph1: ld a,(hl) ; get char and 7fh ; mask out msb cp sectchar jr z,ph2 cp ctrlz ; eof? -- abort jp z,hlpexit inc c ; increment selection count ld a,(htype) ; check for index cp ihchar jr z,ph1a ; skip letters if indexed ld a,(selchar) ; display selection char call bout inc a ; incr char ld (selchar),a call eprint db '. ',0 ph1a: call prline ; print header line jr ph1 ; ; save ptr to first entry ; ph2: ld (firstentry),hl ld a,(lcount) ; get count of remaining lines ld b,a ; ... in b or a ; any left? ret z skipout: call crlf1 ; new line djnz skipout ret ; ; print an information section ; information section is pted to by hl ; prinfo: ld (strtinfo),hl ; set start of information pointer call ldnod ; load new node if dual sectchar ld (strtframe),hl ; set frame pointer set 7,(hl) ; set msb call setlcount ld a,1 ; a=1 ld (frnum),a ; set frame number pi1: call prline ; print line from info file ld a,(hl) ; done? and 7fh ; mask out msb cp ctrlz ; eof? jr z,pi2 cp sectchar ; next section jr z,pi2 cp ff ; form feed? jr nz,pi1 inc hl ; pt to char after form feed call formfeed ; feed screen jr pi1 ; ; form feed screen ; formfeed: ld a,(lcount) ; get line count ld b,a ; ... in b or a ; 0 already? call nz,skipout ; print blank lines if not jp crlfc1 ; go to end of screen processing ; ; end of info ; pi2: set 7,(hl) ; set msb of next byte ld a,(lcount) ; get line count or a ld b,a call nz,skipout pi2msg: call eprint ; print end of information indicator db 'EOI ',0 call prprompt ; print prompt and process common options cp backupchar ; back up from eoi? jr z,pi2backup cp strtchar ; start of info? jr z,pi2strt jp setlcount ; reset line count in case of all ; ; jump to start of info from eoi ; pi2strt: ld hl,(strtinfo) ; pt to start of info call fresume ; reset pointers ld a,1 ; reset frame count ld (frnum),a jr pi1 ; continue processing ; ; back up to previous frame from eoi ; pi2backup: call boicheck ; at beginning of information? jr z,pi2strt pi2back: call fb1 ; back up to previous frame jr pi1 ; continue processing ; ; check for position at beginning of information section ; if so, print backup error msg and return w/zero set ; boicheck: ld hl,(strtinfo) ; start address ex de,hl ; ... in de ld hl,(strtframe) ; frame address ld a,d ; equal? cp h ret nz ld a,e cp l ret nz call sak ; error bell xor a ; 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: ld a,(hl) ; get char and 7fh ; mask out msb cp cr ; eol? jr z,lcrlf cp lf ; line feed? (ws file) jr z,lcrlf0 cp ctrlz ; end of file? jr z,lcrlfc ; done if so inc hl ; pt to next cp tab jr z,ltab ; expand tab cp ctrlc jr c,listline ; don't print highlight control chars inc b ; bump char count call lstout ; print char ret z ; abort jr listline ; ; expand tabs ltab: ld a,' ' call lstout ; print a space ret z ; user abort? inc b ; bump char count ld a,b and 7 ; at tab stop? jr nz,ltab ; no, print more spaces jr listline ; ; list crlf, pt to first char of next line, and page if necessary ; lcrlf: inc hl ; pt to lf lcrlf0: inc hl ; pt to 1st char of next line lcrlfc: call lcrlf1 ; print crlf ret z ; abort ld a,(lcount) ; get line count dec a ld (lcount),a ret nz ; ok -- continue call lformfeed ; advance to next page setplc: push hl ; save hl call getprt ; pt to printer info in env inc hl inc hl ; pt to lines of text ld a,(hl) ld (lcount),a ; set line count pop hl ; restore hl ret lcrlf1: ld a,cr ; send to printer call lstout ret z ; abort ld a,lf ; fall thru to lstout ; ; print character in a on printer; affect no registers ; lstout: push hl ; save regs push de push bc ld e,a ; char in e ld c,5 ; bdose prer output routine call bdose ld e,0ffh ; conditional input ld c,6 ; direct console i/o call bdose pop bc ; restore regs pop de pop hl cp ctrlc ; 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: ld hl,(strtframe) ; list current frame only ld a,0ffh ; set flag ld (lfrflag),a ; list frame only jr list2info list1info: ld hl,(strtinfo) ; prepare to list entire info section xor a ; clear frame list flag ld (lfrflag),a list2info: call listinfo ; do print call cls ; clear screen ld a,(ffflg) ; did we just do a formfeed? or a call z,lformfeed ; form feed printer if not ld sp,stack-2 ; fix stack pointer ld hl,(strtframe) ; return to frame we were on call fresume ld a,(frnum) ; adjust frame numbering dec a ld (frnum),a jp pi1 ; resume at pi1 ; ; main print routine ; z flag set on exit if user aborts ; listinfo: call cls ; print frame or info section call eprint db cr,lf,' Printing ',0 call setplc ; set printer line count xor a ld (ffflg),a ; clear formfeed flag li1: ld b,0 ; init count of chars on line for tab expansion call listline ; list line from info file ret z ; feed printer and exit if abort ld a,(hl) ; done? and 7fh ; mask out msb cp ctrlz ; eof? ret z ; resume if at end of info cp sectchar ; next section ret z ; resume if at end of info cp ff ; form feed? jr nz,li1 ld a,(lfrflag) ; list frame only? or a ; 0=no ret nz inc hl ; pt to char after form feed call lcrlfc ; new line ret z ; abort ld b,10 ; print separator li2: ld a,'-' ; dashes call lstout ret z ; abort? djnz li2 call lcrlfc ; 2 new lines ret z call lcrlfc ret z jr li1 ; ; form feed printer ; lformfeed: call lcrlf1 ; new line ld a,ff ; output form feed ld (ffflg),a ; set formfeed flag jp lstout ; ; 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: ld a,(hl) ; get it and 7fh ; mask msb cp sectchar ; another one? ret nz ; process normally if not ; ; we have a new node -- check to see if we can nest again ; ld a,(hlplvl) ; get current help level cp 25 ; at maximum? jr nz,ldnod1 call cls ; new screen call eprint db cr,lf,' Node Level Limit',0 jp hlpexit1 ; ; 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 ; inc hl ; now pointing to file name push hl ; save ptr call comptr ; hl=pointer to stack elt indexed by a ex de,hl ; de=address of next element ; ; copy current node element name into next stack element ; ld hl,fcb1+1 ; pt to file name ld bc,8 ; 8 bytes ldir ; ; increment help level ; inc a ; set new level ld (hlplvl),a ; ; set up fcb for new file ; pop hl ; get ptr to new file name ld de,fcb1+1 ; pt to fcb name ld b,8 ; 8 chars max call ldfcb ; place into fcb with error checking ; ; print loading help file message ; plhfm: call eprint db cr,lf,' Loading HELP File ',0 ld de,fcb1+1 ; print file name call pnam jp strt1 ; load new help file ; ; load fcb pted to by de with "normal" file name pted to by hl for b bytes ; ldfcb: ld a,(hl) ; get char inc hl ; pt to next cp '.' ; done if decimal jr z,ldfcb2 cp ' '+1 ; done if <= jr c,ldfcb2 call caps ; capitalize ld (de),a ; store char inc de ; pt to next djnz ldfcb ldfcb1: ld a,(hl) ; check for error and 7fh ; mask msb inc hl ; pt to next char cp '.' ; ok if '.' ret z cp ' '+1 ; ok if <= ret c jr ldfcb1 ldfcb2: ld c,a ; save char that terminated string ldfcb3: ld a,' ' ; fill rest of fcb ld (de),a ; store inc de ; pt to next djnz ldfcb3 ld a,c ; get char that terminated string ret ; ; go to root ; goroot: ld a,(hlplvl) ; at root? or a ; 0=yes jp z,help ; return to help xor a ; set root index jr goret ; ; return to previous help level ; lrurn: ld a,(hlplvl) ; are we at the lowest level? or a ; 0=yes jr nz,lret call sak ; error bell jp help ; ; set new help level ; lret: dec a ; down 1 and fall thru to goret ; ; go to help level indexed in a ; goret: ld (hlplvl),a ; set new help level call comptr ; hl=pointer to target help file name ld de,fcb1+1 ; copy element into fcb ld bc,8 ; 8 bytes ldir jr plhfm ; print loading message and load ; ; compute pointer to help name entry indexed by help level in a ; comptr: ld l,a ; value in hl ld h,0 ; compute offset as index*11 add hl,hl ; *2 add hl,hl ; *4 add hl,hl ; *8 ld de,hlpns ; pt to base of help names add hl,de ; add in offset ret ; ; print level number ; prlevel: ld a,(hlplvl) ; dont print level 0 or a ; 0? jr z,prframe call eprint db 'Level ',0 ld a,(hlplvl) ; get number call pafdc ; print as decimal ld a,(frnum) ; get frame number or a ; set flags ld a,'/' ; prep to print slash call nz,bout ; print slash if frame is non-zero prframe: ld a,(frnum) ; get number or a ld a,' ' ; prep to print space on exit jp z,bout ld a,(frnum) ; get frame number again call pafdc ; print as decimal call eprint db ': ',0 ret ;----------------------------------------------------------------------------- uncrit: ; main uncrunch routine ld de,endu ; end of program ld hl,24*1024+255 ; uncrunch buffer size plus add hl,de ld l,0 ; output buffer starts on next page boundary ld (outbuf),hl exx ld bc,0ffh ; init pointer to input buffer ld de,(outbuf) ; init pointer to output buffer exx ex de,hl ; pointer to uncr buffer in hl call uncrel push af ; save return code from uncrel ld de,hlpfcb call f$close ; close file pop af jp nc,help dec a jr z,toonew call EPRINT db cr,lf,'Invalid crunched file',0 jr errexit toonew: call EPRINT db cr,lf,'File needs newer revision',0 errexit: jp hlpexit1 ;------------------------------------------------------------------------------ ; ; "a" <-- next byte from ("physical") input stream. ; returns with carry set on eof. getbyt: exx ; switch to i/o regs or a ; be sure carry is clear inc c ; point to next char loc in buffer call z,rdsec ; read another sector if at 0 ld a,(bc) ; 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: ex de,hl ; save de before clobbering it with fcb ld de,hlpfcb ; input fcb call f$read ; read a record ex de,hl ; restore de to value on entry ld bc,tbuff ret z ; return if successful scf ; indicate eof reached ret ;______________________________________________________________________________ ; ; output char in 'A' to the output buffer. ; out: exx ; switch to i/o regs ld (de),a ; put byte into the next avail position inc de ; pt to next position in buffer ld hl,(obufhi) ; highest memory available or a ; clear carry sbc hl,de ; compare exx ; flip regs ret nz ; return if limit not reached toobig: call eprint db 'Memory Overflow, File too large',0 ld de,hlpfcb call f$close jp hlpexit1 ;----------------------------------------------------------------------------- pnam: push af push bc push de ld b,8 ; prt 8 chars only pnam1: ld a,(de) cp ' ' jr z,pnamend call bout inc de djnz pnam1 pnamend: pop de pop bc pop af ret sak: ld a,bel cout: jp bout ; get a char from console via dos dconio cin: push hl push de push bc cin1: ld c,6 ; direct console i/o ld e,0ffh ; get character call bdose or a ; got a character? jr z,cin1 ; no, try again pop bc pop de pop hl ret DSEG ffflg: ds 1 ; formfeed indicator htype: ds 1 ; type of help file (if = ihchar, it is indexed by usr) lfrflag: ds 1 ; list frame only flag (for print function) strtinfo: ds 2 ; ptr to start of current information block strtframe: ds 2 ; ptr to start of current frame selchar: ds 1 ; selection table option char firstentry: ds 2 ; ptr to first entry of information section lcount: ds 1 ; line count buffer hlplvl: ds 1 ; number of help level current node is at (0=bottom) frnum: ds 1 ; number of current frame obufhi: ds 2 ; hi byte of output buffer outbuf: ds 2 ; ptr to output buffer hlpfcb: ds 36 stksav: ds 2 ; uncrunch stack location hlpns: ds 200 ; room for 25 help file names ds 60 stack: ds 2 end