Previous 15994 Revisions Next

r10097 Wednesday 19th January, 2011 at 01:20:12 UTC by Angelo Salese
[PC-8801]: Preliminary text tilemap attribute support
[src/mess/drivers]pc8801.c

src/mess/drivers/pc8801.c
r10096r10097
182182
183183[4] x--- ---- attribute not separate flag
184184[4] -x-- ---- attribute color flag
185[4] --x- ---- attribute not special flag
185[4] --x- ---- attribute not special flag (invalidates next register)
186[4] ---x xxxx attribute size (+1)
186187*/
187188
188189#define blink_speed ((((crtc.param[0][1] & 0xc0) >> 6) + 1) << 3)
190#define text_color_flag (crtc.param[0][4] & 0x40)
189191
190192static struct
191193{
r10096r10097
310312   return 0;
311313}
312314
315
316
317static UINT8 extract_text_attribute(running_machine *machine,UINT32 address,int x,int swap)
318{
319   UINT8 *vram = machine->region("maincpu")->base() + WRAM_BASE;
320   int i;
321   int fifo_size;
322
323   if(crtc.param[0][4] & 0x80)
324   {
325      popmessage("Using non-separate mode for text tilemap, contact MESSdev");
326      return 0;
327   }
328
329   fifo_size = (crtc.param[0][4] & 0x20) ? 0 : ((crtc.param[0][4] & 0x1f) + 1);
330
331   for(i=0;i<fifo_size;i++)
332   {
333      /* TODO: do we have a bug lying to somewhere else? N-BASIC attributes doesn't work without this +2 ... */
334      if(x < vram[address+swap])
335      {
336         return vram[address+1];
337      }
338      else
339         address+=2;
340   }
341
342   return 0;
343}
344
313345static void draw_text_80(running_machine *machine, bitmap_t *bitmap,int y_size)
314346{
315347   int x,y;
r10096r10097
317349   UINT8 *vram = machine->region("maincpu")->base() + WRAM_BASE;
318350   UINT8 is_cursor;
319351   UINT8 y_height;
352   UINT8 attr;
353   UINT8 reverse;
354   UINT8 pal;
320355
321356   y_height = y_size == 20 ? 10 : 8;
322357
r10096r10097
324359   {
325360      for(x=0;x<80;x++)
326361      {
362         attr = extract_text_attribute(machine,(((y*120)+80+dma_address[2]) & 0xffff),(x),0);
363
364         if(text_color_flag)
365            pal = (attr & 0xe0) >> 5;
366         else
367            pal = 7;
368
369         reverse = attr & 4;
370
327371         for(yi=0;yi<8;yi++)
328372         {
329373            is_cursor = calc_cursor_pos(machine,x,y,yi);
r10096r10097
340384               res_x = x*8+xi;
341385               res_y = y*y_height+yi;
342386
343               if(is_cursor)
344                  color = ((gfx_data[tile*8+yi] >> (7-xi)) & 1) ? -1 : 7;
387               if(is_cursor || reverse)
388                  color = ((gfx_data[tile*8+yi] >> (7-xi)) & 1) ? -1 : pal;
345389               else
346                  color = ((gfx_data[tile*8+yi] >> (7-xi)) & 1) ? 7 : -1;
390                  color = ((gfx_data[tile*8+yi] >> (7-xi)) & 1) ? pal : -1;
347391
348392               if((res_x)<=machine->primary_screen->visible_area().max_x && (res_y)<=machine->primary_screen->visible_area().max_y)
349393                  if(color != -1)
r10096r10097
361405   UINT8 *vram = machine->region("maincpu")->base() + WRAM_BASE;
362406   UINT8 is_cursor;
363407   UINT8 y_height;
408   UINT8 attr;
409   UINT8 reverse;
364410
365411   y_height = y_size == 20 ? 10 : 8;
366412
r10096r10097
371417         if(x & 1)
372418            continue;
373419
420         attr = extract_text_attribute(machine,(((y*120)+80+dma_address[2]) & 0xffff),(x),2);
421
422         reverse = attr & 4;
423
374424         for(yi=0;yi<8;yi++)
375425         {
376426            is_cursor = calc_cursor_pos(machine,x,y,yi);
r10096r10097
387437               res_x = (x*8)+xi*2;
388438               res_y = (y*y_height)+yi;
389439
390               if(is_cursor)
440               if(is_cursor || reverse)
391441                  color = ((gfx_data[tile*8+yi] >> (7-xi)) & 1) ? -1 : 7;
392442               else
393443                  color = ((gfx_data[tile*8+yi] >> (7-xi)) & 1) ? 7 : -1;
r10096r10097
420470   {
421471      static int y_size;
422472
473      //popmessage("%02x %02x",crtc.param[0][0],crtc.param[0][4]);
474
423475      y_size = (crtc.param[0][1] & 0x3f) + 1;
424476
425477      if(y_size < 20) y_size = 20;

Previous 15994 Revisions Next


© 1998-2018 The MESS Team