src/mame/video/stvvdp2.c
| r14371 | r14372 | |
| 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); |
| r14371 | r14372 | |
| 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( |
| r14371 | r14372 | |
| 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; |
| r14371 | r14372 | |
| 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 | |
| r14371 | r14372 | |
| 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; |
| r14371 | r14372 | |
| 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; |
| r14371 | r14372 | |
| 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; |
| r14371 | r14372 | |
| 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 | } |
| r14371 | r14372 | |
| 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 | } |
| r14371 | r14372 | |
| 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 | } |
| r14371 | r14372 | |
| 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 | } |
| r14371 | r14372 | |
| 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 | } |
| r14371 | r14372 | |
| 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 | { |
| r14371 | r14372 | |
| 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); |
| r14371 | r14372 | |
| 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 | { |
| r14371 | r14372 | |
| 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); |
| r14371 | r14372 | |
| 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); |
| r14371 | r14372 | |
| 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); |
| r14371 | r14372 | |
| 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); |
| r14371 | r14372 | |
| 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); |
| r14371 | r14372 | |
| 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); |
| r14371 | r14372 | |
| 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 | |
| r14371 | r14372 | |
| 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); |
| r14371 | r14372 | |
| 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; |
| r14371 | r14372 | |
| 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 ); |
| r14371 | r14372 | |
| 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 |
| r14371 | r14372 | |
| 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 | } |
| r14371 | r14372 | |
| 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 ); |
| r14371 | r14372 | |
| 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 |
| r14371 | r14372 | |
| 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 ) |
| r14371 | r14372 | |
| 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 ); |
| r14371 | r14372 | |
| 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 |
| r14371 | r14372 | |
| 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 ) |
| r14371 | r14372 | |
| 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 | |
| r14371 | r14372 | |
| 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)); |
src/mame/drivers/coolridr.c
| r14371 | r14372 | |
| 257 | 257 | public: |
| 258 | 258 | coolridr_state(const machine_config &mconfig, device_type type, const char *tag) |
| 259 | 259 | : driver_device(mconfig, type, tag), |
| 260 | m_textBytesToWrite(0x00), |
| 261 | m_blitterSerialCount(0x00), |
| 262 | m_blitterMode(0x00), |
| 263 | m_textOffset(0x0000), |
| 264 | m_colorNumber(0x00000000), |
| 265 | m_vCellCount(0x0000), |
| 266 | m_hCellCount(0x0000), |
| 267 | m_vPosition(0x0000), |
| 268 | m_hPosition(0x0000), |
| 260 | 269 | m_maincpu(*this, "maincpu"), |
| 261 | 270 | m_subcpu(*this,"sub"), |
| 262 | 271 | m_soundcpu(*this,"soundcpu") |
| r14371 | r14372 | |
| 273 | 282 | UINT32 m_test_offs; |
| 274 | 283 | int m_color; |
| 275 | 284 | UINT8 m_vblank; |
| 276 | | UINT16 m_cmd; |
| 277 | | UINT16 m_param; |
| 278 | | UINT32 m_dst_addr; |
| 279 | | UINT32 m_txt_buff[0x10]; |
| 280 | | UINT32 m_attr_buff[0x10]; |
| 281 | | UINT8 m_txt_index; |
| 282 | | UINT8 m_attr_index; |
| 283 | 285 | |
| 286 | // Blitter state |
| 287 | UINT16 m_textBytesToWrite; |
| 288 | INT16 m_blitterSerialCount; |
| 289 | UINT8 m_blitterMode; |
| 290 | UINT16 m_textOffset; |
| 291 | UINT32 m_colorNumber; |
| 292 | UINT16 m_vCellCount; |
| 293 | UINT16 m_hCellCount; |
| 294 | UINT16 m_vPosition; |
| 295 | UINT16 m_hPosition; |
| 296 | |
| 284 | 297 | required_device<cpu_device> m_maincpu; |
| 285 | 298 | required_device<cpu_device> m_subcpu; |
| 286 | 299 | required_device<cpu_device> m_soundcpu; |
| r14371 | r14372 | |
| 402 | 415 | COMBINE_DATA(&h1_ioga[offset]); |
| 403 | 416 | } |
| 404 | 417 | #endif |
| 405 | | /* |
| 406 | | CMD = 03f4 PARAM = 0230 | ? |
| 407 | | CMD = ac90 PARAM = 0001 DATA = 00000000 |
| 408 | | CMD = ac90 PARAM = 0001 DATA = 00000059 |
| 409 | | CMD = ac90 PARAM = 0001 DATA = 00000000 |
| 410 | | CMD = ac90 PARAM = 0001 DATA = 00000000 |
| 411 | | CMD = ac90 PARAM = 0001 DATA = 07000000 |
| 412 | | CMD = ac90 PARAM = 0001 DATA = 00010000 |
| 413 | | CMD = ac90 PARAM = 0001 DATA = 00010001 |
| 414 | | CMD = ac90 PARAM = 0001 DATA = 00000000 |
| 415 | | CMD = ac90 PARAM = 0001 DATA = 00400040 |
| 416 | | CMD = ac90 PARAM = 0001 DATA = 01200050 |
| 417 | | CMD = ac90 PARAM = 0001 DATA = 00000000 |
| 418 | | CMD = ac90 PARAM = 0001 DATA = 03f40230 |
| 419 | 418 | |
| 420 | | CMD = 03f4 PARAM = 0170 | ? |
| 421 | | CMD = ac90 PARAM = 0001 DATA = 00000000 |
| 422 | | CMD = ac90 PARAM = 0001 DATA = 00000059 |
| 423 | | CMD = ac90 PARAM = 0001 DATA = 00000000 |
| 424 | | CMD = ac90 PARAM = 0001 DATA = 00000000 |
| 425 | | CMD = ac90 PARAM = 0001 DATA = 07000000 |
| 426 | | CMD = ac90 PARAM = 0001 DATA = 00010000 |
| 427 | | CMD = ac90 PARAM = 0001 DATA = 00010001 |
| 428 | | CMD = ac90 PARAM = 0001 DATA = 00000000 |
| 429 | | CMD = ac90 PARAM = 0001 DATA = 00400040 |
| 430 | | CMD = ac90 PARAM = 0001 DATA = 00800050 |
| 431 | | CMD = ac90 PARAM = 0001 DATA = 00000000 |
| 432 | | CMD = ac90 PARAM = 0001 DATA = 03f40170 |
| 433 | | */ |
| 434 | | /* this looks like an exotic I/O-based tilemap / sprite blitter, very unusual from Sega... */ |
| 419 | |
| 420 | /* This is a RLE-based sprite blitter (US Patent #6,141,122), very unusual from Sega... */ |
| 435 | 421 | static WRITE32_HANDLER( sysh1_txt_blit_w ) |
| 436 | 422 | { |
| 437 | 423 | coolridr_state *state = space->machine().driver_data<coolridr_state>(); |
| r14371 | r14372 | |
| 440 | 426 | |
| 441 | 427 | switch(offset) |
| 442 | 428 | { |
| 443 | | case 0x10/4: //state->m_cmd + state->m_param? |
| 444 | | state->m_cmd = (state->m_sysh1_txt_blit[offset] & 0xffff0000) >> 16; |
| 445 | | state->m_param = (state->m_sysh1_txt_blit[offset] & 0x0000ffff) >> 0; |
| 446 | | state->m_dst_addr = 0x3f40000; |
| 447 | | state->m_txt_index = 0; |
| 448 | | state->m_attr_index = 0; |
| 429 | // The mode register |
| 430 | case 0x04: |
| 431 | { |
| 432 | state->m_blitterMode = (data & 0x00ff0000) >> 16; |
| 433 | |
| 434 | if (state->m_blitterMode == 0xf4) |
| 435 | { |
| 436 | // Some sort of addressing state. |
| 437 | // In the case of text, simply writes 4 characters per 32-bit word. |
| 438 | // These values may be loaded into RAM somewhere as they are written. |
| 439 | // The number of characters is determined by the upper-most 8 bits. |
| 440 | state->m_textBytesToWrite = (data & 0xff000000) >> 24; |
| 441 | state->m_textOffset = (data & 0x0000ffff); |
| 442 | state->m_blitterSerialCount = 0; |
| 443 | } |
| 444 | else if (state->m_blitterMode == 0x30 || state->m_blitterMode == 0x90) |
| 445 | { |
| 446 | // The blitter function(s). |
| 447 | // After this is set a fixed count of 11 32-bit words are sent to the data register. |
| 448 | // The lower word always seems to be 0x0001 and the upper byte always 0xac. |
| 449 | state->m_blitterSerialCount = 0; |
| 450 | } |
| 451 | else if (state->m_blitterMode == 0x10) |
| 452 | { |
| 453 | // Could be a full clear of VRAM? |
| 454 | for(UINT32 vramAddr = 0x3f40000; vramAddr < 0x3f4ffff; vramAddr+=4) |
| 455 | space->write_dword(vramAddr, 0x00000000); |
| 456 | } |
| 449 | 457 | break; |
| 450 | | case 0x14/4: //data |
| 451 | | /* "THIS MACHINE IS STAND-ALONE." / disclaimer written with this CMD */ |
| 452 | | if((state->m_cmd & 0xff) == 0xf4) |
| 458 | } |
| 459 | |
| 460 | // The data register |
| 461 | case 0x05: |
| 462 | { |
| 463 | if (state->m_blitterMode == 0xf4) |
| 453 | 464 | { |
| 454 | | state->m_txt_buff[state->m_txt_index++] = data; |
| 465 | // Uploads a series of bytes that index into the encoded sprite table |
| 466 | const size_t memOffset = 0x03f40000 + state->m_textOffset + state->m_blitterSerialCount; |
| 467 | space->write_dword(memOffset, data); |
| 468 | state->m_blitterSerialCount += 0x04; |
| 455 | 469 | |
| 456 | | //printf("CMD = %04x PARAM = %04x | %c%c%c%c\n",state->m_cmd,state->m_param,(data >> 24) & 0xff,(data >> 16) & 0xff,(data >> 8) & 0xff,(data >> 0) & 0xff); |
| 470 | // DEBUG: Uncomment to see the ASCII strings as they are being blitted |
| 471 | //if (state->m_blitterSerialCount >= state->m_textBytesToWrite) |
| 472 | //{ |
| 473 | // for (int i = 0; i < state->m_textBytesToWrite+1; i++) |
| 474 | // printf("%c", space->read_byte(0x03f40000 + state->m_textOffset + i)); |
| 475 | // printf("\n"); |
| 476 | //} |
| 457 | 477 | } |
| 458 | | else if((state->m_cmd & 0xff) == 0x90 || (state->m_cmd & 0xff) == 0x30) |
| 478 | else if (state->m_blitterMode == 0x30 || state->m_blitterMode == 0x90) |
| 459 | 479 | { |
| 460 | | state->m_attr_buff[state->m_attr_index++] = data; |
| 480 | // Serialized 32-bit words in order of appearance: |
| 481 | // 0: 00000000 - totally unknown : always seems to be zero |
| 482 | // 1: xxxxxxxx - "Color Number" (all bits or just lower 16/8?) |
| 483 | // 2: 00000000 - unknown : OT flag? (transparency) |
| 484 | // 3: 00000000 - unknown : RF flag? (90 degree rotation) |
| 485 | // 4: 07000000 - unknown : VF flag? (vertically flipped) |
| 486 | // 5: 00010000 - unknown : HF flag? (horizontally flipped) |
| 487 | // 6: vvvv---- - "Vertical Cell Count" |
| 488 | // 6: ----hhhh - "Horizontal Cell Count" |
| 489 | // 7: 00000000 - unknown : "Vertical|Horizontal Zoom Centers"? |
| 490 | // 8: 00400040 - unknown : "Vertical|Horizontal Zoom Ratios"? |
| 491 | // 9: xxxx---- - "Display Vertical Position" |
| 492 | // 9: ----yyyy - "Display Horizontal Position" |
| 493 | // 10: 00000000 - unknown : always seems to be zero |
| 494 | // 11: ........ - complex - likely an address into bytes uploaded by mode 0xf4 |
| 495 | // (See ifdef'ed out code below for a closer examination) |
| 461 | 496 | |
| 462 | | if(state->m_attr_index == 0xa) |
| 497 | // Serialized counts |
| 498 | if (state->m_blitterSerialCount == 1) |
| 463 | 499 | { |
| 464 | | UINT16 x,y; |
| 465 | | |
| 466 | | y = (state->m_attr_buff[9] & 0x01f00000) >> 20; |
| 467 | | x = (state->m_attr_buff[9] & 0x1f0) >> 4; |
| 468 | | state->m_dst_addr = 0x3f40000 | y*0x40 | x; |
| 469 | | |
| 470 | | { |
| 471 | | int x2,y2; |
| 472 | | const gfx_element *gfx = space->machine().gfx[1]; |
| 473 | | rectangle clip; |
| 474 | | |
| 475 | | y2 = (state->m_attr_buff[9] & 0x01ff0000) >> 16; |
| 476 | | x2 = (state->m_attr_buff[9] & 0x000001ff); |
| 477 | | clip = state->m_temp_bitmap_sprites.cliprect(); |
| 478 | | |
| 479 | | drawgfx_opaque(state->m_temp_bitmap_sprites,clip,gfx,1,1,0,0,x2,y2); |
| 480 | | } |
| 500 | state->m_colorNumber = (data & 0x000000ff); // Probably more bits |
| 481 | 501 | } |
| 482 | | if(state->m_attr_index == 0xc) |
| 502 | else if (state->m_blitterSerialCount == 6) |
| 483 | 503 | { |
| 484 | | UINT8 size; |
| 504 | state->m_vCellCount = (data & 0xffff0000) >> 16; |
| 505 | state->m_hCellCount = (data & 0x0000ffff); |
| 506 | } |
| 507 | else if (state->m_blitterSerialCount == 9) |
| 508 | { |
| 509 | state->m_vPosition = (data & 0xffff0000) >> 16; |
| 510 | state->m_hPosition = (data & 0x0000ffff); |
| 511 | } |
| 512 | else if (state->m_blitterSerialCount == 11) |
| 513 | { |
| 514 | const UINT32 memOffset = data; |
| 515 | |
| 516 | // Splat some sprites |
| 517 | for (int h = 0; h < state->m_hCellCount; h++) |
| 518 | { |
| 519 | for (int v = 0; v < state->m_vCellCount; v++) |
| 520 | { |
| 521 | const int pixelOffsetX = state->m_hPosition + (h*16); |
| 522 | const int pixelOffsetY = state->m_vPosition + (v*16); |
| 523 | |
| 524 | // It's unknown if it's row-major or column-major |
| 525 | // TODO: Study the CRT test and "Cool Riders" logo for clues. |
| 526 | UINT8 spriteNumber = space->read_byte(memOffset + h + (v*h)); |
| 527 | |
| 528 | // DEBUG: For demo purposes, skip spaces and NULL characters |
| 529 | if (spriteNumber == 0x20 || spriteNumber == 0x00) |
| 530 | continue; |
| 485 | 531 | |
| 486 | | size = (state->m_attr_buff[6] / 4)+1; |
| 487 | | for(state->m_txt_index = 0;state->m_txt_index < size; state->m_txt_index++) |
| 488 | | { |
| 489 | | space->write_dword((state->m_dst_addr),state->m_txt_buff[state->m_txt_index]); |
| 490 | | state->m_dst_addr+=4; |
| 532 | // DEBUG: Draw 16x16 block |
| 533 | for (int x = 1; x < 15; x++) |
| 534 | { |
| 535 | for (int y = 1; y < 15; y++) |
| 536 | { |
| 537 | UINT32 color; |
| 538 | if (state->m_colorNumber == 0x5b) |
| 539 | color = 0xffff0000; |
| 540 | else if (state->m_colorNumber == 0x5d) |
| 541 | color = 0xff00ff00; |
| 542 | else if (state->m_colorNumber == 0x5e) |
| 543 | color = 0xff0000ff; |
| 544 | else |
| 545 | color = 0xff00ffff; |
| 546 | state->m_temp_bitmap_sprites.pix32(pixelOffsetY+y, pixelOffsetX+x) = color; |
| 547 | } |
| 548 | } |
| 549 | } |
| 491 | 550 | } |
| 492 | 551 | } |
| 552 | |
| 553 | state->m_blitterSerialCount++; |
| 493 | 554 | } |
| 494 | | else if((state->m_cmd & 0xff) == 0x10) |
| 495 | | { |
| 496 | | UINT32 clear_vram; |
| 497 | | for(clear_vram=0x3f40000;clear_vram < 0x3f4ffff;clear_vram+=4) |
| 498 | | space->write_dword((clear_vram),0x00000000); |
| 499 | | } |
| 500 | | //else |
| 501 | | // printf("CMD = %04x PARAM = %04x DATA = %08x\n",state->m_cmd,state->m_param,data); |
| 502 | 555 | break; |
| 556 | } |
| 503 | 557 | } |
| 504 | 558 | } |
| 505 | 559 | |