Mercurial > repos > blastem
comparison vdp.c @ 2230:3888c7ed4e36
Fix handling of sprite indices >= 64 in H32 mode
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Wed, 07 Sep 2022 23:19:29 -0700 |
parents | eaaf28af3c94 |
children | c149c929361c |
comparison
equal
deleted
inserted
replaced
2229:f699f9d500b4 | 2230:3888c7ed4e36 |
---|---|
652 ymin = 128; | 652 ymin = 128; |
653 height_mult = 8; | 653 height_mult = 8; |
654 } | 654 } |
655 context->sprite_index &= 0x7F; | 655 context->sprite_index &= 0x7F; |
656 //TODO: Implement squirelly behavior documented by Kabuto | 656 //TODO: Implement squirelly behavior documented by Kabuto |
657 if (context->sprite_index >= context->max_sprites_frame) { | 657 if (context->sprite_index >= MAX_SPRITES_FRAME) { |
658 context->sprite_index = 0; | 658 context->sprite_index = 0; |
659 return; | 659 return; |
660 } | 660 } |
661 uint16_t address = context->sprite_index * 4; | 661 uint16_t address = context->sprite_index * 4; |
662 line += ymin; | 662 line += ymin; |
671 } | 671 } |
672 context->sprite_index = context->sat_cache[address+3] & 0x7F; | 672 context->sprite_index = context->sat_cache[address+3] & 0x7F; |
673 if (context->sprite_index && ((uint8_t)context->slot_counter) < context->max_sprites_line) | 673 if (context->sprite_index && ((uint8_t)context->slot_counter) < context->max_sprites_line) |
674 { | 674 { |
675 //TODO: Implement squirelly behavior documented by Kabuto | 675 //TODO: Implement squirelly behavior documented by Kabuto |
676 if (context->sprite_index >= context->max_sprites_frame) { | 676 if (context->sprite_index >= MAX_SPRITES_FRAME) { |
677 context->sprite_index = 0; | 677 context->sprite_index = 0; |
678 return; | 678 return; |
679 } | 679 } |
680 address = context->sprite_index * 4; | 680 address = context->sprite_index * 4; |
681 y = ((context->sat_cache[address] & 0x3) << 8 | context->sat_cache[address+1]) & ymask; | 681 y = ((context->sat_cache[address] & 0x3) << 8 | context->sat_cache[address+1]) & ymask; |
772 ymin = 256; | 772 ymin = 256; |
773 } else { | 773 } else { |
774 ymask = 0x1FF; | 774 ymask = 0x1FF; |
775 ymin = 128; | 775 ymin = 128; |
776 } | 776 } |
777 uint16_t att_addr = mode5_sat_address(context) + context->sprite_info_list[context->cur_slot].index * 8 + 4; | 777 uint8_t index = context->sprite_info_list[context->cur_slot].index; |
778 if (!(context->regs[REG_MODE_4] & BIT_H40)) { | |
779 index &= MAX_SPRITES_FRAME_H32 - 1; | |
780 } | |
781 uint16_t att_addr = mode5_sat_address(context) + index * 8 + 4; | |
778 uint16_t tileinfo = (context->vdpmem[att_addr] << 8) | context->vdpmem[att_addr+1]; | 782 uint16_t tileinfo = (context->vdpmem[att_addr] << 8) | context->vdpmem[att_addr+1]; |
779 uint8_t pal_priority = (tileinfo >> 9) & 0x70; | 783 uint8_t pal_priority = (tileinfo >> 9) & 0x70; |
780 uint8_t row; | 784 uint8_t row; |
781 uint16_t cache_addr = context->sprite_info_list[context->cur_slot].index * 4; | 785 uint16_t cache_addr = context->sprite_info_list[context->cur_slot].index * 4; |
782 line = (line + ymin) & ymask; | 786 line = (line + ymin) & ymask; |