Previous 15994 Revisions Next

r10243 Monday 31st January, 2011 at 21:28:49 UTC by Angelo Salese
[PC-8801]: more tv tilemap improvements, added upper / lower attributes and fixed cursor when 20 lines are selected
[src/mess/drivers]pc8801.c

src/mess/drivers/pc8801.c
r10242r10243
339339   return 0;
340340}
341341
342static void pc8801_draw_char(running_machine *machine,bitmap_t *bitmap,int x,int y,int pal,UINT8 gfx_mode,UINT8 reverse,int y_size,int width)
342static void pc8801_draw_char(running_machine *machine,bitmap_t *bitmap,int x,int y,int pal,UINT8 gfx_mode,UINT8 reverse,UINT8 secret,UINT8 blink,UINT8 upper,UINT8 lower,int y_size,int width)
343343{
344344   int xi,yi;
345345   UINT8 *vram = machine->region("wram")->base();
r10242r10243
348348
349349   y_height = y_size == 20 ? 10 : 8;
350350
351   for(yi=0;yi<8;yi++)
351   for(yi=0;yi<y_height;yi++)
352352   {
353353      is_cursor = calc_cursor_pos(machine,x,y,yi);
354354
r10242r10243
359359         int color;
360360
361361         {
362            UINT8 *gfx_data = machine->region("gfx1")->base();
363
364362            tile = vram[x+(y*120)+dma_address[2]];
365363
366364            res_x = x*8+xi*(width+1);
r10242r10243
376374            }
377375            else
378376            {
377               UINT8 char_data;
378               UINT8 *gfx_rom = machine->region("gfx1")->base();
379
380               if(yi >= 8 || secret)
381                  char_data = 0;
382               else
383                  char_data = (gfx_rom[tile*8+yi] >> (7-xi)) & 1;
384
385               if(yi == 0 && upper)
386                  char_data = 1;
387
388               if(yi == y_height && lower)
389                  char_data = 1;
390
379391               if(is_cursor || reverse)
380                  color = ((gfx_data[tile*8+yi] >> (7-xi)) & 1) ? -1 : pal;
392                  color = char_data ? -1 : pal;
381393               else
382                  color = ((gfx_data[tile*8+yi] >> (7-xi)) & 1) ? pal : -1;
394                  color = char_data ? pal : -1;
383395            }
384396
385397            if((res_x)>machine->primary_screen->visible_area().max_x && (res_y)>machine->primary_screen->visible_area().max_y)
r10242r10243
407419   UINT8 attr;
408420   UINT8 reverse;
409421   UINT8 gfx_mode;
422   UINT8 secret;
423   UINT8 upper;
424   UINT8 lower;
425   UINT8 blink;
410426   int pal;
411427
412428   for(y=0;y<y_size;y++)
r10242r10243
415431      {
416432         attr = extract_text_attribute(machine,(((y*120)+80+dma_address[2]) & 0xffff),(x));
417433
418         if(text_color_flag)
434         if(text_color_flag) // color mode
419435         {
420436            pal = (attr & 0xe0) >> 5;
421437            gfx_mode = (attr & 0x10) >> 4;
422438            reverse = 0;
439            secret = 0;
440            upper = 0;
441            lower = 0;
442            blink = 0;
423443            pal|=8; //text pal bank
444
445            if(((attr & 8) == 8) && ((attr & 7) != 0))
446               popmessage("Warning: color switch enabled, contact MESSdev");
424447         }
425         else
448         else // monochrome
426449         {
427450            pal = (txt_color) ? 7 : 0;
428451            gfx_mode = 0;
429            reverse = attr & 4;
452            reverse = (attr & 4) >> 2;
453            secret = (attr & 1);
454            upper = (attr & 0x10) >> 4;
455            lower = (attr & 0x20) >> 5;
456            blink = (attr & 2) >> 1;
430457            pal|=8; //text pal bank
458
459            if(attr & 0x80)
460               popmessage("Warning: mono gfx mode enabled, contact MESSdev");
431461         }
432462
433         pc8801_draw_char(machine,bitmap,x,y,pal,gfx_mode,reverse,y_size,0);
463         pc8801_draw_char(machine,bitmap,x,y,pal,gfx_mode,reverse,secret,upper,lower,blink,y_size,0);
434464      }
435465   }
436466}
r10242r10243
441471   UINT8 attr;
442472   UINT8 reverse;
443473   UINT8 gfx_mode;
474   UINT8 secret;
475   UINT8 upper;
476   UINT8 lower;
477   UINT8 blink;
444478   int pal;
445479
446480   for(y=0;y<y_size;y++)
r10242r10243
457491            pal = (attr & 0xe0) >> 5;
458492            gfx_mode = (attr & 0x10) >> 4;
459493            reverse = 0;
494            secret = 0;
495            upper = 0;
496            lower = 0;
497            blink = 0;
460498            pal|=8; //text pal bank
499
500            if(attr & 0x08)
501               popmessage("Warning: color switch enabled, contact MESSdev");
461502         }
462503         else
463504         {
464505            pal = (txt_color) ? 7 : 0;
465506            gfx_mode = 0;
466            reverse = attr & 4;
507            reverse = (attr & 4) >> 2;
508            secret = (attr & 1);
509            upper = (attr & 0x10) >> 4;
510            lower = (attr & 0x20) >> 5;
511            blink = (attr & 2) >> 1;
467512            pal|=8; //text pal bank
513
514            if(attr & 0x80)
515               popmessage("Warning: mono gfx mode enabled, contact MESSdev");
468516         }
469517
470         pc8801_draw_char(machine,bitmap,x,y,pal,gfx_mode,reverse,y_size,1);
518         pc8801_draw_char(machine,bitmap,x,y,pal,gfx_mode,reverse,secret,upper,lower,blink,y_size,1);
471519      }
472520   }
473521}

Previous 15994 Revisions Next


© 1998-2018 The MESS Team