Skip to content
Clément Gallet edited this page Jun 25, 2014 · 1 revision
char i = 0; // $824D
char j = 0; // $824E
char k; // $824F
char l; // $8250
char m = 0; // $8254
char n; // $12
char sprite[20] // $822D
short address_to; // $10
short address_from; // $64
char offset = 0; // Y
const short base_address; // $61
const char const_sprite_width; // $8251
char sprite_width; // $8252
char sprite_height; // $8253


for (; sprite_height != 0; sprite_height--){
offset = 0;
for (sprite_width = const_sprite_width; sprite_width != 0; sprite_width--){

if (i == 0){
  i = 0x10;
  l = sprite[j];
  k = sprite[j+1];
  j = j + 2;
}
i--;

// Basically, shift left the 16-bit integer (l << 8) | k.
k <<= 1;
rotate_left(l);

if (carry_set){
  address_to = base_address;
  if (! bit16_mode){ // $81AC
    for (n = 0; n < 0x8; n++){
      address_to[offset + 2*n] = address_from[m + 2*n] // two bytes copied
    }
    for (n = 0; n < 0x8; n++){
      address_to[offset + 2*n + 0x10] = address_from[m + n + 0x10] & 0x00FF // two bytes copied
    }
    m += 0x18;
  }
  else {
    for (n = 0; n < 0x10; n++){
      address_to[offset + 2*n] = address_from[m + 2*n] // two bytes copied
    }
    m += 0x20;

  }  
}
offset += 0x20;
}

i = 0;
base_address += 0x200;
}
Clone this wiki locally