comparison vdp.c @ 1122:d4bef26d0977

Implemented Mode 4 sprite list termination
author Michael Pavone <pavone@retrodev.com>
date Tue, 27 Dec 2016 13:11:07 -0800
parents 1913f9c28003
children d5412f76accc
comparison
equal deleted inserted replaced
1121:1913f9c28003 1122:d4bef26d0977
469 line += 1; 469 line += 1;
470 line &= 0xFF; 470 line &= 0xFF;
471 471
472 uint32_t y = context->sat_cache[context->sprite_index]; 472 uint32_t y = context->sat_cache[context->sprite_index];
473 uint32_t size = (context->regs[REG_MODE_2] & BIT_SPRITE_SZ) ? 16 : 8; 473 uint32_t size = (context->regs[REG_MODE_2] & BIT_SPRITE_SZ) ? 16 : 8;
474 if (y <= line && line < (y + size)) {
475 context->sprite_info_list[--(context->slot_counter)].size = size;
476 context->sprite_info_list[context->slot_counter].index = context->sprite_index;
477 context->sprite_info_list[context->slot_counter].y = y;
478 }
479 context->sprite_index++;
480 474
481 if (context->sprite_index < MAX_SPRITES_FRAME_H32 && context->slot_counter) { 475 if (y >= 0xd0) {
482 y = context->sat_cache[context->sprite_index]; 476 context->sprite_index = MAX_SPRITES_FRAME_H32;
477 return;
478 } else {
483 if (y <= line && line < (y + size)) { 479 if (y <= line && line < (y + size)) {
484 context->sprite_info_list[--(context->slot_counter)].size = size; 480 context->sprite_info_list[--(context->slot_counter)].size = size;
485 context->sprite_info_list[context->slot_counter].index = context->sprite_index; 481 context->sprite_info_list[context->slot_counter].index = context->sprite_index;
486 context->sprite_info_list[context->slot_counter].y = y; 482 context->sprite_info_list[context->slot_counter].y = y;
487 } 483 }
488 context->sprite_index++; 484 context->sprite_index++;
485 }
486
487 if (context->sprite_index < MAX_SPRITES_FRAME_H32 && context->slot_counter) {
488 y = context->sat_cache[context->sprite_index];
489 if (y >= 0xd0) {
490 context->sprite_index = MAX_SPRITES_FRAME_H32;
491 return;
492 } else {
493 if (y <= line && line < (y + size)) {
494 context->sprite_info_list[--(context->slot_counter)].size = size;
495 context->sprite_info_list[context->slot_counter].index = context->sprite_index;
496 context->sprite_info_list[context->slot_counter].y = y;
497 }
498 context->sprite_index++;
499 }
489 } 500 }
490 501
491 } 502 }
492 } 503 }
493 504
1254 if (context->debug) { 1265 if (context->debug) {
1255 *(dst++) = context->debugcolors[DBG_SRC_A]; 1266 *(dst++) = context->debugcolors[DBG_SRC_A];
1256 } else { 1267 } else {
1257 *(dst++) = context->colors[(*bg_src & 0x1F) + CRAM_SIZE*3]; 1268 *(dst++) = context->colors[(*bg_src & 0x1F) + CRAM_SIZE*3];
1258 } 1269 }
1259
1260 } else if (*sprite_src) { 1270 } else if (*sprite_src) {
1261 //sprite layer is opaque 1271 //sprite layer is opaque
1262 if (context->debug) { 1272 if (context->debug) {
1263 *(dst++) = context->debugcolors[DBG_SRC_S]; 1273 *(dst++) = context->debugcolors[DBG_SRC_S];
1264 } else { 1274 } else {