diff --git a/Machines/Atari2600.cpp b/Machines/Atari2600.cpp index 787e7fa83..07fab5f7a 100644 --- a/Machines/Atari2600.cpp +++ b/Machines/Atari2600.cpp @@ -18,6 +18,7 @@ Machine::Machine() _timestamp = 0; _horizontalTimer = 0; _pixelPosition = 0; + _crt = new Outputs::CRT(228); } void Machine::output_pixels(int count) diff --git a/Machines/Atari2600.hpp b/Machines/Atari2600.hpp index 43c42b5cb..c21a61b84 100644 --- a/Machines/Atari2600.hpp +++ b/Machines/Atari2600.hpp @@ -10,6 +10,7 @@ #define Atari2600_cpp #include "../Processors/6502/CPU6502.hpp" +#include "../Outputs/CRT.hpp" namespace Atari2600 { @@ -39,6 +40,8 @@ class Machine: public CPU6502::Processor { int _pixelPosition; uint8_t _playFieldPixel; void output_pixels(int count); + + Outputs::CRT *_crt; }; } diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index 51972f70e..17c6e3c0a 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -15,6 +15,7 @@ 4B14145E1B5887AA00E04248 /* CPU6502AllRAM.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B1414591B58879D00E04248 /* CPU6502AllRAM.cpp */; }; 4B1414601B58885000E04248 /* WolfgangLorenzTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B14145F1B58885000E04248 /* WolfgangLorenzTests.swift */; }; 4B1414621B58888700E04248 /* KlausDormannTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B1414611B58888700E04248 /* KlausDormannTests.swift */; }; + 4B366DFC1B5C165A0026627B /* CRT.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B366DFA1B5C165A0026627B /* CRT.cpp */; }; 4BB298EE1B587D8400A49093 /* 6502_functional_test.bin in Resources */ = {isa = PBXBuildFile; fileRef = 4BB297E01B587D8300A49093 /* 6502_functional_test.bin */; }; 4BB298EF1B587D8400A49093 /* AllSuiteA.bin in Resources */ = {isa = PBXBuildFile; fileRef = 4BB297E11B587D8300A49093 /* AllSuiteA.bin */; }; 4BB298F01B587D8400A49093 /* TestMachine.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4BB297E31B587D8300A49093 /* TestMachine.mm */; }; @@ -321,6 +322,8 @@ 4B14145A1B58879D00E04248 /* CPU6502AllRAM.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = CPU6502AllRAM.hpp; sourceTree = ""; }; 4B14145F1B58885000E04248 /* WolfgangLorenzTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WolfgangLorenzTests.swift; sourceTree = ""; }; 4B1414611B58888700E04248 /* KlausDormannTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KlausDormannTests.swift; sourceTree = ""; }; + 4B366DFA1B5C165A0026627B /* CRT.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CRT.cpp; path = ../../Outputs/CRT.cpp; sourceTree = ""; }; + 4B366DFB1B5C165A0026627B /* CRT.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = CRT.hpp; path = ../../Outputs/CRT.hpp; sourceTree = ""; }; 4B6D7F921B58822000787C9A /* Atari2600.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Atari2600.cpp; sourceTree = ""; }; 4B6D7F931B58822000787C9A /* Atari2600.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Atari2600.hpp; sourceTree = ""; }; 4BB297DF1B587D8200A49093 /* Clock SignalTests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Clock SignalTests-Bridging-Header.h"; sourceTree = ""; }; @@ -655,6 +658,15 @@ name = "Test Binaries"; sourceTree = ""; }; + 4B366DFD1B5C165F0026627B /* Outputs */ = { + isa = PBXGroup; + children = ( + 4B366DFA1B5C165A0026627B /* CRT.cpp */, + 4B366DFB1B5C165A0026627B /* CRT.hpp */, + ); + name = Outputs; + sourceTree = ""; + }; 4BB297E41B587D8300A49093 /* Wolfgang Lorenz 6502 test suite */ = { isa = PBXGroup; children = ( @@ -930,6 +942,7 @@ 4BB73E951B587A5100552FC2 = { isa = PBXGroup; children = ( + 4B366DFD1B5C165F0026627B /* Outputs */, 4BB73EDC1B587CA500552FC2 /* Machines */, 4BB73EDD1B587CA500552FC2 /* Processors */, 4BB73EA01B587A5100552FC2 /* Clock Signal */, @@ -1415,6 +1428,7 @@ buildActionMask = 2147483647; files = ( 4B1414511B5885DF00E04248 /* Atari2600.cpp in Sources */, + 4B366DFC1B5C165A0026627B /* CRT.cpp in Sources */, 4BB73EA41B587A5100552FC2 /* Atari2600Document.swift in Sources */, 4B14144E1B5883E500E04248 /* Atari2600.mm in Sources */, 4B14145B1B58879D00E04248 /* CPU6502.cpp in Sources */, diff --git a/OSBindings/Mac/Clock Signal/Atari2600Document.swift b/OSBindings/Mac/Clock Signal/Atari2600Document.swift index cc92d4d87..49f981b54 100644 --- a/OSBindings/Mac/Clock Signal/Atari2600Document.swift +++ b/OSBindings/Mac/Clock Signal/Atari2600Document.swift @@ -50,6 +50,8 @@ class Atari2600Document: NSDocument, CSOpenGLViewDelegate { private var lastCycleCount: Int64? func openGLView(view: CSOpenGLView!, didUpdateToTime time: CVTimeStamp) { + // TODO: treat time as a delta from old time, work out how many cycles that is plus error + // this slightly elaborate dance is to avoid overflow let intendedCyclesPerSecond: Int64 = 1194720 let videoTimeScale64 = Int64(time.videoTimeScale) diff --git a/Outputs/CRT.cpp b/Outputs/CRT.cpp new file mode 100644 index 000000000..763864dc6 --- /dev/null +++ b/Outputs/CRT.cpp @@ -0,0 +1,27 @@ +// +// CRT.cpp +// Clock Signal +// +// Created by Thomas Harte on 19/07/2015. +// Copyright © 2015 Thomas Harte. All rights reserved. +// + +#include "CRT.hpp" + +using namespace Outputs; + +CRT::CRT(int cycles_per_line) +{ +} + +void CRT::output_sync(int number_of_cycles) +{ +} + +void CRT::output_level(int number_of_cycles, uint8_t *level, std::string type) +{ +} + +void CRT::output_data(int number_of_cycles, uint8_t *data, std::string type) +{ +} diff --git a/Outputs/CRT.hpp b/Outputs/CRT.hpp new file mode 100644 index 000000000..45be6488b --- /dev/null +++ b/Outputs/CRT.hpp @@ -0,0 +1,28 @@ +// +// CRT.hpp +// Clock Signal +// +// Created by Thomas Harte on 19/07/2015. +// Copyright © 2015 Thomas Harte. All rights reserved. +// + +#ifndef CRT_cpp +#define CRT_cpp + +#include +#include + +namespace Outputs { + +class CRT { + public: + CRT(int cycles_per_line); + void output_sync(int number_of_cycles); + void output_level(int number_of_cycles, uint8_t *level, std::string type); + void output_data(int number_of_cycles, uint8_t *data, std::string type); +}; + +} + + +#endif /* CRT_cpp */