Home > CBM > BASIC > Keywords > Run | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
RUN [ lineNumber ] ~ or ~ RUN fileName [ , D driveNumber ] [ { , | ON } U unitNumber ] ... [ , ItwoChar ] [ , R ] ...
Program flow control. Start program execution.
RUN is most typically entered without any parameters. For those with v7.0, supplying a fileName (and sometimes a unitNumber) may occur on a regular basis. If a fileName is given, RUN will first load the program (fileName) into memory. Should the specfied fileName not be found on the device, a FILE NOT FOUND ERROR message will be generated. The RUN fileName form, like all disk commands, updates the secret variable "DosFA" (sets it equal to unitNumber), and clears DS$. See DLOAD for more information about parameters when a fileName is used. Next, the RUN command perfors the equivalant of CLR : GOTO lineNumber (where lineNumber defaults to the first line of the program). When a fileName is specified, execution always begins on the first program line; as it turns out, you can not supply both a fileName and a lineNumber... one or the other... if you try to specify both, you get SYNTAX ERROR. Specifiying a lineNumber implies (but does not gaurantee) that one or more program lines will be skipped. Skipping initial program line(s) is generally a bad idea. Occassionaly it may be useful for debugging. Much more useful for debugging are CONT and GOTO. If lineNumber is specified, it must exist; otherwise an UNDEF'D STATEMENT ERROR is generated. If you are into hard-core debugging/analysis, be sure to see the topic about Entering RUN Mode and of course the details of CLR. This statement updates a secret variable "Run Mode" by setting it to 128. It is secret because BASIC provides no way to read the value (except for machine-specific PEEK). Example:
I almost forgot! The "R" and "I" parameters (only allowed in BASIC 7.0) do nothing.
If present, the "I" parameter must be immediately followed twoChars (any two two literal characters).
The "R" is suppose to specifiy Read mode for the device; anyway you can use it multiply times if you like.
© H2Obsession, 2014 |