Hey all,

I'm making a multiplayer game with 2 calculators, in which I want to share both scores. To do that, I'd like to swap both DE-registers. I figured this couldn't be that difficult, but I do not even know how to communicate with the USB port yet. And since this port wasn't there on the TI-83+ calculator, it's not explained in the ASMin28Days tutorial.
I'd appreciate if someone could help me out with this. Thanks in advance.

Greetings, Arriopolis.
Use CALCnet so that you can have two-or-more player games!

High-level details and video: http://www.cemetech.net/projects/item.php?id=33
Brief programming details: http://dcs.cemetech.net/index.php?title=Interfacing_CALCnet2
Although I appreciate the fact that CALCnet2.2 offers simple communication between calculators, I'd really like to just do it on my own... you know, getting some more coding experience.
My intuition says that it cannot be that hard... something like:
Sending calc:

Code:
Send:
LD A, $FF
OUT (USB-port), A
Send:
IN A, (USB-port)
CP $FF
JR NZ, Send
LD A, D
OUT (USB-port), A
LD A, E
OUT (USB-port), A

Recieving calc:

Code:
Receive:
IN A, (USB-port)
CP $FF   ;$FF indicates the other calc is ready
JR NZ, Receive
LD A, $FF
OUT (USB-port), A
NOP    ;Maybe more NOPs dunno...:)
IN A, (USB-port)
LD D, A
IN A, (USB-port)
LD E, A
Arriopolis, sorry for the slow response. I'm afraid that that is far, far too simplistic. Smile Even ignoring the USB port (which has the more complex semantics between the USB and I/O ports) and using the I/O port instead: there are four things you can do:

1) Pull the tip high
2) Pull the tip low
3) Pull the ring high
4) Pull the ring low

You have no other communication channels, certainly not a full byte, and you have no shared clock. Therefore, you must either use one of the lines as a shared clock, or coming up with a timing-agnostic protocol. To make your life slightly more complex (or slightly easier, depending on your perspective), if either calculator pulls either line low, then that line is low for both calculators until both calculators release it. Pseudocode:


Code:
 Calc A: out (ring), low
Calc B: in a,(ring) //reads low
Calc B: out (ring), high
Calc B: in a,(ring) // reads low
Calc A: out (ring), high
Calc B: in a,(ring) //reads high
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement