1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-23 20:29:42 +00:00

Incoming: a 'CRT' class, to receive information intended for a cathode ray tube. To decode sync, etc.

This commit is contained in:
Thomas Harte 2015-07-19 13:36:27 -04:00
parent 03a25c8ff2
commit 2d0f861474
6 changed files with 75 additions and 0 deletions

View File

@ -18,6 +18,7 @@ Machine::Machine()
_timestamp = 0;
_horizontalTimer = 0;
_pixelPosition = 0;
_crt = new Outputs::CRT(228);
}
void Machine::output_pixels(int count)

View File

@ -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<Machine> {
int _pixelPosition;
uint8_t _playFieldPixel;
void output_pixels(int count);
Outputs::CRT *_crt;
};
}

View File

@ -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 = "<group>"; };
4B14145F1B58885000E04248 /* WolfgangLorenzTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WolfgangLorenzTests.swift; sourceTree = "<group>"; };
4B1414611B58888700E04248 /* KlausDormannTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KlausDormannTests.swift; sourceTree = "<group>"; };
4B366DFA1B5C165A0026627B /* CRT.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CRT.cpp; path = ../../Outputs/CRT.cpp; sourceTree = "<group>"; };
4B366DFB1B5C165A0026627B /* CRT.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = CRT.hpp; path = ../../Outputs/CRT.hpp; sourceTree = "<group>"; };
4B6D7F921B58822000787C9A /* Atari2600.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Atari2600.cpp; sourceTree = "<group>"; };
4B6D7F931B58822000787C9A /* Atari2600.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Atari2600.hpp; sourceTree = "<group>"; };
4BB297DF1B587D8200A49093 /* Clock SignalTests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Clock SignalTests-Bridging-Header.h"; sourceTree = "<group>"; };
@ -655,6 +658,15 @@
name = "Test Binaries";
sourceTree = "<group>";
};
4B366DFD1B5C165F0026627B /* Outputs */ = {
isa = PBXGroup;
children = (
4B366DFA1B5C165A0026627B /* CRT.cpp */,
4B366DFB1B5C165A0026627B /* CRT.hpp */,
);
name = Outputs;
sourceTree = "<group>";
};
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 */,

View File

@ -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)

27
Outputs/CRT.cpp Normal file
View File

@ -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)
{
}

28
Outputs/CRT.hpp Normal file
View File

@ -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 <stdint.h>
#include <string>
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 */