Article View: comp.sys.atari.st
Article #27824Re: A couple of programming questions
From: Richard Sansom
Date: Wed, 29 Jul 1987 15:31
Date: Wed, 29 Jul 1987 15:31
55 lines
2450 bytes
2450 bytes
In article <8707272346.AA14688@orville.arpa> rowley@ORVILLE.ARPA (Karl Rowley) writes:
>
>Does anyone know how to determine what the rs-232 parameters are at any
>point in time? They are simple enough to set with Rsconf(), but I do
>not know of a way to just read the current settings.
>
The Rsconf() call returns the old rs232 parameters in a packed long word
as follows:
31 23 15 7
----------------------------------------
| UCR | RSR | TSR | SCR |
----------------------------------------
bits value
31-24 UCR
23-16 RSR
15- 8 TSR
7- 0 SCR
If you're using the Mark Williams C compiler, you'll need to redefine
Rsconf() like this:
#undef Rsconf
#define Rsconf(a,b,c,d,e,f) (unsigned long)xbios(15,a,b,c,d,e,f)
(this is necessary because xbios.h defines Rsconf() as a void!)
The following C blurb will fetch the old values:
#define UCRSHIFT 24
#define RSRSHIFT 16
#define TSRSHIFT 8
#define SCRSHIFT 0
unsigned long old_rsconf;
int old_ucr, old_rsr, old_tsr, old_scr;
/* BAUD and FLOW may also be -1 */
old_rsconf = Rsconf(BAUD, FLOW, -1, -1, -1, -1);
old_ucr = (int)(old_rsconf >> UCRSHIFT) & 0xFF;
old_rsr = (int)(old_rsconf >> RSRSHIFT) & 0xFF;
old_tsr = (int)(old_rsconf >> TSRSHIFT) & 0xFF;
old_scr = (int)(old_rsconf >> SCRSHIFT) & 0xFF;
Hope this helps some.
-Rich
--
/////////////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
/// Richard E. Sansom TRW Electronics & Defense Sector \\\
\\\ {decvax,ucbvax,ihnp4}!trwrb!sansom Redondo Beach, CA ///
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/////////////////////////////////////
Technical Details
Message-ID:
<2254@trwrb.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!uunet!seismo!nbires!hao!husc6!mit-eddie!ll-xn!cit-vax!elroy!smeagol!jplgodo!wlbr!scgvaxd!trwrb!sansomReferences:
<8707272346.AA14688@orville.arpa>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!seismo!nbires!hao!husc6!mit-eddie!ll-xn!cit-vax!elroy!smeagol!jplgodo!wlbr!scgvaxd!trwrb!sansom From: sansom@trwrb.UUCP (Richard Sansom) Newsgroups: comp.sys.atari.st Subject: Re: A couple of programming questions Message-ID: <2254@trwrb.UUCP> Date: Wed, 29-Jul-87 11:31:15 EDT Article-I.D.: trwrb.2254 Posted: Wed Jul 29 11:31:15 1987 Date-Received: Sat, 1-Aug-87 11:21:21 EDT References: <8707272346.AA14688@orville.arpa> Reply-To: sansom@trwrb.UUCP (Richard Sansom) Distribution: world Organization: TRW EDS, Redondo Beach, CA Lines: 55