From b8d88ae60b38c23074bd339cc10568b364f1b4aa Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Tue, 6 Dec 2022 08:32:31 +0100 Subject: dataeast/sshangha.cpp: consolidated driver in single file --- src/mame/dataeast/sshangha.cpp | 375 ++++++++++++++++++++++++++++----------- src/mame/dataeast/sshangha.h | 75 -------- src/mame/dataeast/sshangha_v.cpp | 73 -------- 3 files changed, 268 insertions(+), 255 deletions(-) delete mode 100644 src/mame/dataeast/sshangha.h delete mode 100644 src/mame/dataeast/sshangha_v.cpp diff --git a/src/mame/dataeast/sshangha.cpp b/src/mame/dataeast/sshangha.cpp index ea10a2e6d19..9eeb3d94cba 100644 --- a/src/mame/dataeast/sshangha.cpp +++ b/src/mame/dataeast/sshangha.cpp @@ -1,5 +1,6 @@ // license:BSD-3-Clause -// copyright-holders:Bryan McPhail, Charles MacDonald, David Haywood +// copyright-holders: Bryan McPhail, Charles MacDonald, David Haywood + /*************************************************************************** Super Shanghai Dragon's Eye (c) 1992 Hot-B @@ -78,19 +79,177 @@ HB-PCB-A5 M6100691A (distributed by Taito) ***************************************************************************/ #include "emu.h" -#include "sshangha.h" -#include "cpu/z80/z80.h" +#include "deco146.h" +#include "deco16ic.h" +#include "decospr.h" + #include "cpu/m68000/m68000.h" +#include "cpu/z80/z80.h" #include "sound/okim6295.h" #include "sound/ymopn.h" + +#include "emupal.h" #include "screen.h" #include "speaker.h" +// configurable logging +#define LOG_VIDEOREGS (1U << 1) + +//#define VERBOSE (LOG_GENERAL | LOG_VIDEOREGS) + +#include "logmacro.h" + +#define LOGVIDEOREGS(...) LOGMASKED(LOG_VIDEOREGS, __VA_ARGS__) + + +namespace { + #define SSHANGHA_HACK 0 +class sshangha_state : public driver_device +{ +public: + sshangha_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_audiocpu(*this, "audiocpu"), + m_palette(*this, "palette"), + m_sprgen(*this, "spritegen%u", 1U), + m_tilegen(*this, "tilegen"), + m_deco146(*this, "ioprot"), + m_spriteram(*this, "spriteram%u", 1U), + m_sound_shared_ram(*this, "sound_shared"), + m_pf_rowscroll(*this, "pf%u_rowscroll", 1U), + m_prot_data(*this, "prot_data"), + m_inputs(*this, "INPUTS"), + m_system(*this, "SYSTEM"), + m_dsw(*this, "DSW") + { } + + void sshanghab(machine_config &config); + void sshangha(machine_config &config); + + void init_sshangha(); + +protected: + virtual void video_start() override; + +private: + required_device m_maincpu; + required_device m_audiocpu; + required_device m_palette; + required_device_array m_sprgen; + required_device m_tilegen; + optional_device m_deco146; + + required_shared_ptr_array m_spriteram; + required_shared_ptr m_sound_shared_ram; + required_shared_ptr_array m_pf_rowscroll; + optional_shared_ptr m_prot_data; + + required_ioport m_inputs; + required_ioport m_system; + required_ioport m_dsw; + + uint16_t m_video_control = 0; + + DECO16IC_BANK_CB_MEMBER(bank_callback); + uint16_t mix_callback(uint16_t p, uint16_t p2); + + uint16_t sshangha_protection_region_8_146_r(offs_t offset); + void sshangha_protection_region_8_146_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + uint16_t sshangha_protection_region_d_146_r(offs_t offset); + void sshangha_protection_region_d_146_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + uint16_t deco_71_r(); + uint16_t sshanghab_protection16_r(offs_t offset); + + uint8_t sound_shared_r(offs_t offset); + void sound_shared_w(offs_t offset, uint8_t data); + + void video_w(uint16_t data); + + uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + void sshangha_main_map(address_map &map); + void sound_map(address_map &map); + void sshanghab_main_map(address_map &map); +}; + + +// video + +/*************************************************************************** + + Uses Data East custom chip 55 for backgrounds, with a special 8bpp mode + 2 times custom chips 52/71 for sprites. + +***************************************************************************/ + +/******************************************************************************/ + +void sshangha_state::video_w(uint16_t data) +{ + // 0x4: Special video mode, other bits unknown + m_video_control = data; + LOGVIDEOREGS("video_w: %04x", data); +} + +/******************************************************************************/ + +void sshangha_state::video_start() +{ + m_sprgen[0]->alloc_sprite_bitmap(); + m_sprgen[1]->alloc_sprite_bitmap(); + + save_item(NAME(m_video_control)); +} + +/******************************************************************************/ + +uint32_t sshangha_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + const bool combine_tilemaps = (m_video_control & 4) ? false : true; + + // sprites are flipped relative to tilemaps + uint16_t flip = m_tilegen->pf_control_r(0); + flip_screen_set(BIT(flip, 7)); + m_sprgen[0]->set_flip_screen(!BIT(flip, 7)); + m_sprgen[1]->set_flip_screen(!BIT(flip, 7)); + // render sprites to temp bitmaps + m_sprgen[0]->draw_sprites(bitmap, cliprect, m_spriteram[0], 0x400); + m_sprgen[1]->draw_sprites(bitmap, cliprect, m_spriteram[1], 0x400); + + // draw / mix + bitmap.fill(m_palette->black_pen(), cliprect); + + m_tilegen->pf_update(m_pf_rowscroll[0], m_pf_rowscroll[1]); + + // TODO: fully verify draw order / priorities + + // the tilemap 4bpp + 4bpp = 8bpp mixing actually seems external to the tilemap, note video_control is not part of the tilemap chip + if (combine_tilemaps) + m_tilegen->tilemap_12_combine_draw(screen, bitmap, cliprect, 0, 0); + else + m_tilegen->tilemap_2_draw(screen, bitmap, cliprect, 0, 0); + + // pri, primask,palbase,palmask + m_sprgen[0]->inefficient_copy_sprite_bitmap(bitmap, cliprect, 0x000, 0x000, 0x200, 0x0ff); // low+high pri spr1 (definitely needs to be below low pri spr2 - game tiles & definitely needs to be below tilemap1 - lightning on win screen in traditional mode) + m_sprgen[1]->inefficient_copy_sprite_bitmap(bitmap, cliprect, 0x200, 0x200, 0x000, 0x0ff); // low pri spr2 (definitely needs to be below tilemap1 - 2nd level failure screen etc.) + + if (!combine_tilemaps) + m_tilegen->tilemap_1_draw(screen, bitmap, cliprect, 0, 0); + + // pri, primask,palbase,palmask + m_sprgen[1]->inefficient_copy_sprite_bitmap(bitmap, cliprect, 0x000, 0x200, 0x000, 0x0ff); // high pri spr2 (definitely needs to be above tilemap1 - title logo) + + return 0; +} + + +// machine /******************************************************************************/ @@ -102,17 +261,17 @@ uint16_t sshangha_state::sshanghab_protection16_r(offs_t offset) // bootleg inpu switch (offset) { case 0x050 >> 1: - return ioport("INPUTS")->read(); + return m_inputs->read(); case 0x76a >> 1: - return ioport("SYSTEM")->read(); + return m_system->read(); case 0x0ac >> 1: - return ioport("DSW")->read(); + return m_dsw->read(); } - return m_prot_data[offset]; + return m_prot_data[offset]; // TODO: m_prot_data share isn't mapped in the bootleg, so this is useless? } -/* Probably returns 0xffff when sprite DMA is complete, the game waits on it */ +// Probably returns 0xffff when sprite DMA is complete, the game waits on it uint16_t sshangha_state::deco_71_r() { return 0xffff; @@ -123,39 +282,39 @@ uint16_t sshangha_state::deco_71_r() uint16_t sshangha_state::sshangha_protection_region_d_146_r(offs_t offset) { - int real_address = 0x3f4000 + (offset *2); - int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff; + int const real_address = 0x3f4000 + (offset * 2); + int const deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff; uint8_t cs = 0; - uint16_t data = m_deco146->read_data( deco146_addr, cs ); + uint16_t const data = m_deco146->read_data(deco146_addr, cs); return data; } void sshangha_state::sshangha_protection_region_d_146_w(offs_t offset, uint16_t data, uint16_t mem_mask) { - int real_address = 0x3f4000 + (offset *2); - int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff; + int const real_address = 0x3f4000 + (offset * 2); + int const deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff; uint8_t cs = 0; - m_deco146->write_data( deco146_addr, data, mem_mask, cs ); + m_deco146->write_data(deco146_addr, data, mem_mask, cs); } uint16_t sshangha_state::sshangha_protection_region_8_146_r(offs_t offset) { - int real_address = 0x3e0000 + (offset *2); - int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff; + int const real_address = 0x3e0000 + (offset * 2); + int const deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff; uint8_t cs = 0; - uint16_t data = m_deco146->read_data( deco146_addr, cs ); + uint16_t const data = m_deco146->read_data(deco146_addr, cs); return data; } void sshangha_state::sshangha_protection_region_8_146_w(offs_t offset, uint16_t data, uint16_t mem_mask) { - int real_address = 0x3e0000 + (offset *2); - int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff; + int const real_address = 0x3e0000 + (offset *2); + int const deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff; uint8_t cs = 0; - m_deco146->write_data( deco146_addr, data, mem_mask, cs ); + m_deco146->write_data(deco146_addr, data, mem_mask, cs); } -void sshangha_state::sshangha_map(address_map &map) +void sshangha_state::sshangha_main_map(address_map &map) { map.global_mask(0x3fffff); map(0x000000, 0x03ffff).rom(); @@ -163,18 +322,18 @@ void sshangha_state::sshangha_map(address_map &map) map(0x200000, 0x201fff).rw(m_tilegen, FUNC(deco16ic_device::pf1_data_r), FUNC(deco16ic_device::pf1_data_w)); map(0x202000, 0x203fff).rw(m_tilegen, FUNC(deco16ic_device::pf2_data_r), FUNC(deco16ic_device::pf2_data_w)); - map(0x204000, 0x2047ff).ram().share(m_pf1_rowscroll); - map(0x206000, 0x2067ff).ram().share(m_pf2_rowscroll); + map(0x204000, 0x2047ff).ram().share(m_pf_rowscroll[0]); + map(0x206000, 0x2067ff).ram().share(m_pf_rowscroll[1]); map(0x206800, 0x207fff).ram(); map(0x300000, 0x30000f).w(m_tilegen, FUNC(deco16ic_device::pf_control_w)); map(0x320000, 0x320001).w(FUNC(sshangha_state::video_w)); map(0x320002, 0x320005).nopw(); map(0x320006, 0x320007).nopr(); //irq ack - map(0x340000, 0x3407ff).mirror(0x800).ram().share(m_spriteram2); + map(0x340000, 0x3407ff).mirror(0x800).ram().share(m_spriteram[1]); map(0x350000, 0x350001).r(FUNC(sshangha_state::deco_71_r)); map(0x350000, 0x350007).nopw(); - map(0x360000, 0x3607ff).mirror(0x800).ram().share(m_spriteram); + map(0x360000, 0x3607ff).mirror(0x800).ram().share(m_spriteram[0]); map(0x370000, 0x370001).r(FUNC(sshangha_state::deco_71_r)); map(0x370000, 0x370007).nopw(); @@ -185,16 +344,16 @@ void sshangha_state::sshangha_map(address_map &map) map(0x3f4000, 0x3f7fff).rw(FUNC(sshangha_state::sshangha_protection_region_d_146_r), FUNC(sshangha_state::sshangha_protection_region_d_146_w)).share(m_prot_data); } -void sshangha_state::sshanghab_map(address_map &map) +void sshangha_state::sshanghab_main_map(address_map &map) { map(0x000000, 0x03ffff).rom(); map(0x084000, 0x0847ff).r(FUNC(sshangha_state::sshanghab_protection16_r)); - map(0x101000, 0x10100f).ram().share(m_sound_shared_ram); /* the bootleg writes here */ + map(0x101000, 0x10100f).ram().share(m_sound_shared_ram); // the bootleg writes here map(0x200000, 0x201fff).rw(m_tilegen, FUNC(deco16ic_device::pf1_data_r), FUNC(deco16ic_device::pf1_data_w)); map(0x202000, 0x203fff).rw(m_tilegen, FUNC(deco16ic_device::pf2_data_r), FUNC(deco16ic_device::pf2_data_w)); - map(0x204000, 0x2047ff).ram().share(m_pf1_rowscroll); - map(0x206000, 0x2067ff).ram().share(m_pf2_rowscroll); + map(0x204000, 0x2047ff).ram().share(m_pf_rowscroll[0]); + map(0x206000, 0x2067ff).ram().share(m_pf_rowscroll[1]); map(0x206800, 0x207fff).ram(); map(0x300000, 0x30000f).w(m_tilegen, FUNC(deco16ic_device::pf_control_w)); map(0x320000, 0x320001).w(FUNC(sshangha_state::video_w)); @@ -206,8 +365,8 @@ void sshangha_state::sshanghab_map(address_map &map) map(0x380000, 0x380fff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); map(0x381000, 0x383fff).ram(); // unused palette area - map(0x3c0000, 0x3c07ff).ram().share(m_spriteram); // bootleg spriteram - map(0x3c0800, 0x3c0fff).ram().share(m_spriteram2); + map(0x3c0000, 0x3c07ff).ram().share(m_spriteram[0]); // bootleg spriteram + map(0x3c0800, 0x3c0fff).ram().share(m_spriteram[1]); map(0xfec000, 0xff3fff).ram(); map(0xff4000, 0xff47ff).ram(); @@ -215,7 +374,7 @@ void sshangha_state::sshanghab_map(address_map &map) /******************************************************************************/ -/* 8 "sound latches" shared between main and sound cpus. */ +// 8 "sound latches" shared between main and sound CPUs. uint8_t sshangha_state::sound_shared_r(offs_t offset) { @@ -224,10 +383,10 @@ uint8_t sshangha_state::sound_shared_r(offs_t offset) void sshangha_state::sound_shared_w(offs_t offset, uint8_t data) { - m_sound_shared_ram[offset] = data & 0xff; + m_sound_shared_ram[offset] = data; } -/* Note: there's rom data after 0x8000 but the game never seem to call a rom bank, left-over? */ +// Note: there's ROM data after 0x8000 but the game never seem to call a ROM bank, left-over? void sshangha_state::sound_map(address_map &map) { map(0x0000, 0x7fff).rom(); @@ -240,7 +399,7 @@ void sshangha_state::sound_map(address_map &map) /******************************************************************************/ static INPUT_PORTS_START( sshangha ) - PORT_START("INPUTS") /* 0xfec046.b - 0xfec047.b */ + PORT_START("INPUTS") // 0xfec046.b - 0xfec047.b PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) @@ -268,8 +427,8 @@ static INPUT_PORTS_START( sshangha ) PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN ) - /* Dips seem inverted with respect to other Deco games */ - PORT_START("DSW") /* 0xfec04b.b - 0xfec04a.b, inverted bits order */ + // Dips seem inverted with respect to other Deco games + PORT_START("DSW") // 0xfec04b.b - 0xfec04a.b, inverted bits order PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:1") PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0080, DEF_STR( On ) ) @@ -277,27 +436,27 @@ static INPUT_PORTS_START( sshangha ) PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) PORT_SERVICE_DIPLOC( 0x0020, IP_ACTIVE_LOW, "SW1:3" ) - PORT_DIPNAME( 0x0010, 0x0010, "Coin Mode" ) PORT_DIPLOCATION("SW1:4") /* Manual states "Always Off" - Check code at 0x000010f2 */ + PORT_DIPNAME( 0x0010, 0x0010, "Coin Mode" ) PORT_DIPLOCATION("SW1:4") // Manual states "Always Off" - Check code at 0x000010f2 PORT_DIPSETTING( 0x0010, "Mode 1" ) PORT_DIPSETTING( 0x0000, "Mode 2" ) PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:5,6") - PORT_DIPSETTING( 0x0008, DEF_STR( 2C_1C ) ) PORT_CONDITION("DSW", 0x0010, EQUALS, 0x0010) //Mode 1 - PORT_DIPSETTING( 0x000c, DEF_STR( 1C_1C ) ) PORT_CONDITION("DSW", 0x0010, EQUALS, 0x0010) //Mode 1 - PORT_DIPSETTING( 0x0000, DEF_STR( 2C_3C ) ) PORT_CONDITION("DSW", 0x0010, EQUALS, 0x0010) //Mode 1 - PORT_DIPSETTING( 0x0004, DEF_STR( 1C_2C ) ) PORT_CONDITION("DSW", 0x0010, EQUALS, 0x0010) //Mode 1 - PORT_DIPSETTING( 0x0000, DEF_STR( 4C_1C ) ) PORT_CONDITION("DSW", 0x0010, NOTEQUALS, 0x0010) //Mode 2 - PORT_DIPSETTING( 0x0008, DEF_STR( 3C_1C ) ) PORT_CONDITION("DSW", 0x0010, NOTEQUALS, 0x0010) //Mode 2 - PORT_DIPSETTING( 0x000c, DEF_STR( 1C_1C ) ) PORT_CONDITION("DSW", 0x0010, NOTEQUALS, 0x0010) //Mode 2 - PORT_DIPSETTING( 0x0004, DEF_STR( 1C_4C ) ) PORT_CONDITION("DSW", 0x0010, NOTEQUALS, 0x0010) //Mode 2 + PORT_DIPSETTING( 0x0008, DEF_STR( 2C_1C ) ) PORT_CONDITION("DSW", 0x0010, EQUALS, 0x0010) // Mode 1 + PORT_DIPSETTING( 0x000c, DEF_STR( 1C_1C ) ) PORT_CONDITION("DSW", 0x0010, EQUALS, 0x0010) // Mode 1 + PORT_DIPSETTING( 0x0000, DEF_STR( 2C_3C ) ) PORT_CONDITION("DSW", 0x0010, EQUALS, 0x0010) // Mode 1 + PORT_DIPSETTING( 0x0004, DEF_STR( 1C_2C ) ) PORT_CONDITION("DSW", 0x0010, EQUALS, 0x0010) // Mode 1 + PORT_DIPSETTING( 0x0000, DEF_STR( 4C_1C ) ) PORT_CONDITION("DSW", 0x0010, NOTEQUALS, 0x0010) // Mode 2 + PORT_DIPSETTING( 0x0008, DEF_STR( 3C_1C ) ) PORT_CONDITION("DSW", 0x0010, NOTEQUALS, 0x0010) // Mode 2 + PORT_DIPSETTING( 0x000c, DEF_STR( 1C_1C ) ) PORT_CONDITION("DSW", 0x0010, NOTEQUALS, 0x0010) // Mode 2 + PORT_DIPSETTING( 0x0004, DEF_STR( 1C_4C ) ) PORT_CONDITION("DSW", 0x0010, NOTEQUALS, 0x0010) // Mode 2 PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW1:7,8") - PORT_DIPSETTING( 0x0002, DEF_STR( 2C_1C ) ) PORT_CONDITION("DSW", 0x0010, EQUALS, 0x0010) //Mode 1 - PORT_DIPSETTING( 0x0003, DEF_STR( 1C_1C ) ) PORT_CONDITION("DSW", 0x0010, EQUALS, 0x0010) //Mode 1 - PORT_DIPSETTING( 0x0000, DEF_STR( 2C_3C ) ) PORT_CONDITION("DSW", 0x0010, EQUALS, 0x0010) //Mode 1 - PORT_DIPSETTING( 0x0001, DEF_STR( 1C_2C ) ) PORT_CONDITION("DSW", 0x0010, EQUALS, 0x0010) //Mode 1 - PORT_DIPSETTING( 0x0000, DEF_STR( 4C_1C ) ) PORT_CONDITION("DSW", 0x0010, NOTEQUALS, 0x0010) //Mode 2 - PORT_DIPSETTING( 0x0002, DEF_STR( 3C_1C ) ) PORT_CONDITION("DSW", 0x0010, NOTEQUALS, 0x0010) //Mode 2 - PORT_DIPSETTING( 0x0003, DEF_STR( 1C_1C ) ) PORT_CONDITION("DSW", 0x0010, NOTEQUALS, 0x0010) //Mode 2 - PORT_DIPSETTING( 0x0001, DEF_STR( 1C_4C ) ) PORT_CONDITION("DSW", 0x0010, NOTEQUALS, 0x0010) //Mode 2 + PORT_DIPSETTING( 0x0002, DEF_STR( 2C_1C ) ) PORT_CONDITION("DSW", 0x0010, EQUALS, 0x0010) // Mode 1 + PORT_DIPSETTING( 0x0003, DEF_STR( 1C_1C ) ) PORT_CONDITION("DSW", 0x0010, EQUALS, 0x0010) // Mode 1 + PORT_DIPSETTING( 0x0000, DEF_STR( 2C_3C ) ) PORT_CONDITION("DSW", 0x0010, EQUALS, 0x0010) // Mode 1 + PORT_DIPSETTING( 0x0001, DEF_STR( 1C_2C ) ) PORT_CONDITION("DSW", 0x0010, EQUALS, 0x0010) // Mode 1 + PORT_DIPSETTING( 0x0000, DEF_STR( 4C_1C ) ) PORT_CONDITION("DSW", 0x0010, NOTEQUALS, 0x0010) // Mode 2 + PORT_DIPSETTING( 0x0002, DEF_STR( 3C_1C ) ) PORT_CONDITION("DSW", 0x0010, NOTEQUALS, 0x0010) // Mode 2 + PORT_DIPSETTING( 0x0003, DEF_STR( 1C_1C ) ) PORT_CONDITION("DSW", 0x0010, NOTEQUALS, 0x0010) // Mode 2 + PORT_DIPSETTING( 0x0001, DEF_STR( 1C_4C ) ) PORT_CONDITION("DSW", 0x0010, NOTEQUALS, 0x0010) // Mode 2 PORT_DIPNAME( 0xc000, 0xc000, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:1,2") PORT_DIPSETTING( 0x4000, DEF_STR( Easy ) ) PORT_DIPSETTING( 0xc000, DEF_STR( Normal ) ) @@ -308,9 +467,9 @@ static INPUT_PORTS_START( sshangha ) PORT_DIPSETTING( 0x2000, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) #else - PORT_DIPUNUSED_DIPLOC( 0x2000, 0x2000, "SW2:3" ) /* Listed as "Unused" - However see notes */ + PORT_DIPUNUSED_DIPLOC( 0x2000, 0x2000, "SW2:3" ) // Listed as "Unused" - However see notes #endif - PORT_DIPUNUSED_DIPLOC( 0x1000, 0x1000, "SW2:4" ) /* Listed as "Unused" */ + PORT_DIPUNUSED_DIPLOC( 0x1000, 0x1000, "SW2:4" ) // Listed as "Unused" PORT_DIPNAME( 0x0800, 0x0800, "Tile Animation" ) PORT_DIPLOCATION("SW2:5") PORT_DIPSETTING( 0x0000, DEF_STR( No ) ) PORT_DIPSETTING( 0x0800, DEF_STR( Yes ) ) @@ -329,9 +488,9 @@ INPUT_PORTS_END static const gfx_layout charlayout = { - 8,8, /* 8*8 chars */ + 8,8, // 8*8 chars RGN_FRAC(1,2), - 4, /* 4 bits per pixel */ + 4, // 4 bits per pixel { 8, 0, RGN_FRAC(1,2)+8,RGN_FRAC(1,2)+0 }, { STEP8(0,1) }, { STEP8(0,8*2) }, @@ -350,10 +509,10 @@ static const gfx_layout tilelayout = }; static GFXDECODE_START( gfx_sshangha ) - GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0x000, 64 ) /* Characters 8x8 */ - GFXDECODE_ENTRY( "gfx1", 0, tilelayout, 0x000, 64 ) /* Tiles 16x16 */ - GFXDECODE_ENTRY( "gfx2", 0, tilelayout, 0x000, 64 ) /* Sprites 16x16 */ - GFXDECODE_ENTRY( "gfx3", 0, tilelayout, 0x000, 64 ) /* Sprites 16x16 */ + GFXDECODE_ENTRY( "tiles", 0, charlayout, 0x000, 64 ) // 8x8 + GFXDECODE_ENTRY( "tiles", 0, tilelayout, 0x000, 64 ) // 16x16 + GFXDECODE_ENTRY( "sprites1", 0, tilelayout, 0x000, 64 ) // 16x16 + GFXDECODE_ENTRY( "sprites2", 0, tilelayout, 0x000, 64 ) // 16x16 GFXDECODE_END /******************************************************************************/ @@ -363,17 +522,17 @@ DECO16IC_BANK_CB_MEMBER(sshangha_state::bank_callback) return (bank >> 4) * 0x1000; } -// similar as tattass (deco32.cpp) but base color is pf2 color bank -u16 sshangha_state::mix_callback(u16 p, u16 p2) +// similar as tattass (dataeast/deco32.cpp) but base color is pf2 color bank +uint16_t sshangha_state::mix_callback(uint16_t p, uint16_t p2) { return (p2 & 0x300) ^ (((p & 0x10) << 5) | (p & 0x0f) | ((p2 & 0x0f) << 4)); } void sshangha_state::sshangha(machine_config &config) { - /* basic machine hardware */ - M68000(config, m_maincpu, 16_MHz_XTAL); /* CPU marked as 16MHz part */ - m_maincpu->set_addrmap(AS_PROGRAM, &sshangha_state::sshangha_map); + // basic machine hardware + M68000(config, m_maincpu, 16_MHz_XTAL); // CPU marked as 16MHz part + m_maincpu->set_addrmap(AS_PROGRAM, &sshangha_state::sshangha_main_map); m_maincpu->set_vblank_int("screen", FUNC(sshangha_state::irq6_line_hold)); Z80(config, m_audiocpu, 16_MHz_XTAL / 4); @@ -408,20 +567,20 @@ void sshangha_state::sshangha(machine_config &config) m_tilegen->set_pf12_16x16_bank(1); m_tilegen->set_gfxdecode_tag("gfxdecode"); - DECO_SPRITE(config, m_sprgen1, 0); - m_sprgen1->set_gfx_region(2); - m_sprgen1->set_gfxdecode_tag("gfxdecode"); + DECO_SPRITE(config, m_sprgen[0], 0); + m_sprgen[0]->set_gfx_region(2); + m_sprgen[0]->set_gfxdecode_tag("gfxdecode"); - DECO_SPRITE(config, m_sprgen2, 0); - m_sprgen2->set_gfx_region(3); - m_sprgen2->set_gfxdecode_tag("gfxdecode"); + DECO_SPRITE(config, m_sprgen[1], 0); + m_sprgen[1]->set_gfx_region(3); + m_sprgen[1]->set_gfxdecode_tag("gfxdecode"); DECO146PROT(config, m_deco146, 0); - m_deco146->port_a_cb().set_ioport("INPUTS"); - m_deco146->port_b_cb().set_ioport("SYSTEM"); - m_deco146->port_c_cb().set_ioport("DSW"); + m_deco146->port_a_cb().set_ioport(m_inputs); + m_deco146->port_b_cb().set_ioport(m_system); + m_deco146->port_c_cb().set_ioport(m_dsw); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); ym2203_device &ymsnd(YM2203(config, "ymsnd", 16_MHz_XTAL / 4)); @@ -436,7 +595,7 @@ void sshangha_state::sshanghab(machine_config &config) { sshangha(config); - m_maincpu->set_addrmap(AS_PROGRAM, &sshangha_state::sshanghab_map); + m_maincpu->set_addrmap(AS_PROGRAM, &sshangha_state::sshanghab_main_map); config.device_remove("ioprot"); } @@ -444,100 +603,100 @@ void sshangha_state::sshanghab(machine_config &config) /******************************************************************************/ ROM_START( sshangha ) - ROM_REGION( 0x40000, "maincpu", 0 ) /* 68000 code */ + ROM_REGION( 0x40000, "maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "ss007e.u28", 0x00000, 0x20000, CRC(5f275f6e) SHA1(ca7790d2401c95aff48098800f0da9590a0d88a2) ) ROM_LOAD16_BYTE( "ss006e.u27", 0x00001, 0x20000, CRC(111327fe) SHA1(60f9e839a027eab5ef019dcb27cac2f0f9bf04d8) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) /* Sound CPU */ + ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "ss008-1.u82", 0x000000, 0x010000, CRC(ff128b54) SHA1(2cdae94000c695417ebfe302999baa8e8cec09bf) ) - ROM_REGION( 0x200000, "gfx1", 0 ) + ROM_REGION( 0x200000, "tiles", 0 ) ROM_LOAD( "ss001.u8", 0x000000, 0x100000, CRC(ebeca5b7) SHA1(1746e757ad9bbef2aa9028c54f25d4aa4dedf79e) ) ROM_LOAD( "ss002.u7", 0x100000, 0x100000, CRC(67659f29) SHA1(50944877665b7b848b3f7063892bd39a96a847cf) ) - ROM_REGION( 0x200000, "gfx2", 0 ) + ROM_REGION( 0x200000, "sprites1", 0 ) ROM_LOAD( "ss003.u39", 0x000000, 0x100000, CRC(fbecde72) SHA1(2fe32b28e77ec390c534d276261eefac3fbe21fd) ) ROM_LOAD( "ss004.u37", 0x100000, 0x100000, CRC(98b82c5e) SHA1(af1b52d4b36b1776c148478b5a5581e6a57256b8) ) - ROM_REGION( 0x200000, "gfx3", 0 ) // 2 sprite chips, 2 copies of sprite ROMs on PCB + ROM_REGION( 0x200000, "sprites2", 0 ) // 2 sprite chips, 2 copies of sprite ROMs on PCB ROM_LOAD( "ss003.u47", 0x000000, 0x100000, CRC(fbecde72) SHA1(2fe32b28e77ec390c534d276261eefac3fbe21fd) ) ROM_LOAD( "ss004.u46", 0x100000, 0x100000, CRC(98b82c5e) SHA1(af1b52d4b36b1776c148478b5a5581e6a57256b8) ) - ROM_REGION( 0x40000, "oki", 0 ) /* ADPCM samples */ + ROM_REGION( 0x40000, "oki", 0 ) // ADPCM samples ROM_LOAD( "ss005.u86", 0x000000, 0x040000, CRC(c53a82ad) SHA1(756e453c8b5ce8e47f93fbda3a9e48bb73e93e2e) ) ROM_END ROM_START( sshanghaj ) - ROM_REGION( 0x40000, "maincpu", 0 ) /* 68000 code */ + ROM_REGION( 0x40000, "maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "ss007-1.u28", 0x00000, 0x20000, CRC(bc466edf) SHA1(b96525b2c879d15b46a7753fa6ebf12a851cd019) ) ROM_LOAD16_BYTE( "ss006-1.u27", 0x00001, 0x20000, CRC(872a2a2d) SHA1(42d7a01465d5c403354aaf0f2dab8adb9afe61b0) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) /* Sound CPU */ + ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "ss008.u82", 0x000000, 0x010000, CRC(04dc3647) SHA1(c06a7e8932c03de5759a9b69da0d761006b49517) ) - ROM_REGION( 0x200000, "gfx1", 0 ) + ROM_REGION( 0x200000, "tiles", 0 ) ROM_LOAD( "ss001.u8", 0x000000, 0x100000, CRC(ebeca5b7) SHA1(1746e757ad9bbef2aa9028c54f25d4aa4dedf79e) ) ROM_LOAD( "ss002.u7", 0x100000, 0x100000, CRC(67659f29) SHA1(50944877665b7b848b3f7063892bd39a96a847cf) ) - ROM_REGION( 0x200000, "gfx2", 0 ) + ROM_REGION( 0x200000, "sprites1", 0 ) ROM_LOAD( "ss003.u39", 0x000000, 0x100000, CRC(fbecde72) SHA1(2fe32b28e77ec390c534d276261eefac3fbe21fd) ) ROM_LOAD( "ss004.u37", 0x100000, 0x100000, CRC(98b82c5e) SHA1(af1b52d4b36b1776c148478b5a5581e6a57256b8) ) - ROM_REGION( 0x200000, "gfx3", 0 ) // 2 sprite chips, 2 copies of sprite ROMs on PCB + ROM_REGION( 0x200000, "sprites2", 0 ) // 2 sprite chips, 2 copies of sprite ROMs on PCB ROM_LOAD( "ss003.u47", 0x000000, 0x100000, CRC(fbecde72) SHA1(2fe32b28e77ec390c534d276261eefac3fbe21fd) ) ROM_LOAD( "ss004.u46", 0x100000, 0x100000, CRC(98b82c5e) SHA1(af1b52d4b36b1776c148478b5a5581e6a57256b8) ) - ROM_REGION( 0x40000, "oki", 0 ) /* ADPCM samples */ + ROM_REGION( 0x40000, "oki", 0 ) // ADPCM samples ROM_LOAD( "ss005.u86", 0x000000, 0x040000, CRC(c53a82ad) SHA1(756e453c8b5ce8e47f93fbda3a9e48bb73e93e2e) ) ROM_END -ROM_START( sshanghak ) /* Korean censored version - No girls in Paradise games */ - ROM_REGION( 0x40000, "maincpu", 0 ) /* 68000 code */ +ROM_START( sshanghak ) // Korean censored version - No girls in Paradise games + ROM_REGION( 0x40000, "maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "ss007k.u28", 0x00000, 0x20000, CRC(90dbf11c) SHA1(60ab0f3d3f43939e719196ff1775a3cd1c8c9aa0) ) ROM_LOAD16_BYTE( "ss006k.u27", 0x00001, 0x20000, CRC(07d94579) SHA1(25e4fb1669e12c7329e45a8ac0d52ac157a83d46) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) /* Sound CPU */ + ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "ss008.u82", 0x000000, 0x010000, CRC(04dc3647) SHA1(c06a7e8932c03de5759a9b69da0d761006b49517) ) - ROM_REGION( 0x200000, "gfx1", 0 ) + ROM_REGION( 0x200000, "tiles", 0 ) ROM_LOAD( "ss001.u8", 0x000000, 0x100000, CRC(ebeca5b7) SHA1(1746e757ad9bbef2aa9028c54f25d4aa4dedf79e) ) ROM_LOAD( "ss002.u7", 0x100000, 0x100000, CRC(67659f29) SHA1(50944877665b7b848b3f7063892bd39a96a847cf) ) - ROM_REGION( 0x200000, "gfx2", 0 ) + ROM_REGION( 0x200000, "sprites1", 0 ) ROM_LOAD( "ss003.u39", 0x000000, 0x100000, CRC(fbecde72) SHA1(2fe32b28e77ec390c534d276261eefac3fbe21fd) ) ROM_LOAD( "ss004.u37", 0x100000, 0x100000, CRC(98b82c5e) SHA1(af1b52d4b36b1776c148478b5a5581e6a57256b8) ) - ROM_REGION( 0x200000, "gfx3", 0 ) // 2 sprite chips, 2 copies of sprite ROMs on PCB + ROM_REGION( 0x200000, "sprites2", 0 ) // 2 sprite chips, 2 copies of sprite ROMs on PCB ROM_LOAD( "ss003.u47", 0x000000, 0x100000, CRC(fbecde72) SHA1(2fe32b28e77ec390c534d276261eefac3fbe21fd) ) ROM_LOAD( "ss004.u46", 0x100000, 0x100000, CRC(98b82c5e) SHA1(af1b52d4b36b1776c148478b5a5581e6a57256b8) ) - ROM_REGION( 0x40000, "oki", 0 ) /* ADPCM samples */ + ROM_REGION( 0x40000, "oki", 0 ) // ADPCM samples ROM_LOAD( "ss005.u86", 0x000000, 0x040000, CRC(c53a82ad) SHA1(756e453c8b5ce8e47f93fbda3a9e48bb73e93e2e) ) ROM_END ROM_START( sshanghab ) - ROM_REGION( 0x40000, "maincpu", 0 ) /* 68000 code */ + ROM_REGION( 0x40000, "maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "sshanb_2.010", 0x00000, 0x20000, CRC(bc7ed254) SHA1(aeee4b8a8265902bb41575cc143738ecf3aff57d) ) ROM_LOAD16_BYTE( "sshanb_1.010", 0x00001, 0x20000, CRC(7b049f49) SHA1(2570077c67dbd35053d475a18c3f10813bf914f7) ) // TODO: it's unlikely the bootleg used these exact ROMs, they were probably split, verify - ROM_REGION( 0x10000, "audiocpu", 0 ) /* Sound CPU */ + ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "ss008.u82", 0x000000, 0x010000, CRC(04dc3647) SHA1(c06a7e8932c03de5759a9b69da0d761006b49517) ) - ROM_REGION( 0x200000, "gfx1", 0 ) + ROM_REGION( 0x200000, "tiles", 0 ) ROM_LOAD( "ss001.u8", 0x000000, 0x100000, CRC(ebeca5b7) SHA1(1746e757ad9bbef2aa9028c54f25d4aa4dedf79e) ) ROM_LOAD( "ss002.u7", 0x100000, 0x100000, CRC(67659f29) SHA1(50944877665b7b848b3f7063892bd39a96a847cf) ) - ROM_REGION( 0x200000, "gfx2", 0 ) + ROM_REGION( 0x200000, "sprites1", 0 ) ROM_LOAD( "ss003.u39", 0x000000, 0x100000, CRC(fbecde72) SHA1(2fe32b28e77ec390c534d276261eefac3fbe21fd) ) ROM_LOAD( "ss004.u37", 0x100000, 0x100000, CRC(98b82c5e) SHA1(af1b52d4b36b1776c148478b5a5581e6a57256b8) ) - ROM_REGION( 0x200000, "gfx3", 0 ) // 2 sprite chips, 2 copies of sprite ROMs on PCB + ROM_REGION( 0x200000, "sprites2", 0 ) // 2 sprite chips, 2 copies of sprite ROMs on PCB ROM_LOAD( "ss003.u47", 0x000000, 0x100000, CRC(fbecde72) SHA1(2fe32b28e77ec390c534d276261eefac3fbe21fd) ) ROM_LOAD( "ss004.u46", 0x100000, 0x100000, CRC(98b82c5e) SHA1(af1b52d4b36b1776c148478b5a5581e6a57256b8) ) - ROM_REGION( 0x40000, "oki", 0 ) /* ADPCM samples */ + ROM_REGION( 0x40000, "oki", 0 ) // ADPCM samples ROM_LOAD( "ss005.u86", 0x000000, 0x040000, CRC(c53a82ad) SHA1(756e453c8b5ce8e47f93fbda3a9e48bb73e93e2e) ) ROM_END @@ -552,14 +711,16 @@ void sshangha_state::init_sshangha() ROM[0x000386/2] = 0x4e71; ROM[0x000388/2] = 0x4e71; ROM[0x00038a/2] = 0x4e71; - /* To avoid checksum error (only useful for 'sshangha') */ + // To avoid checksum error (only useful for 'sshangha') ROM[0x000428/2] = 0x4e71; ROM[0x00042a/2] = 0x4e71; #endif } +} // anonymous namespace + -GAME( 1992, sshangha, 0, sshangha, sshangha, sshangha_state, init_sshangha, ROT0, "Hot-B Co., Ltd.", "Super Shanghai Dragon's Eye (World)", MACHINE_SUPPORTS_SAVE ) -GAME( 1992, sshanghaj, sshangha, sshangha, sshangha, sshangha_state, init_sshangha, ROT0, "Hot-B Co., Ltd.", "Super Shanghai Dragon's Eye (Japan)", MACHINE_SUPPORTS_SAVE ) -GAME( 1992, sshanghak, sshangha, sshangha, sshangha, sshangha_state, init_sshangha, ROT0, "Hot-B Co., Ltd. (Taito license)", "Super Shanghai Dragon's Eye (Korea)", MACHINE_SUPPORTS_SAVE ) +GAME( 1992, sshangha, 0, sshangha, sshangha, sshangha_state, init_sshangha, ROT0, "Hot-B Co., Ltd.", "Super Shanghai Dragon's Eye (World)", MACHINE_SUPPORTS_SAVE ) +GAME( 1992, sshanghaj, sshangha, sshangha, sshangha, sshangha_state, init_sshangha, ROT0, "Hot-B Co., Ltd.", "Super Shanghai Dragon's Eye (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1992, sshanghak, sshangha, sshangha, sshangha, sshangha_state, init_sshangha, ROT0, "Hot-B Co., Ltd. (Taito license)", "Super Shanghai Dragon's Eye (Korea)", MACHINE_SUPPORTS_SAVE ) GAME( 1992, sshanghab, sshangha, sshanghab, sshangha, sshangha_state, init_sshangha, ROT0, "bootleg", "Super Shanghai Dragon's Eye (World, bootleg)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/dataeast/sshangha.h b/src/mame/dataeast/sshangha.h deleted file mode 100644 index 577514d87e7..00000000000 --- a/src/mame/dataeast/sshangha.h +++ /dev/null @@ -1,75 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Bryan McPhail, Charles MacDonald, David Haywood -#include "deco16ic.h" -#include "decospr.h" -#include "deco146.h" -#include "emupal.h" - -class sshangha_state : public driver_device -{ -public: - sshangha_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_deco146(*this, "ioprot"), - m_tilegen(*this, "tilegen"), - m_spriteram(*this, "spriteram"), - m_spriteram2(*this, "spriteram2"), - m_sound_shared_ram(*this, "sound_shared"), - m_pf1_rowscroll(*this, "pf1_rowscroll"), - m_pf2_rowscroll(*this, "pf2_rowscroll"), - m_prot_data(*this, "prot_data"), - m_sprgen1(*this, "spritegen1"), - m_sprgen2(*this, "spritegen2"), - m_maincpu(*this, "maincpu"), - m_audiocpu(*this, "audiocpu"), - m_palette(*this, "palette") - { } - - void sshanghab(machine_config &config); - void sshangha(machine_config &config); - - void init_sshangha(); - -protected: - virtual void video_start() override; - -private: - optional_device m_deco146; - required_device m_tilegen; - required_shared_ptr m_spriteram; - required_shared_ptr m_spriteram2; - - required_shared_ptr m_sound_shared_ram; - required_shared_ptr m_pf1_rowscroll; - required_shared_ptr m_pf2_rowscroll; - - optional_shared_ptr m_prot_data; - - required_device m_sprgen1; - required_device m_sprgen2; - required_device m_maincpu; - required_device m_audiocpu; - required_device m_palette; - - int m_video_control = 0; - DECO16IC_BANK_CB_MEMBER(bank_callback); - u16 mix_callback(u16 p, u16 p2); - - uint16_t sshangha_protection_region_8_146_r(offs_t offset); - void sshangha_protection_region_8_146_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - uint16_t sshangha_protection_region_d_146_r(offs_t offset); - void sshangha_protection_region_d_146_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - uint16_t deco_71_r(); - uint16_t sshanghab_protection16_r(offs_t offset); - - uint8_t sound_shared_r(offs_t offset); - void sound_shared_w(offs_t offset, uint8_t data); - - void video_w(uint16_t data); - - uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - - void sshangha_map(address_map &map); - void sound_map(address_map &map); - void sshanghab_map(address_map &map); -}; diff --git a/src/mame/dataeast/sshangha_v.cpp b/src/mame/dataeast/sshangha_v.cpp deleted file mode 100644 index 8f927de2264..00000000000 --- a/src/mame/dataeast/sshangha_v.cpp +++ /dev/null @@ -1,73 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Bryan McPhail, Charles MacDonald, David Haywood -/*************************************************************************** - - Uses Data East custom chip 55 for backgrounds, with a special 8bpp mode - 2 times custom chips 52/71 for sprites. - -***************************************************************************/ - -#include "emu.h" -#include "sshangha.h" - - -/******************************************************************************/ - -void sshangha_state::video_w(uint16_t data) -{ - /* 0x4: Special video mode, other bits unknown */ - m_video_control = data; -// popmessage("%04x", data); -} - -/******************************************************************************/ - -void sshangha_state::video_start() -{ - m_sprgen1->alloc_sprite_bitmap(); - m_sprgen2->alloc_sprite_bitmap(); - - save_item(NAME(m_video_control)); -} - -/******************************************************************************/ - -uint32_t sshangha_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - const bool combine_tilemaps = (m_video_control&4) ? false : true; - - // sprites are flipped relative to tilemaps - uint16_t flip = m_tilegen->pf_control_r(0); - flip_screen_set(BIT(flip, 7)); - m_sprgen1->set_flip_screen(!BIT(flip, 7)); - m_sprgen2->set_flip_screen(!BIT(flip, 7)); - - // render sprites to temp bitmaps - m_sprgen1->draw_sprites(bitmap, cliprect, m_spriteram, 0x400); - m_sprgen2->draw_sprites(bitmap, cliprect, m_spriteram2, 0x400); - - // draw / mix - bitmap.fill(m_palette->black_pen(), cliprect); - - m_tilegen->pf_update(m_pf1_rowscroll, m_pf2_rowscroll); - - // TODO: fully verify draw order / priorities - - /* the tilemap 4bpp + 4bpp = 8bpp mixing actually seems external to the tilemap, note video_control is not part of the tilemap chip */ - if (combine_tilemaps) - m_tilegen->tilemap_12_combine_draw(screen, bitmap, cliprect, 0, 0); - else - m_tilegen->tilemap_2_draw(screen, bitmap, cliprect, 0, 0); - - // pri, primask,palbase,palmask - m_sprgen1->inefficient_copy_sprite_bitmap(bitmap, cliprect, 0x000, 0x000, 0x200, 0x0ff); // low+high pri spr1 (definitely needs to be below low pri spr2 - game tiles & definitely needs to be below tilemap1 - lightning on win screen in traditional mode) - m_sprgen2->inefficient_copy_sprite_bitmap(bitmap, cliprect, 0x200, 0x200, 0x000, 0x0ff); // low pri spr2 (definitely needs to be below tilemap1 - 2nd level failure screen etc.) - - if (!combine_tilemaps) - m_tilegen->tilemap_1_draw(screen, bitmap, cliprect, 0, 0); - - // pri, primask,palbase,palmask - m_sprgen2->inefficient_copy_sprite_bitmap(bitmap, cliprect, 0x000, 0x200, 0x000, 0x0ff); // high pri spr2 (definitely needs to be above tilemap1 - title logo) - - return 0; -} -- cgit v1.2.3