diff --git a/src/mame/machine/megacd.c b/src/mame/machine/megacd.c index 2b27d286d21..df244accc84 100644 --- a/src/mame/machine/megacd.c +++ b/src/mame/machine/megacd.c @@ -1758,7 +1758,7 @@ TIMER_DEVICE_CALLBACK_MEMBER( sega_segacd_device::scd_dma_timer_callback ) // timed reset of flags scd_mode_dmna_ret_flags |= 0x0021; - + scd_dma_timer->adjust(attotime::from_hz(megadriv_framerate) / megadrive_total_scanlines); } diff --git a/src/mame/machine/megacdcd.c b/src/mame/machine/megacdcd.c index b001123f41a..c7222a145a7 100644 --- a/src/mame/machine/megacdcd.c +++ b/src/mame/machine/megacdcd.c @@ -441,6 +441,8 @@ void lc89510_temp_device::CDC_Reset(void) LC8951RegistersW[REG_W_WAL] = wa & 0xff; LC8951RegistersW[REG_W_WAH] = (wa >> 8) &0xff; LC8951RegistersR[REG_R_HEAD0] = 0x01; LC8951RegistersR[REG_R_STAT3] = 0x80; + + } @@ -642,19 +644,39 @@ void lc89510_temp_device::CDC_Reg_w(UINT8 data) case REG_W_DACH: LC8951RegistersW[REG_W_DACH] = data; break; case REG_W_DTTRG: - if (LC8951RegistersW[REG_W_IFCTRL] & 0x02) + if (!is_neoCD) { + if (LC8951RegistersW[REG_W_IFCTRL] & 0x02) + { + LC8951RegistersR[REG_R_IFSTAT] &= ~0x08; + SET_CDC_DMA; + CDC_REG0 &= ~0x8000; + } + } + else + { + LC8951RegistersW[REG_W_DTTRG] = ~0x00; LC8951RegistersR[REG_R_IFSTAT] &= ~0x08; - SET_CDC_DMA; - CDC_REG0 &= ~0x8000; } break; - case REG_W_DTACK: LC8951RegistersR[REG_R_IFSTAT] |= 0x40; break; + case REG_W_DTACK: + //if (!is_neoCD) + { + LC8951RegistersR[REG_R_IFSTAT] |= 0x40; + } + //else + //{ + // LC8951RegistersW[REG_W_DTACK] = ~0x00; + // LC8951RegistersR[REG_R_IFSTAT] &= ~0x40; + //} + break; case REG_W_WAL: LC8951RegistersW[REG_W_WAL] = data; break; case REG_W_WAH: LC8951RegistersW[REG_W_WAH] = data; break; case REG_W_CTRL0: LC8951RegistersW[REG_W_CTRL0] = data; break; - case REG_W_CTRL1: LC8951RegistersW[REG_W_CTRL1] = data; break; + case REG_W_CTRL1: LC8951RegistersW[REG_W_CTRL1] = data; + //LC8951UpdateHeader(); // NeoCD + break; case REG_W_PTL: LC8951RegistersW[REG_W_PTL] = data; break; case REG_W_PTH: LC8951RegistersW[REG_W_PTH] = data; break; case REG_W_CTRL2: LC8951RegistersW[REG_W_CTRL2] = data; break; @@ -662,6 +684,8 @@ void lc89510_temp_device::CDC_Reg_w(UINT8 data) } } + + void lc89510_temp_device::CDD_Process(running_machine& machine, int reason) { CDD_Export(); @@ -947,13 +971,12 @@ void lc89510_temp_device::reset_cd(void) - if (segacd.cd) - printf("cd found\n"); +// if (segacd.cd) +// printf("cd found\n"); } - TIMER_DEVICE_CALLBACK_MEMBER( lc89510_temp_device::segacd_access_timer_callback ) { if (!is_neoCD) @@ -1292,33 +1315,9 @@ void lc89510_temp_device::LC8915EndTransfer() } } -void lc89510_temp_device::LC8951Reset() -{ - memset(LC8951RegistersR, 0, sizeof(LC8951RegistersR)); - memset(LC8951RegistersW, 0, sizeof(LC8951RegistersW)); - LC8951RegistersR[REG_R_IFSTAT] = 0xFF; - LC8951RegistersR[REG_R_STAT3] = 0x80; - LC8951UpdateHeader(); -} -void lc89510_temp_device::reset_NeoCd(void) -{ - { - cdrom_image_device *cddevice = machine().device("cdrom"); - if ( cddevice ) - { - segacd.cd = cddevice->get_cdrom_file(); - if ( segacd.cd ) - { - printf("found cd\n"); - segacd.toc = cdrom_get_toc( segacd.cd ); - cdda_set_cdrom( m_cdda, segacd.cd ); - cdda_stop_audio( m_cdda ); //stop any pending CD-DA - } - } - } -} + /* @@ -1535,37 +1534,3 @@ void lc89510_temp_device::nff0016_set(UINT16 wordValue) UINT16 lc89510_temp_device::nff0016_r(void) { return nff0016; } -void lc89510_temp_device::nLC8951_w(UINT16 byteValue) -{ - int regno = CDC_REG0 & 0xf; - - switch (regno) { - case 3: // DBCH - LC8951RegistersW[REG_W_DBCH] = byteValue & 0x0F; - break; - case 6: // DTTRG - LC8951RegistersW[REG_W_DTTRG] = ~0x00; - LC8951RegistersR[REG_R_IFSTAT] &= ~0x08; - break; - case 7: // DTACK - LC8951RegistersW[REG_W_DTACK] = ~0x00; - LC8951RegistersR[REG_R_IFSTAT] &= ~0x40; - break; -// case 10: -// LC8951RegistersW[regno] = byteValue; -// bprintf(PRINT_NORMAL, _T(" - CTRL0 -> %02X (PC: 0x%06X)\n"), LC8951RegistersW[regno], byteValue, SekGetPC(-1)); -// break; - case 11: - LC8951RegistersW[REG_W_CTRL1] = byteValue; // CTRL1 - LC8951UpdateHeader(); - break; - case 15: - LC8951Reset(); - break; - default: - LC8951RegistersW[regno] = byteValue; - } - CDC_REG0 = (regno + 1) & 0x0F; -} - - diff --git a/src/mame/machine/megacdcd.h b/src/mame/machine/megacdcd.h index 1c816faa79a..6d996dda1e1 100644 --- a/src/mame/machine/megacdcd.h +++ b/src/mame/machine/megacdcd.h @@ -296,15 +296,13 @@ public: void LC8951UpdateHeader(); char* LC8915InitTransfer(int NeoCDDMACount); void LC8915EndTransfer(); - void LC8951Reset(); + void neocd_cdd_tx_w(UINT8 data); UINT8 neocd_cdd_rx_r(); void NeoCDCommsReset(); INT32 CDEmuLoadSector(INT32 LBA, char* pBuffer); - void reset_NeoCd(void); - void nLC8951_w(UINT16 byteValue); UINT16 nff0016_r(void); void nff0016_set(UINT16 wordValue); void nff0002_set(UINT16 wordValue); diff --git a/src/mess/drivers/ng_aes.c b/src/mess/drivers/ng_aes.c index 5e8e7999907..7660f92551d 100644 --- a/src/mess/drivers/ng_aes.c +++ b/src/mess/drivers/ng_aes.c @@ -793,7 +793,7 @@ void ng_aes_state::neogeoWriteWordCDROM(UINT32 sekAddress, UINT16 wordValue) m_tempcdc->segacd_cdc_mode_address_w(*curr_space, 0, byteValue, 0xffff); break; case 0x0102: - m_tempcdc->nLC8951_w(byteValue); + m_tempcdc->CDC_Reg_w(byteValue); break; case 0x0104: @@ -1465,7 +1465,7 @@ MACHINE_START_MEMBER(ng_aes_state,neocd) // for custom vectors machine().device("maincpu")->execute().set_irq_acknowledge_callback(neocd_int_callback); - m_tempcdc->reset_NeoCd(); + m_tempcdc->reset_cd(); }