[comp.os.msdos.programmer] serial port BIOS

dondorp@dnlunx.pttrnl.nl (Dondorp E.) (02/19/91)

Help!!!

I want to write a simple application that can read/write from
COM1: (mouse) or COM4: (modem).
However MS-DOS will open the file named "COMx:" but cannot read or
write it.
Also when using direct BIOS calls, I still cannot use the serial
ports.
BtW the ports are functioning OK since both my mouse and my modem
are in use.

Now is there any reason why the serial ports cannot be accessed via
BIOS (INT24)?
(BtW I had all TSRs removed/not installed)

If it's just the fault of my BIOS, is there any way that I can use
the serial ports from my program in a reasonable machine independant
way?

	Erwin

david@kessner.denver.co.us (David Kessner) (02/22/91)

In article <7154@dnlunx.pttrnl.nl> dondorp@dnlunx.pttrnl.nl (Dondorp E.) writes:
>I want to write a simple application that can read/write from
>COM1: (mouse) or COM4: (modem).

Hmmm.   For the most part, you should read the mouse via the mouse driver and
not the serial port.  The data you get at the serial port is not consistant
amung different brands of mice, and is non-existant with bus-mice.  The only
time you should read the serial port directly for mice data is when you are not
using MS-DOS at all (as is the case with UNIX, or MINIX, etc).

>However MS-DOS will open the file named "COMx:" but cannot read or
>write it.

That should work, you might try to use the MODE command to set the speed and
line settings of the COM port.  But, read on...

>Also when using direct BIOS calls, I still cannot use the serial
>ports.
>BtW the ports are functioning OK since both my mouse and my modem
>are in use.
>
>Now is there any reason why the serial ports cannot be accessed via
>BIOS (INT24)?
>(BtW I had all TSRs removed/not installed)
>
>If it's just the fault of my BIOS, is there any way that I can use
>the serial ports from my program in a reasonable machine independant
>way?
>
>	Erwin

The BIOS routines for serial I/O are brain dead.  The DOS functions are even
worse because they have their own way of doing things, and also call the BIOS.
It is all complicated by the speed of those routines, making 2400 baud barely
atainable.

The way EVERYONE accesses the serial ports is by their own ASSEMBLY langyage
routines.  I use Turbo C and Turbo Assembler, and have a set of serial routines
written in asm to be called from C.  If this is useful to anyone, just drop me
a line and I'll mail them you you (or post them here, they are quite small).  
The routines have been tested with a lot of hardware and are incompatable with 
some of the OLD hardware, but have had no problems with the newer things (newer
measning younger than 1985).  

					- David K

-- 
David Kessner - david@kessner.denver.co.us            | do {
1135 Fairfax, Denver CO  80220  (303) 377-1801 (p.m.) |    . . .
This is my system so I can say any damn thing I want! |    } while( jones);