Next: , Previous: , Up: Running the program   [Contents][Index]

3.3.1 Non-interactive mode

To make mixvm work in non-interactive mode, use the -r flag. Thus, to run our hello.mix program, simply type

mixvm -r hello RET

at your command prompt, and you will get the following output:


Since our hello world program uses MIX’s device number 19 as its output device (see Writing a source file), the output is redirected to the shell’s standard output. Had you used any other MIX output devices (disks, drums, line printer, etc.), mixvm would have created a file named after the device used (e.g. and written its output there12.

The virtual machine can also report the execution time of the program, according to the (virtual) time spent in each of the binary instructions (see Execution times). Printing of execution time statistics is activated with the -t flag; running

mixvm -t -r hello RET

produces the following output:

** Execution time: 11

Sometimes, you will prefer to store the results of your program in MIX registers rather than writing them to a device. In such cases, mixvm’s -d flag is your friend: it makes mixvm dump the contents of its registers and flags after executing the loaded program. For instance, typing the following command at your shell’s prompt

mixvm -d -r hello

you will obtain the following output:

rA: + 00 00 00 00 00 (0000000000)
rX: + 00 00 00 00 00 (0000000000)
rJ: + 00 00 (0000)
rI1: + 00 00 (0000)     rI2: + 00 00 (0000)
rI3: + 00 00 (0000)     rI4: + 00 00 (0000)
rI5: + 00 00 (0000)     rI6: + 00 00 (0000)
Overflow: F
Cmp: E

which, in addition to the program’s outputs and execution time, gives you the contents of the MIX registers and the values of the overflow toggle and comparison flag (admittedly, rather uninteresting in our sample).

As you can see, running programs non-interactively has many limitations. You cannot peek the virtual machine’s memory contents, not to mention stepping through your program’s instructions or setting breakpoints13. Enter interactive mode.

Next: , Previous: , Up: Running the program   [Contents][Index]