summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/sh/sh4tmu.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/sh/sh4tmu.cpp')
-rw-r--r--src/devices/cpu/sh/sh4tmu.cpp260
1 files changed, 129 insertions, 131 deletions
diff --git a/src/devices/cpu/sh/sh4tmu.cpp b/src/devices/cpu/sh/sh4tmu.cpp
index 8bcce44b37a..dcdb9454e32 100644
--- a/src/devices/cpu/sh/sh4tmu.cpp
+++ b/src/devices/cpu/sh/sh4tmu.cpp
@@ -37,18 +37,18 @@ void sh34_base_device::sh4_timer_recompute(int which)
switch (which)
{
case 0:
- tcr = m_SH4_TCR0;
- tcnt = m_SH4_TCNT0;
+ tcr = m_tcr0;
+ tcnt = m_tcnt0;
break;
case 1:
- tcr = m_SH4_TCR1;
- tcnt = m_SH4_TCNT1;
+ tcr = m_tcr1;
+ tcnt = m_tcnt1;
break;
case 2:
- tcr = m_SH4_TCR2;
- tcnt = m_SH4_TCNT2;
+ tcr = m_tcr2;
+ tcnt = m_tcnt2;
break;
}
@@ -64,15 +64,15 @@ TIMER_CALLBACK_MEMBER( sh34_base_device::sh4_timer_callback )
switch (which)
{
case 0:
- m_SH4_TCNT0 = m_SH4_TCOR0;
+ m_tcnt0 = m_tcor0;
break;
case 1:
- m_SH4_TCNT1 = m_SH4_TCOR1;
+ m_tcnt1 = m_tcor1;
break;
case 2:
- m_SH4_TCNT2 = m_SH4_TCOR2;
+ m_tcnt2 = m_tcor2;
break;
}
@@ -82,15 +82,15 @@ TIMER_CALLBACK_MEMBER( sh34_base_device::sh4_timer_callback )
switch (which)
{
case 0:
- m_SH4_TCR0 |= 0x100;
+ m_tcr0 |= 0x100;
break;
case 1:
- m_SH4_TCR1 |= 0x100;
+ m_tcr1 |= 0x100;
break;
case 2:
- m_SH4_TCR2 |= 0x100;
+ m_tcr2 |= 0x100;
break;
}
@@ -98,7 +98,7 @@ TIMER_CALLBACK_MEMBER( sh34_base_device::sh4_timer_callback )
switch (which)
{
case 0:
- if (m_SH4_TCR0 & 0x20)
+ if (m_tcr0 & 0x20)
{
sh4_exception_request(SH4_INTC_TUNI0);
// logerror("SH4_INTC_TUNI0 requested\n");
@@ -106,7 +106,7 @@ TIMER_CALLBACK_MEMBER( sh34_base_device::sh4_timer_callback )
break;
case 1:
- if (m_SH4_TCR1 & 0x20)
+ if (m_tcr1 & 0x20)
{
sh4_exception_request(SH4_INTC_TUNI1);
// logerror("SH4_INTC_TUNI1 requested\n");
@@ -114,7 +114,7 @@ TIMER_CALLBACK_MEMBER( sh34_base_device::sh4_timer_callback )
break;
case 2:
- if (m_SH4_TCR2 & 0x20)
+ if (m_tcr2 & 0x20)
{
sh4_exception_request(SH4_INTC_TUNI2);
// logerror("SH4_INTC_TUNI2 requested\n");
@@ -124,88 +124,32 @@ TIMER_CALLBACK_MEMBER( sh34_base_device::sh4_timer_callback )
}
}
-
-uint32_t sh34_base_device::sh4_handle_tcnt0_addr_r(uint32_t mem_mask)
-{
- if (m_SH4_TSTR & 1)
- return compute_ticks_timer(m_timer[0], m_pm_clock, tcnt_div[m_SH4_TCR0 & 7]);
- else
- return m_SH4_TCNT0;
-}
-
-uint32_t sh34_base_device::sh4_handle_tcnt1_addr_r(uint32_t mem_mask)
-{
- if (m_SH4_TSTR & 2)
- return compute_ticks_timer(m_timer[1], m_pm_clock, tcnt_div[m_SH4_TCR1 & 7]);
- else
- return m_SH4_TCNT1;
-}
-
-uint32_t sh34_base_device::sh4_handle_tcnt2_addr_r(uint32_t mem_mask)
-{
- if (m_SH4_TSTR & 4)
- return compute_ticks_timer(m_timer[2], m_pm_clock, tcnt_div[m_SH4_TCR2 & 7]);
- else
- return m_SH4_TCNT2;
-}
-
-uint32_t sh34_base_device::sh4_handle_tcor0_addr_r(uint32_t mem_mask)
-{
- return m_SH4_TCOR0;
-}
-
-uint32_t sh34_base_device::sh4_handle_tcor1_addr_r(uint32_t mem_mask)
-{
- return m_SH4_TCOR1;
-}
-
-uint32_t sh34_base_device::sh4_handle_tcor2_addr_r(uint32_t mem_mask)
+void sh34_base_device::tocr_w(offs_t offset, uint8_t data, uint8_t mem_mask)
{
- return m_SH4_TCOR2;
+ COMBINE_DATA(&m_tocr);
}
-uint32_t sh34_base_device::sh4_handle_tcr0_addr_r(uint32_t mem_mask)
+uint8_t sh34_base_device::tocr_r(offs_t offset, uint8_t mem_mask)
{
- return m_SH4_TCR0;
+ return m_tocr;
}
-uint32_t sh34_base_device::sh4_handle_tcr1_addr_r(uint32_t mem_mask)
+uint8_t sh34_base_device::tstr_r(offs_t offset, uint8_t mem_mask)
{
- return m_SH4_TCR1;
+ return m_tstr;
}
-uint32_t sh34_base_device::sh4_handle_tcr2_addr_r(uint32_t mem_mask)
+void sh34_base_device::tstr_w(offs_t offset, uint8_t data, uint8_t mem_mask)
{
- return m_SH4_TCR2;
-}
-
-uint32_t sh34_base_device::sh4_handle_tstr_addr_r(uint32_t mem_mask)
-{
- return m_SH4_TSTR;
-}
-
-uint32_t sh34_base_device::sh4_handle_tocr_addr_r(uint32_t mem_mask)
-{
- return m_SH4_TOCR;
-}
-
-uint32_t sh34_base_device::sh4_handle_tcpr2_addr_r(uint32_t mem_mask)
-{
- return m_SH4_TCPR2;
-}
-
-
-void sh34_base_device::sh4_handle_tstr_addr_w(uint32_t data, uint32_t mem_mask)
-{
- uint32_t chg = m_SH4_TSTR;
- COMBINE_DATA(&m_SH4_TSTR);
- chg ^= m_SH4_TSTR;
+ uint32_t chg = m_tstr;
+ COMBINE_DATA(&m_tstr);
+ chg ^= m_tstr;
if (chg & 1)
{
- if ((m_SH4_TSTR & 1) == 0)
+ if ((m_tstr & 1) == 0)
{
- m_SH4_TCNT0 = compute_ticks_timer(m_timer[0], m_pm_clock, tcnt_div[m_SH4_TCR0 & 7]);
+ m_tcnt0 = compute_ticks_timer(m_timer[0], m_pm_clock, tcnt_div[m_tcr0 & 7]);
m_timer[0]->adjust(attotime::never);
}
else
@@ -214,9 +158,9 @@ void sh34_base_device::sh4_handle_tstr_addr_w(uint32_t data, uint32_t mem_mask)
if (chg & 2)
{
- if ((m_SH4_TSTR & 2) == 0)
+ if ((m_tstr & 2) == 0)
{
- m_SH4_TCNT1 = compute_ticks_timer(m_timer[1], m_pm_clock, tcnt_div[m_SH4_TCR1 & 7]);
+ m_tcnt1 = compute_ticks_timer(m_timer[1], m_pm_clock, tcnt_div[m_tcr1 & 7]);
m_timer[1]->adjust(attotime::never);
}
else
@@ -225,9 +169,9 @@ void sh34_base_device::sh4_handle_tstr_addr_w(uint32_t data, uint32_t mem_mask)
if (chg & 4)
{
- if ((m_SH4_TSTR & 4) == 0)
+ if ((m_tstr & 4) == 0)
{
- m_SH4_TCNT2 = compute_ticks_timer(m_timer[2], m_pm_clock, tcnt_div[m_SH4_TCR2 & 7]);
+ m_tcnt2 = compute_ticks_timer(m_timer[2], m_pm_clock, tcnt_div[m_tcr2 & 7]);
m_timer[2]->adjust(attotime::never);
}
else
@@ -235,87 +179,141 @@ void sh34_base_device::sh4_handle_tstr_addr_w(uint32_t data, uint32_t mem_mask)
}
}
-void sh34_base_device::sh4_handle_tcr0_addr_w(uint32_t data, uint32_t mem_mask)
+uint32_t sh34_base_device::tcor0_r(offs_t offset, uint32_t mem_mask)
+{
+ return m_tcor0;
+}
+
+void sh34_base_device::tcor0_w(offs_t offset, uint32_t data, uint32_t mem_mask)
+{
+ COMBINE_DATA(&m_tcor0);
+}
+
+uint32_t sh34_base_device::tcnt0_r(offs_t offset, uint32_t mem_mask)
{
- uint32_t old2 = m_SH4_TCR0;
- COMBINE_DATA(&m_SH4_TCR0);
- if (m_SH4_TSTR & 1)
+ if (m_tstr & 1)
+ return compute_ticks_timer(m_timer[0], m_pm_clock, tcnt_div[m_tcr0 & 7]);
+ else
+ return m_tcnt0;
+}
+
+void sh34_base_device::tcnt0_w(offs_t offset, uint32_t data, uint32_t mem_mask)
+{
+ COMBINE_DATA(&m_tcnt0);
+ if (m_tstr & 1)
+ sh4_timer_recompute(0);
+}
+
+uint16_t sh34_base_device::tcr0_r(offs_t offset, uint16_t mem_mask)
+{
+ return m_tcr0;
+}
+
+void sh34_base_device::tcr0_w(offs_t offset, uint16_t data, uint16_t mem_mask)
+{
+ uint32_t old2 = m_tcr0;
+ COMBINE_DATA(&m_tcr0);
+ if (m_tstr & 1)
{
- m_SH4_TCNT0 = compute_ticks_timer(m_timer[0], m_pm_clock, tcnt_div[old2 & 7]);
+ m_tcnt0 = compute_ticks_timer(m_timer[0], m_pm_clock, tcnt_div[old2 & 7]);
sh4_timer_recompute(0);
}
- if (!(m_SH4_TCR0 & 0x20) || !(m_SH4_TCR0 & 0x100))
+ if (!(m_tcr0 & 0x20) || !(m_tcr0 & 0x100))
sh4_exception_unrequest(SH4_INTC_TUNI0);
}
-void sh34_base_device::sh4_handle_tcr1_addr_w(uint32_t data, uint32_t mem_mask)
+uint32_t sh34_base_device::tcor1_r(offs_t offset, uint32_t mem_mask)
{
- uint32_t old2 = m_SH4_TCR1;
- COMBINE_DATA(&m_SH4_TCR1);
- if (m_SH4_TSTR & 2)
- {
- m_SH4_TCNT1 = compute_ticks_timer(m_timer[1], m_pm_clock, tcnt_div[old2 & 7]);
+ return m_tcor1;
+}
+
+void sh34_base_device::tcor1_w(offs_t offset, uint32_t data, uint32_t mem_mask)
+{
+ COMBINE_DATA(&m_tcor1);
+}
+
+uint32_t sh34_base_device::tcnt1_r(offs_t offset, uint32_t mem_mask)
+{
+ if (m_tstr & 2)
+ return compute_ticks_timer(m_timer[1], m_pm_clock, tcnt_div[m_tcr1 & 7]);
+ else
+ return m_tcnt1;
+}
+
+void sh34_base_device::tcnt1_w(offs_t offset, uint32_t data, uint32_t mem_mask)
+{
+ COMBINE_DATA(&m_tcnt1);
+ if (m_tstr & 2)
sh4_timer_recompute(1);
- }
- if (!(m_SH4_TCR1 & 0x20) || !(m_SH4_TCR1 & 0x100))
- sh4_exception_unrequest(SH4_INTC_TUNI1);
}
-void sh34_base_device::sh4_handle_tcr2_addr_w(uint32_t data, uint32_t mem_mask)
+uint16_t sh34_base_device::tcr1_r(offs_t offset, uint16_t mem_mask)
{
- uint32_t old2 = m_SH4_TCR2;
- COMBINE_DATA(&m_SH4_TCR2);
- if (m_SH4_TSTR & 4)
+ return m_tcr1;
+}
+
+void sh34_base_device::tcr1_w(offs_t offset, uint16_t data, uint16_t mem_mask)
+{
+ uint32_t old2 = m_tcr1;
+ COMBINE_DATA(&m_tcr1);
+ if (m_tstr & 2)
{
- m_SH4_TCNT2 = compute_ticks_timer(m_timer[2], m_pm_clock, tcnt_div[old2 & 7]);
- sh4_timer_recompute(2);
+ m_tcnt1 = compute_ticks_timer(m_timer[1], m_pm_clock, tcnt_div[old2 & 7]);
+ sh4_timer_recompute(1);
}
- if (!(m_SH4_TCR2 & 0x20) || !(m_SH4_TCR2 & 0x100))
- sh4_exception_unrequest(SH4_INTC_TUNI2);
+ if (!(m_tcr1 & 0x20) || !(m_tcr1 & 0x100))
+ sh4_exception_unrequest(SH4_INTC_TUNI1);
}
-void sh34_base_device::sh4_handle_tcor0_addr_w(uint32_t data, uint32_t mem_mask)
+uint32_t sh34_base_device::tcor2_r(offs_t offset, uint32_t mem_mask)
{
- COMBINE_DATA(&m_SH4_TCOR0);
+ return m_tcor2;
}
-void sh34_base_device::sh4_handle_tcor1_addr_w(uint32_t data, uint32_t mem_mask)
+void sh34_base_device::tcor2_w(offs_t offset, uint32_t data, uint32_t mem_mask)
{
- COMBINE_DATA(&m_SH4_TCOR1);
+ COMBINE_DATA(&m_tcor2);
}
-void sh34_base_device::sh4_handle_tcor2_addr_w(uint32_t data, uint32_t mem_mask)
+uint32_t sh34_base_device::tcnt2_r(offs_t offset, uint32_t mem_mask)
{
- COMBINE_DATA(&m_SH4_TCOR2);
+ if (m_tstr & 4)
+ return compute_ticks_timer(m_timer[2], m_pm_clock, tcnt_div[m_tcr2 & 7]);
+ else
+ return m_tcnt2;
}
-void sh34_base_device::sh4_handle_tcnt0_addr_w(uint32_t data, uint32_t mem_mask)
+void sh34_base_device::tcnt2_w(offs_t offset, uint32_t data, uint32_t mem_mask)
{
- COMBINE_DATA(&m_SH4_TCNT0);
- if (m_SH4_TSTR & 1)
- sh4_timer_recompute(0);
+ COMBINE_DATA(&m_tcnt2);
+ if (m_tstr & 4)
+ sh4_timer_recompute(2);
}
-void sh34_base_device::sh4_handle_tcnt1_addr_w(uint32_t data, uint32_t mem_mask)
+uint16_t sh34_base_device::tcr2_r(offs_t offset, uint16_t mem_mask)
{
- COMBINE_DATA(&m_SH4_TCNT1);
- if (m_SH4_TSTR & 2)
- sh4_timer_recompute(1);
+ return m_tcr2;
}
-void sh34_base_device::sh4_handle_tcnt2_addr_w(uint32_t data, uint32_t mem_mask)
+void sh34_base_device::tcr2_w(offs_t offset, uint16_t data, uint16_t mem_mask)
{
- COMBINE_DATA(&m_SH4_TCNT2);
- if (m_SH4_TSTR & 4)
+ uint32_t old2 = m_tcr2;
+ COMBINE_DATA(&m_tcr2);
+ if (m_tstr & 4)
+ {
+ m_tcnt2 = compute_ticks_timer(m_timer[2], m_pm_clock, tcnt_div[old2 & 7]);
sh4_timer_recompute(2);
+ }
+ if (!(m_tcr2 & 0x20) || !(m_tcr2 & 0x100))
+ sh4_exception_unrequest(SH4_INTC_TUNI2);
}
-void sh34_base_device::sh4_handle_tocr_addr_w(uint32_t data, uint32_t mem_mask)
+uint32_t sh34_base_device::tcpr2_r(offs_t offset, uint32_t mem_mask)
{
- COMBINE_DATA(&m_SH4_TOCR);
+ return m_tcpr2;
}
-void sh34_base_device::sh4_handle_tcpr2_addr_w(uint32_t data, uint32_t mem_mask)
+void sh34_base_device::tcpr2_w(offs_t offset, uint32_t data, uint32_t mem_mask)
{
- COMBINE_DATA(&m_SH4_TCPR2);
+ COMBINE_DATA(&m_tcpr2);
}