Fixed SCU DSP PC reads from SH-2 side. [Angelo Salese]

This commit is contained in:
Angelo Salese 2011-08-06 20:23:35 +00:00
parent 376bf4653a
commit fe6ba0865a
5 changed files with 47 additions and 10 deletions

View File

@ -520,6 +520,9 @@ static READ32_HANDLER( saturn_scu_r )
if(LOG_SCU) logerror("(PC=%08x) DMA status reg read\n",cpu_get_pc(&space->device()));
res = state->m_scu_regs[offset];
break;
case 0x80/4:
res = dsp_prg_ctrl_r(space);
break;
case 0x8c/4:
if(LOG_SCU) logerror( "DSP mem read at %08X\n", state->m_scu_regs[34]);
res = dsp_ram_addr_r();
@ -589,19 +592,20 @@ static WRITE32_HANDLER( saturn_scu_w )
case 0x7c/4: if(LOG_SCU) logerror("Warning: DMA status WRITE! Offset %02x(%d)\n",offset*4,offset); break;
/*DSP section*/
case 0x80/4:
dsp_prg_ctrl(space, data);
/* TODO: you can't overwrite some flags with this */
dsp_prg_ctrl(space, state->m_scu_regs[offset]);
if(LOG_SCU) logerror("SCU DSP: Program Control Port Access %08x\n",data);
break;
case 0x84/4:
dsp_prg_data(data);
dsp_prg_data(state->m_scu_regs[offset]);
if(LOG_SCU) logerror("SCU DSP: Program RAM Data Port Access %08x\n",data);
break;
case 0x88/4:
dsp_ram_addr_ctrl(data);
dsp_ram_addr_ctrl(state->m_scu_regs[offset]);
if(LOG_SCU) logerror("SCU DSP: Data RAM Address Port Access %08x\n",data);
break;
case 0x8c/4:
dsp_ram_addr_w(data);
dsp_ram_addr_w(state->m_scu_regs[offset]);
if(LOG_SCU) logerror("SCU DSP: Data RAM Data Port Access %08x\n",data);
break;
case 0x90/4: /*if(LOG_SCU) logerror("timer 0 compare data = %03x\n",state->m_scu_regs[36]);*/ break;

View File

@ -4,6 +4,10 @@ System Control Unit - DSP emulator version 0.08
Written by Angelo Salese & Mariusz Wojcieszek
Changelog:
110807: Angelo Salese
- Allow the Program Counter to be read-backable from SH-2, needed by Virtua Fighter to not
get stuck on "round 1" announcement;
110806: Angelo Salese
- Allows reading from non-work ram h areas;
- Fixed DMA add values;
@ -329,9 +333,18 @@ static UINT32 dsp_get_mem_source_dma( UINT32 memcode, UINT32 counter )
return 0;
}
void dsp_prg_ctrl(address_space *space, UINT32 data)
UINT32 dsp_prg_ctrl_r(address_space *space)
{
saturn_state *state = space->machine().driver_data<saturn_state>();
return (state->m_scu_regs[0x80/4] & 0x06ff8000) | (dsp_reg.pc & 0xff);
}
void dsp_prg_ctrl_w(address_space *space, UINT32 data)
{
saturn_state *state = space->machine().driver_data<saturn_state>();
data = state->m_scu_regs[0x80/4] & ;
if(LEF) dsp_reg.pc = (data & 0xff);
if(EXF) dsp_execute_program(space);
}

View File

@ -1,9 +1,10 @@
/*SCU DSP stuff*/
void dsp_prg_ctrl(address_space *space, UINT32 data);
void dsp_prg_ctrl_w(address_space *space, UINT32 data);
void dsp_prg_data(UINT32 data);
void dsp_ram_addr_ctrl(UINT32 data);
void dsp_ram_addr_w(UINT32 data);
UINT32 dsp_prg_ctrl_r(address_space *space);
UINT32 dsp_ram_addr_r(void);
void dsp_execute_program(address_space *dmaspace);

View File

@ -124,6 +124,7 @@ static transT xfertype;
static trans32T xfertype32;
static UINT32 xfercount, calcsize;
static UINT32 xferoffs, xfersect, xfersectpos, xfersectnum, xferdnum;
static UINT8 command;
static filterT filters[MAX_FILTERS];
static filterT *cddevice;
@ -196,7 +197,7 @@ TIMER_DEVICE_CALLBACK( stv_sector_cb )
{
cd_playdata();
}
else
//else
{
hirqreg |= SCDQ;
}
@ -594,21 +595,32 @@ static void cd_writeWord(running_machine &machine, UINT32 addr, UINT16 data)
// CDROM_LOG(("WW CR1: %04x\n", data))
cr1 = data;
cd_stat &= ~CD_STAT_PERI;
command |= 1;
break;
case 0x001c:
case 0x001e:
// CDROM_LOG(("WW CR2: %04x\n", data))
cr2 = data;
command |= 2;
break;
case 0x0020:
case 0x0022:
// CDROM_LOG(("WW CR3: %04x\n", data))
cr3 = data;
command |= 4;
break;
case 0x0024:
case 0x0026:
// CDROM_LOG(("WW CR4: %04x\n", data))
cr4 = data;
command |= 8;
if(command != 0xf)
return;
command = 0;
if(cr1 != 0 && ((cr1 & 0xff00) != 0x5100) && 1)
printf("CD: command exec %04x %04x %04x %04x %04x (stat %04x)\n", hirqreg, cr1, cr2, cr3, cr4, cd_stat);
@ -2166,8 +2178,14 @@ static void cd_playdata(void)
if(cdrom_get_track_type(cdrom, cdrom_get_track(cdrom, cd_curfad)) != CD_TRACK_AUDIO)
cd_read_filtered_sector(cd_curfad);
/* TODO: condition is wrong (should be "if partition isn't null") */
if(!buffull)
{
cd_curfad++;
fadstoplay--;
}
//else
// hirqreg |= SCDQ;
hirqreg |= CSCT;

View File

@ -4372,7 +4372,8 @@ static void stv_vdp2_check_tilemap(running_machine &machine, bitmap_t *bitmap, c
/* Choh Makai Mura 0x0055 */
/* Sega Rally 0x0155 */
/* Find Love 0x4400 */
if(STV_VDP2_SFPRMD & ~0x4555)
/* Dragon Ball Z 0x3800 - 0x2c00 */
if(STV_VDP2_SFPRMD & ~0x7d55)
popmessage("Special Priority Mode enabled %04x, contact MAMEdev",STV_VDP2_SFPRMD);
}
}