1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-02-09 02:31:22 +00:00

Fixed playfield pixel logic.

This commit is contained in:
Thomas Harte 2015-07-19 10:56:04 -04:00
parent 12746b35e3
commit 03a25c8ff2

View File

@ -23,15 +23,17 @@ Machine::Machine()
void Machine::output_pixels(int count) void Machine::output_pixels(int count)
{ {
while(count--) { while(count--) {
int x = _pixelPosition >> 2; const int x = _pixelPosition >> 2;
bool mirrored = (x / 20) && !!(_playFieldControl&1); const int mirrored = (x / 20) & (_playFieldControl&1);
int index = mirrored ? (x%20) : 39 - x; const int index = mirrored ? x - 20 : 19 - (x%20);
int byte = 2 - (index >> 3); const int byte = 2 - (index >> 3);
int bit = (index & 7)^((byte&1) ? 0 : 7); const int lowestBit = (byte&1)^1;
const int bit = (index & 7)^(lowestBit | (lowestBit << 1) | (lowestBit << 2));
_playFieldPixel = (_playField[byte] >> bit)&1; _playFieldPixel = (_playField[byte] >> bit)&1;
// if(!(_pixelPosition&3)) // if(!(_pixelPosition&3))
// printf("[%d %d]\n", byte, bit);
// fputc(_playFieldPixel && !_vblank ? '*' : ' ', stdout); // fputc(_playFieldPixel && !_vblank ? '*' : ' ', stdout);
_pixelPosition++; _pixelPosition++;