summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author R. Belmont <rb6502@users.noreply.github.com>2020-06-04 16:07:03 -0400
committer GitHub <noreply@github.com>2020-06-04 16:07:03 -0400
commitc5608bf42f1c928c14596f54e4e2bd4f944920df (patch)
tree0aff426468193d636a202e4bd80f3033135abe0b
parent7c6d6d19cf2894bec84beb30a0b840f1233f44d4 (diff)
parent168bf77be37fa21edda791cb223c8319c938ec5d (diff)
Merge pull request #6786 from shattered/_7a8ebd17a90
hp_ipc_kbd: implement autorepeat (nw)
-rw-r--r--src/devices/bus/hp_hil/hlebase.cpp6
-rw-r--r--src/devices/bus/hp_hil/hlebase.h1
-rw-r--r--src/devices/bus/hp_hil/hlekbd.cpp53
-rw-r--r--src/devices/bus/hp_hil/hlekbd.h13
-rw-r--r--src/mame/drivers/hp_ipc.cpp5
5 files changed, 75 insertions, 3 deletions
diff --git a/src/devices/bus/hp_hil/hlebase.cpp b/src/devices/bus/hp_hil/hlebase.cpp
index c7b121dcb44..dc849d9f65b 100644
--- a/src/devices/bus/hp_hil/hlebase.cpp
+++ b/src/devices/bus/hp_hil/hlebase.cpp
@@ -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;
diff --git a/src/devices/bus/hp_hil/hlebase.h b/src/devices/bus/hp_hil/hlebase.h
index b5cbfa84bef..ebffc3455b2 100644
--- a/src/devices/bus/hp_hil/hlebase.h
+++ b/src/devices/bus/hp_hil/hlebase.h
@@ -30,6 +30,7 @@ protected:
// 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:
diff --git a/src/devices/bus/hp_hil/hlekbd.cpp b/src/devices/bus/hp_hil/hlekbd.cpp
index 398579e7f08..b3709676d30 100644
--- a/src/devices/bus/hp_hil/hlekbd.cpp
+++ b/src/devices/bus/hp_hil/hlekbd.cpp
@@ -439,6 +439,7 @@ 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()
@@ -446,6 +447,9 @@ 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()
@@ -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;
diff --git a/src/devices/bus/hp_hil/hlekbd.h b/src/devices/bus/hp_hil/hlekbd.h
index 25df57da3b3..c9bb59faaad 100644
--- a/src/devices/bus/hp_hil/hlekbd.h
+++ b/src/devices/bus/hp_hil/hlekbd.h
@@ -24,12 +24,25 @@ public:
// 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
diff --git a/src/mame/drivers/hp_ipc.cpp b/src/mame/drivers/hp_ipc.cpp
index 024a0dbc41e..a62a5b06394 100644
--- a/src/mame/drivers/hp_ipc.cpp
+++ b/src/mame/drivers/hp_ipc.cpp
@@ -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)
@@ -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)
******************************************************************************/