summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Angelo Salese <angelosa@users.noreply.github.com>2011-06-18 17:52:17 +0000
committer Angelo Salese <angelosa@users.noreply.github.com>2011-06-18 17:52:17 +0000
commit46c6f676b018711bf951d056d11a26027a02edff (patch)
tree559442ab3c9b2bb01618a5821ff5388bdb580ea3 /src
parent82878b5a643af66827fd0dc133d288967ea46e29 (diff)
Port from MESS, nw
Diffstat (limited to 'src')
-rw-r--r--src/mame/drivers/saturn.c38
-rw-r--r--src/mame/machine/stvcd.c12
2 files changed, 29 insertions, 21 deletions
diff --git a/src/mame/drivers/saturn.c b/src/mame/drivers/saturn.c
index 9f8e4f02e1e..123e9b24049 100644
--- a/src/mame/drivers/saturn.c
+++ b/src/mame/drivers/saturn.c
@@ -1273,7 +1273,7 @@ static READ32_HANDLER( saturn_scu_r )
state->m_scu_regs[41]|= (stv_irq.vdp1_end & 1)<<13;
state->m_scu_regs[41]|= (stv_irq.abus & 1)<<15;
- return state->m_scu_regs[41] ^ 0xffffffff;
+ return state->m_scu_regs[41] ^ 0xffffffff; //TODO: this is WRONG (Choice Cuts is a good test case)
}
else if( offset == 50 )
{
@@ -1577,7 +1577,7 @@ static void scu_dma_direct(address_space *space, UINT8 dma_ch)
{
state->m_scu.dst_add[dma_ch] = (scu_add_tmp & 0xff00) >> 8;
state->m_scu.src_add[dma_ch] = (scu_add_tmp & 0x00ff) >> 0;
- scu_add_tmp^=0x80000000;
+ scu_add_tmp&=~0x80000000;
}
}
@@ -1589,37 +1589,39 @@ static void scu_dma_indirect(address_space *space,UINT8 dma_ch)
UINT8 job_done = 0;
/*temporary storage for the transfer data*/
UINT32 tmp_src;
+ UINT32 indirect_src,indirect_dst;
+ INT32 indirect_size;
DnMV_1(dma_ch);
- if(state->m_scu.index[dma_ch] == 0) { state->m_scu.index[dma_ch] = state->m_scu.dst[0]; }
+ state->m_scu.index[dma_ch] = state->m_scu.dst[dma_ch];
do{
tmp_src = state->m_scu.index[dma_ch];
- state->m_scu.size[dma_ch] = space->read_dword(state->m_scu.index[dma_ch]);
- state->m_scu.src[dma_ch] = space->read_dword(state->m_scu.index[dma_ch]+8);
- state->m_scu.dst[dma_ch] = space->read_dword(state->m_scu.index[dma_ch]+4);
+ indirect_size = space->read_dword(state->m_scu.index[dma_ch]);
+ indirect_src = space->read_dword(state->m_scu.index[dma_ch]+8);
+ indirect_dst = space->read_dword(state->m_scu.index[dma_ch]+4);
/*Indirect Mode end factor*/
- if(state->m_scu.src[dma_ch] & 0x80000000)
+ if(indirect_src & 0x80000000)
job_done = 1;
if(LOG_SCU) printf("DMA lv %d indirect mode transfer START\n"
- "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]);
+ "Index %08x Start %08x End %08x Size %04x\n",dma_ch,tmp_src,indirect_src,indirect_dst,indirect_size);
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]);
//guess,but I believe it's right.
- state->m_scu.src[dma_ch] &=0x07ffffff;
- state->m_scu.dst[dma_ch] &=0x07ffffff;
- state->m_scu.size[dma_ch] &= ((dma_ch == 0) ? 0xfffff : 0x1fff);
+ indirect_src &=0x07ffffff;
+ indirect_dst &=0x07ffffff;
+ indirect_size &= ((dma_ch == 0) ? 0xfffff : 0x3ffff); //TODO: Guardian Heroes sets up a 0x23000 transfer for the FMV?
- if(state->m_scu.size[dma_ch] == 0) { state->m_scu.size[dma_ch] = (dma_ch == 0) ? 0x00100000 : 0x2000; }
+ if(indirect_size == 0) { indirect_size = (dma_ch == 0) ? 0x00100000 : 0x2000; }
- for (; state->m_scu.size[dma_ch] > 0; state->m_scu.size[dma_ch]-=state->m_scu.dst_add[dma_ch])
+ for (; indirect_size > 0; indirect_size-=state->m_scu.dst_add[dma_ch])
{
if(state->m_scu.dst_add[dma_ch] == 2)
- space->write_word(state->m_scu.dst[dma_ch],space->read_word(state->m_scu.src[dma_ch]));
+ space->write_word(indirect_dst,space->read_word(indirect_src));
else
{
/* some games, eg columns97 are a bit weird, I'm not sure this is correct
@@ -1627,11 +1629,11 @@ static void scu_dma_indirect(address_space *space,UINT8 dma_ch)
can't access 2 byte boundaries, and the end of the sprite list never gets marked,
the length of the transfer is also set to a 2 byte boundary, maybe the add values
should be different, I don't know */
- space->write_word(state->m_scu.dst[dma_ch],space->read_word(state->m_scu.src[dma_ch]));
- space->write_word(state->m_scu.dst[dma_ch]+2,space->read_word(state->m_scu.src[dma_ch]+2));
+ space->write_word(indirect_dst,space->read_word(indirect_src));
+ space->write_word(indirect_dst+2,space->read_word(indirect_src+2));
}
- state->m_scu.dst[dma_ch]+=state->m_scu.dst_add[dma_ch];
- state->m_scu.src[dma_ch]+=state->m_scu.src_add[dma_ch];
+ indirect_dst+=state->m_scu.dst_add[dma_ch];
+ indirect_src+=state->m_scu.src_add[dma_ch];
}
//if(DRUP(0)) space->write_dword(tmp_src+8,state->m_scu.src[0]|job_done ? 0x80000000 : 0);
diff --git a/src/mame/machine/stvcd.c b/src/mame/machine/stvcd.c
index 777571b191d..613d73dfba6 100644
--- a/src/mame/machine/stvcd.c
+++ b/src/mame/machine/stvcd.c
@@ -597,6 +597,7 @@ static void cd_writeWord(running_machine &machine, UINT32 addr, UINT16 data)
cr2 = 0xffff;
cr3 = 0xffff;
cr4 = 0xffff;
+ hirqreg |= CMOK;
return;
}
@@ -658,7 +659,7 @@ static void cd_writeWord(running_machine &machine, UINT32 addr, UINT16 data)
hirqreg |= (CMOK);
break;
- case 0x400: // initialize CD system
+ case 0x0400: // initialize CD system
// CR1 & 1 = reset software
// CR1 & 2 = decode RW subcode
// CR1 & 4 = don't confirm mode 2 subheader
@@ -910,8 +911,12 @@ static void cd_writeWord(running_machine &machine, UINT32 addr, UINT16 data)
}
break;
- case 0x3200:
- popmessage("Last Buffer Destination triggered, contact MAMEdev");
+ case 0x3200: // Last Buffer Destination
+ cr1 = cd_stat | 0;
+ cr2 = 0;
+ cr3 = lastbuf << 8;
+ cr4 = 0;
+ hirqreg |= (CMOK);
break;
case 0x4000: // Set Filter Range
@@ -1320,6 +1325,7 @@ static void cd_writeWord(running_machine &machine, UINT32 addr, UINT16 data)
hirqreg |= (CMOK|EFLS);
// TODO!
+ popmessage("X");
//temp = (cr3&0xff)<<16;
//temp |= cr4;