[comp.sys.atari.8bit] R: devices

rrwood@lotus.waterloo.edu (Roy Wood) (10/17/89)

I've been playing around with my modem (an SX212), trying to do some elementary
communications stuff.  Basically, the program I've written does the following:

1) open up the keyboard as device #1 (through the K: handler)
2) open the modem as device #2 (through the R: handler)
3) continually executes a loop which
     i) checks to see if a key has been pressed, and if so, the keystroke is
        read from device #1, put to device #2, and printed on-screen.
     ii) tries to read an incoming character from device #2, the modem, and
         if there is an incoming character, print it.

This sounds all well and good, but I can't read from the modem without getting
an error.  This occurs even when there are incoming characters available.

My question is: What am I screwing up?  How do I poll the modem to see whether
data is available, and then how should I read it? (single character get, or
input a string?)  What other stupid things am I doing?

Any and all advice appreciated, etc., etc., etc.


--Roy Wood (rrwood@lotus.waterloo.edu)

gdtltr@vax1.acs.udel.EDU (Gary D Duzan) (10/18/89)

In article <17311@watdragon.waterloo.edu> rrwood@lotus.waterloo.edu (Roy Wood) writes:
=>I've been playing around with my modem (an SX212), trying to do some elementary
=>communications stuff.  Basically, the program I've written does the following:
=>
=>1) open up the keyboard as device #1 (through the K: handler)
=>2) open the modem as device #2 (through the R: handler)
=>3) continually executes a loop which
=>     i) checks to see if a key has been pressed, and if so, the keystroke is
=>        read from device #1, put to device #2, and printed on-screen.
=>     ii) tries to read an incoming character from device #2, the modem, and
=>         if there is an incoming character, print it.
=>
=>This sounds all well and good, but I can't read from the modem without getting
=>an error.  This occurs even when there are incoming characters available.
=>
=>My question is: What am I screwing up?  How do I poll the modem to see whether
=>data is available, and then how should I read it? (single character get, or
=>input a string?)  What other stupid things am I doing?
=>
=>Any and all advice appreciated, etc., etc., etc.
=>
   I don't have my manuals with me, but you need to do a status call to the
R: device & check a particular location. 746 rings a bell, but I'm not sure.
This location will hold the number of characters in the input buffer. You
will also need to set the R: device to concurrent mode. I believe an
XIO 40,#RDEV,0,0,"R:" should do it. There are other little details to mess
with like translation, parity, etc. too. You might want to consult a manual
somewhere. The original "Your Atari Computer" had some stuff on it in the
section on the XIO command. You might also want to look through any junk
that came with your modem (or interface, if you aren't using the direct-
connect facility.)

                                        Gary Duzan
                                        Time  Lord
                                    Third Regeneration
                                 Atari Enthusiast Extreme




-- 
      _o_                                                            _o_
    [|o o|]        "Two hearts are better than one." -- Yes        [|o o|]
     |_O_|      "Don't listen to me; I never do." -- Doctor Who     |_O_|