Lard Interpreter li

winbci module

The winbci module is a windows core module, meaning that it is automatically loaded when the windows module is loaded. Its function is to extend the interface to the bcode interpreter for the graphical user interface. Its functions partly replace and augment the facilities provided by the bci module.


User Interface


winbci adds a Simulation menu to the main menubar. Its entries are:
Load...
This menu item allows the user to select a bcode file which is then loaded into the bcode interpreter using bci_load.

Reload
This menu item calls bci_reload which reloads the previously selected bcode file.

Run
This menu item runs the simulation.

Stop
Selecting this menu item causes the simulation to be suspended.

Abandon
This menu item attempts to clear the current bcode file from memory, but doesn't do a very good job - it is probably better to quit and restart.

At any time some of the menu entries will be disabled; for example when no simulation is loaded the Run button will be disabled.


Module Writer's Interface


The command bci_winload gives the behaviour of the Load menu item, i.e. displaying a file selector and calling bci_load with the selected file.

winbci replaces the basic implementation of bci_run from the bci module with a version that gives the effect of running the interpreter in the background so that the user interface can continue to operate. It does this by repeatedly interpreting a number of instructions and then updating the user interface.

The simulation can be stopped by code called during these update periods by setting the variable bci_run_stop to true. This variable is polled by the bci_run code. This can be used to implement breakpoint type behaviour.

The number of instructions executed between updates is a balance between a responsive user interface and fast simulation. The number is controlled by the variable bci_responsiveness and defaults to 1000.