Low Level API

The low-level API of bare68k is found in the bare68k.api module. Here the direct native calls to the machine extension are available.

While the bare68k.api.cpu CPU and bare68k.api.mem Memory module are also used in regular code next to the high level API, all other low level calls are typically wrapped by the high level API.

CPU Access

The functions allow to read and write the current CPU state. All data d0-d7 and address registers a0-a7 are available. Additionally, special registers like USP user space stack pointer and VBR vector base register can be read and written.

The bare68k.api.cpu module wraps machine’s CPU access functions.

bare68k.api.cpu.get_cpu_context = <Mock name='mock.get_cpu_context' id='139892085812752'>

Read the CPU context including all registers.

Read the CPU context if you want to save the entire state. You can later restore the full CPU state with set_cpu_context().

Returns:CPUContext native context object contains stored state
bare68k.api.cpu.set_cpu_context = <Mock name='mock.set_cpu_context' id='139892085872720'>

Set the CPU context including all registers.

After getting the CPU state with get_cpu_context() you can restore the state with this function.

Parameters:ctx (CPUContext) – native context object with state to restore