Mercurial > repos > blastem
comparison vdp.c @ 1871:e75b788caedd
Fix debug register output regression in border region
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sat, 27 Jul 2019 21:11:53 -0700 |
parents | dc94354eab66 |
children | 041a381b9f0d |
comparison
equal
deleted
inserted
replaced
1870:e4671a39d155 | 1871:e75b788caedd |
---|---|
275 } | 275 } |
276 if (context->cur_slot < 0) { | 276 if (context->cur_slot < 0) { |
277 return; | 277 return; |
278 } | 278 } |
279 sprite_draw * d = context->sprite_draw_list + context->cur_slot; | 279 sprite_draw * d = context->sprite_draw_list + context->cur_slot; |
280 context->serial_address = d->address; | 280 uint16_t address = d->address; |
281 address += context->sprite_x_offset * d->height * 4; | |
282 context->serial_address = address; | |
281 uint16_t dir; | 283 uint16_t dir; |
282 int16_t x; | 284 int16_t x; |
283 if (d->h_flip) { | 285 if (d->h_flip) { |
284 x = d->x_pos + 7 + 8 * (d->width - 1); | 286 x = d->x_pos + 7 + 8 * (d->width - context->sprite_x_offset - 1); |
285 dir = -1; | 287 dir = -1; |
286 } else { | 288 } else { |
287 x = d->x_pos; | 289 x = d->x_pos + context->sprite_x_offset * 8; |
288 dir = 1; | 290 dir = 1; |
289 } | 291 } |
290 if (d->x_pos) { | 292 if (d->x_pos) { |
291 context->flags |= FLAG_CAN_MASK; | 293 context->flags |= FLAG_CAN_MASK; |
292 if (!(context->flags & FLAG_MASKED)) { | 294 if (!(context->flags & FLAG_MASKED)) { |
293 x -= 128; | 295 x -= 128; |
294 //printf("Draw Slot %d of %d, Rendering sprite cell from %X to x: %d\n", context->cur_slot, context->sprite_draws, d->address, x); | 296 //printf("Draw Slot %d of %d, Rendering sprite cell from %X to x: %d\n", context->cur_slot, context->sprite_draws, d->address, x); |
295 | 297 |
296 for (uint16_t address = d->address; address != ((d->address+4) & 0xFFFF); address++) { | 298 for (; address != ((context->serial_address+4) & 0xFFFF); address++) { |
297 if (x >= 0 && x < 320) { | 299 if (x >= 0 && x < 320) { |
298 if (!(context->linebuf[x] & 0xF)) { | 300 if (!(context->linebuf[x] & 0xF)) { |
299 context->linebuf[x] = (context->vdpmem[address] >> 4) | d->pal_priority; | 301 context->linebuf[x] = (context->vdpmem[address] >> 4) | d->pal_priority; |
300 } else if (context->vdpmem[address] >> 4) { | 302 } else if (context->vdpmem[address] >> 4) { |
301 context->flags2 |= FLAG2_SPRITE_COLLIDE; | 303 context->flags2 |= FLAG2_SPRITE_COLLIDE; |
314 } | 316 } |
315 } else if (context->flags & FLAG_CAN_MASK) { | 317 } else if (context->flags & FLAG_CAN_MASK) { |
316 context->flags |= FLAG_MASKED; | 318 context->flags |= FLAG_MASKED; |
317 context->flags &= ~FLAG_CAN_MASK; | 319 context->flags &= ~FLAG_CAN_MASK; |
318 } | 320 } |
319 if (d->width) { | 321 |
320 d->width--; | 322 context->sprite_x_offset++; |
321 } | 323 if (context->sprite_x_offset == d->width) { |
322 if (d->width) { | |
323 d->address += d->height * 4; | |
324 if (!d->h_flip) { | |
325 d->x_pos += 8; | |
326 } | |
327 } else { | |
328 d->x_pos = 0; | 324 d->x_pos = 0; |
325 context->sprite_x_offset = 0; | |
329 context->cur_slot--; | 326 context->cur_slot--; |
330 } | 327 } |
331 } | 328 } |
332 | 329 |
333 static void fetch_sprite_cells_mode4(vdp_context * context) | 330 static void fetch_sprite_cells_mode4(vdp_context * context) |
551 "Status: %X\n", | 548 "Status: %X\n", |
552 context->address, context->cd, cd_name(context->cd), | 549 context->address, context->cd, cd_name(context->cd), |
553 (context->flags & FLAG_PENDING) ? "word" : (context->flags2 & FLAG2_BYTE_PENDING) ? "byte" : "none", | 550 (context->flags & FLAG_PENDING) ? "word" : (context->flags2 & FLAG2_BYTE_PENDING) ? "byte" : "none", |
554 context->vcounter, context->hslot*2, (context->flags2 & FLAG2_VINT_PENDING) ? "true" : "false", | 551 context->vcounter, context->hslot*2, (context->flags2 & FLAG2_VINT_PENDING) ? "true" : "false", |
555 (context->flags2 & FLAG2_HINT_PENDING) ? "true" : "false", vdp_control_port_read(context)); | 552 (context->flags2 & FLAG2_HINT_PENDING) ? "true" : "false", vdp_control_port_read(context)); |
553 printf("\nDebug Register: %X | Output disabled: %s, Force Layer: %d\n", context->test_port, | |
554 (context->test_port & TEST_BIT_DISABLE) ? "true" : "false", context->test_port >> 7 & 3 | |
555 ); | |
556 //restore flags as calling vdp_control_port_read can change them | 556 //restore flags as calling vdp_control_port_read can change them |
557 context->flags = old_flags; | 557 context->flags = old_flags; |
558 context->flags2 = old_flags2; | 558 context->flags2 = old_flags2; |
559 } | 559 } |
560 | 560 |
2582 //seems like the sprite table scan fills a shift register | 2582 //seems like the sprite table scan fills a shift register |
2583 //values are FIFO, but unused slots precede used slots | 2583 //values are FIFO, but unused slots precede used slots |
2584 //so we set cur_slot to slot_counter and let it wrap around to | 2584 //so we set cur_slot to slot_counter and let it wrap around to |
2585 //the beginning of the list | 2585 //the beginning of the list |
2586 context->cur_slot = context->slot_counter; | 2586 context->cur_slot = context->slot_counter; |
2587 context->sprite_x_offset = 0; | |
2587 context->sprite_draws = MAX_SPRITES_LINE; | 2588 context->sprite_draws = MAX_SPRITES_LINE; |
2588 CHECK_LIMIT | 2589 CHECK_LIMIT |
2589 COLUMN_RENDER_BLOCK(2, 1) | 2590 COLUMN_RENDER_BLOCK(2, 1) |
2590 COLUMN_RENDER_BLOCK(4, 9) | 2591 COLUMN_RENDER_BLOCK(4, 9) |
2591 COLUMN_RENDER_BLOCK(6, 17) | 2592 COLUMN_RENDER_BLOCK(6, 17) |
3021 len = BORDER_LEFT; | 3022 len = BORDER_LEFT; |
3022 } | 3023 } |
3023 uint8_t *src = NULL; | 3024 uint8_t *src = NULL; |
3024 if (test_layer == 2) { | 3025 if (test_layer == 2) { |
3025 //plane A | 3026 //plane A |
3026 src_off += context->buf_a_off + context->hscroll_a; | 3027 src_off += context->buf_a_off - (context->hscroll_a & 0xF); |
3027 src = context->tmp_buf_a; | 3028 src = context->tmp_buf_a; |
3028 } else if (test_layer == 3){ | 3029 } else if (test_layer == 3){ |
3029 //plane B | 3030 //plane B |
3030 src_off += context->buf_b_off + context->hscroll_b; | 3031 src_off += context->buf_b_off - (context->hscroll_b & 0xF); |
3031 src = context->tmp_buf_b; | 3032 src = context->tmp_buf_b; |
3032 } else { | 3033 } else { |
3033 //sprite layer | 3034 //sprite layer |
3034 memset(dst, 0, len); | 3035 memset(dst, 0, len); |
3035 dst += len; | 3036 dst += len; |
3149 case 7: | 3150 case 7: |
3150 render_border_garbage(context, context->serial_address, context->tmp_buf_b, context->buf_b_off, context->col_1); | 3151 render_border_garbage(context, context->serial_address, context->tmp_buf_b, context->buf_b_off, context->col_1); |
3151 break; | 3152 break; |
3152 case 0: | 3153 case 0: |
3153 render_border_garbage(context, context->serial_address, context->tmp_buf_b, context->buf_b_off+8, context->col_2); | 3154 render_border_garbage(context, context->serial_address, context->tmp_buf_b, context->buf_b_off+8, context->col_2); |
3155 break; | |
3156 case 1: | |
3154 inactive_test_output(context, is_h40, test_layer); | 3157 inactive_test_output(context, is_h40, test_layer); |
3155 break; | 3158 break; |
3156 } | 3159 } |
3157 } | 3160 } |
3158 | 3161 |