summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author robjustice <j.robert.justice@gmail.com>2023-08-24 16:27:12 +1000
committer GitHub <noreply@github.com>2023-08-24 16:27:12 +1000
commitc082f87846f173a4dd2ac688c5caad8ab9738c92 (patch)
tree67aff246d0a161b4a8a6dfc0fc712cc4fd036351
parent4b2e873aaf1e3984e1ca819d4b0268e76c807aa5 (diff)
apple/apple3.cpp: Added support for two-speed keyboard auto-repeat. (#11503)
-rw-r--r--src/mame/apple/apple3.cpp4
-rw-r--r--src/mame/apple/apple3.h5
-rw-r--r--src/mame/apple/apple3_m.cpp35
3 files changed, 44 insertions, 0 deletions
diff --git a/src/mame/apple/apple3.cpp b/src/mame/apple/apple3.cpp
index fbd46b208e0..7c66e6f8b94 100644
--- a/src/mame/apple/apple3.cpp
+++ b/src/mame/apple/apple3.cpp
@@ -90,6 +90,10 @@ void apple3_state::apple3(machine_config &config)
m_ay3600->shift().set(FUNC(apple3_state::ay3600_shift_r));
m_ay3600->control().set(FUNC(apple3_state::ay3600_control_r));
m_ay3600->data_ready().set(FUNC(apple3_state::ay3600_data_ready_w));
+ m_ay3600->ako().set(FUNC(apple3_state::ay3600_ako_w));
+
+ /* repeat timer */
+ TIMER(config, m_repttimer).configure_generic(FUNC(apple3_state::ay3600_repeat));
/* slot bus */
A2BUS(config, m_a2bus, 0);
diff --git a/src/mame/apple/apple3.h b/src/mame/apple/apple3.h
index 794578e2d8e..ff73877ed2a 100644
--- a/src/mame/apple/apple3.h
+++ b/src/mame/apple/apple3.h
@@ -65,6 +65,7 @@ public:
floppy1(*this, "1"),
floppy2(*this, "2"),
floppy3(*this, "3"),
+ m_repttimer(*this, "repttimer"),
m_reset_latch(false),
m_nmi_latch(false)
{
@@ -89,6 +90,7 @@ public:
required_device<floppy_connector> floppy1;
required_device<floppy_connector> floppy2;
required_device<floppy_connector> floppy3;
+ required_device<timer_device> m_repttimer;
uint8_t apple3_memory_r(offs_t offset);
void apple3_memory_w(offs_t offset, uint8_t data);
@@ -122,6 +124,8 @@ public:
int ay3600_shift_r();
int ay3600_control_r();
void ay3600_data_ready_w(int state);
+ void ay3600_ako_w(int state);
+ TIMER_DEVICE_CALLBACK_MEMBER(ay3600_repeat);
virtual void device_post_load() override;
TIMER_DEVICE_CALLBACK_MEMBER(paddle_timer);
void pdl_handler(int offset);
@@ -162,6 +166,7 @@ private:
int m_c040_time = 0;
uint16_t m_lastchar = 0, m_strobe = 0;
uint8_t m_transchar = 0;
+ bool m_anykeydown;
bool m_charwrt = false;
emu_timer *m_scanstart = nullptr, *m_scanend = nullptr;
diff --git a/src/mame/apple/apple3_m.cpp b/src/mame/apple/apple3_m.cpp
index 133c869911b..c185668f1ab 100644
--- a/src/mame/apple/apple3_m.cpp
+++ b/src/mame/apple/apple3_m.cpp
@@ -1294,6 +1294,41 @@ void apple3_state::ay3600_data_ready_w(int state)
}
}
+void apple3_state::ay3600_ako_w(int state)
+{
+ m_anykeydown = (state == ASSERT_LINE) ? true : false;
+
+ if (m_anykeydown)
+ {
+ m_repttimer->adjust(attotime::from_hz(2));
+ }
+ else
+ {
+ m_repttimer->adjust(attotime::never);
+ }
+}
+
+TIMER_DEVICE_CALLBACK_MEMBER(apple3_state::ay3600_repeat)
+{
+ // is the key still down?
+ if (m_anykeydown)
+ {
+ // Closed Apple key
+ if (m_kbspecial->read() & 0x20)
+ {
+ m_repttimer->adjust(attotime::from_hz(30));
+ }
+ else
+ {
+ m_repttimer->adjust(attotime::from_hz(10));
+ }
+
+ m_strobe = 0x80;
+ m_via[1]->write_ca2(ASSERT_LINE);
+ m_via[1]->write_ca2(CLEAR_LINE);
+ }
+}
+
void apple3_state::pdl_handler(int offset)
{
uint8_t pdlread;