From cca53598d3fab1ef092f60308716638545bf7ec1 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sat, 14 May 2016 16:52:24 -0400 Subject: [PATCH] Made another run at 2600 colours. --- Machines/Atari2600/Atari2600.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Machines/Atari2600/Atari2600.cpp b/Machines/Atari2600/Atari2600.cpp index 5615bcebb..835352a92 100644 --- a/Machines/Atari2600/Atari2600.cpp +++ b/Machines/Atari2600/Atari2600.cpp @@ -39,7 +39,7 @@ void Machine::setup_output(float aspect_ratio) "uint y = c & 14u;" "uint iPhase = (c >> 4);" - "float phaseOffset = 6.283185308 * float(iPhase + 13u) / 14.0;" + "float phaseOffset = 6.283185308 * float(iPhase - 1u) / 13.0;" "return (float(y) / 14.0) * (1.0 - amplitude) + step(1, iPhase) * amplitude * cos(phase + phaseOffset);" "}"); _crt->set_output_device(Outputs::CRT::Television); @@ -55,8 +55,10 @@ void Machine::switch_region() "uint y = c & 14u;" "uint iPhase = (c >> 4);" - "float phaseOffset = (0.5 + 2.0 * (float(iPhase&1u) - 0.5) * (float((iPhase >> 1) + (iPhase&1u)) / 14.0));" - "return (float(y) / 14.0) * (1.0 - amplitude) + step(4, (iPhase + 2u) & 15u) * amplitude * cos(phase + 6.283185308 * phaseOffset);" + "uint direction = iPhase & 1u;" + "float phaseOffset = float(7u - direction) + (float(direction) - 0.5) * 2.0 * float(iPhase >> 1);" + "phaseOffset *= 6.283185308 / 12.0;" + "return (float(y) / 14.0) * (1.0 - amplitude) + step(4, (iPhase + 2u) & 15u) * amplitude * cos(phase + phaseOffset);" "}"); _crt->set_new_timing(228, 312, Outputs::CRT::ColourSpace::YUV, 228, 1); } @@ -171,6 +173,9 @@ void Machine::get_output_pixel(uint8_t *pixel, int offset) } // store colour +// static int lc; +// if(_vSyncEnabled) lc = 0; else lc += (offset == 159) ? 1 : 0; +// *pixel = (uint8_t)(((offset / 10) << 4) | (((lc >> 4)&7) << 1)); *pixel = outputColour; }