Previous 15994 Revisions Next

r1764 Monday 25th February, 2008 at 02:41:22 UTC by Nathan Woods
[APPLE2] Fixed apple2/apple2p flipping
[src/mess/video]apple2.c

src/mess/video/apple2.c
r1763r1764
9696-------------------------------------------------*/
9797
9898INLINE void apple2_plot_text_character(mame_bitmap *bitmap, int xpos, int ypos, int xscale, UINT32 code,
99   const UINT8 *textgfx_data, UINT32 textgfx_datalen, UINT32 my_a2)
99   const UINT8 *textgfx_data, UINT32 textgfx_datalen, UINT32 my_a2, int flip)
100100{
101101   int x, y, i;
102102   int fg = fgcolor;
r1763r1764
125125   {
126126      for (x = 0; x < 7; x++)
127127      {
128         color = (chardata[y] & (1 << x)) ? bg : fg;
128         if (flip)
129            color = (chardata[y] & (1 << (6 - x))) ? bg : fg;
130         else
131            color = (chardata[y] & (1 << x)) ? bg : fg;
132
129133         for (i = 0; i < xscale; i++)
130134         {
131135            *BITMAP_ADDR16(bitmap, ypos + y, xpos + (x * xscale) + i) = color;
r1763r1764
141145   column or 80 column)
142146-------------------------------------------------*/
143147
144static void apple2_text_draw(mame_bitmap *bitmap, const rectangle *cliprect, int page, int beginrow, int endrow)
148static void apple2_text_draw(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int page, int beginrow, int endrow)
145149{
146150   int row, col;
147151   UINT32 start_address = (page ? 0x0800 : 0x0400);
r1763r1764
149153   const UINT8 *textgfx_data = memory_region(REGION_GFX1);
150154   UINT32 textgfx_datalen = memory_region_length(REGION_GFX1);
151155   UINT32 my_a2 = effective_a2();
156   int flip = !strcmp(machine->gamedrv->name, "apple2") || !strcmp(machine->gamedrv->name, "apple2p");
152157
153158   /* perform adjustments */
154159   adjust_begin_and_end_row(cliprect, &beginrow, &endrow);
r1763r1764
163168         if (my_a2 & VAR_80COL)
164169         {
165170            apple2_plot_text_character(bitmap, col * 14 + 0, row, 1, a2_videoram[address + 0x10000],
166               textgfx_data, textgfx_datalen, my_a2);
171               textgfx_data, textgfx_datalen, my_a2, flip);
167172            apple2_plot_text_character(bitmap, col * 14 + 7, row, 1, a2_videoram[address + 0x00000],
168               textgfx_data, textgfx_datalen, my_a2);
173               textgfx_data, textgfx_datalen, my_a2, flip);
169174         }
170175         else
171176         {
172177            apple2_plot_text_character(bitmap, col * 14, row, 2, a2_videoram[address],
173               textgfx_data, textgfx_datalen, my_a2);
178               textgfx_data, textgfx_datalen, my_a2, flip);
174179         }
175180      }
176181   }
r1763r1764
181186    apple2_lores_draw - renders lo-res text
182187-------------------------------------------------*/
183188
184static void apple2_lores_draw(mame_bitmap *bitmap, const rectangle *cliprect, int page, int beginrow, int endrow)
189static void apple2_lores_draw(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int page, int beginrow, int endrow)
185190{
186191   int row, col, y, x;
187192   UINT8 code;
r1763r1764
351356   }
352357}
353358
354static void apple2_hires_draw(mame_bitmap *bitmap, const rectangle *cliprect, int page, int beginrow, int endrow)
359static void apple2_hires_draw(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int page, int beginrow, int endrow)
355360{
356361   struct drawtask_params dtparams;
357362
r1763r1764
498503   if (effective_a2() & VAR_TEXT)
499504   {
500505      /* text screen */
501      apple2_text_draw(bitmap, cliprect, page, 0, 191);
506      apple2_text_draw(machine, bitmap, cliprect, page, 0, 191);
502507   }
503508   else if ((effective_a2() & VAR_HIRES) && (effective_a2() & VAR_MIXED))
504509   {
505510      /* hi-res on top; text at bottom */
506      apple2_hires_draw(bitmap, cliprect, page, 0, 159);
507      apple2_text_draw(bitmap, cliprect, page, 160, 191);
511      apple2_hires_draw(machine, bitmap, cliprect, page, 0, 159);
512      apple2_text_draw(machine, bitmap, cliprect, page, 160, 191);
508513   }
509514   else if (effective_a2() & VAR_HIRES)
510515   {
511516      /* hi-res screen */
512      apple2_hires_draw(bitmap, cliprect, page, 0, 191);
517      apple2_hires_draw(machine, bitmap, cliprect, page, 0, 191);
513518   }
514519   else if (effective_a2() & VAR_MIXED)
515520   {
516521      /* lo-res on top; text at bottom */
517      apple2_lores_draw(bitmap, cliprect, page, 0, 159);
518      apple2_text_draw(bitmap, cliprect, page, 160, 191);
522      apple2_lores_draw(machine, bitmap, cliprect, page, 0, 159);
523      apple2_text_draw(machine, bitmap, cliprect, page, 160, 191);
519524   }
520525   else
521526   {
522527      /* lo-res screen */
523      apple2_lores_draw(bitmap, cliprect, page, 0, 191);
528      apple2_lores_draw(machine, bitmap, cliprect, page, 0, 191);
524529   }
525530   return 0;
526531}

Previous 15994 Revisions Next


© 1998-2018 The MESS Team