src/mess/drivers/x1.c
| r5584 | r5585 | |
| 168 | 168 | { |
| 169 | 169 | UINT8 gfx_bank; |
| 170 | 170 | UINT8 pcg_mode; |
| 171 | |
| 172 | UINT8 ply; |
| 171 | 173 | UINT8 blackclip; // x1 turbo specific |
| 172 | 174 | }scrn_reg; |
| 173 | 175 | |
| r5584 | r5585 | |
| 187 | 189 | gfx_bitmap_ram = auto_alloc_array(machine, UINT8, 0xc000*2); |
| 188 | 190 | } |
| 189 | 191 | |
| 190 | | static void draw_fgtilemap(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int w,int pri) |
| 192 | static void draw_fgtilemap(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int w) |
| 191 | 193 | { |
| 192 | 194 | int y,x,res_x,res_y; |
| 193 | 195 | int screen_mask; |
| r5584 | r5585 | |
| 205 | 207 | int pcg_bank = (colorram[(x+(y*40*w)+crtc_start_addr) & screen_mask] & 0x20)>>5; |
| 206 | 208 | UINT8 *gfx_data = pcg_bank ? memory_region(machine, "pcg") : memory_region(machine, "cgrom"); |
| 207 | 209 | |
| 208 | | if(((color & 0x8)>>3) != pri) continue; |
| 209 | 210 | /* skip draw if the x/y values are odd and the width/height is active, */ |
| 210 | 211 | /* behaviour confirmed by Black Onyx title screen and the X1Demo */ |
| 211 | 212 | if((x & 1) == 1 && width) continue; |
| r5584 | r5585 | |
| 256 | 257 | } |
| 257 | 258 | } |
| 258 | 259 | |
| 259 | | static void draw_gfxbitmap(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int w,int plane) |
| 260 | static void draw_gfxbitmap(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int w,int plane,int pri) |
| 260 | 261 | { |
| 261 | 262 | int count,xi,yi,x,y; |
| 262 | 263 | int pen_r,pen_g,pen_b,color; |
| 263 | 264 | int yi_size; |
| 265 | int pri_i,pri_mask_val,pri_helper; |
| 264 | 266 | |
| 265 | 267 | count = crtc_start_addr; |
| 266 | 268 | |
| r5584 | r5585 | |
| 280 | 282 | |
| 281 | 283 | color = pen_g<<2 | pen_r<<1 | pen_b<<0; |
| 282 | 284 | |
| 285 | /* Priority mixer calculation (PLY) */ |
| 286 | { |
| 287 | pri_i = 0; |
| 288 | pri_mask_val = 1; |
| 289 | pri_helper = 0; |
| 290 | |
| 291 | while(pri_i < 7 && pri_helper == 0) |
| 292 | { |
| 293 | if((color & 7) == pri_i) |
| 294 | pri_helper = 1; |
| 295 | else |
| 296 | { |
| 297 | pri_i++; |
| 298 | pri_mask_val<<=1; |
| 299 | } |
| 300 | } |
| 301 | } |
| 302 | |
| 303 | if(pri_mask_val & pri) continue; |
| 304 | |
| 283 | 305 | if(color == 0) |
| 284 | 306 | continue; |
| 285 | 307 | |
| r5584 | r5585 | |
| 312 | 334 | |
| 313 | 335 | bitmap_fill(bitmap, cliprect, screen->machine->pens[0x100]); |
| 314 | 336 | |
| 315 | | draw_fgtilemap(screen->machine,bitmap,cliprect,w,0); |
| 316 | | draw_gfxbitmap(screen->machine,bitmap,cliprect,w,0); |
| 337 | draw_gfxbitmap(screen->machine,bitmap,cliprect,w,0,scrn_reg.ply); |
| 338 | draw_fgtilemap(screen->machine,bitmap,cliprect,w); |
| 339 | draw_gfxbitmap(screen->machine,bitmap,cliprect,w,0,scrn_reg.ply^0xff); |
| 317 | 340 | /* Y's uses the following as a normal buffer without anything reasonable to draw */ |
| 318 | 341 | // draw_gfxbitmap(screen->machine,bitmap,cliprect,w,1); |
| 319 | | draw_fgtilemap(screen->machine,bitmap,cliprect,w,1); |
| 320 | 342 | |
| 321 | 343 | return 0; |
| 322 | 344 | } |
| r5584 | r5585 | |
| 792 | 814 | |
| 793 | 815 | static WRITE8_HANDLER( x1_ply_w ) |
| 794 | 816 | { |
| 817 | scrn_reg.ply = data; |
| 795 | 818 | printf("PLY = %02x\n",data); |
| 796 | 819 | } |
| 797 | 820 | |