コード例 #1
0
ファイル: supercon.c プロジェクト: cdenix/psmame
static void mouse_update(running_machine &machine)
{
	supercon_state *state = machine.driver_data<supercon_state>();
	UINT8 port_input; // m_left;
	int i;

/* Boarder pieces and moving pice */

	port_input=input_port_read(machine, "B_WHITE");
	if (port_input)
	{
		i=get_first_bit(port_input);
		state->m_moving_piece=border_pieces[i];
		output_set_value("MOVING",state->m_moving_piece);
		return;
	}


	port_input=input_port_read(machine, "B_BLACK");
	if (port_input)
	{
		i=get_first_bit(port_input);
		state->m_moving_piece=border_pieces[6+i];
		output_set_value("MOVING",state->m_moving_piece);
		return;
	}


	port_input=input_port_read(machine, "B_CLR");
	if (port_input)
	{
		if (state->m_moving_piece)
		{
			state->m_moving_piece=0;
			output_set_value("MOVING",state->m_moving_piece);
			return;
		}
	}
}
コード例 #2
0
ファイル: supercon.c プロジェクト: CJBass/mame2013-libretro
void supercon_state::mouse_update()
{
	UINT8 port_input; // m_left;
	int i;

/* border pieces and moving piece */

	port_input = m_b_white->read();
	if (port_input)
	{
		i = get_first_bit(port_input);
		m_moving_piece = m_border_pieces[i];
		output_set_value("MOVING", m_moving_piece);
		return;
	}


	port_input = m_b_black->read();
	if (port_input)
	{
		i = get_first_bit(port_input);
		m_moving_piece = m_border_pieces[6+i];
		output_set_value("MOVING", m_moving_piece);
		return;
	}


	port_input = m_b_clr->read();
	if (port_input)
	{
		if (m_moving_piece)
		{
			m_moving_piece=0;
			output_set_value("MOVING", m_moving_piece);
			return;
		}
	}
}
コード例 #3
0
ファイル: supercon.c プロジェクト: cdenix/psmame
static READ8_HANDLER( supercon_port4_r )
{
	supercon_state *state = space->machine().driver_data<supercon_state>();
	int i_18, i_AH;
	UINT8 key_data = 0x00;;

	static const char *const board_lines[8] =
			{ "BOARD_1", "BOARD_2", "BOARD_3", "BOARD_4", "BOARD_5", "BOARD_6", "BOARD_7", "BOARD_8" };

	LOG(("Read from %04x \n",0x1F00));

/* Board buttons */

	i_18=get_first_bit(state->m_data_1E00);
	if (i_18==NOT_VALID)
		return 0xff;

/* if a button was pressed wait til timer -timer_mouse_click- is fired */

	if (state->m_selecting)
		return state->m_save_key_data;
	else
	{
		set_pieces(state);
		output_set_value("MOVING",state->m_moving_piece);
	}

	key_data=input_port_read(space->machine(), board_lines[i_18]);

	if (key_data != 0xff)
	{
		LOG(("%s key_data: %02x \n",board_lines[i_18],key_data));

/* Only if valid data and mouse button is pressed */

		if (key_data && input_port_read(space->machine(), "BUTTON_L")) 
		{

/* Set or remove pieces */

			i_AH=7-get_first_cleared_bit(key_data);
			LOG(("Press -> AH: %d 18: %d Piece: %d\n",i_AH,i_18,state->m_board[i_18*8 + i_AH]););
コード例 #4
0
ファイル: supercon.c プロジェクト: cdenix/psmame
static READ8_HANDLER( supercon_port3_r )
{
	supercon_state *state = space->machine().driver_data<supercon_state>();
	int i;
	UINT8 key_data=0;

	static const char *const status_lines[8] =
			{ "STATUS_1", "STATUS_2", "STATUS_3", "STATUS_4", "STATUS_5", "STATUS_6", "STATUS_7", "STATUS_8" };

	LOG(("Read from %04x \n",0x1E00));

/* remove last bit (only if it was not already set) */

	if ( state->m_data_1F00 & LED_LINE_AH )
	{
		if (state->m_last_LED_value != state->m_LED_AH)
			state->m_LED_AH=state->m_LED_AH & ~state->m_data_1E00;
	}
	else if ( state->m_data_1F00 & LED_LINE_ST)
	{
		if (state->m_last_LED_value != state->m_LED_ST)
			state->m_LED_ST=state->m_LED_ST & ~state->m_data_1E00;
	}
	else if ( state->m_data_1F00 & LED_LINE_18 )
	{
		if (state->m_last_LED_value != state->m_LED_18)
			state->m_LED_18=state->m_LED_18 & ~state->m_data_1E00;
	}


	LOG(("LED_18 from %02x \n",state->m_LED_18));
	LOG(("LED_AH from %02x \n",state->m_LED_AH));
	LOG(("LED_ST from %02x \n",state->m_LED_ST));

	if (state->m_led_update)			/*No LED Update if Port 1C00,1D00 was read */
		update_leds(state);

	state->m_remove_led_flag=TRUE;
	state->m_led_update=TRUE;

	state->m_LED_18=0;
	state->m_LED_AH=0;
	state->m_LED_ST=0;


/* Start */

	if (!state->m_emu_started)
		return 0xbf;
	else
		state->m_timer_update_irq->adjust( attotime::zero, 0, attotime::from_hz(598) );  //HACK adjust timer after start ???


/* Buttons */

	i=get_first_bit(state->m_data_1E00);
	if (i==NOT_VALID)
		return 0xff;

	key_data=input_port_read(space->machine(), status_lines[i]);

	if (key_data != 0xc0)
	{
		LOG(("%s, key_data: %02x \n",status_lines[i],key_data));

/* Button: New Game -> initialize board */

		if (i==0 && key_data==0x80)
		{
			set_board(state);
			set_pieces(state);

			state->m_emu_started=FALSE;
		}

/* Button: Clear Board -> remove all pieces */

		if (i==3 && key_data==0x80)
			clear_pieces(state);

		if (key_data != 0xff )
			return key_data;

	}

	return 0xc0;
}