I'll start coding a program launcher menu for C64 (or DTV) with 1541-III(-DTV) in a couple of days. It will be done in ASM and the source will be released.
The idea is to:
1. Present a list of programs to the user in alphabetical order.
2. Let the user browse the available programs using next/previous, page-up/down and "jump to the first program starting with the letter X" controls
3. Let the user start a program by pressing enter/fire/etc.
The list of programs is constant (determined at compile) and includes data required to find the program from the SD/MMC. This data consist of:
1. The disk number as given by 1541-III when doing a LOAD"$0",8
2. The file name (in this case a number) of the program.
That last paragraph probably raises some questions, so I'll answer them before you can make them :)
Q: Why use a number as the file name instead of simply doing a LOAD"selected_program_name",8,1?
A: The reason is that I want to use the program to select games from the "Blast from the past" collection, which has it's own launcher program and files with the names of "1"..."9" (or less, depending on the number of games). The "Blast" laucher program doesn't seem to load the games on my DTV/1541-III-DTV combo; I assume it's using an incompatible disk turbo. Loading the individual games seems to work.
Q: Why rely on the disk number instead of checking for the disk name?
A: The reason again is "Blast from the past", which has disks named "blast001.d64"..."blast340.d64", which can be copied to the SD/MMC in order the make sure the disk number is correct.
The basic (and in BASIC) idea of loading the correct file should be (AFAIK):
1. OPEN1,8,2,"$x":CLOSE1 (or is it CLOSE2 ?)
2. LOAD"y",8,1
3. RUN
...where x = disk number ("1"..."511") and y = program number ("1".."9").
I haven't done any code (in BASIC or ASM) that uses disk/file operations, so I'd like some advise:
1. How to perform the OPEN...CLOSE? Using some kernal funtions?
2. How the LOAD and RUN the program? Do I copy the relevant part of code to stack/tape buffer and execute it there? Do I use kernal functions? Or could I just put LOAD"y",8,1<enter>RUN<enter> to the keyboard buffer and just RTS to BASIC?
Questions on the data format:
Should I use an array with fixed lengt entries to allow binary search for the "jump to program starting with X"? Or is a simple "for...next" type of loop fast enough with about 1900 entries? Or should the first programs starting with 0..9,A...Z indexed at start of the program (or even in the backgound while browsing)?
Ideas/suggestions/code are welcome :)