ddurbin@polyslo.CalPoly.EDU (Daniel A. Durbin) (03/25/89)
I am writing a BBS door program in TurboC and would like to know if there is a way to determine what baud, parity and number of bits a com port has previously been initialized to assuming there is a modem attached and it is online (carrier dectect high). Also, could someone provide me with the addresses and interrupts assigned to com ports com3 through com8? Sources in .asm or .c or just a description would be helpful. Thanks in advance. Daniel Durbin___________________________________________________ SysOp: Cygnus X-1 BBS | CIS: 73447,1744 (805) 541-8505 (data) | GEnie: D.DURBIN EL major at PolySlo | ddurbin@polyslo.CalPoly.EDU
jmv@sppy00.UUCP (Jim Vickroy) (03/28/89)
In article <9864@polyslo.CalPoly.EDU> ddurbin@polyslo.CalPoly.EDU (Daniel A. Durbin) writes:
=>
=> I am writing a BBS door program in TurboC and would like to know
=> if there is a way to determine what baud, parity and number of
=> bits a com port has previously been initialized to assuming there
=> is a modem attached and it is online (carrier dectect high).
=>
=> Also, could someone provide me with the addresses and interrupts
=> assigned to com ports com3 through com8? Sources in .asm or .c
=> or just a description would be helpful. Thanks in advance.
=>
=> Daniel Durbin___________________________________________________
=> SysOp: Cygnus X-1 BBS | CIS: 73447,1744
=> (805) 541-8505 (data) | GEnie: D.DURBIN
=> EL major at PolySlo | ddurbin@polyslo.CalPoly.EDU
The Parity, Data Bits, and Stop Bits can be retrieved from the Line Control
Register (LCR) of the appropriate 8250. The Baud Rate can be calculated from
information from the two Divisor Latches, also from the 8250.
The LCR is located at port 0x03FB for COM1, 0x02FB for COM2. It is a byte
register which maps as follows:
Bit 7 - Divisor Latch Access Bit (DLAB)
6 - Set Break
5 - Stick Parity
4 - Even Parity Select (EPS)
3 - Parity Enable (PEN)
2 - Number of Stop Bits (STB)
1 - Word Length Select Bit (WLS1)
0 - Word Length Select Bit (WLS0)
Bits 1 and 0 map further as:
Bit 1: 0 Bit 2: 0 - 5 data bits
0 1 - 6 data bits
1 0 - 7 data bits
1 1 - 8 data bits
Calculating the baud rate is a little more compilcated. The information you need
is held in the two divisor latches. The Least Significant Divisor Latch (DLL) is
located at 0x03F8 for COM1 and 0x02F8 for COM2. The Most Significant Divisor
Latch (DLM) is located at 0x03F9 for COM1 and 0x02F9 for COM2. Together these
two bytes make up the binary value for the Divisor Latch. On order for you to
retrieve the latches you will need to set the Divisor Latch Access Bit ON (=1)
in the LCR first. To calculate the baud rate I, sometime ago so I hope this is
accurate, penciled in this formula:
BaudRate = 1/((DLM << 8) | DLL)*115200
Hope this helps........
jim
--
!==================================================================!=========!
! Jim Vickroy | cbosgd!osu-cis!sppy00!jmv !/././././!
! Online Computer Library Center, Inc. |---------------------------!././././.!
! Dublin, Ohio 43017 | jmv@sppy00 !/././././!
!------------------------------------------------------------------!././././.!
! "That voodoo stuff don't do nothin' for me" -jrr !/././././!
!==================================================================!=========!
ddurbin@polyslo.CalPoly.EDU (Daniel A. Durbin) (03/29/89)
I thank all who have responded with all of the information I need and requested. A special thanks to Jim Vickroy for his very explicit detailing of the 8250's Line Control Register. Daniel Durbin___________________________________________________ SysOp: Cygnus X-1 BBS | CIS: 73447,1744 (805) 541-8505 (data) | GEnie: D.DURBIN EL major at PolySlo | ddurbin@polyslo.CalPoly.EDU