diff --git a/Machines/Atari2600.cpp b/Machines/Atari2600.cpp index da3bf02d5..24fba8389 100644 --- a/Machines/Atari2600.cpp +++ b/Machines/Atari2600.cpp @@ -20,7 +20,7 @@ Machine::Machine() _horizontalTimer = 0; _lastOutputStateDuration = 0; _lastOutputState = OutputState::Sync; - _crt = new Outputs::CRT(228, 262, 1, 1); + _crt = new Outputs::CRT(228, 262, 1, 2); _piaTimerStatus = 0xff; memset(_collisions, 0xff, sizeof(_collisions)); _rom = nullptr; @@ -146,8 +146,9 @@ void Machine::get_output_pixel(uint8_t *pixel, int offset) if (playerPixels[0] || missilePixels[0]) outputColour = _playerColour[0]; } - // map that colour to an RGBA - *pixel = outputColour; + // map that colour to separate Y and phase components + pixel[0] = (outputColour << 4)&0xe0; + pixel[1] = outputColour&0xf0; } // in imputing the knowledge that all we're dealing with is the rollover from 159 to 0, @@ -230,7 +231,7 @@ void Machine::output_pixels(unsigned int count) if(_horizontalTimer < (_vBlankExtend ? 152 : 160)) { if(_outputBuffer) - get_output_pixel(&_outputBuffer[_lastOutputStateDuration], 159 - _horizontalTimer); + get_output_pixel(&_outputBuffer[_lastOutputStateDuration << 1], 159 - _horizontalTimer); // increment all graphics counters increment_object_counter(0); diff --git a/OSBindings/Mac/Clock Signal/CSCathodeRayView.m b/OSBindings/Mac/Clock Signal/CSCathodeRayView.m index 6bf8fa5bf..f2494471c 100644 --- a/OSBindings/Mac/Clock Signal/CSCathodeRayView.m +++ b/OSBindings/Mac/Clock Signal/CSCathodeRayView.m @@ -212,12 +212,12 @@ const char *fragmentShader = "uniform sampler2D texID;\n" "uniform float alpha;\n" "\n" - "float sample(float c, float angle)\n" + "float sample(vec2 coordinate, float angle)\n" "{\n" - "float y = 0.1 + mod(c * 128.0, 8.0) * 0.1125;\n" - "float rawCh = (c * 16.0);\n" - "float aOffset = 6.283185308 * floor(rawCh) / 17.0;\n" - "return y + step(1.0, rawCh) * 0.1 * sin(angle + aOffset);\n" + "vec2 c = texture(texID, coordinate).rg;" + "float y = 0.1 + c.x * 0.91071428571429;\n" + "float aOffset = 6.283185308 * c.y;\n" + "return y + step(0.0625, c.y) * 0.1 * sin(angle + aOffset);\n" "}\n" "\n" "void main(void)\n" @@ -229,13 +229,15 @@ const char *fragmentShader = "angles[0] = angle + vec4(3.7699111848, 5.0265482464, 0.0, 1.2566370616);\n" "angles[1] = angle + vec4(2.5132741232, 5.6548667772, 0.6283185308, 0.0);\n" "\n" - "samples[0] = vec4(sample(texture(texID, srcCoordinatesVarying[0]).r, angles[0].x)," - " sample(texture(texID, srcCoordinatesVarying[1]).r, angles[0].y)," - " sample(texture(texID, srcCoordinatesVarying[2]).r, angles[0].z)," - " sample(texture(texID, srcCoordinatesVarying[3]).r, angles[0].w));\n" - "samples[1] = vec4(sample(texture(texID, srcCoordinatesVarying[4]).r, angles[1].x)," - " sample(texture(texID, srcCoordinatesVarying[5]).r, angles[1].y)," - " sample(texture(texID, srcCoordinatesVarying[6]).r, angles[1].z)," + "samples[0] = vec4(" + " sample(srcCoordinatesVarying[0], angles[0].x)," + " sample(srcCoordinatesVarying[1], angles[0].y)," + " sample(srcCoordinatesVarying[2], angles[0].z)," + " sample(srcCoordinatesVarying[3], angles[0].w));\n" + "samples[1] = vec4(" + " sample(srcCoordinatesVarying[4], angles[1].x)," + " sample(srcCoordinatesVarying[5], angles[1].y)," + " sample(srcCoordinatesVarying[6], angles[1].z)," " 1.0);\n" "float y = dot(vec4(0.2, 0.2, 0.2, 0.2), samples[0]) + dot(vec4(0.2, 0.0, 0.0, 0.0), samples[1]);\n" "\n"