 
       if sprite_y <= int16(gpu_line) and (sprite_y + 8) > int16(gpu_line) {
 
+        total += 1;
+        if total > 10 {
+          // No more sprites
+          break;
+        }
+
         let tile_y: int16 = int16(gpu_line) - sprite_y;
         let td_address: int16 = sprite_tile * 16 + int16(tile_y) * 2;
 


            // Combine them into a single index from 0 to 3
            let palette_index = uint8((palette_hi << 1) | palette_lo);

            // Palette
            let color = if testb(sprite_flags, 4) {
              (gpu_obj0_palette >> (palette_index * 2)) & 0x3;
            } else {
              (gpu_obj1_palette >> (palette_index * 2)) & 0x3;
            };

            // Push pixel to framebuffer
            *(gpu_framebuffer + (int64(gpu_line) * 160) + (sprite_x + x)) = color;
          }

          x += 1;


  // Create renderer
  _renderer = SDL_CreateRenderer(_window, -1,
    SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);

  // White initial screen
  SDL_SetRenderDrawColor(_renderer, 155, 188, 15, 255);
