Mercurial > repos > blastem
comparison vdp.c @ 1361:1679ea04c449
WIP attempt at fixing the minor line -2 glitch in the OD2 Ninja Escape scene
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 14 May 2017 11:15:56 -0700 |
parents | 3716b90d3470 |
children | 83bdd358f3a7 |
comparison
equal
deleted
inserted
replaced
1360:e1a6e8ee656f | 1361:1679ea04c449 |
---|---|
2055 uint32_t bg_color = context->colors[context->regs[REG_BG_COLOR] & 0x3F]; | 2055 uint32_t bg_color = context->colors[context->regs[REG_BG_COLOR] & 0x3F]; |
2056 uint32_t *dst; | 2056 uint32_t *dst; |
2057 if (headless) { | 2057 if (headless) { |
2058 dst = context->output; | 2058 dst = context->output; |
2059 } else { | 2059 } else { |
2060 dst = ((uint32_t *)(((char *)context->fb) + context->output_pitch * (context->border_top - 2))) | 2060 dst = context->output + (context->hslot - BG_START_SLOT) * 2; |
2061 + (context->hslot - BG_START_SLOT) * 2; | 2061 } |
2062 } | 2062 for (int i = 0; i < LINEBUF_SIZE - 2 * (context->hslot - BG_START_SLOT); i++, dst++) |
2063 for (int i = 0; i < LINEBUF_SIZE - 2 * (context->hslot - BG_START_SLOT); i++) | |
2064 { | 2063 { |
2065 *(dst++) = bg_color; | 2064 if (dst >= context->done_output) { |
2065 *dst = bg_color; | |
2066 } | |
2066 } | 2067 } |
2067 } | 2068 } |
2068 context->sprite_index = 0x80; | 2069 context->sprite_index = 0x80; |
2069 context->slot_counter = 0; | 2070 context->slot_counter = 0; |
2070 render_border_garbage( | 2071 render_border_garbage( |
2718 } else { | 2719 } else { |
2719 dst++; | 2720 dst++; |
2720 } | 2721 } |
2721 if (dst >= context->done_output) { | 2722 if (dst >= context->done_output) { |
2722 *(dst++) = bg_color; | 2723 *(dst++) = bg_color; |
2724 context->done_output = dst; | |
2723 } else { | 2725 } else { |
2724 dst++; | 2726 dst++; |
2725 } | 2727 } |
2726 if (context->hslot == (bg_end_slot-1)) { | 2728 if (context->hslot == (bg_end_slot-1)) { |
2727 *(dst++) = bg_color; | 2729 *(dst++) = bg_color; |
2730 context->done_output = dst; | |
2728 } | 2731 } |
2729 } | 2732 } |
2730 | 2733 |
2731 if (!is_refresh(context, context->hslot)) { | 2734 if (!is_refresh(context, context->hslot)) { |
2732 external_slot(context); | 2735 external_slot(context); |
2910 vdp_latch_hv(context); | 2913 vdp_latch_hv(context); |
2911 } | 2914 } |
2912 if (reg == REG_BG_COLOR) { | 2915 if (reg == REG_BG_COLOR) { |
2913 value &= 0x3F; | 2916 value &= 0x3F; |
2914 } | 2917 } |
2918 if (reg == REG_MODE_2 && ((value ^ context->regs[reg]) & BIT_DISP_EN)) { | |
2919 printf("Display %s at %d, %d, %d\n", value & BIT_DISP_EN ? "enabled" : "disabled", context->frame, context->vcounter, context->hslot); | |
2920 } | |
2915 /*if (reg == REG_MODE_4 && ((value ^ context->regs[reg]) & BIT_H40)) { | 2921 /*if (reg == REG_MODE_4 && ((value ^ context->regs[reg]) & BIT_H40)) { |
2916 printf("Mode changed from H%d to H%d @ %d, frame: %d\n", context->regs[reg] & BIT_H40 ? 40 : 32, value & BIT_H40 ? 40 : 32, context->cycles, context->frame); | 2922 printf("Mode changed from H%d to H%d @ %d, frame: %d\n", context->regs[reg] & BIT_H40 ? 40 : 32, value & BIT_H40 ? 40 : 32, context->cycles, context->frame); |
2917 }*/ | 2923 }*/ |
2918 context->regs[reg] = value; | 2924 context->regs[reg] = value; |
2919 if (reg == REG_MODE_4) { | 2925 if (reg == REG_MODE_4) { |