[net.micro.amiga] input from the serial port...

rodb@tektronix.UUCP (Rod Belshee ) (11/13/85)

> Attention Amiga Hacks:
> 
> 	I have a friend who is trying to get input from the serial
> 	port.  He has been able to send characters, but not recieve
> 	them.  Any ideas?
> 


	Yes if he is using the C compiler... "LATTICE" then he should
	be advised that there is a bug with the data element of the
	SERIO->IOSer.io_Data.  This element must be at least 4 bytes
	(a long) and the data (ie the character received from the
	serial port) will be in the HI byte of the DATA element.  
	
	BAD NEWS ... AMIGA we are waiting for UPDATES... 

			Curt Jutzi
			tektronix!rodb

zaphod%wwu.csnet@CSNET-RELAY.ARPA (11/14/85)

From: Brown@CSNET-RELAY.ARPA, David D <zaphod%wwu.csnet@CSNET-RELAY.ARPA>


Attention Amiga Hacks:

	I have a friend who is trying to get input from the serial
	port.  He has been able to send characters, but not recieve
	them.  Any ideas?

						Dave Brown
						zaphod%wwu@csnet-relay.arpa

hamilton@uiucuxc.CSO.UIUC.EDU (11/15/85)

>> 	I have a friend who is trying to get input from the serial
>> 	port.  He has been able to send characters, but not recieve
>> 	them.  Any ideas?
>	Yes if he is using the C compiler... "LATTICE" then he should
>	be advised that there is a bug with the data element of the
>	SERIO->IOSer.io_Data.  This element must be at least 4 bytes
>	(a long) and the data (ie the character received from the
>	serial port) will be in the HI byte of the DATA element.  

io_Data is a pointer to a buffer, not a buffer itself.  the real bug,
as was posted recently (for which, much thanx!) involves the C compiler.
io_Data is declared an APTR, which is defined:
typedef STRPTR		*APTR;		/* absolute memory pointer */
typedef unsigned char	*STRPTR;	/* string pointer */
(should be "typedef unsigned char *APTR" or "typedef STRPTR APTR"?)
now, if you have in your program:
	char buf[BUFSIZE];
	...
	xxx.io_Data = (APTR) &buf[0];
it is possible for the value in io_Data to be, eg, &buf[-3], due to
the lattice C bug that truncates some low-order bits.  there are several
ways to work around this bug: obtain your buffer from malloc, manually
align your buffer pointer, or pass your buffer pointer to a function where
the formal argument is declared APTR (eliminate the "conversion").
    i have a prototype terminal emulator program working that reads
from the serial port.  i'll post it when i've cleaned it up some and
added file transfer capability.

	wayne hamilton
	U of Il and US Army Corps of Engineers CERL
UUCP:	{ihnp4,pur-ee,convex}!uiucdcs!uiucuxc!hamilton
ARPA:	hamilton@uiucuxc.cso.uiuc.edu
CSNET:	hamilton%uiucuxc@uiuc.csnet
USMail:	Box 476, Urbana, IL 61801
Phone:	(217)333-8703