home *** CD-ROM | disk | FTP | other *** search
/ DOS Wares / doswares.zip / doswares / UTILS / TOOLS / ASKEY121.ZIP / ASCKEY.ENG < prev    next >
Encoding:
Text File  |  1994-05-19  |  12.8 KB  |  247 lines

  1.  
  2.  
  3.                           ASCKEY.COM Version 1.21
  4.                    Terminate and Stay Resident ASCII table
  5.                         & key codes look-up utility
  6.    ────────────────══════════════════════════ BY: Kuo Shiang-Shiang (Djohan)
  7.  
  8.                          ┌───────────────────────┐
  9.                          │    ACKNOWLEDGEMENT    │
  10.                          └───────────────────────┘
  11.     This software is Shareware. You may copy it, use it, or give it to your
  12.     friends, upload it to a BBS or something similar,  under the conditions
  13.     that  this software is distributed in its whole original package,  with
  14.     all the files included and unmodified.  If ASCKEY.COM is to be included
  15.     in a  comercial product,  please send me a free copy  of the product as
  16.     soon as it is published, and  only then you may forget about getting my
  17.     written permission for it.
  18.     If you like this utility,  or if there's any bug(s), or if you have had
  19.     a good suggestion to have it improved, please let me know,  I'll appre-
  20.     ciate it. I could be reached at
  21.                               E-mail:  djohan@mail.ncku.edu.tw
  22.                    or postal address:  P.O.BOX 7-158, Tainan-70098, Taiwan.
  23.     YOU ARE USING ASCKEY.COM AT YOUR OWN RISK! THE AUTHOR IS NOT LIABLE FOR
  24.     ANY DAMAGE CAUSED BY THE USE OR INABILITY TO USE ASCKEY.COM.
  25.     This package should include  the following files,  if they do not match
  26.     with what is listed below, please contact the person or the place where
  27.     you got the package from, or contact me.
  28.                      FILENAME     LENGTH    DATE    TIME
  29.                     -------------------------------------
  30.                     ASCKEY.COM     4058   5-18-94   2:12p
  31.                     ASCKEY.DOC    10403   5-19-94  10:47p
  32.                     ASCKEY.ENG    13071   5-19-94  10:47p
  33.  
  34.  
  35.  
  36.    ----------------===============< Usage >================-----------------
  37.                                   ^^^^^^^^^
  38.     HOT KEY      : Once residented, you may type [Left-Shift]+[Right-Shift]
  39.                    keys  simultaneously  to pop up this TSR  under any TEXT
  40.                    screen.
  41.     Reside memory: About 5.5K (About  4.5K  if loaded  without control code
  42.                    information)
  43.     Options      :
  44.            /?      HELP
  45.                    List out available options.
  46.            /X      Install without control code information
  47.                    ASCII 0-31 and 127  are control codes  which are used in
  48.                    files (as: line feed, end of file, etc.)  and in network
  49.                    communication.  This TSR would  load messages of control
  50.                    codes as well as the name strings of certain keys by de-
  51.                    fault when loading. You may use this option to leave out
  52.                    these messages, and saving about 1K of memory.
  53.            /N      Do not use extended keyboard service
  54.                    "Extended keyboard service" is the BIOS service provided
  55.                    to support enhanced (101/102-key) keyboard. Use this op-
  56.                    tion if your keyboard has less than 101 keys (Wait a mi-
  57.                    nute, are you STILL using such a keyboard??).  Neverthe-
  58.                    less, if you're using this option on enhanced keyboards,
  59.                    it'll certainly work,  except that some unsupported keys
  60.                    might not respond  (P.S. The getch() function from Turbo
  61.                    C library  doesn't support  the enhanced keyboard,  yet.
  62.                    That's why  you won't be able  to read F11 and F12  keys
  63.                    with it!). Please read "Technical Information" on how to
  64.                    write programs to read extended keys.
  65.            /R      Release program from memory
  66.  
  67.  
  68.  
  69.    ----------------==========< The ASCII table >===========-----------------
  70.                              ^^^^^^^^^^^^^^^^^^^
  71.     The  ASCII table could be popped up by pressing [L-Shift] and [R-Shift]
  72.     keys simultaneously:
  73.  
  74.       ┌─ The number of currently pointed ASCII code, in Hex, Decimal and
  75.       │  Binary numbers respectively.
  76.       │
  77.       │        The code information of current code, or the code itself
  78.       │                 printed if there's no information for the code. ─┐
  79.       │                                                                  │
  80.       │     ╔═════════════ ASCkey Coder Version 1.21 ══════════════╗     │
  81.       └──────> Code No. 1Bh = 027d = 00011011b             Escape <──────┘
  82.             ║                                                      ║
  83.             ║    │ 0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F  ║
  84.             ║ ───┼──────────────────────────────────────────────── ║
  85.             ║  0 │         0  @  P  `  p  Ç  É  á  ░  └  ╨  α  ≡  ║
  86.             ║  1 │     !  1  A  Q  a  q  ü  æ  í  ▒  ┴  ╤  ß  ±  ║
  87.             ║  2 │     "  2  B  R  b  r  é  Æ  ó  ▓  ┬  ╥  Γ  ≥  ║
  88.             ║  3 │     #  3  C  S  c  s  â  ô  ú  │  ├  ╙  π  ≤  ║
  89.             ║  4 │     $  4  D  T  d  t  ä  ö  ñ  ┤  ─  ╘  Σ  ⌠  ║
  90.             ║  5 │     %  5  E  U  e  u  à  ò  Ñ  ╡  ┼  ╒  σ  ⌡  ║
  91.             ║  6 │     &  6  F  V  f  v  å  û  ª  ╢  ╞  ╓  µ  ÷  ║
  92.             ║  7 │     '  7  G  W  g  w  ç  ù  º  ╖  ╟  ╫  τ  ≈  ║
  93.             ║  8 │     (  8  H  X  h  x  ê  ÿ  ¿  ╕  ╚  ╪  Φ  °  ║
  94.             ║  9 │      )  9  I  Y  i  y  ë  Ö  ⌐  ╣  ╔  ┘  Θ  ∙  ║
  95.             ║  A │       *  :  J  Z  j  z  è  Ü  ¬  ║  ╩  ┌  Ω  ·  ║
  96.             ║  B │      +  ;  K  [  k  {  ï  ¢  ½  ╗  ╦  █  δ  √  ║
  97.             ║  C │      ,  <  L  \  l  |  î  £  ¼  ╝  ╠  ▄  ∞  ⁿ  ║
  98.             ║  D │      -  =  M  ]  m  }  ì  ¥  ¡  ╜  ═  ▌  φ  ²  ║
  99.             ║  E │     .  >  N  ^  n  ~  Ä  ₧  «  ╛  ╬  ▐  ε  ■  ║
  100.             ║  F │     /  ?  O  _  o    Å  ƒ  »  ┐  ╧  ▀  ∩     ║
  101.             ╚═════════════   » : View, INS: Get Key, ESC: Quit ═╝
  102.  
  103.     Pressing  [Enter]  key at any time  would return  the currently pointed
  104.     ASCII code to the environment  where this TSR was popped up.  [Ins] key
  105.     would start the key codes look-up function, and [Esc] key to quit TSR.
  106.  
  107.  
  108.  
  109.    ----------------===< The key codes look-up function >===-----------------
  110.                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  111.     Pressing [Ins] at the ASCII table  would start this function.  Then the
  112.     ASCII code and scan code  of any key you typed  would be printed out on
  113.     the table. If the key is a special key (like: F1-F12, Alt, Ctrl, Enter,
  114.     Caps Lock, Num Lock, etc.),  the corresponding message  would be output
  115.     on the upper right corner of the table,  while the make-code and break-
  116.     code of the keys could be seen under the message.
  117.     Keys with ASCII code 0 or E0h are extended keys. This kind of keys when
  118.     read with  C language  getch() function,  would produce two codes,  the
  119.     first to be 0, while the second is its scan code.  The improved routine
  120.     of this function  is included  under  "Technical Information"  later in
  121.     this file.
  122.     In order that  the user could look-up  on virtually any key  (including
  123.     [Esc] key),  the author had assigned a special keys-combination to exit
  124.     from this look-up function -- [Shift] + [Backspace]. This keys-combina-
  125.     tion normally would not produce a special code.
  126.  
  127.  
  128.  
  129.    ----------------=======< Technical Information >========-----------------
  130.                           ^^^^^^^^^^^^^^^^^^^^^^^^^
  131.     The following  demonstrates how to use  BIOS keyboard function  to read
  132.     keys (the examples below improve C language getch() and ungetch() func-
  133.     tions).
  134.  
  135.       Use BIOS to read keys of standard keyboards:
  136.  
  137.        /*----------------------------------------------------------------*/
  138.        /* This function  returns the ASCII code  of normal keys (same as */
  139.        /* the original getch() function) and  scan_code+256 for extended */
  140.        /* keys (you don't need to read twice as getch() does!).          */
  141.        /* Note: There is a very simple way to calculate  "scan_code+256" */
  142.        /*       value-- Since the Hex number of 256  is 0x100,  we would */
  143.        /*       simply add "1" to the front of a scan-code  (in Hex num- */
  144.        /*       ber, of course). You don't need a calculator for that!   */
  145.        /*       e.g: The scan-code of [F1] key is 0x3B,  thus the return */
  146.        /*            value of this function is 0x13B                     */
  147.        /*            The scan-code of [Ins] key is 0x52, thus the return */
  148.        /*            value of this function is 0x152                     */
  149.        /*----------------------------------------------------------------*/
  150.        int my_getch(void) {
  151.           union REGS reg;
  152.  
  153.           reg.h.ah = 0;               /* BIOS interrupt 16h to read keys */
  154.           int86(0x16, ®, ®);    /* ...  of normal keyboards to  AL */
  155.                                       /* (ASCII code) and AH (scan code) */
  156.           if(reg.h.al==0) {
  157.              reg.h.al = reg.h.ah;
  158.              reg.h.ah = 1;
  159.           }
  160.           else reg.h.ah = 0;
  161.           return(reg.x.ax);
  162.        }
  163.  
  164.       Use BIOS to read keys of enhanced (101/102-key) keyboards:
  165.  
  166.        /*----------------------------------------------------------------*/
  167.        /* This function  returns the ASCII code  of normal keys (same as */
  168.        /* the original getch() function) and  scan_code+256 for extended */
  169.        /* keys (you don't need to read twice as getch() does!).          */
  170.        /* Note: There is a very simple way to calculate  "scan_code+256" */
  171.        /*       value-- Since the Hex number of 256  is 0x100,  we would */
  172.        /*       simply add "1" to the front of a scan-code  (in Hex num- */
  173.        /*       ber, of course). You don't need a calculator for that!   */
  174.        /*       e.g: The scan-code of [F1] key is 0x3B,  thus the return */
  175.        /*            value of this function is 0x13B                     */
  176.        /*            The scan-code of [Ins] key is 0x52, thus the return */
  177.        /*            value of this function is 0x152                     */
  178.        /*----------------------------------------------------------------*/
  179.        int my_getch(void) {
  180.           union REGS reg;
  181.  
  182.           reg.h.ah = 0x10;            /* BIOS interrupt 16h to read keys */
  183.           int86(0x16, ®, ®);    /* ... of enhanced keyboards to AL */
  184.                                       /* (ASCII code) and AH (scan code) */
  185.           if(reg.h.al==0 || reg.h.al==0xE0) {
  186.              reg.h.al = reg.h.ah;
  187.              reg.h.ah = 1;
  188.           }
  189.           else reg.h.ah = 0;
  190.           return(reg.x.ax);
  191.        }
  192.  
  193.       The above functions  could not read  the key pushed back to the key-
  194.        board by original C language  ungetch() function.  Use the following
  195.        instead.
  196.  
  197.        /*----------------------------------------------------------------*/
  198.        /* The value  passed to 'key'  should be  the same value  as that */
  199.        /* which would be returned by my_getch() for the same key, either */
  200.        /* normal key or extended key.  And unlike the original ungetch() */
  201.        /* function, this function would push  any number of keys back to */
  202.        /* the keyboard as many as the buffer could hold  (normally about */
  203.        /* 15 keys).                                                      */
  204.        /* return value:  0   success                                     */
  205.        /*                1   fail (the keyboard buffer is full)          */
  206.        /*----------------------------------------------------------------*/
  207.        int my_ungetch(unsigned int key) {
  208.           union REGS reg;
  209.           char ASCII_code, scan_code;
  210.  
  211.           if(key>0xFF) {
  212.              ASCII_code = 0;
  213.              scan_code = (char)(key & 0xFF);
  214.           }
  215.           else {
  216.              ASCII_code = (char)(key);
  217.              scan_code = (char)(key);
  218.           }
  219.           reg.x.ax = 0x0500;
  220.           reg.x.cx = (scan_code<<8)+ASCII_code;
  221.           int86(0x16, ®, ®);
  222.           return((int)reg.h.al);
  223.        }
  224.  
  225.  
  226.  
  227.    ----------------===============< History >==============-----------------
  228.                                   ^^^^^^^^^^^
  229.    Version 1.21   1994-05-18
  230.                 o Resolve the problem of not being able to read two command
  231.                   line parameters at a time
  232.                 o More compact codes, requiring smaller resident memory
  233.  
  234.    Version 1.20   1994-04-14
  235.                 o First public release as shareware
  236.  
  237.  
  238.  
  239.    ----------------=============< The Author >=============-----------------
  240.                                 ^^^^^^^^^^^^^^
  241.     Name          : Kuo Shiang-Shiang (Djohan)
  242.     E-mail        : djohan@mail.ncku.edu.tw
  243.     Postal address: P. O. Box 7-158, Tainan 70098, Taiwan.
  244.     Author of     : GetCAP I & II, ASCKEY, GRABBER2, etc.
  245.  
  246.    ────────────────═════════════< End of file >═════════════────────────────
  247.