From 1673f464f9318b20ef82349b75e6b4792538b43a Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Sat, 21 Nov 2020 11:40:03 +0100 Subject: shangkid.cpp: updated to use derived classes --- src/mame/drivers/shangkid.cpp | 543 ++++++++++++++++++++---------------------- src/mame/includes/shangkid.h | 138 ++++++----- src/mame/video/shangkid.cpp | 244 +++++++++---------- 3 files changed, 461 insertions(+), 464 deletions(-) diff --git a/src/mame/drivers/shangkid.cpp b/src/mame/drivers/shangkid.cpp index db98d44240f..a6b9f8809ea 100644 --- a/src/mame/drivers/shangkid.cpp +++ b/src/mame/drivers/shangkid.cpp @@ -55,7 +55,7 @@ Games by Nihon Game/Culture Brain: #include "cpu/z80/z80.h" #include "machine/74259.h" -#include "sound/ay8910.h" +#include "machine/gen_latch.h" #include "sound/dac.h" #include "screen.h" #include "speaker.h" @@ -63,136 +63,122 @@ Games by Nihon Game/Culture Brain: /***************************************************************************************/ -WRITE_LINE_MEMBER(shangkid_state::sound_enable_w) +WRITE_LINE_MEMBER(chinhero_state::sound_enable_w) { if (!state) m_aysnd->reset(); } -WRITE_LINE_MEMBER(shangkid_state::int_enable_1_w) +WRITE_LINE_MEMBER(dynamski_state::int_enable_1_w) { m_int_enable[0] = state; if (!m_int_enable[0]) m_maincpu->set_input_line(0, CLEAR_LINE); } -WRITE_LINE_MEMBER(shangkid_state::int_enable_2_w) +WRITE_LINE_MEMBER(chinhero_state::int_enable_2_w) { m_int_enable[1] = state; if (!m_int_enable[1]) m_bbx->set_input_line(0, CLEAR_LINE); } -WRITE_LINE_MEMBER(shangkid_state::nmi_enable_1_w) +WRITE_LINE_MEMBER(chinhero_state::nmi_enable_1_w) { m_nmi_enable[0] = state; if (!m_int_enable[0]) m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); } -WRITE_LINE_MEMBER(shangkid_state::nmi_enable_2_w) +WRITE_LINE_MEMBER(chinhero_state::nmi_enable_2_w) { m_nmi_enable[1] = state; if (!m_nmi_enable[1]) m_bbx->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); } -WRITE_LINE_MEMBER(shangkid_state::irq_1_w) +WRITE_LINE_MEMBER(dynamski_state::irq_1_w) { if (state && m_int_enable[0]) m_maincpu->set_input_line(0, ASSERT_LINE); } -WRITE_LINE_MEMBER(shangkid_state::irq_2_w) +WRITE_LINE_MEMBER(chinhero_state::irq_2_w) { if (state && m_int_enable[1]) m_bbx->set_input_line(0, ASSERT_LINE); } -void shangkid_state::nmiq_1_w(uint8_t data) +void chinhero_state::nmiq_1_w(uint8_t data) { if (m_nmi_enable[0]) m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); } -void shangkid_state::nmiq_2_w(uint8_t data) +void chinhero_state::nmiq_2_w(uint8_t data) { if (m_nmi_enable[1]) m_bbx->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); } -WRITE_LINE_MEMBER(shangkid_state::coin_counter_1_w) +WRITE_LINE_MEMBER(chinhero_state::coin_counter_1_w) { machine().bookkeeping().coin_counter_w(0, state); } -WRITE_LINE_MEMBER(shangkid_state::coin_counter_2_w) +WRITE_LINE_MEMBER(chinhero_state::coin_counter_2_w) { machine().bookkeeping().coin_counter_w(1, state); } -void shangkid_state::chinhero_ay8910_porta_w(uint8_t data) +void chinhero_state::ay8910_porta_w(uint8_t data) { if (BIT(data, 0)) - /* 0->1 transition triggers interrupt on Sound CPU */ - m_audiocpu->set_input_line(0, HOLD_LINE ); + // 0->1 transition triggers interrupt on Sound CPU + m_audiocpu->set_input_line(0, HOLD_LINE); } -void shangkid_state::shangkid_ay8910_porta_w(uint8_t data) +void shangkid_state::ay8910_porta_w(uint8_t data) { if (BIT(data, 0)) - /* 0->1 transition triggers interrupt on Sound CPU */ - m_audiocpu->set_input_line(0, HOLD_LINE ); + // 0->1 transition triggers interrupt on Sound CPU + m_audiocpu->set_input_line(0, HOLD_LINE); - membank("bank2")->set_entry((data & 0xfe) ? 0 : 1); + m_soundbank->set_entry((data & 0xfe) ? 0 : 1); } -void shangkid_state::ay8910_portb_w(uint8_t data) -{ - m_sound_latch = data; -} /***************************************************************************************/ -uint8_t shangkid_state::soundlatch_r() -{ - return m_sound_latch; -} - -/***************************************************************************************/ - -void shangkid_state::init_dynamski() +void dynamski_state::machine_start() { save_item(NAME(m_int_enable[0])); } -void shangkid_state::init_chinhero() +void chinhero_state::machine_start() { m_gfx_type = 0; - save_item(NAME(m_sound_latch)); save_item(NAME(m_int_enable)); save_item(NAME(m_nmi_enable)); } -void shangkid_state::init_shangkid() +void shangkid_state::machine_start() { - m_gfx_type = 1; + chinhero_state::machine_start(); - /* set up banking */ - membank("bank1")->configure_entries(0, 2, memregion("maincpu")->base() + 0x8000, 0x8000); - membank("bank2")->configure_entries(0, 2, memregion("audiocpu")->base() + 0x0000, 0x10000); + m_gfx_type = 1; - save_item(NAME(m_sound_latch)); - save_item(NAME(m_int_enable)); - save_item(NAME(m_nmi_enable)); + // set up banking + membank("mainbank")->configure_entries(0, 2, memregion("maincpu")->base() + 0x8000, 0x8000); + m_soundbank->configure_entries(0, 2, memregion("audiocpu")->base() + 0x0000, 0x10000); } /***************************************************************************************/ -MACHINE_RESET_MEMBER(shangkid_state,shangkid) +void shangkid_state::machine_reset() { - membank("bank2")->set_entry(0); + m_soundbank->set_entry(0); } /***************************************************************************************/ @@ -256,45 +242,45 @@ static const gfx_layout chinhero_sprite_layout2 = { }; static GFXDECODE_START( gfx_chinhero ) - GFXDECODE_ENTRY( "gfx1", 0, shangkid_char_layout, 0, 0x40 ) - GFXDECODE_ENTRY( "gfx2", 0, chinhero_sprite_layout1, 0, 0x20 ) - GFXDECODE_ENTRY( "gfx2", 0, chinhero_sprite_layout2, 0, 0x20 ) - GFXDECODE_ENTRY( "gfx3", 0, chinhero_sprite_layout1, 0, 0x20 ) - GFXDECODE_ENTRY( "gfx3", 0, chinhero_sprite_layout2, 0, 0x20 ) + GFXDECODE_ENTRY( "tiles", 0, shangkid_char_layout, 0, 0x40 ) + GFXDECODE_ENTRY( "sprites", 0, chinhero_sprite_layout1, 0, 0x20 ) + GFXDECODE_ENTRY( "sprites", 0, chinhero_sprite_layout2, 0, 0x20 ) + GFXDECODE_ENTRY( "sprites_2", 0, chinhero_sprite_layout1, 0, 0x20 ) + GFXDECODE_ENTRY( "sprites_2", 0, chinhero_sprite_layout2, 0, 0x20 ) GFXDECODE_END static GFXDECODE_START( gfx_shangkid ) - GFXDECODE_ENTRY( "gfx1", 0, shangkid_char_layout, 0, 0x40 ) - GFXDECODE_ENTRY( "gfx2", 0, shangkid_sprite_layout, 0, 0x40 ) + GFXDECODE_ENTRY( "tiles", 0, shangkid_char_layout, 0, 0x40 ) + GFXDECODE_ENTRY( "sprites", 0, shangkid_sprite_layout, 0, 0x40 ) GFXDECODE_END static GFXDECODE_START( gfx_dynamski ) - GFXDECODE_ENTRY( "gfx1", 0, shangkid_char_layout, 0, 0x10 ) - GFXDECODE_ENTRY( "gfx2", 0, shangkid_sprite_layout, 0x40, 0x10 ) + GFXDECODE_ENTRY( "tiles", 0, shangkid_char_layout, 0, 0x10 ) + GFXDECODE_ENTRY( "sprites", 0, shangkid_sprite_layout, 0x40, 0x10 ) GFXDECODE_END /***************************************************************************************/ -void shangkid_state::chinhero_main_map(address_map &map) +void chinhero_state::main_map(address_map &map) { map(0x0000, 0x9fff).rom(); - map(0xa000, 0xa000).w(FUNC(shangkid_state::nmiq_1_w)); - map(0xa800, 0xa800).w(FUNC(shangkid_state::nmiq_2_w)); + map(0xa000, 0xa000).w(FUNC(chinhero_state::nmiq_1_w)); + map(0xa800, 0xa800).w(FUNC(chinhero_state::nmiq_2_w)); map(0xb000, 0xb007).w("mainlatch", FUNC(ls259_device::write_d0)); map(0xb800, 0xb800).portr("DSW"); map(0xb801, 0xb801).portr("SYSTEM"); map(0xb802, 0xb802).portr("P2"); map(0xb803, 0xb803).portr("P1"); - map(0xc000, 0xc002).writeonly().share("videoreg"); - map(0xd000, 0xdfff).ram().w(FUNC(shangkid_state::videoram_w)).share("videoram"); + map(0xc000, 0xc002).writeonly().share(m_videoreg); + map(0xd000, 0xdfff).ram().w(FUNC(chinhero_state::videoram_w)).share(m_videoram); map(0xe000, 0xfdff).ram().share("share2"); - map(0xfe00, 0xffff).ram().share("spriteram"); + map(0xfe00, 0xffff).ram().share(m_spriteram); } -void shangkid_state::shangkid_main_map(address_map &map) +void shangkid_state::main_map(address_map &map) { map(0x0000, 0x7fff).rom(); - map(0x8000, 0x9fff).bankr("bank1"); + map(0x8000, 0x9fff).bankr("mainbank"); map(0xa000, 0xa000).w(FUNC(shangkid_state::nmiq_1_w)); map(0xa800, 0xa800).w(FUNC(shangkid_state::nmiq_2_w)); map(0xb000, 0xb007).w("mainlatch", FUNC(ls259_device::write_d0)); @@ -302,30 +288,30 @@ void shangkid_state::shangkid_main_map(address_map &map) map(0xb801, 0xb801).portr("SYSTEM"); map(0xb802, 0xb802).portr("P2"); map(0xb803, 0xb803).portr("P1"); - map(0xc000, 0xc002).writeonly().share("videoreg"); - map(0xd000, 0xdfff).ram().w(FUNC(shangkid_state::videoram_w)).share("videoram"); + map(0xc000, 0xc002).writeonly().share(m_videoreg); + map(0xd000, 0xdfff).ram().w(FUNC(shangkid_state::videoram_w)).share(m_videoram); map(0xe000, 0xfdff).ram().share("share2"); - map(0xfe00, 0xffff).ram().share("spriteram"); + map(0xfe00, 0xffff).ram().share(m_spriteram); } /***************************************************************************************/ -void shangkid_state::chinhero_bbx_map(address_map &map) +void chinhero_state::bbx_map(address_map &map) { map(0x0000, 0x9fff).rom(); - map(0xa000, 0xa000).w(FUNC(shangkid_state::nmiq_1_w)); - map(0xa800, 0xa800).w(FUNC(shangkid_state::nmiq_2_w)); + map(0xa000, 0xa000).w(FUNC(chinhero_state::nmiq_1_w)); + map(0xa800, 0xa800).w(FUNC(chinhero_state::nmiq_2_w)); map(0xb000, 0xb007).w("mainlatch", FUNC(ls259_device::write_d0)); map(0xb800, 0xb800).portr("DSW"); map(0xb801, 0xb801).portr("SYSTEM"); map(0xb802, 0xb802).portr("P2"); map(0xb803, 0xb803).portr("P1"); - map(0xd000, 0xdfff).ram().w(FUNC(shangkid_state::videoram_w)).share("videoram"); + map(0xd000, 0xdfff).ram().w(FUNC(chinhero_state::videoram_w)).share(m_videoram); map(0xe000, 0xfdff).ram().share("share2"); - map(0xfe00, 0xffff).ram().share("spriteram"); + map(0xfe00, 0xffff).ram().share(m_spriteram); } -void shangkid_state::shangkid_bbx_map(address_map &map) +void shangkid_state::bbx_map(address_map &map) { map(0x0000, 0x9fff).rom(); map(0xa000, 0xa000).w(FUNC(shangkid_state::nmiq_1_w)); @@ -335,18 +321,18 @@ void shangkid_state::shangkid_bbx_map(address_map &map) map(0xb801, 0xb801).portr("SYSTEM"); map(0xb802, 0xb802).portr("P2"); map(0xb803, 0xb803).portr("P1"); - map(0xd000, 0xdfff).ram().w(FUNC(shangkid_state::videoram_w)).share("videoram"); + map(0xd000, 0xdfff).ram().w(FUNC(shangkid_state::videoram_w)).share(m_videoram); map(0xe000, 0xfdff).ram().share("share2"); - map(0xfe00, 0xffff).ram().share("spriteram"); + map(0xfe00, 0xffff).ram().share(m_spriteram); } -void shangkid_state::chinhero_bbx_portmap(address_map &map) +void chinhero_state::bbx_portmap(address_map &map) { map.global_mask(0xff); map(0x00, 0x01).w(m_aysnd, FUNC(ay8910_device::address_data_w)); } -void shangkid_state::shangkid_bbx_portmap(address_map &map) +void shangkid_state::bbx_portmap(address_map &map) { map.global_mask(0xff); map(0x00, 0x01).w(m_aysnd, FUNC(ay8910_device::address_data_w)); @@ -354,76 +340,77 @@ void shangkid_state::shangkid_bbx_portmap(address_map &map) /***************************************************************************************/ -void shangkid_state::chinhero_sound_map(address_map &map) +void chinhero_state::sound_map(address_map &map) { map(0x0000, 0xdfff).rom(); map(0xe000, 0xe7ff).ram().mirror(0x0800); } -void shangkid_state::shangkid_sound_map(address_map &map) +void shangkid_state::sound_map(address_map &map) { - map(0x0000, 0xdfff).bankr("bank2"); /* sample player writes to ROM area */ + map(0x0000, 0xdfff).bankr(m_soundbank); // sample player writes to ROM area map(0xe000, 0xe7ff).ram().mirror(0x0800); } -void shangkid_state::sound_portmap(address_map &map) +void chinhero_state::sound_portmap(address_map &map) { map.global_mask(0xff); - map(0x00, 0x00).r(FUNC(shangkid_state::soundlatch_r)).w("dac", FUNC(dac_byte_interface::data_w)); + map(0x00, 0x00).r("soundlatch", FUNC(generic_latch_8_device::read)).w("dac", FUNC(dac_byte_interface::data_w)); } /***************************************************************************************/ -void shangkid_state::chinhero(machine_config &config) +void chinhero_state::chinhero(machine_config &config) { - /* basic machine hardware */ - Z80(config, m_maincpu, XTAL(18'432'000)/6); /* verified on pcb */ - m_maincpu->set_addrmap(AS_PROGRAM, &shangkid_state::chinhero_main_map); + // basic machine hardware + Z80(config, m_maincpu, XTAL(18'432'000) / 6); // verified on pcb + m_maincpu->set_addrmap(AS_PROGRAM, &chinhero_state::main_map); - Z80(config, m_bbx, XTAL(18'432'000)/6); /* verified on pcb */ - m_bbx->set_addrmap(AS_PROGRAM, &shangkid_state::chinhero_bbx_map); - m_bbx->set_addrmap(AS_IO, &shangkid_state::chinhero_bbx_portmap); + Z80(config, m_bbx, XTAL(18'432'000) / 6); // verified on pcb + m_bbx->set_addrmap(AS_PROGRAM, &chinhero_state::bbx_map); + m_bbx->set_addrmap(AS_IO, &chinhero_state::bbx_portmap); - Z80(config, m_audiocpu, XTAL(18'432'000)/6); /* verified on pcb */ - m_audiocpu->set_addrmap(AS_PROGRAM, &shangkid_state::chinhero_sound_map); - m_audiocpu->set_addrmap(AS_IO, &shangkid_state::sound_portmap); + Z80(config, m_audiocpu, XTAL(18'432'000) / 6); // verified on pcb + m_audiocpu->set_addrmap(AS_PROGRAM, &chinhero_state::sound_map); + m_audiocpu->set_addrmap(AS_IO, &chinhero_state::sound_portmap); ls259_device &mainlatch(LS259(config, "mainlatch")); mainlatch.q_out_cb<0>().set_inputline(m_bbx, INPUT_LINE_RESET).invert(); // RESET2 mainlatch.q_out_cb<1>().set_inputline(m_audiocpu, INPUT_LINE_RESET).invert(); // RESET3 - mainlatch.q_out_cb<1>().append(FUNC(shangkid_state::sound_enable_w)); - mainlatch.q_out_cb<2>().set(FUNC(shangkid_state::int_enable_1_w)); // INTE1 - mainlatch.q_out_cb<3>().set(FUNC(shangkid_state::int_enable_2_w)); // INTE2 - mainlatch.q_out_cb<4>().set(FUNC(shangkid_state::nmi_enable_1_w)); // NMIE1 - mainlatch.q_out_cb<5>().set(FUNC(shangkid_state::nmi_enable_2_w)); // NMIE2 - mainlatch.q_out_cb<6>().set(FUNC(shangkid_state::coin_counter_1_w)); - mainlatch.q_out_cb<7>().set(FUNC(shangkid_state::coin_counter_2_w)); + mainlatch.q_out_cb<1>().append(FUNC(chinhero_state::sound_enable_w)); + mainlatch.q_out_cb<2>().set(FUNC(chinhero_state::int_enable_1_w)); // INTE1 + mainlatch.q_out_cb<3>().set(FUNC(chinhero_state::int_enable_2_w)); // INTE2 + mainlatch.q_out_cb<4>().set(FUNC(chinhero_state::nmi_enable_1_w)); // NMIE1 + mainlatch.q_out_cb<5>().set(FUNC(chinhero_state::nmi_enable_2_w)); // NMIE2 + mainlatch.q_out_cb<6>().set(FUNC(chinhero_state::coin_counter_1_w)); + mainlatch.q_out_cb<7>().set(FUNC(chinhero_state::coin_counter_2_w)); config.set_maximum_quantum(attotime::from_hz(600)); - /* video hardware */ + // video hardware screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_refresh_hz(60); - screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500) /* not accurate */); - screen.set_size(40*8, 28*8); - screen.set_visarea(16, 319-16, 0, 223); - screen.set_screen_update(FUNC(shangkid_state::screen_update_shangkid)); - screen.set_palette(m_palette); - screen.screen_vblank().set(FUNC(shangkid_state::irq_1_w)); - screen.screen_vblank().append(FUNC(shangkid_state::irq_2_w)); - - GFXDECODE(config, m_gfxdecode, m_palette, gfx_chinhero); - PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 256); - MCFG_VIDEO_START_OVERRIDE(shangkid_state,shangkid) - - /* sound hardware */ + screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); // not accurate + screen.set_size(40 * 8, 28 * 8); + screen.set_visarea(16, 319 - 16, 0, 223); + screen.set_screen_update(FUNC(chinhero_state::screen_update)); + screen.set_palette("palette"); + screen.screen_vblank().set(FUNC(chinhero_state::irq_1_w)); + screen.screen_vblank().append(FUNC(chinhero_state::irq_2_w)); + + GFXDECODE(config, m_gfxdecode, "palette", gfx_chinhero); + PALETTE(config, "palette", palette_device::RGB_444_PROMS, "proms", 256); + + // sound hardware SPEAKER(config, "speaker").front_center(); + GENERIC_LATCH_8(config, "soundlatch"); + DAC_8BIT_R2R(config, "dac", 0).add_route(ALL_OUTPUTS, "speaker", 0.25); // unknown DAC - AY8910(config, m_aysnd, XTAL(18'432'000)/12); /* verified on pcb */ - m_aysnd->port_a_write_callback().set(FUNC(shangkid_state::chinhero_ay8910_porta_w)); - m_aysnd->port_b_write_callback().set(FUNC(shangkid_state::ay8910_portb_w)); + AY8910(config, m_aysnd, XTAL(18'432'000) / 12); // verified on pcb + m_aysnd->port_a_write_callback().set(FUNC(chinhero_state::ay8910_porta_w)); + m_aysnd->port_b_write_callback().set("soundlatch", FUNC(generic_latch_8_device::write)); m_aysnd->add_route(ALL_OUTPUTS, "speaker", 0.1); } @@ -432,78 +419,76 @@ void shangkid_state::shangkid(machine_config &config) { chinhero(config); - /* basic machine hardware */ - m_maincpu->set_addrmap(AS_PROGRAM, &shangkid_state::shangkid_main_map); + // basic machine hardware + m_maincpu->set_addrmap(AS_PROGRAM, &shangkid_state::main_map); - m_bbx->set_addrmap(AS_PROGRAM, &shangkid_state::shangkid_bbx_map); - m_bbx->set_addrmap(AS_IO, &shangkid_state::shangkid_bbx_portmap); + m_bbx->set_addrmap(AS_PROGRAM, &shangkid_state::bbx_map); + m_bbx->set_addrmap(AS_IO, &shangkid_state::bbx_portmap); - m_audiocpu->set_addrmap(AS_PROGRAM, &shangkid_state::shangkid_sound_map); + m_audiocpu->set_addrmap(AS_PROGRAM, &shangkid_state::sound_map); ls259_device &mainlatch(*subdevice("mainlatch")); // Q1 should *not* reset the AY-3-8910 here, or else banking writes will be lost! mainlatch.q_out_cb<1>().set_inputline(m_audiocpu, INPUT_LINE_RESET).invert(); - mainlatch.q_out_cb<7>().set_membank("bank1"); - - MCFG_MACHINE_RESET_OVERRIDE(shangkid_state,shangkid) + mainlatch.q_out_cb<7>().set_membank("mainbank"); - /* video hardware */ + // video hardware m_gfxdecode->set_info(gfx_shangkid); - m_aysnd->port_a_write_callback().set(FUNC(shangkid_state::shangkid_ay8910_porta_w)); + m_aysnd->port_a_write_callback().set(FUNC(shangkid_state::ay8910_porta_w)); } -void shangkid_state::dynamski_map(address_map &map) +void dynamski_state::prgmap(address_map &map) { map(0x0000, 0x7fff).rom(); - map(0xc000, 0xcbff).ram().share("videoram"); /* tilemap */ - map(0xd000, 0xdbff).ram().share("spriteram"); /* tilemap */ + map(0xc000, 0xcbff).ram().share(m_videoram); // tilemap + map(0xd000, 0xdbff).ram().share(m_spriteram); map(0xe000, 0xe007).w("mainlatch", FUNC(ls259_device::write_d0)); map(0xe800, 0xe800).portr("SYSTEM"); map(0xe801, 0xe801).portr("P1"); map(0xe802, 0xe802).portr("P2"); map(0xe803, 0xe803).portr("DSW"); - map(0xf000, 0xf7ff).ram(); /* work ram */ + map(0xf000, 0xf7ff).ram(); // work ram } -void shangkid_state::dynamski_portmap(address_map &map) +void dynamski_state::portmap(address_map &map) { map.global_mask(0xff); - /* ports are reversed */ - map(0x00, 0x01).w(m_aysnd, FUNC(ay8910_device::data_address_w)); + // ports are reversed + map(0x00, 0x01).w("aysnd", FUNC(ay8910_device::data_address_w)); } -void shangkid_state::dynamski(machine_config &config) +void dynamski_state::dynamski(machine_config &config) { - /* basic machine hardware */ - Z80(config, m_maincpu, 3000000); /* ? */ - m_maincpu->set_addrmap(AS_PROGRAM, &shangkid_state::dynamski_map); - m_maincpu->set_addrmap(AS_IO, &shangkid_state::dynamski_portmap); + // basic machine hardware + Z80(config, m_maincpu, 3000000); // ? + m_maincpu->set_addrmap(AS_PROGRAM, &dynamski_state::prgmap); + m_maincpu->set_addrmap(AS_IO, &dynamski_state::portmap); ls259_device &mainlatch(LS259(config, "mainlatch")); - mainlatch.q_out_cb<0>().set(FUNC(shangkid_state::int_enable_1_w)); + mainlatch.q_out_cb<0>().set(FUNC(dynamski_state::int_enable_1_w)); mainlatch.q_out_cb<1>().set_nop(); // screen flip? mainlatch.q_out_cb<2>().set_nop(); // screen flip? - /* video hardware */ + // video hardware screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_refresh_hz(60); - screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500) /* not accurate */); + screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); // not accurate screen.set_size(256+32, 256); screen.set_visarea(0, 255+32, 16, 255-16); - screen.set_screen_update(FUNC(shangkid_state::screen_update_dynamski)); - screen.set_palette(m_palette); - screen.screen_vblank().set(FUNC(shangkid_state::irq_1_w)); + screen.set_screen_update(FUNC(dynamski_state::screen_update)); + screen.set_palette("palette"); + screen.screen_vblank().set(FUNC(dynamski_state::irq_1_w)); - GFXDECODE(config, m_gfxdecode, m_palette, gfx_dynamski); - PALETTE(config, m_palette, FUNC(shangkid_state::dynamski_palette), 16*4 + 16*4, 32); + GFXDECODE(config, m_gfxdecode, "palette", gfx_dynamski); + PALETTE(config, "palette", FUNC(dynamski_state::palette), 16*4 + 16*4, 32); - /* sound hardware */ + // sound hardware SPEAKER(config, "speaker").front_center(); - AY8910(config, m_aysnd, 2000000).add_route(ALL_OUTPUTS, "speaker", 0.1); + AY8910(config, "aysnd", 2000000).add_route(ALL_OUTPUTS, "speaker", 0.1); } /***************************************************************************************/ @@ -512,7 +497,7 @@ static INPUT_PORTS_START( dynamski ) PORT_START("SYSTEM") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE1 ) /* service */ + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START1 ) PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_START2 ) PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN ) @@ -568,7 +553,7 @@ static INPUT_PORTS_START( chinhero ) PORT_START("SYSTEM") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE1 ) /* service */ + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START1 ) PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_START2 ) PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) @@ -623,12 +608,12 @@ static INPUT_PORTS_START( shangkid ) PORT_START("SYSTEM") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE1 ) /* service */ + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START1 ) PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_START2 ) PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) /* busy flag? */ + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) // busy flag? // button order is trusted from practice layout and service mode PORT_START("P1") @@ -684,144 +669,144 @@ INPUT_PORTS_END /***************************************************************************************/ ROM_START( chinhero ) - ROM_REGION( 0x10000, "maincpu", 0 ) /* Z80 code (main) */ + ROM_REGION( 0x10000, "maincpu", 0 ) // Z80 code ROM_LOAD( "ic2.1", 0x0000, 0x2000, CRC(8974bac4) SHA1(932a677d0928f4146201f206b71ac2bcc0f6735c) ) ROM_LOAD( "ic3.2", 0x2000, 0x2000, CRC(9b7a02fe) SHA1(b17593262ec24b999d66634b84eee95c1088f7eb) ) ROM_LOAD( "ic4.3", 0x4000, 0x2000, CRC(e86d4195) SHA1(5081500e0a6d4fd19690134efd6f35b6047e6727) ) ROM_LOAD( "ic5.4", 0x6000, 0x2000, CRC(2b629d2c) SHA1(7e92e2c2d09d3501ddbf79a14228cf273f4a17df) ) ROM_LOAD( "ic6.5", 0x8000, 0x2000, CRC(35bf4a4f) SHA1(2600c57d40355775847eed8a9592c67f5d11f1f1) ) - ROM_REGION( 0x10000, "bbx", 0 ) /* Z80 code (coprocessor) */ + ROM_REGION( 0x10000, "bbx", 0 ) // Z80 code (coprocessor) ROM_LOAD( "ic31.6", 0x0000, 0x2000, CRC(7c56927b) SHA1(565a10b39f2d5d38cb5415aadd7fbdb90dcf13cb) ) ROM_LOAD( "ic32.7", 0x2000, 0x2000, CRC(d67b8045) SHA1(0374cafb8d4828e195791784ac187772c49c18f9) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) /* Z80 code (sound) */ + ROM_REGION( 0x10000, "audiocpu", 0 ) // Z80 code ROM_LOAD( "ic47.8", 0x0000, 0x2000, CRC(3c396062) SHA1(2c1540eb123b3124e1679ba09e063e80f2423022) ) ROM_LOAD( "ic48.9", 0x2000, 0x2000, CRC(b14f2bab) SHA1(3643b430e3b464b0bc9aca81122b07fb8eb0fb9f) ) ROM_LOAD( "ic49.10", 0x4000, 0x2000, CRC(8c0e43d1) SHA1(acaead801b4782875c8b6092e987b73f9973f8b0) ) - ROM_REGION( 0x4000, "gfx1", ROMREGION_INVERT ) /* tiles */ + ROM_REGION( 0x4000, "tiles", ROMREGION_INVERT ) ROM_LOAD( "ic21.11", 0x0000, 0x2000, CRC(3a37fb45) SHA1(4c631cf924f1e1dfea6db3f014ab7d9cb9f4b0c4) ) ROM_LOAD( "ic22.12", 0x2000, 0x2000, CRC(bc21c002) SHA1(4fc5e4dfe8331a3feb1c370a8aca9c8303eb7b4e) ) - ROM_REGION( 0x6000, "gfx2", ROMREGION_INVERT ) /* sprites */ + ROM_REGION( 0x6000, "sprites", ROMREGION_INVERT ) ROM_LOAD( "ic114.18", 0x0000, 0x2000, CRC(fc4183a8) SHA1(4bc891a9e16cd84ce353180705cc8fcadf414a49) ) ROM_LOAD( "ic113.17", 0x2000, 0x2000, CRC(d713d7fe) SHA1(8dd97f96a1190c5be5e19721227dd80adf060b4d) ) ROM_LOAD( "ic99.13", 0x4000, 0x2000, CRC(a8e2a3f4) SHA1(db9f954d4b46660f5f1cb4122838e6418f92d0a3) ) - ROM_REGION( 0x6000, "gfx3", ROMREGION_INVERT ) /* sprites */ + ROM_REGION( 0x6000, "sprites_2", ROMREGION_INVERT ) ROM_LOAD( "ic112.16", 0x0000, 0x2000, CRC(dd5170ca) SHA1(e0a9d1dbc021a8ad84dd7d1bd7e390e51e6328b7) ) ROM_LOAD( "ic111.15", 0x2000, 0x2000, CRC(20f6052e) SHA1(e22ddb3fb90ff8df5ce7fda6a26c1b9fce2f59ab) ) ROM_LOAD( "ic110.14", 0x4000, 0x2000, CRC(9bc2d568) SHA1(a4ee8822709645b0dc088635c0a9c263fb5a2245) ) ROM_REGION( 0xa80, "proms", 0 ) - ROM_LOAD( "v_ic36_r", 0x000, 0x100, CRC(16ae1692) SHA1(e287b96890da4815350af72e9f2189d0c72313b6) ) /* red */ - ROM_LOAD( "v_ic35_g", 0x100, 0x100, CRC(b3d0a074) SHA1(e955fda8cb8df389507e17b7b4609e845e5ef0c4) ) /* green */ - ROM_LOAD( "v_ic27_b", 0x200, 0x100, CRC(353a2d11) SHA1(76f21e3e092024592d9ccd33ae69c438254c5755) ) /* blue */ + ROM_LOAD( "v_ic36_r", 0x000, 0x100, CRC(16ae1692) SHA1(e287b96890da4815350af72e9f2189d0c72313b6) ) // red + ROM_LOAD( "v_ic35_g", 0x100, 0x100, CRC(b3d0a074) SHA1(e955fda8cb8df389507e17b7b4609e845e5ef0c4) ) // green + ROM_LOAD( "v_ic27_b", 0x200, 0x100, CRC(353a2d11) SHA1(76f21e3e092024592d9ccd33ae69c438254c5755) ) // blue - ROM_LOAD( "v_ic28_m", 0x300, 0x100, CRC(7ca273c1) SHA1(20d85547d96bea8b310c943c45e4978a7e5b5585) ) /* unknown */ - ROM_LOAD( "v_ic69", 0x400, 0x200, CRC(410d6f86) SHA1(3cfaef3702dbda3e7c7eb84a93561e36778aec3e) ) /* zoom */ - ROM_LOAD( "v_ic108", 0x600, 0x200, CRC(d33c02ae) SHA1(1a2146ae404a5e8a701e1d547a8409a376d4bee4) ) /* zoom */ + ROM_LOAD( "v_ic28_m", 0x300, 0x100, CRC(7ca273c1) SHA1(20d85547d96bea8b310c943c45e4978a7e5b5585) ) // unknown + ROM_LOAD( "v_ic69", 0x400, 0x200, CRC(410d6f86) SHA1(3cfaef3702dbda3e7c7eb84a93561e36778aec3e) ) // zoom + ROM_LOAD( "v_ic108", 0x600, 0x200, CRC(d33c02ae) SHA1(1a2146ae404a5e8a701e1d547a8409a376d4bee4) ) // zoom - ROM_LOAD( "v_ic12", 0x800, 0x100, CRC(0de07e89) SHA1(5655bce6ff3abad63f5b31add402cdbb51c323f0) ) /* tile pen priority */ - ROM_LOAD( "v_ic15_p", 0x900, 0x100, CRC(7e0a0581) SHA1(e355a6ef21a65a1e828d7bd5b0f2224b06438b4a) ) /* sprite pen transparency */ + ROM_LOAD( "v_ic12", 0x800, 0x100, CRC(0de07e89) SHA1(5655bce6ff3abad63f5b31add402cdbb51c323f0) ) // tile pen priority + ROM_LOAD( "v_ic15_p", 0x900, 0x100, CRC(7e0a0581) SHA1(e355a6ef21a65a1e828d7bd5b0f2224b06438b4a) ) // sprite pen transparency ROM_LOAD( "v_ic8", 0xa00, 0x020, CRC(4c62974d) SHA1(fd5970b5ba1d9e986515ae06c2e83f8bf20b3cdc) ) - ROM_LOAD( "ic8", 0xa20, 0x020, CRC(84bcd9af) SHA1(5a5afeb6aedb8ac6ac49fb8da62df57fbd8b1780) ) /* main CPU banking */ - ROM_LOAD( "ic22", 0xa40, 0x020, CRC(84bcd9af) SHA1(5a5afeb6aedb8ac6ac49fb8da62df57fbd8b1780) ) /* coprocessor banking */ - ROM_LOAD( "ic42", 0xa60, 0x020, CRC(2ccfe10a) SHA1(d89ea91e5da436805fca9ded9b33609f4a862724) ) /* sound cpu banking */ + ROM_LOAD( "ic8", 0xa20, 0x020, CRC(84bcd9af) SHA1(5a5afeb6aedb8ac6ac49fb8da62df57fbd8b1780) ) // main CPU banking + ROM_LOAD( "ic22", 0xa40, 0x020, CRC(84bcd9af) SHA1(5a5afeb6aedb8ac6ac49fb8da62df57fbd8b1780) ) // coprocessor banking + ROM_LOAD( "ic42", 0xa60, 0x020, CRC(2ccfe10a) SHA1(d89ea91e5da436805fca9ded9b33609f4a862724) ) // sound cpu banking ROM_END ROM_START( chinhero2 ) - ROM_REGION( 0x10000, "maincpu", 0 ) /* Z80 code (main) */ + ROM_REGION( 0x10000, "maincpu", 0 ) // Z80 code ROM_LOAD( "1.128", 0x0000, 0x4000, CRC(68e247aa) SHA1(27c2b864e482ba10c81337ed7c03a58b395e52bb) ) ROM_LOAD( "2.128", 0x4000, 0x4000, CRC(0346d8c9) SHA1(458b9a37b0ad0cafecdb0348f7d93508531bc310) ) ROM_LOAD( "3.128", 0x8000, 0x4000, CRC(a78b8d78) SHA1(c2b7b2d56e2fdb7a2a11bb8b1aab35a841331b96) ) - ROM_REGION( 0x10000, "bbx", 0 ) /* Z80 code (coprocessor) */ + ROM_REGION( 0x10000, "bbx", 0 ) // Z80 code (coprocessor) ROM_LOAD( "4.128", 0x0000, 0x4000, CRC(6ab2e836) SHA1(61c84c0b685e29bac8020a0051586267ecd20166) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) /* Z80 code (sound) */ + ROM_REGION( 0x10000, "audiocpu", 0 ) // Z80 code ROM_LOAD( "5.128", 0x0000, 0x4000, CRC(4e4f3f92) SHA1(57d0485f8a0110f5448b554d2fab1caba52551fd) ) ROM_LOAD( "ic49.10", 0x4000, 0x2000, CRC(8c0e43d1) SHA1(acaead801b4782875c8b6092e987b73f9973f8b0) ) - ROM_REGION( 0x4000, "gfx1", ROMREGION_INVERT ) /* tiles */ + ROM_REGION( 0x4000, "tiles", ROMREGION_INVERT ) ROM_LOAD( "ic21.11", 0x0000, 0x2000, CRC(3a37fb45) SHA1(4c631cf924f1e1dfea6db3f014ab7d9cb9f4b0c4) ) ROM_LOAD( "ic22.12", 0x2000, 0x2000, CRC(bc21c002) SHA1(4fc5e4dfe8331a3feb1c370a8aca9c8303eb7b4e) ) - ROM_REGION( 0x6000, "gfx2", ROMREGION_INVERT ) /* sprites */ + ROM_REGION( 0x6000, "sprites", ROMREGION_INVERT ) ROM_LOAD( "ic114.18", 0x0000, 0x2000, CRC(fc4183a8) SHA1(4bc891a9e16cd84ce353180705cc8fcadf414a49) ) ROM_LOAD( "ic113.17", 0x2000, 0x2000, CRC(d713d7fe) SHA1(8dd97f96a1190c5be5e19721227dd80adf060b4d) ) ROM_LOAD( "ic99.13", 0x4000, 0x2000, CRC(a8e2a3f4) SHA1(db9f954d4b46660f5f1cb4122838e6418f92d0a3) ) - ROM_REGION( 0x6000, "gfx3", ROMREGION_INVERT ) /* sprites */ + ROM_REGION( 0x6000, "sprites_2", ROMREGION_INVERT ) ROM_LOAD( "ic112.16", 0x0000, 0x2000, CRC(dd5170ca) SHA1(e0a9d1dbc021a8ad84dd7d1bd7e390e51e6328b7) ) ROM_LOAD( "ic111.15", 0x2000, 0x2000, CRC(20f6052e) SHA1(e22ddb3fb90ff8df5ce7fda6a26c1b9fce2f59ab) ) ROM_LOAD( "ic110.14", 0x4000, 0x2000, CRC(9bc2d568) SHA1(a4ee8822709645b0dc088635c0a9c263fb5a2245) ) ROM_REGION( 0xa80, "proms", 0 ) - ROM_LOAD( "v_ic36_r", 0x000, 0x100, CRC(16ae1692) SHA1(e287b96890da4815350af72e9f2189d0c72313b6) ) /* red */ - ROM_LOAD( "v_ic35_g", 0x100, 0x100, CRC(b3d0a074) SHA1(e955fda8cb8df389507e17b7b4609e845e5ef0c4) ) /* green */ - ROM_LOAD( "v_ic27_b", 0x200, 0x100, CRC(353a2d11) SHA1(76f21e3e092024592d9ccd33ae69c438254c5755) ) /* blue */ + ROM_LOAD( "v_ic36_r", 0x000, 0x100, CRC(16ae1692) SHA1(e287b96890da4815350af72e9f2189d0c72313b6) ) // red + ROM_LOAD( "v_ic35_g", 0x100, 0x100, CRC(b3d0a074) SHA1(e955fda8cb8df389507e17b7b4609e845e5ef0c4) ) // green + ROM_LOAD( "v_ic27_b", 0x200, 0x100, CRC(353a2d11) SHA1(76f21e3e092024592d9ccd33ae69c438254c5755) ) // blue - ROM_LOAD( "v_ic28_m", 0x300, 0x100, CRC(7ca273c1) SHA1(20d85547d96bea8b310c943c45e4978a7e5b5585) ) /* unknown */ - ROM_LOAD( "v_ic69", 0x400, 0x200, CRC(410d6f86) SHA1(3cfaef3702dbda3e7c7eb84a93561e36778aec3e) ) /* zoom */ - ROM_LOAD( "v_ic108", 0x600, 0x200, CRC(d33c02ae) SHA1(1a2146ae404a5e8a701e1d547a8409a376d4bee4) ) /* zoom */ + ROM_LOAD( "v_ic28_m", 0x300, 0x100, CRC(7ca273c1) SHA1(20d85547d96bea8b310c943c45e4978a7e5b5585) ) // unknown + ROM_LOAD( "v_ic69", 0x400, 0x200, CRC(410d6f86) SHA1(3cfaef3702dbda3e7c7eb84a93561e36778aec3e) ) // zoom + ROM_LOAD( "v_ic108", 0x600, 0x200, CRC(d33c02ae) SHA1(1a2146ae404a5e8a701e1d547a8409a376d4bee4) ) // zoom - ROM_LOAD( "v_ic12", 0x800, 0x100, CRC(0de07e89) SHA1(5655bce6ff3abad63f5b31add402cdbb51c323f0) ) /* tile pen priority */ - ROM_LOAD( "v_ic15_p", 0x900, 0x100, CRC(7e0a0581) SHA1(e355a6ef21a65a1e828d7bd5b0f2224b06438b4a) ) /* sprite pen transparency */ + ROM_LOAD( "v_ic12", 0x800, 0x100, CRC(0de07e89) SHA1(5655bce6ff3abad63f5b31add402cdbb51c323f0) ) // tile pen priority + ROM_LOAD( "v_ic15_p", 0x900, 0x100, CRC(7e0a0581) SHA1(e355a6ef21a65a1e828d7bd5b0f2224b06438b4a) ) // sprite pen transparency ROM_LOAD( "v_ic8", 0xa00, 0x020, CRC(4c62974d) SHA1(fd5970b5ba1d9e986515ae06c2e83f8bf20b3cdc) ) - ROM_LOAD( "ic8", 0xa20, 0x020, CRC(84bcd9af) SHA1(5a5afeb6aedb8ac6ac49fb8da62df57fbd8b1780) ) /* main CPU banking */ - ROM_LOAD( "ic22", 0xa40, 0x020, CRC(84bcd9af) SHA1(5a5afeb6aedb8ac6ac49fb8da62df57fbd8b1780) ) /* coprocessor banking */ - ROM_LOAD( "ic42", 0xa60, 0x020, CRC(2ccfe10a) SHA1(d89ea91e5da436805fca9ded9b33609f4a862724) ) /* sound cpu banking */ + ROM_LOAD( "ic8", 0xa20, 0x020, CRC(84bcd9af) SHA1(5a5afeb6aedb8ac6ac49fb8da62df57fbd8b1780) ) // main CPU banking + ROM_LOAD( "ic22", 0xa40, 0x020, CRC(84bcd9af) SHA1(5a5afeb6aedb8ac6ac49fb8da62df57fbd8b1780) ) // coprocessor banking + ROM_LOAD( "ic42", 0xa60, 0x020, CRC(2ccfe10a) SHA1(d89ea91e5da436805fca9ded9b33609f4a862724) ) // sound cpu banking ROM_END ROM_START( chinhero3 ) - ROM_REGION( 0x10000, "maincpu", 0 ) /* Z80 code (main) */ + ROM_REGION( 0x10000, "maincpu", 0 ) // Z80 code ROM_LOAD( "1-11-22.ic2", 0x0000, 0x4000, CRC(9b24f886) SHA1(ac34c353bae68d2fa716b0dd9f5e41edcf59ad2a) ) ROM_LOAD( "2-11-22.ic3", 0x4000, 0x4000, CRC(39c66686) SHA1(e19ef3116c848f76e516f1de08bfe4be306753ca) ) ROM_LOAD( "3-11-22.ic4", 0x8000, 0x2000, CRC(2d51135e) SHA1(58892495ee51a43fa02f2421b1d6fe4c48d7c8a7) ) // other boards use a rom with both halves identical here instead of a smaller one. - ROM_REGION( 0x10000, "bbx", 0 ) /* Z80 code (coprocessor) */ + ROM_REGION( 0x10000, "bbx", 0 ) // Z80 code (coprocessor) ROM_LOAD( "4-11-22.ic31", 0x0000, 0x4000, CRC(6ab2e836) SHA1(61c84c0b685e29bac8020a0051586267ecd20166) ) // nothing below was dumped on this set, assuming to be the same. - ROM_REGION( 0x10000, "audiocpu", 0 ) /* Z80 code (sound) */ + ROM_REGION( 0x10000, "audiocpu", 0 ) // Z80 code ROM_LOAD( "5.128", 0x0000, 0x4000, CRC(4e4f3f92) SHA1(57d0485f8a0110f5448b554d2fab1caba52551fd) ) ROM_LOAD( "ic49.10", 0x4000, 0x2000, CRC(8c0e43d1) SHA1(acaead801b4782875c8b6092e987b73f9973f8b0) ) - ROM_REGION( 0x4000, "gfx1", ROMREGION_INVERT ) /* tiles */ + ROM_REGION( 0x4000, "tiles", ROMREGION_INVERT ) ROM_LOAD( "ic21.11", 0x0000, 0x2000, CRC(3a37fb45) SHA1(4c631cf924f1e1dfea6db3f014ab7d9cb9f4b0c4) ) ROM_LOAD( "ic22.12", 0x2000, 0x2000, CRC(bc21c002) SHA1(4fc5e4dfe8331a3feb1c370a8aca9c8303eb7b4e) ) - ROM_REGION( 0x6000, "gfx2", ROMREGION_INVERT ) /* sprites */ + ROM_REGION( 0x6000, "sprites", ROMREGION_INVERT ) ROM_LOAD( "ic114.18", 0x0000, 0x2000, CRC(fc4183a8) SHA1(4bc891a9e16cd84ce353180705cc8fcadf414a49) ) ROM_LOAD( "ic113.17", 0x2000, 0x2000, CRC(d713d7fe) SHA1(8dd97f96a1190c5be5e19721227dd80adf060b4d) ) ROM_LOAD( "ic99.13", 0x4000, 0x2000, CRC(a8e2a3f4) SHA1(db9f954d4b46660f5f1cb4122838e6418f92d0a3) ) - ROM_REGION( 0x6000, "gfx3", ROMREGION_INVERT ) /* sprites */ + ROM_REGION( 0x6000, "sprites_2", ROMREGION_INVERT ) ROM_LOAD( "ic112.16", 0x0000, 0x2000, CRC(dd5170ca) SHA1(e0a9d1dbc021a8ad84dd7d1bd7e390e51e6328b7) ) ROM_LOAD( "ic111.15", 0x2000, 0x2000, CRC(20f6052e) SHA1(e22ddb3fb90ff8df5ce7fda6a26c1b9fce2f59ab) ) ROM_LOAD( "ic110.14", 0x4000, 0x2000, CRC(9bc2d568) SHA1(a4ee8822709645b0dc088635c0a9c263fb5a2245) ) ROM_REGION( 0xa80, "proms", 0 ) - ROM_LOAD( "v_ic36_r", 0x000, 0x100, CRC(16ae1692) SHA1(e287b96890da4815350af72e9f2189d0c72313b6) ) /* red */ - ROM_LOAD( "v_ic35_g", 0x100, 0x100, CRC(b3d0a074) SHA1(e955fda8cb8df389507e17b7b4609e845e5ef0c4) ) /* green */ - ROM_LOAD( "v_ic27_b", 0x200, 0x100, CRC(353a2d11) SHA1(76f21e3e092024592d9ccd33ae69c438254c5755) ) /* blue */ + ROM_LOAD( "v_ic36_r", 0x000, 0x100, CRC(16ae1692) SHA1(e287b96890da4815350af72e9f2189d0c72313b6) ) // red + ROM_LOAD( "v_ic35_g", 0x100, 0x100, CRC(b3d0a074) SHA1(e955fda8cb8df389507e17b7b4609e845e5ef0c4) ) // green + ROM_LOAD( "v_ic27_b", 0x200, 0x100, CRC(353a2d11) SHA1(76f21e3e092024592d9ccd33ae69c438254c5755) ) // blue - ROM_LOAD( "v_ic28_m", 0x300, 0x100, CRC(7ca273c1) SHA1(20d85547d96bea8b310c943c45e4978a7e5b5585) ) /* unknown */ - ROM_LOAD( "v_ic69", 0x400, 0x200, CRC(410d6f86) SHA1(3cfaef3702dbda3e7c7eb84a93561e36778aec3e) ) /* zoom */ - ROM_LOAD( "v_ic108", 0x600, 0x200, CRC(d33c02ae) SHA1(1a2146ae404a5e8a701e1d547a8409a376d4bee4) ) /* zoom */ + ROM_LOAD( "v_ic28_m", 0x300, 0x100, CRC(7ca273c1) SHA1(20d85547d96bea8b310c943c45e4978a7e5b5585) ) // unknown + ROM_LOAD( "v_ic69", 0x400, 0x200, CRC(410d6f86) SHA1(3cfaef3702dbda3e7c7eb84a93561e36778aec3e) ) // zoom + ROM_LOAD( "v_ic108", 0x600, 0x200, CRC(d33c02ae) SHA1(1a2146ae404a5e8a701e1d547a8409a376d4bee4) ) // zoom - ROM_LOAD( "v_ic12", 0x800, 0x100, CRC(0de07e89) SHA1(5655bce6ff3abad63f5b31add402cdbb51c323f0) ) /* tile pen priority */ - ROM_LOAD( "v_ic15_p", 0x900, 0x100, CRC(7e0a0581) SHA1(e355a6ef21a65a1e828d7bd5b0f2224b06438b4a) ) /* sprite pen transparency */ + ROM_LOAD( "v_ic12", 0x800, 0x100, CRC(0de07e89) SHA1(5655bce6ff3abad63f5b31add402cdbb51c323f0) ) // tile pen priority + ROM_LOAD( "v_ic15_p", 0x900, 0x100, CRC(7e0a0581) SHA1(e355a6ef21a65a1e828d7bd5b0f2224b06438b4a) ) // sprite pen transparency ROM_LOAD( "v_ic8", 0xa00, 0x020, CRC(4c62974d) SHA1(fd5970b5ba1d9e986515ae06c2e83f8bf20b3cdc) ) - ROM_LOAD( "ic8", 0xa20, 0x020, CRC(84bcd9af) SHA1(5a5afeb6aedb8ac6ac49fb8da62df57fbd8b1780) ) /* main CPU banking */ - ROM_LOAD( "ic22", 0xa40, 0x020, CRC(84bcd9af) SHA1(5a5afeb6aedb8ac6ac49fb8da62df57fbd8b1780) ) /* coprocessor banking */ - ROM_LOAD( "ic42", 0xa60, 0x020, CRC(2ccfe10a) SHA1(d89ea91e5da436805fca9ded9b33609f4a862724) ) /* sound cpu banking */ + ROM_LOAD( "ic8", 0xa20, 0x020, CRC(84bcd9af) SHA1(5a5afeb6aedb8ac6ac49fb8da62df57fbd8b1780) ) // main CPU banking + ROM_LOAD( "ic22", 0xa40, 0x020, CRC(84bcd9af) SHA1(5a5afeb6aedb8ac6ac49fb8da62df57fbd8b1780) ) // coprocessor banking + ROM_LOAD( "ic42", 0xa60, 0x020, CRC(2ccfe10a) SHA1(d89ea91e5da436805fca9ded9b33609f4a862724) ) // sound cpu banking ROM_END /* @@ -830,7 +815,7 @@ CPU Main cpu z80A x2 Sound cpu z80A Sound chip AY-3-8910 -Other ics: on lower video board,one flat-pack and two smd types.I cannot read id code on them because it was been erased. +Other ics: on lower video board, one flat-pack and two smd types. I cannot read id code on them because it has been erased. Osc 18,432 Mhz ROMs @@ -838,64 +823,64 @@ chtaito1 to 4 main program chtaito5-6 sound program chtaito11 to 18 graphics -All eproms are 27128,2764 +All eproms are 27128, 2764 -There are present 12 bipolar proms but i cannot dump them,but i think that code is identical to Taiyo set. +There are present 12 bipolar proms but I cannot dump them, but I think that code is identical to Taiyo set. */ ROM_START( chinherot ) - ROM_REGION( 0x10000, "maincpu", 0 ) /* Z80 code (main) */ + ROM_REGION( 0x10000, "maincpu", 0 ) // Z80 code ROM_LOAD( "chtaito1.bin", 0x0000, 0x4000, CRC(2bd64de0) SHA1(cce14f9779a830ed83fa185918d22de0658e40ea) ) ROM_LOAD( "chtaito2.bin", 0x4000, 0x4000, CRC(8fd04da9) SHA1(17f868c33ad01f0df96fe50e78dbde35ac8e2fe1) ) ROM_LOAD( "chtaito3.bin", 0x8000, 0x2000, CRC(cd6908e7) SHA1(0a9b1d91bf64e8722a4e9c89658f5d4ea96c07a4) ) - ROM_REGION( 0x10000, "bbx", 0 ) /* Z80 code (coprocessor) */ + ROM_REGION( 0x10000, "bbx", 0 ) // Z80 code (coprocessor) ROM_LOAD( "chtaito4.bin", 0x0000, 0x4000, CRC(2a012614) SHA1(384575197f927a6acc8b77c3b3516e0d93e7784d) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) /* Z80 code (sound) */ + ROM_REGION( 0x10000, "audiocpu", 0 ) // Z80 code ROM_LOAD( "chtaito5.bin", 0x0000, 0x4000, CRC(4e4f3f92) SHA1(57d0485f8a0110f5448b554d2fab1caba52551fd) ) ROM_LOAD( "chtaito6.bin", 0x4000, 0x2000, CRC(8c0e43d1) SHA1(acaead801b4782875c8b6092e987b73f9973f8b0) ) - ROM_REGION( 0x4000, "gfx1", ROMREGION_INVERT ) /* tiles */ + ROM_REGION( 0x4000, "tiles", ROMREGION_INVERT ) ROM_LOAD( "chtaito11.bin", 0x0000, 0x2000, CRC(3a37fb45) SHA1(4c631cf924f1e1dfea6db3f014ab7d9cb9f4b0c4) ) ROM_LOAD( "chtaito12.bin", 0x2000, 0x2000, CRC(bc21c002) SHA1(4fc5e4dfe8331a3feb1c370a8aca9c8303eb7b4e) ) - ROM_REGION( 0x6000, "gfx2", ROMREGION_INVERT ) /* sprites */ + ROM_REGION( 0x6000, "sprites", ROMREGION_INVERT ) ROM_LOAD( "chtaito18.bin", 0x0000, 0x2000, CRC(fc4183a8) SHA1(4bc891a9e16cd84ce353180705cc8fcadf414a49) ) ROM_LOAD( "chtaito17.bin", 0x2000, 0x2000, CRC(d713d7fe) SHA1(8dd97f96a1190c5be5e19721227dd80adf060b4d) ) ROM_LOAD( "chtaito13.bin", 0x4000, 0x2000, CRC(a8e2a3f4) SHA1(db9f954d4b46660f5f1cb4122838e6418f92d0a3) ) - ROM_REGION( 0x6000, "gfx3", ROMREGION_INVERT ) /* sprites */ + ROM_REGION( 0x6000, "sprites_2", ROMREGION_INVERT ) ROM_LOAD( "chtaito16.bin", 0x0000, 0x2000, CRC(dd5170ca) SHA1(e0a9d1dbc021a8ad84dd7d1bd7e390e51e6328b7) ) ROM_LOAD( "chtaito15.bin", 0x2000, 0x2000, CRC(20f6052e) SHA1(e22ddb3fb90ff8df5ce7fda6a26c1b9fce2f59ab) ) ROM_LOAD( "chtaito14.bin", 0x4000, 0x2000, CRC(9bc2d568) SHA1(a4ee8822709645b0dc088635c0a9c263fb5a2245) ) - /* these were not dumped from this pcb */ + // these were not dumped from this pcb ROM_REGION( 0xa80, "proms", 0 ) - ROM_LOAD( "v_ic36_r", 0x000, 0x100, CRC(16ae1692) SHA1(e287b96890da4815350af72e9f2189d0c72313b6) ) /* red */ - ROM_LOAD( "v_ic35_g", 0x100, 0x100, CRC(b3d0a074) SHA1(e955fda8cb8df389507e17b7b4609e845e5ef0c4) ) /* green */ - ROM_LOAD( "v_ic27_b", 0x200, 0x100, CRC(353a2d11) SHA1(76f21e3e092024592d9ccd33ae69c438254c5755) ) /* blue */ + ROM_LOAD( "v_ic36_r", 0x000, 0x100, CRC(16ae1692) SHA1(e287b96890da4815350af72e9f2189d0c72313b6) ) // red + ROM_LOAD( "v_ic35_g", 0x100, 0x100, CRC(b3d0a074) SHA1(e955fda8cb8df389507e17b7b4609e845e5ef0c4) ) // green + ROM_LOAD( "v_ic27_b", 0x200, 0x100, CRC(353a2d11) SHA1(76f21e3e092024592d9ccd33ae69c438254c5755) ) // blue - ROM_LOAD( "v_ic28_m", 0x300, 0x100, CRC(7ca273c1) SHA1(20d85547d96bea8b310c943c45e4978a7e5b5585) ) /* unknown */ - ROM_LOAD( "v_ic69", 0x400, 0x200, CRC(410d6f86) SHA1(3cfaef3702dbda3e7c7eb84a93561e36778aec3e) ) /* zoom */ - ROM_LOAD( "v_ic108", 0x600, 0x200, CRC(d33c02ae) SHA1(1a2146ae404a5e8a701e1d547a8409a376d4bee4) ) /* zoom */ + ROM_LOAD( "v_ic28_m", 0x300, 0x100, CRC(7ca273c1) SHA1(20d85547d96bea8b310c943c45e4978a7e5b5585) ) // unknown + ROM_LOAD( "v_ic69", 0x400, 0x200, CRC(410d6f86) SHA1(3cfaef3702dbda3e7c7eb84a93561e36778aec3e) ) // zoom + ROM_LOAD( "v_ic108", 0x600, 0x200, CRC(d33c02ae) SHA1(1a2146ae404a5e8a701e1d547a8409a376d4bee4) ) // zoom - ROM_LOAD( "v_ic12", 0x800, 0x100, CRC(0de07e89) SHA1(5655bce6ff3abad63f5b31add402cdbb51c323f0) ) /* tile pen priority */ - ROM_LOAD( "v_ic15_p", 0x900, 0x100, CRC(7e0a0581) SHA1(e355a6ef21a65a1e828d7bd5b0f2224b06438b4a) ) /* sprite pen transparency */ + ROM_LOAD( "v_ic12", 0x800, 0x100, CRC(0de07e89) SHA1(5655bce6ff3abad63f5b31add402cdbb51c323f0) ) // tile pen priority + ROM_LOAD( "v_ic15_p", 0x900, 0x100, CRC(7e0a0581) SHA1(e355a6ef21a65a1e828d7bd5b0f2224b06438b4a) ) // sprite pen transparency ROM_LOAD( "v_ic8", 0xa00, 0x020, CRC(4c62974d) SHA1(fd5970b5ba1d9e986515ae06c2e83f8bf20b3cdc) ) - ROM_LOAD( "ic8", 0xa20, 0x020, CRC(84bcd9af) SHA1(5a5afeb6aedb8ac6ac49fb8da62df57fbd8b1780) ) /* main CPU banking */ - ROM_LOAD( "ic22", 0xa40, 0x020, CRC(84bcd9af) SHA1(5a5afeb6aedb8ac6ac49fb8da62df57fbd8b1780) ) /* coprocessor banking */ - ROM_LOAD( "ic42", 0xa60, 0x020, CRC(2ccfe10a) SHA1(d89ea91e5da436805fca9ded9b33609f4a862724) ) /* sound cpu banking */ + ROM_LOAD( "ic8", 0xa20, 0x020, CRC(84bcd9af) SHA1(5a5afeb6aedb8ac6ac49fb8da62df57fbd8b1780) ) // main CPU banking + ROM_LOAD( "ic22", 0xa40, 0x020, CRC(84bcd9af) SHA1(5a5afeb6aedb8ac6ac49fb8da62df57fbd8b1780) ) // coprocessor banking + ROM_LOAD( "ic42", 0xa60, 0x020, CRC(2ccfe10a) SHA1(d89ea91e5da436805fca9ded9b33609f4a862724) ) // sound cpu banking ROM_END ROM_START( shangkid ) - /* Main CPU - handles game logic */ - ROM_REGION( 0x12000, "maincpu", 0 ) /* Z80 (NEC D780C-1) code */ + // Main CPU - handles game logic + ROM_REGION( 0x12000, "maincpu", 0 ) // Z80 (NEC D780C-1) code ROM_LOAD( "cr00ic02.bin", 0x00000, 0x4000, CRC(2e420377) SHA1(73eb916b1693ffab8049ea0d8d3503629fa27948) ) ROM_LOAD( "cr01ic03.bin", 0x04000, 0x4000, CRC(161cd358) SHA1(2cc1c30b3d3215ddc7c7f96a3358ed50e0f850e3) ) - ROM_LOAD( "cr02ic04.bin", 0x08000, 0x2000, CRC(85b6e455) SHA1(3b2cd1e55355d24c014c5afe0212c6c9f0899a28) ) /* banked at 0x8000 */ - ROM_LOAD( "cr03ic05.bin", 0x10000, 0x2000, CRC(3b383863) SHA1(3fb10a7f89cf2387d70b0337916063fd4ec5f754) ) /* banked at 0x8000 */ + ROM_LOAD( "cr02ic04.bin", 0x08000, 0x2000, CRC(85b6e455) SHA1(3b2cd1e55355d24c014c5afe0212c6c9f0899a28) ) // banked at 0x8000 + ROM_LOAD( "cr03ic05.bin", 0x10000, 0x2000, CRC(3b383863) SHA1(3fb10a7f89cf2387d70b0337916063fd4ec5f754) ) // banked at 0x8000 /* The BBX coprocessor is buried in an epoxy block. It contains: ** - a surface-mounted Z80 (TMPZ84C00P) @@ -907,14 +892,14 @@ ROM_START( shangkid ) ** responsible for populating spriteram, and forwards appropriate sound ** commands to the sample-playing CPU. */ - ROM_REGION( 0x10000, "bbx", 0 ) /* Z80: bbx module */ - ROM_LOAD( "bbx.bin", 0x0000, 0x2000, CRC(560c0abd) SHA1(165beadd55bc29195cc680825f71f3f7f60fa0f6) ) /* battery-backed RAM */ + ROM_REGION( 0x10000, "bbx", 0 ) // Z80: bbx module + ROM_LOAD( "bbx.bin", 0x0000, 0x2000, CRC(560c0abd) SHA1(165beadd55bc29195cc680825f71f3f7f60fa0f6) ) // battery-backed RAM ROM_LOAD( "cr04ic31.bin", 0x2000, 0x2000, CRC(cb207885) SHA1(b73458c959a4ebceb4c88931f8e3d1aff01dbaff) ) ROM_LOAD( "cr05ic32.bin", 0x4000, 0x4000, CRC(cf3b8d55) SHA1(c2e196e2762dd7884f461fc2be37698b9ed1deef) ) ROM_LOAD( "cr06ic33.bin", 0x8000, 0x2000, CRC(0f3bdbd8) SHA1(2e0e81425e4e5592d3e2c8395075720c2ad3f79a) ) - /* The Sound CPU is a dedicated Sample Player */ - ROM_REGION( 0x1e000, "audiocpu", 0 ) /* Z80 (NEC D780C-1) */ + // The Sound CPU is a dedicated Sample Player + ROM_REGION( 0x1e000, "audiocpu", 0 ) // Z80 (NEC D780C-1) ROM_LOAD( "cr11ic51.bin", 0x00000, 0x4000, CRC(2e2d6afe) SHA1(1414a06b6cf14dfd69ca6cf35e4eb7d75af3f219) ) ROM_LOAD( "cr12ic43.bin", 0x04000, 0x4000, CRC(dd29a0c8) SHA1(8411c31fefdce8c9233fe531b5bf3b6c43c03cba) ) ROM_LOAD( "cr13ic44.bin", 0x08000, 0x4000, CRC(879d0de0) SHA1(b1422cf239381ac949867c42ca8101fa8dcac9d6) ) @@ -923,11 +908,11 @@ ROM_START( shangkid ) ROM_LOAD( "cr09ic49.bin", 0x18000, 0x4000, CRC(d50c96a8) SHA1(7fcf798b49b0827349366475dbbca1554df25cc4) ) ROM_LOAD( "cr10ic50.bin", 0x1c000, 0x2000, CRC(873a5f2d) SHA1(32f806da319807bef68b5e810815ef2aba6ea0a7) ) - ROM_REGION( 0x4000, "gfx1", ROMREGION_INVERT ) /* 8x8 tiles */ + ROM_REGION( 0x4000, "tiles", ROMREGION_INVERT ) // 8x8 ROM_LOAD( "cr20ic21.bin", 0x0000, 0x2000, CRC(eb3cbb11) SHA1(8d36d6f328263eb0b956c0bd752d2cac84795c1a) ) ROM_LOAD( "cr21ic22.bin", 0x2000, 0x2000, CRC(7c6e75f4) SHA1(2a4a7971777136a476b8ca0b888e65a31a032a9e) ) - ROM_REGION( 0x18000, "gfx2", ROMREGION_INVERT ) /* 16x16 sprites */ + ROM_REGION( 0x18000, "sprites", ROMREGION_INVERT ) // 16x16 sprites ROM_LOAD( "cr14i114.bin", 0x00000, 0x4000, CRC(ee1f348f) SHA1(7bfcdf645a2f406130444bb7b641a91351761c83) ) ROM_LOAD( "cr15i113.bin", 0x04000, 0x4000, CRC(a46398bd) SHA1(2f968eb95f3406110b4b503fe4da735bb64b548b) ) ROM_LOAD( "cr16i112.bin", 0x08000, 0x4000, CRC(cbed446c) SHA1(cc36ab32b42f6ec8ce574f040f7fb034b1351467) ) @@ -936,30 +921,30 @@ ROM_START( shangkid ) ROM_LOAD( "cr19i100.bin", 0x14000, 0x4000, CRC(f948f829) SHA1(c4305d4a04213af39413e1575eaee3905344c788) ) ROM_REGION( 0xa80, "proms", 0 ) - ROM_LOAD( "cr31ic36.bin", 0x000, 0x100, CRC(9439590b) SHA1(cd07526d6373358bae6bfce8dbcab7d44472041f) ) /* 82S129 - red */ - ROM_LOAD( "cr30ic35.bin", 0x100, 0x100, CRC(324e295e) SHA1(9076e3da2edc8889bd635191e7687676b6fb4cec) ) /* 82S129 - green */ - ROM_LOAD( "cr28ic27.bin", 0x200, 0x100, CRC(375cba96) SHA1(fd3ba36588147a3252b800f1f86b2897e9605b8d) ) /* 82S129 - blue */ + ROM_LOAD( "cr31ic36.bin", 0x000, 0x100, CRC(9439590b) SHA1(cd07526d6373358bae6bfce8dbcab7d44472041f) ) // 82S129 - red + ROM_LOAD( "cr30ic35.bin", 0x100, 0x100, CRC(324e295e) SHA1(9076e3da2edc8889bd635191e7687676b6fb4cec) ) // 82S129 - green + ROM_LOAD( "cr28ic27.bin", 0x200, 0x100, CRC(375cba96) SHA1(fd3ba36588147a3252b800f1f86b2897e9605b8d) ) // 82S129 - blue - ROM_LOAD( "cr29ic28.bin", 0x300, 0x100, CRC(7ca273c1) SHA1(20d85547d96bea8b310c943c45e4978a7e5b5585) ) /* 82S129 - unknown */ - ROM_LOAD( "cr32ic69.bin", 0x400, 0x200, CRC(410d6f86) SHA1(3cfaef3702dbda3e7c7eb84a93561e36778aec3e) ) /* 82S147 - sprite-related (zoom?) */ - ROM_LOAD( "cr33-108.bin", 0x600, 0x200, CRC(d33c02ae) SHA1(1a2146ae404a5e8a701e1d547a8409a376d4bee4) ) /* 82S147 - sprite-related (zoom?) */ + ROM_LOAD( "cr29ic28.bin", 0x300, 0x100, CRC(7ca273c1) SHA1(20d85547d96bea8b310c943c45e4978a7e5b5585) ) // 82S129 - unknown + ROM_LOAD( "cr32ic69.bin", 0x400, 0x200, CRC(410d6f86) SHA1(3cfaef3702dbda3e7c7eb84a93561e36778aec3e) ) // 82S147 - sprite-related (zoom?) + ROM_LOAD( "cr33-108.bin", 0x600, 0x200, CRC(d33c02ae) SHA1(1a2146ae404a5e8a701e1d547a8409a376d4bee4) ) // 82S147 - sprite-related (zoom?) - ROM_LOAD( "cr26ic12.bin", 0x800, 0x100, CRC(85b5e958) SHA1(f211b5122fccf84e4aa1556c0290b5cb83935386) ) /* 82S129 - tile pen priority? */ - ROM_LOAD( "cr27ic15.bin", 0x900, 0x100, CRC(f7a19fe2) SHA1(d88e0743aa858b132f636fcd5d493ccb1af82224) ) /* 82S129 - sprite pen transparency */ + ROM_LOAD( "cr26ic12.bin", 0x800, 0x100, CRC(85b5e958) SHA1(f211b5122fccf84e4aa1556c0290b5cb83935386) ) // 82S129 - tile pen priority? + ROM_LOAD( "cr27ic15.bin", 0x900, 0x100, CRC(f7a19fe2) SHA1(d88e0743aa858b132f636fcd5d493ccb1af82224) ) // 82S129 - sprite pen transparency - ROM_LOAD( "cr25ic8.bin", 0xa00, 0x020, CRC(c85e09ad) SHA1(f42e3840ec0e4720067eda7c536b6dcc540e63ff) ) /* 82S123 */ - ROM_LOAD( "cr22ic8.bin", 0xa20, 0x020, CRC(1a7e0b06) SHA1(648d58a4ad14f4b242e492cf302d6678d899cf4f) ) /* 82S123 - main CPU banking */ - ROM_LOAD( "cr23ic22.bin", 0xa40, 0x020, CRC(efb5f265) SHA1(3de15e03cb12956d34074abb48236537f2b47dba) ) /* 82S123 - coprocessor banking */ - ROM_LOAD( "cr24ic42.bin", 0xa60, 0x020, CRC(823878aa) SHA1(eb5026270890e5af9193e354b7e814f32238a9bf) ) /* 82S123 - sample player banking */ + ROM_LOAD( "cr25ic8.bin", 0xa00, 0x020, CRC(c85e09ad) SHA1(f42e3840ec0e4720067eda7c536b6dcc540e63ff) ) // 82S123 + ROM_LOAD( "cr22ic8.bin", 0xa20, 0x020, CRC(1a7e0b06) SHA1(648d58a4ad14f4b242e492cf302d6678d899cf4f) ) // 82S123 - main CPU banking + ROM_LOAD( "cr23ic22.bin", 0xa40, 0x020, CRC(efb5f265) SHA1(3de15e03cb12956d34074abb48236537f2b47dba) ) // 82S123 - coprocessor banking + ROM_LOAD( "cr24ic42.bin", 0xa60, 0x020, CRC(823878aa) SHA1(eb5026270890e5af9193e354b7e814f32238a9bf) ) // 82S123 - sample player banking ROM_END ROM_START( hiryuken ) - /* Main CPU - handles game logic */ - ROM_REGION( 0x12000, "maincpu", 0 ) /* Z80 (NEC D780C-1) code */ + // Main CPU - handles game logic + ROM_REGION( 0x12000, "maincpu", 0 ) // Z80 (NEC D780C-1) code ROM_LOAD( "1.2", 0x00000, 0x4000, CRC(c7af7f2e) SHA1(b035a4230e10bcf0891e41423a51fb6169087b8e) ) ROM_LOAD( "2.3", 0x04000, 0x4000, CRC(639afdb3) SHA1(50bd1deffb66049f101faceb108ee95eb3fe8ae6) ) - ROM_LOAD( "3.4", 0x08000, 0x2000, CRC(ad210482) SHA1(9a32bbaf601d3b00f0a79ce90bb9a32e8e608977) ) /* banked at 0x8000 */ - ROM_LOAD( "4.5", 0x10000, 0x2000, CRC(6518943a) SHA1(b5e78267d5a58c466c9ae20ba4f9c5e14e252287) ) /* banked at 0x8000 */ + ROM_LOAD( "3.4", 0x08000, 0x2000, CRC(ad210482) SHA1(9a32bbaf601d3b00f0a79ce90bb9a32e8e608977) ) // banked at 0x8000 + ROM_LOAD( "4.5", 0x10000, 0x2000, CRC(6518943a) SHA1(b5e78267d5a58c466c9ae20ba4f9c5e14e252287) ) // banked at 0x8000 /* The BBX coprocessor is buried in an epoxy block. It contains: ** - a surface-mounted Z80 (TMPZ84C00P) @@ -971,14 +956,14 @@ ROM_START( hiryuken ) ** responsible for populating spriteram, and forwards appropriate sound ** commands to the sample-playing CPU. */ - ROM_REGION( 0x10000, "bbx", 0 ) /* Z80: bbx module */ - ROM_LOAD( "bbxj.bin", 0x0000, 0x2000, CRC(8def4aaf) SHA1(bfb9b2874294499c1026f2a4cd20f9cd0efd30f9) ) /* battery-backed RAM */ + ROM_REGION( 0x10000, "bbx", 0 ) // Z80: bbx module + ROM_LOAD( "bbxj.bin", 0x0000, 0x2000, CRC(8def4aaf) SHA1(bfb9b2874294499c1026f2a4cd20f9cd0efd30f9) ) // battery-backed RAM ROM_LOAD( "5.31", 0x2000, 0x2000, CRC(8ae37ce7) SHA1(6299b0cd4e7348d4599126d61192924f19ae5401) ) ROM_LOAD( "6.32", 0x4000, 0x4000, CRC(e835bb7f) SHA1(4ed8033994fe6ca268e20e30382dbe61eb8d2cf6) ) ROM_LOAD( "7.33", 0x8000, 0x2000, CRC(3745ed36) SHA1(29a462a7d6e994cd2a917ce0b79fe342cfcc2417) ) - /* The Sound CPU is a dedicated Sample Player */ - ROM_REGION( 0x1e000, "audiocpu", 0 ) /* Z80 (NEC D780C-1) */ + // The Sound CPU is a dedicated Sample Player + ROM_REGION( 0x1e000, "audiocpu", 0 ) // Z80 (NEC D780C-1) ROM_LOAD( "cr11ic51.bin", 0x00000, 0x4000, CRC(2e2d6afe) SHA1(1414a06b6cf14dfd69ca6cf35e4eb7d75af3f219) ) // 12.51 // ROM_LOAD( "cr12ic43.bin", 0x04000, 0x4000, CRC(dd29a0c8) SHA1(8411c31fefdce8c9233fe531b5bf3b6c43c03cba) ) // not present in this set // ROM_LOAD( "cr13ic44.bin", 0x08000, 0x4000, CRC(879d0de0) SHA1(b1422cf239381ac949867c42ca8101fa8dcac9d6) ) // not present in this set @@ -987,11 +972,11 @@ ROM_START( hiryuken ) ROM_LOAD( "10.49", 0x18000, 0x4000, CRC(52b82fee) SHA1(99a2952af6493586745463c33b11ab69251af063) ) ROM_LOAD( "cr10ic50.bin", 0x1c000, 0x2000, CRC(873a5f2d) SHA1(32f806da319807bef68b5e810815ef2aba6ea0a7) ) // 11.50 - ROM_REGION( 0x4000, "gfx1", ROMREGION_INVERT ) /* 8x8 tiles */ + ROM_REGION( 0x4000, "tiles", ROMREGION_INVERT ) // 8x8 ROM_LOAD( "21.21", 0x0000, 0x2000, CRC(ce20a1d4) SHA1(4d5708a1b8b3ac81afeebd82eb6a3d9763ef3d39) ) ROM_LOAD( "22.22", 0x2000, 0x2000, CRC(26fc88bf) SHA1(663c88510b4df8153b10d1b0cc20b332aab5ca2e) ) - ROM_REGION( 0x18000, "gfx2", ROMREGION_INVERT ) /* 16x16 sprites */ + ROM_REGION( 0x18000, "sprites", ROMREGION_INVERT ) // 16x16 ROM_LOAD( "15.114", 0x00000, 0x4000, CRC(ed07854e) SHA1(caebd227c458717a5fc58daa6e774b1a09e68d34) ) ROM_LOAD( "16.113", 0x04000, 0x4000, CRC(85cf1939) SHA1(8bf410a91aba40b0336e3c6c5b2c2b353aeea420) ) ROM_LOAD( "cr16i112.bin", 0x08000, 0x4000, CRC(cbed446c) SHA1(cc36ab32b42f6ec8ce574f040f7fb034b1351467) ) // 17.112 @@ -1000,26 +985,26 @@ ROM_START( hiryuken ) ROM_LOAD( "20.100", 0x14000, 0x4000, CRC(4bc77ca0) SHA1(22a057c3c29ff9feb0afab0cb76b37c4a1363cb1) ) ROM_REGION( 0xa80, "proms", 0 ) - ROM_LOAD( "r.36", 0x000, 0x100, CRC(65dec63d) SHA1(b481151687311f8d732f8c313f8af183a53dbc2f) ) /* 82S129 - red */ - ROM_LOAD( "g.35", 0x100, 0x100, CRC(e79de8cf) SHA1(65cc626c91830eafbf5a7e4ce7571cbb0ada91c1) ) /* 82S129 - green */ - ROM_LOAD( "b.27", 0x200, 0x100, CRC(d6ab3448) SHA1(efb879e7c5dd50ea70fb5ed5e4d3b87ab2c1b8b9) ) /* 82S129 - blue */ + ROM_LOAD( "r.36", 0x000, 0x100, CRC(65dec63d) SHA1(b481151687311f8d732f8c313f8af183a53dbc2f) ) // 82S129 - red + ROM_LOAD( "g.35", 0x100, 0x100, CRC(e79de8cf) SHA1(65cc626c91830eafbf5a7e4ce7571cbb0ada91c1) ) // 82S129 - green + ROM_LOAD( "b.27", 0x200, 0x100, CRC(d6ab3448) SHA1(efb879e7c5dd50ea70fb5ed5e4d3b87ab2c1b8b9) ) // 82S129 - blue - ROM_LOAD( "cr29ic28.bin", 0x300, 0x100, CRC(7ca273c1) SHA1(20d85547d96bea8b310c943c45e4978a7e5b5585) ) /* 82S129 - unknown */ // m.28 - ROM_LOAD( "cr32ic69.bin", 0x400, 0x200, CRC(410d6f86) SHA1(3cfaef3702dbda3e7c7eb84a93561e36778aec3e) ) /* 82S147 - sprite-related (zoom?) */ // ic69 - ROM_LOAD( "cr33-108.bin", 0x600, 0x200, CRC(d33c02ae) SHA1(1a2146ae404a5e8a701e1d547a8409a376d4bee4) ) /* 82S147 - sprite-related (zoom?) */ // ic108 + ROM_LOAD( "cr29ic28.bin", 0x300, 0x100, CRC(7ca273c1) SHA1(20d85547d96bea8b310c943c45e4978a7e5b5585) ) // 82S129 - unknown // m.28 + ROM_LOAD( "cr32ic69.bin", 0x400, 0x200, CRC(410d6f86) SHA1(3cfaef3702dbda3e7c7eb84a93561e36778aec3e) ) // 82S147 - sprite-related (zoom?) // ic69 + ROM_LOAD( "cr33-108.bin", 0x600, 0x200, CRC(d33c02ae) SHA1(1a2146ae404a5e8a701e1d547a8409a376d4bee4) ) // 82S147 - sprite-related (zoom?) // ic108 - ROM_LOAD( "cr26ic12.bin", 0x800, 0x100, CRC(85b5e958) SHA1(f211b5122fccf84e4aa1556c0290b5cb83935386) ) /* 82S129 - tile pen priority? */ // sc.12 - ROM_LOAD( "cr27ic15.bin", 0x900, 0x100, CRC(f7a19fe2) SHA1(d88e0743aa858b132f636fcd5d493ccb1af82224) ) /* 82S129 - sprite pen transparency */ // sp.15 + ROM_LOAD( "cr26ic12.bin", 0x800, 0x100, CRC(85b5e958) SHA1(f211b5122fccf84e4aa1556c0290b5cb83935386) ) // 82S129 - tile pen priority? // sc.12 + ROM_LOAD( "cr27ic15.bin", 0x900, 0x100, CRC(f7a19fe2) SHA1(d88e0743aa858b132f636fcd5d493ccb1af82224) ) // 82S129 - sprite pen transparency // sp.15 - ROM_LOAD( "cr25ic8.bin", 0xa00, 0x020, CRC(c85e09ad) SHA1(f42e3840ec0e4720067eda7c536b6dcc540e63ff) ) /* 82S123 */ // a.8 - ROM_LOAD( "cr22ic8.bin", 0xa20, 0x020, CRC(1a7e0b06) SHA1(648d58a4ad14f4b242e492cf302d6678d899cf4f) ) /* 82S123 - main CPU banking */ // 1.8 - ROM_LOAD( "cr23ic22.bin", 0xa40, 0x020, CRC(efb5f265) SHA1(3de15e03cb12956d34074abb48236537f2b47dba) ) /* 82S123 - coprocessor banking */ // 2.22 - ROM_LOAD( "cr24ic42.bin", 0xa60, 0x020, CRC(823878aa) SHA1(eb5026270890e5af9193e354b7e814f32238a9bf) ) /* 82S123 - sample player banking */ // 3.42 + ROM_LOAD( "cr25ic8.bin", 0xa00, 0x020, CRC(c85e09ad) SHA1(f42e3840ec0e4720067eda7c536b6dcc540e63ff) ) // 82S123 // a.8 + ROM_LOAD( "cr22ic8.bin", 0xa20, 0x020, CRC(1a7e0b06) SHA1(648d58a4ad14f4b242e492cf302d6678d899cf4f) ) // 82S123 - main CPU banking // 1.8 + ROM_LOAD( "cr23ic22.bin", 0xa40, 0x020, CRC(efb5f265) SHA1(3de15e03cb12956d34074abb48236537f2b47dba) ) // 82S123 - coprocessor banking // 2.22 + ROM_LOAD( "cr24ic42.bin", 0xa60, 0x020, CRC(823878aa) SHA1(eb5026270890e5af9193e354b7e814f32238a9bf) ) // 82S123 - sample player banking // 3.42 ROM_END ROM_START( dynamski ) - ROM_REGION( 0x12000, "maincpu", 0 ) /* Z80 code */ - ROM_LOAD( "dynski.1", 0x00000, 0x1000, CRC(30191160) SHA1(5ffa3355f53e4be65bd96101088d2d7b66490141) ) /* code */ + ROM_REGION( 0x12000, "maincpu", 0 ) // Z80 code + ROM_LOAD( "dynski.1", 0x00000, 0x1000, CRC(30191160) SHA1(5ffa3355f53e4be65bd96101088d2d7b66490141) ) // code ROM_LOAD( "dynski.2", 0x01000, 0x1000, CRC(5e08a0b0) SHA1(89398752e8ea1ffd8ec8392f5c8e20f25cf8fdfb) ) ROM_LOAD( "dynski.3", 0x02000, 0x1000, CRC(29cfd740) SHA1(a5d6b7b59e631f387788f29e8f029eaf00d1ea3f) ) ROM_LOAD( "dynski.4", 0x03000, 0x1000, CRC(e1d47776) SHA1(d08985a5b523706bc2b3e090373a72b781116a80) ) @@ -1028,27 +1013,27 @@ ROM_START( dynamski ) ROM_LOAD( "dynski.7", 0x06000, 0x1000, CRC(b88d328b) SHA1(5229fcb0ed1067770fcd47bec674a6fd7b999484) ) ROM_LOAD( "dynski.8", 0x07000, 0x1000, CRC(8db5e691) SHA1(ccacfb7cd30f03de95690bbd32ab46e39d084244) ) - ROM_REGION( 0x4000, "gfx1", ROMREGION_INVERT ) /* 8x8 tiles */ + ROM_REGION( 0x4000, "tiles", ROMREGION_INVERT ) // 8x8 tiles ROM_LOAD( "dynski8.3e", 0x0000, 0x2000, CRC(32c354dc) SHA1(6f73c9fc3802ec5f349a6088d7eaee5876c901de) ) ROM_LOAD( "dynski9.2e", 0x2000, 0x2000, CRC(80a6290c) SHA1(3a1581451802bf2e822fba1084800e6de9bd0f7a) ) - ROM_REGION( 0x6000, "gfx2", ROMREGION_INVERT ) /* 16x16 sprites */ + ROM_REGION( 0x6000, "sprites", ROMREGION_INVERT ) // 16x16 sprites ROM_LOAD( "dynski5.14b", 0x0000, 0x2000, CRC(aa4ac6e2) SHA1(b6f7cb7310be2a12ca17dfd0ee3526e0522eb85b) ) ROM_LOAD( "dynski6.15b", 0x2000, 0x2000, CRC(47e76886) SHA1(c42bd3d973cf17ec265852527085085bcc674b18) ) ROM_LOAD( "dynski7.14d", 0x4000, 0x2000, CRC(a153dfa9) SHA1(c81dbdce2e11e9d6d8465f400a048d7688745232) ) ROM_REGION( 0x240, "proms", 0 ) - ROM_LOAD( "dynskic.15g", 0x000, 0x020, CRC(9333a5e4) SHA1(11025f53c98c2ae21e9d4f95da86bba4703a52bc) ) /* palette */ - ROM_LOAD( "dynskic.15f", 0x020, 0x020, CRC(3869514b) SHA1(1ef062284e52777ec6e269368a16b9b357a2647a) ) /* palette */ - ROM_LOAD( "dynski.4g", 0x040, 0x100, CRC(761fe465) SHA1(87741a6e4d14440073aaed3a8a15bc5e30b8fcfc) ) /* lookup table */ - ROM_LOAD( "dynski.11e", 0x140, 0x100, CRC(e625aa09) SHA1(c10371f1adf7245815c0bdcb24458c7b04edd5b9) ) /* lookup table */ + ROM_LOAD( "dynskic.15g", 0x000, 0x020, CRC(9333a5e4) SHA1(11025f53c98c2ae21e9d4f95da86bba4703a52bc) ) // palette + ROM_LOAD( "dynskic.15f", 0x020, 0x020, CRC(3869514b) SHA1(1ef062284e52777ec6e269368a16b9b357a2647a) ) // palette + ROM_LOAD( "dynski.4g", 0x040, 0x100, CRC(761fe465) SHA1(87741a6e4d14440073aaed3a8a15bc5e30b8fcfc) ) // lookup table + ROM_LOAD( "dynski.11e", 0x140, 0x100, CRC(e625aa09) SHA1(c10371f1adf7245815c0bdcb24458c7b04edd5b9) ) // lookup table ROM_END -GAME( 1984, dynamski, 0, dynamski, dynamski, shangkid_state, init_dynamski, ROT90, "Taiyo", "Dynamic Ski", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE ) -GAME( 1984, chinhero, 0, chinhero, chinhero, shangkid_state, init_chinhero, ROT90, "Taiyo", "Chinese Hero", MACHINE_SUPPORTS_SAVE ) // by Nihon Game? -GAME( 1984, chinhero2, chinhero, chinhero, chinhero, shangkid_state, init_chinhero, ROT90, "Taiyo", "Chinese Hero (older, set 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1984, chinhero3, chinhero, chinhero, chinhero, shangkid_state, init_chinhero, ROT90, "Taiyo", "Chinese Hero (older, set 2)", MACHINE_SUPPORTS_SAVE ) -GAME( 1984, chinherot, chinhero, chinhero, chinhero, shangkid_state, init_chinhero, ROT90, "Taiyo (Taito license)", "Chinese Heroe (Taito)", MACHINE_SUPPORTS_SAVE ) -GAME( 1985, shangkid, 0, shangkid, shangkid, shangkid_state, init_shangkid, ROT0, "Taiyo (Data East license)", "Shanghai Kid", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE ) -GAME( 1985, hiryuken, shangkid, shangkid, shangkid, shangkid_state, init_shangkid, ROT0, "Taiyo (Taito license)", "Hokuha Syourin Hiryu no Ken", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE ) +GAME( 1984, dynamski, 0, dynamski, dynamski, dynamski_state, empty_init, ROT90, "Taiyo", "Dynamic Ski", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE ) +GAME( 1984, chinhero, 0, chinhero, chinhero, chinhero_state, empty_init, ROT90, "Taiyo", "Chinese Hero", MACHINE_SUPPORTS_SAVE ) // by Nihon Game? +GAME( 1984, chinhero2, chinhero, chinhero, chinhero, chinhero_state, empty_init, ROT90, "Taiyo", "Chinese Hero (older, set 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, chinhero3, chinhero, chinhero, chinhero, chinhero_state, empty_init, ROT90, "Taiyo", "Chinese Hero (older, set 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, chinherot, chinhero, chinhero, chinhero, chinhero_state, empty_init, ROT90, "Taiyo (Taito license)", "Chinese Heroe (Taito)", MACHINE_SUPPORTS_SAVE ) +GAME( 1985, shangkid, 0, shangkid, shangkid, shangkid_state, empty_init, ROT0, "Taiyo (Data East license)", "Shanghai Kid", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE ) +GAME( 1985, hiryuken, shangkid, shangkid, shangkid, shangkid_state, empty_init, ROT0, "Taiyo (Taito license)", "Hokuha Syourin Hiryu no Ken", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/includes/shangkid.h b/src/mame/includes/shangkid.h index c4f7b50c013..327e75fc8b3 100644 --- a/src/mame/includes/shangkid.h +++ b/src/mame/includes/shangkid.h @@ -9,92 +9,122 @@ #include "emupal.h" #include "tilemap.h" -class shangkid_state : public driver_device +class dynamski_state : public driver_device { public: - shangkid_state(const machine_config &mconfig, device_type type, const char *tag) : + dynamski_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_bbx(*this, "bbx"), - m_aysnd(*this, "aysnd"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"), m_videoram(*this, "videoram"), - m_spriteram(*this, "spriteram"), - m_videoreg(*this, "videoreg") + m_spriteram(*this, "spriteram") { } void dynamski(machine_config &config); - void chinhero(machine_config &config); - void shangkid(machine_config &config); - void init_dynamski(); - void init_shangkid(); - void init_chinhero(); +protected: + virtual void machine_start() override; -private: required_device m_maincpu; - optional_device m_audiocpu; - optional_device m_bbx; - required_device m_aysnd; required_device m_gfxdecode; - required_device m_palette; - required_shared_ptr m_videoram; - optional_shared_ptr m_spriteram; - optional_shared_ptr m_videoreg; + required_shared_ptr m_spriteram; bool m_int_enable[2]; - bool m_nmi_enable[2]; - uint8_t m_sound_latch; + + DECLARE_WRITE_LINE_MEMBER(int_enable_1_w); + DECLARE_WRITE_LINE_MEMBER(irq_1_w); + +private: + void palette(palette_device &palette) const; + + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect, int pri); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprec ); + + void prgmap(address_map &map); + void portmap(address_map &map); +}; + +class chinhero_state : public dynamski_state +{ +public: + chinhero_state(const machine_config &mconfig, device_type type, const char *tag) : + dynamski_state(mconfig, type, tag), + m_audiocpu(*this, "audiocpu"), + m_bbx(*this, "bbx"), + m_aysnd(*this, "aysnd"), + m_videoreg(*this, "videoreg") + { } + + void chinhero(machine_config &config); + +protected: + virtual void machine_start() override; + virtual void video_start() override; + + required_device m_audiocpu; + required_device m_bbx; + required_device m_aysnd; + required_shared_ptr m_videoreg; + int m_gfx_type; + + void nmiq_1_w(uint8_t data); + void nmiq_2_w(uint8_t data); + void videoram_w(offs_t offset, uint8_t data); + +private: + bool m_nmi_enable[2]; tilemap_t *m_background; - // shangkid and chinhero + void ay8910_porta_w(uint8_t data); + DECLARE_WRITE_LINE_MEMBER(sound_enable_w); - DECLARE_WRITE_LINE_MEMBER(int_enable_1_w); DECLARE_WRITE_LINE_MEMBER(int_enable_2_w); DECLARE_WRITE_LINE_MEMBER(nmi_enable_1_w); DECLARE_WRITE_LINE_MEMBER(nmi_enable_2_w); - DECLARE_WRITE_LINE_MEMBER(irq_1_w); DECLARE_WRITE_LINE_MEMBER(irq_2_w); - void nmiq_1_w(uint8_t data); - void nmiq_2_w(uint8_t data); DECLARE_WRITE_LINE_MEMBER(coin_counter_1_w); DECLARE_WRITE_LINE_MEMBER(coin_counter_2_w); - uint8_t soundlatch_r(); - void videoram_w(offs_t offset, uint8_t data); - void ay8910_portb_w(uint8_t data); - - // game specific - void chinhero_ay8910_porta_w(uint8_t data); - void shangkid_ay8910_porta_w(uint8_t data); TILE_GET_INFO_MEMBER(get_bg_tile_info); - DECLARE_VIDEO_START(shangkid); - void dynamski_palette(palette_device &palette) const; - DECLARE_MACHINE_RESET(shangkid); + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_shangkid(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_dynamski(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); void draw_sprite(const uint8_t *source, bitmap_ind16 &bitmap, const rectangle &cliprect); - void shangkid_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); - void dynamski_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect, int pri ); - void dynamski_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ); - - void chinhero_bbx_map(address_map &map); - void chinhero_bbx_portmap(address_map &map); - void chinhero_main_map(address_map &map); - void chinhero_sound_map(address_map &map); - void dynamski_map(address_map &map); - void dynamski_portmap(address_map &map); - void shangkid_bbx_map(address_map &map); - void shangkid_bbx_portmap(address_map &map); - void shangkid_main_map(address_map &map); - void shangkid_sound_map(address_map &map); + + void bbx_map(address_map &map); + void bbx_portmap(address_map &map); + void main_map(address_map &map); + void sound_map(address_map &map); void sound_portmap(address_map &map); }; +class shangkid_state : public chinhero_state +{ +public: + shangkid_state(const machine_config &mconfig, device_type type, const char *tag) : + chinhero_state(mconfig, type, tag), + m_soundbank(*this, "soundbank") + { } + + void shangkid(machine_config &config); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + +private: + required_memory_bank m_soundbank; + + void ay8910_porta_w(uint8_t data); + + void bbx_map(address_map &map); + void bbx_portmap(address_map &map); + void main_map(address_map &map); + void sound_map(address_map &map); +}; + #endif // MAME_INCLUDES_SHANGKID_H diff --git a/src/mame/video/shangkid.cpp b/src/mame/video/shangkid.cpp index 1188e89595a..f498a58cc1f 100644 --- a/src/mame/video/shangkid.cpp +++ b/src/mame/video/shangkid.cpp @@ -1,30 +1,29 @@ // license:BSD-3-Clause // copyright-holders:Phil Stroffolino -/* video/shangkid */ #include "emu.h" #include "includes/shangkid.h" -TILE_GET_INFO_MEMBER(shangkid_state::get_bg_tile_info) +TILE_GET_INFO_MEMBER(chinhero_state::get_bg_tile_info) { - int attributes = m_videoram[tile_index+0x800]; - int tile_number = m_videoram[tile_index]+0x100*(attributes&0x3); + int attributes = m_videoram[tile_index + 0x800]; + int tile_number = m_videoram[tile_index] + 0x100 * (attributes & 0x3); int color; - if( m_gfx_type==1 ) + if (m_gfx_type== 1) { /* Shanghai Kid: ------xx bank -----x-- flipx xxxxx--- color */ - color = attributes>>3; - color = (color&0x03)|((color&0x1c)<<1); + color = attributes >> 3; + color = (color & 0x03) | ((color & 0x1c) << 1); tileinfo.set(0, tile_number, color, - (attributes&0x04)?TILE_FLIPX:0); + (attributes & 0x04) ? TILE_FLIPX : 0); } else { @@ -33,69 +32,64 @@ TILE_GET_INFO_MEMBER(shangkid_state::get_bg_tile_info) -xxxxx-- color x------- flipx? */ - color = (attributes>>2)&0x1f; + color = (attributes >> 2) & 0x1f; tileinfo.set(0, tile_number, color, - (attributes&0x80)?TILE_FLIPX:0); + (attributes & 0x80) ? TILE_FLIPX : 0); } - tileinfo.category = - (memregion( "proms" )->base()[0x800+color*4]==2)?1:0; + tileinfo.category = (memregion( "proms" )->base()[0x800 + color * 4] == 2) ? 1 : 0; } -VIDEO_START_MEMBER(shangkid_state,shangkid) +void chinhero_state::video_start() { - m_background = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(shangkid_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8,8, 64,32); + m_background = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(chinhero_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); } -void shangkid_state::videoram_w(offs_t offset, uint8_t data) +void chinhero_state::videoram_w(offs_t offset, uint8_t data) { m_videoram[offset] = data; - m_background->mark_tile_dirty(offset&0x7ff ); + m_background->mark_tile_dirty(offset & 0x7ff); } -void shangkid_state::draw_sprite(const uint8_t *source, bitmap_ind16 &bitmap, const rectangle &cliprect) +void chinhero_state::draw_sprite(const uint8_t *source, bitmap_ind16 &bitmap, const rectangle &cliprect) { - gfx_element *gfx; int transparent_pen; int bank_index; - int c,r; - int width,height; - int sx,sy; int ypos = 209 - source[0]; - int tile = source[1]&0x3f; - int xflip = (source[1]&0x40)?1:0; - int yflip = (source[1]&0x80)?1:0; - int bank = source[2]&0x3f; - int xsize = (source[2]&0x40)?1:0; - int ysize = (source[2]&0x80)?1:0; - int yscale = source[3]&0x07; /* 0x0 = smallest; 0x7 = biggest */ - int xpos = ((source[4]+source[5]*255)&0x1ff)-23; - int color = source[6]&0x3f; - int xscale = source[7]&0x07; /* 0x0 = smallest; 0x7 = biggest */ - - /* adjust placement for small sprites */ - if( xsize==0 && xflip ) xpos -= 16; - if( ysize==0 && yflip==0 ) ypos += 16; - - if( m_gfx_type == 1 ) + int tile = source[1] & 0x3f; + int xflip = (source[1] & 0x40) ? 1 : 0; + int yflip = (source[1] & 0x80) ? 1 : 0; + int bank = source[2] & 0x3f; + int xsize = (source[2] & 0x40) ? 1 : 0; + int ysize = (source[2] & 0x80) ? 1 : 0; + int yscale = source[3] & 0x07; // 0x0 = smallest; 0x7 = biggest + int xpos = ((source[4] + source[5] * 255) & 0x1ff) - 23; + int color = source[6] & 0x3f; + int xscale = source[7] & 0x07; // 0x0 = smallest; 0x7 = biggest + + // adjust placement for small sprites + if (xsize == 0 && xflip) xpos -= 16; + if (ysize == 0 && yflip == 0) ypos += 16; + + if(m_gfx_type == 1) { - /* Shanghai Kid */ - switch( bank&0x30 ) + // Shanghai Kid + switch (bank & 0x30) { case 0x00: case 0x10: - tile += 0x40*(bank&0xf); + tile += 0x40 * (bank & 0xf); break; case 0x20: - tile += 0x40*((bank&0x3)|0x10); + tile += 0x40 * ((bank & 0x3) | 0x10); break; case 0x30: - tile += 0x40*((bank&0x3)|0x14); + tile += 0x40 * ((bank & 0x3) | 0x14); break; } bank_index = 0; @@ -103,14 +97,14 @@ void shangkid_state::draw_sprite(const uint8_t *source, bitmap_ind16 &bitmap, co } else { - /* Chinese Hero */ + // Chinese Hero color >>= 1; // It's needed in level 7 to hide "bogus" sprites. Is it a sprite disable flag or an end sprite list flag? - if(color == 0) + if (color == 0) return; - switch( bank>>2 ) + switch (bank >> 2) { case 0x0: bank_index = 0; break; case 0x9: bank_index = 1; break; @@ -121,77 +115,76 @@ void shangkid_state::draw_sprite(const uint8_t *source, bitmap_ind16 &bitmap, co break; } - if( bank&0x01 ) tile += 0x40; + if (bank & 0x01) tile += 0x40; transparent_pen = 7; } - gfx = m_gfxdecode->gfx(1+bank_index); + gfx_element *gfx = m_gfxdecode->gfx(1+bank_index); - width = (xscale+1)*2; - height = (yscale+1)*2; + int width = (xscale + 1) * 2; + int height = (yscale + 1) * 2; - /* center zoomed sprites */ - xpos += (16-width)*(xsize+1)/2; - ypos += (16-height)*(ysize+1)/2; + // center zoomed sprites + xpos += (16 - width) * (xsize + 1) / 2; + ypos += (16 - height) * (ysize + 1) / 2; - for( r=0; r<=ysize; r++ ) + for (int r = 0; r <= ysize; r++) { - for( c=0; c<=xsize; c++ ) + for (int c = 0; c <= xsize; c++) { - sx = xpos+(c^xflip)*width; - sy = ypos+(r^yflip)*height; + int sx = xpos + (c ^ xflip) * width; + int sy = ypos + (r ^ yflip) * height; gfx->zoom_transpen( bitmap, cliprect, - tile+c*8+r, + tile + c * 8 + r, color, xflip,yflip, - sx,sy, - (width<<16)/16, (height<<16)/16,transparent_pen ); + sx, sy, + (width << 16) / 16, (height << 16) / 16, transparent_pen); // wrap around y gfx->zoom_transpen( bitmap, cliprect, - tile+c*8+r, + tile + c * 8 + r, color, - xflip,yflip, - sx,sy+256, - (width<<16)/16, (height<<16)/16,transparent_pen ); + xflip, yflip, + sx, sy + 256, + (width << 16) / 16, (height << 16) / 16, transparent_pen); } } } -void shangkid_state::shangkid_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) +void chinhero_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) { - const uint8_t *source, *finish; - - finish = m_spriteram; - source = &m_spriteram[0x200]; - while( source>finish ){ + const uint8_t *finish = m_spriteram; + const uint8_t *source = &m_spriteram[0x200]; + while (source > finish) + { source -= 8; - draw_sprite(source, bitmap,cliprect ); + draw_sprite(source, bitmap,cliprect); } } -uint32_t shangkid_state::screen_update_shangkid(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +uint32_t chinhero_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int flipscreen = m_videoreg[1]&0x80; - m_background->set_flip(flipscreen?(TILEMAP_FLIPX|TILEMAP_FLIPY):0 ); - m_background->set_scrollx(0,m_videoreg[0]-40 ); - m_background->set_scrolly(0,m_videoreg[2]+0x10 ); - - m_background->draw(screen, bitmap, cliprect, 0,0 ); - shangkid_draw_sprites(bitmap,cliprect ); - m_background->draw(screen, bitmap, cliprect, 1,0 ); /* high priority tiles */ + int flipscreen = m_videoreg[1] & 0x80; + m_background->set_flip(flipscreen ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0); + m_background->set_scrollx(0, m_videoreg[0] - 40); + m_background->set_scrolly(0, m_videoreg[2] + 0x10); + + m_background->draw(screen, bitmap, cliprect, 0, 0); + draw_sprites(bitmap,cliprect); + m_background->draw(screen, bitmap, cliprect, 1, 0); // high priority tiles return 0; } -void shangkid_state::dynamski_palette(palette_device &palette) const +void dynamski_state::palette(palette_device &palette) const { const uint8_t *color_prom = memregion("proms")->base(); @@ -223,92 +216,81 @@ void shangkid_state::dynamski_palette(palette_device &palette) const } -void shangkid_state::dynamski_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect, int pri ) +void dynamski_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect, int pri) { - int i; - int sx,sy; - int tile; - int attr; - int temp; - - for( i=0; i<0x400; i++ ) + for (int i = 0; i < 0x400; i++) { - sx = (i%32)*8; - sy = (i/32)*8; + int sx = (i % 32) * 8; + int sy = (i / 32) * 8; + int temp; - if( sy<16 ) + if (sy < 16) { temp = sx; - sx = sy+256+16; + sx = sy + 256 + 16; sy = temp; } - else if( sy>=256-16 ) + else if (sy >= 256 - 16) { temp = sx; - sx = sy-256+16; + sx = sy - 256 + 16; sy = temp; } else { - sx+=16; + sx += 16; } - tile = m_videoram[i]; - attr = m_videoram[i+0x400]; + int tile = m_videoram[i]; + int attr = m_videoram[i + 0x400]; /* x---.---- priority? -xx-.---- bank */ - if( pri==0 || (attr>>7)==pri ) + if (pri == 0 || (attr >> 7) == pri) { - tile += ((attr>>5)&0x3)*256; + tile += ((attr >> 5) & 0x3) * 256; m_gfxdecode->gfx(0)->transpen( bitmap, cliprect, tile, attr & 0x0f, - 0,0,//xflip,yflip, - sx,sy, - pri?3:-1 ); + 0,0,//xflip, yflip, + sx, sy, + pri ? 3 : -1); } } } -void shangkid_state::dynamski_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ) +void dynamski_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) { - int i; - int sx,sy; - int tile; - int bank; - int attr; - int color; - for( i=0x7e; i>=0x00; i-=2 ) + for (int i = 0x7e; i >= 0x00; i -= 2) { - bank = m_spriteram[0xb80+i]; - attr = m_spriteram[0xb81+i]; - tile = m_videoram[0xb80+i]; - color = m_videoram[0xb81+i]; - sy = 240-m_spriteram[0x380+i]; - - sx = m_spriteram[0x381+i]-64+8+16; - if( attr&1 ) sx += 0x100; - - - m_gfxdecode->gfx(1)->transpen( - bitmap, - cliprect, - bank*0x40 + (tile&0x3f), - color, - tile&0x80,tile&0x40, /* flipx,flipy */ - sx,sy,3 ); + int bank = m_spriteram[0xb80 + i]; + int attr = m_spriteram[0xb81 + i]; + int tile = m_videoram[0xb80 + i]; + int color = m_videoram[0xb81 + i]; + int sy = 240 - m_spriteram[0x380 + i]; + + int sx = m_spriteram[0x381 + i] - 64 + 8 + 16; + if (attr & 1) sx += 0x100; + + + m_gfxdecode->gfx(1)->transpen( + bitmap, + cliprect, + bank * 0x40 + (tile & 0x3f), + color, + tile & 0x80, tile & 0x40, // flipx, flipy + sx, sy, 3); } } -uint32_t shangkid_state::screen_update_dynamski(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +uint32_t dynamski_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - dynamski_draw_background(bitmap,cliprect, 0 ); - dynamski_draw_sprites(bitmap,cliprect ); - dynamski_draw_background(bitmap,cliprect, 1 ); + draw_background(bitmap, cliprect, 0); + draw_sprites(bitmap, cliprect); + draw_background(bitmap, cliprect, 1); return 0; } -- cgit v1.2.3