From 4cd69c41afa44a768e21913d4aa9c80cb656b059 Mon Sep 17 00:00:00 2001 From: David Haywood <28625134+DavidHaywood@users.noreply.github.com> Date: Sat, 6 Jun 2020 00:21:24 +0100 Subject: [PATCH] gpl16250 / sunplus rendering - improvements for jak_pf (double height tilemaps etc.) (nw) (#6797) --- .../machine/generalplus_gpl16250soc_video.cpp | 37 ++++++------ src/devices/machine/spg_renderer.cpp | 59 +++++++++++++++---- .../drivers/generalplus_gpl16250_nand.cpp | 2 +- 3 files changed, 68 insertions(+), 30 deletions(-) diff --git a/src/devices/machine/generalplus_gpl16250soc_video.cpp b/src/devices/machine/generalplus_gpl16250soc_video.cpp index 1c7b373fce3..fe6e03e534f 100644 --- a/src/devices/machine/generalplus_gpl16250soc_video.cpp +++ b/src/devices/machine/generalplus_gpl16250soc_video.cpp @@ -351,23 +351,23 @@ uint32_t gcm394_base_video_device::screen_update(screen_device &screen, bitmap_r uint16_t ctrl3 = m_tmap3_regs[1]; popmessage( - "p0ct u:%02x Bl:%d HC:%d Ycmp:%d Hcmp:%d RS:%d E:%d WP:%d Rg:%d Bm:%d gfxadr: %08x\n" - "p1ct u:%02x Bl:%d HC:%d Ycmp:%d Hcmp:%d RS:%d E:%d WP:%d Rg:%d Bm:%d gfxadr: %08x\n" - "p2ct u:%02x Bl:%d HC:%d Ycmp:%d Hcmp:%d RS:%d E:%d WP:%d Rg:%d Bm:%d gfxadr: %08x\n" - "p3ct u:%02x Bl:%d HC:%d Ycmp:%d Hcmp:%d RS:%d E:%d WP:%d Rg:%d Bm:%d gfxadr: %08x\n" - "p0attr u:%01x Z:%d P:%d V:%d H:%d FY:%d FX:%d D:%d\n" - "p1attr u:%01x Z:%d P:%d V:%d H:%d FY:%d FX:%d D:%d\n" - "p2attr u:%01x Z:%d P:%d V:%d H:%d FY:%d FX:%d D:%d\n" - "p3attr u:%01x Z:%d P:%d V:%d H:%d FY:%d FX:%d D:%d\n" + "p0ct u:%02x Bl:%d HC:%d Ycmp:%d Hcmp:%d RS:%d E:%d WP:%d Rg:%d Bm:%d gfxadr: %08x t:%04x p:%04x\n" + "p1ct u:%02x Bl:%d HC:%d Ycmp:%d Hcmp:%d RS:%d E:%d WP:%d Rg:%d Bm:%d gfxadr: %08x t:%04x p:%04x\n" + "p2ct u:%02x Bl:%d HC:%d Ycmp:%d Hcmp:%d RS:%d E:%d WP:%d Rg:%d Bm:%d gfxadr: %08x t:%04x p:%04x\n" + "p3ct u:%02x Bl:%d HC:%d Ycmp:%d Hcmp:%d RS:%d E:%d WP:%d Rg:%d Bm:%d gfxadr: %08x t:%04x p:%04x\n" + "p0attr dw:%01x dh:%01x Z:%d P:%d V:%d H:%d FY:%d FX:%d D:%d xs: %04x ys %04x\n" + "p1attr dw:%01x dh:%01x Z:%d P:%d V:%d H:%d FY:%d FX:%d D:%d xs: %04x ys %04x\n" + "p2attr dw:%01x dh:%01x Z:%d P:%d V:%d H:%d FY:%d FX:%d D:%d xs: %04x ys %04x\n" + "p3attr dw:%01x dh:%01x Z:%d P:%d V:%d H:%d FY:%d FX:%d D:%d xs: %04x ys %04x\n" "palbank %04x 707e: %04x 707f: %04x tvc703c: %04x spr7042: %04x\n", - (ctrl0 & 0xfe00) >> 9, BIT(ctrl0, 8), BIT(ctrl0, 7), BIT(ctrl0, 6), BIT(ctrl0, 5), BIT(ctrl0, 4), BIT(ctrl0, 3), BIT(ctrl0, 2), BIT(ctrl0, 1), BIT(ctrl0, 0), page0_addr, - (ctrl1 & 0xfe00) >> 9, BIT(ctrl1, 8), BIT(ctrl1, 7), BIT(ctrl1, 6), BIT(ctrl1, 5), BIT(ctrl1, 4), BIT(ctrl1, 3), BIT(ctrl1, 2), BIT(ctrl1, 1), BIT(ctrl1, 0), page1_addr, - (ctrl2 & 0xfe00) >> 9, BIT(ctrl2, 8), BIT(ctrl2, 7), BIT(ctrl2, 6), BIT(ctrl2, 5), BIT(ctrl2, 4), BIT(ctrl2, 3), BIT(ctrl2, 2), BIT(ctrl2, 1), BIT(ctrl2, 0), page2_addr, - (ctrl3 & 0xfe00) >> 9, BIT(ctrl3, 8), BIT(ctrl3, 7), BIT(ctrl3, 6), BIT(ctrl3, 5), BIT(ctrl3, 4), BIT(ctrl3, 3), BIT(ctrl3, 2), BIT(ctrl3, 1), BIT(ctrl3, 0), page3_addr, - (attr0 & 0xc000) >> 14, (attr0 >> 12) & 3, (attr0 >> 8) & 15, 8 << ((attr0 >> 6) & 3), 8 << ((attr0 >> 4) & 3), BIT(attr0, 3), BIT(attr0, 2), 2 * ((attr0 & 3) + 1), - (attr1 & 0xc000) >> 14, (attr1 >> 12) & 3, (attr1 >> 8) & 15, 8 << ((attr1 >> 6) & 3), 8 << ((attr1 >> 4) & 3), BIT(attr1, 3), BIT(attr1, 2), 2 * ((attr1 & 3) + 1), - (attr2 & 0xc000) >> 14, (attr2 >> 12) & 3, (attr2 >> 8) & 15, 8 << ((attr2 >> 6) & 3), 8 << ((attr2 >> 4) & 3), BIT(attr2, 3), BIT(attr2, 2), 2 * ((attr2 & 3) + 1), - (attr3 & 0xc000) >> 14, (attr3 >> 12) & 3, (attr3 >> 8) & 15, 8 << ((attr3 >> 6) & 3), 8 << ((attr3 >> 4) & 3), BIT(attr3, 3), BIT(attr3, 2), 2 * ((attr3 & 3) + 1), + (ctrl0 & 0xfe00) >> 9, BIT(ctrl0, 8), BIT(ctrl0, 7), BIT(ctrl0, 6), BIT(ctrl0, 5), BIT(ctrl0, 4), BIT(ctrl0, 3), BIT(ctrl0, 2), BIT(ctrl0, 1), BIT(ctrl0, 0), page0_addr, m_tmap0_regs[2], m_tmap0_regs[3], + (ctrl1 & 0xfe00) >> 9, BIT(ctrl1, 8), BIT(ctrl1, 7), BIT(ctrl1, 6), BIT(ctrl1, 5), BIT(ctrl1, 4), BIT(ctrl1, 3), BIT(ctrl1, 2), BIT(ctrl1, 1), BIT(ctrl1, 0), page1_addr, m_tmap1_regs[2], m_tmap1_regs[3], + (ctrl2 & 0xfe00) >> 9, BIT(ctrl2, 8), BIT(ctrl2, 7), BIT(ctrl2, 6), BIT(ctrl2, 5), BIT(ctrl2, 4), BIT(ctrl2, 3), BIT(ctrl2, 2), BIT(ctrl2, 1), BIT(ctrl2, 0), page2_addr, m_tmap2_regs[2], m_tmap2_regs[3], + (ctrl3 & 0xfe00) >> 9, BIT(ctrl3, 8), BIT(ctrl3, 7), BIT(ctrl3, 6), BIT(ctrl3, 5), BIT(ctrl3, 4), BIT(ctrl3, 3), BIT(ctrl3, 2), BIT(ctrl3, 1), BIT(ctrl3, 0), page3_addr, m_tmap3_regs[2], m_tmap3_regs[3], + BIT(attr0, 15), BIT(attr0, 14), (attr0 >> 12) & 3, (attr0 >> 8) & 15, 8 << ((attr0 >> 6) & 3), 8 << ((attr0 >> 4) & 3), BIT(attr0, 3), BIT(attr0, 2), 2 * ((attr0 & 3) + 1), m_tmap0_scroll[0], m_tmap0_scroll[1], + BIT(attr1, 15), BIT(attr1, 14), (attr1 >> 12) & 3, (attr1 >> 8) & 15, 8 << ((attr1 >> 6) & 3), 8 << ((attr1 >> 4) & 3), BIT(attr1, 3), BIT(attr1, 2), 2 * ((attr1 & 3) + 1), m_tmap1_scroll[0], m_tmap1_scroll[1], + BIT(attr2, 15), BIT(attr2, 14), (attr2 >> 12) & 3, (attr2 >> 8) & 15, 8 << ((attr2 >> 6) & 3), 8 << ((attr2 >> 4) & 3), BIT(attr2, 3), BIT(attr2, 2), 2 * ((attr2 & 3) + 1), m_tmap2_scroll[0], m_tmap2_scroll[1], + BIT(attr3, 15), BIT(attr3, 14), (attr3 >> 12) & 3, (attr3 >> 8) & 15, 8 << ((attr3 >> 6) & 3), 8 << ((attr3 >> 4) & 3), BIT(attr3, 3), BIT(attr3, 2), 2 * ((attr3 & 3) + 1), m_tmap3_scroll[0], m_tmap3_scroll[1], m_703a_palettebank, m_707e_spritebank, m_707f, m_703c_tvcontrol1, m_7042_sprite ); } @@ -1058,7 +1058,10 @@ WRITE16_MEMBER(gcm394_base_video_device::palette_w) m_paletteram[offset] = data; // for debug - m_palette->set_pen_color(offset, rgb_t((((data >> 15) & 0x1f)<<3), (((data >> 10) & 0x1f)<<3), (((data >> 0) & 0x1f)<<3))); + m_palette->set_pen_color(offset, rgb_t( + (((data >> 10) & 0x1f)<<3), + (((data >> 5) & 0x1f)<<3), + (((data >> 0) & 0x1f)<<3))); } } diff --git a/src/devices/machine/spg_renderer.cpp b/src/devices/machine/spg_renderer.cpp index c9156585441..19a0cbaff05 100644 --- a/src/devices/machine/spg_renderer.cpp +++ b/src/devices/machine/spg_renderer.cpp @@ -419,24 +419,29 @@ void spg_renderer_device::draw_page(bool read_from_csspace, bool has_extended_ti uint32_t total_width; uint32_t y_mask; uint32_t screenwidth; - uint32_t drawwidthmask; - if (read_from_csspace && ((attr >> 15) & 0x1)) + + if (read_from_csspace && (attr & 0x8000)) // is this only available in high res mode, or always? { // just a guess based on this being set on the higher resolution tilemaps we've seen, could be 100% incorrect register total_width = 1024; - y_mask = 0x1ff; + y_mask = 0x200; screenwidth = 640; - drawwidthmask = 0x400 - 1; } else { total_width = 512; - y_mask = 0xff; + y_mask = 0x100; screenwidth = 320; - drawwidthmask = 0x200 - 1; } + if (has_extended_tilemaps && (attr & 0x4000)) // is this only available in high res mode, or always? + { + y_mask <<= 1; // double height tilemap? + } + + const uint32_t drawwidthmask = total_width - 1; + y_mask--; // turn into actual mask const uint32_t xscroll = scrollregs[0]; const uint32_t yscroll = scrollregs[1]; @@ -471,8 +476,16 @@ void spg_renderer_device::draw_page(bool read_from_csspace, bool has_extended_ti int realxscroll = xscroll; if (row_scroll) { - // Tennis in My Wireless Sports confirms the need to add the scroll value here rather than rowscroll being screen-aligned - realxscroll += (int16_t)scrollram[(logical_scanline + yscroll) & 0xff]; + if (!has_extended_tilemaps) + { + // Tennis in My Wireless Sports confirms the need to add the scroll value here rather than rowscroll being screen-aligned + realxscroll += (int16_t)scrollram[(logical_scanline + yscroll) & 0xff]; + } + else + { + // the logic seems to be different on GPL16250, see Galaxian in paccon and Crazy Moto in myac220, is this mode be selected or did behavior just change? + realxscroll += (int16_t)scrollram[logical_scanline & 0xff]; + } } const int upperscrollbits = (realxscroll >> (tile_width + 3)); @@ -499,7 +512,24 @@ void spg_renderer_device::draw_page(bool read_from_csspace, bool has_extended_ti tile = (ctrl & 0x0004) ? spc.read_word(tilemap_rambase) : spc.read_word(tilemap_rambase + tile_address); if (!tile) - continue; + { + if (!has_extended_tilemaps) + { + // always skip on older SPG types? + continue; + } + else if (m_video_regs_7f & 0x0002) + { + // Galaga in paccon won't render '0' characters in the scoring table if you skip empty tiles, so maybe GPL16250 doesn't skip? - extra tile bits from extended read make no difference + + // probably not based on register m_video_regs_7f, but paccon galaga needs no skip, jak_gtg and jak_hmhsm needs to skip + //49 0100 1001 no skip (paccon galaga) + //4b 0100 1011 skip (paccon pacman) + //53 0101 0011 skip (jak_gtg, jak_hmhsm) + continue; + } + } + uint32_t tileattr = attr; uint32_t tilectrl = ctrl; @@ -537,7 +567,11 @@ void spg_renderer_device::draw_page(bool read_from_csspace, bool has_extended_ti tilectrl |= (exattribute << 2) & 0x0100; // blend } - blend = ((tileattr & 0x4000 || tilectrl & 0x0100)) ? BlendOn : BlendOff; + if (!has_extended_tilemaps) + blend = (tilectrl & 0x0100) ? BlendOn : BlendOff; + else + blend = ((/*tileattr & 0x4000 ||*/ tilectrl & 0x0100)) ? BlendOn : BlendOff; // is this logic even correct or should it just be like above? where is the extra enable needed? + flip_x = (tileattr & 0x0004) ? FlipXOn : FlipXOff; flip_y = (tileattr & 0x0008); @@ -586,6 +620,7 @@ void spg_renderer_device::draw_sprite(bool read_from_csspace, bool has_extended_ // screenheight = 480; screenheight = 512; xmask = 0x3ff; + ymask = 0x3ff; } const uint32_t tile_h = 8 << ((attr & 0x00c0) >> 6); @@ -680,7 +715,7 @@ void spg_renderer_device::draw_sprite(bool read_from_csspace, bool has_extended_ else { // clipped from top - int tempfirstline = firstline - 0x200; + int tempfirstline = firstline - (screenheight<<1); int templastline = lastline; int scanx = scanline - tempfirstline; @@ -690,7 +725,7 @@ void spg_renderer_device::draw_sprite(bool read_from_csspace, bool has_extended_ } // clipped against the bottom tempfirstline = firstline; - templastline = lastline + 0x200; + templastline = lastline + (screenheight<<1); scanx = scanline - tempfirstline; if ((scanx >= 0) && (scanline <= templastline)) diff --git a/src/mame/drivers/generalplus_gpl16250_nand.cpp b/src/mame/drivers/generalplus_gpl16250_nand.cpp index 0ea2e9ba457..2d77470dde6 100644 --- a/src/mame/drivers/generalplus_gpl16250_nand.cpp +++ b/src/mame/drivers/generalplus_gpl16250_nand.cpp @@ -820,7 +820,7 @@ CONS(2008, jak_hmhsm, 0, 0, generalplus_gpac800, jak_hsm, generalplus_gp CONS(2008, jak_umdf, 0, 0, generalplus_gpac800, jak_hsm, generalplus_gpac800_game_state, nand_init210_32mb, "JAKKS Pacific Inc / Handheld Games", "Ultimotion - Disney Fairies Sleeping Beauty & TinkerBell (JAKKS Pacific TV Game)", MACHINE_NO_SOUND | MACHINE_NOT_WORKING) // Ultimotion Swing Zone is SPG29xx instead -// There were 1 player and 2 player versions for several of the JAKKS guns. The 2nd gun appears to be simply a controller (no AV connectors) but as they were separate products with the 2 player verisons being released up to a year after the original, the code could differ. +// There were 1 player and 2 player versions for several of the JAKKS guns. The 2nd gun appears to be simply a controller (no AV connectors) but as they were separate products with the 2 player versions being released up to a year after the original, the code could differ. // If they differ, it is currently uncertain which versions these ROMs are from CONS(2012, jak_wdzh, 0, 0, generalplus_gpac800, jak_car2, generalplus_gpac800_game_state, nand_init210, "JAKKS Pacific Inc / Merge Interactive", "The Walking Dead: Zombie Hunter (JAKKS Pacific TV Game)", MACHINE_NO_SOUND | MACHINE_NOT_WORKING) // gun games all had Atmel 16CM (24C16). CONS(2013, jak_duck, 0, 0, generalplus_gpac800, jak_car2, generalplus_gpac800_game_state, nand_init210_32mb, "JAKKS Pacific Inc / Merge Interactive", "Duck Commander (JAKKS Pacific TV Game)", MACHINE_NO_SOUND | MACHINE_NOT_WORKING) // no 2 Player version was released