src/mess/video/tms3556.c
| r1923 | r1924 | |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | 14 | #include "driver.h" |
| 15 | | #include "deprecat.h" |
| 16 | 15 | #include "tms3556.h" |
| 17 | 16 | |
| 18 | 17 | static struct |
| r1923 | r1924 | |
| 308 | 307 | draw a line of text (called by tms3556_draw_line_text and |
| 309 | 308 | tms3556_draw_line_mixed) |
| 310 | 309 | */ |
| 311 | | static void tms3556_draw_line_text_common(UINT16 *ln) |
| 310 | static void tms3556_draw_line_text_common(running_machine *machine, UINT16 *ln) |
| 312 | 311 | { |
| 313 | 312 | int pattern, x, xx, i, name_offset; |
| 314 | 313 | UINT16 fg, bg; |
| r1923 | r1924 | |
| 336 | 335 | name_lo = nametbl[name_offset+1]; |
| 337 | 336 | pattern_ix = ((name_hi >> 2) & 2) | ((name_hi >> 4) & 1); |
| 338 | 337 | alphanumeric_mode = (pattern_ix < 2) || ((pattern_ix == 3) && !(vdp.controlRegs[7] & 0x08)); |
| 339 | | fg = Machine->pens[(name_hi >> 5) & 0x7]; |
| 338 | fg = machine->pens[(name_hi >> 5) & 0x7]; |
| 340 | 339 | if (alphanumeric_mode) |
| 341 | 340 | { |
| 342 | 341 | if (name_hi & 4) |
| r1923 | r1924 | |
| 422 | 421 | draw a line of bitmap (called by tms3556_draw_line_bitmap and |
| 423 | 422 | tms3556_draw_line_mixed) |
| 424 | 423 | */ |
| 425 | | static void tms3556_draw_line_bitmap_common(UINT16 *ln) |
| 424 | static void tms3556_draw_line_bitmap_common(running_machine *machine, UINT16 *ln) |
| 426 | 425 | { |
| 427 | 426 | int x, xx; |
| 428 | 427 | UINT8 *nametbl; |
| r1923 | r1924 | |
| 444 | 443 | name_r = nametbl[vdp.name_offset+2]; |
| 445 | 444 | for (xx=0;xx<8;xx++) |
| 446 | 445 | { |
| 447 | | UINT16 color = Machine->pens[((name_b >> 5) & 0x4) | ((name_g >> 6) & 0x2) | ((name_r >> 7) & 0x1)]; |
| 446 | UINT16 color = machine->pens[((name_b >> 5) & 0x4) | ((name_g >> 6) & 0x2) | ((name_r >> 7) & 0x1)]; |
| 448 | 447 | #if DOUBLE_WIDTH |
| 449 | 448 | *ln++ = color; |
| 450 | 449 | #endif |
| r1923 | r1924 | |
| 468 | 467 | |
| 469 | 468 | draw a line in text mode |
| 470 | 469 | */ |
| 471 | | static void tms3556_draw_line_text(UINT16 *ln) |
| 470 | static void tms3556_draw_line_text(running_machine *machine, UINT16 *ln) |
| 472 | 471 | { |
| 473 | 472 | if (vdp.char_line_counter == 0) |
| 474 | 473 | vdp.char_line_counter = 10; |
| 475 | 474 | vdp.char_line_counter--; |
| 476 | | tms3556_draw_line_text_common(ln); |
| 475 | tms3556_draw_line_text_common(machine, ln); |
| 477 | 476 | } |
| 478 | 477 | |
| 479 | 478 | /* |
| r1923 | r1924 | |
| 481 | 480 | |
| 482 | 481 | draw a line in bitmap mode |
| 483 | 482 | */ |
| 484 | | static void tms3556_draw_line_bitmap(UINT16 *ln) |
| 483 | static void tms3556_draw_line_bitmap(running_machine *machine, UINT16 *ln) |
| 485 | 484 | { |
| 486 | 485 | UINT8 *nametbl; |
| 487 | 486 | |
| 488 | 487 | |
| 489 | | tms3556_draw_line_bitmap_common(ln); |
| 488 | tms3556_draw_line_bitmap_common(machine, ln); |
| 490 | 489 | nametbl = vdp.vram + vdp.addressRegs[2]; |
| 491 | | vdp.bg_color = Machine->pens[(nametbl[vdp.name_offset] >> 5) & 0x7]; |
| 490 | vdp.bg_color = machine->pens[(nametbl[vdp.name_offset] >> 5) & 0x7]; |
| 492 | 491 | vdp.name_offset += 2; |
| 493 | 492 | } |
| 494 | 493 | |
| r1923 | r1924 | |
| 497 | 496 | |
| 498 | 497 | draw a line in mixed mode |
| 499 | 498 | */ |
| 500 | | static void tms3556_draw_line_mixed(UINT16 *ln) |
| 499 | static void tms3556_draw_line_mixed(running_machine *machine, UINT16 *ln) |
| 501 | 500 | { |
| 502 | 501 | UINT8 *nametbl; |
| 503 | 502 | |
| 504 | 503 | |
| 505 | 504 | if (vdp.cg_flag) |
| 506 | 505 | { /* bitmap line */ |
| 507 | | tms3556_draw_line_bitmap_common(ln); |
| 506 | tms3556_draw_line_bitmap_common(machine, ln); |
| 508 | 507 | nametbl = vdp.vram + vdp.addressRegs[2]; |
| 509 | | vdp.bg_color = Machine->pens[(nametbl[vdp.name_offset] >> 5) & 0x7]; |
| 508 | vdp.bg_color = machine->pens[(nametbl[vdp.name_offset] >> 5) & 0x7]; |
| 510 | 509 | vdp.cg_flag = (nametbl[vdp.name_offset] >> 4) & 0x1; |
| 511 | 510 | vdp.name_offset += 2; |
| 512 | 511 | } |
| r1923 | r1924 | |
| 515 | 514 | if (vdp.char_line_counter == 0) |
| 516 | 515 | vdp.char_line_counter = 10; |
| 517 | 516 | vdp.char_line_counter--; |
| 518 | | tms3556_draw_line_text_common(ln); |
| 517 | tms3556_draw_line_text_common(machine, ln); |
| 519 | 518 | if (vdp.char_line_counter == 0) |
| 520 | 519 | { |
| 521 | 520 | nametbl = vdp.vram + vdp.addressRegs[2]; |
| 522 | | vdp.bg_color = Machine->pens[(nametbl[vdp.name_offset] >> 5) & 0x7]; |
| 521 | vdp.bg_color = machine->pens[(nametbl[vdp.name_offset] >> 5) & 0x7]; |
| 523 | 522 | vdp.cg_flag = (nametbl[vdp.name_offset] >> 4) & 0x1; |
| 524 | 523 | vdp.name_offset += 2; |
| 525 | 524 | } |
| r1923 | r1924 | |
| 531 | 530 | |
| 532 | 531 | draw a line. If non-interlaced mode, duplicate the line. |
| 533 | 532 | */ |
| 534 | | static void tms3556_draw_line(bitmap_t *bmp, int line) |
| 533 | static void tms3556_draw_line(running_machine *machine, bitmap_t *bmp, int line) |
| 535 | 534 | { |
| 536 | 535 | int double_lines; |
| 537 | 536 | UINT16 *ln, *ln2 = NULL; |
| r1923 | r1924 | |
| 561 | 560 | tms3556_draw_line_empty(ln); |
| 562 | 561 | break; |
| 563 | 562 | case TMS3556_MODE_TEXT: |
| 564 | | tms3556_draw_line_text(ln); |
| 563 | tms3556_draw_line_text(machine, ln); |
| 565 | 564 | break; |
| 566 | 565 | case TMS3556_MODE_BITMAP: |
| 567 | | tms3556_draw_line_bitmap(ln); |
| 566 | tms3556_draw_line_bitmap(machine, ln); |
| 568 | 567 | break; |
| 569 | 568 | case TMS3556_MODE_MIXED: |
| 570 | | tms3556_draw_line_mixed(ln); |
| 569 | tms3556_draw_line_mixed(machine, ln); |
| 571 | 570 | break; |
| 572 | 571 | } |
| 573 | 572 | } |
| r1923 | r1924 | |
| 582 | 581 | |
| 583 | 582 | Do vblank-time tasks |
| 584 | 583 | */ |
| 585 | | static void tms3556_interrupt_start_vblank(void) |
| 584 | static void tms3556_interrupt_start_vblank(running_machine *machine) |
| 586 | 585 | { |
| 587 | 586 | int i; |
| 588 | 587 | |
| r1923 | r1924 | |
| 599 | 598 | vdp.blink_count = 60; /*no idea what the real value is*/ |
| 600 | 599 | } |
| 601 | 600 | /* reset background color */ |
| 602 | | vdp.bg_color = Machine->pens[(vdp.controlRegs[7] >> 5) & 0x7]; |
| 601 | vdp.bg_color = machine->pens[(vdp.controlRegs[7] >> 5) & 0x7]; |
| 603 | 602 | /* reset name offset */ |
| 604 | 603 | vdp.name_offset = 0; |
| 605 | 604 | /* reset character line counter */ |
| r1923 | r1924 | |
| 616 | 615 | |
| 617 | 616 | scanline handler |
| 618 | 617 | */ |
| 619 | | void tms3556_interrupt(void) |
| 618 | void tms3556_interrupt(running_machine *machine) |
| 620 | 619 | { |
| 621 | 620 | /* check for start of vblank */ |
| 622 | 621 | if (vdp.scanline == 310) /*no idea what the real value is*/ |
| 623 | | tms3556_interrupt_start_vblank(); |
| 622 | tms3556_interrupt_start_vblank( machine ); |
| 624 | 623 | |
| 625 | 624 | /* render the current line */ |
| 626 | 625 | if ((vdp.scanline >= 0) && (vdp.scanline < TOTAL_HEIGHT)) |
| 627 | 626 | { |
| 628 | 627 | //if (!video_skip_this_frame()) |
| 629 | | tms3556_draw_line(tmpbitmap, vdp.scanline); |
| 628 | tms3556_draw_line(machine, tmpbitmap, vdp.scanline); |
| 630 | 629 | } |
| 631 | 630 | |
| 632 | 631 | if (++vdp.scanline == 313) |