various GPL16250 tweaks (DMA, video rendering etc.) (nw) (#6751)

* some gormiti progress (nw)

* debugging aids (nw)

* trying (and mostly failing) to understand how background palette selection works (nw)

* disable some older hacks for the time being, even if disabling then makes some bits worse (nw)

* tweaks (nw)

* some tweaks to DMA behavior in GPL16250 for Power Rangers Force in Time and Disney Fairies (nw)

* slight unSP 'exp' change (probably never used tho) (nw)
This commit is contained in:
David Haywood 2020-05-27 21:24:09 +01:00 committed by GitHub
parent eec46650ff
commit edc883ea7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 285 additions and 156 deletions

View File

@ -379,7 +379,7 @@ void unsp_12_device::execute_fxxx_101_group(uint16_t op)
if (r4 & 0x8000)
{
// r2 undefined (code will check for this and avoid calculations
m_core->m_r[REG_R2] = count_leading_ones(0xffff0000 | r4) - 17;
}
else
{

View File

@ -67,9 +67,24 @@ void sunplus_gcm394_base_device::write_dma_params(int channel, int offset, uint1
m_dma_params[offset][channel] = data;
// TODO: very likely DMA happens whenever the length is not 0, as long as it's been enabled previously
// jak_prft doesn't rewrite the offset 0 register between requests, and instead writes the length
// as the final thing for each new request. other games do not write the length last, but turn off
// register 0 before writing params, and enable it again afterwards
// if that's the case, this code can be refactored to work on 'length' instead of the m_dma_latched
if (offset == 3)
{
m_dma_latched[channel] = true;
if (m_dma_params[0][channel] & 1)
trigger_systemm_dma(space, channel);
}
if (offset == 0 && (data & 1))
{
trigger_systemm_dma(space, channel);
if (m_dma_latched[channel])
trigger_systemm_dma(space, channel);
}
}
@ -152,7 +167,6 @@ void sunplus_gcm394_base_device::trigger_systemm_dma(address_space &space, int c
// wrlshunt transfers ROM to RAM, all RAM write addresses have 0x800000 in the destination set
address_space& mem = this->space(AS_PROGRAM);
source &= 0x0fffffff;
length &= 0x0fffffff; // gormiti
@ -188,6 +202,8 @@ void sunplus_gcm394_base_device::trigger_systemm_dma(address_space &space, int c
// note, these patch the code copied to SRAM so the 'PROGRAM ROM' check fails (it passes otherwise)
//address_space& mem = this->space(AS_PROGRAM);
//if (mem.read_word(0x4368c) == 0x4846)
// mem.write_word(0x4368c, 0x4840); // cars 2 force service mode
@ -195,16 +211,21 @@ void sunplus_gcm394_base_device::trigger_systemm_dma(address_space &space, int c
// mem.write_word(0x34410, 0x4840); // golden tee force service mode
// what is it waiting for when we need these? (needed on some service mode screens)
if (mem.read_word(0x3f368) == 0x4840)
mem.write_word(0x3f368, 0x4841); // cars 2 IRQ? wait hack
//if (mem.read_word(0x3f368) == 0x4840)
// mem.write_word(0x3f368, 0x4841); // cars 2 IRQ? wait hack
if (mem.read_word(0x4d8d4) == 0x4840)
mem.write_word(0x4d8d4, 0x4841); // golden tee IRQ? wait hack
//if (mem.read_word(0x4d8d4) == 0x4840)
// mem.write_word(0x4d8d4, 0x4841); // golden tee IRQ? wait hack
// clear params after operation
m_dma_params[0][channel] = m_dma_params[1][channel] = m_dma_params[2][channel] = m_dma_params[3][channel] = m_dma_params[4][channel] = m_dma_params[5][channel] = m_dma_params[6][channel] = 0x0000;
m_dma_params[0][channel] = m_dma_params[0][channel] & 0x00f7;
m_dma_params[1][channel] = m_dma_params[2][channel] = m_dma_params[3][channel] = m_dma_params[4][channel] = m_dma_params[5][channel] = m_dma_params[6][channel] = 0x0000;
m_dma_latched[channel] = false;
//machine().debug_break();
}
WRITE16_MEMBER(sunplus_gcm394_base_device::system_dma_7abf_unk_w)
@ -772,7 +793,7 @@ void sunplus_gcm394_base_device::base_internal_map(address_map &map)
// these don't exist on older SPG
map(0x00707c, 0x00707c).r(m_spg_video, FUNC(gcm394_base_video_device::video_707c_r)); // wrlshunt polls this waiting for 0x8000, is this some kind of manual port-based data upload?
map(0x00707e, 0x00707e).w(m_spg_video, FUNC(gcm394_base_video_device::video_dma_unk_w)); // written around same time as DMA, seems to select alt sprite bank
map(0x00707e, 0x00707e).w(m_spg_video, FUNC(gcm394_base_video_device::video_707e_spritebank_w)); // written around same time as DMA, seems to select alt sprite bank
map(0x00707f, 0x00707f).rw(m_spg_video, FUNC(gcm394_base_video_device::video_707f_r), FUNC(gcm394_base_video_device::video_707f_w));
// another set of registers for something?
@ -1445,6 +1466,7 @@ void sunplus_gcm394_base_device::device_reset()
{
m_dma_params[i][j] = 0x0000;
}
m_dma_latched[j] = false;
}
// 78xx unknown

View File

@ -83,10 +83,11 @@ public:
void set_cs_space(address_space* csspace) { m_cs_space = csspace; }
void set_paldisplaybank_high_hack(int pal_displaybank_high) { m_spg_video->set_paldisplaybank_high(pal_displaybank_high); }
//void set_paldisplaybank_high_hack(int pal_displaybank_high) { m_spg_video->set_paldisplaybank_high(pal_displaybank_high); }
void set_alt_tile_addressing_hack(int alt_tile_addressing) { m_spg_video->set_alt_tile_addressing(alt_tile_addressing); }
void set_pal_sprites_hack(int pal_sprites) { m_spg_video->set_pal_sprites(pal_sprites); }
void set_pal_back_hack(int pal_back) { m_spg_video->set_pal_back(pal_back); }
//void set_pal_sprites_hack(int pal_sprites) { m_spg_video->set_pal_sprites(pal_sprites); }
//void set_pal_back_hack(int pal_back) { m_spg_video->set_pal_back(pal_back); }
void set_alt_extrasprite_hack(int alt_extrasprite_hack) { m_spg_video->set_alt_extrasprite(alt_extrasprite_hack); }
void set_romtype(int romtype) { m_romtype = romtype; }
@ -119,6 +120,7 @@ protected:
devcb_write16 m_portd_out;
uint16_t m_dma_params[8][4];
bool m_dma_latched[4];
// unk 78xx
uint16_t m_7803;
@ -130,7 +132,6 @@ protected:
uint16_t m_7816;
uint16_t m_7817;
uint16_t m_7819;
uint16_t m_782x[5];

View File

@ -129,9 +129,10 @@ gcm394_base_video_device::gcm394_base_video_device(const machine_config &mconfig
m_space_read_cb(*this),
m_rowscroll(*this, "^rowscroll"),
m_rowzoom(*this, "^rowzoom"),
m_pal_displaybank_high(0),
m_pal_sprites(0x500),
m_pal_back(0x100),
// m_pal_displaybank_high(0),
// m_pal_sprites(0x100),
// m_pal_back(0x000),
m_alt_extrasprite_hack(0),
m_alt_tile_addressing(0)
{
}
@ -325,7 +326,7 @@ void gcm394_base_video_device::device_start()
save_item(NAME(m_page0_addr_msb));
save_item(NAME(m_page1_addr_lsb));
save_item(NAME(m_page1_addr_msb));
save_item(NAME(m_707e_videodma_bank));
save_item(NAME(m_707e_spritebank));
save_item(NAME(m_videodma_size));
save_item(NAME(m_videodma_dest));
save_item(NAME(m_videodma_source));
@ -366,7 +367,7 @@ void gcm394_base_video_device::device_start()
save_item(NAME(m_spriteextra));
save_item(NAME(m_paletteram));
save_item(NAME(m_maxgfxelement));
save_item(NAME(m_pal_displaybank_high));
// save_item(NAME(m_pal_displaybank_high));
save_item(NAME(m_alt_tile_addressing));
}
@ -421,7 +422,7 @@ void gcm394_base_video_device::device_reset()
m_7087 = 0x0000;
m_7088 = 0x0000;
m_707e_videodma_bank = 0x0000;
m_707e_spritebank = 0x0000;
m_videodma_size = 0x0000;
m_videodma_dest = 0x0000;
m_videodma_source = 0x0000;
@ -506,28 +507,6 @@ void gcm394_base_video_device::draw(const rectangle &cliprect, uint32_t line, ui
int current_palette_offset = palette_offset;
// for planes above 4bpp palette ends up being pulled from different places?
if (nc_bpp < 6)
{
// 2bpp
// 4bpp
if (m_pal_displaybank_high) // how is this set?
current_palette_offset |= 0x0800;
}
else if (nc_bpp < 8)
{
// 6bpp
// current_palette_offset |= 0x0800;
}
else
{
//pen = machine().rand() & 0x1f;
// 8bpp
}
uint32_t pal = current_palette_offset + pen;
bits &= 0xffff;
@ -564,7 +543,7 @@ void gcm394_base_video_device::draw(const rectangle &cliprect, uint32_t line, ui
}
}
void gcm394_base_video_device::draw_page(const rectangle &cliprect, uint32_t scanline, int priority, uint32_t bitmap_addr, uint16_t *regs, uint16_t *scroll)
void gcm394_base_video_device::draw_page(const rectangle &cliprect, uint32_t scanline, int priority, uint32_t bitmap_addr, uint16_t *regs, uint16_t *scroll, int which)
{
uint32_t xscroll = scroll[0];
uint32_t yscroll = scroll[1];
@ -574,22 +553,48 @@ void gcm394_base_video_device::draw_page(const rectangle &cliprect, uint32_t sca
uint32_t palette_map = regs[3];
address_space &space = m_cpu->space(AS_PROGRAM);
if (!(ctrl_reg & PAGE_ENABLE_MASK))
// attr_reg bits
// -Bzz pppp hhww ffbb
//
// B = blend
// zz = depth
// pppp = palette
// ff = flips
// bb = bpp
// hh = height
// ww = width
// ctrl_reg bits
// ---- ---B h--r ewRl
//
// e = enable
// l = bitmape/line mode
// r = rowscroll
// w = wallpaper mode
// R = regset mode
// h = high colour
// B = blend
if (!(ctrl_reg & 0x0008))
{
return;
}
if (((attr_reg & PAGE_PRIORITY_FLAG_MASK) >> PAGE_PRIORITY_FLAG_SHIFT) != priority)
if (((attr_reg & 0x3000) >> 12) != priority)
{
return;
}
if (ctrl_reg & 0x01) // bitmap mode jak_car2 and jak_s500 use for the ingame race sections, also have a bitmap test in test mode
if (ctrl_reg & 0x0001) // bitmap mode jak_car2 and jak_s500 use for the ingame race sections, also have a bitmap test in test mode
{
if (ctrl_reg & 0x10)
popmessage("bitmap mode %08x with rowscroll\n", bitmap_addr);
else
popmessage("bitmap mode %08x\n", bitmap_addr);
if (0)
{
if (ctrl_reg & 0x0010)
popmessage("bitmap mode %08x with rowscroll\n", bitmap_addr);
else
popmessage("bitmap mode %08x\n", bitmap_addr);
}
// note, in interlace modes it appears every other line is unused? (480 entry table, but with blank values)
// and furthermore the rowscroll and rowzoom tables only have 240 entries, not enough for every line
@ -655,15 +660,15 @@ void gcm394_base_video_device::draw_page(const rectangle &cliprect, uint32_t sca
}
else
{
uint32_t tile_h = 8 << ((attr_reg & PAGE_TILE_HEIGHT_MASK) >> PAGE_TILE_HEIGHT_SHIFT);
uint32_t tile_w = 8 << ((attr_reg & PAGE_TILE_WIDTH_MASK) >> PAGE_TILE_WIDTH_SHIFT);
uint32_t tile_h = 8 << ((attr_reg & 0x00c0) >> 6);
uint32_t tile_w = 8 << ((attr_reg & 0x0030) >> 4);
int total_width;
int use_alt_drawmode = m_alt_tile_addressing;
int y_mask = 0;
// just a guess based on this being set on the higher resolution tilemaps we've seen, could be 100% incorrect register
if ((attr_reg >> 14) & 0x2)
if ((attr_reg >> 15) & 0x1)
{
total_width = 1024;
y_mask = 0x1ff;
@ -687,71 +692,99 @@ void gcm394_base_video_device::draw_page(const rectangle &cliprect, uint32_t sca
{
uint32_t yy = ((tile_h * y0 - yscroll + 0x10) & y_mask) - 0x10;
uint32_t xx = (tile_w * x0 - xscroll) & (total_width-1);
uint32_t tile = (ctrl_reg & PAGE_WALLPAPER_MASK) ? space.read_word(tilemap) : space.read_word(tilemap + tile_address);
uint32_t tile = (ctrl_reg & 0x0004) ? space.read_word(tilemap) : space.read_word(tilemap + tile_address);
if (!tile)
continue;
uint32_t tileattr = attr_reg;
uint32_t tilectrl = ctrl_reg;
bool blend;
bool row_scroll;
bool flip_x;
uint32_t yflipmask;
uint32_t palette_offset;
blend = (tileattr & 0x4000 || tilectrl & 0x0100);
row_scroll = (tilectrl & 0x0010);
blend = (attr_reg & 0x4000 || ctrl_reg & 0x0100);
row_scroll = (ctrl_reg & 0x0010);
if ((ctrl_reg & 2) == 0) // RegSet:0
if ((ctrl_reg & 0x0002) == 0) // RegSet:0
{
uint16_t palette = (ctrl_reg & PAGE_WALLPAPER_MASK) ? space.read_word(palette_map) : space.read_word(palette_map + tile_address / 2);
uint16_t palette = (ctrl_reg & 0x0004) ? space.read_word(palette_map) : space.read_word(palette_map + tile_address / 2);
if (x0 & 1)
palette >>= 8;
flip_x = palette & 0x0010;
yflipmask = (palette & 0x0020) ? tile_h - 1 : 0;
palette_offset = (palette & 0x0f) << 4;
// 'palette' format
// --ff pppp
//
// f = flip bits
// p = palette
//tilectrl &= ~0x0100;
//tilectrl |= (palette << 2) & 0x0100; // blend
flip_x = palette & 0x10;
yflipmask = (palette & 0x20) ? tile_h - 1 : 0;
palette_offset = (palette & 0x0f) << 4;
}
else // RegSet:1
{
if (m_alt_tile_addressing == 0)
{
// smartfp needs the attribute table to contain extra tile bits even if regset is 1
uint16_t palette = (ctrl_reg & PAGE_WALLPAPER_MASK) ? space.read_word(palette_map) : space.read_word(palette_map + tile_address / 2);
uint16_t palette = (ctrl_reg & 0x0004) ? space.read_word(palette_map) : space.read_word(palette_map + tile_address / 2);
if (x0 & 1)
palette >>= 8;
// 'palette' format
// -- -ttt
//
// t = extra tile number bits
tile |= (palette & 0x0007) << 16;
flip_x = (tileattr & TILE_X_FLIP);
yflipmask = tileattr & TILE_Y_FLIP ? tile_h - 1 : 0;
palette_offset = (tileattr & 0x0f00) >> 4;
}
else
{
flip_x = (tileattr & TILE_X_FLIP);
yflipmask = tileattr & TILE_Y_FLIP ? tile_h - 1 : 0;
palette_offset = (tileattr & 0x0f00) >> 4;
}
flip_x = (attr_reg & 0x0004);
yflipmask = attr_reg & 0x0008 ? tile_h - 1 : 0;
palette_offset = (attr_reg & 0x0f00) >> 4;
}
const uint8_t bpp = attr_reg & 0x0003;
// HACKS
// There must be a select bit for the tilemap palettes somewhere, but where?!
//palette_offset |= 0x0900;
palette_offset |= m_pal_back;
// the different games in paccon also expect a variety of different configs here, maybe a good place to look
const uint8_t bpp = tileattr & 0x0003;
if (m_703a_palettebank & 1) // this actually seems to be the sprite palette bank enable, but for tkmag220 it gives us an easy way to ignore the logic below
{
if (which == 0) // tilemap 0
{
if (ctrl_reg & 0x0002) // RegSet:1
{
// smartfp has a conflict between the bootlogos and the first screen, it's in regset mode, no obvious difference in registers but needs palette from different places?
// not even m_707f changes here, which makes the m_707f case specific hacks for jak_s500 below very unlikely to actually be related
if ((bpp + 1) * 2 == 4)
if (m_alt_tile_addressing == 0)
palette_offset |= 0x200;
}
}
if (which == 1)
{
// can't do this for jak_s500 logos
// jak_s500 also uses this tilemap in both 4 and 6bpp modes expecting the same palette base, so the hack used for smartfp on tilemap 0 is not applicable here
// m_707f != 0x2d3 for jak_S500 main menu
if ((m_707f != 0x53) && (m_707f != 0x63) && (m_707f != 0x2d3))
palette_offset |= 0x200;
}
// jak_car2 screen transitions use layers 2 and 3 the same way, alternating each frame
if (which == 2)
{
// jak_s500 title screen + loading screen before race
if ((m_707f == 0x2d3) || (m_707f == 0x2db))
palette_offset |= 0x200;
}
}
//palette_offset |= m_pal_back;
if (blend)
{
@ -829,26 +862,39 @@ void gcm394_base_video_device::draw_sprite(const rectangle& cliprect, uint32_t s
else
addressing_mode = 1;
if (addressing_mode == 0) // smartfp, paccon
tile |= m_spriteextra[base_addr / 4] << 16;
if (m_alt_extrasprite_hack == 0)
if (addressing_mode == 0) // smartfp, paccon
tile |= m_spriteextra[base_addr / 4] << 16;
if (((attr & PAGE_PRIORITY_FLAG_MASK) >> PAGE_PRIORITY_FLAG_SHIFT) != priority)
if (m_alt_extrasprite_hack == 1) // jak_prft
tile |= (m_spriteextra[base_addr] & 0x000f) << 16;
if (((attr & 0x3000) >> 12) != priority)
{
return;
}
const uint32_t h = 8 << ((attr & PAGE_TILE_HEIGHT_MASK) >> PAGE_TILE_HEIGHT_SHIFT);
const uint32_t w = 8 << ((attr & PAGE_TILE_WIDTH_MASK) >> PAGE_TILE_WIDTH_SHIFT);
// attr PBzz pppp hhww ffdd
// P = high palette bit
// b = blend enable
// zz = priority
// pppp = palette
// hh = height
// ww = width
// ff = flips
// dd = depth
const uint32_t h = 8 << ((attr & 0x00c0) >> 6);
const uint32_t w = 8 << ((attr & 0x0030) >> 4);
if (!(m_7042_sprite & SPRITE_COORD_TL_MASK))
if (!(m_7042_sprite & 0x0002))
{
x = ((screenwidth / 2) + x) - w / 2;
y = ((screenheight / 2) - y) - (h / 2) + 8;
}
x &= (x_max - 1);
y &= 0x01ff;
@ -872,21 +918,34 @@ void gcm394_base_video_device::draw_sprite(const rectangle& cliprect, uint32_t s
// different attribute use?
if (screenwidth == 320)
{
flip_x = (attr & TILE_X_FLIP);
if (m_alt_extrasprite_hack == 0)
{
flip_x = (attr & 0x0004);
yflipmask = attr & 0x0008 ? h - 1 : 0;
}
else
{
flip_x = 0;
yflipmask = 0;
}
bpp = attr & 0x0003;
yflipmask = attr & TILE_Y_FLIP ? h - 1 : 0;
palette_offset = (attr & 0x0f00) >> 4;
}
else
{
flip_x = 0;// (attr & TILE_X_FLIP);
bpp = attr & 0x0003;
yflipmask = 0;// attr& TILE_Y_FLIP ? h - 1 : 0;
bpp = attr & 0x0003;
palette_offset = (attr & 0x0f00) >> 4;
}
//palette_offset |= 0x0d00;
palette_offset |= m_pal_sprites;
if (m_703a_palettebank & 1)
palette_offset |= 0x100;
if (attr & 0x8000)
palette_offset |= 0x200;
if (blend)
{
@ -927,6 +986,39 @@ uint32_t gcm394_base_video_device::screen_update(screen_device &screen, bitmap_r
// jak_s500 briely sets pen 0 of the layer to magenta, but then ends up erasing it
if (0)
{
uint16_t attr0 = m_tmap0_regs[0];
uint16_t attr1 = m_tmap1_regs[0];
uint16_t attr2 = m_tmap2_regs[0];
uint16_t attr3 = m_tmap3_regs[0];
uint16_t ctrl0 = m_tmap0_regs[1];
uint16_t ctrl1 = m_tmap1_regs[1];
uint16_t ctrl2 = m_tmap2_regs[1];
uint16_t ctrl3 = m_tmap3_regs[1];
popmessage(
"p0ctrl u:%02x Bl:%d HC:%d u:%d u:%d RS:%d E:%d WP:%d Rg:%d Bm:%d\n"
"p1ctrl u:%02x Bl:%d HC:%d u:%d u:%d RS:%d E:%d WP:%d Rg:%d Bm:%d\n"
"p2ctrl u:%02x Bl:%d HC:%d u:%d u:%d RS:%d E:%d WP:%d Rg:%d Bm:%d\n"
"p3ctrl u:%02x Bl:%d HC:%d u:%d u:%d RS:%d E:%d WP:%d Rg:%d Bm:%d\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"
"palbank %04x 707e: %04x 707f: %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),
(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),
(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),
(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),
(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),
m_703a_palettebank, m_707e_spritebank, m_707f
);
}
//const uint16_t bgcol = 0x7c1f; // magenta
const uint16_t bgcol = 0x0000; // black
@ -955,10 +1047,10 @@ uint32_t gcm394_base_video_device::screen_update(screen_device &screen, bitmap_r
if (1)
{
if ((!(machine().input().code_pressed(KEYCODE_Q))) || draw_all) draw_page(cliprect, scanline, i, (m_page0_addr_lsb | (m_page0_addr_msb<<16)), m_tmap0_regs, m_tmap0_scroll);
if ((!(machine().input().code_pressed(KEYCODE_W))) || draw_all) draw_page(cliprect, scanline, i, (m_page1_addr_lsb | (m_page1_addr_msb<<16)), m_tmap1_regs, m_tmap1_scroll);
if ((!(machine().input().code_pressed(KEYCODE_E))) || draw_all) draw_page(cliprect, scanline, i, (m_page2_addr_lsb | (m_page2_addr_msb<<16)), m_tmap2_regs, m_tmap2_scroll);
if ((!(machine().input().code_pressed(KEYCODE_R))) || draw_all) draw_page(cliprect, scanline, i, (m_page3_addr_lsb | (m_page3_addr_msb<<16)), m_tmap3_regs, m_tmap3_scroll);
if ((!(machine().input().code_pressed(KEYCODE_Q))) || draw_all) draw_page(cliprect, scanline, i, (m_page0_addr_lsb | (m_page0_addr_msb<<16)), m_tmap0_regs, m_tmap0_scroll, 0);
if ((!(machine().input().code_pressed(KEYCODE_W))) || draw_all) draw_page(cliprect, scanline, i, (m_page1_addr_lsb | (m_page1_addr_msb<<16)), m_tmap1_regs, m_tmap1_scroll, 1);
if ((!(machine().input().code_pressed(KEYCODE_E))) || draw_all) draw_page(cliprect, scanline, i, (m_page2_addr_lsb | (m_page2_addr_msb<<16)), m_tmap2_regs, m_tmap2_scroll, 2);
if ((!(machine().input().code_pressed(KEYCODE_R))) || draw_all) draw_page(cliprect, scanline, i, (m_page3_addr_lsb | (m_page3_addr_msb<<16)), m_tmap3_regs, m_tmap3_scroll, 3);
}
if ((!(machine().input().code_pressed(KEYCODE_T))) || draw_all) draw_sprites(cliprect, scanline, i);
@ -1327,7 +1419,7 @@ WRITE16_MEMBER(gcm394_base_video_device::video_dma_size_trigger_w)
LOGMASKED(LOG_GCM394_VIDEO_DMA, "%s:gcm394_base_video_device::video_dma_size_trigger_w %04x\n", machine().describe_context(), data);
m_videodma_size = data;
LOGMASKED(LOG_GCM394_VIDEO_DMA, "%s: doing sprite / video DMA source %04x dest %04x size %04x value of 707e (bank) %04x value of 707f %04x\n", machine().describe_context(), m_videodma_source, m_videodma_dest, m_videodma_size, m_707e_videodma_bank, m_707f );
LOGMASKED(LOG_GCM394_VIDEO_DMA, "%s: doing sprite / video DMA source %04x dest %04x size %04x value of 707e (bank) %04x value of 707f %04x\n", machine().describe_context(), m_videodma_source, m_videodma_dest, m_videodma_size, m_707e_spritebank, m_707f );
for (int i = 0; i <= m_videodma_size; i++)
{
@ -1347,10 +1439,10 @@ WRITE16_MEMBER(gcm394_base_video_device::video_dma_size_trigger_w)
}
}
WRITE16_MEMBER(gcm394_base_video_device::video_dma_unk_w)
WRITE16_MEMBER(gcm394_base_video_device::video_707e_spritebank_w)
{
LOGMASKED(LOG_GCM394_VIDEO, "%s:gcm394_base_video_device::video_dma_unk_w %04x\n", machine().describe_context(), data);
m_707e_videodma_bank = data;
LOGMASKED(LOG_GCM394_VIDEO, "%s:gcm394_base_video_device::video_707e_spritebank_w %04x\n", machine().describe_context(), data);
m_707e_spritebank = data;
}
READ16_MEMBER(gcm394_base_video_device::video_707c_r)
@ -1420,6 +1512,10 @@ WRITE16_MEMBER(gcm394_base_video_device::video_703a_palettebank_w)
// lazertag uses 2 banks (0 and 8)
// tkmag220 only uses 1 bank (0)
// ---- bb-s
// bb = write bank?
// s = sprite palette bank select?
LOGMASKED(LOG_GCM394_VIDEO, "%s:gcm394_base_video_device::video_703a_palettebank_w %04x\n", machine().describe_context(), data);
m_703a_palettebank = data;
}
@ -1565,33 +1661,33 @@ WRITE16_MEMBER(gcm394_base_video_device::spriteram_w)
// however for 707e only 0/1 is written, and it also gets written before system DMA, so despite being in the video DMA
// region seems to operate separate from that.
if (m_707e_videodma_bank == 0x0000)
if (m_707e_spritebank == 0x0000)
{
m_spriteram[offset] = data;
}
else if (m_707e_videodma_bank == 0x0001)
else if (m_707e_spritebank == 0x0001)
{
m_spriteextra[offset] = data;
}
else
{
LOGMASKED(LOG_GCM394_VIDEO, "%s: spriteram_w %04x %04x unknown bank %04x\n", machine().describe_context(), offset, data, m_707e_videodma_bank);
LOGMASKED(LOG_GCM394_VIDEO, "%s: spriteram_w %04x %04x unknown bank %04x\n", machine().describe_context(), offset, data, m_707e_spritebank);
}
}
READ16_MEMBER(gcm394_base_video_device::spriteram_r)
{
if (m_707e_videodma_bank == 0x0000)
if (m_707e_spritebank == 0x0000)
{
return m_spriteram[offset];
}
else if (m_707e_videodma_bank == 0x0001)
else if (m_707e_spritebank == 0x0001)
{
return m_spriteextra[offset];
}
else
{
LOGMASKED(LOG_GCM394_VIDEO, "%s: spriteram_r %04x unknown bank %04x\n", machine().describe_context(), offset, m_707e_videodma_bank);
LOGMASKED(LOG_GCM394_VIDEO, "%s: spriteram_r %04x unknown bank %04x\n", machine().describe_context(), offset, m_707e_spritebank);
return 0x0000;
}
}
@ -1606,8 +1702,7 @@ WRITE16_MEMBER(gcm394_base_video_device::palette_w)
}
else
{
offset |= (m_703a_palettebank & 0x000f) << 8;
offset |= (m_703a_palettebank & 0x000c) << 6;
m_paletteram[offset] = data;
uint32_t pal = m_rgb555_to_rgb888[data & 0x7fff];
@ -1627,7 +1722,7 @@ READ16_MEMBER(gcm394_base_video_device::palette_r)
}
else
{
offset |= (m_703a_palettebank & 0x000f) << 8;
offset |= (m_703a_palettebank & 0x000c) << 6;
return m_paletteram[offset];
}
}
@ -1666,7 +1761,9 @@ WRITE_LINE_MEMBER(gcm394_base_video_device::vblank)
if (m_video_irq_enable & 1)
{
m_video_irq_status |= 1;
// jak_prft expects 0x800 to be set in the status register or most of the main vblank code is skipped, why?
m_video_irq_status |= 1 | 0x800;
LOGMASKED(LOG_GCM394_VIDEO, "Setting video IRQ status to %04x\n", m_video_irq_status);
check_video_irq();
}

View File

@ -30,10 +30,13 @@ public:
void write_tmap_regs(int tmap, uint16_t* regs, int offset, uint16_t data);
void set_paldisplaybank_high(int pal_displaybank_high) { m_pal_displaybank_high = pal_displaybank_high; }
//void set_paldisplaybank_high(int pal_displaybank_high) { m_pal_displaybank_high = pal_displaybank_high; }
void set_alt_tile_addressing(int alt_tile_addressing) { m_alt_tile_addressing = alt_tile_addressing; }
void set_pal_sprites(int pal_sprites) { m_pal_sprites = pal_sprites; }
void set_pal_back(int pal_back) { m_pal_back = pal_back; }
void set_alt_extrasprite(int alt_extrasprite_hack) { m_alt_extrasprite_hack = alt_extrasprite_hack; }
//void set_pal_sprites(int pal_sprites) { m_pal_sprites = pal_sprites; }
//void set_pal_back(int pal_back) { m_pal_back = pal_back; }
DECLARE_READ16_MEMBER(tmap0_regs_r);
DECLARE_WRITE16_MEMBER(tmap0_regs_w);
@ -79,7 +82,7 @@ public:
DECLARE_WRITE16_MEMBER(video_dma_dest_w);
DECLARE_READ16_MEMBER(video_dma_size_busy_r);
DECLARE_WRITE16_MEMBER(video_dma_size_trigger_w);
DECLARE_WRITE16_MEMBER(video_dma_unk_w);
DECLARE_WRITE16_MEMBER(video_707e_spritebank_w);
DECLARE_READ16_MEMBER(video_703a_palettebank_r);
DECLARE_WRITE16_MEMBER(video_703a_palettebank_w);
@ -134,24 +137,6 @@ public:
protected:
enum
{
PAGE_ENABLE_MASK = 0x0008,
PAGE_WALLPAPER_MASK = 0x0004,
SPRITE_ENABLE_MASK = 0x0001,
SPRITE_COORD_TL_MASK = 0x0002,
PAGE_PRIORITY_FLAG_MASK = 0x3000,
PAGE_PRIORITY_FLAG_SHIFT = 12,
PAGE_TILE_HEIGHT_MASK = 0x00c0,
PAGE_TILE_HEIGHT_SHIFT = 6,
PAGE_TILE_WIDTH_MASK = 0x0030,
PAGE_TILE_WIDTH_SHIFT = 4,
TILE_X_FLIP = 0x0004,
TILE_Y_FLIP = 0x0008
};
static const device_timer_id TIMER_SCREENPOS = 2;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
@ -181,7 +166,7 @@ protected:
template<blend_enable_t Blend, rowscroll_enable_t RowScroll, flipx_t FlipX>
void draw(const rectangle &cliprect, uint32_t line, uint32_t xoff, uint32_t yoff, uint32_t bitmap_addr, uint32_t tile, int32_t h, int32_t w, uint8_t bpp, uint32_t yflipmask, uint32_t palette_offset, int addressing_mode);
void draw_page(const rectangle &cliprect, uint32_t scanline, int priority, uint32_t bitmap_addr, uint16_t *regs, uint16_t *scroll);
void draw_page(const rectangle &cliprect, uint32_t scanline, int priority, uint32_t bitmap_addr, uint16_t *regs, uint16_t *scroll, int which);
void draw_sprites(const rectangle& cliprect, uint32_t scanline, int priority);
void draw_sprite(const rectangle& cliprect, uint32_t scanline, int priority, uint32_t base_addr);
@ -199,7 +184,7 @@ protected:
uint16_t m_page1_addr_lsb;
uint16_t m_page1_addr_msb;
uint16_t m_707e_videodma_bank;
uint16_t m_707e_spritebank;
uint16_t m_videodma_size;
uint16_t m_videodma_dest;
uint16_t m_videodma_source;
@ -270,10 +255,12 @@ protected:
int m_maxgfxelement;
void decodegfx(const char* tag);
int m_pal_displaybank_high;
int m_pal_sprites;
int m_pal_back;
//int m_pal_displaybank_high;
//int m_pal_sprites;
//int m_pal_back;
int m_alt_extrasprite_hack;
int m_alt_tile_addressing;
};
class gcm394_video_device : public gcm394_base_video_device

View File

@ -176,7 +176,7 @@ void gcm394_game_state::machine_reset()
m_maincpu->reset(); // reset CPU so vector gets read etc.
m_maincpu->set_paldisplaybank_high_hack(1);
//m_maincpu->set_paldisplaybank_high_hack(1);
m_maincpu->set_alt_tile_addressing_hack(0);
}

View File

@ -739,7 +739,7 @@ void generalplus_gpac800_game_state::machine_reset()
m_maincpu->reset(); // reset CPU so vector gets read etc.
m_maincpu->set_paldisplaybank_high_hack(0);
//m_maincpu->set_paldisplaybank_high_hack(0);
m_maincpu->set_alt_tile_addressing_hack(1);
}
@ -823,6 +823,6 @@ CONS(2008, jak_umdf, 0, 0, generalplus_gpac800, jak_hsm, generalplus_gp
// 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.
// 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_swc, 0, 0, generalplus_gpac800, jak_car2, generalplus_gpac800_game_state, nand_init210_32mb, "JAKKS Pacific Inc / Merge Interactive", "Star Wars Clone Trooper (JAKKS Pacific TV Game)", MACHINE_NO_SOUND | MACHINE_NOT_WORKING)
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
CONS(2013, jak_swc, 0, 0, generalplus_gpac800, jak_car2, generalplus_gpac800_game_state, nand_init210_32mb, "JAKKS Pacific Inc / Merge Interactive", "Star Wars Clone Trooper (JAKKS Pacific TV Game)", MACHINE_NO_SOUND | MACHINE_NOT_WORKING)
CONS(2014, jak_wdbg, 0, 0, generalplus_gpac800, jak_car2, generalplus_gpac800_game_state, nand_init210_32mb, "JAKKS Pacific Inc / Super Happy Fun Fun", "The Walking Dead: Battleground (JAKKS Pacific TV Game)", MACHINE_NO_SOUND | MACHINE_NOT_WORKING)

View File

@ -444,9 +444,9 @@ void tkmag220_game_state::machine_reset()
m_upperbase = 0 * (0x1000000 / 2);
gcm394_game_state::machine_reset();
m_maincpu->set_paldisplaybank_high_hack(0);
m_maincpu->set_pal_sprites_hack(0x000);
m_maincpu->set_pal_back_hack(0x000);
//m_maincpu->set_paldisplaybank_high_hack(0);
//m_maincpu->set_pal_sprites_hack(0x000);
//m_maincpu->set_pal_back_hack(0x000);
m_maincpu->set_alt_tile_addressing_hack(1);
}

View File

@ -227,7 +227,7 @@ void wrlshunt_game_state::machine_reset()
m_maincpu->set_cs_space(m_memory->get_program());
m_maincpu->reset(); // reset CPU so vector gets read etc.
m_maincpu->set_paldisplaybank_high_hack(1);
//m_maincpu->set_paldisplaybank_high_hack(1);
m_maincpu->set_alt_tile_addressing_hack(1);
}
@ -309,7 +309,7 @@ void jak_s500_game_state::machine_reset()
m_maincpu->set_cs_space(m_memory->get_program());
m_maincpu->reset(); // reset CPU so vector gets read etc.
m_maincpu->set_paldisplaybank_high_hack(0);
//m_maincpu->set_paldisplaybank_high_hack(0);
m_maincpu->set_alt_tile_addressing_hack(1);
}
@ -317,7 +317,7 @@ void jak_s500_game_state::machine_reset()
void lazertag_game_state::machine_reset()
{
jak_s500_game_state::machine_reset();
m_maincpu->set_pal_sprites_hack(0x800);
//m_maincpu->set_pal_sprites_hack(0x800);
}
void paccon_game_state::machine_reset()
@ -326,6 +326,12 @@ void paccon_game_state::machine_reset()
m_maincpu->install_speedup_hack(0x6593, 0x30033);
}
void jak_prft_game_state::machine_reset()
{
jak_s500_game_state::machine_reset();
//m_maincpu->set_alt_tile_addressing_hack(0);
m_maincpu->set_alt_extrasprite_hack(1);
}
ROM_START( paccon )
//ROM_REGION16_BE( 0x40000, "maincpu:internal", ROMREGION_ERASE00 ) // not on this model? (or at least not this size, as CS base is different)
@ -503,8 +509,8 @@ CONS(2009, jak_s500, 0, 0, wrlshunt, jak_s500, jak_s500_game_state, init_wrlshun
CONS(2009, jak_smwm, 0, 0, wrlshunt, jak_s500, jak_s500_game_state, init_wrlshunt, "JAKKS Pacific Inc / HotGen Ltd", "Spider-Man Web Master (JAKKS Pacific TV Motion Game)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND)
CONS(2010, jak_pf, 0, 0, wrlshunt, jak_s500, jak_s500_game_state, init_wrlshunt, "JAKKS Pacific Inc / HotGen Ltd", "Phineas and Ferb: Best Game Ever! (JAKKS Pacific TV Motion Game)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND) // build date is 2009, but onscreen display is 2010
CONS(200?, jak_totm, 0, 0, wrlshunt, jak_s500, jak_s500_game_state, init_wrlshunt, "JAKKS Pacific Inc / HotGen Ltd", "Toy Story - Toys on the Move (JAKKS Pacific TV Motion Game)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND) // Toys on the Move has ISSI 404A
CONS(2009, jak_prft, 0, 0, wrlshunt, jak_s500, jak_s500_game_state, init_wrlshunt, "JAKKS Pacific Inc / Santa Cruz Games", "Power Rangers Force In Time (JAKKS Pacific TV Motion Game)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND)
CONS(2009, jak_tink, 0, 0, wrlshunt, jak_s500, jak_s500_game_state, init_wrlshunt, "JAKKS Pacific Inc / Santa Cruz Games", "Tinker Bell and the Lost Treasure (JAKKS Pacific TV Motion Game)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND)
CONS(2009, jak_prft, 0, 0, wrlshunt, jak_s500, jak_prft_game_state, init_wrlshunt, "JAKKS Pacific Inc / Santa Cruz Games", "Power Rangers Force In Time (JAKKS Pacific TV Motion Game)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND)
CONS(2009, jak_tink, 0, 0, wrlshunt, jak_s500, jak_prft_game_state, init_wrlshunt, "JAKKS Pacific Inc / Santa Cruz Games", "Tinker Bell and the Lost Treasure (JAKKS Pacific TV Motion Game)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND)
CONS(2009, jak_ths, 0, 0, wrlshunt, jak_s500, jak_s500_game_state, init_ths, "JAKKS Pacific Inc / Super Happy Fun Fun", "Triple Header Sports (JAKKS Pacific TV Motion Game)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND)
CONS(2011, wrlshunt, 0, 0, wrlshunt, wrlshunt, wrlshunt_game_state, init_wrlshunt, "Hamy / Kids Station Toys Inc", "Wireless Hunting Video Game System", MACHINE_NO_SOUND | MACHINE_NOT_WORKING)

View File

@ -64,7 +64,7 @@ void generalplus_gpspispi_game_state::machine_reset()
{
m_maincpu->reset(); // reset CPU so vector gets read etc.
m_maincpu->set_paldisplaybank_high_hack(0);
//m_maincpu->set_paldisplaybank_high_hack(0);
m_maincpu->set_alt_tile_addressing_hack(1);
}

View File

@ -113,5 +113,4 @@ protected:
private:
};
#endif

View File

@ -101,6 +101,23 @@ private:
};
class jak_prft_game_state : public jak_s500_game_state
{
public:
jak_prft_game_state(const machine_config& mconfig, device_type type, const char* tag) :
jak_s500_game_state(mconfig, type, tag)
{
}
protected:
virtual void machine_reset() override;
private:
};
#endif // MAME_INCLUDES_GENERALPLUS_GPL16250_ROMRAM_H