summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/diexec.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/emu/diexec.h')
-rw-r--r--src/emu/diexec.h61
1 files changed, 44 insertions, 17 deletions
diff --git a/src/emu/diexec.h b/src/emu/diexec.h
index ded5a024d06..eb99b8241c8 100644
--- a/src/emu/diexec.h
+++ b/src/emu/diexec.h
@@ -7,15 +7,12 @@
Device execution interfaces.
***************************************************************************/
+#ifndef MAME_EMU_DIEXEC_H
+#define MAME_EMU_DIEXEC_H
#pragma once
-#ifndef __EMU_H__
-#error Dont include this file directly; include emu.h instead.
-#endif
-
-#ifndef MAME_EMU_DIEXEC_H
-#define MAME_EMU_DIEXEC_H
+#include "debug/debugcpu.h"
//**************************************************************************
@@ -71,8 +68,6 @@ enum
// MACROS
//**************************************************************************
-#define TIMER_CALLBACK_MEMBER(name) void name(void *ptr, s32 param)
-
// IRQ callback to be called by device implementations when an IRQ is actually taken
#define IRQ_CALLBACK_MEMBER(func) int func(device_t &device, int irqline)
@@ -159,10 +154,10 @@ public:
// execution management
device_scheduler &scheduler() const { assert(m_scheduler != nullptr); return *m_scheduler; }
- bool executing() const;
- s32 cycles_remaining() const;
- void eat_cycles(int cycles);
- void adjust_icount(int delta);
+ bool executing() const { return scheduler().currently_executing() == this; }
+ s32 cycles_remaining() const { return executing() ? *m_icountptr : 0; } // cycles remaining in this timeslice
+ void eat_cycles(int cycles) { if (executing()) *m_icountptr = (cycles > *m_icountptr) ? 0 : (*m_icountptr - cycles); }
+ void adjust_icount(int delta) { if (executing()) *m_icountptr += delta; }
void abort_timeslice();
// input and interrupt management
@@ -224,9 +219,29 @@ protected:
virtual void interface_clock_changed() override;
// for use by devcpu for now...
+ int current_input_state(unsigned i) const { return m_input[i].m_curstate; }
+ void set_icountptr(int &icount) { assert(!m_icountptr); m_icountptr = &icount; }
IRQ_CALLBACK_MEMBER(standard_irq_callback_member);
int standard_irq_callback(int irqline);
+ // debugger hooks
+ void debugger_instruction_hook(offs_t curpc)
+ {
+ if (device().machine().debug_flags & DEBUG_FLAG_CALL_HOOK)
+ device().debug()->instruction_hook(curpc);
+ }
+ void debugger_exception_hook(int exception)
+ {
+ if (device().machine().debug_flags & DEBUG_FLAG_ENABLED)
+ device().debug()->exception_hook(exception);
+ }
+ void debugger_interrupt_hook(int irqline)
+ {
+ if (device().machine().debug_flags & DEBUG_FLAG_ENABLED)
+ device().debug()->interrupt_hook(irqline);
+ }
+
+private:
// internal information about the state of inputs
class device_input
{
@@ -255,6 +270,18 @@ protected:
TIMER_CALLBACK_MEMBER(empty_event_queue);
};
+ // internal debugger hooks
+ void debugger_start_cpu_hook(const attotime &endtime)
+ {
+ if (device().machine().debug_flags & DEBUG_FLAG_ENABLED)
+ device().debug()->start_hook(endtime);
+ }
+ void debugger_stop_cpu_hook()
+ {
+ if (device().machine().debug_flags & DEBUG_FLAG_ENABLED)
+ device().debug()->stop_hook();
+ }
+
// scheduler
device_scheduler * m_scheduler; // pointer to the machine scheduler
@@ -288,21 +315,22 @@ protected:
s32 m_inttrigger; // interrupt trigger index
// clock and timing information
+protected: // FIXME: MIPS3 accesses m_totalcycles directly from execute_burn - devise a better solution
u64 m_totalcycles; // total device cycles executed
+private:
attotime m_localtime; // local time, relative to the timer system's global time
s32 m_divisor; // 32-bit attoseconds_per_cycle divisor
u8 m_divshift; // right shift amount to fit the divisor into 32 bits
u32 m_cycles_per_second; // cycles per second, adjusted for multipliers
attoseconds_t m_attoseconds_per_cycle; // attoseconds per adjusted clock cycle
-private:
// callbacks
- TIMER_CALLBACK_MEMBER(timed_trigger_callback);
+ TIMER_CALLBACK_MEMBER(timed_trigger_callback) { trigger(param); }
void on_vblank(screen_device &screen, bool vblank_state);
TIMER_CALLBACK_MEMBER(trigger_periodic_interrupt);
- TIMER_CALLBACK_MEMBER(irq_pulse_clear);
+ TIMER_CALLBACK_MEMBER(irq_pulse_clear) { set_input_line(int(param), CLEAR_LINE); }
void suspend_resume_changed();
attoseconds_t minimum_quantum() const;
@@ -314,5 +342,4 @@ public:
// iterator
typedef device_interface_iterator<device_execute_interface> execute_interface_iterator;
-
-#endif /* MAME_EMU_DIEXEC_H */
+#endif // MAME_EMU_DIEXEC_H