Exemple #1
0
static TIMER_CALLBACK(poly88_cassette_timer_callback)
{
	poly88_state *state = machine.driver_data<poly88_state>();
	int data;
	int current_level;


//  if (!(input_port_read(machine, "DSW0") & 0x02)) /* V.24 / Tape Switch */
	//{
		/* tape reading */
		if (cassette_get_state(machine.device("cassette"))&CASSETTE_PLAY)
		{
					if (state->m_clk_level_tape)
					{
						state->m_previous_level = (cassette_input(machine.device("cassette")) > 0.038) ? 1 : 0;
						state->m_clk_level_tape = 0;
					}
					else
					{
						current_level = (cassette_input(machine.device("cassette")) > 0.038) ? 1 : 0;

						if (state->m_previous_level!=current_level)
						{
							data = (!state->m_previous_level && current_level) ? 1 : 0;
//data = current_level;
							set_out_data_bit(state->m_cassette_serial_connection.State, data);
							serial_connection_out(machine, &state->m_cassette_serial_connection);
							msm8251_receive_clock(machine.device("uart"));

							state->m_clk_level_tape = 1;
						}
					}
		}

		/* tape writing */
		if (cassette_get_state(machine.device("cassette"))&CASSETTE_RECORD)
		{
			data = get_in_data_bit(state->m_cassette_serial_connection.input_state);
			data ^= state->m_clk_level_tape;
			cassette_output(machine.device("cassette"), data&0x01 ? 1 : -1);

			if (!state->m_clk_level_tape)
				msm8251_transmit_clock(machine.device("uart"));

			state->m_clk_level_tape = state->m_clk_level_tape ? 0 : 1;

			return;
		}

		state->m_clk_level_tape = 1;

		if (!state->m_clk_level)
			msm8251_transmit_clock(machine.device("uart"));
		state->m_clk_level = state->m_clk_level ? 0 : 1;
//  }
}
Exemple #2
0
static TIMER_DEVICE_CALLBACK( cassette_tick )
{
	mtx_state *state = timer.machine().driver_data<mtx_state>();
	int data = (cassette_input(state->m_cassette) > +0.0) ? 0 : 1;

	z80ctc_trg3_w(state->m_z80ctc, data);
}
Exemple #3
0
/* only works for one cassette so far */
static void exidy_cassette_timer_callback(int dummy)
{
	cassette_clock_counter++;

	if (cassette_clock_counter==(4800/1200))
	{
		/* reset counter */
		cassette_clock_counter = 0;

		/* toggle state of clock */
		cassette_clock_state^=0x0ffffffff;

		/* previously was 0, now gone 1 */
		/* +ve edge detected */
		if (cassette_clock_state)
		{			
			int bit;

			/* clock bits into cassette flip flops */
			/* bit is inverted! */

			/* detect level */
			bit = 1;
			if (cassette_input(image_from_devtype_and_index(IO_CASSETTE, 0)) > 0.0038)
				bit = 0;
			cassette_input_ff[0] = bit;
			/* detect level */
			bit = 1;
			if (cassette_input(image_from_devtype_and_index(IO_CASSETTE, 1)) > 0.0038)
				bit = 0;

			cassette_input_ff[1] = bit;

			logerror("cassette bit: %0d\n",bit);

			/* set out data bit */
			set_out_data_bit(cassette_serial_connection.State, cassette_input_ff[0]);
			/* output through serial connection */
			serial_connection_out(&cassette_serial_connection);

			/* update hd6402 receive clock */
			hd6402_receive_clock();
		}
	}
}
Exemple #4
0
static  READ8_HANDLER ( lviv_ppi_0_portc_r )
{
	UINT8 data = lviv_ppi_port_outputs[0][2] & 0x0f;
	if (cassette_input(image_from_devtype_and_index(IO_CASSETTE, 0)) > 0.038)
		data |= 0x10;
	if (lviv_ppi_port_outputs[0][0] & readinputport(13))
		data |= 0x80;
	return data;
}
Exemple #5
0
static READ8_DEVICE_HANDLER (ac1_port_b_r)
{
	ac1_state *state = device->machine().driver_data<ac1_state>();
	UINT8 data = 0x7f;

	if (cassette_input(state->m_cassette) > 0.03)
		data |= 0x80;

	return data;
}
Exemple #6
0
static READ8_HANDLER( ondra_keyboard_r )
{
	UINT8 retVal = 0x00;
	UINT8 ondra_keyboard_line = offset & 0x000f;
	static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7", "LINE8", "LINE9" };
	double valcas = cassette_input(cassette_device_image(space->machine()));
	if ( valcas < 0.00) {
		retVal = 0x80;
	}
	if (ondra_keyboard_line > 9) {
		retVal |= 0x1f;
	} else {
		retVal |= input_port_read(space->machine(), keynames[ondra_keyboard_line]);
	}
	return retVal;
}
Exemple #7
0
/* not called yet - this will update the via with the state of the tape data.
This allows the via to trigger on bit changes and issue interrupts */
static void oric_refresh_tape(int dummy)
{
	int data;
	int input_port_9;

	data = 0;

	if (cassette_input(cassette_device_image()) > 0.0038)
		data |= 1;

	/* "A simple cable to catch the vertical retrace signal !
		This cable connects the video output for the television/monitor
	to the via cb1 input. Interrupts can be generated from the vertical
	sync, and flicker free games can be produced */

	input_port_9 = readinputport(9);
	/* cable is enabled? */
	if ((input_port_9 & 0x08)!=0)
	{
		/* return state of vsync */
		data = input_port_9>>4;
	}
Exemple #8
0
/* not called yet - this will update the via with the state of the tape data.
This allows the via to trigger on bit changes and issue interrupts */
static TIMER_CALLBACK(oric_refresh_tape)
{
	int data;
	int input_port_9;
	via6522_device *via_0 = machine.device<via6522_device>("via6522_0");

	data = 0;

	if (cassette_input(cassette_device_image(machine)) > 0.0038)
		data |= 1;

	/* "A simple cable to catch the vertical retrace signal !
        This cable connects the video output for the television/monitor
    to the via cb1 input. Interrupts can be generated from the vertical
    sync, and flicker free games can be produced */

	input_port_9 = input_port_read(machine, "FLOPPY");
	/* cable is enabled? */
	if ((input_port_9 & 0x08)!=0)
	{
		/* return state of vsync */
		data = input_port_9>>4;
	}
Exemple #9
0
/*
    To read stored data from cassette the program should look at bit zero of
    the cassette input port and measure the time difference between leading
    edges or trailing edges. This is to prevent DC level shifting from altering
    pulse width of data. The program should then look for sync bytes for data
    synchronisation before data block transfer. If there is any task that must
    be performed during cassette loading, the maximum allowable time to do the
    job after one byte from cassette, must be less than 80% of the period of a
    mark cycle. Control must be returned at that time to the cassette routine
    in order to maintain data integrity.
*/
static READ8_HANDLER( cassette_r )
{
	device_t *cassette = space->machine().device("cassette");
	return (cassette_input(cassette) < +0.0) ? 0 : 1;
}
Exemple #10
0
// identical to sorcerer
static TIMER_CALLBACK(sol20_cassette_tc)
{
	sol20_state *state = machine.driver_data<sol20_state>();
	UINT8 cass_ws = 0;
	switch (state->m_sol20_fa & 0x20)
	{
		case 0x20:				/* Cassette 300 baud */

			/* loading a tape - this is basically the same as the super80.
                           We convert the 1200/2400 Hz signal to a 0 or 1, and send it to the uart. */

			state->m_cass_data.input.length++;

			cass_ws = (cassette_input(cassette_device_image(machine)) > +0.02) ? 1 : 0;

			if (cass_ws != state->m_cass_data.input.level)
			{
				state->m_cass_data.input.level = cass_ws;
				state->m_cass_data.input.bit = ((state->m_cass_data.input.length < 0x6) || (state->m_cass_data.input.length > 0x20)) ? 1 : 0;
				state->m_cass_data.input.length = 0;
				ay31015_set_input_pin( state->m_uart, AY31015_SI, state->m_cass_data.input.bit );
			}

			/* saving a tape - convert the serial stream from the uart, into 1200 and 2400 Hz frequencies.
                           Synchronisation of the frequency pulses to the uart is extremely important. */

			state->m_cass_data.output.length++;
			if (!(state->m_cass_data.output.length & 0x1f))
			{
				cass_ws = ay31015_get_output_pin( state->m_uart, AY31015_SO );
				if (cass_ws != state->m_cass_data.output.bit)
				{
					state->m_cass_data.output.bit = cass_ws;
					state->m_cass_data.output.length = 0;
				}
			}

			if (!(state->m_cass_data.output.length & 3))
			{
				if (!((state->m_cass_data.output.bit == 0) && (state->m_cass_data.output.length & 4)))
				{
					state->m_cass_data.output.level ^= 1;			// toggle output state, except on 2nd half of low bit
					cassette_output(cassette_device_image(machine), state->m_cass_data.output.level ? -1.0 : +1.0);
				}
			}
			return;

		case 0x00:			/* Cassette 1200 baud */
			/* loading a tape */
			state->m_cass_data.input.length++;

			cass_ws = (cassette_input(cassette_device_image(machine)) > +0.02) ? 1 : 0;

			if (cass_ws != state->m_cass_data.input.level || state->m_cass_data.input.length == 10)
			{
				state->m_cass_data.input.bit = ((state->m_cass_data.input.length < 10) || (state->m_cass_data.input.length > 0x20)) ? 1 : 0;
				if ( cass_ws != state->m_cass_data.input.level )
				{
					state->m_cass_data.input.length = 0;
					state->m_cass_data.input.level = cass_ws;
				}
				ay31015_set_input_pin( state->m_uart, AY31015_SI, state->m_cass_data.input.bit );
			}

			/* saving a tape - convert the serial stream from the uart, into 600 and 1200 Hz frequencies. */

			state->m_cass_data.output.length++;
			if (!(state->m_cass_data.output.length & 7))
			{
				cass_ws = ay31015_get_output_pin( state->m_uart, AY31015_SO );
				if (cass_ws != state->m_cass_data.output.bit)
				{
					state->m_cass_data.output.bit = cass_ws;
					state->m_cass_data.output.length = 0;
				}
			}

			if (!(state->m_cass_data.output.length & 7))
			{
				if (!((state->m_cass_data.output.bit == 0) && (state->m_cass_data.output.length & 8)))
				{
					state->m_cass_data.output.level ^= 1;			// toggle output state, except on 2nd half of low bit
					cassette_output(cassette_device_image(machine), state->m_cass_data.output.level ? -1.0 : +1.0);
				}
			}
			return;
	}
}
Exemple #11
0
/*************************************************
 * memory mapped I/O read
 * bit  function
 * 7	not assigned
 * 6	column 6
 * 5	column 5
 * 4	column 4
 * 3	column 3
 * 2	column 2
 * 1	column 1
 * 0	column 0
 ************************************************/
static int mra_bank(int bank, int offs)
{
	static int level_old = 0, cassette_bit = 0;
    int level, data = 0xff;

    /* Laser 500/700 only: keyboard rows A through D */
	if( (offs & 0x00ff) == 0x00ff )
	{
		static int row_a,row_b,row_c,row_d;
		if( (offs & 0x0300) == 0x0000 ) /* keyboard row A */
		{
			if( readinputport( 8) != row_a )
			{
				row_a = readinputport(8);
				data &= row_a;
			}
		}
		if( (offs & 0x0300) == 0x0100 ) /* keyboard row B */
		{
			if( readinputport( 9) != row_b )
			{
				row_b = readinputport( 9);
				data &= row_b;
			}
		}
		if( (offs & 0x0300) == 0x0200 ) /* keyboard row C */
		{
			if( readinputport(10) != row_c )
			{
				row_c = readinputport(10);
				data &= row_c;
			}
		}
		if( (offs & 0x0300) == 0x0300 ) /* keyboard row D */
		{
			if( readinputport(11) != row_d )
			{
				row_d = readinputport(11);
				data &= row_d;
			}
		}
	}
	else
	{
		/* All Lasers keyboard rows 0 through 7 */
        if( !(offs & 0x01) )
			data &= readinputport( 0);
		if( !(offs & 0x02) )
			data &= readinputport( 1);
		if( !(offs & 0x04) )
			data &= readinputport( 2);
		if( !(offs & 0x08) )
			data &= readinputport( 3);
		if( !(offs & 0x10) )
			data &= readinputport( 4);
		if( !(offs & 0x20) )
			data &= readinputport( 5);
		if( !(offs & 0x40) )
			data &= readinputport( 6);
		if( !(offs & 0x80) )
			data &= readinputport( 7);
	}

    /* what's bit 7 good for? tape input maybe? */
	level = cassette_input(vtech2_cassette_image()) * 65536.0;
	if( level < level_old - 511 )
		cassette_bit = 0x00;
	if( level > level_old + 511 )
		cassette_bit = 0x80;
	level_old = level;

	data &= ~cassette_bit;
    // logerror("bank #%d keyboard_r [$%04X] $%02X\n", bank, offs, data);

    return data;
}
Exemple #12
0
static READ_LINE_DEVICE_HANDLER( cassette_r )
{
	return cassette_input(device) < 0.0;
}