summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/machine
diff options
context:
space:
mode:
author arbee <rb6502@users.noreply.github.com>2020-08-23 12:01:40 -0400
committer arbee <rb6502@users.noreply.github.com>2020-08-23 12:01:40 -0400
commit82d2eea5a9452a5a6c9bf31e6c5191394a2dd686 (patch)
tree0047e1b3ee177f53406146b2e208dd643e92b6dc /src/devices/machine
parent915e4a3171c9a360089b688cb174fbdedf13ddfc (diff)
6522via.cpp: Add support for CB2 pulse mode [R. Belmont, Peter Ferrie]
Diffstat (limited to 'src/devices/machine')
-rw-r--r--src/devices/machine/6522via.cpp20
-rw-r--r--src/devices/machine/6522via.h3
2 files changed, 22 insertions, 1 deletions
diff --git a/src/devices/machine/6522via.cpp b/src/devices/machine/6522via.cpp
index a0b66c138d8..37c7237db52 100644
--- a/src/devices/machine/6522via.cpp
+++ b/src/devices/machine/6522via.cpp
@@ -227,6 +227,7 @@ void via6522_device::device_start()
m_t1 = timer_alloc(TIMER_T1);
m_t2 = timer_alloc(TIMER_T2);
m_ca2_timer = timer_alloc(TIMER_CA2);
+ m_cb2_timer = timer_alloc(TIMER_CB2);
m_shift_timer = timer_alloc(TIMER_SHIFT);
m_shift_irq_timer = timer_alloc(TIMER_SHIFT_IRQ);
@@ -308,6 +309,7 @@ void via6522_device::device_reset()
m_t1->adjust(attotime::never);
m_t2->adjust(attotime::never);
m_ca2_timer->adjust(attotime::never);
+ m_cb2_timer->adjust(attotime::never);
m_shift_timer->adjust(attotime::never);
m_shift_irq_timer->adjust(attotime::never);
}
@@ -585,6 +587,17 @@ u8 via6522_device::read(offs_t offset)
{
LOGINT("PB INT ");
CLR_PB_INT();
+
+ if (m_out_cb2 && (CB2_PULSE_OUTPUT(m_pcr) || CB2_AUTO_HS(m_pcr)))
+ {
+ m_out_cb2 = 0;
+ m_cb2_handler(m_out_cb2);
+ }
+
+ if (CB2_PULSE_OUTPUT(m_pcr))
+ {
+ m_cb2_timer->adjust(clocks_to_attotime(1));
+ }
}
break;
@@ -780,11 +793,16 @@ void via6522_device::write(offs_t offset, u8 data)
LOGINT("PB INT ");
CLR_PB_INT();
- if (m_out_cb2 && CB2_AUTO_HS(m_pcr))
+ if (m_out_cb2 && (CB2_PULSE_OUTPUT(m_pcr) || CB2_AUTO_HS(m_pcr)))
{
m_out_cb2 = 0;
m_cb2_handler(m_out_cb2);
}
+
+ if (CB2_PULSE_OUTPUT(m_pcr))
+ {
+ m_cb2_timer->adjust(clocks_to_attotime(1));
+ }
break;
case VIA_PA:
diff --git a/src/devices/machine/6522via.h b/src/devices/machine/6522via.h
index c79f0fa5903..1a705ab6a29 100644
--- a/src/devices/machine/6522via.h
+++ b/src/devices/machine/6522via.h
@@ -105,6 +105,8 @@ private:
static constexpr device_timer_id TIMER_T2 = 2;
static constexpr device_timer_id TIMER_CA2 = 3;
static constexpr device_timer_id TIMER_SHIFT_IRQ = 4;
+ static constexpr device_timer_id TIMER_CB2 = 5;
+
uint16_t get_counter1_value();
void counter2_decrement();
@@ -175,6 +177,7 @@ private:
attotime m_time2;
uint8_t m_t2_active;
emu_timer *m_ca2_timer;
+ emu_timer *m_cb2_timer;
emu_timer *m_shift_timer;
emu_timer *m_shift_irq_timer;