[comp.sys.atari.st] A couple of programming questions

rowley@ORVILLE.ARPA (Karl Rowley) (07/28/87)

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.

Also, I have been trying to figure out what the format of resource files is.
Every resource file starts with a header.  The header includes a bunch of
offsets and counts.  I don't understand how these offsets are set.  When
rsrc_load() loads a resource, does it simply read the objects from the file
and call rsrc_obfix() for each one?  Any information or pointers to 
information would be appreciated.  Is this stuff documented in the Atari
developers kit?


Karl Rowley

rowley@orville.nas.nasa.gov
...{seismo,hplabs,lll-crg,ucbvax}!ames!orville!rowley

sansom@trwrb.UUCP (Richard Sansom) (07/29/87)

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                ///
   \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/////////////////////////////////////