mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-21 05:29:13 +00:00
Factored out the Atari 2600's 6532 connection, as a low-hanging fruit.
This commit is contained in:
parent
3361d6b93a
commit
b81c058c0a
@ -12,8 +12,8 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "../../Processors/6502/CPU6502.hpp"
|
#include "../../Processors/6502/CPU6502.hpp"
|
||||||
#include "../../Components/6532/6532.hpp"
|
|
||||||
#include "../CRTMachine.hpp"
|
#include "../CRTMachine.hpp"
|
||||||
|
#include "PIA.hpp"
|
||||||
#include "Speaker.hpp"
|
#include "Speaker.hpp"
|
||||||
|
|
||||||
#include "../ConfigurationTarget.hpp"
|
#include "../ConfigurationTarget.hpp"
|
||||||
@ -24,28 +24,6 @@ namespace Atari2600 {
|
|||||||
const unsigned int number_of_upcoming_events = 6;
|
const unsigned int number_of_upcoming_events = 6;
|
||||||
const unsigned int number_of_recorded_counters = 7;
|
const unsigned int number_of_recorded_counters = 7;
|
||||||
|
|
||||||
class PIA: public MOS::MOS6532<PIA> {
|
|
||||||
public:
|
|
||||||
inline uint8_t get_port_input(int port)
|
|
||||||
{
|
|
||||||
return port_values_[port];
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void update_port_input(int port, uint8_t mask, bool set)
|
|
||||||
{
|
|
||||||
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];
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
class Machine:
|
class Machine:
|
||||||
public CPU6502::Processor<Machine>,
|
public CPU6502::Processor<Machine>,
|
||||||
public CRTMachine::Machine,
|
public CRTMachine::Machine,
|
||||||
|
40
Machines/Atari2600/PIA.hpp
Normal file
40
Machines/Atari2600/PIA.hpp
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
//
|
||||||
|
// PIA.h
|
||||||
|
// Clock Signal
|
||||||
|
//
|
||||||
|
// Created by Thomas Harte on 03/12/2016.
|
||||||
|
// Copyright © 2016 Thomas Harte. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef Atari2600_PIA_h
|
||||||
|
#define Atari2600_PIA_h
|
||||||
|
|
||||||
|
#include "../../Components/6532/6532.hpp"
|
||||||
|
|
||||||
|
namespace Atari2600 {
|
||||||
|
|
||||||
|
class PIA: public MOS::MOS6532<PIA> {
|
||||||
|
public:
|
||||||
|
inline uint8_t get_port_input(int port)
|
||||||
|
{
|
||||||
|
return port_values_[port];
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void update_port_input(int port, uint8_t mask, bool set)
|
||||||
|
{
|
||||||
|
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 */
|
@ -902,6 +902,7 @@
|
|||||||
4BEA52621DF339D7007E74F2 /* Speaker.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Speaker.hpp; path = Electron/Speaker.hpp; sourceTree = "<group>"; };
|
4BEA52621DF339D7007E74F2 /* Speaker.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Speaker.hpp; path = Electron/Speaker.hpp; sourceTree = "<group>"; };
|
||||||
4BEA52641DF3472B007E74F2 /* Speaker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Speaker.cpp; sourceTree = "<group>"; };
|
4BEA52641DF3472B007E74F2 /* Speaker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Speaker.cpp; sourceTree = "<group>"; };
|
||||||
4BEA52651DF3472B007E74F2 /* Speaker.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Speaker.hpp; sourceTree = "<group>"; };
|
4BEA52651DF3472B007E74F2 /* Speaker.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Speaker.hpp; sourceTree = "<group>"; };
|
||||||
|
4BEA52671DF34909007E74F2 /* PIA.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = PIA.hpp; sourceTree = "<group>"; };
|
||||||
4BEE0A6A1D72496600532C7B /* Cartridge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Cartridge.cpp; sourceTree = "<group>"; };
|
4BEE0A6A1D72496600532C7B /* Cartridge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Cartridge.cpp; sourceTree = "<group>"; };
|
||||||
4BEE0A6B1D72496600532C7B /* Cartridge.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Cartridge.hpp; sourceTree = "<group>"; };
|
4BEE0A6B1D72496600532C7B /* Cartridge.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Cartridge.hpp; sourceTree = "<group>"; };
|
||||||
4BEE0A6D1D72496600532C7B /* PRG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PRG.cpp; sourceTree = "<group>"; };
|
4BEE0A6D1D72496600532C7B /* PRG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PRG.cpp; sourceTree = "<group>"; };
|
||||||
@ -1056,6 +1057,7 @@
|
|||||||
4B2E2D991C3A06EC00138695 /* Atari2600Inputs.h */,
|
4B2E2D991C3A06EC00138695 /* Atari2600Inputs.h */,
|
||||||
4B2E2D981C3A06EC00138695 /* Atari2600.hpp */,
|
4B2E2D981C3A06EC00138695 /* Atari2600.hpp */,
|
||||||
4BEA52651DF3472B007E74F2 /* Speaker.hpp */,
|
4BEA52651DF3472B007E74F2 /* Speaker.hpp */,
|
||||||
|
4BEA52671DF34909007E74F2 /* PIA.hpp */,
|
||||||
);
|
);
|
||||||
path = Atari2600;
|
path = Atari2600;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user