Tyrop Posted April 22, 2008 Share Posted April 22, 2008 Does anyone have any documentation on how to access the R: handler in machine language (such as Put's and Get's) on an open channel to the 850 interface module (R:)? Is it exactly the same as doing a Put or Get command to the S:, K: or E: handlers via JSR's to $E456 (CIO)? I am trying to speed up a BBS I wrote in Basic in the 1980's by doing the I/O in machine language. I know how to load up the IOCB's and I can Put to R: and E:, but the computer hangs when I do a status command, and then I check location 747, and then do a Get (if there is a non-zero in 747). De Re Atari and the Technical Reference Notes don't have any documentation on the R: handler. The Atari 850 manual has no information regarding machine lanuage access to the handler. I am using SpartaDos X with its RS232 handler which I belive is used exactly like Atari's 850 handler. Quote Link to comment Share on other sites More sharing options...
Rybags Posted April 22, 2008 Share Posted April 22, 2008 What do you mean by "hang"? Does the Break key get you out? Maybe it's a program crash. The handler should adhere to CIO standards - if you're having a problem with GET, double-check where your buffer is pointed to as it might be overwriting something. To make things easier to debug while developing, you might be better off using BASIC and a USR routine to do the CIO call for you. Then, you have a much easier ability to check things before/after every step. Quote Link to comment Share on other sites More sharing options...
Tyrop Posted April 22, 2008 Author Share Posted April 22, 2008 If the CIO standard is the same, then I guess that answers my question, and I will try to figure out what I am doing wrong. The Break does not work. THe computer just locks up. SYstem Reset does work. I am using CIO through a USR routine in BASIC. Trouble with debugging is that I am doing this on a real Atari and I need to have R: open while in my debugger, which I cannot use while in BASIC. BTW, I am using Jim Dunion's EXDDT to debug but I don't think I can access it while in my BASIC program. (If you know a good debugger, I'd love to know, but EXDDT makes it real easy). I am loading the IOCB with 0's for the buffer address and 0 for the buffer length. I read in the Technical Reference Notes that this allows a simple single-byte PUT and GET using just the accumulator as the buffer. My machine language routine takes a string (passed to it from BASIC) and PUTs each character, byte by byte, to both R: and E:, using CIO standard single-byte PUTs. This works without a problem. However, I then added code to check for characters received by the modem. To do this, after each byte that is PUT, I do a CIO STATUS command on the channel and then check location 747 decimal. If 747 is non-zero, then there is a character in the 850's buffer, and I do a GET to bring the character into the accumulator. Somwhere between the STATUS and the GET is where I think it is crashing. Quote Link to comment Share on other sites More sharing options...
thorfdbg Posted April 22, 2008 Share Posted April 22, 2008 If the CIO standard is the same, then I guess that answers my question, and I will try to figure out what I am doing wrong. The Break does not work. The regular R: handler disables the BREAK key for reasons beyond me. But otherwise, it is a standard CIO handler. The difference is that, once you open a channel, you're in "small block mode", which only allows you to send out blocks of bytes, but no reading, and no continuous writing of data is possible. For that, you need to go for concurrent mode. THe computer just locks up. SYstem Reset does work. I am using CIO through a USR routine in BASIC. Basic is not adequate for the 850. For any *serious* activity, you need to setup the concurrent mode, and then need to define an input and an output buffer by yourself where the interrupt routines of the R: handler will place their data. Trouble with debugging is that I am doing this on a real Atari and I need to have R: open while in my debugger, which I cannot use while in BASIC. BTW, I am using Jim Dunion's EXDDT to debug but I don't think I can access it while in my BASIC program. (If you know a good debugger, I'd love to know, but EXDDT makes it real easy). I am loading the IOCB with 0's for the buffer address and 0 for the buffer length. I read in the Technical Reference Notes that this allows a simple single-byte PUT and GET using just the accumulator as the buffer. Not for R:, at least not in the "small block mode". My machine language routine takes a string (passed to it from BASIC) and PUTs each character, byte by byte, to both R: and E:, using CIO standard single-byte PUTs. This works without a problem. However, I then added code to check for characters received by the modem. To do this, after each byte that is PUT, I do a CIO STATUS command on the channel and then check location 747 decimal. If 747 is non-zero, then there is a character in the 850's buffer, and I do a GET to bring the character into the accumulator. Somwhere between the STATUS and the GET is where I think it is crashing. It's not crashing. It's just not getting any data. The man page of atari++ contains the list of the CIO commands R: understands (the emulated R: device reproduces the original exactly, up to a couple of bugs I didn't want to emulate). So long, Thomas Quote Link to comment Share on other sites More sharing options...
Rybags Posted April 22, 2008 Share Posted April 22, 2008 First thing to do would be to use higher memory, with a buffer size reserved to whatever the maximum blocksize is. Another way you might like to debug your program is to just use the "E:" device instead of "R:". You can "simulate" I/O reasonably well by just keying in stuff. CTRL-3 is used to signify End-of-File. Quote Link to comment Share on other sites More sharing options...
Tyrop Posted April 23, 2008 Author Share Posted April 23, 2008 Thanks Thomas and Rybags. Thomas, your web page is very informative. Basic is not adequate for the 850. For any *serious* activity, you need to setup the concurrent mode, and then need to define an input and an output buffer by yourself where the interrupt routines of the R: handler will place their data. I do have concurrent mode on (it was turned on in BASIC). Do I set up the buffer address for the interrupt routines during the IOCB setup for a GET? I would think that the interrupt routines of the R: handler would have set up the buffer for me, no? In other words, where do the 850 interrupt routines put incoming bytes if I don't do a GET? Quote Link to comment Share on other sites More sharing options...
a8maestro Posted April 23, 2008 Share Posted April 23, 2008 (edited) Does anyone have any documentation on how to access the R: handler in machine language (such as Put's and Get's) on an open channel to the 850 interface module (R:)? Is it exactly the same as doing a Put or Get command to the S:, K: or E: handlers via JSR's to $E456 (CIO)? I am trying to speed up a BBS I wrote in Basic in the 1980's by doing the I/O in machine language. I know how to load up the IOCB's and I can Put to R: and E:, but the computer hangs when I do a status command, and then I check location 747, and then do a Get (if there is a non-zero in 747). De Re Atari and the Technical Reference Notes don't have any documentation on the R: handler. The Atari 850 manual has no information regarding machine lanuage access to the handler. I am using SpartaDos X with its RS232 handler which I belive is used exactly like Atari's 850 handler. I can only think of 2 things...maybe showing 746 for any errors would shed light. And make sure you set the IOCB in X and it doesn't get changed. Also, Standard RS232 routine has a 32 byte incoming buffer and 32 byte outgoing buffer by default. Rick D. Edited April 23, 2008 by a8maestro Quote Link to comment Share on other sites More sharing options...
thorfdbg Posted April 23, 2008 Share Posted April 23, 2008 Thanks Thomas and Rybags. Thomas, your web page is very informative. Basic is not adequate for the 850. For any *serious* activity, you need to setup the concurrent mode, and then need to define an input and an output buffer by yourself where the interrupt routines of the R: handler will place their data. I do have concurrent mode on (it was turned on in BASIC). Do I set up the buffer address for the interrupt routines during the IOCB setup for a GET? I would think that the interrupt routines of the R: handler would have set up the buffer for me, no? In other words, where do the 850 interrupt routines put incoming bytes if I don't do a GET? The handler provides a pretty small input buffer (32 bytes) that can be used for a get. It's not large enough for any "serious" serial communiation (i.e. not at typewriter speed). You define the input buffer at the time you enter concurrent mode. XIO is not a good command for that since the IOCB Adr and Len fields are used to define the buffer address. AUX1 must be non-zero for that to work,i.e. the "enter concurrent mode" command defines the size and position of the input buffer if its AUX1 is non-zero. The GET implementation of the R: handler by default locks until data is available (i.e. it is blocking). Since the (default) R: handler also disables the BREAK key, your program hangs then until input becomes available. If hardware handshake is enabled, but the handshake is not signaled, the program will hang forever. Quote Link to comment Share on other sites More sharing options...
drac030 Posted April 23, 2008 Share Posted April 23, 2008 (edited) I am using SpartaDos X with its RS232 handler which I belive is used exactly like Atari's 850 handler. Just to clarify that: the SpartaDOS X "RS232.COM" program is not a "handler", it is just a command that loads the proper handler from the 850. By the way, make sure that the RS-232 buffers are outside the banking area ($4000-$7FFF). Edited April 23, 2008 by drac030 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.