Scripting Support

The command line interface provides a simple way to script the emulator. For scripts that need more advanced control flow, data structures, callbacks, TEMU can also run Python scripts.

Scripting wrappers typically strip the temu namespace from function names as the languages have their own support for namespaces or packages. Instead, they bundle the TEMU functions inside the TEMU package. To use the functions the relevant package must be imported using e.g. import temu.c.support.cpu. The C-subpackage is used for auto-generated wrappers of the C-API.

Python scripts can be executed via the script-run command from the CLI. The command takes either a file using the file argument, or a literal string using the script argument.

Another way to run a Python script is to start the CLI with the --run-script option, using this option a non-interactive execution of TEMU will be started (which stops after the script finishes). It is possible to run multiple scripts by specifying the --run-script option multiple times. As argument, pass a name of the script you want to execute.

Use the --run-commands option to specify a CLI script as well. The CLI scripts are normally more convenient for constructing CPUs and will be possible to use when running interactively as well.

See Python Scripting for the temu.Object bridge, command invocation, notifications, fixed-width integers, and the legacy ctypes wrapper fallback.