[Core/CD] improved CDC emulation (fixes random freezes during Jeopardy & ESPN Sunday Night NFL intro)

This commit is contained in:
EkeEke 2015-05-31 18:57:21 +02:00
parent a07f7a3d24
commit 304219da58
3 changed files with 9 additions and 13 deletions

View File

@ -2,7 +2,7 @@
* Genesis Plus * Genesis Plus
* CD data controller (LC89510 compatible) * CD data controller (LC89510 compatible)
* *
* Copyright (C) 2012 Eke-Eke (Genesis Plus GX) * Copyright (C) 2012-2015 Eke-Eke (Genesis Plus GX)
* *
* Redistribution and use of this code or any derivative works are permitted * Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met: * provided that the following conditions are met:
@ -376,8 +376,8 @@ void cdc_reg_w(unsigned char data)
/* start data transfer if data output is enabled */ /* start data transfer if data output is enabled */
if (cdc.ifctrl & BIT_DOUTEN) if (cdc.ifctrl & BIT_DOUTEN)
{ {
/* set !DTBSY */ /* set !DTBSY and !DTEN */
cdc.ifstat &= ~BIT_DTBSY; cdc.ifstat &= ~(BIT_DTBSY | BIT_DTEN);
/* clear DBCH bits 4-7 */ /* clear DBCH bits 4-7 */
cdc.dbc.byte.h &= 0x0f; cdc.dbc.byte.h &= 0x0f;
@ -391,10 +391,7 @@ void cdc_reg_w(unsigned char data)
case 2: /* MAIN-CPU host read */ case 2: /* MAIN-CPU host read */
case 3: /* SUB-CPU host read */ case 3: /* SUB-CPU host read */
{ {
/* set !DTEN */ /* set DSR bit (SCD register $04) */
cdc.ifstat &= ~BIT_DTEN;
/* set DSR bit (register $04) */
scd.regs[0x04>>1].byte.h |= 0x40; scd.regs[0x04>>1].byte.h |= 0x40;
break; break;
} }
@ -645,7 +642,7 @@ unsigned char cdc_reg_r(void)
unsigned short cdc_host_r(void) unsigned short cdc_host_r(void)
{ {
/* check if data is available */ /* check if data is available */
if (!(cdc.ifstat & BIT_DTEN)) if (scd.regs[0x04>>1].byte.h & 0x40)
{ {
/* read data word from CDC RAM buffer */ /* read data word from CDC RAM buffer */
uint16 data = *(uint16 *)(cdc.ram + (cdc.dac.w & 0x3ffe)); uint16 data = *(uint16 *)(cdc.ram + (cdc.dac.w & 0x3ffe));

View File

@ -2,7 +2,7 @@
* Genesis Plus * Genesis Plus
* CD data controller (LC89510 compatible) * CD data controller (LC89510 compatible)
* *
* Copyright (C) 2012 Eke-Eke (Genesis Plus GX) * Copyright (C) 2012-2015 Eke-Eke (Genesis Plus GX)
* *
* Redistribution and use of this code or any derivative works are permitted * Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met: * provided that the following conditions are met:

View File

@ -1561,10 +1561,9 @@ void cdd_process(void)
{ {
/* Fixes a few games hanging during intro because they expect data to be read with some delay */ /* Fixes a few games hanging during intro because they expect data to be read with some delay */
/* Radical Rex needs at least one interrupt delay */ /* Radical Rex needs at least one interrupt delay */
/* Wolf Team games (Anet Futatabi, Cobra Command, Road Avenger & Time Gal) need at least 6 interrupts delay */ /* Wolf Team games (Anet Futatabi, Cobra Command, Road Avenger & Time Gal) need at least 7 interrupts delay */
/* Space Adventure Cobra (2nd morgue scene) needs at least 13 interrupts delay (incl. seek time, so 6 is OK) */ /* Space Adventure Cobra (2nd morgue scene) needs at least 13 interrupts delay (incl. seek time, so 7 is OK) */
/* Jeopardy & ESPN Sunday Night NFL are picky about this as well: 10 interrupts delay (+ seek time) seems OK */ cdd.latency = 7;
cdd.latency = 10;
} }
/* CD drive seek time */ /* CD drive seek time */