[Featured][Alpha] CLAP - TI Link - http://clap.timendus.com

Here you can find side projects of the staff and great projects which we think should get extra support. (Note that featured projects are not projects by staff members of MaxCoderz)

Moderator: MaxCoderz Staff

Post Reply
User avatar
KermMartian
Calc Wizard
Posts: 549
Joined: Tue 05 Jul, 2005 11:28 pm
Contact:

Post by KermMartian »

Butdoes he haveenough free of the 16k-400 b?
Image Image Image
User avatar
kalan_vod
Calc King
Posts: 2932
Joined: Sat 18 Dec, 2004 6:46 am
Contact:

Post by kalan_vod »

I was just asking, don't know if he wants to add it anyway >.>
User avatar
Timendus
Calc King
Posts: 1729
Joined: Sun 23 Jan, 2005 12:37 am
Location: Netherlands
Contact:

Post by Timendus »

kalan_vod wrote:Once this is finished would it be ok to add it to xLIB (with tr1p1eas permission)

Sure it would, it's open source, distribute it in any way you like. As always; just give a bit of credit where credit is due :) If he has a good modular variable input system (which he undoubtedly has), it shouldn't add more than around 200 bytes.

kerm wrote:Just to make sure, you don't particularly mind if I try to code a set of competing routines on my own, right?

I wouldn't be dancing in joy, but it will not bother me either. Let's see how far you get without leeching first ;)
http://clap.timendus.com/ - The Calculator Link Alternative Protocol
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
User avatar
KermMartian
Calc Wizard
Posts: 549
Joined: Tue 05 Jul, 2005 11:28 pm
Contact:

Post by KermMartian »

Timendus wrote:
kerm wrote:Just to make sure, you don't particularly mind if I try to code a set of competing routines on my own, right?

I wouldn't be dancing in joy, but it will not bother me either. Let's see how far you get without leeching first ;)
Don't worry, I'm looking forward to the challenge of seeing what I can do once school ends May 10th.
Image Image Image
User avatar
kalan_vod
Calc King
Posts: 2932
Joined: Sat 18 Dec, 2004 6:46 am
Contact:

Post by kalan_vod »

So is this using interrupts? I am a little unclear about it.
Liazon
Calc Guru
Posts: 962
Joined: Thu 27 Oct, 2005 8:28 pm

Post by Liazon »

I don't think so. Link port code is typically not interrupt based. But I'm usually wrong. Communicating with the link port is done similarly to reading the keypad, it's just a different port though.
Image Image Image
User avatar
Timendus
Calc King
Posts: 1729
Joined: Sun 23 Jan, 2005 12:37 am
Location: Netherlands
Contact:

Post by Timendus »

It isn't using interrupts yet, but I'm working on that ;) You're right, Liazon, linking isn't typically interrupt based, but it isn't typically done among more than two calculators either :P I have a nice interrupt setup done and I have already written quite a bit of the necessary routines, so I "just" need to finish and debug it.

Could take a while though, because I'm having my gf over for three days starting tomorrow evening, then sunday I'm visiting my parents, and mondays and tuesdays are usually very busy... Perhaps I can do something tomorrow, otherwise it'll have to wait untill half way next week I'm afraid.
http://clap.timendus.com/ - The Calculator Link Alternative Protocol
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
User avatar
kalan_vod
Calc King
Posts: 2932
Joined: Sat 18 Dec, 2004 6:46 am
Contact:

Post by kalan_vod »

Well, from what tr1p1ea told me. Using interrupts with the TI-OS in basic, it doesn't work well. Something like that, you think you could make one without the interrupts?
Liazon
Calc Guru
Posts: 962
Joined: Thu 27 Oct, 2005 8:28 pm

Post by Liazon »

Well, the interrupts will make it impossible to do GS at the same time (am I right?) because iirc, there is only one interrupt that you can really redirect as opposed to the 2-7 (I think only 2 can really be messed around with) on 68k calcs.

So he has to write some non-interrupt versions, most likely for 2 calc though.

The purpose of interrupts I'm guessing is to improve the sync of the four calcs.

Just wondering, theoretically couldn't you just:
1.) Disable interrupts
2.) Use a sync routine
3.) enable interrupts inmediately after

and the result is 4 calcs with interrupts triggering at about the same time. then you could use the interrupt to do data transfers. Probably changing the sender calc every time.

Just wondering of course :D I'm not ASM expert like you guys :D
Image Image Image
User avatar
Timendus
Calc King
Posts: 1729
Joined: Sun 23 Jan, 2005 12:37 am
Location: Netherlands
Contact:

Post by Timendus »

@Kalan: Everything I have so far is interrupt-less. The next layer that I'm working on now will use the lower levels in an interrupt routine to make things easier for real time games. But that has nothing to do with the Basic interface. To explain, here are the different levels:

low level - Easily control the hardware (not possible in Basic interface)
mid level - Sending over bytes using the low level (is in the Basic interface)
high level - Sending over blocks of data using the mid level (could be put in Basic interface)
network level - Setting up and using a network using the mid level (not in Basic interface, and will probably not get there)
net handler level - Holds the network level in an interrupt to make things easier (not in Basic interface)

@Liazon: Yes, the networking interrupt will make it impossible to use greyscale, but:
- you don't have to use the interrupt for networking
- you can try merging the two interrupts, shouldn't be difficult, but I expect very ugly flickers when data is received
- the networking part will slow the game down enough; using greyscale too will probably make it too slow to be fun

And if I understand correctely how the interrupt timers work, they will not be reset when you enable interrupts. Only when you put the calc in low power mode (soft powerdown). So your idea of synchronizing the interrupts is pretty cool, but I don't think it'll work :)

Anyway, I don't use the interrupt to synchronize the network. I use it to enable calculators to be running a program/game and listen for transfers on the link port at the same time.

Ordinary two player link games usually swap a byte once every loop of the main routine, and that's it. You can't really do this in a scalable network though, because it will slow everything down way too much when the network gets larger. The other option you have is to check if a transfer is about to be sent once every loop of the main routine, and jump to a receive routine when you do. This can be dangerous though, if you happen to be doing something time intensive outside the main loop (like copying sprites to the screen and calling ionFastCopy) and you return too late to detect the transfer in time. I will add that option to the library though, because it can be useful if people want to try making a greyscale multiplayer game.

Anyway, the third option you have is to set up an interrupt with the sole task of doing that transfer check. It's there in the background, just waiting for a transfer to begin, while your game is running in front. When a transfer is detected, it calls a receive routine, checks if the transfer is meant for you, and if so it calls a user defined handler. So if you'd want to make a multiplayer game where you can walk around the screen for some reason, you'd just make your own transfer handler accept coordinates and draw your opponent on the screen. Whenever you move your character, your own coordinates are sent out to the other calculators, who then get triggered to draw your sprite.

Anyway, I'll make a few demo programs to do the talking for me when I finish the library routines :)
http://clap.timendus.com/ - The Calculator Link Alternative Protocol
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
User avatar
Timendus
Calc King
Posts: 1729
Joined: Sun 23 Jan, 2005 12:37 am
Location: Netherlands
Contact:

Post by Timendus »

It's been a while :)

But I have been able to do a few things for this project. I wrote a nice demo for the interrupt part of the library, but that part isn't done yet, so there's nothing to demonstrate yet :P I plan to add a bit more network handling and there should still be an endless loop that you can't "clear" out of. When that is done it shouldn't be much work to finish the interrupt (which, in fact, is pretty much done except for bugfixing if necessary) and write another send routine that preceeds data transfers with a handshake. Then it needs a lot of testing, bugfixing, modifying, fine-tuning, et cetera, and it'll be done :)

On the hardware part I've been to my local hardware store to find out that they didn't have the 2.5mm male plugs that I wanted. I got myself a few 2.5mm female plugs though that gave me an idea. You can easily modify your every day link cable like this:

Image

You cut the cable in two, or just strip the wires in the middle, and you add a female 2.5mm connector that you can get in any hardware store. Connect the copper wire to the casing, the red wire to the left pin and the white wire to the right pin. That's all. Your link cable will still work as it did before, but you can now also plug in a second link cable in the female connector, making it a three way link cable. If you have modified that second link cable as well, you can plug yet another one into that one, and have a four way link cable. You can extend this pretty far in theory, it's a piece of cake to make one, and it doesn't require any of those hard to get male plugs that fit properly.

Anyway, I don't have a link cable of my own that I can modify, so I used my 2.5mm female connector to make my three way link splitter look a bit more professional ;) It went from this:

Image

To this:

Image
Last edited by Timendus on Tue 16 May, 2006 3:52 pm, edited 1 time in total.
http://clap.timendus.com/ - The Calculator Link Alternative Protocol
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
User avatar
kalan_vod
Calc King
Posts: 2932
Joined: Sat 18 Dec, 2004 6:46 am
Contact:

Post by kalan_vod »

Looking good, I think it looks better in the new pic :P. I hope to try this soon as it may revive my calc projects!
User avatar
KermMartian
Calc Wizard
Posts: 549
Joined: Tue 05 Jul, 2005 11:28 pm
Contact:

Post by KermMartian »

Meanwhile, I'm looking forward to summer vacation starting so I can get gCn underway. :) This is looking quite excellent.
Image Image Image
User avatar
Timendus
Calc King
Posts: 1729
Joined: Sun 23 Jan, 2005 12:37 am
Location: Netherlands
Contact:

Post by Timendus »

Thanks, both :)

I've been working on extending the protocol. One byte of extra overhead has been added to the data transfer header, and quite a few bytes of code to the library, to make the network more versatile. Some interesting aspects that I want to share with you:

- Built in device identification
Primarily intended to identify exotic hardware, different calculator types and PCs in the network, but also useful for, for example, nicknames in multiplayer games. It's like a ping request (which the network now also has, by the way) but with an informative response :)

- Program channels
What if you connect four calculators and run two different networking applications using CLAP on them? If the programs are properly identified by their programmers, they should share the network and both programs will run just fine, only receiving data that is meant for them. Wow, isn't that cool :mrgreen:

- Log in/log out notification
When data is received, a user defined handler will be called by the interrupt routine to do whatever has to be done with that data. This same mechanism will now also notify the program of new calculators that join the network and ones that leave.

I really hope I can pull all this off, but it's looking good so far :)
http://clap.timendus.com/ - The Calculator Link Alternative Protocol
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
User avatar
Timendus
Calc King
Posts: 1729
Joined: Sun 23 Jan, 2005 12:37 am
Location: Netherlands
Contact:

Post by Timendus »

For my own overview and your convenience, I made a scematic representation of the network libraries and how you can interact with them:

Image
(Click for larger version)

Your software is the environment in white, the libraries are the circle(parts) in different colours. I think this is a little more clear than a readme that nobody ever reads ;)
http://clap.timendus.com/ - The Calculator Link Alternative Protocol
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
Post Reply