🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #7141

Re: modem programming in BASIC

#7141
From: David Kessner
Date: Wed, 19 Jun 1991 06:07
37 lines
2474 bytes
In article <1991Jun18.175638.8957@murdoch.acc.Virginia.EDU> dmm0t@holmes.acc.Virginia.EDU (Dave Meyer) writes:
>I'm trying to write a string to my modem in BASIC, but when
>I try to open the COM port I get device timeouts.  I'm using
>OPEN "COM1:9600,n,8,1" as #1
>to get these timeouts.  I vaguely remember reading about this,
>and there was a very simple solution to the problem.  Sadly,
>I don't remember what it was.
>
>Does anyone happen to remember how to open a COM port with
>a modem attached?  If it matters, I have a USR HST 9600.
>
>David M. Meyer                                   | dmm0t@virginia.edu

I strongly reccomend that you don't access the modem in that way-- or
if you do, don't run it at anything above 1200 baud.  The reason why is
because you are going though DOS _and_ the BIOS.  The BIOS is pittifully
slow and putting DOn on top of that is asking for trouble.  The other reason
is that the DOS/BIOS routines are not intterupt driven, essentally giving
you a ONE byte buffer.  If you cannot read that byte before the next one
comes in then you will loose characters, and in BASIC this is highly possible.

The 'proper' way to access the serial ports in MS-DOS is to write a small
assembly language driver with an 'interface' to the language of choice (BASIC,
C, Pascal, etc).

Given that here is how I would access the modem using _your_ way.  (Please
keep in mind that I have not written in BASIC for five years.)  Anyway, I
would use the DOS 'mode' command to set the baud rate, parity, etc.  Then,
in BASIC I would open the file 'com1' for READ AND WRITE.  I don't believe 
that you can set the baud rate from the open command-- but I could be 
wrong.  At any rate, this method is only reliable at slow speeds and
is only useful when sending to a printer...

-- 
David Kessner - david@kessner.denver.co.us            |
1135 Fairfax, Denver CO  80220  (303) 377-1801 (p.m.) | Reunite PANGEA!
Compuserve?  Isn't that some sort of FIDO BBS?        |
Technical Details
Message-ID: <1991Jun19.060721.26616@kessner.denver.co.us>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!cis.ohio-state.edu!magnus.acs.ohio-state.edu!csn!kessner!david
References: <1991Jun18.175638.8957@murdoch.acc.Virginia.EDU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!cis.ohio-state.edu!magnus.acs.ohio-state.edu!csn!kessner!david
From: david@kessner.denver.co.us (David Kessner)
Newsgroups: comp.os.msdos.programmer
Subject: Re: modem programming in BASIC
Message-ID: <1991Jun19.060721.26616@kessner.denver.co.us>
Date: 19 Jun 91 06:07:21 GMT
References: <1991Jun18.175638.8957@murdoch.acc.Virginia.EDU>
Organization: Kessner, Inc.
Lines: 37