diff --git a/Components/6522/6522.hpp b/Components/6522/6522.hpp index f0a492ebe..051f609ef 100644 --- a/Components/6522/6522.hpp +++ b/Components/6522/6522.hpp @@ -131,7 +131,7 @@ private: void access(int address); template uint8_t get_port_input(uint8_t output_mask, uint8_t output, uint8_t timer_mask); - template void update_pcr(const uint8_t); + template void update_pcr(const uint8_t); inline void reevaluate_interrupts(); /// Sets the current intended output value for the port and line; diff --git a/Components/6522/Implementation/6522Implementation.hpp b/Components/6522/Implementation/6522Implementation.hpp index e11f7d512..ccca7a2dd 100644 --- a/Components/6522/Implementation/6522Implementation.hpp +++ b/Components/6522/Implementation/6522Implementation.hpp @@ -132,13 +132,11 @@ template void MOS6522::write(int address, const uint8_t value) { } evaluate_port_b_output(); break; - case 0xc: { // Peripheral control ('PCR'). -// const auto old_peripheral_control = registers_.peripheral_control; + case 0xc: // Peripheral control ('PCR'). registers_.peripheral_control = value; - - update_pcr(value); - update_pcr(value); - } break; + update_pcr(value); + update_pcr(value >> 4); + break; // Interrupt control case 0xd: // Interrupt flag regiser ('IFR'). @@ -156,10 +154,10 @@ template void MOS6522::write(int address, const uint8_t value) { } template -template +template void MOS6522::update_pcr(const uint8_t value) { handshake_modes_[port] = HandshakeMode::None; - switch((value >> shift) & 0x0e) { + switch(value & 0x0e) { default: break; case 0x00: // Negative interrupt input; set Cx2 interrupt on negative Cx2 transition, clear on access to Port x register.