Converted line endings from DOS to UNIX format.

This commit is contained in:
Bart Trzynadlowski 2015-06-13 02:56:26 +00:00
parent ee8afa17c3
commit 6bf4244207
8 changed files with 19224 additions and 19224 deletions

View file

@ -1,395 +1,395 @@
/** /**
** Supermodel ** Supermodel
** A Sega Model 3 Arcade Emulator. ** A Sega Model 3 Arcade Emulator.
** Copyright 2011 Bart Trzynadlowski, Nik Henson ** Copyright 2011 Bart Trzynadlowski, Nik Henson
** **
** This file is part of Supermodel. ** This file is part of Supermodel.
** **
** Supermodel is free software: you can redistribute it and/or modify it under ** Supermodel is free software: you can redistribute it and/or modify it under
** the terms of the GNU General Public License as published by the Free ** the terms of the GNU General Public License as published by the Free
** Software Foundation, either version 3 of the License, or (at your option) ** Software Foundation, either version 3 of the License, or (at your option)
** any later version. ** any later version.
** **
** Supermodel is distributed in the hope that it will be useful, but WITHOUT ** Supermodel is distributed in the hope that it will be useful, but WITHOUT
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
** FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ** FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
** more details. ** more details.
** **
** You should have received a copy of the GNU General Public License along ** You should have received a copy of the GNU General Public License along
** with Supermodel. If not, see <http://www.gnu.org/licenses/>. ** with Supermodel. If not, see <http://www.gnu.org/licenses/>.
**/ **/
/* /*
* m68k.h * m68k.h
* *
* Header file for the Musashi 68K emulator. * Header file for the Musashi 68K emulator.
* *
* Permission was obtained from Karl Stenerud to apply the GPL license to this * Permission was obtained from Karl Stenerud to apply the GPL license to this
* code. * code.
*/ */
#ifndef M68K__HEADER #ifndef M68K__HEADER
#define M68K__HEADER #define M68K__HEADER
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/* ======================================================================== */ /* ======================================================================== */
/* ========================= LICENSING & COPYRIGHT ======================== */ /* ========================= LICENSING & COPYRIGHT ======================== */
/* ======================================================================== */ /* ======================================================================== */
/* /*
* MUSASHI * MUSASHI
* Version 3.3 * Version 3.3
* *
* A portable Motorola M680x0 processor emulation engine. * A portable Motorola M680x0 processor emulation engine.
* Copyright 1998-2001 Karl Stenerud. All rights reserved. * Copyright 1998-2001 Karl Stenerud. All rights reserved.
* *
* This code may be freely used for non-commercial purposes as long as this * This code may be freely used for non-commercial purposes as long as this
* copyright notice remains unaltered in the source code and any binary files * copyright notice remains unaltered in the source code and any binary files
* containing this code in compiled form. * containing this code in compiled form.
* *
* All other lisencing terms must be negotiated with the author * All other lisencing terms must be negotiated with the author
* (Karl Stenerud). * (Karl Stenerud).
* *
* The latest version of this code can be obtained at: * The latest version of this code can be obtained at:
* http://kstenerud.cjb.net * http://kstenerud.cjb.net
*/ */
/* ======================================================================== */ /* ======================================================================== */
/* ============================ GENERAL DEFINES =========================== */ /* ============================ GENERAL DEFINES =========================== */
/* ======================================================================== */ /* ======================================================================== */
/* There are 7 levels of interrupt to the 68K. /* There are 7 levels of interrupt to the 68K.
* A transition from < 7 to 7 will cause a non-maskable interrupt (NMI). * A transition from < 7 to 7 will cause a non-maskable interrupt (NMI).
*/ */
#define M68K_IRQ_NONE 0 #define M68K_IRQ_NONE 0
#define M68K_IRQ_1 1 #define M68K_IRQ_1 1
#define M68K_IRQ_2 2 #define M68K_IRQ_2 2
#define M68K_IRQ_3 3 #define M68K_IRQ_3 3
#define M68K_IRQ_4 4 #define M68K_IRQ_4 4
#define M68K_IRQ_5 5 #define M68K_IRQ_5 5
#define M68K_IRQ_6 6 #define M68K_IRQ_6 6
#define M68K_IRQ_7 7 #define M68K_IRQ_7 7
/* Special interrupt acknowledge values. /* Special interrupt acknowledge values.
* Use these as special returns from the interrupt acknowledge callback * Use these as special returns from the interrupt acknowledge callback
* (specified later in this header). * (specified later in this header).
*/ */
/* Causes an interrupt autovector (0x18 + interrupt level) to be taken. /* Causes an interrupt autovector (0x18 + interrupt level) to be taken.
* This happens in a real 68K if VPA or AVEC is asserted during an interrupt * This happens in a real 68K if VPA or AVEC is asserted during an interrupt
* acknowledge cycle instead of DTACK. * acknowledge cycle instead of DTACK.
*/ */
#define M68K_INT_ACK_AUTOVECTOR 0xffffffff #define M68K_INT_ACK_AUTOVECTOR 0xffffffff
/* Causes the spurious interrupt vector (0x18) to be taken /* Causes the spurious interrupt vector (0x18) to be taken
* This happens in a real 68K if BERR is asserted during the interrupt * This happens in a real 68K if BERR is asserted during the interrupt
* acknowledge cycle (i.e. no devices responded to the acknowledge). * acknowledge cycle (i.e. no devices responded to the acknowledge).
*/ */
#define M68K_INT_ACK_SPURIOUS 0xfffffffe #define M68K_INT_ACK_SPURIOUS 0xfffffffe
/* CPU types for use in m68k_set_cpu_type() */ /* CPU types for use in m68k_set_cpu_type() */
enum enum
{ {
M68K_CPU_TYPE_INVALID, M68K_CPU_TYPE_INVALID,
M68K_CPU_TYPE_68000, M68K_CPU_TYPE_68000,
M68K_CPU_TYPE_68008, M68K_CPU_TYPE_68008,
M68K_CPU_TYPE_68010, M68K_CPU_TYPE_68010,
M68K_CPU_TYPE_68EC020, M68K_CPU_TYPE_68EC020,
M68K_CPU_TYPE_68020, M68K_CPU_TYPE_68020,
M68K_CPU_TYPE_68030, /* Supported by disassembler ONLY */ M68K_CPU_TYPE_68030, /* Supported by disassembler ONLY */
M68K_CPU_TYPE_68040 /* Supported by disassembler ONLY */ M68K_CPU_TYPE_68040 /* Supported by disassembler ONLY */
}; };
/* Registers used by m68k_get_reg() and m68k_set_reg() */ /* Registers used by m68k_get_reg() and m68k_set_reg() */
typedef enum typedef enum
{ {
/* Real registers */ /* Real registers */
M68K_REG_D0, /* Data registers */ M68K_REG_D0, /* Data registers */
M68K_REG_D1, M68K_REG_D1,
M68K_REG_D2, M68K_REG_D2,
M68K_REG_D3, M68K_REG_D3,
M68K_REG_D4, M68K_REG_D4,
M68K_REG_D5, M68K_REG_D5,
M68K_REG_D6, M68K_REG_D6,
M68K_REG_D7, M68K_REG_D7,
M68K_REG_A0, /* Address registers */ M68K_REG_A0, /* Address registers */
M68K_REG_A1, M68K_REG_A1,
M68K_REG_A2, M68K_REG_A2,
M68K_REG_A3, M68K_REG_A3,
M68K_REG_A4, M68K_REG_A4,
M68K_REG_A5, M68K_REG_A5,
M68K_REG_A6, M68K_REG_A6,
M68K_REG_A7, M68K_REG_A7,
M68K_REG_PC, /* Program Counter */ M68K_REG_PC, /* Program Counter */
M68K_REG_SR, /* Status Register */ M68K_REG_SR, /* Status Register */
M68K_REG_SP, /* The current Stack Pointer (located in A7) */ M68K_REG_SP, /* The current Stack Pointer (located in A7) */
M68K_REG_USP, /* User Stack Pointer */ M68K_REG_USP, /* User Stack Pointer */
M68K_REG_ISP, /* Interrupt Stack Pointer */ M68K_REG_ISP, /* Interrupt Stack Pointer */
M68K_REG_MSP, /* Master Stack Pointer */ M68K_REG_MSP, /* Master Stack Pointer */
M68K_REG_SFC, /* Source Function Code */ M68K_REG_SFC, /* Source Function Code */
M68K_REG_DFC, /* Destination Function Code */ M68K_REG_DFC, /* Destination Function Code */
M68K_REG_VBR, /* Vector Base Register */ M68K_REG_VBR, /* Vector Base Register */
M68K_REG_CACR, /* Cache Control Register */ M68K_REG_CACR, /* Cache Control Register */
M68K_REG_CAAR, /* Cache Address Register */ M68K_REG_CAAR, /* Cache Address Register */
/* Assumed registers */ /* Assumed registers */
/* These are cheat registers which emulate the 1-longword prefetch /* These are cheat registers which emulate the 1-longword prefetch
* present in the 68000 and 68010. * present in the 68000 and 68010.
*/ */
M68K_REG_PREF_ADDR, /* Last prefetch address */ M68K_REG_PREF_ADDR, /* Last prefetch address */
M68K_REG_PREF_DATA, /* Last prefetch data */ M68K_REG_PREF_DATA, /* Last prefetch data */
/* Convenience registers */ /* Convenience registers */
M68K_REG_PPC, /* Previous value in the program counter */ M68K_REG_PPC, /* Previous value in the program counter */
M68K_REG_IR, /* Instruction register */ M68K_REG_IR, /* Instruction register */
M68K_REG_CPU_TYPE /* Type of CPU being run */ M68K_REG_CPU_TYPE /* Type of CPU being run */
} m68k_register_t; } m68k_register_t;
/* ======================================================================== */ /* ======================================================================== */
/* ====================== FUNCTIONS CALLED BY THE CPU ===================== */ /* ====================== FUNCTIONS CALLED BY THE CPU ===================== */
/* ======================================================================== */ /* ======================================================================== */
/* You will have to implement these functions */ /* You will have to implement these functions */
/* read/write functions called by the CPU to access memory. /* read/write functions called by the CPU to access memory.
* while values used are 32 bits, only the appropriate number * while values used are 32 bits, only the appropriate number
* of bits are relevant (i.e. in write_memory_8, only the lower 8 bits * of bits are relevant (i.e. in write_memory_8, only the lower 8 bits
* of value should be written to memory). * of value should be written to memory).
* *
* NOTE: I have separated the immediate and PC-relative memory fetches * NOTE: I have separated the immediate and PC-relative memory fetches
* from the other memory fetches because some systems require * from the other memory fetches because some systems require
* differentiation between PROGRAM and DATA fetches (usually * differentiation between PROGRAM and DATA fetches (usually
* for security setups such as encryption). * for security setups such as encryption).
* This separation can either be achieved by setting * This separation can either be achieved by setting
* M68K_SEPARATE_READS in m68kconf.h and defining * M68K_SEPARATE_READS in m68kconf.h and defining
* the read functions, or by setting M68K_EMULATE_FC and * the read functions, or by setting M68K_EMULATE_FC and
* making a function code callback function. * making a function code callback function.
* Using the callback offers better emulation coverage * Using the callback offers better emulation coverage
* because you can also monitor whether the CPU is in SYSTEM or * because you can also monitor whether the CPU is in SYSTEM or
* USER mode, but it is also slower. * USER mode, but it is also slower.
*/ */
/* Read from anywhere */ /* Read from anywhere */
unsigned int m68k_read_memory_8(unsigned int address); unsigned int m68k_read_memory_8(unsigned int address);
unsigned int m68k_read_memory_16(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_32(unsigned int address);
/* Read data immediately following the PC */ /* Read data immediately following the PC */
unsigned int m68k_read_immediate_16(unsigned int address); unsigned int m68k_read_immediate_16(unsigned int address);
unsigned int m68k_read_immediate_32(unsigned int address); unsigned int m68k_read_immediate_32(unsigned int address);
/* Read data relative to the PC */ /* Read data relative to the PC */
unsigned int m68k_read_pcrelative_8(unsigned int address); unsigned int m68k_read_pcrelative_8(unsigned int address);
unsigned int m68k_read_pcrelative_16(unsigned int address); unsigned int m68k_read_pcrelative_16(unsigned int address);
unsigned int m68k_read_pcrelative_32(unsigned int address); unsigned int m68k_read_pcrelative_32(unsigned int address);
/* Memory access for the disassembler */ /* Memory access for the disassembler */
unsigned int m68k_read_disassembler_8 (unsigned int address); unsigned int m68k_read_disassembler_8 (unsigned int address);
unsigned int m68k_read_disassembler_16 (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_32 (unsigned int address);
/* Write to anywhere */ /* Write to anywhere */
void m68k_write_memory_8(unsigned int address, unsigned int value); 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_16(unsigned int address, unsigned int value);
void m68k_write_memory_32(unsigned int address, unsigned int value); void m68k_write_memory_32(unsigned int address, unsigned int value);
/* Special call to simulate undocumented 68k behavior when move.l with a /* Special call to simulate undocumented 68k behavior when move.l with a
* predecrement destination mode is executed. * predecrement destination mode is executed.
* To simulate real 68k behavior, first write the high word to * To simulate real 68k behavior, first write the high word to
* [address+2], and then write the low word to [address]. * [address+2], and then write the low word to [address].
* *
* Enable this functionality with M68K_SIMULATE_PD_WRITES in m68kconf.h. * Enable this functionality with M68K_SIMULATE_PD_WRITES in m68kconf.h.
*/ */
void m68k_write_memory_32_pd(unsigned int address, unsigned int value); void m68k_write_memory_32_pd(unsigned int address, unsigned int value);
/* ======================================================================== */ /* ======================================================================== */
/* ============================== CALLBACKS =============================== */ /* ============================== CALLBACKS =============================== */
/* ======================================================================== */ /* ======================================================================== */
/* These functions allow you to set callbacks to the host when specific events /* These functions allow you to set callbacks to the host when specific events
* occur. Note that you must enable the corresponding value in m68kconf.h * occur. Note that you must enable the corresponding value in m68kconf.h
* in order for these to do anything useful. * in order for these to do anything useful.
* Note: I have defined default callbacks which are used if you have enabled * Note: I have defined default callbacks which are used if you have enabled
* the corresponding #define in m68kconf.h but either haven't assigned a * the corresponding #define in m68kconf.h but either haven't assigned a
* callback or have assigned a callback of NULL. * callback or have assigned a callback of NULL.
*/ */
/* Set the callback for an interrupt acknowledge. /* Set the callback for an interrupt acknowledge.
* You must enable M68K_EMULATE_INT_ACK in m68kconf.h. * You must enable M68K_EMULATE_INT_ACK in m68kconf.h.
* The CPU will call the callback with the interrupt level being acknowledged. * The CPU will call the callback with the interrupt level being acknowledged.
* The host program must return either a vector from 0x02-0xff, or one of the * The host program must return either a vector from 0x02-0xff, or one of the
* special interrupt acknowledge values specified earlier in this header. * special interrupt acknowledge values specified earlier in this header.
* If this is not implemented, the CPU will always assume an autovectored * If this is not implemented, the CPU will always assume an autovectored
* interrupt, and will automatically clear the interrupt request when it * interrupt, and will automatically clear the interrupt request when it
* services the interrupt. * services the interrupt.
* Default behavior: return M68K_INT_ACK_AUTOVECTOR. * Default behavior: return M68K_INT_ACK_AUTOVECTOR.
*/ */
void m68k_set_int_ack_callback(int (*callback)(int int_level)); void m68k_set_int_ack_callback(int (*callback)(int int_level));
/* Set the callback for a breakpoint acknowledge (68010+). /* Set the callback for a breakpoint acknowledge (68010+).
* You must enable M68K_EMULATE_BKPT_ACK in m68kconf.h. * You must enable M68K_EMULATE_BKPT_ACK in m68kconf.h.
* The CPU will call the callback with whatever was in the data field of the * The CPU will call the callback with whatever was in the data field of the
* BKPT instruction for 68020+, or 0 for 68010. * BKPT instruction for 68020+, or 0 for 68010.
* Default behavior: do nothing. * Default behavior: do nothing.
*/ */
void m68k_set_bkpt_ack_callback(void (*callback)(unsigned int data)); void m68k_set_bkpt_ack_callback(void (*callback)(unsigned int data));
/* Set the callback for the RESET instruction. /* Set the callback for the RESET instruction.
* You must enable M68K_EMULATE_RESET in m68kconf.h. * You must enable M68K_EMULATE_RESET in m68kconf.h.
* The CPU calls this callback every time it encounters a RESET instruction. * The CPU calls this callback every time it encounters a RESET instruction.
* Default behavior: do nothing. * Default behavior: do nothing.
*/ */
void m68k_set_reset_instr_callback(void (*callback)(void)); void m68k_set_reset_instr_callback(void (*callback)(void));
/* Set the callback for the CMPI.L #v, Dn instruction. /* Set the callback for the CMPI.L #v, Dn instruction.
* You must enable M68K_CMPILD_HAS_CALLBACK in m68kconf.h. * You must enable M68K_CMPILD_HAS_CALLBACK in m68kconf.h.
* The CPU calls this callback every time it encounters a CMPI.L #v, Dn instruction. * The CPU calls this callback every time it encounters a CMPI.L #v, Dn instruction.
* Default behavior: do nothing. * Default behavior: do nothing.
*/ */
void m68k_set_cmpild_instr_callback(void (*callback)(unsigned int val, int reg)); void m68k_set_cmpild_instr_callback(void (*callback)(unsigned int val, int reg));
/* Set the callback for the RTE instruction. /* Set the callback for the RTE instruction.
* You must enable M68K_RTE_HAS_CALLBACK in m68kconf.h. * You must enable M68K_RTE_HAS_CALLBACK in m68kconf.h.
* The CPU calls this callback every time it encounters a RTE instruction. * The CPU calls this callback every time it encounters a RTE instruction.
* Default behavior: do nothing. * Default behavior: do nothing.
*/ */
void m68k_set_rte_instr_callback(void (*callback)(void)); void m68k_set_rte_instr_callback(void (*callback)(void));
/* Set the callback for informing of a large PC change. /* Set the callback for informing of a large PC change.
* You must enable M68K_MONITOR_PC in m68kconf.h. * You must enable M68K_MONITOR_PC in m68kconf.h.
* The CPU calls this callback with the new PC value every time the PC changes * The CPU calls this callback with the new PC value every time the PC changes
* by a large value (currently set for changes by longwords). * by a large value (currently set for changes by longwords).
* Default behavior: do nothing. * Default behavior: do nothing.
*/ */
void m68k_set_pc_changed_callback(void (*callback)(unsigned int new_pc)); void m68k_set_pc_changed_callback(void (*callback)(unsigned int new_pc));
/* Set the callback for CPU function code changes. /* Set the callback for CPU function code changes.
* You must enable M68K_EMULATE_FC in m68kconf.h. * You must enable M68K_EMULATE_FC in m68kconf.h.
* The CPU calls this callback with the function code before every memory * The CPU calls this callback with the function code before every memory
* access to set the CPU's function code according to what kind of memory * access to set the CPU's function code according to what kind of memory
* access it is (supervisor/user, program/data and such). * access it is (supervisor/user, program/data and such).
* Default behavior: do nothing. * Default behavior: do nothing.
*/ */
void m68k_set_fc_callback(void (*callback)(unsigned int new_fc)); void m68k_set_fc_callback(void (*callback)(unsigned int new_fc));
/* Set a callback for the instruction cycle of the CPU. /* Set a callback for the instruction cycle of the CPU.
* You must enable M68K_INSTRUCTION_HOOK in m68kconf.h. * You must enable M68K_INSTRUCTION_HOOK in m68kconf.h.
* The CPU calls this callback just before fetching the opcode in the * The CPU calls this callback just before fetching the opcode in the
* instruction cycle. * instruction cycle.
* Default behavior: do nothing. * Default behavior: do nothing.
*/ */
void m68k_set_instr_hook_callback(void (*callback)(void)); void m68k_set_instr_hook_callback(void (*callback)(void));
/* ======================================================================== */ /* ======================================================================== */
/* ====================== FUNCTIONS TO ACCESS THE CPU ===================== */ /* ====================== FUNCTIONS TO ACCESS THE CPU ===================== */
/* ======================================================================== */ /* ======================================================================== */
/* Use this function to set the CPU type you want to emulate. /* Use this function to set the CPU type you want to emulate.
* Currently supported types are: M68K_CPU_TYPE_68000, M68K_CPU_TYPE_68008, * Currently supported types are: M68K_CPU_TYPE_68000, M68K_CPU_TYPE_68008,
* M68K_CPU_TYPE_68010, M68K_CPU_TYPE_EC020, and M68K_CPU_TYPE_68020. * 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(unsigned int cpu_type);
/* Do whatever initialisations the core requires. Should be called /* Do whatever initialisations the core requires. Should be called
* at least once at init time. * at least once at init time.
*/ */
void m68k_init(void); void m68k_init(void);
/* Pulse the RESET pin on the CPU. /* Pulse the RESET pin on the CPU.
* You *MUST* reset the CPU at least once to initialize the emulation * You *MUST* reset the CPU at least once to initialize the emulation
* Note: If you didn't call m68k_set_cpu_type() before resetting * Note: If you didn't call m68k_set_cpu_type() before resetting
* the CPU for the first time, the CPU will be set to * the CPU for the first time, the CPU will be set to
* M68K_CPU_TYPE_68000. * M68K_CPU_TYPE_68000.
*/ */
void m68k_pulse_reset(void); void m68k_pulse_reset(void);
/* execute num_cycles worth of instructions. returns number of cycles used */ /* execute num_cycles worth of instructions. returns number of cycles used */
int m68k_execute(int num_cycles); int m68k_execute(int num_cycles);
/* These functions let you read/write/modify the number of cycles left to run /* These functions let you read/write/modify the number of cycles left to run
* while m68k_execute() is running. * while m68k_execute() is running.
* These are useful if the 68k accesses a memory-mapped port on another device * These are useful if the 68k accesses a memory-mapped port on another device
* that requires immediate processing by another CPU. * that requires immediate processing by another CPU.
*/ */
int m68k_cycles_run(void); /* Number of cycles run so far */ int m68k_cycles_run(void); /* Number of cycles run so far */
int m68k_cycles_remaining(void); /* Number of cycles left */ int m68k_cycles_remaining(void); /* Number of cycles left */
void m68k_modify_timeslice(int cycles); /* Modify cycles left */ void m68k_modify_timeslice(int cycles); /* Modify cycles left */
void m68k_end_timeslice(void); /* End timeslice now */ void m68k_end_timeslice(void); /* End timeslice now */
/* Set the IPL0-IPL2 pins on the CPU (IRQ). /* Set the IPL0-IPL2 pins on the CPU (IRQ).
* A transition from < 7 to 7 will cause a non-maskable interrupt (NMI). * A transition from < 7 to 7 will cause a non-maskable interrupt (NMI).
* Setting IRQ to 0 will clear an interrupt request. * Setting IRQ to 0 will clear an interrupt request.
*/ */
void m68k_set_irq(unsigned int int_level); void m68k_set_irq(unsigned int int_level);
/* Halt the CPU as if you pulsed the HALT pin. */ /* Halt the CPU as if you pulsed the HALT pin. */
void m68k_pulse_halt(void); void m68k_pulse_halt(void);
/* Context switching to allow multiple CPUs */ /* Context switching to allow multiple CPUs */
/* Get the size of the cpu context in bytes */ /* Get the size of the cpu context in bytes */
unsigned int m68k_context_size(void); unsigned int m68k_context_size(void);
/* Get a cpu context */ /* Get a cpu context */
unsigned int m68k_get_context(void* dst); unsigned int m68k_get_context(void* dst);
/* set the current cpu context */ /* set the current cpu context */
void m68k_set_context(void* dst); void m68k_set_context(void* dst);
/* Register the CPU state information */ /* Register the CPU state information */
void m68k_state_register(const char *type); void m68k_state_register(const char *type);
/* Peek at the internals of a CPU context. This can either be a context /* Peek at the internals of a CPU context. This can either be a context
* retrieved using m68k_get_context() or the currently running context. * retrieved using m68k_get_context() or the currently running context.
* If context is NULL, the currently running CPU context will be used. * 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(void* context, m68k_register_t reg);
/* Poke values into the internals of the currently running CPU context */ /* 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(m68k_register_t reg, unsigned int value);
/* Check if an instruction is valid for the specified CPU type */ /* 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(unsigned int instruction, unsigned int cpu_type);
/* Disassemble 1 instruction using the epecified CPU type at pc. Stores /* Disassemble 1 instruction using the epecified CPU type at pc. Stores
* disassembly in str_buff and returns the size of the instruction in bytes. * 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(char* str_buff, unsigned int pc, unsigned int cpu_type);
/* ======================================================================== */ /* ======================================================================== */
/* ============================= CONFIGURATION ============================ */ /* ============================= CONFIGURATION ============================ */
/* ======================================================================== */ /* ======================================================================== */
/* Import the configuration for this build */ /* Import the configuration for this build */
#include "m68kconf.h" #include "m68kconf.h"
/* ======================================================================== */ /* ======================================================================== */
/* ============================== END OF FILE ============================= */ /* ============================== END OF FILE ============================= */
/* ======================================================================== */ /* ======================================================================== */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* M68K__HEADER */ #endif /* M68K__HEADER */

File diff suppressed because it is too large Load diff

View file

@ -1,254 +1,254 @@
/** /**
** Supermodel ** Supermodel
** A Sega Model 3 Arcade Emulator. ** A Sega Model 3 Arcade Emulator.
** Copyright 2011 Bart Trzynadlowski, Nik Henson ** Copyright 2011 Bart Trzynadlowski, Nik Henson
** **
** This file is part of Supermodel. ** This file is part of Supermodel.
** **
** Supermodel is free software: you can redistribute it and/or modify it under ** Supermodel is free software: you can redistribute it and/or modify it under
** the terms of the GNU General Public License as published by the Free ** the terms of the GNU General Public License as published by the Free
** Software Foundation, either version 3 of the License, or (at your option) ** Software Foundation, either version 3 of the License, or (at your option)
** any later version. ** any later version.
** **
** Supermodel is distributed in the hope that it will be useful, but WITHOUT ** Supermodel is distributed in the hope that it will be useful, but WITHOUT
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
** FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ** FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
** more details. ** more details.
** **
** You should have received a copy of the GNU General Public License along ** You should have received a copy of the GNU General Public License along
** with Supermodel. If not, see <http://www.gnu.org/licenses/>. ** with Supermodel. If not, see <http://www.gnu.org/licenses/>.
**/ **/
/* /*
* m68kconf.h * m68kconf.h
* *
* Musashi configuration. * Musashi configuration.
* *
* Permission was obtained from Karl Stenerud to apply the GPL license to this * Permission was obtained from Karl Stenerud to apply the GPL license to this
* code. * code.
*/ */
/* ======================================================================== */ /* ======================================================================== */
/* ========================= LICENSING & COPYRIGHT ======================== */ /* ========================= LICENSING & COPYRIGHT ======================== */
/* ======================================================================== */ /* ======================================================================== */
/* /*
* MUSASHI * MUSASHI
* Version 3.3 * Version 3.3
* *
* A portable Motorola M680x0 processor emulation engine. * A portable Motorola M680x0 processor emulation engine.
* Copyright 1998-2001 Karl Stenerud. All rights reserved. * Copyright 1998-2001 Karl Stenerud. All rights reserved.
* *
* This code may be freely used for non-commercial purposes as long as this * This code may be freely used for non-commercial purposes as long as this
* copyright notice remains unaltered in the source code and any binary files * copyright notice remains unaltered in the source code and any binary files
* containing this code in compiled form. * containing this code in compiled form.
* *
* All other lisencing terms must be negotiated with the author * All other lisencing terms must be negotiated with the author
* (Karl Stenerud). * (Karl Stenerud).
* *
* The latest version of this code can be obtained at: * The latest version of this code can be obtained at:
* http://kstenerud.cjb.net * http://kstenerud.cjb.net
*/ */
#ifndef M68KCONF__HEADER #ifndef M68KCONF__HEADER
#define M68KCONF__HEADER #define M68KCONF__HEADER
#define M68K_COMPILE_FOR_MAME OPT_OFF #define M68K_COMPILE_FOR_MAME OPT_OFF
/* Configuration switches. /* Configuration switches.
* Use OPT_SPECIFY_HANDLER for configuration options that allow callbacks. * Use OPT_SPECIFY_HANDLER for configuration options that allow callbacks.
* OPT_SPECIFY_HANDLER causes the core to link directly to the function * OPT_SPECIFY_HANDLER causes the core to link directly to the function
* or macro you specify, rather than using callback functions whose pointer * or macro you specify, rather than using callback functions whose pointer
* must be passed in using m68k_set_xxx_callback(). * must be passed in using m68k_set_xxx_callback().
*/ */
#define OPT_OFF 0 #define OPT_OFF 0
#define OPT_ON 1 #define OPT_ON 1
#define OPT_SPECIFY_HANDLER 2 #define OPT_SPECIFY_HANDLER 2
/* ======================================================================== */ /* ======================================================================== */
/* ============================= CONFIGURATION ============================ */ /* ============================= CONFIGURATION ============================ */
/* ======================================================================== */ /* ======================================================================== */
/* Turn ON if you want to use the following M68K variants */ /* Turn ON if you want to use the following M68K variants */
#define M68K_EMULATE_008 OPT_OFF #define M68K_EMULATE_008 OPT_OFF
#define M68K_EMULATE_010 OPT_OFF #define M68K_EMULATE_010 OPT_OFF
#define M68K_EMULATE_EC020 OPT_OFF #define M68K_EMULATE_EC020 OPT_OFF
#define M68K_EMULATE_020 OPT_OFF #define M68K_EMULATE_020 OPT_OFF
/* If ON, the CPU will call m68k_read_immediate_xx() for immediate addressing /* If ON, the CPU will call m68k_read_immediate_xx() for immediate addressing
* and m68k_read_pcrelative_xx() for PC-relative addressing. * and m68k_read_pcrelative_xx() for PC-relative addressing.
* If off, all read requests from the CPU will be redirected to m68k_read_xx() * If off, all read requests from the CPU will be redirected to m68k_read_xx()
*/ */
#define M68K_SEPARATE_READS OPT_ON // fixes Supermodel compilation on MacOS #define M68K_SEPARATE_READS OPT_ON // fixes Supermodel compilation on MacOS
/* If ON, the CPU will call m68k_write_32_pd() when it executes move.l with a /* If ON, the CPU will call m68k_write_32_pd() when it executes move.l with a
* predecrement destination EA mode instead of m68k_write_32(). * predecrement destination EA mode instead of m68k_write_32().
* To simulate real 68k behavior, m68k_write_32_pd() must first write the high * To simulate real 68k behavior, m68k_write_32_pd() must first write the high
* word to [address+2], and then write the low word to [address]. * word to [address+2], and then write the low word to [address].
*/ */
#define M68K_SIMULATE_PD_WRITES OPT_OFF #define M68K_SIMULATE_PD_WRITES OPT_OFF
/* If ON, CPU will call the interrupt acknowledge callback when it services an /* If ON, CPU will call the interrupt acknowledge callback when it services an
* interrupt. * interrupt.
* If off, all interrupts will be autovectored and all interrupt requests will * If off, all interrupts will be autovectored and all interrupt requests will
* auto-clear when the interrupt is serviced. * auto-clear when the interrupt is serviced.
*/ */
#define M68K_EMULATE_INT_ACK OPT_SPECIFY_HANDLER #define M68K_EMULATE_INT_ACK OPT_SPECIFY_HANDLER
#define M68K_INT_ACK_CALLBACK(A) M68KIRQCallback(A) #define M68K_INT_ACK_CALLBACK(A) M68KIRQCallback(A)
/* If ON, CPU will call the breakpoint acknowledge callback when it encounters /* If ON, CPU will call the breakpoint acknowledge callback when it encounters
* a breakpoint instruction and it is running a 68010+. * a breakpoint instruction and it is running a 68010+.
*/ */
#define M68K_EMULATE_BKPT_ACK OPT_OFF #define M68K_EMULATE_BKPT_ACK OPT_OFF
#define M68K_BKPT_ACK_CALLBACK() your_bkpt_ack_handler_function() #define M68K_BKPT_ACK_CALLBACK() your_bkpt_ack_handler_function()
/* If ON, the CPU will monitor the trace flags and take trace exceptions /* If ON, the CPU will monitor the trace flags and take trace exceptions
*/ */
#define M68K_EMULATE_TRACE OPT_OFF #define M68K_EMULATE_TRACE OPT_OFF
/* If ON, CPU will call the output reset callback when it encounters a reset /* If ON, CPU will call the output reset callback when it encounters a reset
* instruction. * instruction.
*/ */
#define M68K_EMULATE_RESET OPT_OFF #define M68K_EMULATE_RESET OPT_OFF
#define M68K_RESET_CALLBACK() M68KResetCallback() #define M68K_RESET_CALLBACK() M68KResetCallback()
/* If ON, CPU will call the callback when it encounters a cmpi.l #v, dn /* If ON, CPU will call the callback when it encounters a cmpi.l #v, dn
* instruction. * instruction.
*/ */
#define M68K_CMPILD_HAS_CALLBACK OPT_OFF #define M68K_CMPILD_HAS_CALLBACK OPT_OFF
#define M68K_CMPILD_CALLBACK(v,r) your_cmpild_handler_function(v,r) #define M68K_CMPILD_CALLBACK(v,r) your_cmpild_handler_function(v,r)
/* If ON, CPU will call the callback when it encounters a rte /* If ON, CPU will call the callback when it encounters a rte
* instruction. * instruction.
*/ */
#define M68K_RTE_HAS_CALLBACK OPT_OFF #define M68K_RTE_HAS_CALLBACK OPT_OFF
#define M68K_RTE_CALLBACK() your_rte_handler_function() #define M68K_RTE_CALLBACK() your_rte_handler_function()
/* If ON, CPU will call the set fc callback on every memory access to /* If ON, CPU will call the set fc callback on every memory access to
* differentiate between user/supervisor, program/data access like a real * differentiate between user/supervisor, program/data access like a real
* 68000 would. This should be enabled and the callback should be set if you * 68000 would. This should be enabled and the callback should be set if you
* want to properly emulate the m68010 or higher. (moves uses function codes * want to properly emulate the m68010 or higher. (moves uses function codes
* to read/write data from different address spaces) * to read/write data from different address spaces)
*/ */
#define M68K_EMULATE_FC OPT_OFF #define M68K_EMULATE_FC OPT_OFF
#define M68K_SET_FC_CALLBACK(A) your_set_fc_handler_function(A) #define M68K_SET_FC_CALLBACK(A) your_set_fc_handler_function(A)
/* If ON, CPU will call the pc changed callback when it changes the PC by a /* If ON, CPU will call the pc changed callback when it changes the PC by a
* large value. This allows host programs to be nicer when it comes to * large value. This allows host programs to be nicer when it comes to
* fetching immediate data and instructions on a banked memory system. * fetching immediate data and instructions on a banked memory system.
*/ */
#define M68K_MONITOR_PC OPT_OFF #define M68K_MONITOR_PC OPT_OFF
#define M68K_SET_PC_CALLBACK(A) your_pc_changed_handler_function(A) #define M68K_SET_PC_CALLBACK(A) your_pc_changed_handler_function(A)
/* If ON, CPU will call the instruction hook callback before every /* If ON, CPU will call the instruction hook callback before every
* instruction. * instruction.
*/ */
#ifdef SUPERMODEL_DEBUGGER #ifdef SUPERMODEL_DEBUGGER
#define M68K_INSTRUCTION_HOOK OPT_SPECIFY_HANDLER #define M68K_INSTRUCTION_HOOK OPT_SPECIFY_HANDLER
#define M68K_INSTRUCTION_CALLBACK() M68KDebugCallback() #define M68K_INSTRUCTION_CALLBACK() M68KDebugCallback()
#else #else
#define M68K_INSTRUCTION_HOOK OPT_OFF #define M68K_INSTRUCTION_HOOK OPT_OFF
#define M68K_INSTRUCTION_CALLBACK() your_instruction_hook_function() #define M68K_INSTRUCTION_CALLBACK() your_instruction_hook_function()
#endif // SUPERMODEL_DEBUGGER #endif // SUPERMODEL_DEBUGGER
/* If ON, the CPU will emulate the 4-byte prefetch queue of a real 68000 */ /* If ON, the CPU will emulate the 4-byte prefetch queue of a real 68000 */
#define M68K_EMULATE_PREFETCH OPT_OFF #define M68K_EMULATE_PREFETCH OPT_OFF
/* If ON, the CPU will generate address error exceptions if it tries to /* If ON, the CPU will generate address error exceptions if it tries to
* access a word or longword at an odd address. * access a word or longword at an odd address.
* NOTE: This is only emulated properly for 68000 mode. * NOTE: This is only emulated properly for 68000 mode.
*/ */
#define M68K_EMULATE_ADDRESS_ERROR OPT_OFF #define M68K_EMULATE_ADDRESS_ERROR OPT_OFF
/* Turn ON to enable logging of illegal instruction calls. /* Turn ON to enable logging of illegal instruction calls.
* M68K_LOG_FILEHANDLE must be #defined to a stdio file stream. * M68K_LOG_FILEHANDLE must be #defined to a stdio file stream.
* Turn on M68K_LOG_1010_1111 to log all 1010 and 1111 calls. * Turn on M68K_LOG_1010_1111 to log all 1010 and 1111 calls.
*/ */
#define M68K_LOG_ENABLE OPT_OFF #define M68K_LOG_ENABLE OPT_OFF
#define M68K_LOG_1010_1111 OPT_OFF #define M68K_LOG_1010_1111 OPT_OFF
#define M68K_LOG_FILEHANDLE some_file_handle #define M68K_LOG_FILEHANDLE some_file_handle
/* ----------------------------- COMPATIBILITY ---------------------------- */ /* ----------------------------- COMPATIBILITY ---------------------------- */
/* The following options set optimizations that violate the current ANSI /* The following options set optimizations that violate the current ANSI
* standard, but will be compliant under the forthcoming C9X standard. * standard, but will be compliant under the forthcoming C9X standard.
*/ */
/* If ON, the enulation core will use 64-bit integers to speed up some /* If ON, the enulation core will use 64-bit integers to speed up some
* operations. * operations.
*/ */
#define M68K_USE_64_BIT OPT_ON #define M68K_USE_64_BIT OPT_ON
/* Set to your compiler's static inline keyword to enable it, or /* Set to your compiler's static inline keyword to enable it, or
* set it to blank to disable it. * set it to blank to disable it.
* If you define INLINE in the makefile, it will override this value. * If you define INLINE in the makefile, it will override this value.
* NOTE: not enabling inline functions will SEVERELY slow down emulation. * NOTE: not enabling inline functions will SEVERELY slow down emulation.
*/ */
#ifndef INLINE #ifndef INLINE
#define INLINE static __inline__ // defined for GCC; if using MSVC, pass INLINE as "static __inline" from Makefile #define INLINE static __inline__ // defined for GCC; if using MSVC, pass INLINE as "static __inline" from Makefile
#endif /* INLINE */ #endif /* INLINE */
/****************************************************************************** /******************************************************************************
Supermodel Interface Supermodel Interface
******************************************************************************/ ******************************************************************************/
// Supermodel 68K interface (these functions defined in CPU/68K.cpp) // Supermodel 68K interface (these functions defined in CPU/68K.cpp)
//#ifndef FASTCALL (this doesn't work for now (needs to be added to the prototypes in m68k.h for m68k_read_memory*) //#ifndef FASTCALL (this doesn't work for now (needs to be added to the prototypes in m68k.h for m68k_read_memory*)
#undef FASTCALL #undef FASTCALL
#define FASTCALL #define FASTCALL
//#endif //#endif
unsigned int FASTCALL M68KFetch8(unsigned int a); unsigned int FASTCALL M68KFetch8(unsigned int a);
unsigned int FASTCALL M68KFetch16(unsigned int a); unsigned int FASTCALL M68KFetch16(unsigned int a);
unsigned int FASTCALL M68KFetch32(unsigned int a); unsigned int FASTCALL M68KFetch32(unsigned int a);
unsigned int FASTCALL M68KRead8(unsigned int a); unsigned int FASTCALL M68KRead8(unsigned int a);
unsigned int FASTCALL M68KRead16(unsigned int a); unsigned int FASTCALL M68KRead16(unsigned int a);
unsigned int FASTCALL M68KRead32(unsigned int a); unsigned int FASTCALL M68KRead32(unsigned int a);
void FASTCALL M68KWrite8(unsigned int a, unsigned int d); void FASTCALL M68KWrite8(unsigned int a, unsigned int d);
void FASTCALL M68KWrite16(unsigned int a, unsigned int d); void FASTCALL M68KWrite16(unsigned int a, unsigned int d);
void FASTCALL M68KWrite32(unsigned int a, unsigned int d); void FASTCALL M68KWrite32(unsigned int a, unsigned int d);
/* Read data relative to the PC */ /* Read data relative to the PC */
#define m68k_read_pcrelative_8(address) M68KFetch8(address) #define m68k_read_pcrelative_8(address) M68KFetch8(address)
#define m68k_read_pcrelative_16(address) M68KFetch16(address) #define m68k_read_pcrelative_16(address) M68KFetch16(address)
#define m68k_read_pcrelative_32(address) M68KFetch32(address) #define m68k_read_pcrelative_32(address) M68KFetch32(address)
/* Read data immediately following the PC */ /* Read data immediately following the PC */
#define m68k_read_immediate_16(address) M68KFetch16(address) #define m68k_read_immediate_16(address) M68KFetch16(address)
#define m68k_read_immediate_32(address) M68KFetch32(address) #define m68k_read_immediate_32(address) M68KFetch32(address)
/* Memory access for the disassembler */ /* Memory access for the disassembler */
#define m68k_read_disassembler_8(address) M68KRead8(address) #define m68k_read_disassembler_8(address) M68KRead8(address)
#define m68k_read_disassembler_16(address) M68KRead16(address) #define m68k_read_disassembler_16(address) M68KRead16(address)
#define m68k_read_disassembler_32(address) M68KRead32(address) #define m68k_read_disassembler_32(address) M68KRead32(address)
/* Read from anywhere */ /* Read from anywhere */
#define m68k_read_memory_8(address) M68KRead8(address) #define m68k_read_memory_8(address) M68KRead8(address)
#define m68k_read_memory_16(address) M68KRead16(address) #define m68k_read_memory_16(address) M68KRead16(address)
#define m68k_read_memory_32(address) M68KRead32(address) #define m68k_read_memory_32(address) M68KRead32(address)
/* Write to anywhere */ /* Write to anywhere */
#define m68k_write_memory_8(address, value) M68KWrite8(address, value) #define m68k_write_memory_8(address, value) M68KWrite8(address, value)
#define m68k_write_memory_16(address, value) M68KWrite16(address, value) #define m68k_write_memory_16(address, value) M68KWrite16(address, value)
#define m68k_write_memory_32(address, value) M68KWrite32(address, value) #define m68k_write_memory_32(address, value) M68KWrite32(address, value)
/* ======================================================================== */ /* ======================================================================== */
/* ============================== END OF FILE ============================= */ /* ============================== END OF FILE ============================= */
/* ======================================================================== */ /* ======================================================================== */
#endif /* M68KCONF__HEADER */ #endif /* M68KCONF__HEADER */

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,87 +1,87 @@
/** /**
** Supermodel ** Supermodel
** A Sega Model 3 Arcade Emulator. ** A Sega Model 3 Arcade Emulator.
** Copyright 2011 Bart Trzynadlowski, Nik Henson ** Copyright 2011 Bart Trzynadlowski, Nik Henson
** **
** This file is part of Supermodel. ** This file is part of Supermodel.
** **
** Supermodel is free software: you can redistribute it and/or modify it under ** Supermodel is free software: you can redistribute it and/or modify it under
** the terms of the GNU General Public License as published by the Free ** the terms of the GNU General Public License as published by the Free
** Software Foundation, either version 3 of the License, or (at your option) ** Software Foundation, either version 3 of the License, or (at your option)
** any later version. ** any later version.
** **
** Supermodel is distributed in the hope that it will be useful, but WITHOUT ** Supermodel is distributed in the hope that it will be useful, but WITHOUT
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
** FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ** FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
** more details. ** more details.
** **
** You should have received a copy of the GNU General Public License along ** You should have received a copy of the GNU General Public License along
** with Supermodel. If not, see <http://www.gnu.org/licenses/>. ** with Supermodel. If not, see <http://www.gnu.org/licenses/>.
**/ **/
/* /*
* m68kctx.h * m68kctx.h
* *
* Musashi CPU context. This was made a separate file to more easily facilitate * Musashi CPU context. This was made a separate file to more easily facilitate
* save state management. It is used internally by m68kcpu.h. * save state management. It is used internally by m68kcpu.h.
*/ */
#include "Types.h" // Supermodel types #include "Types.h" // Supermodel types
typedef struct typedef struct
{ {
UINT32 cpu_type; /* CPU Type: 68000, 68008, 68010, 68EC020, or 68020 */ UINT32 cpu_type; /* CPU Type: 68000, 68008, 68010, 68EC020, or 68020 */
UINT32 dar[16]; /* Data and Address Registers */ UINT32 dar[16]; /* Data and Address Registers */
UINT32 ppc; /* Previous program counter */ UINT32 ppc; /* Previous program counter */
UINT32 pc; /* Program Counter */ UINT32 pc; /* Program Counter */
UINT32 sp[7]; /* User, Interrupt, and Master Stack Pointers */ UINT32 sp[7]; /* User, Interrupt, and Master Stack Pointers */
UINT32 vbr; /* Vector Base Register (m68010+) */ UINT32 vbr; /* Vector Base Register (m68010+) */
UINT32 sfc; /* Source Function Code Register (m68010+) */ UINT32 sfc; /* Source Function Code Register (m68010+) */
UINT32 dfc; /* Destination Function Code Register (m68010+) */ UINT32 dfc; /* Destination Function Code Register (m68010+) */
UINT32 cacr; /* Cache Control Register (m68020, unemulated) */ UINT32 cacr; /* Cache Control Register (m68020, unemulated) */
UINT32 caar; /* Cache Address Register (m68020, unemulated) */ UINT32 caar; /* Cache Address Register (m68020, unemulated) */
UINT32 ir; /* Instruction Register */ UINT32 ir; /* Instruction Register */
UINT32 t1_flag; /* Trace 1 */ UINT32 t1_flag; /* Trace 1 */
UINT32 t0_flag; /* Trace 0 */ UINT32 t0_flag; /* Trace 0 */
UINT32 s_flag; /* Supervisor */ UINT32 s_flag; /* Supervisor */
UINT32 m_flag; /* Master/Interrupt state */ UINT32 m_flag; /* Master/Interrupt state */
UINT32 x_flag; /* Extend */ UINT32 x_flag; /* Extend */
UINT32 n_flag; /* Negative */ UINT32 n_flag; /* Negative */
UINT32 not_z_flag; /* Zero, inverted for speedups */ UINT32 not_z_flag; /* Zero, inverted for speedups */
UINT32 v_flag; /* Overflow */ UINT32 v_flag; /* Overflow */
UINT32 c_flag; /* Carry */ UINT32 c_flag; /* Carry */
UINT32 int_mask; /* I0-I2 */ UINT32 int_mask; /* I0-I2 */
UINT32 int_level; /* State of interrupt pins IPL0-IPL2 -- ASG: changed from ints_pending */ UINT32 int_level; /* State of interrupt pins IPL0-IPL2 -- ASG: changed from ints_pending */
UINT32 int_cycles; /* ASG: extra cycles from generated interrupts */ UINT32 int_cycles; /* ASG: extra cycles from generated interrupts */
UINT32 stopped; /* Stopped state */ UINT32 stopped; /* Stopped state */
UINT32 pref_addr; /* Last prefetch address */ UINT32 pref_addr; /* Last prefetch address */
UINT32 pref_data; /* Data in the prefetch queue */ UINT32 pref_data; /* Data in the prefetch queue */
UINT32 address_mask; /* Available address pins */ UINT32 address_mask; /* Available address pins */
UINT32 sr_mask; /* Implemented status register bits */ UINT32 sr_mask; /* Implemented status register bits */
UINT32 instr_mode; /* Stores whether we are in instruction mode or group 0/1 exception mode */ UINT32 instr_mode; /* Stores whether we are in instruction mode or group 0/1 exception mode */
UINT32 run_mode; /* Stores whether we are processing a reset, bus error, address error, or something else */ UINT32 run_mode; /* Stores whether we are processing a reset, bus error, address error, or something else */
/* Clocks required for instructions / exceptions */ /* Clocks required for instructions / exceptions */
UINT32 cyc_bcc_notake_b; UINT32 cyc_bcc_notake_b;
UINT32 cyc_bcc_notake_w; UINT32 cyc_bcc_notake_w;
UINT32 cyc_dbcc_f_noexp; UINT32 cyc_dbcc_f_noexp;
UINT32 cyc_dbcc_f_exp; UINT32 cyc_dbcc_f_exp;
UINT32 cyc_scc_r_true; UINT32 cyc_scc_r_true;
UINT32 cyc_movem_w; UINT32 cyc_movem_w;
UINT32 cyc_movem_l; UINT32 cyc_movem_l;
UINT32 cyc_shift; UINT32 cyc_shift;
UINT32 cyc_reset; UINT32 cyc_reset;
UINT8* cyc_instruction; UINT8* cyc_instruction;
UINT8* cyc_exception; UINT8* cyc_exception;
/* Callbacks to host */ /* Callbacks to host */
int (*int_ack_callback)(int int_line); /* Interrupt Acknowledge */ int (*int_ack_callback)(int int_line); /* Interrupt Acknowledge */
void (*bkpt_ack_callback)(unsigned int data); /* Breakpoint Acknowledge */ void (*bkpt_ack_callback)(unsigned int data); /* Breakpoint Acknowledge */
void (*reset_instr_callback)(void); /* Called when a RESET instruction is encountered */ void (*reset_instr_callback)(void); /* Called when a RESET instruction is encountered */
void (*cmpild_instr_callback)(unsigned int, int); /* Called when a CMPI.L #v, Dn instruction is encountered */ void (*cmpild_instr_callback)(unsigned int, int); /* Called when a CMPI.L #v, Dn instruction is encountered */
void (*rte_instr_callback)(void); /* Called when a RTE instruction is encountered */ void (*rte_instr_callback)(void); /* Called when a RTE instruction is encountered */
void (*pc_changed_callback)(unsigned int new_pc); /* Called when the PC changes by a large amount */ void (*pc_changed_callback)(unsigned int new_pc); /* Called when the PC changes by a large amount */
void (*set_fc_callback)(unsigned int new_fc); /* Called when the CPU function code changes */ void (*set_fc_callback)(unsigned int new_fc); /* Called when the CPU function code changes */
void (*instr_hook_callback)(void); /* Called every instruction cycle prior to execution */ void (*instr_hook_callback)(void); /* Called every instruction cycle prior to execution */
} m68ki_cpu_core; } m68ki_cpu_core;

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff