Previous 15994 Revisions Next

r5500 Tuesday 25th August, 2009 at 23:12:52 UTC by Robbbert
[JAGUAR] Correction to bitmap/clut processing on the last update.
Added partial PIT support.
Added mirror in clut.
[src/mame/video]jagobj.c jaguar.c
[src/mess/drivers]jaguar.c

src/mame/video/jagobj.c
r5499r5500
553553
554554INLINE UINT8 lookup_pixel(const UINT32 *src, int i, int pitch, int depth)
555555{
556   int ppl         = 32 / depth;
556   int ppl      = 32 / depth;
557557   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);
559559   return pix;
560560}
561561
r5499r5500
612612      UINT32 dwidth = (lower2 >> 18) & 0x3ff;
613613      UINT32 iwidth = ((lower2 >> 28) | ((upper2 & 0x3f) << 4)) << (6 - depthlog);
614614      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;
617617      int i, dxpos = (flags & 1) ? -1 : 1;
618618
619619      /* preadjust for firstpix */
r5499r5500
625625         /* 1bpp case */
626626         case 0:
627627         {
628            UINT16 *clut = (UINT16 *)jaguar_gpu_clut;
629            clut += _index & 0xfe;
628            UINT16 *clut = (UINT16 *)jaguar_gpu_clut + _index;
630629
631630            /* non-blending */
632631            if (!(flags & 2))
r5499r5500
659658         /* 2bpp case */
660659         case 1:
661660         {
662            UINT16 *clut = (UINT16 *)jaguar_gpu_clut;
663            clut += _index & 0xfc;
661            UINT16 *clut = (UINT16 *)jaguar_gpu_clut + (_index & 0xfc);
664662
665663            /* non-blending */
666664            if (!(flags & 2))
r5499r5500
696694            if (pitch != 1)
697695               logerror("Unhandled pitch = %d\n", pitch);
698696
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);
701699            break;
702700
703701         /* 8bpp case */
r5499r5500
707705               logerror("Unhandled pitch = %d\n", pitch);
708706
709707            clutbase = (UINT16 *)jaguar_gpu_clut;
710            (*bitmap8[flags & 7])(firstpix, iwidth, src, xpos);
708            (*bitmap8[flags])(firstpix, iwidth, src, xpos);
711709            break;
712710
713711         /* 16bpp case */
r5499r5500
716714            if (pitch != 1)
717715               logerror("Unhandled pitch = %d\n", pitch);
718716
719            (*bitmap16[flags & 7])(firstpix, iwidth, src, xpos);
717            (*bitmap16[flags])(firstpix, iwidth, src, xpos);
720718            break;
721719
722720         /* 32bpp case */
r5499r5500
725723            if (pitch != 1)
726724               logerror("Unhandled pitch = %d\n", pitch);
727725
728            (*bitmap32[flags & 7])(firstpix, iwidth, src, xpos);
726            (*bitmap32[flags])(firstpix, iwidth, src, xpos);
729727            break;
730728
731729         default:
r5499r5500
802800      UINT32 dwidth = (lower2 >> 18) & 0x3ff;
803801      INT32 iwidth = ((lower2 >> 28) | ((upper2 & 0x3f) << 4)) << (6 - depthlog);
804802      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;
807805
808806      INT32 hscale = lower3 & 0xff;
809807      INT32 vscale = (lower3 >> 8) & 0xff;
r5499r5500
829827         /* switch off the depth */
830828         switch (depthlog)
831829         {
832            case 0:      /* needs to be verified */
830            case 0:
833831            {
834               UINT16 *clut = (UINT16 *)jaguar_gpu_clut;
835               clut += _index & 0x03;
832               UINT16 *clut = (UINT16 *)jaguar_gpu_clut + _index;
836833
837834               /* render in phrases */
838835               while (xpix < iwidth)
r5499r5500
852849               break;
853850            }
854851
855            case 1:      /* needs to be verified */
852            case 1:
856853            {
857               UINT16 *clut = (UINT16 *)jaguar_gpu_clut;
858               clut += _index & 0x0f;
854               UINT16 *clut = (UINT16 *)jaguar_gpu_clut + (_index & 0xfc);
859855
860856               /* render in phrases */
861857               while (xpix < iwidth)
r5499r5500
877873
878874            case 2:
879875            {
880               UINT16 *clut = (UINT16 *)jaguar_gpu_clut;
881               clut += _index & 0xf0;
876               UINT16 *clut = (UINT16 *)jaguar_gpu_clut + (_index & 0xf8);
882877
883878               /* render in phrases */
884879               while (xpix < iwidth)
r5499r5500
10701065
10711066         /* GPU interrupt */
10721067         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;
10771072            cpu_irq_state |= 2;
10781073            update_cpu_irq(machine);
10791074            done=1;
src/mame/video/jaguar.c
r5499r5500
646646   return gpu_regs[offset];
647647}
648648
649static TIMER_CALLBACK( jaguar_pit )
650{
651   attotime sample_period;
652   cpu_irq_state |= 8;
653   update_cpu_irq(machine);
649654
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   
650662WRITE16_HANDLER( jaguar_tom_regs_w )
651663{
652664   UINT32 reg_store = gpu_regs[offset];
653
665   attotime sample_period;
654666   if (offset < GPU_REGS)
655667   {
656668      COMBINE_DATA(&gpu_regs[offset]);
657669
658670      switch (offset)
659671      {
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;
660679         case INT1:
661680            cpu_irq_state &= ~(gpu_regs[INT1] >> 8);
662681            update_cpu_irq(space->machine);
src/mess/drivers/jaguar.c
r5499r5500
416416   AM_RANGE(0x800000, 0xdfffff) AM_ROM AM_BASE(&cart_base) AM_SIZE(&cart_size) AM_SHARE(15) AM_REGION("maincpu", 0x800000)
417417   AM_RANGE(0xe00000, 0xe1ffff) AM_ROM AM_BASE(&rom_base) AM_SIZE(&rom_size) AM_SHARE(16) AM_REGION("maincpu", 0xe00000)
418418   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)
420420   AM_RANGE(0xf02100, 0xf021ff) AM_MIRROR(0x008000) AM_READWRITE(gpuctrl_r, gpuctrl_w)
421421   AM_RANGE(0xf02200, 0xf022ff) AM_MIRROR(0x008000) AM_READWRITE(jaguar_blitter_r, jaguar_blitter_w)
422422   AM_RANGE(0xf03000, 0xf03fff) AM_MIRROR(0x008000) AM_RAM AM_BASE(&jaguar_gpu_ram) AM_SHARE(3)
r5499r5500
442442   AM_RANGE(0x800000, 0xdfffff) AM_ROM AM_SHARE(15) AM_REGION("maincpu", 0x800000)
443443   AM_RANGE(0xe00000, 0xe1ffff) AM_ROM AM_SHARE(16) AM_REGION("maincpu", 0xe00000)
444444   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)
446446   AM_RANGE(0xf02100, 0xf021ff) AM_MIRROR(0x008000) AM_READWRITE(gpuctrl_r, gpuctrl_w)
447447   AM_RANGE(0xf02200, 0xf022ff) AM_MIRROR(0x008000) AM_READWRITE(jaguar_blitter_r, jaguar_blitter_w)
448448   AM_RANGE(0xf03000, 0xf03fff) AM_MIRROR(0x008000) AM_RAM AM_SHARE(3)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team