COM4 and COM3

 BBS: Inland Empire Archive
Date: 02-04-93 (14:37)             Number: 371
From: CALVIN FRENCH                Refer#: NONE
  To: DIK COATES                    Recvd: NO  
Subj: COM4 and COM3                  Conf: (2) Quik_Bas
Hi Dik,
 Here's an example of how to do this...  I think this should help.
 Also, Mr. Moderator, if the message is too long or if I'm violating
 someone's copyright, please tell me! I hope this helps out.

___------- Use Pork & Beans Can Lid To Slice Paper... -----------------

____________________________________________________________
__________________

             Using COM3: and COM4: from Microsoft QuickBASIC (tm)
               Copyright (C) 1987 HUMBLEWARE Custom Programming
____________________________________________________________
__________________

QuickBASIC does not support serial communications through COM3: or COM4: but
this shortcomming can be worked around easily. The
following explains what must
be done to make QuickBASIC talk to COM3: and COM4:.

Using COM3: and COM4: a little theory:

When your PC boots up it fills in a table which lists the
addresses of all the
the serial communications ports installed in your system. This table exists
within the BIOS data area of your PC and can store the addresses of up to 4
serial communications ports.

Unfortunately, though the IBM PC hardware can handle 4 serial communications
ports, QuickBASIC acknowledges only 2 such devices.

So, if you want QuickBASIC to use a serial port addressed as COM3: you must
fool QuickBASIC by changing the address in the BIOS data area that normally
points to COM1: and put the address of COM3: there instead.

Likewise, the address in the BIOS data area that normally points to COM2: can
be changed to point to COM4: instead.

Once this has been done, when QuickBASIC tries to read or write to COM1: the
data will be redirected to COM3: and when QuickBASIC tries
to read or write to
COM2: the data will be redirected to COM4:.

The following QuickBASIC programs illustrate how to access COM3: and COM4:



'EXAMPLE: Accessing COM3: from QuickBASIC


        'move QuickBASIC segment pointer to BIOS data area
        DEF SEG=64

        'change com1: address in BIOS data area to com3:
        POKE &H00,&HE8

        'open com3: by issuing open com1: command
        OPEN "COM1:1200,N,8,1" FOR OUTPUT AS #1

        'print to comm port
        PRINT #1,"ATDT844-1212"

        'close comm port
        CLOSE #1

        'restore com1: address in BIOS data area to com1:
        POKE &H00,&HF8



'EXAMPLE: Accessing COM4: from QuickBASIC


        'move QuickBASIC segment pointer to BIOS data area
        DEF SEG=64

        'change com2: address in BIOS data area to com4:
        POKE &H02,&HE8

        'open com4: by issuing open com2: command
        OPEN "COM2:1200,N,8,1" FOR OUTPUT AS #1

        'print to comm port
        PRINT #1,"ATDT844-1212"

        'close comm port
        CLOSE #1

        'restore com2: address in BIOS data area to com2:
        POKE &H02,&HF8


I hope this information helps you with your QuickBASIC programming projects!
____________________________________________________________
__________________

                                          Best wishes, L.A.Westhaver

                                          HUMBLEWARE Custom Programming
                                          247 Paul Martin Drive
                                          Baltimore, MD  21227
                                          (301) 799-1975

___------- Use Pork & Beans Can Lid To Slice Paper... -----------------


Well, I sure hope this helps! I haven't had too much luck with it,
however. The other method is to use direct INP and OUT commands. This
would seem Ok but actually there is much extra programming and unwanted
or unneeded bugs if it's used. Error trapping COMn can often help you
out if you're doing psuedo-multitasking with your COM program or if,
like I, you're writing an over-the-modem game. I'm not sure what the
addresses are, but I think the ones that are listed in TELIX or
whatever should work. I haven't really tried too much with this yet.

Well, Hope this helps out (and I hope Mr. Moderator diddn't terminate
part of this message.. if he did, tell me and I'll see what I can do!).

Always as happy as a bean,
- Calvin -

... OFFLINE 1.39 * Oh beans... I just killed my tagline file.

--- Maximus 2.01wb
 * Origin: RJ's Byteline =[HST/DS]= Calgary (403)247-3180 CANADA (1:134/75)
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