 
         // 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)) {

    //    Bit2-0 Palette number  **CGB Mode Only**     (OBP0-7)

    let spriteHeight = 16 if self.SpriteSize else 8;
    let i: int64 = 39;
    let n = 0;
    let offset = uint64(self.LY) * DISP_WIDTH;

    while i >= 0 {
      let s = *((self.OAM as *Sprite) + i);
      let sy = int16(s.Y) - 16;
      let sx = int16(s.X) - 8;

      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);
