mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-26 09:29:45 +00:00
Latch and return data direction.
Albeit with no port-handling effect yet.
This commit is contained in:
parent
622cca0acf
commit
67d53601d5
@ -11,6 +11,8 @@
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "Implementation/6526Storage.hpp"
|
||||
|
||||
namespace MOS {
|
||||
namespace MOS6526 {
|
||||
|
||||
@ -25,7 +27,9 @@ enum class Personality {
|
||||
P8250,
|
||||
};
|
||||
|
||||
template <typename PortHandlerT, Personality personality> class MOS6526 {
|
||||
template <typename PortHandlerT, Personality personality> class MOS6526:
|
||||
private MOS6526Storage
|
||||
{
|
||||
public:
|
||||
MOS6526(PortHandlerT &port_handler) noexcept : port_handler_(port_handler) {}
|
||||
MOS6526(const MOS6526 &) = delete;
|
||||
|
@ -18,15 +18,31 @@ namespace MOS6526 {
|
||||
template <typename BusHandlerT, Personality personality>
|
||||
void MOS6526<BusHandlerT, personality>::write(int address, uint8_t value) {
|
||||
address &= 0xf;
|
||||
printf("Unhandled 6526 write: %02x to %d\n", value, address);
|
||||
assert(false);
|
||||
switch(address) {
|
||||
case 2: case 3:
|
||||
registers_.data_direction[address - 2] = value;
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("Unhandled 6526 write: %02x to %d\n", value, address);
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename BusHandlerT, Personality personality>
|
||||
uint8_t MOS6526<BusHandlerT, personality>::read(int address) {
|
||||
address &= 0xf;
|
||||
printf("Unhandled 6526 read from %d\n", address);
|
||||
assert(false);
|
||||
switch(address) {
|
||||
case 2: case 3:
|
||||
return registers_.data_direction[address - 2];
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("Unhandled 6526 read from %d\n", address);
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
|
28
Components/6526/Implementation/6526Storage.hpp
Normal file
28
Components/6526/Implementation/6526Storage.hpp
Normal file
@ -0,0 +1,28 @@
|
||||
//
|
||||
// 6526Storage.hpp
|
||||
// Clock Signal
|
||||
//
|
||||
// Created by Thomas Harte on 18/07/2021.
|
||||
// Copyright © 2021 Thomas Harte. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef _526Storage_h
|
||||
#define _526Storage_h
|
||||
|
||||
namespace MOS {
|
||||
namespace MOS6526 {
|
||||
|
||||
struct MOS6526Storage {
|
||||
|
||||
struct Registers {
|
||||
uint8_t output[2] = {0, 0};
|
||||
uint8_t input[2] = {0, 0};
|
||||
uint8_t data_direction[2] = {0, 0};
|
||||
} registers_;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* _526Storage_h */
|
@ -1922,6 +1922,7 @@
|
||||
4BC080D826A25ADA00D03FD8 /* Amiga.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Amiga.cpp; sourceTree = "<group>"; };
|
||||
4BC080DE26A481C100D03FD8 /* 6526.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = 6526.hpp; sourceTree = "<group>"; };
|
||||
4BC080E026A481C100D03FD8 /* 6526Implementation.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = 6526Implementation.hpp; sourceTree = "<group>"; };
|
||||
4BC080E126A48BCC00D03FD8 /* 6526Storage.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = 6526Storage.hpp; sourceTree = "<group>"; };
|
||||
4BC0CB272446BC7B00A79DBB /* OPLTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = OPLTests.mm; sourceTree = "<group>"; };
|
||||
4BC1316D2346DE5000E4FF3D /* StaticAnalyser.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = StaticAnalyser.hpp; sourceTree = "<group>"; };
|
||||
4BC1316E2346DE5000E4FF3D /* Target.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Target.hpp; sourceTree = "<group>"; };
|
||||
@ -4282,6 +4283,7 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4BC080E026A481C100D03FD8 /* 6526Implementation.hpp */,
|
||||
4BC080E126A48BCC00D03FD8 /* 6526Storage.hpp */,
|
||||
);
|
||||
path = Implementation;
|
||||
sourceTree = "<group>";
|
||||
|
Loading…
Reference in New Issue
Block a user