CATRUN V1.3
Implemented by norecess464 2023.
-=-=-=-=-

CATRUN is a simple tool for the Amstrad CPC machines to fasten the process of disc's content discovery / launch a program.

When inserting a new disc into the machine, I bet than 95% of the regular Amstrad CPC users will first type the CAT command to discover its content, then type RUN"FILENAME to launch a targeted program.

With CATRUN, the user can press CTRL+TAB (or SHIFT+TAB for 464 owners) at machine startup (or any other time, of course) to show the list of files stored on the disc, then use the arrow keys to select the targeted file to execute, then press RETURN/ENTER/COPY key to auto-type the RUN command. Few key presses are saved in the process, while enhancing (a little bit !) the launching experience.

While selecting a file, it's also possible to:

* use H key to print the program help
* use ESC key to just get back to BASIC (cf. discard the RUN command)
* use TAB key to redo a catalogue discovery (cf. when the user is willing to change disc and rebrowse its content)
* use R key to rename the selected file
* use D or E key to delete the selected file
* use A or B key to switch current drive to A: or B:
* use P key to open an ASCII file with with Protext
* use S key for multiselection. You can combine that with delete operations.

Starting V1.2, if UniDOS gets detected:
* use CLR key to navigate to root folder
* use DEL key to navigate to parent folder
* use RETURN/ENTER/COPY to navigate into a sub-folder
* use N key to create a new folder
* use C key to copy a file to the other logical drive (can also be combined with S key (multiselection))

And that's all :)

* supports both MODE 1 and MODE 2. If the current video mode is MODE 0, then a regular CAT will be applied and the user will get back to BASIC
* to be available system-wide from the BASIC prompt, this program is distributed as a ROM to be installed on a ROMBoard (X-MEM, FlashGordon, etc.)
* the program only takes few bytes for the ROM initialization (cf. required for the system handling of |CATRUN shortcut through Control+Tab keys). The execution itself of the program does not require any extra RAM!
* if the catalogue on disc appears to be a CATART, then a regular CAT will be applied and the user will get back to BASIC
* if the catalogue appears to be impossible to browse for whatever reasons, then a regular CAT will be applied and the user will get back to BASIC. This happens for example with the (great!) Duke's M4 expansion not behaving internally like the regular CAT from Amstrad -- for programmers: the 2K buffer not being populated by CAS CATALOG.
* generally speaking, this program refers only to the firmware routines. It provides full compatibility between 464, 664 and 6128 Amstrad CPC machines (tested)
* a test is done to ensure that the call of |CATRUN is made from the BASIC prompt. There would be no purpose to trigger CATRUN from Protext command prompt (yes, it's possible!), for example.
* UniDOS-specific: the current path gets displayed on top of all printed catalogues
* the build date is displayed in the Help
* Doesn't assume AmsDOS is at ROM7
* internally relies on a "fast print routine" (faster than the standard Amstrad one).
* when displaying a catalog, CATRUN will try to pre-select an executable file, based on filename (thanks Eto/Prodatron!):
 * if it finds a file "disc."/"disk."/"disc.bas"/"disk.bas"/"disc.bin"/"disk.bin"
 * and if not, if it finds the first "*. "
 * and if not, if it finds the first "*.bas"
 * and if not, if it finds the first "*.bin"
 Very useful, most of the time it's accurate. 

Some extra-testing has been achieved by Poulette73 (thanks!) on multiple hardware configurations (cf. when Amsdos gets patched with custom file systems):

* M4 Board + USB storage is well supported
* RSF3 + USB storage is well supported
* CubeMDOS, UniDOS, ParaDOS and X-Ddos work fine too

--
Final words.
This program is useful to me. With some luck it will also be useful to you ! :)

>>norecess464.condense 2023!

Thanks to TotO, Offset, Poulette73, roudoudou & everyone else keeping the Amstrad scene alive! =)

--
CHANGELOG
V1.3 (20th of Dec 2023)
- fixed bugs with selection when doing an action on files
- direct calls to |ERA and |COPY RSXs for multiselection (cf. removed the limit of 9 files max. to be auto-typed in BASIC prompt)

V1.2 (5th of Dec 2023)
- 464 fix + added Shift+TAB/COPY key usage (better ergonomy for CPC 464 users)
- user can now go to Drive A or B (key A or B)
- added multiselection for file delete operations (key S to toggle select on a file, Control+A to select all).
- P key on a text file to open Protext editor
- if UniDOS gets detected:
  * current path gets displayed on top of all printed catalogues
  * user can navigate through the directory hierarchy (go to root (CLR key), go to parent directory (DEL key), go to subfolder (right arrow key))
  * user can create a new directory (key N)
  * simple file copy to the other logical drive (key C)
- minor improvements (better internal memory management, build date shown in Help, don't assume AmsDOS ROM being at ROM 7, etc).

V1.1 (17th of Sept 2023) -> First feedbacks received, adjusting few things.
- implemented pre-selection of an executable file in the catalog, based on filename (thanks Eto/Prodatron!):
 * if it finds a file "disc."/"disk."/"disc.bas"/"disk.bas"/"disc.bin"/"disk.bin"
 * and if not, if it finds the first "*. "
 * and if not, if it finds the first "*.bas"
 * and if not, if it finds the first "*.bin"
 Very useful, most of the time it's accurate. 
 Of course, user must still press RETURN key to trigger the launch of the program (cf. RUN it).
- if we are about to display more than 42 files in MODE 1, the video-mode will be automatically switched to MODE 2 (to allow more files displayed on screen)
- 2 new (unrelated) helpers, while I was at it:
 * it's now possible to press E or D keys ("E"rase or "D"elete) to delete the selected file. A confirmation gets presented to the user before proceeding.
 * it's now possible to press R key ("R"ename) to rename the selected file. ESC to cancel while entering the new filename.

V1.0 (15th Sept 2023) -> Initial release 