Previous 15994 Revisions Next

r9029 Friday 3rd September, 2010 at 16:30:54 UTC by Angelo Salese
[MZ2500]: Rewritten plot pixel calls with a custom function
[src/mess/drivers]mz2500.c

src/mess/drivers/mz2500.c
r9028r9029
105105[2] xx-- ---- kanji select
106106*/
107107
108/* helper function, to draw stuff without getting crazy with height / width conditions :) */
109static void mz2500_draw_pixel(running_machine *machine, bitmap_t *bitmap,int x,int y,UINT16    pen,UINT8 width,UINT8 height)
110{
111   if(width && height)
112   {
113      *BITMAP_ADDR16(bitmap, y*2+0, x*2+0) = machine->pens[pen];
114      *BITMAP_ADDR16(bitmap, y*2+0, x*2+1) = machine->pens[pen];
115      *BITMAP_ADDR16(bitmap, y*2+1, x*2+0) = machine->pens[pen];
116      *BITMAP_ADDR16(bitmap, y*2+1, x*2+1) = machine->pens[pen];
117   }
118   else if(width)
119   {
120      *BITMAP_ADDR16(bitmap, y, x*2+0) = machine->pens[pen];
121      *BITMAP_ADDR16(bitmap, y, x*2+1) = machine->pens[pen];
122   }
123   else if(height)
124   {
125      *BITMAP_ADDR16(bitmap, y*2+0, x) = machine->pens[pen];
126      *BITMAP_ADDR16(bitmap, y*2+1, x) = machine->pens[pen];
127   }
128   else
129      *BITMAP_ADDR16(bitmap, y, x) = machine->pens[pen];
130}
131
108132static void draw_80x25(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,UINT16 map_addr)
109133{
110134   UINT8 *vram = memory_region(machine, "maincpu");
r9028r9029
175199               if(pen)
176200               {
177201                  if((y*8+yi-s_y) >= 0 && (y*8+yi-s_y) < 200*y_step)
178                     *BITMAP_ADDR16(bitmap, (y*8+yi-s_y), x*8+xi) = machine->pens[pen+(pal_select ? 0x000 : 0x208)];
202                     mz2500_draw_pixel(machine,bitmap,x*8+xi,y*8+yi-s_y,pen+(pal_select ? 0x000 : 0x208),0,0);
179203               }
180204            }
181205         }
182            //drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[gfx_num],tile,color,0,0,x*8,(y)*8);
183206
184207         count++;
185208         count&=0x7ff;
r9028r9029
258281                  if(wid_40) // 640 x 200 with 40 x 25, double x size
259282                  {
260283                     if((y*8+yi-s_y) >= 0 && (y*8+yi-s_y) < 200*y_step)
261                     {
262                        *BITMAP_ADDR16(bitmap, (y*8+yi-s_y), (x*8+xi)*2+0) = machine->pens[pen+(pal_select ? 0x000 : 0x208)];
263                        *BITMAP_ADDR16(bitmap, (y*8+yi-s_y), (x*8+xi)*2+1) = machine->pens[pen+(pal_select ? 0x000 : 0x208)];
264                     }
284                        mz2500_draw_pixel(machine,bitmap,x*8+xi,y*8+yi-s_y,pen+(pal_select ? 0x000 : 0x208),1,0);
265285                  }
266286                  else
267287                  {
268288                     if((y*8+yi-s_y) >= 0 && (y*8+yi-s_y) < 200*y_step)
269                        *BITMAP_ADDR16(bitmap, (y*8+yi-s_y), x*8+xi) = machine->pens[pen+(pal_select ? 0x000 : 0x208)];
289                        mz2500_draw_pixel(machine,bitmap,x*8+xi,y*8+yi-s_y,pen+(pal_select ? 0x000 : 0x208),0,0);
270290                  }
271291               }
272292            }
r9028r9029
346366
347367            {
348368               //if(pri == ((clut256[pen] & 0x100) >> 8))
349                  *BITMAP_ADDR16(bitmap, res_y, res_x) = machine->pens[pen];
369               mz2500_draw_pixel(machine,bitmap,res_x,res_y,pen,0,0);
350370            }
351371         }
352372         count++;
r9028r9029
401421            if(cg_interlace == 2)
402422            {
403423               if(pri == ((clut16[pen] & 0x10) >> 4))
404               {
405                  *BITMAP_ADDR16(bitmap, res_y*2+0, res_x) = machine->pens[(clut16[pen] & 0x0f)+0x200];
406                  *BITMAP_ADDR16(bitmap, res_y*2+1, res_x) = machine->pens[(clut16[pen] & 0x0f)+0x200];
407               }
424                  mz2500_draw_pixel(machine,bitmap,res_x,res_y,(clut16[pen] & 0x0f)+0x200,0,1);
425
408426            }
409427            else
410428            {
411429               if(pri == ((clut16[pen] & 0x10) >> 4))
412                  *BITMAP_ADDR16(bitmap, res_y, res_x) = machine->pens[(clut16[pen] & 0x0f)+0x200];
430                  mz2500_draw_pixel(machine,bitmap,res_x,res_y,(clut16[pen] & 0x0f)+0x200,0,0);
413431            }
414432         }
415433         count++;
r9028r9029
461479            if(cg_interlace == 2)
462480            {
463481               if(pri == ((clut256[pen] & 0x100) >> 8))
464               {
465                  *BITMAP_ADDR16(bitmap, res_y*2+0, res_x) = machine->pens[(clut256[pen] & 0xff)+0x100];
466                  *BITMAP_ADDR16(bitmap, res_y*2+1, res_x) = machine->pens[(clut256[pen] & 0xff)+0x100];
467               }
482                  mz2500_draw_pixel(machine,bitmap,res_x,res_y,(clut256[pen] & 0xff)+0x100,0,1);
468483            }
469484            else
470485            {
471486               if(pri == ((clut256[pen] & 0x100) >> 8))
472                  *BITMAP_ADDR16(bitmap, res_y, res_x) = machine->pens[(clut256[pen] & 0xff)+0x100];
487                  mz2500_draw_pixel(machine,bitmap,res_x,res_y,(clut256[pen] & 0xff)+0x100,0,0);
473488            }
474489         }
475490         count++;

Previous 15994 Revisions Next


© 1998-2018 The MESS Team