 
       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;
 

        while x < 8 {
          if (sprite_x + x >= 0) and (sprite_x + x < 160) {
            // Make a bitmask for the pixel being rendered
            let pixel_mask = 0x80 >> ((sprite_x + x) % 8);

            // Check the color bits for that pixel
            let palette_lo = if *(vram + td_address) & pixel_mask != 0 { 1; } else { 0; };

extern def fflush(stream: *FILE);
extern def strncpy(dst: str, src: str, count: size_t): str;
extern def clock(): uint64;
extern def rand(): c_int;
extern def sleep(seconds: uint32);

let CLOCKS_PER_SEC: uint64 = 1000000;
