comparison vdp.c @ 2205:90297f1fb3fe

Fix implementation of semi-broken sprite zoom on SMS1
author Michael Pavone <pavone@retrodev.com>
date Tue, 23 Aug 2022 20:21:26 -0700
parents dc4268a778bc
children 1cccc57c069a
comparison
equal deleted inserted replaced
2204:dc4268a778bc 2205:90297f1fb3fe
700 uint32_t sat_address = mode4_address_map[(context->regs[REG_SAT] << 7 & 0x3F00) + context->sprite_index]; 700 uint32_t sat_address = mode4_address_map[(context->regs[REG_SAT] << 7 & 0x3F00) + context->sprite_index];
701 uint32_t y = context->vdpmem[sat_address+1]; 701 uint32_t y = context->vdpmem[sat_address+1];
702 uint32_t size = (context->regs[REG_MODE_2] & BIT_SPRITE_SZ) ? 16 : 8; 702 uint32_t size = (context->regs[REG_MODE_2] & BIT_SPRITE_SZ) ? 16 : 8;
703 uint32_t ysize = size; 703 uint32_t ysize = size;
704 uint8_t zoom = context->type != VDP_GENESIS && (context->regs[REG_MODE_2] & BIT_SPRITE_ZM); 704 uint8_t zoom = context->type != VDP_GENESIS && (context->regs[REG_MODE_2] & BIT_SPRITE_ZM);
705 if (context->type == VDP_SMS && context->slot_counter <= 4) {
706 zoom = 0;
707 }
708 if (zoom) { 705 if (zoom) {
709 ysize *= 2; 706 ysize *= 2;
710 } 707 }
711 708
712 if (y == 0xd0) { 709 if (y == 0xd0) {
812 if (context->cur_slot >= context->slot_counter) { 809 if (context->cur_slot >= context->slot_counter) {
813 uint32_t address = (context->regs[REG_SAT] << 7 & 0x3F00) + 0x80 + context->sprite_info_list[context->cur_slot].index * 2; 810 uint32_t address = (context->regs[REG_SAT] << 7 & 0x3F00) + 0x80 + context->sprite_info_list[context->cur_slot].index * 2;
814 address = mode4_address_map[address]; 811 address = mode4_address_map[address];
815 --context->sprite_draws; 812 --context->sprite_draws;
816 uint8_t zoom = context->type != VDP_GENESIS && (context->regs[REG_MODE_2] & BIT_SPRITE_ZM); 813 uint8_t zoom = context->type != VDP_GENESIS && (context->regs[REG_MODE_2] & BIT_SPRITE_ZM);
817 if (context->type == VDP_SMS && context->sprite_draws < 4) {
818 zoom = 0;
819 }
820 uint32_t tile_address = context->vdpmem[address] * 32 + (context->regs[REG_STILE_BASE] << 11 & 0x2000); 814 uint32_t tile_address = context->vdpmem[address] * 32 + (context->regs[REG_STILE_BASE] << 11 & 0x2000);
821 if (context->regs[REG_MODE_2] & BIT_SPRITE_SZ) { 815 if (context->regs[REG_MODE_2] & BIT_SPRITE_SZ) {
822 tile_address &= ~32; 816 tile_address &= ~32;
823 } 817 }
824 uint16_t y_diff = context->vcounter - context->sprite_info_list[context->cur_slot].y; 818 uint16_t y_diff = context->vcounter - context->sprite_info_list[context->cur_slot].y;