Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: Michael_Lee on January 14, 2011, 02:35:39 pm

Title: How do I use calcnet for Axe?
Post by: Michael_Lee on January 14, 2011, 02:35:39 pm
Insofar as I can tell, using calcnet seems to be fairly simple - a certain amount of RAM is allocated for data, and there are about 4 commands I can use to send/recieve data.  However, I have no idea on the specifics, and the nature of the sending-of-data.
So out of curiosity...

1] Which area of RAM can I store data to?  (I think it's L1?)
2] How do I instruct my calculator to send/recieve data?
3] When sending data, how exactly does it work?  Does it take the contents of my buffer and update every other buffer to match mine, or what?
4] Is there a way to use Calcnet without having to require/bundle DoorsCS 7.1 with each program?
5] Could somebody provide a simple example of an Axe program using Calcnet?
6] How do I simulate linking two calculators in wabbitemu?
7] How is Calcnet spelled?  Is it 'calcnet', or 'CalcNet', or 'Calcnet', etc...
Title: Re: How do I use calcnet for Axe?
Post by: JosJuice on January 14, 2011, 02:36:46 pm
4] Is there a way to use Calcnet without having to require/bundle DoorsCS 7.1 with each program?
No.
Title: Re: How do I use calcnet for Axe?
Post by: aeTIos on January 14, 2011, 02:37:01 pm
you dont have to have cn, using a simple 2.5mm jack cable with get( and send( is enough
Title: Re: How do I use calcnet for Axe?
Post by: Michael_Lee on January 14, 2011, 02:40:04 pm
4] Is there a way to use Calcnet without having to require/bundle DoorsCS 7.1 with each program?
No.
Ah, well, pretty much what I expected.

you dont have to have cn, using a simple 2.5mm jack cable with get( and send( is enough
Okay,
8] Do the send( and get( commands send/recieve data for an extended period of time, or for only a brief millisecond?
9] Is it feasible to send about 100 bytes of data using get( and send(?
Title: Re: How do I use calcnet for Axe?
Post by: KermMartian on January 14, 2011, 02:42:27 pm
I cannot help you with Axe, but I can help you with CALCnet.  If you wish to pick my brain, I'll try to remember to check this topic (someone on #cemetech on IRC alerted me to it), but it's very likely I'll forget, so I'd ask that if you would like to pursue CALCnet that you poke my on Cemetech.
Title: Re: How do I use calcnet for Axe?
Post by: Compynerd255 on January 14, 2011, 02:44:29 pm
Using CALCnet is actually very important for having 3+ player games. It basically works with every calculator having a 3-byte address. When you send data to someone else, you store the address first, then the packet contents, then the size of the packet contents, in that order. Once you do that, the interrupt routine will simply send the information byte by byte to the target's recieve buffer. Look up the CALCnet2.2 whitepaper on cemetech.net.
Title: Re: How do I use calcnet for Axe?
Post by: aeTIos on January 14, 2011, 02:44:57 pm
the time is:
send(byte,timeinticks)
so to send 100 bytes in str1, you could use
for(a,0,99)
send({str1+a},10)
end

get checks if there's a byte in the link port
for(b,0,99
get->{str1+b}
end
Title: Re: How do I use calcnet for Axe?
Post by: KermMartian on January 14, 2011, 02:53:47 pm
*Five byte address, but close enough.  The whitepaper (and an abbreviated HOWTO) are at the following pair of links, respectively:

http://www.cemetech.net/projects/item.php?id=33
http://dcs.cemetech.net/index.php?title=Interfacing_CALCnet2
Title: Re: How do I use calcnet for Axe?
Post by: DJ Omnimaga on January 14, 2011, 05:12:02 pm
I cannot help you with Axe, but I can help you with CALCnet.  If you wish to pick my brain, I'll try to remember to check this topic (someone on #cemetech on IRC alerted me to it), but it's very likely I'll forget, so I'd ask that if you would like to pursue CALCnet that you poke my on Cemetech.
Idea, I can edit the topic title to "Kerm, read this or I'll eat you (CALCnet question)" so it highlights you on IRC. ;D

j/k that would get annoying :P
Title: Re: How do I use calcnet for Axe?
Post by: Happybobjr on January 14, 2011, 05:24:58 pm
One of your most powerful tools is "if"

all my send statements are.
If Send(#,"length)
Title: Re: How do I use calcnet for Axe?
Post by: Munchor on January 14, 2011, 07:21:58 pm
I think I might learn Axe+CalcNet some of these days. Those links are useful!
Title: Re: How do I use calcnet for Axe?
Post by: KermMartian on January 14, 2011, 07:25:25 pm
I think I might learn Axe+CalcNet some of these days. Those links are useful!
Cheers, Scout.  DJ, hehe.
Title: Re: How do I use calcnet for Axe?
Post by: Michael_Lee on January 14, 2011, 07:29:22 pm
I really need to learn assembly one of these days.
Thanks for the links, Kerm!
Title: Re: How do I use calcnet for Axe?
Post by: jnesselr on January 14, 2011, 10:18:16 pm
When full axiom support is available, It might be easy enough to just do the basic calcnet commands without DCS.  If you were doing an app or something, that might be best considering how big DCS is.
Title: Re: How do I use calcnet for Axe?
Post by: Compynerd255 on January 14, 2011, 11:26:46 pm
Insofar as I can tell, using calcnet seems to be fairly simple - a certain amount of RAM is allocated for data, and there are about 4 commands I can use to send/recieve data.  However, I have no idea on the specifics, and the nature of the sending-of-data.
So out of curiosity...

1] Which area of RAM can I store data to?  (I think it's L1?)
2] How do I instruct my calculator to send/recieve data?
3] When sending data, how exactly does it work?  Does it take the contents of my buffer and update every other buffer to match mine, or what?
4] Is there a way to use Calcnet without having to require/bundle DoorsCS 7.1 with each program?
5] Could somebody provide a simple example of an Axe program using Calcnet?
6] How do I simulate linking two calculators in wabbitemu?
7] How is Calcnet spelled?  Is it 'calcnet', or 'CalcNet', or 'Calcnet', etc...
1) About the first 600 bytes of L1 are used by CALCnet2.2, so if you want to store data, you must store to the end of L1, to L3 (abandoning grayscale, L4 (abandoning archiving), or an appvar in user memory (this is actually what I do in Eitrix, which is being developed here).
2) Read the CALCnet whitepaper on cemetech.net. Sending basically is storing bytes in certain locations in a certain order. Recieving happens automatically, and you only have to check the recieve buffer, do what you want with it, and then clear it. The CALCnet interrupt takes care of the rest.
3) CALCnet uses point-to-point sending. Each calculator has a unique 3-byte address based on its serial number. When you send data, you store where you want it to go, and it will get there in less than a tenth of a second if everything is working right. You would store 0 to the address to send the message to everyone (this is how you would send your ID), and use AAAAAA to connect to a router that connects to the Internet.
4) Sadly, you do need DoorsCS, unless you can somewhow embed the libraries into your program. Someone with influence at Cemetech could convince Kerm to make a smaller version with some of the features removed (such as the BASIC libs).
6) I don't know about wabbitemu, but Tilem 0.992 (the emulator I use) supports libticables, which allows an instance of the emulator to set a virtual link cable for linking together two calculators. You can also use this to link with a real cable (except for TI-84 Plus Directlink) which you could modify or couple to link with more than one calculator (although I don't know how good that is for your computer).
7) The first time you use it, you write CALCnet2.2. Thereafter, you can write CALCnet.

CALCnet is essential when you are sending a lot of data or linking more than one calculator (through simply splicing link cables together). Other than that, you should use Axe's linking functionality.
Title: Re: How do I use calcnet for Axe?
Post by: Compynerd255 on January 26, 2011, 10:31:05 am
I wrote a little sample code to show how to use CALCnet2.2 in Axe. The code assigns a player index to your calculator, occassionally broadcasts that index to others, and takes recieved player indices and stores their 5-byte addresses in memory:
Code: [Select]
ClrHome
Disp "F1-F5=P1-P5"
0->K
Repeat K>=49 and (K<54)
getKey->K
ReturnIf K=15
End
ClrHome
K-49->D
0->{L3
Fill(L3,40
Disp "LINKING...",i
.START CALCNET
Asm(CD4209)
.CLEAR SEND BUFFER
Asm(CD420C)
.CLEAR RECIEVE BUFFER
Asm(CD420F)
0->T
Repeat getKey(15)
!If T^16
.SEND FRAME
Asm(CD420C)
.SENDER INDEX (0 for all)
0->{L1+270}
Fill(L1+270,5
.FRAME CONTENT
D->{L1+277}
.FRAME SIZE
1->{L1+276}
.READY SIGNAL
128->{L1+275
End
T+1->T
.CHECK RECIEVE
If {L1+12}>128
.COPY PLAYER ADDRESS TO SPACE DICTATED BY PLAYER INDEX
Copy(L1+7,{L1+14}*8+L3,5
.PRINT PLAYER ADDRESS IN RIGHT SPOT
Output(1,{L1+14}+1,{L1+14}+L3
.CLEAR RECIEVE BUFFER
Asm(CD420F
End
End
.STOP CALCNET (Remember to use!)
Asm(CD4212)
Return
Title: Re: How do I use calcnet for Axe?
Post by: JustCause on January 28, 2011, 09:48:14 am
I wrote a little sample code to show how to use CALCnet2.2 in Axe. The code assigns a player index to your calculator, occassionally broadcasts that index to others, and takes recieved player indices and stores their 5-byte addresses in memory:
<codebox omitted>

This crashes for me. Yes, I remembered to call the "stop CALCnet" opcode. Have you tested this? I'm not sure whether to trust my hardware anymore.
Title: Re: How do I use calcnet for Axe?
Post by: JosJuice on January 28, 2011, 12:02:50 pm
I wrote a little sample code to show how to use CALCnet2.2 in Axe. The code assigns a player index to your calculator, occassionally broadcasts that index to others, and takes recieved player indices and stores their 5-byte addresses in memory:
<codebox omitted>

This crashes for me. Yes, I remembered to call the "stop CALCnet" opcode. Have you tested this? I'm not sure whether to trust my hardware anymore.
Are you using the newest versions of Axe? The older versions stores variables in the location where CALCnet expects its data to be.
Title: Re: How do I use calcnet for Axe?
Post by: KermMartian on January 28, 2011, 12:10:29 pm
Just to remind you, since I hardly ever notice these topics, try to poke me on Cemetech if you have any specific CALCnet2.2 questions.  As I said previously, though, I'll try to remember to look for this topic.
Title: Re: How do I use calcnet for Axe?
Post by: JustCause on January 28, 2011, 03:12:30 pm
I wrote a little sample code to show how to use CALCnet2.2 in Axe. The code assigns a player index to your calculator, occassionally broadcasts that index to others, and takes recieved player indices and stores their 5-byte addresses in memory:
<codebox omitted>

This crashes for me. Yes, I remembered to call the "stop CALCnet" opcode. Have you tested this? I'm not sure whether to trust my hardware anymore.
Are you using the newest versions of Axe? The older versions stores variables in the location where CALCnet expects its data to be.

0.4.8. It just up and RAM clears whenever I try to call any of those opcodes.

DCS 7 Beta 1.
Title: Re: How do I use calcnet for Axe?
Post by: FinaleTI on January 28, 2011, 03:21:58 pm
I wrote a little sample code to show how to use CALCnet2.2 in Axe. The code assigns a player index to your calculator, occassionally broadcasts that index to others, and takes recieved player indices and stores their 5-byte addresses in memory:
<codebox omitted>

This crashes for me. Yes, I remembered to call the "stop CALCnet" opcode. Have you tested this? I'm not sure whether to trust my hardware anymore.
Are you using the newest versions of Axe? The older versions stores variables in the location where CALCnet expects its data to be.

0.4.8. It just up and RAM clears whenever I try to call any of those opcodes.

DCS 7 Beta 1.
That might be your problem.
DCS 7.1 Beta 2 was the first version to have Calcnet implemented in it if I'm not mistaken.
Title: Re: How do I use calcnet for Axe?
Post by: JustCause on January 28, 2011, 04:04:46 pm
I wrote a little sample code to show how to use CALCnet2.2 in Axe. The code assigns a player index to your calculator, occassionally broadcasts that index to others, and takes recieved player indices and stores their 5-byte addresses in memory:
<codebox omitted>

This crashes for me. Yes, I remembered to call the "stop CALCnet" opcode. Have you tested this? I'm not sure whether to trust my hardware anymore.
Are you using the newest versions of Axe? The older versions stores variables in the location where CALCnet expects its data to be.

0.4.8. It just up and RAM clears whenever I try to call any of those opcodes.

DCS 7 Beta 1.
That might be your problem.
DCS 7.1 Beta 2 was the first version to have Calcnet implemented in it if I'm not mistaken.
NetPong and the speed test work, so I'm guessing that's not true.
Title: Re: How do I use calcnet for Axe?
Post by: JosJuice on January 28, 2011, 04:10:41 pm
I wrote a little sample code to show how to use CALCnet2.2 in Axe. The code assigns a player index to your calculator, occassionally broadcasts that index to others, and takes recieved player indices and stores their 5-byte addresses in memory:
<codebox omitted>

This crashes for me. Yes, I remembered to call the "stop CALCnet" opcode. Have you tested this? I'm not sure whether to trust my hardware anymore.
Are you using the newest versions of Axe? The older versions stores variables in the location where CALCnet expects its data to be.

0.4.8. It just up and RAM clears whenever I try to call any of those opcodes.

DCS 7 Beta 1.
That might be your problem.
DCS 7.1 Beta 2 was the first version to have Calcnet implemented in it if I'm not mistaken.
NetPong and the speed test work, so I'm guessing that's not true.
Any version of 7.1 (including the 7.1 betas) should work. However, if you're going to connect to other calcs, it's strongly recommended that you use 7.1.1.
Title: Re: How do I use calcnet for Axe?
Post by: FinaleTI on January 28, 2011, 04:20:21 pm
I guess I was wrong. Aside from that, I'm unsure of the problem.
Title: Re: How do I use calcnet for Axe?
Post by: Eeems on January 28, 2011, 04:29:01 pm
Just to remind you, since I hardly ever notice these topics, try to poke me on Cemetech if you have any specific CALCnet2.2 questions.  As I said previously, though, I'll try to remember to look for this topic.
You could always click the notify option to get emails whenever this topic is replied to.
Title: Re: How do I use calcnet for Axe?
Post by: DJ Omnimaga on January 30, 2011, 04:13:53 am
JustCause if I was you I would upgrade to DCS7 latest version. It hasn't been in beta anymore for months. O.O
Title: Re: How do I use calcnet for Axe?
Post by: Quigibo on January 30, 2011, 01:25:51 pm
I'm pretty sure those calls are not in little-endian.  Switch the last hex pair with the middle hex pair for all the calls.
Title: Re: How do I use calcnet for Axe?
Post by: Compynerd255 on February 01, 2011, 10:36:16 am
Thanks, Quigibo. I tried changing all of the CDs to CFs (Call to b_Call) but I'll try this suggestion and see how it works.

On another note, when I try to do linking in WabbitEmu, I can't get it to work. I use this exact command sequence:
F12 (to switch the calc on)
File -> New
F12
Calculator -> Connect To...

And nothing happens. Before and after I use this command, link apps that do work on real hardware (Bomberkids, Bubble Bobble, the TI link system itself) do not work in WabbitEmu. I've tried both the 32 bit and 64 bit versions in Windows 7 Ultimate, 64 bit. Do you know what is going on?
Title: Re: How do I use calcnet for Axe?
Post by: souvik1997 on February 01, 2011, 12:14:30 pm
Use PindurTI for linking.
Title: Re: How do I use calcnet for Axe?
Post by: Fast Crash on February 01, 2011, 12:29:49 pm
i tried with pindur TI, how do i link the two calcs ?
Title: Re: How do I use calcnet for Axe?
Post by: DJ Omnimaga on February 01, 2011, 11:55:42 pm
According to the readme (which is only included in the Omni download version and WikiTI) you have to click the 3rd icon above each calc screens. There's the pause icon, the hi speed icon (lightning bolt), the link icon and another icon which is for screenshoting, I think.
Title: Re: How do I use calcnet for Axe?
Post by: Compynerd255 on February 02, 2011, 10:11:33 am
Wait, is this for Wabbit or PindurTI?
Title: Re: How do I use calcnet for Axe?
Post by: JustCause on February 03, 2011, 09:02:02 am
Ok, swapping the last two pairs makes it not crash. Have not confirmed whether this actually makes it work tho. (Don't have another calc.)
Title: Re: How do I use calcnet for Axe?
Post by: KermMartian on February 06, 2011, 01:55:10 am
@Eeems: Then I would have to still visit and add watching to each new topic relevant to me, and then get tons of emails. I don't have that kind of time with research, classes, teaching, and personal projects. :)
Title: Re: How do I use calcnet for Axe?
Post by: DJ Omnimaga on February 06, 2011, 02:06:08 am
On that note, I wonder if topic notifications actually sends the entire post content via e-mail? That said, if the quote is not included, then I guess it doesn't help much, since you have to check the topic anyway (and find it in the first place, which can take a while if you haven't visited for a few days)
Title: Re: How do I use calcnet for Axe?
Post by: Compynerd255 on February 07, 2011, 10:31:13 am
The post is not included. I used to have notifications for my Eitrix forum, but the post doesn't show up in the email. However, the email does contain the link to the post, so simply clicking the link will take you to the post.
Title: Re: How do I use calcnet for Axe?
Post by: DJ Omnimaga on February 07, 2011, 02:20:01 pm
Ah ok X.x, I guess it's only for PMs, then.
Title: Re: How do I use calcnet for Axe?
Post by: Compynerd255 on March 29, 2011, 03:33:26 pm
I'm necroposting on the forum because I redid the basic CALCnet code so that it WORKS!
Code: [Select]
ClrHome
0→{L3}
Fill(L3, 5

Asm(CD0942)
0→T→A
Repeat getKey(15)
T+1→T
If (L1+275}=0 and (T>A)
.SEND
Asm(CD0C42)
rand^256+128+T→A
Copy(L3,L1+270,5
T→{L1+277}r
2→{L1+275}
128→{L1+276}
Disp T►Hex,":SEND",i
End
If {L1+13}
{L1+14}r→T
Disp T►Hex,":RCVD",i
Copy(L1+7,L3,5
Asm(CD0F42)
End
End
Asm(CD1242)
In this code, two calculators will actually send and recieve frames to each other, synchronizing the T variable.
Title: Re: How do I use calcnet for Axe?
Post by: Ashbad on March 29, 2011, 03:52:45 pm
wow, sounds awesome ^-^

next step will be to make an axiom for this :D actually won't be as hard in assembly.
Title: Re: How do I use calcnet for Axe?
Post by: DJ Omnimaga on March 29, 2011, 03:55:50 pm
That is great! An axiom would definitively be great, or at least an Axe routine available for download. I'm sure that Axe combined with gCn will cause many online games to be created.
Title: Re: How do I use calcnet for Axe?
Post by: Compynerd255 on March 29, 2011, 04:00:24 pm
Once I get this working completely, I'll probably convert this to an Axe Library or even an Axiom (although I'm not all that good at assembly, lol). I'll post it once I'm able to reliably transport ridiculously long and complex messages.

EDIT: And then I'll write it into Eitrix.
Title: Re: How do I use calcnet for Axe?
Post by: DJ Omnimaga on March 29, 2011, 04:05:15 pm
Cool. Will we be able to choose an amount of bytes to send at once and stuff like that, or will it just be one by one? Multiple bytes sending at once would be nice. I also wonder how will we interface between calcs (in 4 player mode, for example). I really need to concentrate and read the docs on Cemetech describing how CALCnet protocol works at one point...
Title: Re: How do I use calcnet for Axe?
Post by: Compynerd255 on March 29, 2011, 04:24:54 pm
The documents tell it all, but I'll give the rundown:
- In CALCnet, data transmission takes place in frames (the equivalent of packets). A frame contains a size word, the unique 5-byte address of the sender, and up to 255 bytes of data. To send a frame, one clears the send buffer, then stores the recipient, the data, and then the size, with the high bit of the MSB set.
- Each calculator has a unique 5-byte address that is assigned to it when CALCnet is initialized. When you send a message, you may either store their address to send a message only to them, or send a message to 0x0000000000 to send a message to all the calculators connected to the network (a broadcast frame).
- Because of CALCnet's nature, you could theoretically connect every single calc that TI has ever minted. :)
Title: Re: How do I use calcnet for Axe?
Post by: Freyaday on March 29, 2011, 05:10:27 pm
Think of all the processing power..../me drools.
Title: Re: How do I use calcnet for Axe?
Post by: Compynerd255 on March 29, 2011, 07:57:05 pm
I've made good progress this afternoon on a CALCnet library. What's cool about it is that not only does it send and recieve frames, but will also keep track of the 5-byte addresses of all the online players in any location you choose, up to the number you dictate. I still need to test it and tweak it, but expect something next week, if not sooner.

EDIT: And I just found out that the code I put up doesn't actually work very well: messages only get to one calc while the other suffers. And I also found out that when the Disp command scrolls the homescreen, the CALCnet signal values are tampered with.