Join us on Discord!
You can help CodeWalrus stay online by donating here.

Run Axe program from an application ?

Started by Hayleia, February 19, 2015, 02:40:02 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Hayleia

Basically what the title says.

I tried something stupid like

#Axiom(MEMKIT)
GetCalc("appvNope",1)->V
New(V,e9D93-V,5000)
GetCalc("prgmPROGRAM",Y0)
Copy(Y0,e9D93,5000)
(e9D95)() .9D95 to skip the AsmPrgm
Delete(V,e9D93-V,5000)
DelVar "appvNope"

but there are some problems. It does run the program from the app, and the program runs fine, but when it exits, there are problems (basically, if after running the program, I just do a "Return", the calculator turns off and RAM Clears when turned on).

I am pretty sure matref knows the answer to my problem after doing AxeSh :P

Snektron

#1
Can't you just do something with some inline ASM magic?
(sorry, not helping. I'll try something out when im home, because i don't have memkit on my calc)
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


CKH4

Is this attempting to create a shell with axe?
  • Calculators owned: TI-83+, TI-84+


Snektron

Oh! Oh! Wont

V

be corrupted after running the program, causing some random location to be deleted?
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Hayleia

Quote from: Cumred_Snektron on February 19, 2015, 02:44:06 PM
Can't you just do something with some inline ASM magic?
(sorry, not helping. I'll try something out when im home, because i don't have memkit on my calc)
Well inline ASM can always help, but only if someone gives the helping portion of ASM.

Quote from: CKH4 on February 19, 2015, 03:00:45 PM
Is this attempting to create a shell with axe?
Nope.

Quote from: Cumred_Snektron on February 19, 2015, 03:02:15 PM
Oh! Oh! Wont

V

be corrupted after running the program, causing some random location to be deleted?
Nope, I checked and it keeps the same value from the beginning to the end.

Dream of Omnimaga

This is most likely due to saferam or other memory conflicts. When you exit the program you need to ensure that the state of the calculator RAM (and in the case of ASM programs, ports) is identical to how it was before you launched the program in the first place. I could be wrong, though, since I don't do much Axe, but this seems like the common cause when we exit something and stuff messes up.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Snektron

Maybe put in a small test after
DelVar "appvNope"
to see if
Delete(V,e9D93-V,5000)
DelVar "appvNope"

is causing problems
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Hayleia

What do you mean by "small test" ?
If I put a Text(0,,"Back to App") right after the call, it is displayed.
If I put a Text(0,,"Temp ram deleted") after the Delete, it is displayed.
If I put a Text(0,,"Appvar deleted") after the DelVar, it is displayed.

Snektron

hmm. But i think i've got a solution, but i'll have to test it out :P
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Duke "Tape" Eiyeron

  • Calculators owned: A lot.

Snektron

#10
Ah thnx.

So... I remembered there was a BCALL which runs an ASM program,
and i put it in an Axiom for you! :D
All the code you posted can now be replaced by a SINGLE line (well, 2 if you count #Axiom(RUN)):

Run("prgmPROGRAM")

The "Run(" token can be found in the stat-calc menu (QuadReg).
Have fun  ;)

Oh and btw the actual ASM which gets parsed form the axiom is a stunning 2 lines
EDIT: 6 lines. i fixed the asm_prgm_size part  ;)
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


matrefeytontias

#11
Quote from: Hayleia on February 19, 2015, 02:40:02 PM
I am pretty sure matref knows the answer to my problem after doing AxeSh :P

* matrefeytontias comes to save the day

You have to use that certain BCALL called ExecutePrgm, but before that, you must save what is in asm_prgm_size ($89EC) somewhere, and you must restore it afterwards.

Cumred: you didn't take care of that asm_prgm_size part :P

EDIT : by the way, you probably wonder how to use it. So I did a nice opcode for you, just put a pointer to the name of the program in HL before calling it :
Asm(E72AEC89E5EF7C4EE122EC89)
  • Calculators owned: TI-83+.fr, TI-Nspire CAS prototype, TI-84+ CSE, TI-Nspire CX
My TI games (some got their own article on non-calc websites !) : http://www.ticalc.org/archives/files/authors/112/11202.html

My moozik (100% free metal) : http://www.soundcloud.com/matrefeytontias

Hayleia

Thanks both of you :D

Quote from: matrefeytontias on February 19, 2015, 07:55:58 PM
you must save what is in asm_prgm_size ($89EC) somewhere, and you must restore it afterwards.
How many bytes do I need to save ? 2 ?

matrefeytontias

Yeah two, but don't worry I edited the message with an opcode to execute directly.
  • Calculators owned: TI-83+.fr, TI-Nspire CAS prototype, TI-84+ CSE, TI-Nspire CX
My TI games (some got their own article on non-calc websites !) : http://www.ticalc.org/archives/files/authors/112/11202.html

My moozik (100% free metal) : http://www.soundcloud.com/matrefeytontias

Snektron

Quote from: matrefeytontias on February 19, 2015, 07:55:58 PM
You have to use that certain BCALL called ExecutePrgm, but before that, you must save what is in asm_prgm_size ($89EC) somewhere, and you must restore it afterwards.

Cumred: you didn't take care of that asm_prgm_size part :P
Ah thanks for clarifying. I fixed it ;)
* Cumred_Snektron sees a replacing hex code
* Cumred_Snektron cries a little inside :(
Also why do you need to save the asm_prgm_size part? im interested because it seemed to run fine without :P
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Powered by EzPortal