Re: QB communications

 BBS: Inland Empire Archive
Date: 04-09-93 (09:43)             Number: 322
From: CHARLES GRAHAM               Refer#: NONE
  To: JASON PETERSON                Recvd: NO  
Subj: Re: QB communications          Conf: (2) Quik_Bas
> Is it true that QuickBASIC 4.5 will only support up to 2400 baud?

No. Plain old vanilla QB will take it to 9600 bps.

> I assume you have to use ANSI escape sequences. Does anyone
> have some code they'd be willing to share?

(The following was extracted from an article of mine in The QBNews.)

    For purposes of communications,  ANSI.SYS is a standardized set of
instructions that does four things - clears all or part of the screen,
locates the cursor,  changes the foreground and background colors  and
performs  all screen writes.  It performs these tasks by  interpreting
special sequences of characters it receives through the modem.
    Each ANSI sequence begins with an ESCape character <ESC>. <ESC> is
ASCII  character  27  which QB knows as CHR$(27).   <ESC>   is  always
followed  by a left bracket.  Then none,  one or multiple sequences of
digits may be received.  If multiple sequences of digits are received,
they  are  separated  by semi-colons.  Finally,   each  ANSI  sequence
terminates  with  an UPPER or lower case letter that  indicates  which
ANSI command you need to perform.
    For communications purposes,  there are 13 ANSI commands indicated
by the terminal letters: H A B C D R n f s u J K m.
    Note. CaSe Is ImPoRtAnT. "A" does not equal "a". Here's the syntax
and what each of these commands means.
    <ESC>[row;colH  -  The Cursor Position command moves the cursor to
the position specified by the parameters row and col.  The default for
each parameter is 1. No parameters homes the cursor.
    <ESC>[#A - The Cursor Up command moves the cursor up the number of
lines specified by the parameter #.  The default value is 1. Cursor Up
is ignored if the cursor is already on the top row.
    <ESC>[#B  -   The Cursor Down command moves the  cursor  down  the
number of lines specified by the parameter #.  The default value is 1.
Cursor Down is ignored if the cursor is already on the bottom row.
    <ESC>[#C  -  The Cursor Right command moves the cursor  right  the
number of columns specified by the parameter #.  The default value  is
1.  Cursor Right is ignored if the cursor is already in the far  right
    <ESC>[#D  -   The  Cursor Left command moves the cursor  left  the
number  of columns specified by the parameter #.  The default value is
1.   Cursor  Left is ignored if the cursor is already if the far  left
    <ESC>[row;colR  -  A  Cursor Position Report is generated  by  the
Device Status Report command,  below.  The parameter row contains  the
cursor's  current  line  number;  col contains  the  cursor's  current
    <ESC>[6n  -   The  Device Status Report command triggers a  Cursor
Position Report, above, being generated.
    <ESC>[row;colf  -   The Horizontal and Vertical  Position  command
works exactly like the Cursor Position command, above.
    <ESC>[s  -  The  Save Cursor Position command stores the  cursor's
current row and column.  This is used in conjunction with the  Restore
Cursor Position command, below.
    <ESC>[u  -   The  Restore  Cursor Position  command  restores  the
cursor's  position to the location stored by the Save Cursor  Position
command, above.
    <ESC>[2J  -  The Erase Display command clears the screen and homes
the cursor.
    <ESC>[K -  The Erase Line command clears from the  current  cursor
position to the end of the line.
    <ESC>[#;...;#m - The Set Graphics Rendition command changes screen
colors according to any valid #  parameters.   The  following schedule
lists allowable values for the # parameters and the meaning of each.

General                     Foreground Colors        Background Colors
--------------------        -----------------        -----------------
0 all attributes off        30 black                 40 black
1 bright on                 31 red                   41 red
4 underscore on             32 green                 42 green
5 blink on                  33 yellow                43 yellow
7 reverse video on          34 blue                  44 blue
8 concealed on              35 magenta               45 magenta
                            36 cyan                  46 cyan
                            37 white                 47 white

--- QM v1.30
 * Origin: QwikCom * St Charles MO * 16.8K HST/V32b (1:100/602.0)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET