Serial port init freeze.

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
Troy Martin
Member
Member
Posts: 1686
Joined: Fri Apr 18, 2008 4:40 pm
Location: Langley, Vancouver, BC, Canada
Contact:

Serial port init freeze.

Post 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?
Image
Image
Solar wrote:It keeps stunning me how friendly we - as a community - are towards people who start programming "their first OS" who don't even have a solid understanding of pointers, their compiler, or how a OS is structured.
I wish I could add more tex
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Serial port init freeze.

Post 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
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
User avatar
Troy Martin
Member
Member
Posts: 1686
Joined: Fri Apr 18, 2008 4:40 pm
Location: Langley, Vancouver, BC, Canada
Contact:

Re: Serial port init freeze.

Post by Troy Martin »

Hmmm, I'll go find some serial code on the wiki then!

Thanks!
Image
Image
Solar wrote:It keeps stunning me how friendly we - as a community - are towards people who start programming "their first OS" who don't even have a solid understanding of pointers, their compiler, or how a OS is structured.
I wish I could add more tex
Post Reply