mirror of
https://github.com/holub/mame
synced 2025-07-06 18:39:28 +03:00
legionna.cpp: fixed regression in background tilemap colors for Godzilla (uses DMA mode 4 like Denjin Makai) [Angelo Salese]
This commit is contained in:
parent
afa6aa8b58
commit
66ebaeb41d
@ -104,7 +104,7 @@ READ8_MEMBER(legionna_state::denjinmk_sound_comms_r)
|
|||||||
return m_seibu_sound->main_r(space, (offset >> 1) & 7);
|
return m_seibu_sound->main_r(space, (offset >> 1) & 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
void legionna_state::legionna_cop_mem(address_map &map)
|
void legionna_state::legionna_cop_map(address_map &map)
|
||||||
{
|
{
|
||||||
map(0x100400, 0x100401).w(m_raiden2cop, FUNC(raiden2cop_device::cop_sprite_dma_param_lo_w)); // grainbow
|
map(0x100400, 0x100401).w(m_raiden2cop, FUNC(raiden2cop_device::cop_sprite_dma_param_lo_w)); // grainbow
|
||||||
map(0x100402, 0x100403).w(m_raiden2cop, FUNC(raiden2cop_device::cop_sprite_dma_param_hi_w)); // grainbow
|
map(0x100402, 0x100403).w(m_raiden2cop, FUNC(raiden2cop_device::cop_sprite_dma_param_hi_w)); // grainbow
|
||||||
@ -183,7 +183,7 @@ void legionna_state::legionna_cop_mem(address_map &map)
|
|||||||
|
|
||||||
void legionna_state::legionna_map(address_map &map)
|
void legionna_state::legionna_map(address_map &map)
|
||||||
{
|
{
|
||||||
legionna_cop_mem(map);
|
legionna_cop_map(map);
|
||||||
map(0x000000, 0x07ffff).rom();
|
map(0x000000, 0x07ffff).rom();
|
||||||
map(0x100000, 0x1003ff).ram();
|
map(0x100000, 0x1003ff).ram();
|
||||||
map(0x100470, 0x100471).nopw(); // toggles 0x2000 / 0x0000, tile bank on some games
|
map(0x100470, 0x100471).nopw(); // toggles 0x2000 / 0x0000, tile bank on some games
|
||||||
@ -213,7 +213,7 @@ void legionna_state::legionna_map(address_map &map)
|
|||||||
|
|
||||||
void legionna_state::heatbrl_map(address_map &map)
|
void legionna_state::heatbrl_map(address_map &map)
|
||||||
{
|
{
|
||||||
legionna_cop_mem(map);
|
legionna_cop_map(map);
|
||||||
map(0x000000, 0x07ffff).rom();
|
map(0x000000, 0x07ffff).rom();
|
||||||
map(0x100000, 0x1003ff).ram();
|
map(0x100000, 0x1003ff).ram();
|
||||||
map(0x100470, 0x100471).w(this, FUNC(legionna_state::heatbrl_setgfxbank));
|
map(0x100470, 0x100471).w(this, FUNC(legionna_state::heatbrl_setgfxbank));
|
||||||
@ -241,7 +241,7 @@ void legionna_state::heatbrl_map(address_map &map)
|
|||||||
|
|
||||||
void legionna_state::godzilla_map(address_map &map)
|
void legionna_state::godzilla_map(address_map &map)
|
||||||
{
|
{
|
||||||
legionna_cop_mem(map);
|
legionna_cop_map(map);
|
||||||
map(0x000000, 0x07ffff).rom();
|
map(0x000000, 0x07ffff).rom();
|
||||||
map(0x100000, 0x1003ff).ram();
|
map(0x100000, 0x1003ff).ram();
|
||||||
map(0x100470, 0x100471).w(this, FUNC(legionna_state::denjinmk_setgfxbank));
|
map(0x100470, 0x100471).w(this, FUNC(legionna_state::denjinmk_setgfxbank));
|
||||||
@ -270,12 +270,21 @@ void legionna_state::godzilla_map(address_map &map)
|
|||||||
map(0x106800, 0x106fff).ram();
|
map(0x106800, 0x106fff).ram();
|
||||||
map(0x107000, 0x107fff).ram(); /*Ani-DSP ram*/
|
map(0x107000, 0x107fff).ram(); /*Ani-DSP ram*/
|
||||||
map(0x108000, 0x11ffff).ram();
|
map(0x108000, 0x11ffff).ram();
|
||||||
|
// map(0xff0000, 0xffffff).ram(); // game reads here at Biollante stage in story mode (i.e. when Super X starts shooting).
|
||||||
|
// Development leftover/coding bug? Game doesn't seem to care at all anyway.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Denjin Makai: Looks like they specifically swapped address line A1 in this range?
|
||||||
|
// Initially thought it was a palette DMA mode 4 but it doesn't apply for Godzilla, causing color bugs in the background tilemap.
|
||||||
|
WRITE16_MEMBER(legionna_state::palette_swap_w)
|
||||||
|
{
|
||||||
|
offset^=1;
|
||||||
|
COMBINE_DATA(&m_swappal[offset]);
|
||||||
|
}
|
||||||
|
|
||||||
void legionna_state::denjinmk_map(address_map &map)
|
void legionna_state::denjinmk_map(address_map &map)
|
||||||
{
|
{
|
||||||
legionna_cop_mem(map);
|
legionna_cop_map(map);
|
||||||
map(0x000000, 0x0fffff).rom();
|
map(0x000000, 0x0fffff).rom();
|
||||||
map(0x100000, 0x1003ff).ram();
|
map(0x100000, 0x1003ff).ram();
|
||||||
map(0x100470, 0x100471).w(this, FUNC(legionna_state::denjinmk_setgfxbank));
|
map(0x100470, 0x100471).w(this, FUNC(legionna_state::denjinmk_setgfxbank));
|
||||||
@ -296,7 +305,7 @@ void legionna_state::denjinmk_map(address_map &map)
|
|||||||
map(0x101800, 0x101fff).ram(); // .w(this, FUNC(legionna_state::legionna_foreground_w).share("fore_data");
|
map(0x101800, 0x101fff).ram(); // .w(this, FUNC(legionna_state::legionna_foreground_w).share("fore_data");
|
||||||
map(0x102000, 0x1027ff).ram(); // .w(this, FUNC(legionna_state::legionna_midground_w).share("mid_data");
|
map(0x102000, 0x1027ff).ram(); // .w(this, FUNC(legionna_state::legionna_midground_w).share("mid_data");
|
||||||
map(0x102800, 0x103fff).ram(); // .w(this, FUNC(legionna_state::legionna_text_w).share("textram");
|
map(0x102800, 0x103fff).ram(); // .w(this, FUNC(legionna_state::legionna_text_w).share("textram");
|
||||||
map(0x104000, 0x104fff).ram();
|
map(0x104000, 0x104fff).ram().w(this, FUNC(legionna_state::palette_swap_w)).share("swappal");
|
||||||
map(0x105000, 0x105fff).ram().share("spriteram");
|
map(0x105000, 0x105fff).ram().share("spriteram");
|
||||||
map(0x106000, 0x107fff).ram();
|
map(0x106000, 0x107fff).ram();
|
||||||
map(0x108000, 0x11dfff).ram();
|
map(0x108000, 0x11dfff).ram();
|
||||||
@ -306,7 +315,7 @@ void legionna_state::denjinmk_map(address_map &map)
|
|||||||
|
|
||||||
void legionna_state::grainbow_map(address_map &map)
|
void legionna_state::grainbow_map(address_map &map)
|
||||||
{
|
{
|
||||||
legionna_cop_mem(map);
|
legionna_cop_map(map);
|
||||||
map(0x000000, 0x0fffff).rom();
|
map(0x000000, 0x0fffff).rom();
|
||||||
map(0x100000, 0x1003ff).ram();
|
map(0x100000, 0x1003ff).ram();
|
||||||
map(0x100480, 0x100487).w(this, FUNC(legionna_state::grainbow_layer_config_w)); // probably a COP feature
|
map(0x100480, 0x100487).w(this, FUNC(legionna_state::grainbow_layer_config_w)); // probably a COP feature
|
||||||
@ -336,9 +345,9 @@ void legionna_state::grainbow_map(address_map &map)
|
|||||||
map(0x108000, 0x11ffff).ram();
|
map(0x108000, 0x11ffff).ram();
|
||||||
}
|
}
|
||||||
|
|
||||||
void legionna_state::cupsoc_mem(address_map &map)
|
void legionna_state::cupsoc_map(address_map &map)
|
||||||
{
|
{
|
||||||
legionna_cop_mem(map);
|
legionna_cop_map(map);
|
||||||
map(0x000000, 0x0fffff).rom();
|
map(0x000000, 0x0fffff).rom();
|
||||||
map(0x100000, 0x1003ff).ram();
|
map(0x100000, 0x1003ff).ram();
|
||||||
map(0x100600, 0x10064f).rw(m_crtc, FUNC(seibu_crtc_device::read), FUNC(seibu_crtc_device::write));
|
map(0x100600, 0x10064f).rw(m_crtc, FUNC(seibu_crtc_device::read), FUNC(seibu_crtc_device::write));
|
||||||
@ -370,9 +379,9 @@ void legionna_state::cupsoc_mem(address_map &map)
|
|||||||
map(0x11e000, 0x11ffff).ram(); /*Stack Ram*/
|
map(0x11e000, 0x11ffff).ram(); /*Stack Ram*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void legionna_state::cupsocs_mem(address_map &map)
|
void legionna_state::cupsocs_map(address_map &map)
|
||||||
{
|
{
|
||||||
legionna_cop_mem(map);
|
legionna_cop_map(map);
|
||||||
map(0x000000, 0x0fffff).rom();
|
map(0x000000, 0x0fffff).rom();
|
||||||
map(0x100000, 0x1003ff).ram();
|
map(0x100000, 0x1003ff).ram();
|
||||||
map(0x100600, 0x10067f).lrw16("crtc_rw",
|
map(0x100600, 0x10067f).lrw16("crtc_rw",
|
||||||
@ -1468,7 +1477,7 @@ MACHINE_CONFIG_START(legionna_state::cupsoc)
|
|||||||
|
|
||||||
/* basic machine hardware */
|
/* basic machine hardware */
|
||||||
MCFG_CPU_ADD("maincpu", M68000,20000000/2)
|
MCFG_CPU_ADD("maincpu", M68000,20000000/2)
|
||||||
MCFG_CPU_PROGRAM_MAP(cupsoc_mem)
|
MCFG_CPU_PROGRAM_MAP(cupsoc_map)
|
||||||
MCFG_CPU_VBLANK_INT_DRIVER("screen", legionna_state, irq4_line_hold)/* VBL */
|
MCFG_CPU_VBLANK_INT_DRIVER("screen", legionna_state, irq4_line_hold)/* VBL */
|
||||||
|
|
||||||
MCFG_CPU_ADD("audiocpu", Z80, 14318180/4)
|
MCFG_CPU_ADD("audiocpu", Z80, 14318180/4)
|
||||||
@ -1519,7 +1528,7 @@ MACHINE_CONFIG_END
|
|||||||
MACHINE_CONFIG_START(legionna_state::cupsocs)
|
MACHINE_CONFIG_START(legionna_state::cupsocs)
|
||||||
cupsoc(config);
|
cupsoc(config);
|
||||||
MCFG_CPU_MODIFY("maincpu")
|
MCFG_CPU_MODIFY("maincpu")
|
||||||
MCFG_CPU_PROGRAM_MAP(cupsocs_mem)
|
MCFG_CPU_PROGRAM_MAP(cupsocs_map)
|
||||||
MACHINE_CONFIG_END
|
MACHINE_CONFIG_END
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
|
@ -13,6 +13,7 @@ public:
|
|||||||
legionna_state(const machine_config &mconfig, device_type type, const char *tag)
|
legionna_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||||
: driver_device(mconfig, type, tag),
|
: driver_device(mconfig, type, tag),
|
||||||
m_spriteram(*this, "spriteram"),
|
m_spriteram(*this, "spriteram"),
|
||||||
|
m_swappal(*this, "swappal"),
|
||||||
m_layer_disable(0),
|
m_layer_disable(0),
|
||||||
m_back_gfx_bank(0),
|
m_back_gfx_bank(0),
|
||||||
m_fore_gfx_bank(0),
|
m_fore_gfx_bank(0),
|
||||||
@ -30,6 +31,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
required_shared_ptr<uint16_t> m_spriteram;
|
required_shared_ptr<uint16_t> m_spriteram;
|
||||||
|
optional_shared_ptr<uint16_t> m_swappal;
|
||||||
std::unique_ptr<uint16_t[]> m_back_data;
|
std::unique_ptr<uint16_t[]> m_back_data;
|
||||||
std::unique_ptr<uint16_t[]> m_fore_data;
|
std::unique_ptr<uint16_t[]> m_fore_data;
|
||||||
std::unique_ptr<uint16_t[]> m_mid_data;
|
std::unique_ptr<uint16_t[]> m_mid_data;
|
||||||
@ -64,7 +66,8 @@ public:
|
|||||||
DECLARE_WRITE16_MEMBER(denjinmk_setgfxbank);
|
DECLARE_WRITE16_MEMBER(denjinmk_setgfxbank);
|
||||||
DECLARE_WRITE16_MEMBER(heatbrl_setgfxbank);
|
DECLARE_WRITE16_MEMBER(heatbrl_setgfxbank);
|
||||||
DECLARE_WRITE16_MEMBER(grainbow_layer_config_w);
|
DECLARE_WRITE16_MEMBER(grainbow_layer_config_w);
|
||||||
|
DECLARE_WRITE16_MEMBER(palette_swap_w);
|
||||||
|
|
||||||
DECLARE_DRIVER_INIT(legiongfx);
|
DECLARE_DRIVER_INIT(legiongfx);
|
||||||
DECLARE_DRIVER_INIT(cupsoc_debug);
|
DECLARE_DRIVER_INIT(cupsoc_debug);
|
||||||
DECLARE_DRIVER_INIT(cupsoc);
|
DECLARE_DRIVER_INIT(cupsoc);
|
||||||
@ -106,12 +109,12 @@ public:
|
|||||||
void legionna(machine_config &config);
|
void legionna(machine_config &config);
|
||||||
void godzilla(machine_config &config);
|
void godzilla(machine_config &config);
|
||||||
void denjinmk(machine_config &config);
|
void denjinmk(machine_config &config);
|
||||||
void cupsoc_mem(address_map &map);
|
void cupsoc_map(address_map &map);
|
||||||
void cupsocs_mem(address_map &map);
|
void cupsocs_map(address_map &map);
|
||||||
void denjinmk_map(address_map &map);
|
void denjinmk_map(address_map &map);
|
||||||
void godzilla_map(address_map &map);
|
void godzilla_map(address_map &map);
|
||||||
void grainbow_map(address_map &map);
|
void grainbow_map(address_map &map);
|
||||||
void heatbrl_map(address_map &map);
|
void heatbrl_map(address_map &map);
|
||||||
void legionna_cop_mem(address_map &map);
|
void legionna_cop_map(address_map &map);
|
||||||
void legionna_map(address_map &map);
|
void legionna_map(address_map &map);
|
||||||
};
|
};
|
||||||
|
@ -844,7 +844,7 @@ WRITE16_MEMBER(raiden2cop_device::cop_dma_trigger_w)
|
|||||||
/* Number Conversion */
|
/* Number Conversion */
|
||||||
void raiden2cop_device::bcd_update()
|
void raiden2cop_device::bcd_update()
|
||||||
{
|
{
|
||||||
//int digits = 1 << cop_itoa_mode*2;
|
//int digits = 1 << cop_itoa_mode*2;
|
||||||
uint32_t val = cop_itoa;
|
uint32_t val = cop_itoa;
|
||||||
|
|
||||||
//if(digits > 9)
|
//if(digits > 9)
|
||||||
|
@ -81,12 +81,12 @@ void raiden2cop_device::dma_palette_brightness()
|
|||||||
pal_val |= ((r + rt) & 0x1f);
|
pal_val |= ((r + rt) & 0x1f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (pal_brightness_mode == 4) //Denjin Makai
|
else if (pal_brightness_mode == 4) //Denjin Makai & Godzilla
|
||||||
{
|
{
|
||||||
// mode 4 swaps endianness between two words, likely that DMA works in dword steps and bit 0.
|
// In mode 4 Denjin Makai seems to swaps endianness between two words, likely that DMA works in dword steps and bit 0.
|
||||||
// TODO: check on V30 flavour
|
// Godzilla contradicts with this tho, so maybe it's just an address swap for the palette range ...
|
||||||
uint16_t targetpaldata = m_host_space->read_word((src + (cop_dma_adr_rel * 0x400)) ^ 2);
|
uint16_t targetpaldata = m_host_space->read_word((src + (cop_dma_adr_rel * 0x400)));
|
||||||
uint16_t paldata = m_host_space->read_word(src ^ 2);
|
uint16_t paldata = m_host_space->read_word(src);
|
||||||
|
|
||||||
bt = (targetpaldata & 0x7c00) >> 10;
|
bt = (targetpaldata & 0x7c00) >> 10;
|
||||||
b = (paldata & 0x7c00) >> 10;
|
b = (paldata & 0x7c00) >> 10;
|
||||||
|
@ -60,7 +60,7 @@ WRITE16_MEMBER(legionna_state::tile_scroll_base_w)
|
|||||||
if(offset == 7)
|
if(offset == 7)
|
||||||
m_text_layer->set_scrolldy(0x1ef - data,0x1ef - data);
|
m_text_layer->set_scrolldy(0x1ef - data,0x1ef - data);
|
||||||
|
|
||||||
printf("%02x %04x\n",offset,data);
|
//printf("%02x %04x\n",offset,data);
|
||||||
}
|
}
|
||||||
|
|
||||||
WRITE16_MEMBER(legionna_state::heatbrl_setgfxbank)
|
WRITE16_MEMBER(legionna_state::heatbrl_setgfxbank)
|
||||||
|
Loading…
Reference in New Issue
Block a user