mirror of
https://github.com/holub/mame
synced 2025-07-01 08:18:59 +03:00
further neocd/scd code reduction (nw)
This commit is contained in:
parent
879a36d601
commit
acc197d05e
@ -1758,7 +1758,7 @@ TIMER_DEVICE_CALLBACK_MEMBER( sega_segacd_device::scd_dma_timer_callback )
|
|||||||
|
|
||||||
// timed reset of flags
|
// timed reset of flags
|
||||||
scd_mode_dmna_ret_flags |= 0x0021;
|
scd_mode_dmna_ret_flags |= 0x0021;
|
||||||
|
|
||||||
scd_dma_timer->adjust(attotime::from_hz(megadriv_framerate) / megadrive_total_scanlines);
|
scd_dma_timer->adjust(attotime::from_hz(megadriv_framerate) / megadrive_total_scanlines);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -441,6 +441,8 @@ void lc89510_temp_device::CDC_Reset(void)
|
|||||||
LC8951RegistersW[REG_W_WAL] = wa & 0xff; LC8951RegistersW[REG_W_WAH] = (wa >> 8) &0xff;
|
LC8951RegistersW[REG_W_WAL] = wa & 0xff; LC8951RegistersW[REG_W_WAH] = (wa >> 8) &0xff;
|
||||||
LC8951RegistersR[REG_R_HEAD0] = 0x01;
|
LC8951RegistersR[REG_R_HEAD0] = 0x01;
|
||||||
LC8951RegistersR[REG_R_STAT3] = 0x80;
|
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_DACH: LC8951RegistersW[REG_W_DACH] = data; break;
|
||||||
|
|
||||||
case REG_W_DTTRG:
|
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;
|
LC8951RegistersR[REG_R_IFSTAT] &= ~0x08;
|
||||||
SET_CDC_DMA;
|
|
||||||
CDC_REG0 &= ~0x8000;
|
|
||||||
}
|
}
|
||||||
break;
|
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_WAL: LC8951RegistersW[REG_W_WAL] = data; break;
|
||||||
case REG_W_WAH: LC8951RegistersW[REG_W_WAH] = 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_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_PTL: LC8951RegistersW[REG_W_PTL] = data; break;
|
||||||
case REG_W_PTH: LC8951RegistersW[REG_W_PTH] = data; break;
|
case REG_W_PTH: LC8951RegistersW[REG_W_PTH] = data; break;
|
||||||
case REG_W_CTRL2: LC8951RegistersW[REG_W_CTRL2] = 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)
|
void lc89510_temp_device::CDD_Process(running_machine& machine, int reason)
|
||||||
{
|
{
|
||||||
CDD_Export();
|
CDD_Export();
|
||||||
@ -947,13 +971,12 @@ void lc89510_temp_device::reset_cd(void)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (segacd.cd)
|
// if (segacd.cd)
|
||||||
printf("cd found\n");
|
// printf("cd found\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TIMER_DEVICE_CALLBACK_MEMBER( lc89510_temp_device::segacd_access_timer_callback )
|
TIMER_DEVICE_CALLBACK_MEMBER( lc89510_temp_device::segacd_access_timer_callback )
|
||||||
{
|
{
|
||||||
if (!is_neoCD)
|
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_image_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; }
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -296,15 +296,13 @@ public:
|
|||||||
void LC8951UpdateHeader();
|
void LC8951UpdateHeader();
|
||||||
char* LC8915InitTransfer(int NeoCDDMACount);
|
char* LC8915InitTransfer(int NeoCDDMACount);
|
||||||
void LC8915EndTransfer();
|
void LC8915EndTransfer();
|
||||||
void LC8951Reset();
|
|
||||||
void neocd_cdd_tx_w(UINT8 data);
|
void neocd_cdd_tx_w(UINT8 data);
|
||||||
UINT8 neocd_cdd_rx_r();
|
UINT8 neocd_cdd_rx_r();
|
||||||
void NeoCDCommsReset();
|
void NeoCDCommsReset();
|
||||||
|
|
||||||
INT32 CDEmuLoadSector(INT32 LBA, char* pBuffer);
|
INT32 CDEmuLoadSector(INT32 LBA, char* pBuffer);
|
||||||
void reset_NeoCd(void);
|
|
||||||
|
|
||||||
void nLC8951_w(UINT16 byteValue);
|
|
||||||
UINT16 nff0016_r(void);
|
UINT16 nff0016_r(void);
|
||||||
void nff0016_set(UINT16 wordValue);
|
void nff0016_set(UINT16 wordValue);
|
||||||
void nff0002_set(UINT16 wordValue);
|
void nff0002_set(UINT16 wordValue);
|
||||||
|
@ -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);
|
m_tempcdc->segacd_cdc_mode_address_w(*curr_space, 0, byteValue, 0xffff);
|
||||||
break;
|
break;
|
||||||
case 0x0102:
|
case 0x0102:
|
||||||
m_tempcdc->nLC8951_w(byteValue);
|
m_tempcdc->CDC_Reg_w(byteValue);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x0104:
|
case 0x0104:
|
||||||
@ -1465,7 +1465,7 @@ MACHINE_START_MEMBER(ng_aes_state,neocd)
|
|||||||
// for custom vectors
|
// for custom vectors
|
||||||
machine().device("maincpu")->execute().set_irq_acknowledge_callback(neocd_int_callback);
|
machine().device("maincpu")->execute().set_irq_acknowledge_callback(neocd_int_callback);
|
||||||
|
|
||||||
m_tempcdc->reset_NeoCd();
|
m_tempcdc->reset_cd();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user