Rocket 68
A Motorola 68000 CPU emulator in C
Loading...
Searching...
No Matches
m68k.h File Reference

Public CPU core API for Rocket 68. More...

#include <assert.h>
#include <setjmp.h>
#include <stdalign.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>

Go to the source code of this file.

Classes

union  M68kRegister
 68000 general register view. More...
struct  M68kCpu
 Full CPU context for one emulated 68000 instance. More...

Macros

#define M68K_INT_ACK_AUTOVECTOR   0xffffffff
 INT ACK callback return value for autovector.
#define M68K_INT_ACK_SPURIOUS   0xfffffffe
 INT ACK callback return value for spurious interrupt.
#define M68K_FC_USER_DATA   1
 Function code for user data access.
#define M68K_FC_USER_PROG   2
 Function code for user program access.
#define M68K_FC_SUPV_DATA   5
 Function code for supervisor data access.
#define M68K_FC_SUPV_PROG   6
 Function code for supervisor program access.
#define M68K_FC_INT_ACK   7
 Function code for interrupt acknowledge cycle.
#define M68K_SR_C   (1 << 0)
 Carry flag bit mask in SR.
#define M68K_SR_V   (1 << 1)
 Overflow flag bit mask in SR.
#define M68K_SR_Z   (1 << 2)
 Zero flag bit mask in SR.
#define M68K_SR_N   (1 << 3)
 Negative flag bit mask in SR.
#define M68K_SR_X   0x0010
 Extend flag bit mask in SR.
#define M68K_SR_S   0x2000
 Supervisor state bit mask in SR.

Typedefs

typedef uint8_t u8
 Unsigned 8-bit integer type.
typedef uint16_t u16
 Unsigned 16-bit integer type.
typedef uint32_t u32
 Unsigned 32-bit integer type.
typedef int8_t s8
 Signed 8-bit integer type.
typedef int16_t s16
 Signed 16-bit integer type.
typedef int32_t s32
 Signed 32-bit integer type.
typedef struct M68kCpu M68kCpu
 Forward declaration of the CPU context.
typedef int(* M68kWaitBusCallback) (M68kCpu *cpu, u32 address, M68kSize size, bool is_write)
 Bus wait callback.
typedef int(* M68kIntAckCallback) (M68kCpu *cpu, int level)
 Interrupt acknowledge callback.
typedef void(* M68kFcCallback) (M68kCpu *cpu, unsigned int new_fc)
 Function code callback emitted for each bus/program access context.
typedef void(* M68kInstrHookCallback) (M68kCpu *cpu, u32 pc)
 Instruction hook callback executed before instruction decode/execute.
typedef void(* M68kPcChangedCallback) (M68kCpu *cpu, u32 new_pc)
 Program counter changed callback.
typedef void(* M68kResetCallback) (M68kCpu *cpu)
 Reset callback.
typedef int(* M68kTasCallback) (M68kCpu *cpu)
 TAS callback. Return nonzero to allow write-back, or zero to block it.
typedef int(* M68kIllgCallback) (M68kCpu *cpu, int opcode)
 Illegal instruction callback. Return nonzero to suppress vector 4 and continue execution. Line-A and line-F exceptions do not invoke this callback.
typedef u8(* M68kRead8Callback) (M68kCpu *cpu, u32 address)
 Host memory read callback (8-bit).
typedef u16(* M68kRead16Callback) (M68kCpu *cpu, u32 address)
 Host memory read callback (16-bit).
typedef u32(* M68kRead32Callback) (M68kCpu *cpu, u32 address)
 Host memory read callback (32-bit).
typedef void(* M68kWrite8Callback) (M68kCpu *cpu, u32 address, u8 value)
 Host memory write callback (8-bit).
typedef void(* M68kWrite16Callback) (M68kCpu *cpu, u32 address, u16 value)
 Host memory write callback (16-bit).
typedef void(* M68kWrite32Callback) (M68kCpu *cpu, u32 address, u32 value)
 Host memory write callback (32-bit).

Enumerations

enum  M68kSize { SIZE_BYTE = 1 , SIZE_WORD = 2 , SIZE_LONG = 4 }
 Operand size in bytes. More...
enum  M68kModel { M68K_MODEL_68000 = 0 , M68K_MODEL_68010 = 1 }
 CPU model selection. The 68000 is the default. More...
enum  M68kAddrMode {
  ADDR_MODE_DATA_REG_DIRECT , ADDR_MODE_ADDR_REG_DIRECT , ADDR_MODE_ADDR_REG_INDIRECT , ADDR_MODE_ARI_POSTINC ,
  ADDR_MODE_ARI_PREDEC , ADDR_MODE_ARI_DISP , ADDR_MODE_ARI_INDEX , ADDR_MODE_ABS_SHORT ,
  ADDR_MODE_ABS_LONG , ADDR_MODE_PC_DISP , ADDR_MODE_PC_INDEX , ADDR_MODE_IMMEDIATE
}
 Effective address mode encoding used by internal helpers and opcode decoding. More...

Functions

void m68k_init (M68kCpu *cpu, u8 *memory, u32 memory_size)
 Initialize a CPU context and bind memory.
void m68k_reset (M68kCpu *cpu)
 Reset CPU state and load initial vectors from memory.
void m68k_set_pc (M68kCpu *cpu, u32 pc)
 Set the program counter.
u32 m68k_get_pc (M68kCpu *cpu)
 Get the current program counter.
void m68k_set_model (M68kCpu *cpu, M68kModel model)
 Select the CPU model profile.
M68kModel m68k_get_model (M68kCpu *cpu)
 Read the selected CPU model profile.
void m68k_set_dr (M68kCpu *cpu, int reg, u32 value)
 Set data register value.
u32 m68k_get_dr (M68kCpu *cpu, int reg)
 Get data register value.
void m68k_set_ar (M68kCpu *cpu, int reg, u32 value)
 Set address register value.
u32 m68k_get_ar (M68kCpu *cpu, int reg)
 Get address register value.
void m68k_step_ex (M68kCpu *cpu, bool check_exceptions)
 Execute one instruction with optional interrupt and trace checks.
void m68k_step (M68kCpu *cpu)
 Execute one instruction step.
int m68k_execute (M68kCpu *cpu, int cycles)
 Execute instructions for a cycle budget.
int m68k_cycles_run (M68kCpu *cpu)
 Get cycles consumed in the active timeslice accounting model.
int m68k_cycles_remaining (M68kCpu *cpu)
 Get remaining cycles in the current timeslice.
void m68k_modify_timeslice (M68kCpu *cpu, int cycles)
 Add cycles to current timeslice.
void m68k_end_timeslice (M68kCpu *cpu)
 End current timeslice immediately.
void m68k_set_sr (M68kCpu *cpu, u16 new_sr)
 Set the status register.
void m68k_set_irq (M68kCpu *cpu, int level)
 Set the asserted interrupt level (the virtual IPL lines).
u8 m68k_read_8 (M68kCpu *cpu, u32 address)
 Read one byte from emulated memory.
u16 m68k_read_16 (M68kCpu *cpu, u32 address)
 Read one word from emulated memory.
u32 m68k_read_32 (M68kCpu *cpu, u32 address)
 Read one longword from emulated memory.
void m68k_write_8 (M68kCpu *cpu, u32 address, u8 value)
 Write one byte to emulated memory.
void m68k_write_16 (M68kCpu *cpu, u32 address, u16 value)
 Write one word to emulated memory.
void m68k_write_32 (M68kCpu *cpu, u32 address, u32 value)
 Write one longword to emulated memory.
void m68k_set_wait_bus_callback (M68kCpu *cpu, M68kWaitBusCallback callback)
 Install wait bus callback.
void m68k_set_int_ack_callback (M68kCpu *cpu, M68kIntAckCallback callback)
 Install interrupt acknowledge callback.
void m68k_set_fc_callback (M68kCpu *cpu, M68kFcCallback callback)
 Install function code callback.
void m68k_set_instr_hook_callback (M68kCpu *cpu, M68kInstrHookCallback callback)
 Install instruction hook callback.
void m68k_set_pc_changed_callback (M68kCpu *cpu, M68kPcChangedCallback callback)
 Install PC-changed callback.
void m68k_set_reset_callback (M68kCpu *cpu, M68kResetCallback callback)
 Install reset callback.
void m68k_set_tas_callback (M68kCpu *cpu, M68kTasCallback callback)
 Install TAS callback.
void m68k_set_illg_callback (M68kCpu *cpu, M68kIllgCallback callback)
 Install illegal opcode callback.
void m68k_set_read8_callback (M68kCpu *cpu, M68kRead8Callback callback)
 Install host memory read callback (8-bit).
void m68k_set_read16_callback (M68kCpu *cpu, M68kRead16Callback callback)
 Install host memory read callback (16-bit).
void m68k_set_read32_callback (M68kCpu *cpu, M68kRead32Callback callback)
 Install host memory read callback (32-bit).
void m68k_set_write8_callback (M68kCpu *cpu, M68kWrite8Callback callback)
 Install host memory write callback (8-bit).
void m68k_set_write16_callback (M68kCpu *cpu, M68kWrite16Callback callback)
 Install host memory write callback (16-bit).
void m68k_set_write32_callback (M68kCpu *cpu, M68kWrite32Callback callback)
 Install host memory write callback (32-bit).
void m68k_raise_bus_error (M68kCpu *cpu)
 Report a bus error from the current host memory callback.
unsigned int m68k_context_size (void)
 Get serialized context size.
void m68k_get_context (M68kCpu *cpu, void *dst)
 Copy CPU context into an external buffer.
void m68k_set_context (M68kCpu *cpu, const void *src)
 Restore CPU context from an external buffer.
size_t m68k_serialize (const M68kCpu *cpu, u8 *buffer, size_t capacity)
 Serialize architectural CPU state into a portable save state.
bool m68k_deserialize (M68kCpu *cpu, const u8 *buffer, size_t length)
 Restore architectural CPU state from a portable save state.

Detailed Description

Public CPU core API for Rocket 68.

Macro Definition Documentation

◆ M68K_FC_INT_ACK

#define M68K_FC_INT_ACK   7

Function code for interrupt acknowledge cycle.

◆ M68K_FC_SUPV_DATA

#define M68K_FC_SUPV_DATA   5

Function code for supervisor data access.

◆ M68K_FC_SUPV_PROG

#define M68K_FC_SUPV_PROG   6

Function code for supervisor program access.

◆ M68K_FC_USER_DATA

#define M68K_FC_USER_DATA   1

Function code for user data access.

◆ M68K_FC_USER_PROG

#define M68K_FC_USER_PROG   2

Function code for user program access.

◆ M68K_INT_ACK_AUTOVECTOR

#define M68K_INT_ACK_AUTOVECTOR   0xffffffff

INT ACK callback return value for autovector.

◆ M68K_INT_ACK_SPURIOUS

#define M68K_INT_ACK_SPURIOUS   0xfffffffe

INT ACK callback return value for spurious interrupt.

◆ M68K_SR_C

#define M68K_SR_C   (1 << 0)

Carry flag bit mask in SR.

◆ M68K_SR_N

#define M68K_SR_N   (1 << 3)

Negative flag bit mask in SR.

◆ M68K_SR_S

#define M68K_SR_S   0x2000

Supervisor state bit mask in SR.

◆ M68K_SR_V

#define M68K_SR_V   (1 << 1)

Overflow flag bit mask in SR.

◆ M68K_SR_X

#define M68K_SR_X   0x0010

Extend flag bit mask in SR.

◆ M68K_SR_Z

#define M68K_SR_Z   (1 << 2)

Zero flag bit mask in SR.

Typedef Documentation

◆ M68kCpu

typedef struct M68kCpu M68kCpu

Forward declaration of the CPU context.

Full CPU context for one emulated 68000 instance.

◆ M68kFcCallback

typedef void(* M68kFcCallback) (M68kCpu *cpu, unsigned int new_fc)

Function code callback emitted for each bus/program access context.

◆ M68kIllgCallback

typedef int(* M68kIllgCallback) (M68kCpu *cpu, int opcode)

Illegal instruction callback. Return nonzero to suppress vector 4 and continue execution. Line-A and line-F exceptions do not invoke this callback.

◆ M68kInstrHookCallback

typedef void(* M68kInstrHookCallback) (M68kCpu *cpu, u32 pc)

Instruction hook callback executed before instruction decode/execute.

◆ M68kIntAckCallback

typedef int(* M68kIntAckCallback) (M68kCpu *cpu, int level)

Interrupt acknowledge callback.

Return a vector number, M68K_INT_ACK_AUTOVECTOR, or M68K_INT_ACK_SPURIOUS.

◆ M68kPcChangedCallback

typedef void(* M68kPcChangedCallback) (M68kCpu *cpu, u32 new_pc)

Program counter changed callback.

◆ M68kRead16Callback

typedef u16(* M68kRead16Callback) (M68kCpu *cpu, u32 address)

Host memory read callback (16-bit).

◆ M68kRead32Callback

typedef u32(* M68kRead32Callback) (M68kCpu *cpu, u32 address)

Host memory read callback (32-bit).

◆ M68kRead8Callback

typedef u8(* M68kRead8Callback) (M68kCpu *cpu, u32 address)

Host memory read callback (8-bit).

◆ M68kResetCallback

typedef void(* M68kResetCallback) (M68kCpu *cpu)

Reset callback.

◆ M68kTasCallback

typedef int(* M68kTasCallback) (M68kCpu *cpu)

TAS callback. Return nonzero to allow write-back, or zero to block it.

◆ M68kWaitBusCallback

typedef int(* M68kWaitBusCallback) (M68kCpu *cpu, u32 address, M68kSize size, bool is_write)

Bus wait callback.

Called on every memory access (reads, writes, and instruction fetches) before the access occurs. Returns the number of extra M68K cycles to deduct for bus contention or wait states. Return 0 for no delay.

Parameters
cpuCPU context.
address24-bit physical address.
sizeOperand size (byte, word, or long).
is_writetrue for write accesses, false for reads and fetches.
Returns
Extra M68K cycles to deduct (0 = no wait).

◆ M68kWrite16Callback

typedef void(* M68kWrite16Callback) (M68kCpu *cpu, u32 address, u16 value)

Host memory write callback (16-bit).

◆ M68kWrite32Callback

typedef void(* M68kWrite32Callback) (M68kCpu *cpu, u32 address, u32 value)

Host memory write callback (32-bit).

◆ M68kWrite8Callback

typedef void(* M68kWrite8Callback) (M68kCpu *cpu, u32 address, u8 value)

Host memory write callback (8-bit).

◆ s16

typedef int16_t s16

Signed 16-bit integer type.

◆ s32

typedef int32_t s32

Signed 32-bit integer type.

◆ s8

typedef int8_t s8

Signed 8-bit integer type.

◆ u16

typedef uint16_t u16

Unsigned 16-bit integer type.

◆ u32

typedef uint32_t u32

Unsigned 32-bit integer type.

◆ u8

typedef uint8_t u8

Unsigned 8-bit integer type.

Enumeration Type Documentation

◆ M68kAddrMode

Effective address mode encoding used by internal helpers and opcode decoding.

Enumerator
ADDR_MODE_DATA_REG_DIRECT 
ADDR_MODE_ADDR_REG_DIRECT 
ADDR_MODE_ADDR_REG_INDIRECT 
ADDR_MODE_ARI_POSTINC 
ADDR_MODE_ARI_PREDEC 
ADDR_MODE_ARI_DISP 
ADDR_MODE_ARI_INDEX 
ADDR_MODE_ABS_SHORT 
ADDR_MODE_ABS_LONG 
ADDR_MODE_PC_DISP 
ADDR_MODE_PC_INDEX 
ADDR_MODE_IMMEDIATE 

◆ M68kModel

enum M68kModel

CPU model selection. The 68000 is the default.

Enumerator
M68K_MODEL_68000 

Base 68000 profile.

M68K_MODEL_68010 

68010 profile: MOVEC, MOVES, RTD, and BKPT enabled.

◆ M68kSize

enum M68kSize

Operand size in bytes.

Enumerator
SIZE_BYTE 
SIZE_WORD 
SIZE_LONG 

Function Documentation

◆ m68k_context_size()

unsigned int m68k_context_size ( void )

Get serialized context size.

Returns
Number of bytes required for context copy buffer.

◆ m68k_cycles_remaining()

int m68k_cycles_remaining ( M68kCpu * cpu)

Get remaining cycles in the current timeslice.

Parameters
cpuCPU context.
Returns
Remaining cycles.

◆ m68k_cycles_run()

int m68k_cycles_run ( M68kCpu * cpu)

Get cycles consumed in the active timeslice accounting model.

Parameters
cpuCPU context.
Returns
Consumed cycle count.

◆ m68k_deserialize()

bool m68k_deserialize ( M68kCpu * cpu,
const u8 * buffer,
size_t length )

Restore architectural CPU state from a portable save state.

Parameters
cpuCPU context; its memory binding and callbacks are kept.
bufferSerialized state produced by m68k_serialize.
lengthLength of the serialized state in bytes.
Returns
true on success; false when the data is malformed, truncated, or has an unsupported version.

Fields with unknown tags are skipped, so states written by newer library versions restore their known fields.

◆ m68k_end_timeslice()

void m68k_end_timeslice ( M68kCpu * cpu)

End current timeslice immediately.

Parameters
cpuCPU context.

◆ m68k_execute()

int m68k_execute ( M68kCpu * cpu,
int cycles )

Execute instructions for a cycle budget.

Parameters
cpuCPU context.
cyclesRequested number of cycles to add to the current timeslice.
Returns
Number of cycles consumed by this call.

◆ m68k_get_ar()

u32 m68k_get_ar ( M68kCpu * cpu,
int reg )

Get address register value.

Parameters
cpuCPU context.
regAddress register index [0,7].
Returns
Register value, or 0 for invalid index.

◆ m68k_get_context()

void m68k_get_context ( M68kCpu * cpu,
void * dst )

Copy CPU context into an external buffer.

Memory pointer and size are copied as part of the context payload.

Parameters
cpuCPU context.
dstDestination buffer with at least m68k_context_size bytes.

◆ m68k_get_dr()

u32 m68k_get_dr ( M68kCpu * cpu,
int reg )

Get data register value.

Parameters
cpuCPU context.
regData register index [0,7].
Returns
Register value, or 0 for invalid index.

◆ m68k_get_model()

M68kModel m68k_get_model ( M68kCpu * cpu)

Read the selected CPU model profile.

Parameters
cpuCPU context.
Returns
Current model profile.

◆ m68k_get_pc()

u32 m68k_get_pc ( M68kCpu * cpu)

Get the current program counter.

Parameters
cpuCPU context.
Returns
Current PC.

◆ m68k_init()

void m68k_init ( M68kCpu * cpu,
u8 * memory,
u32 memory_size )

Initialize a CPU context and bind memory.

Parameters
cpuCPU context to initialize.
memoryPointer to emulated memory.
memory_sizeSize of memory in bytes.

◆ m68k_modify_timeslice()

void m68k_modify_timeslice ( M68kCpu * cpu,
int cycles )

Add cycles to current timeslice.

Parameters
cpuCPU context.
cyclesNumber of cycles to add.

◆ m68k_raise_bus_error()

void m68k_raise_bus_error ( M68kCpu * cpu)

Report a bus error from the current host memory callback.

Parameters
cpuCPU context supplied to the callback.

Return immediately after this call (read callbacks may return any value). The core processes vector 2 after the callback returns, using the current access address and direction. This function does not unwind the callback. Calls outside a CPU memory access, including disassembly and internal peeks, have no effect. Callbacks must not reenter execution or memory access helpers on the same CPU. Earlier bus side effects are not rolled back.

◆ m68k_read_16()

u16 m68k_read_16 ( M68kCpu * cpu,
u32 address )

Read one word from emulated memory.

Parameters
cpuCPU context.
addressEmulated address.
Returns
Read value.

◆ m68k_read_32()

u32 m68k_read_32 ( M68kCpu * cpu,
u32 address )

Read one longword from emulated memory.

Parameters
cpuCPU context.
addressEmulated address.
Returns
Read value.

◆ m68k_read_8()

u8 m68k_read_8 ( M68kCpu * cpu,
u32 address )

Read one byte from emulated memory.

Parameters
cpuCPU context.
addressEmulated address.
Returns
Read value.

◆ m68k_reset()

void m68k_reset ( M68kCpu * cpu)

Reset CPU state and load initial vectors from memory.

Parameters
cpuCPU context.

◆ m68k_serialize()

size_t m68k_serialize ( const M68kCpu * cpu,
u8 * buffer,
size_t capacity )

Serialize architectural CPU state into a portable save state.

Parameters
cpuCPU context.
bufferOutput buffer, or NULL to query the required size.
capacitySize of the output buffer in bytes.
Returns
Number of bytes written, the required size when buffer is NULL, or 0 when the buffer is too small.

The format is versioned, tagged, and big-endian, so it is stable across builds, compilers, and host architectures, unlike the raw m68k_get_context blob. Host bindings (memory, callbacks) and transient fault latches are not serialized. Serializing in the middle of exception processing is not supported.

◆ m68k_set_ar()

void m68k_set_ar ( M68kCpu * cpu,
int reg,
u32 value )

Set address register value.

Parameters
cpuCPU context.
regAddress register index [0,7].
valueNew 32-bit value.

◆ m68k_set_context()

void m68k_set_context ( M68kCpu * cpu,
const void * src )

Restore CPU context from an external buffer.

The bound memory pointer and memory size from the destination context are preserved.

Parameters
cpuCPU context.
srcSource buffer with at least m68k_context_size bytes.

◆ m68k_set_dr()

void m68k_set_dr ( M68kCpu * cpu,
int reg,
u32 value )

Set data register value.

Parameters
cpuCPU context.
regData register index [0,7].
valueNew 32-bit value.

◆ m68k_set_fc_callback()

void m68k_set_fc_callback ( M68kCpu * cpu,
M68kFcCallback callback )

Install function code callback.

Parameters
cpuCPU context.
callbackCallback function pointer or NULL.

The callback is invoked before memory/program accesses with the active function code.

◆ m68k_set_illg_callback()

void m68k_set_illg_callback ( M68kCpu * cpu,
M68kIllgCallback callback )

Install illegal opcode callback.

Parameters
cpuCPU context.
callbackCallback function pointer or NULL.

◆ m68k_set_instr_hook_callback()

void m68k_set_instr_hook_callback ( M68kCpu * cpu,
M68kInstrHookCallback callback )

Install instruction hook callback.

Parameters
cpuCPU context.
callbackCallback function pointer or NULL.

◆ m68k_set_int_ack_callback()

void m68k_set_int_ack_callback ( M68kCpu * cpu,
M68kIntAckCallback callback )

Install interrupt acknowledge callback.

Parameters
cpuCPU context.
callbackCallback function pointer or NULL.

◆ m68k_set_irq()

void m68k_set_irq ( M68kCpu * cpu,
int level )

Set the asserted interrupt level (the virtual IPL lines).

Levels 1-6 are level-sensitive. Without an INT ACK callback the request clears automatically when serviced; with a callback installed the level stays asserted until the host calls this function with 0 (or a new level). Level 7 is edge-sensitive: each transition to 7 latches one non-maskable interrupt.

Parameters
cpuCPU context.
levelInterrupt level in range [0,7].

◆ m68k_set_model()

void m68k_set_model ( M68kCpu * cpu,
M68kModel model )

Select the CPU model profile.

Parameters
cpuCPU context.
modelModel profile; the default after m68k_init is the 68000.

On the 68000 profile the later-family instructions MOVEC, MOVES, RTD, and BKPT raise illegal-instruction exceptions, matching real hardware.

◆ m68k_set_pc()

void m68k_set_pc ( M68kCpu * cpu,
u32 pc )

Set the program counter.

Parameters
cpuCPU context.
pcNew program counter value.

◆ m68k_set_pc_changed_callback()

void m68k_set_pc_changed_callback ( M68kCpu * cpu,
M68kPcChangedCallback callback )

Install PC-changed callback.

Parameters
cpuCPU context.
callbackCallback function pointer or NULL.

◆ m68k_set_read16_callback()

void m68k_set_read16_callback ( M68kCpu * cpu,
M68kRead16Callback callback )

Install host memory read callback (16-bit).

Parameters
cpuCPU context.
callbackCallback function pointer or NULL.

◆ m68k_set_read32_callback()

void m68k_set_read32_callback ( M68kCpu * cpu,
M68kRead32Callback callback )

Install host memory read callback (32-bit).

Parameters
cpuCPU context.
callbackCallback function pointer or NULL.

◆ m68k_set_read8_callback()

void m68k_set_read8_callback ( M68kCpu * cpu,
M68kRead8Callback callback )

Install host memory read callback (8-bit).

Parameters
cpuCPU context.
callbackCallback function pointer or NULL.

◆ m68k_set_reset_callback()

void m68k_set_reset_callback ( M68kCpu * cpu,
M68kResetCallback callback )

Install reset callback.

Parameters
cpuCPU context.
callbackCallback function pointer or NULL.

◆ m68k_set_sr()

void m68k_set_sr ( M68kCpu * cpu,
u16 new_sr )

Set the status register.

Parameters
cpuCPU context.
new_srNew status register value.

◆ m68k_set_tas_callback()

void m68k_set_tas_callback ( M68kCpu * cpu,
M68kTasCallback callback )

Install TAS callback.

Parameters
cpuCPU context.
callbackCallback function pointer or NULL.

◆ m68k_set_wait_bus_callback()

void m68k_set_wait_bus_callback ( M68kCpu * cpu,
M68kWaitBusCallback callback )

Install wait bus callback.

Parameters
cpuCPU context.
callbackCallback function pointer or NULL.

◆ m68k_set_write16_callback()

void m68k_set_write16_callback ( M68kCpu * cpu,
M68kWrite16Callback callback )

Install host memory write callback (16-bit).

Parameters
cpuCPU context.
callbackCallback function pointer or NULL.

◆ m68k_set_write32_callback()

void m68k_set_write32_callback ( M68kCpu * cpu,
M68kWrite32Callback callback )

Install host memory write callback (32-bit).

Parameters
cpuCPU context.
callbackCallback function pointer or NULL.

◆ m68k_set_write8_callback()

void m68k_set_write8_callback ( M68kCpu * cpu,
M68kWrite8Callback callback )

Install host memory write callback (8-bit).

Parameters
cpuCPU context.
callbackCallback function pointer or NULL.

◆ m68k_step()

void m68k_step ( M68kCpu * cpu)

Execute one instruction step.

Parameters
cpuCPU context.

◆ m68k_step_ex()

void m68k_step_ex ( M68kCpu * cpu,
bool check_exceptions )

Execute one instruction with optional interrupt and trace checks.

Parameters
cpuCPU context.
check_exceptionsIf true, check interrupts and deliver trace exceptions. Instruction-generated exceptions are processed regardless of this flag.

◆ m68k_write_16()

void m68k_write_16 ( M68kCpu * cpu,
u32 address,
u16 value )

Write one word to emulated memory.

Parameters
cpuCPU context.
addressEmulated address.
valueValue to write.

◆ m68k_write_32()

void m68k_write_32 ( M68kCpu * cpu,
u32 address,
u32 value )

Write one longword to emulated memory.

Parameters
cpuCPU context.
addressEmulated address.
valueValue to write.

◆ m68k_write_8()

void m68k_write_8 ( M68kCpu * cpu,
u32 address,
u8 value )

Write one byte to emulated memory.

Parameters
cpuCPU context.
addressEmulated address.
valueValue to write.