Our diskette menu program

Menu program

Here is a compact program (only 2k) building a handy menu for your diskettes. It runs on any memory configuration, loads quickly and can be controlled with the joystick. With it you can easily deal with multipart programs, so that only the first part will show up in the menu.

 

How to use it

Put the program as first one on a diskette so that you can load it with the classical: LOAD”*”,8

You choose the program to be executed by selecting it on te menu using the cursor keys or the joystick, then RETURN or FIRE to run.

At its first run the program will read the diskette contents and will create an index file named dir.dta to be used the next time for faster execution. In case you add or remove programs on the diskette, you just can tell the program to update that index file by pressing the [CLR] key (Shift-Home).

Unlisted files

The program by default will not display itself and will hide all files whose name terminates with an extension (such as “.CHN” for example). So, if you have a multipart program say file1, file2, file3 to be loaded in sequence, you just need to rename file2 and file3 as file2.chn file3.chn so that they won’t be displayed in the list.

The source code

110 PRINT”{CLR}MENU:VIC20RELOADED.COM”:REMV1.3
120 DIMTB$(155):D=PEEK(186)
190 C=1:C1=0:C2=6:IFPEEK(648)<>16ANDPEEK(648)<>30THENC1=1:C2=15
200 OPEN8,D,8,”:DIR.DTA”:OPEN15,D,15:INPUT#15,A,A$,I,J
210 INPUT#8,DN$:IFATHENCLOSE8:CLOSE15:GOTO536
220 INPUT#8,A$:PRINT”.”;
230 IFLEN(A$)<21THENA$=” “+A$
232 IFLEN(A$)<21THENA$=A$+” ”
234 IFLEN(A$)<21THEN230
236 TB$(C)=A$:IFST=64THEN250
240 C=C+1:GOTO220
250 CLOSE8:CLOSE15:M=C:TB$(M+1)=” ”
260 POKE646,C2:PRINT”{CLR}”DN$:H=1:POKE198,0
261 PRINT”{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{RVS}UP{RIGHT}DWN{RIGHT}HOME{RIGHT}RET{RIGHT}CLR{RIGHT}{5F}”
262 GOSUB1100.DISPLAY
310 GETA$:S=PEEK(37151):POKE37154,127:T=PEEK(37152):POKE37154,255
318 IFA$=”{UP}”OR((4ANDS)=0)THENIFH>1THENH=H-1:GOTO262
320 IFA$=”{DOWN}”OR((8ANDS)=0)THENIFH<144THENH=H+1:GOTO262
330 IFA$=”{HOME}”THENH=1:GOTO262
332 IFA$=CHR$(13)OR((32ANDS)=0)THENIFH<=MTHENGOSUB1200:GOTO400
334 IFA$=”{CLR}”THEN530
336 IFA$=”{5F}”THENPOKE198,0:POKE646,C2:PRINT”{CLR}”:END
340 IFA$=” “THENOPEN15,D,15,”I”:CLOSE15:RUN120
380 GOTO310
400 POKE646,C2:PRINT”{CLR}LOAD”;CHR$(34);TB$(H);”*”;CHR$(34);”,8″
402 A$=”{HOME}”+CHR$(13)+”RUN”+CHR$(13):FORI=1TOLEN(A$)
404 POKE630+I,ASC(MID$(A$,I,1)):NEXT:POKE198,I-1:END
530 POKE646,C2
536 PRINT”{CLR}UPDATING…”
540 OPEN8,D,0,”$0″:FORC=1TO8:GET#8,A$:NEXT:C=1:DN$=””:FORC=1TO16
550 GET#8,A$:DN$=DN$+A$:NEXT:GET#8,A$:GET#8,A$:DN$=DN$+” “:GET#8,A$
560 DN$=DN$+A$:GET#8,A$:DN$=DN$+A$:GET#8,A$:GET#8,A$
570 GET#8,A$:GET#8,A$:C=1
580 FORA=1TO4:GET#8,A$:NEXT:PN$=””:TY$=””
590 GET#8,A$:IFST<>0THEN680
600 IFA$=””THEN680
610 IFASC(A$)<>34THEN590
620 GET#8,A$:IFASC(A$)<>34THENPN$=PN$+A$:GOTO620
630 GET#8,A$:IFA$=” “THEN630
640 TY$=TY$+A$:GET#8,A$:IFA$<>””THEN640
650 IFLEFT$(TY$,3)<>”PRG”THEN580
660 IFLEFT$(PN$,1)=” “THEN580
662 FORI=1TOLEN(PN$):IFMID$(PN$,I,1)<>”.”THENNEXT
664 IFI”.EXE”ANDA$<>”.COM”THEN580
665 IFI>=LEN(PN$)ANDPN$=”MENU”THEN580.JUMPOVER
666 PN$=LEFT$(PN$,I-1)
670 TB$(C)=PN$:C=C+1:IFST=0THEN580
680 CLOSE8:OPEN15,D,15,”I”:PRINT#15,”S:DIR.DTA”:CLOSE15
690 OPEN8,D,8,”:DIR.DTA,S,W”:PRINT#8,DN$
700 FORA=1TOC-1:PRINT#8,TB$(A):NEXT
720 CLOSE8:RUN
998 REM *ERRORS**
999 OPEN15,D,15
1000 INPUT#15,A,B$,C,W:PRINTA;B$;C;W:CLOSE15:END
1006 RETURN
1100 REM *DISPLAY**
1102 POKE646,C1:PRINT”{HOME}{DOWN}”;:FORI=HTOH+10
1104 PRINT”{RVS}”TB$(I):POKE646,C2:NEXT
1106 RETURN
1200 REM *RESTORE NAME**
1202 FORI=1TOLEN(TB$(H))-1:IFMID$(TB$(H),I,1)=” “THENNEXT
1204 FORJ=LEN(TB$(H))TO2STEP-1:IFMID$(TB$(H),J,1)=” “THENNEXT
1206 TB$(H)=MID$(TB$(H),I,J-I+1):RETURN

Line 120: Detects disk drive number and puts it into variable D for later use
Line 190: C1,C2 colors for menu. You can tweak this line to use alternate colors if expansion is fitted
Lines 200-240: Reads index file (dir.dta) and stores file names into TB$() array
Line 310-380: Keyboard and Joystick poll cycle
Line 400: Loads and runs selected program in command mode
Line 530-720: Reads diskette directory and writes the dir.dta index file
Line 998: Disk error checking routine (unused)
Line 1100 (sub): displays the list of files contained in the TB$() array

Download

Get the program with this link.


1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

One Reply to “Our diskette menu program”

Leave a Reply to Alex Cancel reply

Your email address will not be published. Required fields are marked *