Author Topic: Conversion from 83+ to 83  (Read 13511 times)

0 Members and 2 Guests are viewing this topic.

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: Conversion from 83+ to 83
« Reply #15 on: June 14, 2012, 05:47:11 pm »
Nope, that's not it, my disassembler supports label names, datas and texts :(

The problem is inside the code ... I'll send you when I can

Offline FloppusMaximus

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 290
  • Rating: +57/-5
    • View Profile
Re: Conversion from 83+ to 83
« Reply #16 on: June 14, 2012, 11:13:20 pm »
But in the general case, determining what is a label and what is a constant is not something any automated disassembler can do.  (For one thing, determining all the possible code paths reduces to the halting problem.  For another thing, when you start getting into seriously optimized code, like some that I've written, the distinction between "constant" and "label" becomes somewhat fuzzy, as optimizations can imply constraints on your labels that can't even be expressed in standard assembly language.)  But for even a moderately complex assembly program, I wouldn't trust any automated disassembler to understand everything - it requires human eyes to figure out exactly what the program is doing.

That said, if you know the code is produced by a compiler that doesn't use any outlandish optimizations (and more to the point, if you know beforehand exactly what programming techniques that compiler uses) - then some heuristics able to recognize those techniques might be sufficient.  (Note that I'm assuming the programmer has used "pure" Axe, or Axe with a well-defined set of simple assembly libraries - in other words, that the programmer has not made any assumptions that depend on the implementation of the Axe compiler or the target machine.)  I don't know enough about Axe to say how hard it would really be, but I would be somewhat surprised if there were any existing disassembler able to do that in general.

OK, this is getting a bit off-topic; sorry.  In conclusion: disassembly is hard.

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Conversion from 83+ to 83
« Reply #17 on: June 15, 2012, 02:36:15 am »
disassembly is hard.
That's something that is totally true (too bad)
I'm not a nerd but I pretend:

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: Conversion from 83+ to 83
« Reply #18 on: June 15, 2012, 04:51:22 am »
That's true, I really have a disassembler recognizing labels, datas and texts. Unfortunately, it's unnamed, but you can download it here : http://mattias.refeyton.fr/espace-ti/z80disassembler.zip

Also, I have my code here : http://mattias.refeyton.fr/espace-ti/jetpack82/JETPACK.z80 , but remind that it's 51K large.

There aren't any error at the compilation, but here is a screenshot of it working with the installer on a 83 :


EDIT : in fact, there isn't any _DelVarArc in the file ... <_<
« Last Edit: June 16, 2012, 02:47:26 pm by Matrefeytontias »

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: Conversion from 83+ to 83
« Reply #19 on: June 15, 2012, 10:34:38 am »
Could I just try running it through IDA? (I need the 8xp)

That looks like a good disassembler, but one mistake can break the program.
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 Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: Conversion from 83+ to 83
« Reply #20 on: June 15, 2012, 11:20:32 am »
Yeah sure, I join the *.8xp I compiled from the source I posted.

Oops, I forgot to join the installer, you need to launch it before prgmJETPACK :/
« Last Edit: June 15, 2012, 11:35:36 am by Matrefeytontias »

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: Conversion from 83+ to 83
« Reply #21 on: June 16, 2012, 02:23:23 pm »
You know, before I finish off this disassembly, what does the setup program do? The reason I ask this is because if it gets some variables prepped, then we'll have to store those variables in a static memory location. You can't allocate space after a program and then expect that memory to remain constant.

Edit:
   After disassembling it, it would appear that you make an appvar and store some data to saveSScreen. I think I can work with that.
« Last Edit: June 16, 2012, 02:43:28 pm by thepenguin77 »
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 Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: Conversion from 83+ to 83
« Reply #22 on: June 16, 2012, 02:45:46 pm »
The setup creates a program named prgmJTPKSTUP, stores three 768 bytes images in it and then quits.

What the main program does is accessing to this program and read the three images with a 768 or 1536 offset.

Now that I think of it, I remind that there is a bcall named _DelVarArc on the 83+ that doesn't exist anymore on the 83, I'll try to replace it with _DelVar and see if it works better.

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: Conversion from 83+ to 83
« Reply #23 on: June 16, 2012, 02:54:54 pm »
Also, I don't have a way to test this in wabbitemu. So if you could help me out there... (email)
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 Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: Conversion from 83+ to 83
« Reply #24 on: June 16, 2012, 02:56:33 pm »
Ah yeah, I'll send you something to test it.

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: Conversion from 83+ to 83
« Reply #25 on: June 20, 2012, 06:53:27 pm »
Complete!!!

Now, there were two specific parts that I know you missed. First, run a Ctrl+F for $522, $533, and $FADB. These numbers are correct on the 84+, but what they actually represent are
  • appBackUpScreen-plotSScreen
  • appBackUpScreen-plotSScreen+1
  • plotSScreen-appBackUpScreen+13

respectively. Since we moved these memory locations around, those numbers were now no longer correct.


The second part actually slipped by your disassembler twice. Run a Ctrl+F for "ld bc,$B978". This address was actually 1 byte past the end of your program, so your disassembler assumed that it was a constant memory address.

For the second part of this problem, go to the very end of your data. You'll see .db $F1,$9D,$73,$9F, which we could rearrange to .dw $9DF1, $9F73. These are actually pointers to certain locations in your code and need to adjust with the change in running location. That means they should be more properly written as labels: .dw loc_9DF1, loc_9F73.


But, in all, it's done. So enjoy. I included the source I used as well as the source compiled for use with venus. (That's why there's an awkward header on the files).

Also, this screenshot was the first time I ever got the grappling hook thing, so that kind of freaked me out.

Edit:
   I have no idea how big loc_8079 should be. You can remove all the zeros before it and probably give it like 2 after. (Rather than 96)
« Last Edit: June 20, 2012, 07:00:19 pm by thepenguin77 »
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 aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Conversion from 83+ to 83
« Reply #26 on: June 21, 2012, 02:07:37 am »
Is it only me or is the gs the same on the real 83? Since uh, then you can better remove the gs part <_<
I'm not a nerd but I pretend:

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: Conversion from 83+ to 83
« Reply #27 on: June 21, 2012, 08:02:25 am »
Waaaa thanks a lot thepenguin77 ! :D

You'll be in the credits ^^