Previous 15994 Revisions Next

r15576 Wednesday 11th July, 2012 at 00:55:56 UTC by Angelo Salese
Cleaned up text drawing function
[src/mess/drivers]pc8801.c

src/mess/drivers/pc8801.c
r15575r15576
551551   }
552552}
553553
554static void draw_text_80(running_machine &machine, bitmap_ind16 &bitmap,int y_size)
554static void draw_text(running_machine &machine, bitmap_ind16 &bitmap,int y_size, UINT8 width)
555555{
556556   pc8801_state *state = machine.driver_data<pc8801_state>();
557557   int x,y;
r15575r15576
568568   {
569569      for(x=0;x<80;x++)
570570      {
571         if(x & 1 && !width)
572            continue;
573
571574         attr = extract_text_attribute(machine,(((y*120)+80+state->m_dma_address[2]) & 0xffff),(x));
572575
573576         if(text_color_flag) // color mode
r15575r15576
596599               popmessage("Warning: mono gfx mode enabled, contact MESSdev");
597600         }
598601
599         pc8801_draw_char(machine,bitmap,x,y,pal,gfx_mode,reverse,secret,upper,lower,blink,y_size,monitor_24KHz,0);
602         pc8801_draw_char(machine,bitmap,x,y,pal,gfx_mode,reverse,secret,upper,lower,blink,y_size,monitor_24KHz,!width);
600603      }
601604   }
602605}
603606
604static void draw_text_40(running_machine &machine, bitmap_ind16 &bitmap, int y_size)
605{
606   pc8801_state *state = machine.driver_data<pc8801_state>();
607   int x,y;
608   UINT8 attr;
609   UINT8 reverse;
610   UINT8 gfx_mode;
611   UINT8 secret;
612   UINT8 upper;
613   UINT8 lower;
614   UINT8 blink;
615   int pal;
616
617   for(y=0;y<y_size;y++)
618   {
619      for(x=0;x<80;x++)
620      {
621         if(x & 1)
622            continue;
623
624         attr = extract_text_attribute(machine,(((y*120)+80+state->m_dma_address[2]) & 0xffff),(x));
625
626         if(text_color_flag)
627         {
628            pal = (attr & 8) ? ((attr & 0xe0) >> 5) : 7;  // Alpha behaves on this
629            gfx_mode = (attr & 0x10) >> 4;
630            reverse = 0;
631            secret = 0;
632            upper = 0;
633            lower = 0;
634            blink = 0;
635            pal|=8; //text pal bank
636         }
637         else
638         {
639            pal = (state->m_txt_color) ? 7 : 0;
640            gfx_mode = 0;
641            reverse = (attr & 4) >> 2;
642            secret = (attr & 1);
643            upper = (attr & 0x10) >> 4;
644            lower = (attr & 0x20) >> 5;
645            blink = (attr & 2) >> 1;
646            pal|=8; //text pal bank
647
648            if(attr & 0x80)
649               popmessage("Warning: mono gfx mode enabled, contact MESSdev");
650         }
651
652         pc8801_draw_char(machine,bitmap,x,y,pal,gfx_mode,reverse,secret,upper,lower,blink,y_size,monitor_24KHz,1);
653      }
654   }
655}
656
657607static SCREEN_UPDATE_IND16( pc8801 )
658608{
659609   pc8801_state *state = screen.machine().driver_data<pc8801_state>();
r15575r15576
680630      if(y_size < 20) y_size = 20;
681631      if(y_size > 25) y_size = 25;
682632
683      if(state->m_txt_width)
684         draw_text_80(screen.machine(),bitmap,y_size);
685      else
686         draw_text_40(screen.machine(),bitmap,y_size);
633      draw_text(screen.machine(),bitmap,y_size,state->m_txt_width);
687634   }
688635
689636   return 0;

Previous 15994 Revisions Next


© 1998-2018 The MESS Team