Z88 Menu System Page 1 The MENU program is a BASIC program which uses the Z88 CLI features to simplify tasks on the Z88 by allowing a number of CLI commands to be stored in a single file, and accessed from a menu driven interface. The menu file format is described in detail subsequently. Distributed with the Menu program is also a demo menu file named demo, demo.pd is the Pipedream file, and demo.mnu is the menu file (simply demo.pd saved with the "Save plain text" option set to yes. While the demo menu is not very useful as it is, it provides an example, or a template to work from. The demo main menu allows for access to the file catalog menu, the printer driver menu, and loading the scratch file s.sgn into Pipedream (scratch file is deleted after being loaded). The file catalog menu simply turns on screen capture, lists the files according to what option was selected, goes into Pipedream, loads the files, then deletes the scratch file. The printer menu has a number of options and assumes the printer editor files las1.pe to las4.pe exist in :RAM.0/, it loads the printer editor, sets the default directory to :RAM.0/, and then loads and makes active the specified driver file. It should be noted here (as in many other places), that there is a bug in the operating system, and if any files are placed in :RAM.- they should be deleted as soon as they are copied to somewhere else. If the machine experiences a soft reset with files in :RAM.- the machine will be corrupted. Executable options in the menu display are displayed in normal text, other menus are displayed in tiny text. There is no exit path for the program, simply hit ESC to exit the program. Things get a little confusing if BASIC is invoked in a command. If there is another instantation of BASIC, that instantation will be invoked, otherwise MENU will call itself. This is perfectly all right so long as that is what you want to do. If you want to run another BASIC program over MENU, simply make the start of your CLI command "|[", or ESC, which will terminate any running program (mainly menu). Z88 Menu System Page 2 Menu File Structure The menu data file is a standard Z88 ASCII file, a series of lines terminated by the CR character (ASCII 13). To create a file of this form from Pipedream, save the file with the "Save plain text" option set to YES. The file consists of a series of menus, each menu containing either the names of other menus to execute, or command strings to execute. No error checking is done when reading in the file, so the file should be created with some care to avoid run time errors. The following rules MUST be followed when creating the menu file to avoid problems: 1 The first line of the file must be the start of a new menu. 2 Each menu may have no more than 10 options. 3 Each menu must have a reference to some other menu, otherwise there is no way to exit that menu. 4 Each menu item must have a unique hot key. 5 The last line of the file must be the start of a menu with the name "$$EOF$$". Z88 Menu System Page 3 Line Formats Three basic line formats exist, the start of a menu, an executable command, and a menu call, each of which is described in detail below. It is assumed in the description that the file was created with Pipedream, and saved with the "Save plain text" option set to YES, so that columns are separated with the TAB character. Menu Start The menu start indicates the start of a new menu, the menu name is used to refer to this menu from other menus. Col Contents 1 Menu name (case sensitive) 2 The "$" character (ASCII 36) Executable Command The executable command is the heart of the MENU system, it actually causes the CLI to be created and executed for whatever purpose. There are device and path specifications for each command, when the CLI is built the noted application is entered, then the filer is called up and the current directory is changed to the specified device and path. If this fields are left blank the file is not called. Col Contents 1 Descriptive string. 2 Hot key used to invoke the command. (A single alphanumeric character). 3 Device number (0 to 3). 4 Path to make the default. 5 Application code (for example P for Pipedream, whatever you would type after the square key to bring up the application. 6 CLI command string to execute, if the commands require more than one line, they can be placed in subsequent columns, each column will be placed as a separate line. Menu Call The menu call invokes the selected menu. Any menu named in the file can be used, if a name is used that is not in the file a run time error will occur. Note that names are case sensitive. Col Contents 1 Descriptive text. 2 Hot key used to select from the menu (a single alphabetic character). 3 The "/" character (ASCII 47). 4 The name of the menu to invoke, must be defined in the file, and is case sensitive.