95 DEFINT D,I-L,O,U-Z
97 DEFSTR A
100 DIRMAX=128	'MAXIMUM # OF DIRECTORY ENTRIES (EXTENDED FROM STANDARD 64)
110 PRINT CHR$(26)	'CLR SCREEN CODE OSBORNE, FOR ZORBA USE CHR$(27)+"E"
120 DIM D(8,DIRMAX),A$(DIRMAX)           
130 FILES"*.BAS"	'DISPLAY ALL .BAS FILES ON SCREEN
140 OFFSET=&HF700:COLUMN=0:Y=1	'FOR OSBORNE OFFSET IS &HF000 PEEK VIDEO RAM
150 VIDEO=OFFSET+COLUMN*14	'TO GET FILE NAMES INTO ARRAY
170 IF (PEEK(VIDEO))=32 THEN 230
180 FOR X=0 TO 7	'READ FILE NAME INTO ARRAY
190 D(X,Y)=PEEK(VIDEO+X):A$(Y)=A$(Y)+CHR$(D(X,Y))
200 NEXT X
210 Y=Y+1:COLUMN=COLUMN+1
220 GOTO 150
230 OFFSET=OFFSET+80:COLUMN=0	'IF THE FILE NAME STARTS WITH A SPACE
240 VIDEO=OFFSET+COLUMN*14	'DROP DOWN TO THE NEXT LINE
250 IF (PEEK(VIDEO))=32 THEN DIRMAX=Y-1:GOTO 270
260 GOTO 180
270 PRINT CHR$(26)	'USE APPROPRIATE CLEAR SCREEN CODE.  CLEAR SCREEN
290 PRINT TAB(10);"************************************************************"
310 PRINT TAB(10);"*         M E N U  FOR MBASIC PROGRAMS ON THIS DISK        *"
312 PRINT TAB(10);"*  ORIGINAL PROGRAM BY JIM DUNN (C) 1985  12/85 FOGHORN    *"
322 PRINT TAB(10);"*  DIRECTORY SORT ROUTINE ADDED BY T. S. COX  12/24/85     *"
324 PRINT TAB(10);"* GENERIC 80 COLUMN VERSION WITH FIVE COLUMNS OF FILENAMES *"
330 PRINT TAB(10);"************************************************************"
340 PRINT
510 PRINT
515 GOSUB 2000:GOTO 3000
520 PRINT"          ENTER NUMBER OF PROGRAM YOU WISH TO RUN, PRESS <ENTER>";:INPUT C
530 G$=A$(C)
540 PRINT"LOADING ";G$
550 RUN G$
560 END
2000 'SHELL-METZNER SORT
2005 M=DIRMAX
2010 M=M\2:IF M=0 THEN 2080
2020 K=DIRMAX-M:J=1
2030 I=J     
2040 L=I+M
2050 IF A$(I)<=A$(L) THEN J=J+1:IF J>K THEN 2010 ELSE 2030 ELSE 2060
2060 SWAP A$(I),A$(L):I=I-M:IF I>0 THEN 2040
2070 J=J+1:IF J>K THEN 2010 ELSE 2030
2080 RETURN
3000 COLY=INT(DIRMAX/5)	'PRINT 5 COLUMNS WIDE (FOR 80 COLUMN SCREEN)
3360 IF DIRMAX/5>COLY THEN COLY=COLY+1
3370 FOR Y=1 TO COLY
3380 Z=Y
3390 IF Z>9 THEN PRINT TAB(1);Z;"- ";ELSE PRINT TAB(1);" ";Z;"- ";
3400 GOSUB 5570		'PRINT FILE NAME TO SCREEN
3410 Z=Y+COLY
3420 IF Z>DIRMAX GOTO 3490
3430 IF Z>9 THEN PRINT TAB(17);Z;"- ";ELSE PRINT TAB(17);" ";Z;"- ";
3440 GOSUB 5570
3450 Z=Y+(COLY*2)
3460 IF Z>DIRMAX GOTO 3490
3470 IF Z>9 THEN PRINT TAB(33);Z;"- ";ELSE PRINT TAB(33);" ";Z;"- ";
3480 GOSUB 5570
3481 Z=Y+(COLY*3)
3482 IF Z>DIRMAX GOTO 3490
3483 IF Z>9 THEN PRINT TAB(49);Z;"- ";ELSE PRINT TAB(49);" ";Z;"- ";
3484 GOSUB 5570 
3485 Z=Y+(COLY*4)
3486 IF Z>DIRMAX GOTO 3490
3487 IF Z>9 THEN PRINT TAB(65);Z;"- ";ELSE PRINT TAB(65);" ";Z;"- ";
3488 GOSUB 5570
3490 PRINT
3500 NEXT Y
3510 PRINT
3600 GOTO 520
5570 PRINT A$(Z);:RETURN
ELSE PRINT TAB(65);" ";Z;"- ";
3488 GOSUB 5570
3490 PRINT
3500 NEXT Y
3510 PRINT
3600 GOTO 520
5570 PRINT A$(Z);:RE