 
         // Iterate through the columns of the sprite pixels ..
         let x = 0;
+        let rendered = false;
         while x < 8 {
           // Is this column of the sprite visible on the screen ?
           if (sx + x >= 0) and (sx + x < int16(DISP_WIDTH)) {


            // Get pixel data of tile (and apply palette)
            let pixel = self.getPixelForTile(uint16(s.Tile), tileX, tileY);
            if pixel == 0 {
              x += 1;
              continue;
            }

            // Update priority cache
            *(self.SpriteXCache + cacheOffset) = uint8(sx + 8);
            *(self.PixelCache + cacheOffset) |= 0x2;

            let palette = self.OBP1 if bits.Test(s.Flags, 4) else self.OBP0;
            pixel = (palette >> (pixel << 1)) & 0x3;

            // Push pixel to framebuffer
            let offs = offset + uint64(sx + x);
            *(self.FrameBuffer + offs) = self.getColorForPixel(pixel);
          }

          x += 1;
        }
      }

      i -= 1;
    }
  }


      if (sy <= int16(self.LY)) and (sy + spriteHeight) > int16(self.LY) {

        // A maximum 10 sprites per line are allowed
        // n += 1;
        if n >= 10 { break; }

        // Calculate y-index into the tile (applying y-mirroring)
        let tileY = uint8(int16(self.LY) - sy);
