!! TYPRAN.bas Prints a random file on the terminal ! ! makes use of STRCTL.SBR on AMUS ! STRIP.SBR somewher in AMOS land ! INKEY.SBR on AMUS !! !! Author James A. Jarboe IV ! Educational Filmstrips ! 1401 19th street ! Huntsville TX 77340 ! 409-295-5767 ! GR/AM ! 25-NOV-85 ! !! Displays a random file on the terminal similar !! to the way TYPE displays a sequential file. !! INVOKE using the DO file called TYPRAN.DO !! Options at invoking time include !! !! /B:## starting at relative block number of the file !! /R display relative record # of file !! /P:## print ## bytes per line of display !! /D display Alpha Accounting dummy record !! !! Options during displying of file include !! !! SPACE BAR freeze display or continue display !! 1-9 slow display 1=slow 9=fast !! HOME start at begining of file !! S stop display !! Q quit and exit !! D display Alpha Accounting dummy record !! H display this help !! BELOW is TYPRAN.DO !! !D #USAGE !:S !; !; TYPRAN.DO !; types out a random file on screen !; !; Created: 25-nov-85 by JAJ GR/AM !; !:S !GOTO #$0 !;##USAGE !XY=0 !XY=11 !: !XY=12 !: !XY=11 !:< filename/{OPTIONS} !> !XY=12 !:< ! This program will type out a RANDOM file on the screen. ! Default characteristics are: ! DAT extension ! starting at block #1 of the file opened ! printing 64 bytes per line ! ! Options: ! /B:## starting at logical block number of the file ! /R display logical record # of file ! /P:## print ## bytes per line ! /D display Alpha Accounting dummy record ! ! SPACE BAR freeze display or continue display ! 1-9 slow display 1=slow 9=fast ! HOME start at begining of file ! S stop display ! Q quit and exit ! D display Alpha Accounting dummy record ! H display this help !> !XY=12 !GOTO @EXIT !; !; FORMAT the document specified. !; !; 1) find out if it exists. !;#$0 !LOAD STRCTL.SBR !LOAD STRIP.SBR !LOAD INKEY.SBR !:R !RUN DSK0:TYPRAN.RUN[77,7] !$0 !;@EXIT !; we're done with this simple little routine folks. !:R ! ! PROGRAM MAP1 PLINE,S,512 ! input line variable MAP1 FILENAME,S,50 ! name of input string MAP1 FILE$,S,24 ! name of file MAP1 MSG$,S,12 ! message string MAP1 RECSIZ,F,6,64 ! record size default of 64 bytes MAP1 SLASH1,F ! / character MAP1 BLOCK,S,1 ! block # of file opened MAP1 RECORD,S,1 ! relative record # MAP1 PAGE,S,1 ! bytes per line printed MAP1 STRING,S,1,"0" ! Inkey input character MAP1 HOLD,S,20 ! / data MAP1 STORE,F ! store file1 number MAP1 DUMB,S,1 MAP1 DUMMY MAP2 BYT1,S,1 ! Alpha filler MAP2 BYT2,S,1 ! Alpha filler MAP2 BYT3,F ! Alpha organized count MAP2 BYT4,F ! Alpha record count MAP2 BYT5,F ! Alpha maximum count MAP2 BYT6,F ! Alpha delete count ! ! TOP: FILEBASE 1 ! make record 1 = #1 FILE1=0 ! clear stuff ? TAB(-1,0); ! clear screen INPUT LINE "",FILENAME ! get name of file FILENAME=UCS(FILENAME) ! make it all upper case XCALL STRIP,FILENAME ! clear out blanks CALL CLEAN ! cleanup input line for filename LOOKUP FILE$,ANSWER ! look it up ? IF ANSWER=0 THEN ? FILE$;" doesn't exist":GOTO END IF ANSWER>0 THEN ? "mismatch file type":GOTO END OPEN #1,FILE$,RANDOM,512,FILE1! open file RECCNT=ABS(ANSWER) ! size of file CALL SLASH ! get options BEGIN: FILE1=FILE1+1 ! increment file IF FILE1=1 THEN RECNO=0 ! record count to 0 IF (FILE1=1 AND DUMB="1") THEN CALL DUMB ? TAB(-1,11);"Block #";FILE1;TAB(-1,12) ! print relative block READ #1,PLINE ! read file XCALL STRCTL,PLINE ! clear out unprintables XCALL STRIP,PLINE ! clear out blanks at end of line SIZ=INT((512/RECSIZ)+.9) ! printed lines of record NEWSIZ=1 ! starting byte of displayed record FOR I= 1 TO SIZ ! number of lines IF PAUSE>300 THEN FOR P=1 TO PAUSE:NEXT P ! if pause set RECNO=RECNO+1 ! relative record # REC$=RECNO ! put in string MSG$="" ! clear message IF RECORD="1" THEN MSG$="Rec #"+REC$+SPACE$(6-LEN(REC$)) IF RECORD="1" AND NEWSIZ+RECSIZ>513 & THEN RECNO=RECNO-1:MSG$="not valid " ? MSG$;PLINE[NEWSIZ;RECSIZ] ! print it on screen CALL INKEY ! check for any inputs NEWSIZ=NEWSIZ+RECSIZ ! IF STRING="Q" THEN I=SIZ:NEXT I:GOTO OUT ! quit if necessary NEXT I IF FILE1= RECCNT THEN GOTO OUT ! quit if through GOTO BEGIN ! get next block OUT: CLOSE #1 ! close file ? IF FILE1=1 THEN MSG$="block read" ELSE MSG$="blocks read" ? "Total of";FILE1;MSG$ ! print stat END: END !!!!!!!!!! inkey input subroutine INKEY: STRING="0" ! XCALL INKEY,STRING STRING=UCS(STRING) IF STRING=" " THEN CALL NOMOVE IF STRING="H" THEN CALL HELP IF STRING="S" THEN CALL NOMOVE:RETURN IF STRING="D" THEN CALL DUMB:RETURN IF ASC(STRING)=30 THEN ? TAB(-1,0);:FILE1=0:I=SIZ:RETURN IF ASC(STRING)=19 THEN CALL NOMOVE:RETURN IF VAL(STRING)>0 THEN CALL PAUSE:RETURN RETURN !!!!!!!!! stop display NOMOVE: STRING="%" XCALL INKEY,STRING IF STRING #"%" THEN RETURN GOTO NOMOVE !!!!!!!! slow display PAUSE: PAUSE=VAL(STRING) PAUSE=PAUSE*300 RETURN !!!!!!!! look for / SLASH: POS=1 SLASH1: SLASH1=INSTR(POS,FILENAME,"/") IF SLASH1=0 THEN RETURN POS=SLASH1+1 SLASH2=INSTR(POS,FILENAME,"/") IF SLASH2=0 THEN POS=LEN(FILENAME) ELSE POS=SLASH2-1 HOLD=FILENAME[SLASH1+1,POS] XCALL STRIP,HOLD IF HOLD[1,2]="B:" THEN BLOCK="1":FILE1=VAL(HOLD[3,POS])-1:GOTO POS IF HOLD[1,2]="P:" THEN PAGE="1":RECSIZ=VAL(HOLD[3,POS]):GOTO POS IF HOLD[1,1]="R" THEN RECORD="1":GOTO POS IF HOLD[1,1]="D" THEN DUMB="1": GOTO POS ? ? HOLD;" is an invalid option" ?:?TAB(-1,32); ? " Valid Options are: ";TAB(-1,33); ?:? ? " /B:## starting at logical block number of the file" ? " /R display logical record # of file" ? " /P:## print ## bytes per line" ? " /D display Alpha Accounting dummy record" ? : ? "Press any key to continue"; CALL NOMOVE ? POS: POS=POS+1 GOTO SLASH1 !!!!!!!! help screen HELP: ? TAB(-1,0); ?:? TAB(-1,32); ?" OPTIONS " ?TAB(-1,33); ? ?" SPACE BAR Freeze display or continue display" ?" 1-9 Slow display 1=slow 9=fast" ?" HOME Start at begining of file" ?" S Stop display" ?" Q Quit and exit" ?" D display Alpha Accounting dummy record" ?" H display this help" ?:?:?:?:?"Press any key to continue"; CALL NOMOVE ? RETURN DUMB: STORE=FILE1 FILE1=1 READ #1,DUMMY FILE1=STORE ? ? TAB(-1,32); ? "Dummy Record";TAB(-1,33); ?:? ? "flag 1 ";BYT1 ? "flag 2 ";BYT2 ? "orgcnt ";BYT3 ? "reccnt ";BYT4 ? "maxcnt ";BYT5 ? "delcnt ";BYT6 ? ? "Press any key to continue"; CALL NOMOVE ? RETURN CLEAN: RB=INSTR(1,FILENAME,"]") IF RB>1 THEN FILE$=FILENAME[1,RB]:RETURN SL=INSTR(1,FILENAME,"/") IF SL>1 THEN FILE$=FILENAME[1,SL-1]:RETURN FILE$=FILENAME RETURN