MC-Basic:LOAD$

From SoftMC-Wiki
Jump to: navigation, search

This command loads a programs and libraries from the Flash Disk into RAM, from where it may be executed. In the process, the program or library is checked for syntax errors. Syntax errors are written to the TRN.ERR file, which may be retrieved to see which errors occurred. Only programs without syntax errors may be executed. Programs are executed using the STARTTASK command. The Priority sets the <priority level> at which the task is run within the system. The highest priority is 1, which causes the task to be run after all realtime tasks have run. The lowest priority is 16. Tasks with the same priority level run using a round-robin procedure, which gives equal time to each task. A low priority task cannot interrupt a high priority task.

The StackSize optional parameter sets the size of local (Dim) variables’ stack. It’s value is a actually a floating point multiplier of an internal basic stack size.  This basic stack size is the lowest size allowed for local data stack (when size multiplier is 1), whereas the highest value depends on the amount of freememory available.

The <task name> defines the new task name, what the loaded task gets. This option lets user load the same task several times with different names

NOTE-Info.svgNOTE
The command line operates at priority level 2. If a task is started at priority level 1, the command line is not operable until the task ends or until it releases the CPU.

Syntax

Load$ <filename>  { as <task name> } {Priority = <priority level>} {StackSize = <stacksize multiplier>}

Availability

All versions

Type

<filename>: String.
<priority level>: Long

<stacksize multiplier>: Double

<task name>: String

Range

<priority level>: 1 to 16

<stacksize multiplier>:1 to MaxDouble

Default

<priority level>: 16

<stacksize multiplier>:1

Scope

Task or Terminal      for programs and IMPORTED ( local ) libraries

Configuration            for global libraries

Limitations

The only limitation is free memory space. The largest block of free memory may be queried using the SYSTEM.MAXMEMBLOCK query.

Examples

Load$ “MAKECUT.PRG”

Or

Common shared Str1 as string

Str1 = “MAKECUT.PRG”

Load$ Str1

Load$ “LIBRARY1.LIB”


Load$ “Process.PRG” as “Process1.PRG” Priority = 16

Load$ “Process.PRG” as “Process2.PRG” Priority = 15

Load$ “Process.PRG” as “Process3.PRG”Priority = 14

-->?tasklist

TaskName= PROCESS1.PRG.PRG,State=Ready,Priority=16

TaskName= PROCESS2.PRG.PRG,State=Ready,Priority=15

TaskName= PROCESS3.PRG.PRG,State=Ready,Priority=14

See Also