Previous: , Up: Scheme functions reference   [Contents][Index]


8.2.3 Additional VM functions

When writing non-trivial Scheme extensions using the MIX/Scheme library, you will probably need to evaluate the contents of the virtual machine components (registers, memory cells and so on). For instance, you may need to store the contents of the A register in a variable. The Scheme functions described so far are of no help: you can print the contents of A using (mix-preg 'A), but you cannot define a variable containing the contents of A. To address this kind of problems, the MIX/Scheme library provides the following additional functions:

Function: mixvm-status
Function: mix-vm-status

Return the current status of the virtual machine, as a number (mixvm-status) or as a symbol (mix-vm-status). Posible return values are:

(mixvm-status)(mix-vm-status)
0MIX_ERRORLoading or execution error
1MIX_BREAKBreakpoint encountered
2MIX_COND_BREAKConditional breakpoint
3MIX_HALTEDExecution terminated
4MIX_RUNNINGExecution stopped after next
5MIX_LOADEDProgram successfully loaded
6MIX_EMPTYNo program loaded
Function: mix-vm-error?
Function: mix-vm-break?
Function: mix-vm-cond-break?
Function: mix-vm-halted?
Function: mix-vm-running?
Function: mix-vm-loaded?
Function: mix-vm-empty?

Predicates asking whether the current virtual machine status is MIX_ERROR, MIX_BREAK, etc.

Function: mix-reg register
Function: mix-set-reg! register value

mix-reg evaluates to a number which is the contents of the specified register. mix-set-reg sets the contents of the given register to value. The register can be specified either as a string ("A", "X", etc.) or as a symbol ('A, 'X, etc.). For instance,

guile> (mix-reg 'A)
2341
guile> (mix-set-reg! "A" 2000)
ok
guile> (define reg-a (mix-reg 'A))
guile> (display reg-a)
2000
guile>
Function: mix-cell cell_no
Function: mix-set-cell! cell_no value

Evaluate and set the contents of the memory cell number cell_no. Both cell_no and value are Scheme numbers.

Function: mix-loc

Evaluates to the value of the location counter (i.e., the address of the next instruction to be executed).

Function: mix-over
Function: mix-set-over! #t|#f

mix-over evaluates to #t if the overflow toggle is set, and to #f otherwise. The value of the overflow toggle can be modified using mix-set-over!.

Function: mix-cmp
Function: mix-set-cmp! 'L|'E|'G

Evaluate and set the comparison flag. Possible values are the scheme symbols L (lesser), E (equal) and G (greater).

Function: mix-up-time

Evaluates to the current virtual machine uptime.

Function: mix-lap-time

Evaluates to the current virtual machine lapsed time, i.e., the time elapsed since the last run or next command.

Function: mix-prog-time

Evaluates to the total time spent executing the currently loaded program.

Function: mix-prog-name

Evaluates to a string containing the basename (without any leading path) of the currently loaded MIX program.

Function: mix-prog-path

Evaluates to a string containing the full path to the currently loaded MIX program.

Function: mix-src-path

Evaluates to a string containing the full path to the source file of the currently loaded MIX program.

Function: mix-src-line [lineno]
Function: mix-src-line-no

mix-src-line-no evaluates to the current source file number during the execution of a program. mix-src-line evaluates to a string containing the source file line number lineno; when invoked without argument, it evaluates to (mix-src-line (mix-src-line-no)).

Function: mix-ddir

Evaluates to a string containing the full path of the current device directory.


Previous: , Up: Scheme functions reference   [Contents][Index]