Beispiel #1
0
static DEVICE_START( ym2203 )
{
	static const ym2203_interface generic_2203 =
	{
		{
			AY8910_LEGACY_OUTPUT,
			AY8910_DEFAULT_LOADS,
			DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL
		},
		NULL
	};
	const ym2203_interface *intf = device->baseconfig().static_config() ? (const ym2203_interface *)device->baseconfig().static_config() : &generic_2203;
	ym2203_state *info = get_safe_token(device);
	int rate = device->clock()/72; /* ??? */

	info->intf = intf;
	info->device = device;
	info->psg = ay8910_start_ym(NULL, YM2203, device, device->clock(), &intf->ay8910_intf);
	assert_always(info->psg != NULL, "Error creating YM2203/AY8910 chip");

	/* Timer Handler set */
	info->timer[0] = timer_alloc(device->machine, timer_callback_2203_0, info);
	info->timer[1] = timer_alloc(device->machine, timer_callback_2203_1, info);

	/* stream system initialize */
	info->stream = stream_create(device,0,1,rate,info,ym2203_stream_update);

	/* Initialize FM emurator */
	info->chip = ym2203_init(info,device,device->clock(),rate,timer_handler,IRQHandler,&psgintf);
	assert_always(info->chip != NULL, "Error creating YM2203 chip");

	state_save_register_postload(device->machine, ym2203_intf_postload, info);
}
Beispiel #2
0
static MACHINE_START( ninjaw )
{
	ninjaw_state *state = (ninjaw_state *)machine->driver_data;

	memory_configure_bank(machine, "bank10", 0, 8, memory_region(machine, "audiocpu") + 0xc000, 0x4000);

	state->maincpu = machine->device("maincpu");
	state->audiocpu = machine->device("audiocpu");
	state->subcpu = machine->device("sub");
	state->tc0140syt = machine->device("tc0140syt");
	state->tc0100scn_1 = machine->device("tc0100scn_1");
	state->tc0100scn_2 = machine->device("tc0100scn_2");
	state->tc0100scn_3 = machine->device("tc0100scn_3");

	state->lscreen = machine->device("lscreen");
	state->mscreen = machine->device("mscreen");
	state->rscreen = machine->device("rscreen");

	state->_2610_1l = machine->device("2610.1.l");
	state->_2610_1r = machine->device("2610.1.r");
	state->_2610_2l = machine->device("2610.2.l");
	state->_2610_2r = machine->device("2610.2.r");

	state_save_register_global(machine, state->cpua_ctrl);
	state_save_register_global(machine, state->banknum);
	state_save_register_global_array(machine, state->pandata);
	state_save_register_postload(machine, ninjaw_postload, NULL);
}
Beispiel #3
0
static void *ym2612_start(int sndindex, int clock, const void *config)
{
	static const struct YM2612interface dummy = { 0 };
	struct ym2612_info *info;
	int rate = clock/72;

	info = auto_malloc(sizeof(*info));
	memset(info, 0, sizeof(*info));

	info->intf = config ? config : &dummy;

	/* FM init */
	/* Timer Handler set */
	info->timer[0] = timer_alloc(timer_callback_2612_0, info);
	info->timer[1] = timer_alloc(timer_callback_2612_1, info);

	/* stream system initialize */
	info->stream = stream_create(0,2,rate,info,ym2612_stream_update);

	/**** initialize YM2612 ****/
	info->chip = YM2612Init(info,sndindex,clock,rate,timer_handler,IRQHandler);

	state_save_register_postload(Machine, ym2612_postload, info);

	if (info->chip)
		return info;
	/* error */
	return NULL;
}
Beispiel #4
0
void timer_init(running_machine *machine)
{
	int i;

	/* we need to wait until the first call to timer_cyclestorun before using real CPU times */
	global_basetime = attotime_zero;
	callback_timer = NULL;
	callback_timer_modified = FALSE;

	/* register with the save state system */
	state_save_push_tag(0);
	state_save_register_item("timer", 0, global_basetime.seconds);
	state_save_register_item("timer", 0, global_basetime.attoseconds);
	state_save_register_postload(machine, timer_postload, NULL);
	state_save_pop_tag();

	/* reset the timers */
	memset(timers, 0, sizeof(timers));

	/* initialize the lists */
	timer_head = NULL;
	timer_free_head = &timers[0];
	for (i = 0; i < MAX_TIMERS-1; i++)
		timers[i].next = &timers[i+1];
	timers[MAX_TIMERS-1].next = NULL;
	timer_free_tail = &timers[MAX_TIMERS-1];
}
Beispiel #5
0
void timer_init(running_machine *machine)
{
	timer_private *global;
	int i;

	/* allocate global data */
	global = machine->timer_data = auto_alloc_clear(machine, timer_private);

	/* we need to wait until the first call to timer_cyclestorun before using real CPU times */
	global->exec.basetime = attotime_zero;
	global->exec.nextfire = attotime_never;
	global->exec.curquantum = DEFAULT_MINIMUM_QUANTUM;
	global->callback_timer = NULL;
	global->callback_timer_modified = FALSE;

	/* register with the save state system */
	state_save_register_item(machine, "timer", NULL, 0, global->exec.basetime.seconds);
	state_save_register_item(machine, "timer", NULL, 0, global->exec.basetime.attoseconds);
	state_save_register_postload(machine, timer_postload, NULL);

	/* initialize the lists */
	global->activelist = NULL;
	global->freelist = &global->timers[0];
	for (i = 0; i < MAX_TIMERS-1; i++)
		global->timers[i].next = &global->timers[i+1];
	global->timers[MAX_TIMERS-1].next = NULL;
	global->freelist_tail = &global->timers[MAX_TIMERS-1];

	/* reset the quanta */
	global->quantum_list[0].requested = DEFAULT_MINIMUM_QUANTUM;
	global->quantum_list[0].actual = DEFAULT_MINIMUM_QUANTUM;
	global->quantum_list[0].expire = attotime_never;
	global->quantum_current = &global->quantum_list[0];
	global->quantum_minimum = ATTOSECONDS_IN_NSEC(1) / 1000;
}
Beispiel #6
0
sound_stream *stream_create(device_t *device, int inputs, int outputs, int sample_rate, void *param, stream_update_func callback)
{
	running_machine *machine = device->machine;
	streams_private *strdata = machine->streams_data;
	int inputnum, outputnum;
	sound_stream *stream;
	char statetag[30];

	/* allocate memory */
	stream = auto_alloc_clear(device->machine, sound_stream);

	VPRINTF(("stream_create(%d, %d, %d) => %p\n", inputs, outputs, sample_rate, stream));

	/* fill in the data */
	stream->device = device;
	stream->index = strdata->stream_index++;
	stream->sample_rate = sample_rate;
	stream->inputs = inputs;
	stream->outputs = outputs;
	stream->callback = callback;
	stream->param = param;

	/* create a unique tag for saving */
	sprintf(statetag, "%d", stream->index);
	state_save_register_item(machine, "stream", statetag, 0, stream->sample_rate);
	state_save_register_postload(machine, stream_postload, stream);

	/* allocate space for the inputs */
	if (inputs > 0)
	{
		stream->input = auto_alloc_array_clear(device->machine, stream_input, inputs);
		stream->input_array = auto_alloc_array_clear(device->machine, stream_sample_t *, inputs);
	}
Beispiel #7
0
void demonwld_driver_savestate(running_machine *machine)
{
	state_save_register_global(machine, demonwld_dsp_on);
	state_save_register_global(machine, dsp_addr_w);
	state_save_register_global(machine, main_ram_seg);
	state_save_register_global(machine, demonwld_dsp_BIO);
	state_save_register_global(machine, dsp_execute);
	state_save_register_postload(machine, demonwld_restore_dsp, NULL);
}
Beispiel #8
0
static MACHINE_START( atetris )
{
	/* Allocate interrupt timer */
	interrupt_timer = timer_alloc(machine, interrupt_gen, NULL);

	/* Set up save state */
	state_save_register_global(machine, current_bank);
	state_save_register_global(machine, nvram_write_enable);
	state_save_register_postload(machine, atetris_postload, NULL);
}
Beispiel #9
0
static MACHINE_START( ninjaw )
{
	cpua_ctrl = 0xff;
	banknum = -1;
	memset(ninjaw_pandata, 0, sizeof(ninjaw_pandata));

	state_save_register_global(machine, cpua_ctrl);
	state_save_register_global(machine, banknum);
	state_save_register_postload(machine, ninjaw_postload, NULL);
}
Beispiel #10
0
static void *ym2608_start(int sndindex, int clock, const void *config)
{
	static const struct YM2608interface generic_2608 =
	{
		{
			AY8910_LEGACY_OUTPUT | AY8910_SINGLE_OUTPUT,
			AY8910_DEFAULT_LOADS,
			NULL, NULL, NULL, NULL
		},
		NULL,
		0,
	};
	const struct YM2608interface *intf = config ? config : &generic_2608;
	int rate = clock/72;
	void *pcmbufa;
	int  pcmsizea;

	struct ym2608_info *info;

	info = auto_malloc(sizeof(*info));
	memset(info, 0, sizeof(*info));

	info->intf = intf;
	/* FIXME: Force to use simgle output */
	info->psg = ay8910_start_ym(SOUND_YM2608, sndindex, clock, &intf->ay8910_intf);
	if (!info->psg) return NULL;

	/* Timer Handler set */
	info->timer[0] = timer_alloc(timer_callback_2608_0, info);
	info->timer[1] = timer_alloc(timer_callback_2608_1, info);

	/* stream system initialize */
	info->stream = stream_create(0,2,rate,info,ym2608_stream_update);
	/* setup adpcm buffers */
	pcmbufa  = (void *)(memory_region(info->intf->pcmrom));
	pcmsizea = memory_region_length(info->intf->pcmrom);

	/* initialize YM2608 */
	info->chip = YM2608Init(info,sndindex,clock,rate,
		           pcmbufa,pcmsizea,
		           timer_handler,IRQHandler,&psgintf);

	state_save_register_postload(Machine, ym2608_postload, info);

	if (info->chip)
		return info;

	/* error */
	return NULL;
}
Beispiel #11
0
static DEVICE_START( ym2610 )
{
	static const ym2610_interface generic_2610 = { 0 };
	static const ay8910_interface generic_ay8910 =
	{
		AY8910_LEGACY_OUTPUT | AY8910_SINGLE_OUTPUT,
		AY8910_DEFAULT_LOADS,
		DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL
	};
	const ym2610_interface *intf = device->baseconfig().static_config() ? (const ym2610_interface *)device->baseconfig().static_config() : &generic_2610;
	int rate = device->clock()/72;
	void *pcmbufa,*pcmbufb;
	int  pcmsizea,pcmsizeb;
	ym2610_state *info = get_safe_token(device);
	astring name;
	device_type type = device->type();

	info->intf = intf;
	info->device = device;
	info->psg = ay8910_start_ym(NULL, device->type(), device, device->clock(), &generic_ay8910);
	assert_always(info->psg != NULL, "Error creating YM2610/AY8910 chip");

	/* Timer Handler set */
	info->timer[0] = timer_alloc(device->machine, timer_callback_0, info);
	info->timer[1] = timer_alloc(device->machine, timer_callback_1, info);

	/* stream system initialize */
	info->stream = stream_create(device,0,2,rate,info,(type == SOUND_YM2610) ? ym2610_stream_update : ym2610b_stream_update);
	/* setup adpcm buffers */
	pcmbufa  = *device->region();
	pcmsizea = device->region()->bytes();
	name.printf("%s.deltat", device->tag());
	pcmbufb  = (void *)(memory_region(device->machine, name));
	pcmsizeb = memory_region_length(device->machine, name);
	if (pcmbufb == NULL || pcmsizeb == 0)
	{
		pcmbufb = pcmbufa;
		pcmsizeb = pcmsizea;
	}

	/**** initialize YM2610 ****/
	info->chip = ym2610_init(info,device,device->clock(),rate,
		           pcmbufa,pcmsizea,pcmbufb,pcmsizeb,
		           timer_handler,IRQHandler,&psgintf);
	assert_always(info->chip != NULL, "Error creating YM2610 chip");

	state_save_register_postload(device->machine, ym2610_intf_postload, info);
}
Beispiel #12
0
static DEVICE_START( nmk112 )
{
	nmk112_state *nmk112 = get_safe_token(device);
	const nmk112_interface *intf = get_interface(device);

	nmk112->rom0 = memory_region(device->machine, intf->rgn0);
	nmk112->size0 = memory_region_length(device->machine, intf->rgn0) - 0x40000;
	nmk112->rom1 = memory_region(device->machine, intf->rgn1);
	nmk112->size1 = memory_region_length(device->machine, intf->rgn1) - 0x40000;

	nmk112->page_mask = ~intf->disable_page_mask;

	state_save_register_device_item_array(device, 0, nmk112->current_bank);
	state_save_register_device_item_array(device, 0, nmk112->last_bank);
	state_save_register_postload(device->machine, nmk112_postload_bankswitch, nmk112);
}
Beispiel #13
0
static DEVICE_START( ym2608 )
{
	static const ym2608_interface generic_2608 =
	{
		{
			AY8910_LEGACY_OUTPUT | AY8910_SINGLE_OUTPUT,
			AY8910_DEFAULT_LOADS,
			DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL
		},
		NULL
	};
	const ym2608_interface *intf = device->baseconfig().static_config() ? (const ym2608_interface *)device->baseconfig().static_config() : &generic_2608;
	int rate = device->clock()/72;
	void *pcmbufa;
	int  pcmsizea;

	ym2608_state *info = get_safe_token(device);

	info->intf = intf;
	info->device = device;

	/* FIXME: Force to use simgle output */
	info->psg = ay8910_start_ym(NULL, SOUND_YM2608, device, device->clock(), &intf->ay8910_intf);
	assert_always(info->psg != NULL, "Error creating YM2608/AY8910 chip");

	/* Timer Handler set */
	info->timer[0] = timer_alloc(device->machine, timer_callback_2608_0, info);
	info->timer[1] = timer_alloc(device->machine, timer_callback_2608_1, info);

	/* stream system initialize */
	info->stream = stream_create(device,0,2,rate,info,ym2608_stream_update);
	/* setup adpcm buffers */
	pcmbufa  = *device->region();
	pcmsizea = device->region()->bytes();

	/* initialize YM2608 */
	info->chip = ym2608_init(info,device,device->clock(),rate,
		           pcmbufa,pcmsizea,
		           timer_handler,IRQHandler,&psgintf);
	assert_always(info->chip != NULL, "Error creating YM2608 chip");

	state_save_register_postload(device->machine, ym2608_intf_postload, info);
}
Beispiel #14
0
void streams_init(running_machine *machine)
{
	streams_private *strdata;

	/* allocate memory for our private data */
	strdata = auto_alloc_clear(machine, streams_private);

	/* reset globals */
	strdata->stream_tailptr = &strdata->stream_head;
	strdata->update_attoseconds = STREAMS_UPDATE_ATTOTIME.attoseconds;

	/* set the global pointer */
	machine->streams_data = strdata;

	/* register global states */
	state_save_register_global(machine, strdata->last_update.seconds);
	state_save_register_global(machine, strdata->last_update.attoseconds);
	state_save_register_postload(machine, stream_postload, strdata);
}
Beispiel #15
0
static void *ym2203_start(int sndindex, int clock, const void *config)
{
	static const struct YM2203interface generic_2203 =
	{
		{
			AY8910_LEGACY_OUTPUT,
			AY8910_DEFAULT_LOADS,
			NULL, NULL, NULL, NULL
		},
		NULL
	};
	const struct YM2203interface *intf = config ? config : &generic_2203;
	struct ym2203_info *info;
	int rate = clock/72; /* ??? */

	info = auto_malloc(sizeof(*info));
	memset(info, 0, sizeof(*info));

	info->intf = intf;
	info->psg = ay8910_start_ym(SOUND_YM2203, sndindex, clock, &intf->ay8910_intf);
	if (!info->psg) return NULL;

	/* Timer Handler set */
	info->timer[0] = timer_alloc(timer_callback_2203_0, info);
	info->timer[1] = timer_alloc(timer_callback_2203_1, info);

	/* stream system initialize */
	info->stream = stream_create(0,1,rate,info,ym2203_stream_update);

	/* Initialize FM emurator */
	info->chip = YM2203Init(info,sndindex,clock,rate,timer_handler,IRQHandler,&psgintf);

	state_save_register_postload(Machine, ym2203_postload, info);

	if (info->chip)
		return info;

	/* error */
	/* stream close */
	return NULL;
}
Beispiel #16
0
static DEVICE_START( ym2151 )
{
	static const ym2151_interface dummy = { 0 };
	ym2151_state *info = get_safe_token(device);
	int rate;

	info->intf = device->baseconfig().static_config ? (const ym2151_interface *)device->baseconfig().static_config : &dummy;

	rate = device->clock/64;

	/* stream setup */
	info->stream = stream_create(device,0,2,rate,info,ym2151_update);

	info->chip = ym2151_init(device,device->clock,rate);
	assert_always(info->chip != NULL, "Error creating YM2151 chip");

	state_save_register_postload(device->machine, ym2151intf_postload, info);

	ym2151_set_irq_handler(info->chip,info->intf->irqhandler);
	ym2151_set_port_write_handler(info->chip,info->intf->portwritehandler);
}
Beispiel #17
0
/* device interface */
static DEVICE_START( tms9927 )
{
	tms9927_state *tms = get_safe_token(device);

	/* validate arguments */
	assert(device != NULL);
	assert(device->tag != NULL);

	tms->intf = (const tms9927_interface *)device->static_config;

	if (tms->intf != NULL)
	{
		assert(device->clock > 0);
		assert(tms->intf->hpixels_per_column > 0);

		/* copy the initial parameters */
		tms->clock = device->clock;
		tms->hpixels_per_column = tms->intf->hpixels_per_column;

		/* get the screen device */
		tms->screen = devtag_get_device(device->machine, tms->intf->screen_tag);
		assert(tms->screen != NULL);

		/* get the self-load PROM */
		if (tms->intf->selfload_region != NULL)
		{
			tms->selfload = memory_region(device->machine, tms->intf->selfload_region);
			assert(tms->selfload != NULL);
		}
	}

	/* register for state saving */
	state_save_register_postload(device->machine, tms9927_state_save_postload, tms);

	state_save_register_device_item(device, 0, tms->clock);
	state_save_register_device_item_array(device, 0, tms->reg);
	state_save_register_device_item(device, 0, tms->start_datarow);
	state_save_register_device_item(device, 0, tms->reset);
	state_save_register_device_item(device, 0, tms->hpixels_per_column);
}
Beispiel #18
0
static DEVICE_START( bsmt2000 )
{
	bsmt2000_chip *chip = get_safe_token(device);
	int voicenum;

	/* create a stream at a nominal sample rate (real one specified later) */
	chip->stream = stream_create(device, 0, 2, device->clock() / 1000, chip, bsmt2000_update);
	chip->clock = device->clock();

	/* initialize the regions */
	chip->region_base = *device->region();
	chip->total_banks = device->region()->bytes() / 0x10000;

	/* register chip-wide data for save states */
	state_save_register_postload(device->machine, bsmt2000_postload, chip);
	state_save_register_device_item(device, 0, chip->last_register);
	state_save_register_device_item(device, 0, chip->mode);
	state_save_register_device_item(device, 0, chip->stereo);
	state_save_register_device_item(device, 0, chip->voices);
	state_save_register_device_item(device, 0, chip->adpcm);
	state_save_register_device_item(device, 0, chip->adpcm_current);
	state_save_register_device_item(device, 0, chip->adpcm_delta_n);

	/* register voice-specific data for save states */
	for (voicenum = 0; voicenum < MAX_VOICES; voicenum++)
	{
		bsmt2000_voice *voice = &chip->voice[voicenum];

		state_save_register_device_item(device, voicenum, voice->pos);
		state_save_register_device_item(device, voicenum, voice->rate);
		state_save_register_device_item(device, voicenum, voice->loopend);
		state_save_register_device_item(device, voicenum, voice->loopstart);
		state_save_register_device_item(device, voicenum, voice->bank);
		state_save_register_device_item(device, voicenum, voice->leftvol);
		state_save_register_device_item(device, voicenum, voice->rightvol);
		state_save_register_device_item(device, voicenum, voice->fraction);
	}
}
Beispiel #19
0
static DEVICE_START( ym2612 )
{
	static const ym2612_interface dummy = { 0 };
	ym2612_state *info = get_safe_token(device);
	int rate = device->clock()/72;

	info->intf = device->baseconfig().static_config() ? (const ym2612_interface *)device->baseconfig().static_config() : &dummy;
	info->device = device;

	/* FM init */
	/* Timer Handler set */
	info->timer[0] = timer_alloc(device->machine, timer_callback_2612_0, info);
	info->timer[1] = timer_alloc(device->machine, timer_callback_2612_1, info);

	/* stream system initialize */
	info->stream = stream_create(device,0,2,rate,info,ym2612_stream_update);

	/**** initialize YM2612 ****/
	info->chip = ym2612_init(info,device,device->clock(),rate,timer_handler,IRQHandler);
	assert_always(info->chip != NULL, "Error creating YM2612 chip");

	state_save_register_postload(device->machine, ym2612_intf_postload, info);
}
Beispiel #20
0
static MACHINE_START( warriorb )
{
	warriorb_state *state = machine->driver_data<warriorb_state>();

	memory_configure_bank(machine, "bank10", 0, 8, machine->region("audiocpu")->base() + 0xc000, 0x4000);

	state->maincpu = machine->device("maincpu");
	state->audiocpu = machine->device("audiocpu");
	state->tc0140syt = machine->device("tc0140syt");
	state->tc0100scn_1 = machine->device("tc0100scn_1");
	state->tc0100scn_2 = machine->device("tc0100scn_2");

	state->lscreen = machine->device("lscreen");
	state->rscreen = machine->device("rscreen");

	state->_2610_1l = machine->device("2610.1.l");
	state->_2610_1r = machine->device("2610.1.r");
	state->_2610_2l = machine->device("2610.2.l");
	state->_2610_2r = machine->device("2610.2.r");

	state_save_register_global(machine, state->banknum);
	state_save_register_global_array(machine, state->pandata);
	state_save_register_postload(machine, warriorb_postload, NULL);
}
Beispiel #21
0
static void gtia_state(running_machine *machine)
{
	state_save_register_global(gtia.r.m0pf);
	state_save_register_global(gtia.r.m1pf);
	state_save_register_global(gtia.r.m2pf);
	state_save_register_global(gtia.r.m3pf);
	state_save_register_global(gtia.r.p0pf);
	state_save_register_global(gtia.r.p1pf);
	state_save_register_global(gtia.r.p2pf);
	state_save_register_global(gtia.r.p3pf);
	state_save_register_global(gtia.r.m0pl);
	state_save_register_global(gtia.r.m1pl);
	state_save_register_global(gtia.r.m2pl);
	state_save_register_global(gtia.r.m3pl);
	state_save_register_global(gtia.r.p0pl);
	state_save_register_global(gtia.r.p1pl);
	state_save_register_global(gtia.r.p2pl);
	state_save_register_global(gtia.r.p3pl);
	state_save_register_global_array(gtia.r.but);
	state_save_register_global(gtia.r.pal);
	state_save_register_global(gtia.r.gtia15);
	state_save_register_global(gtia.r.gtia16);
	state_save_register_global(gtia.r.gtia17);
	state_save_register_global(gtia.r.gtia18);
	state_save_register_global(gtia.r.gtia19);
	state_save_register_global(gtia.r.gtia1a);
	state_save_register_global(gtia.r.gtia1b);
	state_save_register_global(gtia.r.gtia1c);
	state_save_register_global(gtia.r.gtia1d);
	state_save_register_global(gtia.r.gtia1e);
	state_save_register_global(gtia.r.cons);
	state_save_register_global(gtia.w.hposp0);
	state_save_register_global(gtia.w.hposp1);
	state_save_register_global(gtia.w.hposp2);
	state_save_register_global(gtia.w.hposp3);
	state_save_register_global(gtia.w.hposm0);
	state_save_register_global(gtia.w.hposm1);
	state_save_register_global(gtia.w.hposm2);
	state_save_register_global(gtia.w.hposm3);
	state_save_register_global(gtia.w.sizep0);
	state_save_register_global(gtia.w.sizep1);
	state_save_register_global(gtia.w.sizep2);
	state_save_register_global(gtia.w.sizep3);
	state_save_register_global(gtia.w.sizem);
	state_save_register_global_array(gtia.w.grafp0);
	state_save_register_global_array(gtia.w.grafp1);
	state_save_register_global_array(gtia.w.grafp2);
	state_save_register_global_array(gtia.w.grafp3);
	state_save_register_global_array(gtia.w.grafm);
	state_save_register_global(gtia.w.colpm0);
	state_save_register_global(gtia.w.colpm1);
	state_save_register_global(gtia.w.colpm2);
	state_save_register_global(gtia.w.colpm3);
	state_save_register_global(gtia.w.colpf0);
	state_save_register_global(gtia.w.colpf1);
	state_save_register_global(gtia.w.colpf2);
	state_save_register_global(gtia.w.colpf3);
	state_save_register_global(gtia.w.colbk);
	state_save_register_global(gtia.w.prior);
	state_save_register_global(gtia.w.vdelay);
	state_save_register_global(gtia.w.gractl);
	state_save_register_global(gtia.w.hitclr);
	state_save_register_global(gtia.w.cons);
	state_save_register_postload(machine, gtia_state_postload, NULL);
}
Beispiel #22
0
void palette_init(running_machine *machine)
{
	int format;
	palette_private *palette = auto_malloc(sizeof(*palette));
	const device_config *device = video_screen_first(machine->config);

	/* get the format from the first screen, or use BITMAP_FORMAT_INVALID, if screenless */
	if (device != NULL)
	{
		screen_config *config = device->inline_config;
		format = config->format;
	}
	else
		format = BITMAP_FORMAT_INVALID;

	/* request cleanup */
	machine->palette_data = palette;
	add_exit_callback(machine, palette_exit);

	/* reset all our data */
	memset(palette, 0, sizeof(*palette));
	palette->format = format;

	/* determine the color mode */
	switch (format)
	{
		case BITMAP_FORMAT_INDEXED16:
		case BITMAP_FORMAT_RGB15:
		case BITMAP_FORMAT_RGB32:
			/* indexed and RGB modes are fine for everything */
			break;

		case BITMAP_FORMAT_INVALID:
			/* invalid format means no palette - or at least it should */
			assert(machine->config->total_colors == 0);
			return;

		default:
			fatalerror("Unsupported screen bitmap format!");
			break;
	}

	/* allocate all the data structures */
	if (machine->config->total_colors > 0)
	{
		int numcolors;

		allocate_palette(machine, palette);
		allocate_color_tables(machine, palette);
		allocate_shadow_tables(machine, palette);

		/* set up save/restore of the palette */
		numcolors = palette_get_num_colors(machine->palette);
		palette->save_pen = auto_malloc(sizeof(*palette->save_pen) * numcolors);
		palette->save_bright = auto_malloc(sizeof(*palette->save_bright) * numcolors);
		state_save_register_global_pointer(palette->save_pen, numcolors);
		state_save_register_global_pointer(palette->save_bright, numcolors);
		state_save_register_presave(machine, palette_presave, palette);
		state_save_register_postload(machine, palette_postload, palette);
	}
}
Beispiel #23
0
static MACHINE_START( wgp )
{
	state_save_register_global(cpua_ctrl);
	state_save_register_global(banknum);
	state_save_register_postload(machine, wgp_postload, NULL);
}