Author Topic: USB Linking.  (Read 8706 times)

0 Members and 1 Guest are viewing this topic.

Offline matthias1992

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 408
  • Rating: +33/-5
    • View Profile
USB Linking.
« on: September 11, 2010, 01:32:35 pm »
Ok so recently a friend of mine and I tried some multiplayer games for the TI84+ series, guess whata, out of 5 tried games 0 worked! This is why we came up with the idea for a small asm library that we could use to make our own bomberman two-calc multiplayer game. however I can't find any info about sending info from one calc to another via the miniusb.

I intend on having the following commands available:

SendMode (sets a calculator ready for sending stuff, it will pause the program until one (one exactly) request is completed)
Syntax: {3}
requests:

ReqReal Requests a real variable from the other calc, the other calc has to be in SendMode!
Syntax: {4,#} #= any number from 1 to 26, 1=A, 2=B...26=Z (theta not supported)

ReqStr Requests a string variable from the other calc, the other calc has to be in SendMode!
Syntax: {5,#} #= any number from 0 to 9, 0=Str0, 1=Str1...9=Str9

ReqMtrx Requests a matrix variable from the other calc, the other calc has to be in SendMode!
Syntax: {6,#} #= any number from 1 to 10, 1=A, 2=B...10=J

ReqBuf Requests the screen buffer (basically what is on the screen on the sending calc) from the sending calc and draws it onto the screen of the requesting calc, the other calc has to be in SendMode!
Syntax: {7}

So can anybody give me some pointers on this? so far I ahve only found guides on how to link between a calc and a PC but not between two calcs...
MASM xxxxxxxxxx aborted | SADce ====:::::: 40% -Halted until further notice| XAOS =====::::: 50% -Units done| SKYBOX2D engine ========== 100% -Pre-alpha done. Need to  document it and extend |

~Those who dream by day are cognizant of much more than those who dream by night only. -Sir Edgar Allen Poe-

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: USB Linking.
« Reply #1 on: September 11, 2010, 01:47:17 pm »
Yeah, the issue with most of those games is that they came out before 15 MHz TI calcs existed, so most have broken linking on them. It would be cool to have USB linking. However, the games wouldn't be 83+ compatible, then.

In S.A.D case, I think one calc waits info from the other and to get told it received it, then does the same back, then back and forth.

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: USB Linking.
« Reply #2 on: September 11, 2010, 02:56:22 pm »
I wish you luck, especially given the sparse documentation. You'd probably be best off looking at http://wikiti.brandonw.net/index.php?title=Category:83Plus:Ports:By_Address and http://wikiti.brandonw.net/index.php?title=83Plus:OS:84_Plus_USB_Information, not to mention existing code that uses USB.
Good luck! :D
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: USB Linking.
« Reply #3 on: September 11, 2010, 03:03:56 pm »
My question is, why are you sing the usb instead of the I/O cable?  All 84-83 series have an Io Port, so you have comparability, and the usb is crazy hard to manipulate if i remember correctly?  That being said, however, we have been lacking in usb multiplayer games, and there are a lot of people out there with only usb cables, so it might be to their advantage... hmmm

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: USB Linking.
« Reply #4 on: September 11, 2010, 03:43:17 pm »
Most likely because 84+(SE)'s don't come with an I/O cable ;D
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: USB Linking.
« Reply #5 on: September 11, 2010, 03:47:41 pm »
Ahhhhhh yes that would be the reason.  I still wonder why TI put IO ports on the 84's but didnt supply an IO cable? o.O Either way, i hope USB can match the speed of IO!

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: USB Linking.
« Reply #6 on: September 11, 2010, 03:50:54 pm »
I would assume for 83+(SE) compatibility :P
Yeah, I hope the speed can be comparable.
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline BrandonW

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 115
  • Rating: +38/-1
    • View Profile
Re: USB Linking.
« Reply #7 on: September 11, 2010, 03:51:43 pm »
There's some (admittedly old) code at http://brandonw.net/calcstuff/remote8x.zip that shows how to quickly talk back and forth between two calculators connected via direct USB. It does too much stuff between transfers so it's dog slow, but you get the idea.

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: USB Linking.
« Reply #8 on: September 11, 2010, 04:03:26 pm »
Do you have any example code (or does anyone) of how to act as a peripheral, since one device would be host and the other would have to be control?
Good idea to link to Remote8x, though. :D
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline matthias1992

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 408
  • Rating: +33/-5
    • View Profile
Re: USB Linking.
« Reply #9 on: September 11, 2010, 04:06:34 pm »
thanks all!

I had to 0x5 because I now understand why 0 of these games worked, we were trying them over USB, not over the IO port! Gosh that is stupid of me....It does solve the mistery though...

From the sparse information that I read it can be pretty fast up to 4KB a sec I think (I read that somewhere). Also whoever has tried to send a program from calc 1 to calc 2 over the USB will notice that it goes pretty fast. From PC->calc and vice versa is quite slow but that is because there is a whole interface and handshaking process involved which takes quite some time. Indeed this will be 84+ exclusive...

I'll think that I will release a library then with source to make USB link gaming more...ehr...available...
unless it is depressingly slow of course because then it wouldn't be really worth the effort.
« Last Edit: September 11, 2010, 04:23:08 pm by matthias1992 »
MASM xxxxxxxxxx aborted | SADce ====:::::: 40% -Halted until further notice| XAOS =====::::: 50% -Units done| SKYBOX2D engine ========== 100% -Pre-alpha done. Need to  document it and extend |

~Those who dream by day are cognizant of much more than those who dream by night only. -Sir Edgar Allen Poe-

Offline BrandonW

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 115
  • Rating: +38/-1
    • View Profile
Re: USB Linking.
« Reply #10 on: September 11, 2010, 04:10:14 pm »
Do you have any example code (or does anyone) of how to act as a peripheral, since one device would be host and the other would have to be control?
Good idea to link to Remote8x, though. :D

Yeah, I just did link to the example code. The TI-OS will deal with who is host and who is peripheral through HNP (Host Negotiation Protocol) and make sure power is supplied to the port. You don't need to concern yourself with it.

If you mean truly act as an independent USB peripheral (like a USB keyboard, mouse, PS3 jailbreak stick, etc.), then look at periph8x at http://brandonw.net/svn/calcstuff/periph8x/trunk/ or http://brandonw.net/svn/calcstuff/PS3JB/trunk/

Offline matthias1992

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 408
  • Rating: +33/-5
    • View Profile
Re: USB Linking.
« Reply #11 on: September 11, 2010, 04:23:14 pm »
Code: [Select]
SendUSBData:
;Sends data over USB.
;Inputs:        HL => pointer in zone 1 (RAM pages 3\2) of data to send.
;               DE: number of bytes to send.
;Outputs:       DE bytes sent from HL.
;               Carry flag set if any issues.
SendUSBData:
        res 0,(iy+43h)
        bcall(50F2h)
        res 0,(iy+41h)
        res 5,(iy+41h)
        ret
what do you mean with this: "zone 1 (RAM pages 3\2)" especially the 3\2 part...
could you maybe give me a example with the Basic TI-OS variable 'A' (a ti-os real variable is 9 bytes right?) being send? (I think I understand the receiving code...) Thanks!
« Last Edit: September 11, 2010, 04:26:31 pm by matthias1992 »
MASM xxxxxxxxxx aborted | SADce ====:::::: 40% -Halted until further notice| XAOS =====::::: 50% -Units done| SKYBOX2D engine ========== 100% -Pre-alpha done. Need to  document it and extend |

~Those who dream by day are cognizant of much more than those who dream by night only. -Sir Edgar Allen Poe-

Offline BrandonW

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 115
  • Rating: +38/-1
    • View Profile
Re: USB Linking.
« Reply #12 on: September 11, 2010, 04:47:02 pm »
Sending REAL variables is a lot more complicated, I don't have time to type up such an example. remote8x shows the direct USB link protocol that the OS uses to send and receive OS variables, and there's a text document out there ("DirectUSB.txt") somewhere that documents the entire thing fully.

"Zone 1" is just a convention I use to talk about the extra RAM pages. In the last two banks are usually RAM pages 1 and 0 (or "1\0"), which I consider zone 0.
Zone 1 is RAM pages 3 and 2.
Zone 2 is RAM pages 5 and 4.
Zone 3 is RAM pages 7 and 6.

Offline matthias1992

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 408
  • Rating: +33/-5
    • View Profile
Re: USB Linking.
« Reply #13 on: September 11, 2010, 04:49:02 pm »
Thanks! I understand it is a lot of work, I'll be looking for that file and link to it here if I find it..might be usefull to others as well...

edit:
Benjamin, mysterious as ever hehe...I now see that you were ironic about a DirectUSB.txt file being "somewhere" hehe. So that is your way to say 'Google is your friend' eh? well, yeah it is and I have skimmed trough your file before but I clearly must have misunderstood it because I thought it was 'bout calc>PC and vice versa, not calc-to-calc connection...

btw for anyone who needs it, here is the file: http://www.brandonw.org/calcstuff/DirectUSB.txt (just my way of saying BrandonW's cryptic references aren't as good as google :P)
« Last Edit: September 11, 2010, 05:13:47 pm by matthias1992 »
MASM xxxxxxxxxx aborted | SADce ====:::::: 40% -Halted until further notice| XAOS =====::::: 50% -Units done| SKYBOX2D engine ========== 100% -Pre-alpha done. Need to  document it and extend |

~Those who dream by day are cognizant of much more than those who dream by night only. -Sir Edgar Allen Poe-

Offline jnesselr

  • King Graphmastur
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2270
  • Rating: +81/-20
  • TAO == epic
    • View Profile
Re: USB Linking.
« Reply #14 on: September 11, 2010, 05:06:31 pm »
Isn't that for calc<->PC?