src/mame/drivers/saturn.c
| r11984 | r11985 | |
| 115 | 115 | /* TODO: do this in a verboselog style */ |
| 116 | 116 | #define LOG_CDB 0 |
| 117 | 117 | #define LOG_SMPC 0 |
| 118 | | #define LOG_SCU |
| 118 | #define LOG_SCU 1 |
| 119 | 119 | #define LOG_IRQ 0 |
| 120 | 120 | #define LOG_IOGA 0 |
| 121 | 121 | |
| r11984 | r11985 | |
| 1577 | 1577 | { |
| 1578 | 1578 | state->m_scu.dst_add[dma_ch] = (scu_add_tmp & 0xff00) >> 8; |
| 1579 | 1579 | state->m_scu.src_add[dma_ch] = (scu_add_tmp & 0x00ff) >> 0; |
| 1580 | | scu_add_tmp^=0x80000000; |
| 1580 | scu_add_tmp&=~0x80000000; |
| 1581 | 1581 | } |
| 1582 | 1582 | } |
| 1583 | 1583 | |
| r11984 | r11985 | |
| 1589 | 1589 | UINT8 job_done = 0; |
| 1590 | 1590 | /*temporary storage for the transfer data*/ |
| 1591 | 1591 | UINT32 tmp_src; |
| 1592 | UINT32 indirect_src,indirect_dst; |
| 1593 | INT32 indirect_size; |
| 1592 | 1594 | |
| 1593 | 1595 | DnMV_1(dma_ch); |
| 1594 | 1596 | |
| 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]; |
| 1596 | 1598 | |
| 1597 | 1599 | do{ |
| 1598 | 1600 | tmp_src = state->m_scu.index[dma_ch]; |
| 1599 | 1601 | |
| 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); |
| 1603 | 1605 | |
| 1604 | 1606 | /*Indirect Mode end factor*/ |
| 1605 | | if(state->m_scu.src[dma_ch] & 0x80000000) |
| 1607 | if(indirect_src & 0x80000000) |
| 1606 | 1608 | job_done = 1; |
| 1607 | 1609 | |
| 1608 | 1610 | 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); |
| 1610 | 1612 | 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]); |
| 1611 | 1613 | |
| 1612 | 1614 | //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? |
| 1616 | 1618 | |
| 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; } |
| 1618 | 1620 | |
| 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]) |
| 1620 | 1622 | { |
| 1621 | 1623 | 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)); |
| 1623 | 1625 | else |
| 1624 | 1626 | { |
| 1625 | 1627 | /* some games, eg columns97 are a bit weird, I'm not sure this is correct |
| r11984 | r11985 | |
| 1627 | 1629 | can't access 2 byte boundaries, and the end of the sprite list never gets marked, |
| 1628 | 1630 | the length of the transfer is also set to a 2 byte boundary, maybe the add values |
| 1629 | 1631 | 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)); |
| 1632 | 1634 | } |
| 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]; |
| 1635 | 1637 | } |
| 1636 | 1638 | |
| 1637 | 1639 | //if(DRUP(0)) space->write_dword(tmp_src+8,state->m_scu.src[0]|job_done ? 0x80000000 : 0); |