Previous 15994 Revisions Next

r936 Friday 7th September, 2007 at 14:46:31 UTC by Wilbert Pol
[PCE] Added support for b&w mode. (bug #1363)
[src/mess/drivers]pce.c
[src/mess/video]vdc.c

src/mess/video/vdc.c
r935r936
223223{
224224   int i;
225225
226   /* Are we in greyscale mode or in color mode? */
227   int color_base = vdc.vce_control & 0x80 ? 512 : 0;
228
226229    /* our line buffer */
227230    UINT16 *line_buffer = BITMAP_ADDR16( vdc.bmp, line, 0 );
228231   
229232   for ( i = 0; i < VDC_WPF; i++ )
230      line_buffer[i] = Machine->pens[vdc.vce_data[0x100].w];
233      line_buffer[i] = Machine->pens[color_base + vdc.vce_data[0x100].w];
231234
232235}
233236
r935r936
391394      int r = (( i >> 3) & 7) << 5;
392395      int g = (( i >> 6) & 7) << 5;
393396      int b = (( i     ) & 7) << 5;
394      palette_set_color_rgb(Machine, i, r, g, b);
397      int y = ( (  66 * r + 129 * g +  25 * b + 128) >> 8) +  16;
398      palette_set_color_rgb(machine, i, r, g, b);
399      palette_set_color_rgb(machine, 512+i, y, y, y);
395400   }
396401}
397402
r935r936
472477    /* pointer to the name table (Background Attribute Table) in VRAM */
473478    UINT8 *bat = &(vdc.vram[nt_row << (v_width+1)]);
474479
480   /* Are we in greyscale mode or in color mode? */
481   int color_base = vdc.vce_control & 0x80 ? 512 : 0;
482
475483    int b0, b1, b2, b3;
476484    int i0, i1, i2, i3;
477485    int cell_pattern_index;
r935r936
490498
491499      /* First fill line with overscan colour */
492500      for ( i = -86; i < VDC_WPF - 86; i++ )
493         line_buffer[i] = Machine->pens[vdc.vce_data[0x100].w];
501         line_buffer[i] = Machine->pens[color_base + vdc.vce_data[0x100].w];
494502
495503      for(i=0;i<(vdc.physical_width >> 3) + 1;i++)
496504      {
r935r936
526534               c &= 0x0F;
527535
528536            if ( phys_x >= 0 && phys_x < vdc.physical_width ) {
529               line_buffer[ pixel ] = Machine->pens[vdc.vce_data[c].w];
537               line_buffer[ pixel ] = Machine->pens[color_base + vdc.vce_data[c].w];
530538               pixel++;
531539               if ( vdc.physical_width != 512 ) {
532540                  if ( pixel < ( ( ( phys_x + 1 ) * 512 ) / vdc.physical_width ) ) {
533                     line_buffer[ pixel ] = Machine->pens[vdc.vce_data[c].w];
541                     line_buffer[ pixel ] = Machine->pens[color_base + vdc.vce_data[c].w];
534542                     pixel++;
535543                  }
536544               }
r935r936
588596   /* 0 -> no sprite pixels drawn, otherwise is sprite #+1 */
589597   UINT8 drawn[VDC_WPF];
590598
599   /* Are we in greyscale mode or in color mode? */
600   int color_base = vdc.vce_control & 0x80 ? 512 : 0;
601
591602   /* clear our sprite-to-sprite clipping buffer. */
592603   memset(drawn, 0, VDC_WPF);
593604   /* count up: Highest priority is Sprite 0 */
r935r936
657668                  {
658669                     if(!drawn[obj_x+x])
659670                     {
660                        if(priority || (line_buffer[pixel_x] == Machine->pens[vdc.vce_data[0].w])) {
661                           line_buffer[pixel_x] = Machine->pens[vdc.vce_data[0x100 + (palette << 4) + buf[x]].w];
671                        if(priority || (line_buffer[pixel_x] == Machine->pens[color_base + vdc.vce_data[0].w])) {
672                           line_buffer[pixel_x] = Machine->pens[color_base + vdc.vce_data[0x100 + (palette << 4) + buf[x]].w];
662673                           if ( vdc.physical_width != 512 ) {
663674                              if ( pixel_x + 1 < ( ( ( obj_x + x + 1 ) * 512 ) / vdc.physical_width ) ) {
664                                 line_buffer[pixel_x + 1] = Machine->pens[vdc.vce_data[0x100 + (palette << 4) + buf[x]].w];
675                                 line_buffer[pixel_x + 1] = Machine->pens[color_base + vdc.vce_data[0x100 + (palette << 4) + buf[x]].w];
665676                              }
666677                           }
667678                           drawn[obj_x+x]=i+1;
r935r936
698709                  {
699710                     if(!drawn[obj_x+x])
700711                     {
701                        if(priority || (line_buffer[pixel_x] == Machine->pens[vdc.vce_data[0].w])) {
702                           line_buffer[pixel_x] = Machine->pens[vdc.vce_data[0x100 + (palette << 4) + buf[x]].w];
712                        if(priority || (line_buffer[pixel_x] == Machine->pens[color_base + vdc.vce_data[0].w])) {
713                           line_buffer[pixel_x] = Machine->pens[color_base + vdc.vce_data[0x100 + (palette << 4) + buf[x]].w];
703714                           if ( vdc.physical_width != 512 ) {
704715                              if ( pixel_x + 1 < ( ( ( obj_x + x + 1 ) * 512 ) / vdc.physical_width ) ) {
705                                 line_buffer[pixel_x + 1] = Machine->pens[vdc.vce_data[0x100 + (palette << 4) + buf[x]].w];
716                                 line_buffer[pixel_x + 1] = Machine->pens[color_base + vdc.vce_data[0x100 + (palette << 4) + buf[x]].w];
706717                              }
707718                           }
708719                           drawn[obj_x + x]=i+1;
r935r936
735746                  {
736747                     if(!drawn[obj_x+0x10+x])
737748                     {
738                        if(priority || (line_buffer[pixel_x] == Machine->pens[vdc.vce_data[0].w])) {
739                           line_buffer[pixel_x] = Machine->pens[vdc.vce_data[0x100 + (palette << 4) + buf[x]].w];
749                        if(priority || (line_buffer[pixel_x] == Machine->pens[color_base + vdc.vce_data[0].w])) {
750                           line_buffer[pixel_x] = Machine->pens[color_base + vdc.vce_data[0x100 + (palette << 4) + buf[x]].w];
740751                           if ( vdc.physical_width != 512 ) {
741752                              if ( pixel_x + 1 < ( ( ( obj_x + x + 17 ) * 512 ) / vdc.physical_width ) ) {
742                                 line_buffer[pixel_x + 1] = Machine->pens[vdc.vce_data[0x100 + (palette << 4) + buf[x]].w];
753                                 line_buffer[pixel_x + 1] = Machine->pens[color_base + vdc.vce_data[0x100 + (palette << 4) + buf[x]].w];
743754                              }
744755                           }                                   
745756                           drawn[obj_x + 0x10 + x]=i+1;
src/mess/drivers/pce.c
r935r936
158158   MDRV_SCREEN_ADD("main",0)
159159   MDRV_SCREEN_RAW_PARAMS(MAIN_CLOCK/2, VDC_WPF, 0, VDC_WPF, VDC_LPF, 0, VDC_LPF)
160160   /* MDRV_GFXDECODE( pce_gfxdecodeinfo ) */
161   MDRV_PALETTE_LENGTH(512)
161   MDRV_PALETTE_LENGTH(1024)
162162   MDRV_PALETTE_INIT( vce )
163   MDRV_COLORTABLE_LENGTH(512)
163   MDRV_COLORTABLE_LENGTH(1024)
164164
165165   MDRV_VIDEO_START( pce )
166166   MDRV_VIDEO_UPDATE( pce )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team