comparison vdp.c @ 1644:cf4e387a8db6

Populate layer debug buffer during inactive display
author Michael Pavone <pavone@retrodev.com>
date Tue, 20 Nov 2018 01:10:03 -0800
parents 6909c5d0bbb5
children b500e971da75
comparison
equal deleted inserted replaced
1643:6909c5d0bbb5 1644:cf4e387a8db6
2900 } else { 2900 } else {
2901 //never active unless either mode 4 or mode 5 is turned on 2901 //never active unless either mode 4 or mode 5 is turned on
2902 active_line = 0x200; 2902 active_line = 0x200;
2903 } 2903 }
2904 } 2904 }
2905 uint32_t *dst = ( 2905 uint32_t *dst;
2906 context->vcounter < context->inactive_start + context->border_bot 2906 uint8_t *debug_dst;
2907 || context->vcounter >= 0x200 - context->border_top 2907 if (
2908 ) && context->hslot >= BG_START_SLOT && context->hslot < bg_end_slot 2908 (
2909 ? context->output + 2 * (context->hslot - BG_START_SLOT) 2909 context->vcounter < context->inactive_start + context->border_bot
2910 : NULL; 2910 || context->vcounter >= 0x200 - context->border_top
2911 ) && context->hslot >= BG_START_SLOT && context->hslot < bg_end_slot
2912 ) {
2913 dst = context->output + 2 * (context->hslot - BG_START_SLOT);
2914 debug_dst = context->layer_debug_buf + 2 * (context->hslot - BG_START_SLOT);
2915 } else {
2916 dst = NULL;
2917 }
2911 2918
2912 if ( 2919 if (
2913 !dst && context->vcounter == context->inactive_start + context->border_bot 2920 !dst && context->vcounter == context->inactive_start + context->border_bot
2914 && context->hslot >= line_change && context->hslot < bg_end_slot 2921 && context->hslot >= line_change && context->hslot < bg_end_slot
2915 ) { 2922 ) {
2916 dst = context->output + 2 * (context->hslot - BG_START_SLOT); 2923 dst = context->output + 2 * (context->hslot - BG_START_SLOT);
2924 debug_dst = context->layer_debug_buf + 2 * (context->hslot - BG_START_SLOT);
2917 } 2925 }
2918 2926
2919 uint8_t test_layer = context->test_port >> 7 & 3; 2927 uint8_t test_layer = context->test_port >> 7 & 3;
2920 if (test_layer) { 2928 if (test_layer) {
2921 dst = NULL; 2929 dst = NULL;
2927 if (context->hslot == BG_START_SLOT && !test_layer && ( 2935 if (context->hslot == BG_START_SLOT && !test_layer && (
2928 context->vcounter < context->inactive_start + context->border_bot 2936 context->vcounter < context->inactive_start + context->border_bot
2929 || context->vcounter >= 0x200 - context->border_top 2937 || context->vcounter >= 0x200 - context->border_top
2930 )) { 2938 )) {
2931 dst = context->output + (context->hslot - BG_START_SLOT) * 2; 2939 dst = context->output + (context->hslot - BG_START_SLOT) * 2;
2940 debug_dst = context->layer_debug_buf + 2 * (context->hslot - BG_START_SLOT);
2932 } else if (context->hslot == bg_end_slot) { 2941 } else if (context->hslot == bg_end_slot) {
2933 advance_output_line(context); 2942 advance_output_line(context);
2934 dst = NULL; 2943 dst = NULL;
2935 } 2944 }
2936 //this will need some tweaking to properly interact with 128K mode, 2945 //this will need some tweaking to properly interact with 128K mode,
2987 } else if (context->regs[REG_MODE_1] & BIT_MODE_4) { 2996 } else if (context->regs[REG_MODE_1] & BIT_MODE_4) {
2988 bg_color = context->colors[CRAM_SIZE * 3 + 0x10 + (context->regs[REG_BG_COLOR] & 0xF)]; 2997 bg_color = context->colors[CRAM_SIZE * 3 + 0x10 + (context->regs[REG_BG_COLOR] & 0xF)];
2989 } 2998 }
2990 if (dst >= context->done_output) { 2999 if (dst >= context->done_output) {
2991 *(dst++) = bg_color; 3000 *(dst++) = bg_color;
3001 *(debug_dst++) = DBG_SRC_BG;
2992 } else { 3002 } else {
2993 dst++; 3003 dst++;
3004 debug_dst++;
2994 } 3005 }
2995 if (dst >= context->done_output) { 3006 if (dst >= context->done_output) {
2996 *(dst++) = bg_color; 3007 *(dst++) = bg_color;
3008 *(debug_dst++) = DBG_SRC_BG;
2997 context->done_output = dst; 3009 context->done_output = dst;
2998 } else { 3010 } else {
2999 dst++; 3011 dst++;
3012 debug_dst++;
3000 } 3013 }
3001 if (context->hslot == (bg_end_slot-1)) { 3014 if (context->hslot == (bg_end_slot-1)) {
3002 *(dst++) = bg_color; 3015 *(dst++) = bg_color;
3016 *(debug_dst++) = DBG_SRC_BG;
3003 context->done_output = dst; 3017 context->done_output = dst;
3004 } 3018 }
3005 } 3019 }
3006 3020
3007 if (!is_refresh(context, context->hslot)) { 3021 if (!is_refresh(context, context->hslot)) {