Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hp_ipc_kbd: implement autorepeat (nw) #6786

Merged
merged 1 commit into from
Jun 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/devices/bus/hp_hil/hlebase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,12 @@ bool hle_device_base::hil_write(uint16_t *pdata)
return true;
break;

case HPHIL_DKA:
case HPHIL_EK1:
case HPHIL_EK2:
hil_typematic(data);
break;

default:
LOG("command %02X unknown\n", data);
break;
Expand Down
1 change: 1 addition & 0 deletions src/devices/bus/hp_hil/hlebase.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class hle_device_base
// device_hp_hil_interface overrides
virtual bool hil_write(uint16_t *data) override;
virtual void hil_idd() = 0;
virtual void hil_typematic(uint8_t command) {};
virtual int hil_poll() = 0;
private:

Expand Down
53 changes: 53 additions & 0 deletions src/devices/bus/hp_hil/hlekbd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,13 +439,17 @@ void hle_hp_itf_device::transmit_byte(uint8_t byte)
hle_hp_ipc_device::hle_hp_ipc_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock)
: hle_device_base(mconfig, HP_IPC_HLE_KEYBOARD, tag, owner, clock)
, device_matrix_keyboard_interface(mconfig, *this, "COL1", "COL2", "COL3", "COL4", "COL5", "COL6", "COL7", "COL8", "COL9", "COL10", "COL11", "COL12", "COL13", "COL14", "COL15")
, m_modifiers(*this, "COL8")
{ }

void hle_hp_ipc_device::device_reset()
{
m_fifo.clear();
reset_key_state();
start_processing(attotime::from_hz(1'200));
typematic_stop();
m_typematic = false;
m_typematic_rate = 0;
}

void hle_hp_ipc_device::hil_idd()
Expand All @@ -454,17 +458,66 @@ void hle_hp_ipc_device::hil_idd()
m_hp_hil_mlc->hil_write(m_device_id16 | 0);
}

void hle_hp_ipc_device::hil_typematic(uint8_t command)
{
switch (command)
{
case HPHIL_DKA:
typematic_stop();
m_typematic = false;
m_typematic_rate = 0;
break;

case HPHIL_EK1:
m_typematic = true;
m_typematic_rate = 30;
break;

case HPHIL_EK2:
m_typematic = true;
m_typematic_rate = 60;
break;
}
}

void hle_hp_ipc_device::key_make(uint8_t row, uint8_t column)
{
transmit_byte((((row + 1) ^ 8) << 4) + (column << 1));
if (m_typematic)
typematic_start(row, column, typematic_delay(), typematic_period());
}

void hle_hp_ipc_device::key_repeat(uint8_t row, uint8_t column)
{
transmit_byte((((row + 1) ^ 8) << 4) + (column << 1));
}

void hle_hp_ipc_device::key_break(uint8_t row, uint8_t column)
{
transmit_byte((((row + 1) ^ 8) << 4) + (column << 1) + 1);
typematic_stop();
}

void hle_hp_ipc_device::will_scan_row(u8 row)
{
u16 const modifiers(m_modifiers->read() & 0x7c);
if (modifiers != m_last_modifiers && m_typematic)
typematic_restart(typematic_delay(), typematic_period());

m_last_modifiers = modifiers;
}

attotime hle_hp_ipc_device::typematic_delay() const
{
return attotime::from_msec(250); // XXX
}

attotime hle_hp_ipc_device::typematic_period() const
{
return attotime::from_hz(m_typematic_rate);
}


int hle_hp_ipc_device::hil_poll()
{
int frames = 1;
Expand Down
13 changes: 13 additions & 0 deletions src/devices/bus/hp_hil/hlekbd.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,25 @@ class hle_hp_ipc_device

// device_matrix_keyboard_interface overrides
virtual void key_make(uint8_t row, uint8_t column) override;
virtual void key_repeat(uint8_t row, uint8_t column) override;
virtual void key_break(uint8_t row, uint8_t column) override;
virtual int hil_poll() override;
virtual void hil_idd() override;
virtual void hil_typematic(uint8_t command) override;

required_ioport m_modifiers;

private:
virtual void will_scan_row(u8 row) override;

util::fifo<uint8_t, 8> m_fifo;
void transmit_byte(uint8_t byte);
attotime typematic_delay() const;
attotime typematic_period() const;

u16 m_last_modifiers;
bool m_typematic;
int m_typematic_rate;
};

class hle_hp_itf_device
Expand Down
5 changes: 2 additions & 3 deletions src/mame/drivers/hp_ipc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ Hewlett-Packard, 1985
Driver to-do list
=================

- softlist: merge dumps from coho.org and classiccmp.org
- keyboard: NMI generation, autorepeat
- keyboard: NMI generation
- RTC chip: proper month, day (possibly a different chip, 82167)
- HP-IL printer
- sound (needs dump of COP452)
Expand Down Expand Up @@ -353,7 +352,7 @@ Software to look for
00095-60006 (original System III-based HP-UX 1.0 ROM)
82995A (same bits as 82991A; the latter is an upgrade kit, former was pre-installed)
82989J Technical Basic ROM (Jan'1986)
82987A Software Engineering ROM (Nov'1986) (possibly can be rebuilt from floppy images on coho?)
82987A Software Engineering ROM (Nov'1986)

******************************************************************************/

Expand Down