diff options
| author | 2009-08-10 17:00:20 +0000 | |
|---|---|---|
| committer | 2009-08-10 17:00:20 +0000 | |
| commit | d692baf7696b849c8caecc5573dbc6dc754ac7e7 (patch) | |
| tree | 1fa7f737d7034572aef4032b2f58011aa3dffd74 | |
| parent | 674e64217fae63ade7484a895635537984955c50 (diff) | |
jaguar/cojag video updates:
* Added variable pixel width.
* Fixed display of screens wider than 360 pixels.
* Enabled use of RGB16.
[Robbbert]
| -rw-r--r-- | src/mame/video/jagobj.c | 50 | ||||
| -rw-r--r-- | src/mame/video/jaguar.c | 52 |
2 files changed, 54 insertions, 48 deletions
diff --git a/src/mame/video/jagobj.c b/src/mame/video/jagobj.c index 386738a19e7..43525c38655 100644 --- a/src/mame/video/jagobj.c +++ b/src/mame/video/jagobj.c @@ -84,7 +84,7 @@ INLINE void bitmap_4_draw(INT32 firstpix, INT32 iwidth, UINT32 *src, INT32 xpos, while (firstpix & 7) { int pix = (pixsrc >> (4 * (~firstpix & 7))) & 0x0f; - if ((!(flags & 4) || pix) && (UINT32)xpos < 360) + if ((!(flags & 4) || pix) && (UINT32)xpos < 760) { if (!(flags & 2)) scanline[xpos] = clutbase[BYTE_XOR_BE(pix)]; @@ -105,7 +105,7 @@ INLINE void bitmap_4_draw(INT32 firstpix, INT32 iwidth, UINT32 *src, INT32 xpos, UINT32 pix = src[firstpix++]; if (!(flags & 4) || pix) { - if ((!(flags & 4) || (pix & 0xf0000000)) && (UINT32)xpos < 360) + if ((!(flags & 4) || (pix & 0xf0000000)) && (UINT32)xpos < 760) { if (!(flags & 2)) scanline[xpos] = clutbase[BYTE_XOR_BE(pix >> 28)]; @@ -114,7 +114,7 @@ INLINE void bitmap_4_draw(INT32 firstpix, INT32 iwidth, UINT32 *src, INT32 xpos, } xpos += dxpos; - if ((!(flags & 4) || (pix & 0x0f000000)) && (UINT32)xpos < 360) + if ((!(flags & 4) || (pix & 0x0f000000)) && (UINT32)xpos < 760) { if (!(flags & 2)) scanline[xpos] = clutbase[BYTE_XOR_BE((pix >> 24) & 0x0f)]; @@ -123,7 +123,7 @@ INLINE void bitmap_4_draw(INT32 firstpix, INT32 iwidth, UINT32 *src, INT32 xpos, } xpos += dxpos; - if ((!(flags & 4) || (pix & 0x00f00000)) && (UINT32)xpos < 360) + if ((!(flags & 4) || (pix & 0x00f00000)) && (UINT32)xpos < 760) { if (!(flags & 2)) scanline[xpos] = clutbase[BYTE_XOR_BE((pix >> 20) & 0x0f)]; @@ -132,7 +132,7 @@ INLINE void bitmap_4_draw(INT32 firstpix, INT32 iwidth, UINT32 *src, INT32 xpos, } xpos += dxpos; - if ((!(flags & 4) || (pix & 0x000f0000)) && (UINT32)xpos < 360) + if ((!(flags & 4) || (pix & 0x000f0000)) && (UINT32)xpos < 760) { if (!(flags & 2)) scanline[xpos] = clutbase[BYTE_XOR_BE((pix >> 16) & 0x0f)]; @@ -141,7 +141,7 @@ INLINE void bitmap_4_draw(INT32 firstpix, INT32 iwidth, UINT32 *src, INT32 xpos, } xpos += dxpos; - if ((!(flags & 4) || (pix & 0x0000f000)) && (UINT32)xpos < 360) + if ((!(flags & 4) || (pix & 0x0000f000)) && (UINT32)xpos < 760) { if (!(flags & 2)) scanline[xpos] = clutbase[BYTE_XOR_BE((pix >> 12) & 0x0f)]; @@ -150,7 +150,7 @@ INLINE void bitmap_4_draw(INT32 firstpix, INT32 iwidth, UINT32 *src, INT32 xpos, } xpos += dxpos; - if ((!(flags & 4) || (pix & 0x00000f00)) && (UINT32)xpos < 360) + if ((!(flags & 4) || (pix & 0x00000f00)) && (UINT32)xpos < 760) { if (!(flags & 2)) scanline[xpos] = clutbase[BYTE_XOR_BE((pix >> 8) & 0x0f)]; @@ -159,7 +159,7 @@ INLINE void bitmap_4_draw(INT32 firstpix, INT32 iwidth, UINT32 *src, INT32 xpos, } xpos += dxpos; - if ((!(flags & 4) || (pix & 0x000000f0)) && (UINT32)xpos < 360) + if ((!(flags & 4) || (pix & 0x000000f0)) && (UINT32)xpos < 760) { if (!(flags & 2)) scanline[xpos] = clutbase[BYTE_XOR_BE((pix >> 4) & 0x0f)]; @@ -168,7 +168,7 @@ INLINE void bitmap_4_draw(INT32 firstpix, INT32 iwidth, UINT32 *src, INT32 xpos, } xpos += dxpos; - if ((!(flags & 4) || (pix & 0x0000000f)) && (UINT32)xpos < 360) + if ((!(flags & 4) || (pix & 0x0000000f)) && (UINT32)xpos < 760) { if (!(flags & 2)) scanline[xpos] = clutbase[BYTE_XOR_BE(pix & 0x0f)]; @@ -250,7 +250,7 @@ INLINE void bitmap_8_draw(INT32 firstpix, INT32 iwidth, UINT32 *src, INT32 xpos, while (firstpix & 3) { UINT8 pix = pixsrc >> (8 * (~firstpix & 3)); - if ((!(flags & 4) || pix) && (UINT32)xpos < 360) + if ((!(flags & 4) || pix) && (UINT32)xpos < 760) { if (!(flags & 2)) scanline[xpos] = clutbase[BYTE_XOR_BE(pix)]; @@ -271,7 +271,7 @@ INLINE void bitmap_8_draw(INT32 firstpix, INT32 iwidth, UINT32 *src, INT32 xpos, UINT32 pix = src[firstpix++]; if (!(flags & 4) || pix) { - if ((!(flags & 4) || (pix & 0xff000000)) && (UINT32)xpos < 360) + if ((!(flags & 4) || (pix & 0xff000000)) && (UINT32)xpos < 760) { if (!(flags & 2)) scanline[xpos] = clutbase[BYTE_XOR_BE(pix >> 24)]; @@ -280,7 +280,7 @@ INLINE void bitmap_8_draw(INT32 firstpix, INT32 iwidth, UINT32 *src, INT32 xpos, } xpos += dxpos; - if ((!(flags & 4) || (pix & 0x00ff0000)) && (UINT32)xpos < 360) + if ((!(flags & 4) || (pix & 0x00ff0000)) && (UINT32)xpos < 760) { if (!(flags & 2)) scanline[xpos] = clutbase[BYTE_XOR_BE((pix >> 16) & 0xff)]; @@ -289,7 +289,7 @@ INLINE void bitmap_8_draw(INT32 firstpix, INT32 iwidth, UINT32 *src, INT32 xpos, } xpos += dxpos; - if ((!(flags & 4) || (pix & 0x0000ff00)) && (UINT32)xpos < 360) + if ((!(flags & 4) || (pix & 0x0000ff00)) && (UINT32)xpos < 760) { if (!(flags & 2)) scanline[xpos] = clutbase[BYTE_XOR_BE((pix >> 8) & 0xff)]; @@ -298,7 +298,7 @@ INLINE void bitmap_8_draw(INT32 firstpix, INT32 iwidth, UINT32 *src, INT32 xpos, } xpos += dxpos; - if ((!(flags & 4) || (pix & 0x000000ff)) && (UINT32)xpos < 360) + if ((!(flags & 4) || (pix & 0x000000ff)) && (UINT32)xpos < 760) { if (!(flags & 2)) scanline[xpos] = clutbase[BYTE_XOR_BE(pix & 0xff)]; @@ -377,7 +377,7 @@ INLINE void bitmap_16_draw(INT32 firstpix, INT32 iwidth, UINT32 *src, INT32 xpos if (firstpix & 1) { UINT16 pix = src[firstpix / 2]; - if ((!(flags & 4) || pix) && (UINT32)xpos < 360) + if ((!(flags & 4) || pix) && (UINT32)xpos < 760) { if (!(flags & 2)) scanline[xpos] = pix; @@ -396,7 +396,7 @@ INLINE void bitmap_16_draw(INT32 firstpix, INT32 iwidth, UINT32 *src, INT32 xpos UINT32 pix = src[firstpix++]; if (!(flags & 4) || pix) { - if ((!(flags & 4) || (pix >> 16)) && (UINT32)xpos < 360) + if ((!(flags & 4) || (pix >> 16)) && (UINT32)xpos < 760) { if (!(flags & 2)) scanline[xpos] = pix >> 16; @@ -405,7 +405,7 @@ INLINE void bitmap_16_draw(INT32 firstpix, INT32 iwidth, UINT32 *src, INT32 xpos } xpos += dxpos; - if ((!(flags & 4) || (pix & 0xffff)) && (UINT32)xpos < 360) + if ((!(flags & 4) || (pix & 0xffff)) && (UINT32)xpos < 760) { if (!(flags & 2)) scanline[xpos] = pix; @@ -557,7 +557,7 @@ static UINT32 *process_bitmap(running_machine *machine, UINT32 *objdata, int vc, { UINT8 pix = lookup_pixel(src, i, pitch, 1); - if (xpos >= 0 && xpos < 360 && (pix || !(flags & 4))) + if (xpos >= 0 && xpos < 760 && (pix || !(flags & 4))) scanline[xpos] = clut[BYTE_XOR_BE(pix)]; xpos += dxpos; } @@ -570,7 +570,7 @@ static UINT32 *process_bitmap(running_machine *machine, UINT32 *objdata, int vc, { UINT8 pix = lookup_pixel(src, i, pitch, 1); - if (xpos >= 0 && xpos < 360 && (pix || !(flags & 4))) + if (xpos >= 0 && xpos < 760 && (pix || !(flags & 4))) BLEND(scanline[xpos], clut[BYTE_XOR_BE(pix)]); xpos += dxpos; } @@ -591,7 +591,7 @@ static UINT32 *process_bitmap(running_machine *machine, UINT32 *objdata, int vc, { UINT8 pix = lookup_pixel(src, i, pitch, 2); - if (xpos >= 0 && xpos < 360 && (pix || !(flags & 4))) + if (xpos >= 0 && xpos < 760 && (pix || !(flags & 4))) scanline[xpos] = clut[BYTE_XOR_BE(pix)]; xpos += dxpos; } @@ -604,7 +604,7 @@ static UINT32 *process_bitmap(running_machine *machine, UINT32 *objdata, int vc, { UINT8 pix = lookup_pixel(src, i, pitch, 2); - if (xpos >= 0 && xpos < 360 && (pix || !(flags & 4))) + if (xpos >= 0 && xpos < 760 && (pix || !(flags & 4))) BLEND(scanline[xpos], clut[BYTE_XOR_BE(pix)]); xpos += dxpos; } @@ -754,7 +754,7 @@ static UINT32 *process_scaled_bitmap(running_machine *machine, UINT32 *objdata, while (xleft > 0) { - if (xpos >= 0 && xpos < 360 && (pix || !(flags & 4))) + if (xpos >= 0 && xpos < 760 && (pix || !(flags & 4))) scanline[xpos] = clut[BYTE_XOR_BE(pix)]; xpos += dxpos; xleft -= 0x20; @@ -776,7 +776,7 @@ static UINT32 *process_scaled_bitmap(running_machine *machine, UINT32 *objdata, while (xleft > 0) { - if (xpos >= 0 && xpos < 360 && (pix || !(flags & 4))) + if (xpos >= 0 && xpos < 760 && (pix || !(flags & 4))) scanline[xpos] = clut[BYTE_XOR_BE(pix)]; xpos += dxpos; xleft -= 0x20; @@ -794,7 +794,7 @@ static UINT32 *process_scaled_bitmap(running_machine *machine, UINT32 *objdata, while (xleft > 0) { - if (xpos >= 0 && xpos < 360 && (pix || !(flags & 4))) + if (xpos >= 0 && xpos < 760 && (pix || !(flags & 4))) scanline[xpos] = pix; xpos += dxpos; xleft -= 0x20; @@ -908,7 +908,7 @@ static void process_object_list(running_machine *machine, int vc, UINT16 *_scanl /* erase the scanline first */ scanline = _scanline; - for (x = 0; x < 360; x++) + for (x = 0; x < 760; x++) scanline[x] = gpu_regs[BG]; logit = LOG_OBJECTS; diff --git a/src/mame/video/jaguar.c b/src/mame/video/jaguar.c index 7f353599979..ac951ece215 100644 --- a/src/mame/video/jaguar.c +++ b/src/mame/video/jaguar.c @@ -435,7 +435,7 @@ static void jaguar_set_palette(UINT16 vmode) /* YCC/RGB VARMOD */ case 0x100: - case 0x107: + case 0x106: for (i = 0; i < 65536; i++) { UINT8 r = (red_lookup[i >> 8] * (i & 0xff)) >> 8; @@ -646,6 +646,8 @@ READ16_HANDLER( jaguar_tom_regs_r ) WRITE16_HANDLER( jaguar_tom_regs_w ) { + UINT32 reg_store = gpu_regs[offset]; + if (offset < GPU_REGS) { COMBINE_DATA(&gpu_regs[offset]); @@ -658,7 +660,8 @@ WRITE16_HANDLER( jaguar_tom_regs_w ) break; case VMODE: - jaguar_set_palette(gpu_regs[VMODE]); + if (reg_store != gpu_regs[offset]) + jaguar_set_palette(gpu_regs[VMODE]); break; case OBF: /* clear GPU interrupt */ @@ -678,23 +681,25 @@ WRITE16_HANDLER( jaguar_tom_regs_w ) case VDB: case VDE: { - int hperiod = 2 * ((gpu_regs[HP] & 0x3ff) + 1); - int hbend = effective_hvalue(ENABLE_BORDERS ? gpu_regs[HBE] : MIN(gpu_regs[HDB1], gpu_regs[HDB2])); - int hbstart = effective_hvalue(gpu_regs[ENABLE_BORDERS ? HBB : HDE]); - int vperiod = (gpu_regs[VP] & 0x7ff) + 1; - int vbend = gpu_regs[VBE] & 0x7ff; - int vbstart = gpu_regs[VBB] & 0x7ff; - - /* adjust for the half-lines */ - if (hperiod != 0 && vperiod != 0 && hbend < hbstart && vbend < vbstart && hbstart < hperiod) + if (reg_store != gpu_regs[offset]) { - rectangle visarea; - visarea.min_x = hbend / 2; - visarea.max_x = MIN((hbstart >> 1) - 1, 0x19c); -// visarea.max_x = hbstart / 2 - 1; - visarea.min_y = vbend / 2; - visarea.max_y = vbstart / 2 - 1; - video_screen_configure(space->machine->primary_screen, hperiod / 2, vperiod / 2, &visarea, HZ_TO_ATTOSECONDS((double)COJAG_PIXEL_CLOCK * 2 / hperiod / vperiod)); + int hperiod = 2 * ((gpu_regs[HP] & 0x3ff) + 1); + int hbend = effective_hvalue(ENABLE_BORDERS ? gpu_regs[HBE] : MIN(gpu_regs[HDB1], gpu_regs[HDB2])); + int hbstart = effective_hvalue(gpu_regs[ENABLE_BORDERS ? HBB : HDE]); + int vperiod = (gpu_regs[VP] & 0x7ff) + 1; + int vbend = gpu_regs[VBE] & 0x7ff; + int vbstart = gpu_regs[VBB] & 0x7ff; + + /* adjust for the half-lines */ + if (hperiod != 0 && vperiod != 0 && hbend < hbstart && vbend < vbstart && hbstart < hperiod) + { + rectangle visarea; + visarea.min_x = hbend / 2; + visarea.max_x = hbstart / 2 - 1; + visarea.min_y = vbend / 2; + visarea.max_y = vbstart / 2 - 1; + video_screen_configure(space->machine->primary_screen, hperiod / 2, vperiod / 2, &visarea, HZ_TO_ATTOSECONDS((double)COJAG_PIXEL_CLOCK * 2 / hperiod / vperiod)); + } } break; } @@ -772,8 +777,8 @@ static TIMER_CALLBACK( cojag_scanline_update ) UINT32 *dest = BITMAP_ADDR32(screen_bitmap, vc / 2, 0); int maxx = visarea->max_x; int hde = effective_hvalue(gpu_regs[HDE]) / 2; - UINT16 scanline[360]; - int x; + UINT16 x,scanline[760]; + UINT8 y,pixel_width = ((gpu_regs[VMODE]>>10)&3)+1; /* if we are first on this scanline, clear to the border color */ if (ENABLE_BORDERS && vc % 2 == 0) @@ -787,8 +792,9 @@ static TIMER_CALLBACK( cojag_scanline_update ) process_object_list(machine, vc, scanline); /* copy the data to the target, clipping */ - for (x = 0; x < 360 && hdb <= maxx && hdb < hde; x++, hdb++) - dest[hdb] = pen_table[scanline[x]]; + for (x = 0; x < 760 && hdb <= maxx && hdb < hde; x++) + for (y = 0; y < pixel_width; y++) + dest[hdb++] = pen_table[scanline[x]]; } /* adjust the timer in a loop, to handle missed cases */ @@ -822,7 +828,7 @@ VIDEO_START( cojag ) object_timer = timer_alloc(machine, cojag_scanline_update, NULL); adjust_object_timer(machine, 0); - screen_bitmap = auto_bitmap_alloc(machine, 720, 512, BITMAP_FORMAT_RGB32); + screen_bitmap = auto_bitmap_alloc(machine, 760, 512, BITMAP_FORMAT_RGB32); jagobj_init(machine); |
