API¶
This section describes all the high level interface modules found in the
bare68k
package. The classes wrap the low-level machine interface
and offer a object-oriented access with lots of convenience methods.
The Runtime¶
-
class
bare68k.
Runtime
(cpu_cfg, mem_cfg, run_cfg, event_handler=None, log_channel=None)[source]¶ The runtime controls the CPU emulation run and dispatches events.
The central entry point for every system emulation done with bare68k is the Runtime. First you configure it by passing in a CPU, memory layout and runtime configuration.
Add an optional event handler to control the processing of incoming events. Configure an optional Logger to receive all incoming traces.
Parameters: - cpu_cfg (
bare68k.CPUConfig
) – the CPU configuration - mem_cfg (
bare68k.MemoryConfig
) – the memory layout for the emulation - run_cfg (
bare68k.RunConfig
) – runtime options - event_handler (
bare68k.EventHandler
, optional) – event handler that receives all returned events from the CPU emulation. By default thebare68k.EventHandler
is used. - log_channel (
logging.Logger
, optional) – a logger that logs all runtime events. By default a logger with__name__
of the module is created.
-
get_label_mgr
()[source]¶ Get the label manager associated with the runtime.
If labels are enabled a real
LabelMgr
is returned. If labels are disabled then a fakeDummyLabelMgr
is available. It provides the same interface but does nothing.Returns: active label manager Return type: LabelMgr
orDummyLabelMgr
-
get_with_labels
()[source]¶ Check is memory labels are enabled for the runtime.
The runtime can be either configured to enable or disable memory labels via the
RunConfig
. This function returns True if labels are enabled otherwise False.Returns: True if labels are enabled, otherwise False Return type: bool
-
reset
(init_pc, init_sp=2048)[source]¶ reset the CPU
before you can run the CPU you have to reset it. This will write the initial SP and the initial PC to locations 0 and 4 in RAM and pulse a reset in the CPU emulation. After this operation you are free to overwrite these values again. Now proceed to call run().
-
run
(reset_end_pc=None, start_pc=None, start_sp=None)[source]¶ run the CPU until emulation ends
This is the main loop of your emulation. The CPU emulation is run and events are processed. The events are dispatched and the associated handlers are called. If a reset opcode is encountered then the execution is terminated.
Returns a RunInfo instance giving you timing information.
- cpu_cfg (
-
class
bare68k.
MemoryConfig
(auto_align=False)[source]¶ Configuration class for the memory layout of your m68k system
-
class
bare68k.
RunConfig
(catch_kb_intr=True, cycles_per_run=0, with_labels=True, pc_trace_size=8, instr_trace=False, cpu_mem_trace=False, api_mem_trace=False)[source]¶ define the runtime configuration