src/mame/video/jagobj.c
| r5540 | r5541 | |
| 80 | 80 | { |
| 81 | 81 | if (firstpix & 7) |
| 82 | 82 | { |
| 83 | | UINT32 pixsrc = src[firstpix / 8]; |
| 83 | UINT32 pixsrc = src[firstpix >> 3]; |
| 84 | 84 | while (firstpix & 7) |
| 85 | 85 | { |
| 86 | | int pix = (pixsrc >> (4 * (~firstpix & 7))) & 0x0f; |
| 86 | int pix = (pixsrc >> ((~firstpix & 7) << 2)) & 0x0f; |
| 87 | 87 | if ((!(flags & 4) || pix) && (UINT32)xpos < 760) |
| 88 | 88 | { |
| 89 | 89 | if (!(flags & 2)) |
| r5540 | r5541 | |
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | | firstpix /= 8; |
| 100 | | iwidth /= 8; |
| 99 | firstpix >>= 3; |
| 100 | iwidth >>= 3; |
| 101 | 101 | iwidth -= firstpix; |
| 102 | 102 | |
| 103 | 103 | while (iwidth-- > 0) |
| r5540 | r5541 | |
| 178 | 178 | xpos += dxpos; |
| 179 | 179 | } |
| 180 | 180 | else |
| 181 | | xpos += 8 * dxpos; |
| 181 | xpos += dxpos << 3; |
| 182 | 182 | } |
| 183 | 183 | } |
| 184 | 184 | |
| r5540 | r5541 | |
| 246 | 246 | { |
| 247 | 247 | if (firstpix & 3) |
| 248 | 248 | { |
| 249 | | UINT32 pixsrc = src[firstpix / 4]; |
| 249 | UINT32 pixsrc = src[firstpix >> 2]; |
| 250 | 250 | while (firstpix & 3) |
| 251 | 251 | { |
| 252 | | UINT8 pix = pixsrc >> (8 * (~firstpix & 3)); |
| 252 | UINT8 pix = pixsrc >> ((~firstpix & 3) << 3); |
| 253 | 253 | if ((!(flags & 4) || pix) && (UINT32)xpos < 760) |
| 254 | 254 | { |
| 255 | 255 | if (!(flags & 2)) |
| r5540 | r5541 | |
| 262 | 262 | } |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | | firstpix /= 4; |
| 266 | | iwidth /= 4; |
| 265 | firstpix >>= 2; |
| 266 | iwidth >>= 2; |
| 267 | 267 | iwidth -= firstpix; |
| 268 | 268 | |
| 269 | 269 | while (iwidth-- > 0) |
| r5540 | r5541 | |
| 308 | 308 | xpos += dxpos; |
| 309 | 309 | } |
| 310 | 310 | else |
| 311 | | xpos += 4 * dxpos; |
| 311 | xpos += dxpos << 2; |
| 312 | 312 | } |
| 313 | 313 | } |
| 314 | 314 | |
| r5540 | r5541 | |
| 376 | 376 | { |
| 377 | 377 | if (firstpix & 1) |
| 378 | 378 | { |
| 379 | | UINT16 pix = src[firstpix / 2]; |
| 379 | UINT16 pix = src[firstpix >> 1]; |
| 380 | 380 | if ((!(flags & 4) || pix) && (UINT32)xpos < 760) |
| 381 | 381 | { |
| 382 | 382 | if (!(flags & 2)) |
| r5540 | r5541 | |
| 387 | 387 | xpos += dxpos; |
| 388 | 388 | } |
| 389 | 389 | |
| 390 | | firstpix /= 2; |
| 391 | | iwidth /= 2; |
| 390 | firstpix >>= 1; |
| 391 | iwidth >>= 1; |
| 392 | 392 | iwidth -= firstpix; |
| 393 | 393 | |
| 394 | 394 | while (iwidth-- > 0) |
| r5540 | r5541 | |
| 415 | 415 | xpos += dxpos; |
| 416 | 416 | } |
| 417 | 417 | else |
| 418 | | xpos += 2 * dxpos; |
| 418 | xpos += dxpos << 1; |
| 419 | 419 | } |
| 420 | 420 | } |
| 421 | 421 | |
| r5540 | r5541 | |
| 473 | 473 | |
| 474 | 474 | |
| 475 | 475 | |
| 476 | |
| 477 | |
| 478 | /************************************* |
| 479 | * |
| 480 | * 32bpp bitmap renderers - needs to be verified |
| 481 | * |
| 482 | *************************************/ |
| 483 | |
| 484 | INLINE void bitmap_32_draw(INT32 firstpix, INT32 iwidth, UINT32 *src, INT32 xpos, UINT8 flags, INT32 dxpos) |
| 485 | { |
| 486 | iwidth -= firstpix; |
| 487 | |
| 488 | while (iwidth-- > 0) |
| 489 | { |
| 490 | UINT32 pix = src[firstpix++]; |
| 491 | |
| 492 | if (xpos < 760) |
| 493 | { |
| 494 | scanline[xpos++] = (pix&0xffff0000)>>16; |
| 495 | scanline[xpos++] = pix&0xffff; |
| 496 | } |
| 497 | } |
| 498 | } |
| 499 | |
| 500 | static void bitmap_32_0(INT32 firstpix, INT32 iwidth, UINT32 *src, INT32 xpos) |
| 501 | { |
| 502 | bitmap_32_draw(firstpix, iwidth, src, xpos, 0, 1); |
| 503 | } |
| 504 | |
| 505 | static void bitmap_32_1(INT32 firstpix, INT32 iwidth, UINT32 *src, INT32 xpos) |
| 506 | { |
| 507 | bitmap_32_draw(firstpix, iwidth, src, xpos, 1, -1); |
| 508 | } |
| 509 | |
| 510 | static void bitmap_32_2(INT32 firstpix, INT32 iwidth, UINT32 *src, INT32 xpos) |
| 511 | { |
| 512 | bitmap_32_draw(firstpix, iwidth, src, xpos, 2, 1); |
| 513 | } |
| 514 | |
| 515 | static void bitmap_32_3(INT32 firstpix, INT32 iwidth, UINT32 *src, INT32 xpos) |
| 516 | { |
| 517 | bitmap_32_draw(firstpix, iwidth, src, xpos, 3, -1); |
| 518 | } |
| 519 | |
| 520 | static void bitmap_32_4(INT32 firstpix, INT32 iwidth, UINT32 *src, INT32 xpos) |
| 521 | { |
| 522 | bitmap_32_draw(firstpix, iwidth, src, xpos, 4, 1); |
| 523 | } |
| 524 | |
| 525 | static void bitmap_32_5(INT32 firstpix, INT32 iwidth, UINT32 *src, INT32 xpos) |
| 526 | { |
| 527 | bitmap_32_draw(firstpix, iwidth, src, xpos, 5, -1); |
| 528 | } |
| 529 | |
| 530 | static void bitmap_32_6(INT32 firstpix, INT32 iwidth, UINT32 *src, INT32 xpos) |
| 531 | { |
| 532 | bitmap_32_draw(firstpix, iwidth, src, xpos, 6, 1); |
| 533 | } |
| 534 | |
| 535 | static void bitmap_32_7(INT32 firstpix, INT32 iwidth, UINT32 *src, INT32 xpos) |
| 536 | { |
| 537 | bitmap_32_draw(firstpix, iwidth, src, xpos, 7, -1); |
| 538 | } |
| 539 | |
| 540 | static void (*const bitmap32[8])(INT32, INT32, UINT32 *, INT32) = |
| 541 | { |
| 542 | bitmap_32_0, |
| 543 | bitmap_32_1, |
| 544 | bitmap_32_2, |
| 545 | bitmap_32_3, |
| 546 | bitmap_32_4, |
| 547 | bitmap_32_5, |
| 548 | bitmap_32_6, |
| 549 | bitmap_32_7 |
| 550 | }; |
| 551 | |
| 552 | |
| 553 | |
| 476 | 554 | INLINE UINT8 lookup_pixel(const UINT32 *src, int i, int pitch, int depth) |
| 477 | 555 | { |
| 478 | | int ppl = 32 / depth; |
| 479 | | UINT32 data = src[((i & ppl) / ppl) + ((i / (ppl*2)) * 2 * pitch)]; |
| 480 | | UINT8 pix = (data >> ((~i & (ppl-1)) * depth)) & ((1 << depth) - 1); |
| 556 | int ppl = 32 / depth; |
| 557 | UINT32 data = src[((i & ppl) / ppl) + ((i / (ppl<<1)) * (pitch<<1))]; |
| 558 | UINT8 pix = (data >> ((~i & (ppl-1)) * depth)) & ((1 << depth) - 1); |
| 481 | 559 | return pix; |
| 482 | 560 | } |
| 483 | 561 | |
| r5540 | r5541 | |
| 534 | 612 | UINT32 dwidth = (lower2 >> 18) & 0x3ff; |
| 535 | 613 | UINT32 iwidth = ((lower2 >> 28) | ((upper2 & 0x3f) << 4)) << (6 - depthlog); |
| 536 | 614 | UINT8 _index = (upper2 >> 5) & 0xfe; |
| 537 | | UINT8 flags = (upper2 >> 13) & 0x0f; |
| 538 | | UINT8 firstpix = ((upper2 >> 17) & 0x1f) >> depthlog; |
| 615 | UINT8 flags = (upper2 >> 13) & 0x07; |
| 616 | UINT8 firstpix = ((upper2 >> 17) & 0x3f) >> depthlog; |
| 539 | 617 | int i, dxpos = (flags & 1) ? -1 : 1; |
| 540 | 618 | |
| 541 | 619 | /* preadjust for firstpix */ |
| r5540 | r5541 | |
| 547 | 625 | /* 1bpp case */ |
| 548 | 626 | case 0: |
| 549 | 627 | { |
| 550 | | UINT16 *clut = (UINT16 *)jaguar_gpu_clut; |
| 551 | | clut += _index & 0xfe; |
| 628 | UINT16 *clut = (UINT16 *)jaguar_gpu_clut + _index; |
| 552 | 629 | |
| 553 | 630 | /* non-blending */ |
| 554 | 631 | if (!(flags & 2)) |
| r5540 | r5541 | |
| 581 | 658 | /* 2bpp case */ |
| 582 | 659 | case 1: |
| 583 | 660 | { |
| 584 | | UINT16 *clut = (UINT16 *)jaguar_gpu_clut; |
| 585 | | clut += _index & 0xfc; |
| 661 | UINT16 *clut = (UINT16 *)jaguar_gpu_clut + (_index & 0xfc); |
| 586 | 662 | |
| 587 | 663 | /* non-blending */ |
| 588 | 664 | if (!(flags & 2)) |
| r5540 | r5541 | |
| 618 | 694 | if (pitch != 1) |
| 619 | 695 | logerror("Unhandled pitch = %d\n", pitch); |
| 620 | 696 | |
| 621 | | clutbase = (UINT16 *)jaguar_gpu_clut + (_index & 0xf0); |
| 622 | | (*bitmap4[flags & 7])(firstpix, iwidth, src, xpos); |
| 697 | clutbase = (UINT16 *)jaguar_gpu_clut + (_index & 0xf8); |
| 698 | (*bitmap4[flags])(firstpix, iwidth, src, xpos); |
| 623 | 699 | break; |
| 624 | 700 | |
| 625 | 701 | /* 8bpp case */ |
| r5540 | r5541 | |
| 629 | 705 | logerror("Unhandled pitch = %d\n", pitch); |
| 630 | 706 | |
| 631 | 707 | clutbase = (UINT16 *)jaguar_gpu_clut; |
| 632 | | (*bitmap8[flags & 7])(firstpix, iwidth, src, xpos); |
| 708 | (*bitmap8[flags])(firstpix, iwidth, src, xpos); |
| 633 | 709 | break; |
| 634 | 710 | |
| 635 | 711 | /* 16bpp case */ |
| r5540 | r5541 | |
| 638 | 714 | if (pitch != 1) |
| 639 | 715 | logerror("Unhandled pitch = %d\n", pitch); |
| 640 | 716 | |
| 641 | | (*bitmap16[flags & 7])(firstpix, iwidth, src, xpos); |
| 717 | (*bitmap16[flags])(firstpix, iwidth, src, xpos); |
| 642 | 718 | break; |
| 643 | 719 | |
| 720 | /* 32bpp case */ |
| 721 | case 5: |
| 722 | /* only handle pitch=1 for now */ |
| 723 | if (pitch != 1) |
| 724 | logerror("Unhandled pitch = %d\n", pitch); |
| 725 | |
| 726 | (*bitmap32[flags])(firstpix, iwidth, src, xpos); |
| 727 | break; |
| 728 | |
| 644 | 729 | default: |
| 645 | 730 | fprintf(stderr, "Unhandled bitmap source depth = %d\n", depthlog); |
| 646 | 731 | break; |
| r5540 | r5541 | |
| 715 | 800 | UINT32 dwidth = (lower2 >> 18) & 0x3ff; |
| 716 | 801 | INT32 iwidth = ((lower2 >> 28) | ((upper2 & 0x3f) << 4)) << (6 - depthlog); |
| 717 | 802 | UINT8 _index = (upper2 >> 5) & 0xfe; |
| 718 | | UINT8 flags = (upper2 >> 13) & 0x0f; |
| 719 | | UINT8 firstpix = ((upper2 >> 17) & 0x1f) >> depthlog; |
| 803 | UINT8 flags = (upper2 >> 13) & 0x07; |
| 804 | UINT8 firstpix = ((upper2 >> 17) & 0x3f) >> depthlog; |
| 720 | 805 | |
| 721 | 806 | INT32 hscale = lower3 & 0xff; |
| 722 | 807 | INT32 vscale = (lower3 >> 8) & 0xff; |
| r5540 | r5541 | |
| 724 | 809 | int dxpos = (flags & 1) ? -1 : 1; |
| 725 | 810 | int xpix = firstpix, yinc; |
| 726 | 811 | |
| 727 | | /* only handle pitch=0 for now */ |
| 812 | /* only handle pitch=1 (sequential data) for now */ |
| 728 | 813 | if (pitch != 1) |
| 729 | 814 | logerror("Unhandled pitch = %d\n", pitch); |
| 730 | 815 | if (flags & 2) |
| r5540 | r5541 | |
| 742 | 827 | /* switch off the depth */ |
| 743 | 828 | switch (depthlog) |
| 744 | 829 | { |
| 830 | case 0: |
| 831 | { |
| 832 | UINT16 *clut = (UINT16 *)jaguar_gpu_clut + _index; |
| 833 | |
| 834 | /* render in phrases */ |
| 835 | while (xpix < iwidth) |
| 836 | { |
| 837 | UINT16 pix = (src[xpix >> 5] >> (~xpix & 31)) & 0x01; |
| 838 | |
| 839 | while (xleft > 0) |
| 840 | { |
| 841 | if (xpos >= 0 && xpos < 760 && (pix || !(flags & 4))) |
| 842 | scanline[xpos] = clut[BYTE_XOR_BE(pix)]; |
| 843 | xpos += dxpos; |
| 844 | xleft -= 0x20; |
| 845 | } |
| 846 | while (xleft <= 0) |
| 847 | xleft += hscale, xpix++; |
| 848 | } |
| 849 | break; |
| 850 | } |
| 851 | |
| 852 | case 1: |
| 853 | { |
| 854 | UINT16 *clut = (UINT16 *)jaguar_gpu_clut + (_index & 0xfc); |
| 855 | |
| 856 | /* render in phrases */ |
| 857 | while (xpix < iwidth) |
| 858 | { |
| 859 | UINT16 pix = (src[xpix >> 4] >> ((~xpix & 15) << 1)) & 0x03; |
| 860 | |
| 861 | while (xleft > 0) |
| 862 | { |
| 863 | if (xpos >= 0 && xpos < 760 && (pix || !(flags & 4))) |
| 864 | scanline[xpos] = clut[BYTE_XOR_BE(pix)]; |
| 865 | xpos += dxpos; |
| 866 | xleft -= 0x20; |
| 867 | } |
| 868 | while (xleft <= 0) |
| 869 | xleft += hscale, xpix++; |
| 870 | } |
| 871 | break; |
| 872 | } |
| 873 | |
| 745 | 874 | case 2: |
| 746 | 875 | { |
| 747 | | UINT16 *clut = (UINT16 *)jaguar_gpu_clut; |
| 748 | | clut += _index & 0xf0; |
| 876 | UINT16 *clut = (UINT16 *)jaguar_gpu_clut + (_index & 0xf8); |
| 749 | 877 | |
| 750 | 878 | /* render in phrases */ |
| 751 | 879 | while (xpix < iwidth) |
| 752 | 880 | { |
| 753 | | UINT16 pix = (src[xpix / 8] >> ((~xpix & 7) * 4)) & 0x0f; |
| 881 | UINT16 pix = (src[xpix >> 3] >> ((~xpix & 7) << 2)) & 0x0f; |
| 754 | 882 | |
| 755 | 883 | while (xleft > 0) |
| 756 | 884 | { |
| r5540 | r5541 | |
| 772 | 900 | /* render in phrases */ |
| 773 | 901 | while (xpix < iwidth) |
| 774 | 902 | { |
| 775 | | UINT16 pix = (src[xpix / 4] >> ((~xpix & 3) * 8)) & 0xff; |
| 903 | UINT16 pix = (src[xpix >> 2] >> ((~xpix & 3) << 3)) & 0xff; |
| 776 | 904 | |
| 777 | 905 | while (xleft > 0) |
| 778 | 906 | { |
| r5540 | r5541 | |
| 790 | 918 | case 4: |
| 791 | 919 | while (xpix < iwidth) |
| 792 | 920 | { |
| 793 | | UINT16 pix = src[xpix / 2] >> ((~xpix & 1) * 16); |
| 921 | UINT16 pix = src[xpix >> 1] >> ((~xpix & 1) << 4); |
| 794 | 922 | |
| 795 | 923 | while (xleft > 0) |
| 796 | 924 | { |
| r5540 | r5541 | |
| 831 | 959 | |
| 832 | 960 | /************************************* |
| 833 | 961 | * |
| 834 | | * Brach object processor |
| 962 | * Branch object processor |
| 835 | 963 | * |
| 836 | 964 | *************************************/ |
| 837 | 965 | |
| r5540 | r5541 | |
| 937 | 1065 | |
| 938 | 1066 | /* GPU interrupt */ |
| 939 | 1067 | case 2: |
| 940 | | gpu_regs[OB_HH]=objdata[1]; |
| 941 | | gpu_regs[OB_HL]=objdata[2]; |
| 942 | | gpu_regs[OB_LH]=objdata[3]; |
| 943 | | gpu_regs[OB_LL]=objdata[4]; |
| 1068 | gpu_regs[OB_HH]=(objdata[1]&0xffff0000)>>16; |
| 1069 | gpu_regs[OB_HL]=objdata[1]&0xffff; |
| 1070 | gpu_regs[OB_LH]=(objdata[0]&0xffff0000)>>16; |
| 1071 | gpu_regs[OB_LL]=objdata[0]&0xffff; |
| 944 | 1072 | cpu_irq_state |= 2; |
| 945 | 1073 | update_cpu_irq(machine); |
| 946 | 1074 | done=1; |
src/mame/video/jaguar.c
| r5540 | r5541 | |
| 424 | 424 | { |
| 425 | 425 | /* YCC full */ |
| 426 | 426 | case 0x000: |
| 427 | /* RGB24 */ |
| 428 | case 0x002: |
| 427 | 429 | for (i = 0; i < 65536; i++) |
| 428 | 430 | { |
| 429 | 431 | UINT8 r = (red_lookup[i >> 8] * (i & 0xff)) >> 8; |
| r5540 | r5541 | |
| 465 | 467 | /* others */ |
| 466 | 468 | default: |
| 467 | 469 | logerror("Can't handle mode %X\n", vmode); |
| 470 | fprintf(stderr, "Can't handle mode %X\n", vmode); |
| 468 | 471 | break; |
| 469 | 472 | } |
| 470 | 473 | } |
| r5540 | r5541 | |
| 595 | 598 | switch (offset) |
| 596 | 599 | { |
| 597 | 600 | case B_CMD: /* B_CMD */ |
| 598 | | return 0x00000001; |
| 601 | return 1; |
| 599 | 602 | |
| 600 | 603 | default: |
| 601 | 604 | logerror("%08X:Blitter read register @ F022%02X\n", cpu_get_previouspc(space->cpu), offset * 4); |
| r5540 | r5541 | |
| 643 | 646 | return gpu_regs[offset]; |
| 644 | 647 | } |
| 645 | 648 | |
| 649 | #if 0 |
| 650 | static TIMER_CALLBACK( jaguar_pit ) |
| 651 | { |
| 652 | attotime sample_period; |
| 653 | cpu_irq_state |= 4; |
| 654 | update_cpu_irq(machine); |
| 646 | 655 | |
| 656 | if (gpu_regs[PIT0]) |
| 657 | { |
| 658 | sample_period = ATTOTIME_IN_NSEC(cpu_get_clock(cputag_get_cpu(machine,"gpu")) / (1+gpu_regs[PIT0]) / (1+gpu_regs[PIT1])); |
| 659 | // timer_set(machine, sample_period, NULL, 0, jaguar_pit); |
| 660 | } |
| 661 | } |
| 662 | #endif |
| 663 | |
| 647 | 664 | WRITE16_HANDLER( jaguar_tom_regs_w ) |
| 648 | 665 | { |
| 649 | 666 | UINT32 reg_store = gpu_regs[offset]; |
| 650 | | |
| 667 | attotime sample_period; |
| 651 | 668 | if (offset < GPU_REGS) |
| 652 | 669 | { |
| 653 | 670 | COMBINE_DATA(&gpu_regs[offset]); |
| 654 | 671 | |
| 655 | 672 | switch (offset) |
| 656 | 673 | { |
| 674 | |
| 675 | #if 0 case PIT1: |
| 676 | if (gpu_regs[PIT0]) |
| 677 | { |
| 678 | sample_period = ATTOTIME_IN_NSEC(cpu_get_clock(cputag_get_cpu(space->machine,"gpu")) / (1+gpu_regs[PIT0]) / (1+gpu_regs[PIT1])); |
| 679 | timer_set(space->machine, sample_period, NULL, 0, jaguar_pit); |
| 680 | } |
| 681 | break; |
| 682 | #endif |
| 657 | 683 | case INT1: |
| 658 | 684 | cpu_irq_state &= ~(gpu_regs[INT1] >> 8); |
| 659 | 685 | update_cpu_irq(space->machine); |
| r5540 | r5541 | |
| 687 | 713 | int hbend = effective_hvalue(ENABLE_BORDERS ? gpu_regs[HBE] : MIN(gpu_regs[HDB1], gpu_regs[HDB2])); |
| 688 | 714 | int hbstart = effective_hvalue(gpu_regs[ENABLE_BORDERS ? HBB : HDE]); |
| 689 | 715 | int vperiod = (gpu_regs[VP] & 0x7ff) + 1; |
| 690 | | int vbend = gpu_regs[VBE] & 0x7ff; |
| 716 | int vbend = MAX(gpu_regs[VBE],gpu_regs[VDB]) & 0x7ff; |
| 691 | 717 | int vbstart = gpu_regs[VBB] & 0x7ff; |
| 692 | 718 | |
| 693 | 719 | /* adjust for the half-lines */ |
| r5540 | r5541 | |
| 774 | 800 | /* only run if video is enabled and we are past the "display begin" */ |
| 775 | 801 | if ((gpu_regs[VMODE] & 1) && vc >= (gpu_regs[VDB] & 0x7ff)) |
| 776 | 802 | { |
| 777 | | UINT32 *dest = BITMAP_ADDR32(screen_bitmap, vc / 2, 0); |
| 803 | UINT32 *dest = BITMAP_ADDR32(screen_bitmap, vc >> 1, 0); |
| 778 | 804 | int maxx = visarea->max_x; |
| 779 | | int hde = effective_hvalue(gpu_regs[HDE]) / 2; |
| 805 | int hde = effective_hvalue(gpu_regs[HDE]) >> 1; |
| 780 | 806 | UINT16 x,scanline[760]; |
| 781 | 807 | UINT8 y,pixel_width = ((gpu_regs[VMODE]>>10)&3)+1; |
| 782 | 808 | |
| r5540 | r5541 | |
| 792 | 818 | process_object_list(machine, vc, scanline); |
| 793 | 819 | |
| 794 | 820 | /* copy the data to the target, clipping */ |
| 795 | | for (x = 0; x < 760 && hdb <= maxx && hdb < hde; x++) |
| 796 | | for (y = 0; y < pixel_width; y++) |
| 797 | | dest[hdb++] = pen_table[scanline[x]]; |
| 821 | if ((gpu_regs[VMODE] & 0x106) == 0x002) /* RGB24 */ |
| 822 | { |
| 823 | for (x = 0; x < 760 && hdb <= maxx && hdb < hde; x+=2) |
| 824 | for (y = 0; y < pixel_width; y++) |
| 825 | { |
| 826 | UINT8 r = pen_table[(scanline[x]&0xff)|256]; |
| 827 | UINT8 g = pen_table[(scanline[x]>>8)|512]; |
| 828 | UINT8 b = pen_table[scanline[x+1]&0xff]; |
| 829 | dest[hdb++] = MAKE_RGB(r, g, b); |
| 830 | } |
| 831 | } |
| 832 | else |
| 833 | { |
| 834 | for (x = 0; x < 760 && hdb <= maxx && hdb < hde; x++) |
| 835 | for (y = 0; y < pixel_width; y++) |
| 836 | dest[hdb++] = pen_table[scanline[x]]; |
| 837 | } |
| 798 | 838 | } |
| 799 | 839 | |
| 800 | 840 | /* adjust the timer in a loop, to handle missed cases */ |