nec/pc9801_kbd.cpp: add reset command, srcclean
Some checks failed
CI (Linux) / build-linux (-U_FORTIFY_SOURCE, gcc, gcc, g++, mametiny, tiny) (push) Has been cancelled
CI (Linux) / build-linux (clang, clang, clang++, mame, mame) (push) Has been cancelled
CI (macOS) / build-macos (push) Has been cancelled
CI (Windows) / build-windows (clang, clang, clang++, mametiny, tiny) (push) Has been cancelled
CI (Windows) / build-windows (gcc, gcc, g++, mame, mame) (push) Has been cancelled

This commit is contained in:
angelosa 2024-11-08 09:44:57 +01:00
parent 570625398d
commit f0434ceeb7
2 changed files with 33 additions and 23 deletions

View file

@ -10,8 +10,7 @@ Resources:
- https://github.com/tmk/tmk_keyboard/wiki/PC-9801-Keyboard;
TODO:
- key repeat;
- Implement actual i8251 interface;
- actual RDY / RTY implementation, find and check schematics (how they connects to i8251?)
- GRPH + SHIFT scancodes;
- Subclass keyboard variants (cfr. PC-9801-119 with Windows & Menu keys and PC-9801-115 Bungo);
- Verify untested keys:
@ -51,15 +50,6 @@ pc9801_kbd_device::pc9801_kbd_device(const machine_config &mconfig, const char *
{
}
//-------------------------------------------------
// input_ports - device-specific input ports
//-------------------------------------------------
uint8_t pc9801_kbd_device::translate(uint8_t row, uint8_t column)
{
return row * 8 + column;
}
//-------------------------------------------------
// device_validity_check - perform validity checks
// on this device
@ -103,6 +93,11 @@ void pc9801_kbd_device::device_reset()
m_rty_cb(0);
}
uint8_t pc9801_kbd_device::translate(uint8_t row, uint8_t column)
{
return row * 8 + column;
}
static INPUT_PORTS_START( pc9801_kbd )
PORT_START("KEY0") // 0x00 - 0x07
PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC)
@ -274,7 +269,7 @@ ioport_constructor pc9801_kbd_device::device_input_ports() const
//**************************************************************************
// Serial implementation
// device_matrix_keyboard
//**************************************************************************
void pc9801_kbd_device::key_make(uint8_t row, uint8_t column)
@ -313,6 +308,10 @@ void pc9801_kbd_device::send_key(uint8_t code)
stop_processing();
}
//**************************************************************************
// Serial implementation
//**************************************************************************
void pc9801_kbd_device::tra_complete()
{
if (fifo_full())
@ -330,11 +329,23 @@ void pc9801_kbd_device::transmit_byte(u8 byte)
/*
* 0xff: reset
* everything else: implementation specific, TBD
* everything else: implementation specific, TBD (0x9* command, some have extra parameters)
*/
void pc9801_kbd_device::received_byte(u8 byte)
{
logerror("received_byte 0x%02x\n", byte);
if (byte == 0xff)
{
clear_fifo();
receive_register_reset();
transmit_register_reset();
reset_key_state();
start_processing(attotime::from_hz(BAUD));
typematic_stop();
m_rdy_cb(0);
m_rty_cb(0);
}
}
void pc9801_kbd_device::rcv_complete()
@ -342,4 +353,3 @@ void pc9801_kbd_device::rcv_complete()
receive_register_extract();
received_byte(get_received_char());
}