Previous 15994 Revisions Next

r11985 Saturday 18th June, 2011 at 15:31:29 UTC by Angelo Salese
Bunch of SCU indirect mode DMA fixes, allows Guardian Heroes to execute a little of its FMV
[src/mame/drivers]saturn.c
[src/mame/machine]stvcd.c

src/mame/machine/stvcd.c
r11984r11985
13251325         hirqreg |= (CMOK|EFLS);
13261326
13271327         // TODO!
1328         popmessage("X");
13281329
13291330         //temp = (cr3&0xff)<<16;
13301331         //temp |= cr4;
src/mame/drivers/saturn.c
r11984r11985
115115/* TODO: do this in a verboselog style */
116116#define LOG_CDB  0
117117#define LOG_SMPC 0
118#define LOG_SCU 
118#define LOG_SCU  1
119119#define LOG_IRQ  0
120120#define LOG_IOGA 0
121121
r11984r11985
15771577   {
15781578      state->m_scu.dst_add[dma_ch] = (scu_add_tmp & 0xff00) >> 8;
15791579      state->m_scu.src_add[dma_ch] = (scu_add_tmp & 0x00ff) >> 0;
1580      scu_add_tmp^=0x80000000;
1580      scu_add_tmp&=~0x80000000;
15811581   }
15821582}
15831583
r11984r11985
15891589   UINT8 job_done = 0;
15901590   /*temporary storage for the transfer data*/
15911591   UINT32 tmp_src;
1592   UINT32 indirect_src,indirect_dst;
1593   INT32 indirect_size;
15921594
15931595   DnMV_1(dma_ch);
15941596
1595   if(state->m_scu.index[dma_ch] == 0) { state->m_scu.index[dma_ch] = state->m_scu.dst[0]; }
1597   state->m_scu.index[dma_ch] = state->m_scu.dst[dma_ch];
15961598
15971599   do{
15981600      tmp_src = state->m_scu.index[dma_ch];
15991601
1600      state->m_scu.size[dma_ch] = space->read_dword(state->m_scu.index[dma_ch]);
1601      state->m_scu.src[dma_ch]  = space->read_dword(state->m_scu.index[dma_ch]+8);
1602      state->m_scu.dst[dma_ch]  = space->read_dword(state->m_scu.index[dma_ch]+4);
1602      indirect_size = space->read_dword(state->m_scu.index[dma_ch]);
1603      indirect_src  = space->read_dword(state->m_scu.index[dma_ch]+8);
1604      indirect_dst  = space->read_dword(state->m_scu.index[dma_ch]+4);
16031605
16041606      /*Indirect Mode end factor*/
1605      if(state->m_scu.src[dma_ch] & 0x80000000)
1607      if(indirect_src & 0x80000000)
16061608         job_done = 1;
16071609
16081610      if(LOG_SCU) printf("DMA lv %d indirect mode transfer START\n"
1609                        "Start %08x End %08x Size %04x\n",dma_ch,state->m_scu.src[dma_ch],state->m_scu.dst[dma_ch],state->m_scu.size[dma_ch]);
1611                       "Index %08x Start %08x End %08x Size %04x\n",dma_ch,tmp_src,indirect_src,indirect_dst,indirect_size);
16101612      if(LOG_SCU) printf("Start Add %04x Destination Add %04x\n",state->m_scu.src_add[dma_ch],state->m_scu.dst_add[dma_ch]);
16111613
16121614      //guess,but I believe it's right.
1613      state->m_scu.src[dma_ch] &=0x07ffffff;
1614      state->m_scu.dst[dma_ch] &=0x07ffffff;
1615      state->m_scu.size[dma_ch] &= ((dma_ch == 0) ? 0xfffff : 0x1fff);
1615      indirect_src &=0x07ffffff;
1616      indirect_dst &=0x07ffffff;
1617      indirect_size &= ((dma_ch == 0) ? 0xfffff : 0x3ffff); //TODO: Guardian Heroes sets up a 0x23000 transfer for the FMV?
16161618
1617      if(state->m_scu.size[dma_ch] == 0) { state->m_scu.size[dma_ch] = (dma_ch == 0) ? 0x00100000 : 0x2000; }
1619      if(indirect_size == 0) { indirect_size = (dma_ch == 0) ? 0x00100000 : 0x2000; }
16181620
1619      for (; state->m_scu.size[dma_ch] > 0; state->m_scu.size[dma_ch]-=state->m_scu.dst_add[dma_ch])
1621      for (; indirect_size > 0; indirect_size-=state->m_scu.dst_add[dma_ch])
16201622      {
16211623         if(state->m_scu.dst_add[dma_ch] == 2)
1622            space->write_word(state->m_scu.dst[dma_ch],space->read_word(state->m_scu.src[dma_ch]));
1624            space->write_word(indirect_dst,space->read_word(indirect_src));
16231625         else
16241626         {
16251627            /* some games, eg columns97 are a bit weird, I'm not sure this is correct
r11984r11985
16271629                  can't access 2 byte boundaries, and the end of the sprite list never gets marked,
16281630                  the length of the transfer is also set to a 2 byte boundary, maybe the add values
16291631                  should be different, I don't know */
1630            space->write_word(state->m_scu.dst[dma_ch],space->read_word(state->m_scu.src[dma_ch]));
1631            space->write_word(state->m_scu.dst[dma_ch]+2,space->read_word(state->m_scu.src[dma_ch]+2));
1632            space->write_word(indirect_dst,space->read_word(indirect_src));
1633            space->write_word(indirect_dst+2,space->read_word(indirect_src+2));
16321634         }
1633         state->m_scu.dst[dma_ch]+=state->m_scu.dst_add[dma_ch];
1634         state->m_scu.src[dma_ch]+=state->m_scu.src_add[dma_ch];
1635         indirect_dst+=state->m_scu.dst_add[dma_ch];
1636         indirect_src+=state->m_scu.src_add[dma_ch];
16351637      }
16361638
16371639      //if(DRUP(0))   space->write_dword(tmp_src+8,state->m_scu.src[0]|job_done ? 0x80000000 : 0);

Previous 15994 Revisions Next


© 1998-2018 The MESS Team