10 REM <<HELP.BAS>> 1987.3.24 [create HELP.TIT and HELP.TXT from HELP.DBS]
20 DIM W$(127),L$(100),T$(50):DEFINT A-Y:DEFDBL Z:BELL$=CHR$(7)+CHR$(7)+CHR$(7)
30 CLS:PRINT"Create REFERENCE about dBASE III or III PLUS from HELP.DBS for print":LOCATE 5
40 OPEN"HELP.DBS" AS 1 LEN=1:FIELD 1,1 AS D$:GET 1:D=ASC(D$):GET 1
50 IF D=215 AND ASC(D$)=10 THEN W$(56)="dBASE III PLUS":W$(48)="^End":WJ$="`":CC1=6:CC2=152:ELSE IF D=162 AND ASC(D$)=7 THEN W$(56)="dBASE III":W$(48)="~~~~":WJ$="&":CC1=4:CC2=162:ELSE PRINT" HELP.DBS is bad !"+BELL$:SYSTEM
60 FOR I=0 TO 47:W$(I)=WJ$+CHR$(I):NEXT I:FOR I=53 TO 55:READ W$(I):NEXT I:FOR I=57 TO 64:READ W$(I):NEXT I:FOR I=65 TO 127:W$(I)=WJ$+CHR$(I):NEXT
70 DATA " Syntax : "," Description : "," Example : "," See also : ","","^S","&<","","Esc","PgUp/PgDn","Enter"
80 GET 1:C0=ASC(D$):C0$=RIGHT$(STR$(C0),3):CR$=CHR$(13)+CHR$(10):FOR I=1 TO 100:CRL$=CRL$+CR$:NEXT I
300 GET 1,7+4*C1:ZRL=ASC(D$):GET 1:ZR=ASC(D$):ZRL=ZRL+256#*ZR:GET 1:ZR=ASC(D$):ZRL=ZRL+65536#*ZR+2:CLOSE 1:ZR1=INT((ZRL-1)/ZBUFFSIZE):ZRL=ZRL-1-ZR1*ZBUFFSIZE
310 OPEN TXTFILE$+".TXT" AS 2:IF LOF(2)>0 THEN PRINT:PRINT" "+TXTFILE$+".TXT already exists , overwrite it ? [Y/N] "+BELL$;:INPUT "",X$:IF X$<>"Y" AND X$<>"y" THEN SYSTEM
440 WEND:PRINT L$(0),:IF L$(1)="~~~~" THEN L$(1)=L$(2):L$(2)=""
450 IF L$(0)=MID$(L$(1),2) THEN LHEAD$="" ELSE LHEAD$=" ["+MID$(L$(1),2)+"]"
460 LN=LN+N+1+CRN:IF LN<=PZ THEN 480 ELSE IF START$="" THEN START$="!":GOTO 470 ELSE IF PF$<>"L" AND PF$<>"l" THEN PRINT# 2,CHR$(12);ELSE LN=PZ+1-LN+N+1+CRN:IF LN<1 THEN PRINT# 2,"" ELSE PRINT# 2,LEFT$(CRL$,2*LN);
470 LN=N+1+CRN:PN=PN+1:IF PS>0 THEN PRINT# 2,MG$+HEAD$+SPACE$(54)+"Page";PN;CR$ ELSE PRINT# 2,CR$
480 START$="!":TN=CN MOD 48:CN=CN+1:IF PS>0 THEN TNN=PN ELSE TNN=CN
520 OPEN"O",2,TXTFILE$+".TIT":PRINT# 2,CHR$(27)+"A";MG$+W$(56);CR$+CR$+CR$+MG$+SPACE$(32)+DW$+"CONTENTS"+NW$+CR$+CR$+CR$:FOR I=0 TO 47:PRINT# 2,MG$+LEFT$(T$(I),79):NEXT I:IF PF$<>"L" AND PF$<>"l" THEN PRINT# 2,CHR$(12);ELSE PRINT# 2,LEFT$(CRL$,20)
530 IF CN>144 THEN PRINT# 2,MG$+W$(56)+CR$+CR$+CR$+MG$+SPACE$(32)+DW$+"CONTENTS"+NW$+CR$+CR$+CR$:FOR I=0 TO 47:PRINT# 2,MG$+MID$(T$(I),88,79):NEXT I:IF PF$<>"L" AND PF$<>"l" THEN PRINT# 2,CHR$(12);ELSE PRINT# 2,LEFT$(CRL$,20)
540 CLS:LOCATE 6:PRINT" "+TXTFILE$+".TIT and "+TXTFILE$+".TXT have deen created , you can TYPE them to print"+BELL$:PRINT:SYSTEM