tiasound.c: added save state support (nw)

This commit is contained in:
Osso13 2015-01-16 18:16:35 +01:00
parent 54cb118b59
commit 8fc526c463
3 changed files with 21 additions and 3 deletions

View File

@ -30,7 +30,7 @@ tia_device::tia_device(const machine_config &mconfig, const char *tag, device_t
void tia_device::device_start()
{
m_channel = stream_alloc(0, 1, clock());
m_chip = tia_sound_init(clock(), clock(), 16);
m_chip = tia_sound_init(this, clock(), clock(), 16);
assert_always(m_chip != NULL, "Error creating TIA chip");
}

View File

@ -526,6 +526,22 @@ static void poly_init(UINT8 *poly, int size, int f0, int f1)
}
}
static void tia_save_state(device_t *device, tia *tia)
{
device->save_item(NAME(tia->AUDC));
device->save_item(NAME(tia->AUDF));
device->save_item(NAME(tia->AUDV));
device->save_item(NAME(tia->Outvol));
device->save_item(NAME(tia->P4));
device->save_item(NAME(tia->P5));
device->save_item(NAME(tia->P9));
device->save_item(NAME(tia->Div_n_cnt));
device->save_item(NAME(tia->Div_n_max));
device->save_item(NAME(tia->Div_3_cnt));
device->save_item(NAME(tia->Samp_n_cnt));
device->save_item(NAME(tia->oversampling));
}
/*****************************************************************************/
/* Module: tia_sh_start() */
/* Purpose: to handle the power-up initialization functions */
@ -541,7 +557,7 @@ static void poly_init(UINT8 *poly, int size, int f0, int f1)
/* */
/*****************************************************************************/
void *tia_sound_init(int clock, int sample_rate, int gain)
void *tia_sound_init(device_t *device, int clock, int sample_rate, int gain)
{
struct tia *chip;
int chan;
@ -582,6 +598,8 @@ void *tia_sound_init(int clock, int sample_rate, int gain)
chip->P9[chan] = 0;
}
tia_save_state(device, chip);
return chip;
}

View File

@ -37,7 +37,7 @@
#ifndef __TIASOUND_H__
#define __TIASOUND_H__
void *tia_sound_init(int clock, int sample_rate, int gain);
void *tia_sound_init(device_t *device, int clock, int sample_rate, int gain);
void tia_sound_free(void *chip);
void tia_process (void *chip, stream_sample_t *buffer, int length);
void tia_write(void *chip, offs_t offset, UINT8 data);