Next: , Previous: Using mixguile, Up: Using mixguile


3.4.1 The mixguile shell

If you simply type

     mixguile <RET>

at the command prompt, you'll be presented a Guile shell prompt like this

     guile>

At this point, you have entered a Scheme read-eval-print loop (REPL) which offers you all the Guile functionality plus a new set of built-in procedures to execute and debug MIX programs. Each of the mixvm commands described in the previous sections (and in see mixvm) have a Scheme function counterpart named after it by prepending the prefix mix- to its name. Thus, to load our hello world program, you can simply enter

     guile> (mix-load "hello")
     Program loaded. Start address: 3000
     guile>

and run it using mix-run:

     guile> (mix-run)
     Running ...
     MIXAL HELLO WORLD
     ... done
     Elapsed time: 11 /Total program time: 11 (Total uptime: 11)
     guile>

In the same way, you can execute it step by step using the Scheme function mix-next or set a breakpoint:

     guile> (mix-sbp 4)
     Breakpoint set at line 5
     guile>

or, if you one to peek at a register contents:

     guile> (mix-preg 'A)
     rA: + 00 00 00 00 00 (0000000000)
     guile>

You get the idea: you have at your disposal all the mixvm and gmixvm commands by means of mix- functions. But, in case you are wondering, this is only the beginning. You also have at your disposal a whole Scheme interpreter, and you can, for instance, define new functions combining the mix- and all other Scheme primitives. In the next sections, you'll find examples of how to take advantage of the Guile interpreter.