home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PROGRAMS / UTILS / MEMORIA / PKII_127.ZIP / ANSI.DOC next >
Encoding:
Text File  |  1989-06-30  |  28.7 KB  |  527 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.                              ANSI.MOD Documentation 
  9.  
  10.  
  11.                                     May 1989
  12.                                   Version 1.24
  13.  
  14.  
  15.                        Copyright 1988 by John H. Brooks.
  16.                               All rights reserved.
  17.                        Permission is granted to quote or 
  18.               distribute copies of this documentation separately,
  19.                  and the entire, unaltered POWERKIT II package.
  20.  
  21.  
  22.     DISCLAIMER: This software is sold "as is."  No warranty is given, either 
  23.     express or implied, that any specific POWERKIT feature will work on any 
  24.     particular machine.  The manufacturer will not be liable for any damage 
  25.     caused by the use of POWERKIT. 
  26.     
  27.     The names of hardware and software products, and companies mentioned in 
  28.     this document are trademarks or service marks of the respective companies.
  29.  
  30. FORWARD: Welcome, let me tell you what this ANSI.MOD documentation does NOT 
  31.     contain.  Although ANSI.MOD supports most of the ANSI X3.64 and VT100 
  32.     "escape" sequences, not all of them will be described here.  Just remember 
  33.     that ANSI.MOD will do the job for you, should you have an application pro-
  34.     gram that requires VT100 emulation, or ANSI.SYS be loaded.  Also, ANSI.MOD 
  35.     has many helpful routines that can be used by other programs, and these 
  36.     will not be mentioned here either.  Instead, for those of you who might 
  37.     wish to write your own "module", or to delve into the esoteric mysteries of 
  38.     ANSI "escape" sequences, there is a technical reference manual available to 
  39.     all registered users of POWERKIT II. 
  40.  
  41.     I have placed the "module" format for executable TSR (and device driver, 
  42.     ANSI.MOD is the console device driver*) files in the public domain, and 
  43.     any software developer, commercial or shareware, may use it, free of royal-
  44.     ties.  You may also take advantage of ANSI.MOD's superior routines in your 
  45.     programs.  There are some restrictions, and you MUST contact me for 
  46.     approval, and for the specifics of this offer. 
  47.  
  48. WHAT IS ANSI.MOD?  ANSI.MOD performs three major tasks (the keystroke buffer, 
  49.         with view-port, is a separate program).  First, it is a replacement for 
  50.         the rather inadequate MS/PC-DOS console that controls your screen and 
  51.         keyboard.  The DOS console's inadequacies are the reason every major 
  52.         application package handles its own I/O to/from the screen and key-
  53.         board.  Since each program handles this I/O a bit differently, you can
  54.  
  55. * - For you "techies", ANSI.MOD (when active, and it's simple to turn it on and 
  56.     off) is the highest "CON" link in the device driver chain, is carried in 
  57.     the "list of lists" as the console driver, takes over INT 29h duties, and 
  58.     is the "file" that answers to "handles" 0, 1, and 2. 
  59.  
  60. Page 2 
  61.         
  62.         blame the poorly designed DOS console for the fact that some of your 
  63.         favorite pop-up TSR's (terminate, but stay resident programs) don't 
  64.         work inside some of your applications, and why some TSR's don't work 
  65.         very well with other TSR's.  Thus, a major goal of the POWERKIT II 
  66.         design is, at least, to get a special class of TSR's, called "modules", 
  67.         to COEXIST amicably.  To this end, ANSI.MOD provides a set of keyboard 
  68.         handling and screen updating routines, that are quite simply the best 
  69.         in the business.  ANSI.MOD can replace an entire 80x25 screen, 40 times 
  70.         a second, on a standard 4.77 Mhz PC. 
  71.  
  72.         Second, ANSI.MOD is a replacement for the equally laughable ANSI.SYS 
  73.         that came in your DOS package.  It has a far larger set of the ANSI 
  74.         X3.64 and VT100 escape sequences, plus a few that ANSI never heard of.  
  75.         The commands represented by the escape sequences work under much more 
  76.         diverse conditions than do the corresponding ANSI.SYS commands, and in 
  77.         many instances, the same command does many more things than its ANSI-
  78.         .SYS counterpart. 
  79.  
  80.         To cite an example, the old ANSI "keyboard redefine" sequence did 
  81.         indeed replace one character by one or more other characters, giving 
  82.         ANSI.SYS a "MACRO" capability, sort of.  But, the key redefinition 
  83.         acted ONLY at the DOS prompt (well OK, in DEBUG and EDLIN too).  When 
  84.         you entered an application, the key reverted to its former self.  ANSI-
  85.         .MOD produces true MACROS that are available at the touch of a key, all 
  86.         the time. 
  87.  
  88.         Furthermore, you can attach a comment or description to each of your 
  89.         MACROS, to remind you of some important fact about them.  There is a 
  90.         way provided to show this comment, and also a means to move this MACRO 
  91.         to a different key (you'll see why later).
  92.  
  93.         Another feature unique to ANSI.MOD's MACROS is that ANSI escape 
  94.         sequences can be embedded in them.  Thus, MACROS can be used to com-
  95.         mand your communications port (dial the phone, for example), or 
  96.         printer, or even to define other MACROS (or delete!!, even themselves). 
  97.  
  98.         Finally, MACROS can be defined at any time, because ANSI.MOD pro-
  99.         vides "hot" key access to the ANSI sequence parser, replacing "PROMPT 
  100.         $e [" (ALT-ESC is the default, and FYI, all hot keys for POWERKIT II 
  101.         modules are just special types of MACROS, the help screens for the mod-
  102.         ules are the above-mentioned comments, and the hot key can be moved 
  103.         just like any other MACRO).  The old, unhandy "PROMPT $e [ ... " method 
  104.         is still available for batch file use, etc (but don't put "ECHO OFF" in 
  105.         that batch file, use CTTY NUL, then CTTY CON to restore the display). 
  106.  
  107.         Oops, I almost forgot, an ANSI.MOD MACRO can contain sub-macros 
  108.         (to 10 levels deep), and these are expanded when the outer MACRO is 
  109.         being called, not when the outer MACRO is being defined.  This not 
  110.         only saves space in the MACRO buffer, but the sub-macro(s) can be 
  111.         ALTERED between calls to the outer MACRO.  I'm sure you will discover 
  112.         many uses for this sophisticated capability.
  113.  
  114.         Speaking of space, ANSI.MOD MACROS use only a single byte for most key-
  115.         strokes, except "extended" ASCII codes (these are two byte codes whose 
  116.         first byte is 0, or E0h).  "Problem" codes (such as control codes) are 
  117.         handled in software.  This results in a significantly larger program, 
  118.         but the reward is, ANSI's buffer will hold almost twice as much inform-
  119.         ation, in the same space, as some other "KEY" or "ANSI type" programs. 
  120.  
  121. Page 3
  122.  
  123.         This brings us to a second important goal of POWERKIT II, STANDARD-
  124.         IZATION!!!.  All good word processors, spreadsheets, data "basers", 
  125.         provide many of the same helpful operations, like SEARCH, REPLACE, 
  126.         COPY, MOVE, DELETE, to name a few.  The only trouble is, they each use 
  127.         different keystrokes to accomplish these tasks, and YOU have to REMEM-
  128.         BER which keystroke combination goes with which program.  NO MORE, just 
  129.         create a batch file for each of your programs.  The batch file will 
  130.         create MACROS that move these operations to the same keys in all the 
  131.         programs -- call the program -- then "uncreate" the MACROS (yep, I 
  132.         forgot that too, you can delete MACROS) after exiting the program. 
  133.  
  134.         Lastly, ANSI.MOD is the traffic cop that mediates potential conflicts 
  135.         between POWERKIT II modules, recognizes hot keys and calls the associ-
  136.         ated module, disables one when another pops up on top of it (to 4 lev-
  137.         els deep), interprets their "command" keys for them and calls the 
  138.         proper routine, sends them keystrokes when asked, pops up their help 
  139.         screens when F1 is pressed, provides many other useful routines (PKII-
  140.         .MOD is several hundred bytes smaller because of these routines). 
  141.  
  142.         Now for perhaps THE most AMAZING fact about ANSI.MOD.  In its smallest 
  143.         configuration, with a 256 byte MACRO / ANSI sequence buffer, ANSI.MOD 
  144.         requires slightly over 5k bytes! and this leads us naturally to a third 
  145.         important goal of the POWERKIT II design, SAVING SPACE !!!  The space 
  146.         savings provided by the remarkable module design is described in 
  147.         PKII.DOC, but ANSI.MOD also plays its part. 
  148.  
  149.         The three goals mentioned above are intermediate to the FINAL goal, 
  150.         which is to SAVE MS/PC-DOS!!! (from itself, mainly).  It's just too 
  151.         LOUSY an operating system not to need a great deal of help to survive.  
  152.         And survive it SHOULD; consider the alternatives; multi-megabyte, 
  153.         multi-user, multi-tasking UNIX and OS/2!  Sure, they're powerful oper-
  154.         ating systems, but I question whether even most "power users" need 
  155.         them.  What I believe IS needed is a communications program, a smallish 
  156.         one, that will operate in the background, to process your Email, UL 
  157.         and DL files, and such (MIRROR II does a good job, but consumes 150k+, 
  158.         and THE INVISIBLE LINK has the right idea, does a partial job in only 
  159.         29k of memory, could use more fine tuning); a print spooler to drive 
  160.         your printer in the background (PRINT comes with DOS, and is one of the 
  161.         best there is); a small, not too sophisticated foreground/background 
  162.         dual-tasker to handle a compute-intensive process (like a spreadsheet 
  163.         re-calc) in the background, and an I/O intensive task (like a word pro-
  164.         cessor) in the foreground; ANSI, PKII.MOD, and a few other tiny, inex-
  165.         pensive, indispensable, POWERKIT II modules to help you cope with DOS. 
  166.  
  167.         Well, I've spoken my piece, now let me hear from YOU (please send money 
  168.         too).  Does this approach to Personal Computing make any sense at all 
  169.         to you? 
  170.  
  171. INSTALLATION: Though it is far from being "just another module", ANSI.MOD can 
  172.         be loaded (and unloaded) like all other modules, by typing:
  173.  
  174.           LOAD C:\PKII\ANSI.MOD (instructions to ANSI.MOD may go here) 
  175.  
  176. Page 4
  177.  
  178.         Of course, this assumes you have previously created the \PKII directory 
  179.         on the "C" (or "A") drive, and copied ANSI.MOD into it.  The easiest 
  180.         way to do this is to run POWERKIT II's "INSTALL" program (see the in-
  181.         structions in README.1ST). 
  182.  
  183. IMPORTANT NOTE:  ANSI.MOD MUST BE LOADED BEFORE MOST OTHER MODULES !!!
  184.  
  185.         ANSI.MOD has two switches that may be set at load time (if you don't 
  186.         like the default values, otherwise don't do a thing).  For example: 
  187.  
  188.           LOAD C:\PKII\ANSI.MOD /m100/j0
  189.                                ^ blank space
  190.         
  191.         will set aside 25,600 bytes for MACROS and ANSI sequence parsing 
  192.         (the default is 2048 bytes), and eliminate ANSI.MOD's help screen. 
  193.  
  194.         * /Mn, n = 1 to 237 (approx.), tells ANSI how many 256 byte sections of
  195.           memory to reserve for MACROS and ANSI escape sequence parsing.
  196.  
  197.         * /Jn, n = 0 or 1, turns ANSI.MOD 's help screen off or on.
  198.  
  199.     NOTE: You must reserve space, in ANSI.MOD's MACRO buffer, for module help 
  200.         screens.  If the screen for PKII.MOD is attached, in /Mn, n must be 4, 
  201.         or higher.  ANSI comes to you with the default set at 8 (i.e., 2k of 
  202.         MACRO buffer space), so there's no need to worry when you first load 
  203.         ANSI.MOD and PKII.MOD (2k will hold both help screens). 
  204.  
  205. ANSI COMMANDS: All ANSI escape sequence commands begin with the "escape" char-
  206.         acter, which is a decimal 27.  The next character is almost always a 
  207.         left bracket (a "[").  The real "meat" of the command then follows 
  208.         those preliminaries.  As was stated earlier, ANSI commands can be ac-
  209.         tivated from the keyboard, at any time (not just at the DOS prompt), by 
  210.         pressing ALT-ESC (press the "ESC" key, while holding down the "ALT" 
  211.         key).  ALT-ESC acts as the "27" and the"[".  The "meat" is either a 
  212.         series of numbers, separated by semicolons (like 1;2;33;44), or a se-
  213.         ries of characters, enclosed by single or double quotes (like 'abc' or 
  214.         "abc"), plus a final upper or lower case character (must be outside of 
  215.         any quote marks).  That final character of the sequence tells the ANSI 
  216.         command interpreter (hereafter referred to simply as ANSI) what to do.  
  217.  
  218. MACRO RELATED COMMANDS: To a Greek (and a select few others), "macro" means 
  219.         "large".  In computerese, a MACRO is a string of one or more charac-
  220.         ters, that are sent to a display, a file, printed on a printer, or sent 
  221.         to a modem, after a (single) key is pressed.  At this very moment, I'm 
  222.         using MACROS to enter the words "ANSI.MOD" (I press ALT-2), "ALT-ESC" 
  223.         (I press ALT-3), and "MACRO" (I press ALT-4), into this document. 
  224.  
  225.     CREATE A MACRO: The final character (mentioned above) that tells ANSI to 
  226.         create a MACRO is lower case "p" (upper case "P" means something en-
  227.         tirely different to ANSI).  Creating a MACRO with ANSI.MOD is almost as 
  228.         easy as (or easier than) it is with those well-known (and costly, in 
  229.         PRICE and MEMORY) "KEY" and "ANSI" programs: 
  230.  
  231.         The "quote" key is the key between the semicolon/colon key, and the 
  232.         ENTER (RETURN) key. 
  233.  
  234. Page 5
  235.  
  236.         1. Press ALT-ESC (you should hear a beep)
  237.         2. Press the "quote" key (shifted or not)
  238.         3. Press the key to which the MACRO will be attached
  239.         4. Press the sequence of keys you wish the redefined key to represent
  240.         5. Press the "quote" key again (shifted or not, but the same as in step 
  241.            two above)
  242.         6. Press lower case p
  243.  
  244.         That's all there is to it.  You will notice ANSI's view-port will open 
  245.         to show you the keystrokes you are typing (well not quite, it cannot 
  246.         show non-printing codes). 
  247.  
  248.         If you need one or the other of the "quote" keystrokes in your MACRO, 
  249.         use the other 'quote' as the delimiter.  If you need them both, end 
  250.         one "quote" sequence, press ";", press the other 'quote', press the 
  251.         "quote" you need, and continue. 
  252.  
  253.         If you wish an ANSI escape sequence to be part of your redefinition, 
  254.         press ALT-ESC, followed by the ANSI sequence.  Make sure you are 
  255.         inside the "quote" delimiters (see note below). Outside "quote" 
  256.         delimiters, you must use "0;1" to represent "ESC [". 
  257.  
  258.     IMPORTANT NOTE: Pressing ALT-ESC a second time ABORTS an ANSI escape 
  259.         sequence, but not if you are inside the "quote" delimiters. 
  260.  
  261.     DELETE A MACRO: To delete a MACRO, press ALT-ESC, "quote", the key to 
  262.         which the MACRO is attached, "quote", then lower case p.  This causes 
  263.         the key to revert to its original function.   Sorry, the only way to 
  264.         delete all MACROS, is to UNLOAD, then re-LOAD, ANSI.  The reason for 
  265.         this, is that all module "hot" keys are MACROS too (including ANSI.-
  266.         MOD's), and it wouldn't be wise to delete them. 
  267.  
  268.     MOVE A MACRO: To move a MACRO to a different key, press ALT-ESC, "quote", 
  269.         the "old" key, the "new" key, "quote", then lower case k.  Since module 
  270.         hot keys are MACROS, this procedure will also move a module's hot key.
  271.  
  272.     MACRO DESCRIPTION: You can include a description of what the MACRO does, 
  273.         when you define the MACRO, if you wish.  After defining the MACRO, and 
  274.         pressing the "quote" key, but before pressing "p", press the "left 
  275.         single quote" key, enter your description, press the "left single 
  276.         quote" again, then press "p".  Include carriage returns (the ENTER or 
  277.         RETURN key), when you want to start a new line, in your description. 
  278.  
  279.     SHOW DESCRIPTION: To look at this description, press ALT-ESC, "quote", the 
  280.         MACRO's key, "quote", then lower case q.  The description will pop-up 
  281.         on the screen, then disappear as soon as you press another key (the 
  282.         SHIFT key, for example).
  283.  
  284.     NOTE: This can be used to produce helpful information for you at the touch 
  285.         of a key.  Create a "view-only" MACRO by putting the text you would 
  286.         like to see, in the description field, the MACRO's activation key, en-
  287.         closed in quotes, then lower case q, in the execution field of the 
  288.         MACRO.  Now, when this MACRO's key is pressed, the text will pop up on 
  289.         the screen, and disappear when the next key is pressed.
  290.  
  291.     TURN MACROS OFF/ON:  Press ALT-ESC, "0", lower case "t" to disable all MAC-
  292.         ROS, except ANSI.MOD's hot key.  ALT-ESC, "1", "t", turns them back on. 
  293.  
  294. Page 6
  295.  
  296.     IMPORTANT NOTE: The fact that ANSI.MOD waits until an outer MACRO is being 
  297.         called, before expanding sub-macros, creates a problem for which there 
  298.         is no completely satisfactory solution.  Consider this: Suppose you at-
  299.         tached the MACRO "a" to "a".  In other words, define the key "a" to be 
  300.         itself.  When "a" is pressed, ANSI.MOD will look at it, decide that it 
  301.         was redefined, and look up its redefinition.  The characters in the re-
  302.         definition will then be checked to see if any are themselves redefini-
  303.         tions, AND DISCOVER THAT "a" IS.  What has been created, is an infin-
  304.         ite loop.  To stop this, ANSI.MOD checks the stack of sub-macros cur-
  305.         rently being expanded, and if it finds a sub-macro already on the stack 
  306.         that is the same as the one being checked, it will NOT expand the one 
  307.         being checked. 
  308.  
  309. FAST SCREEN MODE: ANSI.MOD is far from being a slow poke in putting characters 
  310.         on your screen.  But sometimes, it can be even faster.  DOS does some 
  311.         checking between sending characters to the screen.  For instance, DOS 
  312.         checks for CTRL-C, which tells DOS to stop doing whatever it is doing.
  313.  
  314.         This checking can be turned off, thus speeding up screen writes.  True, 
  315.         you will lose CTRL-C and CTRL-BREAK, but PKII.MOD's KEYPAD 5 (or SCROLL 
  316.         LOCK), ESC will still get you out of trouble. 
  317.  
  318.         To enable ANSI.MOD's fast screen update mode, press ALT-ESC, then 1, 
  319.         then lower case "r".  To disable this mode, press ALT-ESC, 0, lower 
  320.         case "r". 
  321.  
  322. CHANGE TEXT AND GRAPHICS MODES: Press ALT-ESC, n, lower case h, where n is the 
  323.         number of the text or graphics mode you wish to use.  I use this mostly 
  324.         when some ignorant programmer has decided he knows more than I, about 
  325.         what mode I want MY display in, puts MY display into 80x25 color mode, 
  326.         when I want it to be in 80x25 Black & White.  
  327.  
  328.         Note that n = 7 is not a text or graphics mode, but rather a "wrap" 
  329.         mode.  If you don't wish characters to "wrap" at the end of a line, 
  330.         press ALT-ESC, 7, lower case L (l looks like 1).  The option, n = 43, 
  331.         is not part of ANSI, but if you have an EGA (or VGA), it will put your 
  332.         display into an 80x43 (50 for VGA) text mode. 
  333.  
  334.         The possible values for "n" are: 
  335.         
  336.                0 - 40x25 black & white
  337.                1 - 40x25 color
  338.                2 - 80x25 black & white
  339.                3 - 80x25 color
  340.                4 - 320x200 color graphics
  341.                5 - 320x200 black & white graphics
  342.                6 - 640x200 black & white graphics
  343.                7 - Automatic CR LF at end of line
  344.                8 - 160x200 color graphics (PCjr and Tandy 1000)
  345.                9 - ?
  346.               10 - ?
  347.               11 - ?
  348.               12 - ?
  349.               13 - 320x200 EGA color graphics
  350.               14 - 640x200 EGA color graphics
  351.               15 - 640x350 EGA B & W graphics
  352.               16 - 640x350 EGA color graphics
  353.  
  354. Page 7
  355.                     
  356.               17 to 42 - ?   
  357.  
  358.               43 - Forty-three (50) line TEXT mode for EGA (VGA) (text only)
  359.  
  360.         ? - Means "perhaps" that number does something nice to your machine.  
  361.             If not, entering it may cause your machine to LOCK UP. 
  362.  
  363. CHANGE SCREEN COLORS, ETC.: Press ALT-ESC, P1;P2; ... ;Pk, lower case m, where 
  364.         the Pi's are numbers listed below.  In other words, you are able to 
  365.         select more than one of the attributes listed below, in the same call 
  366.         to ANSI.  Put semicolons between each number.  Again, this is used when 
  367.         some stupid application messes up your screen.  It always works after 
  368.         you exit the program, but some programs won't permit you to change 
  369.         colors while inside them.  Note that option 9 lets you supply an attri-
  370.         bute byte, thus can do the work of (almost all of) the other options. 
  371.  
  372.         no param - makes current screen (low intensity) White, on Black
  373.                0 - return to White on Black background, no Bold, no Blink
  374.                1 - high intensity (foreground and border only)
  375.                2 - normal intensity, no color change, just dimmer foreground 
  376.                4 - underline (monochrome adaptors only)
  377.                5 - blinking (in graphics modes, characters are XOR'ed)
  378.                7 - reverse video (XOR background & foreground, blink, bold
  379.                    unchanged) 
  380.                8 - concealed characters (foreground = background, in color)
  381.  
  382.                9 - The number entered after the 9 replaces current attribute 
  383.                    byte (background & foreground colors, blink, and intensity)
  384.  
  385.         *     10 - Turn off cursor in graphics modes (this is the default)
  386.         *     11 - Turn on cursor in graphics modes (VERY SLOW, use sparingly)
  387.         *     12 - Turn off (detach) ANSI.MOD.  MACROS, and many other things, 
  388.                    still work.  ANSI.MOD can still support the other modules.
  389.         *     13 - Turn ANSI.MOD back on.
  390.  
  391.               21 - Remove boldness
  392.               22 - Remove blinking and boldness (like option 0, but it works
  393.                    on color screens)
  394.               24 - Remove underlining (MDA only)
  395.               25 - Remove blinking
  396.               27 - Reverse video (same as option 7)
  397.               28 - Remove concealed characters (restore foreground)
  398.  
  399.         foreground colors
  400.               30 - black
  401.               31 - red
  402.               32 - green
  403.               33 - yellow
  404.               34 - blue
  405.               35 - magenta
  406.               36 - cyan
  407.               37 - white
  408.               38 - ERROR
  409.               39 - ERROR
  410.  
  411. * - NOTE: At release time (1/31/89), options 10 through 13 sometimes had to be 
  412.     entered twice before they "took". 
  413.  
  414. Page 8
  415.  
  416.               40-47 - Background colors (in same order as 30-37)
  417.               48 - ERROR
  418.               49 - ERROR
  419.  
  420.               50-81 - Border colors (in same order as 30-37, except 51-blue,
  421.                       53-cyan, 54-red, 56-yellow.  58-65 are high intensity.)
  422.     
  423. COPY TO PRINTER OR MODEM: Use ALT-ESC, n, i, where n is a number listed below.  
  424.         These commands will usually be used in MACROS.  For example, suppose 
  425.         your boss is too cheap to buy you a demon dialing telephone, and you 
  426.         MUST call your stockbroker quickly and often.  If your modem has auto-
  427.         dial capability, you can set up a MACRO to do this.  Let's attach this 
  428.         MACRO to F10.  Press ALT-ESC, "quote", F10, ALT-ESC (again), 2, i, 
  429.         ATDT5551212 (or whatever your broker's number is), ALT-ESC (yes, 
  430.         again), 6, i, "quote", p.  Note: If your boss is too cheap even to 
  431.         install touch tone lines, change the "ATDT" to "ATDP". 
  432.  
  433.         What did we do here?  The first ALT-ESC gets ANSI's attention.  The 
  434.         "quote" mark says that characters, rather than numbers, are to follow.  
  435.         F10 is the MACRO's key.  The characters before the next "quote" will be 
  436.         explained later.  The "quote" marks the end of the characters, and the 
  437.         "p" tells ANSI to attach those characters to the F10 key. 
  438.  
  439.         Now here's what happens when you press F10.  ALT-ESC starts the ANSI 
  440.         sequence to turn on copy to the modem.  The "2" selects the modem.  The 
  441.         "i" completes the ANSI sequence.  From here on, everything that would 
  442.         normally go to the screen, goes to the modem instead.  Thus, the "ATDT-
  443.         5551212" is sent to the modem, and the modem dials the number.  The 
  444.         final ALT-ESC alerts ANSI again; the "6" deselects the modem; the "i" 
  445.         completes the command, and ANSI directs output back to the screen. 
  446.  
  447.         The possible values for "n" are: 
  448.  
  449.                0 - Copy to printer (LPT1)
  450.                2 - Copy to modem (COM1)
  451.                3 - Copy from modem (COM1)
  452.                4 - Turn off copy to printer
  453.                6 - Turn off copy to modem
  454.                7 - Turn off copy from modem
  455.  
  456. FAKE KEYSTROKES: How many times have you wished you could send instructions to 
  457.         an application you call from a batch file?  Now you can.  In the batch 
  458.         file that calls the application, on a line before the call, put:
  459.  
  460.         prompt $e["instruction 1";13;"instruction 2";13; ... etc. ... ;v
  461.  
  462.         Those "13"'s are carriage returns to separate the individual 
  463.         instructions (sometimes not needed).
  464.  
  465. STANDARDIZATION: Suppose you have two word processors, one named "EDITOR", and 
  466.         one named "ED".  One you use to dash off notes and memos, the other, 
  467.         for more serious work (not that your memos aren't serious).  For the 
  468.         sake of simplicity, suppose the two have identical command structures, 
  469.         except that ED uses F8 to call up the "search" capability, while EDITOR 
  470.         uses F9.  To get both programs to use the same keys for the same opera-
  471.         tions, you must call one using a batch file.  Let's call ED using the 
  472.         batch file, EDIT.BAT.  Use either ED or EDITOR to create the following 
  473.         EDIT.BAT, batch file (note the CTTY command, in place of ECHO OFF. 
  474.         ECHO OFF disables the "PROMPT" command): 
  475.  
  476. Page 9
  477.  
  478.         ctty nul             - diverts output from display
  479.         prompt $e[0;67;0;66p - turns F9 into F8
  480.         ed                   - calls the editor
  481.         prompt $e[0;67p      - after ED finishes, turns F9 back into F9
  482.         prompt $n$g          - resets your "DOS prompt"
  483.         ctty con             - sends output back to display
  484.                 
  485.         Now, when you wish to use ED, just type EDIT, and the F9 key will call 
  486.         the search facility.
  487.  
  488.         Perhaps some of you are thinking "what's this screwy `prompt $e[' no-
  489.         tation?"  Well, it's the screwy way DOS has provided you to access 
  490.         ANSI.  I'll bet you recognized the "p" at the end of the first line, 
  491.         and guessed that a MACRO was being defined there.  The "prompt $e[" is 
  492.         DOS's way of sending an escape (27, remember?),and a "[", to ANSI.  The 
  493.         "0;67" is the (extended) ASCII code for the F9 key, and "0;66" the 
  494.         ASCII code for the F8 key.  They have to be represented in this awkward 
  495.         manner (when using the PROMPT command only), because they are nonprint-
  496.         ing characters (for printing characters, you would simply put in a 
  497.         "quote", then the characters, then another "quote").   Thus, the first 
  498.         line of EDIT.BAT turns F9 into F8.  The second line calls ED.  The 
  499.         third line isn't executed until you have exited ED, and it deletes the 
  500.         MACRO attached to F9.  The fourth line tells DOS to make a prompt 
  501.         consisting of the current drive letter, followed by the symbol ">" 
  502.         (look familiar?). 
  503.         
  504.         The following does the same thing, but without using "prompt ...", and 
  505.         also suppresses the irritating display of "echo off" when the batch 
  506.         file starts.  Most editors will let you hold down ALT, then press 
  507.         keypad "2", then "7", to make the "" (escape) character: 
  508.  
  509.                       - make foreground = background (and save foreground)
  510.         echo off          - suppress display of batch file actions
  511.         echo         - restore foreground color
  512.         echo 7;0;66p - turns F9 into F8
  513.         ed                - calls the editor
  514.         echo 7p      - after ED finishes, turns F9 back into F9
  515.         echo on           - restore display
  516.  
  517.         This method has the added advantage of not destroying your DOS prompt.
  518.  
  519.         I hope this (admittedly oversimplified) example gives some idea of how 
  520.         to lessen the memory circuit overload many of us endure, because every 
  521.         program we own does the same thing differently.  Most DOS manuals have 
  522.         a table of ASCII codes in the back, for you to refer to in this endeav-
  523.         or.  Yes, these ANSI sequences are kind of tough to construct, but you 
  524.         need to create a batch file only once, for each of your most-used 
  525.         programs. 
  526.  
  527.