Skip to content
Textmode edited this page Mar 1, 2011 · 1 revision

machine.lua can be required.

As a module, machine exposes the following functions:

module:new(opt_name)
returns: machine

Creates a new machine with the given name. If no name is given, a default name will be provided.

(VM):signal(opt_signal)
returns: signal, description

if given no parms, returns the current signal, and a (short) textual description.
Otherwise it triggers the given signal.
If another signal has yet to be cleared, it will trigger a double fault.
If a double-fault is uncleared, a triple-fault.
Triggering a signal NONE will clear the signal.

(VM):load(opt_start, data-string-or-table)
returns: (nothing)

Attempts to load the given data into the machine's memory.
If start is omitted, it will load at address 0, segment 0.

(VM):cycle(opt_num)
returns: machine_state

completes num instruction cycles. if num is omitted, it will assume 1 cycle.

(VM):run(bool_show_status_dumps)
returns: (nothing)

Attempts to run the machine at it's base speed.
If passed true, it will call VM:dump() roughly 1/s

(VM):dump()
returns: (nothing)

Prints state information of the machine, including registers, and relevant memory segments.

Clone this wiki locally