summaryrefslogtreecommitdiff
path: root/plugins/ao/eng_ssf/m68k.h
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-07-04 10:51:28 +0200
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-07-04 10:51:28 +0200
commite6013001a3e730497e4606add4aff3ac743aedc4 (patch)
tree0b347abed118addaf7631f78cbc1649b0b9d0596 /plugins/ao/eng_ssf/m68k.h
parentefd7ae55acdca5eef47432eefed35d90d594d572 (diff)
ao plugin: eng_ssf reentrant
Diffstat (limited to 'plugins/ao/eng_ssf/m68k.h')
-rw-r--r--plugins/ao/eng_ssf/m68k.h70
1 files changed, 37 insertions, 33 deletions
diff --git a/plugins/ao/eng_ssf/m68k.h b/plugins/ao/eng_ssf/m68k.h
index 082ed4df..851c7132 100644
--- a/plugins/ao/eng_ssf/m68k.h
+++ b/plugins/ao/eng_ssf/m68k.h
@@ -1,6 +1,8 @@
#ifndef M68K__HEADER
#define M68K__HEADER
+struct m68ki_cpu_core_s;
+
/* ======================================================================== */
/* ========================= LICENSING & COPYRIGHT ======================== */
/* ======================================================================== */
@@ -142,9 +144,9 @@ typedef enum
*/
/* Read from anywhere */
-unsigned int m68k_read_memory_8(unsigned int address);
-unsigned int m68k_read_memory_16(unsigned int address);
-unsigned int m68k_read_memory_32(unsigned int address);
+unsigned int m68k_read_memory_8(struct m68ki_cpu_core_s *cpu, unsigned int address);
+unsigned int m68k_read_memory_16(struct m68ki_cpu_core_s *cpu, unsigned int address);
+unsigned int m68k_read_memory_32(struct m68ki_cpu_core_s *cpu, unsigned int address);
/* Read data immediately following the PC */
//INLINE unsigned int m68k_read_immediate_16(unsigned int address);
@@ -156,14 +158,14 @@ unsigned int m68k_read_memory_32(unsigned int address);
//INLINE unsigned int m68k_read_pcrelative_32(unsigned int address);
/* Memory access for the disassembler */
-unsigned int m68k_read_disassembler_8 (unsigned int address);
-unsigned int m68k_read_disassembler_16 (unsigned int address);
-unsigned int m68k_read_disassembler_32 (unsigned int address);
+unsigned int m68k_read_disassembler_8 (struct m68ki_cpu_core_s *cpu, unsigned int address);
+unsigned int m68k_read_disassembler_16 (struct m68ki_cpu_core_s *cpu, unsigned int address);
+unsigned int m68k_read_disassembler_32 (struct m68ki_cpu_core_s *cpu, unsigned int address);
/* Write to anywhere */
-void m68k_write_memory_8(unsigned int address, unsigned int value);
-void m68k_write_memory_16(unsigned int address, unsigned int value);
-void m68k_write_memory_32(unsigned int address, unsigned int value);
+void m68k_write_memory_8(struct m68ki_cpu_core_s *cpu, unsigned int address, unsigned int value);
+void m68k_write_memory_16(struct m68ki_cpu_core_s *cpu, unsigned int address, unsigned int value);
+void m68k_write_memory_32(struct m68ki_cpu_core_s *cpu, unsigned int address, unsigned int value);
/* Special call to simulate undocumented 68k behavior when move.l with a
* predecrement destination mode is executed.
@@ -198,7 +200,7 @@ void m68k_write_memory_32(unsigned int address, unsigned int value);
* services the interrupt.
* Default behavior: return M68K_INT_ACK_AUTOVECTOR.
*/
-void m68k_set_int_ack_callback(int (*callback)(int int_level));
+void m68k_set_int_ack_callback(struct m68ki_cpu_core_s *cpu, int (*callback)(struct m68ki_cpu_core_s *cpu, int int_level));
/* Set the callback for a breakpoint acknowledge (68010+).
@@ -207,7 +209,7 @@ void m68k_set_int_ack_callback(int (*callback)(int int_level));
* BKPT instruction for 68020+, or 0 for 68010.
* Default behavior: do nothing.
*/
-void m68k_set_bkpt_ack_callback(void (*callback)(unsigned int data));
+void m68k_set_bkpt_ack_callback(struct m68ki_cpu_core_s *cpu, void (*callback)(struct m68ki_cpu_core_s *cpu, unsigned int data));
/* Set the callback for the RESET instruction.
@@ -215,7 +217,7 @@ void m68k_set_bkpt_ack_callback(void (*callback)(unsigned int data));
* The CPU calls this callback every time it encounters a RESET instruction.
* Default behavior: do nothing.
*/
-void m68k_set_reset_instr_callback(void (*callback)(void));
+void m68k_set_reset_instr_callback(struct m68ki_cpu_core_s *cpu, void (*callback)(struct m68ki_cpu_core_s *cpu));
/* Set the callback for informing of a large PC change.
@@ -224,7 +226,7 @@ void m68k_set_reset_instr_callback(void (*callback)(void));
* by a large value (currently set for changes by longwords).
* Default behavior: do nothing.
*/
-void m68k_set_pc_changed_callback(void (*callback)(unsigned int new_pc));
+void m68k_set_pc_changed_callback(struct m68ki_cpu_core_s *cpu, void (*callback)(struct m68ki_cpu_core_s *cpu, unsigned int new_pc));
/* Set the callback for CPU function code changes.
@@ -234,7 +236,7 @@ void m68k_set_pc_changed_callback(void (*callback)(unsigned int new_pc));
* access it is (supervisor/user, program/data and such).
* Default behavior: do nothing.
*/
-void m68k_set_fc_callback(void (*callback)(unsigned int new_fc));
+void m68k_set_fc_callback(struct m68ki_cpu_core_s *cpu, void (*callback)(struct m68ki_cpu_core_s *cpu, unsigned int new_fc));
/* Set a callback for the instruction cycle of the CPU.
@@ -243,7 +245,7 @@ void m68k_set_fc_callback(void (*callback)(unsigned int new_fc));
* instruction cycle.
* Default behavior: do nothing.
*/
-void m68k_set_instr_hook_callback(void (*callback)(void));
+void m68k_set_instr_hook_callback(struct m68ki_cpu_core_s *cpu, void (*callback)(struct m68ki_cpu_core_s *cpu));
@@ -255,12 +257,12 @@ void m68k_set_instr_hook_callback(void (*callback)(void));
* Currently supported types are: M68K_CPU_TYPE_68000, M68K_CPU_TYPE_68010,
* M68K_CPU_TYPE_EC020, and M68K_CPU_TYPE_68020.
*/
-void m68k_set_cpu_type(unsigned int cpu_type);
+void m68k_set_cpu_type(struct m68ki_cpu_core_s *cpu, unsigned int cpu_type);
/* Do whatever initialisations the core requires. Should be called
* at least once at init time.
*/
-void m68k_init(void);
+struct m68ki_cpu_core_s *m68k_init(void);
/* Pulse the RESET pin on the CPU.
* You *MUST* reset the CPU at least once to initialize the emulation
@@ -268,63 +270,65 @@ void m68k_init(void);
* the CPU for the first time, the CPU will be set to
* M68K_CPU_TYPE_68000.
*/
-void m68k_pulse_reset(void);
+void m68k_pulse_reset(struct m68ki_cpu_core_s *cpu);
/* execute num_cycles worth of instructions. returns number of cycles used */
-int m68k_execute(int num_cycles);
+int m68k_execute(struct m68ki_cpu_core_s *cpu, int num_cycles);
/* These functions let you read/write/modify the number of cycles left to run
* while m68k_execute() is running.
* These are useful if the 68k accesses a memory-mapped port on another device
* that requires immediate processing by another CPU.
*/
-int m68k_cycles_run(void); /* Number of cycles run so far */
-int m68k_cycles_remaining(void); /* Number of cycles left */
-void m68k_modify_timeslice(int cycles); /* Modify cycles left */
-void m68k_end_timeslice(void); /* End timeslice now */
+int m68k_cycles_run(struct m68ki_cpu_core_s *cpu); /* Number of cycles run so far */
+int m68k_cycles_remaining(struct m68ki_cpu_core_s *cpu); /* Number of cycles left */
+void m68k_modify_timeslice(struct m68ki_cpu_core_s *cpu, int cycles); /* Modify cycles left */
+void m68k_end_timeslice(struct m68ki_cpu_core_s *cpu); /* End timeslice now */
/* Set the IPL0-IPL2 pins on the CPU (IRQ).
* A transition from < 7 to 7 will cause a non-maskable interrupt (NMI).
* Setting IRQ to 0 will clear an interrupt request.
*/
-void m68k_set_irq(unsigned int int_level);
+void m68k_set_irq(struct m68ki_cpu_core_s *cpu, unsigned int int_level);
/* Halt the CPU as if you pulsed the HALT pin. */
-void m68k_pulse_halt(void);
+void m68k_pulse_halt(struct m68ki_cpu_core_s *cpu);
+#if 0
/* Context switching to allow multiple CPUs */
/* Get the size of the cpu context in bytes */
-unsigned int m68k_context_size(void);
+unsigned int m68k_context_size(struct m68ki_cpu_core_s *cpu);
/* Get a cpu context */
-unsigned int m68k_get_context(void* dst);
+unsigned int m68k_get_context(struct m68ki_cpu_core_s *cpu, void* dst);
/* set the current cpu context */
-void m68k_set_context(void* dst);
+void m68k_set_context(struct m68ki_cpu_core_s *cpu, void* dst);
+#endif
/* Register the CPU state information */
-void m68k_state_register(const char *type);
+void m68k_state_register(struct m68ki_cpu_core_s *cpu, const char *type);
/* Peek at the internals of a CPU context. This can either be a context
* retrieved using m68k_get_context() or the currently running context.
* If context is NULL, the currently running CPU context will be used.
*/
-unsigned int m68k_get_reg(void* context, m68k_register_t reg);
+unsigned int m68k_get_reg(struct m68ki_cpu_core_s *cpu, void* context, m68k_register_t reg);
/* Poke values into the internals of the currently running CPU context */
-void m68k_set_reg(m68k_register_t reg, unsigned int value);
+void m68k_set_reg(struct m68ki_cpu_core_s *cpu, m68k_register_t reg, unsigned int value);
/* Check if an instruction is valid for the specified CPU type */
-unsigned int m68k_is_valid_instruction(unsigned int instruction, unsigned int cpu_type);
+unsigned int m68k_is_valid_instruction(struct m68ki_cpu_core_s *cpu, unsigned int instruction, unsigned int cpu_type);
/* Disassemble 1 instruction using the epecified CPU type at pc. Stores
* disassembly in str_buff and returns the size of the instruction in bytes.
*/
-unsigned int m68k_disassemble(char* str_buff, unsigned int pc, unsigned int cpu_type);
+unsigned int m68k_disassemble(struct m68ki_cpu_core_s *cpu, char* str_buff, unsigned int pc, unsigned int cpu_type);
/* ======================================================================== */