From 0f575e747726f657e06753faf3a61c9af694c299 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Banaan=20Ananas?= Date: Mon, 3 Jun 2013 13:08:07 +0000 Subject: [PATCH] fix kram3 set locking up MAME --- src/emu/cpu/m6809/6809dasm.c | 13 ++++--------- src/emu/cpu/m6809/m6809.c | 27 ++------------------------- src/emu/cpu/m6809/m6809.h | 18 ++++++------------ src/emu/cpu/m6809/m6809.ops | 4 ++-- src/mame/drivers/qix.c | 7 +------ src/mame/video/qix.c | 8 +------- 6 files changed, 16 insertions(+), 61 deletions(-) diff --git a/src/emu/cpu/m6809/6809dasm.c b/src/emu/cpu/m6809/6809dasm.c index c1a21321628..73f79417e09 100644 --- a/src/emu/cpu/m6809/6809dasm.c +++ b/src/emu/cpu/m6809/6809dasm.c @@ -370,16 +370,11 @@ CPU_DISASSEMBLE( m6809 ) const UINT8 *operandarray; unsigned int ea, flags; int numoperands, offset, indirect; - bool encrypt_only_first_byte = false; - m6809_base_device *m6809 = static_cast(device); - if (m6809 != NULL) - { - m6809_config &config = static_cast(*m6809); - encrypt_only_first_byte = config.m_encrypt_only_first_byte; - } - int i, p = 0, page = 0, opcode_found = FALSE; - + + // FIXME (qix.c kram3 is the only set that uses it) + bool encrypt_only_first_byte = false; + do { if (encrypt_only_first_byte) diff --git a/src/emu/cpu/m6809/m6809.c b/src/emu/cpu/m6809/m6809.c index 513af1f7f8e..b69773b45b2 100644 --- a/src/emu/cpu/m6809/m6809.c +++ b/src/emu/cpu/m6809/m6809.c @@ -109,41 +109,18 @@ const device_type M6809E = &device_creator; m6809_base_device::m6809_base_device(const machine_config &mconfig, const char *name, const char *tag, device_t *owner, UINT32 clock, const device_type type, int divider) : cpu_device(mconfig, type, name, tag, owner, clock), m_program_config("program", ENDIANNESS_BIG, 8, 16), - m_clock_divider(divider) + m_clock_divider(divider), + m_encrypt_only_first_byte(false) { } -//------------------------------------------------- -// static_set_config - set the configuration -// structure -//------------------------------------------------- - -void m6809_base_device::static_set_config(device_t &device, const m6809_config &config) -{ - m6809_base_device &m6809 = downcast(device); - static_cast(m6809) = config; - static_set_static_config(device, &config); -} - - //------------------------------------------------- // device_start - device-specific startup //------------------------------------------------- void m6809_base_device::device_start() { - // default configuration - static const m6809_config default_config = - { - false - }; - - if (!static_config()) - { - static_set_config(*this, default_config); - } - m_program = &space(AS_PROGRAM); m_direct = &m_program->direct(); diff --git a/src/emu/cpu/m6809/m6809.h b/src/emu/cpu/m6809/m6809.h index d9e2ce4305e..969a66d4cb3 100644 --- a/src/emu/cpu/m6809/m6809.h +++ b/src/emu/cpu/m6809/m6809.h @@ -16,8 +16,9 @@ // INTERFACE CONFIGURATION MACROS //************************************************************************** -#define MCFG_CPU_M6809_CONFIG(_config) \ - m6809_base_device::static_set_config(*device, _config); +/* encrypt only the first byte in 10 xx and 11 xx opcodes */ +#define MCFG_CPU_M6809_ENCRYPT_ONLY_FIRST_BYTE() \ + m6809_base_device::set_encrypt_only_first_byte(*device, true); //************************************************************************** @@ -26,13 +27,6 @@ class m6809_device; -// ======================> m6809_config - -struct m6809_config -{ - bool m_encrypt_only_first_byte; -}; - // device type definition extern const device_type M6809; @@ -41,15 +35,14 @@ extern const device_type M6809E; // ======================> m6809_base_device // Used by core CPU interface -class m6809_base_device : public cpu_device, - public m6809_config +class m6809_base_device : public cpu_device { public: // construction/destruction m6809_base_device(const machine_config &mconfig, const char *name, const char *tag, device_t *owner, UINT32 clock, const device_type type, int divider); // inline configuration helpers - static void static_set_config(device_t &device, const m6809_config &config); + static void set_encrypt_only_first_byte(device_t &device, bool b) { downcast(device).m_encrypt_only_first_byte = b; } DECLARE_WRITE_LINE_MEMBER( irq_line ); DECLARE_WRITE_LINE_MEMBER( firq_line ); @@ -268,6 +261,7 @@ private: // incidentals int m_clock_divider; + bool m_encrypt_only_first_byte; // functions void execute_one(); diff --git a/src/emu/cpu/m6809/m6809.ops b/src/emu/cpu/m6809/m6809.ops index a8026459554..e5841d4bd0c 100644 --- a/src/emu/cpu/m6809/m6809.ops +++ b/src/emu/cpu/m6809/m6809.ops @@ -270,7 +270,7 @@ MAIN: return; DISPATCH10: - @m_opcode = read_opcode(); + @m_opcode = m_encrypt_only_first_byte ? read_opcode_arg() : read_opcode(); switch(m_opcode) { case 0x20: set_cond(true); %LBRANCH; return; @@ -323,7 +323,7 @@ DISPATCH10: return; DISPATCH11: - @m_opcode = read_opcode(); + @m_opcode = m_encrypt_only_first_byte ? read_opcode_arg() : read_opcode(); switch(m_opcode) { case 0x3F: %SWI3; return; diff --git a/src/mame/drivers/qix.c b/src/mame/drivers/qix.c index 47ec492350e..7eeaf4e916b 100644 --- a/src/mame/drivers/qix.c +++ b/src/mame/drivers/qix.c @@ -544,17 +544,12 @@ INPUT_PORTS_END * *************************************/ -static const m6809_config encryption_config = -{ - TRUE, /* encrypt only the first byte in 10 xx and 11 xx opcodes */ -}; - static MACHINE_CONFIG_START( qix_base, qix_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", M6809, MAIN_CLOCK_OSC/4/4) /* 1.25 MHz */ MCFG_CPU_PROGRAM_MAP(main_map) - MCFG_CPU_M6809_CONFIG(encryption_config) // for kram3 + MCFG_CPU_M6809_ENCRYPT_ONLY_FIRST_BYTE() // for kram3 /* high interleave needed to ensure correct text in service mode */ /* Zookeeper settings and high score table seem especially sensitive to this */ diff --git a/src/mame/video/qix.c b/src/mame/video/qix.c index d98250db596..bb0389cfa8b 100644 --- a/src/mame/video/qix.c +++ b/src/mame/video/qix.c @@ -398,16 +398,10 @@ static MC6845_INTERFACE( mc6845_intf ) }; -static const m6809_config encryption_config = -{ - TRUE, /* encrypt only the first byte in 10 xx and 11 xx opcodes */ -}; - - MACHINE_CONFIG_FRAGMENT( qix_video ) MCFG_CPU_ADD("videocpu", M6809, MAIN_CLOCK_OSC/4/4) /* 1.25 MHz */ MCFG_CPU_PROGRAM_MAP(qix_video_map) - MCFG_CPU_CONFIG(encryption_config) // for kram3 + MCFG_CPU_M6809_ENCRYPT_ONLY_FIRST_BYTE() // for kram3 MCFG_VIDEO_START_OVERRIDE(qix_state,qix)