comparison vdp.c @ 1138:25268334a24c

Fix Mode 4 sprite table Y scan to account for VRAM byte swapping
author Michael Pavone <pavone@retrodev.com>
date Mon, 02 Jan 2017 16:25:13 -0800
parents 9e0f2ea4a0fc
children 6b0da6021544
comparison
equal deleted inserted replaced
1137:9e0f2ea4a0fc 1138:25268334a24c
468 if (context->sprite_index < MAX_SPRITES_FRAME_H32) { 468 if (context->sprite_index < MAX_SPRITES_FRAME_H32) {
469 uint32_t line = context->vcounter + 1; 469 uint32_t line = context->vcounter + 1;
470 line &= 0xFF; 470 line &= 0xFF;
471 471
472 uint32_t sat_address = mode4_address_map[(context->regs[REG_SAT] << 7 & 0x3F00) + context->sprite_index]; 472 uint32_t sat_address = mode4_address_map[(context->regs[REG_SAT] << 7 & 0x3F00) + context->sprite_index];
473 uint32_t y = context->vdpmem[sat_address]; 473 uint32_t y = context->vdpmem[sat_address+1];
474 uint32_t size = (context->regs[REG_MODE_2] & BIT_SPRITE_SZ) ? 16 : 8; 474 uint32_t size = (context->regs[REG_MODE_2] & BIT_SPRITE_SZ) ? 16 : 8;
475 475
476 if (y >= 0xd0) { 476 if (y >= 0xd0) {
477 context->sprite_index = MAX_SPRITES_FRAME_H32; 477 context->sprite_index = MAX_SPRITES_FRAME_H32;
478 return; 478 return;
489 } 489 }
490 context->sprite_index++; 490 context->sprite_index++;
491 } 491 }
492 492
493 if (context->sprite_index < MAX_SPRITES_FRAME_H32) { 493 if (context->sprite_index < MAX_SPRITES_FRAME_H32) {
494 y = context->vdpmem[sat_address+1]; 494 y = context->vdpmem[sat_address];
495 if (y >= 0xd0) { 495 if (y >= 0xd0) {
496 context->sprite_index = MAX_SPRITES_FRAME_H32; 496 context->sprite_index = MAX_SPRITES_FRAME_H32;
497 return; 497 return;
498 } else { 498 } else {
499 if (y <= line && line < (y + size)) { 499 if (y <= line && line < (y + size)) {