HELPER--AN INTERACTIVE TEXT PRESENTER HELPER is a small (<2k) program that enables you to "menu" a document. It combines the function of programs like the TXT__ series which let you turn documents into .COM files with that of programs like HELP__ which let you divide documents into user-selectable sections. HELPER itself is a small .COM file which you tack on to the beginning of your document to create a new .COM file. The default behavior when the new file is run is to display the document, pausing every 23 lines. Two special characters can be embedded in the document; their default values (changeable by assembly-time equate are ^(known as the control prefix) and ~(the command prefix). The control prefix causes the following character to be output as its control equivalent; the command prefix causes the following characters to be treated as a statement in a small programming language. These statements enable you to control the presentation of the document. They fall into five categories: SELECTIONS ~S Select: get menu response and select section ~C Choice: mark section corresponding to menu selection ~D Default: mark section for choice not on menu ~E End: mark end of menu choices LOOPS ~B Begin: start of loop ~A Again: end of loop ~X Exit: break out of loop TEXT SHARING ~U Use: "call" section of text ~R Return: return from section called by ~U FLOW CONTROL ~Q Quit: return to operating system ~T Top: restart display from start of document ~L Label: give internal name to section of text ~G Goto: jump to internally-named position OTHERS ~P Pause: force "any key" pause ~O Output: display last selection response EXPLANATION OF COMMANDS SELECTIONS These commands let you divide a portion of a document into sections such that the user is prompted for a choice, responds, and is shown the appropriate section. To create a selection section, put a list of possible choices in the text, and follow it with ~S. For each possible response, put in a line beginning with ~C followed by the response (responses can be strings of up to 16 characters). Then put in the text corresponding to that choice. To display text when the user enters an invalid response, put in a line consisting of ~D and follow it by whatever error message you want (on separate lines). At the end of all these sections, put a line consisting of ~E. The commands work as follows: when HELPER encounters a ~S, it waits for the user to type in a string followed by CR. The ~S by itself does not cause any output, so it can be placed immediately following a prompt. When the string has been typed, HELPER skips through the text attempting to find a ~C followed by that string. If a match occurs, HELPER resumes displaying text from that point on until it sees another ~C, a ~D, or a ~E. It then skips to the ~E and resumes display. If HELPER sees a ~D while searching for a match, it resumes display at that point, continuing to the ~E. Selection sections can be nested up to 8 levels deep, allowing you to create submenus. Note that HELPER never tries to assign numbers or letters to sections the way the HELP__ programs do: you have complete control of what menus look like. LOOPS Frequently you want to show a menu, let the user make a choice, show the appropriate section, and then show the menu again. You can do this by using the loop commands. Whenever HELPER sees a ~B, it marks the current position in the document as the beginning of a loop. When it encounters a ~A, it repositions itself to the loop beginning. If it encounters a ~X, it skips down past the ~A. Normally the ~X will be part of a selection section for going back to a previous menu or something similar. Loops can also be nested up to 8 levels deep. Selections can be nested within loops and vice versa. TEXT SHARING If you have a portion of text that you need to display at several points in a document, you can turn it into a "subroutine" by labeling it with ~L and ending it with ~R. Whenever HELPER sees ~U followed by a string, it will save the current postion and search (starting at the top of the document) for ~L followed by the same string. It will then display until it sees a ~R, at which point it will resume display after the ~U. "Subroutines" can also be nested up to 8 levels deep. FLOW CONTROL A ~Q causes HELPER to immediately return to the operating system (which also happens if HELPER "falls off" the end of the document. A ~T sends you back to the top of the document, and ~G followed by a string jumps you to the position marked by ~L followed by the same string. OTHER COMMANDS ~P forces an "any key" pause when it is encountered. However, it will not cause a pause if no text has been displayed since the last pause (triggered either by 23 lines or by another ~P), so the user will never see two pauses in a row. ~O displays the string the user typed in response to the last ~S command executed. This can be used for error messages. POSITIONING OF COMMANDS Some of the commands can be located anywhere within a line of text; others need a line of their own: ~S Must be at end of line ~C Must stand alone ~D Must stand alone ~E Must stand alone ~B Anywhere on line ~A Anywhere on line ~X Anywhere on line ~U