Metropoli BBS
VIEWER: me.doc MODE: TEXT (ASCII)












                                     ME
                                   My Echo
                                Version 1.00
                                (Production)


                              Mark Plancke, Author
                         Fellow Programmer of The Guild
                               January 3, 1989

Version 1.00                       ME - My Echo                         Page 1

It has always bothered me that the DOS ECHO command fell short in some areas,
mainly the ability to send escape sequences to the console. This would allow
people who were so inclinded, to enter ANSI escape sequences into thier batch
files, etc.

So I wrote this as an my first ASSEMBLER project for the IBM PC. I have
written in a variety of high level languages, such as C, COBOL, FORTRAN and
BASIC, but have never attempted the "down to the bare metal" programming
which ASSEMBLER allows. Seems like a lot of fun, if you have the time and
you need the speed which an assembler can provide.

At any rate, this program is designed as a simple replacement for the DOS
ECHO command, with a few added features. There is the ability to echo escape
sequences to the console as well as all the options offered by the DOS PROMPT
command (I figured it was a good starting point).

Escape sequences are prefaced by an escape character, which is the '$'. To
echo a message, you simply type the text as you want it to appear. So here
are the escape sequences which may be used:

                Characters              Meaning

                   $$                   Print the $ character
                   $T                   Current time
                   $D                   Current date
                   $P                   Current directory
                   $V                   DOS version number
                   $N                   Current drive code
                   $G                   Print the > character
                   $L                   Print the < character
                   $B                   Print the | character
                   $Q                   Print the = character
                   $H                   Print the Back space character
                   $E                   ESCape character
                   $_                   Print a CR/LF character sequence


Examples:

        me $e[2jHello World             ; Clear screen and home cursor and
                                        ; Print Hello World

        me $e31;47m$e[1mHello World


Version 1.00                       ME - My Echo                       Page 2

                              REVISION HISTORY


Oct 12, 1988    Version 0.10    Initial testing pre-release.

Oct 13, 1988    Version 0.20    Added help screen when no arguments where
                                given. Improved error messages.

Jan 3, 1989     Version 1.00    Implemented the printing of the following

                                o Current Time
                                o Current Date
                                o DOS Version Number


                            NOTES ON DATE OUTPUT

The date can be formatted in three ways, as follows;

      1.  MM/DD/YYYY
      2.  MM/DD/YY
      3.  DDD MM/DD/YYYY

The format is determined by a variable in the assembler program TM_FMT, set
this to the format number you want and recompile. Valid formats are as above
1 through 3.

The file ME.COM may be modified directly to update this field, the variable
is located at position four (4) in the file. You can use a hex editor or
DEBUG to change this variable to the value you want.

To use debug, follow this procedure...

        Commands                          Comments - do not type these

        DEBUG ME.COM                      ; Start up debugger

        -D 100 L4                         ; Dump four bytes 

        5691:0100  E9 71 04 03                                  .q..
        -E 103                            ; Enter data at 103

        5691:0103  03.01                  ; Enter the new display mode
        -W                                ; Write the file
        Writing 08B3 bytes
        -Q                                ; Exit debugger


This changes the display mode from 3 to 1.


                                ANSI TUTOR

Here are some control codes for the ANSI driver, summarized from
the IBM material.


1. CURSOR POSITIONING

     To move the cursor to a specified position: ESC [#;#h where the first #
     is the desired line number and the second the desire column.

     To move the cursor up without changing columns: ESC [#a where # specifies
     the number of lines moved.

     To move the cursor to a specified horizontal and vertical position: ESC
     [#;#f where # means first the line number and secondly the column number.

     To get a device status report: ESC [6n

     To get a cursor position report: ESC [#;#r where the first # specifies
     the current line and the second # specifies the current column

     To move the cursor down: ESC [#b where # specifies the number of lines
     moved down.

     To move the cursor forward: ESC [#C where # specifies the number of
     columns moved.

     To move the cursor backward: ESC [#d where # specifies the number of
     columns moved.

     To save the cursor position: ESC [s and to restore it: ESC [u.

2. ERASING

     To do a CLS (erase screen move cursor to home position): ESC [2j

     To erase from cursor to end of line: ESC [k


3. COLOR GRAPHICS

     To set the color/graphics attributes, enter ESC [#;#m where the first #
     is the desired foreground color and the second is the desired background
     color.  Select colors from the list below:

     30  black foreground
     31  red foreground
     32  green foreground
     33  yellow foreground
     34  blue foreground
     35  magenta foreground
     36  cyan foreground
     37  white foreground

     40  black background
     41  red background
     42  green background
     43  yellow background
     44  blue background
     45  magenta background
     46  cyan background
     47  white background

     To set additional attributes enter: ESC [#m where # is the number of the
     desired attribute.  Select attributes from the list below:

     0  all attributes off (white on black)
     1  bold on
     4  underscore (on IBM Monochrome Display)
     5  blink
     7  reverse video
     8  invisible

To give an example of what can be done with these additional codes, a batch
file called MENUOFF.BAT containing only the line:

                        PROMPT $e[2J$e[30;40m$h

would blank a color display completely.  It does a CLS, sets the display to a
black foreground and background and the with the "$h" performs a backspace to
erase the blinking cursor (the "$h command is documented in the DOS manual
under PROMPT).  Another batch file called MENUON.BAT containing the lines:

      PROMPT $e[0m
      prompt
      cls

Would reset a color display to restore the screen after MENUOFF.BAT had been
run.

Enjoy ANSI!  It is a wonderful tool, and can be a lot of fun to use.  It's not
a keyboard enhancer, and if you load it up with too many keyboard
redefinitions at one time you will run out of environment space.  This is
harmless and simply means that ANSI is full.  But it will work fine to define
your function keys and control your screen.



ME (My Echo) Version 1.00 (Production) January 3, 1989
[ RETURN TO DIRECTORY ]