comparison vdp.c @ 2513:61645edbe30f

Fix TMS9918A sprite zooming and early clock flag
author Michael Pavone <pavone@retrodev.com>
date Fri, 30 Aug 2024 21:16:46 -0700
parents e51b1fc0e37f
children 75dd7536c467
comparison
equal deleted inserted replaced
2512:9df8dec435b7 2513:61645edbe30f
3834 uint16_t address = context->regs[REG_SAT] << 7 & 0x3F80; 3834 uint16_t address = context->regs[REG_SAT] << 7 & 0x3F80;
3835 address |= context->sprite_info_list[context->sprite_index].index << 2 | 2; 3835 address |= context->sprite_info_list[context->sprite_index].index << 2 | 2;
3836 address = context->vdpmem[mode4_address_map[address] ^ 1] << 3; 3836 address = context->vdpmem[mode4_address_map[address] ^ 1] << 3;
3837 address |= context->regs[REG_STILE_BASE] << 11 & 0x3800; 3837 address |= context->regs[REG_STILE_BASE] << 11 & 0x3800;
3838 uint8_t diff = context->vcounter + 1 - context->sprite_info_list[context->sprite_index].y; 3838 uint8_t diff = context->vcounter + 1 - context->sprite_info_list[context->sprite_index].y;
3839 if (context->regs[REG_MODE_2] & BIT_SPRITE_ZM) {
3840 diff >>= 1;
3841 }
3839 address += diff; 3842 address += diff;
3840 context->sprite_draw_list[context->sprite_index].address = address; 3843 context->sprite_draw_list[context->sprite_index].address = address;
3841 } 3844 }
3842 3845
3843 static void tms_sprite_tag(vdp_context *context) 3846 static void tms_sprite_tag(vdp_context *context)
3895 context->flags2 |= FLAG2_SPRITE_COLLIDE; 3898 context->flags2 |= FLAG2_SPRITE_COLLIDE;
3896 } else { 3899 } else {
3897 output = context->sprite_draw_list[i].pal_priority; 3900 output = context->sprite_draw_list[i].pal_priority;
3898 } 3901 }
3899 } 3902 }
3900 context->sprite_draw_list[i].address <<= 1; 3903 if (!(context->regs[REG_MODE_2] & BIT_SPRITE_SZ) || ((x - context->sprite_draw_list[i].x_pos) & 1)) {
3904 context->sprite_draw_list[i].address <<= 1;
3905 }
3901 } 3906 }
3902 } 3907 }
3903 return output; 3908 return output;
3904 } 3909 }
3905 3910
4053 tms_fetch_pattern_value(context);\ 4058 tms_fetch_pattern_value(context);\
4054 TMS_CHECK_LIMIT 4059 TMS_CHECK_LIMIT
4055 4060
4056 #define TMS_SPRITE_SCAN_SLOT(slot) \ 4061 #define TMS_SPRITE_SCAN_SLOT(slot) \
4057 case slot:\ 4062 case slot:\
4058 if (context->hslot >= (520 - BORDER_LEFT) / 2) { tms_border(context); }\ 4063 if (context->hslot >= (520 - BORDER_LEFT) / 2) {\
4064 tms_border(context);\
4065 } else {\
4066 tms_sprite_clock(context, 0);\
4067 tms_sprite_clock(context, 1);\
4068 }\
4059 tms_sprite_scan(context);\ 4069 tms_sprite_scan(context);\
4060 TMS_CHECK_LIMIT 4070 TMS_CHECK_LIMIT
4061 4071
4062 #define TMS_SPRITE_BLOCK(slot) \ 4072 #define TMS_SPRITE_BLOCK(slot) \
4063 case slot:\ 4073 case slot:\