Previous 15994 Revisions Next

r6010 Thursday 8th October, 2009 at 00:38:07 UTC by Angelo Salese
[PC98]: Improved tilemap support
[src/mess/drivers]pc98.c

src/mess/drivers/pc98.c
r6009r6010
226226   gfx_bitmap_ram = auto_alloc_array(machine, UINT32, 0x18000*2);
227227}
228228
229/*
230attrib ram is:
231bit 0: secret / hidden (?)
232bit 1: blink
233bit 2: reverse video
234bit 3: underline
235bit 4: vertical line / simple gfx (toggled by flip-flop bit) (?)
236bit 5-7: BRG colors
237*/
238
229239static VIDEO_UPDATE( pc9801 )
230240{
231   const gfx_element *gfx = screen->machine->gfx[0];
232   int count = 0x00000;
241//   const gfx_element *gfx = screen->machine->gfx[0];
233242   int y,x;
243   int yi,xi;
244   UINT8 *gfx_data = memory_region(screen->machine, "gfx1");
234245
235
236   for (y=0;y<64;y++)
246   for (y=0;y<24;y++)
237247   {
238      for (x=0;x<64;x+=2)
248      for (x=0;x<40;x++)
239249      {
240         int tile;
250         for(yi=0;yi<8;yi++)
251         {
252            for(xi=0;xi<8;xi++)
253            {
254               int tile,attr,pen[3],pen_mask,color;
241255
242         tile = (pc9801_vram[count] & 0x00ff0000)>>16;
243         drawgfx_opaque(bitmap,cliprect,gfx,tile,0,0,0,(x+1)*8,y*8);
256               tile = (pc9801_vram[(x+y*40)] & 0x00ff0000) >> 16;
257               attr = (pc9801_vram[((x+y*40)+0x2000/4)] & 0x00ff0000) >> 16;
244258
245         tile = pc9801_vram[count] & 0x000000ff;
246         drawgfx_opaque(bitmap,cliprect,gfx,tile,0,0,0,(x+0)*8,y*8);
259               pen_mask = (attr & 0xe0)>>5;
247260
248         count++;
261               pen[0] = gfx_data[(tile*8)+yi]>>(7-xi) & (pen_mask & 1)>>0;
262               pen[1] = gfx_data[(tile*8)+yi]>>(7-xi) & (pen_mask & 2)>>1;
263               pen[2] = gfx_data[(tile*8)+yi]>>(7-xi) & (pen_mask & 4)>>2;
264
265               color = pen[2]<<2|pen[1]<<1|pen[0]<<0;
266
267               if(((x*2+1)*8+xi)<video_screen_get_visible_area(screen->machine->primary_screen)->max_x && (y*8+yi)<video_screen_get_visible_area(screen->machine->primary_screen)->max_y)
268                  *BITMAP_ADDR16(bitmap, y*8+yi, (x*2+1)*8+xi) = screen->machine->pens[color];
269
270               tile = (pc9801_vram[(x+y*40)] & 0x000000ff) >> 0;
271               attr = (pc9801_vram[((x+y*40)+0x2000/4)] & 0x000000ff) >> 0;
272
273               pen_mask = (attr & 0xe0)>>5;
274
275               pen[0] = gfx_data[(tile*8)+yi]>>(7-xi) & (pen_mask & 1)>>0;
276               pen[1] = gfx_data[(tile*8)+yi]>>(7-xi) & (pen_mask & 2)>>1;
277               pen[2] = gfx_data[(tile*8)+yi]>>(7-xi) & (pen_mask & 4)>>2;
278
279               color = pen[2]<<2|pen[1]<<1|pen[0]<<0;
280
281               if(((x*2+0)*8+xi)<video_screen_get_visible_area(screen->machine->primary_screen)->max_x && (y*8+yi)<video_screen_get_visible_area(screen->machine->primary_screen)->max_y)
282                  *BITMAP_ADDR16(bitmap, y*8+yi, (x*2+0)*8+xi) = screen->machine->pens[color];
283            }
284         }
249285      }
250286   }
251287
r6009r6010
579615   }
580616};
581617
618static PALETTE_INIT( pc9801 )
619{
620   int i;
621
622   for(i=0;i<8;i++)
623      palette_set_color_rgb(machine, i+0x000, pal1bit(i >> 1), pal1bit(i >> 2), pal1bit(i >> 0));
624}
625
582626/* I suspect the dump for pc9801 comes from a i386 later model... the original machine would use a i8086 @ 5Mhz CPU (see notes at top) */
583627/* More investigations are required, but in the meanwhile I set a I386 as main CPU */
584628static MACHINE_DRIVER_START( pc9801 )
r6009r6010
600644   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
601645   MDRV_SCREEN_SIZE(640, 480)
602646   MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
603   MDRV_PALETTE_LENGTH(2)
604   MDRV_PALETTE_INIT(black_and_white)
647   MDRV_PALETTE_LENGTH(8)
648   MDRV_PALETTE_INIT(pc9801)
605649   MDRV_GFXDECODE(pc9801)
606650
607651   MDRV_VIDEO_START(pc9801)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team