Author Topic: application question  (Read 10685 times)

0 Members and 1 Guest are viewing this topic.

Ashbad

  • Guest
application question
« on: January 17, 2011, 11:20:48 am »
is it possible to use an Asm() code within a compiled axe app to run another assembly program?

Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: application question
« Reply #1 on: January 17, 2011, 11:22:13 am »
Yes.
Code: [Select]
PointerAsm(E7EF7C4E)where pointer is the name string of the program in RAM you want to execute. Probably the most super awesome way of getting around the code limit. Of course, the program you want to run can't be over 8192 bytes, plus the bigger it gets of course the more user RAM must be available before starting the app.
« Last Edit: January 17, 2011, 11:23:11 am by squidgetx »

Ashbad

  • Guest
Re: application question
« Reply #2 on: January 17, 2011, 11:23:40 am »
so... like:

Code: [Select]
prgmTITLEAsm(E7EF7C4E)
would run assembly program called title?  if so, thanks a ton!

Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: application question
« Reply #3 on: January 17, 2011, 11:26:28 am »
You'd have to put quotation marks around prgmTITLE..so
Code: [Select]
"prgmTITLE"Asm(E7EF7C4E) or you could store it to a static pointer (say "prgmTITLE" is in Str1):
Code: [Select]
Str1Asm(E7EF7C4E) You may need to put a null byte at the end of the string though if you don't use the string static pointer but i'm not sure:
Code: [Select]
"prgmTITLE"[00]Asm(E7EF7C4E)
« Last Edit: January 17, 2011, 11:27:19 am by squidgetx »

Ashbad

  • Guest
Re: application question
« Reply #4 on: January 17, 2011, 11:27:15 am »
thanks again, I needed a little more space for TaNF and this solves it. Thanks! :D

EDIT: if this didn't work I would've gotten rid of magic and spin attack to preserve 3K :/
« Last Edit: January 17, 2011, 11:27:38 am by Ashbad »

Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: application question
« Reply #5 on: January 17, 2011, 11:30:36 am »
Yup. I use this for the stat screen, the battle transitions, the name input screen, and the shop in Ash:Phoenix. It's very handy. Don't forget that you can't use subroutines from the app in the external program though. Also, it's not a bad idea to have the program in an archived appvar, then copy the appvar to a temp program. This way not only is it more user friendly, but also if you need to use this more than once, you can use the same temp program name every time :)

Ashbad

  • Guest
Re: application question
« Reply #6 on: January 17, 2011, 11:32:02 am »
thanks a ton for all of your help, without it, I would have to ditch TaNF :D

and btw good luck on A:P

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55941
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: application question
« Reply #7 on: January 21, 2011, 09:32:34 pm »
So basically this lets you use 16384+8192 bytes of code total? O.O

Ashbad

  • Guest
Re: application question
« Reply #8 on: January 21, 2011, 09:40:25 pm »
yep :D

Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: application question
« Reply #9 on: January 21, 2011, 10:06:27 pm »
Actually, it lets you use practically 16384+ as much code as your archive can hold, except they all have to be divided into 8192 byte or less pieces. For example, you could have 5 programs that were 8192 bytes each in archive, then from the app you could copy each one to ram when you needed to and run it. That's like 56k of code O.0

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55941
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: application question
« Reply #10 on: January 21, 2011, 10:08:43 pm »
Oh wow... that's pure win. That would especially be handy for a game with insane amounts of AI or a game where a lot of things have to be hard coded instead of stored in data form.

Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: application question
« Reply #11 on: January 24, 2011, 05:52:36 pm »
Just as a note, many of my external programs I call using this method do not function correctly when the main app is compiled in Axe 0.4.7 or higher. Most of the operations in the external prgoram (still compiled with .4.6) are fairly standard things like math and memory management (storing, copying etc.) Have any of the Axe variables (like r1-r6) been moved or something to make something like this happen?
« Last Edit: January 24, 2011, 05:53:02 pm by squidgetx »

Ashbad

  • Guest
Re: application question
« Reply #12 on: January 24, 2011, 06:07:33 pm »
Interesting... My external programs run fine (at least for now :P) I wonder why this is happening for you...  Are you external progs compiled under different versions?

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: application question
« Reply #13 on: January 24, 2011, 06:09:17 pm »
All of the main variables (A-θ) were moved. Because of this, L1 also no longer points to the same location. As for the other variables, I'm not sure, but my guess is that none of them were moved.
« Last Edit: January 24, 2011, 06:09:50 pm by Runer112 »

Ashbad

  • Guest
Re: application question
« Reply #14 on: January 24, 2011, 06:12:30 pm »
So this means that external progs from different versions may not use the same A-θ as 0.4.7 +.  Though I have my title program and the TaNF engine working fine together in 0.4.8.

EDIT: and thanks for the clarification runer :)
« Last Edit: January 24, 2011, 06:12:44 pm by Ashbad »