[comp.sys.cbm] rs232 *** HELP!!!

ksk@well.UUCP (Kianusch Sayah-Karadji) (06/20/89)

How in the world do I access the rs232 interface in ML? (on a 64 or 128)

It workes fine if I do it in Basic (open 2,2,2...), so I thought would be
the same in ML. Wrong :-(. I try opening it like a file, and writing to it,
but I didn't get any response from the Modem...

Anybody out there who has some short routines he (or she) could E-Mail me?

The only thing I need to do is reading a character into the A-reg...
and sending the A-reg to the modem...

							Thanx :-)
							Greetings Kianusch

jgreco@csd4.milw.wisc.edu (Joe Greco) (06/21/89)

In comp.sys.cbm article <12277@well.UUCP>, ksk@well.UUCP (Kianusch Sayah-Karadji) wrote:
>How in the world do I access the rs232 interface in ML? (on a 64 or 128)
>
>It workes fine if I do it in Basic (open 2,2,2...), so I thought would be
>the same in ML. Wrong :-(. I try opening it like a file, and writing to it,
>but I didn't get any response from the Modem...
>
>Anybody out there who has some short routines he (or she) could E-Mail me?
>
>The only thing I need to do is reading a character into the A-reg...
>and sending the A-reg to the modem...

That's pretty simple.  If you are in ML, the format is identical to
BASIC - except that you are dealing with Kernal routines rather than
BASIC commands.  Duplicate BASIC's calls.

OPEN:   .a=length of filename (2 or 4)
	.x=lo byte of start of filename
	.y=hi "    "   "
	JSR setnam
	.a=file#
	.x=2
	.y=0
	JSR setlfs
	JSR open

Remember that OPEN allocates 512 bytes at the Top-Of-RAM!

Read:	.x=file#
	JSR chkin
	JSR getin  ...  or chrin, although I prefer the first format
	STA where-ever
	JSR clrchn

Note that the chkin/clrchn sequence is only needed if you intend to
access a device other than RS232 - if you are waiting for a
buffer-full of info, you need only chkin at the beginning and clrchn
when all done.  The getin routine has the singular virtue of crashing
less obviously if you forgot to open the file (I never liked chrin
because of that).

Write:	.x=file#
	JSR chkout
	JSR chrout
	JSR clrchn

Again, you don't need to chkout/clrchn for successive writes.

I can't see why you would have troubles, unless you are trying to do
something like use the Serial Bus routines.  I disapprove of their use
anyways, and this just goes to show how useless they really are....
using standardized Kernal routines, your program can easily be ported
between machines.

Problems?  Send E-Mail.  This is simple stuff....  I have an interrupt
package that fetches RS232 input, converts to Commodore ASCII, buffers
it, and scans for Hayes Verbose Result Codes at the same time.  Really
slick IRQ programming of RS232 (and that is just the tip of the iceberg).

Joe Greco
--
jgreco@csd4.milw.wisc.edu		Joe Greco at FidoNet 1:154/200
USnail: 9905 W Montana Ave			     PunterNet Node 30 or 31
	West Allis, WI  53227-3329	"These aren't anybody's opinions."
Voice:	414/321-6184			Data: 414/321-9287 (Happy Hacker's BBS)