src/mame/video/jagobj.c
| r5499 | r5500 | |
| 553 | 553 | |
| 554 | 554 | INLINE UINT8 lookup_pixel(const UINT32 *src, int i, int pitch, int depth) |
| 555 | 555 | { |
| 556 | | int ppl = 32 / depth; |
| 556 | int ppl = 32 / depth; |
| 557 | 557 | UINT32 data = src[((i & ppl) / ppl) + ((i / (ppl<<1)) * (pitch<<1))]; |
| 558 | | UINT8 pix = (data >> ((~i & (ppl-1)) * depth)) & ((1 << depth) - 1); |
| 558 | UINT8 pix = (data >> ((~i & (ppl-1)) * depth)) & ((1 << depth) - 1); |
| 559 | 559 | return pix; |
| 560 | 560 | } |
| 561 | 561 | |
| r5499 | r5500 | |
| 612 | 612 | UINT32 dwidth = (lower2 >> 18) & 0x3ff; |
| 613 | 613 | UINT32 iwidth = ((lower2 >> 28) | ((upper2 & 0x3f) << 4)) << (6 - depthlog); |
| 614 | 614 | UINT8 _index = (upper2 >> 5) & 0xfe; |
| 615 | | UINT8 flags = (upper2 >> 13) & 0x0f; |
| 616 | | UINT8 firstpix = ((upper2 >> 17) & 0x1f) >> depthlog; |
| 615 | UINT8 flags = (upper2 >> 13) & 0x07; |
| 616 | UINT8 firstpix = ((upper2 >> 17) & 0x3f) >> depthlog; |
| 617 | 617 | int i, dxpos = (flags & 1) ? -1 : 1; |
| 618 | 618 | |
| 619 | 619 | /* preadjust for firstpix */ |
| r5499 | r5500 | |
| 625 | 625 | /* 1bpp case */ |
| 626 | 626 | case 0: |
| 627 | 627 | { |
| 628 | | UINT16 *clut = (UINT16 *)jaguar_gpu_clut; |
| 629 | | clut += _index & 0xfe; |
| 628 | UINT16 *clut = (UINT16 *)jaguar_gpu_clut + _index; |
| 630 | 629 | |
| 631 | 630 | /* non-blending */ |
| 632 | 631 | if (!(flags & 2)) |
| r5499 | r5500 | |
| 659 | 658 | /* 2bpp case */ |
| 660 | 659 | case 1: |
| 661 | 660 | { |
| 662 | | UINT16 *clut = (UINT16 *)jaguar_gpu_clut; |
| 663 | | clut += _index & 0xfc; |
| 661 | UINT16 *clut = (UINT16 *)jaguar_gpu_clut + (_index & 0xfc); |
| 664 | 662 | |
| 665 | 663 | /* non-blending */ |
| 666 | 664 | if (!(flags & 2)) |
| r5499 | r5500 | |
| 696 | 694 | if (pitch != 1) |
| 697 | 695 | logerror("Unhandled pitch = %d\n", pitch); |
| 698 | 696 | |
| 699 | | clutbase = (UINT16 *)jaguar_gpu_clut + (_index & 0xf0); |
| 700 | | (*bitmap4[flags & 7])(firstpix, iwidth, src, xpos); |
| 697 | clutbase = (UINT16 *)jaguar_gpu_clut + (_index & 0xf8); |
| 698 | (*bitmap4[flags])(firstpix, iwidth, src, xpos); |
| 701 | 699 | break; |
| 702 | 700 | |
| 703 | 701 | /* 8bpp case */ |
| r5499 | r5500 | |
| 707 | 705 | logerror("Unhandled pitch = %d\n", pitch); |
| 708 | 706 | |
| 709 | 707 | clutbase = (UINT16 *)jaguar_gpu_clut; |
| 710 | | (*bitmap8[flags & 7])(firstpix, iwidth, src, xpos); |
| 708 | (*bitmap8[flags])(firstpix, iwidth, src, xpos); |
| 711 | 709 | break; |
| 712 | 710 | |
| 713 | 711 | /* 16bpp case */ |
| r5499 | r5500 | |
| 716 | 714 | if (pitch != 1) |
| 717 | 715 | logerror("Unhandled pitch = %d\n", pitch); |
| 718 | 716 | |
| 719 | | (*bitmap16[flags & 7])(firstpix, iwidth, src, xpos); |
| 717 | (*bitmap16[flags])(firstpix, iwidth, src, xpos); |
| 720 | 718 | break; |
| 721 | 719 | |
| 722 | 720 | /* 32bpp case */ |
| r5499 | r5500 | |
| 725 | 723 | if (pitch != 1) |
| 726 | 724 | logerror("Unhandled pitch = %d\n", pitch); |
| 727 | 725 | |
| 728 | | (*bitmap32[flags & 7])(firstpix, iwidth, src, xpos); |
| 726 | (*bitmap32[flags])(firstpix, iwidth, src, xpos); |
| 729 | 727 | break; |
| 730 | 728 | |
| 731 | 729 | default: |
| r5499 | r5500 | |
| 802 | 800 | UINT32 dwidth = (lower2 >> 18) & 0x3ff; |
| 803 | 801 | INT32 iwidth = ((lower2 >> 28) | ((upper2 & 0x3f) << 4)) << (6 - depthlog); |
| 804 | 802 | UINT8 _index = (upper2 >> 5) & 0xfe; |
| 805 | | UINT8 flags = (upper2 >> 13) & 0x0f; |
| 806 | | UINT8 firstpix = ((upper2 >> 17) & 0x1f) >> depthlog; |
| 803 | UINT8 flags = (upper2 >> 13) & 0x07; |
| 804 | UINT8 firstpix = ((upper2 >> 17) & 0x3f) >> depthlog; |
| 807 | 805 | |
| 808 | 806 | INT32 hscale = lower3 & 0xff; |
| 809 | 807 | INT32 vscale = (lower3 >> 8) & 0xff; |
| r5499 | r5500 | |
| 829 | 827 | /* switch off the depth */ |
| 830 | 828 | switch (depthlog) |
| 831 | 829 | { |
| 832 | | case 0: /* needs to be verified */ |
| 830 | case 0: |
| 833 | 831 | { |
| 834 | | UINT16 *clut = (UINT16 *)jaguar_gpu_clut; |
| 835 | | clut += _index & 0x03; |
| 832 | UINT16 *clut = (UINT16 *)jaguar_gpu_clut + _index; |
| 836 | 833 | |
| 837 | 834 | /* render in phrases */ |
| 838 | 835 | while (xpix < iwidth) |
| r5499 | r5500 | |
| 852 | 849 | break; |
| 853 | 850 | } |
| 854 | 851 | |
| 855 | | case 1: /* needs to be verified */ |
| 852 | case 1: |
| 856 | 853 | { |
| 857 | | UINT16 *clut = (UINT16 *)jaguar_gpu_clut; |
| 858 | | clut += _index & 0x0f; |
| 854 | UINT16 *clut = (UINT16 *)jaguar_gpu_clut + (_index & 0xfc); |
| 859 | 855 | |
| 860 | 856 | /* render in phrases */ |
| 861 | 857 | while (xpix < iwidth) |
| r5499 | r5500 | |
| 877 | 873 | |
| 878 | 874 | case 2: |
| 879 | 875 | { |
| 880 | | UINT16 *clut = (UINT16 *)jaguar_gpu_clut; |
| 881 | | clut += _index & 0xf0; |
| 876 | UINT16 *clut = (UINT16 *)jaguar_gpu_clut + (_index & 0xf8); |
| 882 | 877 | |
| 883 | 878 | /* render in phrases */ |
| 884 | 879 | while (xpix < iwidth) |
| r5499 | r5500 | |
| 1070 | 1065 | |
| 1071 | 1066 | /* GPU interrupt */ |
| 1072 | 1067 | case 2: |
| 1073 | | gpu_regs[OB_HH]=objdata[1]; |
| 1074 | | gpu_regs[OB_HL]=objdata[2]; |
| 1075 | | gpu_regs[OB_LH]=objdata[3]; |
| 1076 | | 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; |
| 1077 | 1072 | cpu_irq_state |= 2; |
| 1078 | 1073 | update_cpu_irq(machine); |
| 1079 | 1074 | done=1; |
src/mame/video/jaguar.c
| r5499 | r5500 | |
| 646 | 646 | return gpu_regs[offset]; |
| 647 | 647 | } |
| 648 | 648 | |
| 649 | static TIMER_CALLBACK( jaguar_pit ) |
| 650 | { |
| 651 | attotime sample_period; |
| 652 | cpu_irq_state |= 8; |
| 653 | update_cpu_irq(machine); |
| 649 | 654 | |
| 655 | if (gpu_regs[PIT0]) |
| 656 | { |
| 657 | sample_period = ATTOTIME_IN_NSEC(cpu_get_clock(cputag_get_cpu(machine,"gpu")) / (1+gpu_regs[PIT0]) / (1+gpu_regs[PIT1])); |
| 658 | // timer_set(machine, sample_period, NULL, 0, jaguar_pit); |
| 659 | } |
| 660 | } |
| 661 | |
| 650 | 662 | WRITE16_HANDLER( jaguar_tom_regs_w ) |
| 651 | 663 | { |
| 652 | 664 | UINT32 reg_store = gpu_regs[offset]; |
| 653 | | |
| 665 | attotime sample_period; |
| 654 | 666 | if (offset < GPU_REGS) |
| 655 | 667 | { |
| 656 | 668 | COMBINE_DATA(&gpu_regs[offset]); |
| 657 | 669 | |
| 658 | 670 | switch (offset) |
| 659 | 671 | { |
| 672 | case PIT1: |
| 673 | if (gpu_regs[PIT0]) |
| 674 | { |
| 675 | sample_period = ATTOTIME_IN_NSEC(cpu_get_clock(cputag_get_cpu(space->machine,"gpu")) / (1+gpu_regs[PIT0]) / (1+gpu_regs[PIT1])); |
| 676 | timer_set(space->machine, sample_period, NULL, 0, jaguar_pit); |
| 677 | } |
| 678 | break; |
| 660 | 679 | case INT1: |
| 661 | 680 | cpu_irq_state &= ~(gpu_regs[INT1] >> 8); |
| 662 | 681 | update_cpu_irq(space->machine); |
src/mess/drivers/jaguar.c
| r5499 | r5500 | |
| 416 | 416 | AM_RANGE(0x800000, 0xdfffff) AM_ROM AM_BASE(&cart_base) AM_SIZE(&cart_size) AM_SHARE(15) AM_REGION("maincpu", 0x800000) |
| 417 | 417 | AM_RANGE(0xe00000, 0xe1ffff) AM_ROM AM_BASE(&rom_base) AM_SIZE(&rom_size) AM_SHARE(16) AM_REGION("maincpu", 0xe00000) |
| 418 | 418 | AM_RANGE(0xf00000, 0xf003ff) AM_READWRITE(jaguar_tom_regs32_r, jaguar_tom_regs32_w) |
| 419 | | AM_RANGE(0xf00400, 0xf007ff) AM_RAM AM_BASE(&jaguar_gpu_clut) AM_SHARE(2) |
| 419 | AM_RANGE(0xf00400, 0xf005ff) AM_MIRROR(0x000200) AM_RAM AM_BASE(&jaguar_gpu_clut) AM_SHARE(2) |
| 420 | 420 | AM_RANGE(0xf02100, 0xf021ff) AM_MIRROR(0x008000) AM_READWRITE(gpuctrl_r, gpuctrl_w) |
| 421 | 421 | AM_RANGE(0xf02200, 0xf022ff) AM_MIRROR(0x008000) AM_READWRITE(jaguar_blitter_r, jaguar_blitter_w) |
| 422 | 422 | AM_RANGE(0xf03000, 0xf03fff) AM_MIRROR(0x008000) AM_RAM AM_BASE(&jaguar_gpu_ram) AM_SHARE(3) |
| r5499 | r5500 | |
| 442 | 442 | AM_RANGE(0x800000, 0xdfffff) AM_ROM AM_SHARE(15) AM_REGION("maincpu", 0x800000) |
| 443 | 443 | AM_RANGE(0xe00000, 0xe1ffff) AM_ROM AM_SHARE(16) AM_REGION("maincpu", 0xe00000) |
| 444 | 444 | AM_RANGE(0xf00000, 0xf003ff) AM_READWRITE(jaguar_tom_regs32_r, jaguar_tom_regs32_w) |
| 445 | | AM_RANGE(0xf00400, 0xf007ff) AM_RAM AM_SHARE(2) |
| 445 | AM_RANGE(0xf00400, 0xf005ff) AM_MIRROR(0x000200) AM_RAM AM_SHARE(2) |
| 446 | 446 | AM_RANGE(0xf02100, 0xf021ff) AM_MIRROR(0x008000) AM_READWRITE(gpuctrl_r, gpuctrl_w) |
| 447 | 447 | AM_RANGE(0xf02200, 0xf022ff) AM_MIRROR(0x008000) AM_READWRITE(jaguar_blitter_r, jaguar_blitter_w) |
| 448 | 448 | AM_RANGE(0xf03000, 0xf03fff) AM_MIRROR(0x008000) AM_RAM AM_SHARE(3) |