CircuitGizmos

Electronic Products for Creative Minds

  • Home
  • Gizmo Store/Products
  • Documentation/Datasheets
  • Projects/Libraries
  • GizmoBlog
  • Services/Contact
    • Design
    • Contact Gizmo!
  • Your Gizmo Cart
    • Your Account
You are here: Home / GizmoBlog / MMBasic Language / Programming, and Debugging / RUN

RUN

RUN [line] [file$]

Executes the program in memory. If a line number is supplied then execution will begin at that line, otherwise it will start at the beginning of the program. Or, if a file name (file$) is supplied, the current program will be erased and that program will be loaded from the current drive and executed. This enables one program to load and run another.


RUN “TEST.BAS”

RUN “DAVE\TEST.BAS”

' Run starting from root dir:
RUN “\DAVE\TEST.BAS”

' Up a directory from where you are:
RUN “..\DAVE\TEST.BAS”


If an extension is not specified “.BAS” will be added to the file name.

The length of the path plus the file name (including punctuation) must be less than 127 characters.

Implied RUN command

At the command prompt it is possible to omit the RUN keyword and MMBasic will search the default drive and directory for a matching program and if found, it will be run.

‘program’ is the program name. If there is no extension the extension .BAS will be automatically appended.

‘command-line’ is an arbitrary string of characters which can be retrieved by the new program from the read only variable MM.CMDLINE$.

The implied RUN command is valid only at the command prompt (not within a running program).

If ‘program’ is the same as an internal MMBasic command the internal command will be run instead. To avoid this ‘program’ can be surrounded by quote marks:


"PRINT" command line


An error will be generated if the program currently in memory has been edited and not saved. If this happens (and you do not want to save the program) use the NEW command to clear the memory.

Example:


SORT INFILE.TXT OUTFILE.TXT


Will run the program SORT.BAS and the variable MM.CMDLINE$ will hold the string: “INFILE.TXT OUTFILE.TXT”

Create an MMBasic file named CMDLINE.BAS with this code:

1
PRINT MM.CMDLINE$

Place it on the B: drive (SD card). With B: as the current drive, the following is a test of the command line:


> cmdline 1 2 3 4

1 2 3 4
>


See also:
CHAIN
EDIT
LOAD
MM.CMDLINE$
MM.FNAME$
NEW
OPTION BREAK
SAVE
WATCHDOG

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

A Ton of Documentation

Open all | Close all

Projects made by Gizmo, Friends, and Members

open all | close all

Recent GizmoBlog Musings

  • Altair 8800 using a ColorMax!
  • Re-energizing the ColorMax, Pt. 3

Visit us!

  • Facebook

Electronic Products for Creative Minds

CircuitGizmos is your source for electronic products that help you create your embedded projects. Here at CircuitGizmos.com you will find a friendly store filled with creative products and all of the documentation that you need to use these gizmos.

We create devices that we believe make electronics fun, but we also know that our products are used for professional designs. For decades we have designed products for commercial, military, and medical industries. Our gizmos here are great for engineers and hobbyists alike.

Copyright © 2008+ CircuitGizmos, L.L.C. All rights reserved

Image already added

Recently Viewed Products

Copyright © 2021 · Generate Pro Theme on Genesis Framework · WordPress · Log in