1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
// license:BSD-3-Clause
// copyright-holders:Aaron Giles
/***************************************************************************
devcpu.cpp
CPU device definitions.
***************************************************************************/
#include "emu.h"
#include "emuopts.h"
#include <cctype>
//**************************************************************************
// CPU RUNNING DEVICE
//**************************************************************************
//-------------------------------------------------
// 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),
m_access_to_be_redone(false),
m_access_before_delay_tag(nullptr)
{
}
//-------------------------------------------------
// cpu_device - destructor
//-------------------------------------------------
cpu_device::~cpu_device()
{
}
//-------------------------------------------------
// allow_drc - return true if DRC is allowed
//-------------------------------------------------
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;
}
|