diff --git a/Outputs/CRT.cpp b/Outputs/CRT.cpp index 854dbb101..23adb2604 100644 --- a/Outputs/CRT.cpp +++ b/Outputs/CRT.cpp @@ -12,19 +12,22 @@ using namespace Outputs; CRT::CRT(int cycles_per_line) { + _horizontalOffset = 0.0f; + _verticalOffset = 0.0f; } void CRT::output_sync(int number_of_cycles) { - printf("[%d]\n", number_of_cycles); + // horizontal sync is edge triggered; vertical is integrated + _syncCapacitorChargeLevel += number_of_cycles; } void CRT::output_level(int number_of_cycles, uint8_t *level, std::string type) { - printf("[---:%d]", number_of_cycles); + _syncCapacitorChargeLevel -= number_of_cycles; } void CRT::output_data(int number_of_cycles, uint8_t *data, std::string type) { - printf("[+++:%d]", number_of_cycles); + _syncCapacitorChargeLevel -= number_of_cycles; } diff --git a/Outputs/CRT.hpp b/Outputs/CRT.hpp index 45be6488b..c895e51a7 100644 --- a/Outputs/CRT.hpp +++ b/Outputs/CRT.hpp @@ -20,6 +20,30 @@ class CRT { 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); + + struct CRTRun { + struct Point { + float x, y; + } start_point, end_point; + + enum Type { + Sync, Level, Data + } type; + + uint8_t *data; + }; + + class CRTDelegate { + public: + void crt_did_start_vertical_retrace_with_runs(CRTRun *runs, int number_of_runs); + }; + void set_crt_delegate(CRTDelegate *); + + private: + CRTDelegate *_delegate; + + int _syncCapacitorChargeLevel; + float _horizontalOffset, _verticalOffset; }; }