10 REM Making a file selector : Part 1 100 REM |digits 110 REM auld Bastid 1993 120 REM 130 UNKNOWN OP: 0x3A 140 REM 1st we have to reserve enough space to hold our filenames. Gem can't handle as many as 300 files in a directory, BUT Neodesk can (actually it can handle as many as you want, but 300 is fine) 150 UNKNOWN OP: 0x3A 160 DIM 170 UNKNOWN OP: 0x3A 180 GOSUB 190 UNKNOWN OP: 0x3A 20 REM Reading the Disk 200 IF 201 IF 210 FOR 220 PRINT 230 IF 240 NEXT 250 UNKNOWN OP: 0x3A 260 WAIT KEY 270 STOP 280 UNKNOWN OP: 0x3A 290 UNKNOWN OP: 0x3A 30 REM Subroutine 1 - Scans the disk,sorts the files alphabetically then returns with the files names etc in: F_BLOCK$() and the number of files in N_FILES, subroutine also return FSELERR as -1 if too many files are in the directory. 300 REM SCAN DISK RETURNS F_BLOCK$(),N_FILES 31 REM VARIABLES USED : F_BLOCK$(),FSELADD$,FSELT,N_FILES, FSELTMP$,COUNFSELT,FSELERR 310 REM The Main Routine 320 UNKNOWN OP: 0x3A 330 REM SCAN DISK PATH 340 UNKNOWN OP: 0x3A 350 VARNAME 355 VARNAME 360 VARNAME 370 IF 380 WHILE 390 IF 40 REM 400 UNKNOWN OP: 0x3A 410 REM fseladd$ holds the folder sorting character chr$(1) puts them at the top chr$(255) put them at the bottom. By using other characters you can order the files any way you fancy. 420 VARNAME 430 UNKNOWN OP: 0x3A 440 VARNAME 450 VARNAME 455 IF 460 VARNAME 470 WEND 480 UNKNOWN OP: 0x3A 490 REM *** SORT ALPHABETICALLY 50 REM MID$ positions: 500 UNKNOWN OP: 0x3A 510 SORT 520 UNKNOWN OP: 0x3A 530 REM STRIP OUT ADDITIONAL CHARS . It's now sorted so get rid of the characters we used for sorting. 540 UNKNOWN OP: 0x3A 550 FOR 560 UNKNOWN OP: 0x3A 570 REM FIND THE FIRST THAT ACTUALLY HOLDS INFO. Because a null string ("") is less than all other things they come first so we have to manually search down to find the first 'real' entry. 580 UNKNOWN OP: 0x3A 590 FOR 60 REM 1+12 14+8 600 IF 610 NEXT 620 UNKNOWN OP: 0x3A 630 REM MOVE THEM UP. Okay found it shuffle the entries up to the start. 640 UNKNOWN OP: 0x3A 650 VARNAME 660 FOR 670 VARNAME 680 NEXT 690 UNKNOWN OP: 0x3A 70 REM returns: PICB1.BAS 40987 700 REM NOW MAKE THE BLOCK TYPE I WANT. This file reconstructs the block to include a marker character in position 1. This is so the user can see that it's a folder and not a normal file. Any character can be used. This section also removes unwanted information (date,time,type). 710 UNKNOWN OP: 0x3A 720 FOR 730 IF 740 NEXT 750 RETURN 80 REM filename.ext|size 90 REM 12 chars |upto 8