home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / MODEM / UWPC201.ZIP / UW-SRC.ZIP / ADM31.CAP next >
Encoding:
Text File  |  1991-07-25  |  5.2 KB  |  194 lines

  1. //-------------------------------------------------------------------------
  2. //
  3. // ADM31.CAP - Capability file for the ADM31 terminal type.
  4. // 
  5. //  This file is part of UW/PC - a multi-window comms package for the PC.
  6. //  Copyright (C) 1990-1991  Rhys Weatherley
  7. //
  8. //  This program is free software; you can redistribute it and/or modify
  9. //  it under the terms of the GNU General Public License as published by
  10. //  the Free Software Foundation; either version 1, or (at your option)
  11. //  any later version.
  12. //
  13. //  This program is distributed in the hope that it will be useful,
  14. //  but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. //  GNU General Public License for more details.
  17. //
  18. //  You should have received a copy of the GNU General Public License
  19. //  along with this program; if not, write to the Free Software
  20. //  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21. //
  22. // Revision History:
  23. // ================
  24. //
  25. //  Version  DD/MM/YY  By  Description
  26. //  -------  --------  --  --------------------------------------
  27. //    1.0    04/04/91  RW  Original Version of ADM31.CAP
  28. //    1.1    24/05/91  RW  Add some other "adm"-series codes.
  29. //    1.2    25/07/91  RW  Add support for client escapes.
  30. //
  31. // You may contact the author by:
  32. // =============================
  33. //
  34. //  e-mail: rhys@cs.uq.oz.au
  35. //    mail: Rhys Weatherley
  36. //          5 Horizon Drive
  37. //          Jamboree Heights
  38. //          Queensland 4074
  39. //        Australia
  40. //
  41. //-------------------------------------------------------------------------
  42.  
  43.         name    "ADM31"        // Name of the terminal type.
  44.  
  45. start:        reset    0        // Reset insert mode flag.
  46.         setattr    0        // Reset current attribute.
  47. loop:        getch            // Get next character from remote.
  48.         switch            // Determine top-level action.
  49.           0x00,loop        // Ignore NUL characters
  50.           '\r',crproc
  51.           '\n',lfproc
  52.           '\b',bsproc
  53.           '\t',tabproc
  54.           0x07,bellproc
  55.           0x0B,upline
  56.           0x0C,right
  57.           0x1A,clrscrn
  58.           0x1B,escproc
  59.           0x1E,home
  60.         endsw
  61.         test    0        // Test the insertion flag.
  62.         jne    insert
  63.         send            // Send the character direct.
  64.         jmp    loop
  65. insert:        inschar            // Insert the received character.
  66.         jmp    loop        // Back around for another character.
  67.  
  68. crproc:        cr
  69.         jmp    loop
  70. lfproc:        lf
  71.         jmp    loop
  72. bsproc:        bs
  73.         jmp    loop
  74. tabproc:    tab
  75.         jmp    loop
  76. bellproc:    bell
  77.         jmp    loop
  78. escproc:    getch            // Get the escape character.
  79.         switch
  80.           '*',clrscrn
  81.           '=',domove
  82.           'E',doinsline
  83.           'G',attrs
  84.           'R',dodelline
  85.           'T',doclreol
  86.           'Y',doclreos
  87.           'W',dodelchar
  88.           'q',enterins
  89.           'r',exitins
  90.           'u',start
  91. // The following escape codes are not guaranteed to be part of
  92. // the "ADM31" standard, but provide a good selection of facilities
  93. // from the whole "adm" range of terminals.  The terminals that do
  94. // support these according to termcap and terminfo are indicated.
  95.           ')',standout        // adm3e, adm20, adm22, adm11
  96.           '(',normal        // adm3e, adm20, adm22, adm11
  97.           'Q',insertch        // adm2,22 insert char
  98.           ';',clrscrn        // adm1, adm1a, adm2, adm42
  99.           '3',dummy        // adm42 - cursor visibilites.
  100.           'I',loop        // adm42,22 - backtab (ignored for now)
  101.           'i',tabproc        // adm22
  102.           '|',doclient        // UW/PC client escape code
  103.         endsw
  104.         jmp    loop        // Ignore the escape sequence.
  105. dummy:        getch            // Skip the cursor visibility char.
  106.         jmp    loop
  107. doclient:    getch            // Get the client operation character.
  108.         client            // Do a client operation.
  109.         jmp    loop
  110. insertch:    insblank        // Insert a blank here.
  111.         jmp    loop
  112. right:        getxy
  113.         getx
  114.         add    1
  115.         cmp    width
  116.         jae    crlf
  117.         setx
  118.         move
  119.         jmp    loop
  120. crlf:        cr
  121.         lf
  122.         jmp    loop
  123. upline:        getxy
  124.         gety
  125.         cmp    0
  126.         je    loop
  127.         sub    1
  128.         sety
  129.         move
  130.         jmp    loop
  131. clrscrn:    clear
  132. home:        load    0
  133.         setx
  134.         sety
  135.         move
  136.         jmp    loop
  137. domove:        getch
  138.         sub    ' '
  139.         sety
  140.         getch
  141.         sub    ' '
  142.         setx
  143.         move
  144.         jmp    loop
  145. doinsline:    insline
  146.         jmp    loop
  147. attrs:        getch            // Get attribute value.
  148.         switch
  149.           '0',normal
  150.           '1',standout
  151. // The following attribute values for for other terminals
  152. // in the "adm" series and provides a good range of facilities.
  153.           '4',standout        // adm42, adm12, adm21
  154.           '8',standout        // adm3e, adm21
  155.         endsw
  156.         jmp    loop
  157. normal:        setattr    0
  158.         jmp    loop
  159. standout:    setattr 1
  160.         jmp    loop
  161. dodelline:    delline
  162.         jmp    loop
  163. doclreol:    clreol
  164.         jmp    loop
  165. doclreos:    clreos
  166.         jmp    loop
  167. dodelchar:    delchar
  168.         jmp    loop
  169. enterins:    set    0            // Enter insert mode.
  170.         jmp    loop
  171. exitins:    reset    0            // Exit insert mode.
  172.         jmp    loop
  173. //
  174. // Define the keyboard translations to be performed.  Note that
  175. // the adm3e and adm22 terminal types use "\001@\r" ... for their
  176. // function key encodings.  The standard ADM31 codes are used.
  177. //
  178. keys:        key    0x4800,"\013"        // Cursor Up key
  179.         key    0x5000,"\012"        // Cursor Down key
  180.         key    0x4D00,"\014"        // Cursor Right key
  181.         key    0x4B00,"\010"        // Cursor Left key
  182.         key    0x4700,"\036"        // Home - adm3e, adm2
  183.         key    0x3B00,"\0011\r"    // F1
  184.         key    0x3C00,"\0012\r"    // F2
  185.         key    0x3D00,"\0013\r"    // F3
  186.         key    0x3E00,"\0014\r"    // F4
  187.         key    0x3F00,"\0015\r"    // F5
  188.         key    0x4000,"\0016\r"    // F6
  189.         key    0x4100,"\0017\r"    // F7
  190.         key    0x4200,"\0018\r"    // F8
  191.         key    0x4300,"\0019\r"    // F9
  192.         key    0x4400,"\0010\r"    // F0
  193.         endkeys
  194.