comparison vdp.c @ 1884:b5549258b98b

Slightly gross fix for edge case introduced in border cropping change
author Michael Pavone <pavone@retrodev.com>
date Sat, 21 Sep 2019 10:53:51 -0700
parents 55198fc9cc1f
children 4178ce857e87
comparison
equal deleted inserted replaced
1883:9ab5184811ea 1884:b5549258b98b
301 context->flags |= FLAG_CAN_MASK; 301 context->flags |= FLAG_CAN_MASK;
302 if (!(context->flags & FLAG_MASKED)) { 302 if (!(context->flags & FLAG_MASKED)) {
303 x -= 128; 303 x -= 128;
304 //printf("Draw Slot %d of %d, Rendering sprite cell from %X to x: %d\n", context->cur_slot, context->sprite_draws, d->address, x); 304 //printf("Draw Slot %d of %d, Rendering sprite cell from %X to x: %d\n", context->cur_slot, context->sprite_draws, d->address, x);
305 305
306 for (; address != ((context->serial_address+4) & 0xFFFF); address++) { 306 for (; address != ((context->serial_address+4) & 0xFFFF); address++) {
307 if (x >= 0 && x < 320) { 307 if (x >= 0 && x < 320) {
308 if (!(context->linebuf[x] & 0xF)) { 308 if (!(context->linebuf[x] & 0xF)) {
309 context->linebuf[x] = (context->vdpmem[address] >> 4) | d->pal_priority; 309 context->linebuf[x] = (context->vdpmem[address] >> 4) | d->pal_priority;
310 } else if (context->vdpmem[address] >> 4) { 310 } else if (context->vdpmem[address] >> 4) {
311 context->flags2 |= FLAG2_SPRITE_COLLIDE; 311 context->flags2 |= FLAG2_SPRITE_COLLIDE;
312 }
312 } 313 }
313 } 314 x += dir;
314 x += dir; 315 if (x >= 0 && x < 320) {
315 if (x >= 0 && x < 320) { 316 if (!(context->linebuf[x] & 0xF)) {
316 if (!(context->linebuf[x] & 0xF)) {
317 context->linebuf[x] = (context->vdpmem[address] & 0xF) | d->pal_priority; 317 context->linebuf[x] = (context->vdpmem[address] & 0xF) | d->pal_priority;
318 } else if (context->vdpmem[address] & 0xF) { 318 } else if (context->vdpmem[address] & 0xF) {
319 context->flags2 |= FLAG2_SPRITE_COLLIDE; 319 context->flags2 |= FLAG2_SPRITE_COLLIDE;
320 }
320 } 321 }
321 } 322 x += dir;
322 x += dir;
323 } 323 }
324 } 324 }
325 } else if (context->flags & FLAG_CAN_MASK) { 325 } else if (context->flags & FLAG_CAN_MASK) {
326 context->flags |= FLAG_MASKED; 326 context->flags |= FLAG_MASKED;
327 context->flags &= ~FLAG_CAN_MASK; 327 context->flags &= ~FLAG_CAN_MASK;
2051 } 2051 }
2052 vdp_update_per_frame_debug(context); 2052 vdp_update_per_frame_debug(context);
2053 context->h40_lines = 0; 2053 context->h40_lines = 0;
2054 context->frame++; 2054 context->frame++;
2055 context->output_lines = 0; 2055 context->output_lines = 0;
2056 } else if (context->output_lines && context->vcounter < context->inactive_start && context->vcounter > context->output_lines) {
2057 context->output_lines = context->vcounter;
2056 } 2058 }
2057 uint32_t output_line = context->vcounter; 2059 uint32_t output_line = context->vcounter;
2058 if (!(context->regs[REG_MODE_2] & BIT_MODE_5)) { 2060 if (!(context->regs[REG_MODE_2] & BIT_MODE_5)) {
2059 //vcounter increment occurs much later in Mode 4 2061 //vcounter increment occurs much later in Mode 4
2060 output_line++; 2062 output_line++;