Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : Help wanted with RUN command
Author | Message | ||||
Nick Guru Joined: 09/06/2011 Location: AustraliaPosts: 512 |
"How do you use the RUN command?" Sounds like a pretty lame question but I'm actually trying to do something out-of-the ordinary with it. I have a program which needs to RUN another program. Easy you say... just enter the command RUN "filename" in your program and it will run. But I want to be able to prompt the user for the name of the other program, let's say via an INPUT F$. The command RUN F$ doesn't work. RUN must have the filename inserted in " " within your code. I tried RUN CHR$(34)+F$+CHR$(34) but this doesn't work. The only way I see of doing this is to have you program generate a ascii file as another BASIC program... 10 RUN F$ ... and save it with a set filename, eg. BOOT. Then, after you've created the extra BASIC program from within your original program, RUN"BOOT". A program...that runs another program... to run the program you selected. Seems awkward. Is there a better way to do this? |
||||
Nick Guru Joined: 09/06/2011 Location: AustraliaPosts: 512 |
More confusion. The Maximite User manual states under the RUN command... "This enables one program to load and run another." If I have the program GRAPH.BAS on my SD and I write the BASIC program... 10 RUN "GRAPH.BAS" ... then RUN this program, I get the following error message... "Error line 10: File number is not open" Typing RUN "GRAPH" at the command prompt loads and runs the GRAPH program but it will not do it from within another program as the manual states. I need this function to work as it is the last piece to complete my Maximite Program Launcher menu program. So far and I get crunched by this!! No wonder programmers go nuts. :) |
||||
Nick Guru Joined: 09/06/2011 Location: AustraliaPosts: 512 |
UPDATE! Powered off the Maximite and powered up again, ran my program and now it works! (I thought this technique was only for PC's!) :) I wonder if there is a bug lurking in the firmware somewhere that caused this. Has anyone noticed keyboard buffer problems? Sometimes when I list a program and do a CTRL-C to stop the listing, the maximite goes nuts, throwing out previous command I had typed and executing them. CTRL-C again stops this. I've swapped keyboards and have been finding the problem still exists. |
||||
BobDevries Senior Member Joined: 08/06/2011 Location: AustraliaPosts: 266 |
Hi Nick, I haven't seen this problem at all. My CTRL-C quits cleanly and lets me type other commands without problems Regards, Bob Devries Dalby, QLD, Australia |
||||
Nick Guru Joined: 09/06/2011 Location: AustraliaPosts: 512 |
Maybe I type too fast? It has only done it when I'm typing fast. The lack of a screen editor with Maximite itself has me listing and CTRL-C'ing a lot and you tend to do it quickly when you need to list a line that needs to be retyped all because you pressed . instead of a , I should connect it to my PC via USB but the number of times I jump from RUN to EDITOR mode makes uploading each time very time consuming. It's fine for short programs but writing anything grander defeats on of BASIC's greatest assets... EDIT and RUN with little delay. I'm sure there's bug there somewhere. |
||||
rhamer Senior Member Joined: 06/06/2011 Location: AustraliaPosts: 174 |
I think your right. I too have seen some odd behavior like what you are experiencing. I have had LED's on 10 channels and the can do strange things when a program is stopped with ctrl c. Then they will change state after executing the "list" command. My initial thought was it was something to do with the outputs being reset to inputs, but I haven't had much time to look in depth. I am also still running v2.2 Regards Rohan Rohan Hamer HAMFIELD Software & Hardware Solutions Makers of the Maximite Expander. http://www.hamfield.com.au |
||||
Nick Guru Joined: 09/06/2011 Location: AustraliaPosts: 512 |
This keyboard buffer problem was worst in v2.3 (didn't try v2.2) while v2.4 seems to be a bit more stable but the bug still appears every now and then. I'm sure it's something to do with the keyboard buffer and speed typing. It's only ever initiated after a LIST and pressing CTRL-C to break out of the list. |
||||
VK6MRG Guru Joined: 08/06/2011 Location: AustraliaPosts: 347 |
Hi, I run programs within my menu system that I wrote way back when my mother taught me Basic (almost 30 years ago. the program was called System 2000, and all of our family's software was run thought is menu system, even giving you instructions on which disk to enter and into which drive to put the disk. upon exiting the chosen program the menu system would pop back up for your next choice. the original program was written on a legal pad and was over 20 pages long, then transferred to the PC). The PC was a Trimph Adler alphtronic PC. Here is some of the code. 2210: GOTO 2000 2300: RUN "HAMURABI.BAS" 2400: RUN "CHECKER.BAS" 2500: RUN "MMPREY.BAS" 2600: RUN "MMFOUR.BAS" 2700: RUN "HIGHIQ.BAS" 2800: RUN "STAR.BAS" Then i have edited the quit function of the above programs to run my menu system when you chose to quit/exit the program. I've never had problems with any version of MM Basic running my program. Regards, Matt Its easier to ask forgiveness than to seek permission! ............VK6MRG.............VK3MGR............ |
||||
Nick Guru Joined: 09/06/2011 Location: AustraliaPosts: 512 |
Speaking of Menu system, I have just written a graphical menu system for the maximite. Makes the Max look like a big ipod. :) Still doing some final touches and icon definitions but I should have it available soon. Set as AUTORUN.BAS, the maximite boots with this graphical front end. Stay tuned... |
||||
BobDevries Senior Member Joined: 08/06/2011 Location: AustraliaPosts: 266 |
Hey Nick, I reckon we can attach a mouse or joystick to the Maximite's analog ports. software wise it wouldn't be a big deal, I guess, even in MMBasic! Regards, Bob Devries Dalby, QLD, Australia |
||||
Print this page |