src/mess/video/apple2.c
| r1763 | r1764 | |
| 96 | 96 | -------------------------------------------------*/ |
| 97 | 97 | |
| 98 | 98 | INLINE 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) |
| 100 | 100 | { |
| 101 | 101 | int x, y, i; |
| 102 | 102 | int fg = fgcolor; |
| r1763 | r1764 | |
| 125 | 125 | { |
| 126 | 126 | for (x = 0; x < 7; x++) |
| 127 | 127 | { |
| 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 | |
| 129 | 133 | for (i = 0; i < xscale; i++) |
| 130 | 134 | { |
| 131 | 135 | *BITMAP_ADDR16(bitmap, ypos + y, xpos + (x * xscale) + i) = color; |
| r1763 | r1764 | |
| 141 | 145 | column or 80 column) |
| 142 | 146 | -------------------------------------------------*/ |
| 143 | 147 | |
| 144 | | static void apple2_text_draw(mame_bitmap *bitmap, const rectangle *cliprect, int page, int beginrow, int endrow) |
| 148 | static void apple2_text_draw(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int page, int beginrow, int endrow) |
| 145 | 149 | { |
| 146 | 150 | int row, col; |
| 147 | 151 | UINT32 start_address = (page ? 0x0800 : 0x0400); |
| r1763 | r1764 | |
| 149 | 153 | const UINT8 *textgfx_data = memory_region(REGION_GFX1); |
| 150 | 154 | UINT32 textgfx_datalen = memory_region_length(REGION_GFX1); |
| 151 | 155 | UINT32 my_a2 = effective_a2(); |
| 156 | int flip = !strcmp(machine->gamedrv->name, "apple2") || !strcmp(machine->gamedrv->name, "apple2p"); |
| 152 | 157 | |
| 153 | 158 | /* perform adjustments */ |
| 154 | 159 | adjust_begin_and_end_row(cliprect, &beginrow, &endrow); |
| r1763 | r1764 | |
| 163 | 168 | if (my_a2 & VAR_80COL) |
| 164 | 169 | { |
| 165 | 170 | 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); |
| 167 | 172 | 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); |
| 169 | 174 | } |
| 170 | 175 | else |
| 171 | 176 | { |
| 172 | 177 | 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); |
| 174 | 179 | } |
| 175 | 180 | } |
| 176 | 181 | } |
| r1763 | r1764 | |
| 181 | 186 | apple2_lores_draw - renders lo-res text |
| 182 | 187 | -------------------------------------------------*/ |
| 183 | 188 | |
| 184 | | static void apple2_lores_draw(mame_bitmap *bitmap, const rectangle *cliprect, int page, int beginrow, int endrow) |
| 189 | static void apple2_lores_draw(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int page, int beginrow, int endrow) |
| 185 | 190 | { |
| 186 | 191 | int row, col, y, x; |
| 187 | 192 | UINT8 code; |
| r1763 | r1764 | |
| 351 | 356 | } |
| 352 | 357 | } |
| 353 | 358 | |
| 354 | | static void apple2_hires_draw(mame_bitmap *bitmap, const rectangle *cliprect, int page, int beginrow, int endrow) |
| 359 | static void apple2_hires_draw(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int page, int beginrow, int endrow) |
| 355 | 360 | { |
| 356 | 361 | struct drawtask_params dtparams; |
| 357 | 362 | |
| r1763 | r1764 | |
| 498 | 503 | if (effective_a2() & VAR_TEXT) |
| 499 | 504 | { |
| 500 | 505 | /* text screen */ |
| 501 | | apple2_text_draw(bitmap, cliprect, page, 0, 191); |
| 506 | apple2_text_draw(machine, bitmap, cliprect, page, 0, 191); |
| 502 | 507 | } |
| 503 | 508 | else if ((effective_a2() & VAR_HIRES) && (effective_a2() & VAR_MIXED)) |
| 504 | 509 | { |
| 505 | 510 | /* 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); |
| 508 | 513 | } |
| 509 | 514 | else if (effective_a2() & VAR_HIRES) |
| 510 | 515 | { |
| 511 | 516 | /* hi-res screen */ |
| 512 | | apple2_hires_draw(bitmap, cliprect, page, 0, 191); |
| 517 | apple2_hires_draw(machine, bitmap, cliprect, page, 0, 191); |
| 513 | 518 | } |
| 514 | 519 | else if (effective_a2() & VAR_MIXED) |
| 515 | 520 | { |
| 516 | 521 | /* 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); |
| 519 | 524 | } |
| 520 | 525 | else |
| 521 | 526 | { |
| 522 | 527 | /* lo-res screen */ |
| 523 | | apple2_lores_draw(bitmap, cliprect, page, 0, 191); |
| 528 | apple2_lores_draw(machine, bitmap, cliprect, page, 0, 191); |
| 524 | 529 | } |
| 525 | 530 | return 0; |
| 526 | 531 | } |