Previous 15994 Revisions Next

r5585 Friday 4th September, 2009 at 19:19:13 UTC by Angelo Salese
[X1]: Added proper priority mixer emulation (PLY register)
[src/mess/drivers]x1.c

src/mess/drivers/x1.c
r5584r5585
168168{
169169   UINT8 gfx_bank;
170170   UINT8 pcg_mode;
171
172   UINT8 ply;
171173   UINT8 blackclip; // x1 turbo specific
172174}scrn_reg;
173175
r5584r5585
187189   gfx_bitmap_ram = auto_alloc_array(machine, UINT8, 0xc000*2);
188190}
189191
190static void draw_fgtilemap(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int w,int pri)
192static void draw_fgtilemap(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int w)
191193{
192194   int y,x,res_x,res_y;
193195   int screen_mask;
r5584r5585
205207         int pcg_bank = (colorram[(x+(y*40*w)+crtc_start_addr) & screen_mask] & 0x20)>>5;
206208         UINT8 *gfx_data = pcg_bank ? memory_region(machine, "pcg") : memory_region(machine, "cgrom");
207209
208         if(((color & 0x8)>>3) != pri) continue;
209210         /* skip draw if the x/y values are odd and the width/height is active, */
210211         /* behaviour confirmed by Black Onyx title screen and the X1Demo */
211212         if((x & 1) == 1 && width) continue;
r5584r5585
256257   }
257258}
258259
259static void draw_gfxbitmap(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int w,int plane)
260static void draw_gfxbitmap(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int w,int plane,int pri)
260261{
261262   int count,xi,yi,x,y;
262263   int pen_r,pen_g,pen_b,color;
263264   int yi_size;
265   int pri_i,pri_mask_val,pri_helper;
264266
265267   count = crtc_start_addr;
266268
r5584r5585
280282
281283               color =  pen_g<<2 | pen_r<<1 | pen_b<<0;
282284
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
283305               if(color == 0)
284306                  continue;
285307
r5584r5585
312334
313335   bitmap_fill(bitmap, cliprect, screen->machine->pens[0x100]);
314336
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);
317340   /* Y's uses the following as a normal buffer without anything reasonable to draw */
318341//   draw_gfxbitmap(screen->machine,bitmap,cliprect,w,1);
319   draw_fgtilemap(screen->machine,bitmap,cliprect,w,1);
320342
321343   return 0;
322344}
r5584r5585
792814
793815static WRITE8_HANDLER( x1_ply_w )
794816{
817   scrn_reg.ply = data;
795818   printf("PLY = %02x\n",data);
796819}
797820

Previous 15994 Revisions Next


© 1998-2018 The MESS Team