Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: pimathbrainiac on December 14, 2012, 01:03:17 pm

Title: AXE Linking
Post by: pimathbrainiac on December 14, 2012, 01:03:17 pm
I'm making a new (and better) pong game for the TI-84 in AXE.

I have everything done but linking.

My problem: I need to know how to link in such a way that the calcs are constantly in sync

The vars:
Y - P1 Y coordinate
_theta_ - P2 y coordinate
A - Ball X coodinate
B - Ball Y coordinate

Thanks in advance if you can help!
Title: Re: AXE Linking
Post by: V1mes on December 14, 2012, 01:04:21 pm
How are you currently trying to do it?
Title: Re: AXE Linking
Post by: pimathbrainiac on December 14, 2012, 01:05:34 pm
In no way at all... what I currently have crashes P1!

That's why I need help.
Title: Re: AXE Linking
Post by: Matrefeytontias on December 14, 2012, 01:06:33 pm
This should work :

Code: [Select]
0→A→B

Repeat A
Get+1→A
End
Repeat B
Send(your_byte,65535)→B
End

A--

And invert the order of the loops for the other calc. I recommend to make a test at the starting of the program to sync the calcs (like who's pushing [2nd] first).
Title: Re: AXE Linking
Post by: V1mes on December 14, 2012, 01:08:24 pm
If you leave the time field empty will it go on forever?
Title: Re: AXE Linking
Post by: pimathbrainiac on December 14, 2012, 01:16:27 pm
I just crashed both calcs b/c I don't understand Matrefeytontias's code...

please explain.
Title: Re: AXE Linking
Post by: V1mes on December 14, 2012, 01:18:46 pm
The first loop waits until a byte is received. Then when it is it adds 1 to it and stores it to A.

The second loop loops until it has sent your_byte.

Then A-- subtracts the one added to A at the end of the first loop restoring the sent value. Hope this helps.

On second thoughts you could have the loops as subs then you would have more control over the order they are called in
Title: Re: AXE Linking
Post by: pimathbrainiac on December 14, 2012, 03:00:13 pm
It works! (kinda) Still need a bit of help.
Title: Re: AXE Linking
Post by: Matrefeytontias on December 14, 2012, 04:31:15 pm
In fact, Get returns -1 if no byte was found, so I add it 1 and store it to A so if no byte was found, A is 0 and the loop repeats.

What are you having trouble with ?
Title: Re: AXE Linking
Post by: stevon8ter on December 14, 2012, 04:36:39 pm
Question, the getcalc (sending command...? ) , also returns a value if failed or completed right?
Title: Re: AXE Linking
Post by: Matrefeytontias on December 14, 2012, 04:43:31 pm
GetCalc() is the function to accesas an OS var in Axe. You send a byte with the command Send(byte, time), which returns zero if failed or non-zero otherwise.
Title: Re: AXE Linking
Post by: stevon8ter on December 14, 2012, 04:45:54 pm
Wow sorry mistake on my side xp

But yeah thanks, now i can now how i can do easy synchr... Thx :p
Title: Re: AXE Linking
Post by: pimathbrainiac on December 14, 2012, 05:02:26 pm
My problem: sending 3 vars from one calc, but only 1 from the other.
Title: Re: AXE Linking
Post by: stevon8ter on December 14, 2012, 05:09:15 pm
Hmmm, let the routines on the two calcs be different... So routine 1.1 = 3 sends... Routine 2.1 = 3 gets
Routine 1.2 = 1 get. Routine 2.2 = 1 send

Where 1.1 and 1.2 are for the calc that sends 3 vars
And 2.1 and 2.2 for the other calc...
?
Title: Re: AXE Linking
Post by: Matrefeytontias on December 15, 2012, 04:09:35 am
You can't send/receive a different number of bytes between 2 calcs. You always have to send and receive the same number of bytes, so if you want to send 3 bytes and receive 1, make the second calc send useless bytes as 2nd and 3rd to keep the calcs in sync.
Title: Re: AXE Linking
Post by: Builderboy on December 15, 2012, 04:15:25 am
You can't send/receive a different number of bytes between 2 calcs. You always have to send and receive the same number of bytes, so if you want to send 3 bytes and receive 1, make the second calc send useless bytes as 2nd and 3rd to keep the calcs in sync.
That is not necessarily true, with the right linking protocol you can send any number of bytes in either direction.  I wrote a basic tutorial on linking a while ago but I think it got lost D:
Title: Re: AXE Linking
Post by: pimathbrainiac on January 11, 2013, 10:09:05 am
Hey, For a different game, I'm doing a test for the engine with the link port.

It's not working... I think it's because I'm using the USB port, but does that actually make a difference in the code?
Title: Re: AXE Linking
Post by: Matrefeytontias on January 11, 2013, 12:54:07 pm
Ow, USB has nothing to do with the port D:
Title: Re: AXE Linking
Post by: pimathbrainiac on January 11, 2013, 12:55:10 pm
Crap! I'm going to have to borrow a cable from a math teacher at my school...
Title: Re: AXE Linking
Post by: Matrefeytontias on January 11, 2013, 01:17:04 pm
If the gCn axiom can't allow you to deal with the USB port, nothing will do (at least with Axe). I'm even not sure ASM can do something with the USB port without a host (and then the calc to be slave).
Title: Re: AXE Linking
Post by: pimathbrainiac on January 11, 2013, 01:19:18 pm
Well, I hope I can get that working... Does it work with a direct link???