1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-06-17 06:29:28 +00:00

Started sketching out the delegate interface that will allow a branch from the CRT into whatever native display system is used by a particular platform.

This commit is contained in:
Thomas Harte 2015-07-19 18:32:42 -04:00
parent 4d1e410150
commit 7df5025eef
2 changed files with 30 additions and 3 deletions

View File

@ -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;
}

View File

@ -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;
};
}