home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / LCOMMT.ZIP / LCTP.TXT < prev    next >
Encoding:
Text File  |  1988-10-06  |  113.9 KB  |  3,829 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.                                       OVERVIEW                                      OVERVIEW                                      ________
  10.  
  11.  
  12.             FEATURES            FEATURES            ________
  13.  
  14.  
  15.             The LiteComm-TP Toolbox(Tm) is a set of powerful routines
  16.             designed to provide easy access to the full capabilities of
  17.             the PC's asynchronous communications ports. In its initial
  18.             release, the LiteComm-TP ToolBox supports fully interrupt-
  19.             driven and buffered communications support on COM1 thru COM4
  20.             simultaneously. Now you can quickly incorporate
  21.             sophisticated communications support in your applications
  22.             without having in-depth knowledge of how the hardware
  23.             functions.
  24.  
  25.  
  26.             LiteComm-TP is implemented as a set of 4 units for the basic
  27.             product, with additional units providing the protocol-engine
  28.             capability.  The protocol engines are a part of the
  29.             registered version of the package.
  30.  
  31.  
  32.             The LiteComm ToolBox was originally developed in the C
  33.             language for use in CAD/CAM applications that required the
  34.             ability to have PC compatible systems communicating with a
  35.             variety of devices.  The introduction of version 4.0 of
  36.             Turbo PASCAL<> has made it possible for use to extend the
  37.             power and flexibility of the original LiteComm ToolBox(Tm)
  38.             to Turbo PASCAL programmers.
  39.  
  40.  
  41.  
  42.             THE SHAREWARE CONCEPT            THE SHAREWARE CONCEPT            _____________________
  43.  
  44.  
  45.             Shareware is a "try before you buy" means of software
  46.             distribution. If you find a shareware product useful, pay
  47.             the registration fee, and let the authors know that you
  48.             support their efforts.
  49.  
  50.  
  51.             Information Technology, Ltd., is a member of, and supports
  52.             the standards of, ASP, The Association of Shareware
  53.             Professionals.
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.                                        Page 1
  62.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  71.  
  72.  
  73.                          LICENSE, WARRANTY AND REGISTRATION                         LICENSE, WARRANTY AND REGISTRATION                         __________________________________
  74.  
  75.  
  76.             LICENSE            LICENSE            _______
  77.  
  78.  
  79.             The LiteComm-TP ToolBox, is distributed as a shareware
  80.             product. In its shareware form, support is limited to all
  81.             COM ports, but only at sppeds of 1200 baud and below.  To
  82.             receive the units that support the extended features of
  83.             LiteComm-TP and/or the source code for the product, register
  84.             your copy today. See the registration form at the end of
  85.             this manual.
  86.  
  87.  
  88.             Information Technology, Ltd, grants to registered users a
  89.             non-exclusive, perpetual license to the LiteComm-TP ToolBox,
  90.             subject to these terms and conditions:
  91.  
  92.  
  93.  
  94.                 1. You must treat your copy of the LiteComm-TP
  95.                    Toolbox as you would a book.  You may install
  96.                    the LiteComm-TP ToolBox on more than one
  97.                    machine, but you may use only one copy at a
  98.                    time.  If you desire, site licenses are
  99.                    available at a reduced cost.  You may make as
  100.                    many copies of the LiteComm-TP ToolBox as you
  101.                    require for the sole purpose of backup.
  102.  
  103.  
  104.                 2. You may incorporate portions of the LiteComm-TP
  105.                    ToolBox in products that you develop without the
  106.                    payment of additional royalties or license fees.
  107.                    You must include the statement 'Portions
  108.                    Copyright 1987, 1988, Information Technology,
  109.                    Ltd' in your product's documentation.
  110.  
  111.  
  112.                 3. You may copy and redistribute the shareware
  113.                    portion of the LiteComm-TP ToolBox, commonly
  114.                    known as LCOMMTP.ARC, but you may not modify in
  115.                    any way, the contents of the shareware package.
  116.                    Further, you may charge a fee for providing such
  117.                    a copy, beyond a maximum $8.00 copying or
  118.                    duplication fee, without the express, written
  119.                    consent of Information Technology, Ltd,
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.                                        Page 2
  128.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  137.  
  138.  
  139.                 4. You may not redistribute, in any form, the
  140.                    source code for the LiteComm-TP ToolBox.
  141.                    Further, you may not translate the source code
  142.                    for the LiteComm-TP ToolBox into any other
  143.                    language without the express, written consent of
  144.                    Information Technology, Ltd.
  145.  
  146.  
  147.                 5. Information Technology reserves the right to
  148.                    change both the LiteComm-TP ToolBox or its
  149.                    documentation without prior notice, with no
  150.                    obligation to you, the licensee.
  151.  
  152.  
  153.                 6. You agree that any disputes arising from this
  154.                    license will be subject to the laws of the state
  155.                    of Rhode Island.
  156.  
  157.  
  158.                 7. You agree to hold the developer and distributors
  159.                    of the LiteComm-TP ToolBox harmless for any
  160.                    damages, either direct or consequential, that
  161.                    might arise from the use of this product.
  162.  
  163.  
  164.                 8. You acknowledge that the LiteComm-TP ToolBox,
  165.                    libraries, source code, and documentation are
  166.                    the copyrighted property of Information
  167.                    Technology, Ltd.
  168.  
  169.  
  170.                 9. By your use of the LiteComm-TP ToolBox, you
  171.                    acknowledge that you have read, and understand
  172.                    the terms and conditions of this license.
  173.  
  174.  
  175.             WARRANTY            WARRANTY            ________
  176.  
  177.  
  178.             The LiteComm-TP ToolBox is distributed as-is and without
  179.             warranty, including, but not limited to, the implied
  180.             warranties of merchantability and fitness for a particular
  181.             purpose.
  182.  
  183.  
  184.             Information Technology, Ltd does warrant the distribution
  185.             media for a period of 30 days.  During that period,
  186.             Information Technology, Ltd will replace the distribution
  187.             media or provide a refund at its option.
  188.  
  189.  
  190.  
  191.  
  192.  
  193.                                        Page 3
  194.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  203.  
  204.  
  205.             REGISTERING YOUR COPY            REGISTERING YOUR COPY            _____________________
  206.  
  207.             Registration of your copy of the LiteComm-TP ToolBox
  208.             provides you with several benefits:
  209.  
  210.  
  211.                 1. Puts you on our mailing list for low-cost
  212.                    updates, enhancements, and alert bulletins when
  213.                    they occur.
  214.  
  215.  
  216.                 2. Gives you access to telephone support. Sorry,
  217.                    but we cannot provide support by telephone to
  218.                    unregistered user's of the ToolBox. Unregistered
  219.                    users can leave EMAIL on Compuserve to
  220.                    70166,1152; on GEnie to I.TECH; and on DELPHI to
  221.                    RBMACE. We will respond to EMAIL on an as-
  222.                    available basis.
  223.  
  224.  
  225.                 3.Helps to further the shareware concept.
  226.  
  227.             To register your copy, use the form at the end of this
  228.             documentation. You may also register on-line through
  229.             Compuserve, GEnie, or DELPHI, using EMAIL.
  230.  
  231.  
  232.  
  233.             NOTE            NOTE            ____
  234.  
  235.             LiteComm-TP is a package undergoing continuing development.
  236.             Registered users of the product receive, in addition to the
  237.             fully-functional base package, units that provide protocol
  238.             engines supporting XModem, Windowed XModem, and YModem
  239.             protocols.
  240.  
  241.             We plan to follow these with similar engines for CompuServe
  242.             B, Telink, and other protocols. These engines, as they are
  243.             released, will only be made available to registered ToolBox
  244.             users. The shareware version, as enhanced but without the
  245.             protocol engines, will continue to be offered.
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.                                        Page 4
  260.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  269.  
  270.  
  271.                              COMMUNICATIONS AND THE PC                             COMMUNICATIONS AND THE PC                             _________________________
  272.  
  273.  
  274.             PC SHORTCOMINGS            PC SHORTCOMINGS            _______________
  275.  
  276.  
  277.             This section is intended as a mini-tutorial on            ______________________________________________
  278.             communications concepts. We encourage you to read it,            _____________________________________________________
  279.             although it is not strictly necessary to do so.            _______________________________________________
  280.  
  281.  
  282.             The IBM-PC, and its close compatibles, is a generally well
  283.             thought-out, flexible, and well-executed computer.
  284.             Unfortunately, not as much can be said for the thought which
  285.             was given to the software which is meant to provide access
  286.             to that hardware. One of the shortcomings which is most
  287.             noticeable is in the support, or rather lack of it, that is
  288.             provided to handle access to the serial port. Support for
  289.             the serial port is limited by the BIOS to polled mode only,
  290.             i.e. a program must interrogate the port on a regular basis
  291.             to avoid losing received characters, and to check to
  292.             determine whether or not the port is ready to send a
  293.             character. Not only is this mode of operation primitive; it
  294.             also tends to cause complications when attempting to perform
  295.             any but the simplest of tasks, at slow speeds.
  296.  
  297.  
  298.             A novice might think that the hardware, in some way, is the
  299.             limiting factor. In fact, everything that is needed,
  300.             hardware-wise, to support a more sophisticated method of
  301.             handling the serial port is already there. All that is
  302.             missing is the software follow-through. The LiteComm-TP
  303.             ToolBox provides this missing software.
  304.  
  305.  
  306.  
  307.             THE 8250 UART            THE 8250 UART            _____________
  308.  
  309.  
  310.             The term serial port comes from the fact that both incoming
  311.             and outgoing characters entering and leaving the port do so
  312.             in a bitwise fashion. When we send a character out the
  313.             serial port, the responsible circuitry sends out information
  314.             one bit at a time. When we receive a character, this
  315.             circuitry accepts the individual bits and reassembles them
  316.             into a recognizable character. These very complex operations
  317.             are performed automatically by the 8250 UART (Universal
  318.             Asynchronous Receiver-Transmitter).
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.                                        Page 5
  326.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  335.  
  336.  
  337.             The 8250 UART is a fully programmable device that permits
  338.             independent control of the various parameters that affect
  339.             serial communications, i.e. baud rate, parity, number of
  340.             data bits, and number of stop bits. The 8250 also optionally
  341.             supports four types of interrupts, error/break detection,
  342.             modem status change detection, transmitter ready, and
  343.             received character ready. The LiteComm-TP ToolBox fully
  344.             supports all four type of interrupts.
  345.  
  346.  
  347.             The term asynchronous implies that there is no absolute                     asynchronous                                                       ____________                                  
  348.             timing associated with the transmission of information.
  349.             Instead, the clocking-in of the data bits is done by                         clocking-in                                                     ___________                            
  350.             counting the bits. The first bit sent or received is call
  351.             the start bit and signals the beginning of a new character.
  352.             The individual data bits follow the start bit which are
  353.             clocked out and in at the specified data rate, with the
  354.             least significant bit transferred first and the parity bit,
  355.             if present, transferred last. Finally one or more stop bits
  356.             follow, signalling the end of the character.
  357.  
  358.  
  359.             The 8250 UART takes care of all of the mechanics associated
  360.             with the process described in the preceding paragraph. The
  361.             UART will also detect and report error which may occur in
  362.             the process. For example, if the parity bit is incorrect,
  363.             the UART reports the fact. If too few or too many bits are
  364.             received, the UART will report a framing error or overrun
  365.             error respectively.
  366.  
  367.  
  368.             Since the transmission of information may depend on complex
  369.             interactions with another device, such as a modem or
  370.             computer, the 8250 can also report on the status of the
  371.             handshaking lines used to provide information about the            handshaking                                                        ___________                                            
  372.             status of the connection with the other device. These
  373.             signals are explained below.
  374.  
  375.                                 SIGNAL DESCRIPTIONS
  376.                                           
  377.                   CTS      Clear To Send   The other device will accept
  378.                                            a transmission.
  379.             
  380.                   DSR      Data Set Ready  The other device is enabled.
  381.             
  382.                   RI       Ring Indicator  Usually reserved for modems
  383.                                            only. The phone is ringing
  384.             
  385.                   DCD      Carrier Detect  Usually reserved for modems.
  386.                                            The other modem's
  387.                                             carrier signal was detected.
  388.  
  389.  
  390.  
  391.                                        Page 6
  392.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  401.  
  402.  
  403.             The units for the LiteComm-TP ToolBox contains the various
  404.             bit masks required for you to make use of the information
  405.             provided by the 8250 UART.
  406.  
  407.  
  408.  
  409.             TOOLBOX NOTES AND WARNINGS            TOOLBOX NOTES AND WARNINGS            __________________________
  410.  
  411.  
  412.             Before you can send or receive information on a serial port
  413.             using the ToolBox, you must use the open function to enable
  414.             the line. This function initializes the 8250 UART with the
  415.             correct parameters, and introduces the UART into the
  416.             interrupt structure of the PC. The ToolBox will detect, and
  417.             report, any errors that you may make in selecting the port
  418.             or specifying the initial parameters. The ToolBox cannot and
  419.             will not detect an attempt to open a non-existent serial
  420.             port.
  421.  
  422.  
  423.             The ToolBox interfaces directly with the interrupt structure
  424.             of the PC. It is critical that, before exiting a program
  425.             that has opened a serial port that the serial port is closed
  426.             with the close function. If you exit your program without
  427.             closing the port, you may cause your system to crash since
  428.             the interrupt vector for the port might point to a section
  429.             of memory that no longer contains the needed code to support
  430.             the interrupt.  As an alternative, Turbo PASCAL permits you
  431.             to install one or more exit handlers (see the PASCAL
  432.             reference).  You may use this approach to provide a safe
  433.             shutdown, but be follow carefully Borland's recommendations
  434.             about implementing exit handlers.
  435.  
  436.  
  437.             Failure of the open function can be the result of either
  438.             improper parameters to the open function, or insufficient
  439.             memory available to allocate the requested buffers and
  440.             related control structures for the port. Memory for the
  441.             transmit and receive buffers as well as the port control
  442.             block are allocated from the heap. It is your responsibility
  443.             to insure that adequate memory is available for this
  444.             purpose.
  445.  
  446.  
  447.             Unless you are very familiar with the interrupt structure of
  448.             the PC, do not attempt to manipulate the interrupt enable
  449.             flag outside of the ToolBox. The ToolBox sets and clears the
  450.             interrupt enable flag at appropriate times and assumes that
  451.             it has sole control over the flag.
  452.  
  453.  
  454.  
  455.  
  456.  
  457.                                        Page 7
  458.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  467.  
  468.  
  469.             Unless otherwise specified, all library functions have been
  470.             compiled with the default structure alignment, i.e. the
  471.             structure alignment switch has not been used in creating the
  472.             ToolBox library.
  473.  
  474.  
  475.  
  476.                                 LITECOMM-TP HISTORY                                LITECOMM-TP HISTORY                                ___________________
  477.  
  478.  
  479.             VERSION 1.0            VERSION 1.0            ___________
  480.  
  481.  
  482.             Version 1.0 is the first version of LiteComm-TP to be
  483.             offered to the general public, although there have been 2
  484.             Beta releases prior to Version 1.0 release.  Version 1.0 is
  485.             the functional equivalent of the original LiteComm ToolBox,
  486.             version 2.5. At present, Windowed XModem is still under
  487.             development
  488.  
  489.  
  490.  
  491.             VERSION 2.0            VERSION 2.0            ___________
  492.  
  493.  
  494.             Version 2.0 represent some major tuning to the heart of
  495.             LiteComm-TP, the kernel routines.  In version 2.0, the
  496.             kernel routines have been tightened and made more efficient,
  497.             resulting in improved reliability of LiteComm-TP at higher
  498.             baud rates than before.
  499.  
  500.  
  501.             In addition new functionality has been added in the support
  502.             of Break Detection.  The ModemStatus function has also been
  503.             enhanced to make it simpler to use.  Finally, with version
  504.             2.0, we have introduced support for the Windowed XModem
  505.             protocol, and we have also added additional support to the
  506.             existing engines in the nature of a user-written 'hook' that
  507.             permits a limited view of the engine in operation.
  508.  
  509.  
  510.             Finally, several minor bugs have been corrected that were
  511.             detected in version 1.o of the product.
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.                                        Page 8
  524.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  533.  
  534.  
  535.             VERSION 3.0            VERSION 3.0            ___________
  536.  
  537.  
  538.             Version 3 of LiteComm-TP is a departure from the precedent
  539.             established in previous version.  In versions 1 and 2,
  540.             LiteComm-TP was implemented strictly in Turbo-PASCAL.  The
  541.             advantages to a strictly high-level language implementation
  542.             are obvious...as is the drawback of speed.  In version 3.0,
  543.             the kernel interrupt handlers have been recoded in assembly
  544.             language.  In addition, version 3 contains some fundamental
  545.             function additions that will be of use to those attempting
  546.             to develop bulletin board systems.  In addition, we feel
  547.             that these routines will serve as a tutorial on how to
  548.             approach certain communications problems.
  549.  
  550.  
  551.             With version 3, we have also included interrupt chaining for
  552.             COM3 and COM4, that users of the C version of LiteComm have
  553.             enjoyed since version 2.
  554.  
  555.  
  556.             Note also that, with version 3, we have changed the
  557.             shareware distribution package.  The shareware package now
  558.             supports all COM ports, but only at speeds of 1200 baud or
  559.             less.
  560.  
  561.  
  562.  
  563.  
  564.  
  565.  
  566.  
  567.  
  568.  
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.                                        Page 9
  590.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  599.  
  600.  
  601.                                     BEYOND COM2                                    BEYOND COM2                                    ___________
  602.  
  603.  
  604.             THE TOOLBOX METHODOLOGY            THE TOOLBOX METHODOLOGY            _______________________
  605.  
  606.  
  607.             In the design of the original PC, and in subsequent
  608.             variations such as the PC/AT, there were only provision for
  609.             two serial ports. Many manufacturers of add-in products,
  610.             both serial ports and internal modems have added the
  611.             capability to support 1 or more additional ports beyond the
  612.             COM2 limit. Generally, this can cause problems in the PC
  613.             since there is no room in the interrupt request scheme for
  614.             additional levels of interrupts, and there are no designated
  615.             interrupt vectors for other additional ports.
  616.  
  617.  
  618.             The ToolBox approach to resolving these issues is to permit
  619.             the programmer a degree of control over the parameters that
  620.             govern the interrupt mechanism for COM3 and COM4.
  621.             Specifically, these parameters are: 1) the interrupt request
  622.             (IRQ) bit that is used to mask the 8259 interrupt
  623.             controller; 2) the interrupt vector number (not address) to
  624.             which the port is attached; and 3) the base i/o register for
  625.             the port itself. Of course, it is assumed that the port is
  626.             based upon the 8250 UART or compatible device.
  627.  
  628.  
  629.             Before you attempt to use COM3 and/or COM4, you must
  630.             determine from the port's documentation, the appropriate
  631.             values for these three parameters. As distributed, the
  632.             ToolBox assumes the following:
  633.  
  634.             
  635.             
  636.                                      COM3         COM4                                     ____         ____
  637.             
  638.                         IRQ Bit      4            3
  639.                         Vector #     0Ch          0Bh
  640.                         Base Reg     3E8h         2E8h
  641.  
  642.             You may change any or all of these values by using the
  643.             PortChange function described below, but only before you
  644.             open the port with CommOpen. Once the port has been opened,
  645.             PortChange is ineffective, and PortChange will not work on
  646.             COM1 or COM2.
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.                                       Page 10
  656.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  665.  
  666.  
  667.             CAUTIONS            CAUTIONS            ________
  668.  
  669.  
  670.             There is an intimate relationship between the IRQ setting
  671.             and the interrupt vector to which it relates. In the PC,
  672.             this relationship is controlled, in part, by the 8259
  673.             interrupt controller that is set during BIOS initialization.
  674.  
  675.  
  676.             In brief, the BIOS settings for the PC (and most close
  677.             compatibles) establish IRQ0 as being vector number 08h, and
  678.             subsequent IRQ levels at increasing vector numbers. These
  679.             vector numbers (or types in INTEL terms) act as a cpu-
  680.             directed call table to locations in the lowest 1K of system
  681.             memory. We can alter how the system responds to a given
  682.             interrupt by replacing or changing the values in the
  683.             associated vector position to point to a routine which we
  684.             supply.
  685.  
  686.  
  687.             COM3 and COM4 share two critical parameters with COM1 and
  688.             COM2 respectively, the IRQ bit and the interrupt vector
  689.             number. If you intend to use COM1 with COM3 or COM2 with
  690.             COM4 simultaneously, you must change the BOTH the vector
  691.             number and the IRQ for COM3 or COM4 to an unused or un-
  692.             needed vector. The ability for your add-on ports to handle
  693.             such a change is highly hardware dependent, so check your
  694.             port's documentation carefully. Failure to do so will result
  695.             in loss of data at best, and a system lockup at worst.
  696.  
  697.  
  698.             Judging from the questions asked by some users of LiteComm-
  699.             TP, there is evidently some mis-understanding about using
  700.             ports beyond COM2, and how this all relates to your
  701.             hardware. Before you can successfully use COM3 or COM4, you
  702.             must consider the following:
  703.  
  704.  
  705.  
  706.                 1. Does the hardware permit a change to the base
  707.                    port and/or the interrupt vector to which the
  708.                    port responds.  Some expansion cards will
  709.                    support changing one and not the other, giving
  710.                    rise to potential hardware conflicts and lost
  711.                    data.
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.                                       Page 11
  722.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  731.  
  732.  
  733.                 2. Does the hardware permit  re-assignment of the
  734.                    IRQ priority. Some expansion cards permit you to
  735.                    alter the IRQ priority, some won't. Suffice it
  736.                    to say from the previous discussion the any
  737.                    change to the IRQ priority must allow a
  738.                    corresponding change to the interrupt vector
  739.                    number. Without this capability, reprogramming
  740.                    of the 8259 chip would be required.
  741.  
  742.  
  743.                 3. In fact, many add-on cards permit this dual
  744.                    change simply by making a single switch or
  745.                    jumper setting. Unfortunately, the documentation
  746.                    for these cards  generally assume that you are
  747.                    aware of the dual nature of the IRQ vector
  748.                    relationship, and may leave you with the
  749.                    impression that you are changing one and not the
  750.                    other. In most circumstances, this is not the
  751.                    case.
  752.  
  753.             The point to all of this is that LiteComm-TP can only
  754.             provide as much support as the hardware permits, or is
  755.             capable of responding to. If you wish to use other than the
  756.             default base port, interrupt vector, or irq priority for
  757.             COM3 or COM4, then your expansion card must be capable of
  758.             supporting the new values; in other words, these values are
  759.             all hardware-provided, and are recognized by the LiteComm-TP
  760.             software. If your hardware does not permit changing a value,
  761.             LiteComm-TP cannot improve the situation.
  762.  
  763.  
  764.             We should, at this point, add one final caution about how
  765.             interrupt priorities function, and their relationship to the
  766.             irq bit the you may select. The standard PC permits 8
  767.             interrupt priority levels, with the programmable timer
  768.             having the highest priority, and the parallel printer port
  769.             having the lowest priority. When an interrupt occurs, the
  770.             interrupt controller (8259 chip) masks out all other
  771.             interrupts from the priority of the interrupting device and
  772.             all lower priority devices.
  773.  
  774.  
  775.             As an aid to making COM3 and COM4 "fit", LiteComm-TP
  776.             supports  interrupt chaining for the COM3 and COM4 ports. If
  777.             you use COM3 or COM4, when an interrupt occurs, the kernel
  778.             will attempt to determine if the interrupt was caused by the
  779.             supported port or from some other source.
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.                                       Page 12
  788.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  797.  
  798.  
  799.             If the kernel determines that the supported port did not
  800.             cause the interrupt, an automatic chain to the original
  801.             interrupt handler for that interrupt level (IRQ level) will
  802.             take place, allowing you to "patch in" or share the
  803.             available interrupt vectors.
  804.  
  805.  
  806.             If you intend to use other than the provided defaults, be
  807.             sure that you understand the interrupt mechanism. The use of
  808.             the automatic chaining described above can be particularly
  809.             troublesome under some circumstances, resulting in loss of
  810.             interrupts and, potentially, a system crash.
  811.  
  812.  
  813.  
  814.                                   PACKAGE CONTENTS                                  PACKAGE CONTENTS                                  ________________
  815.  
  816.             Your distribution diskette contains several files that are
  817.             important to you. All distribution diskettes, at a minimum,
  818.             include the following files in the diskette's root
  819.             directory:
  820.  
  821.             
  822.                         PSERIAL.NUM       SERIAL NUMBER OF THIS COPY
  823.                         READ.ME           LATEST INFORMATION ABOUT
  824.                                           LITECOMM-TP
  825.             
  826.                         LTCOMM.ARC        SHAREWARE VERSION AND
  827.                                           DOCUMENTATION FILES
  828.             
  829.                         LTUNITS.ARC       FULLY FUNCTIONAL UNIT FILES
  830.             
  831.             If you registered for the source code modules, the diskette
  832.             contains 2 additional source code archives.
  833.             
  834.             
  835.                         LITECOMM-TP SOURCE CODE     LTSRC.ARC
  836.             
  837.                         XMODEM ENGINE SOURCE CODE   LTXMSRC.ARC
  838.             
  839.  
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.                                       Page 13
  854.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  863.  
  864.  
  865.             INSTALLATION INSTRUCTIONS            INSTALLATION INSTRUCTIONS            _________________________
  866.  
  867.  
  868.             In the following discussion, we assume that your regular            ________________________________________________________
  869.             unit files are contained in a directory called \TP.                                                           \TP             ___________________________________________________
  870.  
  871.  
  872.             To install the unit files used with LiteComm-TP, perform the
  873.             following steps:
  874.  
  875.  
  876.  
  877.                 1. CD \TP
  878.  
  879.  
  880.                 2. ARC E A:LTUNITS
  881.  
  882.             Since Turbo PASCAL permits you the flexibility of having a
  883.             separate sub-directory for units, you should execute the
  884.             above instructions in whatever directory you use for units.
  885.  
  886.  
  887.             If you are installing only the units, this completes the
  888.             installation procedure. If you have registered for the
  889.             package's source code, we recommend that you create a
  890.             separate sub-directory.  The example below assumes that you
  891.             will use a directory named COMM to hold the LiteComm-TP and
  892.             XModem source code modules. To install the LiteComm-TP
  893.             source code, do the following:
  894.  
  895.  
  896.  
  897.                 1. MD \COMM
  898.  
  899.  
  900.                 2. CD \COMM
  901.  
  902.  
  903.                 3. ARC E A:LTSRC *.*
  904.  
  905.  
  906.                 4. ARC E A:LTXMSRC *.*
  907.  
  908.             We strongly urge that you use the recommended approach in
  909.             handling the source code to avoid naming conflicts that
  910.             might arise.
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.                                       Page 14
  920.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  929.  
  930.  
  931.                                    GENERAL NOTES                                   GENERAL NOTES                                   _____________
  932.  
  933.             In the discussion of the various functions which follow, you
  934.             should assume that any references to the 'port' variable
  935.             refer to a variable or constant that may take on a value of
  936.             from 1 to 4. No other values are acceptable, and will be
  937.             rejected.
  938.  
  939.  
  940.             While we feel that LiteComm-TP is written in the most
  941.             efficient way possible, commensurate with good programming
  942.             practice, we cannot be responsible for variations caused by
  943.             hardware configurations or other factors beyond our control.
  944.             LiteComm-TP has been tested, and is known to perform on, the
  945.             IBM PC-AT and several compatible systems such as the Zenith
  946.             and Wyse equivalents. LiteComm-TP has not been tested in
  947.             environments in which other software, most significantly TSR
  948.             (terminate and stay resident) modules exist. Some TSR
  949.             programs that "steal" interrupts for their own purposes
  950.             present an unfavorable environment to other programs that
  951.             rely on the interrupt structure of the computer.
  952.  
  953.  
  954.             Should you experience erratic behavior with LiteComm-TP in a
  955.             TSR-type situation, try executing your application without
  956.             the TSR module being present. If the problems you have
  957.             experienced disappear, suspect the TSR module.
  958.  
  959.  
  960.             Conversely, LiteComm-TP provides an excellent vehicle for
  961.             supporting TSR programs that you may write. Since the
  962.             package is fully reentrant, your only concern need be with
  963.             those aspects of TSR programs are of normal concern, e.g.
  964.             the non-reentrant nature of DOS. LiteComm-TP never uses DOS
  965.             functions and may therefore be safely used in a TSR
  966.             environment.
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.                                       Page 15
  986.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  995.  
  996.  
  997.                           PROCEDURE AND FUNCTION REFERENCE                          PROCEDURE AND FUNCTION REFERENCE                          ________________________________
  998.  
  999.             In the following pages, we provide the detailed information
  1000.             about each of the available LiteComm-TP ToolBox functions
  1001.             and procedures.  Each definition includes, at a minimum, a
  1002.             summary of how the function or procedure is referenced, in
  1003.             which unit the function or procedure is found, a description
  1004.             of what the function or procedure does, and an indication of
  1005.             those values, if any, that might be returned.
  1006.  
  1007.  
  1008.             Where appropriate, we include additional documentation about
  1009.             the function.  Some definitions include examples, in the
  1010.             sense of code fragments illustrating the function's usage.
  1011.             More importantly, some definitions include additional notes
  1012.             and warnings as well as references to other functions within
  1013.             the package.
  1014.  
  1015.  
  1016.             We have made every effort to insure that the documentation
  1017.             of the functions is complete and accurate.  The style and
  1018.             manner of the documentation assumes that the reader is
  1019.             thoroughly familiar with the elements of C syntax and common
  1020.             conventions.
  1021.  
  1022.  
  1023.  
  1024.             UNIT USAGE            UNIT USAGE            __________
  1025.  
  1026.  
  1027.             To assist you in developing your own applications, you will
  1028.             need to know the following information.
  1029.  
  1030.  
  1031.                            Unit           Uses
  1032.             
  1033.                            LctKrnl        DOS
  1034.                            LctSupp        DOS, LctKrnl
  1035.                            LctHayes       DOS, LctSupp
  1036.                            LctBBs         DOS, CRT, LctKrnl, LctSupp
  1037.                            LcTimer        DOS *
  1038.                            LTXMKrnl       DOS, LctSupp, LcTimer *
  1039.                            LTXModem       DOS, LctSupp, LTXMKrnl
  1040.                                           LcTimer *
  1041.             
  1042.             * This unit part of registered version only.
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.                                       Page 16
  1052.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  1061.  
  1062.            _______________________________________________________________
  1063.  
  1064.                  PortChange function               LctKrnl                 PortChange function               LctKrnl
  1065.            _______________________________________________________________
  1066.  
  1067.  
  1068.             FUNCTION            FUNCTION            ________
  1069.  
  1070.             Changes one or more of the critical parameters for port COM3
  1071.             or COM4.
  1072.  
  1073.  
  1074.  
  1075.             DECLARATION            DECLARATION            ___________
  1076.  
  1077.                  Portchange(CPort:integer; NewBase:word; NewIrq,
  1078.                     NewVector:byte)
  1079.  
  1080.  
  1081.             RESULT TYPE            RESULT TYPE            ___________
  1082.  
  1083.                  boolean
  1084.  
  1085.  
  1086.  
  1087.             REMARKS            REMARKS            _______
  1088.  
  1089.  
  1090.             This function must be used before the port is opened to be
  1091.             effective. To leave any of the parameters at its default
  1092.             value, make the corresponding entry 0. Note that vector is a
  1093.             vector number, not an address or pointer.
  1094.  
  1095.  
  1096.             The irq parameter should not be taken to be the irq
  1097.             (interrupt request number), but rather the irq mask. For
  1098.             example, the correct value for irq4 is NOT 4, but a byte in
  1099.             which bit 4, using INTEL's bit numbering, is set to a value
  1100.             of 1. Thus, to use irq priority 4 as the irq for either COM3
  1101.             or COM4, you would specify $10 as the value of irq when
  1102.             calling PortChange.
  1103.  
  1104.  
  1105.             If you intend to change the default irq settings, you MUST
  1106.             also make a corresponding change to the vector number. See
  1107.             the preceding section about using COM3 and COM4 for
  1108.             additional details. Failure to follow this rule may make the
  1109.             port appear to be non-functional.
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.                                       Page 17
  1118.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  1127.  
  1128.  
  1129.             The PortChange function does NOT check to determine that you
  1130.             have provided both an IRQ mask AND a new vector number.
  1131.  
  1132.  
  1133.             PortChange returns a value of TRUE if the change was
  1134.             successful, false otherwise.
  1135.  
  1136.  
  1137.  
  1138.             EXAMPLE            EXAMPLE            _______
  1139.  
  1140.                  Var
  1141.                     Newbase : word;
  1142.                     Newirq : byte;
  1143.                     NewVector : byte;
  1144.                     
  1145.                     Begin
  1146.                       Newbase := $03E8;
  1147.                       Newirq := $10;
  1148.                       NewVector := $0C;
  1149.                     
  1150.                       if PortChange(3, Newbase, Newirq, NewVector)
  1151.                     then
  1152.                       Writeln('Port 3 Changed')
  1153.                     else
  1154.                       Writeln('Error changing Port 3');
  1155.                     end;
  1156.  
  1157.  
  1158.  
  1159.  
  1160.  
  1161.  
  1162.  
  1163.  
  1164.  
  1165.  
  1166.  
  1167.  
  1168.  
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.                                       Page 18
  1184.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  1193.  
  1194.            _______________________________________________________________
  1195.  
  1196.                  CommOpen function                 LctKrnl                 CommOpen function                 LctKrnl
  1197.            _______________________________________________________________
  1198.  
  1199.  
  1200.             FUNCTION            FUNCTION            ________
  1201.  
  1202.             Prepares the specified port for use by the other functions
  1203.  
  1204.  
  1205.  
  1206.             DECLARATION            DECLARATION            ___________
  1207.  
  1208.                  CommOpen(CPort, Baud:integer; Parity:char;
  1209.                     Databits, Stopbits, InSize, OutSize:integer)
  1210.  
  1211.  
  1212.             RESULT TYPE            RESULT TYPE            ___________
  1213.  
  1214.                  boolean
  1215.  
  1216.  
  1217.  
  1218.             REMARKS            REMARKS            _______
  1219.  
  1220.             Opens the specified port for use and attaches an interrupt
  1221.             handler to DOS for the port. The function allocates buffers
  1222.             for input and output of the specified sizes, and sets the
  1223.             port to the parameters specified. The minimum value for
  1224.             InSize is 128; the minimum size for OutSize is 64. A port
  1225.             opened in this manner must be closed using CommClose before
  1226.             program termination to avoid the possibility of a system
  1227.             crash.
  1228.  
  1229.  
  1230.             CommOpen sets aside an additional 512 bytes per open port.
  1231.             This additional memory is used as the stack for the port's
  1232.             interrupt handler while interrupts are being processed.
  1233.             This approach help avoid the possiblity of stack overflows
  1234.             that might occur under some conditions.
  1235.  
  1236.  
  1237.  
  1238.  
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.                                       Page 19
  1250.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  1259.  
  1260.  
  1261.             The parameters passed to the function are discrete values,
  1262.             and must be drawn from the following lists:
  1263.  
  1264.  
  1265.             Baud: any value that your communication equipment, e.g. your
  1266.             modem, will support.
  1267.             Parity: E, O, N, M, S
  1268.                  E - Even
  1269.                  O - Odd
  1270.                  N - None
  1271.                  M - Mark
  1272.                  S - Space
  1273.             Databits: 5, 6, 7, 8
  1274.             StopBits: 1, 2
  1275.  
  1276.  
  1277.             A return of TRUE indicates the port has been successfully
  1278.             opened and is ready for use.  A return of FALSE indicates an
  1279.             error occurred, either as the result of an invalid
  1280.             parameter, or insufficient heap space available to allocate
  1281.             the buffers and control structures for the port.
  1282.  
  1283.  
  1284.  
  1285.             EXAMPLE            EXAMPLE            _______
  1286.  
  1287.                  Var
  1288.                     Baud, Databits, Stopbits : integer;
  1289.                     Parity : char;
  1290.                     Insize, Outsize : integer;
  1291.                     
  1292.                     begin
  1293.                       Baud := 2400;
  1294.                       Parity := 'E';
  1295.                       Databits := 7;
  1296.                       Stopbits := 1;
  1297.                       Insize := 256;
  1298.                       Outsize := 256;
  1299.                     
  1300.                       if CommOpen(1, Baud, Parity, Databits,
  1301.                     Stopbits, Insize, Outsize) then
  1302.                            Writeln('COM1 available for use')
  1303.                       else
  1304.                            Writeln('Error opening COM1');
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.                                       Page 20
  1316.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  1325.  
  1326.            _______________________________________________________________           _______________________________________________________________
  1327.  
  1328.                CommClose procedure                           LctKrnl               CommClose procedure                           LctKrnl
  1329.            _______________________________________________________________           _______________________________________________________________
  1330.  
  1331.  
  1332.             FUNCTION            FUNCTION            ________
  1333.  
  1334.             Closes a port that has been opened by the CommOpen function
  1335.  
  1336.             DECLARATION            DECLARATION            ___________
  1337.  
  1338.             CommClose(CPort:integer)
  1339.  
  1340.  
  1341.  
  1342.             REMARKS            REMARKS            _______
  1343.  
  1344.             This function is the companion to CommOpen and, in effect,
  1345.             performs the opposite action. CommClose detaches the kernel
  1346.             interrupt handler from the port, and reconnects the previous
  1347.             interrupt handler. CommClose also release dynamically
  1348.             allocated memory used for buffering and control structures.
  1349.             Failure to call CommClose before terminating a program may
  1350.             result in unexplained system crashes or hangs.
  1351.  
  1352.  
  1353.  
  1354.  
  1355.  
  1356.  
  1357.  
  1358.  
  1359.  
  1360.  
  1361.  
  1362.  
  1363.  
  1364.  
  1365.  
  1366.  
  1367.  
  1368.  
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.                                       Page 21
  1382.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  1383.  
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  1391.  
  1392.            _______________________________________________________________           _______________________________________________________________
  1393.  
  1394.                CommSetup function                            LctKrnl               CommSetup function                            LctKrnl
  1395.            _______________________________________________________________           _______________________________________________________________
  1396.  
  1397.  
  1398.             FUNCTION            FUNCTION            ________
  1399.  
  1400.             Provides the capability of changing the parameters for an
  1401.             open port, without breaking the connection or closing the
  1402.             port.
  1403.  
  1404.  
  1405.  
  1406.             DECLARATION            DECLARATION            ___________
  1407.  
  1408.             CommSetup(CPort, Baud:integer; Parity:char; Databits,
  1409.             Stopbits:integer)
  1410.  
  1411.  
  1412.  
  1413.             RESULT TYPE            RESULT TYPE            ___________
  1414.                  boolean
  1415.  
  1416.  
  1417.             REMARKS            REMARKS            _______
  1418.  
  1419.             The CommSetup function is a subset of the CommOpen function
  1420.             and the remarks made in the description of CommOpen apply.
  1421.             This function is useful if you wish to change the basic
  1422.             communication parameters of the specified port that has
  1423.             already been opened without CommClose'ing the port and
  1424.             breaking the connection.
  1425.  
  1426.  
  1427.  
  1428.             SEE ALSO            SEE ALSO            ________
  1429.  
  1430.                  CommOpen
  1431.  
  1432.  
  1433.  
  1434.  
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.  
  1444.  
  1445.  
  1446.  
  1447.                                       Page 22
  1448.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  1449.  
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  1457.  
  1458.            _______________________________________________________________           _______________________________________________________________
  1459.  
  1460.                ValidatePort function                         LctKrnl               ValidatePort function                         LctKrnl
  1461.            _______________________________________________________________           _______________________________________________________________
  1462.  
  1463.  
  1464.             FUNCTION            FUNCTION            ________
  1465.  
  1466.             Verifies that the specified port has been opened and returns
  1467.             a pointer to the Communications Control Block for the port.
  1468.  
  1469.  
  1470.  
  1471.             DECLARATION            DECLARATION            ___________
  1472.  
  1473.             ValidatePort(CPort:integer)
  1474.  
  1475.  
  1476.  
  1477.             RESULT TYPE            RESULT TYPE            ___________
  1478.  
  1479.                  CCBPTR
  1480.  
  1481.  
  1482.  
  1483.             REMARKS            REMARKS            _______
  1484.  
  1485.             Used internally to validate that the port number specified
  1486.             is correct and has been opened with the CommOpen function.
  1487.             May be of use to you in writing certain applications that
  1488.             require access to the Communications Control Block.  The
  1489.             function returns a value of NIL if the specified port is
  1490.             incorrect or not open.
  1491.  
  1492.  
  1493.  
  1494.             EXAMPLE            EXAMPLE            _______
  1495.  
  1496.                  if ValidatePort(2) = NIL then
  1497.                       Writeln('The port has been opened')
  1498.                     else
  1499.                       Writeln('The port is nor presently open');
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505.  
  1506.  
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.                                       Page 23
  1514.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  1523.  
  1524.            _______________________________________________________________           _______________________________________________________________
  1525.  
  1526.                BytesInInput function                         LctSupp               BytesInInput function                         LctSupp
  1527.            _______________________________________________________________           _______________________________________________________________
  1528.  
  1529.  
  1530.             FUNCTION            FUNCTION            ________
  1531.  
  1532.             Returns the number of characters currently available in the
  1533.             input buffer (BytesInInput) or the number of untransmitted
  1534.             characters in the output buffer (ByteInOutput).
  1535.  
  1536.  
  1537.  
  1538.             DECLARATION            DECLARATION            ___________
  1539.  
  1540.             BytesInInput(CPort:integer)
  1541.             BytesInOutput(CPort:integer)
  1542.  
  1543.  
  1544.  
  1545.             RESULT TYPE            RESULT TYPE            ___________
  1546.  
  1547.                  integer
  1548.  
  1549.  
  1550.  
  1551.             REMARKS            REMARKS            _______
  1552.  
  1553.             May be used to determine the number of characters currently
  1554.             in the input (BytesInInput) or output (BytesInOutput)
  1555.             buffers for the port. In the event of an error (bad port), a
  1556.             value of -1 is returned.
  1557.  
  1558.  
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564.  
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570.  
  1571.  
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578.  
  1579.                                       Page 24
  1580.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  1581.  
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  1589.  
  1590.            _______________________________________________________________           _______________________________________________________________
  1591.  
  1592.                ModemStatus function                          LctKrnl               ModemStatus function                          LctKrnl
  1593.            _______________________________________________________________           _______________________________________________________________
  1594.  
  1595.  
  1596.             FUNCTION            FUNCTION            ________
  1597.  
  1598.             Returns the last know status of the modem control lines for
  1599.             the specified port.
  1600.  
  1601.  
  1602.  
  1603.             DECLARATION            DECLARATION            ___________
  1604.  
  1605.             ModemStatus(CPort:integer)
  1606.  
  1607.  
  1608.  
  1609.             RESULT TYPE            RESULT TYPE            ___________
  1610.  
  1611.                  byte
  1612.  
  1613.  
  1614.  
  1615.             REMARKS            REMARKS            _______
  1616.  
  1617.             Use this function to determine the last known state of the
  1618.             modem-supplied handshake signals. These may be tested using
  1619.             the values included in the unit, using PASCAL's bitwise AND
  1620.             operator.  NOTE: The byte value returned can be viewed as
  1621.             consisting of two sub-fields, the current signal state
  1622.             (found in the high order 4 bits of the byte), and the signal
  1623.             change(DELTA) indicators(found in the low-order 4 bits of
  1624.             the byte).  Whenever this function is called, both subfields
  1625.             are returned, and represent the current state of the
  1626.             individual signals.  The DELTA settings may be all reset, if
  1627.             no signals have changed since the last call to the function.
  1628.             The signals which are tracked are CTS, DSR, RI, and DCD.
  1629.  
  1630.  
  1631.             To determine which signals, if any, have changed use the
  1632.             DeltaXXX bits returned. For example, if CTS has changed, the
  1633.             DeltaCTS bit will be set.  The actual CTS value (on or off)
  1634.             will be found in the CTS bit of the returned byte.
  1635.  
  1636.  
  1637.             In the event of an error, a byte of $00 is returned.
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.                                       Page 25
  1646.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  1655.  
  1656.  
  1657.             HINT            HINT            ____
  1658.  
  1659.             Detecting a ringing phone (using the RI signal) can be
  1660.             tricky and timing dependent.  One nearly foolproof method
  1661.             that we have used is to examine the DeltaRI value, not the
  1662.             RI value.  The DeltaRI value is set and reset as the
  1663.             telephone starts and stops ringing.  The RI value is set and
  1664.             cleared independantly, and you may miss the fact that the
  1665.             phone is ringing if you don't examine the value at the right
  1666.             time.
  1667.  
  1668.  
  1669.  
  1670.             EXAMPLE            EXAMPLE            _______
  1671.  
  1672.                  Var
  1673.                     CStat : byte;
  1674.                     
  1675.                     begin
  1676.                       CStat := ModemStatus(1);
  1677.                       if CStat and DeltaCTS = DeltaCTS then
  1678.                         if CStat and CTS <> CTS then
  1679.                            Writeln('The connection is broken');
  1680.  
  1681.  
  1682.  
  1683.  
  1684.  
  1685.  
  1686.  
  1687.  
  1688.  
  1689.  
  1690.  
  1691.  
  1692.  
  1693.  
  1694.  
  1695.  
  1696.  
  1697.  
  1698.  
  1699.  
  1700.  
  1701.  
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710.  
  1711.                                       Page 26
  1712.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  1721.  
  1722.            _______________________________________________________________           _______________________________________________________________
  1723.  
  1724.                BreakRecd function                            LctKrnl               BreakRecd function                            LctKrnl
  1725.            _______________________________________________________________           _______________________________________________________________
  1726.  
  1727.  
  1728.             FUNCTION            FUNCTION            ________
  1729.  
  1730.             Returns a value of true if a BREAK signal has been received
  1731.             from the serial port since that last call to the function.
  1732.  
  1733.  
  1734.  
  1735.             DECLARATION            DECLARATION            ___________
  1736.  
  1737.                  BreakRecd(CPort:integer);
  1738.  
  1739.  
  1740.  
  1741.             RESULT TYPE            RESULT TYPE            ___________
  1742.  
  1743.                  boolean;
  1744.  
  1745.  
  1746.  
  1747.             REMARKS            REMARKS            _______
  1748.  
  1749.             This function returns a value of TRUE if a BREAK character
  1750.             has been received since the last call to the function.
  1751.  
  1752.  
  1753.  
  1754.             EXAMPLE            EXAMPLE            _______
  1755.  
  1756.                       if BreakRecd(2) then
  1757.                         Writeln('Break Signal detected on Port 2');
  1758.  
  1759.  
  1760.  
  1761.  
  1762.  
  1763.  
  1764.  
  1765.  
  1766.  
  1767.  
  1768.  
  1769.  
  1770.  
  1771.  
  1772.  
  1773.  
  1774.  
  1775.  
  1776.  
  1777.                                       Page 27
  1778.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  1779.  
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  1787.  
  1788.            _______________________________________________________________           _______________________________________________________________
  1789.  
  1790.                ErrorStatus function                          LctKrnl               ErrorStatus function                          LctKrnl
  1791.            _______________________________________________________________           _______________________________________________________________
  1792.  
  1793.  
  1794.             FUNCTION            FUNCTION            ________
  1795.  
  1796.             Return the last known error status for the specified port.
  1797.  
  1798.  
  1799.  
  1800.             DECLARATION            DECLARATION            ___________
  1801.  
  1802.             ErrorStatus(CPort:integer)
  1803.  
  1804.  
  1805.  
  1806.             RESULT TYPE            RESULT TYPE            ___________
  1807.  
  1808.                  byte
  1809.  
  1810.  
  1811.  
  1812.             REMARKS            REMARKS            _______
  1813.  
  1814.             Returns the last known state of the serial port's error
  1815.             status bits, encoded in a byte. These may be tested using
  1816.             the constants defined in the unit in conjunction with
  1817.             PASCAL's bitwise AND operator.  The applicable values that
  1818.             may be checked are OverRun, BadParity, and, BadFrame.  Break
  1819.             detection, i.e. the receipt of a BREAK character, is handled
  1820.             by the BreakRecd function(qv).  In the event of an error, a
  1821.             byte of $00 is returned.
  1822.  
  1823.  
  1824.             Once the error status bits have been read in this fashion,
  1825.             they are reset to $00, and will remain so until the next
  1826.             error occurs.  Since this process happens asynchronously, it
  1827.             is not possible for your application to determine which
  1828.             character created the error, only that the error occurred.
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  
  1837.  
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.                                       Page 28
  1844.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  1845.  
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  1853.  
  1854.  
  1855.             EXAMPLE            EXAMPLE            _______
  1856.  
  1857.                  Var
  1858.                     EStat : byte;
  1859.                     
  1860.                     begin
  1861.                       EStat := ErrorStatus(2);
  1862.                       if EStat and OverRun = OverRun then
  1863.                         Writeln('Receive Character Over Run');
  1864.  
  1865.  
  1866.            _______________________________________________________________           _______________________________________________________________
  1867.  
  1868.                SetModemSignals function                      LctKrnl               SetModemSignals function                      LctKrnl
  1869.            _______________________________________________________________           _______________________________________________________________
  1870.  
  1871.  
  1872.             FUNCTION            FUNCTION            ________
  1873.  
  1874.             Allows the programmer to set the individual modem control
  1875.             lines for the specified port.
  1876.  
  1877.  
  1878.  
  1879.             DECLARATION            DECLARATION            ___________
  1880.  
  1881.             SetModemSignals(CPort:integer; NewSet:byte)
  1882.  
  1883.  
  1884.  
  1885.             RESULT TYPE            RESULT TYPE            ___________
  1886.  
  1887.                  boolean
  1888.  
  1889.  
  1890.  
  1891.             REMARKS            REMARKS            _______
  1892.  
  1893.             Set one or more of the modem control signals. Because of the
  1894.             need to always have OUT2 set for interrupt support, the
  1895.             function always provides the correct setting for this bit.
  1896.  
  1897.  
  1898.             The value of NewSet is bitwise OR'ed with the current set of
  1899.             values to produce a new modem control setting.  The value of
  1900.             NewSet DOES NOT replace the current values. Use the
  1901.             constants supplied in the unit to obtain the correct values.
  1902.             These include DTR and RTS.
  1903.  
  1904.  
  1905.  
  1906.  
  1907.  
  1908.  
  1909.                                       Page 29
  1910.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  1911.  
  1912.  
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  1919.  
  1920.  
  1921.             EXAMPLE            EXAMPLE            _______
  1922.  
  1923.                  begin
  1924.                     if SetModemSignals(1, (DTR and RTS)) then
  1925.                       Writeln('Port is ready to transmit')
  1926.                     else
  1927.                       Writeln('Unable to set modem signals');
  1928.  
  1929.  
  1930.             SEE ALSO            SEE ALSO            ________
  1931.  
  1932.                  ClearModemSignals, FlipModemSignals
  1933.  
  1934.  
  1935.  
  1936.            _______________________________________________________________           _______________________________________________________________
  1937.  
  1938.                ClearModemSignals function                    LctKrnl               ClearModemSignals function                    LctKrnl
  1939.            _______________________________________________________________           _______________________________________________________________
  1940.  
  1941.  
  1942.             FUNCTION            FUNCTION            ________
  1943.  
  1944.             Allows the programmer to clear (reset) the individual modem
  1945.             control lines for the specified port.
  1946.  
  1947.  
  1948.  
  1949.             DECLARATION            DECLARATION            ___________
  1950.  
  1951.             ClearModemSignals(CPort:integer; NewSet:byte)
  1952.  
  1953.  
  1954.  
  1955.             RESULT TYPE            RESULT TYPE            ___________
  1956.  
  1957.                  boolean
  1958.  
  1959.  
  1960.  
  1961.  
  1962.  
  1963.  
  1964.  
  1965.  
  1966.  
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.                                       Page 30
  1976.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  1977.  
  1978.  
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  1985.  
  1986.  
  1987.             REMARKS            REMARKS            _______
  1988.  
  1989.             Clears (resets) one or more of the modem control signals.
  1990.             Because of the need to always have OUT2 set for interrupt
  1991.             support, the function always provides the correct setting
  1992.             for this bit.
  1993.  
  1994.  
  1995.             The compliment of NewSet is bitwise AND'ed with the current
  1996.             set of values to produce a new modem control setting.  The
  1997.             value of NewSet DOES NOT replace the current values. Use the
  1998.             constants supplied in the unit to obtain the correct values.
  1999.             These include DTR and RTS.
  2000.  
  2001.  
  2002.  
  2003.             EXAMPLE            EXAMPLE            _______
  2004.  
  2005.                  begin
  2006.                     if ClearModemSignals(1,  RTS) then
  2007.                       Writeln('RTS for Port 1 has been dropped')
  2008.                     else
  2009.                       Writeln('Unable to clear RTS');
  2010.  
  2011.  
  2012.             SEE ALSO            SEE ALSO            ________
  2013.  
  2014.                  SetModemSignals, FlipModemSignals
  2015.  
  2016.  
  2017.  
  2018.  
  2019.  
  2020.  
  2021.  
  2022.  
  2023.  
  2024.  
  2025.  
  2026.  
  2027.  
  2028.  
  2029.  
  2030.  
  2031.  
  2032.  
  2033.  
  2034.  
  2035.  
  2036.  
  2037.  
  2038.  
  2039.  
  2040.  
  2041.                                       Page 31
  2042.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  2043.  
  2044.  
  2045.  
  2046.  
  2047.  
  2048.  
  2049.  
  2050.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  2051.  
  2052.            _______________________________________________________________           _______________________________________________________________
  2053.  
  2054.                FlipModemSignals function                     LctKrnl               FlipModemSignals function                     LctKrnl
  2055.            _______________________________________________________________           _______________________________________________________________
  2056.  
  2057.  
  2058.             FUNCTION            FUNCTION            ________
  2059.  
  2060.             Allows the programmer to compliment(toggle) the individual
  2061.             modem control lines for the specified port.
  2062.  
  2063.  
  2064.  
  2065.             DECLARATION            DECLARATION            ___________
  2066.  
  2067.             FlipModemSignals(CPort:integer; NewSet:byte)
  2068.  
  2069.  
  2070.  
  2071.             RESULT TYPE            RESULT TYPE            ___________
  2072.  
  2073.                  boolean
  2074.  
  2075.  
  2076.  
  2077.             REMARKS            REMARKS            _______
  2078.  
  2079.             Complements(toggles) one or more of the modem control
  2080.             signals. Because of the need to always have OUT2 set for
  2081.             interrupt support, the function always provides the correct
  2082.             setting for this bit.
  2083.  
  2084.  
  2085.             The value of NewSet is bitwise XOR'ed with the current set
  2086.             of values to produce a new modem control setting.  The value
  2087.             of NewSet DOES NOT replace the current values. Use the
  2088.             constants supplied in the unit to obtain the correct values.
  2089.             These include DTR and RTS.
  2090.  
  2091.  
  2092.  
  2093.             EXAMPLE            EXAMPLE            _______
  2094.  
  2095.                  begin
  2096.                     if FlipModemSignals(1, RTS) then
  2097.                       Writeln('RTS for Port 1 has been changed')
  2098.                     else
  2099.                       Writeln('Unable to change RTS');
  2100.  
  2101.  
  2102.             SEE ALSO            SEE ALSO            ________
  2103.  
  2104.                  SetModemSignals, ClearModemSignals
  2105.  
  2106.  
  2107.                                       Page 32
  2108.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  2109.  
  2110.  
  2111.  
  2112.  
  2113.  
  2114.  
  2115.  
  2116.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  2117.  
  2118.            _______________________________________________________________           _______________________________________________________________
  2119.  
  2120.                EnableXon function                            LctKrnl               EnableXon function                            LctKrnl
  2121.            _______________________________________________________________           _______________________________________________________________
  2122.  
  2123.  
  2124.             FUNCTION            FUNCTION            ________
  2125.  
  2126.             Enable or disable the semi-automatic flow control features
  2127.             of LiteComm-TP
  2128.  
  2129.  
  2130.  
  2131.             DECLARATION            DECLARATION            ___________
  2132.  
  2133.             EnableXon(CPort:integer; XonFlag:boolean)
  2134.  
  2135.  
  2136.  
  2137.             RESULT TYPE            RESULT TYPE            ___________
  2138.  
  2139.                  boolean;
  2140.  
  2141.  
  2142.  
  2143.             DESCRIPTION            DESCRIPTION            ___________
  2144.  
  2145.             If XonFlag is TRUE, turns on semi-automatic XON-XOFF flow
  2146.             control function. If XonFlag is FALSE (the default setting),
  2147.             automatic flow control is disabled. When enabled, the kernel
  2148.             will automatically transmit an XOFF if and when the input
  2149.             buffer is approximately 2/3 full and will automatically
  2150.             recognize an XOFF sent by the companion system. If the
  2151.             companion system transmits an XOFF, the kernel will refuse
  2152.             to send any characters until the condition is cleared.
  2153.  
  2154.  
  2155.             It is the programmer's responsibility to transmit XON when
  2156.             conditions permit. See the XoffSent function to tell if an
  2157.             automatic XOFF has been sent by the kernel. See the XoffRecd
  2158.             function to determine if the kernel has detected an XOFF.
  2159.  
  2160.  
  2161.             If you intended to implement a protocol that might include
  2162.             the XON-XOFF characters, be sure to disable the automatic
  2163.             flow control. Failure to do so may result in a system hang.
  2164.  
  2165.  
  2166.  
  2167.             SEE ALSO            SEE ALSO            ________
  2168.  
  2169.                  XoffRecd, XoffRecd
  2170.  
  2171.  
  2172.  
  2173.                                       Page 33
  2174.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  2175.  
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  2183.  
  2184.            _______________________________________________________________           _______________________________________________________________
  2185.  
  2186.                XoffRecd function                             LctKrnl               XoffRecd function                             LctKrnl
  2187.            _______________________________________________________________           _______________________________________________________________
  2188.  
  2189.  
  2190.             FUNCTION            FUNCTION            ________
  2191.  
  2192.             Reports whether or not the kernel has detected an XOFF from
  2193.             the companion system
  2194.  
  2195.  
  2196.  
  2197.             DECLARATION            DECLARATION            ___________
  2198.  
  2199.             XoffRecd(CPort:integer)
  2200.  
  2201.  
  2202.  
  2203.             RESULT TYPE            RESULT TYPE            ___________
  2204.  
  2205.                  boolean
  2206.  
  2207.  
  2208.  
  2209.             REMARKS            REMARKS            _______
  2210.  
  2211.             Returns TRUE if an XOFF has been received, FALSE otherwise.
  2212.             If an XOFF has been received, the port's flag will be reset,
  2213.             and transmission to the companion system will be permitted.
  2214.             If an XON is received from the companion system, the port's
  2215.             flag will also be reset, permitting further transmissions to
  2216.             occur. Be aware that if the companion system never sends an
  2217.             XON after sending an XOFF, a possible race condition may                                                  race                                                                ____              
  2218.             occur, resulting in a system hang.
  2219.  
  2220.  
  2221.  
  2222.             SEE ALSO            SEE ALSO            ________
  2223.  
  2224.                  EnableXon, XoffSent
  2225.  
  2226.  
  2227.  
  2228.  
  2229.  
  2230.  
  2231.  
  2232.  
  2233.  
  2234.  
  2235.  
  2236.  
  2237.  
  2238.  
  2239.                                       Page 34
  2240.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  2241.  
  2242.  
  2243.  
  2244.  
  2245.  
  2246.  
  2247.  
  2248.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  2249.  
  2250.            _______________________________________________________________           _______________________________________________________________
  2251.  
  2252.                XoffSent function                             LctKrnl               XoffSent function                             LctKrnl
  2253.            _______________________________________________________________           _______________________________________________________________
  2254.  
  2255.  
  2256.             FUNCTION            FUNCTION            ________
  2257.  
  2258.             Reports whether or not the kernel has automatically sent an
  2259.             XOFF to the companion system.
  2260.  
  2261.  
  2262.  
  2263.             DECLARATION            DECLARATION            ___________
  2264.  
  2265.             XoffSent(CPort:integer)
  2266.  
  2267.  
  2268.  
  2269.             RESULT TYPE            RESULT TYPE            ___________
  2270.  
  2271.                  boolean
  2272.  
  2273.  
  2274.  
  2275.             REMARKS            REMARKS            _______
  2276.  
  2277.             Returns TRUE if the kernel has sent an XOFF to the companion
  2278.             system, FALSE otherwise. If an XOFF has been sent, the
  2279.             port's flag will be reset. You must send an XON character to
  2280.             the companion system to permit transmissions to proceed.
  2281.  
  2282.  
  2283.  
  2284.             SEE ALSO            SEE ALSO            ________
  2285.  
  2286.                  EnableXon, XoffRecd
  2287.  
  2288.  
  2289.  
  2290.  
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298.  
  2299.  
  2300.  
  2301.  
  2302.  
  2303.  
  2304.  
  2305.                                       Page 35
  2306.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  2307.  
  2308.  
  2309.  
  2310.  
  2311.  
  2312.  
  2313.  
  2314.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  2315.  
  2316.            _______________________________________________________________           _______________________________________________________________
  2317.  
  2318.                LctGet function                               LctSupp               LctGet function                               LctSupp
  2319.            _______________________________________________________________           _______________________________________________________________
  2320.  
  2321.  
  2322.             FUNCTION            FUNCTION            ________
  2323.  
  2324.             Returns an available character from the ports input buffer.
  2325.  
  2326.  
  2327.  
  2328.             DECLARATION            DECLARATION            ___________
  2329.  
  2330.             LctGet(CPort:integer; var Ch:byte)
  2331.  
  2332.  
  2333.  
  2334.             RESULT TYPE            RESULT TYPE            ___________
  2335.  
  2336.                  boolean
  2337.  
  2338.  
  2339.  
  2340.             REMARKS            REMARKS            _______
  2341.  
  2342.             Places the next available character in the input buffer for
  2343.             the port in Ch. The function returns a value of TRUE if
  2344.             there is a character available, FALSE if there is no
  2345.             character available or on an error.  The contents of Ch are
  2346.             undefined when the return is FALSE.
  2347.  
  2348.  
  2349.  
  2350.  
  2351.  
  2352.  
  2353.  
  2354.  
  2355.  
  2356.  
  2357.  
  2358.  
  2359.  
  2360.  
  2361.  
  2362.  
  2363.  
  2364.  
  2365.  
  2366.  
  2367.  
  2368.  
  2369.  
  2370.  
  2371.                                       Page 36
  2372.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  2373.  
  2374.  
  2375.  
  2376.  
  2377.  
  2378.  
  2379.  
  2380.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  2381.  
  2382.            _______________________________________________________________           _______________________________________________________________
  2383.  
  2384.                LctPeek function                              LctSupp               LctPeek function                              LctSupp
  2385.            _______________________________________________________________           _______________________________________________________________
  2386.  
  2387.  
  2388.             FUNCTION            FUNCTION            ________
  2389.  
  2390.             Permits you to look at the next character in the ports input
  2391.             buffer without removing if from the buffer.
  2392.  
  2393.  
  2394.  
  2395.             DECLARATION            DECLARATION            ___________
  2396.  
  2397.             LctPeek(CPort:integer; var Ch:byte)
  2398.  
  2399.  
  2400.  
  2401.             RESULT TYPE            RESULT TYPE            ___________
  2402.  
  2403.                  boolean
  2404.  
  2405.  
  2406.  
  2407.             REMARKS            REMARKS            _______
  2408.  
  2409.             Places the next available character in the input buffer for
  2410.             the specified port into the Ch variable, but does not remove
  2411.             the character from the buffer. This allows the application
  2412.             to look-ahead by one character in a non-destructive fashion.               look-ahead                                                              __________                                               
  2413.             Returns FALSE if the port is not active, or if there are no
  2414.             characters in the port's buffer, TRUE otherwise. The
  2415.             contents of Ch are undefined when the result is FALSE
  2416.  
  2417.  
  2418.  
  2419.  
  2420.  
  2421.  
  2422.  
  2423.  
  2424.  
  2425.  
  2426.  
  2427.  
  2428.  
  2429.  
  2430.  
  2431.  
  2432.  
  2433.  
  2434.  
  2435.  
  2436.  
  2437.                                       Page 37
  2438.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  2439.  
  2440.  
  2441.  
  2442.  
  2443.  
  2444.  
  2445.  
  2446.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  2447.  
  2448.            _______________________________________________________________           _______________________________________________________________
  2449.  
  2450.                LctPut function                               LctSupp               LctPut function                               LctSupp
  2451.            _______________________________________________________________           _______________________________________________________________
  2452.  
  2453.  
  2454.             FUNCTION            FUNCTION            ________
  2455.  
  2456.             Places a character in the port's transmit buffer to be sent
  2457.             when the port is ready.
  2458.  
  2459.  
  2460.  
  2461.             DECLARATION            DECLARATION            ___________
  2462.  
  2463.             LctPut(CPort:integer; Ch:byte)
  2464.  
  2465.  
  2466.  
  2467.             RESULT TYPE            RESULT TYPE            ___________
  2468.  
  2469.                  boolean
  2470.  
  2471.  
  2472.  
  2473.             REMARKS            REMARKS            _______
  2474.  
  2475.             Returns TRUE if successful. Note that this does not
  2476.             guarantee that the character has been sent, only that no
  2477.             errors were detected. Returns FALSE if the port is not
  2478.             active, or if there no room in the port's buffer.
  2479.  
  2480.  
  2481.  
  2482.  
  2483.  
  2484.  
  2485.  
  2486.  
  2487.  
  2488.  
  2489.  
  2490.  
  2491.  
  2492.  
  2493.  
  2494.  
  2495.  
  2496.  
  2497.  
  2498.  
  2499.  
  2500.  
  2501.  
  2502.  
  2503.                                       Page 38
  2504.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  2505.  
  2506.  
  2507.  
  2508.  
  2509.  
  2510.  
  2511.  
  2512.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  2513.  
  2514.            _______________________________________________________________           _______________________________________________________________
  2515.  
  2516.                GetStream function                            LctSupp               GetStream function                            LctSupp
  2517.            _______________________________________________________________           _______________________________________________________________
  2518.  
  2519.  
  2520.             FUNCTION            FUNCTION            ________
  2521.  
  2522.             Gets a stream of N characters from the port's input buffer
  2523.  
  2524.  
  2525.  
  2526.             DECLARATION            DECLARATION            ___________
  2527.  
  2528.             GetStream(CPort:integer; var Buff; BCnt:integer)
  2529.  
  2530.  
  2531.  
  2532.             RESULT TYPE            RESULT TYPE            ___________
  2533.  
  2534.                  integer
  2535.  
  2536.  
  2537.  
  2538.             REMARKS            REMARKS            _______
  2539.  
  2540.             Reads a stream of, at most, BCnt characters from the serial
  2541.             port's input buffer into the Buff array. Returns the count
  2542.             of characters actually transferred, or -1 if an error
  2543.             occurs. NOTE that Buff is an array of characters or bytes,
  2544.             not a string, although you may treat a string variable like
  2545.             an array, as shown below.
  2546.  
  2547.  
  2548.  
  2549.             EXAMPLE            EXAMPLE            _______
  2550.  
  2551.                  Type
  2552.                     MaxStr = string[256];
  2553.                     
  2554.                     Var
  2555.                       StrBuff : MaxStr;
  2556.                       RecdLen : integer;
  2557.                     
  2558.                     begin
  2559.                       RecdLen := GetStream(2, StrBuff[1], 256);
  2560.                       if RecdLen <M=> 0 then     { error or no char
  2561.                     }
  2562.                         StrBuff[0] := 0
  2563.                       else
  2564.                         StrBuff[0] := Chr(RecdLen);
  2565.                     end;
  2566.  
  2567.  
  2568.  
  2569.                                       Page 39
  2570.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  2571.  
  2572.  
  2573.  
  2574.  
  2575.  
  2576.  
  2577.  
  2578.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  2579.  
  2580.            _______________________________________________________________           _______________________________________________________________
  2581.  
  2582.                PutStream function                            LctSupp               PutStream function                            LctSupp
  2583.            _______________________________________________________________           _______________________________________________________________
  2584.  
  2585.  
  2586.             FUNCTION            FUNCTION            ________
  2587.  
  2588.             Places a stream of, at most, N characters in the port's
  2589.             transmit buffer.
  2590.  
  2591.  
  2592.  
  2593.             DECLARATION            DECLARATION            ___________
  2594.  
  2595.             PutStream(CPort:integer; var Buff; BCnt:integer)
  2596.  
  2597.  
  2598.  
  2599.             RESULT TYPE            RESULT TYPE            ___________
  2600.  
  2601.                  integer
  2602.  
  2603.  
  2604.  
  2605.             REMARKS            REMARKS            _______
  2606.  
  2607.             Buff is an array of character or byte, not a string,
  2608.             although it is possible to specify a string variable, using
  2609.             the same approach as outlined for the GetStream function.
  2610.             PutStream returns the number of characters actually placed
  2611.             into the buffer. Note that this does not guarantee that the
  2612.             characters have been sent. A value of 0 will be returned if
  2613.             any error occurs, or if there no room in the port's buffer.
  2614.  
  2615.  
  2616.  
  2617.             SEE ALSO            SEE ALSO            ________
  2618.  
  2619.                  PutStream
  2620.  
  2621.  
  2622.  
  2623.  
  2624.  
  2625.  
  2626.  
  2627.  
  2628.  
  2629.  
  2630.  
  2631.  
  2632.  
  2633.  
  2634.  
  2635.                                       Page 40
  2636.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  2637.  
  2638.  
  2639.  
  2640.  
  2641.  
  2642.  
  2643.  
  2644.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  2645.  
  2646.            _______________________________________________________________           _______________________________________________________________
  2647.  
  2648.                Buffer Flushing functions                     LctSupp               Buffer Flushing functions                     LctSupp
  2649.            _______________________________________________________________           _______________________________________________________________
  2650.  
  2651.  
  2652.             FUNCTION            FUNCTION            ________
  2653.             Provides several high level buffer management functions to
  2654.             control the contents of the port's transmit and receive
  2655.             buffers
  2656.  
  2657.  
  2658.             DELCLARATION            DELCLARATION            ____________
  2659.  
  2660.             function PurgeTxBuff(CPort:integer)
  2661.             
  2662.             function PurgeRxBuff(CPort:integer)
  2663.             
  2664.             procedure FlushUntilMatch(CPort:integer; Ch:byte)
  2665.             
  2666.             procedure FlushNBytes(CPort:integer; N:integer);
  2667.  
  2668.  
  2669.  
  2670.             RESULT TYPE            RESULT TYPE            ___________
  2671.  
  2672.                  boolean for PurgeTxBuff, PurgeRxBuff
  2673.  
  2674.  
  2675.  
  2676.             REMARKS            REMARKS            _______
  2677.  
  2678.             The PurgeRxBuff and PurgeTxBuff functions remove all
  2679.             characters from the port's receive and transmit buffers
  2680.             respectively and discard them; untransmitted characters in
  2681.             the transmit buffer are NEVER sent; unprocessed characters
  2682.             in the receive buffer are lost.  Both functions return a
  2683.             value of TRUE if no errors were encountered, FALSE
  2684.             otherwise.  An empty buffer is NOT considered an error.
  2685.  
  2686.  
  2687.             The FlushUntilMatch procedure will continually dispose of
  2688.             received characters until the character Ch is received. The
  2689.             procedure will return when the character Ch is detected, or
  2690.             when there are no more characters in the port's input
  2691.             buffer.
  2692.  
  2693.  
  2694.             The FlushNBytes procedure removes, at most, N characters
  2695.             from the port's receive buffer.
  2696.  
  2697.  
  2698.  
  2699.  
  2700.  
  2701.                                       Page 41
  2702.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  2703.  
  2704.  
  2705.  
  2706.  
  2707.  
  2708.  
  2709.  
  2710.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  2711.  
  2712.            _______________________________________________________________           _______________________________________________________________
  2713.  
  2714.                SendBreak function                            LctKrnl               SendBreak function                            LctKrnl
  2715.            _______________________________________________________________           _______________________________________________________________
  2716.  
  2717.  
  2718.             FUNCTION            FUNCTION            ________
  2719.  
  2720.             Send a true Break signal
  2721.  
  2722.  
  2723.  
  2724.             DECLARATION            DECLARATION            ___________
  2725.  
  2726.             SendBreak(CPort:integer)
  2727.  
  2728.  
  2729.  
  2730.             RESULT TYPE            RESULT TYPE            ___________
  2731.  
  2732.                  boolean
  2733.  
  2734.  
  2735.  
  2736.             REMARKS            REMARKS            _______
  2737.  
  2738.             SendBreak generates a BREAK signal using a particular
  2739.             characteristic of the 8250 UART to generate an accurate
  2740.             BREAK at any baud rate.  BREAKS generated in this manner are
  2741.             timed based upon the baud rate at which the 8250 is
  2742.             currently initialized.  This function may or may not work
  2743.             correctly with other than the actual 8250 UART.
  2744.  
  2745.  
  2746.             Returns TRUE if successful. Returns FALSE if an error is
  2747.             detected.
  2748.  
  2749.  
  2750.  
  2751.  
  2752.  
  2753.  
  2754.  
  2755.  
  2756.  
  2757.  
  2758.  
  2759.  
  2760.  
  2761.  
  2762.  
  2763.  
  2764.  
  2765.  
  2766.  
  2767.                                       Page 42
  2768.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  2769.  
  2770.  
  2771.  
  2772.  
  2773.  
  2774.  
  2775.  
  2776.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  2777.  
  2778.  
  2779.             BBS Functions
  2780.  
  2781.  
  2782.  
  2783.            _______________________________________________________________           _______________________________________________________________
  2784.  
  2785.                CheckEvent Function                            LctBBS               CheckEvent Function                            LctBBS
  2786.            _______________________________________________________________           _______________________________________________________________
  2787.  
  2788.  
  2789.             FUNCTION            FUNCTION            ________
  2790.  
  2791.             Returns a value of TRUE is the Event Timer specified in the
  2792.             function call has not expired.  Returns a value of FALSE if
  2793.             the specified Event Timer has expired.
  2794.  
  2795.  
  2796.  
  2797.             DECLARATION            DECLARATION            ___________
  2798.  
  2799.             CheckEvent(EventVal : Event);
  2800.  
  2801.  
  2802.  
  2803.             RESULT TYPE            RESULT TYPE            ___________
  2804.  
  2805.                  boolean;
  2806.  
  2807.  
  2808.  
  2809.             REMARKS            REMARKS            _______
  2810.  
  2811.             The event timer specified by EventVal must have been set
  2812.             using the NewEvent function
  2813.  
  2814.  
  2815.  
  2816.             SEE ALSO            SEE ALSO            ________
  2817.  
  2818.             NewEvent
  2819.  
  2820.  
  2821.  
  2822.  
  2823.  
  2824.  
  2825.  
  2826.  
  2827.  
  2828.  
  2829.  
  2830.  
  2831.  
  2832.  
  2833.                                       Page 43
  2834.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  2835.  
  2836.  
  2837.  
  2838.  
  2839.  
  2840.  
  2841.  
  2842.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  2843.  
  2844.            _______________________________________________________________           _______________________________________________________________
  2845.  
  2846.                NewEvent Function                              LctBBS               NewEvent Function                              LctBBS
  2847.            _______________________________________________________________           _______________________________________________________________
  2848.  
  2849.  
  2850.             FUNCTION            FUNCTION            ________
  2851.  
  2852.             Initializes an event timer to a value suitable for use with
  2853.             CheckEvent.  The event timer created in this fashion can
  2854.             time events up to 32767 seconds in duration.
  2855.  
  2856.  
  2857.  
  2858.             DECLARATION            DECLARATION            ___________
  2859.  
  2860.             NewEvent(Seconds : integer);
  2861.  
  2862.  
  2863.  
  2864.             RESULT TYPE            RESULT TYPE            ___________
  2865.  
  2866.                  Event;
  2867.  
  2868.  
  2869.  
  2870.             REMARKS            REMARKS            _______
  2871.  
  2872.             When used in conjunction with CheckEvent, the event timer
  2873.             can be used to time events that span days, months or years.
  2874.             Actually, it should be termed a timeout timer, since
  2875.             CheckEvent checks to see if the period specified by Seconds
  2876.             has elapsed.
  2877.  
  2878.  
  2879.  
  2880.             EXAMPLE            EXAMPLE            _______
  2881.  
  2882.                  var
  2883.                     InputEvent : Event;
  2884.                     Ch : byte;
  2885.                     
  2886.                     begin
  2887.                       InputEvent := NewEvent(15);
  2888.                       while CheckEvent(InputEvent) do
  2889.                            if LctGet(Port, Ch) then
  2890.                                 exit;
  2891.                       WriteLn('No Input Received in 15 seconds');
  2892.                     end;
  2893.  
  2894.  
  2895.  
  2896.  
  2897.  
  2898.  
  2899.                                       Page 44
  2900.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  2901.  
  2902.  
  2903.  
  2904.  
  2905.  
  2906.  
  2907.  
  2908.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  2909.  
  2910.            _______________________________________________________________           _______________________________________________________________
  2911.  
  2912.                CheckForCall Function                          LctBBS               CheckForCall Function                          LctBBS
  2913.            _______________________________________________________________           _______________________________________________________________
  2914.  
  2915.  
  2916.             FUNCTION            FUNCTION            ________
  2917.  
  2918.             'Listens' to the specified port to see if the telephone is
  2919.             ringing.  If the phone is ringing, waits for up to 30
  2920.             seconds for a successful connection to be established.
  2921.  
  2922.  
  2923.  
  2924.             DECLARATION            DECLARATION            ___________
  2925.  
  2926.             CheckForCall(CPort : integer);
  2927.  
  2928.  
  2929.  
  2930.             RESULT TYPE            RESULT TYPE            ___________
  2931.  
  2932.                  integer;
  2933.  
  2934.  
  2935.  
  2936.             REMARKS            REMARKS            _______
  2937.  
  2938.             This function will return a value of -1 if the phone is not
  2939.             ringing, or if the modem fails to respond to the call within
  2940.             the 30 second period allowed.  In all other cases the
  2941.             function returns the result code that was returned by the
  2942.             modem itself.  It is the programmer's responsibility to
  2943.             correctly recognize and react to the various codes. In the
  2944.             case of a failure of the modem to respond, this function
  2945.             will automatically attempt to disconnect and reset the
  2946.             modem.
  2947.  
  2948.  
  2949.             The function assumes that the modem has been present to use
  2950.             numeric result codes, and that the S0 register (number of
  2951.             rings before answering) has not been set to zero.  The
  2952.             function ResetModem sets the correct values to match these
  2953.             assumptions.  CAUTION - do not attempt to use this function
  2954.             on ports not connected to a modem.  The function examines
  2955.             the modem control status lines and may behave in a
  2956.             unpredictable fashion if not connected to a modem.
  2957.  
  2958.  
  2959.  
  2960.  
  2961.  
  2962.  
  2963.  
  2964.  
  2965.                                       Page 45
  2966.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  2967.  
  2968.  
  2969.  
  2970.  
  2971.  
  2972.  
  2973.  
  2974.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  2975.  
  2976.  
  2977.             EXAMPLE            EXAMPLE            _______
  2978.  
  2979.                  var
  2980.                     ModemResult : integer;
  2981.                     
  2982.                     begin
  2983.                       repeat
  2984.                            ModemResult := CheckForCall(CPort);
  2985.                            if ModemResult = -1 then
  2986.                                 Delay(1000);  (* settling time*)
  2987.                       until ModemResult <> -1;
  2988.                       Writeln('Modem reply to call was ',
  2989.                     ModemResult:2);
  2990.                     end;
  2991.  
  2992.  
  2993.             SEE ALSO            SEE ALSO            ________
  2994.  
  2995.             Disconnect, ResetModem
  2996.  
  2997.  
  2998.  
  2999.  
  3000.  
  3001.  
  3002.  
  3003.  
  3004.  
  3005.  
  3006.  
  3007.  
  3008.  
  3009.  
  3010.  
  3011.  
  3012.  
  3013.  
  3014.  
  3015.  
  3016.  
  3017.  
  3018.  
  3019.  
  3020.  
  3021.  
  3022.  
  3023.  
  3024.  
  3025.  
  3026.  
  3027.  
  3028.  
  3029.  
  3030.  
  3031.                                       Page 46
  3032.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  3033.  
  3034.  
  3035.  
  3036.  
  3037.  
  3038.  
  3039.  
  3040.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  3041.  
  3042.            _______________________________________________________________           _______________________________________________________________
  3043.  
  3044.                Disconnect Procedure                           LctBBS               Disconnect Procedure                           LctBBS
  3045.            _______________________________________________________________           _______________________________________________________________
  3046.  
  3047.  
  3048.             FUNCTION            FUNCTION            ________
  3049.  
  3050.             Causes the modem to disconnect from the caller.
  3051.  
  3052.  
  3053.  
  3054.             DECLARATION            DECLARATION            ___________
  3055.  
  3056.             Disconnect(CPort : integer);
  3057.  
  3058.  
  3059.  
  3060.             REMARKS            REMARKS            _______
  3061.  
  3062.             Forceablly disconnects the modem by dropping the DTR (Data
  3063.             Terminal Ready) modem status signal for 1 second.  This
  3064.             action will cause most modems to drop carrier and force the
  3065.             phone on-hook.  Please not that if the modem has been
  3066.             optioned with DTR permanently set on or ignored, this
  3067.             procedure will have no effect.
  3068.  
  3069.  
  3070.  
  3071.  
  3072.  
  3073.  
  3074.  
  3075.  
  3076.  
  3077.  
  3078.  
  3079.  
  3080.  
  3081.  
  3082.  
  3083.  
  3084.  
  3085.  
  3086.  
  3087.  
  3088.  
  3089.  
  3090.  
  3091.  
  3092.  
  3093.  
  3094.  
  3095.  
  3096.  
  3097.                                       Page 47
  3098.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  3099.  
  3100.  
  3101.  
  3102.  
  3103.  
  3104.  
  3105.  
  3106.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  3107.  
  3108.            _______________________________________________________________           _______________________________________________________________
  3109.  
  3110.                ResetModem Function                            LctBBS               ResetModem Function                            LctBBS
  3111.            _______________________________________________________________           _______________________________________________________________
  3112.  
  3113.  
  3114.             FUNCTION            FUNCTION            ________
  3115.  
  3116.             Returns the modem to a known set of parameters, suitable for
  3117.             use with the related functions in this unit.  See the typed
  3118.             constants MODEMSET0 thru MODEMSET2 in the interface portion
  3119.             of the unit.
  3120.  
  3121.  
  3122.  
  3123.             DECLARATION            DECLARATION            ___________
  3124.  
  3125.             ResetModem(CPort, : integer);
  3126.  
  3127.  
  3128.  
  3129.             RESULT TYPE            RESULT TYPE            ___________
  3130.  
  3131.                  integer;
  3132.  
  3133.  
  3134.  
  3135.             REMARKS            REMARKS            _______
  3136.  
  3137.             The modem is reset to a known state, including, but not
  3138.             limited to 1) answer on the first ring, 2) numeric result
  3139.             codes, 3) extended code set.  The function returns the
  3140.             result of the reset operation (a modem response code) or -1
  3141.             if the modem fails to respond.  This function and related
  3142.             functions are suitable for use only with HAYES-type modems.
  3143.             It is the programmer's responsibility to interpret the
  3144.             result code returned.
  3145.  
  3146.  
  3147.  
  3148.             SEE ALSO            SEE ALSO            ________
  3149.  
  3150.             GetModemReply
  3151.  
  3152.  
  3153.  
  3154.  
  3155.  
  3156.  
  3157.  
  3158.  
  3159.  
  3160.  
  3161.  
  3162.  
  3163.                                       Page 48
  3164.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  3165.  
  3166.  
  3167.  
  3168.  
  3169.  
  3170.  
  3171.  
  3172.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  3173.  
  3174.            _______________________________________________________________           _______________________________________________________________
  3175.  
  3176.                GetModemReply Function                         LctBBS               GetModemReply Function                         LctBBS
  3177.            _______________________________________________________________           _______________________________________________________________
  3178.  
  3179.  
  3180.             FUNCTION            FUNCTION            ________
  3181.  
  3182.             Returns the modem's response to the last set of instructions
  3183.             that were issued to the modem, in numeric form.
  3184.  
  3185.  
  3186.  
  3187.             DECLARATION            DECLARATION            ___________
  3188.  
  3189.             GetModemReply(CPort : integer);
  3190.  
  3191.  
  3192.  
  3193.             RESULT TYPE            RESULT TYPE            ___________
  3194.  
  3195.                  integer;
  3196.  
  3197.  
  3198.  
  3199.             REMARKS            REMARKS            _______
  3200.  
  3201.             This function expects the modem to be returning numeric
  3202.             result codes (set ResetModem) of up to 2 digits.  The
  3203.             function will react to 2 digits returned or the first <CR>
  3204.             returned, whichever occurs first within a 1 second timeout
  3205.             period.  In the case that the modem does not respond in the
  3206.             timeout period, the function returns a value of -1.  In no
  3207.             case does the function attempt to evaluate the
  3208.             response...this is left to the programmer.
  3209.  
  3210.  
  3211.  
  3212.             SEE ALSO            SEE ALSO            ________
  3213.  
  3214.             ResetModem.
  3215.  
  3216.  
  3217.  
  3218.  
  3219.  
  3220.  
  3221.  
  3222.  
  3223.  
  3224.  
  3225.  
  3226.  
  3227.  
  3228.  
  3229.                                       Page 49
  3230.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  3231.  
  3232.  
  3233.  
  3234.  
  3235.  
  3236.  
  3237.  
  3238.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  3239.  
  3240.  
  3241.             
  3242.  
  3243.  
  3244.  
  3245.            _______________________________________________________________           _______________________________________________________________
  3246.  
  3247.                HAYES MODEM FUNCTIONS                        LctHayes               HAYES MODEM FUNCTIONS                        LctHayes
  3248.            _______________________________________________________________           _______________________________________________________________
  3249.  
  3250.  
  3251.             FUNCTION            FUNCTION            ________
  3252.  
  3253.             Provides support for various aspects of modems the support
  3254.             the Hayes(Tm) command set.
  3255.  
  3256.  
  3257.  
  3258.             DECLARATIONS            DECLARATIONS            ____________
  3259.  
  3260.                  const
  3261.                       NUMRES = 0     { numeric result codes}
  3262.                       WRDRES = 1     { word result codes }
  3263.                       SPKOFF = 0     { speaker off }
  3264.                       SPKON  = 1     { speaker on until CD }
  3265.                       SPKSPC = 2     { speaker always on }
  3266.                       ONHK   = 0     { go on-hook (hang up) }
  3267.                       OFFHK  = 1     { go off-hook (lift receiver)
  3268.                     }
  3269.                       OFFHKS = 2     { go off-hook, don't close
  3270.                     relay }
  3271.                       BASIC  = 0     { basic result set }
  3272.                       EXSET1 = 1     { extended results, set 1 }
  3273.                       EXSET3 = 2     { extended results, set 3 }
  3274.                       EXSET4 = 3     { extended results, set 4 }
  3275.                     
  3276.  
  3277.                  type
  3278.                       TelNumStr = string[20];
  3279.                     
  3280.  
  3281.  
  3282.  
  3283.  
  3284.  
  3285.  
  3286.  
  3287.  
  3288.  
  3289.  
  3290.  
  3291.  
  3292.  
  3293.  
  3294.  
  3295.                                       Page 50
  3296.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  3297.  
  3298.  
  3299.  
  3300.  
  3301.  
  3302.  
  3303.  
  3304.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  3305.  
  3306.  
  3307.             procedure SetType(NType : byte)
  3308.             
  3309.             procedure SetSet(NSet : byte)
  3310.             
  3311.             function RetType : byte
  3312.             
  3313.             function RetSet : byte
  3314.             
  3315.             function ModemCodesOn(CPort : integer):boolean
  3316.             
  3317.             function ModemCodesOff(CPort : integer):boolean
  3318.             
  3319.             function ModemWordResponse(CPort : integer):boolean
  3320.             
  3321.             function ModemDigitResponse(CPort : integer):boolean
  3322.             
  3323.             function RepeatModemCommand(CPort : integer):boolean
  3324.             
  3325.             function ModemSpeaker(CPort : integer; Mode : byte):boolean
  3326.             
  3327.             function SetModemRegister(CPort, Reg, NValue : integer) :
  3328.             boolean
  3329.             
  3330.             function GetModemRegister(CPort, Reg, NValue : integer) :
  3331.             boolean
  3332.             
  3333.             function ModemHalfDuplex(CPort : integer) : boolean
  3334.             
  3335.             function ModemFullDuplex(CPort : integer) : boolean
  3336.             
  3337.             function ModemEchoCmd(CPort : integer) : boolean
  3338.             
  3339.             function ModemNoEchoCmd(CPort : integer) : boolean
  3340.             
  3341.             function ModemHookMode(CPort : integer; HMode : byte) :
  3342.             boolean
  3343.             
  3344.             function ModemCarrierOn(CPort : integer) : boolean
  3345.             
  3346.             function ModemCarrierOff(CPort : integer) : boolean
  3347.             
  3348.             function ModemWordResponse(CPort : integer):boolean
  3349.             
  3350.             function ModemDigitResponse(CPort : integer):boolean
  3351.             
  3352.             function RepeatModemCommand(CPort : integer):boolean
  3353.             
  3354.             function ModemSpeaker(CPort : integer; Mode : byte):boolean
  3355.             
  3356.             function SetModemRegister(CPort, Reg, NValue : integer) :
  3357.             boolean
  3358.             
  3359.  
  3360.  
  3361.                                       Page 51
  3362.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  3363.  
  3364.  
  3365.  
  3366.  
  3367.  
  3368.  
  3369.  
  3370.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  3371.  
  3372.  
  3373.             function GetModemRegister(CPort, Reg, NValue : integer) :
  3374.             boolean
  3375.             
  3376.             function ModemHalfDuplex(CPort : integer) : boolean
  3377.             
  3378.             function ModemFullDuplex(CPort : integer) : boolean
  3379.             
  3380.             function ModemEchoCmd(CPort : integer) : boolean
  3381.             
  3382.             function ModemNoEchoCmd(CPort : integer) : boolean
  3383.             
  3384.             function ModemHookMode(CPort : integer; HMode : byte) :
  3385.             boolean
  3386.             
  3387.             function ModemCarrierOn(CPort : integer) : boolean
  3388.             
  3389.             function ModemCarrierOff(CPort : integer) : boolean
  3390.             
  3391.             function ModemCodeSet(CPort : integer; NewSet : byte) :
  3392.             boolean
  3393.             
  3394.             function ModemPulse(CPort : integer) : boolean
  3395.             
  3396.             function ModemTone(CPort : integer) : boolean
  3397.             
  3398.             function ModemDial(CPort : integer; TelNo : TelNumStr) :
  3399.             boolean
  3400.  
  3401.  
  3402.  
  3403.             REMARKS            REMARKS            _______
  3404.  
  3405.             The ModemCodeSet function allows you to change the set of
  3406.             codes that are returned by the modem when an action is
  3407.             specified.
  3408.  
  3409.  
  3410.             ModemDial instructs the modem to dial the number contained
  3411.             in TelNo. Do not include the dialing (ATD) prefix, or the
  3412.             trailing <CR>. These are provided by the function. You may
  3413.             include non-numeric characters as the contents of TelNo are
  3414.             not checked. The dialing is done in the last known, pulse or
  3415.             tone, mode. If you use the Modempulse or ModemTone
  3416.             functions, then dialing will be done in the mode that was
  3417.             last correctly enabled. If you have not exercised these
  3418.             functions, then dialing occurs in the modems default or
  3419.             power-up mode.
  3420.  
  3421.  
  3422.             The ModemHalfDuplex and ModemFullDuplex functions place the
  3423.             modem into local echo and remote echo modes respectively.
  3424.  
  3425.  
  3426.  
  3427.                                       Page 52
  3428.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  3429.  
  3430.  
  3431.  
  3432.  
  3433.  
  3434.  
  3435.  
  3436.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  3437.  
  3438.  
  3439.             The GetModemRegister function requests that the modem return
  3440.             the current value of S-register Reg. Reg must be in the
  3441.             range 0 to 13. Use the GetStream, or similar function, to
  3442.             retrieve the modem's response. Specifying a register outside
  3443.             the 0 to 13 range will cause a return of FALSE.
  3444.  
  3445.  
  3446.             SetModemRegister is the companion to GetModemRegister, with
  3447.             the same restrictions. Sets the S-register Reg to the value
  3448.             contained in NValue. If NValue contains -1, then the
  3449.             register is reset to its default (power-up) value. The
  3450.             function checks the value to be certain that it is within
  3451.             the limits specified for the particular register, and
  3452.             returns a value of FALSE if the value is outside the
  3453.             predefined limits.
  3454.  
  3455.  
  3456.             ModemCarrierOff enables modem carrier detect, but disables
  3457.             the modems carrier signal. The ModemCarrierOn companion
  3458.             enables both carrier detect and the modems carrier signal.
  3459.             When ModemCarrierOff is used the modem will receive data but
  3460.             will be unable to send data.
  3461.  
  3462.  
  3463.             The ModemNoEchoCmd and ModemEchoCmd functions determine
  3464.             whether commands sent to the modem are echoed back to the
  3465.             sending program. With echo turned off, the modem will
  3466.             continue to accept commands, but will not try to redisplay
  3467.             the command's characters.
  3468.  
  3469.  
  3470.             ModemHookMode allows you to control the current status of
  3471.             the modem's telephone line connection. See your modem's
  3472.             documentation and the above constants for additional
  3473.             information.
  3474.  
  3475.  
  3476.             The ModemRepeatCommand function instructs the modem to
  3477.             repeat the last command sequence executed. Generally, this
  3478.             function is of greatest value in re-dialing numbers that are
  3479.             busy, although its use is not restricted to that.
  3480.  
  3481.  
  3482.             The way in which your modem responds to commands is
  3483.             determined, in part, by the ModemWordResponse and
  3484.             ModemDigitResponse functions. If you call ModemWordResponse,
  3485.             then modem responses use the English language response
  3486.             codes, e.g. CONNECT or OK. Calling ModemDigitResponse
  3487.             instructs the modem to respond with code numbers only from
  3488.             the currently selected response set, see the ModemCodeSet
  3489.             function above.
  3490.  
  3491.  
  3492.  
  3493.                                       Page 53
  3494.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  3495.  
  3496.  
  3497.  
  3498.  
  3499.  
  3500.  
  3501.  
  3502.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  3503.  
  3504.  
  3505.             You may use the functions ModemCodesOn and ModemCodesOff to
  3506.             specify whether you want your modem to send back response
  3507.             codes when it receives a command string. In a sense, these
  3508.             act as companions to the EchoCmd functions above.
  3509.  
  3510.  
  3511.             Use the ModemSpeaker function to control the modem's
  3512.             internal speaker, if it has one. See the above constants for
  3513.             the applicable codes.
  3514.  
  3515.  
  3516.             The RetSet and RetType functions return, respectively, the
  3517.             last known command set (ModemCodeSet) and last known result
  3518.             type (ModemWordResponse, ModemDigitResponse). The RetSet and
  3519.             RetType  functions are only of value when used in
  3520.             conjunction with the companion functions.
  3521.  
  3522.  
  3523.  
  3524.             GENERAL REMARKS            GENERAL REMARKS            _______________
  3525.  
  3526.             Several considerations are in order if you intend to use the
  3527.             Hayes ToolBox functions.
  3528.  
  3529.  
  3530.  
  3531.                 1. You are responsible for checking the return
  3532.                    codes from the modem once you have given modem a
  3533.                    command. To make the task easier, we suggest
  3534.                    that you turn OFF command echo (so that you
  3535.                    don't have to worry about separating commands
  3536.                    from responses) and turn ON numeric responses
  3537.                    (to make the interpretation of result codes
  3538.                    easier and faster).
  3539.  
  3540.  
  3541.                 2. Be sure that you allow  adequate time between
  3542.                    commands for the modem to process the command
  3543.                    and respond. Failure to observe this rule may
  3544.                    result in commands being misinterpreted or
  3545.                    "lost". You can monitor the number of characters
  3546.                    in the receive buffer to help you with the
  3547.                    timing. Or alternatively, check the response
  3548.                    after each command. The latter approach is more
  3549.                    in line with what we believe to be good
  3550.                    programming practice.
  3551.  
  3552.  
  3553.             RETURN VALUES            RETURN VALUES            _____________
  3554.  
  3555.             All functions return a value of FALSE if a port or other
  3556.             error is detected, TRUE otherwise.
  3557.  
  3558.  
  3559.                                       Page 54
  3560.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  3561.  
  3562.  
  3563.  
  3564.  
  3565.  
  3566.  
  3567.  
  3568.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  3569.  
  3570.  
  3571.                            LITECOMM-TP REGISTRATION FORM                           LITECOMM-TP REGISTRATION FORM                           _____________________________
  3572.  
  3573.             Please complete the following information. Note that the
  3574.             prices below are for a single-use registration only. Please
  3575.             contact us directly for site licensing.
  3576.  
  3577.             Mail to:
  3578.                  Information Technology
  3579.                  PO Box 554
  3580.                  Coventry, RI 02816
  3581.                  Telephone Orders or Information (401) 826-2223
  3582.             
  3583.              SHIP TO:
  3584.              Name    ________________________________________
  3585.             
  3586.              Company ________________________________________
  3587.             
  3588.              Street  ________________________________________
  3589.             
  3590.                      ________________________________________
  3591.             
  3592.              City    ___________________  State __  Zip _____
  3593.             
  3594.              Telephone _______________________
  3595.             
  3596.             
  3597.                QTY     REGISTRATION TYPE   REGISTRATION FEE
  3598.             
  3599.                        LIBRARIES @ $25    
  3600.             
  3601.                        LIBRARIES AND
  3602.                        SOURCE  @ $50      
  3603.             [ ] Check here for 3.5" disks, add $1.00
  3604.             RI residents, Sales Tax 6%    
  3605.             
  3606.             
  3607.             Method of Payment (Check, Mastercard, Visa) _____________
  3608.             
  3609.                  Credit Card Number __________________________
  3610.             
  3611.                  Expiration Date __________________________
  3612.             
  3613.                  Name as it appears on card ___________________________
  3614.             
  3615.                  Signature for MC/VISA ________________________________
  3616.             
  3617.             All MasterCard/Visa orders must include a telephone number,
  3618.             
  3619.             We regret that we cannot accept COD orders
  3620.             (office use only)
  3621.                 Date Received ______________ Date Sent _____________
  3622.                 Version ______________ Serial Number _______________
  3623.  
  3624.  
  3625.                                       Page 55
  3626.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  3627.  
  3628.  
  3629.  
  3630.  
  3631.  
  3632.  
  3633.  
  3634.                      LITECOMM-TP (tm) TOOLBOX for Turbo-PASCAL
  3635.  
  3636.  
  3637.  
  3638.  
  3639.  
  3640.  
  3641.  
  3642.  
  3643.  
  3644.  
  3645.  
  3646.  
  3647.  
  3648.  
  3649.  
  3650.  
  3651.  
  3652.  
  3653.  
  3654.  
  3655.  
  3656.  
  3657.  
  3658.  
  3659.  
  3660.  
  3661.  
  3662.  
  3663.  
  3664.  
  3665.  
  3666.  
  3667.  
  3668.  
  3669.  
  3670.  
  3671.  
  3672.  
  3673.  
  3674.  
  3675.  
  3676.  
  3677.  
  3678.  
  3679.  
  3680.  
  3681.  
  3682.  
  3683.  
  3684.  
  3685.  
  3686.  
  3687.  
  3688.  
  3689.  
  3690.  
  3691.                                       Page 56
  3692.                 CopyRight (c) 1987,1988 Information Technology, Ltd.
  3693.  
  3694.  
  3695.  
  3696.  
  3697.  
  3698.  
  3699.  
  3700.      8250 5, 6, 7                                              ResetModem   48
  3701.      8259 10                                              RetSet  51
  3702.      Asynchronous   6                                              RetType 51
  3703.      BIOS 5, 11                                              SendBreak    42
  3704.      BREAK     27, 28, 42                                              SetModemRegister  51
  3705.      BreakRecd 27                                              SetModemSignals   29
  3706.      Buffer Flushing     41                                              ValidatePort 23
  3707.      Buffers   7, 19                                              XoffRecd     34
  3708.      COM3 10                                              XoffSent     35
  3709.      COM4 10                                            Handshake 25
  3710.      CommOpen  10                                            Handshaking    6
  3711.      Control structures  7                                            HAYES     48
  3712.      CTS  25                                            HAYES MODEM    50
  3713.      DCD  25                                            Heap 7, 20
  3714.      DeltaCTS  25                                            Interrupt chaining  9, 12
  3715.      DSR  25                                            Interrupt enable flag    7
  3716.      DTR  29, 31, 32, 47                                            Interrupt vector    11
  3717.      Error status bits   28                                            Interrupt vectors   10
  3718.      Event Timer    43                                            IRQ  11, 17
  3719.      Expansion cards     11                                            IRQ0 11
  3720.      Flow control   33                                            Look-ahead     37
  3721.      Functions                                            Open function  7
  3722.        BytesInInput 24                                            PortChange     10
  3723.        CheckEvent   43                                            Procedures
  3724.        CheckForCall 45                                              CommClose    21
  3725.        ClearModemSignals 30                                              Disconnect   47
  3726.        CommOpen     19                                              FlushNBytes  41
  3727.        CommSetup    22                                              FlushUntilMatch   41
  3728.        EnableXon    33                                              SetSet  51
  3729.        ErrorStatus  28                                              SetType 51
  3730.        FlipModemSignals  32                                            RI   25
  3731.        GetModemRegister  51, 52                                            RTS  29, 31, 32
  3732.        GetModemReply     49                                            S-register     53
  3733.        GetStream    39                                            Stream    39, 40
  3734.        LctGet  36                                            TSR  15
  3735.        LctPeek 37                                            Vector numbers 11
  3736.        LctPut  38                                            XOFF 33
  3737.        ModemCarrierOff   51, 52                                            XON  33
  3738.        ModemCarrierOn    51, 52
  3739.        ModemCodeSet 52
  3740.        ModemCodesOff     51
  3741.        ModemCodesOn 51
  3742.        ModemDial    52
  3743.        ModemDigitResponse     51
  3744.        ModemEchoCmd 51, 52
  3745.        ModemFullDuplex   51, 52
  3746.        ModemHalfDuplex   51, 52
  3747.        ModemHookMode     51, 52
  3748.        ModemNoEchoCmd    51, 52
  3749.        ModemPulse   52
  3750.        ModemSpeaker 51
  3751.        ModemStatus  25
  3752.        ModemTone    52
  3753.        ModemWordResponse 51
  3754.        NewEvent     44
  3755.        PortChange   17
  3756.        PurgeRxBuff  41
  3757.        PurgeTxBuff  41
  3758.        PutStream    40
  3759.        RepeatModemCommand     51
  3760.  
  3761.                                           1
  3762.  
  3763.  
  3764.  
  3765.  
  3766.  
  3767.  
  3768.  
  3769.  
  3770.                 OVERVIEW........................................... 1
  3771.                     FEATURES....................................... 1
  3772.                     THE SHAREWARE CONCEPT.......................... 1
  3773.  
  3774.                 LICENSE, WARRANTY AND REGISTRATION................. 2
  3775.                     LICENSE........................................ 2
  3776.                     WARRANTY....................................... 3
  3777.                     REGISTERING YOUR COPY.......................... 4
  3778.                     NOTE........................................... 4
  3779.  
  3780.                 COMMUNICATIONS AND THE PC.......................... 5
  3781.                     PC SHORTCOMINGS................................ 5
  3782.                     THE 8250 UART.................................. 5
  3783.                     TOOLBOX NOTES AND WARNINGS..................... 7
  3784.  
  3785.                 LITECOMM-TP HISTORY................................ 8
  3786.                     VERSION 1.0.................................... 8
  3787.                     VERSION 2.0.................................... 8
  3788.                     VERSION 3.0.................................... 9
  3789.  
  3790.                 BEYOND COM2........................................ 10
  3791.                     THE TOOLBOX METHODOLOGY........................ 10
  3792.                     CAUTIONS....................................... 11
  3793.  
  3794.                 PACKAGE CONTENTS................................... 13
  3795.  
  3796.                 INSTALLATION INSTRUCTIONS.......................... 14
  3797.  
  3798.                 GENERAL NOTES...................................... 15
  3799.  
  3800.                 PROCEDURE AND FUNCTION REFERENCE................... 16
  3801.                     UNIT USAGE..................................... 16
  3802.  
  3803.                 BBS Functions...................................... 43
  3804.  
  3805.                 HAYES MODEM FUNCTIONS.............................. 50
  3806.  
  3807.                 LITECOMM-TP REGISTRATION FORM...................... 55
  3808.             
  3809.              Turbo PASCAL is a registered trademark of Borland
  3810.             International
  3811.             
  3812.  
  3813.  
  3814.  
  3815.  
  3816.  
  3817.  
  3818.  
  3819.  
  3820.  
  3821.  
  3822.  
  3823.  
  3824.  
  3825.  
  3826.  
  3827.  
  3828.  
  3829.