Previous 15994 Revisions Next

r5525 Saturday 29th August, 2009 at 12:31:42 UTC by Angelo Salese
[X1]: Made some video-related clean-ups
[src/mess/drivers]x1.c

src/mess/drivers/x1.c
r5524r5525
157157   gfx_bitmap_ram = auto_alloc_array(machine, UINT8, 0xc000);
158158}
159159
160static VIDEO_UPDATE( x1 )
160static void draw_fgtilemap(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int w,int pri)
161161{
162   int y,x,w;
162   int y,x;
163163
164   w = (video_screen_get_width(screen) < 640) ? 1 : 2;
165
166   bitmap_fill(bitmap, cliprect, screen->machine->pens[0x100]);
167
168164   for (y=0;y<25;y++)
169165   {
170166      for (x=0;x<40*w;x++)
r5524r5525
178174
179175         if(pcg_bank) { region+= 4; }
180176
181         if(color & 0x8) continue;
182         if(tile == 0) continue;
177         if(((color & 0x8)>>3) != pri) continue;
178         if(tile == 0) continue; //correct?
183179
184         drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[region],tile,color,0,0,(x/(width+1))*8*(width+1),(y/(height+1))*8*(height+1));
180         drawgfx_opaque(bitmap,cliprect,machine->gfx[region],tile,color,0,0,(x/(width+1))*8*(width+1),(y/(height+1))*8*(height+1));
185181      }
186182   }
183}
187184
188   {
189      int count,xi,yi;
190      int pen_r,pen_g,pen_b,color;
191      int yi_size;
185static void draw_gfxbitmap(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int w)
186{
187   int count,xi,yi,x,y;
188   int pen_r,pen_g,pen_b,color;
189   int yi_size;
192190
193      count = 0;
191   count = 0;
194192
195      yi_size = (w == 1) ? 16 : 8;
193   yi_size = (w == 1) ? 16 : 8;
196194
197      for(yi=0;yi<yi_size;yi++)
195   for(yi=0;yi<yi_size;yi++)
196   {
197      for(y=0;y<200;y+=8)
198198      {
199         for(y=0;y<200;y+=8)
199         for(x=0;x<(320*w);x+=8)
200200         {
201            for(x=0;x<(320*w);x+=8)
201            for(xi=0;xi<8;xi++)
202202            {
203               for(xi=0;xi<8;xi++)
204               {
205                  pen_r = (gfx_bitmap_ram[count+0x4000]>>(7-xi)) & 1;
206                  pen_g = (gfx_bitmap_ram[count+0x8000]>>(7-xi)) & 1;
207                  pen_b = (gfx_bitmap_ram[count+0x0000]>>(7-xi)) & 1;
203               pen_b = (gfx_bitmap_ram[count+0x0000]>>(7-xi)) & 1;
204               pen_r = (gfx_bitmap_ram[count+0x4000]>>(7-xi)) & 1;
205               pen_g = (gfx_bitmap_ram[count+0x8000]>>(7-xi)) & 1;
208206
209                  color = pen_r<<1 | pen_g<<2 | pen_b<<0;
207               color = pen_g<<2 | pen_r<<1 | pen_b<<0;
210208
211                  if(color == 0)
212                     continue;
209               if(color == 0)
210                  continue;
213211
214                  if(w == 1)
215                  {
216                     if(yi & 1)
217                        continue;
218
219                     if((x+xi)<=video_screen_get_visible_area(screen)->max_x && ((y)+0)<video_screen_get_visible_area(screen)->max_y)
220                        *BITMAP_ADDR16(bitmap, y+(yi >> 1), x+xi) = screen->machine->pens[color+0x100];
221                  }
222                  else
223                  {
224                     if((x+xi)<=video_screen_get_visible_area(screen)->max_x && ((y)+0)<video_screen_get_visible_area(screen)->max_y)
225                        *BITMAP_ADDR16(bitmap, y+yi, x+xi) = screen->machine->pens[color+0x100];
226                  }
212               if(w == 1)
213               {
214                  if(yi & 1)
215                     continue;
216                  if((x+xi)<=video_screen_get_visible_area(machine->primary_screen)->max_x && (y+(yi >> 1))<video_screen_get_visible_area(machine->primary_screen)->max_y)
217                     *BITMAP_ADDR16(bitmap, y+(yi >> 1), x+xi) = machine->pens[color+0x100];
227218               }
228               count++;
219               else
220               {
221                  if((x+xi)<=video_screen_get_visible_area(machine->primary_screen)->max_x && (y+yi)<video_screen_get_visible_area(machine->primary_screen)->max_y)
222                     *BITMAP_ADDR16(bitmap, y+yi, x+xi) = machine->pens[color+0x100];
223               }
229224            }
225            count++;
230226         }
231         count+= (w == 2) ? 48 : 24;
232227      }
228      count+= (w == 2) ? 48 : 24;
233229   }
230}
234231
235   for (y=0;y<25;y++)
236   {
237      for (x=0;x<40*w;x++)
238      {
239         int tile = videoram[x+(y*40*w)];
240         int color = colorram[x+(y*40*w)] & 0x1f;
241         int width = (colorram[x+(y*40*w)] & 0x80)>>7;
242         int height = (colorram[x+(y*40*w)] & 0x40)>>6;
243         int pcg_bank = (colorram[x+(y*40*w)] & 0x20)>>4;
244         int region = (width+(height<<1)) & 3;
232static VIDEO_UPDATE( x1 )
233{
234   int w;
245235
246         if(pcg_bank) { region+= 4; }
236   w = (video_screen_get_width(screen) < 640) ? 1 : 2;
247237
248         if(!(color & 0x8)) continue;
238   bitmap_fill(bitmap, cliprect, screen->machine->pens[0x100]);
249239
250         drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[region],tile,color,0,0,(x/(width+1))*8*(width+1),(y/(height+1))*8*(height+1));
251      }
252   }
240   draw_fgtilemap(screen->machine,bitmap,cliprect,w,0);
241   draw_gfxbitmap(screen->machine,bitmap,cliprect,w);
242   draw_fgtilemap(screen->machine,bitmap,cliprect,w,1);
243
253244   return 0;
254245}
255246
r5524r5525
717708
718709   for (i = 0; i < 0x20; i++)
719710   {
720      rgb_t color;
711      UINT8 r,g,b;
721712
722      if(i >= 0x10)
713      if(i & 0x01)
723714      {
724         if (i & 0x01)
725            color = RGB_WHITE;
726         else
727            color = MAKE_RGB(pal1bit(i >> 3), pal1bit(i >> 2), pal1bit(i >> 1));
728
729         palette_set_color(machine, 0x2f-i, color);
715         r = ((i >> 3) & 1) ? 0xff : 0x00;
716         g = ((i >> 2) & 1) ? 0xff : 0x00;
717         b = ((i >> 1) & 1) ? 0xff : 0x00;
730718      }
731      else
732      {
733         if (i & 0x01)
734            color = MAKE_RGB(pal1bit(i >> 3), pal1bit(i >> 2), pal1bit(i >> 1));
735         else
736            color = RGB_BLACK;
719      else { r = g = b = 0x00; }
737720
738         palette_set_color(machine, i, color);
739      }
721      if(i & 0x10) { r^=0xff; g^=0xff; b^=0xff; }
722
723      palette_set_color_rgb(machine, i, r,g,b);
740724   }
741725
742726   /* TODO: fix this */
r5524r5525
11411125   MDRV_PALETTE_LENGTH(0x300)
11421126   MDRV_PALETTE_INIT(x1)
11431127
1144   MDRV_MC6845_ADD("crtc", MC6845, XTAL_4MHz/5, mc6845_intf)   /* unknown type and clock / divider, hand tuned to get ~60 fps */
1128   MDRV_MC6845_ADD("crtc", MC6845, XTAL_3_579545MHz/4, mc6845_intf)   /* unknown type and clock / divider, hand tuned to get ~60 fps */
11451129
11461130   MDRV_GFXDECODE(x1)
11471131

Previous 15994 Revisions Next


© 1998-2018 The MESS Team