Page 1 of 1
Serial port init freeze.
Posted: Tue Nov 11, 2008 8:59 pm
by Troy Martin
I have a problem when initializing the serial port via the BIOS. It works fine if everything's connected, but if the null modem cable is connected on the TBOS side and not on the other side or if no cable is connected it freezes. Here's my serial port init code:
Code: Select all
mov ah,0
mov al,11100011b
mov dx,rs0
int 14h
What's the problem?
Thanks,
Troy
PS: Is it possible to deinitialize or shut down a serial port?
Re: Serial port init freeze.
Posted: Tue Nov 11, 2008 11:46 pm
by Brendan
Hi,
Troy Martin wrote:I have a problem when initializing the serial port via the BIOS.
Troy Martin wrote:What's the problem?
The problem is you're using the BIOS...
For serial ports, the BIOS code is crap - polling wastes CPU time and can cause data loss (e.g. several bytes arrive while you're trying to do something with already received data), and these functions don't support higher speeds (anything above 9600 bits per second) and have no control over things like FIFOs (no FIFO means more chance of data loss). Because of this (and because serial ports are well documented and mostly standard) nobody has used the BIOS serial port functions in the last 20 years (they just write decent serial port code that uses I/O ports); and because nobody uses these functions it's probably not a good idea to assume the BIOS serial port functions have been tested (they're probably full of bugs that nobody cared about).
Cheers,
Brendan
Re: Serial port init freeze.
Posted: Wed Nov 12, 2008 9:49 am
by Troy Martin
Hmmm, I'll go find some serial code on the wiki then!
Thanks!