Omnimaga

Calculator Community => TI Calculators => TI-BASIC => Topic started by: holmes221b on December 16, 2010, 11:55:53 am

Title: Using asm( inside a program?
Post by: holmes221b on December 16, 2010, 11:55:53 am
I'm trying to create a program that will run a compiled program specified by the user.

Here's what I've tried (and none of them work, I keep getting ERR:Syntax):
Code: ("Version 1 (with prgm not included in Str1)") [Select]
:Input "PRGM?", Str1
:asm(prgmStr1
Code: ("Version 2 (with prgm included in Str1)") [Select]
:Input PRGM?", Str1
:asm(Str1

Any way of making this work?
Title: Re: Using asm( inside a program?
Post by: yunhua98 on December 16, 2010, 11:58:16 am
I haven't tried it yet, but maybre try this:
Code: [Select]
:Input "PRGM?",Str1
:"Asm(prgm"+Str1->Str1
:expr(Str1
make sure the "Asm" and the "prgm" are the tokens, and not characters

EDIT:  nvm, doesn't work, if you have a finite number of choices in mind, then your best bet is If statements, otherwise, I think Axe may be able to do it.
Title: Re: Using asm( inside a program?
Post by: holmes221b on December 16, 2010, 12:04:32 pm
How would I do it with If statements?
Title: Re: Using asm( inside a program?
Post by: yunhua98 on December 16, 2010, 12:12:57 pm
well, say you are going to Run 3 different Asm Programs, called ASM1, ASM2, and ASM3:
Code: [Select]
:Input "PRGM?",Str1
:If Str1="ASM1"
:Then
:Asm(prgmASM1
:End
:If Str1="ASM2"
:Then
:Asm(prgmASM2
:End
:If Str1="ASM3"
:Then
:Asm(prgmASM3
:End
note that this is for a finite number of programs only and if you know the names of the programs.
Title: Re: Using asm( inside a program?
Post by: BrandonW on December 16, 2010, 12:16:03 pm
I couldn't speak towards Axe, but from a pure assembly perspective, the only way to do this is to use a loader program whose only purpose is to take the name of a program as a string, look it up, and run it, similar to what ZASMLOAD used to do way back in the day:

"MYPROG
Asm(prgmLOADER

(and prgmLOADER would look up Ans as a string, get the name out of it, look up the program, and load it)
Title: Re: Using asm( inside a program?
Post by: holmes221b on December 16, 2010, 12:23:59 pm
Thanks, yunhua, that gives me something to work with.../me has had an thought about how to make it work the way I want it to work, while still using If statements.

BrandonW, I'm trying to come up with something that is purely TI-Basic (mostly because that's really the only programming language I know well enough to create original programs with).
Title: Re: Using asm( inside a program?
Post by: Munchor on December 18, 2010, 01:05:10 pm
Code: [Select]
If the assembly program isn't that large you can even have it all in the same program:

[code]:Input "PRGM?",Str1
:If Str1="ASM3"
:Then
:AsmPrgm
:HEX CODE
:End
[/code]

:D
Title: Re: Using asm( inside a program?
Post by: Deep Toaster on December 18, 2010, 01:06:53 pm
Code: [Select]
If the assembly program isn't that large you can even have it all in the same program:

[code]:Input "PRGM?",Str1
:If Str1="ASM3"
:Then
:AsmPrgm
:HEX CODE
:End
[/code]

:D

You can't do that. Programs are either ASM or BASIC, not a combination. Running that program would give you a syntax error at the AsmPrgm, since it's not actually a command.
Title: Re: Using asm( inside a program?
Post by: Munchor on December 18, 2010, 02:08:57 pm
Code: [Select]
If the assembly program isn't that large you can even have it all in the same program:

[code]:Input "PRGM?",Str1
:If Str1="ASM3"
:Then
:AsmPrgm
:HEX CODE
:End
[/code]

:D

You can't do that. Programs are either ASM or BASIC, not a combination. Running that program would give you a syntax error at the AsmPrgm, since it's not actually a command.

Really? had no idea. Sorry, then :S
Title: Re: Using asm( inside a program?
Post by: Deep Toaster on December 20, 2010, 05:46:52 pm
Code: [Select]
If the assembly program isn't that large you can even have it all in the same program:

[code]:Input "PRGM?",Str1
:If Str1="ASM3"
:Then
:AsmPrgm
:HEX CODE
:End
[/code]

:D

You can't do that. Programs are either ASM or BASIC, not a combination. Running that program would give you a syntax error at the AsmPrgm, since it's not actually a command.

Really? had no idea. Sorry, then :S

That's why Asm( is needed to run ASM programs (so the OS knows it's that). It's all right, though, just try to make sure you know what you're posting ;)
Title: Re: Using asm( inside a program?
Post by: DJ Omnimaga on December 21, 2010, 02:17:50 pm
I swear I posted in here, or maybe it was a different topic. Asm(Hex would only work in Axe. In Doors CS it would be the ExecAsm( command (I forgot the real(number, equivalent).
Title: Re: Using asm( inside a program?
Post by: JosJuice on December 21, 2010, 02:23:13 pm
I swear I posted in here, or maybe it was a different topic. Asm(Hex would only work in Axe. In Doors CS it would be the ExecAsm( command (I forgot the real(number, equivalent).
Err... Isn't ExecAsm( used with identity(? real( is for xLib, and xLib doesn't have ExecAsm( - Celtic III has...
Or do you mean the Omnicalc real(?
Title: Re: Using asm( inside a program?
Post by: ztrumpet on December 21, 2010, 02:25:27 pm
det(20,"Hex String") and real(33,"Hex String") both work. :)
Title: Re: Using asm( inside a program?
Post by: JosJuice on December 21, 2010, 02:28:07 pm
I tend to confuse det( and identity(... D:
Title: Re: Using asm( inside a program?
Post by: DJ Omnimaga on December 21, 2010, 02:33:14 pm
I swear I posted in here, or maybe it was a different topic. Asm(Hex would only work in Axe. In Doors CS it would be the ExecAsm( command (I forgot the real(number, equivalent).
Err... Isn't ExecAsm( used with identity(? real( is for xLib, and xLib doesn't have ExecAsm( - Celtic III has...
Or do you mean the Omnicalc real(?
Oh strange, I thought it used real, since DCS has backwards copmpatibility with omnicalc and xLIB (which both uses real and Omnicalc has an ExecAsm command)

Does this means a BASIC game using Omnicalc's ExecAsm command would not work in DCS? O.O
Title: Re: Using asm( inside a program?
Post by: JosJuice on December 21, 2010, 02:37:23 pm
Does this means a BASIC game using Omnicalc's ExecAsm command would not work in DCS? O.O
It would work in DCS. I was just a bit confused, since real( is used by xLib, and xLib doesn't support ExecAsm( (but Omnicalc does).
Title: Re: Using asm( inside a program?
Post by: Builderboy on December 21, 2010, 02:41:19 pm
I think both xLib and Omnicalc use real() functions, but Omnicalc's real functions don't interfere with xLib, so they can both be run at the same time
Title: Re: Using asm( inside a program?
Post by: DJ Omnimaga on December 21, 2010, 02:47:13 pm
Nah, Omnicalc cannot be ran at the same time. I think Celtic III/Doors CS was made so Omnicalc's ExecAsm will run fine, though, through Celtic III/DCS.