Previous: Hooks, Up: Scheme functions reference [Contents][Index]
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:
Return the current status of the virtual machine, as a number
(mixvm-status
) or as a symbol (mix-vm-status
). Possible
return values are:
(mixvm-status) | (mix-vm-status) | |
0 | MIX_ERROR | Loading or execution error |
1 | MIX_BREAK | Breakpoint encountered |
2 | MIX_COND_BREAK | Conditional breakpoint |
3 | MIX_HALTED | Execution terminated |
4 | MIX_RUNNING | Execution stopped after next |
5 | MIX_LOADED | Program successfully loaded |
6 | MIX_EMPTY | No program loaded |
Predicates asking whether the current virtual machine status is
MIX_ERROR
, MIX_BREAK
, etc.
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>
Evaluate and set the contents of the memory cell number cell_no. Both cell_no and value are Scheme numbers.
Evaluates to the value of the location counter (i.e., the address of the next instruction to be executed).
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!
.
Evaluate and set the comparison flag. Possible values are the scheme
symbols L
(lesser), E
(equal) and G
(greater).
Evaluates to the current virtual machine uptime.
Evaluates to the current virtual machine lapsed time, i.e., the time
elapsed since the last run
or next
command.
Evaluates to the total time spent executing the currently loaded program.
Evaluates to a string containing the basename (without any leading path) of the currently loaded MIX program.
Evaluates to a string containing the full path to the currently loaded MIX program.
Evaluates to a string containing the full path to the source file of the currently loaded MIX program.
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))
.
Evaluates to a string containing the full path of the current device directory.
Previous: Hooks, Up: Scheme functions reference [Contents][Index]