summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/saturn.c
diff options
context:
space:
mode:
author Angelo Salese <angelosa@users.noreply.github.com>2013-01-29 01:28:00 +0000
committer Angelo Salese <angelosa@users.noreply.github.com>2013-01-29 01:28:00 +0000
commita7cea9231fa7465279149f737d75494b204d6de8 (patch)
tree9c9fce977ec062f589d2f3065c591636c67ca97b /src/mame/drivers/saturn.c
parent82d94720481fd46c0273fe56939ebfd26bde1881 (diff)
Do the same for Indirect DMA too
Diffstat (limited to 'src/mame/drivers/saturn.c')
-rw-r--r--src/mame/drivers/saturn.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/mame/drivers/saturn.c b/src/mame/drivers/saturn.c
index 3d9d4d2fd34..ec74ab2f7bb 100644
--- a/src/mame/drivers/saturn.c
+++ b/src/mame/drivers/saturn.c
@@ -448,7 +448,7 @@ void saturn_state::scu_single_transfer(address_space &space, UINT32 src, UINT32
void saturn_state::scu_dma_direct(address_space &space, UINT8 dma_ch)
{
- UINT32 tmp_src,tmp_dst,tmp_size;
+ UINT32 tmp_src,tmp_dst,total_size;
UINT8 cd_transfer_flag;
if(m_scu.src_add[dma_ch] == 0 || (m_scu.dst_add[dma_ch] != 2 && m_scu.dst_add[dma_ch] != 4))
@@ -469,7 +469,7 @@ void saturn_state::scu_dma_direct(address_space &space, UINT8 dma_ch)
tmp_src = tmp_dst = 0;
- tmp_size = m_scu.size[dma_ch];
+ total_size = m_scu.size[dma_ch];
if(!(DRUP(dma_ch))) tmp_src = m_scu.src[dma_ch];
if(!(DWUP(dma_ch))) tmp_dst = m_scu.dst[dma_ch];
@@ -518,12 +518,12 @@ void saturn_state::scu_dma_direct(address_space &space, UINT8 dma_ch)
if(!(DWUP(dma_ch))) m_scu.dst[dma_ch] = tmp_dst;
{
- /*TODO: change DMA into DRQ model. */
+ /*TODO: change DMA into DRQ model. Timing is a guess. */
switch(dma_ch)
{
- case 0: machine().scheduler().timer_set(m_maincpu->cycles_to_attotime(tmp_size/4), timer_expired_delegate(FUNC(saturn_state::dma_lv0_ended),this)); break;
- case 1: machine().scheduler().timer_set(m_maincpu->cycles_to_attotime(tmp_size/4), timer_expired_delegate(FUNC(saturn_state::dma_lv1_ended),this)); break;
- case 2: machine().scheduler().timer_set(m_maincpu->cycles_to_attotime(tmp_size/4), timer_expired_delegate(FUNC(saturn_state::dma_lv2_ended),this)); break;
+ case 0: machine().scheduler().timer_set(m_maincpu->cycles_to_attotime(total_size/4), timer_expired_delegate(FUNC(saturn_state::dma_lv0_ended),this)); break;
+ case 1: machine().scheduler().timer_set(m_maincpu->cycles_to_attotime(total_size/4), timer_expired_delegate(FUNC(saturn_state::dma_lv1_ended),this)); break;
+ case 2: machine().scheduler().timer_set(m_maincpu->cycles_to_attotime(total_size/4), timer_expired_delegate(FUNC(saturn_state::dma_lv2_ended),this)); break;
}
}
}
@@ -536,6 +536,7 @@ void saturn_state::scu_dma_indirect(address_space &space,UINT8 dma_ch)
UINT32 tmp_src;
UINT32 indirect_src,indirect_dst;
INT32 indirect_size;
+ UINT32 total_size = 0;
DnMV_1(dma_ch);
@@ -582,7 +583,10 @@ void saturn_state::scu_dma_indirect(address_space &space,UINT8 dma_ch)
}
}
- //if(DRUP(0)) space.write_dword(tmp_src+8,m_scu.src[0]|job_done ? 0x80000000 : 0);
+ /* Guess: Size + data acquire (1 cycle for src/dst/size) */
+ total_size += indirect_size + 3*4;
+
+ //if(DRUP(0)) space.write_dword(tmp_src+8,m_scu.src[0]|job_done ? 0x80000000 : 0);
//if(DWUP(0)) space.write_dword(tmp_src+4,m_scu.dst[0]);
m_scu.index[dma_ch] = tmp_src+0xc;
@@ -590,12 +594,12 @@ void saturn_state::scu_dma_indirect(address_space &space,UINT8 dma_ch)
}while(job_done == 0);
{
- /*TODO: this is completely wrong HW-wise ... */
+ /*TODO: change DMA into DRQ model. Timing is a guess. */
switch(dma_ch)
{
- case 0: machine().scheduler().timer_set(attotime::from_usec(300), timer_expired_delegate(FUNC(saturn_state::dma_lv0_ended),this)); break;
- case 1: machine().scheduler().timer_set(attotime::from_usec(300), timer_expired_delegate(FUNC(saturn_state::dma_lv1_ended),this)); break;
- case 2: machine().scheduler().timer_set(attotime::from_usec(300), timer_expired_delegate(FUNC(saturn_state::dma_lv2_ended),this)); break;
+ case 0: machine().scheduler().timer_set(m_maincpu->cycles_to_attotime(total_size/4), timer_expired_delegate(FUNC(saturn_state::dma_lv0_ended),this)); break;
+ case 1: machine().scheduler().timer_set(m_maincpu->cycles_to_attotime(total_size/4), timer_expired_delegate(FUNC(saturn_state::dma_lv1_ended),this)); break;
+ case 2: machine().scheduler().timer_set(m_maincpu->cycles_to_attotime(total_size/4), timer_expired_delegate(FUNC(saturn_state::dma_lv2_ended),this)); break;
}
}
}