RUN

Format

RUN string1

Description

This function can be used to load and execute other programs compiled with ASIC or another compiler. String1 represents the name of the program to execute. If an error occurs when ASIC attempts to RUN the program, it will set the system ERROR variable to 255. Otherwise, the ERROR variable will be set to the value of the return code of the called program (which is 0 unless the called program specifies otherwise).

Example

RUN "OTHER.COM"

Comments

If you are compiling with the OBJ output option, you must LINK your program from the command line. This is due to the fact that, by default, LINK.EXE will request all available memory for the program. When your program tries to RUN another program, DOS has no memory to allocate for the called program and the RUN will fail. To get around this, use the "/CPARMAXALLOC" LINK parameter and run LINK from the COMMAND line. You must estimate how much memory your program needs to load (in 16 byte paragraphs). For example, to limit your program to 32k, use a LINK statement such as the following:
     LINK progname /CPARMAXALLOC:2000

If you fail to specify a large enough value for "/CPARMAXALLOC", LINK.EXE will ignore the option and allocate all available memory, so you may have to experiment with this parameter to determine the proper setting.
String1 must contain the FULL pathname of the program (ie,"\directory\progname.COM") only if the program is NOT in the current directory. You must include the file extension on the file name (for example, use "MYPROG.COM" instead of just "MYPROG", or use "MYPROG.EXE" instead of "MYPROG").
It is recommended (but not required) that you compile your program using the EXE format (instead of the COM format) when your program uses this statement, since an EXE program will release more memory when calling the program. This will allow you to call a slightly larger program than is possible with the COM format.

Caution

You may use the debugger with programs which contain "CALL" or "RUN" statements. However, the programs you call should not themselves contain debugging code. For example, if A.ASI calls B.ASI, then make sure you compile B.ASI with the "Debugging Code" option OFF before you try to debug program A.ASI. Failure to do so will cause the debugger to behave erratically. This also applies to programs you write using other compilers, since they also use the same interrupt that ASIC uses (INT 3) for debugging purposes.

See Also

  • CALL