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
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef Atari2600_PIA_h
|
|
|
|
#define Atari2600_PIA_h
|
|
|
|
|
2017-11-10 03:04:49 +00:00
|
|
|
#include <cstdint>
|
|
|
|
|
2016-12-03 18:41:55 +00:00
|
|
|
#include "../../Components/6532/6532.hpp"
|
|
|
|
|
|
|
|
namespace Atari2600 {
|
|
|
|
|
|
|
|
class PIA: public MOS::MOS6532<PIA> {
|
|
|
|
public:
|
2017-03-24 01:59:16 +00:00
|
|
|
inline uint8_t get_port_input(int port) {
|
2016-12-03 18:41:55 +00:00
|
|
|
return port_values_[port];
|
|
|
|
}
|
|
|
|
|
2017-03-24 01:59:16 +00:00
|
|
|
inline void update_port_input(int port, uint8_t mask, bool set) {
|
2016-12-03 18:41:55 +00:00
|
|
|
if(set) port_values_[port] &= ~mask; else port_values_[port] |= mask;
|
|
|
|
set_port_did_change(port);
|
|
|
|
}
|
|
|
|
|
|
|
|
PIA() :
|
|
|
|
port_values_{0xff, 0xff}
|
|
|
|
{}
|
|
|
|
|
|
|
|
private:
|
|
|
|
uint8_t port_values_[2];
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* PIA_h */
|