       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; }
+        // n += 1;
+        if n >= 10 { break; }
 
         // Calculate y-index into the tile (applying y-mirroring)
         let tileY = uint8(int16(self.LY) - sy);


            // 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;
    }
  }



            // Another sprite was drawn and the drawn sprite is < on the
            // X-axis
            if bits.Test(pixelCache, 1) and (xCache <= uint8(sx + 8)) {
              x += 1;
              continue;
            }
