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

@ -128,16 +128,16 @@ void bungo_mini5sx_state::mini5sx_config(machine_config &config)
// m_maincpu->set_irq_acknowledge_callback("pic8259_master", FUNC(pic8259_device::inta_cb));
I8251(config, m_sio_kbd, 0);
// m_sio_kbd->txd_handler().set("keyb", FUNC(pc9801_kbd_device::input_txd));
// m_sio_kbd->rxrdy_handler().set_inputline(m_maincpu, INPUT_LINE_IRQ1);
// m_sio_kbd->txd_handler().set("keyb", FUNC(pc9801_kbd_device::input_txd));
// m_sio_kbd->rxrdy_handler().set_inputline(m_maincpu, INPUT_LINE_IRQ1);
// clock_device &kbd_clock(CLOCK(config, "kbd_clock", 19'200));
// kbd_clock.signal_handler().set(m_sio_kbd, FUNC(i8251_device::write_rxc));
// kbd_clock.signal_handler().append(m_sio_kbd, FUNC(i8251_device::write_txc));
// clock_device &kbd_clock(CLOCK(config, "kbd_clock", 19'200));
// kbd_clock.signal_handler().set(m_sio_kbd, FUNC(i8251_device::write_rxc));
// kbd_clock.signal_handler().append(m_sio_kbd, FUNC(i8251_device::write_txc));
// TODO: should be PC-98 based with no numpad and some extra keys.
// TODO: should be PC-98 based with no numpad and some extra keys.
PC9801_KBD(config, m_keyb, 0);
// m_keyb->rxd_callback().set("sio_kbd", FUNC(i8251_device::write_rxd));
// m_keyb->rxd_callback().set("sio_kbd", FUNC(i8251_device::write_rxd));
I8255(config, m_ppi_sys, 0);
// m_ppi_sys->in_pa_callback().set(m_ppi_sys, FUNC(i8255_device::pa_r));

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)
@ -301,9 +296,9 @@ void pc9801_kbd_device::key_break(uint8_t row, uint8_t column)
void pc9801_kbd_device::key_repeat(uint8_t row, uint8_t column)
{
uint8_t code = translate(row, column);
uint8_t code = translate(row, column);
send_key(code);
send_key(code);
}
void pc9801_kbd_device::send_key(uint8_t code)
@ -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());
}