home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Programmierung / SOURCE.mdf / programm / windows / basic / lclb42 / lcl4b.doc < prev    next >
Encoding:
Text File  |  1994-08-16  |  82.9 KB  |  2,177 lines

  1.  
  2.  
  3.                             Lite (Personal) Communications Library
  4.  
  5.                                     For Visual Basic
  6.  
  7.  
  8.                                          (LCL4B)
  9.  
  10.  
  11.  
  12.                                       USERS MANUAL
  13.  
  14.  
  15.  
  16.  
  17.  
  18.                                        Version 4.2(1)
  19.  
  20.                                        Aug 16, 1994
  21.  
  22.  
  23.  
  24.  
  25.                              This software is provided as-is.
  26.                       There are no warranties, expressed or implied.
  27.  
  28.  
  29.  
  30.  
  31.                                    Copyright (C) 1994
  32.                                    All rights reserved
  33.  
  34.  
  35.  
  36.                                    MarshallSoft Computing, Inc.
  37.                                    Post Office Box 4543
  38.                                    Huntsville AL 35815
  39.  
  40.                                    Voice 205-881-4630
  41.                                    FAX   205|881|4630
  42.                                    BBS   205-880-9748
  43.  
  44.  
  45.                                        _______
  46.                                   ____|__     |                (R)
  47.                                --+       |    +-------------------
  48.                                  |   ____|__  |  Association of
  49.                                  |  |       |_|  Shareware
  50.                                  |__|   o   |    Professionals
  51.                                --+--+   |   +---------------------
  52.                                     |___|___|    MEMBER
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.              LCL4B Users Manual                                                Page 1
  69.                                    C O N T E N T S
  70.  
  71.  
  72.  
  73.  
  74.               Chapter                                                       Page
  75.  
  76.               1.0 Introduction................................................4
  77.                   1.1 User Support............................................5
  78.                   1.2 ASP Ombudsman...........................................5
  79.                   1.3 A Typical Application...................................6
  80.                   1.4 Installation............................................7
  81.               2.0 Library Organization........................................8
  82.                   2.1 Initialization & Termination............................8
  83.                   2.2 Modem Control & Status..................................8
  84.                   2.3 Serial I/O..............................................9
  85.                   2.4 Error Detection.........................................9
  86.                   2.5 General Support.........................................9
  87.               3.0 Talking to Your Modem......................................10
  88.                   3.1 ModemEcho..............................................10
  89.                   3.2 ModemSendTo............................................10
  90.                   3.3 ModemWaitFor...........................................10
  91.                   3.4 ModemQuiet.............................................10
  92.                   3.5 ModemCmdState..........................................10
  93.                   3.6 ModemHangup............................................10
  94.               4.0 Problems...................................................12
  95.               5.0 Serial Communications......................................13
  96.                   5.1 Standard Port Addresses................................12
  97.               6.0 Example Programs...........................................13
  98.                   6.1 MINIMAL.BAS............................................13
  99.                   6.2 SIMPLE.BAS.............................................13
  100.                   6.3 LOGIN.BAS..............................................13
  101.               7.0 Legal Issues...............................................14
  102.                   7.1 Registration...........................................14
  103.                   7.2 Upgrading to PCL4B.....................................14
  104.                   7.3 License................................................14
  105.                   7.4 Warranty...............................................15
  106.               8.0 Summary....................................................15
  107.                   8.1 Revision History.......................................15
  108.                   8.2 Function Summary.......................................16
  109.                   8.3 Error Code Summary.....................................16
  110.               9.0 Other MarshallSoft Computing products for Basic............17
  111.                   9.1 The Personal Communications Library for Basic..........17
  112.  
  113.  
  114.  
  115.                   ( CONTENTS continued next page )
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.              LCL4B Users Manual                                                Page 2
  137.                                C O N T E N T S (continued)
  138.  
  139.  
  140.               Chapter                                                      Page
  141.  
  142.  
  143.              10.0 Function Reference.........................................17
  144.                   SioBaud....................................................18
  145.                   SioBrkKey..................................................18
  146.                   SioBrkSig..................................................19
  147.                   SioCrtWrite................................................19
  148.                   SioCTS.....................................................20
  149.                   SioDCD.....................................................20
  150.                   SioDelay...................................................21
  151.                   SioDone....................................................21
  152.                   SioDSR.....................................................22
  153.                   SioDTR.....................................................22
  154.                   SioError...................................................23
  155.                   SioGetc....................................................23
  156.                   SioGetDiv..................................................24
  157.                   SioInfo....................................................24
  158.                   SioKeyPress................................................25
  159.                   SioKeyRead.................................................25
  160.                   SioLine....................................................26
  161.                   SioLoopBack................................................26
  162.                   SioModem...................................................27
  163.                   SioParms...................................................27
  164.                   SioPutc....................................................28
  165.                   SioRead....................................................28
  166.                   SioReset...................................................29
  167.                   SioRI......................................................29
  168.                   SioRTS.....................................................30
  169.                   SioRxBuf...................................................30
  170.                   SioRxFlush.................................................31
  171.                   SioRxQue...................................................31
  172.                   SioTimer...................................................32
  173.                   SioUnGetc..................................................32
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.              LCL4B Users Manual                                                Page 3
  205.               1.0 Introduction
  206.  
  207.  
  208.               The   Lite  (Personal)  Communications  Library  for  Basic  (LCL4B)  is  an
  209.               asynchronous communications library for software developers using  Microsoft
  210.               Visual Basic for DOS.
  211.  
  212.               o 30 communications & support functions.
  213.               o Interrupt driven receiver.
  214.               o Supports 300 baud to 115,200 baud.
  215.               o Supports COM1 through COM4.
  216.               o Adjustable queues from 8 bytes to 32 KB.
  217.               o Control-BREAK error exit.
  218.               o 18 communications error conditions trapped.
  219.               o Allows 2 ports to run concurrently.
  220.               o Complete modem control & status.
  221.               o Written in assembly language for small size & high speed.
  222.  
  223.  
  224.               Why should you buy LCL4B? Consider the following:
  225.  
  226.                  COMPLETE  -  LCL4B is complete since it provides absolute control of the
  227.                               serial ports (including the high performance INS16550).
  228.  
  229.                   COMPACT  -  LCL4B is very compact at less than 6 KB.  Your  application
  230.                               doesn't carry a lot of excess code.
  231.  
  232.                      FAST  -  LCL4B is fast.  It will run at 115200 baud on all 80386 and
  233.                               up machines.
  234.  
  235.                   SUPPORT   - If  you  get  stuck,   you will talk to the programmer that
  236.                               wrote the code, not a person hired to answer the phone.
  237.  
  238.                       BBS  -  A user support BBS is available (2400 to 9600 baud, N81) in
  239.                               order to provide immediate support as necessary.
  240.  
  241.                NEWSLETTER  -  One year  subscription  to  the  MSC  newsletter discussing
  242.                               communications problems and solutions (published quarterly).
  243.  
  244.                     PRICE  -  You get LCL4B for a very reasonable price !
  245.  
  246.                  UPGRADES  -  Once  you  purchase LCL4B, you can always update to the most
  247.                               recent version for a very reasonable cost.
  248.  
  249.                COMPATIBLE  -  LCL4B  is  call  for call compatible with the MSDOS based
  250.                               version PCL4C.
  251.  
  252.                UPGRADABLE  -  You can upgrade from the lite product LCL4B to the standard
  253.                               product PCL4B for $39.
  254.  
  255.               If you need more than 4 ports, wish to be able to configure UART addresses &
  256.               IRQs,  need  DigiBoard  or BOCA board support, need hardware flow control or
  257.               support for the 16550 UART, then you should register the  standard  product:
  258.               The  Personal  Communications Library for BASIC (PCL4B) rather than the lite
  259.               version (LCL4B). You can also register  the  lite  product  and  then  later
  260.               upgrade to the standard product. Refer to sections 7.1 & 7.2.
  261.  
  262.               Our  goal is to provide a robust serial communications library that that you
  263.               and your customers can depend upon.
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.              LCL4B Users Manual                                                Page 4
  273.               1.1 User Support
  274.  
  275.  
  276.               We want you to be successful in developing your applications using LCL4B! We
  277.               depend on our customers to let us know what they need  in  a  communications
  278.               library.   This  means we are committed to providing the best communications
  279.               library that we can. If you have any suggestions or comments, please let  us
  280.               know.
  281.  
  282.               If  you  are  having  a problem using LCL4B, call us at 205-881-4630 between
  283.               1:30 PM and 9:30 PM CST Monday through  Friday.  ,or  FAX  us  at  the  same
  284.               telephone  number  at any time (24 hours).  You can also call at other times
  285.               and leave a message, and call back later for a reply.  However, we can  only
  286.               answer  questions  with  respect to using the LCL4B library.  We cannot help
  287.               you program your application.
  288.  
  289.               You may also call our User Support BBS (2400 to 9600 baud, no parity, 8 data
  290.               bits, 1 stop bit) at 205-880-9748 and leave a message  (address  it  to  the
  291.               SYSOP).  We will usually have a reply ready for you within 24 hours.
  292.  
  293.               The  BBS  is  available  24  hours  per  day  except  at  2  PM  Sundays for
  294.               maintenanace. All files are in standard ZIP format. The BBS will contain the
  295.               latest shareware version of all MarshallSoft products  as  well  as  related
  296.               files such as:
  297.  
  298.                    BUGS.ZIP  ++  Bug report.
  299.                    NEWS.ZIP  ++  Latest news regarding our products.
  300.  
  301.               The MarshallSoft  Computing,  Inc.   newsletter  "Comm  Talk"  is  published
  302.               quarterly.  It discusses various communications problems and solutions using
  303.               LCL4B  as  well  as related information. Registered users receive a one year
  304.               complimentary subscription  when  first  registering  and  for  each  update
  305.               purchased.
  306.  
  307.               Of  course,  you can always write to us. You should receive a reply within a
  308.               week or so. Please don't mail hardware without first talking to us.
  309.  
  310.  
  311.               1.2 ASP Ombudsman
  312.  
  313.  
  314.               MarshallSoft  Computing,  Inc.   is a member of the Association of Shareware
  315.               Professionals (ASP).  ASP wants to make sure that  the  shareware  principle
  316.               works  for  you.   If  you are unable to resolve a shareware-related problem
  317.               with an ASP member by contacting the member directly, ASP  may  be  able  to
  318.               help.  The  ASP  Ombudsman can help you resolve a dispute or problem with an
  319.               ASP member, but does not provide technical support  for  members'  products.
  320.               Please  write  to  the  ASP  Ombudsman  at 545 Grover Road, Muskegon, MI USA
  321.               49442-9427, Fax 616-788-2765, or send a CompuServe  message  via  CompuServe
  322.               Mail to ASP Ombudsman 70007,3536.
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.  
  339.  
  340.              LCL4B Users Manual                                                Page 5
  341.               1.3 A Typical Application
  342.  
  343.  
  344.               The  following code is the complete MINIMAL.BAS program. It talks on COM1 at
  345.               2400 baud. The code is as follows:
  346.  
  347.  
  348.               +--------------------------------------------------------+
  349.               |                                                        |
  350.               |  '                                                     |
  351.               |  '  MINIMAL.BAS:  Talk on COM1 @ 2400 baud             |
  352.               |  '                                                     |
  353.               |  '$INCLUDE: 'LCL4B.INC'                                |
  354.               |  DECLARE FUNCTION Buf256Seg CDECL()                    |
  355.               |  'Reset port                                           |
  356.               |  CODE = SioRxBuf(COM1, Buf256Seg(), Size256)           |
  357.               |  CODE = SioReset(COM1, Baud2400)                       |
  358.               |  DO                                                    |
  359.               |    'Anything incoming ?                                |
  360.               |    CODE = SioGetc(COM1, 1)                             |
  361.               |    IF CODE > -1 THEN CODE = SioCrtWrite(CODE)          |
  362.               |    'Anything to send ?                                 |
  363.               |    IF SioKeyPress() <> 0 THEN                          |
  364.               |      ANYKEY = SioKeyRead()                             |
  365.               |      'Exit if user types Escape (ESC=27)               |
  366.               |      IF ANYKEY = 27 THEN EXIT DO                       |
  367.               |      CODE = SioPutc(COM1,ANYKEY)                       |
  368.               |    END IF                                              |
  369.               |  LOOP                                                  |
  370.               |  CODE = SioDone(COM1)                                  |
  371.               |  END                                                   |
  372.               |                                                        |
  373.               +--------------------------------------------------------+
  374.  
  375.  
  376.               The  above code can be compiled by using either the command line compiler by
  377.               typing
  378.  
  379.                    MINIMAL_.BAT
  380.  
  381.               or
  382.  
  383.                    BC MINIMAL.BAS;
  384.                    LINK MINIMAL+BUF256,MINIMAL,,VBDRT10.LIB LCL4B_BC.LIB;
  385.  
  386.               or by using the project file MINIMAL.MAK from within the  integrated  Visual
  387.               Basic  environment.  Be  sure to start by loading the LCL4B quick library by
  388.               typing
  389.  
  390.                    VBDOS /LLCL4B.QLB
  391.  
  392.               when starting VBDOS.
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.  
  406.  
  407.  
  408.              LCL4B Users Manual                                                Page 6
  409.               1.4 Installation
  410.  
  411.  
  412.               (1)  Before installation of LCL4B, your Visual Basic for DOS compiler should
  413.               already be installed on your system and tested.
  414.  
  415.               (2) Make a backup  copy  of  your  distribution  disk.   Put  your  original
  416.               distribution disk in a safe place.
  417.  
  418.               (3)  Create a work directory on your work disk (normally your harddisk). For
  419.               example, to create a work directory named LCL4B, we first log onto the  work
  420.               disk and then type:
  421.  
  422.                                MKDIR LCL4B
  423.  
  424.               (4)  Copy  all  the  files from your backup copy of the distribution disk to
  425.               your work directory.  For example, to copy from the A: drive  to  your  work
  426.               directory, we type:
  427.  
  428.                               CD LCL4B
  429.                               COPY A:*.*
  430.  
  431.               (5)  Compile  MINIMAL.BAS  using  either the command line compiler by typing
  432.               MINIMAL_, or compile it within the integrated environment. Be sure  to  load
  433.               the quick library LCL4B.QLB when the integrated environment is started:
  434.  
  435.                               VBDOS /LLCL4B.QLB
  436.  
  437.               After compiling MINIMAL.BAS, compile SIMPLE.BAS and LOGIN.BAS.
  438.  
  439.               (6)  The  recommended  way  to  test  MINIMAL and SIMPLE is to run it on two
  440.               computers connected by a  null  modem  cable.   Whatever  is  typed  on  one
  441.               computer  should be displayed on the other.
  442.  
  443.               If  you  don't  have two computers, you can use MINIMAL or SIMPLE to talk to
  444.               your modem.  Sending an "AT" to the modem should result  in  an  "OK"  being
  445.               sent  back.   In  order  to  talk  to  a  modem,  you  may  need  to send an
  446.               initialization string to your modem  with  ModemSendTo  (see  section  3.2).
  447.               Refer to your modem manual for the appropriate initilization string.
  448.  
  449.               To test LOGIN you will need a modem. See the writeup on the example programs
  450.               in section 6.
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.  
  470.  
  471.  
  472.  
  473.  
  474.  
  475.  
  476.              LCL4B Users Manual                                                Page 7
  477.               2.0 Library Organization
  478.  
  479.  
  480.               The  LCL4B  library is organized into five categories of functions. Refer to
  481.               the section 10 of this manual for details on individual functions.
  482.  
  483.  
  484.               2.1 Initialization & Termination
  485.  
  486.  
  487.               There  are  six  functions  in  the initialization and termination category.
  488.               Together,  SioParms,  SioRxBuf,  and   SioReset   initialize   your   serial
  489.               communications  system.   Your  application  must call SioParms and SioRxBuf
  490.               before calling SioReset, and SioReset must be called before any  serial  I/O
  491.               processing can be done.
  492.  
  493.               After initialization, SioParms and SioBaud can be called again to change the
  494.               communications  parameters without resetting the serial port. SioFlow can be
  495.               called to enable hardware flow control.
  496.  
  497.               Before exiting from your application, SioDone must  be  called.  Failure  to
  498.               call SioDone can crash your system later.
  499.  
  500.                    SioRxBuf   ++ Sets up receive buffer.
  501.                    SioParms   ++ Sets parity, stop bits, and word length.
  502.                    SioReset   ++ Initialize a serial port for processing.
  503.                    SioDone    ++ Terminates further serial processing.
  504.                    SioBaud    ++ Sets the baud rate of the selected port.
  505.  
  506.  
  507.               2.2 Modem Control & Status
  508.  
  509.  
  510.               There  are  nine  functions  in  the modem control and status category which
  511.               provide your application with complete control over the status  and  control
  512.               bits of your modem.
  513.  
  514.               There  are  two modem control bits, "Data Terminal Ready" (DTR) and "Request
  515.               To Send" (RTS). These bits can be  read,  set,  or  cleared  by  SioDTR  and
  516.               SioRTS.
  517.  
  518.               There  are  four  modem status bits, "Data Set Ready" (DSR), "Clear To Send"
  519.               (CTS), "Ring Indicator" (RI), and "Data Carrier Detect" (DCD). SioModem  can
  520.               read  any  of  the modem status bits.  SioDSR, SioCTS, SioRI, and SioDCD can
  521.               only read their respective modem status bit.
  522.  
  523.               There are two functions, SioRead and  SioGetDiv,  that  can  read  all  UART
  524.               registers.
  525.  
  526.               Refer  to  the  chapter entitled "RS232 Signals" for a discussion of each of
  527.               the control and status bits.
  528.  
  529.                    SioDTR    - Set, clear, or read the Data Terminal Ready (DTR) bit.
  530.                    SioRTS    | Sets, clears, or reads the Request to Send (RTS) line.
  531.                    SioModem  | Reads the modem status register.
  532.                    SioDSR    | Reads the Data Set Ready (DSR) modem status bit.
  533.                    SioCTS    | Reads the Clear to Send (CTS) modem status bit.
  534.                    SioDCD    | Reads the Data Carrier Detect (DCD) modem status bit.
  535.                    SioRI     | Reads the Ring Indicator (RI) modem status bit.
  536.                    SioRead   | Reads the contents of the 7 UART registers.
  537.                    SioGetDiv - Reads the baud rate divisor.
  538.  
  539.  
  540.  
  541.  
  542.  
  543.  
  544.              LCL4B Users Manual                                                Page 8
  545.               2.3 Serial I/O
  546.  
  547.  
  548.               There  are  six  library  functions  in the serial I/O category. Together,
  549.               these functions give the programmer complete control over serial I/O. Higher
  550.               level functions such as protocols and  smart  modem  communications  can  be
  551.               completely  implemented  in  terms  of these functions. Refer to the example
  552.               code.
  553.  
  554.               SioGetc and SioPutc perform all the actual serial I/O.   SioUnGetc  "ungets"
  555.               the  last  serial  byte  read.  SioRxFlush  clears  the  receive queue while
  556.               SioTxFlush clears the transmit queue. SioLine can be used to test  for  UART
  557.               errors.   SioRxQue  returns  the  number of bytes in the receive queue while
  558.               SioTxQue returns the number of bytes in the transmit queue.
  559.  
  560.                    SioGetc    ++ Reads the next character from the serial line.
  561.                    SioPutc    ++ Transmit a character over a serial line.
  562.                    SioUnGetc  ++ "Un-gets" (puts back) a specified character.
  563.                    SioRxFlush ++ Flush (clears) the receive buffer.
  564.                    SioRxQue   ++ Returns the number of characters in the RX queue.
  565.                    SioLine    ++ Reads the line status register.
  566.  
  567.  
  568.               2.4 Error Detection
  569.  
  570.  
  571.               There are two functions in the error detection category. They are  concerned
  572.               with  detecting  or reporting communications errors.  Use of these functions
  573.               can make your application significantly more robust.
  574.  
  575.               SioBrkSig can read or modify  the  UART  break  bit.   This  is  useful  for
  576.               signalling   the   remote  system  that  a  fatal  condition  has  occurred.
  577.               SioLoopBack can be used  to  test  the  integrity  of  your  UART.  SioError
  578.               displays  a  error  message  corresponding  to an error code returned from a
  579.               LCL4B function (every LCL4B function returns a code).
  580.  
  581.                    SioBrkSig   ++ Asserts, cancels, or detects the RS232 BREAK  signal.
  582.                    SioError    ++ Displays  error  in  text.
  583.  
  584.  
  585.               2.5 General Support
  586.  
  587.  
  588.               There is one function in the general support category. SioInfo  returns  the
  589.               version  number  of  the  library  and  whether  transmitter  interrupts are
  590.               enabled.
  591.  
  592.                    SioInfo      --  Returns  the  library  version (currently 4.2)
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.  
  601.  
  602.  
  603.  
  604.  
  605.  
  606.  
  607.  
  608.  
  609.  
  610.  
  611.  
  612.              LCL4B Users Manual                                                Page 9
  613.               3.0 Talking to Your Modem
  614.  
  615.  
  616.               A  modem  is  used  to  extend  the distance over which you may communicate.
  617.               Without a modem, your RS232 cable is limited to a maximum  of  approximately
  618.               50 feet.  But with a modem, you can communicate literally around the world.
  619.  
  620.               Several functions for talking to you modem are included in the  MODEM_IO.BAS
  621.               file.   The  functions  are  declared  in  the  MODEM_IO.INC  file, which is
  622.               included in BASIC program files which use any of the modem_io functions. All
  623.               MODEM_IO functions require that your modem use the standard AT command  set.
  624.               Refer to the program LOGIN.BAS for an example of using MODEM_IO functions.
  625.  
  626.  
  627.               3.1 ModemEcho
  628.  
  629.               Syntax: FUNCTION ModemEcho(Port,Echo)
  630.  
  631.               The ModemEcho functions copies bytes from serial input to  the  display  for
  632.               'Echo' timer tics (18.2 tics per second).
  633.  
  634.  
  635.               3.2 ModemSendTo
  636.  
  637.               Syntax: FUNCTION ModemSendTo(Port,Pace,Text$)
  638.  
  639.               The ModemSendTo function sends the  characters  in  the  string  'Text$'  to
  640.               serial output. There is a delay of 'Pace' timer tics between characters.
  641.  
  642.  
  643.               3.3 ModemWaitFor
  644.  
  645.               Syntax: FUNCTION ModemWaitFor(Port,Tics,CaseFlag,Text$)
  646.  
  647.               The  ModemWaitFor function waits for characters from serial input that match
  648.               the string 'Text$'. A total of 'Tics' timer tics are allowed  before  timing
  649.               out  and  returning  FALSE.  If  the  'CaseFlag'  is  TRUE,  then the string
  650.               comparison is case sensitive.
  651.  
  652.  
  653.               3.4 ModemQuiet
  654.  
  655.               Syntax: FUNCTION ModemQuiet(Port,Tics)
  656.  
  657.               The  ModemQuiet  function  waits  for  continuous quiet of 'Tics' timer tics
  658.               before returning. Any incoming character is echoed to the  display  and  the
  659.               wait begins anew.
  660.  
  661.  
  662.               3.5 ModemCmdState
  663.  
  664.               Syntax: FUNCTION ModemCmdState(Port)
  665.  
  666.               The ModemCmdState sets the modem to command state, provided that your  modem
  667.               uses  a guard time of 1 second and the standard 3 characters "+-+". Refer to
  668.               you Modem manual for information on setting command state.
  669.  
  670.  
  671.               3.6 ModemHangup
  672.  
  673.               Syntax: FUNCTION ModemHangup(Port)
  674.  
  675.               The  ModemHangup command hangs up the modem by first calling ModemCmdState
  676.               and then sending the string "ATH0".
  677.  
  678.  
  679.  
  680.              LCL4B Users Manual                                                Page 10
  681.               4.0 Problems
  682.  
  683.  
  684.               If you cannot get your application to run properly, first  compile  and  run
  685.               the  terminal  emulator  program  SIMPLE provided on your distribution disk.
  686.               Test SIMPLE by connecting two computers  with  a  null  modem  cable  or  by
  687.               commanding  a Hayes AT command set compatible modem. You may need to send an
  688.               initialization string to your modem. Refer to your modem manual.
  689.  
  690.               If your application does not run but SIMPLE runs correctly,  then  you  have
  691.               most  likely  made  a programming mistake in your application.  MarshallSoft
  692.               Computing cannot debug your  application,  especially  over  the  telephone!
  693.               However,  consider each of the following when searching for an error in your
  694.               application.
  695.  
  696.               1.  Have you included the file LCL4B.INC in your application ?
  697.  
  698.               2. Are you using COM1 to COM4 with the standard port addresses  and  IRQs  ?
  699.               Refer to the next section for a discussion of standard port addresses.
  700.  
  701.               3.  Have you selected too high a baud rate? You should be  able  to  run  at
  702.               9600 to 38400 baud on just about anything, and 115200 baud on 386s and up.
  703.  
  704.               4.  Did SioReset return a zero value ?  If not, then you must call  SioReset
  705.               again.
  706.  
  707.               5.   Did  you  send the proper initialization string to your modem? Refer to
  708.               your modem manual for the correct initialization string.
  709.  
  710.               6.  Did you set DTR and RTS? Most all modems require that DTR  be  set,  and
  711.               many also require that RTS be set.
  712.  
  713.               7.   Do  you  have more than one COM1 port?  For example, if you have a COM1
  714.               port on your motherboard, you cannot add another COM1 port  or  modem  board
  715.               that uses COM1 without first disabling the COM1 on the motherboard.
  716.  
  717.               8.   Is  your  modem using hardware flow control? The LCL4B library does not
  718.               support flow control. If you need hardware flow control, upgrade to PCL4B.
  719.  
  720.               9. Did you start the integrated environment with the LCL4B quick library? If
  721.               not, you will get a "Subprogram not defined" error  message.   For  example,
  722.               start  Visual  Basic with "VBDOS /LLCL4B.QLB". Also, don't forget to set the
  723.               COMMAND$ string when running SIMPLE or LOGIN.
  724.  
  725.               We recommend the following steps if you believe that you have  discovered  a
  726.               bug in the library:
  727.  
  728.               (1) Create the smallest, simpliest test program  possible  that  demonstates
  729.               the problem.
  730.  
  731.               (2)  Document  your  exact  machine  configuration  and  what error the test
  732.               program demonstates.
  733.  
  734.               (3) Upload the example source to our user support BBS or mail us a disk.
  735.  
  736.               If  the  problem can be solved with an easy work-around, we will publish the
  737.               work-around.  If the problem requires a modification to the library, we will
  738.               make the change and make the modified library  available  to  our  customers
  739.               without charge.
  740.  
  741.  
  742.  
  743.  
  744.  
  745.  
  746.  
  747.  
  748.              LCL4B Users Manual                                                Page 11
  749.               5.0 Serial Communications
  750.  
  751.  
  752.               5.1 Standard Port Addresses
  753.  
  754.  
  755.               The Lite (Personal) Communications Library  (LCL4B)  supports  COM1  through
  756.               COM4.  The  standard  IBM  PC/XT/AT  configuration  values  supported are as
  757.               follows:
  758.  
  759.                     Port     Reg Base   IRQ Line
  760.                     COM1        3F8H         4
  761.                     COM2        2F8H         3
  762.                     COM3        3E8H         4
  763.                     COM4        2E8H         3
  764.  
  765.               LCL4B assumes the above values. The Lite (Personal)  Communications  Library
  766.               can  use two standard ports simultaneously: COM1 & COM2, COM1 & COM4, COM2 &
  767.               COM3 ,or COM3 & COM4.
  768.  
  769.               The lite version of the Personal Communications Library will suffice  for  a
  770.               wide  range of serial communications projects. If you want to use more ports
  771.               or non-standard UART addresses  or  non-standard  IRQs,  you  will  need  to
  772.               upgrade  to  the  standard product PCL4B. Refer to section 7.2 "Upgrading to
  773.               PCL4B".
  774.  
  775.               When installing new  communications  cards,  the  following  guidelines  are
  776.               recommended:
  777.  
  778.               (1)  Be  sure to read the documentation for the hardware you are installing.
  779.               Pay special attention to UART base addresses and IRQ lines, particularly  if
  780.               trying to set up a non-standard configuration.
  781.  
  782.               (2)  If  you  have  a  choice in base addresses and IRQ lines, always choose
  783.               standard values as defined above.
  784.  
  785.               (3) The first port should be COM1, the second COM2, etc.
  786.  
  787.               (4) Be carefull not to configure two ports for the  same  address.  This  is
  788.               easier to do than you may believe.
  789.  
  790.               (5)  Choose  an  external  modem over an internal one.  It is much easier to
  791.               debug problems with an external modem than an internal one.
  792.  
  793.               (6)  Always  test your port as soon as it is installed. Try several programs
  794.               that use the communications ports.
  795.  
  796.  
  797.  
  798.  
  799.  
  800.  
  801.  
  802.  
  803.  
  804.  
  805.  
  806.  
  807.  
  808.  
  809.  
  810.  
  811.  
  812.  
  813.  
  814.  
  815.  
  816.              LCL4B Users Manual                                                Page 12
  817.               6.0 Example Programs
  818.  
  819.  
  820.               There  are  three  example  programs  MINIMAL, SIMPLE, and LOGIN provided as
  821.               described below.  It is recommended that they be compiled, linked,  and  run
  822.               as a test of the software installation.
  823.  
  824.  
  825.               6.1 MINIMAL.BAS
  826.  
  827.  
  828.               MINIMAL  is about the smallest possible terminal program. MINIMAL reads from
  829.               the serial port and writes to the display and reads from  the  keyboard  and
  830.               writes to the serial port. The complete source code in listed in section 1.3
  831.               of this manual.
  832.  
  833.  
  834.               6.2 SIMPLE.BAS
  835.  
  836.  
  837.               SIMPLE is a simple terminal emulator, with a few more features than MINIMAL.
  838.               To talk to COM1 at 9600 baud, type:
  839.  
  840.                   SIMPLE 1 9600
  841.  
  842.               SIMPLE  is  a  good starting place for an application that talks to a serial
  843.               device other than a modem (use LOGIN for that).
  844.  
  845.               The  best  way  to  test  MINIMAL  and SIMPLE is to run them on two machines
  846.               connected by a null modem cable. Whatever is typed on one  is  displayed  on
  847.               the  other,  and  vice  versa.   If  you have just one computer, you can use
  848.               MINIMAL or SIMPLE to talk to a modem. Type AT, and you should  receive  "OK"
  849.               back.
  850.  
  851.  
  852.               6.3 LOGIN
  853.  
  854.  
  855.               LOGIN  is  similiar  to  SIMPLE, except that it first initializes your modem
  856.               using standard AT command set commands, and then dials up  the  MarshallSoft
  857.               Computing  support  BBS  (at  205-880-9748) to the point of logging onto the
  858.               BBS. The modem initialization string  may  need  to  be  modified  for  your
  859.               particular modem. To run LOGIN on COM2 at 2400 baud, type:
  860.  
  861.                  LOGIN 2 2400
  862.  
  863.  
  864.  
  865.  
  866.  
  867.  
  868.  
  869.  
  870.  
  871.  
  872.  
  873.  
  874.  
  875.  
  876.  
  877.  
  878.  
  879.  
  880.  
  881.  
  882.  
  883.  
  884.              LCL4B Users Manual                                                Page 13
  885.               7.0 Legal Issues
  886.  
  887.               7.1 Registration
  888.  
  889.  
  890.               If you wish to register the LCL4B library, please send $39 plus $3  S&H  ($6
  891.               outside of North America) to:
  892.  
  893.                    MarshallSoft Computing, Inc.
  894.                    Post Office Box  4543
  895.                    Huntsville AL 35815
  896.  
  897.               Multiple copies are available: $30 for 3 to 9, $25 for 10 to 19, and $20 for
  898.               20  or  more.  A site license is also available for $395 (includes 5 sets of
  899.               printed documentation). We pay shipping.
  900.  
  901.               We accept American Express (account number, expiration date, exact  name  on
  902.               your card, and complete AmEx billing address required), checks in US dollars
  903.               drawn  on  a  US  bank, purchase orders (POs) from recognized US schools and
  904.               companies listed in Dun & Bradstreet, and  COD  (street  address  and  phone
  905.               number  required)  within  the  USA  (plus a $3 COD charge).  Print the file
  906.               INVOICE.DOC if an invoice is needed.
  907.  
  908.               You  can  also  order LCL4B from The Public Software Library (PSL) with your
  909.               MC, Visa, AmEx, or Discover card by  calling  800-242-4PSL  (from  overseas:
  910.               713-524-6394)  or  by  FAX  at 713-524-6398 or by CompuServe at [71355,470].
  911.               THESE NUMBERS ARE FOR ORDERING ONLY. The product number for LCL4B is 11499.
  912.  
  913.               If  you  wish to update from an older version of LCL4B, send $15 plus $3 S&H
  914.               ($6 outside of North  America).   Updates  must  be  ordered  directly  from
  915.               MarshallSoft Computing.
  916.  
  917.               The registered package includes:
  918.  
  919.                    o  Libs w/o shareware screens.
  920.                    o  Laser printed Users and Reference Manuals.
  921.                    o  Telephone, FAX, and BBS support for one year.
  922.  
  923.               Print the file INVOICE.DOC if an invoice is needed. The registered user will
  924.               receive the latest version of LCL4B shipped by two day priority mail (packet
  925.               airmail overseas).  A 5.25" diskette is provided unless a 3.5"  diskette  is
  926.               requested.
  927.  
  928.  
  929.               7.2 Upgrading to PCL4B
  930.  
  931.  
  932.               You may also upgrade from LPL4B to PCL4B for $39 plus $3 S&H ($6  overseas).
  933.               This  will  get  you  hardware  (RTS-CTS)  flow control, 16550 UART support,
  934.               DigiBoard PC/4 & PC/8 support, BOCA board BB1004, BB1008, & BB2016  support,
  935.               XMODEM & YMODEM code, and source code to the library.
  936.  
  937.  
  938.               7.3 License
  939.  
  940.  
  941.               MarshallSoft  Computing,  Inc. grants the registered user of LCL4B the right
  942.               to use one copy of the LCL4B library (in object form) on a  single  computer
  943.               in  the  development  of  any software product (other than libraries such as
  944.               LCL4B).  The user may not use the library on more than one computer  at  the
  945.               same  time.   The  source code for the library (LCL4B.ASM) is copyrighted by
  946.               MarshallSoft Computing and may not be released in whole or in part. Products
  947.               developed using LCL4B may be distributed without any royalty.
  948.  
  949.  
  950.  
  951.  
  952.              LCL4B Users Manual                                                Page 14
  953.               7.4 Warranty
  954.  
  955.  
  956.               MARSHALLSOFT COMPUTING, INC.  DISCLAIMS  ALL  WARRANTIES  RELATING  TO  THIS
  957.               SOFTWARE,  WHETHER  EXPRESSED  OR  IMPLIED, INCLUDING BUT NOT LIMITED TO ANY
  958.               IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR  PURPOSE,
  959.               AND  ALL  SUCH WARRANTIES ARE EXPRESSLY AND SPECIFICALLY DISCLAIMED. NEITHER
  960.               MARSHALLSOFT COMPUTING, INC. NOR ANYONE ELSE WHO HAS BEEN  INVOLVED  IN  THE
  961.               CREATION,  PRODUCTION,  OR DELIVERY OF THIS SOFTWARE SHALL BE LIABLE FOR ANY
  962.               INDIRECT, CONSEQUENTIAL, OR INCIDENTAL DAMAGES ARISING OUT  OF  THE  USE  OR
  963.               INABILITY  TO  USE  SUCH  SOFTWARE EVEN IF MARSHALLSOFT COMPUTING, INC.  HAS
  964.               BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES OR CLAIMS. IN NO EVENT SHALL
  965.               MARSHALLSOFT COMPUTING, INC.'S LIABILITY FOR ANY SUCH  DAMAGES  EVER  EXCEED
  966.               THE  PRICE  PAID FOR THE LICENSE TO USE THE SOFTWARE, REGARDLESS OF THE FORM
  967.               OF THE CLAIM. THE PERSON USING THE SOFTWARE BEARS ALL RISK AS TO THE QUALITY
  968.               AND PERFORMANCE OF THE SOFTWARE.
  969.  
  970.               Some states do not allow  the  exclusion  of  the  limit  of  liability  for
  971.               consequential  or  incidental damages, so the above limitation may not apply
  972.               to you.
  973.  
  974.               This agreement shall be governed by the laws of the  State  of  Alabama  and
  975.               shall  inure  to  the  benefit  of  Marshallsoft  Computing,  Inc.   and any
  976.               successors, administrators, heirs and  assigns.  Any  action  or  proceeding
  977.               brought  by either party against the other arising out of or related to this
  978.               agreement shall be brought only in a STATE or  FEDERAL  COURT  of  competent
  979.               jurisdiction  located in Madison County, Alabama. The parties hereby consent
  980.               to in personam jurisdiction of said courts.
  981.  
  982.  
  983.               8.0 Summary
  984.  
  985.  
  986.               8.1 Revision History
  987.  
  988.  
  989.               Version 4.2 -- 1 August, 1994.
  990.  
  991.               The  initial  release  of LCL4B uses version 4.2.0 of the assembler language
  992.               communications library, which is part of PCL4C (C/C++) and  PCL4P  (Pascal).
  993.  
  994.  
  995.  
  996.  
  997.  
  998.  
  999.  
  1000.  
  1001.  
  1002.  
  1003.  
  1004.  
  1005.  
  1006.  
  1007.  
  1008.  
  1009.  
  1010.  
  1011.  
  1012.  
  1013.  
  1014.  
  1015.  
  1016.  
  1017.  
  1018.  
  1019.  
  1020.              LCL4B Users Manual                                                Page 15
  1021.               8.2 Function Summary
  1022.  
  1023.  
  1024.  
  1025.               +-------------+----------+----------+----------+----------+
  1026.               | Function    |   Arg1   |   Arg2   |   Arg3   |   Arg4   |
  1027.               +-------------+----------+----------+----------+----------+
  1028.               | SioBaud     | Port     | BaudCode |          |          |
  1029.               | SioBrkKey   |          |          |          |          |
  1030.               | SioBrkSig   | Port     | Cmd      |          |          |
  1031.               | SioCTS      | Port     |          |          |          |
  1032.               | SioDCD      | Port     |          |          |          |
  1033.               | SioDelay    | Tics     |          |          |          |
  1034.               | SioDone     | Port     |          |          |          |
  1035.               | SioDSR      | Port     |          |          |          |
  1036.               | SioDTR      | Port     | Cmd      |          |          |
  1037.               | SioError    | Code     |          |          |          |
  1038.               | SioGetc     | Port     |          |          |          |
  1039.               | SioGetDiv   | Port     |          |          |          |
  1040.               | SioInfo     | Cmd      |          |          |          |
  1041.               | SioKeyPress |          |          |          |          |
  1042.               | SioKeyRead  |          |          |          |          |
  1043.               | SioLoopBack | Port     |          |          |          |
  1044.               | SioModem    | Port     | Mask     |          |          |
  1045.               | SioParms    | Port     | Parity   | StopBits |WordLength|
  1046.               | SioPorts    | NbrPorts | FirstDBP |StatusReg |          |
  1047.               | SioPutc     | Port     | Ch       |          |          |
  1048.               | SioRead     | Port     | Register |          |          |
  1049.               | SioReset    | Port     | BaudCode |          |          |
  1050.               | SioRI       | Port     |          |          |          |
  1051.               | SioRTS      | Port     | Cmd      |          |          |
  1052.               | SioRxBuf    | Port     | BufSeg   | SizeCode |          |
  1053.               | SioRxFlush  | Port     |          |          |          |
  1054.               | SioRxQue    | Port     |          |          |          |
  1055.               | SioTimer    | Port     |          |          |          |
  1056.               | SioUnGetc   | Port     | Ch       |          |          |
  1057.               +-------------+----------+----------+----------+----------+
  1058.  
  1059.  
  1060.               8.3 Error Code Summary
  1061.  
  1062.  
  1063.               +------+--------------------------------------------------------+
  1064.               | Code |  Description                                           |
  1065.               +------+--------------------------------------------------------+
  1066.               |   0  |  No error.                                             |
  1067.               |  -1  |  Timeout waiting for I/O.                              |
  1068.               |  |2  |  Port not enabled. Call SioReset first.                |
  1069.               |  |3  |  No buffer available. Call SioRxBuf first.             |
  1070.               |  |4  |  No such port. Expect 0 to MaxPort. (COM1 = 0)         |
  1071.               |  |5  |  Expected 'S', 'C', or 'R' as 2nd argument.            |
  1072.               |  |6  |  Expected 'A', 'C', or 'D' as 2nd argument.            |
  1073.               |  |7  |  Bad parity code specified. Expected 0 to 7.           |
  1074.               |  |8  |  Bad stop bits code specified. Expected 0 or 1.        |
  1075.               |  -9  |  Bad wordlength code specified. Expect 0 to MaxPort.   |
  1076.               | -10  |  Bad buffer size code specified. Expected 0 to 11.     |
  1077.               | |11  |  Bad baud rate code. Expected 0 to 9.                  |
  1078.               | |13  |  UART undefined.                                       |
  1079.               | |14  |  Missing or bad UART. (no UART hardware ?)             |
  1080.               | |15  |  Port already enabled.                                 |
  1081.               | |16  |  Interrupt already in use.                             |
  1082.               +-+----+--------------------------------------------------------+
  1083.  
  1084.  
  1085.  
  1086.  
  1087.  
  1088.              LCL4B Users Manual                                                Page 16
  1089.               9.0 Other MarshallSoft Computing Products
  1090.  
  1091.               9.1 The Personal Communications Library for Basic
  1092.  
  1093.               The  Personal  Communications  Library  for the Basic (PCL4B) is a DOS based
  1094.               asynchronous  communications  library  designed  for  experienced   software
  1095.               developers programming in C.
  1096.  
  1097.               Microsoft Visual Basic for DOS is supported.  An IBM PC/XT/AT or  compatible
  1098.               is required.  The PCL features:
  1099.  
  1100.               o 38 communications and support functions.
  1101.               o Supports hardware (RTS/CTS) flow control.
  1102.               o Supports the high performance 16550 UART.
  1103.               o Use any UART address with any of IRQ2 to IRQ7.
  1104.               o Supports the Digiboard PC/4 and PC/8.
  1105.               o Supports the BOCA BB1004, BB1008, and BB2016 boards.
  1106.               o Interrupt driven transmitter (optionally) & receiver.
  1107.               o Supports 300 baud to 115,200 baud.
  1108.               o Supports COM1 through COM16.
  1109.               o Adjustable receive queues from 8 bytes to 32 KB.
  1110.               o Control-BREAK error exit.
  1111.               o 18 communications error conditions trapped.
  1112.               o Allows 4 ports (16 with multiport boards) to run concurrently.
  1113.               o Complete modem control & status.
  1114.               o Written in assembly language for small size & high speed.
  1115.               o Terminal program featuring XMODEM, YMODEM, & YMODEM-G.
  1116.               o SCRIPT compiler & interpreter.
  1117.  
  1118.               The Personal Communications Library for Basic (PCL4B) is available  for  $65
  1119.               plus  $3  S&H  ($6  S&H overseas). LCL4B can be upgraded to  PCL4B  for  $39
  1120.               plus $3 S&H ($6 overseas).
  1121.  
  1122.  
  1123.               10.0 Function Reference
  1124.  
  1125.  
  1126.               The  remainder  of  this manual is a detailed function reference.  Note that
  1127.               each library function returns a value. Negative values  are  always  errors.
  1128.               Errors  can  be  printed  by  calling  SioError  with  the error code as its
  1129.               argument.
  1130.  
  1131.               Many  of  these  function are used in the three example programs detailed in
  1132.               section 6.
  1133.  
  1134.  
  1135.  
  1136.  
  1137.  
  1138.  
  1139.  
  1140.  
  1141.  
  1142.  
  1143.  
  1144.  
  1145.  
  1146.  
  1147.  
  1148.  
  1149.  
  1150.  
  1151.  
  1152.  
  1153.  
  1154.  
  1155.  
  1156.              LCL4B Users Manual                                                Page 17
  1157.               +-------------+------------------------------------------------------------+
  1158.               |   SioBaud   |  Sets the baud rate of the selected port.                  |
  1159.               +-------------+------------------------------------------------------------+
  1160.  
  1161.  
  1162.                 Syntax    FUNCTION SioBaud(Port,BaudCode)
  1163.                           REM Port:     Port selected (COM1 - COM4)
  1164.                           REM BaudCode: Baud code
  1165.  
  1166.                Remarks    The  SioBaud  function sets the baud rate without resetting  the
  1167.                           port. It is used to change the baud rate after calling SioReset.
  1168.  
  1169.                            Code   Rate    Name             Code   Rate   Name
  1170.                              0     300    Baud300            5    9600   Baud9600
  1171.                              1     600    Baud600            6   19200   Baud19200
  1172.                              2    1200    Baud1200           7   38400   Baud38400
  1173.                              3    2400    Baud2400           8   57600   Baud57600
  1174.                              4    4800    Baud4800           9  115200   Baud115200
  1175.  
  1176.  
  1177.                Returns     -4 : No such port. Expect 0 to MaxPort.
  1178.                           -11 : Bad baud rate code. See above code values.
  1179.  
  1180.               See Also    SioReset
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.               +-------------+------------+-------------------+---------------------------+
  1191.               |  SioBrkKey  |  Return non|zero if the Control|BREAK key was pressed.     |
  1192.               +-------------+------------+-------------------+---------------------------+
  1193.  
  1194.  
  1195.  
  1196.  
  1197.  
  1198.                 Syntax    FUNCTION SioBrkKey()
  1199.  
  1200.                Remarks    The  SioBrkKey function returns a TRUE value (non- zero) if the
  1201.                           Control-BREAK key was pressed,  else  it  returns  a  zero.  Use
  1202.                           SioBrkKey  as a safety exit from a polling loop.  Don't mix this
  1203.                           function up with SioBrkSig.
  1204.  
  1205.                Returns    -1 : Control-BREAK was pressed.
  1206.                            0 : Control-BREAK was NOT pressed.
  1207.  
  1208.               See Also    SioBrkSig
  1209.  
  1210.  
  1211.  
  1212.  
  1213.  
  1214.  
  1215.  
  1216.  
  1217.  
  1218.  
  1219.  
  1220.  
  1221.  
  1222.  
  1223.  
  1224.              LCL4B Users Manual                                                Page 18
  1225.               +-------------+------------------------------------------------------------+
  1226.               |  SioBrkSig  |  Asserts, cancels, or detects BREAK signal.                |
  1227.               +-------------+------------------------------------------------------------+
  1228.  
  1229.  
  1230.                 Syntax    FUNCTION SioBrkSig(Port,Cmd)
  1231.                           REM Port: Port selected (COM1 thru COM4)
  1232.                           REM Cmd:  ASSERT, CANCEL, or DETECT
  1233.  
  1234.                Remarks    The SioBrkSig function controls the BREAK bit in the line status
  1235.                           register. The legal commands are:
  1236.  
  1237.                           ASSERT_BREAK ('A') to assert BREAK
  1238.                           CANCEL_BREAK ('C') to cancel BREAK
  1239.                           DETECT_BREAK ('D') to detect BREAK
  1240.  
  1241.                           ASSERT_BREAK, CANCEL_BREAK,  and  DETECT_BREAK  are  defined  in
  1242.                           LCL4B.INC. See TERM.BAS for an example of the use of SioBrkSig.
  1243.  
  1244.                Returns    -2 : Port not enabled. Call SioReset first.
  1245.                           -4 : No such port. Expect 0 to MaxPort.
  1246.                           -6 : Illegal command. Expected 'A', 'C', or 'D'.
  1247.                           >0 : BREAK signal detected (DETECT command only)
  1248.  
  1249.               See Also    SioBrkKey
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.               +-------------+------------------------------------------------------------+
  1258.               | SioCrtWrite |  Write character to the screen.                            |
  1259.               +-------------+------------------------------------------------------------+
  1260.  
  1261.  
  1262.                 Syntax    FUNCTION SioCrtWrite(Ch)
  1263.                           REM Ch:  character to write
  1264.  
  1265.                Remarks    The SioCrtWrite  function  uses  the  BIOS  to  write  a  single
  1266.                           character to the screen at the current cursor location.
  1267.  
  1268.                           SioCrtWrite  calls  the  BIOS  directly without any intermediate
  1269.                           buffering or processing.  It is usually faster than  a  call  to
  1270.                           the C library.
  1271.  
  1272.               Returns    zero
  1273.  
  1274.              See Also    SioKeyPress and SioKeyRead
  1275.  
  1276.  
  1277.  
  1278.  
  1279.  
  1280.  
  1281.  
  1282.  
  1283.  
  1284.  
  1285.  
  1286.  
  1287.  
  1288.  
  1289.  
  1290.  
  1291.  
  1292.              LCL4B Users Manual                                                Page 19
  1293.               +-------------+------------------------------------------------------------+
  1294.               |   SioCTS    |  Reads the Clear to Send (CTS) modem status bit.           |
  1295.               +-------------+------------------------------------------------------------+
  1296.  
  1297.                 Syntax    FUNCTION SioCTS(Port)
  1298.                           REM Port:  Port selected (COM1 thru COM4)
  1299.  
  1300.                Remarks    The SioCTS function is used to read  the  Clear  to  Send  (CTS)
  1301.                           modem status bit.
  1302.  
  1303.                           The  CTS  line  is  used  by  some  error  correcting  modems to
  1304.                           implement hardware flow control.  CTS is dropped by the modem to
  1305.                           signal the computer not to send data  and is  raised  to  signal
  1306.                           the computer to continue.
  1307.  
  1308.                           Refer to the User's Manual for a discussion of flow control.
  1309.  
  1310.                Returns    -2 : Port not enabled. Call SioReset first.
  1311.                           -4 : No such port.  Expect 0 to MaxPort.
  1312.                            0 : CTS is clear.
  1313.                           >0 : CTS is set.
  1314.  
  1315.               See Also    SioFlow, SioDSR, SioRI, SioDCD, and SioModem.
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325.  
  1326.               +-------------+------------------------------------------------------------+
  1327.               |   SioDCD    |  Reads the Data Carrier Detect (DCD) modem staus bit.      |
  1328.               +-------------+------------------------------------------------------------+
  1329.  
  1330.  
  1331.                 Syntax    FUNCTION SioDCD(Port)
  1332.                           REM Port: Port selected (COM1 thru COM4)
  1333.  
  1334.                Remarks    The  SioDCD  function is  used to read the Data Carrier Detect
  1335.                           (DCD) modem status bit. Also see SioModem.
  1336.  
  1337.                Returns    -2 : Port not enabled. Call SioReset first.
  1338.                           -4 : No such port.  Expect 0 to MaxPort.
  1339.                            0 : DCD is clear.
  1340.                           >0 : DCD is set.
  1341.  
  1342.               See Also    SioDSR, SioCTS, SioRI, and SioModem.
  1343.  
  1344.  
  1345.  
  1346.  
  1347.  
  1348.  
  1349.  
  1350.  
  1351.  
  1352.  
  1353.  
  1354.  
  1355.  
  1356.  
  1357.  
  1358.  
  1359.  
  1360.              LCL4B Users Manual                                                Page 20
  1361.               +-------------+------------------------------------------------------------+
  1362.               |  SioDelay   |  Delays one or more timer tics.                            |
  1363.               +-------------+------------------------------------------------------------+
  1364.  
  1365.  
  1366.  
  1367.                 Syntax    FUNCTION SioDelay(Tics)
  1368.                           REM Tics: # Timer tics (18.2 tics per second)
  1369.  
  1370.                Remarks    The  SioDelay function is used to delay one or more timer tics,
  1371.                           where each timer tic is approximately 55 milliseconds (18.2 tics
  1372.                           to the second).
  1373.  
  1374.                Returns    zero
  1375.  
  1376.               See Also    SioTimer
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.               +-------------+------------------------------------------------------------+
  1391.               |   SioDone   |  Terminates further serial processing.                     |
  1392.               +-------------+------------------------------------------------------------+
  1393.  
  1394.  
  1395.                 Syntax    FUNCTION SioDone(Port)
  1396.                           REM Port:    Port selected (COM1 thru COM4)
  1397.  
  1398.                Remarks    The  SioDone  function  terminates  further  serial  processing.
  1399.                           SioDone  MUST  be called before exiting your application so that
  1400.                           interrupts can be restored to their original state.  Failure  to
  1401.                           do  this  can crash the operating system.  If you forget to call
  1402.                           SioDone before exiting, be sure to re-boot your  computer.   You
  1403.                           can  call SioDone even if SioReset has not been called, so it is
  1404.                           good  practice  to  always  call  SioDone  before  exiting  your
  1405.                           application.
  1406.  
  1407.                           Also  note  that  SioDone  dereferences the transmit and receive
  1408.                           buffers set up by SioRxQue and SioTxQue.
  1409.  
  1410.                Returns    -2 : Port not enabled. Call SioReset first.
  1411.                           -4 : No such port. Expect 0 to MaxPort.
  1412.  
  1413.               See Also    SioReset.
  1414.  
  1415.  
  1416.  
  1417.  
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.              LCL4B Users Manual                                                Page 21
  1429.               +-------------+------------------------------------------------------------+
  1430.               |    SioDSR   |  Reads the Data Set Ready (DSR) modem status bit.          |
  1431.               +-------------+------------------------------------------------------------+
  1432.  
  1433.  
  1434.                 Syntax    FUNCTION SioDSR(Port)
  1435.                           REM Port: Port selected (COM1 thru COM4)
  1436.  
  1437.                Remarks    The SioDSR function is used to read the  Data  Set  Ready  (DSR)
  1438.                           modem status bit.
  1439.  
  1440.                Returns    -2 : Port not enabled. Call SioReset first.
  1441.                           -4 : No such port.  Expect 0 to MaxPort.
  1442.                            0 : DSR is clear.
  1443.                           >0 : DSR is set
  1444.  
  1445.               See Also    SioCTS, SioRI, SioDCD, and SioModem
  1446.  
  1447.  
  1448.  
  1449.  
  1450.  
  1451.  
  1452.  
  1453.               +-------------+------------------------------------------------------------+
  1454.               |    SioDTR   |  Set, clear, or read Data Terminal Ready (DTR) status bit. |
  1455.               +-------------+------------------------------------------------------------+
  1456.  
  1457.  
  1458.                 Syntax    FUNCTION SioDTR(Port,Cmd)
  1459.                           REM Port: Port selected (COM1 thru COM4)
  1460.                           REM Cmd:  DTR command (SET, CLEAR, or READ)
  1461.  
  1462.                Remarks    The SioDTR function controls the Data Terminal Ready  (DTR)  bit
  1463.                           in the modem control register.  Commands  (defined  in  LCL4B.INC)
  1464.                           are:
  1465.  
  1466.                           SET_LINE ('S')  to set DTR (ON)
  1467.                           CLEAR_LINE ('C')  to clear DTR (OFF)
  1468.                           READ_LINE ('R')  to read DTR
  1469.  
  1470.                           Most  all  modem  require that DTR be set, and many require that
  1471.                           RTS be set.
  1472.  
  1473.                Returns    -2 : Port not enabled. Call SioReset first.
  1474.                           -4 : No such port. Expect 0 to MaxPort.
  1475.                           -5 : Not one of 'S', 'C', or 'R'.
  1476.                            0 : DTR is OFF (READ_LINE Command).
  1477.                           >0 : DTR is ON (READ_LINE Command).
  1478.  
  1479.               See Also    SioRTS.
  1480.  
  1481.  
  1482.  
  1483.  
  1484.  
  1485.  
  1486.  
  1487.  
  1488.  
  1489.  
  1490.  
  1491.  
  1492.  
  1493.  
  1494.  
  1495.  
  1496.              LCL4B Users Manual                                                Page 22
  1497.               +-------------+------------------------------------------------------------+
  1498.               |   SioError  |  Displays error in text.                                   |
  1499.               +-------------+------------------------------------------------------------+
  1500.  
  1501.  
  1502.                 Syntax    FUNCTION SioError(Code)
  1503.                           REM Code: Error code returned from a LCL4B function.
  1504.  
  1505.                Remarks    The  SioError function displays the error in text corresponding
  1506.                           to the error  code.   During  development  of  a  communications
  1507.                           application,  it is a good idea to always test return codes, and
  1508.                           print out their descriptions with SioError.
  1509.  
  1510.                Returns    zero
  1511.  
  1512.  
  1513.  
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.  
  1523.  
  1524.  
  1525.  
  1526.               +------------+-------------------------------------------------------------+
  1527.               |   SioGetc  |  Reads the next character from the serial line.             |
  1528.               +------------+-------------------------------------------------------------+
  1529.  
  1530.  
  1531.                 Syntax    FUNCTION SioGetc(Port,Tics)
  1532.                           REM Port: COM1 to COM4
  1533.                           REM Tics: Time in tics before timing out.
  1534.  
  1535.                Remarks    The SioGetc function reads a byte from the selected serial port.
  1536.                           The function will return immediately if no serial byte is ready.
  1537.  
  1538.                Returns    -2 : Port not enabled. Call SioReset first.
  1539.                           -4 : No such port. Expect 0 to MaxPort.
  1540.                           -1 : If timed out.
  1541.                           >0 : Character read.
  1542.  
  1543.               See Also    SioUnGetc and SioPutc.
  1544.  
  1545.  
  1546.  
  1547.  
  1548.  
  1549.  
  1550.  
  1551.  
  1552.  
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558.  
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564.              LCL4B Users Manual                                                Page 23
  1565.               +---------------+----------------------------------------------------------+
  1566.               |   SioGetDiv   |  Reads the baud rate divisor.                            |
  1567.               +---------------+----------------------------------------------------------+
  1568.  
  1569.  
  1570.                 Syntax    FUNCTION SioGetDiv(int Port)
  1571.                           REM Port: Port selected (COM1 thru COM16)
  1572.  
  1573.  
  1574.                Remarks     The   SioGetDiv function reads the baud rate divisor. The baud
  1575.                           rate can then be determined by the divisor:
  1576.  
  1577.                           Baud   Divisor      Baud  Divisor      Baud  Divisor
  1578.                            300    0180        4800   0018       38400   0003
  1579.                           1200    0060        9600   000C       57600   0002
  1580.                           2400    0030       19200   0006      115200   0001
  1581.  
  1582.                           The remaining registers can be read by the SioRead function.
  1583.  
  1584.                Returns    -2 : Port not enabled. Call SioReset first.
  1585.                           -4 : No such port. Expect 0 to MaxPort.
  1586.                           >0 : Baud rate divisor.
  1587.  
  1588.               See Also    SioParms and SioRead.
  1589.  
  1590.  
  1591.  
  1592.  
  1593.  
  1594.               +-------------+------------------------------------------------------------+
  1595.               |   SioInfo   |  Returns LCL4B library information.                        |
  1596.               +-------------+------------------------------------------------------------+
  1597.  
  1598.  
  1599.                 Syntax    FUNCTION SioInfo(Cmd)
  1600.                           REM Cmd: Command (VERSION)
  1601.  
  1602.                Remarks    The  SioInfo  function returns an integer code  corresponding to
  1603.                           either the library version number. Other information may be made
  1604.                           available in future releases.
  1605.  
  1606.  
  1607.                Returns    Version ('V')
  1608.  
  1609.                           hex byte XY where version is denoted as X.Y
  1610.  
  1611.  
  1612.  
  1613.  
  1614.  
  1615.  
  1616.  
  1617.  
  1618.  
  1619.  
  1620.  
  1621.  
  1622.  
  1623.  
  1624.  
  1625.  
  1626.  
  1627.  
  1628.  
  1629.  
  1630.  
  1631.  
  1632.              LCL4B Users Manual                                                Page 24
  1633.               +-------------+------------------------------------------------------------+
  1634.               | SioKeyPress | Detects if keyboard has been pressed.                      |
  1635.               +-------------+------------------------------------------------------------+
  1636.  
  1637.                 Syntax    FUNCTION SioKeyPress()
  1638.  
  1639.                Remarks    The SioKeyPress function uses the BIOS to test the keyboard  for
  1640.                           a key press (including control characters).
  1641.  
  1642.                           SioKeyPress  calls  the  BIOS  directly without any intermediate
  1643.                           buffering or processing.  It is usually faster than using the  C
  1644.                           library.
  1645.  
  1646.               Returns    zero
  1647.  
  1648.              See Also    SioCrtWrite and SioKeyRead.
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.  
  1655.  
  1656.  
  1657.  
  1658.  
  1659.  
  1660.  
  1661.  
  1662.               +-------------+------------------------------------------------------------+
  1663.               | SioKeyRead  | Reads the keyboard.                                        |
  1664.               +-------------+------------------------------------------------------------+
  1665.  
  1666.  
  1667.               Syntax    int SioKeyRead()
  1668.  
  1669.                           Remarks  The  SioKeyRead  function  uses  the  BIOS  to read the
  1670.                           keyboard.  It will wait until a character is typed.
  1671.  
  1672.                           SioKeyRead calls the  BIOS  directly  without  any  intermediate
  1673.                           buffering  or processing.  It is usually faster than using the C
  1674.                           library.
  1675.  
  1676.              Returns    Character typed (including control codes).
  1677.  
  1678.             See Also    SioCrtWrite and SioKeyRead.
  1679.  
  1680.  
  1681.  
  1682.  
  1683.  
  1684.  
  1685.  
  1686.  
  1687.  
  1688.  
  1689.  
  1690.  
  1691.  
  1692.  
  1693.  
  1694.  
  1695.  
  1696.  
  1697.  
  1698.  
  1699.  
  1700.              LCL4B Users Manual                                                Page 25
  1701.               +-------------+------------------------------------------------------------+
  1702.               |   SioLine   |  Reads the line status register.                           |
  1703.               +-------------+------------------------------------------------------------+
  1704.  
  1705.  
  1706.                 Syntax    FUNCTION SioLine(Port)
  1707.                           REM Port: Port selected (COM1 thru COM4)
  1708.  
  1709.                Remarks    The  SioLine  function  reads  the  line  status  register.  The
  1710.                           individual bit masks are as follows:
  1711.  
  1712.                           0x40  = Transmitter empty.
  1713.                           0x20  = Transmitter buffer empty.
  1714.                           0x10  = Break detected.
  1715.                           0x08  = Framming error.
  1716.                           0x04  = Parity error.
  1717.                           0x02  = Overrun error.
  1718.                           0x01  = Data ready.
  1719.  
  1720.                           The above are documented in the file LCL4B.INC.
  1721.  
  1722.                Returns    -2 : Port not enabled. Call SioReset first.
  1723.                           -4 : No such port. Expect 0 to MaxPort.
  1724.                           >0 : Line status (rightmost byte of word).
  1725.  
  1726.               See Also    SioModem.
  1727.  
  1728.  
  1729.  
  1730.               +-------------+------------------------------------------------------------+
  1731.               | SioLoopback |  Does a UART loopback test.                                |
  1732.               +-------------+------------------------------------------------------------+
  1733.  
  1734.  
  1735.                 Syntax   FUNCTION SioLoopBack(Port)
  1736.                          REM Port: Port selected (COM1 thru COM4)
  1737.  
  1738.                Remarks     SioLoopBack  makes use of the built in loopback test capability
  1739.                           of the INS8250 family UART.   Normally  SioLoopBack  will  never
  1740.                           need to be called except if you suspect that your UART is bad.
  1741.  
  1742.                           Many UARTs must be reset after running a loopback test.
  1743.  
  1744.                Returns    0 : Loopback test is successfull.
  1745.                          -2 : Port not enabled. Call SioReset first.
  1746.                          -4 : No such port.  Expect 0 to MaxPort.
  1747.                         -12 : Loopback test fails.
  1748.  
  1749.  
  1750.  
  1751.  
  1752.  
  1753.  
  1754.  
  1755.  
  1756.  
  1757.  
  1758.  
  1759.  
  1760.  
  1761.  
  1762.  
  1763.  
  1764.  
  1765.  
  1766.  
  1767.  
  1768.              LCL4B Users Manual                                                Page 26
  1769.               +-------------+------------------------------------------------------------+
  1770.               |   SioModem  |  Reads the modem status register.                          |
  1771.               +-------------+------------------------------------------------------------+
  1772.  
  1773.  
  1774.                 Syntax    FUNCTION SioModem(Port, Mask)
  1775.                           REM Port:   Port selected (COM1 thru COM4)
  1776.                           REM Mask:   Modem function mask
  1777.  
  1778.                Remarks    The  SioModem  function  reads  the  modem  register.    The bit
  1779.                           definitions for the function mask are as follows:
  1780.  
  1781.                           Bit Name  Function               Bit  Name      Function
  1782.                            7  DCD   Data Carrier Detect     3   DeltaDCD  DCD has changed
  1783.                            6  RI    Ring Indicator          2   DeltaRI   RI has changed
  1784.                            5  DSR   Data Set Ready          1   DeltaDSR  DSR has changed
  1785.                            4  CTS   Clear To Send           0   DeltaCTS  CTS has changed
  1786.  
  1787.                           Bits  4  through  7  represent  the  absolute  state  of   their
  1788.                           respective  RS-232  inputs.  Bits 0 through 3 represent a change
  1789.                           in the state of their respective RS-232 inputs since last read.
  1790.  
  1791.                Returns    -2 : Port not enabled. Call SioReset first.
  1792.                           -4 : No such port. Expect 0 to MaxPort.
  1793.                           >0 : Modem status (rightmost byte of word).
  1794.  
  1795.               See Also   SioCTS, SioDCD, SioDSR and SioRI.
  1796.  
  1797.  
  1798.  
  1799.               +-------------+------------------------------------------------------------+
  1800.               |  SioParms   |  Sets parity, stop bits, and word length.                  |
  1801.               +-------------+------------------------------------------------------------+
  1802.  
  1803.  
  1804.                Syntax     FUNCTION SioParms(Port,ParityCode,StopBitsCode, WordLengthCode)
  1805.                           REM Port:  Port selected (COM1 - COM4)
  1806.                           REM ParityCode:     parity code [0,1,2]
  1807.                           REM StopBitsCode:   stop bits code [0,1]
  1808.                           REM WordLengthCode: word length code [0,1,2,3]
  1809.  
  1810.                Remarks    The SioParms function sets  the  parity,  stop  bits,  and  word
  1811.                           length.   If  the  default parity (none), stop bits (1), or word
  1812.                           length (8) is not  acceptable,  then  they  can  be  changed  by
  1813.                           calling SioParms.  SioParms can be called either before or after
  1814.                           calling SioReset. See file LCL4B.INC. (8 = default)
  1815.  
  1816.                                         Value   Description    LCL4B.INC Name
  1817.                           ParityCode:    *0      no parity      NoParity
  1818.                                           1      odd parity     OddParity
  1819.                                           3      even parity    EvenParity
  1820.                           StopBitsCode:  *0      1 stop bit     OneStopBit
  1821.                                           1      2 stop bits    TwoStopBits
  1822.                           WordLengthCode: 0      5 data bits    WordLength5
  1823.                                           1      6 data bits    WordLength6
  1824.                                           2      7 data bits    WordLength7
  1825.                                          *3      8 data bits    WordLength8
  1826.  
  1827.               Returns     -4 : No such port. Expect 0 to MaxPort.
  1828.                           -7 : Bad parity code selected. Expecting  0 to 2.
  1829.                           |8 : Bad stop bits code. Expecting  0 or 1.
  1830.                           -9 : Bad word length code. Expecting  0 to 3.
  1831.  
  1832.              See Also    SioReset.
  1833.  
  1834.  
  1835.  
  1836.              LCL4B Users Manual                                                Page 27
  1837.               +-------------+------------------------------------------------------------+
  1838.               |   SioPutc   |  Transmit a character over a serial line.                  |
  1839.               +-------------+------------------------------------------------------------+
  1840.  
  1841.  
  1842.                 Syntax    FUNCTION SioPutc(Port,Ch)
  1843.                           REM Port: Port selected (COM1 thru COM4)
  1844.                           REM Ch:   Character to send
  1845.  
  1846.                Remarks    The SioPutc function transmits one character  over the  selected
  1847.                           serial line.
  1848.  
  1849.                Returns    -2 : Port not enabled. Call SioReset first.
  1850.                           -4 : No such port. Expect 0 to MaxPort.
  1851.  
  1852.               See Also    SioGetc and SioFlow.
  1853.  
  1854.  
  1855.  
  1856.  
  1857.  
  1858.  
  1859.               +-------------+------------------------------------------------------------+
  1860.               |   SioRead   |  Reads any UART register.                                  |
  1861.               +-------------+------------------------------------------------------------+
  1862.  
  1863.  
  1864.                 Syntax    FUNCTION SioRead(Port,Reg)
  1865.                           REM Port: Port selected (COM1 thru COM4)
  1866.                           REM Reg:  UART register (0 to 7)
  1867.  
  1868.                Remarks    The SioReset function directly reads the contents of any of  the
  1869.                           7  UART  registers.   This  function  is  useful  when debugging
  1870.                           application  programs  and  as  a  method  for  verifying   UART
  1871.                           contents.   Refer  to the LCL4B Users Manual for a discussion of
  1872.                           the 7 UART registers.
  1873.  
  1874.                           The line status register (register 5)  can  also  be  read  with
  1875.                           SioLine while the modem status register (register 6) can also be
  1876.                           read  with  SioModem.  Refer  to  the  LCL4B User's Manual for a
  1877.                           discussion of the UART registers.
  1878.  
  1879.                Returns     -3 : No buffer available. Call SioRxBuf first.
  1880.                            -4 : No such port. Expect 0 to MaxPort.
  1881.  
  1882.               See Also    SioLine, SioModem, and SioGetDiv.
  1883.  
  1884.  
  1885.  
  1886.  
  1887.  
  1888.  
  1889.  
  1890.  
  1891.  
  1892.  
  1893.  
  1894.  
  1895.  
  1896.  
  1897.  
  1898.  
  1899.  
  1900.  
  1901.  
  1902.  
  1903.  
  1904.              LCL4B Users Manual                                                Page 28
  1905.               +-------------+------------------------------------------------------------+
  1906.               |  SioReset   |  Initialize a serial port for processing.                  |
  1907.               +-------------+------------------------------------------------------------+
  1908.  
  1909.  
  1910.                 Syntax    FUNCTION SioReset(Port,BaudCode)
  1911.                           REM Port: Port selected (COM1 thru COM4)
  1912.                           REM BaudCode:  baud code or -1
  1913.  
  1914.                Remarks    The SioReset function  initializes  the  selected  serial  port.
  1915.                           SioReset should be called after calling SioParm and SioRxBuf but
  1916.                           before  making  any  other  calls  to  LCL4B.  SioReset uses the
  1917.                           parity, stop bits, and  word  length  value  previously  set  if
  1918.                           SioParm  was  called, otherwise the default values (see SioParm)
  1919.                           are used.
  1920.  
  1921.                           Recall that COM1 and COM3 share the same  interrupt  vector  and
  1922.                           therefore  cannot  operate  simultaneously. Similiarly, COM2 and
  1923.                           COM4 cannot operate simultaneously. Any other combination of two
  1924.                           ports can be used.
  1925.  
  1926.                           By specifing NORESET (-1) for the baud rate code, the port  will
  1927.                           NOT  be  reset.   This is used to "take over" a port from a host
  1928.                           communications program that allows a  "DOS  gateway".   External
  1929.                           protocols  can  be implemented this way.  See SioBaud for a list
  1930.                           of the baud rate codes, or see "LCL4B.INC".
  1931.  
  1932.                Returns     -3 : No buffer available. Call SioRxBuf first.
  1933.                            -4 : No such port. Expect 0 to MaxPort.
  1934.                           -11 : Bad baud rate code selected. Expecting  0 to 9.
  1935.                           |14 : Bad or missing UART.  You may not have hardware present.
  1936.                           |15 : Port already enabled.  SioReset has already been called.
  1937.                           -16 : Interrupt already in use.
  1938.  
  1939.               See Also    SioBaud, SioParms, SioRxBuf, SioDone.
  1940.  
  1941.  
  1942.  
  1943.  
  1944.               +-------------+------------------------------------------------------------+
  1945.               |    SioRI    |  Reads the Ring Indicator (RI) modem status bit.           |
  1946.               +-------------+------------------------------------------------------------+
  1947.  
  1948.  
  1949.                 Syntax    FUNCTION SioRI(Port)
  1950.                           REM Port: Port selected (COM1 thru COM4)
  1951.  
  1952.                Remarks    The SioRI function is used to read the Ring  Indicator
  1953.                           (RI) modem status bit. Also see SioModem.
  1954.  
  1955.                Returns    -2 : Port not enabled. Call SioReset first.
  1956.                           -4 : No such port.  Expect 0 to MaxPort.
  1957.                            0 : RI is clear.
  1958.                           >0 : RI is set (RING has occurred).
  1959.  
  1960.               See Also    SioDSR, SioCTS, SioDCD, and SioModem.
  1961.  
  1962.  
  1963.  
  1964.  
  1965.  
  1966.  
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.              LCL4B Users Manual                                                Page 29
  1973.               +-------------+------------------------------------------------------------+
  1974.               |    SioRTS   |  Sets, clears, or reads the Request to Send (RTS) line.    |
  1975.               +-------------+------------------------------------------------------------+
  1976.  
  1977.  
  1978.                 Syntax    FUNCTION SioRTS(Port,Cmd)
  1979.                           REM Port:  COM1 to COM4
  1980.                           REM Cmd:   RTS command (SET, CLEAR, or READ)
  1981.  
  1982.                Remarks    The SioRTS function controls the Request to Send (RTS bit in the
  1983.                           modem control register.
  1984.  
  1985.                           The  RTS  line  is  used  by  some  error  correcting  modems to
  1986.                           implement hardware flow control.  RTS is dropped by the computer
  1987.                           to signal the modem not to send data, and is  raised  to  signal
  1988.                           the modem to continue.
  1989.  
  1990.                           Refer  to  the  User's  Manual for a discussion of flow control.
  1991.                           Commands (defined in LCL4B.INC) are:
  1992.  
  1993.                           SET_LINE ('S')   ++ set RTS (ON)
  1994.                           CLEAR_LINE ('C') ++ clear RTS (OFF)
  1995.                           READ_LINE ('R')  ++ read RTS
  1996.  
  1997.                Returns    -2 : Port not enabled. Call SioReset first.
  1998.                           -4 : No such port. Expect 0 to MaxPort.
  1999.                           -5 : Command is not one of 'S', 'C', or 'R'.
  2000.                            0 : RTS is OFF (READ_LINE Command).
  2001.                           >0 : RTS is ON  (READ_LINE Command).
  2002.  
  2003.               See Also    SioFlow and SioDTR.
  2004.  
  2005.  
  2006.               +-------------+------------------------------------------------------------+
  2007.               |   SioRxBuf  |  Sets up receive buffer.                                   |
  2008.               +-------------+------------------------------------------------------------+
  2009.  
  2010.  
  2011.                 Syntax    FUNCTION SioRxBuf(Port,Buffer,SizeCode)
  2012.                           REM Port:     Port selected (COM1 thru COM4)
  2013.                           REM BufSeg:   Receive buffer segment word
  2014.                           REM SizeCode: Buffer size code
  2015.  
  2016.                Remarks    The SioRxBuf function passes the segment address and size of the receive
  2017.                           buffer  to  LCL4B.   Recall that LCL4B requires a receive buffer
  2018.                           for each  port  in  simultaneous  operation  since  the  receive
  2019.                           function  is  interrupt  driven.   It  must be called before any
  2020.                           incoming characters can be received.  SioRxBuf  must  be  called
  2021.                           before SioReset.  Buffer size codes are listed in "LCL4BC.INC".
  2022.  
  2023.                           Size Code       Buffer Size    LCL4B.INC Name
  2024.                              4            128 bytes        Size128
  2025.                              5            256 bytes        Size256
  2026.                              6            512 bytes        Size512
  2027.                              7           1024 bytes        Size1024 or Size1K
  2028.                              8           2048 bytes        Size2048 or Size2K
  2029.                              9           4096 bytes        Size4096 or Size4K
  2030.                             10           8192 bytes        Size8192 or Size8K
  2031.                             11          16384 bytes        Size16384 or Size16K
  2032.                             12           32768 bytes        Size32768 or Size32K
  2033.  
  2034.                Returns     -4 : No such port. Expect 0 to MaxPort.
  2035.                           -10 : Bad buffer size code. Expecting 0 to 11.
  2036.  
  2037.                See Also    SioReset.
  2038.  
  2039.  
  2040.              LCL4B Users Manual                                                Page 30
  2041.               +------------+-------------------------------------------------------------+
  2042.               | SioRxFlush |  Flushes (clears) the receive buffer.                       |
  2043.               +------------+-------------------------------------------------------------+
  2044.  
  2045.  
  2046.                 Syntax    FUNCTION SioRxFlush(Port)
  2047.                           REM Port:  Port selected (COM1 thru COM4)
  2048.  
  2049.                Remarks    The SioRxFlush  function  will  delete  any  characters  in  the
  2050.                           receive  buffer  for  the  specified port.  After execution, the
  2051.                           receive buffer will be empty.  Call SioRxBuf after  resetting  a
  2052.                           port in order to delete any spurious characters.
  2053.  
  2054.                Returns    -2 : Port not enabled. Call SioReset first.
  2055.                           -4 : No such port. Expect 0 to MaxPort.
  2056.  
  2057.               See Also    SioRxQue.
  2058.  
  2059.  
  2060.  
  2061.  
  2062.  
  2063.  
  2064.  
  2065.  
  2066.  
  2067.               +-------------+------------------------------------------------------------+
  2068.               |  SioRxQue   |  Returns the number of bytes in the receive queue.         |
  2069.               +-------------+------------------------------------------------------------+
  2070.  
  2071.  
  2072.                 Syntax    FUNCTION SioRxQue(Port)
  2073.                           REM Port: Port selected (COM1 thru COM4)
  2074.  
  2075.                Remarks    The  SioRxQue  function  will return the number of characters in
  2076.                           the receive queue at the time of the call. It  can  be  used  to
  2077.                           implement XON/XOFF flow control.
  2078.  
  2079.                Returns    -2 : Port not enabled. Call SioReset first.
  2080.                           -4 : No such port. Expect 0 to MaxPort.
  2081.  
  2082.               See Also     SioRxFlush.
  2083.  
  2084.  
  2085.  
  2086.  
  2087.  
  2088.  
  2089.  
  2090.  
  2091.  
  2092.  
  2093.  
  2094.  
  2095.  
  2096.  
  2097.  
  2098.  
  2099.  
  2100.  
  2101.  
  2102.  
  2103.  
  2104.  
  2105.  
  2106.  
  2107.  
  2108.              LCL4B Users Manual                                                Page 31
  2109.               +------------+-------------------------------------------------------------+
  2110.               |  SioTimer  |  Returns the number of system clock tics since midnight.    |
  2111.               +------------+-------------------------------------------------------------+
  2112.  
  2113.  
  2114.                 Syntax    FUNCTION SioTimer&()
  2115.  
  2116.                Remarks    The  SioTimer  function  will  return the number of system clock
  2117.                           tics since midnight, at 18.2065 tics per second.  This  function
  2118.                           is usefull for timing various functions. Also see SioDelay.
  2119.  
  2120.                Returns    System clock tics since midnight.
  2121.  
  2122.               See Also    SioDelay.
  2123.  
  2124.  
  2125.  
  2126.  
  2127.  
  2128.  
  2129.  
  2130.  
  2131.  
  2132.  
  2133.  
  2134.  
  2135.  
  2136.  
  2137.  
  2138.               +------------+-----+-------------------------------------------------------+
  2139.               | SioUnGetc  |  "Un|gets" the last character read with SioGetc().          |
  2140.               +------------+-----+-------------------------------------------------------+
  2141.  
  2142.  
  2143.                 Syntax    FUNCTION SioUnGetc(Port,Ch)
  2144.                           REM Port: Port selected (COM1 thru COM4)
  2145.                           REM Ch:   Character to unget
  2146.  
  2147.                Remarks    The SioUnGetc function returns  ("pushes")  the  character  back
  2148.                           into  the serial input buffer.  The character pushed will be the
  2149.                           next character returned by SioGetc.  Only one character  can  be
  2150.                           pushed back. This function works just like the "ungetc" function
  2151.                           in the C language.
  2152.  
  2153.                Returns    -2 : Port not enabled. Call SioReset first.
  2154.                           -4 : No such port. Expect 0 to MaxPort.
  2155.  
  2156.               See Also    SioReset.
  2157.  
  2158.  
  2159.  
  2160.  
  2161.  
  2162.  
  2163.  
  2164.  
  2165.  
  2166.  
  2167.  
  2168.  
  2169.  
  2170.  
  2171.  
  2172.  
  2173.  
  2174.  
  2175.  
  2176.              LCL4B Users Manual                                                Page 32
  2177.