Exemple #1
0
static void console_write(UINT8 data)
{
	if (data & 0x08)
		DAC_data_w(0, -120);
	else
		DAC_data_w(0, +120);
}
static WRITE8_HANDLER(cartridge_Orch90_io_w)
{
	if( offset == 58 )
		DAC_data_w(0, data);

	if( offset == 59 )
		DAC_data_w(0, data);

}
Exemple #3
0
static void update_dac(void) {
/*	printf("Clock: %x D: %x  G:%x \n",activecpu_get_icount(),Dvalue, Gvalue); */

  	if (Gvalue == 0 && Dvalue == 0)
		DAC_data_w(0, 0xff);
   	else if (Gvalue == 1 && Dvalue == 1)
   		DAC_data_w(0, 0x80);
   	else
		DAC_data_w(0, 0x00);
}
Exemple #4
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;
}
Exemple #5
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);
}
static void medlanes_hardware_w(int offset, int data)
{
static int DAC_data = 0;

	switch (offset)
	{
		case 0:				   /* speaker ? */
#if VERBOSE
			if (errorlog)
				fprintf(errorlog, "medlanes_hardware_w DAC $%02X\n", data);
#endif
            DAC_data = data & 0xf0;
			DAC_data_w(0, DAC_data);
			break;
		case 1:				   /* ???? it writes 0x05 here... */
#if VERBOSE
			if (errorlog)
				fprintf(errorlog, "medlanes_hardware_w hw1 $%02X\n", data);
#endif
            break;
		case 2:				   /* ???? it writes 0x3c / 0xcc here ... */
#if VERBOSE
			if (errorlog)
				fprintf(errorlog, "medlanes_hardware_w hw2 $%02X\n", data);
#endif
            break;
		case 3:				   /* ???? it writes 0x62 here... */
#if VERBOSE
			if (errorlog)
				fprintf(errorlog, "medlanes_hardware_w hw3 $%02X\n", data);
#endif
            break;
	}
}
static WRITE8_HANDLER( audio_dac_w)
{
	UINT8 *rom = memory_region(REGION_CPU1);
	int	dac_address = ( data & 0xf0 ) << 8;
	int	sel = ( ( (~data) >> 1 ) & 2 ) | ( data & 1 );

	if ( cur_dac_address != dac_address )
	{
		cur_dac_address_index = 0;
		cur_dac_address = dac_address;
	}
	else
	{
		cur_dac_address_index++;
	}

	if ( sel & 1 )
		dac_address += 0x10000;

	if ( sel & 2 )
		dac_address += 0x10000;

	dac_address += 0x10000;

	DAC_data_w( 0, rom[dac_address+cur_dac_address_index] );

	timer_set( TIME_IN_HZ( 16000 ), 0, dac_irq );
}
Exemple #8
0
static void vc20_wav_timer (int data)
{
	/* NPW 28-Feb-2005 - this code sucks */
#if 0
	if (wav.sample->resolution == 8)
	{
		tape.data = wav.sample->data[wav.pos] > 0x0;
		wav.pos++;
		if (wav.pos >= wav.sample->length)
		{
			wav.pos = 0;
			tape.play = 0;
		}
	}
	else
	{
		tape.data = ((short *) (wav.sample->data))[wav.pos] > 0x0;
		wav.pos++;
		if (wav.pos * 2 >= wav.sample->length)
		{
			wav.pos = 0;
			tape.play = 0;
		}
	}
	if (tape.noise)
		DAC_data_w (0, tape.data ? TONE_ON_VALUE : 0);
	if (tape.read_callback)
		tape.read_callback (0, tape.data);
	/*    vc20_wav_state(); // removing timer in timer puls itself hangs */
#endif
}
Exemple #9
0
static WRITE_HANDLER( kabukiz_sample_w )
{
	// to avoid the write when the sound chip is initialized
	if(data != 0xff)
	{
		DAC_data_w( 0, data );
	}
}
Exemple #10
0
ADDRESS_MAP_END



/* 2 DACs per CPU - 4 bits per sample */

static WRITE8_HANDLER( bssoccer_DAC_1_w )
{
	DAC_data_w( 0 + (offset & 1), (data & 0xf) * 0x11 );
}
Exemple #11
0
static WRITE8_HANDLER( ctc_timer_2_w )
{

    if (data) /* rising edge */
    {
        output[1] ^= 0x7f;
        channel_active[1] = 1;
        DAC_data_w(1, output[0]);
    }
}
Exemple #12
0
static void vc20_prg_timer (int data)
{
	if (!tape.data)
	{								   /* send the same low phase */
		if (tape.noise)
			DAC_data_w (0, 0);
		tape.data = 1;
		timer_reset (prg.timer, prg.lasttime);
	}
	else
	{
		if (tape.noise)
			DAC_data_w (0, TONE_ON_VALUE);
		tape.data = 0;
		if (prg.statebit)
		{
			vc20_tape_bit (0);
		}
		else if (prg.statebyte)
		{							   /* send the rest of the byte */
			vc20_tape_byte ();
		}
		else if (prg.stateheader)
		{
			vc20_tape_prgheader ();
		}
		else
		{
			vc20_tape_program ();
			if (!prg.stateblock)
			{
				tape.play = 0;
			}
		}
	}
	if (tape.read_callback)
		tape.read_callback (0, tape.data);
	vc20_prg_state ();
}
Exemple #13
0
static WRITE8_HANDLER(circusc_sound_w)
{
	int c;

	switch (offset & 7)
	{
		/* CS2 */
		case 0:
			sn_latch = data;
			break;

		/* CS3 */
		case 1:
			SN76496_0_w(0, sn_latch);
			break;

		/* CS4 */
		case 2:
			SN76496_1_w(0, sn_latch);
			break;

		/* CS5 */
		case 3:
			DAC_data_w(0, data);
			break;

		/* CS6 */
		case 4:
			c = (offset & 0x20) ? 470000 : 0;
			filter_rc_set_RC(0, 1000, 2200, 1000, c);

			c = 0;
			if (offset & 0x10) c += 470000;
			if (offset & 0x08) c +=  47000;
			filter_rc_set_RC(1, 1000, 2200, 1000, c);

			c = (offset & 0x40) ? 470000 : 0;
			filter_rc_set_RC(2, 1000, 10000, 1000, c);
	}
}
Exemple #14
0
static WRITE_HANDLER( grobda_DAC_w )
{
	DAC_data_w(0, (data << 4) | data);
}
Exemple #15
0
static void vc20_prg_write (int data)
{
#if 0
	/* this was used to decode cbms tape format, but could */
	/* be converted to a real program writer */
	/* c16: be sure the cpu clock is about 1.8 MHz (when screen is off) */
	static int count = 0;
	static int old = 0;
	static double time = 0;
	static int bytecount = 0, byte;

	if (old != data)
	{
		double neu = timer_get_time ();
		int diff = (neu - time) * 1000000;

		count++;
		logerror("%f %d %s %d\n", (PCM_LONG + PCM_MIDDLE) / 2,
					 bytecount, old ? "high" : "low",
					 diff);
		if (old)
		{
			if (count > 0 /*27000 */ )
			{
				switch (bytecount)
				{
				case 0:
					if (diff > (PCM_LONG + PCM_MIDDLE) * 1e6 / 2)
					{
						bytecount++;
						byte = 0;
					}
					break;
				case 1:
				case 3:
				case 5:
				case 7:
				case 9:
				case 11:
				case 13:
				case 15:
				case 17:
					bytecount++;
					break;
				case 2:
					if (diff > (PCM_MIDDLE + PCM_SHORT) * 1e6 / 2)
						byte |= 1;
					bytecount++;
					break;
				case 4:
					if (diff > (PCM_MIDDLE + PCM_SHORT) * 1e6 / 2)
						byte |= 2;
					bytecount++;
					break;
				case 6:
					if (diff > (PCM_MIDDLE + PCM_SHORT) * 1e6 / 2)
						byte |= 4;
					bytecount++;
					break;
				case 8:
					if (diff > (PCM_MIDDLE + PCM_SHORT) * 1e6 / 2)
						byte |= 8;
					bytecount++;
					break;
				case 10:
					if (diff > (PCM_MIDDLE + PCM_SHORT) * 1e6 / 2)
						byte |= 0x10;
					bytecount++;
					break;
				case 12:
					if (diff > (PCM_MIDDLE + PCM_SHORT) * 1e6 / 2)
						byte |= 0x20;
					bytecount++;
					break;
				case 14:
					if (diff > (PCM_MIDDLE + PCM_SHORT) * 1e6 / 2)
						byte |= 0x40;
					bytecount++;
					break;
				case 16:
					if (diff > (PCM_MIDDLE + PCM_SHORT) * 1e6 / 2)
						byte |= 0x80;
					logerror("byte %.2x\n", byte);
					bytecount = 0;
					break;
				}
			}
		}
		old = data;
		time = timer_get_time ();
	}
#endif
	if (tape.noise)
		DAC_data_w (0, data ? TONE_ON_VALUE : 0);
}
Exemple #16
0
void spacefb_sh_putp1(int offset, int data)
{
	DAC_data_w(0,data);
}
Exemple #17
0
void circusc_dac_w(int offset,int data)
{
	DAC_data_w(0,data);
}
Exemple #18
0
static void vc20_prg_state (void)
{
	switch (prg.state)
	{
	case 0:
		break;						   /* not inited */
	case 1:						   /* off */
		if (tape.on)
		{
			prg.state = 2;
			break;
		}
		break;
	case 2:						   /* on */
		if (!tape.on)
		{
			prg.state = 1;
			tape.play = 0;
			tape.record = 0;
			DAC_data_w (0, 0);
			break;
		}
		if (tape.motor && tape.play)
		{
			prg.state = 3;
			timer_reset(prg.timer, 0.0);
			break;
		}
		if (tape.motor && tape.record)
		{
			prg.state = 4;
			break;
		}
		break;
	case 3:						   /* reading */
		if (!tape.on)
		{
			prg.state = 1;
			tape.play = 0;
			tape.record = 0;
			DAC_data_w (0, 0);
			timer_reset(prg.timer, TIME_NEVER);
			break;
		}
		if (!tape.motor || !tape.play)
		{
			prg.state = 2;
			timer_reset(prg.timer, TIME_NEVER);
			DAC_data_w (0, 0);
			break;
		}
		break;
	case 4:						   /* saving */
		if (!tape.on)
		{
			prg.state = 1;
			tape.play = 0;
			tape.record = 0;
			DAC_data_w (0, 0);
			break;
		}
		if (!tape.motor || !tape.record)
		{
			prg.state = 2;
			DAC_data_w (0, 0);
			break;
		}
		break;
	}
}
Exemple #19
0
static void vc20_wav_write (int data)
{
	if (tape.noise)
		DAC_data_w (0, data);
}
Exemple #20
0
static void vc20_wav_state (void)
{
	/* NPW 28-Feb-2005 - this code sucks */
#if 0
	switch (wav.state)
	{
	case 0:
		break;						   /* not inited */
	case 1:						   /* off */
		if (tape.on)
		{
			wav.state = 2;
			break;
		}
		break;
	case 2:						   /* on */
		if (!tape.on)
		{
			wav.state = 1;
			tape.play = 0;
			tape.record = 0;
			DAC_data_w (0, 0);
			break;
		}
		if (tape.motor && tape.play)
		{
			wav.state = 3;
			timer_adjust(wav.timer, 0, 0, 1.0 / wav.sample->smpfreq);
			break;
		}
		if (tape.motor && tape.record)
		{
			wav.state = 4;
			break;
		}
		break;
	case 3:						   /* reading */
		if (!tape.on)
		{
			wav.state = 1;
			tape.play = 0;
			tape.record = 0;
			DAC_data_w (0, 0);
			timer_reset(wav.timer, TIME_NEVER);
			break;
		}
		if (!tape.motor || !tape.play)
		{
			wav.state = 2;
			timer_reset(wav.timer, TIME_NEVER);
			DAC_data_w (0, 0);
			break;
		}
		break;
	case 4:						   /* saving */
		if (!tape.on)
		{
			wav.state = 1;
			tape.play = 0;
			tape.record = 0;
			DAC_data_w (0, 0);
			break;
		}
		if (!tape.motor || !tape.record)
		{
			wav.state = 2;
			DAC_data_w (0, 0);
			break;
		}
		break;
	}
#endif
}
Exemple #21
0
static WRITE_HANDLER( bssoccer_DAC_1_w )
{
    DAC_data_w( 0 + (offset & 1), (data & 0xf) * 0x11 );
}
Exemple #22
0
static WRITE8_HANDLER( bssoccer_DAC_2_w )
{
	DAC_data_w( 2 + (offset & 1), (data & 0xf) * 0x11 );
}
Exemple #23
0
static WRITE_HANDLER(c_port_w)
{
  DAC_data_w(0, data);
//logerror("%04x: C Port Write=%02x\n",activecpu_get_previouspc(),data);
}
Exemple #24
0
static WRITE_HANDLER( mario_sh_sound_w )
{
	DAC_data_w(0,data);
}
Exemple #25
0
static void grobda_DAC_w(int offset, int data)
{
	DAC_data_w(0, (data << 4) | data);
}