mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-26 23:52:26 +00:00
Fixed colour burst acceptance, switched to an integral single byte streaming of Atari colours.
This commit is contained in:
parent
6d769b3639
commit
6c567d166a
@ -30,14 +30,15 @@ Machine::Machine() :
|
|||||||
|
|
||||||
void Machine::setup_output(float aspect_ratio)
|
void Machine::setup_output(float aspect_ratio)
|
||||||
{
|
{
|
||||||
_crt = new Outputs::CRT::CRT(228, 1, 263, Outputs::CRT::ColourSpace::YIQ, 228, 1, 2);
|
_crt = new Outputs::CRT::CRT(228, 1, 263, Outputs::CRT::ColourSpace::YIQ, 228, 1, 1);
|
||||||
_crt->set_composite_sampling_function(
|
_crt->set_composite_sampling_function(
|
||||||
"float composite_sample(usampler2D texID, vec2 coordinate, vec2 iCoordinate, float phase, float amplitude)\n"
|
"float composite_sample(usampler2D texID, vec2 coordinate, vec2 iCoordinate, float phase, float amplitude)\n"
|
||||||
"{\n"
|
"{"
|
||||||
"vec2 c = vec2(texture(texID, coordinate).rg) / vec2(255.0);"
|
"uint c = texture(texID, coordinate).r;"
|
||||||
"float y = 0.1 + c.x * 0.91071428571429;"
|
"uint y = (c >> 1) & 7u;"
|
||||||
"float aOffset = 6.283185308 * (2.0/16.0 - c.y);" // - 3.0 / 16.0
|
"uint iPhase = (c >> 4);"
|
||||||
"return y + step(0.03125, c.y) * amplitude * cos(phase - aOffset);"
|
"float phaseOffset = 6.283185308 * float(iPhase + 13u) / 16.0;"
|
||||||
|
"return (float(y) / 7.0) * (1.0 - amplitude) + step(1, iPhase) * amplitude * cos(phase + phaseOffset);"
|
||||||
"}");
|
"}");
|
||||||
_crt->set_output_device(Outputs::CRT::Television);
|
_crt->set_output_device(Outputs::CRT::Television);
|
||||||
}
|
}
|
||||||
@ -156,9 +157,8 @@ void Machine::get_output_pixel(uint8_t *pixel, int offset)
|
|||||||
if(playerPixels[0] || missilePixels[0]) outputColour = _playerColour[0];
|
if(playerPixels[0] || missilePixels[0]) outputColour = _playerColour[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
// map that colour to separate Y and phase components
|
// store colour
|
||||||
pixel[0] = (outputColour << 4)&0xe0;
|
pixel[0] = outputColour;
|
||||||
pixel[1] = outputColour&0xf0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// in imputing the knowledge that all we're dealing with is the rollover from 159 to 0,
|
// in imputing the knowledge that all we're dealing with is the rollover from 159 to 0,
|
||||||
@ -169,6 +169,7 @@ void Machine::output_pixels(unsigned int count)
|
|||||||
{
|
{
|
||||||
const int32_t start_of_sync = 214;
|
const int32_t start_of_sync = 214;
|
||||||
const int32_t end_of_sync = 198;
|
const int32_t end_of_sync = 198;
|
||||||
|
const int32_t end_of_colour_burst = 188;
|
||||||
|
|
||||||
while(count--)
|
while(count--)
|
||||||
{
|
{
|
||||||
@ -208,7 +209,8 @@ void Machine::output_pixels(unsigned int count)
|
|||||||
state = OutputState::Pixel;
|
state = OutputState::Pixel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(_horizontalTimer < end_of_sync) state = OutputState::Blank;
|
else if(_horizontalTimer < end_of_colour_burst) state = OutputState::Blank;
|
||||||
|
else if(_horizontalTimer < end_of_sync) state = OutputState::ColourBurst;
|
||||||
else if(_horizontalTimer < start_of_sync) state = OutputState::Sync;
|
else if(_horizontalTimer < start_of_sync) state = OutputState::Sync;
|
||||||
else state = OutputState::Blank;
|
else state = OutputState::Blank;
|
||||||
|
|
||||||
@ -222,6 +224,7 @@ void Machine::output_pixels(unsigned int count)
|
|||||||
switch(_lastOutputState) {
|
switch(_lastOutputState) {
|
||||||
case OutputState::Blank: _crt->output_blank(_lastOutputStateDuration); break;
|
case OutputState::Blank: _crt->output_blank(_lastOutputStateDuration); break;
|
||||||
case OutputState::Sync: _crt->output_sync(_lastOutputStateDuration); break;
|
case OutputState::Sync: _crt->output_sync(_lastOutputStateDuration); break;
|
||||||
|
case OutputState::ColourBurst: _crt->output_colour_burst(_lastOutputStateDuration, 96, 0); break;
|
||||||
case OutputState::Pixel: _crt->output_data(_lastOutputStateDuration, 1); break;
|
case OutputState::Pixel: _crt->output_data(_lastOutputStateDuration, 1); break;
|
||||||
}
|
}
|
||||||
_lastOutputStateDuration = 0;
|
_lastOutputStateDuration = 0;
|
||||||
@ -236,7 +239,7 @@ void Machine::output_pixels(unsigned int count)
|
|||||||
|
|
||||||
if(_horizontalTimer < (_vBlankExtend ? 152 : 160)) {
|
if(_horizontalTimer < (_vBlankExtend ? 152 : 160)) {
|
||||||
if(_outputBuffer)
|
if(_outputBuffer)
|
||||||
get_output_pixel(&_outputBuffer[_lastOutputStateDuration << 1], 159 - _horizontalTimer);
|
get_output_pixel(&_outputBuffer[_lastOutputStateDuration], 159 - _horizontalTimer);
|
||||||
|
|
||||||
// increment all graphics counters
|
// increment all graphics counters
|
||||||
increment_object_counter(0);
|
increment_object_counter(0);
|
||||||
|
@ -87,6 +87,7 @@ class Machine: public CPU6502::Processor<Machine> {
|
|||||||
enum OutputState {
|
enum OutputState {
|
||||||
Sync,
|
Sync,
|
||||||
Blank,
|
Blank,
|
||||||
|
ColourBurst,
|
||||||
Pixel
|
Pixel
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -299,7 +299,7 @@ void CRT::output_scan(const Scan *const scan)
|
|||||||
{
|
{
|
||||||
if(_horizontal_flywheel->get_current_time() < (_horizontal_flywheel->get_standard_period() * 12) >> 6)
|
if(_horizontal_flywheel->get_current_time() < (_horizontal_flywheel->get_standard_period() * 12) >> 6)
|
||||||
{
|
{
|
||||||
_colour_burst_time = (uint16_t)_colour_burst_time;
|
_colour_burst_time = (uint16_t)_horizontal_flywheel->get_current_time();
|
||||||
_colour_burst_phase = scan->phase;
|
_colour_burst_phase = scan->phase;
|
||||||
_colour_burst_amplitude = scan->amplitude;
|
_colour_burst_amplitude = scan->amplitude;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user