Author Topic: Using asm( inside a program?  (Read 5221 times)

0 Members and 1 Guest are viewing this topic.

Offline holmes221b

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 282
  • Rating: +13/-1
  • RESISTANCE IS FUTILE.
    • View Profile
    • My Livejournal
Using asm( inside a program?
« 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?

Spoiler For "Projects":
Spoiler For "Because Everyone Else Is":
*Sigh*
can we keep this on topic? The topic is about what the big thing might be, NOT SEX

Offline yunhua98

  • You won't this read sentence right.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2718
  • Rating: +214/-12
  • Go take a dive in the River Lethe.
    • View Profile
Re: Using asm( inside a program?
« Reply #1 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.
« Last Edit: December 16, 2010, 12:01:58 pm by yunhua98 »

Spoiler For =====My Projects=====:
Minor setback due to code messing up.  On hold for Contest.
<hr>
On hold for Contest.


Spoiler For ===Staff Memberships===:






Have you seen any good news-worthy programs/events?  If so, PM me with an article to be included in the next issue of CGPN!
The Game is only a demo, the code that allows one to win hasn't been done.
To paraphrase Oedipus, Hamlet, Lear, and all those guys, "I wish I had known this some time ago."
Signature Last Updated: 12/26/11
<hr>

Offline holmes221b

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 282
  • Rating: +13/-1
  • RESISTANCE IS FUTILE.
    • View Profile
    • My Livejournal
Re: Using asm( inside a program?
« Reply #2 on: December 16, 2010, 12:04:32 pm »
How would I do it with If statements?

Spoiler For "Projects":
Spoiler For "Because Everyone Else Is":
*Sigh*
can we keep this on topic? The topic is about what the big thing might be, NOT SEX

Offline yunhua98

  • You won't this read sentence right.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2718
  • Rating: +214/-12
  • Go take a dive in the River Lethe.
    • View Profile
Re: Using asm( inside a program?
« Reply #3 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.

Spoiler For =====My Projects=====:
Minor setback due to code messing up.  On hold for Contest.
<hr>
On hold for Contest.


Spoiler For ===Staff Memberships===:






Have you seen any good news-worthy programs/events?  If so, PM me with an article to be included in the next issue of CGPN!
The Game is only a demo, the code that allows one to win hasn't been done.
To paraphrase Oedipus, Hamlet, Lear, and all those guys, "I wish I had known this some time ago."
Signature Last Updated: 12/26/11
<hr>

Offline BrandonW

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 115
  • Rating: +38/-1
    • View Profile
Re: Using asm( inside a program?
« Reply #4 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)

Offline holmes221b

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 282
  • Rating: +13/-1
  • RESISTANCE IS FUTILE.
    • View Profile
    • My Livejournal
Re: Using asm( inside a program?
« Reply #5 on: December 16, 2010, 12:23:59 pm »
Thanks, yunhua, that gives me something to work with...
* holmes221b 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).

Spoiler For "Projects":
Spoiler For "Because Everyone Else Is":
*Sigh*
can we keep this on topic? The topic is about what the big thing might be, NOT SEX

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Using asm( inside a program?
« Reply #6 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

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Using asm( inside a program?
« Reply #7 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.




Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Using asm( inside a program?
« Reply #8 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

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Using asm( inside a program?
« Reply #9 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 ;)




Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Using asm( inside a program?
« Reply #10 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).

Offline JosJuice

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1344
  • Rating: +66/-14
    • View Profile
Re: Using asm( inside a program?
« Reply #11 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(?

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Using asm( inside a program?
« Reply #12 on: December 21, 2010, 02:25:27 pm »
det(20,"Hex String") and real(33,"Hex String") both work. :)

Offline JosJuice

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1344
  • Rating: +66/-14
    • View Profile
Re: Using asm( inside a program?
« Reply #13 on: December 21, 2010, 02:28:07 pm »
I tend to confuse det( and identity(... D:

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Using asm( inside a program?
« Reply #14 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
« Last Edit: December 21, 2010, 02:34:06 pm by DJ Omnimaga »