~ubuntu-branches/debian/sid/mame/sid

« back to all changes in this revision

Viewing changes to src/mame/video/stvvdp2.c

  • Committer: Package Import Robot
  • Author(s): Jordi Mallach, Emmanuel Kasper, Jordi Mallach
  • Date: 2012-06-05 20:02:23 UTC
  • mfrom: (0.3.1) (0.1.4)
  • Revision ID: package-import@ubuntu.com-20120605200223-gnlpogjrg6oqe9md
Tags: 0.146-1
[ Emmanuel Kasper ]
* New upstream release
* Drop patch to fix man pages section and patches to link with flac 
  and jpeg system lib: all this has been pushed upstream by Cesare Falco
* Add DM-Upload-Allowed: yes field.

[ Jordi Mallach ]
* Create a "gnu" TARGETOS stanza that defines NO_AFFINITY_NP.
* Stop setting TARGETOS to "unix" in d/rules. It should be autodetected,
  and set to the appropriate value.
* mame_manpage_section.patch: Change mame's manpage section to 6 (games),
  in the TH declaration.

Show diffs side-by-side

added added

removed removed

Lines of Context:
102
102
*/
103
103
 
104
104
#include "emu.h"
105
 
#include "profiler.h"
106
105
#include "includes/stv.h"
107
 
#include "drawgfxm.h"
108
106
 
109
107
static UINT8 get_vblank(running_machine &machine);
110
108
static UINT8 get_hblank(running_machine &machine);
2438
2436
{
2439
2437
        UINT32 rb = (a & 0xff00ff) + (b & 0xff00ff);
2440
2438
        UINT32 g = (a & 0x00ff00) + (b & 0x00ff00);
2441
 
        if (rb & 0x1000000) rb |= 0xff0000;
2442
 
        if (g & 0x10000) g = 0xff00;
2443
 
        if (rb & 0x100) rb |= 0xff;
2444
 
        return (rb & 0xff00ff) | g;
 
2439
        return MAKE_RGB((rb & 0x1000000) ? 0xff : RGB_RED(rb),
 
2440
                (g & 0x0010000) ? 0xff : RGB_GREEN(g),
 
2441
                (rb & 0x0000100) ? 0xff : RGB_BLUE(rb)
 
2442
        );
2445
2443
}
2446
2444
 
2447
2445
static void stv_vdp2_drawgfxzoom(
2692
2690
        saturn_state *state = machine.driver_data<saturn_state>();
2693
2691
        rectangle myclip;
2694
2692
        UINT8* gfxdata;
2695
 
        int t_pen;
2696
2693
        int sprite_screen_width, sprite_screen_height;
2697
2694
 
2698
2695
        gfxdata = state->m_vdp2.gfx_decode + code * 0x20;
2772
2769
                                        int r,g,b;
2773
2770
 
2774
2771
                                        data = (source[(x_index>>16)*2] << 8) | source[(x_index>>16)*2+1];
2775
 
                                        t_pen = (data & 0x8000) || ( transparency == STV_TRANSPARENCY_NONE );
2776
 
                                        if (t_pen)
 
2772
                                        if ((data & 0x8000) || (transparency == STV_TRANSPARENCY_NONE))
2777
2773
                                        {
2778
 
                                                b = (data & 0x7c00) >> 7;
2779
 
                                                g = (data & 0x03e0) >> 2;
2780
 
                                                r = (data & 0x001f) << 3;
 
2774
                                                b = pal5bit((data & 0x7c00) >> 10);
 
2775
                                                g = pal5bit((data & 0x03e0) >> 5);
 
2776
                                                r = pal5bit( data & 0x001f);
2781
2777
                                                if(stv2_current_tilemap.fade_control & 1)
2782
2778
                                                        stv_vdp2_compute_color_offset(machine,&r,&g,&b,stv2_current_tilemap.fade_control & 2);
2783
2779
 
2805
2801
        saturn_state *state = machine.driver_data<saturn_state>();
2806
2802
        rectangle myclip;
2807
2803
        UINT8* gfxdata;
2808
 
        int t_pen;
2809
2804
        int sprite_screen_width, sprite_screen_height;
2810
2805
 
2811
2806
        gfxdata = state->m_vdp2.gfx_decode + code * 0x20;
2885
2880
                                        int r,g,b;
2886
2881
 
2887
2882
                                        data = (source[(x_index>>16)*4+0] << 24) | (source[(x_index>>16)*4+1] << 16) | (source[(x_index>>16)*4+2] << 8) | (source[(x_index>>16)*4+3] << 0);
2888
 
                                        t_pen = (data & 0x80000000) || ( transparency == STV_TRANSPARENCY_NONE );
2889
 
                                        if (t_pen)
 
2883
                                        if ((data & 0x80000000) || (transparency == STV_TRANSPARENCY_NONE))
2890
2884
                                        {
2891
2885
                                                b = (data & 0xff0000) >> 16;
2892
2886
                                                g = (data & 0x00ff00) >> 8;
2925
2919
        int xlinesize = 0/*, xpixelsize = 0*/;
2926
2920
        int xcnt,ycnt;
2927
2921
        UINT8* gfxdata = state->m_vdp2.gfx_decode;
2928
 
        static UINT32 *destline;
 
2922
        UINT32 *destline;
2929
2923
        UINT16 pal_color_offset = 0;
2930
2924
        UINT8* gfxdatalow, *gfxdatahigh;
2931
 
        /*Window effect 1=no draw*/
2932
 
        int tw = 0;
2933
 
        /*Transparency code 1=opaque,0=transparent*/
2934
 
        int t_pen;
2935
2925
        int screen_x,screen_y;
2936
2926
 
2937
2927
        if (!stv2_current_tilemap.enabled) return;
2993
2983
                        {
2994
2984
                                for (xcnt = 0; xcnt <xsize;xcnt+=2)
2995
2985
                                {
2996
 
                                        tw = stv_vdp2_window_process(machine,xcnt+1,ycnt);
2997
 
                                        if(tw == 0)
 
2986
                                        if (!stv_vdp2_window_process(machine,xcnt+1,ycnt))
2998
2987
                                        {
2999
 
                                                t_pen = (((gfxdata[0] & 0x0f) >> 0) != 0) ? (1) : (0);
3000
 
                                                if(stv2_current_tilemap.transparency == STV_TRANSPARENCY_NONE) t_pen = 1;
3001
 
                                                if(t_pen)
 
2988
                                                if ((gfxdata[0] & 0x0f) || (stv2_current_tilemap.transparency == STV_TRANSPARENCY_NONE))
3002
2989
                                                {
3003
2990
                                                        if (((xcnt + 1) <= screen_x) && (ycnt <= screen_y))
3004
2991
                                                        {
3005
 
                                                        if ( stv2_current_tilemap.colour_calculation_enabled == 0 )
3006
 
                                                                bitmap.pix32(ycnt, xcnt+1) = machine.pens[((gfxdata[0] & 0x0f) >> 0) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset];
3007
 
                                                        else
3008
 
                                                                bitmap.pix32(ycnt, xcnt+1) = alpha_blend_r32(bitmap.pix32(ycnt, xcnt+1), machine.pens[((gfxdata[0] & 0x0f) >> 0) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset], stv2_current_tilemap.alpha);
 
2992
                                                                if ( stv2_current_tilemap.colour_calculation_enabled == 0 )
 
2993
                                                                        bitmap.pix32(ycnt, xcnt+1) = machine.pens[((gfxdata[0] & 0x0f) >> 0) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset];
 
2994
                                                                else
 
2995
                                                                        bitmap.pix32(ycnt, xcnt+1) = alpha_blend_r32(bitmap.pix32(ycnt, xcnt+1), machine.pens[((gfxdata[0] & 0x0f) >> 0) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset], stv2_current_tilemap.alpha);
3009
2996
                                                        }
3010
2997
                                                }
3011
2998
                                        }
3012
 
                                        tw = stv_vdp2_window_process(machine,xcnt,ycnt);
3013
 
                                        if(tw == 0)
 
2999
                                        if (!stv_vdp2_window_process(machine,xcnt,ycnt))
3014
3000
                                        {
3015
 
                                                t_pen = (((gfxdata[0] & 0xf0) >> 4) != 0) ? (1) : (0);
3016
 
                                                if(stv2_current_tilemap.transparency == STV_TRANSPARENCY_NONE) t_pen = 1;
3017
 
                                                if(t_pen)
 
3001
                                                if ((gfxdata[0] & 0xf0) || (stv2_current_tilemap.transparency == STV_TRANSPARENCY_NONE))
3018
3002
                                                {
3019
3003
                                                        if (((xcnt + 0) <= screen_x) && (ycnt <= screen_y))
3020
3004
                                                        {
3021
 
                                                        if ( stv2_current_tilemap.colour_calculation_enabled == 0 )
3022
 
                                                                bitmap.pix32(ycnt, xcnt) = machine.pens[((gfxdata[0] & 0xf0) >> 4) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset];
3023
 
                                                        else
3024
 
                                                                bitmap.pix32(ycnt, xcnt) = alpha_blend_r32(bitmap.pix32(ycnt, xcnt), machine.pens[((gfxdata[0] & 0xf0) >> 4) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset], stv2_current_tilemap.alpha);
 
3005
                                                                if ( stv2_current_tilemap.colour_calculation_enabled == 0 )
 
3006
                                                                        bitmap.pix32(ycnt, xcnt) = machine.pens[((gfxdata[0] & 0xf0) >> 4) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset];
 
3007
                                                                else
 
3008
                                                                        bitmap.pix32(ycnt, xcnt) = alpha_blend_r32(bitmap.pix32(ycnt, xcnt), machine.pens[((gfxdata[0] & 0xf0) >> 4) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset], stv2_current_tilemap.alpha);
3025
3009
                                                        }
3026
3010
                                                }
3027
3011
                                        }
3043
3027
                                        {
3044
3028
                                                int xs = xcnt & xsizemask;
3045
3029
 
3046
 
                                                tw = stv_vdp2_window_process(machine,xcnt,ycnt);
3047
 
                                                if(tw == 0)
 
3030
                                                if (!stv_vdp2_window_process(machine,xcnt,ycnt))
3048
3031
                                                {
3049
3032
                                                        //60aee2c = $0013 at @605d838
3050
 
                                                        t_pen = ((gfxdata[xs] & 0xff) != 0) ? (1) : (0);
3051
 
                                                        if(stv2_current_tilemap.transparency == STV_TRANSPARENCY_NONE) t_pen = 1;
3052
 
                                                        if(t_pen)
 
3033
                                                        if ((gfxdata[xs] & 0xff) || (stv2_current_tilemap.transparency == STV_TRANSPARENCY_NONE))
3053
3034
                                                        {
3054
3035
                                                                if (((xcnt + 0) <= screen_x) && (ycnt <= screen_y))
3055
3036
                                                                {
3056
 
                                                                if ( stv2_current_tilemap.colour_calculation_enabled == 0 )
3057
 
                                                                        bitmap.pix32(ycnt, xcnt) = machine.pens[(gfxdata[xs] & 0xff) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset];
3058
 
                                                                else
3059
 
                                                                        bitmap.pix32(ycnt, xcnt) = alpha_blend_r32(bitmap.pix32(ycnt, xcnt), machine.pens[(gfxdata[xs] & 0xff) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset], stv2_current_tilemap.alpha);
 
3037
                                                                        if ( stv2_current_tilemap.colour_calculation_enabled == 0 )
 
3038
                                                                                bitmap.pix32(ycnt, xcnt) = machine.pens[(gfxdata[xs] & 0xff) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset];
 
3039
                                                                        else
 
3040
                                                                                bitmap.pix32(ycnt, xcnt) = alpha_blend_r32(bitmap.pix32(ycnt, xcnt), machine.pens[(gfxdata[xs] & 0xff) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset], stv2_current_tilemap.alpha);
3060
3041
                                                                }
3061
3042
                                                        }
3062
3043
                                                }
3085
3066
                                        gfxdata += xlinesize*(yy>>16);
3086
3067
                                        yy &= 0xffff;
3087
3068
 
3088
 
                                        destline = &bitmap.pix32(ycnt);
3089
3069
                                        xx = 0;
3090
3070
                                        for (xcnt = cliprect.min_x; xcnt <= cliprect.max_x; xx+=stv2_current_tilemap.incx, xcnt++)
3091
3071
                                        {
3092
3072
                                                xs = xx >> 16;
3093
 
                                                tw = stv_vdp2_window_process(machine,xcnt,ycnt);
3094
 
                                                if(tw == 0)
 
3073
                                                if (!stv_vdp2_window_process(machine,xcnt,ycnt))
3095
3074
                                                {
3096
 
                                                        t_pen = ((gfxdata[xs] & 0xff) != 0) ? 1 : 0;
3097
 
                                                        if(stv2_current_tilemap.transparency == STV_TRANSPARENCY_NONE) t_pen = 1;
3098
 
                                                        if(t_pen)
 
3075
                                                        if ((gfxdata[xs] & 0xff) || (stv2_current_tilemap.transparency == STV_TRANSPARENCY_NONE))
3099
3076
                                                        {
3100
3077
                                                                if (((xcnt + 0) <= screen_x) && (ycnt <= screen_y))
3101
3078
                                                                {
3102
 
                                                                if ( stv2_current_tilemap.colour_calculation_enabled == 0 )
3103
 
                                                                        bitmap.pix32(ycnt, xcnt) = machine.pens[(gfxdata[xs] & 0xff) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset];
3104
 
                                                                else
3105
 
                                                                        bitmap.pix32(ycnt, xcnt) = alpha_blend_r32(bitmap.pix32(ycnt, xcnt), machine.pens[(gfxdata[xs] & 0xff) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset], stv2_current_tilemap.alpha);
 
3079
                                                                        if ( stv2_current_tilemap.colour_calculation_enabled == 0 )
 
3080
                                                                                bitmap.pix32(ycnt, xcnt) = machine.pens[(gfxdata[xs] & 0xff) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset];
 
3081
                                                                        else
 
3082
                                                                                bitmap.pix32(ycnt, xcnt) = alpha_blend_r32(bitmap.pix32(ycnt, xcnt), machine.pens[(gfxdata[xs] & 0xff) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset], stv2_current_tilemap.alpha);
3106
3083
                                                                }
3107
3084
                                                        }
3108
3085
                                                }
3118
3095
                        {
3119
3096
                                for (xcnt = 0; xcnt <xsize;xcnt++)
3120
3097
                                {
3121
 
                                        tw = stv_vdp2_window_process(machine,xcnt,ycnt);
3122
 
                                        if(tw == 0)
 
3098
                                        if (!stv_vdp2_window_process(machine,xcnt,ycnt))
3123
3099
                                        {
3124
 
                                                t_pen = ((((gfxdata[0] & 0x07) * 0x100) | (gfxdata[1] & 0xff)) != 0) ? (1) : (0);
3125
 
                                                if(stv2_current_tilemap.transparency == STV_TRANSPARENCY_NONE) t_pen = 1;
3126
 
                                                if(t_pen)
 
3100
                                                if (((gfxdata[0] & 0x07) | (gfxdata[1] & 0xff)) || (stv2_current_tilemap.transparency == STV_TRANSPARENCY_NONE))
3127
3101
                                                {
3128
3102
                                                        if (((xcnt + 0) <= screen_x) && (ycnt <= screen_y))
3129
3103
                                                        {
3130
 
                                                        if ( stv2_current_tilemap.colour_calculation_enabled == 0 )
3131
 
                                                                bitmap.pix32(ycnt, xcnt) = machine.pens[((gfxdata[0] & 0x07) * 0x100) | (gfxdata[1] & 0xff) | pal_color_offset];
3132
 
                                                        else
3133
 
                                                                bitmap.pix32(ycnt, xcnt) = alpha_blend_r32(bitmap.pix32(ycnt, xcnt), machine.pens[((gfxdata[0] & 0x07) * 0x100) | (gfxdata[1] & 0xff) | pal_color_offset], stv2_current_tilemap.alpha);
 
3104
                                                                if ( stv2_current_tilemap.colour_calculation_enabled == 0 )
 
3105
                                                                        bitmap.pix32(ycnt, xcnt) = machine.pens[((gfxdata[0] & 0x07) * 0x100) | (gfxdata[1] & 0xff) | pal_color_offset];
 
3106
                                                                else
 
3107
                                                                        bitmap.pix32(ycnt, xcnt) = alpha_blend_r32(bitmap.pix32(ycnt, xcnt), machine.pens[((gfxdata[0] & 0x07) * 0x100) | (gfxdata[1] & 0xff) | pal_color_offset], stv2_current_tilemap.alpha);
3134
3108
                                                        }
3135
3109
                                                }
3136
3110
                                        }
3162
3136
                                                int r,g,b;
3163
3137
                                                int xs = xcnt & xsizemask;
3164
3138
 
3165
 
                                                t_pen = ((gfxdata[2*xs] & 0x80) >> 7) || (stv2_current_tilemap.transparency == STV_TRANSPARENCY_NONE);
3166
 
 
3167
 
                                                if(t_pen)
 
3139
                                                if ((gfxdata[2*xs] & 0x80) || (stv2_current_tilemap.transparency == STV_TRANSPARENCY_NONE))
3168
3140
                                                {
3169
 
                                                        b = ((gfxdata[2*xs] & 0x7c) << 1);
3170
 
                                                        g = ((gfxdata[2*xs] & 0x03) << 6) | ((gfxdata[2*xs+1] & 0xe0) >> 2);
3171
 
                                                        r = ((gfxdata[2*xs+1] & 0x1f) << 3);
 
3141
                                                        b = pal5bit(((gfxdata[2*xs] & 0x7c) >> 2));
 
3142
                                                        g = pal5bit(((gfxdata[2*xs] & 0x03) << 3) | ((gfxdata[2*xs+1] & 0xe0) >> 5));
 
3143
                                                        r = pal5bit(gfxdata[2*xs+1] & 0x1f);
3172
3144
                                                        if(stv2_current_tilemap.fade_control & 1)
3173
3145
                                                                stv_vdp2_compute_color_offset(machine,&r,&g,&b,stv2_current_tilemap.fade_control & 2);
3174
 
                                                        tw = stv_vdp2_window_process(machine,xcnt,ycnt);
3175
 
                                                        if(tw == 0)
 
3146
 
 
3147
                                                        if (!stv_vdp2_window_process(machine,xcnt,ycnt))
3176
3148
                                                        {
3177
3149
                                                                if (((xcnt + 0) <= screen_x) && (ycnt <= screen_y))
3178
3150
                                                                {
3179
 
                                                                if ( stv2_current_tilemap.colour_calculation_enabled == 0 )
3180
 
                                                                        destline[xcnt] = MAKE_RGB(r, g, b);
3181
 
                                                                else
3182
 
                                                                        destline[xcnt] = alpha_blend_r32( destline[xcnt], MAKE_RGB(r, g, b), stv2_current_tilemap.alpha );
 
3151
                                                                        if ( stv2_current_tilemap.colour_calculation_enabled == 0 )
 
3152
                                                                                destline[xcnt] = MAKE_RGB(r, g, b);
 
3153
                                                                        else
 
3154
                                                                                destline[xcnt] = alpha_blend_r32( destline[xcnt], MAKE_RGB(r, g, b), stv2_current_tilemap.alpha );
3183
3155
                                                                }
3184
3156
                                                        }
3185
3157
                                                }
3208
3180
                                                int r,g,b;
3209
3181
 
3210
3182
                                                xs = xx >> 16;
3211
 
                                                t_pen = ((gfxdata[2*xs] & 0x80) >> 7);
3212
 
                                                if(stv2_current_tilemap.transparency == STV_TRANSPARENCY_NONE) t_pen = 1;
3213
 
                                                b = ((gfxdata[2*xs] & 0x7c) << 1);
3214
 
                                                g = ((gfxdata[2*xs] & 0x03) << 6) | ((gfxdata[2*xs+1] & 0xe0) >> 2);
3215
 
                                                r = ((gfxdata[2*xs+1] & 0x1f) << 3);
 
3183
                                                b = pal5bit(((gfxdata[2*xs] & 0x7c) >> 2));
 
3184
                                                g = pal5bit(((gfxdata[2*xs] & 0x03) << 3) | ((gfxdata[2*xs+1] & 0xe0) >> 5));
 
3185
                                                r = pal5bit(gfxdata[2*xs+1] & 0x1f);
3216
3186
                                                if(stv2_current_tilemap.fade_control & 1)
3217
3187
                                                        stv_vdp2_compute_color_offset(machine, &r,&g,&b,stv2_current_tilemap.fade_control & 2);
3218
 
                                                tw = stv_vdp2_window_process(machine,xcnt,ycnt);
3219
 
                                                if(tw == 0)
 
3188
 
 
3189
                                                if (!stv_vdp2_window_process(machine,xcnt,ycnt))
3220
3190
                                                {
3221
 
                                                        if(t_pen)
 
3191
                                                        if ((gfxdata[2*xs] & 0x80) || (stv2_current_tilemap.transparency == STV_TRANSPARENCY_NONE))
3222
3192
                                                        {
3223
3193
                                                                if (((xcnt + 0) <= screen_x) && (ycnt <= screen_y))
3224
3194
                                                                {
3260
3230
                                        UINT32 dot_data;
3261
3231
 
3262
3232
                                        dot_data = (gfxdata[4*xs+0]<<24)|(gfxdata[4*xs+1]<<16)|(gfxdata[4*xs+2]<<8)|(gfxdata[4*xs+3]<<0);
3263
 
 
3264
 
                                        t_pen = (dot_data & 0x80000000) >> 31;
3265
 
                                        if(stv2_current_tilemap.transparency == STV_TRANSPARENCY_NONE) t_pen = 1;
3266
 
 
3267
 
                                        if(t_pen)
 
3233
                                        if ((dot_data & 0x80000000) || (stv2_current_tilemap.transparency == STV_TRANSPARENCY_NONE))
3268
3234
                                        {
3269
3235
                                                b = ((dot_data & 0x00ff0000) >> 16);
3270
3236
                                                g = ((dot_data & 0x0000ff00) >> 8);
3272
3238
 
3273
3239
                                                if(stv2_current_tilemap.fade_control & 1)
3274
3240
                                                        stv_vdp2_compute_color_offset(machine,&r,&g,&b,stv2_current_tilemap.fade_control & 2);
3275
 
                                                tw = stv_vdp2_window_process(machine,xcnt,ycnt);
3276
 
                                                if(tw == 0)
 
3241
 
 
3242
                                                if (!stv_vdp2_window_process(machine,xcnt,ycnt))
3277
3243
                                                {
3278
3244
                                                        if (((xcnt + 0) <= screen_x) && (ycnt <= screen_y))
3279
3245
                                                        {
4506
4472
                                switch( stv2_current_tilemap.transparency )
4507
4473
                                {
4508
4474
                                        case STV_TRANSPARENCY_PEN:
4509
 
                                                if ( pix != 0x0000 )
 
4475
                                                if (pix & 0xffffff)
4510
4476
                                                {
4511
4477
                                                        if(stv2_current_tilemap.fade_control & 1)
4512
4478
                                                                stv_vdp2_compute_color_offset_UINT32(machine,&pix,stv2_current_tilemap.fade_control & 2);
4521
4487
                                                line[hcnt] = pix;
4522
4488
                                                break;
4523
4489
                                        case STV_TRANSPARENCY_ALPHA:
4524
 
                                                if ( pix != 0x000 )
 
4490
                                                if (pix & 0xffffff)
4525
4491
                                                {
4526
4492
                                                        if(stv2_current_tilemap.fade_control & 1)
4527
4493
                                                                stv_vdp2_compute_color_offset_UINT32(machine,&pix,stv2_current_tilemap.fade_control & 2);
4530
4496
                                                }
4531
4497
                                                break;
4532
4498
                                        case STV_TRANSPARENCY_ADD_BLEND:
4533
 
                                                if ( pix != 0x0000 )
 
4499
                                                if (pix & 0xffffff)
4534
4500
                                                {
4535
4501
                                                        if(stv2_current_tilemap.fade_control & 1)
4536
4502
                                                                stv_vdp2_compute_color_offset_UINT32(machine,&pix,stv2_current_tilemap.fade_control & 2);
4617
4583
                                switch( stv2_current_tilemap.transparency )
4618
4584
                                {
4619
4585
                                        case STV_TRANSPARENCY_PEN:
4620
 
                                                if ( pix != 0x0000 )
 
4586
                                                if (pix & 0xffffff)
4621
4587
                                                {
4622
4588
                                                        if(stv2_current_tilemap.fade_control & 1)
4623
4589
                                                                stv_vdp2_compute_color_offset_UINT32(machine,&pix,stv2_current_tilemap.fade_control & 2);
4632
4598
                                                line[hcnt] = pix;
4633
4599
                                                break;
4634
4600
                                        case STV_TRANSPARENCY_ALPHA:
4635
 
                                                if ( pix != 0x000 )
 
4601
                                                if (pix & 0xffffff)
4636
4602
                                                {
4637
4603
                                                        if(stv2_current_tilemap.fade_control & 1)
4638
4604
                                                                stv_vdp2_compute_color_offset_UINT32(machine,&pix,stv2_current_tilemap.fade_control & 2);
4641
4607
                                                }
4642
4608
                                                break;
4643
4609
                                        case STV_TRANSPARENCY_ADD_BLEND:
4644
 
                                                if ( pix != 0x0000 )
 
4610
                                                if (pix & 0xffffff)
4645
4611
                                                {
4646
4612
                                                        if(stv2_current_tilemap.fade_control & 1)
4647
4613
                                                                stv_vdp2_compute_color_offset_UINT32(machine,&pix,stv2_current_tilemap.fade_control & 2);
5380
5346
                                UINT16 dot;
5381
5347
 
5382
5348
                                dot = (gfxdata[base_offs+0]<<8)|gfxdata[base_offs+1];
5383
 
                                b = (dot & 0x7c00) >> 7;
5384
 
                                g = (dot & 0x03e0) >> 2;
5385
 
                                r = (dot & 0x001f) << 3;
 
5349
                                b = pal5bit((dot & 0x7c00) >> 10);
 
5350
                                g = pal5bit((dot & 0x03e0) >> 5);
 
5351
                                r = pal5bit( dot & 0x001f);
5386
5352
                                if(STV_VDP2_BKCOEN)
5387
5353
                                        stv_vdp2_compute_color_offset( machine, &r, &g, &b, STV_VDP2_BKCOSL );
5388
5354
 
5584
5550
                        palette_set_color_rgb(space->machine(),(offset*2)+1,pal5bit(r),pal5bit(g),pal5bit(b));
5585
5551
                        if(cmode0)
5586
5552
                                palette_set_color_rgb(space->machine(),((offset*2)+1)^0x400,pal5bit(r),pal5bit(g),pal5bit(b));
 
5553
 
5587
5554
                        b = ((state->m_vdp2_cram[offset] & 0x7c000000) >> 26);
5588
5555
                        g = ((state->m_vdp2_cram[offset] & 0x03e00000) >> 21);
5589
5556
                        r = ((state->m_vdp2_cram[offset] & 0x001f0000) >> 16);
5734
5701
 
5735
5702
static UINT8 get_hblank(running_machine &machine)
5736
5703
{
5737
 
        static int cur_h;
5738
5704
        const rectangle &visarea = machine.primary_screen->visible_area();
5739
 
        cur_h = machine.primary_screen->hpos();
 
5705
        int cur_h = machine.primary_screen->hpos();
5740
5706
 
5741
5707
        if (cur_h > visarea.max_x) //TODO
5742
5708
                return 1;
6321
6287
                                                if(STV_VDP2_SPWINEN && pix == 0x8000) /* Pukunpa */
6322
6288
                                                        continue;
6323
6289
 
6324
 
                                                b = (pix & 0x7c00) >> 7;
6325
 
                                                g = (pix & 0x03e0) >> 2;
6326
 
                                                r = (pix & 0x1f) << 3;
6327
 
 
 
6290
                                                b = pal5bit((pix & 0x7c00) >> 10);
 
6291
                                                g = pal5bit((pix & 0x03e0) >> 5);
 
6292
                                                r = pal5bit( pix & 0x001f);
6328
6293
                                                if ( color_offset_pal )
6329
6294
                                                {
6330
6295
                                                        stv_vdp2_compute_color_offset( machine, &r, &g, &b, STV_VDP2_SPCOSL );
6346
6311
                                                {
6347
6312
                                                        if ( pix & ~sprite_shadow )
6348
6313
                                                        {
6349
 
                                                                bitmap_line[x] = (bitmap_line[x] & ~0x010101) >> 1;
 
6314
                                                                UINT32 p = bitmap_line[x];
 
6315
                                                                bitmap_line[x] = MAKE_RGB(RGB_RED(p) >> 1, RGB_GREEN(p) >> 1, RGB_BLUE(p) >> 1);
6350
6316
                                                        }
6351
6317
                                                }
6352
6318
                                                else
6357
6323
                                                                /*shadow - in reality, we should check from what layer pixel beneath comes...*/
6358
6324
                                                                if ( STV_VDP2_SDCTL & 0x3f )
6359
6325
                                                                {
6360
 
                                                                        bitmap_line[x] = (bitmap_line[x] & ~0x010101) >> 1;
 
6326
                                                                        UINT32 p = bitmap_line[x];
 
6327
                                                                        bitmap_line[x] = MAKE_RGB(RGB_RED(p) >> 1, RGB_GREEN(p) >> 1, RGB_BLUE(p) >> 1);
6361
6328
                                                                }
6362
6329
                                                                /* note that when shadows are disabled, "shadow" palette entries are not drawn */
6363
6330
                                                        }
6396
6363
                                                        continue;
6397
6364
                                                };
6398
6365
 
6399
 
                                                b = (pix & 0x7c00) >> 7;
6400
 
                                                g = (pix & 0x03e0) >> 2;
6401
 
                                                r = (pix & 0x1f) << 3;
 
6366
                                                b = pal5bit((pix & 0x7c00) >> 10);
 
6367
                                                g = pal5bit((pix & 0x03e0) >> 5);
 
6368
                                                r = pal5bit( pix & 0x001f);
6402
6369
                                                if ( color_offset_pal )
6403
6370
                                                {
6404
6371
                                                        stv_vdp2_compute_color_offset( machine, &r, &g, &b, STV_VDP2_SPCOSL );
6436
6403
                                                {
6437
6404
                                                        if ( pix & ~sprite_shadow )
6438
6405
                                                        {
6439
 
                                                                bitmap_line[x] = (bitmap_line[x] & ~0x010101) >> 1;
 
6406
                                                                UINT32 p = bitmap_line[x];
 
6407
                                                                bitmap_line[x] = MAKE_RGB(RGB_RED(p) >> 1, RGB_GREEN(p) >> 1, RGB_BLUE(p) >> 1);
6440
6408
                                                        }
6441
6409
                                                }
6442
6410
                                                else
6447
6415
                                                                /*shadow - in reality, we should check from what layer pixel beneath comes...*/
6448
6416
                                                                if ( STV_VDP2_SDCTL & 0x3f )
6449
6417
                                                                {
6450
 
                                                                        bitmap_line[x] = (bitmap_line[x] & ~0x010101) >> 1;
 
6418
                                                                        UINT32 p = bitmap_line[x];
 
6419
                                                                        bitmap_line[x] = MAKE_RGB(RGB_RED(p) >> 1, RGB_GREEN(p) >> 1, RGB_BLUE(p) >> 1);
6451
6420
                                                                }
6452
6421
                                                                /* note that when shadows are disabled, "shadow" palette entries are not drawn */
6453
6422
                                                        } else if ( pix )
6505
6474
                                                stv_sprite_priorities_in_fb_line[y][sprite_priorities[0]] = 1;
6506
6475
                                                continue;
6507
6476
                                        };
6508
 
                                        b = (pix & 0x7c00) >> 7;
6509
 
                                        g = (pix & 0x03e0) >> 2;
6510
 
                                        r = (pix & 0x1f) << 3;
 
6477
 
 
6478
                                        b = pal5bit((pix & 0x7c00) >> 10);
 
6479
                                        g = pal5bit((pix & 0x03e0) >> 5);
 
6480
                                        r = pal5bit( pix & 0x001f);
6511
6481
                                        if ( color_offset_pal )
6512
6482
                                        {
6513
6483
                                                stv_vdp2_compute_color_offset( machine, &r, &g, &b, STV_VDP2_SPCOSL );
6588
6558
                                        {
6589
6559
                                                if ( pix & ~sprite_shadow )
6590
6560
                                                {
6591
 
                                                        bitmap_line[x] = (bitmap_line[x] & ~0x010101) >> 1;
 
6561
                                                        UINT32 p = bitmap_line[x];
 
6562
                                                        bitmap_line[x] = MAKE_RGB(RGB_RED(p) >> 1, RGB_GREEN(p) >> 1, RGB_BLUE(p) >> 1);
6592
6563
                                                }
6593
6564
                                        }
6594
6565
                                        else
6599
6570
                                                        /*shadow - in reality, we should check from what layer pixel beneath comes...*/
6600
6571
                                                        if ( STV_VDP2_SDCTL & 0x3f )
6601
6572
                                                        {
6602
 
                                                                bitmap_line[x] = (bitmap_line[x] & ~0x010101) >> 1;
 
6573
                                                                UINT32 p = bitmap_line[x];
 
6574
                                                                bitmap_line[x] = MAKE_RGB(RGB_RED(p) >> 1, RGB_GREEN(p) >> 1, RGB_BLUE(p) >> 1);
6603
6575
                                                        }
6604
6576
                                                        /* note that when shadows are disabled, "shadow" palette entries are not drawn */
6605
6577
                                                } else if ( pix )
6668
6640
SCREEN_UPDATE_RGB32( stv_vdp2 )
6669
6641
{
6670
6642
        saturn_state *state = screen.machine().driver_data<saturn_state>();
6671
 
        static UINT8 pri;
6672
6643
 
6673
6644
        stv_vdp2_fade_effects(screen.machine());
6674
6645
 
6709
6680
 
6710
6681
        if(STV_VDP2_DISP)
6711
6682
        {
 
6683
                UINT8 pri;
 
6684
 
6712
6685
                stv_sprite_priorities_usage_valid = 0;
6713
6686
                memset(stv_sprite_priorities_used, 0, sizeof(stv_sprite_priorities_used));
6714
6687
                memset(stv_sprite_priorities_in_fb_line, 0, sizeof(stv_sprite_priorities_in_fb_line));
6866
6839
        fp=fopen("68k.dmp", "w+b");
6867
6840
        if (fp)
6868
6841
        {
6869
 
                fwrite(machine.region(REGION_CPU3)->base(), 0x100000, 1, fp);
 
6842
                fwrite(machine.root_device().memregion(REGION_CPU3)->base(), 0x100000, 1, fp);
6870
6843
                fclose(fp);
6871
6844
        }
6872
6845
}