#### 6.2.1 File commands ¶

You have at your disposal a series of commands that let you load and execute MIX executable files, as well as manipulate MIXAL source files:

file command: load file[.mix] ¶

  This command loads a binary file, file.mix into the virtual machine memory, and positions the program counter at the beginning of the loaded program. This address is indicated in the MIXAL source file as the operand of the `END` pseudoinstruction. Thus, if your `sample.mixal` source file contains the line:

           END 3000

  and you compile it with `mixasm` to produce the binary file `sample.mix`, you will load it into the virtual machine as follows:

      MIX > load sample
      Program loaded. Start address: 3000
      MIX >

file command: run [file[.mix]] ¶

  When executed without argument, this command initiates or resumes execution of instructions from the current program counter address. Therefore, issuing this command after a successful `load`, will run the loaded program until either a `HLT` instruction or a breakpoint is found. If you provide a MIX filename as argument, the given file will be loaded (as with `load` file) and executed. If `run` is invoked again after program execution completion (i.e., after the `HLT` instruction has been found in a previous run), the program counter is repositioned and execution starts again from the beginning (as a matter of fact, a `load` command preserving the currently set breakpoints is issued before resuming execution).

file command: edit [file[.mixal]] ¶

  The source file file.mixal is edited using the editor defined in the environment variable MDK_EDITOR. If this variable is not set, the following ones are tried out in order: X_EDITOR, EDITOR and VISUAL. If invoked without argument, the source file for the currently loaded MIX file is edited. The command used to edit source files can also be configured using the `sedit` command (see Configuration commands).

file command: compile file[.mixal] ¶

  The source file file.mixal is compiled (with debug information enabled) using `mixasm`. If invoked without argument, the source file for the currently loaded MIX file is recompiled. The compilation command can be set using the `sasm` command (see Configuration commands).

file command: pprog ¶
file command: psrc ¶

  Print the path of the currently loaded MIX program and its source file:

      MIX > load ../samples/primes
      Program loaded. Start address: 3000
      MIX > pprog
      ../samples/primes.mix
      MIX > psrc
      /home/jao/projects/mdk/gnu/samples/primes.mixal
      MIx>

Finally, you can use the `quit` command to exit `mixvm`:

file command: quit ¶

  Exit `mixvm`, saving the current configuration parameters in `~/.mdk/mixvm.config`.