Previous 15994 Revisions Next

r9031 Saturday 4th September, 2010 at 11:05:55 UTC by Angelo Salese
[MZ-2500]: Misc drawing related clean-ups
[src/mess/drivers]mz2500.c

src/mess/drivers/mz2500.c
r9030r9031
199199               if(pen)
200200               {
201201                  if((y*8+yi-s_y) >= 0 && (y*8+yi-s_y) < 200*y_step)
202                     mz2500_draw_pixel(machine,bitmap,x*8+xi,y*8+yi-s_y,pen+(pal_select ? 0x000 : 0x208),0,0);
202                     mz2500_draw_pixel(machine,bitmap,x*8+xi,y*8+yi-s_y,pen+(pal_select ? 0x00 : 0x18),0,0);
203203               }
204204            }
205205         }
r9030r9031
281281                  if(wid_40) // 640 x 200 with 40 x 25, double x size
282282                  {
283283                     if((y*8+yi-s_y) >= 0 && (y*8+yi-s_y) < 200*y_step)
284                        mz2500_draw_pixel(machine,bitmap,x*8+xi,y*8+yi-s_y,pen+(pal_select ? 0x000 : 0x208),1,0);
284                        mz2500_draw_pixel(machine,bitmap,x*8+xi,y*8+yi-s_y,pen+(pal_select ? 0x000 : 0x18),1,0);
285285                  }
286286                  else
287287                  {
288288                     if((y*8+yi-s_y) >= 0 && (y*8+yi-s_y) < 200*y_step)
289                        mz2500_draw_pixel(machine,bitmap,x*8+xi,y*8+yi-s_y,pen+(pal_select ? 0x000 : 0x208),0,0);
289                        mz2500_draw_pixel(machine,bitmap,x*8+xi,y*8+yi-s_y,pen+(pal_select ? 0x000 : 0x18),0,0);
290290                  }
291291               }
292292            }
r9030r9031
299299   }
300300}
301301
302static void draw_tv_screen(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
303{
304   UINT16 base_addr;
305
306   base_addr = text_reg[1] | ((text_reg[2] & 0x7) << 8);
307
308//  popmessage("%02x",text_reg[9]);
309
310   if(text_col_size)
311      draw_80x25(machine,bitmap,cliprect,base_addr);
312   else
313   {
314      int tv_mode;
315
316      tv_mode = text_reg[0] >> 2;
317
318      switch(tv_mode & 3)
319      {
320//          case 0: mixed 6bpp mode
321         case 1:
322            draw_40x25(machine,bitmap,cliprect,0,base_addr);
323            break;
324         case 2:
325            draw_40x25(machine,bitmap,cliprect,1,base_addr);
326            break;
327         case 3:
328            draw_40x25(machine,bitmap,cliprect,0,base_addr);
329            draw_40x25(machine,bitmap,cliprect,1,base_addr);
330            break;
331         //default: popmessage("%02x %02x %02x",tv_mode & 3,text_reg[1],text_reg[2]); break;
332      }
333   }
334}
335
336302static void draw_cg4_screen(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int pri)
337303{
338304   static UINT32 count;
r9030r9031
421387            if(cg_interlace == 2)
422388            {
423389               if(pri == ((clut16[pen] & 0x10) >> 4))
424                  mz2500_draw_pixel(machine,bitmap,res_x,res_y,(clut16[pen] & 0x0f)+0x200,0,1);
390                  mz2500_draw_pixel(machine,bitmap,res_x,res_y,(clut16[pen] & 0x0f)+0x10,0,1);
425391
426392            }
427393            else
428394            {
429395               if(pri == ((clut16[pen] & 0x10) >> 4))
430                  mz2500_draw_pixel(machine,bitmap,res_x,res_y,(clut16[pen] & 0x0f)+0x200,0,0);
396                  mz2500_draw_pixel(machine,bitmap,res_x,res_y,(clut16[pen] & 0x0f)+0x10,0,0);
431397            }
432398         }
433399         count++;
r9030r9031
492458   }
493459}
494460
461static void draw_tv_screen(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
462{
463   UINT16 base_addr;
464
465   base_addr = text_reg[1] | ((text_reg[2] & 0x7) << 8);
466
467//  popmessage("%02x",text_reg[9]);
468
469   if(text_col_size)
470      draw_80x25(machine,bitmap,cliprect,base_addr);
471   else
472   {
473      int tv_mode;
474
475      tv_mode = text_reg[0] >> 2;
476
477      switch(tv_mode & 3)
478      {
479//          case 0: mixed 6bpp mode
480         case 1:
481            draw_40x25(machine,bitmap,cliprect,0,base_addr);
482            break;
483         case 2:
484            draw_40x25(machine,bitmap,cliprect,1,base_addr);
485            break;
486         case 3:
487            draw_40x25(machine,bitmap,cliprect,0,base_addr);
488            draw_40x25(machine,bitmap,cliprect,1,base_addr);
489            break;
490         //default: popmessage("%02x %02x %02x",tv_mode & 3,text_reg[1],text_reg[2]); break;
491      }
492   }
493}
494
495495static void draw_cg_screen(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int pri)
496496{
497497   switch(cg_reg[0x0e])
r9030r9031
525525{
526526   bitmap_fill(bitmap, cliprect, screen->machine->pens[0]); //TODO: correct?
527527
528   //popmessage("%02x",cg_mask);
529
530528   draw_cg_screen(screen->machine,bitmap,cliprect,0);
531529   draw_tv_screen(screen->machine,bitmap,cliprect);
532530   draw_cg_screen(screen->machine,bitmap,cliprect,1);
r9030r9031
907905
908906               palette_set_color_rgb(space->machine, i+0x100,pal3bit(r),pal3bit(g),pal3bit(b));
909907            }
910
911908         }
912909         if(text_reg_index >= 0x80 && text_reg_index <= 0x8f) //Bitmap 16 clut registers
913910         {
r9030r9031
10471044   //printf("%02x\n",data);
10481045}
10491046
1050/* sets first 16 color entries of the 4096 palette bank */
1047/* sets 16 color entries out of 4096 possible combinations */
10511048static WRITE8_HANDLER( palette4096_io_w )
10521049{
10531050   static UINT8 r[16],g[16],b[16];
r9030r9031
10651062      b[pal_entry] = data & 0x0f;
10661063   }
10671064
1068   palette_set_color_rgb(space->machine, pal_entry+0x200,pal4bit(r[pal_entry]),pal4bit(g[pal_entry]),pal4bit(b[pal_entry]));
1065   palette_set_color_rgb(space->machine, pal_entry+0x10,pal4bit(r[pal_entry]),pal4bit(g[pal_entry]),pal4bit(b[pal_entry]));
10691066}
10701067
10711068static READ8_DEVICE_HANDLER( mz2500_wd17xx_r )
r9030r9031
18041801{
18051802   int i;
18061803
1807   /*set up 16 colors (TODO) */
1804   for(i=0;i<0x200;i++)
1805      palette_set_color_rgb(machine, i,pal1bit(0),pal1bit(0),pal1bit(0));
1806
1807   /* set up 8 colors (PCG) */
18081808   for(i=0;i<8;i++)
18091809      palette_set_color_rgb(machine, i,pal1bit((i & 2)>>1),pal1bit((i & 4)>>2),pal1bit((i & 1)>>0));
18101810
1811   /* set up 256 colors (TODO) */
1811   /* set up 16 colors (PCG / CG) */
18121812
1813   /* set up 4096 colors */
1814   // ...
1813   /* set up 256 colors (CG) */
1814   {
1815      int r,g,b;
1816
1817      for(i = 0;i < 0x100;i++)
1818      {
1819         int bit0,bit1,bit2;
1820
1821         bit0 = pal_256_param(i,0) ? 1 : 0;
1822         bit1 = i & 0x01 ? 2 : 0;
1823         bit2 = i & 0x10 ? 4 : 0;
1824         b = bit0|bit1|bit2;
1825         bit0 = pal_256_param(i,0) ? 1 : 0;
1826         bit1 = i & 0x02 ? 2 : 0;
1827         bit2 = i & 0x20 ? 4 : 0;
1828         r = bit0|bit1|bit2;
1829         bit0 = pal_256_param(i,0) ? 1 : 0;
1830         bit1 = i & 0x04 ? 2 : 0;
1831         bit2 = i & 0x40 ? 4 : 0;
1832         g = bit0|bit1|bit2;
1833
1834         palette_set_color_rgb(machine, i+0x100,pal3bit(r),pal3bit(g),pal3bit(b));
1835      }
1836   }
18151837}
18161838
18171839/* PIT8253 Interface */
r9030r9031
18771899   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
18781900   //MDRV_SCREEN_RAW_PARAMS(XTAL_17_73447MHz/2, 568, 0, 320, 312, 0, 200)
18791901   MDRV_SCREEN_RAW_PARAMS(XTAL_17_73447MHz, 640+108, 0, 320, 480, 0, 200) //TODO: fix this
1880   MDRV_PALETTE_LENGTH(0x200+4096) // TODO: it needs more than this
1902   MDRV_PALETTE_LENGTH(0x200)
18811903   MDRV_PALETTE_INIT(mz2500)
18821904
18831905   MDRV_GFXDECODE(mz2500)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team