From 03a25c8ff2ad910c4a378ab28558d5f19342f894 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 19 Jul 2015 10:56:04 -0400 Subject: [PATCH] Fixed playfield pixel logic. --- Machines/Atari2600.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Machines/Atari2600.cpp b/Machines/Atari2600.cpp index 237aa1031..787e7fa83 100644 --- a/Machines/Atari2600.cpp +++ b/Machines/Atari2600.cpp @@ -23,15 +23,17 @@ Machine::Machine() void Machine::output_pixels(int count) { while(count--) { - int x = _pixelPosition >> 2; - bool mirrored = (x / 20) && !!(_playFieldControl&1); - int index = mirrored ? (x%20) : 39 - x; - int byte = 2 - (index >> 3); - int bit = (index & 7)^((byte&1) ? 0 : 7); + const int x = _pixelPosition >> 2; + const int mirrored = (x / 20) & (_playFieldControl&1); + const int index = mirrored ? x - 20 : 19 - (x%20); + const int byte = 2 - (index >> 3); + const int lowestBit = (byte&1)^1; + const int bit = (index & 7)^(lowestBit | (lowestBit << 1) | (lowestBit << 2)); _playFieldPixel = (_playField[byte] >> bit)&1; // if(!(_pixelPosition&3)) +// printf("[%d %d]\n", byte, bit); // fputc(_playFieldPixel && !_vblank ? '*' : ' ', stdout); _pixelPosition++;