From 1bb109a23b84a9e8c4e06b64f1889db0f834cf63 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 5 Jul 2016 20:39:15 -0400 Subject: [PATCH] Made a quick attempt at basic C[A/B]2 interrupts. --- Components/6522/6522.hpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Components/6522/6522.hpp b/Components/6522/6522.hpp index a71b16255..887b3f709 100644 --- a/Components/6522/6522.hpp +++ b/Components/6522/6522.hpp @@ -112,7 +112,7 @@ template class MOS6522 { _registers.auxiliary_control = value; break; case 0xc: - printf("Peripheral control %02x\n", value); +// printf("Peripheral control %02x\n", value); _registers.peripheral_control = value; switch(value & 0x0e) { @@ -207,7 +207,16 @@ template class MOS6522 { break; case Line::Two: - // TODO + // TODO: independence (?) + if( value != _control_inputs[port].line_two && // i.e. value has changed ... + !(_registers.peripheral_control & (port ? 0x80 : 0x08)) && // ... and line is input ... + value == !!(_registers.peripheral_control & (port ? 0x40 : 0x04)) // ... and it's either high or low, as required + ) + { + _registers.interrupt_flags |= port ? InterruptFlag::CB2ActiveEdge : InterruptFlag::CA2ActiveEdge; + reevaluate_interrupts(); + } + _control_inputs[port].line_two = value; break; } }