Author Topic: TI 83+ asm parser for the TI 83  (Read 7712 times)

0 Members and 1 Guest are viewing this topic.

Offline Le solutionneur

  • LV3 Member (Next: 100)
  • ***
  • Posts: 70
  • Rating: +14/-10
    • View Profile
TI 83+ asm parser for the TI 83
« on: August 31, 2012, 03:33:38 pm »
I just had an idea right now: both calculators uses the same z80, and almost have the same romcalls.
Many programs are done for the TI-83+ and so users can't use them on TI83 calculators (or TI 82 stat in France, the most selled).

So, we would need to hook some stuff to modify the code just after it's copied in the location 9D95h (for the TI 83+, can't remember of the TI 83).

Then we modify the code to modify the addresses, according to the 9D95h of the TI83+ compared to the XXXXh of the TI 83.
We would also need to fix the romcall adresses by creating a table corresponding TI 83 + romcall addresses to the TI 83.
We would need to create our own romcalls for those which aren't supported on the TI 83+, simulate the the free spaces often used by programs (we coud easily simulate it by creating a new program, uneditable, with the size of each free space . Then we change the addresses of the free spaces to our own dummy programs)

I think that's all, maybe a few extra things to fixup.

About the appvars, we can't do much about it or create a dummy program holding the appvar and then hook the stuff to read in the program instead.

I hope someone will be interrested to do this project :)
« Last Edit: August 31, 2012, 03:34:06 pm by Le solutionneur »
"Commit to the Lord whatever you do and your plans will succeed." - Proverbs 16:3
"Whatever you do, work at it with all your heart, as working for the Lord, not for men. " - Colossians 3:23

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: TI 83+ asm parser for the TI 83
« Reply #2 on: August 31, 2012, 03:55:54 pm »
That's a really interesting idea. Maybe something like TI-Boy could be made, a computer program that would convert a TI-83 Plus program to run on a TI-83 or TI-82 STATS.fr.




Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: TI 83+ asm parser for the TI 83
« Reply #3 on: August 31, 2012, 04:09:12 pm »
Well, TI-Boy doesn't convert anything other than simply bundling the ROM into an app with the emulator code. :P

Also, the majorly major problem with this is that it will be quite hard to tell whether an immediate value is a pointer, an offset, or just an integer, and it will also be tough to follow variable jumps when parsing a program (such as PUSH followed by RET or JP HL)
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: TI 83+ asm parser for the TI 83
« Reply #4 on: August 31, 2012, 05:13:51 pm »
Well, TI-Boy doesn't convert anything other than simply bundling the ROM into an app with the emulator code. :P
Oh, I thought it was somehow translating the game to run on calculators :P
« Last Edit: August 31, 2012, 05:13:58 pm by Deep Thought »




Offline ben_g

  • Hey cool I can set a custom title now :)
  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +125/-4
  • Asm noob
    • View Profile
    • Our programmer's team: GameCommandoSquad
Re: TI 83+ asm parser for the TI 83
« Reply #5 on: August 31, 2012, 06:09:56 pm »
calc84 has clearly said in his ti-boy project thread that it's an emulator, not a convertor. The main problem with a convertor is finding the difference between data and code. If you convert data, or leave parts of code untouched, you may have some nasty results. One way of doing this would be to create a very simple 'emulator', that starts reading the program from it's start, and that knows which sequences of bytes represents jumps, calls (and ret's) and bcalls. Also code in the size of optcodes so that it won't recougnize a jump or bcall in what is actually just the end of one optcode and the beginning of an other one. Then you need a boolean array. Use one boolean for every byte of the program. These should all be false at start and mark if a byte is read. Then, 'emulate' the program. At every byte you pass, mark the byte as read (set boolean to 'true'). When you encounter a call instruction, push the position of that instruction to a stack, and continue emulating from where the call points to (substract $9D93 from the label behind the call to get the number of bytes from the start of the program). When you encounter a ret instruction, continue emulating from the location in the stack, or if the stack is empty, stop the emulation. When you come across a jump instruction, check if it's conditional or not. If conditional, save it's location to an other stack than the one used by calls. Then just continue emulating from the location the jump points too, just as you would do with normal jumps. If you encounter a bcall, replace the label with the corresponding ti-83 label. If the bcall isn't supported by the ti-83, replace it by a call to a routine that does the same and that you add at the end of the program (and make sure you don't add it multiple times.) Befoire 'emulating' the next instruction, check if it was already read. If not read, then continue emulating normally. Else, continue emulating from the location stored in the relative jump stack. If that stack is empty, stop emulating, show the user that the conversion failed and terminate the program.

If it exited correctely because of a ret, then add some code at the start that sets up free, useable RAM memory at the standard 83+ locations (when nessicary). Keep 3 bytes free at the end of this one and save the location. At the end of that routine, add an other routine that cleans up that ram and formats it in the way that the ti-83 OS suspects it, and add a ret to the end. Now replace the 3 bytes you kept free with a call to the start of the program (thus to the end of the 2nd routine). Save the program in the proper 83p format, and show the user a message that it finished converting and that he has to try it on an emulator first, backup his data, and that you're not responsible for any damage to calculators caused by this program, ...

This should work on any program (not app) that doesn't use a shell, jump tables or SMC.
My projects
 - The Lost Survivors (Unreal Engine) ACTIVE [GameCommandoSquad main project]
 - Oxo, with single-calc multiplayer and AI (axe) RELEASED (screenshot) (topic)
 - An android version of oxo (java)  ACTIVE
 - A 3D collision detection library (axe) RELEASED! (topic)(screenshot)(more recent screenshot)(screenshot of it being used in a tilemapper)
Spoiler For inactive:
- A first person shooter with a polygon-based 3d engine. (z80, will probably be recoded in axe using GLib) ON HOLD (screenshot)
 - A java MORPG. (pc) DEEP COMA(read more)(screenshot)
 - a minecraft game in axe DEAD (source code available)
 - a 3D racing game (axe) ON HOLD (outdated screenshot of asm version)

This signature was last updated on 20/04/2015 and may be outdated

Offline Le solutionneur

  • LV3 Member (Next: 100)
  • ***
  • Posts: 70
  • Rating: +14/-10
    • View Profile
Re: TI 83+ asm parser for the TI 83
« Reply #6 on: September 01, 2012, 08:23:10 am »
Ok, the idea was originally to create a shell live managing that. I think it's tough, though.
"Commit to the Lord whatever you do and your plans will succeed." - Proverbs 16:3
"Whatever you do, work at it with all your heart, as working for the Lord, not for men. " - Colossians 3:23

Offline thepenguin77

  • z80 Assembly Master
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1594
  • Rating: +823/-5
  • The game in my avatar is bit.ly/p0zPWu
    • View Profile
Re: TI 83+ asm parser for the TI 83
« Reply #7 on: September 01, 2012, 12:44:15 pm »
...

Look at you ben_g, I remember back when you couldn't multiply, and now you are converting 83+ programs to 83 program, I am very impressed by your progress. And yes, in theory, that should totally work.

Ok, the idea was originally to create a shell live managing that. I think it's tough, though.

Yeah, it's not an easy project at all. Honestly, I think the best way to do this would be to try to port an 83+ rom to the 83, it would take some serious work, but I think it would work in the end.
zStart v1.3.013 9-20-2013 
All of my utilities
TI-Connect Help
You can build a statue out of either 1'x1' blocks or 12'x12' blocks. The 1'x1' blocks will take a lot longer, but the final product is worth it.
       -Runer112

Offline ben_g

  • Hey cool I can set a custom title now :)
  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +125/-4
  • Asm noob
    • View Profile
    • Our programmer's team: GameCommandoSquad
Re: TI 83+ asm parser for the TI 83
« Reply #8 on: September 01, 2012, 05:13:48 pm »
...

Look at you ben_g, I remember back when you couldn't multiply, and now you are converting 83+ programs to 83 program, I am very impressed by your progress. And yes, in theory, that should totally work.
That's mainly because this requires a different way of thinking. I'm a lot better at pogramming this kind of stuff than at programming low-level math routines.This is probably because in any programming language I knew before assembly, the math functions were already there and when I'm doing some math-related things, I calculate the result using multiplication and division and other math functions, without thinking about how they themselves are calculated.

Back on topic:
A rom from an 83+ might work, but it would probably require a lot of disassembling and recoding to deal with the different hardware and with ti's safety that prevents you from installing OSes from other calculators on it. Besides from that, there might also be some legal issues, because the operating systems are copyrighted by ti. Heaving an 83+ OS when you don't have an 83+ is, as far as I know, not legal, and modifying the OS, and redistributing that modified OS might make TI very unhappy. But if you can modify the OS so it runs on a TI-83, it will be a good solution as it requires no conversion of the programs and will also work on all programs.

When you want a live shell, there are other problems: First, there is the limited hardware. A conversion like the one I suggested can take some time to complete, and it uses a lot of RAM, because you need to have a secound copy of the program in RAM which is being converted and the convertor needs some additional data. Then there's the limited memory. A converter, which needs a database of bcalls and routines, gets very big very quickly, and on a calc with no flash memory, not everyone wants a big program. If you decide to do this, you should deffinately look into compression.


If you decide to go for the shell which manages it live, I might be able to help you with writing the conversion code. If you decide to create a computer program to convert programs (every program that was downloaded passes trough a computer anyways), I could write all of the computer code (If I can use java), but for the assembly routines, I might need some help. Also, I would need a list of all Ti-83 bcalls and I would need to know the .8xp and .83p format. When you shoose for the modified OS, I doubt that I can help much, but I'm willing to try.
My projects
 - The Lost Survivors (Unreal Engine) ACTIVE [GameCommandoSquad main project]
 - Oxo, with single-calc multiplayer and AI (axe) RELEASED (screenshot) (topic)
 - An android version of oxo (java)  ACTIVE
 - A 3D collision detection library (axe) RELEASED! (topic)(screenshot)(more recent screenshot)(screenshot of it being used in a tilemapper)
Spoiler For inactive:
- A first person shooter with a polygon-based 3d engine. (z80, will probably be recoded in axe using GLib) ON HOLD (screenshot)
 - A java MORPG. (pc) DEEP COMA(read more)(screenshot)
 - a minecraft game in axe DEAD (source code available)
 - a 3D racing game (axe) ON HOLD (outdated screenshot of asm version)

This signature was last updated on 20/04/2015 and may be outdated

Offline Le solutionneur

  • LV3 Member (Next: 100)
  • ***
  • Posts: 70
  • Rating: +14/-10
    • View Profile
Re: TI 83+ asm parser for the TI 83
« Reply #9 on: September 01, 2012, 05:14:39 pm »
"Yeah, it's not an easy project at all. Honestly, I think the best way to do this would be to try to port an 83+ rom to the 83, it would take some serious work, but I think it would work in the end."

Very good idea indeed but this would be very tough cause the TI 83+ OS uses flash memory !
"Commit to the Lord whatever you do and your plans will succeed." - Proverbs 16:3
"Whatever you do, work at it with all your heart, as working for the Lord, not for men. " - Colossians 3:23

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: TI 83+ asm parser for the TI 83
« Reply #10 on: September 01, 2012, 09:28:55 pm »
The link I posted at the beginning is to a news article about ION on ticalc. ION is a shell for the TI-83 and the TI-83+ calculators. As you can see it's been around forever, and gone through many revisions. If you follow the developer guidelines it appears that programs can be compiled for either platform. Many programs were released simultaneously for both calculators back then, both with separate ION versions. Other shells on the 83+ like Mirage OS and Doors CS have since included ION compatibility.

If you are looking for a different solution, I would talk to Brandon W. He's the one that made Chameleon, which allow an 83+ OS to run on the TI-73 due to hardware similarities. The 83+ and the original TI 83 are a bit more different though I believe. Thepenguin77 is also quite familiar with many of the OSes, so he'd be a good person to ask as well. These guys would have good insight as to what is possible, or what route might be the best to take.

*Edit* Missed thepenguin77's post :S, not surprising that he posted here. :) Also fixed a spelling error.

*Edit2:*Distributing a modified OS would be a no-no, however releasing a patch to apply to an OS should be fine.

*Edit3*Silly me, I forgot! The OS can't be replaced on the normal TI-83, no flash memory.
« Last Edit: September 02, 2012, 07:34:08 am by Art_of_camelot »

Offline chickendude

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 817
  • Rating: +90/-1
  • Pro-Riot Squad
    • View Profile
Re: TI 83+ asm parser for the TI 83
« Reply #11 on: September 02, 2012, 08:16:42 am »
As far as i can remember, anyone who released something for the 83+ also released an 83 (and often an 82) version as well, ESPECIALLY after ion came out and made it so easy to do. Actually, it used to be that nobody bothered porting their 83 games to the 83+! Funny how things change :) Now that the newer calculators are faster with more memory, for a lot of these new programs there's probably not much you can do other than a complete rewrite. Btw, can Axe spit out an 83 binary as well?

An on-calc emulator would be pretty cool, though i think an 83 emulator for the 83+ would be much more viable (mostly due to memory constraints on the 83).

As a side note, MirageOS had basic 82 emulation back in the day. I think Sam Heald did a lot of the work, but other folks at DS who are still around might have interesting insights. It might be worth looking into. I remember playing Punchout 82 (sent over directly from my 82). Not all programs worked well, but it was still kinda cool.

Offline Le solutionneur

  • LV3 Member (Next: 100)
  • ***
  • Posts: 70
  • Rating: +14/-10
    • View Profile
Re: TI 83+ asm parser for the TI 83
« Reply #12 on: September 02, 2012, 10:43:29 am »
OK, I think the idea of releasing a patch is definitely the best:
We could even get the TI83 regular OS and modify some stuff like areas of romcalls, add unusued space (free spaces) and change the location of the start of the prog, maybe is it easier than getting the TI 83+ OS and patching it to get it running on the TI 83.
"Commit to the Lord whatever you do and your plans will succeed." - Proverbs 16:3
"Whatever you do, work at it with all your heart, as working for the Lord, not for men. " - Colossians 3:23

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: TI 83+ asm parser for the TI 83
« Reply #13 on: September 02, 2012, 12:12:19 pm »
I don't think it's possible to do that. The OS is stored in ROM.
*Edit* Authors can just create their programs to use the ION shell and compile one version for the 83 and one version for the 83+.
« Last Edit: September 02, 2012, 12:16:44 pm by Art_of_camelot »

Offline ben_g

  • Hey cool I can set a custom title now :)
  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +125/-4
  • Asm noob
    • View Profile
    • Our programmer's team: GameCommandoSquad
Re: TI 83+ asm parser for the TI 83
« Reply #14 on: September 02, 2012, 12:59:22 pm »
yea, but I think this program/patch/watever it'll be is meant to convert or run the programs which were only released for the 83+ series, and their author has been unactive for a while so you can't just ask him to port, and also for the programs compiled by axe parser. But for axe parser, I wonder if programs compiled for ion would run on a ti-83. When you transfer them to a computer, they are saved in .8xp format.
My projects
 - The Lost Survivors (Unreal Engine) ACTIVE [GameCommandoSquad main project]
 - Oxo, with single-calc multiplayer and AI (axe) RELEASED (screenshot) (topic)
 - An android version of oxo (java)  ACTIVE
 - A 3D collision detection library (axe) RELEASED! (topic)(screenshot)(more recent screenshot)(screenshot of it being used in a tilemapper)
Spoiler For inactive:
- A first person shooter with a polygon-based 3d engine. (z80, will probably be recoded in axe using GLib) ON HOLD (screenshot)
 - A java MORPG. (pc) DEEP COMA(read more)(screenshot)
 - a minecraft game in axe DEAD (source code available)
 - a 3D racing game (axe) ON HOLD (outdated screenshot of asm version)

This signature was last updated on 20/04/2015 and may be outdated