示例#1
0
void K056800_init(void (* irq_callback)(int))
{
	double timer_period;
	K056800_sound_irq_callback = irq_callback;

	memset(K056800_host_reg, 0, sizeof(K056800_host_reg));
	memset(K056800_sound_reg, 0, sizeof(K056800_sound_reg));

	timer_period = 1000.0/(44100.0/128.0);	// roughly 2.9us

	K056800_sound_cpu_timer = timer_alloc(K056800_sound_cpu_timer_tick);
	timer_adjust(K056800_sound_cpu_timer, TIME_IN_MSEC(timer_period), 0, TIME_IN_MSEC(timer_period));
}
示例#2
0
/***************************************************************************
  ticket_dispenser_toggle

  How I think this works:
  When a ticket dispenses, there is N milliseconds of status = high,
  and N milliseconds of status = low (a wait cycle?).
***************************************************************************/
static void ticket_dispenser_toggle(int which)
{
	/* If we still have power, keep toggling ticket states. */
	if (dispenser[which].power)
	{
		dispenser[which].status ^= active_bit;
#ifdef DEBUG_TICKET
		logerror("Ticket Status Changed to %02X\n", status);
#endif
		timer_adjust(dispenser[which].timer, TIME_IN_MSEC(time_msec), which, 0);
	}

	if (dispenser[which].status == ticketdispensed)
	{
		set_led_status(2,1);
		dispensed_tickets++;

#ifdef DEBUG_TICKET
		logerror("Ticket Dispensed\n");
#endif
	}
	else
	{
		set_led_status(2,0);
	}
}
示例#3
0
static void Hotdog_SendCmd(int cmda, int cmdb)
{
	cmd_latch = 0;
	cpu_set_irq_line(0, IRQ_LINE_NMI, ASSERT_LINE);

	timer_set(TIME_IN_MSEC(30), cmda, hotdog_timer);
}
示例#4
0
void m1snd_startQueue(void)
{
	cmd_qmutex = 1;
	timer_setturbo(8);
	timer_set(TIME_IN_MSEC(m1snd_getCurBoard()->startupTime), 0, queue_startcb);
	m1ui_message(m1ui_this, M1_MSG_BOOTING, NULL, 0);

	boottime = 1;
}
示例#5
0
static WRITE_HANDLER( sbrkout_dac_w )
{
	sbrkout_sound[offset]=data;

	if (init_timer)
	{
		timer_set (TIME_IN_MSEC(TIME_4V), 0, sbrkout_tones_4V);
		init_timer=0;
	}
}
示例#6
0
static void sbrkout_tones_4V(int foo)
{
	static int vlines=0;

	if ((*sbrkout_sound) & vlines)
		DAC_data_w(0,255);
	else
		DAC_data_w(0,0);

	vlines = (vlines+1) % 16;

	timer_set (TIME_IN_MSEC(TIME_4V), 0, sbrkout_tones_4V);
}
示例#7
0
void m1snd_processQueue(void)
{
	// if a timer is in progress, don't add more
	if (cmd_qmutex)
	{
		return;
	}

	if (cmd_qptr != cmd_qtop)
	{
		cmd_qmutex = 1;
		timer_set(TIME_IN_MSEC(m1snd_getCurBoard()->interCmdTime), cmd_queue[cmd_qptr], queue_timercb);
	}
}
示例#8
0
static void sslam_play(int track, int data)
{
	int status = OKIM6295_status_0_r(0);

	if (data < 0x80) {
		if (track) {
			if (sslam_track != data) {
				sslam_track  = data;
				sslam_bar = 1;
				if (status & 0x08)
					OKIM6295_data_0_w(0,0x40);
				OKIM6295_data_0_w(0,(0x80 | data));
				OKIM6295_data_0_w(0,0x81);
				timer_adjust(music_timer, TIME_IN_MSEC(4), 0, TIME_IN_HZ(250));	/* 250Hz for smooth sequencing */
			}
		}
		else {
			if ((status & 0x01) == 0) {
				OKIM6295_data_0_w(0,(0x80 | data));
				OKIM6295_data_0_w(0,0x11);
			}
			else if ((status & 0x02) == 0) {
				OKIM6295_data_0_w(0,(0x80 | data));
				OKIM6295_data_0_w(0,0x21);
			}
			else if ((status & 0x04) == 0) {
				OKIM6295_data_0_w(0,(0x80 | data));
				OKIM6295_data_0_w(0,0x41);
			}
		}
	}
	else {		/* use above 0x80 to turn off channels */
		if (track) {
			timer_enable(music_timer,0);
			sslam_track = 0;
			sslam_melody = 0;
			sslam_bar = 0;
		}
		data &= 0x7f;
		OKIM6295_data_0_w(0,data);
	}
}
示例#9
0
/***************************************************************************
  ticket_dispenser_toggle

  How I think this works:
  When a ticket dispenses, there is N milliseconds of status = high,
  and N milliseconds of status = low (a wait cycle?).
***************************************************************************/
static void ticket_dispenser_toggle(int parm)
{

	/* If we still have power, keep toggling ticket states. */
	if (power)
	{
		status ^= active_bit;
		timer = timer_set (TIME_IN_MSEC(time_msec), 0, ticket_dispenser_toggle);
	}

	if (status == ticketdispensed)
	{
		osd_led_w(2,1);
		dispensed_tickets++;

	}
	else
	{
		osd_led_w(2,0);
	}
}
示例#10
0
/***************************************************************************
  ticket_dispenser_w
***************************************************************************/
void ticket_dispenser_w(int offset, int data)
{
	/* On an activate signal, start dispensing! */
	if ((data & active_bit) == motoron)
	{
		if (!power)
		{
			timer = timer_set (TIME_IN_MSEC(time_msec), 0, ticket_dispenser_toggle);
			power = 1;

			status = ticketnotdispensed;
		}
	}
	else
	{
		if (power)
		{
			timer_remove(timer);
			osd_led_w(2,0);
			power = 0;
		}
	}
}
示例#11
0
static MACHINE_RESET( adam )
{
	if (image_exists(image_from_devtype_and_index(IO_CARTSLOT, 0)))
	{
		/* ColecoVision Mode Reset (Cartridge Mounted) */
		adam_lower_memory = 3; /* OS7 + 24k RAM */
		adam_upper_memory = 3; /* Cartridge ROM */
	}
	else
	{
		/* Adam Mode Reset */
		adam_lower_memory = 0; /* SmartWriter ROM/EOS */
		adam_upper_memory = 0; /* Internal RAM */
	}

	adam_net_data = 0;
	set_memory_banks();
	adam_pcb=0xFEC0;
	clear_keyboard_buffer();

	memset(&memory_region(REGION_CPU1)[0x0000], 0xFF, 0x20000); /* Initializing RAM */
	timer_pulse(TIME_IN_MSEC(20), 0, adam_paddle_callback);
} 
示例#12
0
static MACHINE_RESET(coleco)
{
    cpunum_set_input_line_vector(0, 0, 0xff);
	memset(&memory_region(REGION_CPU1)[0x6000], 0xff, 0x400);	// initialize RAM
    timer_pulse(TIME_IN_MSEC(20), 0, paddle_callback);
}
示例#13
0
static MACHINE_INIT( sbrkout )
{
	timer_pulse(TIME_IN_MSEC(TIME_4V), 0, sbrkout_tones_4V);
}