src/mess/video/apple2.c
| r1762 | r1763 | |
| 13 | 13 | static const UINT8 *a2_videoram; |
| 14 | 14 | static UINT32 a2_videomask; |
| 15 | 15 | static UINT32 old_a2; |
| 16 | | static tilemap *text_tilemap; |
| 17 | | static tilemap *dbltext_tilemap; |
| 18 | | static tilemap *lores_tilemap; |
| 19 | | static int text_videobase; |
| 20 | | static int dbltext_videobase; |
| 21 | | static int lores_videobase; |
| 22 | 16 | static int fgcolor, bgcolor, flash; |
| 23 | 17 | static int alt_charset_value; |
| 24 | 18 | static UINT16 *hires_artifact_map; |
| 25 | 19 | static UINT16 *dhires_artifact_map; |
| 26 | | static UINT8 *lores_tiledata; |
| 27 | 20 | |
| 28 | 21 | #define BLACK 0 |
| 29 | 22 | #define DKRED 1 |
| r1762 | r1763 | |
| 46 | 39 | #define PROFILER_VIDEOTOUCH PROFILER_USER3 |
| 47 | 40 | |
| 48 | 41 | /*************************************************************************** |
| 49 | | helpers |
| 42 | HELPERS |
| 50 | 43 | ***************************************************************************/ |
| 51 | 44 | |
| 45 | /*------------------------------------------------- |
| 46 | effective_a2 - calculates the effective a2 |
| 47 | register |
| 48 | -------------------------------------------------*/ |
| 49 | |
| 52 | 50 | INLINE UINT32 effective_a2(void) |
| 53 | 51 | { |
| 54 | 52 | return a2 & a2_videomask; |
| 55 | 53 | } |
| 56 | 54 | |
| 57 | 55 | |
| 56 | /*------------------------------------------------- |
| 57 | compute_video_address - performs funky Apple II |
| 58 | video address lookup |
| 59 | -------------------------------------------------*/ |
| 58 | 60 | |
| 59 | | static void apple2_draw_tilemap(mame_bitmap *bitmap, const rectangle *cliprect, |
| 60 | | int beginrow, int endrow, tilemap *tm, int raw_videobase, int *tm_videobase) |
| 61 | static UINT32 compute_video_address(int col, int row) |
| 61 | 62 | { |
| 62 | | rectangle new_cliprect; |
| 63 | /* special Apple II addressing - gotta love it */ |
| 64 | return (((row & 0x07) << 7) | ((row & 0x18) * 5 + col)); |
| 65 | } |
| 63 | 66 | |
| 64 | | new_cliprect = *cliprect; |
| 65 | 67 | |
| 66 | | if (new_cliprect.min_y < beginrow) |
| 67 | | new_cliprect.min_y = beginrow; |
| 68 | | if (new_cliprect.max_y > endrow) |
| 69 | | new_cliprect.max_y = endrow; |
| 70 | | if (new_cliprect.min_y > new_cliprect.max_y) |
| 71 | | return; |
| 72 | 68 | |
| 73 | | if (raw_videobase != *tm_videobase) |
| 74 | | { |
| 75 | | *tm_videobase = raw_videobase; |
| 76 | | tilemap_mark_all_tiles_dirty(tm); |
| 77 | | } |
| 78 | | tilemap_draw(bitmap, &new_cliprect, tm, 0, 0); |
| 69 | /*------------------------------------------------- |
| 70 | adjust_begin_and_end_row - processes the cliprect |
| 71 | -------------------------------------------------*/ |
| 72 | |
| 73 | static void adjust_begin_and_end_row(const rectangle *cliprect, int *beginrow, int *endrow) |
| 74 | { |
| 75 | /* assumptions of the code */ |
| 76 | assert((*beginrow % 8) == 0); |
| 77 | assert((*endrow % 8) == 7); |
| 78 | |
| 79 | *beginrow = MAX(*beginrow, cliprect->min_y - (cliprect->min_y % 8)); |
| 80 | *endrow = MIN(*endrow, cliprect->max_y - (cliprect->max_y % 8) + 7); |
| 81 | |
| 82 | /* sanity check again */ |
| 83 | assert((*beginrow % 8) == 0); |
| 84 | assert((*endrow % 8) == 7); |
| 79 | 85 | } |
| 80 | 86 | |
| 87 | |
| 88 | |
| 81 | 89 | /*************************************************************************** |
| 82 | | text |
| 90 | TEXT |
| 83 | 91 | ***************************************************************************/ |
| 84 | 92 | |
| 85 | | static void apple2_generaltext_gettileinfo(int videobase, int memory_offset, int *code, int *color) |
| 93 | /*------------------------------------------------- |
| 94 | apple2_plot_text_character - plots a single |
| 95 | textual character |
| 96 | -------------------------------------------------*/ |
| 97 | |
| 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) |
| 86 | 100 | { |
| 87 | | int current_fgcolor = fgcolor; |
| 88 | | int current_bgcolor = bgcolor; |
| 89 | | int i; |
| 101 | int x, y, i; |
| 102 | int fg = fgcolor; |
| 103 | int bg = bgcolor; |
| 104 | const UINT8 *chardata; |
| 105 | UINT16 color; |
| 90 | 106 | |
| 91 | | *code = a2_videoram[videobase + memory_offset]; |
| 92 | | |
| 93 | | if (effective_a2() & VAR_ALTCHARSET) |
| 107 | if (my_a2 & VAR_ALTCHARSET) |
| 94 | 108 | { |
| 95 | | *code |= alt_charset_value; |
| 109 | /* we're using an alternate charset */ |
| 110 | code |= alt_charset_value; |
| 96 | 111 | } |
| 97 | | else if (flash && (*code >= 0x40) && (*code <= 0x7f)) |
| 112 | else if (flash && (code >= 0x40) && (code <= 0x7f)) |
| 98 | 113 | { |
| 99 | | i = current_fgcolor; |
| 100 | | current_fgcolor = current_bgcolor; |
| 101 | | current_bgcolor = i; |
| 114 | /* we're flashing; swap */ |
| 115 | i = fg; |
| 116 | fg = bg; |
| 117 | bg = i; |
| 102 | 118 | } |
| 103 | 119 | |
| 104 | | *color = (current_fgcolor * 16) + current_bgcolor; |
| 105 | | } |
| 120 | /* look up the character data */ |
| 121 | chardata = &textgfx_data[(code * 8) % textgfx_datalen]; |
| 106 | 122 | |
| 107 | | static TILE_GET_INFO(apple2_text_gettileinfo) |
| 108 | | { |
| 109 | | int code, color; |
| 110 | | apple2_generaltext_gettileinfo(text_videobase, tile_index, &code, &color); |
| 111 | | SET_TILE_INFO( |
| 112 | | 0, /* gfx */ |
| 113 | | code, /* character */ |
| 114 | | color, /* color */ |
| 115 | | 0); /* flags */ |
| 123 | /* and finally, plot the character itself */ |
| 124 | for (y = 0; y < 8; y++) |
| 125 | { |
| 126 | for (x = 0; x < 7; x++) |
| 127 | { |
| 128 | color = (chardata[y] & (1 << x)) ? bg : fg; |
| 129 | for (i = 0; i < xscale; i++) |
| 130 | { |
| 131 | *BITMAP_ADDR16(bitmap, ypos + y, xpos + (x * xscale) + i) = color; |
| 132 | } |
| 133 | } |
| 134 | } |
| 116 | 135 | } |
| 117 | 136 | |
| 118 | | static TILE_GET_INFO(apple2_dbltext_gettileinfo) |
| 119 | | { |
| 120 | | int code, color; |
| 121 | | apple2_generaltext_gettileinfo(dbltext_videobase, tile_index, &code, &color); |
| 122 | | SET_TILE_INFO( |
| 123 | | 1, /* gfx */ |
| 124 | | code, /* character */ |
| 125 | | color, /* color */ |
| 126 | | 0); /* flags */ |
| 127 | | } |
| 128 | 137 | |
| 129 | | static UINT32 apple2_text_getmemoryoffset(UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows) |
| 130 | | { |
| 131 | | /* Special Apple II addressing. Gotta love it. */ |
| 132 | | return (((row & 0x07) << 7) | ((row & 0x18) * 5 + col)); |
| 133 | | } |
| 134 | 138 | |
| 135 | | static UINT32 apple2_dbltext_getmemoryoffset(UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows) |
| 136 | | { |
| 137 | | return apple2_text_getmemoryoffset(col / 2, row, num_cols / 2, num_rows) + ((col % 2) ? 0x00000 : 0x10000); |
| 138 | | } |
| 139 | /*------------------------------------------------- |
| 140 | apple2_text_draw - renders text (either 40 |
| 141 | column or 80 column) |
| 142 | -------------------------------------------------*/ |
| 139 | 143 | |
| 140 | 144 | static void apple2_text_draw(mame_bitmap *bitmap, const rectangle *cliprect, int page, int beginrow, int endrow) |
| 141 | 145 | { |
| 142 | | if (effective_a2() & VAR_80COL) |
| 143 | | apple2_draw_tilemap(bitmap, cliprect, beginrow, endrow, dbltext_tilemap, page ? 0x800 : 0x400, &dbltext_videobase); |
| 144 | | else |
| 145 | | apple2_draw_tilemap(bitmap, cliprect, beginrow, endrow, text_tilemap, page ? 0x800 : 0x400, &text_videobase); |
| 146 | int row, col; |
| 147 | UINT32 start_address = (page ? 0x0800 : 0x0400); |
| 148 | UINT32 address; |
| 149 | const UINT8 *textgfx_data = memory_region(REGION_GFX1); |
| 150 | UINT32 textgfx_datalen = memory_region_length(REGION_GFX1); |
| 151 | UINT32 my_a2 = effective_a2(); |
| 152 | |
| 153 | /* perform adjustments */ |
| 154 | adjust_begin_and_end_row(cliprect, &beginrow, &endrow); |
| 155 | |
| 156 | for (row = beginrow; row <= endrow; row += 8) |
| 157 | { |
| 158 | for (col = 0; col < 40; col++) |
| 159 | { |
| 160 | /* calculate adderss */ |
| 161 | address = start_address + compute_video_address(col, row / 8); |
| 162 | |
| 163 | if (my_a2 & VAR_80COL) |
| 164 | { |
| 165 | apple2_plot_text_character(bitmap, col * 14 + 0, row, 1, a2_videoram[address + 0x10000], |
| 166 | textgfx_data, textgfx_datalen, my_a2); |
| 167 | apple2_plot_text_character(bitmap, col * 14 + 7, row, 1, a2_videoram[address + 0x00000], |
| 168 | textgfx_data, textgfx_datalen, my_a2); |
| 169 | } |
| 170 | else |
| 171 | { |
| 172 | apple2_plot_text_character(bitmap, col * 14, row, 2, a2_videoram[address], |
| 173 | textgfx_data, textgfx_datalen, my_a2); |
| 174 | } |
| 175 | } |
| 176 | } |
| 146 | 177 | } |
| 147 | 178 | |
| 148 | | void apple2_set_fgcolor(int color) |
| 179 | |
| 180 | /*------------------------------------------------- |
| 181 | apple2_lores_draw - renders lo-res text |
| 182 | -------------------------------------------------*/ |
| 183 | |
| 184 | static void apple2_lores_draw(mame_bitmap *bitmap, const rectangle *cliprect, int page, int beginrow, int endrow) |
| 149 | 185 | { |
| 150 | | if (color != fgcolor) |
| 186 | int row, col, y, x; |
| 187 | UINT8 code; |
| 188 | UINT32 start_address = (page ? 0x0800 : 0x0400); |
| 189 | UINT32 address; |
| 190 | |
| 191 | /* perform adjustments */ |
| 192 | adjust_begin_and_end_row(cliprect, &beginrow, &endrow); |
| 193 | |
| 194 | for (row = beginrow; row <= endrow; row += 8) |
| 151 | 195 | { |
| 152 | | tilemap_mark_all_tiles_dirty(text_tilemap); |
| 153 | | tilemap_mark_all_tiles_dirty(dbltext_tilemap); |
| 154 | | fgcolor = color; |
| 196 | for (col = 0; col < 40; col++) |
| 197 | { |
| 198 | /* calculate adderss */ |
| 199 | address = start_address + compute_video_address(col, row / 8); |
| 200 | |
| 201 | /* perform the lookup */ |
| 202 | code = a2_videoram[address]; |
| 203 | |
| 204 | /* and now draw */ |
| 205 | for (y = 0; y < 4; y++) |
| 206 | { |
| 207 | for (x = 0; x < 14; x++) |
| 208 | *BITMAP_ADDR16(bitmap, row + y, col * 14 + x) = (code >> 0) & 0x0F; |
| 209 | } |
| 210 | for (y = 4; y < 8; y++) |
| 211 | { |
| 212 | for (x = 0; x < 14; x++) |
| 213 | *BITMAP_ADDR16(bitmap, row + y, col * 14 + x) = (code >> 0) & 0x0F; |
| 214 | } |
| 215 | } |
| 155 | 216 | } |
| 156 | 217 | } |
| 157 | 218 | |
| 219 | |
| 220 | /*------------------------------------------------- |
| 221 | apple2_set_fgcolor |
| 222 | -------------------------------------------------*/ |
| 223 | |
| 224 | void apple2_set_fgcolor(int color) |
| 225 | { |
| 226 | fgcolor = color; |
| 227 | } |
| 228 | |
| 229 | |
| 230 | /*------------------------------------------------- |
| 231 | apple2_set_bgcolor |
| 232 | -------------------------------------------------*/ |
| 233 | |
| 158 | 234 | void apple2_set_bgcolor(int color) |
| 159 | 235 | { |
| 160 | | if (color != bgcolor) |
| 161 | | { |
| 162 | | tilemap_mark_all_tiles_dirty(text_tilemap); |
| 163 | | tilemap_mark_all_tiles_dirty(dbltext_tilemap); |
| 164 | | bgcolor = color; |
| 165 | | } |
| 236 | bgcolor = color; |
| 166 | 237 | } |
| 167 | 238 | |
| 239 | |
| 240 | /*------------------------------------------------- |
| 241 | apple2_get_fgcolor |
| 242 | -------------------------------------------------*/ |
| 243 | |
| 168 | 244 | int apple2_get_fgcolor(void) |
| 169 | 245 | { |
| 170 | 246 | return fgcolor; |
| 171 | 247 | } |
| 172 | 248 | |
| 249 | |
| 250 | /*------------------------------------------------- |
| 251 | apple2_get_bgcolor |
| 252 | -------------------------------------------------*/ |
| 253 | |
| 173 | 254 | int apple2_get_bgcolor(void) |
| 174 | 255 | { |
| 175 | 256 | return bgcolor; |
| 176 | 257 | } |
| 177 | 258 | |
| 178 | | /*************************************************************************** |
| 179 | | low resolution graphics |
| 180 | | ***************************************************************************/ |
| 181 | 259 | |
| 182 | | static TILE_GET_INFO(apple2_lores_gettileinfo) |
| 183 | | { |
| 184 | | UINT32 ch = a2_videoram[lores_videobase + tile_index]; |
| 185 | | tileinfo->pen_data = lores_tiledata; |
| 186 | | tileinfo->palette_base = ch * 2; |
| 187 | | tileinfo->flags = 0; |
| 188 | | } |
| 189 | 260 | |
| 190 | | static void apple2_lores_draw(mame_bitmap *bitmap, const rectangle *cliprect, int page, int beginrow, int endrow) |
| 191 | | { |
| 192 | | apple2_draw_tilemap(bitmap, cliprect, beginrow, endrow, lores_tilemap, page ? 0x800 : 0x400, &lores_videobase); |
| 193 | | } |
| 194 | | |
| 195 | 261 | /*************************************************************************** |
| 196 | | high resolution graphics |
| 262 | HIGH RESOLUTION GRAPHICS |
| 197 | 263 | ***************************************************************************/ |
| 198 | 264 | |
| 199 | | static UINT32 apple2_hires_getmemoryoffset(UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows) |
| 200 | | { |
| 201 | | /* Special Apple II addressing. Gotta love it. */ |
| 202 | | return apple2_text_getmemoryoffset(col, row / 8, num_cols, num_rows) | ((row & 7) << 10); |
| 203 | | } |
| 204 | | |
| 205 | 265 | struct drawtask_params |
| 206 | 266 | { |
| 207 | 267 | mame_bitmap *bitmap; |
| r1762 | r1763 | |
| 241 | 301 | { |
| 242 | 302 | for (col = 0; col < 40; col++) |
| 243 | 303 | { |
| 244 | | offset = apple2_hires_getmemoryoffset(col, row, 0, 0); |
| 304 | offset = compute_video_address(col, row / 8); |
| 245 | 305 | |
| 246 | 306 | switch(columns) { |
| 247 | 307 | case 40: |
| r1762 | r1763 | |
| 314 | 374 | |
| 315 | 375 | |
| 316 | 376 | /*************************************************************************** |
| 317 | | video core |
| 377 | VIDEO CORE |
| 318 | 378 | ***************************************************************************/ |
| 319 | 379 | |
| 320 | 380 | void apple2_video_start(const UINT8 *vram, size_t vram_size, UINT32 ignored_softswitches, int hires_modulo) |
| r1762 | r1763 | |
| 344 | 404 | alt_charset_value = memory_region_length(REGION_GFX1) / 16; |
| 345 | 405 | a2_videoram = vram; |
| 346 | 406 | |
| 347 | | text_tilemap = tilemap_create( |
| 348 | | apple2_text_gettileinfo, |
| 349 | | apple2_text_getmemoryoffset, |
| 350 | | 7*2, 8, |
| 351 | | 40, 24); |
| 352 | | |
| 353 | | dbltext_tilemap = tilemap_create( |
| 354 | | apple2_dbltext_gettileinfo, |
| 355 | | apple2_dbltext_getmemoryoffset, |
| 356 | | 7, 8, |
| 357 | | 80, 24); |
| 358 | | |
| 359 | | lores_tilemap = tilemap_create( |
| 360 | | apple2_lores_gettileinfo, |
| 361 | | apple2_text_getmemoryoffset, |
| 362 | | 14, 8, |
| 363 | | 40, 24); |
| 364 | | |
| 365 | 407 | /* 2^3 dependent pixels * 2 color sets * 2 offsets */ |
| 366 | 408 | hires_artifact_map = auto_malloc(sizeof(UINT16) * 8 * 2 * 2); |
| 367 | 409 | |
| 368 | 410 | /* 2^4 dependent pixels */ |
| 369 | 411 | dhires_artifact_map = auto_malloc(sizeof(UINT16) * 16); |
| 370 | 412 | |
| 371 | | /* 14x8 */ |
| 372 | | lores_tiledata = auto_malloc(sizeof(UINT8) * 14 * 8); |
| 373 | | |
| 374 | | /* build lores_tiledata */ |
| 375 | | memset(lores_tiledata + 0*14, 1, 4*14); |
| 376 | | memset(lores_tiledata + 4*14, 0, 4*14); |
| 377 | | |
| 378 | 413 | /* build hires artifact map */ |
| 379 | 414 | for (i = 0; i < 8; i++) |
| 380 | 415 | { |
| r1762 | r1763 | |
| 406 | 441 | } |
| 407 | 442 | |
| 408 | 443 | memset(&old_a2, 0, sizeof(old_a2)); |
| 409 | | text_videobase = lores_videobase = 0; |
| 410 | 444 | a2_videomask = ~ignored_softswitches; |
| 411 | 445 | } |
| 412 | 446 | |
| r1762 | r1763 | |
| 441 | 475 | VIDEO_UPDATE( apple2 ) |
| 442 | 476 | { |
| 443 | 477 | int page; |
| 444 | | int new_flash; |
| 445 | 478 | UINT32 new_a2; |
| 446 | 479 | |
| 447 | | new_flash = (attotime_mul(timer_get_time(), 4).seconds & 1) ? 1 : 0; |
| 448 | | if (flash != new_flash) |
| 449 | | { |
| 450 | | flash = new_flash; |
| 451 | | tilemap_mark_all_tiles_dirty(text_tilemap); |
| 452 | | tilemap_mark_all_tiles_dirty(dbltext_tilemap); |
| 453 | | } |
| 480 | /* calculate the flash value */ |
| 481 | flash = (attotime_mul(timer_get_time(), 4).seconds & 1) ? 1 : 0; |
| 454 | 482 | |
| 455 | 483 | /* read out relevant softswitch variables; to see what has changed */ |
| 456 | 484 | new_a2 = effective_a2(); |
| r1762 | r1763 | |
| 461 | 489 | if (ALWAYS_REFRESH || (new_a2 != old_a2)) |
| 462 | 490 | { |
| 463 | 491 | old_a2 = new_a2; |
| 464 | | tilemap_mark_all_tiles_dirty(text_tilemap); |
| 465 | | tilemap_mark_all_tiles_dirty(dbltext_tilemap); |
| 466 | | tilemap_mark_all_tiles_dirty(lores_tilemap); |
| 467 | 492 | } |
| 468 | 493 | |
| 469 | 494 | /* choose which page to use */ |
| 470 | 495 | page = (new_a2 & VAR_PAGE2) ? 1 : 0; |
| 471 | 496 | |
| 497 | /* choose the video mode to draw */ |
| 472 | 498 | if (effective_a2() & VAR_TEXT) |
| 473 | 499 | { |
| 500 | /* text screen */ |
| 474 | 501 | apple2_text_draw(bitmap, cliprect, page, 0, 191); |
| 475 | 502 | } |
| 476 | 503 | else if ((effective_a2() & VAR_HIRES) && (effective_a2() & VAR_MIXED)) |
| 477 | 504 | { |
| 505 | /* hi-res on top; text at bottom */ |
| 478 | 506 | apple2_hires_draw(bitmap, cliprect, page, 0, 159); |
| 479 | 507 | apple2_text_draw(bitmap, cliprect, page, 160, 191); |
| 480 | 508 | } |
| 481 | 509 | else if (effective_a2() & VAR_HIRES) |
| 482 | 510 | { |
| 511 | /* hi-res screen */ |
| 483 | 512 | apple2_hires_draw(bitmap, cliprect, page, 0, 191); |
| 484 | 513 | } |
| 485 | 514 | else if (effective_a2() & VAR_MIXED) |
| 486 | 515 | { |
| 516 | /* lo-res on top; text at bottom */ |
| 487 | 517 | apple2_lores_draw(bitmap, cliprect, page, 0, 159); |
| 488 | 518 | apple2_text_draw(bitmap, cliprect, page, 160, 191); |
| 489 | 519 | } |
| 490 | 520 | else |
| 491 | 521 | { |
| 522 | /* lo-res screen */ |
| 492 | 523 | apple2_lores_draw(bitmap, cliprect, page, 0, 191); |
| 493 | 524 | } |
| 494 | 525 | return 0; |
| 495 | 526 | } |
| 496 | | |
| 497 | | void apple2_video_touch(offs_t offset) |
| 498 | | { |
| 499 | | profiler_mark(PROFILER_VIDEOTOUCH); |
| 500 | | if (offset >= text_videobase) |
| 501 | | tilemap_mark_tile_dirty(text_tilemap, offset - text_videobase); |
| 502 | | if (offset >= dbltext_videobase) |
| 503 | | tilemap_mark_tile_dirty(dbltext_tilemap, offset - dbltext_videobase); |
| 504 | | if (offset >= lores_videobase) |
| 505 | | tilemap_mark_tile_dirty(lores_tilemap, offset - text_videobase); |
| 506 | | profiler_mark(PROFILER_END); |
| 507 | | } |
src/mess/drivers/apple2.c
| r1762 | r1763 | |
| 526 | 526 | RGB_WHITE |
| 527 | 527 | }; |
| 528 | 528 | |
| 529 | | static const gfx_layout apple2_text_layout = |
| 530 | | { |
| 531 | | 14,8, /* 14*8 characters */ |
| 532 | | 256, /* 256 characters */ |
| 533 | | 1, /* 1 bits per pixel */ |
| 534 | | { 0 }, /* no bitplanes; 1 bit per pixel */ |
| 535 | | { 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7 }, /* x offsets */ |
| 536 | | { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, |
| 537 | | 8*8 /* every char takes 8 bytes */ |
| 538 | | }; |
| 539 | | |
| 540 | | static const gfx_layout apple2_dbltext_layout = |
| 541 | | { |
| 542 | | 7,8, /* 7*8 characters */ |
| 543 | | 256, /* 256 characters */ |
| 544 | | 1, /* 1 bits per pixel */ |
| 545 | | { 0 }, /* no bitplanes; 1 bit per pixel */ |
| 546 | | { 1, 2, 3, 4, 5, 6, 7 }, /* x offsets */ |
| 547 | | { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, |
| 548 | | 8*8 /* every char takes 8 bytes */ |
| 549 | | }; |
| 550 | | |
| 551 | | static GFXDECODE_START( apple2 ) |
| 552 | | GFXDECODE_ENTRY( REGION_GFX1, 0x0000, apple2_text_layout, 0, 2 ) |
| 553 | | GFXDECODE_ENTRY( REGION_GFX1, 0x0000, apple2_dbltext_layout, 0, 2 ) |
| 554 | | GFXDECODE_END |
| 555 | | |
| 556 | | static const gfx_layout apple2e_text_layout = |
| 557 | | { |
| 558 | | 14,8, /* 14*8 characters */ |
| 559 | | 1024, /* 256 characters */ |
| 560 | | 1, /* 1 bits per pixel */ |
| 561 | | { 0 }, /* no bitplanes; 1 bit per pixel */ |
| 562 | | { 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1 }, /* x offsets */ |
| 563 | | { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, |
| 564 | | 8*8 /* every char takes 8 bytes */ |
| 565 | | }; |
| 566 | | |
| 567 | | static const gfx_layout apple2e_dbltext_layout = |
| 568 | | { |
| 569 | | 7,8, /* 7*8 characters */ |
| 570 | | 1024, /* 256 characters */ |
| 571 | | 1, /* 1 bits per pixel */ |
| 572 | | { 0 }, /* no bitplanes; 1 bit per pixel */ |
| 573 | | { 7, 6, 5, 4, 3, 2, 1 }, /* x offsets */ |
| 574 | | { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, |
| 575 | | 8*8 /* every char takes 8 bytes */ |
| 576 | | }; |
| 577 | | |
| 578 | | static GFXDECODE_START( apple2e ) |
| 579 | | GFXDECODE_ENTRY( REGION_GFX1, 0x0000, apple2e_text_layout, 0, 2 ) |
| 580 | | GFXDECODE_ENTRY( REGION_GFX1, 0x0000, apple2e_dbltext_layout, 0, 2 ) |
| 581 | | GFXDECODE_END |
| 582 | | |
| 583 | | static const unsigned short apple2_colortable[] = |
| 584 | | { |
| 585 | | 0, 0, 0, 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, |
| 586 | | 0, 8, 0, 9, 0, 10, 0, 11, 0, 12, 0, 13, 0, 14, 0, 15, |
| 587 | | 1, 0, 1, 1, 1, 2, 1, 3, 1, 4, 1, 5, 1, 6, 1, 7, |
| 588 | | 1, 8, 1, 9, 1, 10, 1, 11, 1, 12, 1, 13, 1, 14, 1, 15, |
| 589 | | 2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 2, 5, 2, 6, 2, 7, |
| 590 | | 2, 8, 2, 9, 2, 10, 2, 11, 2, 12, 2, 13, 2, 14, 2, 15, |
| 591 | | 3, 0, 3, 1, 3, 2, 3, 3, 3, 4, 3, 5, 3, 6, 3, 7, |
| 592 | | 3, 8, 3, 9, 3, 10, 3, 11, 3, 12, 3, 13, 3, 14, 3, 15, |
| 593 | | 4, 0, 4, 1, 4, 2, 4, 3, 4, 4, 4, 5, 4, 6, 4, 7, |
| 594 | | 4, 8, 4, 9, 4, 10, 4, 11, 4, 12, 4, 13, 4, 14, 4, 15, |
| 595 | | 5, 0, 5, 1, 5, 2, 5, 3, 5, 4, 5, 5, 5, 6, 5, 7, |
| 596 | | 5, 8, 5, 9, 5, 10, 5, 11, 5, 12, 5, 13, 5, 14, 5, 15, |
| 597 | | 6, 0, 6, 1, 6, 2, 6, 3, 6, 4, 6, 5, 6, 6, 6, 7, |
| 598 | | 6, 8, 6, 9, 6, 10, 6, 11, 6, 12, 6, 13, 6, 14, 6, 15, |
| 599 | | 7, 0, 7, 1, 7, 2, 7, 3, 7, 4, 7, 5, 7, 6, 7, 7, |
| 600 | | 7, 8, 7, 9, 7, 10, 7, 11, 7, 12, 7, 13, 7, 14, 7, 15, |
| 601 | | 8, 0, 8, 1, 8, 2, 8, 3, 8, 4, 8, 5, 8, 6, 8, 7, |
| 602 | | 8, 8, 8, 9, 8, 10, 8, 11, 8, 12, 8, 13, 8, 14, 8, 15, |
| 603 | | 9, 0, 9, 1, 9, 2, 9, 3, 9, 4, 9, 5, 9, 6, 9, 7, |
| 604 | | 9, 8, 9, 9, 9, 10, 9, 11, 9, 12, 9, 13, 9, 14, 9, 15, |
| 605 | | 10, 0, 10, 1, 10, 2, 10, 3, 10, 4, 10, 5, 10, 6, 10, 7, |
| 606 | | 10, 8, 10, 9, 10, 10, 10, 11, 10, 12, 10, 13, 10, 14, 10, 15, |
| 607 | | 11, 0, 11, 1, 11, 2, 11, 3, 11, 4, 11, 5, 11, 6, 11, 7, |
| 608 | | 11, 8, 11, 9, 11, 10, 11, 11, 11, 12, 11, 13, 11, 14, 11, 15, |
| 609 | | 12, 0, 12, 1, 12, 2, 12, 3, 12, 4, 12, 5, 12, 6, 12, 7, |
| 610 | | 12, 8, 12, 9, 12, 10, 12, 11, 12, 12, 12, 13, 12, 14, 12, 15, |
| 611 | | 13, 0, 13, 1, 13, 2, 13, 3, 13, 4, 13, 5, 13, 6, 13, 7, |
| 612 | | 13, 8, 13, 9, 13, 10, 13, 11, 13, 12, 13, 13, 13, 14, 13, 15, |
| 613 | | 14, 0, 14, 1, 14, 2, 14, 3, 14, 4, 14, 5, 14, 6, 14, 7, |
| 614 | | 14, 8, 14, 9, 14, 10, 14, 11, 14, 12, 14, 13, 14, 14, 14, 15, |
| 615 | | 15, 0, 15, 1, 15, 2, 15, 3, 15, 4, 15, 5, 15, 6, 15, 7, |
| 616 | | 15, 8, 15, 9, 15, 10, 15, 11, 15, 12, 15, 13, 15, 14, 15, 15 |
| 617 | | }; |
| 618 | | |
| 619 | | |
| 620 | 529 | /* Initialize the palette */ |
| 621 | 530 | PALETTE_INIT( apple2 ) |
| 622 | 531 | { |
| r1762 | r1763 | |
| 663 | 572 | |
| 664 | 573 | static MACHINE_DRIVER_START( apple2 ) |
| 665 | 574 | MDRV_IMPORT_FROM( apple2_common ) |
| 666 | | MDRV_GFXDECODE(apple2) |
| 667 | 575 | MACHINE_DRIVER_END |
| 668 | 576 | |
| 669 | 577 | static MACHINE_DRIVER_START( apple2p ) |
| 670 | 578 | MDRV_IMPORT_FROM( apple2_common ) |
| 671 | 579 | MDRV_VIDEO_START(apple2p) |
| 672 | | MDRV_GFXDECODE(apple2) |
| 673 | 580 | MACHINE_DRIVER_END |
| 674 | 581 | |
| 675 | 582 | #ifdef UNUSED_FUNCTION |
| 676 | 583 | static MACHINE_DRIVER_START( ace100 ) |
| 677 | 584 | MDRV_IMPORT_FROM( apple2_common ) |
| 678 | 585 | MDRV_VIDEO_START(apple2p) |
| 679 | | MDRV_GFXDECODE(apple2) |
| 680 | 586 | MACHINE_DRIVER_END |
| 681 | 587 | #endif |
| 682 | 588 | |
| r1762 | r1763 | |
| 692 | 598 | MACHINE_DRIVER_START( apple2e ) |
| 693 | 599 | MDRV_IMPORT_FROM( apple2_common ) |
| 694 | 600 | MDRV_VIDEO_START(apple2e) |
| 695 | | MDRV_GFXDECODE(apple2e) |
| 696 | 601 | MACHINE_DRIVER_END |
| 697 | 602 | |
| 698 | 603 | static MACHINE_DRIVER_START( apple2ee ) |