diff options
Diffstat (limited to 'src/emu/devcpu.cpp')
-rw-r--r-- | src/emu/devcpu.cpp | 77 |
1 files changed, 68 insertions, 9 deletions
diff --git a/src/emu/devcpu.cpp b/src/emu/devcpu.cpp index e75b621c6f0..616a501f438 100644 --- a/src/emu/devcpu.cpp +++ b/src/emu/devcpu.cpp @@ -2,7 +2,7 @@ // copyright-holders:Aaron Giles /*************************************************************************** - devcpu.c + devcpu.cpp CPU device definitions. @@ -10,7 +10,7 @@ #include "emu.h" #include "emuopts.h" -#include <ctype.h> +#include <cctype> //************************************************************************** @@ -21,13 +21,15 @@ // cpu_device - constructor //------------------------------------------------- -cpu_device::cpu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock) - : device_t(mconfig, type, tag, owner, clock), - device_execute_interface(mconfig, *this), - device_memory_interface(mconfig, *this), - device_state_interface(mconfig, *this), - device_disasm_interface(mconfig, *this), - m_force_no_drc(false) +cpu_device::cpu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock) : + device_t(mconfig, type, tag, owner, clock), + device_execute_interface(mconfig, *this), + device_memory_interface(mconfig, *this), + device_state_interface(mconfig, *this), + device_disasm_interface(mconfig, *this), + m_force_no_drc(false), + m_access_to_be_redone(false), + m_access_before_delay_tag(nullptr) { } @@ -49,3 +51,60 @@ bool cpu_device::allow_drc() const { return mconfig().options().drc() && !m_force_no_drc; } + + + +bool cpu_device::cpu_is_interruptible() const +{ + return false; +} + +bool cpu_device::access_before_time(u64 access_time, u64 current_time) noexcept +{ + s32 delta = access_time - current_time; + if(*m_icountptr <= delta) { + defer_access(); + return true; + } + + *m_icountptr -= delta; + + return false; +} + +bool cpu_device::access_before_delay(u32 cycles, const void *tag) noexcept +{ + if(tag == m_access_before_delay_tag) { + m_access_before_delay_tag = nullptr; + return false; + } + + *m_icountptr -= cycles; + + if(*m_icountptr <= 0) { + m_access_before_delay_tag = tag; + m_access_to_be_redone = true; + return true; + } + + m_access_before_delay_tag = nullptr; + return false; +} + +void cpu_device::access_after_delay(u32 cycles) noexcept +{ + *m_icountptr -= cycles; +} + +void cpu_device::defer_access() noexcept +{ + if(*m_icountptr > 0) + *m_icountptr = 0; + m_access_to_be_redone = true; +} + +void cpu_device::retry_access() noexcept +{ + abort_timeslice(); + m_access_to_be_redone = true; +} |