'=========================================================================== ' Subject: SIMPLE TEXT VIEWER FOR BASEC Date: 01-20-99 (23:00) ' Author: The ABC Programmer Code: BEC ' Origin: voxel@edmc.net Packet: BASEC.ABC '=========================================================================== '' Really really simple/useless text viewer for BASEC v0.15 [DOS] '' By William Yu (January 20, 1999) DIM Pointers(1 to 5000) AS LONG DIM I AS INTEGER, A AS INTEGER, MAX AS INTEGER DIM A$ AS STRING DIM TotalBytes AS LONG DIM FilePos AS INTEGER, COffset AS INTEGER DIM FileName AS STRING FileName = "TXTVIEW.BAS" CLS FileNum = FREEFILE OPEN "B", FileNum, FileName IF LOF(FileNum) = 0 THEN CLOSE FileNum ?FileName;" not found." KILL FileName END END IF GOSUB DrawInterface Pointers(1) = 1 I = 1 TotalBytes = 0 LOCATE 22,2:?"Loading..." DO A$ = SPACE$(250) GET #FileNum, , A$ DO A = INSTR(A+1,A$, CHR$(13)) IF A <> 0 THEN I = I + 1 Pointers(I) = TotalBytes + A+2 END IF LOOP UNTIL A = 0 TotalBytes = TotalBytes + 250 LOOP UNTIL EOF(FileNum) Max = I-1 LOCATE 22,2:?CHR$(24)+CHR$(25)+CHR$(27)+CHR$(26)+"/PGUP/PGDN/HOME/END" FilePos = 17: COffset = 1 GOSUB UpdateText DO A$ = INKEY$ IF A$ = CHR$(0) + "P" THEN FilePos = FilePos + 1 IF FilePos > Max+15 THEN FilePos = Max+15 GOSUB UpdateText END IF IF A$ = CHR$(0) + "H" THEN FilePos = FilePos - 1: GOSUB UpdateText IF A$ = CHR$(0) + "Q" THEN FilePos = FilePos + 17 IF FilePos > Max+16 THEN FilePos = Max+15 GOSUB UpdateText END IF IF A$ = CHR$(0) + "I" THEN FilePos = FilePos - 17: GOSUB UpdateText IF A$ = CHR$(0) + "O" THEN FilePos = Max: GOSUB UpdateText IF A$ = CHR$(0) + "G" THEN FilePos = 17: GOSUB UpdateText IF A$ = CHR$(0) + "M" THEN COffset = COffset + 1: GOSUB UpdateText IF A$ = CHR$(0) + "K" THEN IF COffset <> 1 THEN COffset = COffset - 1 GOSUB UpdateText END IF END IF LOOP UNTIL A$ = CHR$(27) CLOSE FileNum LOCATE ,,1 END DrawInterface: LOCATE 2,1,0: COLOR 0,7: PRINT SPACE$(80) LOCATE 2,3: PRINT "Simple Text Viewer for BASIC v0.15 by William Yu" COLOR 7, 1 LOCATE 3,1 : PRINT "Ú"; STRING$(78,"Ä"); "¿" COLOR 1,7:LOCATE 3,40-INT(LEN(FileName)/2):?" ";FileName;" " COLOR 7,1 FOR I = 4 to 20 LOCATE I,1: ?"³" LOCATE I,80: ?"³" NEXT I LOCATE 21,1 : PRINT "À"; STRING$(78,"Ä"); "Ù" LOCATE 22,1 : COLOR 0,7: PRINT SPACE$(80) RETURN UpdateText: IF FilePos - 16 < 1 THEN FilePos = 17 COLOR 0, 7 LOCATE 22,50:?SPACE$(30) LOCATE 22,50:?"³ Line: "; FilePos-16;"...";FilePos;" Col:";COffset COLOR 7, 1 LOCATE 4 FOR I = FilePos-16 TO FilePos A$ = SPACE$(Pointers(I+1) - Pointers(I)-2) GET #FileNum, Pointers(I), A$ A$ = MID$(A$, COffset, 78) LOCATE ,2: ? A$ + SPACE$(78-LEN(A$)) NEXT I RETURN