Previous 15994 Revisions Next

r9044 Sunday 5th September, 2010 at 13:16:52 UTC by Angelo Salese
[MZ-2500]: Added scrolling functions to 256 color layers, improves Super MZ Demo graphics
[src/mess/drivers]mz2500.c

src/mess/drivers/mz2500.c
r9043r9044
367367   base_mask = (x_size == 640) ? 0x3f : 0x1f;
368368
369369   count = (cg_reg[0x10]) | ((cg_reg[0x11] & base_mask) << 8);
370   count|= (plane & 2) ? 0x10000 : 0x00000;
371370   wa_reg = (cg_reg[0x12]) | ((cg_reg[0x13] & base_mask) << 8);
372   wa_reg|= (plane & 2) ? 0x10000 : 0x00000;
373371   /* TODO: layer 2 scrolling */
374372   s_x = (cg_reg[0x0f] & 0xf);
375373   cg_interlace = text_font_reg ? 1 : 2;
r9043r9044
390388            if(res_x < cg_hs || res_x >= cg_he || res_y < cg_vs || res_y >= cg_ve)
391389               continue;
392390
393            pen_bit[0] = (vram[count+0x40000+((plane & 1) * 0x2000)]>>(xi)) & 1 ? (pen_mask & 0x01) : 0; //B
394            pen_bit[1] = (vram[count+0x44000+((plane & 1) * 0x2000)]>>(xi)) & 1 ? (pen_mask & 0x02) : 0; //R
395            pen_bit[2] = (vram[count+0x48000+((plane & 1) * 0x2000)]>>(xi)) & 1 ? (pen_mask & 0x04) : 0; //G
396            pen_bit[3] = (vram[count+0x4c000+((plane & 1) * 0x2000)]>>(xi)) & 1 ? (pen_mask & 0x08) : 0; //I
391            pen_bit[0] = (vram[count+0x40000+((plane & 1) * 0x2000)+(((plane & 2)>>1) * 0x10000)]>>(xi)) & 1 ? (pen_mask & 0x01) : 0; //B
392            pen_bit[1] = (vram[count+0x44000+((plane & 1) * 0x2000)+(((plane & 2)>>1) * 0x10000)]>>(xi)) & 1 ? (pen_mask & 0x02) : 0; //R
393            pen_bit[2] = (vram[count+0x48000+((plane & 1) * 0x2000)+(((plane & 2)>>1) * 0x10000)]>>(xi)) & 1 ? (pen_mask & 0x04) : 0; //G
394            pen_bit[3] = (vram[count+0x4c000+((plane & 1) * 0x2000)+(((plane & 2)>>1) * 0x10000)]>>(xi)) & 1 ? (pen_mask & 0x08) : 0; //I
397395
398396            pen = 0;
399397            for(pen_i=0;pen_i<4;pen_i++)
r9043r9044
410408   }
411409}
412410
413static void draw_cg256_screen(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int pri)
411static void draw_cg256_screen(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int plane,int pri)
414412{
415413   static UINT32 count;
416414   UINT8 *vram = memory_region(machine, "maincpu");
417415   UINT8 pen,pen_bit[8];
418416   int x,y,xi,pen_i;
417   UINT32 wa_reg;
418   UINT8 s_x;
419   UINT8 base_mask;
419420   int res_x,res_y;
420421   UINT8 cg_interlace;
421422
422   count = 0x40000;
423   base_mask = 0x3f; //no x_size == 640
424
425   count = (cg_reg[0x10]) | ((cg_reg[0x11] & base_mask) << 8);
426   wa_reg = (cg_reg[0x12]) | ((cg_reg[0x13] & base_mask) << 8);
427   /* TODO: layer 2 scrolling */
428   s_x = (cg_reg[0x0f] & 0xf);
423429   cg_interlace = text_font_reg ? 1 : 2;
424430
425431   for(y=0;y<200;y++)
r9043r9044
428434      {
429435         for(xi=0;xi<8;xi++)
430436         {
431            res_x = x+xi;
437            res_x = x+xi+s_x;
432438            res_y = y;
433439
434440            /* check window boundaries */
435441            if(res_x < cg_hs || res_x >= cg_he || res_y < cg_vs || res_y >= cg_ve)
436442               continue;
437443
438            pen_bit[0] = (vram[count + 0x2000]>>(xi)) & 1 ? (cg_reg[0x18] & 0x10) : 0; // B1
439            pen_bit[1] = (vram[count + 0x0000]>>(xi)) & 1 ? (cg_reg[0x18] & 0x01) : 0; // B0
440            pen_bit[2] = (vram[count + 0x6000]>>(xi)) & 1 ? (cg_reg[0x18] & 0x20) : 0; // R1
441            pen_bit[3] = (vram[count + 0x4000]>>(xi)) & 1 ? (cg_reg[0x18] & 0x02) : 0; // R0
442            pen_bit[4] = (vram[count + 0xa000]>>(xi)) & 1 ? (cg_reg[0x18] & 0x40) : 0; // G1
443            pen_bit[5] = (vram[count + 0x8000]>>(xi)) & 1 ? (cg_reg[0x18] & 0x04) : 0; // G0
444            pen_bit[6] = (vram[count + 0xe000]>>(xi)) & 1 ? (cg_reg[0x18] & 0x80) : 0; // I1
445            pen_bit[7] = (vram[count + 0xc000]>>(xi)) & 1 ? (cg_reg[0x18] & 0x08) : 0; // I0
444            pen_bit[0] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0x2000]>>(xi)) & 1 ? (cg_reg[0x18] & 0x10) : 0; // B1
445            pen_bit[1] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0x0000]>>(xi)) & 1 ? (cg_reg[0x18] & 0x01) : 0; // B0
446            pen_bit[2] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0x6000]>>(xi)) & 1 ? (cg_reg[0x18] & 0x20) : 0; // R1
447            pen_bit[3] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0x4000]>>(xi)) & 1 ? (cg_reg[0x18] & 0x02) : 0; // R0
448            pen_bit[4] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0xa000]>>(xi)) & 1 ? (cg_reg[0x18] & 0x40) : 0; // G1
449            pen_bit[5] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0x8000]>>(xi)) & 1 ? (cg_reg[0x18] & 0x04) : 0; // G0
450            pen_bit[6] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0xe000]>>(xi)) & 1 ? (cg_reg[0x18] & 0x80) : 0; // I1
451            pen_bit[7] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0xc000]>>(xi)) & 1 ? (cg_reg[0x18] & 0x08) : 0; // I0
446452
447453            pen = 0;
448454            for(pen_i=0;pen_i<8;pen_i++)
r9043r9044
452458               mz2500_draw_pixel(machine,bitmap,res_x,res_y,(clut256[pen] & 0xff)+0x100,scr_x_size == 640,cg_interlace == 2);
453459         }
454460         count++;
461         count&=((base_mask<<8) | 0xff);
462         if(count > wa_reg)
463            count = 0;
455464      }
456465   }
457466}
r9043r9044
514523         draw_cg16_screen(machine,bitmap,cliprect,0,640,pri);
515524         break;
516525      case 0x1d:
517         draw_cg256_screen(machine,bitmap,cliprect,pri);
526         draw_cg256_screen(machine,bitmap,cliprect,0,pri);
518527         break;
519528      case 0x97:
520529         draw_cg16_screen(machine,bitmap,cliprect,2,640,pri);

Previous 15994 Revisions Next


© 1998-2018 The MESS Team