1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-06-25 18:30:07 +00:00

Actually, I'm dithering over whether the 6522 should be an ordinary class or a curiously-recurring template. But it'll need a file, definitely.

This commit is contained in:
Thomas Harte 2016-06-06 21:56:02 -04:00
parent ca23e2e10a
commit 6522530e1c
4 changed files with 71 additions and 3 deletions

24
Components/6522/6522.cpp Normal file
View File

@ -0,0 +1,24 @@
//
// 6522.cpp
// Clock Signal
//
// Created by Thomas Harte on 06/06/2016.
// Copyright © 2016 Thomas Harte. All rights reserved.
//
#include "6522.hpp"
using namespace MOS;
MOS6522::MOS6522()
{
}
void MOS6522::set_register(int address, uint8_t value)
{
}
uint8_t MOS6522::get_register(int address)
{
return 0xff;
}

26
Components/6522/6522.hpp Normal file
View File

@ -0,0 +1,26 @@
//
// 6522.hpp
// Clock Signal
//
// Created by Thomas Harte on 06/06/2016.
// Copyright © 2016 Thomas Harte. All rights reserved.
//
#ifndef _522_hpp
#define _522_hpp
#include <cstdint>
namespace MOS {
class MOS6522 {
public:
MOS6522();
void set_register(int address, uint8_t value);
uint8_t get_register(int address);
};
}
#endif /* _522_hpp */

View File

@ -30,8 +30,20 @@ using namespace MOS;
15 - 1111 Light yellow
*/
/*
0 -> green
1 -> green
2 -> browny yellow
3 -> browny red
4 -> purple
5 -> purple
6 -> cyan
7 -> green
8 -> green
*/
MOS6560::MOS6560() :
_crt(new Outputs::CRT::CRT(65*4, 4, 261, Outputs::CRT::ColourSpace::YIQ, 65*4, 1, 1)),
_crt(new Outputs::CRT::CRT(65*4, 4, 261, Outputs::CRT::ColourSpace::YIQ, 65*4, 1, 1)), // TODO: turn 261 back into 263 once vertical sync exists
_horizontal_counter(0),
_vertical_counter(0)
{
@ -41,8 +53,8 @@ MOS6560::MOS6560() :
"uint c = texture(texID, coordinate).r;"
"float y = 0.75 + (float(c & 8u) / 8.0) * 0.25 * step(1, c);"
"uint iPhase = c & 7u;"
"float phaseOffset = float(iPhase + 3u) / 7.0;" // TODO: appropriate phaseOffset
"uint iPhase = 8u;"
"float phaseOffset = 6.283185308 * (float(iPhase)) / 7.0;" // TODO: appropriate phaseOffset
"return mix(step(1, c) * y, step(2, c) * step(mod(phase + phaseOffset, 6.283185308), 3.141592654), amplitude);"
"}");

View File

@ -317,6 +317,7 @@
4BC76E6B1C98F43700E6EF73 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BC76E6A1C98F43700E6EF73 /* Accelerate.framework */; };
4BC9DF451D044FCA00F44158 /* ROMImages in Resources */ = {isa = PBXBuildFile; fileRef = 4BC9DF441D044FCA00F44158 /* ROMImages */; };
4BC9DF4F1D04691600F44158 /* 6560.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC9DF4D1D04691600F44158 /* 6560.cpp */; };
4BCA98C31D065CA20062F44C /* 6522.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BCA98C11D065CA20062F44C /* 6522.cpp */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@ -689,6 +690,8 @@
4BC9DF461D04565200F44158 /* CSKeyboardMachine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSKeyboardMachine.h; sourceTree = "<group>"; };
4BC9DF4D1D04691600F44158 /* 6560.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = 6560.cpp; sourceTree = "<group>"; };
4BC9DF4E1D04691600F44158 /* 6560.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = 6560.hpp; sourceTree = "<group>"; };
4BCA98C11D065CA20062F44C /* 6522.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = 6522.cpp; sourceTree = "<group>"; };
4BCA98C21D065CA20062F44C /* 6522.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = 6522.hpp; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -1277,6 +1280,8 @@
4BC9DF4B1D04691600F44158 /* 6522 */ = {
isa = PBXGroup;
children = (
4BCA98C11D065CA20062F44C /* 6522.cpp */,
4BCA98C21D065CA20062F44C /* 6522.hpp */,
);
path = 6522;
sourceTree = "<group>";
@ -1720,6 +1725,7 @@
4BBF99181C8FBA6F0075DAFB /* TextureTarget.cpp in Sources */,
4BC76E691C98E31700E6EF73 /* FIRFilter.cpp in Sources */,
4B55CE5F1C3B7D960093A61B /* MachineDocument.swift in Sources */,
4BCA98C31D065CA20062F44C /* 6522.cpp in Sources */,
4B69FB441C4D941400B5F0AA /* TapeUEF.cpp in Sources */,
4BBF99141C8FBA6F0075DAFB /* CRTInputBufferBuilder.cpp in Sources */,
4B2409551C45AB05004DA684 /* Speaker.cpp in Sources */,