mirror of
https://github.com/holub/mame
synced 2025-06-06 12:53:46 +03:00
add DEVICE_RESET
This commit is contained in:
parent
de5f2f7c2f
commit
4350726b12
@ -100,6 +100,9 @@ struct _ymz280b_state
|
|||||||
device_t *device;
|
device_t *device;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void write_to_register(ymz280b_state *, int);
|
||||||
|
|
||||||
|
|
||||||
/* step size index shift table */
|
/* step size index shift table */
|
||||||
static const int index_scale[8] = { 0x0e6, 0x0e6, 0x0e6, 0x0e6, 0x133, 0x199, 0x200, 0x266 };
|
static const int index_scale[8] = { 0x0e6, 0x0e6, 0x0e6, 0x0e6, 0x133, 0x199, 0x200, 0x266 };
|
||||||
|
|
||||||
@ -627,7 +630,7 @@ static STREAM_UPDATE( ymz280b_update )
|
|||||||
|
|
||||||
/**********************************************************************************************
|
/**********************************************************************************************
|
||||||
|
|
||||||
DEVICE_START( ymz280b ) -- start emulation of the YMZ280B
|
DEVICE_START/RESET( ymz280b ) -- start/reset emulation of the YMZ280B
|
||||||
|
|
||||||
***********************************************************************************************/
|
***********************************************************************************************/
|
||||||
|
|
||||||
@ -700,6 +703,22 @@ static DEVICE_START( ymz280b )
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static DEVICE_RESET( ymz280b )
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
ymz280b_state *chip = get_safe_token(device);
|
||||||
|
|
||||||
|
/* initial clear registers */
|
||||||
|
for (i = 0xff; i >= 0; i--)
|
||||||
|
{
|
||||||
|
chip->current_register = 0;
|
||||||
|
write_to_register(chip, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
chip->current_register = 0;
|
||||||
|
chip->status_register = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************************************
|
/**********************************************************************************************
|
||||||
@ -713,9 +732,6 @@ static void write_to_register(ymz280b_state *chip, int data)
|
|||||||
struct YMZ280BVoice *voice;
|
struct YMZ280BVoice *voice;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* force an update */
|
|
||||||
chip->stream->update();
|
|
||||||
|
|
||||||
/* lower registers follow a pattern */
|
/* lower registers follow a pattern */
|
||||||
if (chip->current_register < 0x80)
|
if (chip->current_register < 0x80)
|
||||||
{
|
{
|
||||||
@ -924,7 +940,7 @@ static int compute_status(ymz280b_state *chip)
|
|||||||
|
|
||||||
/**********************************************************************************************
|
/**********************************************************************************************
|
||||||
|
|
||||||
ymz280b_status_0_r/ymz280b_status_1_r -- handle a read from the status register
|
ymz280b_r/ymz280b_w -- handle external accesses
|
||||||
|
|
||||||
***********************************************************************************************/
|
***********************************************************************************************/
|
||||||
|
|
||||||
@ -934,6 +950,7 @@ READ8_DEVICE_HANDLER( ymz280b_r )
|
|||||||
|
|
||||||
if ((offset & 1) == 0)
|
if ((offset & 1) == 0)
|
||||||
{
|
{
|
||||||
|
/* read from external memory */
|
||||||
UINT8 read = chip->ext_ram_read.isnull() ? 0 : chip->ext_ram_read(chip->rom_readback_addr);
|
UINT8 read = chip->ext_ram_read.isnull() ? 0 : chip->ext_ram_read(chip->rom_readback_addr);
|
||||||
chip->rom_readback_addr = (chip->rom_readback_addr + 1) & 0xffffff;
|
chip->rom_readback_addr = (chip->rom_readback_addr + 1) & 0xffffff;
|
||||||
return read;
|
return read;
|
||||||
@ -950,8 +967,13 @@ WRITE8_DEVICE_HANDLER( ymz280b_w )
|
|||||||
if ((offset & 1) == 0)
|
if ((offset & 1) == 0)
|
||||||
chip->current_register = data;
|
chip->current_register = data;
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
/* force an update */
|
||||||
|
chip->stream->update();
|
||||||
|
|
||||||
write_to_register(chip, data);
|
write_to_register(chip, data);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -969,7 +991,7 @@ DEVICE_GET_INFO( ymz280b )
|
|||||||
/* --- the following bits of info are returned as pointers to data or functions --- */
|
/* --- the following bits of info are returned as pointers to data or functions --- */
|
||||||
case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( ymz280b ); break;
|
case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( ymz280b ); break;
|
||||||
case DEVINFO_FCT_STOP: /* Nothing */ break;
|
case DEVINFO_FCT_STOP: /* Nothing */ break;
|
||||||
case DEVINFO_FCT_RESET: /* Nothing */ break;
|
case DEVINFO_FCT_RESET: info->start = DEVICE_RESET_NAME( ymz280b ); break;
|
||||||
|
|
||||||
/* --- the following bits of info are returned as NULL-terminated strings --- */
|
/* --- the following bits of info are returned as NULL-terminated strings --- */
|
||||||
case DEVINFO_STR_NAME: strcpy(info->s, "YMZ280B"); break;
|
case DEVINFO_STR_NAME: strcpy(info->s, "YMZ280B"); break;
|
||||||
|
Loading…
Reference in New Issue
Block a user