Omnimaga

Calculator Community => Major Community Projects => The Axe Parser Project => Topic started by: DrDnar on March 06, 2012, 02:52:08 am

Title: [Axiom] Run (Un/Archived) External Assembly Programs
Post by: DrDnar on March 06, 2012, 02:52:08 am
I thought that some Axe programmers would find it useful to be able to run archived programs. Also, the Asm( sequence I posted to run programs in RAM will leak memory if the program you call throws an error. So I wrote an Axiom that lets you run other assembly/Axe programs and fixes memory leak issues. If you want, there's even a provision in there that lets you prevent your subprograms from being run from anything other than this Axiom, in case they do nothing useful on their own. Additionally, it also lets you catch errors that the OS may throw; that is, it lets you prevent that ERR: screen from showing up. The attached ZIP file contains the Axiom, its source code, and all the documentation. I'm a little afraid that the part of the documentation about error handlers is a little unclear, so if you're confused, feel free to ask questions.

Quigibo and Runer112: Feel free to optimize this---I'm sure it can be---and put it in Axe.


Here's an example. Let's say you have a fancy intro screen that's very large. You want it to run if the user has it---regardless of whether it's archived or in RAM---, but you want your program silently to skip running the intro screen if it doesn't exist. Just put this code in the main program:
Code: [Select]
:AppOnErr(LSKIP)
:RunPrgm("prgmINTRO")
:AppOffErr
:Lbl SKIP
:Your program continues here
Title: Re: [Axiom] Run (Un/Archived) External Assembly Programs
Post by: shmibs on March 06, 2012, 02:55:16 am
they would indeed find it useful =D
thank you kindly
Title: Re: [Axiom] Run (Un/Archived) External Assembly Programs
Post by: LincolnB on March 06, 2012, 05:46:07 pm
Ah, this would make a great Axiom, and would help out a lot with a project like XDE (If it wasn't dead :P)
Title: Re: [Axiom] Run (Un/Archived) External Assembly Programs
Post by: DrDnar on March 06, 2012, 07:13:47 pm
Ah, this would make a great Axiom, and would help out a lot with a project like XDE (If it wasn't dead :P)
What do you mean, "would"? It is an Axiom.
Title: Re: [Axiom] Run (Un/Archived) External Assembly Programs
Post by: ClrDraw on October 19, 2013, 01:38:16 pm
It works perfect for me and displays my own errors and everything, except when I exit the program, it displays the errors that the OS didn't show when the program ran. Is that normal? It's annoying.
Title: Re: [Axiom] Run (Un/Archived) External Assembly Programs
Post by: E37 on May 15, 2016, 07:11:58 pm
Again, there is no better place to put this.
It works perfect for me and displays my own errors and everything, except when I exit the program, it displays the errors that the OS didn't show when the program ran. Is that normal? It's annoying.
I'm having the same problem, am I not restoring something correctly?
Title: Re: [Axiom] Run (Un/Archived) External Assembly Programs
Post by: DrDnar on May 17, 2016, 11:12:04 am
That's . . . odd. Can you give me the simplest program that demonstrates the problem? Does running Asm(FDCB09A6 before quitting fix the problem?
Title: Re: [Axiom] Run (Un/Archived) External Assembly Programs
Post by: E37 on May 17, 2016, 02:16:23 pm
Here you go...
PROGRAM:RUN
.PRGM
Axiom(RUNPRGM)
[prgmBASIC]->A
[00]
"prgm*TEMP"->Str1
GetCalc(Str1,length(A))->B
Copy(A,B,{B-2}r
AppOnErr(lERR)
Str1:Asm(E7FDCB08CEEF9B4AFDCB088E)
AppOffErr
Lbl ERR
Asm(FDCB09A6)

PRGM:BASIC
595*,-5-*-5

when run it gives ERR:SYNTAX

Sorry for any weird words I had to fight spellchecker for each word :P
Title: Re: [Axiom] Run (Un/Archived) External Assembly Programs
Post by: DrDnar on May 23, 2016, 11:31:34 am
Asm(FDCB09A6) just attempts to reset the ERR:BREAK flag. Which isn't happening here.

The Axiom is intended for running external assembly programs. Does the issue with error messages only happen when you run BASIC programs? It's possible the error message isn't being cleaned up properly. From what I read in TI's SDK, you don't need to zero errNo after catching an error. But maybe I misread. Perhaps Asm(AF32DD86) will fix that.
Title: Re: [Axiom] Run (Un/Archived) External Assembly Programs
Post by: E37 on May 26, 2016, 10:44:31 am
Oddly enough, the error fixed itself.
I added some code to my main program. (I think it was a DelVar) and the errors stopped appering...
 ???
Title: Re: [Axiom] Run (Un/Archived) External Assembly Programs
Post by: DrDnar on May 27, 2016, 09:02:11 pm
Oddly enough, the error fixed itself.
That's usually not a good sign. It tends to mean you have (or had) latent bugs. Definitely check for memory leaks and signs of data corruption.
Title: Re: [Axiom] Run (Un/Archived) External Assembly Programs
Post by: E37 on May 28, 2016, 12:24:28 pm
I wouldn't be surprised.
I am using it in a program that uses a homescreen hook, and with a lot of hex codes that I don't really understand.
I don't have a way of converting hex to asm commands. (If I did it would probably easier to fix...)

Anyway I look at it RunPrgm is still vital to a good number of my projects!
Thanks for making it!  :thumbsup: