[net.micro.mac] serial port I/O

jdb@mordor.UUCP (06/11/85)

I've been trying to put together an application which will use the
modem port to talk to a standard RS-232C device (modem or VAX).
I was able to get it to work, but I've run across a couple of
unexpected software problems.  I am using the Megamax C compiler.

My first problem is that a number of the routines (OpenDriver,
SerSetBuf, SerReset) are returning a positive "error code".  I
interpreted *IM* to say that a successful driver call will return
0 and an unsuccessful one will return a negative error code.  The
functions I call appear to work, so I now ignore the error code
unless it is negative.  (Before I had this code debugged I would
occasionally see a negative error code, and they were always
meaningful.)  Does the positive number have any meaning?

My second problem concerns the function "SerGetBuf", which is
supposed to return the number of bytes which are available for
reading.  According to *IM* this is implemented as status call #2.
As far as I can tell (thanks to the misplaced Sound Driver pages
in the *IM* "phone book") it is only supposed to return the
count as a longword.  However, it is definitely returning more
than 32 bits of information.  What are these extra words/longwords
supposed to mean?
-- 
  John Bruner (S-1 Project, Lawrence Livermore National Laboratory)
  MILNET: jdb@mordor.ARPA [jdb@s1-c]	(415) 422-0758
  UUCP: ...!ucbvax!dual!mordor!jdb 	...!decvax!decwrl!mordor!jdb

stew@harvard.ARPA (06/13/85)

> I've been trying to put together an application which will use the
> modem port to talk to a standard RS-232C device (modem or VAX).
> I was able to get it to work, but I've run across a couple of
> unexpected software problems.  I am using the Megamax C compiler.
> 
> My first problem is that a number of the routines (OpenDriver,
> SerSetBuf, SerReset) are returning a positive "error code".  I
> interpreted *IM* to say that a successful driver call will return
> 0 and an unsuccessful one will return a negative error code.  The
> functions I call appear to work, so I now ignore the error code
> unless it is negative.  (Before I had this code debugged I would
> occasionally see a negative error code, and they were always
> meaningful.)  Does the positive number have any meaning?
>
>   John Bruner (S-1 Project, Lawrence Livermore National Laboratory)
>   MILNET: jdb@mordor.ARPA [jdb@s1-c]	(415) 422-0758
>   UUCP: ...!ucbvax!dual!mordor!jdb 	...!decvax!decwrl!mordor!jdb

The MegaMax PBOpen routine returns the wrong value.  It throws away
the ROM trap's result and instead returns the value in the ioResult
field.  I have fixed, but I don't think I can post source code for
MegaMax's library.  I suggest you disassemble and look at file6.o,
and then recode it yourself (it's only a few lines of asm).  This
will hopefully be fixed in a new version of MegaMax C rumored to
be out this month.
-- 
-----------------------
Stew Rubenstein     UUCP: ihnp4!harvard!stew
Harvard Chemistry   ARPA: stew@harvard