2016-12-03 18:41:55 +00:00
|
|
|
//
|
|
|
|
// PIA.h
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 03/12/2016.
|
2018-05-13 19:19:52 +00:00
|
|
|
// Copyright 2016 Thomas Harte. All rights reserved.
|
2016-12-03 18:41:55 +00:00
|
|
|
//
|
|
|
|
|
2024-01-17 04:34:46 +00:00
|
|
|
#pragma once
|
2016-12-03 18:41:55 +00:00
|
|
|
|
2017-11-10 03:04:49 +00:00
|
|
|
#include <cstdint>
|
|
|
|
|
2019-11-09 20:31:41 +00:00
|
|
|
#include "../../../Components/6532/6532.hpp"
|
2016-12-03 18:41:55 +00:00
|
|
|
|
|
|
|
namespace Atari2600 {
|
|
|
|
|
|
|
|
class PIA: public MOS::MOS6532<PIA> {
|
2024-12-02 02:44:14 +00:00
|
|
|
public:
|
|
|
|
inline uint8_t get_port_input(const int port) {
|
|
|
|
return port_values_[port];
|
|
|
|
}
|
2016-12-03 18:41:55 +00:00
|
|
|
|
2024-12-02 02:44:14 +00:00
|
|
|
inline void update_port_input(const int port, const uint8_t mask, const bool set) {
|
|
|
|
if(set) port_values_[port] &= ~mask; else port_values_[port] |= mask;
|
|
|
|
set_port_did_change(port);
|
|
|
|
}
|
2016-12-03 18:41:55 +00:00
|
|
|
|
2024-12-02 02:44:14 +00:00
|
|
|
PIA() : port_values_{0xff, 0xff} {}
|
2016-12-03 18:41:55 +00:00
|
|
|
|
2024-12-02 02:44:14 +00:00
|
|
|
private:
|
|
|
|
uint8_t port_values_[2];
|
2016-12-03 18:41:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|