Author: pimathbrainiac
Posted: 10 Jan 2013 10:07:01 am (GMT -5)
I know that I am double posting, but there is something I don't understand here:
There is no TXSIZ or RXSIZ in the axiom or the library file that I can find. Will you please give me a code example (with the original names of functions instead of the Axiom's functions [CnOn = normalpdf( etc.])
Thanks for helping me understand what I need to do, though
Posted: 10 Jan 2013 10:07:01 am (GMT -5)
I know that I am double posting, but there is something I don't understand here:
Compynerd255 wrote: |
I'm good with Axe if you want help with this. I've also used geekboy's Axiom before, so I can give you a good tutorial. First, what you should know is that local CALCnet and gCn (globalCALCnet) are indistinguishable from the programmer's point of view. Thus, any documentation that tells you how to use CALCnet will help you with gCn as well. Look at the CALCnet project page for some general use guidelines on how to use CALCnet. However, I can also give the basic framework here. The Axiom contains the commands that you'll be using, and the Axe library contains the various pointers to special areas in memory. I'll be using "o" for the degree sign for simplicity. 1. First, start CALCnet using "CnOn". At this point, the custom interrupt will be enabled, and your unique calc ID will be stored in oCID. Note also, at this point, that everything between L1 and L1 + 549 is reserved, so you should reallocate your variables elsewhere when you start. You also can't use anything that messes with interrupts, such as getKey (without parentheses, of course), DiagnosticOn / Off, and certainly not fnInt(). 2. Take a look at the send and receive (TX and RX, respectively) variables. Both of these memory areas are symmetric, containing a 5-byte space for an ID, a 2-byte space for a size, and a 255-byte space for the data. In each, the lower (first) byte of the size represents the actual size, and if the higher (second) byte of the size has its high bit set (it's >= 128, or RXSIZ >= 32768), it means that there is a live frame in that area. 3. To receive a frame, you should occasionally check for the high bit of RXSIZ to be set. If it is, then you process the frame. oRXID is the pointer to the sending calc's ID (so you can tell who it is and perhaps copy the ID somewhere), and oRXDAT points to the data that was sent. Once you're done with the packet, set RXSIZ to zero so that another frame can come in. 4. To send a frame: a. First, load the ID of the receiving calc into oTXID. If you load all zeros into here (I'd recommend using Fill()), the calculator will treat that as a broadcast frame, and try to send it to every calculator on the network, BUT there is no guarantee that the frame will make it to all or even any of the calcs on the network. If you load anything else into this field, the calc will try to send the frame to the calc with that ID, and will keep attempting to do so until it succeeds. b. Then, put the appropriate data into oTXDAT. This is pretty self explanatory, but you should know that this is all the unique data they get - part of this has to mark which frames are which. c. Next, store the number of bytes you wish to send into TXSIZ. d. Finally, mark the frame as live by setting the high bit of TXSIZ (ala 128->{oTXSIZ + 1}). When the frame is done sending, the high bit of TXSIZ will turn off. You can also abandon a frame manually by setting TXSIZ to zero yourself, then using FnOn :Stop to wait for the interrupt and make sure CALCnet gets the message. 5. Finally, when you're done using CALCnet, use CnOff. This will get you back to normal interrupts and unlock all of that space in L1 again. I can give you more details of what that means for you game, but for now, those are the basics. |
There is no TXSIZ or RXSIZ in the axiom or the library file that I can find. Will you please give me a code example (with the original names of functions instead of the Axiom's functions [CnOn = normalpdf( etc.])
Thanks for helping me understand what I need to do, though