Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: aeTIos on January 05, 2011, 10:34:58 am

Title: Writing to variables or executing a basic program
Post by: aeTIos on January 05, 2011, 10:34:58 am
hi,

im going to work on a complete science/ maths suite and i was wondering how to write to variables and/or executing a basic program from a compiled one.

as for the variables,  just
Code: [Select]
getcalc("varA",18)->A
8->A
doesnt work.

who can help me out?
Title: Re: Writing to variables or executing a basic program
Post by: kindermoumoute on January 05, 2011, 11:30:35 am
I don't think we can executing a TI-Basic program without make an interpreter in axe.

But we can easy change bytes of calculator's variables (pic, GDB, appvar, Str,...)
Code: [Select]
:getcalc("appvarA",1)->A
:.I create 1 byte in my appvar "A"
:Copy(8,A,1)
:.I copy number 8 in the only byte of my appvar
Title: Re: Writing to variables or executing a basic program
Post by: Eeems on January 05, 2011, 11:33:46 am
I don't think we can executing a TI-Basic program without make an interpreter in axe.

But we can easy change bytes of calculator's variables (pic, GDB, appvar, Str,...)
Code: [Select]
:getcalc("appvarA",1)->A
:.I create 1 byte in my appvar "A"
:Copy(8,A,1)
:.I copy number 8 in the only byte of my appvar
You could use the OS's one, but that would require knowledge of how to clean up your program in a way that running the basic program wont kill your calc due to interference between the two. Or you could use DCS's runprog routine.

Also I believe he is wanting to know how to manipulate Real variables (ie: A,B,C,D,Ans)
Title: Re: Writing to variables or executing a basic program
Post by: Quigibo on January 05, 2011, 01:31:14 pm
First of all, if you do a getcalc with a real variable you should always subtract 2 from the pointer since reals don't have size bytes in front; the size is ALWAYS 9 bytes.

Code: [Select]
GetCalc("varA",9)-2->A
Secondly, real numbers are floats, not integers, you have to manipulate them with float{} like this:

Code: [Select]
float{A}->B
8->float{A}

Running BASIC programs sounds like it could be done with a bcall, but I don't know of any.
Title: Re: Writing to variables or executing a basic program
Post by: Binder News on January 05, 2011, 02:01:00 pm
There are a number of bcalls to execute commands. So, you could go through command by command, and execute it all. However, you would need to figure out how many args the command takes, because there are different bcalls for different numbers of args. I'm not sure if it returns how many bytes the command was though, so you might have to figure out that as well.
Title: Re: Writing to variables or executing a basic program
Post by: Eeems on January 05, 2011, 02:09:57 pm
DCS will let you run any DCS compatible program (BASIC included) and return to your program. I don't know how nice this will play with AXE programs though due to storage location of variables an such.
Title: Re: Writing to variables or executing a basic program
Post by: Binder News on January 05, 2011, 02:14:22 pm
Yea, but what if the end user doesn't have DCS? (It is a lot of mem you know)
Title: Re: Writing to variables or executing a basic program
Post by: Eeems on January 05, 2011, 02:16:25 pm
(Yes I do know, it's worth it though :p)
Well then they can't run it. But right now that's the best method for ease of programming. Although maybe AXE should have a RunProg command/routine too :p
Title: Re: Writing to variables or executing a basic program
Post by: Binder News on January 05, 2011, 02:21:58 pm
Yea, probably. Will you suggest? I'm at school, CAD1.