Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: alberthrocks on July 24, 2010, 02:17:34 am

Title: Online Calculator Program/App Simulator? (Idea)
Post by: alberthrocks on July 24, 2010, 02:17:34 am
(Ironically, this idea kinda relates to the big fiasco that occurred recently. I won't say what, but it happened in IRC, and those who know will know what I mean...
Also, it so happens that this was posted on July 24th, when the next release of Axe Parser is released. Ignore that also!)

I had a quirky idea - to have an online simulator where you can submit programs and apps! :)

Now, why is that useful, even if you have your own calculator?

1) You can test your programs/apps on other calcs for compatibility.
2) Emulators can be buggy, and don't really 100% represent real hardware.
3) No need for borrowing calcs - you have them available online, and you get FULL CONTROL.
4) Did you leave a calc at home? No worries - you can test programs (and even develop them) online!
5) You feel like a control freak since you're controlling someone's physical calculator. ;)

There's probably more reasons, but I'll leave it to you for suggestions and thoughts.

So what is needed before I (or anyone else) starts?

- Axe Parser features to be implemented:
   - Linking with other calcs
   - Linking with computer and communicating with it
     (This would also mean a client program on the computer that can send data and such, in which
     Axe Parser can receive as a string. This is actually the feature I need - the first one is a stepping
     stone for it.)
   - Screenshoting the calculator - maybe a hook?
     If possible, also when ASM programs are running?
     (Or I might be missing a way to screenshot without TI Connect or TiLP...)

So how does it work?
It starts with a person plugging in his/her calculator into their computer. Then, they install software on both
the computer and calculator to allow remote control. Then they sync with each other. When the person
is using the calculator, there's no way to get in. Control will only work when the person runs the app, and
the program on the computer syncs with it.

The computer software then connects to a specific server to say that a person allows their calc to become
a testing ground. The server handles all the requests for testings and such. The server will have a webpage
for requests for testing.

A person wants to test, say, HELLOWRD.8Xp, their very interesting program.
They would file a request, and if approved, be allowed to schedule a time.
At the specified time, the person would first upload the program/app, and then
go to the main page for control. The program/app would be downloaded by the
client program on the donor's PC, and then sent to the calc. The app running would accept
it, save it, and then run it.

From there, the controller clicks keys, which submit commands to the server.
The clients receives commands from the server, which then gets sent to the calculator,
which the calc app receives and emulates the requested key.

Whew! That was confusing, wasn't it? Prepared to be a LOT more confused.

There are 2 ways of communicating between client and server: HTTP and direct.

HTTP:
Code: [Select]
__________                                                                                             __________
|  Client  | GET http://server.com/calc_ctrl.php?id=123&command=getcomm                                |          |
|    PC    |  ------------------------------------------------------------------------->               | Server   |
|__________|                                                                                           |__________|


Direct:
Code: [Select]
__________                                                                                             ___________
|          | Connect to 77.77.77.777:4567 with raw TCP: "KEY_UP"                                       |  Client   |
|  Server  |  ------------------------------------------------------------------------->               |    PC     |
|__________|                                                                                           |___________|


Now we're done! :) Let's go to the FAQ:

FAQ
1) OMG!!! THIS PROGRAM WILL GIVE ME VIRUSES!!!?!!!
No, it won't. A hacker would have to first figure out who to connect to, bypass all the logins,
THEN bypass the PHP security (for the file that sends commands), and THEN bypass program
security. Python will be used for the program, since it's cross platform (Windows, Mac, Linux),
and it's very secure.

2) Can people kill my calculator?
Yes... they can. However, there's 3 things for defense:
 - Real, valid information (name, phone #, etc.) must be provided, and it is verified so the person can't escape from
   punishment if they try destroying your calc.
 - Pressing the ON key will stop the app completely. If they are doing something crazy, you can disconnect.
 - Disconnecting the USB cable will obviously stop remote control.

3) Why Axe Parser?
Because:
 - Basic really sucks for communication. It's slow and really doesn't work while in loops.
   Not mentioning that Basic can't really communicate with the PC.
 - I don't know ASM (well enough), so obviously I can't write it in that way.
 - Axe Parser is a very nice language! :)
 - The developer of Axe Parser is on this forum!

4) ??? (More to come if asked)

The Future
WOW... the future? Yup.
If you haven't realized it, if this works, that calc can connect to the internet! :)
Of course, on a USB tether, but otherwise, it works.
I recall someone attempting this, but it never went anywhere. (Some famous app had it...??? Not too sure)
I'm hoping that if this, or at least parts of this suggestion are implemented,
we'll have a nice connection with the TI and the internet! :D
Title: Re: Online Calculator Program/App Simulator? (Idea)
Post by: TIfanx1999 on July 24, 2010, 09:45:07 am
So basically, if i don't own a TI 84 SE, but you do; If you have this installed I can upload a program to said server. Once approved I can then remotely control your calculator to test things ? I assume there would be a program on my side where I can Implement keypresses and actually see what I'm doing (screen simulation) in real time (minus lag)? It sounds really interesting and it would certainly be quite an achievement (and undertaking). I'm thinking a bit differently though... Maybe using the server to play linked games? >:D (IE calc connected on each end and the server to pass data between the two). I wonder what else could be done? Anyhow, as I said it'll be one hell of an undertaking, but I'd love to see where it could go. ;)
Title: Re: Online Calculator Program/App Simulator? (Idea)
Post by: qazz42 on July 24, 2010, 10:17:55 am
Hmm, If this ever came true, I might never hook my calculator to my computer again :P


But seriously, this might not be a good Ided, some troll or a guy having a bad day, might, do something bad. I know there are a few programs out ther that are able to invalidate OS's


But, what do I know? Give it a shot!
Title: Re: Online Calculator Program/App Simulator? (Idea)
Post by: jnesselr on July 24, 2010, 12:05:57 pm
I am already working on a client side program (Java, but obviously there are native files) which can access the usb.  It was designed to be used in conjunction with a battle network, or pokemon like trading system.  Using a real calc over a network is going to be slow as anything, there is no point to it.  If you want to program, do it on your own calc.  If you want to test compatibility, release it, and then get bug reports back.

Also, I don't know as you can access usb from python directly.  Anyway, I think it would be rather pointless as it would be horribly slow.  I personally don't like the idea of someone else messing with my calc, and I don't think others do as well.

Just my opinion though.  I can help you with usb a little if you need it.  Only the mac version is done so far. I am currently writing the java part around that.
Title: Re: Online Calculator Program/App Simulator? (Idea)
Post by: calcdude84se on July 24, 2010, 12:55:35 pm
Interesting...
The main problem is getting the screen, though. You have several options here:
The non-USB calcs will have to do communication through the link port, which means programs can't use it, not to mention you'll need a custom interrupt that can't be touched, so programs can't use their own unless it get's chained to yours.
The USB calcs can do as above, or, because the USB hardware has a mode (used for the TI-Presenter, but it can be re-used for your purposes) that'll automatically send the screen, you can use that. You still can't touch the USB port.
It'll be interesting to see you get it work on the 83+(SE)...
But good luck! :)
Title: Re: Online Calculator Program/App Simulator? (Idea)
Post by: alberthrocks on July 24, 2010, 06:58:42 pm
So basically, if i don't own a TI 84 SE, but you do; If you have this installed I can upload a program to said server. Once approved I can then remotely control your calculator to test things ? I assume there would be a program on my side where I can Implement keypresses and actually see what I'm doing (screen simulation) in real time (minus lag)? It sounds really interesting and it would certainly be quite an achievement (and undertaking). I'm thinking a bit differently though... Maybe using the server to play linked games? >:D (IE calc connected on each end and the server to pass data between the two). I wonder what else could be done? Anyhow, as I said it'll be one hell of an undertaking, but I'd love to see where it could go. ;)

Yes, yes, and it's definitely something for the future. :)
VERY extensible, especially since it's something also in Axe. :D

Hmm, If this ever came true, I might never hook my calculator to my computer again :P


But seriously, this might not be a good Ided, some troll or a guy having a bad day, might, do something bad. I know there are a few programs out ther that are able to invalidate OS's


But, what do I know? Give it a shot!

No worries! Just don't install/run the client program, nor install the app or run it, and you're pretty much fine. :)
As for security, there's some mockups I've done that I have yet to publish. I'll just say that it's pretty hard to get past security. Of course, this idea is pretty awkward as well, so it might be generally a bad idea. But we'll see. :)

I am already working on a client side program (Java, but obviously there are native files) which can access the usb.  It was designed to be used in conjunction with a battle network, or pokemon like trading system.  Using a real calc over a network is going to be slow as anything, there is no point to it.  If you want to program, do it on your own calc.  If you want to test compatibility, release it, and then get bug reports back.

Also, I don't know as you can access usb from python directly.  Anyway, I think it would be rather pointless as it would be horribly slow.  I personally don't like the idea of someone else messing with my calc, and I don't think others do as well.

Just my opinion though.  I can help you with usb a little if you need it.  Only the mac version is done so far. I am currently writing the java part around that.

Ahh, interesting. Your Java client is for the calc, right? And does it also have a corresponding calc program/app?

I personally don't like Java, since it's slow, and quite crazy to compile. Python is a lot easier. :)
PyUSB is a python library to access USB devices, and is cross platform. It uses libusb mostly I think.

But I won't know what to do anyway. My idea is for Quigbo to develop the calc side AND the PC side for the communication, then I'll port it back to Python and such. (Or he could just specify the way to contact the calc)

This idea hopefully isn't too bad - but it is kinda strange, so we'll see.
I think speed isn't too bad. The screenshots are streamed, and the screenshots are probably 100 KB max, maybe even less. It depends on server, PC, and calc speed.

And any help is appreciated! :)

Interesting...
The main problem is getting the screen, though. You have several options here:
The non-USB calcs will have to do communication through the link port, which means programs can't use it, not to mention you'll need a custom interrupt that can't be touched, so programs can't use their own unless it get's chained to yours.
The USB calcs can do as above, or, because the USB hardware has a mode (used for the TI-Presenter, but it can be re-used for your purposes) that'll automatically send the screen, you can use that. You still can't touch the USB port.
It'll be interesting to see you get it work on the 83+(SE)...
But good luck! :)

I don't think there's any way to do linking tests when there's only one calc connected, so I don't think that'll work.
The TI-83s and others can do screenshots and such, even without the USB cable. I'm still not sure about a lot of stuff, but we'll see. :)
Title: Re: Online Calculator Program/App Simulator? (Idea)
Post by: calcdude84se on July 24, 2010, 07:36:05 pm
The problem with normal screenshots is that they require the calc to be receiving keys like on the homescreen (which means not during programs, etc.) My solution was a custom interrupt, but they can often get messed up by other things, and it reserves the link port. The 84+(SE) has a hardware setting to send the screen automatically through USB.
What do you mean by linking tests? And if you're saying that won't work, how do you plan to get screenshots?
Just asking ;D
Title: Re: Online Calculator Program/App Simulator? (Idea)
Post by: alberthrocks on July 24, 2010, 08:08:54 pm
The problem with normal screenshots is that they require the calc to be receiving keys like on the homescreen (which means not during programs, etc.) My solution was a custom interrupt, but they can often get messed up by other things, and it reserves the link port. The 84+(SE) has a hardware setting to send the screen automatically through USB.
What do you mean by linking tests? And if you're saying that won't work, how do you plan to get screenshots?
Just asking ;D

Hmm... I didn't know that. My idea is probably similar to yours - something would be sent, and the hook interrupt would produce a screenshot and send it out.

Linking tests are basically when the program wants to link to another calculator. That is impossible to do (I think), so I'm not worried about programs needing a port.

I'm not sure about how the SilverLink (USB to 2.5mm cable for calc) works. It *might* accept commands to send anything to the calc (not regular sending, but true raw data), but that is beyond my knowledge. Maybe someone here knows? :)
Title: Re: Online Calculator Program/App Simulator? (Idea)
Post by: critor on July 24, 2010, 08:11:00 pm
You may allready know, but an online Flash emulator allready exists for old z80 calculators: TI-76.fr/81/82/82Stats/82Stats.fr/83/85.
Title: Re: Online Calculator Program/App Simulator? (Idea)
Post by: alberthrocks on July 24, 2010, 08:14:32 pm
You may allready know, but an online Flash emulator allready exists for old z80 calculators: TI-76.fr/81/82/82Stats/82Stats.fr/83/85.

Yes - I suppose you mean this one? http://www.brandonmeyer.net/projects/TI8XEmu/TI8XEmu.html
I'm just interested to see if this works though. My direct goal is to get the calc to connect to the internet via USB and another program, but I don't know how I would make a program out of that. :)
Title: Re: Online Calculator Program/App Simulator? (Idea)
Post by: TIfanx1999 on July 24, 2010, 09:10:04 pm
Yea, when I originally read this topic I thought he might be talking about something like that. If this idea is workable though, I think it could be much more interesting.
Title: Re: Online Calculator Program/App Simulator? (Idea)
Post by: jnesselr on July 24, 2010, 09:50:49 pm

I am already working on a client side program (Java, but obviously there are native files) which can access the usb.  It was designed to be used in conjunction with a battle network, or pokemon like trading system.  Using a real calc over a network is going to be slow as anything, there is no point to it.  If you want to program, do it on your own calc.  If you want to test compatibility, release it, and then get bug reports back.

Also, I don't know as you can access usb from python directly.  Anyway, I think it would be rather pointless as it would be horribly slow.  I personally don't like the idea of someone else messing with my calc, and I don't think others do as well.

Just my opinion though.  I can help you with usb a little if you need it.  Only the mac version is done so far. I am currently writing the java part around that.

Ahh, interesting. Your Java client is for the calc, right? And does it also have a corresponding calc program/app?

I personally don't like Java, since it's slow, and quite crazy to compile. Python is a lot easier. :)
PyUSB is a python library to access USB devices, and is cross platform. It uses libusb mostly I think.

But I won't know what to do anyway. My idea is for Quigbo to develop the calc side AND the PC side for the communication, then I'll port it back to Python and such. (Or he could just specify the way to contact the calc)

This idea hopefully isn't too bad - but it is kinda strange, so we'll see.
I think speed isn't too bad. The screenshots are streamed, and the screenshots are probably 100 KB max, maybe even less. It depends on server, PC, and calc speed.

And any help is appreciated! :)

I would be glad to help.  The front end is basically java, but I am using JNI as the back-end.  Eventually, I would like to write drivers and kexts to do away completely with the java program, and simply have the user have to plug the calc in and go.  All the abstraction would be done via the program on the calc.  The computer driver would just see that the calc was connected, and basically provide a pass-through to a server that the program specifies.  The java program is currently for testing the interface.

Are you aware of how usb devices work?  Please send me a PM, and I will help with whatever, since our ultimate goal is the same here.  I always had trouble with libusb.  Also, for a calc, all you really need is to deal with two pipes, so it's not all that hard.

Also, for what I do, Java is very easy, but I am also programming in C a little more.  As for Speed, I am thinking that the http is going to go faster than the calc.  Also, it would be impossible for grayscale.  Since my goals are for things like connecting a calc to a server anyway, I will help. (If you want me too.)
Title: Re: Online Calculator Program/App Simulator? (Idea)
Post by: Quigibo on July 25, 2010, 03:33:09 am
The problem is there is not a way to send key presses and receive screen shots fast enough to simulate anything in real time unless you completely gut the hardware and interface it directly to the computer via a micro controller or something.  The other problem is what happens when your code freezes?  Or what if you're testing an OS-kill type program which won't allow the calculator to boot anymore?  The freezing would be more common and there has to be a way to remotely reset everything otherwise it makes the service useless.  Again, that would require a hardware modification.

I do think it would be really useful, but the hardware modifications and software required to do all of this in real time is so complex I can't imagine seeing this any time in the near future.

Better yet, what about designing a site that is just a community of willing testers.  Everyone signs up, giving their calculator models, and then tests different programs submitted by all the members and everyone who tests the programs will report a number on the screen, or a desired/undesired effect, maybe some screenshots, and things like that.  There could be incentives for testing other people's programs like a ranking system or requirements that you have to test at least as many as you upload and maybe some other idea.  I think that could be even more useful and is much more practical.
Title: Re: Online Calculator Program/App Simulator? (Idea)
Post by: Lionel Debroux on July 25, 2010, 03:40:44 am
Yesterday, we talked a bit about the idea on IRC, and it didn't look that practical indeed, due to bricker programs and other problems.

Quote
Better yet, what about designing a site that is just a community of willing testers.  Everyone signs up, giving their calculator models, and then tests different programs submitted by all the members and everyone who tests the programs will report a number on the screen, or a desired/undesired effect, maybe some screenshots, and things like that.  There could be incentives for testing other people's programs like a ranking system or requirements that you have to test at least as many as you upload and maybe some other idea.  I think that could be even more useful and is much more practical.
Ooh yes, agreed.


graphmastur, alberthrocks: the way to interact with the SilverLink and DirectLink cables is documented and implemented in the libti* framework, BTW.
Title: Re: Online Calculator Program/App Simulator? (Idea)
Post by: TIfanx1999 on July 25, 2010, 06:40:34 am
I like the fact that he's thinking outside of the box and trying to develop things that haven't been done before. As I said, I think it be a hell of an undertaking and accomplishment (if even possible).Regardless, I think it's great that people are exploring new ideas.
*edit for grammar
Title: Re: Online Calculator Program/App Simulator? (Idea)
Post by: alberthrocks on July 25, 2010, 11:12:42 am
@graphmastur: Ahh, OK I see. But why a kext? Merely detecting via libusb will work. :)
(Then again, I'm not sure how Mac OS X works in terms of drivers, so excuse me if I wrong.)

I'm not really good with USB devices, other than plugging them in and taking them out. ;)
I've read a little bit of the USB specification, but that's all, and that was a loooonnnngggg time ago.
Also, I've played around with libusb before. (Also when I was looking at the USB spec.)
I wrote an iPod Touch/iPhone jailbreaker in C with libusb (mostly copy and paste functions).

I'm not really good in calc ASM either, which is why I'm waiting for Quigbo to implement the USB communication stuff into his Axe Parser. :) However, we can get started on that stuff first, and maybe post a POC with source code.

For me, Java is "meh"... Python's pretty powerful. You could write a C library and Python can interface with it.
For speed, did you mean the calc is faster than HTTP? ;) That would make more sense.

My main goal in the end is just to get the calc on the internet. It's very tricky to do the remote control idea.
I'll PM you shortly.

@Quigibo: Very true... but as I've said, 1) there are security checks and such that I have yet to show; 2) This was a bad idea from the start (and I knew that) 3) My main goal is just connecting the calc to the internet. :)

I like your idea of a website dedicated to testing! However, there might be some kinks to work out, such as if the person should get 1 credit from the start and such, as well as reviews of the reviews. Otherwise, that definitely sounds more sensible to me.

@Lionel: Yes, we'll look at it for sure. :)
But before we dive into your code, a quick question: does the SilverLink and DirectLink cables (USB) allow for custom communication to the calculator, or are only files (basically regular transfers) allowed?

@Art_of_camelot: It is indeed a tricky idea. If there is a demand, we'll probably implement (or a least try to) the idea.
For now, we'll be focused on getting the calc to get on the internet. :)

Title: Re: Online Calculator Program/App Simulator? (Idea)
Post by: jnesselr on July 25, 2010, 12:23:23 pm
@graphmastur: Ahh, OK I see. But why a kext? Merely detecting via libusb will work. :)
(Then again, I'm not sure how Mac OS X works in terms of drivers, so excuse me if I wrong.)

I'm not really good with USB devices, other than plugging them in and taking them out. ;)
I've read a little bit of the USB specification, but that's all, and that was a loooonnnngggg time ago.
Also, I've played around with libusb before. (Also when I was looking at the USB spec.)
I wrote an iPod Touch/iPhone jailbreaker in C with libusb (mostly copy and paste functions).

I'm not really good in calc ASM either, which is why I'm waiting for Quigbo to implement the USB communication stuff into his Axe Parser. :) However, we can get started on that stuff first, and maybe post a POC with source code.

For me, Java is "meh"... Python's pretty powerful. You could write a C library and Python can interface with it.
For speed, did you mean the calc is faster than HTTP? ;) That would make more sense.

My main goal in the end is just to get the calc on the internet. It's very tricky to do the remote control idea.
I'll PM you shortly.

You can interface with C via jni.  A kext or a driver to basically be able to get rid of the client program all together.  I am not really good with ASM either.  I mean that http is faster than the usb protocol.  At least overall.  Anyway, connecting a calc to a server shouldn't be too difficult.

What OS do you have?
Title: Re: Online Calculator Program/App Simulator? (Idea)
Post by: alberthrocks on July 26, 2010, 10:33:04 pm
@graphmastur: I'm using Linux. (Ubuntu Linux 10.04 LTS to be exact.)
Title: Re: Online Calculator Program/App Simulator? (Idea)
Post by: Lionel Debroux on July 27, 2010, 12:47:25 am
Quote
@Lionel: Yes, we'll look at it for sure. Smiley
But before we dive into your code, a quick question: does the SilverLink and DirectLink cables (USB) allow for custom communication to the calculator, or are only files (basically regular transfers) allowed?
Custom communication is possible on all links: the ROM dump protocol is a custom one :)
Title: Re: Online Calculator Program/App Simulator? (Idea)
Post by: DJ Omnimaga on July 29, 2010, 02:10:21 am
The project testing server/site sounds a bit like it could be implemented into SourceCoder on Cemetech. They allow you to submit projects and even make them public if you want to. I don't remember if you could make them visible to specific users, though.

As for the idea in general, I do not have experience in the matter so I can't tell if this could be doable or not and if it would be practical/convenient to use, but as Art said, it is cool to see more people explore new ideas in the community lately. This is how Nspire cracking happened, after all :P