m6809 fix; vectrex works now (nw)

This commit is contained in:
Nathan Woods 2013-03-09 00:51:04 +00:00
parent 0101a2b283
commit e8c09156cc
2 changed files with 24 additions and 3 deletions

View File

@ -195,6 +195,7 @@ protected:
void write_operand(int ordinal, UINT8 data);
// delay loops
bool match_target_bytes(UINT16 address, const UINT8 *bytes, int length);
void burn_any_delay_loops();
// instructions

View File

@ -123,6 +123,26 @@ inline ATTR_FORCE_INLINE void m6809_base_device::write_operand(int ordinal, UINT
}
//-------------------------------------------------
// match_target_bytes
//-------------------------------------------------
inline ATTR_FORCE_INLINE bool m6809_base_device::match_target_bytes(UINT16 address, const UINT8 *bytes, int length)
{
UINT8 *start_raw = (UINT8 *) m_direct->read_raw_ptr(address);
UINT8 *start_decrypted = (UINT8 *) m_direct->read_decrypted_ptr(address);
UINT8 *end_raw = (UINT8 *) m_direct->read_raw_ptr(address + length - 1);
UINT8 *end_decrypted = (UINT8 *) m_direct->read_decrypted_ptr(address + length - 1);
return (start_raw != NULL)
&& (end_raw != NULL)
&& (start_raw == start_decrypted)
&& (end_raw == end_decrypted)
&& (start_raw + length - 1 == end_raw)
&& !memcmp(start_raw, bytes, length);
}
//-------------------------------------------------
// burn_any_delay_loops - optimization for delay
// loops
@ -130,12 +150,12 @@ inline ATTR_FORCE_INLINE void m6809_base_device::write_operand(int ordinal, UINT
inline ATTR_FORCE_INLINE void m6809_base_device::burn_any_delay_loops()
{
static const UINT8 target_bytes[] = { 0x30, 0x1F, 0x26, 0xFC };
if ((m_opcode == 0x26)
&& !(m_cc & CC_Z)
&& !(machine().debug_flags & DEBUG_FLAG_CALL_HOOK)
&& (read_opcode_arg(m_pc.w) == 0xFC)
&& (read_opcode(m_pc.w - 3) == 0x30)
&& (read_opcode_arg(m_pc.w - 2) == 0x1F))
&& match_target_bytes(m_pc.w - 3, target_bytes, ARRAY_LENGTH(target_bytes)))
{
// LEAX -1,X ; BNE *
UINT16 burned_loops = MIN((int) m_x.w - 1, m_icount / 8);