mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-24 17:32:55 +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:
parent
4d1e410150
commit
7df5025eef
@ -12,19 +12,22 @@ using namespace Outputs;
|
|||||||
|
|
||||||
CRT::CRT(int cycles_per_line)
|
CRT::CRT(int cycles_per_line)
|
||||||
{
|
{
|
||||||
|
_horizontalOffset = 0.0f;
|
||||||
|
_verticalOffset = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRT::output_sync(int number_of_cycles)
|
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)
|
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)
|
void CRT::output_data(int number_of_cycles, uint8_t *data, std::string type)
|
||||||
{
|
{
|
||||||
printf("[+++:%d]", number_of_cycles);
|
_syncCapacitorChargeLevel -= number_of_cycles;
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,30 @@ class CRT {
|
|||||||
void output_sync(int number_of_cycles);
|
void output_sync(int number_of_cycles);
|
||||||
void output_level(int number_of_cycles, uint8_t *level, std::string type);
|
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);
|
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;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user