summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices
diff options
context:
space:
mode:
author angelosa <lordkale4@gmail.com>2025-11-16 19:54:31 +0100
committer angelosa <lordkale4@gmail.com>2025-11-16 19:54:31 +0100
commit661381746bf01462df2c40f3567918293a70a379 (patch)
treec6ba6b5606f821421728b2085c345ac7d698bce9 /src/devices
parent3c38125ab387f16ba3dd083e6be8b398254f0b96 (diff)
cpu/sh/sh7604.cpp: fix BCR1/BCR2 and VCRDIV accessing
Diffstat (limited to 'src/devices')
-rw-r--r--src/devices/cpu/sh/sh7604.cpp29
-rw-r--r--src/devices/machine/sega_scu.cpp4
-rw-r--r--src/devices/sound/scsp.cpp30
3 files changed, 45 insertions, 18 deletions
diff --git a/src/devices/cpu/sh/sh7604.cpp b/src/devices/cpu/sh/sh7604.cpp
index 54205d5c0cc..7841c578c07 100644
--- a/src/devices/cpu/sh/sh7604.cpp
+++ b/src/devices/cpu/sh/sh7604.cpp
@@ -1083,16 +1083,17 @@ void sh7604_device::vcrwdt_w(offs_t offset, uint16_t data, uint16_t mem_mask)
sh2_recalc_irq();
}
+// VCRDIV is a word register where bits 6-0 have a meaning, reads back written word value
uint32_t sh7604_device::vcrdiv_r()
{
- return m_vcrdiv & 0x7f;
+ return m_vcrdiv & 0xffff;
}
void sh7604_device::vcrdiv_w(offs_t offset, uint32_t data, uint32_t mem_mask)
{
COMBINE_DATA(&m_vcrdiv);
// TODO: unemulated, level is seemingly not documented/settable?
- m_irq_vector.divu = data & 0x7f;
+ m_irq_vector.divu = m_vcrdiv & 0x7f;
sh2_recalc_irq();
}
@@ -1356,6 +1357,8 @@ void sh7604_device::ccr_w(uint8_t data)
m_ccr = data;
}
+// BCR1/BCR2 are really 16-bit wide, when accessed as dword the upper part is used as unlock
+// method (0xa55axxxx) and reads back 0.
uint32_t sh7604_device::bcr1_r()
{
return (m_bcr1 & ~0xe008) | (m_is_slave ? 0x8000 : 0);
@@ -1363,7 +1366,16 @@ uint32_t sh7604_device::bcr1_r()
void sh7604_device::bcr1_w(offs_t offset, uint32_t data, uint32_t mem_mask)
{
- COMBINE_DATA(&m_bcr1);
+ if (ACCESSING_BITS_0_31)
+ {
+ if ((data & 0xffff0000) == 0xa55a0000)
+ {
+ COMBINE_DATA(&m_bcr1);
+ m_bcr1 &= 0xffff;
+ }
+ }
+ else if (ACCESSING_BITS_0_15)
+ COMBINE_DATA(&m_bcr1);
}
uint32_t sh7604_device::bcr2_r()
@@ -1373,7 +1385,16 @@ uint32_t sh7604_device::bcr2_r()
void sh7604_device::bcr2_w(offs_t offset, uint32_t data, uint32_t mem_mask)
{
- COMBINE_DATA(&m_bcr2);
+ if (ACCESSING_BITS_0_31)
+ {
+ if ((data & 0xffff0000) == 0xa55a0000)
+ {
+ COMBINE_DATA(&m_bcr2);
+ m_bcr2 &= 0xffff;
+ }
+ }
+ else if (ACCESSING_BITS_0_15)
+ COMBINE_DATA(&m_bcr2);
}
uint32_t sh7604_device::wcr_r()
diff --git a/src/devices/machine/sega_scu.cpp b/src/devices/machine/sega_scu.cpp
index 57214053b36..571992950da 100644
--- a/src/devices/machine/sega_scu.cpp
+++ b/src/devices/machine/sega_scu.cpp
@@ -596,12 +596,12 @@ void sega_scu_device::t1_mode_w(uint16_t data)
}
-void sega_scu_device::check_scanline_timers(int scanline,int y_step)
+void sega_scu_device::check_scanline_timers(int scanline, int y_step)
{
if(m_tenb == false)
return;
- int timer0_compare = (m_t0c & 0x3ff)*y_step;
+ int timer0_compare = (m_t0c & 0x3ff) * y_step;
// Timer 0
if(scanline == timer0_compare)
diff --git a/src/devices/sound/scsp.cpp b/src/devices/sound/scsp.cpp
index e471d35a811..6125ee155be 100644
--- a/src/devices/sound/scsp.cpp
+++ b/src/devices/sound/scsp.cpp
@@ -739,7 +739,8 @@ void scsp_device::UpdateReg(int reg)
case 8:
case 9:
/* Only MSLC could be written. */
- m_udata.data[0x8/2] &= 0xf800; /**< @todo Docs claims MSLC to be 0x7800, but Jikkyou Parodius doesn't agree. */
+ // NOTE: docs claims MSLC to be 0x7800, but Jikkyou Parodius doesn't agree, why?
+ m_udata.data[0x8/2] &= 0xf800;
break;
case 0x12:
case 0x13:
@@ -792,8 +793,8 @@ void scsp_device::UpdateReg(int reg)
}
}
break;
- case 0x1C:
- case 0x1D:
+ case 0x1c:
+ case 0x1d:
if (!m_irq_cb.isunset())
{
m_TimPris[2] = 1 << ((m_udata.data[0x1C/2] >> 8) & 0x7);
@@ -816,7 +817,7 @@ void scsp_device::UpdateReg(int reg)
CheckPendingIRQ();
if (m_udata.data[0x1e/2] & 0x610)
- popmessage("SCSP SCIEB enabled %04x, contact MAMEdev",m_udata.data[0x1e/2]);
+ popmessage("SCSP SCIEB enabled %04x",m_udata.data[0x1e/2]);
}
break;
case 0x20: // SCIPD
@@ -824,12 +825,11 @@ void scsp_device::UpdateReg(int reg)
if (!m_irq_cb.isunset())
{
if (m_udata.data[0x1e/2] & m_udata.data[0x20/2] & 0x20)
- popmessage("SCSP SCIPD write %04x, contact MAMEdev",m_udata.data[0x20/2]);
+ popmessage("SCSP SCIPD write %04x", m_udata.data[0x20/2]);
}
break;
case 0x22: //SCIRE
case 0x23:
-
if (!m_irq_cb.isunset())
{
m_udata.data[0x20/2] &= ~m_udata.data[0x22/2];
@@ -870,7 +870,7 @@ void scsp_device::UpdateReg(int reg)
MainCheckPendingIRQ(0);
if (m_mcieb & ~0x60)
- popmessage("SCSP MCIEB enabled %04x, contact MAMEdev",m_mcieb);
+ popmessage("SCSP MCIEB enabled %04x",m_mcieb);
break;
case 0x2c:
case 0x2d:
@@ -941,6 +941,10 @@ void scsp_device::UpdateRegR(int reg)
case 0x1d:
break;
+ //case 0x20:
+ // m_udata.data[0x20/2] ^= 0x400;
+ // break;
+
case 0x2a:
case 0x2b:
m_udata.data[0x2a/2] = m_mcieb;
@@ -1051,10 +1055,12 @@ u16 scsp_device::r16(u32 addr)
v = *((u16 *) (m_DSP.EFREG + (addr - 0xec0) / 2));
else
{
- /**!
- @todo Kyuutenkai reads from 0xee0/0xee2, it's tied with EXTS register(s) also used for CD-Rom Player equalizer.
+ // TODO: kyutnkai reads from 0xee0/0xee2
+ // it's tied with EXTS register(s) also used for CD-Rom Player equalizer.
+ /*
This port is actually an external parallel port, directly connected from the CD Block device, hence code is a bit of an hack.
- Kyuutenkai code snippet for reference:
+
+ Code snippet for reference:
004A3A: 207C 0010 0EE0 movea.l #$100ee0, A0
004A40: 43EA 0090 lea ($90,A2), A1 ;A2=0x700
004A44: 6100 0254 bsr $4c9a
@@ -1353,7 +1359,7 @@ void scsp_device::exec_dma()
"DGATE: %d DDIR: %d\n", m_dma.dmea, m_dma.drga, m_dma.dtlg, m_dma.dgate ? 1 : 0, m_dma.ddir ? 1 : 0);
/* Copy the dma values in a temp storage for resuming later */
- /* (DMA *can't* overwrite its parameters). */
+ /* (DMA *can't* overwrite its parameters). */
if (!(m_dma.ddir))
{
for (i = 0; i < 3; i++)
@@ -1420,7 +1426,7 @@ void scsp_device::exec_dma()
/* request a dma end irq (TODO: make it inside the interface) */
if (m_udata.data[0x1e/2] & 0x10)
{
- popmessage("SCSP DMA IRQ triggered, contact MAMEdev");
+ popmessage("SCSP DMA IRQ triggered");
m_irq_cb(DecodeSCI(SCIDMA), HOLD_LINE);
}
}