Will you move this to the Asm. section?

I'm making a CMD line program in BASIC, when you type "RUN xxx", it should run xxx. xxx is stored in Str2. I would like an asn prog that will run prgmStr2 if Str2 has anything in it, and return "NO RUN" if the prgm didn't run.

I typed this on my iPod, I'm sorry if it doesn't make sense.
(I'm assuming this will be written with DCS in mind)

One way you can do this is by creating a file (prgmZCMDRUN, for example) at runtime which only contains the line:

Code:
prgmYOURPROG
where YOURPROG will be whatever is stored in Str2.

The first thing you would have to do is delete the line from ZCMDRUN, using Celtic's LineErase function. That would look something like this:

Code:
det(7,"ZCMDRUN",1,2)
Note: The first argument is what line to start at, and 1 stands for the first line (not 0). Also, I'm deleting 2 extra lines (for a total of 3) just to make sure it gets cleaned up.

Next, you need to write the line to ZCMDRUN using Celtic's LineWrite function.

Code:
det(6,"ZCMDRUN","prgm"+Str2,1)


Then you just run ZCMDRUN and it will run the correct program. The full code for that would look like:

Code:
det(7,"ZCMDRUN",1,2)
det(6,"ZCMDRUN","prgm"+Str2,1)
prgmZCMDRUN


I'll leave it to you to check if the file exists and return the correct string(s) when that happens. (hint, look through these.

Also, I'm sure this could be made better. In particular, there appears to be a LineReplace function which would replace the LineErase/LineWrite calls.

Finally, you'll want to check at the beginning of your program whether the person has DCS7 installed or not. This page explains how to do this.

TL;DR You don't need a custom ASM program for this if your users have DCS7 installed.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement