summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Nathan Woods <npwoods@mess.org>2013-03-09 00:51:04 +0000
committer Nathan Woods <npwoods@mess.org>2013-03-09 00:51:04 +0000
commite8c09156ccff793ea7f02cc05cec18cdb8c5ff92 (patch)
tree4a7e5d70377baeb2d04322984b4f2f323fbff7c2
parent0101a2b283705ab9a5c0e6e407961bb10f4d50f9 (diff)
m6809 fix; vectrex works now (nw)
-rw-r--r--src/emu/cpu/m6809/m6809.h1
-rw-r--r--src/emu/cpu/m6809/m6809inl.h26
2 files changed, 24 insertions, 3 deletions
diff --git a/src/emu/cpu/m6809/m6809.h b/src/emu/cpu/m6809/m6809.h
index 0c0fcfb8a97..d6e7f3c0953 100644
--- a/src/emu/cpu/m6809/m6809.h
+++ b/src/emu/cpu/m6809/m6809.h
@@ -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
diff --git a/src/emu/cpu/m6809/m6809inl.h b/src/emu/cpu/m6809/m6809inl.h
index 5a66d98006b..ac299d91818 100644
--- a/src/emu/cpu/m6809/m6809inl.h
+++ b/src/emu/cpu/m6809/m6809inl.h
@@ -124,18 +124,38 @@ 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
//-------------------------------------------------
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);