mirror of
https://github.com/holub/mame
synced 2025-05-24 23:05:32 +03:00
Significantly pared down the 68k core. Merged outer MAME shell
into the core proper and removed unused macros. Changed all external interfaces to pass the CPU device. Enabled 64-bit operations by default. Re-derived the interface functions to cascade and share code more aggressively. These changes also seem to have cured the taito_f3 issues as far as I can tell (at least pbobble3 seems right now).
This commit is contained in:
parent
8b4ee77ef0
commit
5a9c7e2d2d
3
.gitattributes
vendored
3
.gitattributes
vendored
@ -236,15 +236,12 @@ src/emu/cpu/m6800/6800tbl.c svneol=native#text/plain
|
||||
src/emu/cpu/m6800/m6800.c svneol=native#text/plain
|
||||
src/emu/cpu/m6800/m6800.h svneol=native#text/plain
|
||||
src/emu/cpu/m68000/m68000.h svneol=native#text/plain
|
||||
src/emu/cpu/m68000/m68k.h svneol=native#text/plain
|
||||
src/emu/cpu/m68000/m68k_in.c svneol=native#text/plain
|
||||
src/emu/cpu/m68000/m68kcpu.c svneol=native#text/plain
|
||||
src/emu/cpu/m68000/m68kcpu.h svneol=native#text/plain
|
||||
src/emu/cpu/m68000/m68kdasm.c svneol=native#text/plain
|
||||
src/emu/cpu/m68000/m68kfpu.c svneol=native#text/plain
|
||||
src/emu/cpu/m68000/m68kmake.c svneol=native#text/plain
|
||||
src/emu/cpu/m68000/m68kmame.c svneol=native#text/plain
|
||||
src/emu/cpu/m68000/m68kmame.h svneol=native#text/plain
|
||||
src/emu/cpu/m6805/6805dasm.c svneol=native#text/plain
|
||||
src/emu/cpu/m6805/6805ops.c svneol=native#text/plain
|
||||
src/emu/cpu/m6805/m6805.c svneol=native#text/plain
|
||||
|
@ -1097,16 +1097,11 @@ $(CPUOBJ)/mc68hc11/mc68hc11.o: $(CPUSRC)/mc68hc11/mc68hc11.c \
|
||||
# Motorola 68000 series
|
||||
#-------------------------------------------------
|
||||
|
||||
CPUDEFS += -DHAS_M68000=$(if $(filter M68000,$(CPUS)),1,0)
|
||||
CPUDEFS += -DHAS_M68008=$(if $(filter M68008,$(CPUS)),1,0)
|
||||
CPUDEFS += -DHAS_M68010=$(if $(filter M68010,$(CPUS)),1,0)
|
||||
CPUDEFS += -DHAS_M68EC020=$(if $(filter M68EC020,$(CPUS)),1,0)
|
||||
CPUDEFS += -DHAS_M68020=$(if $(filter M68020,$(CPUS)),1,0)
|
||||
CPUDEFS += -DHAS_M68040=$(if $(filter M68040,$(CPUS)),1,0)
|
||||
CPUDEFS += -DHAS_M680X0=$(if $(filter M680X0,$(CPUS)),1,0)
|
||||
|
||||
ifneq ($(filter M68000 M68008 M68010 M68EC020 M68020 M68040,$(CPUS)),)
|
||||
ifneq ($(filter M680X0,$(CPUS)),)
|
||||
OBJDIRS += $(CPUOBJ)/m68000
|
||||
CPUOBJS += $(CPUOBJ)/m68000/m68kcpu.o $(CPUOBJ)/m68000/m68kmame.o $(CPUOBJ)/m68000/m68kops.o
|
||||
CPUOBJS += $(CPUOBJ)/m68000/m68kcpu.o $(CPUOBJ)/m68000/m68kops.o
|
||||
DBGOBJS += $(CPUOBJ)/m68000/m68kdasm.o
|
||||
M68KMAKE = $(BUILDOUT)/m68kmake$(BUILD_EXE)
|
||||
endif
|
||||
@ -1140,9 +1135,6 @@ endif
|
||||
$(CPUOBJ)/m68000/m68kcpu.o: $(CPUOBJ)/m68000/m68kops.c \
|
||||
$(CPUSRC)/m68000/m68kcpu.h
|
||||
|
||||
$(CPUOBJ)/m68000/m68kmame.o: $(CPUSRC)/m68000/m68kmame.c \
|
||||
$(CPUSRC)/m68000/m68kcpu.h
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------
|
||||
|
@ -17,6 +17,19 @@
|
||||
#define M68K_IRQ_6 6
|
||||
#define M68K_IRQ_7 7
|
||||
|
||||
/* CPU types for use in m68k_set_cpu_type() */
|
||||
enum
|
||||
{
|
||||
M68K_CPU_TYPE_INVALID,
|
||||
M68K_CPU_TYPE_68000,
|
||||
M68K_CPU_TYPE_68008,
|
||||
M68K_CPU_TYPE_68010,
|
||||
M68K_CPU_TYPE_68EC020,
|
||||
M68K_CPU_TYPE_68020,
|
||||
M68K_CPU_TYPE_68030, /* Supported by disassembler ONLY */
|
||||
M68K_CPU_TYPE_68040 /* Supported by disassembler ONLY */
|
||||
};
|
||||
|
||||
|
||||
/* Special interrupt acknowledge values.
|
||||
* Use these as special returns from the interrupt acknowledge callback
|
||||
@ -52,135 +65,22 @@ enum
|
||||
CPUINFO_PTR_M68K_TAS_CALLBACK
|
||||
};
|
||||
|
||||
/* Redirect memory calls */
|
||||
typedef void (*m68k_bkpt_ack_func)(const device_config *device, UINT32 data);
|
||||
typedef void (*m68k_reset_func)(const device_config *device);
|
||||
typedef void (*m68k_cmpild_func)(const device_config *device, UINT32 data, UINT8 reg);
|
||||
typedef void (*m68k_rte_func)(const device_config *device);
|
||||
typedef int (*m68k_tas_func)(const device_config *device);
|
||||
|
||||
typedef struct _m68k_memory_interface m68k_memory_interface;
|
||||
struct _m68k_memory_interface
|
||||
{
|
||||
offs_t opcode_xor; // Address Calculation
|
||||
UINT16 (*readimm16)(const address_space *, offs_t); // Immediate read 16 bit
|
||||
UINT8 (*read8)(const address_space *, offs_t); // Normal read 8 bit
|
||||
UINT16 (*read16)(const address_space *, offs_t); // Normal read 16 bit
|
||||
UINT32 (*read32)(const address_space *, offs_t); // Normal read 32 bit
|
||||
void (*write8)(const address_space *, offs_t, UINT8); // Write 8 bit
|
||||
void (*write16)(const address_space *, offs_t, UINT16); // Write 16 bit
|
||||
void (*write32)(const address_space *, offs_t, UINT32); // Write 32 bit
|
||||
};
|
||||
|
||||
|
||||
typedef struct _m68k_encryption_interface m68k_encryption_interface;
|
||||
struct _m68k_encryption_interface
|
||||
{
|
||||
UINT8 (*read8pc)(offs_t); // PC Relative read 8 bit
|
||||
UINT16 (*read16pc)(offs_t); // PC Relative read 16 bit
|
||||
UINT32 (*read32pc)(offs_t); // PC Relative read 32 bit
|
||||
|
||||
UINT16 (*read16d)(offs_t); // Direct read 16 bit
|
||||
UINT32 (*read32d)(offs_t); // Direct read 32 bit
|
||||
};
|
||||
|
||||
/* The MAME API for MC68000 */
|
||||
|
||||
#define MC68000_IRQ_1 1
|
||||
#define MC68000_IRQ_2 2
|
||||
#define MC68000_IRQ_3 3
|
||||
#define MC68000_IRQ_4 4
|
||||
#define MC68000_IRQ_5 5
|
||||
#define MC68000_IRQ_6 6
|
||||
#define MC68000_IRQ_7 7
|
||||
|
||||
#define MC68000_INT_ACK_AUTOVECTOR -1
|
||||
#define MC68000_INT_ACK_SPURIOUS -2
|
||||
|
||||
CPU_GET_INFO( m68000 );
|
||||
extern void m68000_memory_interface_set(int Entry,void * memory_routine);
|
||||
|
||||
/****************************************************************************
|
||||
* M68008 section
|
||||
****************************************************************************/
|
||||
#if HAS_M68008
|
||||
#define MC68008_IRQ_1 MC68000_IRQ_1
|
||||
#define MC68008_IRQ_2 MC68000_IRQ_2
|
||||
#define MC68008_IRQ_3 MC68000_IRQ_3
|
||||
#define MC68008_IRQ_4 MC68000_IRQ_4
|
||||
#define MC68008_IRQ_5 MC68000_IRQ_5
|
||||
#define MC68008_IRQ_6 MC68000_IRQ_6
|
||||
#define MC68008_IRQ_7 MC68000_IRQ_7
|
||||
#define MC68008_INT_ACK_AUTOVECTOR MC68000_INT_ACK_AUTOVECTOR
|
||||
#define MC68008_INT_ACK_SPURIOUS MC68000_INT_ACK_SPURIOUS
|
||||
|
||||
CPU_GET_INFO( m68008 );
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* M68010 section
|
||||
****************************************************************************/
|
||||
#if HAS_M68010
|
||||
#define MC68010_IRQ_1 MC68000_IRQ_1
|
||||
#define MC68010_IRQ_2 MC68000_IRQ_2
|
||||
#define MC68010_IRQ_3 MC68000_IRQ_3
|
||||
#define MC68010_IRQ_4 MC68000_IRQ_4
|
||||
#define MC68010_IRQ_5 MC68000_IRQ_5
|
||||
#define MC68010_IRQ_6 MC68000_IRQ_6
|
||||
#define MC68010_IRQ_7 MC68000_IRQ_7
|
||||
#define MC68010_INT_ACK_AUTOVECTOR MC68000_INT_ACK_AUTOVECTOR
|
||||
#define MC68010_INT_ACK_SPURIOUS MC68000_INT_ACK_SPURIOUS
|
||||
|
||||
CPU_GET_INFO( m68010 );
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* M68EC020 section
|
||||
****************************************************************************/
|
||||
#if HAS_M68EC020
|
||||
#define MC68EC020_IRQ_1 MC68000_IRQ_1
|
||||
#define MC68EC020_IRQ_2 MC68000_IRQ_2
|
||||
#define MC68EC020_IRQ_3 MC68000_IRQ_3
|
||||
#define MC68EC020_IRQ_4 MC68000_IRQ_4
|
||||
#define MC68EC020_IRQ_5 MC68000_IRQ_5
|
||||
#define MC68EC020_IRQ_6 MC68000_IRQ_6
|
||||
#define MC68EC020_IRQ_7 MC68000_IRQ_7
|
||||
#define MC68EC020_INT_ACK_AUTOVECTOR MC68000_INT_ACK_AUTOVECTOR
|
||||
#define MC68EC020_INT_ACK_SPURIOUS MC68000_INT_ACK_SPURIOUS
|
||||
|
||||
CPU_GET_INFO( m68ec020 );
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* M68020 section
|
||||
****************************************************************************/
|
||||
#if HAS_M68020
|
||||
#define MC68020_IRQ_1 MC68000_IRQ_1
|
||||
#define MC68020_IRQ_2 MC68000_IRQ_2
|
||||
#define MC68020_IRQ_3 MC68000_IRQ_3
|
||||
#define MC68020_IRQ_4 MC68000_IRQ_4
|
||||
#define MC68020_IRQ_5 MC68000_IRQ_5
|
||||
#define MC68020_IRQ_6 MC68000_IRQ_6
|
||||
#define MC68020_IRQ_7 MC68000_IRQ_7
|
||||
#define MC68020_INT_ACK_AUTOVECTOR MC68000_INT_ACK_AUTOVECTOR
|
||||
#define MC68020_INT_ACK_SPURIOUS MC68000_INT_ACK_SPURIOUS
|
||||
|
||||
CPU_GET_INFO( m68020 );
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* M68040 section
|
||||
****************************************************************************/
|
||||
#if HAS_M68040
|
||||
#define MC68040_IRQ_1 MC68000_IRQ_1
|
||||
#define MC68040_IRQ_2 MC68000_IRQ_2
|
||||
#define MC68040_IRQ_3 MC68000_IRQ_3
|
||||
#define MC68040_IRQ_4 MC68000_IRQ_4
|
||||
#define MC68040_IRQ_5 MC68000_IRQ_5
|
||||
#define MC68040_IRQ_6 MC68000_IRQ_6
|
||||
#define MC68040_IRQ_7 MC68000_IRQ_7
|
||||
#define MC68040_INT_ACK_AUTOVECTOR MC68000_INT_ACK_AUTOVECTOR
|
||||
#define MC68040_INT_ACK_SPURIOUS MC68000_INT_ACK_SPURIOUS
|
||||
|
||||
CPU_GET_INFO( m68040 );
|
||||
#endif
|
||||
|
||||
// C Core header
|
||||
#include "m68kmame.h"
|
||||
void m68k_set_encrypted_opcode_range(const device_config *device, offs_t start, offs_t end);
|
||||
|
||||
unsigned int m68k_disassemble_raw(char* str_buff, unsigned int pc, const unsigned char* opdata, const unsigned char* argdata, unsigned int cpu_type);
|
||||
|
||||
#endif /* __M68000_H__ */
|
||||
|
@ -1,266 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef __M68K_H__
|
||||
#define __M68K_H__
|
||||
|
||||
/* ======================================================================== */
|
||||
/* ========================= LICENSING & COPYRIGHT ======================== */
|
||||
/* ======================================================================== */
|
||||
/*
|
||||
* MUSASHI
|
||||
* Version 3.32
|
||||
*
|
||||
* A portable Motorola M680x0 processor emulation engine.
|
||||
* Copyright Karl Stenerud. All rights reserved.
|
||||
*
|
||||
* 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
|
||||
* containing this code in compiled form.
|
||||
*
|
||||
* All other licensing terms must be negotiated with the author
|
||||
* (Karl Stenerud).
|
||||
*
|
||||
* The latest version of this code can be obtained at:
|
||||
* http://kstenerud.cjb.net
|
||||
*/
|
||||
|
||||
/* ======================================================================== */
|
||||
/* ============================ GENERAL DEFINES =========================== */
|
||||
|
||||
/* ======================================================================== */
|
||||
|
||||
/* CPU types for use in m68k_set_cpu_type() */
|
||||
enum
|
||||
{
|
||||
M68K_CPU_TYPE_INVALID,
|
||||
M68K_CPU_TYPE_68000,
|
||||
M68K_CPU_TYPE_68008,
|
||||
M68K_CPU_TYPE_68010,
|
||||
M68K_CPU_TYPE_68EC020,
|
||||
M68K_CPU_TYPE_68020,
|
||||
M68K_CPU_TYPE_68030, /* Supported by disassembler ONLY */
|
||||
M68K_CPU_TYPE_68040 /* Supported by disassembler ONLY */
|
||||
};
|
||||
|
||||
/* Registers used by m68k_get_reg() and m68k_set_reg() */
|
||||
enum _m68k_register_t
|
||||
{
|
||||
/* Real registers */
|
||||
M68K_REG_D0, /* Data registers */
|
||||
M68K_REG_D1,
|
||||
M68K_REG_D2,
|
||||
M68K_REG_D3,
|
||||
M68K_REG_D4,
|
||||
M68K_REG_D5,
|
||||
M68K_REG_D6,
|
||||
M68K_REG_D7,
|
||||
M68K_REG_A0, /* Address registers */
|
||||
M68K_REG_A1,
|
||||
M68K_REG_A2,
|
||||
M68K_REG_A3,
|
||||
M68K_REG_A4,
|
||||
M68K_REG_A5,
|
||||
M68K_REG_A6,
|
||||
M68K_REG_A7,
|
||||
M68K_REG_PC, /* Program Counter */
|
||||
M68K_REG_SR, /* Status Register */
|
||||
M68K_REG_SP, /* The current Stack Pointer (located in A7) */
|
||||
M68K_REG_USP, /* User Stack Pointer */
|
||||
M68K_REG_ISP, /* Interrupt Stack Pointer */
|
||||
M68K_REG_MSP, /* Master Stack Pointer */
|
||||
M68K_REG_SFC, /* Source Function Code */
|
||||
M68K_REG_DFC, /* Destination Function Code */
|
||||
M68K_REG_VBR, /* Vector Base Register */
|
||||
M68K_REG_CACR, /* Cache Control Register */
|
||||
M68K_REG_CAAR, /* Cache Address Register */
|
||||
|
||||
/* Assumed registers */
|
||||
/* These are cheat registers which emulate the 1-longword prefetch
|
||||
* present in the 68000 and 68010.
|
||||
*/
|
||||
M68K_REG_PREF_ADDR, /* Last prefetch address */
|
||||
M68K_REG_PREF_DATA, /* Last prefetch data */
|
||||
|
||||
/* Convenience registers */
|
||||
M68K_REG_PPC, /* Previous value in the program counter */
|
||||
M68K_REG_IR, /* Instruction register */
|
||||
M68K_REG_CPU_TYPE /* Type of CPU being run */
|
||||
};
|
||||
typedef enum _m68k_register_t m68k_register_t;
|
||||
|
||||
|
||||
|
||||
/* ======================================================================== */
|
||||
/* ============================== CALLBACKS =============================== */
|
||||
/* ======================================================================== */
|
||||
|
||||
/* 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
|
||||
* in order for these to do anything useful.
|
||||
* 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
|
||||
* callback or have assigned a callback of NULL.
|
||||
*/
|
||||
|
||||
/* Set the callback for an interrupt acknowledge.
|
||||
* 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
|
||||
* special interrupt acknowledge values specified earlier in this header.
|
||||
* If this is not implemented, the CPU will always assume an autovectored
|
||||
* interrupt, and will automatically clear the interrupt request when it
|
||||
* services the interrupt.
|
||||
* Default behavior: return M68K_INT_ACK_AUTOVECTOR.
|
||||
*/
|
||||
void m68k_set_int_ack_callback(m68ki_cpu_core *m68k, void *param, int (*callback)(void *param, int int_level));
|
||||
|
||||
|
||||
/* Set the callback for a breakpoint acknowledge (68010+).
|
||||
* The CPU will call the callback with whatever was in the data field of the
|
||||
* BKPT instruction for 68020+, or 0 for 68010.
|
||||
* Default behavior: do nothing.
|
||||
*/
|
||||
void m68k_set_bkpt_ack_callback(m68ki_cpu_core *m68k, void (*callback)(unsigned int data));
|
||||
|
||||
|
||||
/* Set the callback for the RESET instruction.
|
||||
* The CPU calls this callback every time it encounters a RESET instruction.
|
||||
* Default behavior: do nothing.
|
||||
*/
|
||||
void m68k_set_reset_instr_callback(m68ki_cpu_core *m68k, void (*callback)(void));
|
||||
|
||||
|
||||
/* Set the callback for the CMPI.L #v, Dn instruction.
|
||||
* The CPU calls this callback every time it encounters a CMPI.L #v, Dn instruction.
|
||||
* Default behavior: do nothing.
|
||||
*/
|
||||
void m68k_set_cmpild_instr_callback(m68ki_cpu_core *m68k, void (*callback)(unsigned int val, int reg));
|
||||
|
||||
|
||||
/* Set the callback for the RTE instruction.
|
||||
* The CPU calls this callback every time it encounters a RTE instruction.
|
||||
* Default behavior: do nothing.
|
||||
*/
|
||||
void m68k_set_rte_instr_callback(m68ki_cpu_core *m68k, void (*callback)(void));
|
||||
|
||||
/* Set the callback for the TAS instruction.
|
||||
* The CPU calls this callback every time it encounters a TAS instruction.
|
||||
* Default behavior: return 1, allow writeback.
|
||||
*/
|
||||
void m68k_set_tas_instr_callback(m68ki_cpu_core *m68k, int (*callback)(void));
|
||||
|
||||
|
||||
|
||||
/* Set the callback for CPU function code changes.
|
||||
* You must enable M68K_EMULATE_FC in m68kconf.h.
|
||||
* 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 it is (supervisor/user, program/data and such).
|
||||
* Default behavior: do nothing.
|
||||
*/
|
||||
void m68k_set_fc_callback(m68ki_cpu_core *m68k, void (*callback)(unsigned int new_fc));
|
||||
|
||||
|
||||
|
||||
/* ======================================================================== */
|
||||
/* ====================== FUNCTIONS TO ACCESS THE CPU ===================== */
|
||||
/* ======================================================================== */
|
||||
|
||||
/* Use this function to set the CPU type you want to emulate.
|
||||
* 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.
|
||||
*/
|
||||
void m68k_set_cpu_type(m68ki_cpu_core *m68k, unsigned int cpu_type);
|
||||
|
||||
/* Do whatever initialisations the core requires. Should be called
|
||||
* at least once at init time.
|
||||
*/
|
||||
void m68k_init(m68ki_cpu_core *m68k);
|
||||
|
||||
/* Pulse the RESET pin on the CPU.
|
||||
* You *MUST* reset the CPU at least once to initialize the emulation
|
||||
* Note: If you didn't call m68k_set_cpu_type() before resetting
|
||||
* the CPU for the first time, the CPU will be set to
|
||||
* M68K_CPU_TYPE_68000.
|
||||
*/
|
||||
void m68k_pulse_reset(m68ki_cpu_core *m68k);
|
||||
|
||||
/* execute num_cycles worth of instructions. returns number of cycles used */
|
||||
int m68k_execute(m68ki_cpu_core *m68k, 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(m68ki_cpu_core *m68k); /* Number of cycles run so far */
|
||||
int m68k_cycles_remaining(m68ki_cpu_core *m68k); /* Number of cycles left */
|
||||
void m68k_modify_timeslice(m68ki_cpu_core *m68k, int cycles); /* Modify cycles left */
|
||||
void m68k_end_timeslice(m68ki_cpu_core *m68k); /* 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(m68ki_cpu_core *m68k, unsigned int int_level);
|
||||
|
||||
/* Set the virtual irq lines, where the highest level
|
||||
* active line is automatically selected. If you use this function,
|
||||
* do not use m68k_set_irq.
|
||||
*/
|
||||
void m68k_set_virq(m68ki_cpu_core *m68k, unsigned int level, unsigned int active);
|
||||
unsigned int m68k_get_virq(m68ki_cpu_core *m68k, unsigned int level);
|
||||
|
||||
/* Halt the CPU as if you pulsed the HALT pin. */
|
||||
void m68k_pulse_halt(m68ki_cpu_core *m68k);
|
||||
|
||||
|
||||
/* Context switching to allow multiple CPUs */
|
||||
|
||||
/* Get the size of the cpu context in bytes */
|
||||
unsigned int m68k_context_size(void);
|
||||
|
||||
/* Get a cpu context */
|
||||
unsigned int m68k_get_context(void* dst);
|
||||
|
||||
/* set the current cpu context */
|
||||
void m68k_set_context(void* dst);
|
||||
|
||||
/* Register the CPU state information */
|
||||
void m68k_state_register(m68ki_cpu_core *m68k, 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(m68ki_cpu_core *m68k, m68k_register_t regnum);
|
||||
|
||||
/* Poke values into the internals of the currently running CPU context */
|
||||
void m68k_set_reg(m68ki_cpu_core *m68k, 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);
|
||||
|
||||
/* 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);
|
||||
|
||||
/* Same as above but accepts raw opcode data directly rather than fetching
|
||||
* via the read/write interfaces.
|
||||
*/
|
||||
unsigned int m68k_disassemble_raw(char* str_buff, unsigned int pc, const unsigned char* opdata, const unsigned char* argdata, unsigned int cpu_type);
|
||||
|
||||
|
||||
/* ======================================================================== */
|
||||
/* ============================== MAME STUFF ============================== */
|
||||
/* ======================================================================== */
|
||||
|
||||
#include "m68kmame.h"
|
||||
|
||||
|
||||
/* ======================================================================== */
|
||||
/* ============================== END OF FILE ============================= */
|
||||
/* ======================================================================== */
|
||||
|
||||
#endif /* __M68K_H__ */
|
@ -259,6 +259,7 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
M68KMAKE_OPCODE_HANDLER_HEADER
|
||||
|
||||
#include "m68kcpu.h"
|
||||
#include "mame.h"
|
||||
extern void m68040_fpu_op0(m68ki_cpu_core *m68k);
|
||||
extern void m68040_fpu_op1(m68ki_cpu_core *m68k);
|
||||
|
||||
@ -3119,7 +3120,8 @@ M68KMAKE_OP(bkpt, 0, ., .)
|
||||
{
|
||||
if(CPU_TYPE_IS_010_PLUS(m68k->cpu_type))
|
||||
{
|
||||
(*m68k->bkpt_ack_callback)(CPU_TYPE_IS_EC020_PLUS(m68k->cpu_type) ? m68k->ir & 7 : 0);
|
||||
if (m68k->bkpt_ack_callback != NULL)
|
||||
(*m68k->bkpt_ack_callback)(m68k->device, CPU_TYPE_IS_EC020_PLUS(m68k->cpu_type) ? m68k->ir & 7 : 0);
|
||||
}
|
||||
m68ki_exception_illegal(m68k);
|
||||
}
|
||||
@ -3283,9 +3285,8 @@ M68KMAKE_OP(callm, 32, ., .)
|
||||
m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */
|
||||
REG_PC += 2;
|
||||
(void)ea; /* just to avoid an 'unused variable' warning */
|
||||
M68K_DO_LOG((M68K_LOG_FILEHANDLE "%s at %08x: called unimplemented instruction %04x (%s)\n",
|
||||
m68ki_cpu_get_names[m68k->cpu_type], REG_PC - 2, m68k->ir,
|
||||
m68k_disassemble_quick(REG_PC - 2)));
|
||||
logerror("%s at %08x: called unimplemented instruction %04x (callm)\n",
|
||||
m68k->device->tag, REG_PC - 2, m68k->ir);
|
||||
return;
|
||||
}
|
||||
m68ki_exception_illegal(m68k);
|
||||
@ -4221,7 +4222,8 @@ M68KMAKE_OP(cmpi, 32, ., d)
|
||||
UINT32 dst = DY;
|
||||
UINT32 res = dst - src;
|
||||
|
||||
(*m68k->cmpild_instr_callback)(src, m68k->ir & 7); /* auto-disable (see m68kcpu.h) */
|
||||
if (m68k->cmpild_instr_callback != NULL)
|
||||
(*m68k->cmpild_instr_callback)(m68k->device, src, m68k->ir & 7);
|
||||
|
||||
m68k->n_flag = NFLAG_32(res);
|
||||
m68k->not_z_flag = MASK_OUT_ABOVE_32(res);
|
||||
@ -4361,9 +4363,8 @@ M68KMAKE_OP(cpbcc, 32, ., .)
|
||||
{
|
||||
if(CPU_TYPE_IS_EC020_PLUS(m68k->cpu_type))
|
||||
{
|
||||
M68K_DO_LOG((M68K_LOG_FILEHANDLE "%s at %08x: called unimplemented instruction %04x (%s)\n",
|
||||
m68ki_cpu_get_names[m68k->cpu_type], REG_PC - 2, m68k->ir,
|
||||
m68k_disassemble_quick(REG_PC - 2)));
|
||||
logerror( "%s at %08x: called unimplemented instruction %04x (cpbcc)\n",
|
||||
m68k->device->tag, REG_PC - 2, m68k->ir);
|
||||
return;
|
||||
}
|
||||
m68ki_exception_1111(m68k);
|
||||
@ -4374,9 +4375,8 @@ M68KMAKE_OP(cpdbcc, 32, ., .)
|
||||
{
|
||||
if(CPU_TYPE_IS_EC020_PLUS(m68k->cpu_type))
|
||||
{
|
||||
M68K_DO_LOG((M68K_LOG_FILEHANDLE "%s at %08x: called unimplemented instruction %04x (%s)\n",
|
||||
m68ki_cpu_get_names[m68k->cpu_type], REG_PC - 2, m68k->ir,
|
||||
m68k_disassemble_quick(REG_PC - 2)));
|
||||
logerror("%s at %08x: called unimplemented instruction %04x (cpdbcc)\n",
|
||||
m68k->device->tag, REG_PC - 2, m68k->ir);
|
||||
return;
|
||||
}
|
||||
m68ki_exception_1111(m68k);
|
||||
@ -4387,9 +4387,8 @@ M68KMAKE_OP(cpgen, 32, ., .)
|
||||
{
|
||||
if(CPU_TYPE_IS_EC020_PLUS(m68k->cpu_type))
|
||||
{
|
||||
M68K_DO_LOG((M68K_LOG_FILEHANDLE "%s at %08x: called unimplemented instruction %04x (%s)\n",
|
||||
m68ki_cpu_get_names[m68k->cpu_type], REG_PC - 2, m68k->ir,
|
||||
m68k_disassemble_quick(REG_PC - 2)));
|
||||
logerror("%s at %08x: called unimplemented instruction %04x (cpgen)\n",
|
||||
m68k->device->tag, REG_PC - 2, m68k->ir);
|
||||
return;
|
||||
}
|
||||
m68ki_exception_1111(m68k);
|
||||
@ -4400,9 +4399,8 @@ M68KMAKE_OP(cpscc, 32, ., .)
|
||||
{
|
||||
if(CPU_TYPE_IS_EC020_PLUS(m68k->cpu_type))
|
||||
{
|
||||
M68K_DO_LOG((M68K_LOG_FILEHANDLE "%s at %08x: called unimplemented instruction %04x (%s)\n",
|
||||
m68ki_cpu_get_names[m68k->cpu_type], REG_PC - 2, m68k->ir,
|
||||
m68k_disassemble_quick(REG_PC - 2)));
|
||||
logerror("%s at %08x: called unimplemented instruction %04x (cpscc)\n",
|
||||
m68k->device->tag, REG_PC - 2, m68k->ir);
|
||||
return;
|
||||
}
|
||||
m68ki_exception_1111(m68k);
|
||||
@ -4413,9 +4411,8 @@ M68KMAKE_OP(cptrapcc, 32, ., .)
|
||||
{
|
||||
if(CPU_TYPE_IS_EC020_PLUS(m68k->cpu_type))
|
||||
{
|
||||
M68K_DO_LOG((M68K_LOG_FILEHANDLE "%s at %08x: called unimplemented instruction %04x (%s)\n",
|
||||
m68ki_cpu_get_names[m68k->cpu_type], REG_PC - 2, m68k->ir,
|
||||
m68k_disassemble_quick(REG_PC - 2)));
|
||||
logerror("%s at %08x: called unimplemented instruction %04x (cptrapcc)\n",
|
||||
m68k->device->tag, REG_PC - 2, m68k->ir);
|
||||
return;
|
||||
}
|
||||
m68ki_exception_1111(m68k);
|
||||
@ -4603,8 +4600,6 @@ M68KMAKE_OP(divu, 16, ., .)
|
||||
|
||||
M68KMAKE_OP(divl, 32, ., d)
|
||||
{
|
||||
#if M68K_USE_64_BIT
|
||||
|
||||
if(CPU_TYPE_IS_EC020_PLUS(m68k->cpu_type))
|
||||
{
|
||||
UINT32 word2 = OPER_I_16(m68k);
|
||||
@ -4670,152 +4665,11 @@ M68KMAKE_OP(divl, 32, ., d)
|
||||
return;
|
||||
}
|
||||
m68ki_exception_illegal(m68k);
|
||||
|
||||
#else
|
||||
|
||||
if(CPU_TYPE_IS_EC020_PLUS(m68k->cpu_type))
|
||||
{
|
||||
UINT32 word2 = OPER_I_16(m68k);
|
||||
UINT32 divisor = DY;
|
||||
UINT32 dividend_hi = REG_D[word2 & 7];
|
||||
UINT32 dividend_lo = REG_D[(word2 >> 12) & 7];
|
||||
UINT32 quotient = 0;
|
||||
UINT32 remainder = 0;
|
||||
UINT32 dividend_neg = 0;
|
||||
UINT32 divisor_neg = 0;
|
||||
INT32 i;
|
||||
UINT32 overflow;
|
||||
|
||||
if(divisor != 0)
|
||||
{
|
||||
/* quad / long : long quotient, long remainder */
|
||||
if(BIT_A(word2))
|
||||
{
|
||||
if(BIT_B(word2)) /* signed */
|
||||
{
|
||||
/* special case in signed divide */
|
||||
if(dividend_hi == 0 && dividend_lo == 0x80000000 && divisor == 0xffffffff)
|
||||
{
|
||||
REG_D[word2 & 7] = 0;
|
||||
REG_D[(word2 >> 12) & 7] = 0x80000000;
|
||||
|
||||
m68k->n_flag = NFLAG_SET;
|
||||
m68k->not_z_flag = ZFLAG_CLEAR;
|
||||
m68k->v_flag = VFLAG_CLEAR;
|
||||
m68k->c_flag = CFLAG_CLEAR;
|
||||
return;
|
||||
}
|
||||
if(GET_MSB_32(dividend_hi))
|
||||
{
|
||||
dividend_neg = 1;
|
||||
dividend_hi = (UINT32)MASK_OUT_ABOVE_32((-(INT32)dividend_hi) - (dividend_lo != 0));
|
||||
dividend_lo = (UINT32)MASK_OUT_ABOVE_32(-(INT32)dividend_lo);
|
||||
}
|
||||
if(GET_MSB_32(divisor))
|
||||
{
|
||||
divisor_neg = 1;
|
||||
divisor = (UINT32)MASK_OUT_ABOVE_32(-(INT32)divisor);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* if the upper long is greater than the divisor, we're overflowing. */
|
||||
if(dividend_hi >= divisor)
|
||||
{
|
||||
m68k->v_flag = VFLAG_SET;
|
||||
return;
|
||||
}
|
||||
|
||||
for(i = 31; i >= 0; i--)
|
||||
{
|
||||
quotient <<= 1;
|
||||
remainder = (remainder << 1) + ((dividend_hi >> i) & 1);
|
||||
if(remainder >= divisor)
|
||||
{
|
||||
remainder -= divisor;
|
||||
quotient++;
|
||||
}
|
||||
}
|
||||
for(i = 31; i >= 0; i--)
|
||||
{
|
||||
quotient <<= 1;
|
||||
overflow = GET_MSB_32(remainder);
|
||||
remainder = (remainder << 1) + ((dividend_lo >> i) & 1);
|
||||
if(remainder >= divisor || overflow)
|
||||
{
|
||||
remainder -= divisor;
|
||||
quotient++;
|
||||
}
|
||||
}
|
||||
|
||||
if(BIT_B(word2)) /* signed */
|
||||
{
|
||||
if(quotient > 0x7fffffff)
|
||||
{
|
||||
m68k->v_flag = VFLAG_SET;
|
||||
return;
|
||||
}
|
||||
if(dividend_neg)
|
||||
{
|
||||
remainder = (UINT32)MASK_OUT_ABOVE_32(-(INT32)remainder);
|
||||
quotient = (UINT32)MASK_OUT_ABOVE_32(-(INT32)quotient);
|
||||
}
|
||||
if(divisor_neg)
|
||||
quotient = (UINT32)MASK_OUT_ABOVE_32(-(INT32)quotient);
|
||||
}
|
||||
|
||||
REG_D[word2 & 7] = remainder;
|
||||
REG_D[(word2 >> 12) & 7] = quotient;
|
||||
|
||||
m68k->n_flag = NFLAG_32(quotient);
|
||||
m68k->not_z_flag = quotient;
|
||||
m68k->v_flag = VFLAG_CLEAR;
|
||||
m68k->c_flag = CFLAG_CLEAR;
|
||||
return;
|
||||
}
|
||||
|
||||
/* long / long: long quotient, maybe long remainder */
|
||||
if(BIT_B(word2)) /* signed */
|
||||
{
|
||||
/* Special case in divide */
|
||||
if(dividend_lo == 0x80000000 && divisor == 0xffffffff)
|
||||
{
|
||||
m68k->n_flag = NFLAG_SET;
|
||||
m68k->not_z_flag = ZFLAG_CLEAR;
|
||||
m68k->v_flag = VFLAG_CLEAR;
|
||||
m68k->c_flag = CFLAG_CLEAR;
|
||||
REG_D[(word2 >> 12) & 7] = 0x80000000;
|
||||
REG_D[word2 & 7] = 0;
|
||||
return;
|
||||
}
|
||||
REG_D[word2 & 7] = MAKE_INT_32(dividend_lo) % MAKE_INT_32(divisor);
|
||||
quotient = REG_D[(word2 >> 12) & 7] = MAKE_INT_32(dividend_lo) / MAKE_INT_32(divisor);
|
||||
}
|
||||
else
|
||||
{
|
||||
REG_D[word2 & 7] = MASK_OUT_ABOVE_32(dividend_lo) % MASK_OUT_ABOVE_32(divisor);
|
||||
quotient = REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(dividend_lo) / MASK_OUT_ABOVE_32(divisor);
|
||||
}
|
||||
|
||||
m68k->n_flag = NFLAG_32(quotient);
|
||||
m68k->not_z_flag = quotient;
|
||||
m68k->v_flag = VFLAG_CLEAR;
|
||||
m68k->c_flag = CFLAG_CLEAR;
|
||||
return;
|
||||
}
|
||||
m68ki_exception_trap(m68k, EXCEPTION_ZERO_DIVIDE);
|
||||
return;
|
||||
}
|
||||
m68ki_exception_illegal(m68k);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
M68KMAKE_OP(divl, 32, ., .)
|
||||
{
|
||||
#if M68K_USE_64_BIT
|
||||
|
||||
if(CPU_TYPE_IS_EC020_PLUS(m68k->cpu_type))
|
||||
{
|
||||
UINT32 word2 = OPER_I_16(m68k);
|
||||
@ -4881,145 +4735,6 @@ M68KMAKE_OP(divl, 32, ., .)
|
||||
return;
|
||||
}
|
||||
m68ki_exception_illegal(m68k);
|
||||
|
||||
#else
|
||||
|
||||
if(CPU_TYPE_IS_EC020_PLUS(m68k->cpu_type))
|
||||
{
|
||||
UINT32 word2 = OPER_I_16(m68k);
|
||||
UINT32 divisor = M68KMAKE_GET_OPER_AY_32;
|
||||
UINT32 dividend_hi = REG_D[word2 & 7];
|
||||
UINT32 dividend_lo = REG_D[(word2 >> 12) & 7];
|
||||
UINT32 quotient = 0;
|
||||
UINT32 remainder = 0;
|
||||
UINT32 dividend_neg = 0;
|
||||
UINT32 divisor_neg = 0;
|
||||
INT32 i;
|
||||
UINT32 overflow;
|
||||
|
||||
if(divisor != 0)
|
||||
{
|
||||
/* quad / long : long quotient, long remainder */
|
||||
if(BIT_A(word2))
|
||||
{
|
||||
if(BIT_B(word2)) /* signed */
|
||||
{
|
||||
/* special case in signed divide */
|
||||
if(dividend_hi == 0 && dividend_lo == 0x80000000 && divisor == 0xffffffff)
|
||||
{
|
||||
REG_D[word2 & 7] = 0;
|
||||
REG_D[(word2 >> 12) & 7] = 0x80000000;
|
||||
|
||||
m68k->n_flag = NFLAG_SET;
|
||||
m68k->not_z_flag = ZFLAG_CLEAR;
|
||||
m68k->v_flag = VFLAG_CLEAR;
|
||||
m68k->c_flag = CFLAG_CLEAR;
|
||||
return;
|
||||
}
|
||||
if(GET_MSB_32(dividend_hi))
|
||||
{
|
||||
dividend_neg = 1;
|
||||
dividend_hi = (UINT32)MASK_OUT_ABOVE_32((-(INT32)dividend_hi) - (dividend_lo != 0));
|
||||
dividend_lo = (UINT32)MASK_OUT_ABOVE_32(-(INT32)dividend_lo);
|
||||
}
|
||||
if(GET_MSB_32(divisor))
|
||||
{
|
||||
divisor_neg = 1;
|
||||
divisor = (UINT32)MASK_OUT_ABOVE_32(-(INT32)divisor);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* if the upper long is greater than the divisor, we're overflowing. */
|
||||
if(dividend_hi >= divisor)
|
||||
{
|
||||
m68k->v_flag = VFLAG_SET;
|
||||
return;
|
||||
}
|
||||
|
||||
for(i = 31; i >= 0; i--)
|
||||
{
|
||||
quotient <<= 1;
|
||||
remainder = (remainder << 1) + ((dividend_hi >> i) & 1);
|
||||
if(remainder >= divisor)
|
||||
{
|
||||
remainder -= divisor;
|
||||
quotient++;
|
||||
}
|
||||
}
|
||||
for(i = 31; i >= 0; i--)
|
||||
{
|
||||
quotient <<= 1;
|
||||
overflow = GET_MSB_32(remainder);
|
||||
remainder = (remainder << 1) + ((dividend_lo >> i) & 1);
|
||||
if(remainder >= divisor || overflow)
|
||||
{
|
||||
remainder -= divisor;
|
||||
quotient++;
|
||||
}
|
||||
}
|
||||
|
||||
if(BIT_B(word2)) /* signed */
|
||||
{
|
||||
if(quotient > 0x7fffffff)
|
||||
{
|
||||
m68k->v_flag = VFLAG_SET;
|
||||
return;
|
||||
}
|
||||
if(dividend_neg)
|
||||
{
|
||||
remainder = (UINT32)MASK_OUT_ABOVE_32(-(INT32)remainder);
|
||||
quotient = (UINT32)MASK_OUT_ABOVE_32(-(INT32)quotient);
|
||||
}
|
||||
if(divisor_neg)
|
||||
quotient = (UINT32)MASK_OUT_ABOVE_32(-(INT32)quotient);
|
||||
}
|
||||
|
||||
REG_D[word2 & 7] = remainder;
|
||||
REG_D[(word2 >> 12) & 7] = quotient;
|
||||
|
||||
m68k->n_flag = NFLAG_32(quotient);
|
||||
m68k->not_z_flag = quotient;
|
||||
m68k->v_flag = VFLAG_CLEAR;
|
||||
m68k->c_flag = CFLAG_CLEAR;
|
||||
return;
|
||||
}
|
||||
|
||||
/* long / long: long quotient, maybe long remainder */
|
||||
if(BIT_B(word2)) /* signed */
|
||||
{
|
||||
/* Special case in divide */
|
||||
if(dividend_lo == 0x80000000 && divisor == 0xffffffff)
|
||||
{
|
||||
m68k->n_flag = NFLAG_SET;
|
||||
m68k->not_z_flag = ZFLAG_CLEAR;
|
||||
m68k->v_flag = VFLAG_CLEAR;
|
||||
m68k->c_flag = CFLAG_CLEAR;
|
||||
REG_D[(word2 >> 12) & 7] = 0x80000000;
|
||||
REG_D[word2 & 7] = 0;
|
||||
return;
|
||||
}
|
||||
REG_D[word2 & 7] = MAKE_INT_32(dividend_lo) % MAKE_INT_32(divisor);
|
||||
quotient = REG_D[(word2 >> 12) & 7] = MAKE_INT_32(dividend_lo) / MAKE_INT_32(divisor);
|
||||
}
|
||||
else
|
||||
{
|
||||
REG_D[word2 & 7] = MASK_OUT_ABOVE_32(dividend_lo) % MASK_OUT_ABOVE_32(divisor);
|
||||
quotient = REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(dividend_lo) / MASK_OUT_ABOVE_32(divisor);
|
||||
}
|
||||
|
||||
m68k->n_flag = NFLAG_32(quotient);
|
||||
m68k->not_z_flag = quotient;
|
||||
m68k->v_flag = VFLAG_CLEAR;
|
||||
m68k->c_flag = CFLAG_CLEAR;
|
||||
return;
|
||||
}
|
||||
m68ki_exception_trap(m68k, EXCEPTION_ZERO_DIVIDE);
|
||||
return;
|
||||
}
|
||||
m68ki_exception_illegal(m68k);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -7541,8 +7256,6 @@ M68KMAKE_OP(mulu, 16, ., .)
|
||||
|
||||
M68KMAKE_OP(mull, 32, ., d)
|
||||
{
|
||||
#if M68K_USE_64_BIT
|
||||
|
||||
if(CPU_TYPE_IS_EC020_PLUS(m68k->cpu_type))
|
||||
{
|
||||
UINT32 word2 = OPER_I_16(m68k);
|
||||
@ -7588,85 +7301,11 @@ M68KMAKE_OP(mull, 32, ., d)
|
||||
return;
|
||||
}
|
||||
m68ki_exception_illegal(m68k);
|
||||
|
||||
#else
|
||||
|
||||
if(CPU_TYPE_IS_EC020_PLUS(m68k->cpu_type))
|
||||
{
|
||||
UINT32 word2 = OPER_I_16(m68k);
|
||||
UINT32 src = DY;
|
||||
UINT32 dst = REG_D[(word2 >> 12) & 7];
|
||||
UINT32 neg = GET_MSB_32(src ^ dst);
|
||||
UINT32 src1;
|
||||
UINT32 src2;
|
||||
UINT32 dst1;
|
||||
UINT32 dst2;
|
||||
UINT32 r1;
|
||||
UINT32 r2;
|
||||
UINT32 r3;
|
||||
UINT32 r4;
|
||||
UINT32 lo;
|
||||
UINT32 hi;
|
||||
|
||||
m68k->c_flag = CFLAG_CLEAR;
|
||||
|
||||
if(BIT_B(word2)) /* signed */
|
||||
{
|
||||
if(GET_MSB_32(src))
|
||||
src = (UINT32)MASK_OUT_ABOVE_32(-(INT32)src);
|
||||
if(GET_MSB_32(dst))
|
||||
dst = (UINT32)MASK_OUT_ABOVE_32(-(INT32)dst);
|
||||
}
|
||||
|
||||
src1 = MASK_OUT_ABOVE_16(src);
|
||||
src2 = src>>16;
|
||||
dst1 = MASK_OUT_ABOVE_16(dst);
|
||||
dst2 = dst>>16;
|
||||
|
||||
|
||||
r1 = src1 * dst1;
|
||||
r2 = src1 * dst2;
|
||||
r3 = src2 * dst1;
|
||||
r4 = src2 * dst2;
|
||||
|
||||
lo = r1 + (MASK_OUT_ABOVE_16(r2)<<16) + (MASK_OUT_ABOVE_16(r3)<<16);
|
||||
hi = r4 + (r2>>16) + (r3>>16) + (((r1>>16) + MASK_OUT_ABOVE_16(r2) + MASK_OUT_ABOVE_16(r3)) >> 16);
|
||||
|
||||
if(BIT_B(word2) && neg)
|
||||
{
|
||||
hi = (UINT32)MASK_OUT_ABOVE_32((-(INT32)hi) - (lo != 0));
|
||||
lo = (UINT32)MASK_OUT_ABOVE_32(-(INT32)lo);
|
||||
}
|
||||
|
||||
if(BIT_A(word2))
|
||||
{
|
||||
REG_D[word2 & 7] = hi;
|
||||
REG_D[(word2 >> 12) & 7] = lo;
|
||||
m68k->n_flag = NFLAG_32(hi);
|
||||
m68k->not_z_flag = hi | lo;
|
||||
m68k->v_flag = VFLAG_CLEAR;
|
||||
return;
|
||||
}
|
||||
|
||||
REG_D[(word2 >> 12) & 7] = lo;
|
||||
m68k->n_flag = NFLAG_32(lo);
|
||||
m68k->not_z_flag = lo;
|
||||
if(BIT_B(word2))
|
||||
m68k->v_flag = (!((GET_MSB_32(lo) && hi == 0xffffffff) || (!GET_MSB_32(lo) && !hi)))<<7;
|
||||
else
|
||||
m68k->v_flag = (hi != 0) << 7;
|
||||
return;
|
||||
}
|
||||
m68ki_exception_illegal(m68k);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
M68KMAKE_OP(mull, 32, ., .)
|
||||
{
|
||||
#if M68K_USE_64_BIT
|
||||
|
||||
if(CPU_TYPE_IS_EC020_PLUS(m68k->cpu_type))
|
||||
{
|
||||
UINT32 word2 = OPER_I_16(m68k);
|
||||
@ -7712,78 +7351,6 @@ M68KMAKE_OP(mull, 32, ., .)
|
||||
return;
|
||||
}
|
||||
m68ki_exception_illegal(m68k);
|
||||
|
||||
#else
|
||||
|
||||
if(CPU_TYPE_IS_EC020_PLUS(m68k->cpu_type))
|
||||
{
|
||||
UINT32 word2 = OPER_I_16(m68k);
|
||||
UINT32 src = M68KMAKE_GET_OPER_AY_32;
|
||||
UINT32 dst = REG_D[(word2 >> 12) & 7];
|
||||
UINT32 neg = GET_MSB_32(src ^ dst);
|
||||
UINT32 src1;
|
||||
UINT32 src2;
|
||||
UINT32 dst1;
|
||||
UINT32 dst2;
|
||||
UINT32 r1;
|
||||
UINT32 r2;
|
||||
UINT32 r3;
|
||||
UINT32 r4;
|
||||
UINT32 lo;
|
||||
UINT32 hi;
|
||||
|
||||
m68k->c_flag = CFLAG_CLEAR;
|
||||
|
||||
if(BIT_B(word2)) /* signed */
|
||||
{
|
||||
if(GET_MSB_32(src))
|
||||
src = (UINT32)MASK_OUT_ABOVE_32(-(INT32)src);
|
||||
if(GET_MSB_32(dst))
|
||||
dst = (UINT32)MASK_OUT_ABOVE_32(-(INT32)dst);
|
||||
}
|
||||
|
||||
src1 = MASK_OUT_ABOVE_16(src);
|
||||
src2 = src>>16;
|
||||
dst1 = MASK_OUT_ABOVE_16(dst);
|
||||
dst2 = dst>>16;
|
||||
|
||||
|
||||
r1 = src1 * dst1;
|
||||
r2 = src1 * dst2;
|
||||
r3 = src2 * dst1;
|
||||
r4 = src2 * dst2;
|
||||
|
||||
lo = r1 + (MASK_OUT_ABOVE_16(r2)<<16) + (MASK_OUT_ABOVE_16(r3)<<16);
|
||||
hi = r4 + (r2>>16) + (r3>>16) + (((r1>>16) + MASK_OUT_ABOVE_16(r2) + MASK_OUT_ABOVE_16(r3)) >> 16);
|
||||
|
||||
if(BIT_B(word2) && neg)
|
||||
{
|
||||
hi = (UINT32)MASK_OUT_ABOVE_32((-(INT32)hi) - (lo != 0));
|
||||
lo = (UINT32)MASK_OUT_ABOVE_32(-(INT32)lo);
|
||||
}
|
||||
|
||||
if(BIT_A(word2))
|
||||
{
|
||||
REG_D[word2 & 7] = hi;
|
||||
REG_D[(word2 >> 12) & 7] = lo;
|
||||
m68k->n_flag = NFLAG_32(hi);
|
||||
m68k->not_z_flag = hi | lo;
|
||||
m68k->v_flag = VFLAG_CLEAR;
|
||||
return;
|
||||
}
|
||||
|
||||
REG_D[(word2 >> 12) & 7] = lo;
|
||||
m68k->n_flag = NFLAG_32(lo);
|
||||
m68k->not_z_flag = lo;
|
||||
if(BIT_B(word2))
|
||||
m68k->v_flag = (!((GET_MSB_32(lo) && hi == 0xffffffff) || (!GET_MSB_32(lo) && !hi)))<<7;
|
||||
else
|
||||
m68k->v_flag = (hi != 0) << 7;
|
||||
return;
|
||||
}
|
||||
m68ki_exception_illegal(m68k);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -8437,7 +8004,8 @@ M68KMAKE_OP(reset, 0, ., .)
|
||||
{
|
||||
if(m68k->s_flag)
|
||||
{
|
||||
(*m68k->reset_instr_callback)();
|
||||
if (m68k->reset_instr_callback != NULL)
|
||||
(*m68k->reset_instr_callback)(m68k->device);
|
||||
USE_CYCLES(m68k, m68k->cyc_reset);
|
||||
return;
|
||||
}
|
||||
@ -8814,8 +8382,6 @@ M68KMAKE_OP(roxr, 16, s, .)
|
||||
|
||||
M68KMAKE_OP(roxr, 32, s, .)
|
||||
{
|
||||
#if M68K_USE_64_BIT
|
||||
|
||||
UINT32* r_dst = &DY;
|
||||
UINT32 shift = (((m68k->ir >> 9) - 1) & 7) + 1;
|
||||
UINT64 src = *r_dst;
|
||||
@ -8834,26 +8400,6 @@ M68KMAKE_OP(roxr, 32, s, .)
|
||||
m68k->n_flag = NFLAG_32(res);
|
||||
m68k->not_z_flag = res;
|
||||
m68k->v_flag = VFLAG_CLEAR;
|
||||
|
||||
#else
|
||||
|
||||
UINT32* r_dst = &DY;
|
||||
UINT32 shift = (((m68k->ir >> 9) - 1) & 7) + 1;
|
||||
UINT32 src = *r_dst;
|
||||
UINT32 res = MASK_OUT_ABOVE_32((ROR_33(src, shift) & ~(1 << (32 - shift))) | (XFLAG_AS_1(m68k) << (32 - shift)));
|
||||
UINT32 new_x_flag = src & (1 << (shift - 1));
|
||||
|
||||
if(shift != 0)
|
||||
USE_CYCLES(m68k, shift<<m68k->cyc_shift);
|
||||
|
||||
*r_dst = res;
|
||||
|
||||
m68k->c_flag = m68k->x_flag = (new_x_flag != 0)<<8;
|
||||
m68k->n_flag = NFLAG_32(res);
|
||||
m68k->not_z_flag = res;
|
||||
m68k->v_flag = VFLAG_CLEAR;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -8919,8 +8465,6 @@ M68KMAKE_OP(roxr, 16, r, .)
|
||||
|
||||
M68KMAKE_OP(roxr, 32, r, .)
|
||||
{
|
||||
#if M68K_USE_64_BIT
|
||||
|
||||
UINT32* r_dst = &DY;
|
||||
UINT32 orig_shift = DX & 0x3f;
|
||||
|
||||
@ -8948,32 +8492,6 @@ M68KMAKE_OP(roxr, 32, r, .)
|
||||
m68k->n_flag = NFLAG_32(*r_dst);
|
||||
m68k->not_z_flag = *r_dst;
|
||||
m68k->v_flag = VFLAG_CLEAR;
|
||||
|
||||
#else
|
||||
|
||||
UINT32* r_dst = &DY;
|
||||
UINT32 orig_shift = DX & 0x3f;
|
||||
UINT32 shift = orig_shift % 33;
|
||||
UINT32 src = *r_dst;
|
||||
UINT32 res = MASK_OUT_ABOVE_32((ROR_33(src, shift) & ~(1 << (32 - shift))) | (XFLAG_AS_1(m68k) << (32 - shift)));
|
||||
UINT32 new_x_flag = src & (1 << (shift - 1));
|
||||
|
||||
if(orig_shift != 0)
|
||||
USE_CYCLES(m68k, orig_shift<<m68k->cyc_shift);
|
||||
|
||||
if(shift != 0)
|
||||
{
|
||||
*r_dst = res;
|
||||
m68k->x_flag = (new_x_flag != 0)<<8;
|
||||
}
|
||||
else
|
||||
res = src;
|
||||
m68k->c_flag = m68k->x_flag;
|
||||
m68k->n_flag = NFLAG_32(res);
|
||||
m68k->not_z_flag = res;
|
||||
m68k->v_flag = VFLAG_CLEAR;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -9038,8 +8556,6 @@ M68KMAKE_OP(roxl, 16, s, .)
|
||||
|
||||
M68KMAKE_OP(roxl, 32, s, .)
|
||||
{
|
||||
#if M68K_USE_64_BIT
|
||||
|
||||
UINT32* r_dst = &DY;
|
||||
UINT32 shift = (((m68k->ir >> 9) - 1) & 7) + 1;
|
||||
UINT64 src = *r_dst;
|
||||
@ -9058,26 +8574,6 @@ M68KMAKE_OP(roxl, 32, s, .)
|
||||
m68k->n_flag = NFLAG_32(res);
|
||||
m68k->not_z_flag = res;
|
||||
m68k->v_flag = VFLAG_CLEAR;
|
||||
|
||||
#else
|
||||
|
||||
UINT32* r_dst = &DY;
|
||||
UINT32 shift = (((m68k->ir >> 9) - 1) & 7) + 1;
|
||||
UINT32 src = *r_dst;
|
||||
UINT32 res = MASK_OUT_ABOVE_32((ROL_33(src, shift) & ~(1 << (shift - 1))) | (XFLAG_AS_1(m68k) << (shift - 1)));
|
||||
UINT32 new_x_flag = src & (1 << (32 - shift));
|
||||
|
||||
if(shift != 0)
|
||||
USE_CYCLES(m68k, shift<<m68k->cyc_shift);
|
||||
|
||||
*r_dst = res;
|
||||
|
||||
m68k->c_flag = m68k->x_flag = (new_x_flag != 0)<<8;
|
||||
m68k->n_flag = NFLAG_32(res);
|
||||
m68k->not_z_flag = res;
|
||||
m68k->v_flag = VFLAG_CLEAR;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -9144,8 +8640,6 @@ M68KMAKE_OP(roxl, 16, r, .)
|
||||
|
||||
M68KMAKE_OP(roxl, 32, r, .)
|
||||
{
|
||||
#if M68K_USE_64_BIT
|
||||
|
||||
UINT32* r_dst = &DY;
|
||||
UINT32 orig_shift = DX & 0x3f;
|
||||
|
||||
@ -9173,32 +8667,6 @@ M68KMAKE_OP(roxl, 32, r, .)
|
||||
m68k->n_flag = NFLAG_32(*r_dst);
|
||||
m68k->not_z_flag = *r_dst;
|
||||
m68k->v_flag = VFLAG_CLEAR;
|
||||
|
||||
#else
|
||||
|
||||
UINT32* r_dst = &DY;
|
||||
UINT32 orig_shift = DX & 0x3f;
|
||||
UINT32 shift = orig_shift % 33;
|
||||
UINT32 src = *r_dst;
|
||||
UINT32 res = MASK_OUT_ABOVE_32((ROL_33(src, shift) & ~(1 << (shift - 1))) | (XFLAG_AS_1(m68k) << (shift - 1)));
|
||||
UINT32 new_x_flag = src & (1 << (32 - shift));
|
||||
|
||||
if(orig_shift != 0)
|
||||
USE_CYCLES(m68k, orig_shift<<m68k->cyc_shift);
|
||||
|
||||
if(shift != 0)
|
||||
{
|
||||
*r_dst = res;
|
||||
m68k->x_flag = (new_x_flag != 0)<<8;
|
||||
}
|
||||
else
|
||||
res = src;
|
||||
m68k->c_flag = m68k->x_flag;
|
||||
m68k->n_flag = NFLAG_32(res);
|
||||
m68k->not_z_flag = res;
|
||||
m68k->v_flag = VFLAG_CLEAR;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -9242,7 +8710,8 @@ M68KMAKE_OP(rte, 32, ., .)
|
||||
UINT32 new_pc;
|
||||
UINT32 format_word;
|
||||
|
||||
(*m68k->rte_instr_callback)();
|
||||
if (m68k->rte_instr_callback != NULL)
|
||||
(*m68k->rte_instr_callback)(m68k->device);
|
||||
m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */
|
||||
|
||||
if(CPU_TYPE_IS_000(m68k->cpu_type))
|
||||
@ -9325,9 +8794,8 @@ M68KMAKE_OP(rtm, 32, ., .)
|
||||
if(CPU_TYPE_IS_020_VARIANT(m68k->cpu_type))
|
||||
{
|
||||
m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */
|
||||
M68K_DO_LOG((M68K_LOG_FILEHANDLE "%s at %08x: called unimplemented instruction %04x (%s)\n",
|
||||
m68ki_cpu_get_names[m68k->cpu_type], REG_PC - 2, m68k->ir,
|
||||
m68k_disassemble_quick(REG_PC - 2)));
|
||||
logerror("%s at %08x: called unimplemented instruction %04x (rtm)\n",
|
||||
m68k->device->tag, REG_PC - 2, m68k->ir);
|
||||
return;
|
||||
}
|
||||
m68ki_exception_illegal(m68k);
|
||||
@ -10192,7 +9660,7 @@ M68KMAKE_OP(tas, 8, ., .)
|
||||
{
|
||||
UINT32 ea = M68KMAKE_GET_EA_AY_8;
|
||||
UINT32 dst = m68ki_read_8(m68k, ea);
|
||||
UINT32 allow_writeback;
|
||||
UINT32 allow_writeback = TRUE;
|
||||
|
||||
m68k->not_z_flag = dst;
|
||||
m68k->n_flag = NFLAG_8(dst);
|
||||
@ -10203,9 +9671,11 @@ M68KMAKE_OP(tas, 8, ., .)
|
||||
disabled in order to function properly. Some Amiga software may also rely
|
||||
on this, but only when accessing specific addresses so additional functionality
|
||||
will be needed. */
|
||||
allow_writeback = (*m68k->tas_instr_callback)();
|
||||
if (m68k->tas_instr_callback != NULL)
|
||||
allow_writeback = (*m68k->tas_instr_callback)(m68k->device);
|
||||
|
||||
if (allow_writeback==1) m68ki_write_8(m68k, ea, dst | 0x80);
|
||||
if (allow_writeback)
|
||||
m68ki_write_8(m68k, ea, dst | 0x80);
|
||||
}
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,10 +1,9 @@
|
||||
#include <stdio.h>
|
||||
/* ======================================================================== */
|
||||
/* ========================= LICENSING & COPYRIGHT ======================== */
|
||||
/* ======================================================================== */
|
||||
/*
|
||||
* MUSASHI
|
||||
* Version 3.32
|
||||
* Version 4.00
|
||||
*
|
||||
* A portable Motorola M680x0 processor emulation engine.
|
||||
* Copyright Karl Stenerud. All rights reserved.
|
||||
@ -28,8 +27,9 @@
|
||||
|
||||
typedef struct _m68ki_cpu_core m68ki_cpu_core;
|
||||
|
||||
#include "devintrf.h"
|
||||
#include "m68k.h"
|
||||
#include "cpuintrf.h"
|
||||
#include "m68000.h"
|
||||
|
||||
#include <limits.h>
|
||||
#include <setjmp.h>
|
||||
|
||||
@ -140,9 +140,7 @@ typedef struct _m68ki_cpu_core m68ki_cpu_core;
|
||||
#define GET_MSB_16(A) ((A) & 0x8000)
|
||||
#define GET_MSB_17(A) ((A) & 0x10000)
|
||||
#define GET_MSB_32(A) ((A) & 0x80000000)
|
||||
#if M68K_USE_64_BIT
|
||||
#define GET_MSB_33(A) ((A) & 0x100000000)
|
||||
#endif /* M68K_USE_64_BIT */
|
||||
#define GET_MSB_33(A) ((A) & U64(0x100000000))
|
||||
|
||||
/* Isolate nibbles */
|
||||
#define LOW_NIBBLE(A) ((A) & 0x0f)
|
||||
@ -157,13 +155,8 @@ typedef struct _m68ki_cpu_core m68ki_cpu_core;
|
||||
#define MASK_OUT_BELOW_16(A) ((A) & ~0xffff)
|
||||
|
||||
/* No need to mask if we are 32 bit */
|
||||
#if M68K_USE_64_BIT
|
||||
#define MASK_OUT_ABOVE_32(A) ((A) & 0xffffffff)
|
||||
#define MASK_OUT_BELOW_32(A) ((A) & ~0xffffffff)
|
||||
#else
|
||||
#define MASK_OUT_ABOVE_32(A) (A)
|
||||
#define MASK_OUT_BELOW_32(A) 0
|
||||
#endif /* M68K_INT_GT_32_BIT || M68K_USE_64_BIT */
|
||||
#define MASK_OUT_ABOVE_32(A) ((A) & U64(0xffffffff))
|
||||
#define MASK_OUT_BELOW_32(A) ((A) & ~U64(0xffffffff))
|
||||
|
||||
/* Shift & Rotate Macros. */
|
||||
#define LSL(A, C) ((A) << (C))
|
||||
@ -175,12 +168,10 @@ typedef struct _m68ki_cpu_core m68ki_cpu_core;
|
||||
#define LSR_32(A, C) ((C) < 32 ? (A) >> (C) : 0)
|
||||
#define LSL_32(A, C) ((C) < 32 ? (A) << (C) : 0)
|
||||
|
||||
#if M68K_USE_64_BIT
|
||||
#define LSL_32_64(A, C) ((A) << (C))
|
||||
#define LSR_32_64(A, C) ((A) >> (C))
|
||||
#define ROL_33_64(A, C) (LSL_32_64(A, C) | LSR_32_64(A, 33-(C)))
|
||||
#define ROR_33_64(A, C) (LSR_32_64(A, C) | LSL_32_64(A, 33-(C)))
|
||||
#endif /* M68K_USE_64_BIT */
|
||||
#define LSL_32_64(A, C) ((A) << (C))
|
||||
#define LSR_32_64(A, C) ((A) >> (C))
|
||||
#define ROL_33_64(A, C) (LSL_32_64(A, C) | LSR_32_64(A, 33-(C)))
|
||||
#define ROR_33_64(A, C) (LSR_32_64(A, C) | LSL_32_64(A, 33-(C)))
|
||||
|
||||
#define ROL_8(A, C) MASK_OUT_ABOVE_8(LSL(A, C) | LSR(A, 8-(C)))
|
||||
#define ROL_9(A, C) (LSL(A, C) | LSR(A, 9-(C)))
|
||||
@ -223,70 +214,26 @@ typedef struct _m68ki_cpu_core m68ki_cpu_core;
|
||||
/* These defines are dependant on the configuration defines in m68kconf.h */
|
||||
|
||||
/* Disable certain comparisons if we're not using all CPU types */
|
||||
#if HAS_M68040
|
||||
#define CPU_TYPE_IS_040_PLUS(A) ((A) & CPU_TYPE_040)
|
||||
#define CPU_TYPE_IS_040_LESS(A) 1
|
||||
#else
|
||||
#define CPU_TYPE_IS_040_PLUS(A) 0
|
||||
#define CPU_TYPE_IS_040_LESS(A) 1
|
||||
#endif
|
||||
#define CPU_TYPE_IS_040_PLUS(A) ((A) & CPU_TYPE_040)
|
||||
#define CPU_TYPE_IS_040_LESS(A) 1
|
||||
|
||||
#if HAS_M68020
|
||||
#define CPU_TYPE_IS_020_PLUS(A) ((A) & (CPU_TYPE_020 | CPU_TYPE_040))
|
||||
#define CPU_TYPE_IS_020_LESS(A) 1
|
||||
#else
|
||||
#define CPU_TYPE_IS_020_PLUS(A) 0
|
||||
#define CPU_TYPE_IS_020_LESS(A) 1
|
||||
#endif
|
||||
#define CPU_TYPE_IS_020_PLUS(A) ((A) & (CPU_TYPE_020 | CPU_TYPE_040))
|
||||
#define CPU_TYPE_IS_020_LESS(A) 1
|
||||
|
||||
#if HAS_M68EC020
|
||||
#define CPU_TYPE_IS_EC020_PLUS(A) ((A) & (CPU_TYPE_EC020 | CPU_TYPE_020 | CPU_TYPE_040))
|
||||
#define CPU_TYPE_IS_EC020_LESS(A) ((A) & (CPU_TYPE_000 | CPU_TYPE_008 | CPU_TYPE_010 | CPU_TYPE_EC020))
|
||||
#else
|
||||
#define CPU_TYPE_IS_EC020_PLUS(A) CPU_TYPE_IS_020_PLUS(A)
|
||||
#define CPU_TYPE_IS_EC020_LESS(A) CPU_TYPE_IS_020_LESS(A)
|
||||
#endif
|
||||
#define CPU_TYPE_IS_020_VARIANT(A) ((A) & (CPU_TYPE_EC020 | CPU_TYPE_020))
|
||||
|
||||
#if HAS_M68010
|
||||
#define CPU_TYPE_IS_010(A) ((A) == CPU_TYPE_010)
|
||||
#define CPU_TYPE_IS_010_PLUS(A) ((A) & (CPU_TYPE_010 | CPU_TYPE_EC020 | CPU_TYPE_020 | CPU_TYPE_040))
|
||||
#define CPU_TYPE_IS_010_LESS(A) ((A) & (CPU_TYPE_000 | CPU_TYPE_008 | CPU_TYPE_010))
|
||||
#else
|
||||
#define CPU_TYPE_IS_010(A) 0
|
||||
#define CPU_TYPE_IS_010_PLUS(A) CPU_TYPE_IS_EC020_PLUS(A)
|
||||
#define CPU_TYPE_IS_010_LESS(A) CPU_TYPE_IS_EC020_LESS(A)
|
||||
#endif
|
||||
#define CPU_TYPE_IS_EC020_PLUS(A) ((A) & (CPU_TYPE_EC020 | CPU_TYPE_020 | CPU_TYPE_040))
|
||||
#define CPU_TYPE_IS_EC020_LESS(A) ((A) & (CPU_TYPE_000 | CPU_TYPE_008 | CPU_TYPE_010 | CPU_TYPE_EC020))
|
||||
|
||||
#if HAS_M68020 || HAS_M68EC020
|
||||
#define CPU_TYPE_IS_020_VARIANT(A) ((A) & (CPU_TYPE_EC020 | CPU_TYPE_020))
|
||||
#else
|
||||
#define CPU_TYPE_IS_020_VARIANT(A) 0
|
||||
#endif
|
||||
#define CPU_TYPE_IS_010(A) ((A) == CPU_TYPE_010)
|
||||
#define CPU_TYPE_IS_010_PLUS(A) ((A) & (CPU_TYPE_010 | CPU_TYPE_EC020 | CPU_TYPE_020 | CPU_TYPE_040))
|
||||
#define CPU_TYPE_IS_010_LESS(A) ((A) & (CPU_TYPE_000 | CPU_TYPE_008 | CPU_TYPE_010))
|
||||
|
||||
#if HAS_M68040 || HAS_M68020 || HAS_M68EC020 || HAS_M68010
|
||||
#define CPU_TYPE_IS_000(A) ((A) == CPU_TYPE_000 || (A) == CPU_TYPE_008)
|
||||
#else
|
||||
#define CPU_TYPE_IS_000(A) 1
|
||||
#endif
|
||||
#define CPU_TYPE_IS_000(A) ((A) == CPU_TYPE_000 || (A) == CPU_TYPE_008)
|
||||
|
||||
|
||||
/* Enable or disable function code emulation */
|
||||
#if M68K_EMULATE_FC
|
||||
#if M68K_EMULATE_FC == OPT_SPECIFY_HANDLER
|
||||
#define m68ki_set_fc(A) M68K_SET_FC_CALLBACK(A)
|
||||
#else
|
||||
#define m68ki_set_fc(A) m68k->set_fc_callback(A)
|
||||
#endif
|
||||
#define m68ki_use_data_space(M) (M)->address_space = FUNCTION_CODE_USER_DATA
|
||||
#define m68ki_use_program_space(M) (M)->address_space = FUNCTION_CODE_USER_PROGRAM
|
||||
#define m68ki_get_address_space(M) (M)->address_space
|
||||
#else
|
||||
#define m68ki_set_fc(A)
|
||||
#define m68ki_use_data_space(M)
|
||||
#define m68ki_use_program_space(M)
|
||||
#define m68ki_get_address_space(M) FUNCTION_CODE_USER_DATA
|
||||
#endif /* M68K_EMULATE_FC */
|
||||
|
||||
/* Configuration switches (see m68kconf.h for explanation) */
|
||||
#define M68K_EMULATE_TRACE 0
|
||||
|
||||
/* Enable or disable trace emulation */
|
||||
#if M68K_EMULATE_TRACE
|
||||
@ -328,23 +275,6 @@ typedef struct _m68ki_cpu_core m68ki_cpu_core;
|
||||
longjmp(m68k->aerr_trap, 1); \
|
||||
}
|
||||
|
||||
/* Logging */
|
||||
#if M68K_LOG_ENABLE
|
||||
#include <stdio.h>
|
||||
extern FILE* M68K_LOG_FILEHANDLE
|
||||
extern const char *const m68ki_cpu_get_names[];
|
||||
|
||||
#define M68K_DO_LOG(A) if(M68K_LOG_FILEHANDLE) fprintf A
|
||||
#if M68K_LOG_1010_1111
|
||||
#define M68K_DO_LOG_EMU(A) if(M68K_LOG_FILEHANDLE) fprintf A
|
||||
#else
|
||||
#define M68K_DO_LOG_EMU(A)
|
||||
#endif
|
||||
#else
|
||||
#define M68K_DO_LOG(A)
|
||||
#define M68K_DO_LOG_EMU(A)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* -------------------------- EA / Operand Access ------------------------- */
|
||||
@ -537,9 +467,9 @@ typedef struct _m68ki_cpu_core m68ki_cpu_core;
|
||||
/* ----------------------------- Read / Write ----------------------------- */
|
||||
|
||||
/* Read from the current address space */
|
||||
#define m68ki_read_8(M, A) m68ki_read_8_fc (M, A, m68k->s_flag | m68ki_get_address_space(M))
|
||||
#define m68ki_read_16(M, A) m68ki_read_16_fc(M, A, m68k->s_flag | m68ki_get_address_space(M))
|
||||
#define m68ki_read_32(M, A) m68ki_read_32_fc(M, A, m68k->s_flag | m68ki_get_address_space(M))
|
||||
#define m68ki_read_8(M, A) m68ki_read_8_fc (M, A, m68k->s_flag | FUNCTION_CODE_USER_DATA)
|
||||
#define m68ki_read_16(M, A) m68ki_read_16_fc(M, A, m68k->s_flag | FUNCTION_CODE_USER_DATA)
|
||||
#define m68ki_read_32(M, A) m68ki_read_32_fc(M, A, m68k->s_flag | FUNCTION_CODE_USER_DATA)
|
||||
|
||||
/* Write to the current data space */
|
||||
#define m68ki_write_8(M, A, V) m68ki_write_8_fc (M, A, m68k->s_flag | FUNCTION_CODE_USER_DATA, V)
|
||||
@ -578,10 +508,25 @@ union _fp_reg
|
||||
double f;
|
||||
};
|
||||
|
||||
/* Redirect memory calls */
|
||||
|
||||
typedef struct _m68k_memory_interface m68k_memory_interface;
|
||||
struct _m68k_memory_interface
|
||||
{
|
||||
offs_t opcode_xor; // Address Calculation
|
||||
UINT16 (*readimm16)(const address_space *, offs_t); // Immediate read 16 bit
|
||||
UINT8 (*read8)(const address_space *, offs_t); // Normal read 8 bit
|
||||
UINT16 (*read16)(const address_space *, offs_t); // Normal read 16 bit
|
||||
UINT32 (*read32)(const address_space *, offs_t); // Normal read 32 bit
|
||||
void (*write8)(const address_space *, offs_t, UINT8); // Write 8 bit
|
||||
void (*write16)(const address_space *, offs_t, UINT16); // Write 16 bit
|
||||
void (*write32)(const address_space *, offs_t, UINT32); // Write 32 bit
|
||||
};
|
||||
|
||||
struct _m68ki_cpu_core
|
||||
{
|
||||
UINT32 cpu_type; /* CPU Type: 68000, 68008, 68010, 68EC020, or 68020 */
|
||||
UINT32 dasm_type; /* disassembly type */
|
||||
UINT32 dar[16]; /* Data and Address Registers */
|
||||
UINT32 ppc; /* Previous program counter */
|
||||
UINT32 pc; /* Program Counter */
|
||||
@ -643,20 +588,23 @@ struct _m68ki_cpu_core
|
||||
const UINT8* cyc_exception;
|
||||
|
||||
/* Callbacks to host */
|
||||
int (*int_ack_callback)(void *param, int int_line);/* Interrupt Acknowledge */
|
||||
void *int_ack_param;
|
||||
void (*bkpt_ack_callback)(unsigned int data); /* Breakpoint Acknowledge */
|
||||
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 (*rte_instr_callback)(void); /* Called when a RTE instruction is encountered */
|
||||
int (*tas_instr_callback)(void); /* Called when a TAS instruction is encountered, allows / disallows writeback */
|
||||
void (*set_fc_callback)(unsigned int new_fc); /* Called when the CPU function code changes */
|
||||
cpu_irq_callback int_ack_callback; /* Interrupt Acknowledge */
|
||||
m68k_bkpt_ack_func bkpt_ack_callback; /* Breakpoint Acknowledge */
|
||||
m68k_reset_func reset_instr_callback; /* Called when a RESET instruction is encountered */
|
||||
m68k_cmpild_func cmpild_instr_callback; /* Called when a CMPI.L #v, Dn instruction is encountered */
|
||||
m68k_rte_func rte_instr_callback; /* Called when a RTE instruction is encountered */
|
||||
m68k_tas_func tas_instr_callback; /* Called when a TAS instruction is encountered, allows / disallows writeback */
|
||||
|
||||
const device_config *device;
|
||||
const address_space *program;
|
||||
m68k_memory_interface memory;
|
||||
offs_t encrypted_start;
|
||||
offs_t encrypted_end;
|
||||
|
||||
/* save state data */
|
||||
UINT16 save_sr;
|
||||
UINT8 save_stopped;
|
||||
UINT8 save_halted;
|
||||
};
|
||||
|
||||
|
||||
@ -840,7 +788,6 @@ INLINE UINT32 m68ki_read_imm_16(m68ki_cpu_core *m68k)
|
||||
{
|
||||
UINT32 result;
|
||||
|
||||
m68ki_set_fc(m68k->s_flag | FUNCTION_CODE_USER_PROGRAM); /* auto-disable (see m68kcpu.h) */
|
||||
m68ki_check_address_error(m68k, REG_PC, MODE_READ, m68k->s_flag | FUNCTION_CODE_USER_PROGRAM); /* auto-disable (see m68kcpu.h) */
|
||||
|
||||
if(REG_PC != m68k->pref_addr)
|
||||
@ -859,7 +806,6 @@ INLINE UINT32 m68ki_read_imm_32(m68ki_cpu_core *m68k)
|
||||
{
|
||||
UINT32 temp_val;
|
||||
|
||||
m68ki_set_fc(m68k->s_flag | FUNCTION_CODE_USER_PROGRAM); /* auto-disable (see m68kcpu.h) */
|
||||
m68ki_check_address_error(m68k, REG_PC, MODE_READ, m68k->s_flag | FUNCTION_CODE_USER_PROGRAM); /* auto-disable (see m68kcpu.h) */
|
||||
|
||||
if(REG_PC != m68k->pref_addr)
|
||||
@ -892,12 +838,10 @@ INLINE UINT32 m68ki_read_imm_32(m68ki_cpu_core *m68k)
|
||||
*/
|
||||
INLINE UINT32 m68ki_read_8_fc(m68ki_cpu_core *m68k, UINT32 address, UINT32 fc)
|
||||
{
|
||||
m68ki_set_fc(fc); /* auto-disable (see m68kcpu.h) */
|
||||
return (*m68k->memory.read8)(m68k->program, address);
|
||||
}
|
||||
INLINE UINT32 m68ki_read_16_fc(m68ki_cpu_core *m68k, UINT32 address, UINT32 fc)
|
||||
{
|
||||
m68ki_set_fc(fc); /* auto-disable (see m68kcpu.h) */
|
||||
if (CPU_TYPE_IS_010_LESS(m68k->cpu_type))
|
||||
{
|
||||
m68ki_check_address_error(m68k, address, MODE_READ, fc);
|
||||
@ -906,7 +850,6 @@ INLINE UINT32 m68ki_read_16_fc(m68ki_cpu_core *m68k, UINT32 address, UINT32 fc)
|
||||
}
|
||||
INLINE UINT32 m68ki_read_32_fc(m68ki_cpu_core *m68k, UINT32 address, UINT32 fc)
|
||||
{
|
||||
m68ki_set_fc(fc); /* auto-disable (see m68kcpu.h) */
|
||||
if (CPU_TYPE_IS_010_LESS(m68k->cpu_type))
|
||||
{
|
||||
m68ki_check_address_error(m68k, address, MODE_READ, fc);
|
||||
@ -916,12 +859,10 @@ INLINE UINT32 m68ki_read_32_fc(m68ki_cpu_core *m68k, UINT32 address, UINT32 fc)
|
||||
|
||||
INLINE void m68ki_write_8_fc(m68ki_cpu_core *m68k, UINT32 address, UINT32 fc, UINT32 value)
|
||||
{
|
||||
m68ki_set_fc(fc); /* auto-disable (see m68kcpu.h) */
|
||||
(*m68k->memory.write8)(m68k->program, address, value);
|
||||
}
|
||||
INLINE void m68ki_write_16_fc(m68ki_cpu_core *m68k, UINT32 address, UINT32 fc, UINT32 value)
|
||||
{
|
||||
m68ki_set_fc(fc); /* auto-disable (see m68kcpu.h) */
|
||||
if (CPU_TYPE_IS_010_LESS(m68k->cpu_type))
|
||||
{
|
||||
m68ki_check_address_error(m68k, address, MODE_WRITE, fc);
|
||||
@ -930,7 +871,6 @@ INLINE void m68ki_write_16_fc(m68ki_cpu_core *m68k, UINT32 address, UINT32 fc, U
|
||||
}
|
||||
INLINE void m68ki_write_32_fc(m68ki_cpu_core *m68k, UINT32 address, UINT32 fc, UINT32 value)
|
||||
{
|
||||
m68ki_set_fc(fc); /* auto-disable (see m68kcpu.h) */
|
||||
if (CPU_TYPE_IS_010_LESS(m68k->cpu_type))
|
||||
{
|
||||
m68ki_check_address_error(m68k, address, MODE_WRITE, fc);
|
||||
@ -945,7 +885,6 @@ INLINE void m68ki_write_32_fc(m68ki_cpu_core *m68k, UINT32 address, UINT32 fc, U
|
||||
*/
|
||||
INLINE void m68ki_write_32_pd_fc(m68ki_cpu_core *m68k, UINT32 address, UINT32 fc, UINT32 value)
|
||||
{
|
||||
m68ki_set_fc(fc); /* auto-disable (see m68kcpu.h) */
|
||||
if (CPU_TYPE_IS_010_LESS(m68k->cpu_type))
|
||||
{
|
||||
m68ki_check_address_error(m68k, address, MODE_WRITE, fc);
|
||||
@ -963,14 +902,12 @@ INLINE void m68ki_write_32_pd_fc(m68ki_cpu_core *m68k, UINT32 address, UINT32 fc
|
||||
INLINE UINT32 m68ki_get_ea_pcdi(m68ki_cpu_core *m68k)
|
||||
{
|
||||
UINT32 old_pc = REG_PC;
|
||||
m68ki_use_program_space(m68k); /* auto-disable */
|
||||
return old_pc + MAKE_INT_16(m68ki_read_imm_16(m68k));
|
||||
}
|
||||
|
||||
|
||||
INLINE UINT32 m68ki_get_ea_pcix(m68ki_cpu_core *m68k)
|
||||
{
|
||||
m68ki_use_program_space(m68k); /* auto-disable */
|
||||
return m68ki_get_ea_ix(m68k, REG_PC);
|
||||
}
|
||||
|
||||
@ -1645,11 +1582,6 @@ INLINE void m68ki_exception_privilege_violation(m68ki_cpu_core *m68k)
|
||||
INLINE void m68ki_exception_1010(m68ki_cpu_core *m68k)
|
||||
{
|
||||
UINT32 sr;
|
||||
#if M68K_LOG_1010_1111 == OPT_ON
|
||||
M68K_DO_LOG_EMU((M68K_LOG_FILEHANDLE "%s at %08x: called 1010 instruction %04x (%s)\n",
|
||||
m68ki_cpu_get_names[m68k->cpu_type], REG_PPC, m68k->ir,
|
||||
m68ki_disassemble_quick(REG_PPC)));
|
||||
#endif
|
||||
|
||||
sr = m68ki_init_exception(m68k);
|
||||
m68ki_stack_frame_0000(m68k, REG_PPC, sr, EXCEPTION_1010);
|
||||
@ -1664,12 +1596,6 @@ INLINE void m68ki_exception_1111(m68ki_cpu_core *m68k)
|
||||
{
|
||||
UINT32 sr;
|
||||
|
||||
#if M68K_LOG_1010_1111 == OPT_ON
|
||||
M68K_DO_LOG_EMU((M68K_LOG_FILEHANDLE "%s at %08x: called 1111 instruction %04x (%s)\n",
|
||||
m68ki_cpu_get_names[m68k->cpu_type], REG_PPC, m68k->ir,
|
||||
m68ki_disassemble_quick(REG_PPC)));
|
||||
#endif
|
||||
|
||||
sr = m68ki_init_exception(m68k);
|
||||
m68ki_stack_frame_0000(m68k, REG_PPC, sr, EXCEPTION_1111);
|
||||
m68ki_jump_vector(m68k, EXCEPTION_1111);
|
||||
@ -1683,10 +1609,6 @@ INLINE void m68ki_exception_illegal(m68ki_cpu_core *m68k)
|
||||
{
|
||||
UINT32 sr;
|
||||
|
||||
M68K_DO_LOG((M68K_LOG_FILEHANDLE "%s at %08x: illegal instruction %04x (%s)\n",
|
||||
m68ki_cpu_get_names[m68k->cpu_type], REG_PPC, m68k->ir,
|
||||
m68ki_disassemble_quick(REG_PPC)));
|
||||
|
||||
sr = m68ki_init_exception(m68k);
|
||||
|
||||
if(CPU_TYPE_IS_000(m68k->cpu_type))
|
||||
@ -1759,7 +1681,7 @@ void m68ki_exception_interrupt(m68ki_cpu_core *m68k, UINT32 int_level)
|
||||
return;
|
||||
|
||||
/* Acknowledge the interrupt */
|
||||
vector = (*m68k->int_ack_callback)(m68k->int_ack_param, int_level);
|
||||
vector = (*m68k->int_ack_callback)(m68k->device, int_level);
|
||||
|
||||
/* Get the interrupt vector */
|
||||
if(vector == M68K_INT_ACK_AUTOVECTOR)
|
||||
@ -1769,11 +1691,7 @@ void m68ki_exception_interrupt(m68ki_cpu_core *m68k, UINT32 int_level)
|
||||
/* Called if no devices respond to the interrupt acknowledge */
|
||||
vector = EXCEPTION_SPURIOUS_INTERRUPT;
|
||||
else if(vector > 255)
|
||||
{
|
||||
M68K_DO_LOG_EMU((M68K_LOG_FILEHANDLE "%s at %08x: Interrupt acknowledge returned invalid vector $%x\n",
|
||||
m68ki_cpu_get_names[m68k->cpu_type], REG_PC, vector));
|
||||
return;
|
||||
}
|
||||
|
||||
/* Start exception processing */
|
||||
sr = m68ki_init_exception(m68k);
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#define m68ki_cpu_core void
|
||||
#include "m68k.h"
|
||||
#include "m68000.h"
|
||||
|
||||
#ifndef DECL_SPEC
|
||||
#define DECL_SPEC
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "cpuintrf.h"
|
||||
#include <math.h>
|
||||
|
||||
#define FPCC_N 0x08000000
|
||||
#define FPCC_Z 0x04000000
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,37 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef __M68KMAME_H__
|
||||
#define __M68KMAME_H__
|
||||
|
||||
/* ======================================================================== */
|
||||
/* ============================== MAME STUFF ============================== */
|
||||
/* ======================================================================== */
|
||||
|
||||
#include "debugger.h"
|
||||
#include "deprecat.h"
|
||||
#include "m68000.h"
|
||||
|
||||
#define OPT_ON 1
|
||||
#define OPT_OFF 0
|
||||
|
||||
/* Configuration switches (see m68kconf.h for explanation) */
|
||||
#define M68K_EMULATE_TRACE OPT_OFF
|
||||
|
||||
#define M68K_EMULATE_FC OPT_OFF
|
||||
#define M68K_SET_FC_CALLBACK(A)
|
||||
|
||||
#define M68K_LOG_ENABLE OPT_OFF
|
||||
#define M68K_LOG_1010_1111 OPT_OFF
|
||||
#define M68K_LOG_FILEHANDLE errorlog
|
||||
|
||||
#define M68K_USE_64_BIT OPT_OFF
|
||||
|
||||
|
||||
void m68k_set_encrypted_opcode_range(const device_config *device, offs_t start, offs_t end);
|
||||
|
||||
|
||||
/* ======================================================================== */
|
||||
/* ============================== END OF FILE ============================= */
|
||||
/* ======================================================================== */
|
||||
|
||||
#endif /* __M68KMAME_H__ */
|
@ -492,22 +492,12 @@ static const struct
|
||||
#if (HAS_KONAMI)
|
||||
{ CPU_KONAMI, CPU_GET_INFO_NAME(konami) },
|
||||
#endif
|
||||
#if (HAS_M68000)
|
||||
#if (HAS_M680X0)
|
||||
{ CPU_M68000, CPU_GET_INFO_NAME(m68000) },
|
||||
#endif
|
||||
#if (HAS_M68008)
|
||||
{ CPU_M68008, CPU_GET_INFO_NAME(m68008) },
|
||||
#endif
|
||||
#if (HAS_M68010)
|
||||
{ CPU_M68010, CPU_GET_INFO_NAME(m68010) },
|
||||
#endif
|
||||
#if (HAS_M68EC020)
|
||||
{ CPU_M68EC020, CPU_GET_INFO_NAME(m68ec020) },
|
||||
#endif
|
||||
#if (HAS_M68020)
|
||||
{ CPU_M68020, CPU_GET_INFO_NAME(m68020) },
|
||||
#endif
|
||||
#if (HAS_M68040)
|
||||
{ CPU_M68040, CPU_GET_INFO_NAME(m68040) },
|
||||
#endif
|
||||
#if (HAS_T11)
|
||||
|
@ -128,11 +128,11 @@ static INTERRUPT_GEN(bishi_interrupt)
|
||||
switch (cpu_getiloops(device))
|
||||
{
|
||||
case 0:
|
||||
cpu_set_input_line(device, MC68000_IRQ_3, HOLD_LINE);
|
||||
cpu_set_input_line(device, M68K_IRQ_3, HOLD_LINE);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
cpu_set_input_line(device, MC68000_IRQ_4, HOLD_LINE);
|
||||
cpu_set_input_line(device, M68K_IRQ_4, HOLD_LINE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -302,9 +302,9 @@ static MACHINE_RESET( bishi )
|
||||
static void sound_irq_gen(running_machine *machine, int state)
|
||||
{
|
||||
if (state)
|
||||
cpu_set_input_line(machine->cpu[0], MC68000_IRQ_1, ASSERT_LINE);
|
||||
cpu_set_input_line(machine->cpu[0], M68K_IRQ_1, ASSERT_LINE);
|
||||
else
|
||||
cpu_set_input_line(machine->cpu[0], MC68000_IRQ_1, CLEAR_LINE);
|
||||
cpu_set_input_line(machine->cpu[0], M68K_IRQ_1, CLEAR_LINE);
|
||||
}
|
||||
|
||||
static const ymz280b_interface ymz280b_intf =
|
||||
|
@ -77,12 +77,12 @@ static INTERRUPT_GEN( dbz_interrupt )
|
||||
switch (cpu_getiloops(device))
|
||||
{
|
||||
case 0:
|
||||
cpu_set_input_line(device, MC68000_IRQ_2, HOLD_LINE);
|
||||
cpu_set_input_line(device, M68K_IRQ_2, HOLD_LINE);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if (K053246_is_IRQ_enabled())
|
||||
cpu_set_input_line(device, MC68000_IRQ_4, HOLD_LINE);
|
||||
cpu_set_input_line(device, M68K_IRQ_4, HOLD_LINE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -141,9 +141,9 @@ static VIDEO_START( ddealer )
|
||||
back_tilemap = tilemap_create(get_back_tile_info,tilemap_scan_cols,8,8,64,32);
|
||||
}
|
||||
|
||||
static void ddealer_draw_video_layer( UINT16* vreg_base, UINT16* top, UINT16* bottom, bitmap_t* bitmap, const rectangle *cliprect, int flipy)
|
||||
static void ddealer_draw_video_layer( running_machine *machine, UINT16* vreg_base, UINT16* top, UINT16* bottom, bitmap_t* bitmap, const rectangle *cliprect, int flipy)
|
||||
{
|
||||
const gfx_element *gfx = Machine->gfx[1];
|
||||
const gfx_element *gfx = machine->gfx[1];
|
||||
|
||||
{
|
||||
INT16 sx, sy;
|
||||
@ -244,24 +244,24 @@ static VIDEO_UPDATE( ddealer )
|
||||
{
|
||||
if (ddealer_vregs[0xcc/2] & 0x80)
|
||||
{
|
||||
ddealer_draw_video_layer(&ddealer_vregs[0x1e0/2], left_fg_vram_top, left_fg_vram_bottom, bitmap, cliprect, ddealer_flipscreen);
|
||||
ddealer_draw_video_layer(&ddealer_vregs[0xcc/2], right_fg_vram_top, right_fg_vram_bottom, bitmap, cliprect, ddealer_flipscreen);
|
||||
ddealer_draw_video_layer(screen->machine, &ddealer_vregs[0x1e0/2], left_fg_vram_top, left_fg_vram_bottom, bitmap, cliprect, ddealer_flipscreen);
|
||||
ddealer_draw_video_layer(screen->machine, &ddealer_vregs[0xcc/2], right_fg_vram_top, right_fg_vram_bottom, bitmap, cliprect, ddealer_flipscreen);
|
||||
}
|
||||
else
|
||||
{
|
||||
ddealer_draw_video_layer(&ddealer_vregs[0x1e0/2], left_fg_vram_top, left_fg_vram_bottom, bitmap, cliprect, ddealer_flipscreen);
|
||||
ddealer_draw_video_layer(screen->machine, &ddealer_vregs[0x1e0/2], left_fg_vram_top, left_fg_vram_bottom, bitmap, cliprect, ddealer_flipscreen);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ddealer_vregs[0xcc/2] & 0x80)
|
||||
{
|
||||
ddealer_draw_video_layer(&ddealer_vregs[0xcc/2], left_fg_vram_top, left_fg_vram_bottom, bitmap, cliprect, ddealer_flipscreen);
|
||||
ddealer_draw_video_layer(&ddealer_vregs[0x1e0/2], right_fg_vram_top, right_fg_vram_bottom, bitmap, cliprect, ddealer_flipscreen);
|
||||
ddealer_draw_video_layer(screen->machine, &ddealer_vregs[0xcc/2], left_fg_vram_top, left_fg_vram_bottom, bitmap, cliprect, ddealer_flipscreen);
|
||||
ddealer_draw_video_layer(screen->machine, &ddealer_vregs[0x1e0/2], right_fg_vram_top, right_fg_vram_bottom, bitmap, cliprect, ddealer_flipscreen);
|
||||
}
|
||||
else
|
||||
{
|
||||
ddealer_draw_video_layer(&ddealer_vregs[0x1e0/2], left_fg_vram_top, left_fg_vram_bottom, bitmap, cliprect, ddealer_flipscreen);
|
||||
ddealer_draw_video_layer(screen->machine, &ddealer_vregs[0x1e0/2], left_fg_vram_top, left_fg_vram_bottom, bitmap, cliprect, ddealer_flipscreen);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -258,7 +258,7 @@ static WRITE32_HANDLER( v_ctrl_w )
|
||||
if (pending_vb_int && !DISABLE_VB_INT)
|
||||
{
|
||||
pending_vb_int = 0;
|
||||
cpu_set_input_line(space->machine->cpu[0], MC68000_IRQ_4, HOLD_LINE);
|
||||
cpu_set_input_line(space->machine->cpu[0], M68K_IRQ_4, HOLD_LINE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -449,7 +449,7 @@ static INTERRUPT_GEN( vb_interrupt )
|
||||
}
|
||||
|
||||
//logerror("V-Blank interrupt\n");
|
||||
cpu_set_input_line(device, MC68000_IRQ_4, HOLD_LINE);
|
||||
cpu_set_input_line(device, M68K_IRQ_4, HOLD_LINE);
|
||||
}
|
||||
|
||||
|
||||
@ -458,12 +458,12 @@ static void ide_interrupt(const device_config *device, int state)
|
||||
if (state != CLEAR_LINE)
|
||||
{
|
||||
//logerror("IDE interrupt asserted\n");
|
||||
cpu_set_input_line(device->machine->cpu[0], MC68000_IRQ_1, HOLD_LINE);
|
||||
cpu_set_input_line(device->machine->cpu[0], M68K_IRQ_1, HOLD_LINE);
|
||||
}
|
||||
else
|
||||
{
|
||||
//logerror("IDE interrupt cleared\n");
|
||||
cpu_set_input_line(device->machine->cpu[0], MC68000_IRQ_1, CLEAR_LINE);
|
||||
cpu_set_input_line(device->machine->cpu[0], M68K_IRQ_1, CLEAR_LINE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ from 2.bin to 9.bin program eproms
|
||||
*/
|
||||
|
||||
#include "driver.h"
|
||||
#include "cpu/m68000/m68kmame.h"
|
||||
#include "cpu/m68000/m68000.h"
|
||||
#include "cps1.h"
|
||||
#include "sound/2203intf.h"
|
||||
#include "sound/msm5205.h"
|
||||
|
@ -399,7 +399,7 @@ static VIDEO_UPDATE( jalmah )
|
||||
tilemap_set_scrolly( sc3_tilemap_2, 0, jm_scrollram[7] & 0x1ff);
|
||||
tilemap_set_scrolly( sc3_tilemap_3, 0, jm_scrollram[7] & 0x3ff);
|
||||
|
||||
fillbitmap(bitmap, Machine->pens[0x10f], cliprect);//selectable by a ram address?
|
||||
fillbitmap(bitmap, screen->machine->pens[0x10f], cliprect);//selectable by a ram address?
|
||||
|
||||
for(cur_prin=0;cur_prin<4;cur_prin++)
|
||||
{
|
||||
@ -420,7 +420,7 @@ static VIDEO_UPDATE( urashima )
|
||||
tilemap_set_scrolly( sc0_tilemap_0, 0, jm_scrollram[4]);
|
||||
tilemap_set_scrolly( sc3_tilemap_0, 0, jm_scrollram[7]);
|
||||
|
||||
fillbitmap(bitmap, Machine->pens[0x1ff], cliprect);//selectable by a ram address?
|
||||
fillbitmap(bitmap, screen->machine->pens[0x1ff], cliprect);//selectable by a ram address?
|
||||
if(jm_vregs[0] & 1) { tilemap_draw(bitmap,cliprect,sc0_tilemap_0,0,0); }
|
||||
if(jm_vregs[3] & 1) { tilemap_draw(bitmap,cliprect,sc3_tilemap_0,0,0); }
|
||||
return 0;
|
||||
|
@ -6421,7 +6421,7 @@ static IRQ_CALLBACK(genesis_int_callback)
|
||||
return (0x60+irqline*4)/4; // vector address
|
||||
}
|
||||
|
||||
static int megadriv_tas_callback(void)
|
||||
static int megadriv_tas_callback(const device_config *device)
|
||||
{
|
||||
return 0; // writeback not allowed
|
||||
}
|
||||
|
@ -201,15 +201,15 @@ static INTERRUPT_GEN(mystwarr_interrupt)
|
||||
switch (cpu_getiloops(device))
|
||||
{
|
||||
case 0:
|
||||
cpu_set_input_line(device, MC68000_IRQ_2, HOLD_LINE);
|
||||
cpu_set_input_line(device, M68K_IRQ_2, HOLD_LINE);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
cpu_set_input_line(device, MC68000_IRQ_4, HOLD_LINE);
|
||||
cpu_set_input_line(device, M68K_IRQ_4, HOLD_LINE);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
cpu_set_input_line(device, MC68000_IRQ_6, HOLD_LINE);
|
||||
cpu_set_input_line(device, M68K_IRQ_6, HOLD_LINE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -219,15 +219,15 @@ static INTERRUPT_GEN(metamrph_interrupt)
|
||||
switch (cpu_getiloops(device))
|
||||
{
|
||||
case 0:
|
||||
cpu_set_input_line(device, MC68000_IRQ_4, HOLD_LINE);
|
||||
cpu_set_input_line(device, M68K_IRQ_4, HOLD_LINE);
|
||||
break;
|
||||
|
||||
case 15:
|
||||
cpu_set_input_line(device, MC68000_IRQ_6, HOLD_LINE);
|
||||
cpu_set_input_line(device, M68K_IRQ_6, HOLD_LINE);
|
||||
break;
|
||||
|
||||
case 39:
|
||||
if (K053246_is_IRQ_enabled()) cpu_set_input_line(device, MC68000_IRQ_5, HOLD_LINE);
|
||||
if (K053246_is_IRQ_enabled()) cpu_set_input_line(device, M68K_IRQ_5, HOLD_LINE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -239,18 +239,18 @@ static INTERRUPT_GEN(mchamp_interrupt)
|
||||
switch (cpu_getiloops(device))
|
||||
{
|
||||
case 0:
|
||||
if (K053246_is_IRQ_enabled()) cpu_set_input_line(device, MC68000_IRQ_6, HOLD_LINE);
|
||||
if (K053246_is_IRQ_enabled()) cpu_set_input_line(device, M68K_IRQ_6, HOLD_LINE);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
cpu_set_input_line(device, MC68000_IRQ_2, HOLD_LINE);
|
||||
cpu_set_input_line(device, M68K_IRQ_2, HOLD_LINE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static INTERRUPT_GEN(ddd_interrupt)
|
||||
{
|
||||
cpu_set_input_line(device, MC68000_IRQ_5, HOLD_LINE);
|
||||
cpu_set_input_line(device, M68K_IRQ_5, HOLD_LINE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -156,7 +156,7 @@ static READ32_HANDLER( psac_rom_r )
|
||||
|
||||
static INTERRUPT_GEN(polygonet_interrupt)
|
||||
{
|
||||
cpu_set_input_line(device, MC68000_IRQ_5, HOLD_LINE);
|
||||
cpu_set_input_line(device, M68K_IRQ_5, HOLD_LINE);
|
||||
}
|
||||
|
||||
/* sound CPU communications */
|
||||
|
@ -162,7 +162,7 @@ static WRITE16_HANDLER( rng_sysregs_w )
|
||||
}
|
||||
|
||||
if (!(data & 0x40))
|
||||
cpu_set_input_line(space->machine->cpu[0], MC68000_IRQ_5, CLEAR_LINE);
|
||||
cpu_set_input_line(space->machine->cpu[0], M68K_IRQ_5, CLEAR_LINE);
|
||||
break;
|
||||
|
||||
case 0x0c/2:
|
||||
@ -206,7 +206,7 @@ static READ16_HANDLER( sound_status_msb_r )
|
||||
static INTERRUPT_GEN(rng_interrupt)
|
||||
{
|
||||
if (rng_sysreg[0x0c/2] & 0x09)
|
||||
cpu_set_input_line(device, MC68000_IRQ_5, ASSERT_LINE);
|
||||
cpu_set_input_line(device, M68K_IRQ_5, ASSERT_LINE);
|
||||
}
|
||||
|
||||
static ADDRESS_MAP_START( rngreadmem, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
|
@ -241,9 +241,9 @@ static TIMER_CALLBACK( scanline_callback )
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static void outrun_reset(void)
|
||||
static void outrun_reset(const device_config *device)
|
||||
{
|
||||
cpu_set_input_line(Machine->cpu[1], INPUT_LINE_RESET, PULSE_LINE);
|
||||
cpu_set_input_line(device->machine->cpu[1], INPUT_LINE_RESET, PULSE_LINE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -198,10 +198,10 @@ static READ8_HANDLER( sound_data_r )
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static void xboard_reset(void)
|
||||
static void xboard_reset(const device_config *device)
|
||||
{
|
||||
cpu_set_input_line(Machine->cpu[1], INPUT_LINE_RESET, PULSE_LINE);
|
||||
cpuexec_boost_interleave(Machine, attotime_zero, ATTOTIME_IN_USEC(100));
|
||||
cpu_set_input_line(device->machine->cpu[1], INPUT_LINE_RESET, PULSE_LINE);
|
||||
cpuexec_boost_interleave(device->machine, attotime_zero, ATTOTIME_IN_USEC(100));
|
||||
}
|
||||
|
||||
|
||||
|
@ -81,7 +81,7 @@ static WRITE8_HANDLER( m6809_irq_disable_w )
|
||||
static INTERRUPT_GEN( m68k_vb_interrupt )
|
||||
{
|
||||
if (m68k_irq_enable)
|
||||
cpu_set_input_line(device, MC68000_IRQ_1, HOLD_LINE);
|
||||
cpu_set_input_line(device, M68K_IRQ_1, HOLD_LINE);
|
||||
}
|
||||
|
||||
static WRITE16_HANDLER( m68k_irq_enable_w )
|
||||
|
@ -168,12 +168,12 @@ static INTERRUPT_GEN(cuebrick_interrupt)
|
||||
switch (cpu_getiloops(device))
|
||||
{
|
||||
case 0:
|
||||
cpu_set_input_line(device, MC68000_IRQ_5, HOLD_LINE);
|
||||
cpu_set_input_line(device, M68K_IRQ_5, HOLD_LINE);
|
||||
break;
|
||||
|
||||
default:
|
||||
if (cuebrick_snd_irqlatch)
|
||||
cpu_set_input_line(device, MC68000_IRQ_6, HOLD_LINE);
|
||||
cpu_set_input_line(device, M68K_IRQ_6, HOLD_LINE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -294,10 +294,10 @@ static WRITE16_HANDLER( batsugun_share2_w );
|
||||
Initialisation handlers
|
||||
***************************************************************************/
|
||||
|
||||
static void toaplan2_reset(void)
|
||||
static void toaplan2_reset(const device_config *device)
|
||||
{
|
||||
if (Machine->cpu[1] != NULL)
|
||||
cpu_set_input_line(Machine->cpu[1], INPUT_LINE_RESET, PULSE_LINE);
|
||||
if (device->machine->cpu[1] != NULL)
|
||||
cpu_set_input_line(device->machine->cpu[1], INPUT_LINE_RESET, PULSE_LINE);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( toaplan2 )
|
||||
|
@ -163,7 +163,7 @@ static WRITE16_HANDLER( twin16_CPUA_register_w )
|
||||
twin16_spriteram_process();
|
||||
|
||||
if( (old&0x10)==0 && (twin16_CPUA_register&0x10) )
|
||||
cpu_set_input_line(space->machine->cpu[CPU_B], MC68000_IRQ_6, HOLD_LINE );
|
||||
cpu_set_input_line(space->machine->cpu[CPU_B], M68K_IRQ_6, HOLD_LINE );
|
||||
|
||||
coin_counter_w( 0, twin16_CPUA_register&0x01 );
|
||||
coin_counter_w( 1, twin16_CPUA_register&0x02 );
|
||||
@ -185,7 +185,7 @@ static WRITE16_HANDLER( twin16_CPUB_register_w )
|
||||
{
|
||||
if( (old&0x01)==0 && (twin16_CPUB_register&0x1) )
|
||||
{
|
||||
cpu_set_input_line(space->machine->cpu[CPU_A], MC68000_IRQ_6, HOLD_LINE );
|
||||
cpu_set_input_line(space->machine->cpu[CPU_A], M68K_IRQ_6, HOLD_LINE );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -304,9 +304,9 @@ void amiga_machine_config(running_machine *machine, const amiga_machine_interfac
|
||||
}
|
||||
|
||||
|
||||
static void amiga_m68k_reset(void)
|
||||
static void amiga_m68k_reset(const device_config *device)
|
||||
{
|
||||
const address_space *space = cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM);
|
||||
const address_space *space = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
|
||||
|
||||
logerror("Executed RESET at PC=%06x\n", cpu_get_pc(space->cpu));
|
||||
|
||||
@ -337,7 +337,7 @@ MACHINE_RESET( amiga )
|
||||
/* set m68k reset function */
|
||||
cpu_set_info_fct(machine->cpu[0], CPUINFO_PTR_M68K_RESET_CALLBACK, (genf *)amiga_m68k_reset);
|
||||
|
||||
amiga_m68k_reset();
|
||||
amiga_m68k_reset(machine->cpu[0]);
|
||||
|
||||
/* call the system-specific callback */
|
||||
if (amiga_intf->reset_callback)
|
||||
|
@ -111,7 +111,7 @@ the decryption keys.
|
||||
*******************************************************************************/
|
||||
|
||||
#include "driver.h"
|
||||
#include "cpu/m68000/m68kmame.h"
|
||||
#include "cpu/m68000/m68000.h"
|
||||
#include "ui.h"
|
||||
#include "includes/cps1.h"
|
||||
|
||||
|
@ -109,7 +109,7 @@ static void fd1094_setstate_and_decrypt(int state)
|
||||
}
|
||||
|
||||
/* Callback for CMP.L instructions (state change) */
|
||||
static void fd1094_cmp_callback(UINT32 val, int reg)
|
||||
static void fd1094_cmp_callback(const device_config *device, UINT32 val, int reg)
|
||||
{
|
||||
if (reg == 0 && (val & 0x0000ffff) == 0x0000ffff) // ?
|
||||
{
|
||||
@ -124,7 +124,7 @@ static IRQ_CALLBACK(fd1094_int_callback)
|
||||
return (0x60+irqline*4)/4; // vector address
|
||||
}
|
||||
|
||||
static void fd1094_rte_callback (void)
|
||||
static void fd1094_rte_callback (const device_config *device)
|
||||
{
|
||||
fd1094_setstate_and_decrypt(FD1094_STATE_RTE);
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ static void s24_fd1094_setstate_and_decrypt(int state)
|
||||
}
|
||||
|
||||
/* Callback for CMP.L instructions (state change) */
|
||||
static void s24_fd1094_cmp_callback(UINT32 val, int reg)
|
||||
static void s24_fd1094_cmp_callback(const device_config *device, UINT32 val, int reg)
|
||||
{
|
||||
if (reg == 0 && (val & 0x0000ffff) == 0x0000ffff) // ?
|
||||
{
|
||||
@ -106,7 +106,7 @@ static IRQ_CALLBACK(s24_fd1094_int_callback)
|
||||
return (0x60+irqline*4)/4; // vector address
|
||||
}
|
||||
|
||||
static void s24_fd1094_rte_callback (void)
|
||||
static void s24_fd1094_rte_callback (const device_config *device)
|
||||
{
|
||||
s24_fd1094_setstate_and_decrypt(FD1094_STATE_RTE);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ INTERRUPT_GEN( twincobr_interrupt )
|
||||
{
|
||||
if (twincobr_intenable) {
|
||||
twincobr_intenable = 0;
|
||||
cpu_set_input_line(device, MC68000_IRQ_4, HOLD_LINE);
|
||||
cpu_set_input_line(device, M68K_IRQ_4, HOLD_LINE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -111,12 +111,7 @@ CPUS += HD6309
|
||||
CPUS += M6809
|
||||
CPUS += M6809E
|
||||
CPUS += KONAMI
|
||||
CPUS += M68000
|
||||
#CPUS += M68008
|
||||
CPUS += M68010
|
||||
CPUS += M68EC020
|
||||
CPUS += M68020
|
||||
CPUS += M68040
|
||||
CPUS += M680X0
|
||||
CPUS += T11
|
||||
CPUS += S2650
|
||||
CPUS += TMS340X0
|
||||
|
@ -329,9 +329,9 @@ void jaguar_gpu_resume(running_machine *machine)
|
||||
static void update_cpu_irq(running_machine *machine)
|
||||
{
|
||||
if (cpu_irq_state & gpu_regs[INT1] & 0x1f)
|
||||
cpu_set_input_line(machine->cpu[0], cojag_is_r3000 ? R3000_IRQ4 : MC68000_IRQ_6, ASSERT_LINE);
|
||||
cpu_set_input_line(machine->cpu[0], cojag_is_r3000 ? R3000_IRQ4 : M68K_IRQ_6, ASSERT_LINE);
|
||||
else
|
||||
cpu_set_input_line(machine->cpu[0], cojag_is_r3000 ? R3000_IRQ4 : MC68000_IRQ_6, CLEAR_LINE);
|
||||
cpu_set_input_line(machine->cpu[0], cojag_is_r3000 ? R3000_IRQ4 : M68K_IRQ_6, CLEAR_LINE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1247,5 +1247,5 @@ VIDEO_EOF( samesame )
|
||||
const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
|
||||
buffer_spriteram16_w(space, 0, 0, 0xffff);
|
||||
memcpy(toaplan1_buffered_spritesizeram16, toaplan1_spritesizeram16, TOAPLAN1_SPRITESIZERAM_SIZE);
|
||||
cpu_set_input_line(machine->cpu[0], MC68000_IRQ_2, HOLD_LINE); /* Frame done */
|
||||
cpu_set_input_line(machine->cpu[0], M68K_IRQ_2, HOLD_LINE); /* Frame done */
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user