Example #1
0
int AY3600_init(running_machine &machine)
{
	apple2_state *state = machine.driver_data<apple2_state>();
	/* Init the key remapping table */
	state->m_ay3600_keys = auto_alloc_array_clear(machine, unsigned int, AY3600_KEYS_LENGTH);

	/* We poll the keyboard periodically to scan the keys.  This is
    actually consistent with how the AY-3600 keyboard controller works. */
	machine.scheduler().timer_pulse(attotime::from_hz(60), FUNC(AY3600_poll));

	/* Set Caps Lock light to ON, since that's how we default it. */
	set_led_status(machine,1,1);

	state->m_keywaiting = 0;
	state->m_keycode = 0;
	state->m_keystilldown = 0;
	state->m_keymodreg = A2_KEYMOD_CAPSLOCK;	// caps lock on

	state->m_last_key = 0xff;	/* necessary for special repeat key behaviour */
	state->m_last_key_unmodified = 0xff;	/* necessary for special repeat key behaviour */
	state->m_time_until_repeat = MAGIC_KEY_REPEAT_NUMBER;

	inputx_setup_natural_keyboard(machine,
		AY3600_keyboard_queue_chars,
		AY3600_keyboard_accept_char,
		NULL);

	return 0;
}
Example #2
0
void at_keyboard_init(AT_KEYBOARD_TYPE type)
{
	int i;
	char buf[32];

	memset(&keyboard, 0, sizeof(keyboard));
	keyboard.type = type;
	keyboard.on = 1;
	keyboard.delay = 60;
	keyboard.repeat = 8;
	keyboard.numlock = 0;
	keyboard.head = keyboard.tail = 0;
	keyboard.input_state = 0;
	memset(&keyboard.make[0], 0, sizeof(UINT8)*128);
	/* set default led state */
	set_led_status(2, 0);
	set_led_status(0, 0);
	set_led_status(1, 0);

	keyboard.scan_code_set = 3;

	/* locate the keyboard ports */
	for (i = 0; i < sizeof(keyboard.ports) / sizeof(keyboard.ports[0]); i++)
	{
		sprintf(buf, "pc_keyboard_%d", i);
		keyboard.ports[i] = port_tag_to_index(buf);
	}

#ifdef MESS
	inputx_setup_natural_keyboard(at_keyboard_queue_chars,
		at_keyboard_accept_char,
		at_keyboard_charqueue_empty);
#endif
}