home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / clarion / library / clacom / clacom.txt < prev    next >
Text File  |  1994-02-24  |  129KB  |  4,420 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.                                      C L A C O M
  27.  
  28.  
  29.  
  30.  
  31.                                Communications Library
  32.  
  33.  
  34.                                          For
  35.  
  36.  
  37.                              Clarion Database Developer
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.           Copyright (C) 1993 - 1994 by GAP Development Company.
  45.  
  46.  
  47.           ALL RIGHTS  RESERVED. No part of this manual shall be reproduced,
  48.           stored in  a retrieval  system,  or  transmitted  by  any  means,
  49.           electronic, mechanical,  photocopying, recording,  or  otherwise,
  50.           without written  permission from  GAP Development  Company. While
  51.           every precaution  has been  taken  in  the  preparation  of  this
  52.           manual, GAP  Development Company  assumes no  responsibility  for
  53.           errors or omissions. Neither is any liability assumed for damages
  54.           resulting from the use of the information contained herein.
  55.  
  56.  
  57.           CLACOM is  the sole  and exclusive  property of  GAP  Development
  58.           Company. It  is licensed  and not  sold  to  the  end  user  with
  59.           restrictions placed upon its use.
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.           CLACOM is copyrighted by GAP Development Company.
  67.           Clarion and Clarion Database Developer are trademarks of Clarion
  68.           Software Corporation.
  69.           DESQview is a trademark of Quarterdeck.
  70.           DigiBoard is a trademark of DigiBoard Incorporated.
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.           Contents
  78.  
  79.  
  80.  
  81.           Description                                                     5
  82.  
  83.                Major Features                                             5
  84.  
  85.  
  86.           Getting Started                                                 6
  87.  
  88.  
  89.  
  90.           Integrating with Clarion                                        7
  91.  
  92.                Overlays - Protected Mode                                  8
  93.                Communications Interface                                   9
  94.                File Transfers                                            11
  95.                KeyCodes                                                  12
  96.  
  97.  
  98.           Port Initialization                                            14
  99.  
  100.  
  101.  
  102.           Input & Output                                                 17
  103.  
  104.  
  105.  
  106.           Sample Application                                             21
  107.  
  108.  
  109.  
  110.           Global Variables                                               23
  111.  
  112.  
  113.  
  114.           Functions - Quick Reference                                    24
  115.  
  116.  
  117.  
  118.           Functions - Detailed Reference                                 25
  119.  
  120.  
  121.  
  122.           Appendix A                                                     69
  123.  
  124.  
  125.  
  126.  
  127.  
  128.                                        Page 3
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.           Appendix B                                                     72
  136.  
  137.  
  138.  
  139.           Index                                                          73
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.                                        Page 4
  187.  
  188.  
  189.  
  190.           GAP Communications                                         CLACOM
  191.  
  192.  
  193.  
  194.  
  195.           Description
  196.  
  197.  
  198.           CLACOM is  a professional  communications library for programmers
  199.           using the  Clarion Database  Developer. It  allows you  to easily
  200.           integrate asynchronous communications into your Clarion programs.
  201.  
  202.           CLACOM includes  robust Communications  routines which  are fully
  203.           interrupt driven. Written in highly optimized assembler, they are
  204.           capable of  operating at  any speed which the UART on an IBM type
  205.           of computer  is capable  of producing.  The FIFO  buffers in  the
  206.           16550 UART  are fully  supported. Hardware  flow control (CTS/RTS
  207.           checking) is automatic.
  208.  
  209.           ANSI Terminal  Emulation is  fully integrated into CLACOM, as are
  210.           the most popular file transfer protocols.
  211.  
  212.  
  213.           Major Features
  214.  
  215.               Supports the FIFO buffers of the 16550 UART chip.
  216.               Speeds up to 115,200 baud.
  217.               Supports COM  1 through  COM 4  as  well  as  Intelligent
  218.                DigiBoards using  a Direct  Programming  Interface  or  a
  219.                DigiBoard Device Driver.
  220.               Up to 4 ports can be opened simultaneously (16 ports when
  221.                using a DigiBoard).
  222.               Supports CTS/RTS, automatically.
  223.               Fully self  contained, built  in ANSI driver for IBM ANSI
  224.                Terminal Emulation.
  225.               File transfer  protocols include - ASCII, Xmodem, Xmodem-
  226.                CRC,  1K  Xmodem,  1K  Xmodem-G,  Ymodem,  Ymodem-G,  and
  227.                Zmodem.
  228.               Works with  programs compiled as Static, Overlay, Overlay
  229.                with DLL, Protected, and Protected with DLL.
  230.               Extremely easy interfacing with Clarion programs.
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.                                        Page 5
  245.  
  246.  
  247.  
  248.           GAP Communications                                         CLACOM
  249.  
  250.  
  251.           Getting Started
  252.  
  253.  
  254.           First a  note about this documentation. This Text Based manual is
  255.           identical in  content to  the Printed Manual except that it lacks
  256.           formatting and  graphics. Some screens can not be reproduced in a
  257.           document such  as this.  Font  sizes  can  not  be  changed  when
  258.           necessary since  there is  no way of knowing what kind of printer
  259.           this document  will  be  printed  with.  The  Printed  Manual  is
  260.           designed in  such a way that it is easy to read and it is easy to
  261.           find the  information you may be looking for. We are unable to do
  262.           the same  with this  text  based  manual.  If  the  documentation
  263.           references a  screen, you will need to run the Example program to
  264.           see the  screen, since we are unable to reproduce it in this Text
  265.           Based manual.
  266.  
  267.  
  268.  
  269.           The following files are part of the CLACOM distribution set:
  270.  
  271.               CLACOM.TXT    - Text Based documentation. Not part of
  272.                               Registered version since its not needed.
  273.               DXVCLOM.LIB   - Library routines for Statically linked
  274.                               Clarion APP.
  275.               DOVCLCOM.LIB  - Library routines for Overlayed Clarion APP.
  276.               DDVCLCOM.LIB  - Library routines for Overlayed Clarion APP
  277.                               using Run Time Librares.
  278.               DESCLCOM.LIB  - Library routines for Protected mode Clarion
  279.                               APP using Run Time Libraries.             (1)
  280.               DEVCLCOM.LIB  - Library routines for Statically linked
  281.                               Protected mode Clarion APP.               (1)
  282.               CLACOM.OBJ    - Stub for including Module Definitions.
  283.               CLACOM.INC    - Module Structure Include file.
  284.               GTERM.ZIP     - Terminal Emulation example with Clarion
  285.                               source.
  286.               RESETDIG.ZIP  - Program used to reset a DigiBoard COM/Xi.
  287.  
  288.  
  289.           The .OBJ,  .LIB and  .INC files  should be  placed  in  the  same
  290.           directory where  the program you intend to use them with resides.
  291.           GTERM.ZIP contains  a Terminal  Emulation Clarion Application. It
  292.           should be  placed in its own directory along with the above .OBJ,
  293.           .LIB and .INC files.
  294.  
  295.  
  296.  
  297.           (1) Protected  Mode Libraries  are not  included  with  Shareware
  298.               version of CLACom.
  299.  
  300.  
  301.  
  302.                                        Page 6
  303.  
  304.  
  305.  
  306.           GAP Communications                                         CLACOM
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.           Integrating with Clarion
  314.  
  315.  
  316.           To tell  your Clarion  Application that  you are using the CLACOM
  317.           library, follow these steps:
  318.  
  319.           Load or Create your application.
  320.  
  321.           From the  View Menu,  select Module  View. Select Insert from the
  322.           Edit Menu.  The Module  Properties screen  will appear.  For  the
  323.           Module Name,  type CLACOM.OBJ.  Select the External Object Module
  324.           radio  button.  For  the  Module  Structure  Include  File,  type
  325.           CLACOM.INC. Select OK.
  326.  
  327.           CLACOM.OBJ is  a dummy  module. It  contains no code or data. Its
  328.           sole purpose is to include the CLACOM procedure definitions.
  329.  
  330.           You must  now edit  the Project  File and include the five CLACOM
  331.           libraries. The  fivee libraries  are identical with the exception
  332.           that they  were compiled  using one  of the  five Clarion  memory
  333.           models:  Static,  Overlayed,  Overlayed/Runtime,  Protected,  and
  334.           Protected/Runtime.
  335.  
  336.           Select the  Project Menu.  Select Change Project File. Select the
  337.           Module button  and then  the Insert  button. For the Module Name,
  338.           type:
  339.  
  340.                                   %CLAPFX%CLCOM.LIB
  341.  
  342.           Select the  External OBJ/LIB  Radio  button.  Finally,  save  the
  343.           Project File changes.
  344.  
  345.           Your Clarion application is now fully aware of the CLACOM library
  346.           routines and  you will  be free  to use  any of the five standard
  347.           Memory Models  without having to worry about which CLACOM library
  348.           to use.
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.                                        Page 7
  361.  
  362.  
  363.  
  364.           GAP Communications                                         CLACOM
  365.  
  366.  
  367.           Overlays - Protected Mode
  368.  
  369.           You must  perform one  final step  before generating  your CLACOM
  370.           application.
  371.  
  372.           The Standard  Communications interface  takes over  the interrupt
  373.           vector for  the selected  COM Port. This means that the interrupt
  374.           service routine  can not be swapped out. It must remain in memory
  375.           at all  times. The  same is  true if  you enable  the  Ctrl-Break
  376.           intercept routine (which you should).
  377.  
  378.           In order  to keep  the  Communications  routines  in  memory  and
  379.           prevent them  from being  swapped out,  you must make a change to
  380.           one of  Clarion's files. In the Clarion directory there is a file
  381.           called ROVERLAY.EXP.  Edit this  file and add the following lines
  382.           to the end of the SEGMENTS section:
  383.  
  384.                GCOM_DATA      PRELOAD   FIXED
  385.                GCOM_TEXT      PRELOAD   FIXED
  386.  
  387.           A portion of the ROVERLAY.EXP file would appear as follows:
  388.  
  389.  
  390.  
  391.                        CLAICEP_TEXT     PRELOAD
  392.                        CLAFIXED_DATA    PRELOAD
  393.                        GCOM_DATA        PRELOAD   FIXED
  394.                        GCOM_TEXT        PRELOAD   FIXED
  395.  
  396.  
  397.           Please do not take the above change lightly or forget to make it.
  398.           Failure to  add the  above lines will cause your program to crash
  399.           as soon as the communications routines are swapped out of memory.
  400.           This is  especially important  for Protected Mode programs as you
  401.           want the Communications routines to remain FIXED in memory.
  402.  
  403.           You may  also copy  this file  to your  application's  directory,
  404.           giving it  the name  of your application with the .EXP extension:
  405.           APPNAME.EXP.
  406.  
  407.           Adding the  above lines to your Export file will not, in any way,
  408.           interfere with applications that do not use CLACOM.
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416.  
  417.  
  418.                                        Page 8
  419.  
  420.  
  421.  
  422.           GAP Communications                                         CLACOM
  423.  
  424.  
  425.           Communications Interface
  426.  
  427.           CLACOM supports three serial port interfaces:
  428.  
  429.  
  430.  
  431.                     STANDARD    DIGIBOARD   INT14/EBIOS
  432.  
  433.           The standard  interface is  used when  working with  the standard
  434.           COM1 thru  COM4 serial  ports on  the Host computer. This will be
  435.           the interface  most often  used.  If  an  end  user  is  using  a
  436.           DigiBoard then  either the DigiBoard or Int14/EBIOS interface may
  437.           be selected.  Most  DigiBoard  users  will  use  the  Int14/EBIOS
  438.           interface. All  input/output to  the DigiBoard  is performed  via
  439.           Interrupt 14  calls and  a Device  Driver (supplied by DigiBoard)
  440.           handles the  interface between  the program  and the  board.  The
  441.           DigiBoard interface  uses Direct Programming. CLACOM talks to the
  442.           board directly  without the need for a Device Driver. In order to
  443.           use this interface, a program called RESETDIG.EXE must be used in
  444.           the AUTOEXEC.BAT  file to  reset  the  DigiBoard  once  when  the
  445.           computer is first booted. This program is supplied as part of the
  446.           CLACOM package and may be freely distributed to your end users.
  447.  
  448.           In order to determine which interface your end users require, you
  449.           should provide a Hardware screen similar to the following:
  450.  
  451.  
  452.  
  453.  
  454.                   SCREEN NOT AVAILABLE IN TEXT BASED DOCUMENTATION
  455.                                  SEE EXAMPLE PROGAM
  456.  
  457.  
  458.  
  459.  
  460.           If the Standard Interface is selected, the Ports Button should be
  461.           enabled, the  DigiBoard Button  disabled, and if the Ports Button
  462.           is  selected,  a  screen  similar  to  the  following  should  be
  463.           displayed:
  464.  
  465.  
  466.  
  467.  
  468.                   SCREEN NOT AVAILABLE IN TEXT BASED DOCUMENTATION
  469.                                  SEE EXAMPLE PROGAM
  470.  
  471.  
  472.  
  473.  
  474.  
  475.  
  476.                                        Page 9
  477.  
  478.  
  479.  
  480.           GAP Communications                                         CLACOM
  481.  
  482.  
  483.           If the  DigiBoard or Int14/EBIOS Interface is selected, the Ports
  484.           Button should  be disabled,  the DigiBoard Button enabled, and if
  485.           the DigiBoard  Button  is  selected,  a  screen  similar  to  the
  486.           following should be displayed:
  487.  
  488.  
  489.  
  490.  
  491.                   SCREEN NOT AVAILABLE IN TEXT BASED DOCUMENTATION
  492.                                  SEE EXAMPLE PROGAM
  493.  
  494.  
  495.  
  496.  
  497.           On the Hardware Screen, if the DigiBoard or Int14/EBIOS Interface
  498.           is selected,  then the  Port Radio Buttons should be disabled. On
  499.           the Port  Assignments Screen,  the Base  and IRQ fields for COM 1
  500.           and COM 2 should be marked as "Skip". The reason for this is that
  501.           it makes  no difference what a user types into these fields since
  502.           the standard  Base Address  and IRQ  for these  two ports will be
  503.           used.
  504.  
  505.           On the  DigiBoard Parameters  Screen, the  fields that need to be
  506.           disabled  depend   upon  the   Interface.  If  the  Interface  is
  507.           DigiBoard, then the Memory Window and I/O Port Buttons are valid,
  508.           as is  the Channel  Number field.  Channel Numbers for the Direct
  509.           Interface generally  range from  1 to 16. The sample screens show
  510.           the valid Window and I/O Port address for a DigiBoard.
  511.  
  512.           If, however,  the Interface is Int14/EBIOS, the Memory Window and
  513.           I/O Port  Buttons should  be disabled.  Only the  Channel  Number
  514.           field should  be selectable.  The Int14/EBIOS  Interface uses the
  515.           DigiBoard supplied  Device Driver  and it  already knows what the
  516.           addresses for  the board  are, so  these Radio  Buttons  are  not
  517.           needed for  this Interface.  Channel numbers  for this  Interface
  518.           generally range  from 4  to 19  (0 -  3 are  reserved for  COM1 -
  519.           COM4).
  520.  
  521.           Don't try  to do range checking on the DigiBoard Channel Numbers.
  522.           These boards  are produced  in several  varieties from 2 ports, 8
  523.           ports, up to 16 ports. An end user that is using a DigiBoard will
  524.           likely know what Channel Number is being configured.
  525.  
  526.           When using  the DigiBoard  Interface an  end user that is using a
  527.           DigiBoard will  also know what Memory Window and I/O Port address
  528.           the board  was configured  for when  the board was installed. The
  529.           valid addresses  are contained  in the  DigiBoard manuals and are
  530.           shown on the sample screens.
  531.  
  532.  
  533.  
  534.                                        Page 10
  535.  
  536.  
  537.  
  538.           GAP Communications                                         CLACOM
  539.  
  540.  
  541.           Keep in mind that in order to use the DigiBoard Direct Interface,
  542.           your end  users must  run the  supplied RESETDIG.EXE  program  in
  543.           their AUTOEXEC.BAT  files. This  program makes sure the DigiBoard
  544.           is reset and able to accept commands when the computer is powered
  545.           on. It  resets all  of the Channels on the board, which is why it
  546.           is run only once.
  547.  
  548.  
  549.           File Transfers
  550.  
  551.           CLACOM supports  all of the popular File Transfer Protocols. Each
  552.           of the  protocols are  given a  number  (with  the  exception  of
  553.           Zmodem). Before  initiating an  Upload or a Download, you need to
  554.           prompt the user for a Protocol. Your end users won't be the least
  555.           bit impressed  about having  to type in a number so your Protocol
  556.           Browse Box  should display Protocol Names. In the background, you
  557.           will translate  the Names  into numbers  to send  to the protocol
  558.           drivers. The  sample Terminal  Program shows an excellent example
  559.           of how  to prompt  for a Protocol and translate the string into a
  560.           number to  send  to  the  protocol  drivers.  The  Protocols  are
  561.           numbered as follows:
  562.  
  563.  
  564.  
  565.                     0 - ASCII         3 - 1K Xmodem-G
  566.                     1 - Xmodem        4 - Ymodem
  567.                     2 - 1K Xmodem     5 - Ymodem-G
  568.  
  569.  
  570.           Note that  as far  as CLACOM is concerned, there is no difference
  571.           between Checksum  Xmodem and  CRC Xmodem. CLACOM always starts in
  572.           "CRC Mode" but will adjust itself as necessary.
  573.  
  574.           Also note  that both  of the Ymodem protocols (as well as Zmodem)
  575.           are Batch Protocols and when Downloading, you need not prompt for
  576.           a File  Name since  the name will be supplied by the sender. When
  577.           Uploading you  can either provide a single File Name to upload or
  578.           a Wild Card specification.
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.                                        Page 11
  593.  
  594.  
  595.  
  596.           GAP Communications                                         CLACOM
  597.  
  598.  
  599.           KeyCodes
  600.  
  601.           CLACOM includes  a function  called GetKeyc.  If your application
  602.           needs to  send  keycodes  that  were  generated  from  the  local
  603.           keyboard out  the Communications  Port to  a remote  computer you
  604.           need to  use  this  function  to  gather  input  from  the  local
  605.           keyboard. Clarion's  keyboard routines  can not  be used  because
  606.           Clarion changes  the value  of certain key presses (including the
  607.           standard ASCII codes, 0 - 255).
  608.  
  609.           For instance,  Clarion re-maps  the  following  keys  from  their
  610.           standard ASCII value to a value meaningful only to Clarion:
  611.  
  612.                       Key         Clarion   Actual
  613.  
  614.                       Escape         256      27
  615.                       Enter          257      13
  616.                       Backspace      258       8
  617.  
  618.  
  619.           If you  use the Clarion keyboard functions and a user presses the
  620.           backspace key,  Clarion returns  a code  of 258. If you send this
  621.           keycode to the remote computer, what you will actually be sending
  622.           is the  code 2  (Clarion's keyboard  functions return  a LONG and
  623.           Communications Ports  can only  accept a BYTE, therefore the high
  624.           bytes of  the return  value are truncated and only the lower byte
  625.           is sent).  The remote  computer will either display the character
  626.           (a happy  face) or  act upon  it (to the remote computer, it is a
  627.           Ctrl-B). The  remote computer  will not know that you were trying
  628.           to backspace over a previously typed character!
  629.  
  630.           Any character  typed at the keyboard is a valid character to send
  631.           out the  Communications Port if that character has a value of 255
  632.           or less. It shouldn't be re-mapped or translated in any manner.
  633.  
  634.           GetKeyc  returns   keyboard  characters  "as  is".  It  makes  no
  635.           translations on  regular ASCII  characters (0  - 255).  Any  code
  636.           above 255 (an Extended Keyboard code) returns the actual keyboard
  637.           scan code for that key with the value 256 added. By adding 256 to
  638.           the value  you can  easily determine  if the  key is an exteneded
  639.           key. A  Backspace is  code 8.  An Enter  is code 13. An Escape is
  640.           code 27.
  641.  
  642.           Because  Clarion  includes  its  Keyboard  Equate  file  in  your
  643.           application, there  are no  supplied mnemonics  for the  keycodes
  644.           that GetKeyc  returns. Appendix  A shows the actual key typed and
  645.           the value  returned by GetKeyc. You can not use BSKey to see if a
  646.           key press  is the  Back Space  key because  of the  keyboard  re-
  647.  
  648.  
  649.  
  650.                                        Page 12
  651.  
  652.  
  653.  
  654.           GAP Communications                                         CLACOM
  655.  
  656.  
  657.           mapping equates that Clarion includes in your program. If you do,
  658.           you will  be testing  against the  code 258  when you  need to be
  659.           testing against the code 8.
  660.  
  661.           For instance, this will not work:
  662.  
  663.              keychr = GetKeyc()                   ! Get Key Press
  664.  
  665.              if keychr = BSKey                    ! Backspace hit
  666.                ComPutc(keychr)                    ! Actually sends a Ctrl-B
  667.              end
  668.  
  669.           This will work:
  670.  
  671.              keychr = GetKeyc()                   ! Get Key Press
  672.  
  673.              if keychr = 8                        ! Backspace hit
  674.                ComPutc(keychr)                    ! Sends an 8 (backspace)
  675.              end
  676.  
  677.  
  678.  
  679.  
  680.  
  681.  
  682.  
  683.  
  684.  
  685.  
  686.  
  687.  
  688.  
  689.  
  690.  
  691.  
  692.  
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.                                        Page 13
  709.  
  710.  
  711.  
  712.           GAP Communications                                         CLACOM
  713.  
  714.  
  715.           Port Initialization
  716.  
  717.  
  718.           The  first  thing  a  communications  program  normally  does  is
  719.           initialize the  communications port and reset the modem. You will
  720.           notice that the sample program, GTERM, takes a different approach
  721.           to the  usual "terminal"  interface and it doesn't initialize the
  722.           port until it is ready to use it.
  723.  
  724.           How you  initialize the  communications port  depends upon  which
  725.           Interface the  user has  selected. The  DigiBoard and Int14/EBIOS
  726.           Interfaces set  up the  port in  a single  step process.  This is
  727.           because some of the low level routines either in the Int14 Device
  728.           Driver or  the on-board BIOS require that all parameters be known
  729.           when initializing a port on the board.
  730.  
  731.           Setting up  the Standard  Interface is  a two  step process.  The
  732.           first step  is to  set up the Interrupt Handler, program the UART
  733.           to generate  interrupts, turn the FIFO buffers on (if the UART is
  734.           a 16550)  and program  the Interrupt  Controller chip  so that it
  735.           will recognize the UART interrupts. The second step is to set the
  736.           Line Control register in the UART. This is more commonly known as
  737.           setting the Baud Rate, Party, Data, and Stop bits
  738.  
  739.           Port Numbers  for the Standard and DigiBoard Direct Interface are
  740.           0 based.  Your users will not be accustomed to entering 0 for COM
  741.           1 or  1 for  COM 2, therefore your applications should use 1 when
  742.           referring to  COM 1,  2 when referring to COM 2, 3 when referring
  743.           to COM  3, etc.,  and you should make the translations to 0 based
  744.           ports before  calling any  of the  Communications routines.  Note
  745.           that the  INT14/EBIOS Interface uses port numbers that begin with
  746.           1.
  747.  
  748.           The following  is an  example on  setting up  the  communications
  749.           port. The  first step  is to  initialize the ANSI driver. This is
  750.           important so that the screen output functions know how large your
  751.           Terminal Screen  is and  the default  color you  want to use. You
  752.           must pass  the COM  port number  that the  ANSI  driver  will  be
  753.           associated with.  The ANSI  Cursor Position Report (CPR) sequence
  754.           is issued  whenever the  driver receives  a Device  Status Report
  755.           (DSR) command.  The CPR  sequence is sent out the COM port. Since
  756.           there is  only one  screen and  one ANSI  driver, the driver must
  757.           know which  port to use. The DSR/CPR sequences are generally only
  758.           used by  BBS  programs  to  determine  if  the  caller  has  ANSI
  759.           capability. The  second step  is to determine which Interface the
  760.           user is using and setup the port accordingly:
  761.  
  762.  
  763.  
  764.  
  765.  
  766.                                        Page 14
  767.  
  768.  
  769.  
  770.           GAP Communications                                         CLACOM
  771.  
  772.  
  773.              InitAnsi(comport,MaxRows,MaxCols,14) ! Initialize Ansi Driver
  774.  
  775.              BaudRate = DEFORMAT(GCN:BaudRate)    ! string to number
  776.  
  777.              data = deformat(GCN:Data)            ! get Data
  778.              stop = deformat(GCN:Stop)            ! Stop
  779.  
  780.              if GCN:Parity = 'Odd'                ! and Parity
  781.                parity = 1
  782.              elsif GCN:Parity = 'Even'
  783.                parity = 2
  784.              else
  785.                parity = 0
  786.              end
  787.  
  788.              gotdigi = 0                          ! assume no DigiBoard
  789.  
  790.              if clip(GCN:Interface) = 'DigiBoard' ! using DigiBoard
  791.                comport = GCN:DigiChnl - 1         ! 0 base the Port #
  792.                gotdigi = 1                        ! set DigiBoard flag
  793.                anystring = GCN:DigiSeg            ! get Memory Window
  794.                digiseg = StrHex(anystring)        ! as a Hex Number
  795.                anystring = GCN:DigiPort           ! get I/O Port
  796.                digiport = StrHex(anystring)       ! as a Hex Number
  797.  
  798.                retcode = DsetUp(DigiSeg,DigiPort,comport,BaudRate
  799.                                 parity,data,stop)
  800.  
  801.                if retcode > 0
  802.                  ! display error message and quit
  803.                end
  804.  
  805.              elsif clip(GCN:Interface) = 'Int14/EBIOS' ! using Int14/EBIOS
  806.                comport = GCN:DigiChnl                  ! Port Number
  807.                gotdigi = 1                             ! set DigiBoard flag
  808.  
  809.                retcode = Int14Set(comport,BaudRate,parity,data,stop)
  810.  
  811.                if retcode > 0
  812.                  ! display error message and quit
  813.                end
  814.  
  815.  
  816.  
  817.  
  818.  
  819.  
  820.  
  821.  
  822.  
  823.  
  824.                                        Page 15
  825.  
  826.  
  827.  
  828.           GAP Communications                                         CLACOM
  829.  
  830.  
  831.              else                                 ! Regular Interface
  832.  
  833.                ! get Port, IRQ, and BASE Address
  834.  
  835.                IRQ = 0
  836.                base = 0
  837.  
  838.                if GCN:Port = 'COM1'
  839.                  comport = 0
  840.                elsif GCN:Port = 'COM2'
  841.                  comport = 1
  842.                elsif GCN:Port = 'COM3'
  843.                  comport = 2
  844.                  IRQ = GCN:IRQ3
  845.                  anystring = GCN:BASE3
  846.                  base = StrHex(anystring)
  847.                elsif GCN:Port = 'COM4'
  848.                  comport = 3
  849.                  IRQ = GCN:IRQ4
  850.                  anystring = GCN:BASE4
  851.                  base = StrHex(anystring)
  852.                end
  853.                
  854.                ! initialize COM Port and Interrupt Vector
  855.  
  856.                retcode = SetPort(IRQ,base,comport)
  857.  
  858.                if retcode > 0
  859.                  ! display error message and quit
  860.                else
  861.                  ! Set Baud, Parity, Data, and Stop
  862.  
  863.                  retcode = InitPort(comport,BaudRate,parity,data,stop)
  864.  
  865.                  if retcode > 0
  866.                    ResetPort()                    ! Interrupts Off
  867.                    ! display error message and quit
  868.                  end
  869.                end
  870.              end
  871.  
  872.  
  873.           As you can see when using the Standard Interface and there are no
  874.           errors setting up the Port, we then call InitPort to set the Baud
  875.           Rate, Data, etc.
  876.  
  877.  
  878.  
  879.  
  880.  
  881.  
  882.                                        Page 16
  883.  
  884.  
  885.  
  886.           GAP Communications                                         CLACOM
  887.  
  888.  
  889.           Input & Output
  890.  
  891.  
  892.           To gather input from the local keyboard, GetKeyc is used. GetKeyc
  893.           returns a  SHORT. If  the return  value is  less than 0 then that
  894.           means no  key was  pressed (GetKeyc actually returns a -1 in this
  895.           case). If the return value is greater than 255 then that means an
  896.           extended key was pressed (function key, cursor pad key, etc). You
  897.           normally do  not send  these extended keys out the communications
  898.           port unless  the remote  end can accept and handle extended keys.
  899.           If the  remote end  can handle extended keys, the usual procedure
  900.           for sending  these keys is to first send a 0, then send the lower
  901.           8 bits  of the  return value. If the return value is less than or
  902.           equal to 255, then you assign the return value to a BYTE and call
  903.           ComPutc to send the keyboard code.
  904.  
  905.           The following  example shows how to use GetKeyc and interpret the
  906.           return value.  Note that we do not use the Clarion KeyCode Equate
  907.           labels since they are mapped to different codes:
  908.  
  909.              comport SHORT
  910.              retchr  SHORT
  911.              keychr  BYTE
  912.  
  913.              retchr = GetKeyc()           ! get a keyboard character
  914.  
  915.              if retchr NOT= -1            ! if something there
  916.                if retchr > 255            ! Extended Key
  917.                  case retchr              ! which one
  918.                    of 278                 ! Alt-U, Upload a File
  919.                    of 288                 ! Alt-D, Download a File
  920.                    of 369                 ! Alt-F10, activate Menu
  921.                  end
  922.                else                       ! regular keyboard key
  923.                  keychr = retchr          ! Translate to BYTE value
  924.                  ComPutc(comport,keychr)  ! and send it out
  925.                end
  926.              end
  927.  
  928.  
  929.  
  930.  
  931.  
  932.  
  933.  
  934.  
  935.  
  936.  
  937.  
  938.  
  939.  
  940.                                        Page 17
  941.  
  942.  
  943.  
  944.           GAP Communications                                         CLACOM
  945.  
  946.  
  947.           The following  example is  similar to the above but in this case,
  948.           the remote end can handle extended keyboard codes:
  949.  
  950.              comport SHORT
  951.              retchr  SHORT
  952.              keychr  BYTE
  953.  
  954.              retchr = GetKeyc()           ! get a keyboard character
  955.  
  956.              if retchr NOT= -1            ! if something there
  957.                if retchr > 255            ! Extended Key
  958.                  case retchr              ! which one
  959.                    of 278                 ! Alt-U, Upload a File
  960.                    of 288                 ! Alt-D, Download a File
  961.                    of 369                 ! Alt-F10, activate Menu
  962.                    else                   ! not something we care about
  963.                      keychr = retchr      ! Translate to BYTE value
  964.                      ComPutc(comport,0)   ! flag that this is extended key
  965.                      ComPutc(comport,keychr)      ! send scan code
  966.                  end
  967.                else                       ! regular keyboard key
  968.                  keychr = retchr          ! Translate to BYTE value
  969.                  ComPutc(comport,keychr)  ! and send it out
  970.                end
  971.              end
  972.  
  973.           Whether or  not local  keyboard characters  are sent to the local
  974.           screen depends  upon if you originated the connection or answered
  975.           the connection.  Generally the  originating side does not display
  976.           keyboard characters.  It simply  sends  the  characters  out  the
  977.           communications  port   and  the   answering  side   displays  the
  978.           characters on  its screen and sends the characters back, at which
  979.           time you retrieve them from your receive buffer and display them.
  980.           This is sometimes refered to as Full Duplex.
  981.  
  982.           Some answering  systems do not echo characters back to the sender
  983.           (refered to  as Half  Duplex). In  this case,  you will  need  to
  984.           display the  keyboard character  in addition to sending it to the
  985.           communications port.
  986.  
  987.           If you are writing BBS software, you always display locally typed
  988.           characters on the screen, and you always echo characters received
  989.           from the  communications port  back out  the  port.  If  you  are
  990.           writing Terminal  Emulation software,  whether or  not to display
  991.           locally typed  characters on the screen is generally a Phone Book
  992.           option for each entry in the phone book. Characters received from
  993.           the communications port are never sent back out the port.
  994.  
  995.  
  996.  
  997.  
  998.                                        Page 18
  999.  
  1000.  
  1001.  
  1002.           GAP Communications                                         CLACOM
  1003.  
  1004.  
  1005.           The following  is an  example of  keyboard input  routines  where
  1006.           "Half Duplex" operation is required:
  1007.  
  1008.              comport SHORT
  1009.              retchr  SHORT
  1010.              keychr  BYTE
  1011.              halfdup BYTE
  1012.  
  1013.              halfdup = 1                  ! flag to use half duplex
  1014.  
  1015.              retchr = GetKeyc()           ! get a keyboard character
  1016.  
  1017.              if retchr NOT= -1            ! if something there
  1018.                if retchr < 256            ! regular character
  1019.                  keychr = retchr          ! Translate to BYTE value
  1020.                  ComPutc(comport,keychr)  ! and send it out
  1021.  
  1022.                  if halfdup               ! if half duplex
  1023.                    Gputc(keychr)          ! display on local screen
  1024.                  end
  1025.                end
  1026.              end
  1027.  
  1028.  
  1029.           A good  example of  Half Duplex  versus Full  Duplex is  when you
  1030.           enter into  Terminal Emulation  mode when  not connected  with  a
  1031.           remote  computer.   If  the  modem  is  configured  not  to  echo
  1032.           characters back,  then anything you type will not be displayed on
  1033.           the screen.  This is  because there  is no On Line service on the
  1034.           remote end to send the characters back. If you subsequently place
  1035.           an item  on the  Terminal Menu to toggle duplex from full to half
  1036.           and toggle  it to  half, then  what you type will be displayed on
  1037.           the  screen   (providing  you  write  the  code  to  handle  this
  1038.           situation, as in the above example).
  1039.  
  1040.           GPutc and GPuts are the local output routines. The first displays
  1041.           single characters  while the second displays entire strings. Both
  1042.           routines are  tied into the internal ANSI driver which means they
  1043.           can contain  ANSI display  sequences to  move the  cursor, change
  1044.           colors, clear the screen, etc.
  1045.  
  1046.           ComGetc is  the communications  port input  routine. It retrieves
  1047.           single byte values from the port. In order to distinguish between
  1048.           a no  character available  condition (empty receive buffer) and a
  1049.           legitimate character,  it returns  a negative value (-1) if there
  1050.           are no  characters waiting  to be  read. The return value must be
  1051.           assigned to a BYTE before it can be displayed by Gputc.
  1052.  
  1053.  
  1054.  
  1055.  
  1056.                                        Page 19
  1057.  
  1058.  
  1059.  
  1060.           GAP Communications                                         CLACOM
  1061.  
  1062.  
  1063.           An example of ComGetc and Gputc together:
  1064.  
  1065.              comport SHORT
  1066.              retchr  SHORT
  1067.              keychr  BYTE
  1068.  
  1069.              retchr = ComGetc(comport)    ! get a remote character
  1070.  
  1071.              if retchr NOT= -1            ! if something there
  1072.                keychr = retchr            ! Translate to BYTE value
  1073.                Gputc(keychr)              ! and display it
  1074.              end
  1075.  
  1076.  
  1077.           ComPutc and  ComPuts are  the communications output routines. The
  1078.           first sends  single characters  while  the  second  sends  entire
  1079.           strings.
  1080.  
  1081.           A word  about the  built in  ANSI driver  and Clarion.  The  ANSI
  1082.           driver writes  directly to  the video display memory (taking care
  1083.           to honor  DESQView's shadow  buffer if operating under DESQView).
  1084.           Because Clarion keeps a backup copy of the video display, Clarion
  1085.           will overwrite  anything placed on the screen by Gputc and Gputs.
  1086.           This occurs  because when  Clarion opens  a screen  or a menu, it
  1087.           first updates the physical screen with the contents of its backup
  1088.           buffer, then opens the screen. The only time this is a problem is
  1089.           when you  are in  Terminal  Mode  and  using  the  CLACOM  output
  1090.           routines.
  1091.  
  1092.           To circumvent  this problem  there is  a procedure called GetScrn
  1093.           which will  update Clarion's  backup buffer  with the contents of
  1094.           the physical  screen. This  procedure should  be called  prior to
  1095.           invoking a Clarion function that writes to the screen.
  1096.  
  1097.  
  1098.  
  1099.  
  1100.  
  1101.  
  1102.  
  1103.  
  1104.  
  1105.  
  1106.  
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.                                        Page 20
  1115.  
  1116.  
  1117.  
  1118.           GAP Communications                                         CLACOM
  1119.  
  1120.  
  1121.           Sample Application
  1122.  
  1123.  
  1124.           Included with  CLACOM is  a  sample  Terminal  Emulation  program
  1125.           (called GTERM)  which shows how to use most of the communications
  1126.           routines.  You  may  use  this  application  as  a  template  for
  1127.           designing your own communications program.
  1128.  
  1129.           The First  Procedure is defined as InitProgram. InitProgram first
  1130.           arms a  ShutDown Procedure  called ResetCbreak.  In then  makes a
  1131.           call to  SetCbreak to  set up the Ctrl-Break handler (a necessary
  1132.           requirement for  any communications  program. ResetCbreak will be
  1133.           called automatically  when the  program ends.  It makes a call to
  1134.           RestCbreak to restore the Ctrl-Break handler.
  1135.  
  1136.           InitProgram then  checks to  see if  the Main  Configuration File
  1137.           exists. If  this is  the first  time the  program is run, it will
  1138.           create the configuration file with default values for each of the
  1139.           fields. It  then checks  to see  if the  Protocol File exists. If
  1140.           not, it creates the file with the 7 internal protocols. This data
  1141.           could be  set up  in a  Memory Queue,  but placing  it in  a file
  1142.           allows you  to create  an entry screen so that your users can add
  1143.           external  protocols.   You  will  see  from  examining  the  File
  1144.           Properties that  the fields  to allow  for external protocols are
  1145.           already in  the file.  If you  do create a Browse/Form for adding
  1146.           external protocols,  you need  to make sure that the user can not
  1147.           delete or change any of the internal protocols.
  1148.  
  1149.           InitProgram then  calls MainMenu. On MainMenu the user may select
  1150.           the Files Menu, which contains Quit, to exit the program.
  1151.  
  1152.           The Dial Menu brings up a Lookup screen where the user may select
  1153.           a Phone  Number to  call. The  Dialing Directory is tied into the
  1154.           EditPhone Form  so that a user may add or change an entry without
  1155.           having to go to the Setup Menu.
  1156.  
  1157.           When a  phone  number  has  been  selected,  the  Dial  Procedure
  1158.           initializes the  Communications Port  and calls  the number. Upon
  1159.           successful connection  with the remote computer it will place the
  1160.           user  in   Terminal  Mode.   Dial  gives  excellent  examples  on
  1161.           interfacing with a communications port and a modem.
  1162.  
  1163.           The Terminal  Menu puts  the user  directly into  Terminal  Mode.
  1164.           Because Terminal  Mode can be entered either directly or from the
  1165.           Dial Menu,  the procedure checks to see if it was called by Dial.
  1166.           If so, it won't attempt to initialize the Communications Port. If
  1167.           entered from  the Menu,  Terminal initializes the port in exactly
  1168.           the same  manner as  Dial,  with  one  exception.  For  the  Port
  1169.  
  1170.  
  1171.  
  1172.                                        Page 21
  1173.  
  1174.  
  1175.  
  1176.           GAP Communications                                         CLACOM
  1177.  
  1178.  
  1179.           parameters, instead  of  using  the  parameters  from  a  dialing
  1180.           directory entry, it uses the global default parameters.
  1181.  
  1182.           Terminal Mode is really the heart of the application. Whatever is
  1183.           received from the Communications Port is displayed on the screen.
  1184.           Incoming characters  are sent  to the ANSI Driver. If you wish to
  1185.           emulate a  TTY device,  instead of  sending the characters to the
  1186.           ANSI Driver,  you can  use Clarion's TYPE function (the character
  1187.           will first  have to  be converted  to a  string). Keyboard  codes
  1188.           (those entered  from the  local keyboard)  are checked  to see if
  1189.           they are  extended keys.  Any  keyboard  code  above  255  is  an
  1190.           extended key. If the key code is a regular keyboard character, it
  1191.           is sent  out the  Communications Port.  If the  key  code  is  an
  1192.           extended key  it is  checked to  see if it is the menu activation
  1193.           key (Alt-F10)  or one  of the  "hot keys".  If so,  the  routines
  1194.           associated with  those keys are invoked. If the key code is not a
  1195.           regular  ASCII   character  or  an  extended  key  that  Terminal
  1196.           recognizes it is simply discarded.
  1197.  
  1198.           Please see  the section Keycodes for more information on Extended
  1199.           Keyboard Codes  and why you need to use CLACOM's GetKeyc function
  1200.           to retrieve characters from the keyboard.
  1201.  
  1202.           Terminal includes  a Menu  that is activated by pressing the Alt-
  1203.           F10 key.  It allows  the user  to exit  Terminal Mode, Upload and
  1204.           Download Files,  Clear the  Screen, Change  Modem Parameters  and
  1205.           Hang Up  the modem  (drop carrier). You will notice that any menu
  1206.           function that  depends upon  there  being  a  remote  carrier  is
  1207.           disabled if there is no connection with a remote computer.
  1208.  
  1209.           Because Clarion  writes to the screen twice (once to video memory
  1210.           and once  to its  own backup  buffer) Clarion  doesn't know  that
  1211.           you've been using the ANSI driver to display characters. When you
  1212.           use Gputc  and Gputs  to send  incoming characters  to the CLACOM
  1213.           ANSI driver,  Clarion has no idea that you've been writing to the
  1214.           screen. While  in Terminal  Mode, before  you  call  any  Clarion
  1215.           Function that displays something on the screen (with the possible
  1216.           exception of  the TYPE  function) you  need to  update the backup
  1217.           buffer that  Clarion writes  to. This is accomplished with a call
  1218.           to GetScrn. GetScrn reads the contents of the physical screen and
  1219.           updates Clarion's  backup buffer  with the  information. Terminal
  1220.           shows how and when to call GetScrn. If you don't make the call to
  1221.           GetScrn then  Clarion will  erase whatever  is on  your  Terminal
  1222.           Screen before  it displays  the screen  you open. To get a better
  1223.           understanding for  this, comment  out all of the calls to GetScrn
  1224.           in the  Terminal Procedure. Then make and run the program. Make a
  1225.           connection to a remote computer. While in Terminal Mode, activate
  1226.  
  1227.  
  1228.  
  1229.  
  1230.                                        Page 22
  1231.  
  1232.  
  1233.  
  1234.           GAP Communications                                         CLACOM
  1235.  
  1236.  
  1237.           the  Menu  (Alt-F10).  Watch  what  is  on  the  screen  suddenly
  1238.           disappear!
  1239.  
  1240.           The Setup  Menu allows a user to set default Modem Parameters and
  1241.           enter Phone  Book entries.  The Modem  Parameters are used as the
  1242.           defaults for  each Phone  Book entry  and when  entering Terminal
  1243.           Mode from the Terminal Menu.
  1244.  
  1245.           GTERM gives excellent examples on how to use the CLACOM functions
  1246.           and procedures.  It can  be used  as a template to write powerful
  1247.           Terminal  Emulation   programs   that   include   more   terminal
  1248.           emulations, external  protocols,  script  files  (for  automating
  1249.           logons), keyboard  macros, Compuserve  or BBS  Message  handling,
  1250.           Screen Capturing, and lots more.
  1251.  
  1252.           GTERM can  be condensed so that your Mailing List Application can
  1253.           automatically dial a number contained in the data base. It can be
  1254.           expanded to become a popular Term program, even a BBS program!
  1255.  
  1256.  
  1257.  
  1258.           Global Variables
  1259.  
  1260.  
  1261.           The following  variables are  declared global  and may be used by
  1262.           your application  to alter  the behavior  of  the  Communications
  1263.           routines:
  1264.  
  1265.                noascmes   When set  to 1, disables all messages and windows
  1266.                           associated with  ASCII file  transfers.  This  is
  1267.                           useful   when    you   are    using   the   ASCII
  1268.                           upload/download routines for something other than
  1269.                           transferring files.
  1270.                nocts      When set  to 1,  disables the Clear To Send (CTS)
  1271.                           checking that  is performed by the Communications
  1272.                           Output routines. Should never be set unless there
  1273.                           is a specific reason for doing so.
  1274.                asciidel   The number  of clock  tics to delay after sending
  1275.                           each line  in a  file when  using the  ASCII file
  1276.                           transfer. 18 tics equals 1 second.
  1277.  
  1278.  
  1279.  
  1280.  
  1281.  
  1282.  
  1283.  
  1284.  
  1285.  
  1286.  
  1287.  
  1288.                                        Page 23
  1289.  
  1290.  
  1291.  
  1292.           GAP Communications                                         CLACOM
  1293.  
  1294.  
  1295.           Functions - Quick Reference
  1296.  
  1297.  
  1298.             CkeyPress    - Checks for a remote or local key press.
  1299.             ClrBuf       - Clear the communications receive buffer.
  1300.             ComGetc      - Gets a character from com port.
  1301.             ComGetd      - Gets a character from com port with time-out.
  1302.             ComPutb      - Sends a buffer of data to com port.
  1303.             ComPutc      - Sends a character to com port.
  1304.             ComPuts      - Sends a string to com port.
  1305.             CursorOff    - Turns local cursor off.
  1306.             CursorOn     - Turns local cursor on.
  1307.             DclrTx       - Clear DigiBoard Transmit buffer.
  1308.             DgtTxfree    - Get Free space in DigiBoard Transmit buffer.
  1309.             Dmodem       - Change DigiBoard Port parameters.
  1310.             DownLoad     - Download using Xmodem and Ymodem.
  1311.             Drestore     - Reset DigiBoard Port.
  1312.             DsetUp       - Initialize DigiBoard Port (Direct Interface).
  1313.             Dtr          - Toggles the DTR line on or off.
  1314.             GetKeyc      - Gets keyboard character and scan code.
  1315.             GetScrn      - Update Clarion's screen buffer.
  1316.             GetZmodem    - Download using Zmodem.
  1317.             Gputc        - Sends a character to local screen.
  1318.             Gputs        - Sends a string to local screen.
  1319.             InitAnsi     - Initializes ANSI driver.
  1320.             InitPort     - Sets up Communications Port (Std Interface).
  1321.             Int14Set     - Initialize DigiBoard Port (Int14/EBIOS Intface).
  1322.             Iscd         - Checks if there is a Carrier.
  1323.             ModemPuts    - Send a string to the modem.
  1324.             ModemStat    - Get Modem Status.
  1325.             PosCursor    - Update ANSI Driver Cursor Position.
  1326.             ResetPort    - Restores Communications Port (Std Interface).
  1327.             RestCbreak   - Restores Ctrl-Break vector.
  1328.             Rts          - Toggles RTS line on or off.
  1329.             Rxempty      - Checks if any characters in receive buffer.
  1330.             SendBreak    - Send a break signal to the modem.
  1331.             SendZmodem   - Send files using Zmodem.
  1332.             SetPort      - Initializes Communications port.
  1333.             SetCbreak    - Initializes Ctrl-Break vector.
  1334.             StrHex       - Translate Hex String to number.
  1335.             StrWord      - Find substring in string.
  1336.             Timer        - Time Delay.
  1337.             UpLoad       - Send files using Xmodem and Ymodem.
  1338.  
  1339.  
  1340.  
  1341.  
  1342.  
  1343.  
  1344.  
  1345.  
  1346.                                        Page 24
  1347.  
  1348.  
  1349.  
  1350.           GAP Communications                                         CLACOM
  1351.  
  1352.  
  1353.           Functions - Detailed Reference
  1354.  
  1355.  
  1356.           Functions return a value, procedures do not return anything.
  1357.  
  1358.           Procedures cannot  be used in assignment statements. They perform
  1359.           a service  and do not report back as to the successful completion
  1360.           of that service.
  1361.  
  1362.           Functions also  perform a  service but they do report back on how
  1363.           well that service was performed.
  1364.  
  1365.           The return  value from  a function must be assigned to a variable
  1366.           of like  type or  used in  a comparison statement (this is due to
  1367.           Clarion's strong type checking which will not allow you to call a
  1368.           function without checking its return value).
  1369.  
  1370.           The function  descriptions will note whether or not a function is
  1371.           actually a  Procedure (does  not return  a value)  or a  Function
  1372.           (does return a value).
  1373.  
  1374.           The Examples will use a string called "cstr" to let you know that
  1375.           the function  requires a string in the C, NULL terminated, format
  1376.           (CSTRING in  Clarion). Passing Clarion Strings to these functions
  1377.           will not  work. You  will need  to assign the Clarion STRING to a
  1378.           CSTRING and then pass the variable in the function call.
  1379.  
  1380.  
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.  
  1391.  
  1392.  
  1393.  
  1394.  
  1395.  
  1396.  
  1397.  
  1398.  
  1399.  
  1400.  
  1401.  
  1402.  
  1403.  
  1404.                                        Page 25
  1405.  
  1406.  
  1407.  
  1408.           GAP Communications                                         CLACOM
  1409.  
  1410.  
  1411.           CkeyPress
  1412.           -----------------------------------------------------------------
  1413.  
  1414.           Purpose       Checks for a remote or local key press.
  1415.  
  1416.                         CkeyPress(port)
  1417.  
  1418.                         SHORT port                COM Port Number
  1419.  
  1420.           Type          Function - Returns SHORT
  1421.  
  1422.           Description   This function will check the local keyboard as well
  1423.                         as the  communications receive  buffer to  see if a
  1424.                         key is waiting to be read. It is most often used in
  1425.                         loops that  need to  wait for  a key  press, either
  1426.                         from remote or local.
  1427.  
  1428.           Return Value  0 = no key is waiting, 1 = a key is waiting.
  1429.  
  1430.           Example       c = CkeyPress(0)          ! key pressed?
  1431.  
  1432.              loop while CkeyPress(0) = 0          ! do nothing
  1433.              end                                  ! until a key is pressed
  1434.  
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.  
  1444.  
  1445.  
  1446.  
  1447.  
  1448.  
  1449.  
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.  
  1457.  
  1458.  
  1459.  
  1460.  
  1461.  
  1462.                                        Page 26
  1463.  
  1464.  
  1465.  
  1466.           GAP Communications                                         CLACOM
  1467.  
  1468.  
  1469.           ClrBuf
  1470.           -----------------------------------------------------------------
  1471.  
  1472.           Purpose       Clears the Communications receive buffer.
  1473.  
  1474.                         ClrBuf(port)
  1475.  
  1476.                         SHORT port                COM Port Number
  1477.  
  1478.           Type          Procedure
  1479.  
  1480.           Description   Empties the  receive buffer  such that  any pending
  1481.                         characters are simply ignored.
  1482.  
  1483.           Return Value  None.
  1484.  
  1485.           Example       ClrBuf(0)                 ! clear Rec Buf (COM 1)
  1486.  
  1487.  
  1488.  
  1489.  
  1490.  
  1491.  
  1492.  
  1493.  
  1494.  
  1495.  
  1496.  
  1497.  
  1498.  
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505.  
  1506.  
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.                                        Page 27
  1521.  
  1522.  
  1523.  
  1524.           GAP Communications                                         CLACOM
  1525.  
  1526.  
  1527.           ComGetc
  1528.           -----------------------------------------------------------------
  1529.  
  1530.           Purpose       Retrieve a character from communications buffer.
  1531.  
  1532.                         ComGetc(port)
  1533.  
  1534.                         SHORT port                COM Port Number
  1535.  
  1536.           Type          Function - Returns SHORT
  1537.  
  1538.           Description   Checks  the   communications  receive   buffer  and
  1539.                         returns the  next character,  if any.  In order  to
  1540.                         distinguish between  a legitimate  character and  a
  1541.                         "no character"  condition, this  function returns a
  1542.                         SHORT even though a legitimate character is a BYTE.
  1543.                         If the  function does  not return  a -1, the return
  1544.                         value needs  to be  assigned to  a variable of type
  1545.                         BYTE if the character is to be passed to a function
  1546.                         that requires  a BYTE parameter (Gputc and ComPutc,
  1547.                         for instance).
  1548.  
  1549.           Return Value  Next character  in buffer  or -1  for no characters
  1550.                         waiting.
  1551.  
  1552.           Example       c = ComGetc(0)            ! get a char from remote
  1553.  
  1554.              keychr  BYTE
  1555.              retchr  SHORT
  1556.              comport SHORT
  1557.  
  1558.              comport = 0                          ! use COM 1
  1559.  
  1560.              retchr = ComGetc(comport)            ! get a char from remote
  1561.  
  1562.              if retchr NOT= -1                    ! anything there?
  1563.                keychr = retchr                    ! yes, truncate high byte
  1564.                Gputc(keychr)                      ! and display
  1565.              end
  1566.  
  1567.  
  1568.  
  1569.  
  1570.  
  1571.  
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578.                                        Page 28
  1579.  
  1580.  
  1581.  
  1582.           GAP Communications                                         CLACOM
  1583.  
  1584.  
  1585.           ComGetd
  1586.           -----------------------------------------------------------------
  1587.  
  1588.           Purpose       Retrieve a  character  from  communications  buffer
  1589.                         with delay.
  1590.  
  1591.                         ComGetd(port,secs)
  1592.  
  1593.                         SHORT port                COM Port Number
  1594.                         SHORT secs                Number of seconds to wait
  1595.  
  1596.           Type          Function - Returns SHORT
  1597.  
  1598.           Description   This function  is the  same as ComGetc, except that
  1599.                         if there  are no  characters in the receive buffer,
  1600.                         it will wait for the number of seconds you specify.
  1601.  
  1602.           Return Value  Next character  in buffer  or -10  for time-out (no
  1603.                         characters to read).
  1604.  
  1605.           Example
  1606.  
  1607.              comport SHORT
  1608.  
  1609.              comport = 0                          ! use COM 1
  1610.  
  1611.              do while ComGetd(comport,2) = -10    ! wait 2 seconds
  1612.              end                                  ! for a character
  1613.  
  1614.  
  1615.  
  1616.  
  1617.  
  1618.  
  1619.  
  1620.  
  1621.  
  1622.  
  1623.  
  1624.  
  1625.  
  1626.  
  1627.  
  1628.  
  1629.  
  1630.  
  1631.  
  1632.  
  1633.  
  1634.  
  1635.  
  1636.                                        Page 29
  1637.  
  1638.  
  1639.  
  1640.           GAP Communications                                         CLACOM
  1641.  
  1642.  
  1643.           ComPutb
  1644.           -----------------------------------------------------------------
  1645.  
  1646.           Purpose       Sends a buffer of data out the communications port.
  1647.  
  1648.                         ComPutb(port,buffer,len)
  1649.  
  1650.                         SHORT port                COM Port Number
  1651.                         CSTRING buffer            Buffer containing data
  1652.                         SHORT len                 Number of bytes to send
  1653.  
  1654.           Type          Procedure
  1655.  
  1656.           Description   This function  will send  a user supplied buffer of
  1657.                         len bytes  out the communications port, one byte at
  1658.                         a time.
  1659.  
  1660.           Return Value  None.
  1661.  
  1662.           Example
  1663.  
  1664.              buffer    CSTRING(200)
  1665.  
  1666.              ComPutb(0,buffer,100)                ! Send 100 bytes to COM 1
  1667.  
  1668.  
  1669.  
  1670.  
  1671.  
  1672.  
  1673.  
  1674.  
  1675.  
  1676.  
  1677.  
  1678.  
  1679.  
  1680.  
  1681.  
  1682.  
  1683.  
  1684.  
  1685.  
  1686.  
  1687.  
  1688.  
  1689.  
  1690.  
  1691.  
  1692.  
  1693.  
  1694.                                        Page 30
  1695.  
  1696.  
  1697.  
  1698.           GAP Communications                                         CLACOM
  1699.  
  1700.  
  1701.           ComPutc
  1702.           -----------------------------------------------------------------
  1703.  
  1704.           Purpose       Sends a  single character  out  the  communications
  1705.                         port.
  1706.  
  1707.                         ComPutc(port,ch)
  1708.  
  1709.                         SHORT port                COM Port Number
  1710.                         BYTE ch                   Character to send
  1711.  
  1712.           Type          Procedure
  1713.  
  1714.           Description   Will send a single character out the communications
  1715.                         port.
  1716.  
  1717.           Return Value  None.
  1718.  
  1719.           Example       ComPutc(0,13)             ! Send a Carriage Return
  1720.  
  1721.              keychr  BYTE
  1722.              retchr  SHORT
  1723.              comport SHORT
  1724.  
  1725.              comport = 0                          ! use COM 1
  1726.  
  1727.              retchr = GetKeyc                     ! Keyboard hit?
  1728.  
  1729.              if retchr NOT= -1                    ! anything there?
  1730.                if retchr < 256                    ! yes, if regular char
  1731.                  keychr = retchr                  ! truncate high byte
  1732.                  ComPutc(comport,keychr)          ! and send it to remote
  1733.                end
  1734.              end
  1735.  
  1736.  
  1737.  
  1738.  
  1739.  
  1740.  
  1741.  
  1742.  
  1743.  
  1744.  
  1745.  
  1746.  
  1747.  
  1748.  
  1749.  
  1750.  
  1751.  
  1752.                                        Page 31
  1753.  
  1754.  
  1755.  
  1756.           GAP Communications                                         CLACOM
  1757.  
  1758.  
  1759.           ComPuts
  1760.           -----------------------------------------------------------------
  1761.  
  1762.           Purpose       Sends a string of characters out the communications
  1763.                         port.
  1764.  
  1765.                         ComPuts(port,str)
  1766.  
  1767.                         SHORT port                COM Port Number
  1768.                         CSTRING str               String to send
  1769.  
  1770.           Type          Procedure
  1771.  
  1772.           Description   Will  send   a  string   of  characters   out   the
  1773.                         communications port.  Note that unlike ComPutb, the
  1774.                         number of bytes to send is determined by the length
  1775.                         of  the   string.  Therefore  this  function  stops
  1776.                         sending characters  when  it  encounters  the  NULL
  1777.                         byte.
  1778.  
  1779.           Return Value  None.
  1780.  
  1781.           Example
  1782.  
  1783.              comport SHORT
  1784.              cstr    CSTRING(100)
  1785.  
  1786.              comport = 0                          ! use COM 1
  1787.  
  1788.              cstr = 'Send this String'            ! string to send
  1789.              ComPuts(comport,cstr)                ! send string to com port
  1790.  
  1791.  
  1792.  
  1793.  
  1794.  
  1795.  
  1796.  
  1797.  
  1798.  
  1799.  
  1800.  
  1801.  
  1802.  
  1803.  
  1804.  
  1805.  
  1806.  
  1807.  
  1808.  
  1809.  
  1810.                                        Page 32
  1811.  
  1812.  
  1813.  
  1814.           GAP Communications                                         CLACOM
  1815.  
  1816.  
  1817.           CursorOff
  1818.           -----------------------------------------------------------------
  1819.  
  1820.           Purpose       Turns the local cursor off.
  1821.  
  1822.                         CursorOff()
  1823.  
  1824.           Type          Procedure
  1825.  
  1826.           Description   This function  is used  to turn  the cursor  on the
  1827.                         local monitor off.
  1828.  
  1829.           Return Value  None.
  1830.  
  1831.           Example       CursorOff()               ! turn the cursor off
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  
  1837.           CursorOn
  1838.           -----------------------------------------------------------------
  1839.  
  1840.           Purpose       Turns the local cursor on.
  1841.  
  1842.                         CursorOn()
  1843.  
  1844.           Type          Procedure
  1845.  
  1846.           Description   This function  is used  to turn  the cursor  on the
  1847.                         local monitor on.
  1848.  
  1849.           Return Value  None.
  1850.  
  1851.           Example       CursorOn()                ! turn the cursor on
  1852.  
  1853.  
  1854.  
  1855.  
  1856.  
  1857.  
  1858.  
  1859.  
  1860.  
  1861.  
  1862.  
  1863.  
  1864.  
  1865.  
  1866.  
  1867.  
  1868.                                        Page 33
  1869.  
  1870.  
  1871.  
  1872.           GAP Communications                                         CLACOM
  1873.  
  1874.  
  1875.           DclrTx
  1876.           -----------------------------------------------------------------
  1877.  
  1878.           Purpose       Clears the Transmit Buffer on DigiBoard.
  1879.  
  1880.                         DclrTx(port)
  1881.  
  1882.                         SHORT port                COM Port (Channel) Number
  1883.  
  1884.           Type          Procedure
  1885.  
  1886.           Description   When  using   a  DigiBoard  (Interface  is  set  to
  1887.                         DigiBoard or Int14/EBIOS), this function will clear
  1888.                         the Transmit  Buffer for  the specified port on the
  1889.                         DigiBoard.
  1890.  
  1891.           Return Value  None.
  1892.  
  1893.           Example       DclrTx(4)                 ! clear xmit buffer
  1894.  
  1895.  
  1896.  
  1897.  
  1898.  
  1899.  
  1900.  
  1901.  
  1902.  
  1903.  
  1904.  
  1905.  
  1906.  
  1907.  
  1908.  
  1909.  
  1910.  
  1911.  
  1912.  
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918.  
  1919.  
  1920.  
  1921.  
  1922.  
  1923.  
  1924.  
  1925.  
  1926.                                        Page 34
  1927.  
  1928.  
  1929.  
  1930.           GAP Communications                                         CLACOM
  1931.  
  1932.  
  1933.           DgtTxfree
  1934.           -----------------------------------------------------------------
  1935.  
  1936.           Purpose       Returns number  of  Free  Bytes  in  Digi  Transmit
  1937.                         Buffer.
  1938.  
  1939.                         DgtTxfree(port)
  1940.  
  1941.                         SHORT port                COM Port (Channel) Number
  1942.  
  1943.           Type          Function - Returns USHORT
  1944.  
  1945.           Description   When  using   a  DigiBoard  (Interface  is  set  to
  1946.                         DigiBoard or  Int14/EBIOS), this  function  returns
  1947.                         the number of free bytes in the Transmit Buffer for
  1948.                         the specified port on the DigiBoard.
  1949.  
  1950.           Return Value  None.
  1951.  
  1952.           Example
  1953.  
  1954.              freebytes   USHORT
  1955.  
  1956.              freebytes = DgtTxfree(4)             ! get free space
  1957.  
  1958.  
  1959.  
  1960.  
  1961.  
  1962.  
  1963.  
  1964.  
  1965.  
  1966.  
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.  
  1976.  
  1977.  
  1978.  
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984.                                        Page 35
  1985.  
  1986.  
  1987.  
  1988.           GAP Communications                                         CLACOM
  1989.  
  1990.  
  1991.           Dmodem
  1992.           -----------------------------------------------------------------
  1993.  
  1994.           Purpose       Initialize Digi  port to  baud, parity,  data,  and
  1995.                         stop bits
  1996.  
  1997.                         Dmodem(port,baud,parity,data,stop)
  1998.  
  1999.                         SHORT port        COM Port (Channel) Number
  2000.                         LONG baud         BPS rate
  2001.                         SHORT parity      0 = None, 1 = Odd, 2 = Even
  2002.                         SHORT data        6, 7, or 8 data bits
  2003.                         SHORT stop        1 or 2 stop bits
  2004.  
  2005.           Type          Procedure
  2006.  
  2007.           Description   Changes the current port settings on a DigiBoard to
  2008.                         the parity,  data bits,  stop bits,  and baud rate.
  2009.                         The port  number is  defined when initially setting
  2010.                         up the port with a call to DsetUp or Int14Set.
  2011.  
  2012.                         The port  parameters are  normally set  when  first
  2013.                         initializing  the  DigiBoard  port.  This  function
  2014.                         allows you  to change  those parameters  while "on-
  2015.                         line".
  2016.  
  2017.           Return Value  None.
  2018.  
  2019.           Example       Dmodem(4,2400,2,7,1)      ! E,7,1 - 2400 bps
  2020.  
  2021.  
  2022.  
  2023.  
  2024.  
  2025.  
  2026.  
  2027.  
  2028.  
  2029.  
  2030.  
  2031.  
  2032.  
  2033.  
  2034.  
  2035.  
  2036.  
  2037.  
  2038.  
  2039.  
  2040.  
  2041.  
  2042.                                        Page 36
  2043.  
  2044.  
  2045.  
  2046.           GAP Communications                                         CLACOM
  2047.  
  2048.  
  2049.           DownLoad
  2050.           -----------------------------------------------------------------
  2051.  
  2052.           Purpose       Receives one or more files.
  2053.  
  2054.                         DownLoad(port,protocol,filename)
  2055.  
  2056.                         SHORT port                COM Port Number
  2057.                         SHORT protocol            Number of protocol to use
  2058.                         CSTRING filename          Name of file to download
  2059.  
  2060.           Type          Procedure
  2061.  
  2062.           Description   This function  allows you  to receive a file from a
  2063.                         remote  computer.  The  protocols  are  defined  as
  2064.                         follows:
  2065.  
  2066.                               0 = ASCII           3 = 1K Xmodem-G
  2067.                               1 = Xmodem          4 = Ymodem
  2068.                               2 = 1K Xmodem       5 = Ymodem-G
  2069.  
  2070.  
  2071.                         Filename is  a CSTRING  containing the  name of the
  2072.                         file to  download.  If  the  protocol  is  a  batch
  2073.                         protocol (Ymodem  or Ymodem-G)  then you may pass a
  2074.                         NULL string  (cstr = '') since the name of the file
  2075.                         will  be  supplied  by  the  remote  sender.  If  a
  2076.                         filename is passed, it will be ignored.
  2077.  
  2078.           Return Value  None.
  2079.  
  2080.           Example
  2081.  
  2082.              cstr  CSTRING(100)
  2083.  
  2084.              cstr = 'FILE.ZIP'                    ! receive a single file
  2085.              DownLoad(0,2,cstr)                   ! using 1K Xmodem                                                                                                                         _
  2086.  
  2087.              cstr = ''                            ! receive 1 or more files
  2088.              DownLoad(0,4,cstr)                   ! using Ymodem
  2089.  
  2090.  
  2091.  
  2092.  
  2093.  
  2094.  
  2095.  
  2096.  
  2097.  
  2098.  
  2099.  
  2100.                                        Page 37
  2101.  
  2102.  
  2103.  
  2104.           GAP Communications                                         CLACOM
  2105.  
  2106.  
  2107.           Drestore
  2108.           -----------------------------------------------------------------
  2109.  
  2110.           Purpose       Reset Modem attached to a DigiBoard Port.
  2111.  
  2112.                         Drestore()
  2113.  
  2114.                         SHORT port                COM Port (Channel) Number
  2115.  
  2116.           Type          Procedure
  2117.  
  2118.           Description   This function  simply  turns  off  the  handshaking
  2119.                         lines to  the modem.  It turns  DTR and RTS off and
  2120.                         disables Hardware Flow control. Should be used only
  2121.                         when using the DigiBoard or Int14/EBIOS Interface.
  2122.  
  2123.           Return Value  None.
  2124.  
  2125.           Example       Drestore(4)               ! Reset Modem
  2126.  
  2127.  
  2128.  
  2129.  
  2130.  
  2131.  
  2132.  
  2133.  
  2134.  
  2135.  
  2136.  
  2137.  
  2138.  
  2139.  
  2140.  
  2141.  
  2142.  
  2143.  
  2144.  
  2145.  
  2146.  
  2147.  
  2148.  
  2149.  
  2150.  
  2151.  
  2152.  
  2153.  
  2154.  
  2155.  
  2156.  
  2157.  
  2158.                                        Page 38
  2159.  
  2160.  
  2161.  
  2162.           GAP Communications                                         CLACOM
  2163.  
  2164.  
  2165.           DsetUp
  2166.           -----------------------------------------------------------------
  2167.  
  2168.           Purpose       Initialize Digi  port to  baud, parity,  data,  and
  2169.                         stop bits.
  2170.  
  2171.                         DsetUp(base, port, channel, baud, parity
  2172.                                data, stop)
  2173.  
  2174.                         USHORT base       Memory Window
  2175.                         USHORT port       I/O Port
  2176.                         SHORT channel     Channel Number (port)
  2177.                         LONG baud         BPS rate
  2178.                         SHORT parity      0 = None, 1 = Odd, 2 = Even
  2179.                         SHORT data        6, 7, or 8 data bits
  2180.                         SHORT stop        1 or 2 stop bits
  2181.  
  2182.           Type          Function - Returns SHORT
  2183.  
  2184.           Description   When  using   a  Communications  Interface  set  to
  2185.                         DigiBoard, this  function initializes the specified
  2186.                         port (Channel)  on  the  DigiBoard.  The  DigiBoard
  2187.                         Interface is  a direct  link to  the  DigiBoard  (a
  2188.                         Device Driver  is not needed). In order to use this
  2189.                         interface, the  end user  must have already run the
  2190.                         DigiBoard Reset program called RESETDIG.EXE.
  2191.  
  2192.                         The base  address is  the high  memory address  the
  2193.                         DigiBoard uses  when communicating  with  the  host
  2194.                         computer.
  2195.  
  2196.                         Valid base addresses are:
  2197.  
  2198.                           C000          D000
  2199.                           C800          D800
  2200.  
  2201.  
  2202.                         The port  is the I/O port the DigiBoard is attached
  2203.                         to.
  2204.  
  2205.                         Valid ports are:
  2206.  
  2207.                           100           220
  2208.                           110           300
  2209.                           120           320
  2210.                           200
  2211.  
  2212.  
  2213.  
  2214.  
  2215.  
  2216.                                        Page 39
  2217.  
  2218.  
  2219.  
  2220.           GAP Communications                                         CLACOM
  2221.  
  2222.  
  2223.                         The channel  is the  Communications Port  to use on
  2224.                         the DigiBoard. This should be 0 - 15.
  2225.  
  2226.                         Note that  base and port are USHORTS. Because it is
  2227.                         difficult to  gather input  from an  end user  such
  2228.                         that the  result is  a  valid  hexadecimal  number,
  2229.                         these two  fields are  generally stored as strings.
  2230.                         You can  use  the  function  StrHex  to  convert  a
  2231.                         Hexadecimal String to an unsigned short.
  2232.  
  2233.           Return Value  0 = Successful.
  2234.                         1 = DigiBoard not Installed or RESETDIG.EXE
  2235.                             not run.
  2236.                         2 = DigiBoard not Responding.
  2237.                         3 = Invalid Parameter passed.
  2238.                         4 = DigiBoard EPROM is too old.
  2239.  
  2240.           Example
  2241.  
  2242.              ! set up 1st port on DigiBoard (Channel = 1)
  2243.              ! DigiBoard Memory Address = D800
  2244.              ! DigiBoard I/O Port = 320
  2245.  
  2246.              digiseg   USHORT
  2247.              digiport  USHORT
  2248.              cstr      CSTRING(12)
  2249.  
  2250.              cstr = 'D800'                        ! Base Address
  2251.              digiseg = StrHex(cstr)               ! as a number
  2252.              cstr = '320'                         ! I/O Port
  2253.              digiport = StrHex(cstr)              ! as a number
  2254.  
  2255.              if DsetUp(digiseg,digiport,1,38400,0,8,1)
  2256.                ShowError('Unable To Initialize DigiBoard')
  2257.              end
  2258.  
  2259.  
  2260.  
  2261.  
  2262.  
  2263.  
  2264.  
  2265.  
  2266.  
  2267.  
  2268.  
  2269.  
  2270.  
  2271.  
  2272.  
  2273.  
  2274.                                        Page 40
  2275.  
  2276.  
  2277.  
  2278.           GAP Communications                                         CLACOM
  2279.  
  2280.  
  2281.           Dtr
  2282.           -----------------------------------------------------------------
  2283.  
  2284.           Purpose       Toggle the DTR line on or off.
  2285.  
  2286.                         Dtr(port,how)
  2287.  
  2288.                         SHORT port                COM Port Number
  2289.                         SHORT how                 0 = Turn DTR off
  2290.                                                   1 = Turn DTR on
  2291.  
  2292.           Type          Procedure
  2293.  
  2294.           Description   This routine  is used  to turn  the DTR line of the
  2295.                         communications port  on or  off.  Turning  DTR  off
  2296.                         while there  is a  carrier will  cause the modem to
  2297.                         drop carrier.  In order  to send  commands  to  the
  2298.                         modem, DTR needs to be on.
  2299.  
  2300.           Return Value  None.
  2301.  
  2302.           Example
  2303.  
  2304.              cstr    CSTRING(10)
  2305.  
  2306.              cstr = 'ATZ' & '<13>'        ! Modem Init String
  2307.  
  2308.              Dtr(0,1)                     ! turn DTR on,wake up modem
  2309.              ComPuts(0,cstr)              ! reset the modem
  2310.  
  2311.  
  2312.  
  2313.  
  2314.  
  2315.  
  2316.  
  2317.  
  2318.  
  2319.  
  2320.  
  2321.  
  2322.  
  2323.  
  2324.  
  2325.  
  2326.  
  2327.  
  2328.  
  2329.  
  2330.  
  2331.  
  2332.                                        Page 41
  2333.  
  2334.  
  2335.  
  2336.           GAP Communications                                         CLACOM
  2337.  
  2338.  
  2339.           GetKeyc
  2340.           -----------------------------------------------------------------
  2341.  
  2342.           Purpose       Gets keyboard character and scan code.
  2343.  
  2344.                         GetKeyc()
  2345.  
  2346.           Type          Function - Returns SHORT
  2347.  
  2348.           Description   This is the main keyboard input routine. It returns
  2349.                         the keyboard  character or if the key struck was an
  2350.                         extended key,  it will  return a unique code. These
  2351.                         codes are  described in  Appendix A.  This function
  2352.                         should be  used when  designing terminal  emulation
  2353.                         software, BBS  software or  any software  where you
  2354.                         will be  checking the  local keyboard  and the  Com
  2355.                         Port for  key presses.  Clarion's ASK  and  KEYCODE
  2356.                         functions cannot  be  used  since  Clarion  re-maps
  2357.                         extended keys  and some control keys. Any character
  2358.                         in the ASCII range of 0 to 255 is a valid character
  2359.                         and can  be sent  out the Com Port, however Clarion
  2360.                         re-maps some  of  these  characters  and  does  not
  2361.                         return their true byte value.
  2362.  
  2363.                         If the  return value  is greater than 255, then the
  2364.                         key that  was pressed is an Extended Key (i.e., F1,
  2365.                         Up-Arrow,  PgUp,   Home,  etc).  The  Extended  Key
  2366.                         corresponds to  the Keyboard  Scan codes  with  the
  2367.                         value 256 added.
  2368.  
  2369.           Return Value  ASCII code for the key pressed or a unique code for
  2370.                         extended keys.
  2371.  
  2372.           Example
  2373.  
  2374.              retchr  SHORT
  2375.  
  2376.              retchr = GetKeyc()                   ! get a keyboard char
  2377.  
  2378.              if retchr > 255                      ! Extended Key
  2379.                case retchr                        ! which one
  2380.                  of 278  ! Alt-U, Upload a File
  2381.                  of 288  ! Alt-D, Download a File
  2382.                  of 369  ! Alt-F10, activate Menu
  2383.                end
  2384.              end
  2385.  
  2386.  
  2387.  
  2388.  
  2389.  
  2390.                                        Page 42
  2391.  
  2392.  
  2393.  
  2394.           GAP Communications                                         CLACOM
  2395.  
  2396.  
  2397.           GetScrn
  2398.           -----------------------------------------------------------------
  2399.  
  2400.           Purpose       Copies Physical Screen to Clarion Screen Buffer.
  2401.  
  2402.                         GetScrn()
  2403.  
  2404.           Type          Procedure
  2405.  
  2406.           Description   Clarion keeps  a backup copy of the physical screen
  2407.                         in a  buffer. Whenever  you send  something to  the
  2408.                         screen by  either opening a Window, a Menu, or what
  2409.                         have  you,  Clarion  performs  two  operations:  it
  2410.                         updates the physical screen and its screen buffer.
  2411.  
  2412.                         The screen  output routines  in CLACOM  (Gputc  and
  2413.                         Gputs)  write   directly  to  the  physical  screen
  2414.                         memory. Clarion,  therefore, doesn't  know that the
  2415.                         screen has  been written to. When you open a Window
  2416.                         or a  Menu, Clarion  will re-draw  the screen  with
  2417.                         whatever happens  to be  in its  Screen Buffer  and
  2418.                         then open  your Window.  What Clarion  puts on  the
  2419.                         screen will not necessarily be what you see on your
  2420.                         physical screen.  Clarion only  knows about what it
  2421.                         wrote to  the physical  screen.  It  knows  nothing
  2422.                         about what  an outside  function might  have put on
  2423.                         the screen.
  2424.  
  2425.                         If you  are using  the CLACOM  routines to write to
  2426.                         the screen  and you  need to open a Clarion Window,
  2427.                         activate a  Menu, or  otherwise write  to the local
  2428.                         screen using  a Clarion  function, you need to call
  2429.                         GetScrn before  making your  Clarion call.  GetScrn
  2430.                         will copy  the contents  of the  Physical Screen to
  2431.                         the  Clarion   Screen  Buffer.  This  will  prevent
  2432.                         Clarion from  overwriting the  physical screen with
  2433.                         data that no longer belongs there.
  2434.  
  2435.           Return Value  None.
  2436.  
  2437.  
  2438.  
  2439.  
  2440.  
  2441.  
  2442.  
  2443.  
  2444.  
  2445.  
  2446.  
  2447.  
  2448.                                        Page 43
  2449.  
  2450.  
  2451.  
  2452.           GAP Communications                                         CLACOM
  2453.  
  2454.  
  2455.           Example
  2456.  
  2457.              keychr  BYTE
  2458.              retchr  SHORT
  2459.  
  2460.              retchr = GetKeyc()                   ! Keyboard hit?
  2461.  
  2462.              if retchr = -1                       ! nothing there
  2463.                goto getrmt                        ! check remote
  2464.              end
  2465.  
  2466.              keychr = retchr                      ! strip high byte if set
  2467.  
  2468.              if retchr < 256                      ! if not a scan code
  2469.                ComPutc(0,keychr)                  ! send to com port
  2470.                goto getrmt                        ! and check remote
  2471.              end
  2472.  
  2473.              ! Keyboard key was an Extended key. Check if special key
  2474.  
  2475.              ! First though, it is likely that we will be doing something
  2476.              ! that will use Clarion to write to the Screen (open Window,
  2477.              ! Menu, etc). If so, we have to read the physical screen and
  2478.              ! update Clarion's Screen Buffer. This is because Clarion
  2479.              ! doesn't know that our ANSI driver has been writing to the
  2480.              ! screen. If we don't do this, Clarion will erase whatever is
  2481.              ! on the screen right now.
  2482.  
  2483.              GetScrn()                    ! update Clarion Screen Buffer
  2484.  
  2485.  
  2486.  
  2487.  
  2488.  
  2489.  
  2490.  
  2491.  
  2492.  
  2493.  
  2494.  
  2495.  
  2496.  
  2497.  
  2498.  
  2499.  
  2500.  
  2501.  
  2502.  
  2503.  
  2504.  
  2505.  
  2506.                                        Page 44
  2507.  
  2508.  
  2509.  
  2510.           GAP Communications                                         CLACOM
  2511.  
  2512.  
  2513.              ! Note that we already know the key is an extended key so we
  2514.              ! are only checking the low byte of the key (same as
  2515.              ! subtracting 256 from the return value).
  2516.  
  2517.              case keychr                  ! get special keys
  2518.                of 22                      ! Alt-U, Upload A File
  2519.                  if online = 0            ! if no carrier, you can't upload
  2520.  
  2521.                    ! This is one reason for GetScrn. Remove the call to
  2522.                    ! GetScrn and watch what happens when following window
  2523.                    ! is opened.
  2524.  
  2525.                    Open(NotOnLine)        ! Tell um can't upload
  2526.                    bell()                 ! Make noise
  2527.                    Beep(0,300)            ! Wait 3 seconds
  2528.                    Close(NotOnLine)       ! Close Can't Upload Screen
  2529.                  else                     ! otherwise, upload away
  2530.                    UpFile
  2531.                  end
  2532.              end
  2533.  
  2534.  
  2535.  
  2536.  
  2537.  
  2538.  
  2539.  
  2540.  
  2541.  
  2542.  
  2543.  
  2544.  
  2545.  
  2546.  
  2547.  
  2548.  
  2549.  
  2550.  
  2551.  
  2552.  
  2553.  
  2554.  
  2555.  
  2556.  
  2557.  
  2558.  
  2559.  
  2560.  
  2561.  
  2562.  
  2563.  
  2564.                                        Page 45
  2565.  
  2566.  
  2567.  
  2568.           GAP Communications                                         CLACOM
  2569.  
  2570.  
  2571.           GetZmodem
  2572.           -----------------------------------------------------------------
  2573.  
  2574.           Purpose       Receives 1 or more files using the Zmodem Protocol.
  2575.  
  2576.                         GetZmodem(port)
  2577.  
  2578.                         SHORT port                COM Port Number
  2579.  
  2580.           Type          Procedure
  2581.  
  2582.           Description   This function  allows you  to receive  one or  more
  2583.                         files using  Zmodem. The  files will  be placed  in
  2584.                         whatever directory  the program happens to be in at
  2585.                         the time  of the  call. You may want to use SETPATH
  2586.                         to change into a work directory prior to the call.
  2587.  
  2588.           Return Value  None.
  2589.  
  2590.           Example       GetZmodem(0)              ! Receive using Zmodem
  2591.  
  2592.  
  2593.  
  2594.  
  2595.  
  2596.  
  2597.  
  2598.  
  2599.  
  2600.  
  2601.  
  2602.  
  2603.  
  2604.  
  2605.  
  2606.  
  2607.  
  2608.  
  2609.  
  2610.  
  2611.  
  2612.  
  2613.  
  2614.  
  2615.  
  2616.  
  2617.  
  2618.  
  2619.  
  2620.  
  2621.  
  2622.                                        Page 46
  2623.  
  2624.  
  2625.  
  2626.           GAP Communications                                         CLACOM
  2627.  
  2628.  
  2629.           Gputc
  2630.           -----------------------------------------------------------------
  2631.  
  2632.           Purpose       Sends a single character to local screen.
  2633.  
  2634.                         Gputc(ch)
  2635.  
  2636.                         BYTE ch                   Character to send
  2637.  
  2638.           Type          Procedure
  2639.  
  2640.           Description   This is one of the main output routines. It is part
  2641.                         of the ANSI driver. It will send a single character
  2642.                         to the local screen.
  2643.  
  2644.           Return Value  None.
  2645.  
  2646.           Example       Gputc(12)                 ! Clear the Screen
  2647.  
  2648.              retchr  SHORT
  2649.              keychr  BYTE
  2650.  
  2651.              retchr = GetKeyc()                   ! Keyboard hit?
  2652.  
  2653.              if retchr NOT= -1                    ! if something there
  2654.                keychr = retchr                    ! truncate high byte
  2655.                Gputc(keychr)                      ! and display it
  2656.              end
  2657.  
  2658.  
  2659.  
  2660.  
  2661.  
  2662.  
  2663.  
  2664.  
  2665.  
  2666.  
  2667.  
  2668.  
  2669.  
  2670.  
  2671.  
  2672.  
  2673.  
  2674.  
  2675.  
  2676.  
  2677.  
  2678.  
  2679.  
  2680.                                        Page 47
  2681.  
  2682.  
  2683.  
  2684.           GAP Communications                                         CLACOM
  2685.  
  2686.  
  2687.           Gputs
  2688.           -----------------------------------------------------------------
  2689.  
  2690.           Purpose       Sends a string of characters to local screen.
  2691.  
  2692.                         Gputs(str)
  2693.  
  2694.                         CSTRING str               String to send
  2695.  
  2696.           Type          Procedure
  2697.  
  2698.           Description   This is one of the main output routines and is part
  2699.                         of the  ANSI driver.  It  will  send  a  string  of
  2700.                         characters to the local screen.
  2701.  
  2702.           Return Value  None.
  2703.  
  2704.           Example
  2705.  
  2706.              cstr  CSTRING(100)
  2707.  
  2708.              cstr = 'This is a string of characters'
  2709.  
  2710.              Gputs(cstr)                          ! Display locally
  2711.              ComPuts(0,cstr)                      ! and to remote
  2712.  
  2713.              ! this example embeds the CR/LF pair at the beginning
  2714.              ! and end of the string
  2715.  
  2716.              cstr = '<13,10>' & 'This is a string of characters' &
  2717.           '<13,10>'
  2718.  
  2719.              Gputs(cstr)                          ! Display locally
  2720.  
  2721.  
  2722.  
  2723.  
  2724.  
  2725.  
  2726.  
  2727.  
  2728.  
  2729.  
  2730.  
  2731.  
  2732.  
  2733.  
  2734.  
  2735.  
  2736.  
  2737.  
  2738.                                        Page 48
  2739.  
  2740.  
  2741.  
  2742.           GAP Communications                                         CLACOM
  2743.  
  2744.  
  2745.           InitAnsi
  2746.           -----------------------------------------------------------------
  2747.  
  2748.           Purpose       Initialize ANSI driver.
  2749.  
  2750.                         InitAnsi(port,row,col,color)
  2751.  
  2752.                         SHORT port        COM Port Number
  2753.                         BYTE row          Number of Rows on Screen
  2754.                         BYTE col          Number of Columns on Screen
  2755.                         BYTE color        Default Color to use
  2756.  
  2757.           Type          Procedure
  2758.  
  2759.           Description   This function  sets up  the ANSI  driver so that it
  2760.                         knows the maximum number of Rows and Columns on the
  2761.                         Screen and the default color to use when displaying
  2762.                         characters. This  function must  be called prior to
  2763.                         using the  output routines  Gputc and  Gputs. Since
  2764.                         the ANSI driver writes directly to Video Memory, it
  2765.                         is imperative  that this function be called so that
  2766.                         it can  set internal  variables that tells it where
  2767.                         the cursor  is, the  color attribute  to  use  when
  2768.                         displaying characters  and the  Segment address  of
  2769.                         Video Memory.
  2770.  
  2771.                         You should call this function anytime the Screen is
  2772.                         changed in size (i.e., from 25 to 43 line mode).
  2773.  
  2774.                         The ANSI  driver always  protects the bottom row of
  2775.                         the screen.  In other words, it will not allow text
  2776.                         to be  written there  using Gputc  or Gputs. If you
  2777.                         need to  write to  the bottom  screen row,  use the
  2778.                         Clarion SHOW function.
  2779.  
  2780.                         The color parameter is a standard IBM color code in
  2781.                         the  range  of  0  to  255.  The  Color  codes  are
  2782.                         described in  the Clarion Language Reference Manual
  2783.                         in the Video and Keyboard Chapter.
  2784.  
  2785.                         You must  pass the  COM port  number that  the ANSI
  2786.                         driver will  be associated  with. The  ANSI  Cursor
  2787.                         Position Report (CPR) is issued whenever the driver
  2788.                         receives a  Device Status Report (DSR) command. The
  2789.                         CPR sequence  is sent out the COM port. Since there
  2790.                         is only  one screen and one ANSI driver, the driver
  2791.                         must know  which port to use. The DSR/CPR sequences
  2792.  
  2793.  
  2794.  
  2795.  
  2796.                                        Page 49
  2797.  
  2798.  
  2799.  
  2800.           GAP Communications                                         CLACOM
  2801.  
  2802.  
  2803.                         are  generally   only  used   by  BBS  programs  to
  2804.                         determine if the caller has ANSI capability.
  2805.  
  2806.           Return Value  None.
  2807.  
  2808.           Example
  2809.  
  2810.              MaxRows  SHORT
  2811.              MaxCols  SHORT
  2812.  
  2813.              MaxRows = ROWS()                  ! Get Max Number of Rows
  2814.              MaxCols = COLS()                  ! Get Max Number of Columns
  2815.  
  2816.              SetCursor(1,1)                    ! Cursor to top of screen
  2817.              InitAnsi(0,MaxRows,MaxCols,14)    ! Initialize ANSI driver
  2818.  
  2819.  
  2820.  
  2821.  
  2822.  
  2823.  
  2824.  
  2825.  
  2826.  
  2827.  
  2828.  
  2829.  
  2830.  
  2831.  
  2832.  
  2833.  
  2834.  
  2835.  
  2836.  
  2837.  
  2838.  
  2839.  
  2840.  
  2841.  
  2842.  
  2843.  
  2844.  
  2845.  
  2846.  
  2847.  
  2848.  
  2849.  
  2850.  
  2851.  
  2852.  
  2853.  
  2854.                                        Page 50
  2855.  
  2856.  
  2857.  
  2858.           GAP Communications                                         CLACOM
  2859.  
  2860.  
  2861.           InitPort
  2862.           -----------------------------------------------------------------
  2863.  
  2864.           Purpose       Initialize port  to baud,  data, parity,  and  stop
  2865.                         bits.
  2866.  
  2867.                         InitPort(port,baud,parity,data,stop)
  2868.  
  2869.                         SHORT port        COM Port Number
  2870.                         LONG baud         BPS rate
  2871.                         SHORT parity      0 = None, 1 = Odd, 2 = Even
  2872.                         SHORT data        6, 7, or 8 data bits
  2873.                         SHORT stop        1 or 2 stop bits
  2874.  
  2875.           Type          Function - Returns SHORT
  2876.  
  2877.           Description   Sets the  communications port  to the  parity, data
  2878.                         bits, stop  bits, and baud rate. The port number is
  2879.                         defined when  initially setting  up the port with a
  2880.                         call to SetPort.
  2881.  
  2882.                         This  function   should  only   be  used  when  the
  2883.                         Communications Interface  is set to Standard. Don't
  2884.                         call when interfacing with a DigiBoard.
  2885.  
  2886.           Return Value  0 = Successful.
  2887.                         1 = Port Not Initialized.
  2888.                         2 = Invalid Parameter.
  2889.  
  2890.           Example
  2891.  
  2892.              if InitPort(0,38400,0,8,1)   ! Initialize to N,8,1 - 38400 bps
  2893.                ShowError('Unable To Initialize Port')
  2894.              end
  2895.  
  2896.  
  2897.  
  2898.  
  2899.  
  2900.  
  2901.  
  2902.  
  2903.  
  2904.  
  2905.  
  2906.  
  2907.  
  2908.  
  2909.  
  2910.  
  2911.  
  2912.                                        Page 51
  2913.  
  2914.  
  2915.  
  2916.           GAP Communications                                         CLACOM
  2917.  
  2918.  
  2919.           Int14Set
  2920.           -----------------------------------------------------------------
  2921.  
  2922.           Purpose       Initialize Digi  port to  baud, parity,  data,  and
  2923.                         stop bits.
  2924.  
  2925.                         DsetUp(channel,baud,parity,data,stop)
  2926.  
  2927.                         SHORT channel     Channel Number (port)
  2928.                         LONG baud         BPS rate
  2929.                         SHORT parity      0 = None, 1 = Odd, 2 = Even
  2930.                         SHORT data        6, 7, or 8 data bits
  2931.                         SHORT stop        1 or 2 stop bits
  2932.  
  2933.           Type          Function - Returns SHORT
  2934.  
  2935.           Description   When  using   a  Communications  Interface  set  to
  2936.                         Int14/EBIOS,   this    function   initializes   the
  2937.                         specified port  (Channel) on  the  DigiBoard.  This
  2938.                         interface requires  that  the  end  user  have  the
  2939.                         DigiBoard supplied  Universal DOS  Driver installed
  2940.                         as a TSR.
  2941.  
  2942.                         The channel  is the  Communications Port  to use on
  2943.                         the DigiBoard. This should be 4 - 19.
  2944.  
  2945.           Return Value  0 = Successful.
  2946.                         1 = Device Driver not installed or DigiBoard not
  2947.                             installed.
  2948.                         2 = EBIOS not configured.
  2949.                         3 = Invalid Parameter passed.
  2950.  
  2951.           Example
  2952.  
  2953.              ! set up 1st port on DigiBoard (Channel = 4)
  2954.  
  2955.              if Int14Set(4,38400,0,8,1)
  2956.                ShowError('Unable To Initialize DigiBoard')
  2957.              end
  2958.  
  2959.  
  2960.  
  2961.  
  2962.  
  2963.  
  2964.  
  2965.  
  2966.  
  2967.  
  2968.  
  2969.  
  2970.                                        Page 52
  2971.  
  2972.  
  2973.  
  2974.           GAP Communications                                         CLACOM
  2975.  
  2976.  
  2977.           Iscd
  2978.           -----------------------------------------------------------------
  2979.  
  2980.           Purpose       Check for Carrier on the Communications Port.
  2981.  
  2982.                         Iscd(port)
  2983.  
  2984.                         SHORT port                COM Port Number
  2985.  
  2986.           Type          Function - Returns SHORT
  2987.  
  2988.           Description   This function allows you to test the communications
  2989.                         port for a remote carrier signal.
  2990.  
  2991.           Return Value  Returns 0  if there is no carrier and 1 if there is
  2992.                         a carrier.
  2993.  
  2994.           Example
  2995.  
  2996.              if Iscd(0)                           ! is there a carrier?
  2997.                online = 1
  2998.                show(MaxRows,MaxCols - 7,' OnLine')
  2999.              else
  3000.                online = 0
  3001.                show(MaxRows,MaxCols - 7,'OffLine')
  3002.              end
  3003.  
  3004.  
  3005.  
  3006.  
  3007.  
  3008.  
  3009.  
  3010.  
  3011.  
  3012.  
  3013.  
  3014.  
  3015.  
  3016.  
  3017.  
  3018.  
  3019.  
  3020.  
  3021.  
  3022.  
  3023.  
  3024.  
  3025.  
  3026.  
  3027.  
  3028.                                        Page 53
  3029.  
  3030.  
  3031.  
  3032.           GAP Communications                                         CLACOM
  3033.  
  3034.  
  3035.           ModemPuts
  3036.           -----------------------------------------------------------------
  3037.  
  3038.           Purpose       Sends a Command String to a Modem.
  3039.  
  3040.                         ModemPuts(port,str)
  3041.  
  3042.                         SHORT port                COM Port Number
  3043.                         CSTRING str               String to send
  3044.  
  3045.           Type          Procedure
  3046.  
  3047.           Description   Will  send   a  string   of  characters   out   the
  3048.                         communications port.  This  function  is  generally
  3049.                         used to  send commands  to a modem. It is identical
  3050.                         to ComPuts  except that it interprets and acts upon
  3051.                         certain characters.
  3052.  
  3053.                         The special characters are:
  3054.  
  3055.                               ^M -  Send a Carriage Return
  3056.  
  3057.                               ~  -  Tilde. Pause for 1/2 second
  3058.  
  3059.                         Note that  the special  characters are  not sent to
  3060.                         the modem.  Also note  that in order for a modem to
  3061.                         accept commands,  the modem  must be "offline" (not
  3062.                         connected to  a remote modem) and DTR must be set :
  3063.                         Dtr(1).
  3064.  
  3065.           Return Value  None.
  3066.  
  3067.           Example
  3068.  
  3069.              cstr  CSTRING(100)
  3070.  
  3071.              cstr = 'ATZ^M~~'                     ! Modem Reset String
  3072.  
  3073.              ! The above string will send the Modem Reset String followed
  3074.              ! by a Carriage Return. It will wait 1 second after sending
  3075.              ! the string.
  3076.  
  3077.              ModemPuts(0,cstr)                    ! Send Modem Command
  3078.  
  3079.  
  3080.  
  3081.  
  3082.  
  3083.  
  3084.  
  3085.  
  3086.                                        Page 54
  3087.  
  3088.  
  3089.  
  3090.           GAP Communications                                         CLACOM
  3091.  
  3092.  
  3093.           ModemStat
  3094.           -----------------------------------------------------------------
  3095.  
  3096.           Purpose       Returns Status of the attached Modem.
  3097.  
  3098.                         ModemStat(port)
  3099.  
  3100.                         SHORT port                COM Port Number
  3101.  
  3102.           Type          Function - Returns BYTE
  3103.  
  3104.           Description   Returns the value of the Modem Status Register.
  3105.  
  3106.           Return Value  None.
  3107.  
  3108.           Example
  3109.  
  3110.              modstat BYTE
  3111.  
  3112.              modstat = ModemStat(0)               ! get Modem Status
  3113.  
  3114.              if BAND(Modstat,080h)                ! check for Carrier
  3115.                online = 1                         ! got one, set flag
  3116.              else
  3117.                online = 0                         ! no carrier, reset flag
  3118.              end
  3119.  
  3120.  
  3121.  
  3122.  
  3123.  
  3124.  
  3125.  
  3126.  
  3127.  
  3128.  
  3129.  
  3130.  
  3131.  
  3132.  
  3133.  
  3134.  
  3135.  
  3136.  
  3137.  
  3138.  
  3139.  
  3140.  
  3141.  
  3142.  
  3143.  
  3144.                                        Page 55
  3145.  
  3146.  
  3147.  
  3148.           GAP Communications                                         CLACOM
  3149.  
  3150.  
  3151.           PosCursor
  3152.           -----------------------------------------------------------------
  3153.  
  3154.           Purpose       Restore ANSI Driver Cursor Position.
  3155.  
  3156.                         PosCursor()
  3157.  
  3158.           Type          Procedure
  3159.  
  3160.           Description   When opening  a window and then closing it, Clarion
  3161.                         does not  put the cursor back where it was prior to
  3162.                         opening the window. This doesn't cause any problems
  3163.                         because the  ANSI driver maintains its own internal
  3164.                         cursor position.  However, the  screen will  look a
  3165.                         bit strange  if the  cursor  is  "hanging"  in  the
  3166.                         middle of  the screen  when it  should be on row 2,
  3167.                         column 10.
  3168.  
  3169.           Return Value  None.
  3170.  
  3171.           Example       PosCursor()       ! Put Cursor back where it was
  3172.  
  3173.  
  3174.  
  3175.  
  3176.  
  3177.  
  3178.  
  3179.  
  3180.  
  3181.  
  3182.  
  3183.  
  3184.  
  3185.  
  3186.  
  3187.  
  3188.  
  3189.  
  3190.  
  3191.  
  3192.  
  3193.  
  3194.  
  3195.  
  3196.  
  3197.  
  3198.  
  3199.  
  3200.  
  3201.  
  3202.                                        Page 56
  3203.  
  3204.  
  3205.  
  3206.           GAP Communications                                         CLACOM
  3207.  
  3208.  
  3209.           ResetPort
  3210.           -----------------------------------------------------------------
  3211.  
  3212.           Purpose       Restores the Communications port.
  3213.  
  3214.                         ResetPort(port)
  3215.  
  3216.                         SHORT port                COM Port Number
  3217.  
  3218.           Type          Procedure
  3219.  
  3220.           Description   This function  must be  called prior to exiting the
  3221.                         program or  anytime you  are finished  with the Com
  3222.                         Port. It  restores the interrupt vector used by the
  3223.                         Standard Communications routines.
  3224.  
  3225.                         It is  imperative  that  when  using  the  Standard
  3226.                         Interface you call this function when you no longer
  3227.                         wish  to  access  the  Serial  Port.  The  Standard
  3228.                         Interface sets  up an interrupt vector for the port
  3229.                         and if this vector is not restored prior to exiting
  3230.                         your program, the computer will ultimately crash.
  3231.  
  3232.                         This  function   should  only   be  used  when  the
  3233.                         Communications Interface  is set to Standard. Don't
  3234.                         call when interfacing with a DigiBoard.
  3235.  
  3236.           Return Value  None.
  3237.  
  3238.           Example       ResetPort(0)              ! Reset COM 1
  3239.  
  3240.  
  3241.  
  3242.  
  3243.  
  3244.  
  3245.  
  3246.  
  3247.  
  3248.  
  3249.  
  3250.  
  3251.  
  3252.  
  3253.  
  3254.  
  3255.  
  3256.  
  3257.  
  3258.  
  3259.  
  3260.                                        Page 57
  3261.  
  3262.  
  3263.  
  3264.           GAP Communications                                         CLACOM
  3265.  
  3266.  
  3267.           RestCbreak
  3268.           -----------------------------------------------------------------
  3269.  
  3270.           Purpose       Restores the Ctrl-Break vector.
  3271.  
  3272.                         RestCbreak()
  3273.  
  3274.           Type          Procedure
  3275.  
  3276.           Description   This function  must be  called prior to exiting the
  3277.                         program. It  restores the  interrupt vector used by
  3278.                         the Ctrl-Break  routine. If you set up a Ctrl-Break
  3279.                         handler at  the  beginning  of  your  program,  you
  3280.                         should  call   this  function   from   a   SHUTDOWN
  3281.                         procedure. Setting  up a SHUTDOWN procedure insures
  3282.                         that the  Ctrl-Break vector  is restored  prior  to
  3283.                         program termination.
  3284.  
  3285.           Return Value  None.
  3286.  
  3287.           Example       RestCbreak()      ! restore Ctrl-Break vector
  3288.  
  3289.  
  3290.  
  3291.  
  3292.  
  3293.  
  3294.  
  3295.  
  3296.  
  3297.  
  3298.  
  3299.  
  3300.  
  3301.  
  3302.  
  3303.  
  3304.  
  3305.  
  3306.  
  3307.  
  3308.  
  3309.  
  3310.  
  3311.  
  3312.  
  3313.  
  3314.  
  3315.  
  3316.  
  3317.  
  3318.                                        Page 58
  3319.  
  3320.  
  3321.  
  3322.           GAP Communications                                         CLACOM
  3323.  
  3324.  
  3325.           Rts
  3326.           -----------------------------------------------------------------
  3327.  
  3328.           Purpose       Toggle the RTS line on or off.
  3329.  
  3330.                         Rts(port,how)
  3331.  
  3332.                         SHORT port                COM Port Number
  3333.                         SHORT how                 0 = Turn RTS off
  3334.                                                   1 = Turn RTS on
  3335.  
  3336.           Type          Procedure
  3337.  
  3338.           Description   This routine  is used  to turn  the Request To Send
  3339.                         line of  the communications port on or off. Turning
  3340.                         RTS off  (providing  the  modem  supports  hardware
  3341.                         handshaking) tells  the modem  to stop sending data
  3342.                         to the  computer. It is typically toggled off while
  3343.                         writing a buffer of data to a disk.
  3344.  
  3345.           Return Value  None.
  3346.  
  3347.           Example       Rts(0,0)                  ! Turn RTS off
  3348.  
  3349.  
  3350.  
  3351.  
  3352.  
  3353.  
  3354.  
  3355.  
  3356.  
  3357.  
  3358.  
  3359.  
  3360.  
  3361.  
  3362.  
  3363.  
  3364.  
  3365.  
  3366.  
  3367.  
  3368.  
  3369.  
  3370.  
  3371.  
  3372.  
  3373.  
  3374.  
  3375.  
  3376.                                        Page 59
  3377.  
  3378.  
  3379.  
  3380.           GAP Communications                                         CLACOM
  3381.  
  3382.  
  3383.           Rxempty
  3384.           -----------------------------------------------------------------
  3385.  
  3386.           Purpose       To check if there are any characters in the receive
  3387.                         buffer.
  3388.  
  3389.                         Rxempty(port)
  3390.  
  3391.                         SHORT port                COM Port Number
  3392.  
  3393.           Type          Function - Returns SHORT
  3394.  
  3395.           Description   This function  checks  the  communications  receive
  3396.                         buffer to  see if  there are any characters waiting
  3397.                         to be read.
  3398.  
  3399.           Return Value  Returns 1  if buffer  is  empty,  0  if  there  are
  3400.                         characters waiting to be read.
  3401.  
  3402.           Example
  3403.  
  3404.              while Rxempty(0)             ! nothing happening
  3405.              end                          ! wait till something to read
  3406.  
  3407.  
  3408.  
  3409.  
  3410.  
  3411.  
  3412.  
  3413.  
  3414.  
  3415.  
  3416.  
  3417.  
  3418.  
  3419.  
  3420.  
  3421.  
  3422.  
  3423.  
  3424.  
  3425.  
  3426.  
  3427.  
  3428.  
  3429.  
  3430.  
  3431.  
  3432.  
  3433.  
  3434.                                        Page 60
  3435.  
  3436.  
  3437.  
  3438.           GAP Communications                                         CLACOM
  3439.  
  3440.  
  3441.           SendBreak
  3442.           -----------------------------------------------------------------
  3443.  
  3444.           Purpose       Sends a Break Signal to Modem.
  3445.  
  3446.                         SendBreak(port)
  3447.  
  3448.                         SHORT port                COM Port Number
  3449.  
  3450.           Type          Procedure
  3451.  
  3452.           Description   Will  send  a  Break  Signal  to  the  Modem.  This
  3453.                         function is  most often used with high speed modems
  3454.                         that have their own transmit buffer and you wish to
  3455.                         clear the buffer. These modems can be configured to
  3456.                         empty their buffer upon receipt of a break signal.
  3457.  
  3458.                         Note that  some modems  do not  react too well to a
  3459.                         break signal. Whether or not to send a break to the
  3460.                         modem so  that you  can clear  its transmit  buffer
  3461.                         should be a configuration option.
  3462.  
  3463.           Return Value  None.
  3464.  
  3465.           Example       SendBreak(0)              ! Send a Break to Modem
  3466.  
  3467.  
  3468.  
  3469.  
  3470.  
  3471.  
  3472.  
  3473.  
  3474.  
  3475.  
  3476.  
  3477.  
  3478.  
  3479.  
  3480.  
  3481.  
  3482.  
  3483.  
  3484.  
  3485.  
  3486.  
  3487.  
  3488.  
  3489.  
  3490.  
  3491.  
  3492.                                        Page 61
  3493.  
  3494.  
  3495.  
  3496.           GAP Communications                                         CLACOM
  3497.  
  3498.  
  3499.           SendZmodem
  3500.           -----------------------------------------------------------------
  3501.  
  3502.           Purpose       Sends one or more files using Zmodem.
  3503.  
  3504.                         SendZmodem(port,filename)
  3505.  
  3506.                         SHORT port                COM Port Number
  3507.                         CSTRING filename          Name of file to upload
  3508.  
  3509.           Type          Procedure
  3510.  
  3511.           Description   This function  allows you to send one or more files
  3512.                         to a remote computer using the Zmodem Protocol.
  3513.  
  3514.                         Filename is  a CSTRING  containing the  name of the
  3515.                         file  to   upload.  It  may  contain  a  Wild  Card
  3516.                         Specification to send more than one file at a time.
  3517.  
  3518.           Return Value  None.
  3519.  
  3520.           Example
  3521.  
  3522.              cstr  CSTRING(100)
  3523.  
  3524.              cstr = 'FILE.ZIP'                    ! send a single file
  3525.              SendZmodem(0,cstr)
  3526.  
  3527.              cstr = '*.ZIP'                       ! send all the ZIP files
  3528.              SendZmodem(0,cstr)
  3529.  
  3530.  
  3531.  
  3532.  
  3533.  
  3534.  
  3535.  
  3536.  
  3537.  
  3538.  
  3539.  
  3540.  
  3541.  
  3542.  
  3543.  
  3544.  
  3545.  
  3546.  
  3547.  
  3548.  
  3549.  
  3550.                                        Page 62
  3551.  
  3552.  
  3553.  
  3554.           GAP Communications                                         CLACOM
  3555.  
  3556.  
  3557.           SetCbreak
  3558.           -----------------------------------------------------------------
  3559.  
  3560.           Purpose       Initializes the Ctrl-Break vector.
  3561.  
  3562.                         SetCbreak()
  3563.  
  3564.           Type          Procedure
  3565.  
  3566.           Description   To trap Ctrl-C and Ctrl-Break, this function should
  3567.                         be called to set up an interrupt service routine to
  3568.                         trap these  two keys.  It is  imperative  that  the
  3569.                         program not  exit before calling RestCbreak so that
  3570.                         the interrupt vector can be restored.
  3571.  
  3572.                         When using the Standard Communications Interface, a
  3573.                         Ctrl-Break vector  must be  installed to  prevent a
  3574.                         user from  breaking  out  of  your  program  before
  3575.                         you've had  a chance  to restore the Communications
  3576.                         Interrupt vector.
  3577.  
  3578.           Return Value  None.
  3579.  
  3580.           Example       SetCbreak()               ! set up Ctrl-Break ISR
  3581.  
  3582.  
  3583.  
  3584.  
  3585.  
  3586.  
  3587.  
  3588.  
  3589.  
  3590.  
  3591.  
  3592.  
  3593.  
  3594.  
  3595.  
  3596.  
  3597.  
  3598.  
  3599.  
  3600.  
  3601.  
  3602.  
  3603.  
  3604.  
  3605.  
  3606.  
  3607.  
  3608.                                        Page 63
  3609.  
  3610.  
  3611.  
  3612.           GAP Communications                                         CLACOM
  3613.  
  3614.  
  3615.           SetPort
  3616.           -----------------------------------------------------------------
  3617.  
  3618.           Purpose       Initialize the Communications Port.
  3619.  
  3620.                         SetPort(irq,base,port)
  3621.  
  3622.                         SHORT irq                 Port IRQ to use
  3623.                         SHORT base                Port Base Address to use
  3624.                         SHORT port                Com Port Number
  3625.  
  3626.           Type          Function - Returns SHORT
  3627.  
  3628.           Description   This is  the port  initialization routine that must
  3629.                         be called  when using  the Standard  Interface.  It
  3630.                         must be called prior to any port I/O calls.
  3631.  
  3632.                         IRQ is  the Interrupt Request number to use for the
  3633.                         port. Base Address is the address where the port is
  3634.                         located. Port  is the COM port number, where COM1 =
  3635.                         0, COM2  = 1, COM3 = 2, and COM4 = 3. For COM 1 and
  3636.                         COM 2,  you may  simply pass  0 as the IRQ and Base
  3637.                         address since  the defaults for these ports will be
  3638.                         used.
  3639.  
  3640.                         Note that  the Communications  Routines always  use
  3641.                         hardware handshaking. This means that if CTS is not
  3642.                         active, the  output routines  will not  be able  to
  3643.                         send a  character  out  the  serial  port.  CTS  is
  3644.                         normally controlled  by a  Modem, however  when not
  3645.                         using a  modem, the  serial cable  must be wired so
  3646.                         that CTS  on one  end of  the connection is tied to
  3647.                         RTS on  the other end. See Appendix B for a diagram
  3648.                         of a NULL Modem cable.
  3649.  
  3650.           Return Value  0 = successful.
  3651.                         1 = No UART found at Port Address.
  3652.                         2 = Clear To Send (CTS) is not active.
  3653.  
  3654.           Example
  3655.  
  3656.              ! Set Up Port on COM1
  3657.  
  3658.              if SetPort(0,0,0)
  3659.                ShowError('Unable To Initialize Port')
  3660.              end
  3661.  
  3662.  
  3663.  
  3664.  
  3665.  
  3666.                                        Page 64
  3667.  
  3668.  
  3669.  
  3670.           GAP Communications                                         CLACOM
  3671.  
  3672.  
  3673.           StrHex
  3674.           -----------------------------------------------------------------
  3675.  
  3676.           Purpose       Converts a Hexadecimal string to an Unsigned Short.
  3677.  
  3678.                         StrHex(hexstring)
  3679.  
  3680.                         CSTRING hexstring String containing Hex digits
  3681.  
  3682.           Type          Function - Returns USHORT
  3683.  
  3684.           Description   This function  will  convert  a  string  containing
  3685.                         hexadecimal digits  and return  the value  of  that
  3686.                         string as  an unsigned short. It is most often used
  3687.                         to convert Memory Addresses stored as a string to a
  3688.                         number  that   can  be   utilized   by   the   port
  3689.                         initialization routines.
  3690.  
  3691.           Return Value  0 if  string could  not be  converted, number if it
  3692.                         could.
  3693.  
  3694.           Example
  3695.  
  3696.              cstr    CSTRING(100)
  3697.              hexnum  USHORT
  3698.  
  3699.              cstr = 'D800'                        ! Base Address
  3700.              hexnum = StrHex(cstr)                ! as a number
  3701.  
  3702.  
  3703.  
  3704.  
  3705.  
  3706.  
  3707.  
  3708.  
  3709.  
  3710.  
  3711.  
  3712.  
  3713.  
  3714.  
  3715.  
  3716.  
  3717.  
  3718.  
  3719.  
  3720.  
  3721.  
  3722.  
  3723.  
  3724.                                        Page 65
  3725.  
  3726.  
  3727.  
  3728.           GAP Communications                                         CLACOM
  3729.  
  3730.  
  3731.           StrWord
  3732.           -----------------------------------------------------------------
  3733.  
  3734.           Purpose       Check if one string contains another string.
  3735.  
  3736.                         StrWord(srcstring,substring)
  3737.  
  3738.                         CSTRING srcstring         String to search
  3739.                         CSTRING substring         String to search for
  3740.  
  3741.           Type          Function - Returns SHORT
  3742.  
  3743.           Description   Clarion's INSTRING  function doesn't work very well
  3744.                         with C  strings (in  fact, it doesn't work at all).
  3745.                         The terminating  NULL seems  to be included as part
  3746.                         of the search value.
  3747.  
  3748.                         StrWord will  search for  a string  to see if it is
  3749.                         contained within  another string. Both strings must
  3750.                         be of  type CSTRING.  If the larger string contains
  3751.                         the smaller  string, the  position  in  the  larger
  3752.                         string where  the smaller  string  begins  will  be
  3753.                         returned.
  3754.  
  3755.                         Note that  the strings  are compared without regard
  3756.                         to case.
  3757.  
  3758.           Return Value  0 if  substring not  found, otherwise  position  in
  3759.                         source string where the substring starts.
  3760.  
  3761.           Example
  3762.  
  3763.              srcstring CSTRING(100)
  3764.              substring CSTRING(10)
  3765.  
  3766.              scrstring = 'This is a string'
  3767.              substring = 'string'
  3768.  
  3769.              if StrWord(srcstring,substring)
  3770.                ! srcstring contains substring
  3771.              else
  3772.                ! substring not found
  3773.              end
  3774.  
  3775.  
  3776.  
  3777.  
  3778.  
  3779.  
  3780.  
  3781.  
  3782.                                        Page 66
  3783.  
  3784.  
  3785.  
  3786.           GAP Communications                                         CLACOM
  3787.  
  3788.  
  3789.           Timer
  3790.           -----------------------------------------------------------------
  3791.  
  3792.           Purpose       Pauses for the number of "ticks" specified.
  3793.  
  3794.                         Timer(ticks)
  3795.  
  3796.                         SHORT ticks       Number of timer ticks to pause
  3797.  
  3798.           Type          Procedure
  3799.  
  3800.           Description   This function  allows you  to pause  all processing
  3801.                         for the  specified  number  of  ticks.  It  is  in-
  3802.                         sensitive to processor speed.
  3803.  
  3804.                         The function  simply delays  the number  of "ticks"
  3805.                         indicated by  the passed  parameter. Each  tick  is
  3806.                         1/18 of a second (or 55 milliseconds).
  3807.  
  3808.           Return Value  None.
  3809.  
  3810.           Example       Timer(18)                 ! pause for 1 second
  3811.  
  3812.  
  3813.  
  3814.  
  3815.  
  3816.  
  3817.  
  3818.  
  3819.  
  3820.  
  3821.  
  3822.  
  3823.  
  3824.  
  3825.  
  3826.  
  3827.  
  3828.  
  3829.  
  3830.  
  3831.  
  3832.  
  3833.  
  3834.  
  3835.  
  3836.  
  3837.  
  3838.  
  3839.  
  3840.                                        Page 67
  3841.  
  3842.  
  3843.  
  3844.           GAP Communications                                         CLACOM
  3845.  
  3846.  
  3847.           UpLoad
  3848.           -----------------------------------------------------------------
  3849.  
  3850.           Purpose       Sends one or more files.
  3851.  
  3852.                         UpLoad(port,protocol,filename)
  3853.  
  3854.                         SHORT port                Com Port Number
  3855.                         SHORT protocol            Number of protocol to use
  3856.                         CSTRING filename          Name of file to upload
  3857.  
  3858.           Type          Procedure
  3859.  
  3860.           Description   This function allows you to send a file to a remote
  3861.                         computer. The protocols are defined as follows:
  3862.  
  3863.                               0 = ASCII           3 = 1K Xmodem-G
  3864.                               1 = Xmodem          4 = Ymodem
  3865.                               2 = 1K Xmodem       5 = Ymodem-G
  3866.  
  3867.  
  3868.                         Filename is  a CSTRING  containing the  name of the
  3869.                         file to upload. If the protocol is a batch protocol
  3870.                         (Ymodem or  Ymodem-G) then you may pass a Wild Card
  3871.                         Specification to send more than one file at a time.
  3872.  
  3873.           Return Value  None.
  3874.  
  3875.           Example
  3876.  
  3877.              cstr  CSTRING(100)
  3878.  
  3879.              cstr = 'FILE.ZIP'                    ! send a single file
  3880.              UpLoad(0,2,cstr)                     ! using 1K Xmodem
  3881.  
  3882.              cstr = '*.ZIP'                       ! send all the ZIP files
  3883.              UpLoad(0,4,cstr)                     ! using Ymodem
  3884.  
  3885.  
  3886.  
  3887.  
  3888.  
  3889.  
  3890.  
  3891.  
  3892.  
  3893.  
  3894.  
  3895.  
  3896.  
  3897.  
  3898.                                        Page 68
  3899.  
  3900.  
  3901.  
  3902.           GAP Communications                                         CLACOM
  3903.  
  3904.  
  3905.  
  3906.  
  3907.  
  3908.  
  3909.           Appendix A
  3910.  
  3911.  
  3912.           GetKeyc obtains  keyboard input  by making  calls to the Computer
  3913.           BIOS. The  BIOS translates keyboard scan codes into unique codes.
  3914.           Any code returned by GetKeyc that is less than or equal to 127 is
  3915.           a regular  ASCII character.  Codes in the range of 128 to 255 are
  3916.           IBM enhanced  ASCII characters.  These codes are returned "as is"
  3917.           (no translations are performed upon them).
  3918.  
  3919.           Key Codes  greater than 255 present a problem. These are extended
  3920.           keys and include the function keys, cursor keys, and the Ctrl and
  3921.           Alt key  combinations. The  BIOS returns  the scan  code of these
  3922.           keys. The  problem is  that the scan code can lie in the range of
  3923.           ASCII characters (0 through 255).
  3924.  
  3925.           In order to distinguish between a displayable ASCII character and
  3926.           an extended  key (F1,  Home, PgDn,  Alt-Equal, etc), GetKeyc adds
  3927.           256 to the key code returned by the BIOS.
  3928.  
  3929.           The following  tables show  the extended  key codes  as  well  as
  3930.           Control  Key   combinations  (which   are  used   extensively  in
  3931.           communications).
  3932.  
  3933.  
  3934.  
  3935.  
  3936.  
  3937.  
  3938.  
  3939.  
  3940.  
  3941.  
  3942.  
  3943.  
  3944.  
  3945.  
  3946.  
  3947.  
  3948.  
  3949.  
  3950.  
  3951.  
  3952.  
  3953.  
  3954.  
  3955.  
  3956.                                        Page 69
  3957.  
  3958.  
  3959.  
  3960.           GAP Communications                                         CLACOM
  3961.  
  3962.  
  3963.           Control Keys and Extended Keys in Numerical Order:
  3964.  
  3965.             Ctrl-A      1       Alt-S        287      Shift-F9          348
  3966.             Ctrl-B      2       Alt-D        288      Shift-F10         349
  3967.             Ctrl-C      3       Alt-F        289      Ctrl-F1           350
  3968.             Ctrl-D      4       Alt-G        290      Ctrl-F2           351
  3969.             Ctrl-E      5       Alt-H        291      Ctrl-F3           352
  3970.             Ctrl-F      6       Alt-J        292      Ctrl-F4           353
  3971.             Ctrl-G      7       Alt-K        293      Ctrl-F5           354
  3972.             Backspace   8       Alt-L        294      Ctrl-F6           355
  3973.             Ctrl-H      8       Alt-Z        300      Ctrl-F7           356
  3974.             Ctrl-I      9       Alt-X        301      Ctrl-F8           357
  3975.             Tab         9       Alt-C        302      Ctrl-F9           358
  3976.             Ctrl-J      10      Alt-V        303      Ctrl-F10          359
  3977.             LineFeed    10      Alt-B        304      Alt-F1            360
  3978.             Ctrl-K      11      Alt-N        305      Alt-F2            361
  3979.             Ctrl-L      12      Alt-M        306      Alt-F3            362
  3980.             Ctrl-M      13      F1           315      Alt-F4            363
  3981.             Enter       13      F2           316      Alt-F5            364
  3982.             Ctrl-N      14      F3           317      Alt-F6            365
  3983.             Ctrl-O      15      F4           318      Alt-F7            366
  3984.             Ctrl-P      16      F5           319      Alt-F8            367
  3985.             Ctrl-Q      17      F6           320      Alt-F9            368
  3986.             Ctrl-R      18      F7           321      Alt-F10           369
  3987.             Ctrl-S      19      F8           322      Ctrl-PrintScreen  370
  3988.             Ctrl-T      20      F9           323      Ctrl-CursorLeft   371
  3989.             Ctrl-U      21      F10          324      Ctrl-CursorRight  372
  3990.             Ctrl-V      22      Home         327      Ctrl-End          373
  3991.             Ctrl-W      23      CursorUp     328      Ctrl-PgDn         374
  3992.             Ctrl-X      24      PgUp         329      Ctrl-Home         375
  3993.             Ctrl-Y      25      CursorLeft   331      Alt-1             376
  3994.             Ctrl-Z      26      CursorRight  333      Alt-2             377
  3995.             Escape      27      End          335      Alt-3             378
  3996.             BackTab     271     CursorDown   336      Alt-4             379
  3997.             Alt-Q       272     PgDn         337      Alt-5             380
  3998.             Alt-W       273     Insert       338      Alt-6             381
  3999.             Alt-E       274     Delete       339      Alt-7             382
  4000.             Alt-R       275     Shift-F1     340      Alt-8             383
  4001.             Alt-T       276     Shift-F2     341      Alt-9             384
  4002.             Alt-Y       277     Shift-F3     342      Alt-0             385
  4003.             Alt-U       278     Shift-F4     343      Alt-Hyphen        386
  4004.             Alt-I       279     Shift-F5     344      Alt-Equal         387
  4005.             Alt-O       280     Shift-F6     345      Ctrl-PgUp         388
  4006.             Alt-P       281     Shift-F7     346                           
  4007.             Alt-A       286     Shift-F8     347                           
  4008.  
  4009.  
  4010.  
  4011.  
  4012.  
  4013.  
  4014.                                        Page 70
  4015.  
  4016.  
  4017.  
  4018.           GAP Communications                                         CLACOM
  4019.  
  4020.  
  4021.           Control Keys and Extended Keys in Alphabetical Order:
  4022.  
  4023.             Alt-0       385     Alt-V        303      Ctrl-T             20
  4024.             Alt-1       376     Alt-W        273      Ctrl-U             21
  4025.             Alt-2       377     Alt-X        301      Ctrl-V             22
  4026.             Alt-3       378     Alt-Y        277      Ctrl-W             23
  4027.             Alt-4       379     Alt-Z        300      Ctrl-X             24
  4028.             Alt-5       380     Backspace      8      Ctrl-Y             25
  4029.             Alt-6       381     BackTab      271      Ctrl-Z             26
  4030.             Alt-7       382     Ctrl-A         1      CursorDown        336
  4031.             Alt-8       383     Ctrl-B         2      CursorLeft        331
  4032.             Alt-9       384     Ctrl-C         3      CursorRight       333
  4033.             Alt-A       286     Ctrl-CLeft   371      CursorUp          328
  4034.             Alt-B       304     Ctrl-CRight  372      Delete            339
  4035.             Alt-C       302     Ctrl-D         4      End               335
  4036.             Alt-D       288     Ctrl-E         5      Enter              13
  4037.             Alt-E       274     Ctrl-End     373      Escape             27
  4038.             Alt-Equal   387     Ctrl-F         6      F1                315
  4039.             Alt-F       289     Ctrl-F1      350      F10               324
  4040.             Alt-F1      360     Ctrl-F10     359      F2                316
  4041.             Alt-F10     369     Ctrl-F2      351      F3                317
  4042.             Alt-F2      361     Ctrl-F3      352      F4                318
  4043.             Alt-F3      362     Ctrl-F4      353      F5                319
  4044.             Alt-F4      363     Ctrl-F5      354      F6                320
  4045.             Alt-F5      364     Ctrl-F6      355      F7                321
  4046.             Alt-F6      365     Ctrl-F7      356      F8                322
  4047.             Alt-F7      366     Ctrl-F8      357      F9                323
  4048.             Alt-F8      367     Ctrl-F9      358      Home              327
  4049.             Alt-F9      368     Ctrl-G         7      Insert            338
  4050.             Alt-G       290     Ctrl-H         8      LineFeed           10
  4051.             Alt-H       291     Ctrl-Home    375      PgDn              337
  4052.             Alt-Hyphen  386     Ctrl-I         9      PgUp              329
  4053.             Alt-I       279     Ctrl-J        10      Shift-F1          340
  4054.             Alt-J       292     Ctrl-K        11      Shift-F10         349
  4055.             Alt-K       293     Ctrl-L        12      Shift-F2          341
  4056.             Alt-L       294     Ctrl-M        13      Shift-F3          342
  4057.             Alt-M       306     Ctrl-N        14      Shift-F4          343
  4058.             Alt-N       305     Ctrl-O        15      Shift-F5          344
  4059.             Alt-O       280     Ctrl-P        16      Shift-F6          345
  4060.             Alt-P       281     Ctrl-PgDn    374      Shift-F7          346
  4061.             Alt-Q       272     Ctrl-PgUp    388      Shift-F8          347
  4062.             Alt-R       275     Ctrl-PrtScr  370      Shift-F9          348
  4063.             Alt-S       287     Ctrl-Q        17      Tab                 9
  4064.             Alt-T       276     Ctrl-R        18                           
  4065.             Alt-U       278     Ctrl-S        19                           
  4066.  
  4067.  
  4068.  
  4069.  
  4070.  
  4071.  
  4072.                                        Page 71
  4073.  
  4074.  
  4075.  
  4076.           GAP Communications                                         CLACOM
  4077.  
  4078.  
  4079.           Appendix B
  4080.  
  4081.  
  4082.           Most  of   the  Null   Modem  connectors   and  cables  that  are
  4083.           commercially   available    are   wired    incorrectly.    Sounds
  4084.           unbelievable,  but   true.  They   are  wired  using  yesterday's
  4085.           technology.
  4086.  
  4087.           Modern day  modems are  intelligent devices.  They are capable of
  4088.           telling the  Host Computer when to stop sending data and are able
  4089.           to determine  when the  computer needs  to have  data sent  to it
  4090.           temporarily suspended.  This concept  is known  as Hardware  Flow
  4091.           Control (CTS/RTS checking).
  4092.  
  4093.           CLACOM was  written  with  Hardware  Flow  Control  in  mind.  No
  4094.           characters will be sent to the communications port if the port is
  4095.           unable to  accept new  characters. This prevents loss of data and
  4096.           insures a reliable connection.
  4097.  
  4098.           Most NULL  Modems are  wired with the CTS/RTS lines either always
  4099.           off or always on.
  4100.  
  4101.           If you  are hardwiring  computers together  via a NULL Modem, you
  4102.           will  probably   have  to  change  some  of  the  wiring  on  the
  4103.           connectors. You  can either  make your own NULL Modem or purchase
  4104.           one. If  you purchase  one, be  sure  that  you  can  remove  the
  4105.           connector shields to gain access to the wiring.
  4106.  
  4107.           The following diagram shows a properly wired NULL Modem:
  4108.  
  4109.  
  4110.  
  4111.  
  4112.                   SCREEN NOT AVAILABLE IN TEXT BASED DOCUMENTATION
  4113.                                  SEE PRINTED MANUAL
  4114.  
  4115.  
  4116.  
  4117.  
  4118.  
  4119.  
  4120.  
  4121.  
  4122.  
  4123.  
  4124.  
  4125.  
  4126.  
  4127.  
  4128.  
  4129.  
  4130.                                        Page 72
  4131.  
  4132.  
  4133.  
  4134.           GAP Communications                                         CLACOM
  4135.  
  4136.  
  4137.  
  4138.  
  4139.           Index
  4140.  
  4141.  
  4142.           Ansi driver    5, 19, 20, 22, 24, 44, 47, 48, 56
  4143.             Initializing 14, 24, 49
  4144.           Asciidel  23
  4145.           ASK  42
  4146.           Base Address   10, 64
  4147.           Baud Rate 5, 36, 39, 51, 52, 64
  4148.           Channel   10, 11, 39, 40, 52
  4149.           Characters
  4150.             Sending to com port    17, 24, 31
  4151.             Sending to local screen     17, 24, 47
  4152.           CkeyPress 24, 26
  4153.           Clarion
  4154.             ASK     42
  4155.             Color   49
  4156.             CSTRING 25, 32, 37, 40, 41, 48, 54, 62, 65, 66, 68
  4157.             Cursor  56
  4158.             INSTRING     66
  4159.             KEYCODE 12, 42
  4160.             Overlays     8
  4161.             ROVERLAY.EXP 8
  4162.             Screen  56
  4163.             Screen Buffer     20, 43
  4164.             SHOW    49
  4165.             Strings 66
  4166.             TYPE    22
  4167.             Type Checking     25
  4168.           ClrBuf    24, 27
  4169.           Color     49
  4170.           ComGetc   19, 24, 28
  4171.           ComGetd   24, 29
  4172.           Communications
  4173.             Base address 14, 64
  4174.             Baud rates   5, 14, 64
  4175.             Carrier 53
  4176.             DigiBoard    9, 14, 51, 57
  4177.             FIFO buffers 5, 14
  4178.             Initializing 14, 36, 39, 51, 52, 64
  4179.             Input   28, 29, 60
  4180.             Interface    9, 51, 57
  4181.             Interrupt    8, 14, 57
  4182.             IRQ     64
  4183.             Output  30, 31, 32, 54
  4184.             Port    9, 64
  4185.  
  4186.  
  4187.  
  4188.                                        Page 73
  4189.  
  4190.  
  4191.  
  4192.           GAP Communications                                         CLACOM
  4193.  
  4194.  
  4195.           ComPutb   24, 30
  4196.           ComPutc   20, 24, 31
  4197.           Computs   20, 24, 32
  4198.           CSTRING   25, 32, 37, 40, 41, 48, 54, 62, 65, 66, 68
  4199.           Ctrl-Break handler  8, 58, 63
  4200.           CTS  64
  4201.           Cursor    24, 33, 56
  4202.           CursorOff 24, 33
  4203.           CursorOn  24, 33
  4204.           DclrTx    24, 34
  4205.           Delaying  67
  4206.           DgtTxfree 24, 35
  4207.           DigiBoard 9, 51, 57
  4208.             Channel 10, 11, 39, 40, 52
  4209.             Initializing Port 14, 36, 39, 52
  4210.             Resetting Modem   38
  4211.             Transmit Buffer   34
  4212.               Free Space 35
  4213.           Distribution files  6
  4214.           Dmodem    24, 36
  4215.           DownLoad  24, 37
  4216.           Downloading Files   11, 37, 46
  4217.           Drestore  24, 38
  4218.           DsetUp    14, 24, 36, 39
  4219.           Dtr  24, 41
  4220.           Files
  4221.             Downloading  11, 37, 46
  4222.             Uploading    11, 62, 68
  4223.           Functions
  4224.             CkeyPress    26
  4225.             ClrBuf  27
  4226.             ComGetc 19, 28
  4227.             ComGetd 29
  4228.             ComPutb 30
  4229.             ComPutc 20, 31
  4230.             ComPuts 20, 32
  4231.             CursorOff    33
  4232.             CursorOn     33
  4233.             DclrTx  34
  4234.             DgtTxfree    35
  4235.             Dmodem  36
  4236.             DownLoad     37
  4237.             Drestore     38
  4238.             DsetUp  14, 36, 39
  4239.             Dtr     41
  4240.             GetKeyc 12, 42, 69
  4241.             GetScrn 43
  4242.             GetZmodem    46
  4243.  
  4244.  
  4245.  
  4246.                                        Page 74
  4247.  
  4248.  
  4249.  
  4250.           GAP Communications                                         CLACOM
  4251.  
  4252.  
  4253.             Gputc   19, 43, 47, 49
  4254.             Gputs   19, 43, 48, 49
  4255.             InitAnsi     14, 49
  4256.             InitPort     14, 51
  4257.             INSTRING     66
  4258.             Int14Set     14, 36, 52
  4259.             Iscd    53
  4260.             ModemPuts    54
  4261.             ModemStat    55
  4262.             PosCursor    56
  4263.             ResetPort    57
  4264.             RestCbreak   58
  4265.             Rts     59
  4266.             Rxempty 60
  4267.             SendBreak    61
  4268.             SendZmodem   62
  4269.             SetCbreak    63
  4270.             SETPATH 46
  4271.             SetPort 14, 51, 64
  4272.             SHOW    49
  4273.             SHUTDOWN     58
  4274.             StrHex  40, 65
  4275.             StrWord 66
  4276.             Timer   67
  4277.             UpLoad  68
  4278.           GetKeyc   12, 24, 42, 69
  4279.           GetScrn   24, 43
  4280.           GetZmodem 24, 46
  4281.           Gputc     19, 24, 43, 47, 49
  4282.           Gputs     19, 24, 43, 48, 49
  4283.           Hardware Handshaking     64
  4284.           InitAnsi  14, 24, 49
  4285.           Initializing
  4286.             ANSI driver  49
  4287.             Interrupt handlers     64
  4288.           InitPort  14, 24, 51
  4289.           Input
  4290.             From com port     17, 24, 28, 29, 60
  4291.             From local & remote    17, 26
  4292.             From local keyboard    12, 17, 24, 42, 69
  4293.           INSTRING  66
  4294.           Int14Set  14, 24, 36, 52
  4295.           Interrupt handlers
  4296.             Communications    8, 14, 57
  4297.             Ctrl-Break   8, 58, 63
  4298.           IRQ  10, 64
  4299.           Iscd 24, 53
  4300.           Keyboard  12, 17, 26, 42, 69
  4301.  
  4302.  
  4303.  
  4304.                                        Page 75
  4305.  
  4306.  
  4307.  
  4308.           GAP Communications                                         CLACOM
  4309.  
  4310.  
  4311.             Clarion Key Codes 12, 42
  4312.           KEYCODE   12, 42
  4313.           Modem     38, 41, 51, 72
  4314.             Sending strings to     54
  4315.           ModemPuts 24, 54
  4316.           ModemStat 24, 55
  4317.           Noascmes  23
  4318.           Nocts     23
  4319.           NULL Modem     64, 72
  4320.           Output
  4321.             To com port  17, 24, 30, 31, 32
  4322.             To local screen   17, 24, 47, 48
  4323.             To modem     54
  4324.           Overlays  8
  4325.           Pausing   67
  4326.           Port 9, 14, 34, 35, 36, 38, 39, 41, 51, 64
  4327.           PosCursor 24, 56
  4328.           Program
  4329.             Crashing     8
  4330.           Protocols 5, 11, 21, 23, 37, 46, 68
  4331.             External     21, 23
  4332.           Receive buffer 24, 26, 27, 28, 29, 60, 64
  4333.           RESETDIG.EXE   9, 11, 39, 40
  4334.           ResetPort 24, 57
  4335.           RestCbreak     24, 58
  4336.           ROVERLAY.EXP   8
  4337.           Rts  24, 59, 64
  4338.           Rxempty   24, 60
  4339.           Scan codes     42
  4340.           Screen    24, 43, 47, 48, 49, 56
  4341.             Clearing     47
  4342.             Color   49
  4343.             Columns 49
  4344.             Cursor  33
  4345.             Output  17
  4346.             Rows    49
  4347.           Screen Buffer  20, 43
  4348.           SendBreak 24, 61
  4349.           SendZmodem     24, 62
  4350.           SetCbreak 24, 63
  4351.           SETPATH   46
  4352.           SetPort   14, 24, 51, 64
  4353.           SHOW 49
  4354.           SHUTDOWN  58
  4355.           Standard Interface  9, 14, 51, 57, 64
  4356.           StrHex    24, 40, 65
  4357.           Strings   66
  4358.             Hexadecimal  40
  4359.  
  4360.  
  4361.  
  4362.                                        Page 76
  4363.  
  4364.  
  4365.  
  4366.           GAP Communications                                         CLACOM
  4367.  
  4368.  
  4369.             INSTRING     66
  4370.             Sending to com port    24, 32, 54
  4371.             Sending to local screen     24, 48
  4372.             Sub string   66
  4373.           StrWord   24, 66
  4374.           Timer     24, 67
  4375.           Transmit Buffer     24, 34
  4376.             Free Space   35
  4377.           TYPE 22
  4378.           UpLoad    24, 68
  4379.           Uploading Files     11, 62, 68
  4380.           Video Memory   43
  4381.           Xmodem    5, 11, 24, 37, 68
  4382.           Ymodem    5, 11, 24, 37, 68
  4383.           Zmodem    5, 11, 46, 62
  4384.  
  4385.  
  4386.  
  4387.  
  4388.  
  4389.  
  4390.  
  4391.  
  4392.  
  4393.  
  4394.  
  4395.  
  4396.  
  4397.  
  4398.  
  4399.  
  4400.  
  4401.  
  4402.  
  4403.  
  4404.  
  4405.  
  4406.  
  4407.  
  4408.  
  4409.  
  4410.  
  4411.  
  4412.  
  4413.  
  4414.  
  4415.  
  4416.  
  4417.  
  4418.  
  4419.  
  4420.                                        Page 77