fix kram3 set locking up MAME

This commit is contained in:
Michaël Banaan Ananas 2013-06-03 13:08:07 +00:00
parent abeba8a9a5
commit 0f575e7477
6 changed files with 16 additions and 61 deletions

View File

@ -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<m6809_base_device *>(device);
if (m6809 != NULL)
{
m6809_config &config = static_cast<m6809_config &>(*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)

View File

@ -109,41 +109,18 @@ const device_type M6809E = &device_creator<m6809e_device>;
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<m6809_base_device &>(device);
static_cast<m6809_config &>(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();

View File

@ -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<m6809_base_device &>(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();

View File

@ -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;

View File

@ -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 */

View File

@ -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)