From 2e97343b41c448e18ddbfad6c8c0070271515921 Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Fri, 30 Sep 2022 19:33:57 +0200 Subject: konami/circusc.cpp, konami/ddribble.cpp, konami/divebomb.cpp, konami/rockrage.cpp, konami/rocnrope.cpp, konami/scotrshot.cpp, konami/shaolins.cpp: consolidated drivers in single files, minor cleanups --- src/mame/konami/bladestl.cpp | 15 +- src/mame/konami/circusc.cpp | 487 ++++++++++++++++++++++++++++++----------- src/mame/konami/circusc.h | 91 -------- src/mame/konami/circusc_v.cpp | 211 ------------------ src/mame/konami/ddribble.cpp | 321 ++++++++++++++++++++++++++- src/mame/konami/ddribble.h | 87 -------- src/mame/konami/ddribble_v.cpp | 242 -------------------- src/mame/konami/divebomb.cpp | 342 ++++++++++++++++++++++++++--- src/mame/konami/divebomb.h | 98 --------- src/mame/konami/divebomb_v.cpp | 187 ---------------- src/mame/konami/rockrage.cpp | 364 ++++++++++++++++++++---------- src/mame/konami/rockrage.h | 72 ------ src/mame/konami/rockrage_v.cpp | 81 ------- src/mame/konami/rocnrope.cpp | 221 +++++++++++++++++-- src/mame/konami/rocnrope.h | 63 ------ src/mame/konami/rocnrope_v.cpp | 135 ------------ src/mame/konami/scotrsht.cpp | 329 ++++++++++++++++++++++------ src/mame/konami/scotrsht.h | 69 ------ src/mame/konami/scotrsht_v.cpp | 135 ------------ src/mame/konami/shaolins.cpp | 376 ++++++++++++++++++++++++------- src/mame/konami/shaolins.h | 62 ------ src/mame/konami/shaolins_v.cpp | 175 --------------- src/mame/toaplan/toaplan2.cpp | 4 +- 23 files changed, 1993 insertions(+), 2174 deletions(-) delete mode 100644 src/mame/konami/circusc.h delete mode 100644 src/mame/konami/circusc_v.cpp delete mode 100644 src/mame/konami/ddribble.h delete mode 100644 src/mame/konami/ddribble_v.cpp delete mode 100644 src/mame/konami/divebomb.h delete mode 100644 src/mame/konami/divebomb_v.cpp delete mode 100644 src/mame/konami/rockrage.h delete mode 100644 src/mame/konami/rockrage_v.cpp delete mode 100644 src/mame/konami/rocnrope.h delete mode 100644 src/mame/konami/rocnrope_v.cpp delete mode 100644 src/mame/konami/scotrsht.h delete mode 100644 src/mame/konami/scotrsht_v.cpp delete mode 100644 src/mame/konami/shaolins.h delete mode 100644 src/mame/konami/shaolins_v.cpp diff --git a/src/mame/konami/bladestl.cpp b/src/mame/konami/bladestl.cpp index 2abbf426db2..ebcd86fab08 100644 --- a/src/mame/konami/bladestl.cpp +++ b/src/mame/konami/bladestl.cpp @@ -402,20 +402,9 @@ static const gfx_layout charlayout = 32*8 // every character takes 32 consecutive bytes }; -static const gfx_layout spritelayout = -{ - 8,8, // 8*8 sprites - 0x40000/32, // 8192 sprites - 4, // 4 bpp - { 0, 1, 2, 3 }, // the four bitplanes are packed in one nibble - { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4 }, - { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 }, - 32*8 // every sprite takes 32 consecutive bytes -}; - static GFXDECODE_START( gfx_bladestl ) - GFXDECODE_ENTRY( "tiles", 0, charlayout, 0, 2 ) // colors 00..31 - GFXDECODE_ENTRY( "sprites", 0, spritelayout, 32, 16 ) // colors 32..47 but using lookup table + GFXDECODE_ENTRY( "tiles", 0, charlayout, 0, 2 ) // colors 00..31 + GFXDECODE_ENTRY( "sprites", 0, gfx_8x8x4_packed_msb, 32, 16 ) // colors 32..47 but using lookup table GFXDECODE_END diff --git a/src/mame/konami/circusc.cpp b/src/mame/konami/circusc.cpp index 865a42a9170..2e1b9280703 100644 --- a/src/mame/konami/circusc.cpp +++ b/src/mame/konami/circusc.cpp @@ -1,5 +1,6 @@ // license:BSD-3-Clause -// copyright-holders:Nicola Salmoria,Chris Hardy, Couriersud +// copyright-holders: Nicola Salmoria, Chris Hardy, Couriersud + /*************************************************************************** Circus Charlie GX380 (c) 1984 Konami @@ -52,19 +53,288 @@ This bug is due to 380_r02.6h, it differs from 380_q02.6h by 2 bytes, at ***************************************************************************/ #include "emu.h" -#include "circusc.h" -#include "cpu/z80/z80.h" +#include "konami1.h" + #include "cpu/m6809/m6809.h" +#include "cpu/z80/z80.h" #include "machine/74259.h" #include "machine/gen_latch.h" -#include "konami1.h" #include "machine/watchdog.h" +#include "sound/dac.h" #include "sound/discrete.h" +#include "sound/sn76496.h" +#include "video/resnet.h" +#include "emupal.h" #include "screen.h" #include "speaker.h" +#include "tilemap.h" + + +namespace { + +class circusc_state : public driver_device +{ +public: + circusc_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_scroll(*this, "scroll"), + m_colorram(*this, "colorram"), + m_videoram(*this, "videoram"), + m_spriteram(*this, "spriteram%u", 1U), + m_maincpu(*this, "maincpu"), + m_audiocpu(*this, "audiocpu"), + m_sn(*this, "sn%u", 1U), + m_dac(*this, "dac"), + m_discrete(*this, "fltdisc"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette") + { } + + void circusc(machine_config &config); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + +private: + // memory pointers + required_shared_ptr m_scroll; + required_shared_ptr m_colorram; + required_shared_ptr m_videoram; + required_shared_ptr_array m_spriteram; + + // video-related + tilemap_t *m_bg_tilemap = nullptr; + bool m_spritebank = false; + + // sound-related + uint8_t m_sn_latch = 0U; + + // devices + required_device m_maincpu; + required_device m_audiocpu; + required_device_array m_sn; + required_device m_dac; + required_device m_discrete; + required_device m_gfxdecode; + required_device m_palette; + + bool m_irq_mask = false; + + uint8_t sh_timer_r(); + void sh_irqtrigger_w(uint8_t data); + template DECLARE_WRITE_LINE_MEMBER(coin_counter_w); + void sound_w(offs_t offset, uint8_t data); + DECLARE_WRITE_LINE_MEMBER(irq_mask_w); + void videoram_w(offs_t offset, uint8_t data); + void colorram_w(offs_t offset, uint8_t data); + DECLARE_WRITE_LINE_MEMBER(spritebank_w); + TILE_GET_INFO_MEMBER(get_tile_info); + void palette(palette_device &palette) const; + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_WRITE_LINE_MEMBER(vblank_irq); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); + void main_map(address_map &map); + void sound_map(address_map &map); +}; + + +// video + +/*************************************************************************** + + Convert the color PROMs into a more useable format. + + Circus Charlie has one 32x8 palette PROM and two 256x4 lookup table PROMs + (one for characters, one for sprites). + The palette PROM is connected to the RGB output this way: + + bit 7 -- 220 ohm resistor -- BLUE + -- 470 ohm resistor -- BLUE + -- 220 ohm resistor -- GREEN + -- 470 ohm resistor -- GREEN + -- 1 kohm resistor -- GREEN + -- 220 ohm resistor -- RED + -- 470 ohm resistor -- RED + bit 0 -- 1 kohm resistor -- RED + +***************************************************************************/ + +void circusc_state::palette(palette_device &palette) const +{ + const uint8_t *color_prom = memregion("proms")->base(); + static constexpr int resistances_rg[3] = { 1000, 470, 220 }; + static constexpr int resistances_b [2] = { 470, 220 }; + + // compute the color output resistor weights + double rweights[3], gweights[3], bweights[2]; + compute_resistor_weights(0, 255, -1.0, + 3, &resistances_rg[0], rweights, 0, 0, + 3, &resistances_rg[0], gweights, 0, 0, + 2, &resistances_b[0], bweights, 0, 0); + + // create a lookup table for the palette + for (int i = 0; i < 0x20; i++) + { + int bit0, bit1, bit2; + + // red component + bit0 = BIT(color_prom[i], 0); + bit1 = BIT(color_prom[i], 1); + bit2 = BIT(color_prom[i], 2); + int const r = combine_weights(rweights, bit0, bit1, bit2); + + // green component + bit0 = BIT(color_prom[i], 3); + bit1 = BIT(color_prom[i], 4); + bit2 = BIT(color_prom[i], 5); + int const g = combine_weights(gweights, bit0, bit1, bit2); + + // blue component + bit0 = BIT(color_prom[i], 6); + bit1 = BIT(color_prom[i], 7); + int const b = combine_weights(bweights, bit0, bit1); + + palette.set_indirect_color(i, rgb_t(r, g, b)); + } + + // color_prom now points to the beginning of the lookup table + color_prom += 32; + // characters map to the upper 16 palette entries + for (int i = 0; i < 0x100; i++) + { + uint8_t const ctabentry = color_prom[i] & 0x0f; + palette.set_pen_indirect(i, ctabentry + 0x10); + } + + // sprites map to the lower 16 palette entries + for (int i = 0x100; i < 0x200; i++) + { + uint8_t const ctabentry = color_prom[i] & 0x0f; + palette.set_pen_indirect(i, ctabentry); + } +} + + + +/*************************************************************************** + + Callbacks for the TileMap code + +***************************************************************************/ + +TILE_GET_INFO_MEMBER(circusc_state::get_tile_info) +{ + uint8_t const attr = m_colorram[tile_index]; + tileinfo.category = BIT(attr, 4); + + tileinfo.set( + 0, + m_videoram[tile_index] + ((attr & 0x20) << 3), + attr & 0x0f, + TILE_FLIPYX((attr & 0xc0) >> 6)); +} + + + +/*************************************************************************** + + Start the video hardware emulation. + +***************************************************************************/ + +void circusc_state::video_start() +{ + m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(circusc_state::get_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); + + m_bg_tilemap->set_scroll_cols(32); + + save_item(NAME(m_spritebank)); +} + + + +/*************************************************************************** + + Memory handlers + +***************************************************************************/ + +void circusc_state::videoram_w(offs_t offset, uint8_t data) +{ + m_videoram[offset] = data; + m_bg_tilemap->mark_tile_dirty(offset); +} + +void circusc_state::colorram_w(offs_t offset, uint8_t data) +{ + m_colorram[offset] = data; + m_bg_tilemap->mark_tile_dirty(offset); +} + +WRITE_LINE_MEMBER(circusc_state::spritebank_w) +{ + m_spritebank = state; +} + + + +/*************************************************************************** + + Display refresh + +***************************************************************************/ + +void circusc_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + uint8_t *sr = m_spritebank ? m_spriteram[0] : m_spriteram[1]; + + for (int offs = 0; offs < m_spriteram[0].bytes(); offs += 4) + { + int const code = sr[offs + 0] + 8 * (sr[offs + 1] & 0x20); + int const color = sr[offs + 1] & 0x0f; + int sx = sr[offs + 2]; + int sy = sr[offs + 3]; + int flipx = sr[offs + 1] & 0x40; + int flipy = sr[offs + 1] & 0x80; + + if (flip_screen()) + { + sx = 240 - sx; + sy = 240 - sy; + flipx = !flipx; + flipy = !flipy; + } + + + m_gfxdecode->gfx(1)->transmask(bitmap, cliprect, + code, color, + flipx, flipy, + sx, sy, + m_palette->transpen_mask(*m_gfxdecode->gfx(1), color, 0)); + } +} + +uint32_t circusc_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + for (int i = 0; i < 10; i++) + m_bg_tilemap->set_scrolly(i, 0); + for (int i = 10; i < 32; i++) + m_bg_tilemap->set_scrolly(i, *m_scroll); + + bitmap.fill(0, cliprect); + m_bg_tilemap->draw(screen, bitmap, cliprect, 1, 0); + draw_sprites(bitmap, cliprect); + m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + return 0; +} + + +// machine void circusc_state::machine_start() { @@ -77,7 +347,7 @@ void circusc_state::machine_reset() m_sn_latch = 0; } -uint8_t circusc_state::circusc_sh_timer_r() +uint8_t circusc_state::sh_timer_r() { /* This port reads the output of a counter clocked from the CPU clock. * The CPU XTAL is 14.31818MHz divided by 4. It then goes through 10 @@ -90,51 +360,47 @@ uint8_t circusc_state::circusc_sh_timer_r() * Can be shortened to: */ - int clock = m_audiocpu->total_cycles() >> 9; + int const clock = m_audiocpu->total_cycles() >> 9; return clock & 0x1e; } -void circusc_state::circusc_sh_irqtrigger_w(uint8_t data) +void circusc_state::sh_irqtrigger_w(uint8_t data) { m_audiocpu->set_input_line_and_vector(0, HOLD_LINE, 0xff); // Z80 } -WRITE_LINE_MEMBER(circusc_state::coin_counter_1_w) +template +WRITE_LINE_MEMBER(circusc_state::coin_counter_w) { - machine().bookkeeping().coin_counter_w(0, state); + machine().bookkeeping().coin_counter_w(Which, state); } -WRITE_LINE_MEMBER(circusc_state::coin_counter_2_w) -{ - machine().bookkeeping().coin_counter_w(1, state); -} - -void circusc_state::circusc_sound_w(offs_t offset, uint8_t data) +void circusc_state::sound_w(offs_t offset, uint8_t data) { switch (offset & 7) { - /* CS2 */ + // CS2 case 0: m_sn_latch = data; break; - /* CS3 */ + // CS3 case 1: - m_sn_1->write(m_sn_latch); + m_sn[0]->write(m_sn_latch); break; - /* CS4 */ + // CS4 case 2: - m_sn_2->write(m_sn_latch); + m_sn[1]->write(m_sn_latch); break; - /* CS5 */ + // CS5 case 3: m_dac->write(data); break; - /* CS6 */ + // CS6 case 4: m_discrete->write(NODE_05, (offset & 0x20) >> 5); m_discrete->write(NODE_06, (offset & 0x18) >> 3); @@ -150,24 +416,24 @@ WRITE_LINE_MEMBER(circusc_state::irq_mask_w) m_maincpu->set_input_line(M6809_IRQ_LINE, CLEAR_LINE); } -void circusc_state::circusc_map(address_map &map) +void circusc_state::main_map(address_map &map) { map(0x0000, 0x0007).mirror(0x03f8).w("mainlatch", FUNC(ls259_device::write_d0)); - map(0x0400, 0x0400).mirror(0x03ff).w("watchdog", FUNC(watchdog_timer_device::reset_w)); /* WDOG */ - map(0x0800, 0x0800).mirror(0x03ff).w("soundlatch", FUNC(generic_latch_8_device::write)); /* SOUND DATA */ - map(0x0c00, 0x0c00).mirror(0x03ff).w(FUNC(circusc_state::circusc_sh_irqtrigger_w)); /* SOUND-ON causes interrupt on audio CPU */ + map(0x0400, 0x0400).mirror(0x03ff).w("watchdog", FUNC(watchdog_timer_device::reset_w)); // WDOG + map(0x0800, 0x0800).mirror(0x03ff).w("soundlatch", FUNC(generic_latch_8_device::write)); // SOUND DATA + map(0x0c00, 0x0c00).mirror(0x03ff).w(FUNC(circusc_state::sh_irqtrigger_w)); // SOUND-ON causes interrupt on audio CPU map(0x1000, 0x1000).mirror(0x03fc).portr("SYSTEM"); map(0x1001, 0x1001).mirror(0x03fc).portr("P1"); map(0x1002, 0x1002).mirror(0x03fc).portr("P2"); - map(0x1003, 0x1003).mirror(0x03fc).nopr(); /* unpopulated DIPSW 3*/ + map(0x1003, 0x1003).mirror(0x03fc).nopr(); // unpopulated DIPSW map(0x1400, 0x1400).mirror(0x03ff).portr("DSW1"); map(0x1800, 0x1800).mirror(0x03ff).portr("DSW2"); - map(0x1c00, 0x1c00).mirror(0x03ff).writeonly().share("scroll"); /* VGAP */ + map(0x1c00, 0x1c00).mirror(0x03ff).writeonly().share(m_scroll); // VGAP map(0x2000, 0x2fff).ram(); - map(0x3000, 0x33ff).ram().w(FUNC(circusc_state::circusc_colorram_w)).share("colorram"); /* colorram */ - map(0x3400, 0x37ff).ram().w(FUNC(circusc_state::circusc_videoram_w)).share("videoram"); /* videoram */ - map(0x3800, 0x38ff).ram().share("spriteram_2"); /* spriteram2 */ - map(0x3900, 0x39ff).ram().share("spriteram"); /* spriteram */ + map(0x3000, 0x33ff).ram().w(FUNC(circusc_state::colorram_w)).share(m_colorram); + map(0x3400, 0x37ff).ram().w(FUNC(circusc_state::videoram_w)).share(m_videoram); + map(0x3800, 0x38ff).ram().share(m_spriteram[1]); + map(0x3900, 0x39ff).ram().share(m_spriteram[0]); map(0x3a00, 0x3fff).ram(); map(0x6000, 0xffff).rom(); } @@ -176,9 +442,9 @@ void circusc_state::sound_map(address_map &map) { map(0x0000, 0x3fff).rom(); map(0x4000, 0x43ff).mirror(0x1c00).ram(); - map(0x6000, 0x6000).mirror(0x1fff).r("soundlatch", FUNC(generic_latch_8_device::read)); /* CS0 */ - map(0x8000, 0x8000).mirror(0x1fff).r(FUNC(circusc_state::circusc_sh_timer_r)); /* CS1 */ - map(0xa000, 0xa07f).mirror(0x1f80).w(FUNC(circusc_state::circusc_sound_w)); /* CS2 - CS6 */ + map(0x6000, 0x6000).mirror(0x1fff).r("soundlatch", FUNC(generic_latch_8_device::read)); // CS0 + map(0x8000, 0x8000).mirror(0x1fff).r(FUNC(circusc_state::sh_timer_r)); // CS1 + map(0xa000, 0xa07f).mirror(0x1f80).w(FUNC(circusc_state::sound_w)); // CS2 - CS6 } @@ -190,27 +456,27 @@ static INPUT_PORTS_START( circusc ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* SW7 of 8 on unpopulated DIPSW 3 */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) // SW7 of 8 on unpopulated DIPSW 3 PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("P1") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) /* 1P UP - unused */ - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) /* 1P DOWN - unused */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) // 1P UP - unused + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) // 1P DOWN - unused PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) /* 1P SHOOT2 - unused */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) // 1P SHOOT2 - unused PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("P2") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_COCKTAIL PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_COCKTAIL - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) /* 2P UP - unused */ - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) /* 2P DOWN - unused */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) // 2P UP - unused + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) // 2P DOWN - unused PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) /* 2P SHOOT2 - unused */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) // 2P SHOOT2 - unused PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) @@ -275,33 +541,9 @@ INPUT_PORTS_END -static const gfx_layout charlayout = -{ - 8,8, /* 8*8 characters */ - 512, /* 512 characters */ - 4, /* 4 bits per pixel */ - { 0, 1, 2, 3 }, /* the four bitplanes are packed in one nibble */ - { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4 }, - { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 }, - 32*8 /* every char takes 8 consecutive bytes */ -}; - -static const gfx_layout spritelayout = -{ - 16,16, /* 16*16 sprites */ - 384, /* 384 sprites */ - 4, /* 4 bits per pixel */ - { 0, 1, 2, 3 }, /* the bitplanes are packed */ - { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4, - 8*4, 9*4, 10*4, 11*4, 12*4, 13*4, 14*4, 15*4 }, - { 0*4*16, 1*4*16, 2*4*16, 3*4*16, 4*4*16, 5*4*16, 6*4*16, 7*4*16, - 8*4*16, 9*4*16, 10*4*16, 11*4*16, 12*4*16, 13*4*16, 14*4*16, 15*4*16 }, - 32*4*8 /* every sprite takes 128 consecutive bytes */ -}; - static GFXDECODE_START( gfx_circusc ) - GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 16 ) - GFXDECODE_ENTRY( "gfx2", 0, spritelayout, 16*16, 16 ) + GFXDECODE_ENTRY( "tiles", 0, gfx_8x8x4_packed_msb, 0, 16 ) + GFXDECODE_ENTRY( "sprites", 0, gfx_16x16x4_packed_msb, 16*16, 16 ) GFXDECODE_END @@ -343,44 +585,44 @@ WRITE_LINE_MEMBER(circusc_state::vblank_irq) void circusc_state::circusc(machine_config &config) { - /* basic machine hardware */ - KONAMI1(config, m_maincpu, 2048000); /* 2 MHz? */ - m_maincpu->set_addrmap(AS_PROGRAM, &circusc_state::circusc_map); + // basic machine hardware + KONAMI1(config, m_maincpu, 2'048'000); // 2 MHz? + m_maincpu->set_addrmap(AS_PROGRAM, &circusc_state::main_map); ls259_device &mainlatch(LS259(config, "mainlatch")); // 2C - mainlatch.q_out_cb<0>().set(FUNC(circusc_state::flipscreen_w)); // FLIP + mainlatch.q_out_cb<0>().set(FUNC(circusc_state::flip_screen_set)); // FLIP mainlatch.q_out_cb<1>().set(FUNC(circusc_state::irq_mask_w)); // INTST mainlatch.q_out_cb<2>().set_nop(); // MUT - not used - mainlatch.q_out_cb<3>().set(FUNC(circusc_state::coin_counter_1_w)); // COIN1 - mainlatch.q_out_cb<4>().set(FUNC(circusc_state::coin_counter_2_w)); // COIN2 + mainlatch.q_out_cb<3>().set(FUNC(circusc_state::coin_counter_w<0>)); // COIN1 + mainlatch.q_out_cb<4>().set(FUNC(circusc_state::coin_counter_w<1>)); // COIN2 mainlatch.q_out_cb<5>().set(FUNC(circusc_state::spritebank_w)); // OBJ CHENG WATCHDOG_TIMER(config, "watchdog").set_vblank_count("screen", 8); - Z80(config, m_audiocpu, XTAL(14'318'181)/4); + Z80(config, m_audiocpu, XTAL(14'318'181) / 4); m_audiocpu->set_addrmap(AS_PROGRAM, &circusc_state::sound_map); - /* 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(0)); screen.set_size(32*8, 32*8); screen.set_visarea(0*8, 32*8-1, 2*8, 30*8-1); - screen.set_screen_update(FUNC(circusc_state::screen_update_circusc)); + screen.set_screen_update(FUNC(circusc_state::screen_update)); screen.set_palette(m_palette); screen.screen_vblank().set(FUNC(circusc_state::vblank_irq)); GFXDECODE(config, m_gfxdecode, m_palette, gfx_circusc); - PALETTE(config, m_palette, FUNC(circusc_state::circusc_palette), 16*16 + 16*16, 32); + PALETTE(config, m_palette, FUNC(circusc_state::palette), 16*16 + 16*16, 32); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); GENERIC_LATCH_8(config, "soundlatch"); - SN76496(config, m_sn_1, XTAL(14'318'181)/8).add_route(0, "fltdisc", 1.0, 0); + SN76496(config, m_sn[0], XTAL(14'318'181) / 8).add_route(0, "fltdisc", 1.0, 0); - SN76496(config, m_sn_2, XTAL(14'318'181)/8).add_route(0, "fltdisc", 1.0, 1); + SN76496(config, m_sn[1], XTAL(14'318'181) / 8).add_route(0, "fltdisc", 1.0, 1); DAC_8BIT_R2R(config, "dac", 0).set_output_range(0, 1).add_route(0, "fltdisc", 1.0, 2); // ls374.7g + r44+r45+r47+r48+r50+r56+r57+r58+r59 (20k) + r46+r49+r51+r52+r53+r54+r55 (10k) + upc324.3h @@ -407,11 +649,11 @@ ROM_START( circusc ) ROM_LOAD( "380_l14.5c", 0x0000, 0x2000, CRC(607df0fb) SHA1(67103d61994fd3a1e2de7cf9487e4f763234b18e) ) ROM_LOAD( "380_l15.7c", 0x2000, 0x2000, CRC(a6ad30e1) SHA1(14f305717edcc2471e763b262960a0b96eef3530) ) - ROM_REGION( 0x04000, "gfx1", 0 ) + ROM_REGION( 0x04000, "tiles", 0 ) ROM_LOAD( "380_j12.4a", 0x0000, 0x2000, CRC(56e5b408) SHA1(73b9e3d46dfe9e39b390c634df153648a0906876) ) ROM_LOAD( "380_j13.5a", 0x2000, 0x2000, CRC(5aca0193) SHA1(4d0b0a773c385b7f1dcf024760d0437f47e78fbe) ) - ROM_REGION( 0x0c000, "gfx2", 0 ) + ROM_REGION( 0x0c000, "sprites", 0 ) ROM_LOAD( "380_j06.11e", 0x0000, 0x2000, CRC(df0405c6) SHA1(70a50dcc86dfbdaa9c2af613105aae7f90747804) ) ROM_LOAD( "380_j07.12e", 0x2000, 0x2000, CRC(23dfe3a6) SHA1(2ad7cbcbdbb434dc43e9c94cd00df9e57ac097f5) ) ROM_LOAD( "380_j08.13e", 0x4000, 0x2000, CRC(3ba95390) SHA1(b22ad7cfda392894208eb4b39505f38bfe4c4342) ) @@ -420,12 +662,12 @@ ROM_START( circusc ) ROM_LOAD( "380_j11.16e", 0xa000, 0x2000, CRC(e1725d24) SHA1(d315588e6cc2f4263be621d2d8603c8215a90046) ) ROM_REGION( 0x0220, "proms", 0 ) - ROM_LOAD( "380_j18.2a", 0x0000, 0x020, CRC(10dd4eaa) SHA1(599acd25f36445221c553510a5de23ddba5ecc15) ) /* palette */ - ROM_LOAD( "380_j17.7b", 0x0020, 0x100, CRC(13989357) SHA1(0d61d468f6d3e1570fd18d236ec8cab92db4ed5c) ) /* character lookup table */ - ROM_LOAD( "380_j16.10c", 0x0120, 0x100, CRC(c244f2aa) SHA1(86df21c8e0b1ed51a0a4bd33dbb33f6efdea7d39) ) /* sprite lookup table */ + ROM_LOAD( "380_j18.2a", 0x0000, 0x020, CRC(10dd4eaa) SHA1(599acd25f36445221c553510a5de23ddba5ecc15) ) // palette + ROM_LOAD( "380_j17.7b", 0x0020, 0x100, CRC(13989357) SHA1(0d61d468f6d3e1570fd18d236ec8cab92db4ed5c) ) // character lookup table + ROM_LOAD( "380_j16.10c", 0x0120, 0x100, CRC(c244f2aa) SHA1(86df21c8e0b1ed51a0a4bd33dbb33f6efdea7d39) ) // sprite lookup table ROM_END -ROM_START( circusc2 ) /* This set verified to come with Q revision roms for 01 through 04 */ +ROM_START( circusc2 ) // This set verified to come with Q revision ROMs for 01 through 04 ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "380_w05.3h", 0x6000, 0x2000, CRC(87df9f5e) SHA1(d759ff6200546c562aecee749dc9941bbbdb9918) ) ROM_LOAD( "380_q04.4h", 0x8000, 0x2000, CRC(c283b887) SHA1(458c398911453d558003f49c298b0d593c941c11) ) // Could also be labeled 380 R04 @@ -437,11 +679,11 @@ ROM_START( circusc2 ) /* This set verified to come with Q revision roms for 01 t ROM_LOAD( "380_l14.5c", 0x0000, 0x2000, CRC(607df0fb) SHA1(67103d61994fd3a1e2de7cf9487e4f763234b18e) ) ROM_LOAD( "380_l15.7c", 0x2000, 0x2000, CRC(a6ad30e1) SHA1(14f305717edcc2471e763b262960a0b96eef3530) ) - ROM_REGION( 0x04000, "gfx1", 0 ) + ROM_REGION( 0x04000, "tiles", 0 ) ROM_LOAD( "380_j12.4a", 0x0000, 0x2000, CRC(56e5b408) SHA1(73b9e3d46dfe9e39b390c634df153648a0906876) ) ROM_LOAD( "380_k13.5a", 0x2000, 0x2000, CRC(5aca0193) SHA1(4d0b0a773c385b7f1dcf024760d0437f47e78fbe) ) // == 380_j13.5a - ROM_REGION( 0x0c000, "gfx2", 0 ) + ROM_REGION( 0x0c000, "sprites", 0 ) ROM_LOAD( "380_j06.11e", 0x0000, 0x2000, CRC(df0405c6) SHA1(70a50dcc86dfbdaa9c2af613105aae7f90747804) ) ROM_LOAD( "380_j07.12e", 0x2000, 0x2000, CRC(23dfe3a6) SHA1(2ad7cbcbdbb434dc43e9c94cd00df9e57ac097f5) ) ROM_LOAD( "380_j08.13e", 0x4000, 0x2000, CRC(3ba95390) SHA1(b22ad7cfda392894208eb4b39505f38bfe4c4342) ) @@ -450,9 +692,9 @@ ROM_START( circusc2 ) /* This set verified to come with Q revision roms for 01 t ROM_LOAD( "380_j11.16e", 0xa000, 0x2000, CRC(e1725d24) SHA1(d315588e6cc2f4263be621d2d8603c8215a90046) ) ROM_REGION( 0x0220, "proms", 0 ) - ROM_LOAD( "380_j18.2a", 0x0000, 0x020, CRC(10dd4eaa) SHA1(599acd25f36445221c553510a5de23ddba5ecc15) ) /* palette */ - ROM_LOAD( "380_j17.7b", 0x0020, 0x100, CRC(13989357) SHA1(0d61d468f6d3e1570fd18d236ec8cab92db4ed5c) ) /* character lookup table */ - ROM_LOAD( "380_j16.10c", 0x0120, 0x100, CRC(c244f2aa) SHA1(86df21c8e0b1ed51a0a4bd33dbb33f6efdea7d39) ) /* sprite lookup table */ + ROM_LOAD( "380_j18.2a", 0x0000, 0x020, CRC(10dd4eaa) SHA1(599acd25f36445221c553510a5de23ddba5ecc15) ) // palette + ROM_LOAD( "380_j17.7b", 0x0020, 0x100, CRC(13989357) SHA1(0d61d468f6d3e1570fd18d236ec8cab92db4ed5c) ) // character lookup table + ROM_LOAD( "380_j16.10c", 0x0120, 0x100, CRC(c244f2aa) SHA1(86df21c8e0b1ed51a0a4bd33dbb33f6efdea7d39) ) // sprite lookup table ROM_END ROM_START( circusc3 ) @@ -467,11 +709,11 @@ ROM_START( circusc3 ) ROM_LOAD( "380_l14.5c", 0x0000, 0x2000, CRC(607df0fb) SHA1(67103d61994fd3a1e2de7cf9487e4f763234b18e) ) ROM_LOAD( "380_l15.7c", 0x2000, 0x2000, CRC(a6ad30e1) SHA1(14f305717edcc2471e763b262960a0b96eef3530) ) - ROM_REGION( 0x04000, "gfx1", 0 ) + ROM_REGION( 0x04000, "tiles", 0 ) ROM_LOAD( "380_j12.4a", 0x0000, 0x2000, CRC(56e5b408) SHA1(73b9e3d46dfe9e39b390c634df153648a0906876) ) ROM_LOAD( "380_j13.5a", 0x2000, 0x2000, CRC(5aca0193) SHA1(4d0b0a773c385b7f1dcf024760d0437f47e78fbe) ) - ROM_REGION( 0x0c000, "gfx2", 0 ) + ROM_REGION( 0x0c000, "sprites", 0 ) ROM_LOAD( "380_j06.11e", 0x0000, 0x2000, CRC(df0405c6) SHA1(70a50dcc86dfbdaa9c2af613105aae7f90747804) ) ROM_LOAD( "380_j07.12e", 0x2000, 0x2000, CRC(23dfe3a6) SHA1(2ad7cbcbdbb434dc43e9c94cd00df9e57ac097f5) ) ROM_LOAD( "380_j08.13e", 0x4000, 0x2000, CRC(3ba95390) SHA1(b22ad7cfda392894208eb4b39505f38bfe4c4342) ) @@ -480,9 +722,9 @@ ROM_START( circusc3 ) ROM_LOAD( "380_j11.16e", 0xa000, 0x2000, CRC(e1725d24) SHA1(d315588e6cc2f4263be621d2d8603c8215a90046) ) ROM_REGION( 0x0220, "proms", 0 ) - ROM_LOAD( "380_j18.2a", 0x0000, 0x020, CRC(10dd4eaa) SHA1(599acd25f36445221c553510a5de23ddba5ecc15) ) /* palette */ - ROM_LOAD( "380_j17.7b", 0x0020, 0x100, CRC(13989357) SHA1(0d61d468f6d3e1570fd18d236ec8cab92db4ed5c) ) /* character lookup table */ - ROM_LOAD( "380_j16.10c", 0x0120, 0x100, CRC(c244f2aa) SHA1(86df21c8e0b1ed51a0a4bd33dbb33f6efdea7d39) ) /* sprite lookup table */ + ROM_LOAD( "380_j18.2a", 0x0000, 0x020, CRC(10dd4eaa) SHA1(599acd25f36445221c553510a5de23ddba5ecc15) ) // palette + ROM_LOAD( "380_j17.7b", 0x0020, 0x100, CRC(13989357) SHA1(0d61d468f6d3e1570fd18d236ec8cab92db4ed5c) ) // character lookup table + ROM_LOAD( "380_j16.10c", 0x0120, 0x100, CRC(c244f2aa) SHA1(86df21c8e0b1ed51a0a4bd33dbb33f6efdea7d39) ) // sprite lookup table ROM_END ROM_START( circusc4 ) @@ -497,11 +739,11 @@ ROM_START( circusc4 ) ROM_LOAD( "380_l14.5c", 0x0000, 0x2000, CRC(607df0fb) SHA1(67103d61994fd3a1e2de7cf9487e4f763234b18e) ) ROM_LOAD( "380_l15.7c", 0x2000, 0x2000, CRC(a6ad30e1) SHA1(14f305717edcc2471e763b262960a0b96eef3530) ) - ROM_REGION( 0x04000, "gfx1", 0 ) + ROM_REGION( 0x04000, "tiles", 0 ) ROM_LOAD( "380_j12.4a", 0x0000, 0x2000, CRC(56e5b408) SHA1(73b9e3d46dfe9e39b390c634df153648a0906876) ) ROM_LOAD( "380_j13.5a", 0x2000, 0x2000, CRC(5aca0193) SHA1(4d0b0a773c385b7f1dcf024760d0437f47e78fbe) ) - ROM_REGION( 0x0c000, "gfx2", 0 ) + ROM_REGION( 0x0c000, "sprites", 0 ) ROM_LOAD( "380_j06.11e", 0x0000, 0x2000, CRC(df0405c6) SHA1(70a50dcc86dfbdaa9c2af613105aae7f90747804) ) ROM_LOAD( "380_j07.12e", 0x2000, 0x2000, CRC(23dfe3a6) SHA1(2ad7cbcbdbb434dc43e9c94cd00df9e57ac097f5) ) ROM_LOAD( "380_j08.13e", 0x4000, 0x2000, CRC(3ba95390) SHA1(b22ad7cfda392894208eb4b39505f38bfe4c4342) ) @@ -510,12 +752,12 @@ ROM_START( circusc4 ) ROM_LOAD( "380_j11.16e", 0xa000, 0x2000, CRC(e1725d24) SHA1(d315588e6cc2f4263be621d2d8603c8215a90046) ) ROM_REGION( 0x0220, "proms", 0 ) - ROM_LOAD( "380_j18.2a", 0x0000, 0x020, CRC(10dd4eaa) SHA1(599acd25f36445221c553510a5de23ddba5ecc15) ) /* palette */ - ROM_LOAD( "380_j17.7b", 0x0020, 0x100, CRC(13989357) SHA1(0d61d468f6d3e1570fd18d236ec8cab92db4ed5c) ) /* character lookup table */ - ROM_LOAD( "380_j16.10c", 0x0120, 0x100, CRC(c244f2aa) SHA1(86df21c8e0b1ed51a0a4bd33dbb33f6efdea7d39) ) /* sprite lookup table */ + ROM_LOAD( "380_j18.2a", 0x0000, 0x020, CRC(10dd4eaa) SHA1(599acd25f36445221c553510a5de23ddba5ecc15) ) // palette + ROM_LOAD( "380_j17.7b", 0x0020, 0x100, CRC(13989357) SHA1(0d61d468f6d3e1570fd18d236ec8cab92db4ed5c) ) // character lookup table + ROM_LOAD( "380_j16.10c", 0x0120, 0x100, CRC(c244f2aa) SHA1(86df21c8e0b1ed51a0a4bd33dbb33f6efdea7d39) ) // sprite lookup table ROM_END -ROM_START( circuscc ) /* Version U */ +ROM_START( circuscc ) // Version U ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "380_u05.3h", 0x6000, 0x2000, CRC(964c035a) SHA1(bd69bb755be327d04fc95cd33115663b33b33ed3) ) ROM_LOAD( "380_p04.4h", 0x8000, 0x2000, CRC(dd0c0ee7) SHA1(e56e48f6f251430b7ce0e2cc59cfd00b5c760b9c) ) @@ -527,11 +769,11 @@ ROM_START( circuscc ) /* Version U */ ROM_LOAD( "380_l14.5c", 0x0000, 0x2000, CRC(607df0fb) SHA1(67103d61994fd3a1e2de7cf9487e4f763234b18e) ) ROM_LOAD( "380_l15.7c", 0x2000, 0x2000, CRC(a6ad30e1) SHA1(14f305717edcc2471e763b262960a0b96eef3530) ) - ROM_REGION( 0x04000, "gfx1", 0 ) + ROM_REGION( 0x04000, "tiles", 0 ) ROM_LOAD( "380_j12.4a", 0x0000, 0x2000, CRC(56e5b408) SHA1(73b9e3d46dfe9e39b390c634df153648a0906876) ) ROM_LOAD( "380_j13.5a", 0x2000, 0x2000, CRC(5aca0193) SHA1(4d0b0a773c385b7f1dcf024760d0437f47e78fbe) ) - ROM_REGION( 0x0c000, "gfx2", 0 ) + ROM_REGION( 0x0c000, "sprites", 0 ) ROM_LOAD( "380_j06.11e", 0x0000, 0x2000, CRC(df0405c6) SHA1(70a50dcc86dfbdaa9c2af613105aae7f90747804) ) ROM_LOAD( "380_j07.12e", 0x2000, 0x2000, CRC(23dfe3a6) SHA1(2ad7cbcbdbb434dc43e9c94cd00df9e57ac097f5) ) ROM_LOAD( "380_j08.13e", 0x4000, 0x2000, CRC(3ba95390) SHA1(b22ad7cfda392894208eb4b39505f38bfe4c4342) ) @@ -540,12 +782,12 @@ ROM_START( circuscc ) /* Version U */ ROM_LOAD( "380_j11.16e", 0xa000, 0x2000, CRC(e1725d24) SHA1(d315588e6cc2f4263be621d2d8603c8215a90046) ) ROM_REGION( 0x0220, "proms", 0 ) - ROM_LOAD( "380_j18.2a", 0x0000, 0x020, CRC(10dd4eaa) SHA1(599acd25f36445221c553510a5de23ddba5ecc15) ) /* palette */ - ROM_LOAD( "380_j17.7b", 0x0020, 0x100, CRC(13989357) SHA1(0d61d468f6d3e1570fd18d236ec8cab92db4ed5c) ) /* character lookup table */ - ROM_LOAD( "380_j16.10c", 0x0120, 0x100, CRC(c244f2aa) SHA1(86df21c8e0b1ed51a0a4bd33dbb33f6efdea7d39) ) /* sprite lookup table */ + ROM_LOAD( "380_j18.2a", 0x0000, 0x020, CRC(10dd4eaa) SHA1(599acd25f36445221c553510a5de23ddba5ecc15) ) // palette + ROM_LOAD( "380_j17.7b", 0x0020, 0x100, CRC(13989357) SHA1(0d61d468f6d3e1570fd18d236ec8cab92db4ed5c) ) // character lookup table + ROM_LOAD( "380_j16.10c", 0x0120, 0x100, CRC(c244f2aa) SHA1(86df21c8e0b1ed51a0a4bd33dbb33f6efdea7d39) ) // sprite lookup table ROM_END -ROM_START( circusce ) /* Version P */ +ROM_START( circusce ) // Version P ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "380_p05.3h", 0x6000, 0x2000, CRC(7ca74494) SHA1(326e081490e413b0638ec77de184b128fb2afd14) ) ROM_LOAD( "380_p04.4h", 0x8000, 0x2000, CRC(dd0c0ee7) SHA1(e56e48f6f251430b7ce0e2cc59cfd00b5c760b9c) ) @@ -557,11 +799,11 @@ ROM_START( circusce ) /* Version P */ ROM_LOAD( "380_l14.5c", 0x0000, 0x2000, CRC(607df0fb) SHA1(67103d61994fd3a1e2de7cf9487e4f763234b18e) ) ROM_LOAD( "380_l15.7c", 0x2000, 0x2000, CRC(a6ad30e1) SHA1(14f305717edcc2471e763b262960a0b96eef3530) ) - ROM_REGION( 0x04000, "gfx1", 0 ) + ROM_REGION( 0x04000, "tiles", 0 ) ROM_LOAD( "380_j12.4a", 0x0000, 0x2000, CRC(56e5b408) SHA1(73b9e3d46dfe9e39b390c634df153648a0906876) ) ROM_LOAD( "380_j13.5a", 0x2000, 0x2000, CRC(5aca0193) SHA1(4d0b0a773c385b7f1dcf024760d0437f47e78fbe) ) - ROM_REGION( 0x0c000, "gfx2", 0 ) + ROM_REGION( 0x0c000, "sprites", 0 ) ROM_LOAD( "380_j06.11e", 0x0000, 0x2000, CRC(df0405c6) SHA1(70a50dcc86dfbdaa9c2af613105aae7f90747804) ) ROM_LOAD( "380_j07.12e", 0x2000, 0x2000, CRC(23dfe3a6) SHA1(2ad7cbcbdbb434dc43e9c94cd00df9e57ac097f5) ) ROM_LOAD( "380_j08.13e", 0x4000, 0x2000, CRC(3ba95390) SHA1(b22ad7cfda392894208eb4b39505f38bfe4c4342) ) @@ -570,20 +812,17 @@ ROM_START( circusce ) /* Version P */ ROM_LOAD( "380_j11.16e", 0xa000, 0x2000, CRC(e1725d24) SHA1(d315588e6cc2f4263be621d2d8603c8215a90046) ) ROM_REGION( 0x0220, "proms", 0 ) - ROM_LOAD( "380_j18.2a", 0x0000, 0x020, CRC(10dd4eaa) SHA1(599acd25f36445221c553510a5de23ddba5ecc15) ) /* palette */ - ROM_LOAD( "380_j17.7b", 0x0020, 0x100, CRC(13989357) SHA1(0d61d468f6d3e1570fd18d236ec8cab92db4ed5c) ) /* character lookup table */ - ROM_LOAD( "380_j16.10c", 0x0120, 0x100, CRC(c244f2aa) SHA1(86df21c8e0b1ed51a0a4bd33dbb33f6efdea7d39) ) /* sprite lookup table */ + ROM_LOAD( "380_j18.2a", 0x0000, 0x020, CRC(10dd4eaa) SHA1(599acd25f36445221c553510a5de23ddba5ecc15) ) // palette + ROM_LOAD( "380_j17.7b", 0x0020, 0x100, CRC(13989357) SHA1(0d61d468f6d3e1570fd18d236ec8cab92db4ed5c) ) // character lookup table + ROM_LOAD( "380_j16.10c", 0x0120, 0x100, CRC(c244f2aa) SHA1(86df21c8e0b1ed51a0a4bd33dbb33f6efdea7d39) ) // sprite lookup table ROM_END - -void circusc_state::init_circusc() -{ -} +} // anonymous namespace -GAME( 1984, circusc, 0, circusc, circusc, circusc_state, init_circusc, ROT90, "Konami", "Circus Charlie (level select, set 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1984, circusc2, circusc, circusc, circusc, circusc_state, init_circusc, ROT90, "Konami", "Circus Charlie (level select, set 2)", MACHINE_SUPPORTS_SAVE ) -GAME( 1984, circusc3, circusc, circusc, circusc, circusc_state, init_circusc, ROT90, "Konami", "Circus Charlie (level select, set 3)", MACHINE_SUPPORTS_SAVE ) -GAME( 1984, circusc4, circusc, circusc, circusc, circusc_state, init_circusc, ROT90, "Konami", "Circus Charlie (no level select)", MACHINE_SUPPORTS_SAVE ) -GAME( 1984, circuscc, circusc, circusc, circusc, circusc_state, init_circusc, ROT90, "Konami (Centuri license)", "Circus Charlie (Centuri)", MACHINE_SUPPORTS_SAVE ) -GAME( 1984, circusce, circusc, circusc, circusc, circusc_state, init_circusc, ROT90, "Konami (Centuri license)", "Circus Charlie (Centuri, earlier)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, circusc, 0, circusc, circusc, circusc_state, empty_init, ROT90, "Konami", "Circus Charlie (level select, set 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, circusc2, circusc, circusc, circusc, circusc_state, empty_init, ROT90, "Konami", "Circus Charlie (level select, set 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, circusc3, circusc, circusc, circusc, circusc_state, empty_init, ROT90, "Konami", "Circus Charlie (level select, set 3)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, circusc4, circusc, circusc, circusc, circusc_state, empty_init, ROT90, "Konami", "Circus Charlie (no level select)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, circuscc, circusc, circusc, circusc, circusc_state, empty_init, ROT90, "Konami (Centuri license)", "Circus Charlie (Centuri)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, circusce, circusc, circusc, circusc, circusc_state, empty_init, ROT90, "Konami (Centuri license)", "Circus Charlie (Centuri, earlier)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/konami/circusc.h b/src/mame/konami/circusc.h deleted file mode 100644 index 8e1917de372..00000000000 --- a/src/mame/konami/circusc.h +++ /dev/null @@ -1,91 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nicola Salmoria,Chris Hardy, Couriersud -/************************************************************************* - - Circus Charlie - -*************************************************************************/ -#ifndef MAME_INCLUDES_CIRCUSC_H -#define MAME_INCLUDES_CIRCUSC_H - -#pragma once - -#include "sound/dac.h" -#include "sound/sn76496.h" -#include "sound/discrete.h" -#include "emupal.h" -#include "tilemap.h" - -class circusc_state : public driver_device -{ -public: - circusc_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_scroll(*this, "scroll"), - m_colorram(*this, "colorram"), - m_videoram(*this, "videoram"), - m_spriteram_2(*this, "spriteram_2"), - m_spriteram(*this, "spriteram"), - m_audiocpu(*this, "audiocpu"), - m_sn_1(*this, "sn1"), - m_sn_2(*this, "sn2"), - m_dac(*this, "dac"), - m_discrete(*this, "fltdisc"), - m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") - { } - - void init_circusc(); - void circusc(machine_config &config); - -private: - /* memory pointers */ - required_shared_ptr m_scroll; - required_shared_ptr m_colorram; - required_shared_ptr m_videoram; - required_shared_ptr m_spriteram_2; - required_shared_ptr m_spriteram; - - /* video-related */ - tilemap_t *m_bg_tilemap = nullptr; - bool m_spritebank = false; - - /* sound-related */ - uint8_t m_sn_latch = 0U; - - /* devices */ - required_device m_audiocpu; - required_device m_sn_1; - required_device m_sn_2; - required_device m_dac; - required_device m_discrete; - - bool m_irq_mask = false; - - uint8_t circusc_sh_timer_r(); - void circusc_sh_irqtrigger_w(uint8_t data); - DECLARE_WRITE_LINE_MEMBER(coin_counter_1_w); - DECLARE_WRITE_LINE_MEMBER(coin_counter_2_w); - void circusc_sound_w(offs_t offset, uint8_t data); - DECLARE_WRITE_LINE_MEMBER(irq_mask_w); - void circusc_videoram_w(offs_t offset, uint8_t data); - void circusc_colorram_w(offs_t offset, uint8_t data); - DECLARE_WRITE_LINE_MEMBER(flipscreen_w); - DECLARE_WRITE_LINE_MEMBER(spritebank_w); - TILE_GET_INFO_MEMBER(get_tile_info); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; - void circusc_palette(palette_device &palette) const; - uint32_t screen_update_circusc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_WRITE_LINE_MEMBER(vblank_irq); - void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_palette; - void circusc_map(address_map &map); - void sound_map(address_map &map); -}; - -#endif // MAME_INCLUDES_CIRCUSC_H diff --git a/src/mame/konami/circusc_v.cpp b/src/mame/konami/circusc_v.cpp deleted file mode 100644 index d39a7832181..00000000000 --- a/src/mame/konami/circusc_v.cpp +++ /dev/null @@ -1,211 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nicola Salmoria,Chris Hardy -/*************************************************************************** - - video.c - - Functions to emulate the video hardware of the machine. - -***************************************************************************/ - -#include "emu.h" -#include "video/resnet.h" -#include "circusc.h" - - -/*************************************************************************** - - Convert the color PROMs into a more useable format. - - Circus Charlie has one 32x8 palette PROM and two 256x4 lookup table PROMs - (one for characters, one for sprites). - The palette PROM is connected to the RGB output this way: - - bit 7 -- 220 ohm resistor -- BLUE - -- 470 ohm resistor -- BLUE - -- 220 ohm resistor -- GREEN - -- 470 ohm resistor -- GREEN - -- 1 kohm resistor -- GREEN - -- 220 ohm resistor -- RED - -- 470 ohm resistor -- RED - bit 0 -- 1 kohm resistor -- RED - -***************************************************************************/ - -void circusc_state::circusc_palette(palette_device &palette) const -{ - const uint8_t *color_prom = memregion("proms")->base(); - static constexpr int resistances_rg[3] = { 1000, 470, 220 }; - static constexpr int resistances_b [2] = { 470, 220 }; - - // compute the color output resistor weights - double rweights[3], gweights[3], bweights[2]; - compute_resistor_weights(0, 255, -1.0, - 3, &resistances_rg[0], rweights, 0, 0, - 3, &resistances_rg[0], gweights, 0, 0, - 2, &resistances_b[0], bweights, 0, 0); - - // create a lookup table for the palette - for (int i = 0; i < 0x20; i++) - { - int bit0, bit1, bit2; - - // red component - bit0 = BIT(color_prom[i], 0); - bit1 = BIT(color_prom[i], 1); - bit2 = BIT(color_prom[i], 2); - int const r = combine_weights(rweights, bit0, bit1, bit2); - - // green component - bit0 = BIT(color_prom[i], 3); - bit1 = BIT(color_prom[i], 4); - bit2 = BIT(color_prom[i], 5); - int const g = combine_weights(gweights, bit0, bit1, bit2); - - // blue component - bit0 = BIT(color_prom[i], 6); - bit1 = BIT(color_prom[i], 7); - int const b = combine_weights(bweights, bit0, bit1); - - palette.set_indirect_color(i, rgb_t(r, g, b)); - } - - // color_prom now points to the beginning of the lookup table - color_prom += 32; - - // characters map to the upper 16 palette entries - for (int i = 0; i < 0x100; i++) - { - uint8_t const ctabentry = color_prom[i] & 0x0f; - palette.set_pen_indirect(i, ctabentry + 0x10); - } - - // sprites map to the lower 16 palette entries - for (int i = 0x100; i < 0x200; i++) - { - uint8_t const ctabentry = color_prom[i] & 0x0f; - palette.set_pen_indirect(i, ctabentry); - } -} - - - -/*************************************************************************** - - Callbacks for the TileMap code - -***************************************************************************/ - -TILE_GET_INFO_MEMBER(circusc_state::get_tile_info) -{ - uint8_t const attr = m_colorram[tile_index]; - tileinfo.category = BIT(attr, 4); - - tileinfo.set( - 0, - m_videoram[tile_index] + ((attr & 0x20) << 3), - attr & 0x0f, - TILE_FLIPYX((attr & 0xc0) >> 6)); -} - - - -/*************************************************************************** - - Start the video hardware emulation. - -***************************************************************************/ - -void circusc_state::video_start() -{ - m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(circusc_state::get_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); - - m_bg_tilemap->set_scroll_cols(32); - - save_item(NAME(m_spritebank)); -} - - - -/*************************************************************************** - - Memory handlers - -***************************************************************************/ - -void circusc_state::circusc_videoram_w(offs_t offset, uint8_t data) -{ - m_videoram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset); -} - -void circusc_state::circusc_colorram_w(offs_t offset, uint8_t data) -{ - m_colorram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset); -} - -WRITE_LINE_MEMBER(circusc_state::flipscreen_w) -{ - flip_screen_set(state); -} - -WRITE_LINE_MEMBER(circusc_state::spritebank_w) -{ - m_spritebank = state; -} - - - -/*************************************************************************** - - Display refresh - -***************************************************************************/ - -void circusc_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) -{ - int offs; - uint8_t *sr = m_spritebank ? m_spriteram : m_spriteram_2; - - for (offs = 0; offs < m_spriteram.bytes(); offs += 4) - { - int code = sr[offs + 0] + 8 * (sr[offs + 1] & 0x20); - int color = sr[offs + 1] & 0x0f; - int sx = sr[offs + 2]; - int sy = sr[offs + 3]; - int flipx = sr[offs + 1] & 0x40; - int flipy = sr[offs + 1] & 0x80; - - if (flip_screen()) - { - sx = 240 - sx; - sy = 240 - sy; - flipx = !flipx; - flipy = !flipy; - } - - - m_gfxdecode->gfx(1)->transmask(bitmap,cliprect, - code, color, - flipx,flipy, - sx,sy, - m_palette->transpen_mask(*m_gfxdecode->gfx(1), color, 0)); - } -} - -uint32_t circusc_state::screen_update_circusc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int i; - - for (i = 0; i < 10; i++) - m_bg_tilemap->set_scrolly(i, 0); - for (i = 10; i < 32; i++) - m_bg_tilemap->set_scrolly(i, *m_scroll); - - bitmap.fill(0, cliprect); - m_bg_tilemap->draw(screen, bitmap, cliprect, 1, 0); - draw_sprites(bitmap, cliprect); - m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - return 0; -} diff --git a/src/mame/konami/ddribble.cpp b/src/mame/konami/ddribble.cpp index 5ff4a56f7a4..60e61a2854e 100644 --- a/src/mame/konami/ddribble.cpp +++ b/src/mame/konami/ddribble.cpp @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Manuel Abadia +// copyright-holders: Manuel Abadia /*************************************************************************** Double Dribble (GX690) (c) Konami 1986 @@ -14,15 +14,309 @@ ***************************************************************************/ #include "emu.h" -#include "ddribble.h" + #include "konamipt.h" #include "cpu/m6809/m6809.h" #include "machine/watchdog.h" +#include "sound/flt_rc.h" +#include "sound/vlm5030.h" #include "sound/ymopn.h" + +#include "emupal.h" #include "screen.h" #include "speaker.h" +#include "tilemap.h" + + +namespace { + +class ddribble_state : public driver_device +{ +public: + ddribble_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_fg_videoram(*this, "fg_videoram"), + m_spriteram(*this, "spriteram_%u", 1U), + m_bg_videoram(*this, "bg_videoram"), + m_mainbank(*this, "mainbank"), + m_vlmbank(*this, "vlmbank"), + m_maincpu(*this, "maincpu"), + m_subcpu(*this, "subcpu"), + m_vlm(*this, "vlm"), + m_filter(*this, "filter%u", 1U), + m_gfxdecode(*this, "gfxdecode") + { } + + void ddribble(machine_config &config); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + +private: + // memory pointers + required_shared_ptr m_fg_videoram; + required_shared_ptr_array m_spriteram; + required_shared_ptr m_bg_videoram; + required_memory_bank m_mainbank; + required_memory_bank m_vlmbank; + + // video-related + tilemap_t *m_fg_tilemap = nullptr; + tilemap_t *m_bg_tilemap = nullptr; + uint8_t m_vregs[2][5]{}; + uint8_t m_charbank[2]{}; + + // misc + uint8_t m_int_enable[2]{}; + + // devices + required_device m_maincpu; + required_device m_subcpu; + required_device m_vlm; + required_device_array m_filter; + required_device m_gfxdecode; + + void bankswitch_w(uint8_t data); + void coin_counter_w(uint8_t data); + template void k005885_w(offs_t offset, uint8_t data); + void k005885_1_w(offs_t offset, uint8_t data); + void fg_videoram_w(offs_t offset, uint8_t data); + void bg_videoram_w(offs_t offset, uint8_t data); + uint8_t vlm5030_busy_r(); + void vlm5030_ctrl_w(uint8_t data); + TILEMAP_MAPPER_MEMBER(tilemap_scan); + TILE_GET_INFO_MEMBER(get_fg_tile_info); + TILE_GET_INFO_MEMBER(get_bg_tile_info); + void palette(palette_device &palette) const; + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_WRITE_LINE_MEMBER(vblank_irq); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, uint8_t* source, int lenght, int gfxset, int flipscreen); + void maincpu_map(address_map &map); + void subcpu_map(address_map &map); + void audiocpu_map(address_map &map); + void vlm_map(address_map &map); +}; + + +// video + +void ddribble_state::palette(palette_device &palette) const +{ + uint8_t const *const color_prom = memregion("proms")->base(); + + for (int i = 0x10; i < 0x40; i++) + palette.set_pen_indirect(i, i); + + // sprite #2 uses pens 0x00-0x0f + for (int i = 0x0; i < 0x100; i++) + { + uint8_t const ctabentry = color_prom[i] & 0x0f; + palette.set_pen_indirect(i + 0x40, ctabentry); + } +} + + +template +void ddribble_state::k005885_w(offs_t offset, uint8_t data) // TODO: K005885 should be device-ified +{ + switch (offset) + { + case 0x03: // char bank selection + if ((data & 0x03) != m_charbank[Which]) + { + m_charbank[Which] = data & 0x03; + Which ? m_bg_tilemap->mark_all_dirty() : m_fg_tilemap->mark_all_dirty(); + } + break; + case 0x04: // IRQ control, flipscreen + m_int_enable[Which] = data & 0x02; + break; + } + m_vregs[Which][offset] = data; +} + +/*************************************************************************** + + Callbacks for the TileMap code + +***************************************************************************/ + +TILEMAP_MAPPER_MEMBER(ddribble_state::tilemap_scan) +{ + // logical (col,row) -> memory offset + return (col & 0x1f) + ((row & 0x1f) << 5) + ((col & 0x20) << 6); // skip 0x400 +} + +TILE_GET_INFO_MEMBER(ddribble_state::get_fg_tile_info) +{ + uint8_t const attr = m_fg_videoram[tile_index]; + int const num = m_fg_videoram[tile_index + 0x400] + ((attr & 0xc0) << 2) + ((attr & 0x20) << 5) + ((m_charbank[0] & 2) << 10); + tileinfo.set(0, + num, + 0, + TILE_FLIPYX((attr & 0x30) >> 4)); +} + +TILE_GET_INFO_MEMBER(ddribble_state::get_bg_tile_info) +{ + uint8_t const attr = m_bg_videoram[tile_index]; + int const num = m_bg_videoram[tile_index + 0x400] + ((attr & 0xc0) << 2) + ((attr & 0x20) << 5) + (m_charbank[1] << 11); + tileinfo.set(1, + num, + 0, + TILE_FLIPYX((attr & 0x30) >> 4)); +} + +/*************************************************************************** + + Start the video hardware emulation. +***************************************************************************/ + +void ddribble_state::video_start() +{ + m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(ddribble_state::get_fg_tile_info)), tilemap_mapper_delegate(*this, FUNC(ddribble_state::tilemap_scan)), 8, 8, 64, 32); + m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(ddribble_state::get_bg_tile_info)), tilemap_mapper_delegate(*this, FUNC(ddribble_state::tilemap_scan)), 8, 8, 64, 32); + + m_fg_tilemap->set_transparent_pen(0); +} + +/*************************************************************************** + + Memory handlers + +***************************************************************************/ + +void ddribble_state::fg_videoram_w(offs_t offset, uint8_t data) +{ + m_fg_videoram[offset] = data; + m_fg_tilemap->mark_tile_dirty(offset & 0xbff); +} + +void ddribble_state::bg_videoram_w(offs_t offset, uint8_t data) +{ + m_bg_videoram[offset] = data; + m_bg_tilemap->mark_tile_dirty(offset & 0xbff); +} + +/*************************************************************************** + + Double Dribble sprites + +Each sprite has 5 bytes: +byte #0: sprite number +byte #1: + bits 0..2: sprite bank # + bit 3: not used? + bits 4..7: sprite color +byte #2: y position +byte #3: x position +byte #4: attributes + bit 0: x position (high bit) + bit 1: ??? + bits 2..4: sprite size + bit 5: flip x + bit 6: flip y + bit 7: unused? + +***************************************************************************/ + +void ddribble_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, uint8_t* source, int lenght, int gfxset, int flipscreen) +{ + gfx_element *gfx = m_gfxdecode->gfx(gfxset); + const uint8_t *finish = source + lenght; + + while (source < finish) + { + int number = source[0] | ((source[1] & 0x07) << 8); // sprite number + int const attr = source[4]; // attributes + int sx = source[3] | ((attr & 0x01) << 8); // vertical position + int sy = source[2]; // horizontal position + int flipx = attr & 0x20; // flip x + int flipy = attr & 0x40; // flip y + int const color = (source[1] & 0xf0) >> 4; // color + int width, height; + + if (flipscreen) + { + flipx = !flipx; + flipy = !flipy; + sx = 240 - sx; + sy = 240 - sy; + + if ((attr & 0x1c) == 0x10) + { // ???. needed for some sprites in flipped mode + sx -= 0x10; + sy -= 0x10; + } + } + + switch (attr & 0x1c) + { + case 0x10: // 32x32 + width = height = 2; number &= (~3); break; + case 0x08: // 16x32 + width = 1; height = 2; number &= (~2); break; + case 0x04: // 32x16 + width = 2; height = 1; number &= (~1); break; + // the hardware allows more sprite sizes, but ddribble doesn't use them + default: // 16x16 + width = height = 1; break; + } + + { + static const int x_offset[2] = { 0x00, 0x01 }; + static const int y_offset[2] = { 0x00, 0x02 }; + + for (int y = 0; y < height; y++) + { + for (int x = 0; x < width; x++) + { + int const ex = flipx ? (width - 1 - x) : x; + int const ey = flipy ? (height - 1 - y) : y; + + + gfx->transpen(bitmap, cliprect, + (number) + x_offset[ex] + y_offset[ey], + color, + flipx, flipy, + sx + x * 16, sy + y * 16, 0); + } + } + } + source += 5; + } +} + +/*************************************************************************** + + Display Refresh + +***************************************************************************/ + +uint32_t ddribble_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_fg_tilemap->set_flip((m_vregs[0][4] & 0x08) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); + m_bg_tilemap->set_flip((m_vregs[1][4] & 0x08) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); + + // set scroll registers + m_fg_tilemap->set_scrollx(0, m_vregs[0][1] | ((m_vregs[0][2] & 0x01) << 8)); + m_bg_tilemap->set_scrollx(0, m_vregs[1][1] | ((m_vregs[1][2] & 0x01) << 8)); + m_fg_tilemap->set_scrolly(0, m_vregs[0][0]); + m_bg_tilemap->set_scrolly(0, m_vregs[1][0]); + + m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + draw_sprites(bitmap, cliprect, m_spriteram[0], 0x07d, 2, m_vregs[0][4] & 0x08); + draw_sprites(bitmap, cliprect, m_spriteram[1], 0x140, 3, m_vregs[1][4] & 0x08); + m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + return 0; +} + + +// machine WRITE_LINE_MEMBER(ddribble_state::vblank_irq) { @@ -89,8 +383,8 @@ void ddribble_state::vlm5030_ctrl_w(uint8_t data) void ddribble_state::maincpu_map(address_map &map) { - map(0x0000, 0x0004).w(FUNC(ddribble_state::K005885_0_w)); // video registers (005885 #1) - map(0x0800, 0x0804).w(FUNC(ddribble_state::K005885_1_w)); // video registers (005885 #2) + map(0x0000, 0x0004).w(FUNC(ddribble_state::k005885_w<0>)); // video registers (005885 #1) + map(0x0800, 0x0804).w(FUNC(ddribble_state::k005885_w<1>)); // video registers (005885 #2) map(0x1800, 0x187f).ram().w("palette", FUNC(palette_device::write_indirect)).share("palette"); map(0x2000, 0x2fff).ram().w(FUNC(ddribble_state::fg_videoram_w)).share(m_fg_videoram); // Video RAM 1 map(0x3000, 0x3fff).ram().share(m_spriteram[0]); // Object RAM 1 @@ -238,13 +532,13 @@ void ddribble_state::machine_reset() void ddribble_state::ddribble(machine_config &config) { // basic machine hardware - MC6809E(config, m_maincpu, XTAL(18'432'000)/12); // verified on pcb + MC6809E(config, m_maincpu, XTAL(18'432'000) / 12); // verified on PCB m_maincpu->set_addrmap(AS_PROGRAM, &ddribble_state::maincpu_map); - MC6809E(config, m_subcpu, XTAL(18'432'000)/12); // verified on pcb + MC6809E(config, m_subcpu, XTAL(18'432'000) / 12); // verified on PCB m_subcpu->set_addrmap(AS_PROGRAM, &ddribble_state::subcpu_map); - mc6809e_device &audiocpu(MC6809E(config, "audiocpu", XTAL(18'432'000)/12)); // verified on pcb + mc6809e_device &audiocpu(MC6809E(config, "audiocpu", XTAL(18'432'000) / 12)); // verified on PCB audiocpu.set_addrmap(AS_PROGRAM, &ddribble_state::audiocpu_map); config.set_maximum_quantum(attotime::from_hz(6000)); // we need heavy synch @@ -269,7 +563,7 @@ void ddribble_state::ddribble(machine_config &config) // sound hardware SPEAKER(config, "mono").front_center(); - ym2203_device &ymsnd(YM2203(config, "ymsnd", XTAL(3'579'545))); // verified on pcb + ym2203_device &ymsnd(YM2203(config, "ymsnd", XTAL(3'579'545))); // verified on PCB ymsnd.port_b_read_callback().set(FUNC(ddribble_state::vlm5030_busy_r)); ymsnd.port_a_write_callback().set(FUNC(ddribble_state::vlm5030_ctrl_w)); ymsnd.add_route(0, "filter1", 0.25); @@ -277,7 +571,7 @@ void ddribble_state::ddribble(machine_config &config) ymsnd.add_route(2, "filter3", 0.25); ymsnd.add_route(3, "mono", 0.25); - VLM5030(config, m_vlm, XTAL(3'579'545)); // verified on pcb + VLM5030(config, m_vlm, XTAL(3'579'545)); // verified on PCB m_vlm->add_route(ALL_OUTPUTS, "mono", 1.0); m_vlm->set_addrmap(0, &ddribble_state::vlm_map); @@ -312,7 +606,7 @@ ROM_START( ddribble ) ROM_REGION( 0x0100, "proms", 0 ) ROM_LOAD( "690a11.i15", 0x0000, 0x0100, CRC(f34617ad) SHA1(79ceba6fe204472a5a659641ac4f14bb1f0ee3f6) ) // sprite lookup table - ROM_REGION( 0x20000, "vlm", 0 ) // 128k for the VLM5030 data + ROM_REGION( 0x20000, "vlm", 0 ) ROM_LOAD( "690a04.bin", 0x00000, 0x20000, CRC(1bfeb763) SHA1(f3e9acb2a7a9b4c8dee6838c1344a7a65c27ff77) ) ROM_REGION( 0x0100, "plds", 0 ) @@ -348,10 +642,13 @@ ROM_START( ddribblep ) ROM_REGION( 0x0100, "proms", 0 ) ROM_LOAD( "6301-1.i15", 0x0000, 0x0100, CRC(f34617ad) SHA1(79ceba6fe204472a5a659641ac4f14bb1f0ee3f6) ) // sprite lookup table - ROM_REGION( 0x20000, "vlm", 0 ) // same content as parent, 128k for the VLM5030 data + ROM_REGION( 0x20000, "vlm", 0 ) // same content as parent ROM_LOAD( "voice_00.e7", 0x00000, 0x10000, CRC(8bd0fcf7) SHA1(d55644f8b33eff6f960725f00ba842e0253e3b36) ) ROM_LOAD( "voice_10.d7", 0x10000, 0x10000, CRC(b4c97494) SHA1(93f7c3c93f6f790c3f480e183da0105b5ac3593b) ) ROM_END -GAME( 1986, ddribble, 0, ddribble, ddribble, ddribble_state, empty_init, ROT0, "Konami", "Double Dribble", MACHINE_SUPPORTS_SAVE ) +} // anonymous namespace + + +GAME( 1986, ddribble, 0, ddribble, ddribble, ddribble_state, empty_init, ROT0, "Konami", "Double Dribble", MACHINE_SUPPORTS_SAVE ) GAME( 1986, ddribblep, ddribble, ddribble, ddribble, ddribble_state, empty_init, ROT0, "Konami", "Double Dribble (prototype?)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/konami/ddribble.h b/src/mame/konami/ddribble.h deleted file mode 100644 index 5f4d256ac2d..00000000000 --- a/src/mame/konami/ddribble.h +++ /dev/null @@ -1,87 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Manuel Abadia -/*************************************************************************** - - Double Dribble - -***************************************************************************/ -#ifndef MAME_INCLUDES_DDRIBBLE_H -#define MAME_INCLUDES_DDRIBBLE_H - -#pragma once - -#include "sound/flt_rc.h" -#include "sound/vlm5030.h" -#include "emupal.h" -#include "tilemap.h" - -class ddribble_state : public driver_device -{ -public: - ddribble_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_fg_videoram(*this, "fg_videoram"), - m_spriteram(*this, "spriteram_%u", 1U), - m_bg_videoram(*this, "bg_videoram"), - m_mainbank(*this, "mainbank"), - m_vlmbank(*this, "vlmbank"), - m_maincpu(*this, "maincpu"), - m_subcpu(*this, "subcpu"), - m_vlm(*this, "vlm"), - m_filter(*this, "filter%u", 1U), - m_gfxdecode(*this, "gfxdecode") - { } - - void ddribble(machine_config &config); - -protected: - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; - -private: - // memory pointers - required_shared_ptr m_fg_videoram; - required_shared_ptr_array m_spriteram; - required_shared_ptr m_bg_videoram; - required_memory_bank m_mainbank; - required_memory_bank m_vlmbank; - - // video-related - tilemap_t *m_fg_tilemap = nullptr; - tilemap_t *m_bg_tilemap = nullptr; - uint8_t m_vregs[2][5]{}; - uint8_t m_charbank[2]{}; - - // misc - uint8_t m_int_enable[2]{}; - - // devices - required_device m_maincpu; - required_device m_subcpu; - required_device m_vlm; - required_device_array m_filter; - required_device m_gfxdecode; - - void bankswitch_w(uint8_t data); - void coin_counter_w(uint8_t data); - void K005885_0_w(offs_t offset, uint8_t data); - void K005885_1_w(offs_t offset, uint8_t data); - void fg_videoram_w(offs_t offset, uint8_t data); - void bg_videoram_w(offs_t offset, uint8_t data); - uint8_t vlm5030_busy_r(); - void vlm5030_ctrl_w(uint8_t data); - TILEMAP_MAPPER_MEMBER(tilemap_scan); - TILE_GET_INFO_MEMBER(get_fg_tile_info); - TILE_GET_INFO_MEMBER(get_bg_tile_info); - void palette(palette_device &palette) const; - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_WRITE_LINE_MEMBER(vblank_irq); - void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, uint8_t* source, int lenght, int gfxset, int flipscreen); - void maincpu_map(address_map &map); - void subcpu_map(address_map &map); - void audiocpu_map(address_map &map); - void vlm_map(address_map &map); -}; - -#endif // MAME_INCLUDES_DDRIBBLE_H diff --git a/src/mame/konami/ddribble_v.cpp b/src/mame/konami/ddribble_v.cpp deleted file mode 100644 index 76d4ff24f29..00000000000 --- a/src/mame/konami/ddribble_v.cpp +++ /dev/null @@ -1,242 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Manuel Abadia -/*************************************************************************** - - ddribble.cpp - - Functions to emulate the video hardware of the machine. - -***************************************************************************/ - -#include "emu.h" -#include "ddribble.h" - - -void ddribble_state::palette(palette_device &palette) const -{ - uint8_t const *const color_prom = memregion("proms")->base(); - - for (int i = 0x10; i < 0x40; i++) - palette.set_pen_indirect(i, i); - - // sprite #2 uses pens 0x00-0x0f - for (int i = 0x0; i < 0x100; i++) - { - uint8_t const ctabentry = color_prom[i] & 0x0f; - palette.set_pen_indirect(i + 0x40, ctabentry); - } -} - - -void ddribble_state::K005885_0_w(offs_t offset, uint8_t data) -{ - switch (offset) - { - case 0x03: // char bank selection for set 1 - if ((data & 0x03) != m_charbank[0]) - { - m_charbank[0] = data & 0x03; - m_fg_tilemap->mark_all_dirty(); - } - break; - case 0x04: // IRQ control, flipscreen - m_int_enable[0] = data & 0x02; - break; - } - m_vregs[0][offset] = data; -} - -void ddribble_state::K005885_1_w(offs_t offset, uint8_t data) -{ - switch (offset) - { - case 0x03: // char bank selection for set 2 - if ((data & 0x03) != m_charbank[1]) - { - m_charbank[1] = data & 0x03; - m_bg_tilemap->mark_all_dirty(); - } - break; - case 0x04: // IRQ control, flipscreen - m_int_enable[1] = data & 0x02; - break; - } - m_vregs[1][offset] = data; -} - -/*************************************************************************** - - Callbacks for the TileMap code - -***************************************************************************/ - -TILEMAP_MAPPER_MEMBER(ddribble_state::tilemap_scan) -{ - // logical (col,row) -> memory offset - return (col & 0x1f) + ((row & 0x1f) << 5) + ((col & 0x20) << 6); // skip 0x400 -} - -TILE_GET_INFO_MEMBER(ddribble_state::get_fg_tile_info) -{ - uint8_t attr = m_fg_videoram[tile_index]; - int num = m_fg_videoram[tile_index + 0x400] + ((attr & 0xc0) << 2) + ((attr & 0x20) << 5) + ((m_charbank[0] & 2) << 10); - tileinfo.set(0, - num, - 0, - TILE_FLIPYX((attr & 0x30) >> 4)); -} - -TILE_GET_INFO_MEMBER(ddribble_state::get_bg_tile_info) -{ - uint8_t attr = m_bg_videoram[tile_index]; - int num = m_bg_videoram[tile_index + 0x400] + ((attr & 0xc0) << 2) + ((attr & 0x20) << 5) + (m_charbank[1] << 11); - tileinfo.set(1, - num, - 0, - TILE_FLIPYX((attr & 0x30) >> 4)); -} - -/*************************************************************************** - - Start the video hardware emulation. - -***************************************************************************/ - -void ddribble_state::video_start() -{ - m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(ddribble_state::get_fg_tile_info)), tilemap_mapper_delegate(*this, FUNC(ddribble_state::tilemap_scan)), 8, 8, 64, 32); - m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(ddribble_state::get_bg_tile_info)), tilemap_mapper_delegate(*this, FUNC(ddribble_state::tilemap_scan)), 8, 8, 64, 32); - - m_fg_tilemap->set_transparent_pen(0); -} - -/*************************************************************************** - - Memory handlers - -***************************************************************************/ - -void ddribble_state::fg_videoram_w(offs_t offset, uint8_t data) -{ - m_fg_videoram[offset] = data; - m_fg_tilemap->mark_tile_dirty(offset & 0xbff); -} - -void ddribble_state::bg_videoram_w(offs_t offset, uint8_t data) -{ - m_bg_videoram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset & 0xbff); -} - -/*************************************************************************** - - Double Dribble sprites - -Each sprite has 5 bytes: -byte #0: sprite number -byte #1: - bits 0..2: sprite bank # - bit 3: not used? - bits 4..7: sprite color -byte #2: y position -byte #3: x position -byte #4: attributes - bit 0: x position (high bit) - bit 1: ??? - bits 2..4: sprite size - bit 5: flip x - bit 6: flip y - bit 7: unused? - -***************************************************************************/ - -void ddribble_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, uint8_t* source, int lenght, int gfxset, int flipscreen) -{ - gfx_element *gfx = m_gfxdecode->gfx(gfxset); - const uint8_t *finish = source + lenght; - - while (source < finish) - { - int number = source[0] | ((source[1] & 0x07) << 8); // sprite number - int attr = source[4]; // attributes - int sx = source[3] | ((attr & 0x01) << 8); // vertical position - int sy = source[2]; // horizontal position - int flipx = attr & 0x20; // flip x - int flipy = attr & 0x40; // flip y - int color = (source[1] & 0xf0) >> 4; // color - int width, height; - - if (flipscreen) - { - flipx = !flipx; - flipy = !flipy; - sx = 240 - sx; - sy = 240 - sy; - - if ((attr & 0x1c) == 0x10) - { // ???. needed for some sprites in flipped mode - sx -= 0x10; - sy -= 0x10; - } - } - - switch (attr & 0x1c) - { - case 0x10: // 32x32 - width = height = 2; number &= (~3); break; - case 0x08: // 16x32 - width = 1; height = 2; number &= (~2); break; - case 0x04: // 32x16 - width = 2; height = 1; number &= (~1); break; - // the hardware allows more sprite sizes, but ddribble doesn't use them - default: // 16x16 - width = height = 1; break; - } - - { - static const int x_offset[2] = { 0x00, 0x01 }; - static const int y_offset[2] = { 0x00, 0x02 }; - - for (int y = 0; y < height; y++) - { - for (int x = 0; x < width; x++) - { - int ex = flipx ? (width - 1 - x) : x; - int ey = flipy ? (height - 1 - y) : y; - - - gfx->transpen(bitmap, cliprect, - (number) + x_offset[ex] + y_offset[ey], - color, - flipx, flipy, - sx + x * 16, sy + y * 16, 0); - } - } - } - source += 5; - } -} - -/*************************************************************************** - - Display Refresh - -***************************************************************************/ - -uint32_t ddribble_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_fg_tilemap->set_flip((m_vregs[0][4] & 0x08) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); - m_bg_tilemap->set_flip((m_vregs[1][4] & 0x08) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); - - // set scroll registers - m_fg_tilemap->set_scrollx(0, m_vregs[0][1] | ((m_vregs[0][2] & 0x01) << 8)); - m_bg_tilemap->set_scrollx(0, m_vregs[1][1] | ((m_vregs[1][2] & 0x01) << 8)); - m_fg_tilemap->set_scrolly(0, m_vregs[0][0]); - m_bg_tilemap->set_scrolly(0, m_vregs[1][0]); - - m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - draw_sprites(bitmap, cliprect, m_spriteram[0], 0x07d, 2, m_vregs[0][4] & 0x08); - draw_sprites(bitmap, cliprect, m_spriteram[1], 0x140, 3, m_vregs[1][4] & 0x08); - m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - return 0; -} diff --git a/src/mame/konami/divebomb.cpp b/src/mame/konami/divebomb.cpp index 6a4caa7f7f0..5acb10759bf 100644 --- a/src/mame/konami/divebomb.cpp +++ b/src/mame/konami/divebomb.cpp @@ -1,5 +1,6 @@ // license:BSD-3-Clause -// copyright-holders:David Haywood, Phil Bennett +// copyright-holders: David Haywood, Phil Bennett + /*************************************************************************** Kyuukoukabakugekitai - Dive Bomber Squad @@ -42,7 +43,7 @@ |--------------------------------------------------------------------------| Notes: - There are numerous wire modificationss connecting pins of U15-U18 to + There are numerous wire modifications connecting pins of U15-U18 to various other components on the PCB MB81C86 - 64kx4 SRAM @@ -91,27 +92,300 @@ To verify against original HW: ****************************************************************************/ #include "emu.h" -#include "divebomb.h" + +#include "cpu/z80/z80.h" +#include "machine/gen_latch.h" +#include "machine/input_merger.h" +#include "sound/sn76496.h" +#include "video/k051316.h" +#include "video/resnet.h" + +#include "emupal.h" #include "screen.h" #include "speaker.h" +#include "tilemap.h" + + +// configurable logging +#define LOG_ROZ (1U << 1) + +//#define VERBOSE (LOG_GENERAL | LOG_ROZ) + +#include "logmacro.h" + +#define LOGROZ(...) LOGMASKED(LOG_ROZ, __VA_ARGS__) + + +namespace { + +class divebomb_state : public driver_device +{ +public: + divebomb_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_spritecpu(*this, "spritecpu") + , m_fgcpu(*this, "fgcpu") + , m_rozcpu(*this, "rozcpu") + , m_gfxdecode(*this, "gfxdecode") + , m_palette(*this, "palette") + , m_k051316(*this, "k051316_%u", 1) + , m_fgcpu_irq(*this, "fgcpu_irq") + , m_spr2fg_latch(*this, "spr2fg") + , m_roz2fg_latch(*this, "roz2fg") + , m_rozbank(*this, "rozbank") + , m_fgram(*this, "fgram") + , m_spriteram(*this, "spriteram") + { + } + + void divebomb(machine_config &config); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + +private: + required_device m_spritecpu; + required_device m_fgcpu; + required_device m_rozcpu; + required_device m_gfxdecode; + required_device m_palette; + required_device_array m_k051316; + required_device m_fgcpu_irq; + required_device m_spr2fg_latch; + required_device m_roz2fg_latch; + + required_memory_bank m_rozbank; + required_shared_ptr m_fgram; + required_shared_ptr m_spriteram; + + tilemap_t *m_fg_tilemap = nullptr; + + uint8_t m_roz_pal = 0; + bool m_roz_enable[2]{}; + + void palette(palette_device &palette) const; + + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); + static void decode_proms(palette_device &palette, const uint8_t* rgn, int size, int index, bool inv); + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + K051316_CB_MEMBER(zoom_callback_1); + K051316_CB_MEMBER(zoom_callback_2); + + TILE_GET_INFO_MEMBER(get_fg_tile_info); + + uint8_t fgcpu_comm_flags_r(); + void fgram_w(offs_t offset, uint8_t data); + + void spritecpu_port00_w(uint8_t data); + + void rozcpu_bank_w(uint8_t data); + template void rozcpu_wrap_enable_w(uint8_t data); + template void rozcpu_enable_w(uint8_t data); + void rozcpu_pal_w(uint8_t data); + void fgcpu_iomap(address_map &map); + void fgcpu_map(address_map &map); + void rozcpu_iomap(address_map &map); + void rozcpu_map(address_map &map); + void spritecpu_iomap(address_map &map); + void spritecpu_map(address_map &map); +}; + + +// video + +/************************************* + * + * Tilemap callbacks + * + *************************************/ + +TILE_GET_INFO_MEMBER(divebomb_state::get_fg_tile_info) +{ + uint32_t code = m_fgram[tile_index + 0x000]; + uint32_t attr = m_fgram[tile_index + 0x400]; + uint32_t colour = attr >> 4; + + code |= (attr & 0x3) << 8; + + tileinfo.set(0, code, colour, 0); +} + + + +/************************************* + * + * K051316 callbacks + * + *************************************/ + +K051316_CB_MEMBER(divebomb_state::zoom_callback_1) +{ + *code |= (*color & 0x03) << 8; + *color = 0 + ((m_roz_pal >> 4) & 3); +} + + +K051316_CB_MEMBER(divebomb_state::zoom_callback_2) +{ + *code |= (*color & 0x03) << 8; + *color = 4 + (m_roz_pal & 3); +} + + + +/************************************* + * + * Video hardware handlers + * + *************************************/ + +void divebomb_state::fgram_w(offs_t offset, uint8_t data) +{ + m_fgram[offset] = data; + m_fg_tilemap->mark_tile_dirty(offset & 0x3ff); +} + + +void divebomb_state::rozcpu_pal_w(uint8_t data) +{ + //.... ..xx K051316 1 palette select + //..xx .... K051316 2 palette select + + uint8_t old_pal = m_roz_pal; + m_roz_pal = data; + + if ((old_pal & 0x03) != (data & 0x03)) + m_k051316[1]->mark_tmap_dirty(); + + if ((old_pal & 0x30) != (data & 0x30)) + m_k051316[0]->mark_tmap_dirty(); + + if (data & 0xcc) + LOGROZ("rozcpu_port50_w %02x\n", data); +} + + + +/************************************* + * + * Video hardware init + * + *************************************/ + +void divebomb_state::decode_proms(palette_device &palette, const uint8_t * rgn, int size, int index, bool inv) +{ + static constexpr int resistances[4] = { 2000, 1000, 470, 220 }; + + // compute the color output resistor weights + double rweights[4], gweights[4], bweights[4]; + compute_resistor_weights(0, 255, -1.0, + 4, resistances, rweights, 0, 0, + 4, resistances, gweights, 0, 0, + 4, resistances, bweights, 0, 0); + + // create a lookup table for the palette + for (uint32_t i = 0; i < size; ++i) + { + uint32_t const rdata = rgn[i + size*2] & 0x0f; + uint32_t const r = combine_weights(rweights, BIT(rdata, 0), BIT(rdata, 1), BIT(rdata, 2), BIT(rdata, 3)); + + uint32_t const gdata = rgn[i + size] & 0x0f; + uint32_t const g = combine_weights(gweights, BIT(gdata, 0), BIT(gdata, 1), BIT(gdata, 2), BIT(gdata, 3)); + + uint32_t const bdata = rgn[i] & 0x0f; + uint32_t const b = combine_weights(bweights, BIT(bdata, 0), BIT(bdata, 1), BIT(bdata, 2), BIT(bdata, 3)); + + if (!inv) + palette.set_pen_color(index + i, rgb_t(r, g, b)); + else + palette.set_pen_color(index + (i ^ 0xff), rgb_t(r, g, b)); + } +} + + +void divebomb_state::palette(palette_device &palette) const +{ + decode_proms(palette, memregion("spr_proms")->base(), 0x100, 0x400 + 0x400 + 0x400, false); + decode_proms(palette, memregion("fg_proms")->base(), 0x400, 0x400 + 0x400, false); + decode_proms(palette, memregion("k051316_1_pr")->base(), 0x400, 0, true); + decode_proms(palette, memregion("k051316_2_pr")->base(), 0x400, 0x400, true); +} + + +void divebomb_state::video_start() +{ + m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(divebomb_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); + m_fg_tilemap->set_transparent_pen(0); + m_fg_tilemap->set_scrolly(0, 16); +} +/************************************* + * + * Main update + * + *************************************/ + +void divebomb_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + for (uint32_t i = 0; i < m_spriteram.bytes(); i += 4) + { + uint32_t const sy = m_spriteram[i + 3]; + uint32_t const sx = m_spriteram[i + 0]; + uint32_t code = m_spriteram[i + 2]; + uint32_t const attr = m_spriteram[i + 1]; + + code += (attr & 0x0f) << 8; + + uint32_t const colour = attr >> 4; + + m_gfxdecode->gfx(1)->transpen(bitmap, cliprect, code, colour, 0, 0, sx, sy, 0); + m_gfxdecode->gfx(1)->transpen(bitmap, cliprect, code, colour, 0, 0, sx, sy - 256, 0); + } +} + + +uint32_t divebomb_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + bitmap.fill(m_palette->black_pen(), cliprect); + + for (int chip = 1; chip >= 0; chip--) + { + if (m_roz_enable[chip]) + { + m_k051316[chip]->zoom_draw(screen, bitmap, cliprect, 0, 0); + } + } + + draw_sprites(bitmap, cliprect); + + m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + + return 0; +} + + +// machine + /************************************* * * Main CPU * *************************************/ -void divebomb_state::divebomb_fgcpu_map(address_map &map) +void divebomb_state::fgcpu_map(address_map &map) { map(0x0000, 0x7fff).rom(); - map(0xc000, 0xc7ff).ram().w(FUNC(divebomb_state::fgram_w)).share("fgram"); + map(0xc000, 0xc7ff).ram().w(FUNC(divebomb_state::fgram_w)).share(m_fgram); map(0xe000, 0xffff).ram(); } -void divebomb_state::divebomb_fgcpu_iomap(address_map &map) +void divebomb_state::fgcpu_iomap(address_map &map) { map.global_mask(0xff); map(0x00, 0x00).w("sn0", FUNC(sn76489_device::write)); @@ -153,16 +427,16 @@ uint8_t divebomb_state::fgcpu_comm_flags_r() * *************************************/ -void divebomb_state::divebomb_spritecpu_map(address_map &map) +void divebomb_state::spritecpu_map(address_map &map) { map(0x0000, 0x7fff).rom(); - map(0xc000, 0xc7ff).ram().share("spriteram"); + map(0xc000, 0xc7ff).ram().share(m_spriteram); map(0xc800, 0xdfff).nopw(); map(0xe000, 0xffff).ram(); } -void divebomb_state::divebomb_spritecpu_iomap(address_map &map) +void divebomb_state::spritecpu_iomap(address_map &map) { map.global_mask(0xff); map(0x00, 0x00).w(FUNC(divebomb_state::spritecpu_port00_w)); @@ -197,17 +471,17 @@ void divebomb_state::rozcpu_enable_w(uint8_t data) } -void divebomb_state::divebomb_rozcpu_map(address_map &map) +void divebomb_state::rozcpu_map(address_map &map) { map(0x0000, 0x7fff).rom(); - map(0x8000, 0xbfff).bankr("rozbank"); + map(0x8000, 0xbfff).bankr(m_rozbank); map(0xc000, 0xc7ff).ram().rw(m_k051316[0], FUNC(k051316_device::read), FUNC(k051316_device::write)); map(0xd000, 0xd7ff).ram().rw(m_k051316[1], FUNC(k051316_device::read), FUNC(k051316_device::write)); map(0xe000, 0xffff).ram(); } -void divebomb_state::divebomb_rozcpu_iomap(address_map &map) +void divebomb_state::rozcpu_iomap(address_map &map) { map.global_mask(0xff); map(0x00, 0x00).w(FUNC(divebomb_state::rozcpu_bank_w)); @@ -228,7 +502,7 @@ void divebomb_state::rozcpu_bank_w(uint8_t data) m_rozbank->set_entry(bank); if (data & 0x0f) - logerror("rozcpu_bank_w %02x\n", data); + LOGROZ("rozcpu_bank_w %02x\n", data); } @@ -388,17 +662,19 @@ GFXDECODE_END void divebomb_state::divebomb(machine_config &config) { - Z80(config, m_fgcpu, XTAL1/4); // ? - m_fgcpu->set_addrmap(AS_PROGRAM, &divebomb_state::divebomb_fgcpu_map); - m_fgcpu->set_addrmap(AS_IO, &divebomb_state::divebomb_fgcpu_iomap); + static constexpr XTAL XTAL1 = XTAL(24'000'000); + + Z80(config, m_fgcpu, XTAL1 / 4); // ? + m_fgcpu->set_addrmap(AS_PROGRAM, &divebomb_state::fgcpu_map); + m_fgcpu->set_addrmap(AS_IO, &divebomb_state::fgcpu_iomap); - Z80(config, m_spritecpu, XTAL1/4); // ? - m_spritecpu->set_addrmap(AS_PROGRAM, &divebomb_state::divebomb_spritecpu_map); - m_spritecpu->set_addrmap(AS_IO, &divebomb_state::divebomb_spritecpu_iomap); + Z80(config, m_spritecpu, XTAL1 / 4); // ? + m_spritecpu->set_addrmap(AS_PROGRAM, &divebomb_state::spritecpu_map); + m_spritecpu->set_addrmap(AS_IO, &divebomb_state::spritecpu_iomap); - Z80(config, m_rozcpu, XTAL1/4); // ? - m_rozcpu->set_addrmap(AS_PROGRAM, &divebomb_state::divebomb_rozcpu_map); - m_rozcpu->set_addrmap(AS_IO, &divebomb_state::divebomb_rozcpu_iomap); + Z80(config, m_rozcpu, XTAL1 / 4); // ? + m_rozcpu->set_addrmap(AS_PROGRAM, &divebomb_state::rozcpu_map); + m_rozcpu->set_addrmap(AS_IO, &divebomb_state::rozcpu_iomap); config.set_perfect_quantum(m_fgcpu); @@ -428,31 +704,31 @@ void divebomb_state::divebomb(machine_config &config) m_k051316[1]->set_offsets(-88, -16); m_k051316[1]->set_zoom_callback(FUNC(divebomb_state::zoom_callback_2)); - /* 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(0)); screen.set_size(256, 256); screen.set_visarea(0, 256-1, 0, 256-1-32); - screen.set_screen_update(FUNC(divebomb_state::screen_update_divebomb)); + screen.set_screen_update(FUNC(divebomb_state::screen_update)); screen.set_palette(m_palette); screen.screen_vblank().set_inputline(m_fgcpu, INPUT_LINE_NMI); screen.screen_vblank().append_inputline(m_spritecpu, INPUT_LINE_NMI); screen.screen_vblank().append_inputline(m_rozcpu, INPUT_LINE_NMI); GFXDECODE(config, m_gfxdecode, m_palette, gfx_divebomb); - PALETTE(config, m_palette, FUNC(divebomb_state::divebomb_palette), 0x400+0x400+0x400+0x100); + PALETTE(config, m_palette, FUNC(divebomb_state::palette), 0x400 + 0x400 + 0x400 + 0x100); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); // All frequencies unverified - SN76489(config, "sn0", XTAL1/8).add_route(ALL_OUTPUTS, "mono", 0.15); - SN76489(config, "sn1", XTAL1/8).add_route(ALL_OUTPUTS, "mono", 0.15); - SN76489(config, "sn2", XTAL1/8).add_route(ALL_OUTPUTS, "mono", 0.15); - SN76489(config, "sn3", XTAL1/8).add_route(ALL_OUTPUTS, "mono", 0.15); - SN76489(config, "sn4", XTAL1/8).add_route(ALL_OUTPUTS, "mono", 0.15); - SN76489(config, "sn5", XTAL1/8).add_route(ALL_OUTPUTS, "mono", 0.15); + SN76489(config, "sn0", XTAL1 / 8).add_route(ALL_OUTPUTS, "mono", 0.15); + SN76489(config, "sn1", XTAL1 / 8).add_route(ALL_OUTPUTS, "mono", 0.15); + SN76489(config, "sn2", XTAL1 / 8).add_route(ALL_OUTPUTS, "mono", 0.15); + SN76489(config, "sn3", XTAL1 / 8).add_route(ALL_OUTPUTS, "mono", 0.15); + SN76489(config, "sn4", XTAL1 / 8).add_route(ALL_OUTPUTS, "mono", 0.15); + SN76489(config, "sn5", XTAL1 / 8).add_route(ALL_OUTPUTS, "mono", 0.15); } @@ -553,7 +829,7 @@ void divebomb_state::machine_reset() m_fgcpu_irq->in_w<1>(CLEAR_LINE); } - +} // anonymous namespace /************************************* * diff --git a/src/mame/konami/divebomb.h b/src/mame/konami/divebomb.h deleted file mode 100644 index db356ef63e3..00000000000 --- a/src/mame/konami/divebomb.h +++ /dev/null @@ -1,98 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:David Haywood, Phil Bennett -/************************************************************************* - - Kyuukoukabakugekitai - Dive Bomber Squad - -*************************************************************************/ -#ifndef MAME_INCLUDES_DIVEBOMB_H -#define MAME_INCLUDES_DIVEBOMB_H - -#pragma once - - -#include "cpu/z80/z80.h" -#include "machine/gen_latch.h" -#include "machine/input_merger.h" -#include "sound/sn76496.h" -#include "video/k051316.h" -#include "emupal.h" -#include "tilemap.h" - -#define XTAL1 XTAL(24'000'000) - -class divebomb_state : public driver_device -{ -public: - divebomb_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_spritecpu(*this, "spritecpu") - , m_fgcpu(*this, "fgcpu") - , m_rozcpu(*this, "rozcpu") - , m_rozbank(*this, "rozbank") - , m_fgram(*this, "fgram") - , m_spriteram(*this, "spriteram") - , m_gfxdecode(*this, "gfxdecode") - , m_palette(*this, "palette") - , m_k051316(*this, "k051316_%u", 1) - , m_fgcpu_irq(*this, "fgcpu_irq") - , m_spr2fg_latch(*this, "spr2fg") - , m_roz2fg_latch(*this, "roz2fg") - { - } - - void divebomb(machine_config &config); - -protected: - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; - -private: - required_device m_spritecpu; - required_device m_fgcpu; - required_device m_rozcpu; - required_memory_bank m_rozbank; - required_shared_ptr m_fgram; - required_shared_ptr m_spriteram; - required_device m_gfxdecode; - required_device m_palette; - required_device_array m_k051316; - required_device m_fgcpu_irq; - required_device m_spr2fg_latch; - required_device m_roz2fg_latch; - - tilemap_t *m_fg_tilemap = nullptr; - - uint8_t m_roz_pal = 0; - bool m_roz_enable[2]{}; - - void divebomb_palette(palette_device &palette) const; - - void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); - static void decode_proms(palette_device &palette, const uint8_t* rgn, int size, int index, bool inv); - uint32_t screen_update_divebomb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - K051316_CB_MEMBER(zoom_callback_1); - K051316_CB_MEMBER(zoom_callback_2); - - TILE_GET_INFO_MEMBER(get_fg_tile_info); - - uint8_t fgcpu_comm_flags_r(); - void fgram_w(offs_t offset, uint8_t data); - - void spritecpu_port00_w(uint8_t data); - - void rozcpu_bank_w(uint8_t data); - template void rozcpu_wrap_enable_w(uint8_t data); - template void rozcpu_enable_w(uint8_t data); - void rozcpu_pal_w(uint8_t data); - void divebomb_fgcpu_iomap(address_map &map); - void divebomb_fgcpu_map(address_map &map); - void divebomb_rozcpu_iomap(address_map &map); - void divebomb_rozcpu_map(address_map &map); - void divebomb_spritecpu_iomap(address_map &map); - void divebomb_spritecpu_map(address_map &map); -}; - -#endif // MAME_INCLUDES_DIVEBOMB_H diff --git a/src/mame/konami/divebomb_v.cpp b/src/mame/konami/divebomb_v.cpp deleted file mode 100644 index dfea3b252fb..00000000000 --- a/src/mame/konami/divebomb_v.cpp +++ /dev/null @@ -1,187 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:David Haywood, Phil Bennett -/************************************************************************* - - Kyuukoukabakugekitai - Dive Bomber Squad - -*************************************************************************/ - -#include "emu.h" -#include "divebomb.h" -#include "video/resnet.h" - - - -/************************************* - * - * Tilemap callbacks - * - *************************************/ - -TILE_GET_INFO_MEMBER(divebomb_state::get_fg_tile_info) -{ - uint32_t code = m_fgram[tile_index + 0x000]; - uint32_t attr = m_fgram[tile_index + 0x400]; - uint32_t colour = attr >> 4; - - code |= (attr & 0x3) << 8; - - tileinfo.set(0, code, colour, 0); -} - - - -/************************************* - * - * K051316 callbacks - * - *************************************/ - -K051316_CB_MEMBER(divebomb_state::zoom_callback_1) -{ - *code |= (*color & 0x03) << 8; - *color = 0 + ((m_roz_pal >> 4) & 3); -} - - -K051316_CB_MEMBER(divebomb_state::zoom_callback_2) -{ - *code |= (*color & 0x03) << 8; - *color = 4 + (m_roz_pal & 3); -} - - - -/************************************* - * - * Video hardware handlers - * - *************************************/ - -void divebomb_state::fgram_w(offs_t offset, uint8_t data) -{ - m_fgram[offset] = data; - m_fg_tilemap->mark_tile_dirty(offset & 0x3ff); -} - - -void divebomb_state::rozcpu_pal_w(uint8_t data) -{ - //.... ..xx K051316 1 palette select - //..xx .... K051316 2 palette select - - uint8_t old_pal = m_roz_pal; - m_roz_pal = data; - - if ((old_pal & 0x03) != (data & 0x03)) - m_k051316[1]->mark_tmap_dirty(); - - if ((old_pal & 0x30) != (data & 0x30)) - m_k051316[0]->mark_tmap_dirty(); - - if (data & 0xcc) - logerror("rozcpu_port50_w %02x\n", data); -} - - - -/************************************* - * - * Video hardware init - * - *************************************/ - -void divebomb_state::decode_proms(palette_device &palette, const uint8_t * rgn, int size, int index, bool inv) -{ - static constexpr int resistances[4] = { 2000, 1000, 470, 220 }; - - // compute the color output resistor weights - double rweights[4], gweights[4], bweights[4]; - compute_resistor_weights(0, 255, -1.0, - 4, resistances, rweights, 0, 0, - 4, resistances, gweights, 0, 0, - 4, resistances, bweights, 0, 0); - - // create a lookup table for the palette - for (uint32_t i = 0; i < size; ++i) - { - uint32_t const rdata = rgn[i + size*2] & 0x0f; - uint32_t const r = combine_weights(rweights, BIT(rdata, 0), BIT(rdata, 1), BIT(rdata, 2), BIT(rdata, 3)); - - uint32_t const gdata = rgn[i + size] & 0x0f; - uint32_t const g = combine_weights(gweights, BIT(gdata, 0), BIT(gdata, 1), BIT(gdata, 2), BIT(gdata, 3)); - - uint32_t const bdata = rgn[i] & 0x0f; - uint32_t const b = combine_weights(bweights, BIT(bdata, 0), BIT(bdata, 1), BIT(bdata, 2), BIT(bdata, 3)); - - if (!inv) - palette.set_pen_color(index + i, rgb_t(r, g, b)); - else - palette.set_pen_color(index + (i ^ 0xff), rgb_t(r, g, b)); - } -} - - -void divebomb_state::divebomb_palette(palette_device &palette) const -{ - decode_proms(palette, memregion("spr_proms")->base(), 0x100, 0x400 + 0x400 + 0x400, false); - decode_proms(palette, memregion("fg_proms")->base(), 0x400, 0x400 + 0x400, false); - decode_proms(palette, memregion("k051316_1_pr")->base(), 0x400, 0, true); - decode_proms(palette, memregion("k051316_2_pr")->base(), 0x400, 0x400, true); -} - - -void divebomb_state::video_start() -{ - m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(divebomb_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); - m_fg_tilemap->set_transparent_pen(0); - m_fg_tilemap->set_scrolly(0, 16); -} - - - -/************************************* - * - * Main update - * - *************************************/ - -void divebomb_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - const uint8_t *spriteram = m_spriteram; - - for (uint32_t i = 0; i < m_spriteram.bytes(); i += 4) - { - uint32_t sy = spriteram[i + 3]; - uint32_t sx = spriteram[i + 0]; - uint32_t code = spriteram[i + 2]; - uint32_t attr = spriteram[i + 1]; - - code += (attr & 0x0f) << 8; - - uint32_t colour = attr >> 4; - - m_gfxdecode->gfx(1)->transpen(bitmap, cliprect, code, colour, 0, 0, sx, sy, 0); - m_gfxdecode->gfx(1)->transpen(bitmap, cliprect, code, colour, 0, 0, sx, sy-256, 0); - } -} - - -uint32_t divebomb_state::screen_update_divebomb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - bitmap.fill(m_palette->black_pen(), cliprect); - - for (int chip = 1; chip >= 0; chip--) - { - if (m_roz_enable[chip]) - { - m_k051316[chip]->zoom_draw(screen, bitmap, cliprect, 0, 0); - } - } - - draw_sprites(bitmap, cliprect); - - m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - - return 0; -} diff --git a/src/mame/konami/rockrage.cpp b/src/mame/konami/rockrage.cpp index fc56da1806c..65176b9d3da 100644 --- a/src/mame/konami/rockrage.cpp +++ b/src/mame/konami/rockrage.cpp @@ -1,5 +1,6 @@ // license:BSD-3-Clause -// copyright-holders:Manuel Abadia +// copyright-holders: Manuel Abadia + /*************************************************************************** Rock'n Rage (GX620) (c) 1986 Konami @@ -50,86 +51,223 @@ Notes: ***************************************************************************/ #include "emu.h" -#include "rockrage.h" + +#include "k007342.h" +#include "k007420.h" #include "konamipt.h" -#include "cpu/m6809/m6809.h" #include "cpu/m6809/hd6309.h" +#include "cpu/m6809/m6809.h" +#include "machine/gen_latch.h" #include "machine/watchdog.h" +#include "sound/vlm5030.h" #include "sound/ymopm.h" + +#include "emupal.h" #include "screen.h" #include "speaker.h" +namespace { + +class rockrage_state : public driver_device +{ +public: + rockrage_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_k007342(*this, "k007342"), + m_k007420(*this, "k007420"), + m_vlm(*this, "vlm"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette"), + m_rombank(*this, "rombank") + { } + + void rockrage(machine_config &config); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + +private: + // devices + required_device m_maincpu; + required_device m_audiocpu; + required_device m_k007342; + required_device m_k007420; + required_device m_vlm; + required_device m_gfxdecode; + required_device m_palette; + + // memory pointers + required_memory_bank m_rombank; + + // video-related + uint8_t m_vreg = 0; + + void bankswitch_w(uint8_t data); + void vreg_w(uint8_t data); + uint8_t vlm5030_busy_r(); + void speech_w(uint8_t data); + void palette(palette_device &palette) const; + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_WRITE_LINE_MEMBER(vblank_irq); + K007342_CALLBACK_MEMBER(tile_callback); + K007420_CALLBACK_MEMBER(sprite_callback); + + void main_map(address_map &map); + void sound_map(address_map &map); + void vlm_map(address_map &map); +}; + + +// video + +void rockrage_state::palette(palette_device &palette) const +{ + uint8_t const *const color_prom = memregion("proms")->base(); + + for (int i = 0; i < 256 * 3; i++) + { + // layer0 uses colors 0x00-0x0f; layer1 uses 0x10-0x1f; sprites use 0x20-0x2f + uint8_t const colorbase = (i / 256) * 16; + uint8_t const ctabentry = (color_prom[i] & 0x0f) | colorbase; + palette.set_pen_indirect(i, ctabentry); + } +} + + + +/*************************************************************************** + + Callback for the K007342 + +***************************************************************************/ + +K007342_CALLBACK_MEMBER(rockrage_state::tile_callback) +{ + if (layer == 1) + *code |= ((*color & 0x40) << 2) | ((m_vreg & 0x04) << 7); // doesn't use bank here (Tutankhamen eyes blinking) + else + *code |= ((*color & 0x40) << 2) | ((bank & 0x03) << 10) | ((m_vreg & 0x04) << 7) | ((m_vreg & 0x08) << 9); + *color = layer * 16 + (*color & 0x0f); +} + +/*************************************************************************** + + Callback for the K007420 + +***************************************************************************/ + +K007420_CALLBACK_MEMBER(rockrage_state::sprite_callback) +{ + *code |= ((*color & 0x40) << 2) | ((*color & 0x80) << 1) * ((m_vreg & 0x03) << 1); + *code = (*code << 2) | ((*color & 0x30) >> 4); + *color = 0 + (*color & 0x0f); +} + + +void rockrage_state::vreg_w(uint8_t data) +{ + /* bits 4-7: unused + bit 3: bit 4 of bank # (layer 0) + bit 2: bit 1 of bank # (layer 0) + bits 0-1: sprite bank select */ + + if ((data & 0x0c) != (m_vreg & 0x0c)) + machine().tilemap().mark_all_dirty(); + + m_vreg = data; +} + +/*************************************************************************** + + Screen Refresh + +***************************************************************************/ + +uint32_t rockrage_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_k007342->tilemap_update(); + + bitmap.fill(0, cliprect); + m_k007342->tilemap_draw(screen, bitmap, cliprect, 0, TILEMAP_DRAW_OPAQUE, 0); + // Tutankhamen eyes go below sprites + m_k007342->tilemap_draw(screen, bitmap, cliprect, 1, 0, 0); + m_k007420->sprites_draw(bitmap, cliprect, m_gfxdecode->gfx(1)); + m_k007342->tilemap_draw(screen, bitmap, cliprect, 0, 1, 0); + m_k007342->tilemap_draw(screen, bitmap, cliprect, 1, 1, 0); + return 0; +} + + +// machine + WRITE_LINE_MEMBER(rockrage_state::vblank_irq) { if (state && m_k007342->is_int_enabled()) m_maincpu->set_input_line(HD6309_IRQ_LINE, HOLD_LINE); } -void rockrage_state::rockrage_bankswitch_w(uint8_t data) +void rockrage_state::bankswitch_w(uint8_t data) { - /* bits 4-6 = bank number */ + // bits 4-6 = bank number m_rombank->set_entry((data & 0x70) >> 4); - /* bits 0 & 1 = coin counters */ - machine().bookkeeping().coin_counter_w(0,data & 0x01); - machine().bookkeeping().coin_counter_w(1,data & 0x02); - - /* other bits unknown */ -} + // bits 0 & 1 = coin counters + machine().bookkeeping().coin_counter_w(0, data & 0x01); + machine().bookkeeping().coin_counter_w(1, data & 0x02); -void rockrage_state::rockrage_sh_irqtrigger_w(uint8_t data) -{ - m_soundlatch->write(data); - m_audiocpu->set_input_line(M6809_IRQ_LINE, HOLD_LINE); + // other bits unknown } -uint8_t rockrage_state::rockrage_VLM5030_busy_r() +uint8_t rockrage_state::vlm5030_busy_r() { return (m_vlm->bsy() ? 1 : 0); } -void rockrage_state::rockrage_speech_w(uint8_t data) +void rockrage_state::speech_w(uint8_t data) { - /* bit2 = data bus enable */ + // bit2 = data bus enable m_vlm->rst((data >> 1) & 0x01); m_vlm->st((data >> 0) & 0x01); } -void rockrage_state::rockrage_map(address_map &map) +void rockrage_state::main_map(address_map &map) { - map(0x0000, 0x1fff).rw(m_k007342, FUNC(k007342_device::read), FUNC(k007342_device::write)); /* Color RAM + Video RAM */ - map(0x2000, 0x21ff).rw(m_k007420, FUNC(k007420_device::read), FUNC(k007420_device::write)); /* Sprite RAM */ - map(0x2200, 0x23ff).rw(m_k007342, FUNC(k007342_device::scroll_r), FUNC(k007342_device::scroll_w)); /* Scroll RAM */ + map(0x0000, 0x1fff).rw(m_k007342, FUNC(k007342_device::read), FUNC(k007342_device::write)); // Color RAM + Video RAM + map(0x2000, 0x21ff).rw(m_k007420, FUNC(k007420_device::read), FUNC(k007420_device::write)); // Sprite RAM + map(0x2200, 0x23ff).rw(m_k007342, FUNC(k007342_device::scroll_r), FUNC(k007342_device::scroll_w)); // Scroll RAM map(0x2400, 0x247f).ram().w(m_palette, FUNC(palette_device::write_indirect)).share("palette"); - map(0x2600, 0x2607).w(m_k007342, FUNC(k007342_device::vreg_w)); /* Video Registers */ + map(0x2600, 0x2607).w(m_k007342, FUNC(k007342_device::vreg_w)); map(0x2e00, 0x2e00).portr("SYSTEM"); map(0x2e01, 0x2e01).portr("P1"); map(0x2e02, 0x2e02).portr("P2"); map(0x2e03, 0x2e03).portr("DSW2"); map(0x2e40, 0x2e40).portr("DSW1"); - map(0x2e80, 0x2e80).w(FUNC(rockrage_state::rockrage_sh_irqtrigger_w)); /* cause interrupt on audio CPU */ + map(0x2e80, 0x2e80).w("soundlatch", FUNC(generic_latch_8_device::write)); // cause interrupt on audio CPU map(0x2ec0, 0x2ec0).w("watchdog", FUNC(watchdog_timer_device::reset_w)); - map(0x2f00, 0x2f00).w(FUNC(rockrage_state::rockrage_vreg_w)); /* ??? */ - map(0x2f40, 0x2f40).w(FUNC(rockrage_state::rockrage_bankswitch_w)); /* bankswitch control */ - map(0x4000, 0x5fff).ram(); /* RAM */ - map(0x6000, 0x7fff).bankr("rombank"); /* banked ROM */ - map(0x8000, 0xffff).rom(); /* ROM */ + map(0x2f00, 0x2f00).w(FUNC(rockrage_state::vreg_w)); // ??? + map(0x2f40, 0x2f40).w(FUNC(rockrage_state::bankswitch_w)); + map(0x4000, 0x5fff).ram(); + map(0x6000, 0x7fff).bankr("rombank"); + map(0x8000, 0xffff).rom(); } -void rockrage_state::rockrage_sound_map(address_map &map) +void rockrage_state::sound_map(address_map &map) { - map(0x2000, 0x2000).w(m_vlm, FUNC(vlm5030_device::data_w)); /* VLM5030 */ - map(0x3000, 0x3000).r(FUNC(rockrage_state::rockrage_VLM5030_busy_r)); /* VLM5030 */ - map(0x4000, 0x4000).w(FUNC(rockrage_state::rockrage_speech_w)); /* VLM5030 */ - map(0x5000, 0x5000).r(m_soundlatch, FUNC(generic_latch_8_device::read)); - map(0x6000, 0x6001).rw("ymsnd", FUNC(ym2151_device::read), FUNC(ym2151_device::write)); /* YM 2151 */ - map(0x7000, 0x77ff).ram(); /* RAM */ - map(0x8000, 0xffff).rom(); /* ROM */ + map(0x2000, 0x2000).w(m_vlm, FUNC(vlm5030_device::data_w)); + map(0x3000, 0x3000).r(FUNC(rockrage_state::vlm5030_busy_r)); + map(0x4000, 0x4000).w(FUNC(rockrage_state::speech_w)); + map(0x5000, 0x5000).r("soundlatch", FUNC(generic_latch_8_device::read)); + map(0x6000, 0x6001).rw("ymsnd", FUNC(ym2151_device::read), FUNC(ym2151_device::write)); + map(0x7000, 0x77ff).ram(); + map(0x8000, 0xffff).rom(); } -void rockrage_state::rockrage_vlm_map(address_map &map) +void rockrage_state::vlm_map(address_map &map) { map.global_mask(0x7fff); map(0x0000, 0x7fff).rom(); @@ -144,7 +282,7 @@ void rockrage_state::rockrage_vlm_map(address_map &map) static INPUT_PORTS_START( rockrage ) PORT_START("DSW1") KONAMI_COINAGE_LOC(DEF_STR( Free_Play ), "Invalid", SW1) - /* Invalid = both coin slots disabled */ + // Invalid = both coin slots disabled PORT_START("DSW2") PORT_DIPNAME( 0x03, 0x01, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:1,2") @@ -207,29 +345,18 @@ INPUT_PORTS_END static const gfx_layout charlayout = { - 8,8, /* 8 x 8 characters */ - 0x40000/32, /* 8192 characters */ - 4, /* 4bpp */ - { 0, 1, 2, 3 }, /* the four bitplanes are packed in one nibble */ + 8,8, // 8 x 8 characters + 0x40000/32, // 8192 characters + 4, // 4bpp + { 0, 1, 2, 3 }, // the four bitplanes are packed in one nibble { 2*4, 3*4, 0*4, 1*4, 6*4, 7*4, 4*4, 5*4 }, { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 }, - 32*8 /* every character takes 32 consecutive bytes */ -}; - -static const gfx_layout spritelayout = -{ - 8,8, /* 8*8 sprites */ - 0x40000/32, /* 8192 sprites */ - 4, /* 4 bpp */ - { 0, 1, 2, 3 }, /* the four bitplanes are packed in one nibble */ - { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4 }, - { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 }, - 32*8 /* every sprite takes 32 consecutive bytes */ + 32*8 // every character takes 32 consecutive bytes }; static GFXDECODE_START( gfx_rockrage ) - GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 32 ) /* colors 00..31, using 2 lookup tables */ - GFXDECODE_ENTRY( "gfx2", 0, spritelayout, 512, 16 ) /* colors 32..47, using lookup table */ + GFXDECODE_ENTRY( "tiles", 0, charlayout, 0, 32 ) // colors 00..31, using 2 lookup tables + GFXDECODE_ENTRY( "sprites", 0, gfx_8x8x4_packed_msb, 512, 16 ) // colors 32..47, using lookup table GFXDECODE_END /*************************************************************************** @@ -240,9 +367,9 @@ GFXDECODE_END void rockrage_state::machine_start() { - uint8_t *ROM = memregion("maincpu")->base(); + uint8_t *rom = memregion("maincpu")->base(); - m_rombank->configure_entries(0, 8, &ROM[0x10000], 0x2000); + m_rombank->configure_entries(0, 8, &rom[0x10000], 0x2000); save_item(NAME(m_vreg)); } @@ -254,50 +381,50 @@ void rockrage_state::machine_reset() void rockrage_state::rockrage(machine_config &config) { - /* basic machine hardware */ + // basic machine hardware HD6309E(config, m_maincpu, XTAL(24'000'000) / 8); - m_maincpu->set_addrmap(AS_PROGRAM, &rockrage_state::rockrage_map); + m_maincpu->set_addrmap(AS_PROGRAM, &rockrage_state::main_map); MC6809E(config, m_audiocpu, XTAL(24'000'000) / 16); - m_audiocpu->set_addrmap(AS_PROGRAM, &rockrage_state::rockrage_sound_map); + m_audiocpu->set_addrmap(AS_PROGRAM, &rockrage_state::sound_map); WATCHDOG_TIMER(config, "watchdog"); - /* 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(0)); screen.set_size(32*8, 32*8); screen.set_visarea(0*8, 32*8-1, 2*8, 30*8-1); - screen.set_screen_update(FUNC(rockrage_state::screen_update_rockrage)); + screen.set_screen_update(FUNC(rockrage_state::screen_update)); screen.set_palette(m_palette); screen.screen_vblank().set(FUNC(rockrage_state::vblank_irq)); K007342(config, m_k007342, 0); m_k007342->set_gfxnum(0); - m_k007342->set_tile_callback(FUNC(rockrage_state::rockrage_tile_callback)); + m_k007342->set_tile_callback(FUNC(rockrage_state::tile_callback)); m_k007342->set_gfxdecode_tag(m_gfxdecode); K007420(config, m_k007420, 0); m_k007420->set_bank_limit(0x3ff); - m_k007420->set_sprite_callback(FUNC(rockrage_state::rockrage_sprite_callback)); + m_k007420->set_sprite_callback(FUNC(rockrage_state::sprite_callback)); m_k007420->set_palette_tag(m_palette); GFXDECODE(config, m_gfxdecode, m_palette, gfx_rockrage); - PALETTE(config, m_palette, FUNC(rockrage_state::rockrage_palette)); + PALETTE(config, m_palette, FUNC(rockrage_state::palette)); m_palette->set_format(palette_device::xBGR_555, 16*16*3, 64); m_palette->set_endianness(ENDIANNESS_LITTLE); - /* sound hardware */ + // sound hardware SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); - GENERIC_LATCH_8(config, m_soundlatch); + GENERIC_LATCH_8(config, "soundlatch").data_pending_callback().set_inputline(m_audiocpu, M6809_IRQ_LINE); - YM2151(config, "ymsnd", 3579545).add_route(0, "lspeaker", 0.60).add_route(1, "rspeaker", 0.60); + YM2151(config, "ymsnd", 3'579'545).add_route(0, "lspeaker", 0.60).add_route(1, "rspeaker", 0.60); - VLM5030(config, m_vlm, 3579545); - m_vlm->set_addrmap(0, &rockrage_state::rockrage_vlm_map); + VLM5030(config, m_vlm, 3'579'545); + m_vlm->set_addrmap(0, &rockrage_state::vlm_map); m_vlm->add_route(ALL_OUTPUTS, "lspeaker", 0.60); m_vlm->add_route(ALL_OUTPUTS, "rspeaker", 0.60); } @@ -310,91 +437,94 @@ void rockrage_state::rockrage(machine_config &config) ***************************************************************************/ ROM_START( rockrage ) - ROM_REGION( 0x20000, "maincpu", 0 ) /* code + banked roms */ - ROM_LOAD( "620q01.16c", 0x08000, 0x08000, CRC(0ddb5ef5) SHA1(71b38c9f957858371f0ac95720d3c6d07339e5c5) ) /* fixed ROM */ - ROM_LOAD( "620q02.15c", 0x10000, 0x10000, CRC(b4f6e346) SHA1(43fded4484836ff315dd6e40991f909dad73f1ed) ) /* banked ROM */ + ROM_REGION( 0x20000, "maincpu", 0 ) + ROM_LOAD( "620q01.16c", 0x08000, 0x08000, CRC(0ddb5ef5) SHA1(71b38c9f957858371f0ac95720d3c6d07339e5c5) ) // fixed ROM + ROM_LOAD( "620q02.15c", 0x10000, 0x10000, CRC(b4f6e346) SHA1(43fded4484836ff315dd6e40991f909dad73f1ed) ) // banked ROM - ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for the sound CPU */ + ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "620k03.11c", 0x08000, 0x08000, CRC(9fbefe82) SHA1(ab42b7e519a0dd08f2249dad0819edea0976f39a) ) - ROM_REGION( 0x040000, "gfx1", 0 ) - ROM_LOAD16_BYTE( "620k05.rom", 0x00000, 0x20000, CRC(145d387c) SHA1(4fb0c54f9a218d512d8aec09ef995494a06912d6) ) /* tiles */ - ROM_LOAD16_BYTE( "620k06.rom", 0x00001, 0x20000, CRC(7fa2c57c) SHA1(8c5d85c31dc26cb59a012ebb1ea195c3db80cda8) ) /* Both World & Japan use the same "K" code for these??? */ + ROM_REGION( 0x040000, "tiles", 0 ) + ROM_LOAD16_BYTE( "620k05.rom", 0x00000, 0x20000, CRC(145d387c) SHA1(4fb0c54f9a218d512d8aec09ef995494a06912d6) ) + ROM_LOAD16_BYTE( "620k06.rom", 0x00001, 0x20000, CRC(7fa2c57c) SHA1(8c5d85c31dc26cb59a012ebb1ea195c3db80cda8) ) // Both World & Japan use the same "K" code for these??? - ROM_REGION( 0x040000, "gfx2", 0 ) - ROM_LOAD( "620k11.rom", 0x000000, 0x20000, CRC(70449239) SHA1(07653ea3bfe0063c9d2b2102ac52a1b50fc2971e) ) /* sprites */ - ROM_LOAD( "620l10.8g", 0x020000, 0x20000, CRC(06d108e0) SHA1(cae8c5f2fc4e84bc7adbf27f71a18a74968c4296) ) /* One "K" & one "L" code version??? */ + ROM_REGION( 0x040000, "sprites", 0 ) + ROM_LOAD( "620k11.rom", 0x000000, 0x20000, CRC(70449239) SHA1(07653ea3bfe0063c9d2b2102ac52a1b50fc2971e) ) + ROM_LOAD( "620l10.8g", 0x020000, 0x20000, CRC(06d108e0) SHA1(cae8c5f2fc4e84bc7adbf27f71a18a74968c4296) ) // One "K" & one "L" code version??? ROM_REGION( 0x0300, "proms", 0 ) - ROM_LOAD( "620k07.13g", 0x00000, 0x00100, CRC(b6135ee0) SHA1(248a978987cff86c2bbad10ef332f63a6abd5bee) ) /* layer 0 lookup table */ - ROM_LOAD( "620k08.12g", 0x00100, 0x00100, CRC(b499800c) SHA1(46fa4e071ebceed12027de109be1e16dde5e846e) ) /* layer 1 lookup table */ - ROM_LOAD( "620k09.11g", 0x00200, 0x00100, CRC(9f0e0608) SHA1(c95bdb370e4a91f27afbd5ff3b39b2e0ad87da73) ) /* sprite lookup table */ + ROM_LOAD( "620k07.13g", 0x00000, 0x00100, CRC(b6135ee0) SHA1(248a978987cff86c2bbad10ef332f63a6abd5bee) ) // layer 0 lookup table + ROM_LOAD( "620k08.12g", 0x00100, 0x00100, CRC(b499800c) SHA1(46fa4e071ebceed12027de109be1e16dde5e846e) ) // layer 1 lookup table + ROM_LOAD( "620k09.11g", 0x00200, 0x00100, CRC(9f0e0608) SHA1(c95bdb370e4a91f27afbd5ff3b39b2e0ad87da73) ) // sprite lookup table - ROM_REGION( 0x08000, "vlm", 0 ) /* VLM3050 data */ + ROM_REGION( 0x08000, "vlm", 0 ) ROM_LOAD( "620k04.6e", 0x00000, 0x08000, CRC(8be969f3) SHA1(9856b4c13fac77b645aed67a08cb4965b4966492) ) ROM_END ROM_START( rockragea ) - ROM_REGION( 0x20000, "maincpu", 0 ) /* code + banked roms */ - ROM_LOAD( "620n01.16c", 0x08000, 0x10000, CRC(f89f56ea) SHA1(64ba2575e09af257b242d913eab69130f7341894) ) /* fixed ROM */ - ROM_LOAD( "620n02.15c", 0x10000, 0x10000, CRC(5bc1f1cf) SHA1(d5bb9971d778449e0c01495f9888c0da7ac617a7) ) /* banked ROM */ + ROM_REGION( 0x20000, "maincpu", 0 ) + ROM_LOAD( "620n01.16c", 0x08000, 0x10000, CRC(f89f56ea) SHA1(64ba2575e09af257b242d913eab69130f7341894) ) // fixed ROM + ROM_LOAD( "620n02.15c", 0x10000, 0x10000, CRC(5bc1f1cf) SHA1(d5bb9971d778449e0c01495f9888c0da7ac617a7) ) // banked ROM - ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for the sound CPU */ - ROM_LOAD( "620k03.11c", 0x08000, 0x08000, CRC(9fbefe82) SHA1(ab42b7e519a0dd08f2249dad0819edea0976f39a) ) /* Same rom but labeled as ver "G" */ + ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_LOAD( "620k03.11c", 0x08000, 0x08000, CRC(9fbefe82) SHA1(ab42b7e519a0dd08f2249dad0819edea0976f39a) ) // Same ROM but labeled as ver "G" - ROM_REGION( 0x040000, "gfx1", 0 ) - ROM_LOAD16_BYTE( "620d05a.16g", 0x00000, 0x10000, CRC(4d53fde9) SHA1(941fb6c94922727516945330b4b738aa052f7734) ) /* tiles */ + ROM_REGION( 0x040000, "tiles", 0 ) + ROM_LOAD16_BYTE( "620d05a.16g", 0x00000, 0x10000, CRC(4d53fde9) SHA1(941fb6c94922727516945330b4b738aa052f7734) ) ROM_LOAD16_BYTE( "620d06a.15g", 0x00001, 0x10000, CRC(8cc05d4b) SHA1(0d6fef98bdc4d299229de4e0044241aedee83b85) ) ROM_LOAD16_BYTE( "620d05b.16f", 0x20000, 0x10000, CRC(69f4599f) SHA1(664581874d74ed7bf59bde6730799e15f4e0144d) ) ROM_LOAD16_BYTE( "620d06b.15f", 0x20001, 0x10000, CRC(3892d41d) SHA1(c49f2e61f24a59be4e59e2f3c60e731b8a05ddd3) ) - ROM_REGION( 0x040000, "gfx2", 0 ) - ROM_LOAD( "620g11a.7g", 0x000000, 0x10000, CRC(0ef40c2c) SHA1(2c0b7e611333a072ebcef60c1985211d5936bf66) ) /* sprites */ + ROM_REGION( 0x040000, "sprites", 0 ) + ROM_LOAD( "620g11a.7g", 0x000000, 0x10000, CRC(0ef40c2c) SHA1(2c0b7e611333a072ebcef60c1985211d5936bf66) ) ROM_LOAD( "620d11b.7f", 0x010000, 0x10000, CRC(8f116cbf) SHA1(0400609aadde39c6f02ab954c78bc67a1d23da1d) ) ROM_LOAD( "620d10a.8g", 0x020000, 0x10000, CRC(4789ae7b) SHA1(8885ca20bf746fb3ed229486c0e3903ababfacc9) ) ROM_LOAD( "620g10b.8f", 0x030000, 0x10000, CRC(1618854a) SHA1(0afb34a9ed97f13c1910acd7767cb8546ea7e6cd) ) ROM_REGION( 0x0300, "proms", 0 ) - ROM_LOAD( "620k07.13g", 0x00000, 0x00100, CRC(b6135ee0) SHA1(248a978987cff86c2bbad10ef332f63a6abd5bee) ) /* layer 0 lookup table */ - ROM_LOAD( "620k08.12g", 0x00100, 0x00100, CRC(b499800c) SHA1(46fa4e071ebceed12027de109be1e16dde5e846e) ) /* layer 1 lookup table */ - ROM_LOAD( "620k09.11g", 0x00200, 0x00100, CRC(9f0e0608) SHA1(c95bdb370e4a91f27afbd5ff3b39b2e0ad87da73) ) /* sprite lookup table */ + ROM_LOAD( "620k07.13g", 0x00000, 0x00100, CRC(b6135ee0) SHA1(248a978987cff86c2bbad10ef332f63a6abd5bee) ) // layer 0 lookup table + ROM_LOAD( "620k08.12g", 0x00100, 0x00100, CRC(b499800c) SHA1(46fa4e071ebceed12027de109be1e16dde5e846e) ) // layer 1 lookup table + ROM_LOAD( "620k09.11g", 0x00200, 0x00100, CRC(9f0e0608) SHA1(c95bdb370e4a91f27afbd5ff3b39b2e0ad87da73) ) // sprite lookup table - ROM_REGION( 0x08000, "vlm", 0 ) /* VLM3050 data */ - ROM_LOAD( "620k04.6e", 0x00000, 0x08000, CRC(8be969f3) SHA1(9856b4c13fac77b645aed67a08cb4965b4966492) ) /* Same rom but labeled as ver "G" */ + ROM_REGION( 0x08000, "vlm", 0 ) + ROM_LOAD( "620k04.6e", 0x00000, 0x08000, CRC(8be969f3) SHA1(9856b4c13fac77b645aed67a08cb4965b4966492) ) // Same ROM but labeled as ver "G" ROM_END ROM_START( rockragej ) - ROM_REGION( 0x20000, "maincpu", 0 ) /* code + banked roms */ - ROM_LOAD( "620k01.16c", 0x08000, 0x08000, CRC(4f5171f7) SHA1(5bce9e3f9d01c113c697853763cd891b91297eb2) ) /* fixed ROM */ - ROM_LOAD( "620k02.15c", 0x10000, 0x10000, CRC(04c4d8f7) SHA1(2a1a024fc38bb934c454092b0aed74d0f1d1c4af) ) /* banked ROM */ + ROM_REGION( 0x20000, "maincpu", 0 ) + ROM_LOAD( "620k01.16c", 0x08000, 0x08000, CRC(4f5171f7) SHA1(5bce9e3f9d01c113c697853763cd891b91297eb2) ) // fixed ROM + ROM_LOAD( "620k02.15c", 0x10000, 0x10000, CRC(04c4d8f7) SHA1(2a1a024fc38bb934c454092b0aed74d0f1d1c4af) ) // banked ROM - ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for the sound CPU */ + ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "620k03.11c", 0x08000, 0x08000, CRC(9fbefe82) SHA1(ab42b7e519a0dd08f2249dad0819edea0976f39a) ) - ROM_REGION( 0x040000, "gfx1", 0 ) - ROM_LOAD16_BYTE( "620k05.16g", 0x00000, 0x20000, CRC(ca9d9346) SHA1(fee8d98def802f312c6cd0ec751c67aa18acfacd) ) /* tiles */ - ROM_LOAD16_BYTE( "620k06.15g", 0x00001, 0x20000, CRC(c0e2b35c) SHA1(fb37a151188f27f883fed5fdfb0094c3efa9470d) ) /* Both World & Japan use the same "K" code for these??? */ + ROM_REGION( 0x040000, "tiles", 0 ) + ROM_LOAD16_BYTE( "620k05.16g", 0x00000, 0x20000, CRC(ca9d9346) SHA1(fee8d98def802f312c6cd0ec751c67aa18acfacd) ) + ROM_LOAD16_BYTE( "620k06.15g", 0x00001, 0x20000, CRC(c0e2b35c) SHA1(fb37a151188f27f883fed5fdfb0094c3efa9470d) ) // Both World & Japan use the same "K" code for these??? - ROM_REGION( 0x040000, "gfx2", 0 ) - ROM_LOAD( "620k11.7g", 0x000000, 0x20000, CRC(7430f6e9) SHA1(5d488c7b7b0eb4e502b3e566ac102cd3267e8568) ) /* sprites */ + ROM_REGION( 0x040000, "sprites", 0 ) + ROM_LOAD( "620k11.7g", 0x000000, 0x20000, CRC(7430f6e9) SHA1(5d488c7b7b0eb4e502b3e566ac102cd3267e8568) ) ROM_LOAD( "620k10.8g", 0x020000, 0x20000, CRC(0d1a95ab) SHA1(be565424f17af31dcd07004c6be03bbb00aef514) ) ROM_REGION( 0x0300, "proms", 0 ) - ROM_LOAD( "620k07.13g", 0x00000, 0x00100, CRC(b6135ee0) SHA1(248a978987cff86c2bbad10ef332f63a6abd5bee) ) /* layer 0 lookup table */ - ROM_LOAD( "620k08.12g", 0x00100, 0x00100, CRC(b499800c) SHA1(46fa4e071ebceed12027de109be1e16dde5e846e) ) /* layer 1 lookup table */ - ROM_LOAD( "620k09.11g", 0x00200, 0x00100, CRC(9f0e0608) SHA1(c95bdb370e4a91f27afbd5ff3b39b2e0ad87da73) ) /* sprite lookup table */ + ROM_LOAD( "620k07.13g", 0x00000, 0x00100, CRC(b6135ee0) SHA1(248a978987cff86c2bbad10ef332f63a6abd5bee) ) // layer 0 lookup table + ROM_LOAD( "620k08.12g", 0x00100, 0x00100, CRC(b499800c) SHA1(46fa4e071ebceed12027de109be1e16dde5e846e) ) // layer 1 lookup table + ROM_LOAD( "620k09.11g", 0x00200, 0x00100, CRC(9f0e0608) SHA1(c95bdb370e4a91f27afbd5ff3b39b2e0ad87da73) ) // sprite lookup table - ROM_REGION( 0x08000, "vlm", 0 ) /* VLM3050 data */ + ROM_REGION( 0x08000, "vlm", 0 ) ROM_LOAD( "620k04.6e", 0x00000, 0x08000, CRC(8be969f3) SHA1(9856b4c13fac77b645aed67a08cb4965b4966492) ) ROM_END +} // anonymous namespace + + /*************************************************************************** Game driver(s) ***************************************************************************/ -// YEAR, NAME, PARENT, MACHINE, INPUT, INIT,MONITOR,COMPANY,FULLNAME,FLAGS -GAME( 1986, rockrage, 0, rockrage, rockrage, rockrage_state, empty_init, ROT0, "Konami", "Rock'n Rage (World)", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, rockragea, rockrage, rockrage, rockrage, rockrage_state, empty_init, ROT0, "Konami", "Rock'n Rage (prototype?)", MACHINE_SUPPORTS_SAVE ) // no title screen, abruptly cuts off ending before the "presented by Konami" seen in other sets, location test? -GAME( 1986, rockragej, rockrage, rockrage, rockrage, rockrage_state, empty_init, ROT0, "Konami", "Koi no Hotrock (Japan)", MACHINE_SUPPORTS_SAVE ) +// YEAR, NAME, PARENT, MACHINE, INPUT, STATE INIT, MONITOR, COMPANY, FULLNAME, FLAGS +GAME( 1986, rockrage, 0, rockrage, rockrage, rockrage_state, empty_init, ROT0, "Konami", "Rock'n Rage (World)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, rockragea, rockrage, rockrage, rockrage, rockrage_state, empty_init, ROT0, "Konami", "Rock'n Rage (prototype?)", MACHINE_SUPPORTS_SAVE ) // no title screen, abruptly cuts off ending before the "presented by Konami" seen in other sets, location test? +GAME( 1986, rockragej, rockrage, rockrage, rockrage, rockrage_state, empty_init, ROT0, "Konami", "Koi no Hotrock (Japan)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/konami/rockrage.h b/src/mame/konami/rockrage.h deleted file mode 100644 index 2bebad0870d..00000000000 --- a/src/mame/konami/rockrage.h +++ /dev/null @@ -1,72 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Manuel Abadia -/************************************************************************* - - Rock'n Rage - -*************************************************************************/ -#ifndef MAME_INCLUDES_ROCKRAGE_H -#define MAME_INCLUDES_ROCKRAGE_H - -#pragma once - -#include "machine/gen_latch.h" -#include "sound/vlm5030.h" -#include "k007342.h" -#include "k007420.h" -#include "emupal.h" - -class rockrage_state : public driver_device -{ -public: - rockrage_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_k007342(*this, "k007342"), - m_k007420(*this, "k007420"), - m_vlm(*this, "vlm"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"), - m_soundlatch(*this, "soundlatch"), - m_rombank(*this, "rombank") - { } - - void rockrage(machine_config &config); - -private: - /* devices */ - required_device m_maincpu; - required_device m_audiocpu; - required_device m_k007342; - required_device m_k007420; - required_device m_vlm; - required_device m_gfxdecode; - required_device m_palette; - required_device m_soundlatch; - - /* memory pointers */ - required_memory_bank m_rombank; - - /* video-related */ - int m_vreg = 0; - - void rockrage_bankswitch_w(uint8_t data); - void rockrage_sh_irqtrigger_w(uint8_t data); - void rockrage_vreg_w(uint8_t data); - uint8_t rockrage_VLM5030_busy_r(); - void rockrage_speech_w(uint8_t data); - virtual void machine_start() override; - virtual void machine_reset() override; - void rockrage_palette(palette_device &palette) const; - uint32_t screen_update_rockrage(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_WRITE_LINE_MEMBER(vblank_irq); - K007342_CALLBACK_MEMBER(rockrage_tile_callback); - K007420_CALLBACK_MEMBER(rockrage_sprite_callback); - - void rockrage_map(address_map &map); - void rockrage_sound_map(address_map &map); - void rockrage_vlm_map(address_map &map); -}; - -#endif // MAME_INCLUDES_ROCKRAGE_H diff --git a/src/mame/konami/rockrage_v.cpp b/src/mame/konami/rockrage_v.cpp deleted file mode 100644 index bffcf57aefe..00000000000 --- a/src/mame/konami/rockrage_v.cpp +++ /dev/null @@ -1,81 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Manuel Abadia -#include "emu.h" -#include "rockrage.h" - -void rockrage_state::rockrage_palette(palette_device &palette) const -{ - uint8_t const *const color_prom = memregion("proms")->base(); - - for (int i = 0; i < 256*3; i++) - { - // layer0 uses colors 0x00-0x0f; layer1 uses 0x10-0x1f; sprites use 0x20-0x2f - uint8_t const colorbase = (i / 256) * 16; - uint8_t const ctabentry = (color_prom[i] & 0x0f) | colorbase; - palette.set_pen_indirect(i, ctabentry); - } -} - - - -/*************************************************************************** - - Callback for the K007342 - -***************************************************************************/ - -K007342_CALLBACK_MEMBER(rockrage_state::rockrage_tile_callback) -{ - if (layer == 1) - *code |= ((*color & 0x40) << 2) | ((m_vreg & 0x04) << 7); // doesn't use bank here (Tutankhamen eyes blinking) - else - *code |= ((*color & 0x40) << 2) | ((bank & 0x03) << 10) | ((m_vreg & 0x04) << 7) | ((m_vreg & 0x08) << 9); - *color = layer * 16 + (*color & 0x0f); -} - -/*************************************************************************** - - Callback for the K007420 - -***************************************************************************/ - -K007420_CALLBACK_MEMBER(rockrage_state::rockrage_sprite_callback) -{ - *code |= ((*color & 0x40) << 2) | ((*color & 0x80) << 1) * ((m_vreg & 0x03) << 1); - *code = (*code << 2) | ((*color & 0x30) >> 4); - *color = 0 + (*color & 0x0f); -} - - -void rockrage_state::rockrage_vreg_w(uint8_t data) -{ - /* bits 4-7: unused */ - /* bit 3: bit 4 of bank # (layer 0) */ - /* bit 2: bit 1 of bank # (layer 0) */ - /* bits 0-1: sprite bank select */ - - if ((data & 0x0c) != (m_vreg & 0x0c)) - machine().tilemap().mark_all_dirty(); - - m_vreg = data; -} - -/*************************************************************************** - - Screen Refresh - -***************************************************************************/ - -uint32_t rockrage_state::screen_update_rockrage(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_k007342->tilemap_update(); - - bitmap.fill(0, cliprect); - m_k007342->tilemap_draw(screen, bitmap, cliprect, 0, TILEMAP_DRAW_OPAQUE, 0); - // Tutankhamen eyes go below sprites - m_k007342->tilemap_draw(screen, bitmap, cliprect, 1, 0, 0); - m_k007420->sprites_draw(bitmap, cliprect, m_gfxdecode->gfx(1)); - m_k007342->tilemap_draw(screen, bitmap, cliprect, 0, 1, 0); - m_k007342->tilemap_draw(screen, bitmap, cliprect, 1, 1, 0); - return 0; -} diff --git a/src/mame/konami/rocnrope.cpp b/src/mame/konami/rocnrope.cpp index ad8845b9708..a0239ea03be 100644 --- a/src/mame/konami/rocnrope.cpp +++ b/src/mame/konami/rocnrope.cpp @@ -1,5 +1,6 @@ // license:BSD-3-Clause -// copyright-holders:Chris Hardy +// copyright-holders: Chris Hardy + /*************************************************************************** Roc'n Rope (c) 1983 Konami @@ -9,17 +10,197 @@ ***************************************************************************/ #include "emu.h" -#include "rocnrope.h" + +#include "konami1.h" #include "konamipt.h" #include "timeplt_a.h" #include "cpu/m6809/m6809.h" #include "machine/74259.h" -#include "konami1.h" #include "machine/watchdog.h" +#include "video/resnet.h" + +#include "emupal.h" #include "screen.h" #include "speaker.h" +#include "tilemap.h" + + +namespace { + +class rocnrope_state : public driver_device +{ +public: + rocnrope_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette"), + m_spriteram(*this, "spriteram_%u", 0U), + m_colorram(*this, "colorram"), + m_videoram(*this, "videoram"), + m_vectors(*this, "vectors") + { } + + void rocnrope(machine_config &config); + + void init_rocnrope(); + +protected: + virtual void machine_start() override; + virtual void video_start() override; + +private: + // devices + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_palette; + + // memory pointers + required_shared_ptr_array m_spriteram; + required_shared_ptr m_colorram; + required_shared_ptr m_videoram; + required_shared_ptr m_vectors; + + tilemap_t *m_bg_tilemap = nullptr; + uint8_t m_irq_mask = 0; + + void interrupt_vector_w(offs_t offset, uint8_t data); + DECLARE_WRITE_LINE_MEMBER(irq_mask_w); + template DECLARE_WRITE_LINE_MEMBER(coin_counter_w); + void videoram_w(offs_t offset, uint8_t data); + void colorram_w(offs_t offset, uint8_t data); + + TILE_GET_INFO_MEMBER(get_bg_tile_info); + void palette(palette_device &palette) const; + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_WRITE_LINE_MEMBER(vblank_irq); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); + void main_map(address_map &map); +}; + +// video + +/*************************************************************************** + + Convert the color PROMs into a more useable format. + + Roc'n Rope has one 32x8 palette PROM and two 256x4 lookup table PROMs + (one for characters, one for sprites). + The palette PROM is connected to the RGB output this way: + + bit 7 -- 220 ohm resistor -- BLUE + -- 470 ohm resistor -- BLUE + -- 220 ohm resistor -- GREEN + -- 470 ohm resistor -- GREEN + -- 1 kohm resistor -- GREEN + -- 220 ohm resistor -- RED + -- 470 ohm resistor -- RED + bit 0 -- 1 kohm resistor -- RED + +***************************************************************************/ + +void rocnrope_state::palette(palette_device &palette) const +{ + const uint8_t *color_prom = memregion("proms")->base(); + static constexpr int resistances_rg[3] = { 1000, 470, 220 }; + static constexpr int resistances_b [2] = { 470, 220 }; + + // compute the color output resistor weights + double rweights[3], gweights[3], bweights[2]; + compute_resistor_weights(0, 255, -1.0, + 3, &resistances_rg[0], rweights, 1000, 0, + 3, &resistances_rg[0], gweights, 1000, 0, + 2, &resistances_b[0], bweights, 1000, 0); + + // create a lookup table for the palette + for (int i = 0; i < 0x20; i++) + { + int bit0, bit1, bit2; + + // red component + bit0 = BIT(color_prom[i], 0); + bit1 = BIT(color_prom[i], 1); + bit2 = BIT(color_prom[i], 2); + int const r = combine_weights(rweights, bit0, bit1, bit2); + + // green component + bit0 = BIT(color_prom[i], 3); + bit1 = BIT(color_prom[i], 4); + bit2 = BIT(color_prom[i], 5); + int const g = combine_weights(gweights, bit0, bit1, bit2); + + // blue component + bit0 = BIT(color_prom[i], 6); + bit1 = BIT(color_prom[i], 7); + int const b = combine_weights(bweights, bit0, bit1); + + palette.set_indirect_color(i, rgb_t(r, g, b)); + } + + // color_prom now points to the beginning of the lookup table + color_prom += 0x20; + + // sprites and characters + for (int i = 0; i < 0x200; i++) + { + uint8_t const ctabentry = color_prom[i] & 0x0f; + palette.set_pen_indirect(i, ctabentry); + } +} + +void rocnrope_state::videoram_w(offs_t offset, uint8_t data) +{ + m_videoram[offset] = data; + m_bg_tilemap->mark_tile_dirty(offset); +} + +void rocnrope_state::colorram_w(offs_t offset, uint8_t data) +{ + m_colorram[offset] = data; + m_bg_tilemap->mark_tile_dirty(offset); +} + +TILE_GET_INFO_MEMBER(rocnrope_state::get_bg_tile_info) +{ + int const attr = m_colorram[tile_index]; + int const code = m_videoram[tile_index] + 2 * (attr & 0x80); + int const color = attr & 0x0f; + int const flags = ((attr & 0x40) ? TILE_FLIPX : 0) | ((attr & 0x20) ? TILE_FLIPY : 0); + + tileinfo.set(1, code, color, flags); +} + +void rocnrope_state::video_start() +{ + m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(rocnrope_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); +} + +void rocnrope_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + for (int offs = m_spriteram[0].bytes() - 2; offs >= 0; offs -= 2) + { + int const color = m_spriteram[1][offs] & 0x0f; + + m_gfxdecode->gfx(0)->transmask(bitmap, cliprect, + m_spriteram[0][offs + 1], + color, + m_spriteram[1][offs] & 0x40, ~m_spriteram[1][offs] & 0x80, + 240 - m_spriteram[0][offs], m_spriteram[1][offs + 1], + m_palette->transpen_mask(*m_gfxdecode->gfx(0), color, 0)); + } +} + +uint32_t rocnrope_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + draw_sprites(bitmap, cliprect); + return 0; +} + + +// machine void rocnrope_state::machine_start() { @@ -191,8 +372,8 @@ static const gfx_layout spritelayout = }; static GFXDECODE_START( gfx_rocnrope ) - GFXDECODE_ENTRY( "gfx1", 0, spritelayout, 0, 16 ) - GFXDECODE_ENTRY( "gfx2", 0, charlayout, 16*16, 16 ) + GFXDECODE_ENTRY( "sprites", 0, spritelayout, 0, 16 ) + GFXDECODE_ENTRY( "tiles", 0, charlayout, 16*16, 16 ) GFXDECODE_END @@ -216,7 +397,7 @@ void rocnrope_state::rocnrope(machine_config &config) m_maincpu->set_addrmap(AS_PROGRAM, &rocnrope_state::main_map); ls259_device &mainlatch(LS259(config, "mainlatch")); // B2 - mainlatch.q_out_cb<0>().set(FUNC(rocnrope_state::flip_screen_w)); + mainlatch.q_out_cb<0>().set(FUNC(rocnrope_state::flip_screen_set)).invert(); mainlatch.q_out_cb<1>().set("timeplt_audio", FUNC(timeplt_audio_device::sh_irqtrigger_w)); mainlatch.q_out_cb<2>().set("timeplt_audio", FUNC(timeplt_audio_device::mute_w)); mainlatch.q_out_cb<3>().set(FUNC(rocnrope_state::coin_counter_w<0>)); @@ -267,13 +448,13 @@ ROM_START( rocnrope ) ROM_LOAD( "rnr_7a.snd", 0x0000, 0x1000, CRC(75d2c4e2) SHA1(b701019b4e7b06b268be660ce7958b5367318c27) ) ROM_LOAD( "rnr_8a.snd", 0x1000, 0x1000, CRC(ca4325ae) SHA1(34ac035c0c2ed6bcafde1491d976bb9e9d2a2a7d) ) - ROM_REGION( 0x8000, "gfx1", 0 ) + ROM_REGION( 0x8000, "sprites", 0 ) ROM_LOAD( "rnr_a11.vid", 0x0000, 0x2000, CRC(afdaba5e) SHA1(27c090cb1c3767c997daeedbe1ba24786f9e78f1) ) ROM_LOAD( "rnr_a12.vid", 0x2000, 0x2000, CRC(054cafeb) SHA1(4c3cd850b347217af3dd5c9bb84bcff7b30689bd) ) ROM_LOAD( "rnr_a9.vid", 0x4000, 0x2000, CRC(9d2166b2) SHA1(42d2b05360e58b1b2b3ad06c98eb46d9da2b1c21) ) ROM_LOAD( "rnr_a10.vid", 0x6000, 0x2000, CRC(aff6e22f) SHA1(476d67821519feddc9f9c8537b46e6eede790035) ) - ROM_REGION( 0x4000, "gfx2", 0 ) + ROM_REGION( 0x4000, "tiles", 0 ) ROM_LOAD( "rnr_h12.vid", 0x0000, 0x2000, CRC(e2114539) SHA1(0ea19ae4d7c2da14f23c81abb8e2c931785b2715) ) ROM_LOAD( "rnr_h11.vid", 0x2000, 0x2000, CRC(169a8f3f) SHA1(182c7c9b9849ebb57b3ff7c0b629f2f8e2efa9ba) ) @@ -282,7 +463,7 @@ ROM_START( rocnrope ) ROM_LOAD( "b16_prom.bin", 0x0020, 0x0100, CRC(750a9677) SHA1(7a5b4aed5f87180850657b8852bb3f3138d58b5b) ) ROM_LOAD( "rocnrope.pr3", 0x0120, 0x0100, CRC(b5c75a27) SHA1(923d6ccf015fd7458494416cc05426cc922a9238) ) - ROM_REGION( 0x0001, "pal_cpuvidbd", 0 ) // PAL located on the cpu/video board + ROM_REGION( 0x0001, "pal_cpuvidbd", 0 ) // PAL located on the CPU/video board ROM_LOAD( "h100.6g", 0x0000, 0x0001, NO_DUMP ) // 20 Pin chip. Appears to be a PAL. Schematics obfuscated. ROM_END @@ -298,13 +479,13 @@ ROM_START( rocnropek ) ROM_LOAD( "rnr_7a.snd", 0x0000, 0x1000, CRC(75d2c4e2) SHA1(b701019b4e7b06b268be660ce7958b5367318c27) ) ROM_LOAD( "rnr_8a.snd", 0x1000, 0x1000, CRC(ca4325ae) SHA1(34ac035c0c2ed6bcafde1491d976bb9e9d2a2a7d) ) - ROM_REGION( 0x8000, "gfx1", 0 ) + ROM_REGION( 0x8000, "sprites", 0 ) ROM_LOAD( "rnr_a11.vid", 0x0000, 0x2000, CRC(afdaba5e) SHA1(27c090cb1c3767c997daeedbe1ba24786f9e78f1) ) ROM_LOAD( "rnr_a12.vid", 0x2000, 0x2000, CRC(054cafeb) SHA1(4c3cd850b347217af3dd5c9bb84bcff7b30689bd) ) ROM_LOAD( "rnr_a9.vid", 0x4000, 0x2000, CRC(9d2166b2) SHA1(42d2b05360e58b1b2b3ad06c98eb46d9da2b1c21) ) ROM_LOAD( "rnr_a10.vid", 0x6000, 0x2000, CRC(aff6e22f) SHA1(476d67821519feddc9f9c8537b46e6eede790035) ) - ROM_REGION( 0x4000, "gfx2", 0 ) + ROM_REGION( 0x4000, "tiles", 0 ) ROM_LOAD( "rnr_h12.vid", 0x0000, 0x2000, CRC(e2114539) SHA1(0ea19ae4d7c2da14f23c81abb8e2c931785b2715) ) ROM_LOAD( "rnr_h11.vid", 0x2000, 0x2000, CRC(169a8f3f) SHA1(182c7c9b9849ebb57b3ff7c0b629f2f8e2efa9ba) ) @@ -313,7 +494,7 @@ ROM_START( rocnropek ) ROM_LOAD( "b16_prom.bin", 0x0020, 0x0100, CRC(750a9677) SHA1(7a5b4aed5f87180850657b8852bb3f3138d58b5b) ) ROM_LOAD( "rocnrope.pr3", 0x0120, 0x0100, CRC(b5c75a27) SHA1(923d6ccf015fd7458494416cc05426cc922a9238) ) - ROM_REGION( 0x0001, "pal_cpuvidbd", 0 ) // PAL located on the cpu/video board + ROM_REGION( 0x0001, "pal_cpuvidbd", 0 ) // PAL located on the CPU/video board ROM_LOAD( "h100.6g", 0x0000, 0x0001, NO_DUMP ) // 20 Pin chip. Appears to be a PAL. Schematics obfuscated. ROM_END @@ -346,13 +527,13 @@ ROM_START( ropeman ) ROM_LOAD( "r12.7a", 0x0000, 0x1000, CRC(75d2c4e2) SHA1(b701019b4e7b06b268be660ce7958b5367318c27) ) ROM_LOAD( "r13.8a", 0x1000, 0x1000, CRC(ca4325ae) SHA1(34ac035c0c2ed6bcafde1491d976bb9e9d2a2a7d) ) - ROM_REGION( 0x8000, "gfx1", 0 ) + ROM_REGION( 0x8000, "sprites", 0 ) ROM_LOAD( "r10.11a", 0x0000, 0x2000, CRC(afdaba5e) SHA1(27c090cb1c3767c997daeedbe1ba24786f9e78f1) ) ROM_LOAD( "r11.12a", 0x2000, 0x2000, CRC(054cafeb) SHA1(4c3cd850b347217af3dd5c9bb84bcff7b30689bd) ) ROM_LOAD( "r8.9a", 0x4000, 0x2000, CRC(9d2166b2) SHA1(42d2b05360e58b1b2b3ad06c98eb46d9da2b1c21) ) ROM_LOAD( "r9.10a", 0x6000, 0x2000, CRC(aff6e22f) SHA1(476d67821519feddc9f9c8537b46e6eede790035) ) - ROM_REGION( 0x4000, "gfx2", 0 ) + ROM_REGION( 0x4000, "tiles", 0 ) ROM_LOAD( "r7.12j", 0x0000, 0x2000, CRC(cd8ac4bf) SHA1(22bfd9ac0188bec6a1e8daa8ab915af1a5de7bd7) ) ROM_LOAD( "r6.11j", 0x2000, 0x2000, CRC(35891835) SHA1(9dc6795e336c61b5349cf7bf69a3dc9438ae9336) ) @@ -361,7 +542,7 @@ ROM_START( ropeman ) ROM_LOAD( "2.16b", 0x0020, 0x0100, CRC(750a9677) SHA1(7a5b4aed5f87180850657b8852bb3f3138d58b5b) ) // TBP24S10N ROM_LOAD( "3.16g", 0x0120, 0x0100, CRC(b5c75a27) SHA1(923d6ccf015fd7458494416cc05426cc922a9238) ) // TBP24S10N - ROM_REGION( 0x002c, "pal_cpuvidbd", 0 ) // MMI PAL10L8 located on the cpu/video board + ROM_REGION( 0x002c, "pal_cpuvidbd", 0 ) // MMI PAL10L8 located on the CPU/video board ROM_LOAD( "pal10l8.6g", 0x0000, 0x002c, CRC(82e98da9) SHA1(a49cb9713c6553969de75dc60fc7981d8aa8a4d6) ) ROM_REGION( 0x01D6, "pals_daughterbd", 0 ) // N82S153's located on the daughterboard of the cpu/video board @@ -378,9 +559,11 @@ ROM_END void rocnrope_state::init_rocnrope() { - memregion("maincpu")->base()[0x703d] = 0x98^0x22; // HACK: fix one instruction + memregion("maincpu")->base()[0x703d] = 0x98 ^ 0x22; // HACK: fix one instruction } +} // anonymous namespace + /************************************* * @@ -388,6 +571,6 @@ void rocnrope_state::init_rocnrope() * *************************************/ -GAME( 1983, rocnrope, 0, rocnrope, rocnrope, rocnrope_state, init_rocnrope, ROT270, "Konami", "Roc'n Rope", MACHINE_SUPPORTS_SAVE ) -GAME( 1983, rocnropek, rocnrope, rocnrope, rocnrope, rocnrope_state, empty_init, ROT270, "Konami (Kosuka license)", "Roc'n Rope (Kosuka)", MACHINE_SUPPORTS_SAVE ) -GAME( 1983, ropeman, rocnrope, rocnrope, rocnrope, rocnrope_state, init_rocnrope, ROT270, "bootleg", "Ropeman (bootleg of Roc'n Rope)", MACHINE_SUPPORTS_SAVE ) +GAME( 1983, rocnrope, 0, rocnrope, rocnrope, rocnrope_state, init_rocnrope, ROT270, "Konami", "Roc'n Rope", MACHINE_SUPPORTS_SAVE ) +GAME( 1983, rocnropek, rocnrope, rocnrope, rocnrope, rocnrope_state, empty_init, ROT270, "Konami (Kosuka license)", "Roc'n Rope (Kosuka)", MACHINE_SUPPORTS_SAVE ) +GAME( 1983, ropeman, rocnrope, rocnrope, rocnrope, rocnrope_state, init_rocnrope, ROT270, "bootleg", "Ropeman (bootleg of Roc'n Rope)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/konami/rocnrope.h b/src/mame/konami/rocnrope.h deleted file mode 100644 index 4e3c55c6194..00000000000 --- a/src/mame/konami/rocnrope.h +++ /dev/null @@ -1,63 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Chris Hardy -#ifndef MAME_INCLUDES_ROCNROPE_H -#define MAME_INCLUDES_ROCNROPE_H - -#pragma once - -#include "emupal.h" -#include "tilemap.h" - -class rocnrope_state : public driver_device -{ -public: - rocnrope_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"), - m_spriteram(*this, "spriteram_%u", 0U), - m_colorram(*this, "colorram"), - m_videoram(*this, "videoram"), - m_vectors(*this, "vectors") - { } - - void rocnrope(machine_config &config); - - void init_rocnrope(); - -protected: - virtual void machine_start() override; - virtual void video_start() override; - -private: - // devices - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_palette; - - // memory pointers - required_shared_ptr_array m_spriteram; - required_shared_ptr m_colorram; - required_shared_ptr m_videoram; - required_shared_ptr m_vectors; - - tilemap_t *m_bg_tilemap = nullptr; - uint8_t m_irq_mask = 0; - - void interrupt_vector_w(offs_t offset, uint8_t data); - DECLARE_WRITE_LINE_MEMBER(irq_mask_w); - template DECLARE_WRITE_LINE_MEMBER(coin_counter_w); - void videoram_w(offs_t offset, uint8_t data); - void colorram_w(offs_t offset, uint8_t data); - DECLARE_WRITE_LINE_MEMBER(flip_screen_w); - - TILE_GET_INFO_MEMBER(get_bg_tile_info); - void palette(palette_device &palette) const; - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_WRITE_LINE_MEMBER(vblank_irq); - void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ); - void main_map(address_map &map); -}; - -#endif // MAME_INCLUDES_ROCNROPE_H diff --git a/src/mame/konami/rocnrope_v.cpp b/src/mame/konami/rocnrope_v.cpp deleted file mode 100644 index f801249bf83..00000000000 --- a/src/mame/konami/rocnrope_v.cpp +++ /dev/null @@ -1,135 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Chris Hardy -/*************************************************************************** - - rocnrope.cpp - - Functions to emulate the video hardware of the machine. - -***************************************************************************/ - -#include "emu.h" -#include "video/resnet.h" -#include "rocnrope.h" - -/*************************************************************************** - - Convert the color PROMs into a more useable format. - - Roc'n Rope has one 32x8 palette PROM and two 256x4 lookup table PROMs - (one for characters, one for sprites). - The palette PROM is connected to the RGB output this way: - - bit 7 -- 220 ohm resistor -- BLUE - -- 470 ohm resistor -- BLUE - -- 220 ohm resistor -- GREEN - -- 470 ohm resistor -- GREEN - -- 1 kohm resistor -- GREEN - -- 220 ohm resistor -- RED - -- 470 ohm resistor -- RED - bit 0 -- 1 kohm resistor -- RED - -***************************************************************************/ - -void rocnrope_state::palette(palette_device &palette) const -{ - const uint8_t *color_prom = memregion("proms")->base(); - static constexpr int resistances_rg[3] = { 1000, 470, 220 }; - static constexpr int resistances_b [2] = { 470, 220 }; - - // compute the color output resistor weights - double rweights[3], gweights[3], bweights[2]; - compute_resistor_weights(0, 255, -1.0, - 3, &resistances_rg[0], rweights, 1000, 0, - 3, &resistances_rg[0], gweights, 1000, 0, - 2, &resistances_b[0], bweights, 1000, 0); - - // create a lookup table for the palette - for (int i = 0; i < 0x20; i++) - { - int bit0, bit1, bit2; - - // red component - bit0 = BIT(color_prom[i], 0); - bit1 = BIT(color_prom[i], 1); - bit2 = BIT(color_prom[i], 2); - int const r = combine_weights(rweights, bit0, bit1, bit2); - - // green component - bit0 = BIT(color_prom[i], 3); - bit1 = BIT(color_prom[i], 4); - bit2 = BIT(color_prom[i], 5); - int const g = combine_weights(gweights, bit0, bit1, bit2); - - // blue component - bit0 = BIT(color_prom[i], 6); - bit1 = BIT(color_prom[i], 7); - int const b = combine_weights(bweights, bit0, bit1); - - palette.set_indirect_color(i, rgb_t(r, g, b)); - } - - // color_prom now points to the beginning of the lookup table - color_prom += 0x20; - - // sprites and characters - for (int i = 0; i < 0x200; i++) - { - uint8_t const ctabentry = color_prom[i] & 0x0f; - palette.set_pen_indirect(i, ctabentry); - } -} - -void rocnrope_state::videoram_w(offs_t offset, uint8_t data) -{ - m_videoram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset); -} - -void rocnrope_state::colorram_w(offs_t offset, uint8_t data) -{ - m_colorram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset); -} - -WRITE_LINE_MEMBER(rocnrope_state::flip_screen_w) -{ - flip_screen_set(!state); -} - -TILE_GET_INFO_MEMBER(rocnrope_state::get_bg_tile_info) -{ - int attr = m_colorram[tile_index]; - int code = m_videoram[tile_index] + 2 * (attr & 0x80); - int color = attr & 0x0f; - int flags = ((attr & 0x40) ? TILE_FLIPX : 0) | ((attr & 0x20) ? TILE_FLIPY : 0); - - tileinfo.set(1, code, color, flags); -} - -void rocnrope_state::video_start() -{ - m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(rocnrope_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); -} - -void rocnrope_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ) -{ - for (int offs = m_spriteram[0].bytes() - 2;offs >= 0;offs -= 2) - { - int color = m_spriteram[1][offs] & 0x0f; - - m_gfxdecode->gfx(0)->transmask(bitmap,cliprect, - m_spriteram[0][offs + 1], - color, - m_spriteram[1][offs] & 0x40, ~m_spriteram[1][offs] & 0x80, - 240 - m_spriteram[0][offs], m_spriteram[1][offs + 1], - m_palette->transpen_mask(*m_gfxdecode->gfx(0), color, 0)); - } -} - -uint32_t rocnrope_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - draw_sprites(bitmap, cliprect); - return 0; -} diff --git a/src/mame/konami/scotrsht.cpp b/src/mame/konami/scotrsht.cpp index f18da1ff7ab..298b365c5b6 100644 --- a/src/mame/konami/scotrsht.cpp +++ b/src/mame/konami/scotrsht.cpp @@ -1,5 +1,6 @@ // license:BSD-3-Clause -// copyright-holders:David Haywood, Pierpaolo Prazzoli +// copyright-holders: David Haywood, Pierpaolo Prazzoli + /*************************************************************************** GX545 Scooter Shooter - (c) 1985 Konami @@ -7,13 +8,13 @@ It uses a mixed hardware based on Jailbreak and Iron Horse -Stephh's notes (based on the game M6502 code and some tests) : +Stephh's notes (based on the game M6809 code and some tests) : - There is a leftover from an unknown previous Konami game when you enter your initials (code at 0x43f2) : if DSW2 bit 2 is ON and DSW3 bit 1 is OFF, you ALWAYS have to use player 1 controls ! - Here is what you have for example in jailbrek.c driver : + Here is what you have for example in konami/jailbrek.cpp driver : PORT_START("DSW2") ... @@ -35,16 +36,215 @@ Stephh's notes (based on the game M6502 code and some tests) : ***************************************************************************/ #include "emu.h" -#include "scotrsht.h" + #include "konamipt.h" -#include "cpu/z80/z80.h" #include "cpu/m6809/m6809.h" +#include "cpu/z80/z80.h" +#include "machine/gen_latch.h" #include "machine/watchdog.h" #include "sound/ymopn.h" + +#include "emupal.h" #include "screen.h" #include "speaker.h" +#include "tilemap.h" + + +namespace { + +class scotrsht_state : public driver_device +{ +public: + scotrsht_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_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette"), + m_colorram(*this, "colorram"), + m_videoram(*this, "videoram"), + m_spriteram(*this, "spriteram"), + m_scroll(*this, "scroll") + { } + + void scotrsht(machine_config &config); + +protected: + virtual void video_start() override; + +private: + required_device m_maincpu; + required_device m_audiocpu; + required_device m_gfxdecode; + required_device m_palette; + + required_shared_ptr m_colorram; + required_shared_ptr m_videoram; + required_shared_ptr m_spriteram; + required_shared_ptr m_scroll; + + tilemap_t *m_bg_tilemap = nullptr; + + uint8_t m_irq_enable = 0; + uint8_t m_charbank = 0; + uint8_t m_palette_bank = 0; + + void ctrl_w(uint8_t data); + void soundlatch_w(uint8_t data); + void videoram_w(offs_t offset, uint8_t data); + void colorram_w(offs_t offset, uint8_t data); + void charbank_w(uint8_t data); + void palettebank_w(uint8_t data); + + TILE_GET_INFO_MEMBER(get_bg_tile_info); + + DECLARE_WRITE_LINE_MEMBER(vblank_irq); + + void palette(palette_device &palette) const; + + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); + void main_map(address_map &map); + void sound_map(address_map &map); + void sound_portmap(address_map &map); +}; + + +// video + +// Similar to Iron Horse +void scotrsht_state::palette(palette_device &palette) const +{ + const uint8_t *color_prom = memregion("proms")->base(); + + // create a lookup table for the palette + for (int i = 0; i < 0x100; i++) + { + int const r = pal4bit(color_prom[i | 0x000]); + int const g = pal4bit(color_prom[i | 0x100]); + int const b = pal4bit(color_prom[i | 0x200]); + + palette.set_indirect_color(i, rgb_t(r, g, b)); + } + + // color_prom now points to the beginning of the lookup table + color_prom += 0x300; + + // characters use colors 0x80-0xff, sprites use colors 0-0x7f + for (int i = 0; i < 0x200; i++) + { + for (int j = 0; j < 8; j++) + { + uint8_t const ctabentry = ((~i & 0x100) >> 1) | (j << 4) | (color_prom[i] & 0x0f); + palette.set_pen_indirect(((i & 0x100) << 3) | (j << 8) | (i & 0xff), ctabentry); + } + } +} +void scotrsht_state::videoram_w(offs_t offset, uint8_t data) +{ + m_videoram[offset] = data; + m_bg_tilemap->mark_tile_dirty(offset); +} + +void scotrsht_state::colorram_w(offs_t offset, uint8_t data) +{ + m_colorram[offset] = data; + m_bg_tilemap->mark_tile_dirty(offset); +} + +void scotrsht_state::charbank_w(uint8_t data) +{ + if (m_charbank != (data & 0x01)) + { + m_charbank = data & 0x01; + m_bg_tilemap->mark_all_dirty(); + } + + // other bits unknown +} + +void scotrsht_state::palettebank_w(uint8_t data) +{ + if (m_palette_bank != ((data & 0x70) >> 4)) + { + m_palette_bank = ((data & 0x70) >> 4); + m_bg_tilemap->mark_all_dirty(); + } + + machine().bookkeeping().coin_counter_w(0, data & 1); + machine().bookkeeping().coin_counter_w(1, data & 2); + + // data & 4 unknown +} + + +TILE_GET_INFO_MEMBER(scotrsht_state::get_bg_tile_info) +{ + int const attr = m_colorram[tile_index]; + int const code = m_videoram[tile_index] + (m_charbank << 9) + ((attr & 0x40) << 2); + int const color = (attr & 0x0f) + m_palette_bank * 16; + int flag = 0; + + if (attr & 0x10) flag |= TILE_FLIPX; + if (attr & 0x20) flag |= TILE_FLIPY; + + // data & 0x80 -> tile priority? + + tileinfo.set(0, code, color, flag); +} + +// Same as Jailbreak + palette bank +void scotrsht_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + for (int i = 0; i < m_spriteram.bytes(); i += 4) + { + int const attr = m_spriteram[i + 1]; // attributes = ?tyxcccc + int const code = m_spriteram[i] + ((attr & 0x40) << 2); + int const color = (attr & 0x0f) + m_palette_bank * 16; + int flipx = attr & 0x10; + int flipy = attr & 0x20; + int sx = m_spriteram[i + 2] - ((attr & 0x80) << 1); + int sy = m_spriteram[i + 3]; + + if (flip_screen()) + { + sx = 240 - sx; + sy = 240 - sy; + flipx = !flipx; + flipy = !flipy; + } + + m_gfxdecode->gfx(1)->transmask(bitmap, cliprect, code, color, flipx, flipy, + sx, sy, + m_palette->transpen_mask(*m_gfxdecode->gfx(1), color, m_palette_bank * 16)); + } +} + +void scotrsht_state::video_start() +{ + m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(scotrsht_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); + + m_bg_tilemap->set_scroll_cols(64); + + save_item(NAME(m_irq_enable)); + save_item(NAME(m_charbank)); + save_item(NAME(m_palette_bank)); +} + +uint32_t scotrsht_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + for (int col = 0; col < 32; col++) + m_bg_tilemap->set_scrolly(col, m_scroll[col]); + + m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + draw_sprites(bitmap, cliprect); + return 0; +} + + +// machine void scotrsht_state::ctrl_w(uint8_t data) { @@ -58,27 +258,22 @@ WRITE_LINE_MEMBER(scotrsht_state::vblank_irq) m_maincpu->set_input_line(0, HOLD_LINE); } -void scotrsht_state::soundlatch_w(uint8_t data) -{ - m_soundlatch->write(data); - m_audiocpu->set_input_line(0, HOLD_LINE); -} -void scotrsht_state::scotrsht_map(address_map &map) +void scotrsht_state::main_map(address_map &map) { - map(0x0000, 0x07ff).ram().w(FUNC(scotrsht_state::colorram_w)).share("colorram"); - map(0x0800, 0x0fff).ram().w(FUNC(scotrsht_state::videoram_w)).share("videoram"); - map(0x1000, 0x10bf).ram().share("spriteram"); /* sprites */ - map(0x10c0, 0x1fff).ram(); /* work ram */ - map(0x2000, 0x201f).ram().share("scroll"); /* scroll registers */ + map(0x0000, 0x07ff).ram().w(FUNC(scotrsht_state::colorram_w)).share(m_colorram); + map(0x0800, 0x0fff).ram().w(FUNC(scotrsht_state::videoram_w)).share(m_videoram); + map(0x1000, 0x10bf).ram().share(m_spriteram); + map(0x10c0, 0x1fff).ram(); // work RAM + map(0x2000, 0x201f).ram().share(m_scroll); map(0x2040, 0x2040).nopw(); map(0x2041, 0x2041).nopw(); - map(0x2042, 0x2042).nopw(); /* it should be -> bit 2 = scroll direction like in jailbrek, but it's not used */ + map(0x2042, 0x2042).nopw(); // it should be -> bit 2 = scroll direction like in jailbrek, but it's not used map(0x2043, 0x2043).w(FUNC(scotrsht_state::charbank_w)); map(0x2044, 0x2044).w(FUNC(scotrsht_state::ctrl_w)); map(0x3000, 0x3000).w(FUNC(scotrsht_state::palettebank_w)); - map(0x3100, 0x3100).w(FUNC(scotrsht_state::soundlatch_w)); - map(0x3200, 0x3200).nopw(); /* it writes 0, 1 */ + map(0x3100, 0x3100).w("soundlatch", FUNC(generic_latch_8_device::write)); + map(0x3200, 0x3200).nopw(); // it writes 0, 1 map(0x3100, 0x3100).portr("DSW2"); map(0x3200, 0x3200).portr("DSW3"); map(0x3300, 0x3300).portr("SYSTEM"); @@ -89,14 +284,14 @@ void scotrsht_state::scotrsht_map(address_map &map) map(0x4000, 0xffff).rom(); } -void scotrsht_state::scotrsht_sound_map(address_map &map) +void scotrsht_state::sound_map(address_map &map) { map(0x0000, 0x3fff).rom(); map(0x4000, 0x43ff).ram(); - map(0x8000, 0x8000).r(m_soundlatch, FUNC(generic_latch_8_device::read)); + map(0x8000, 0x8000).r("soundlatch", FUNC(generic_latch_8_device::read)); } -void scotrsht_state::scotrsht_sound_port(address_map &map) +void scotrsht_state::sound_portmap(address_map &map) { map.global_mask(0xff); map(0x00, 0x01).rw("ymsnd", FUNC(ym2203_device::read), FUNC(ym2203_device::write)); @@ -104,7 +299,7 @@ void scotrsht_state::scotrsht_sound_port(address_map &map) static INPUT_PORTS_START( scotrsht ) - PORT_START("SYSTEM") /* $3300 */ + PORT_START("SYSTEM") // $3300 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) @@ -114,26 +309,26 @@ static INPUT_PORTS_START( scotrsht ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("P1") /* $3301 */ + PORT_START("P1") // $3301 KONAMI8_B1_UNK(1) - PORT_START("P2") /* $3302 */ + PORT_START("P2") // $3302 KONAMI8_B1_UNK(2) - PORT_START("DSW1") /* $3303 -> $196e */ + PORT_START("DSW1") // $3303 -> $196e KONAMI_COINAGE_LOC(DEF_STR( Free_Play ), "Invalid", SW1) - /* "Invalid" = both coin slots disabled */ + // "Invalid" = both coin slots disabled - PORT_START("DSW2") /* $3100 -> $196f */ + PORT_START("DSW2") // $3100 -> $196f PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:1,2") PORT_DIPSETTING( 0x03, "2" ) PORT_DIPSETTING( 0x02, "3" ) PORT_DIPSETTING( 0x01, "4" ) PORT_DIPSETTING( 0x00, "5" ) - PORT_DIPNAME( 0x04, 0x04, "Dip MUST be OFF !" ) PORT_DIPLOCATION("SW2:3") /* see notes */ + PORT_DIPNAME( 0x04, 0x04, "Dip MUST be OFF !" ) PORT_DIPLOCATION("SW2:3") // see notes PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW2:4") /* code at 0x40f4 */ + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW2:4") // code at 0x40f4 PORT_DIPSETTING( 0x08, "30k 110k 80k+" ) PORT_DIPSETTING( 0x00, "40k 120k 90k+" ) PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:5,6") @@ -146,11 +341,11 @@ static INPUT_PORTS_START( scotrsht ) PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_START("DSW3") /* $3200 -> $1970 */ + PORT_START("DSW3") // $3200 -> $1970 PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW3:1") PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, "Dip MUST be OFF !" ) PORT_DIPLOCATION("SW3:2") /* see notes */ + PORT_DIPNAME( 0x02, 0x02, "Dip MUST be OFF !" ) PORT_DIPLOCATION("SW3:2") // see notes PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPUNUSED_DIPLOC( 0x04, IP_ACTIVE_LOW, "SW3:3" ) @@ -158,48 +353,37 @@ static INPUT_PORTS_START( scotrsht ) INPUT_PORTS_END -static const gfx_layout charlayout = -{ - 8,8, /* 8*8 characters */ - RGN_FRAC(1,1), /* 1024 characters */ - 4, /* 4 bits per pixel */ - { 0, 1, 2, 3 }, /* the four bitplanes are packed in one nibble */ - { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4 }, - { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 }, - 32*8 /* every char takes 32 consecutive bytes */ -}; - static const gfx_layout spritelayout = { - 16,16, /* 16*16 sprites */ - RGN_FRAC(1,1), /* 512 sprites */ - 4, /* 4 bits per pixel */ - { 0, 1, 2, 3 }, /* the bitplanes are packed in one nibble */ + 16,16, // 16*16 sprites + RGN_FRAC(1,1), // 512 sprites + 4, // 4 bits per pixel + { 0, 1, 2, 3 }, // the bitplanes are packed in one nibble { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4, 32*8+0*4, 32*8+1*4, 32*8+2*4, 32*8+3*4, 32*8+4*4, 32*8+5*4, 32*8+6*4, 32*8+7*4 }, { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32, 16*32, 17*32, 18*32, 19*32, 20*32, 21*32, 22*32, 23*32 }, - 128*8 /* every sprite takes 128 consecutive bytes */ + 128*8 // every sprite takes 128 consecutive bytes }; static GFXDECODE_START( gfx_scotrsht ) - GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 16*8 ) /* characters */ - GFXDECODE_ENTRY( "gfx2", 0, spritelayout, 16*16*8, 16*8 ) /* sprites */ + GFXDECODE_ENTRY( "tiles", 0, gfx_8x8x4_packed_msb, 0, 16*8 ) + GFXDECODE_ENTRY( "sprites", 0, spritelayout, 16*16*8, 16*8 ) GFXDECODE_END void scotrsht_state::scotrsht(machine_config &config) { - /* basic machine hardware */ - MC6809E(config, m_maincpu, 18432000/6); /* 3.072 MHz */ - m_maincpu->set_addrmap(AS_PROGRAM, &scotrsht_state::scotrsht_map); + // basic machine hardware + MC6809E(config, m_maincpu, 18'432'000 / 6); // 3.072 MHz + m_maincpu->set_addrmap(AS_PROGRAM, &scotrsht_state::main_map); - Z80(config, m_audiocpu, 18432000/6); /* 3.072 MHz */ - m_audiocpu->set_addrmap(AS_PROGRAM, &scotrsht_state::scotrsht_sound_map); - m_audiocpu->set_addrmap(AS_IO, &scotrsht_state::scotrsht_sound_port); + Z80(config, m_audiocpu, 18'432'000 / 6); // 3.072 MHz + m_audiocpu->set_addrmap(AS_PROGRAM, &scotrsht_state::sound_map); + m_audiocpu->set_addrmap(AS_IO, &scotrsht_state::sound_portmap); WATCHDOG_TIMER(config, "watchdog"); - /* 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(0)); @@ -210,14 +394,14 @@ void scotrsht_state::scotrsht(machine_config &config) screen.screen_vblank().set(FUNC(scotrsht_state::vblank_irq)); GFXDECODE(config, m_gfxdecode, m_palette, gfx_scotrsht); - PALETTE(config, m_palette, FUNC(scotrsht_state::scotrsht_palette), 16*8*16+16*8*16, 256); + PALETTE(config, m_palette, FUNC(scotrsht_state::palette), 16*8*16+16*8*16, 256); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); - GENERIC_LATCH_8(config, m_soundlatch); + GENERIC_LATCH_8(config, "soundlatch").data_pending_callback().set_inputline(m_audiocpu, 0); - YM2203(config, "ymsnd", 18432000/6).add_route(ALL_OUTPUTS, "mono", 0.40); + YM2203(config, "ymsnd", 18'432'000 / 6).add_route(ALL_OUTPUTS, "mono", 0.40); } @@ -233,22 +417,25 @@ ROM_START( scotrsht ) ROM_CONTINUE( 0x4000, 0x4000 ) ROM_LOAD( "gx545_g02_10c.bin", 0xc000, 0x4000, CRC(b22c0586) SHA1(07c21609c6cdfe2b8dd734d21086c5236ff8197b) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for sound code */ + ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "gx545_g01_8c.bin", 0x0000, 0x4000, CRC(46a7cc65) SHA1(73389fe04ce40da124d630dc3f8e58600d9556fc) ) - ROM_REGION( 0x08000, "gfx1", 0 ) - ROM_LOAD( "gx545_g05_5f.bin", 0x0000, 0x8000, CRC(856c349c) SHA1(ba45e6d18e56cc7fc49c8fda190ec152ce6bd15c) ) /* characters */ + ROM_REGION( 0x08000, "tiles", 0 ) + ROM_LOAD( "gx545_g05_5f.bin", 0x0000, 0x8000, CRC(856c349c) SHA1(ba45e6d18e56cc7fc49c8fda190ec152ce6bd15c) ) - ROM_REGION( 0x10000, "gfx2", 0 ) - ROM_LOAD( "gx545_g06_6f.bin", 0x0000, 0x8000, CRC(14ad7601) SHA1(6dfcf2abfa2ea056c948d82d35c55f033f3e4678) ) /* sprites */ + ROM_REGION( 0x10000, "sprites", 0 ) + ROM_LOAD( "gx545_g06_6f.bin", 0x0000, 0x8000, CRC(14ad7601) SHA1(6dfcf2abfa2ea056c948d82d35c55f033f3e4678) ) ROM_LOAD( "gx545_h04_4f.bin", 0x8000, 0x8000, CRC(c06c11a3) SHA1(6e89c738498d716fd43d9cc7b71b23438bd3c4b8) ) ROM_REGION( 0x0500, "proms", 0 ) - ROM_LOAD( "gx545_6301_1f.bin", 0x0000, 0x0100, CRC(f584586f) SHA1(0576cd0a738737c18143af887efd5ce76cdfc7cb) ) /* red */ - ROM_LOAD( "gx545_6301_2f.bin", 0x0100, 0x0100, CRC(ad464db1) SHA1(24937f2c9143e925c9becb488e11aa6daa807817) ) /* green */ - ROM_LOAD( "gx545_6301_3f.bin", 0x0200, 0x0100, CRC(bd475d23) SHA1(4ae6dfbb5c40a5ff97d7d80d0a441c1dc6dc5705) ) /* blue */ - ROM_LOAD( "gx545_6301_7f.bin", 0x0300, 0x0100, CRC(2b0cd233) SHA1(a2ccf693bf378ce8dd311c4224ad20de59418f88) ) /* char lookup */ - ROM_LOAD( "gx545_6301_8f.bin", 0x0400, 0x0100, CRC(c1c7cf58) SHA1(08452228bf13e43ce4a05806f79e9cd1542416f1) ) /* sprites lookup */ + ROM_LOAD( "gx545_6301_1f.bin", 0x0000, 0x0100, CRC(f584586f) SHA1(0576cd0a738737c18143af887efd5ce76cdfc7cb) ) // red + ROM_LOAD( "gx545_6301_2f.bin", 0x0100, 0x0100, CRC(ad464db1) SHA1(24937f2c9143e925c9becb488e11aa6daa807817) ) // green + ROM_LOAD( "gx545_6301_3f.bin", 0x0200, 0x0100, CRC(bd475d23) SHA1(4ae6dfbb5c40a5ff97d7d80d0a441c1dc6dc5705) ) // blue + ROM_LOAD( "gx545_6301_7f.bin", 0x0300, 0x0100, CRC(2b0cd233) SHA1(a2ccf693bf378ce8dd311c4224ad20de59418f88) ) // char lookup + ROM_LOAD( "gx545_6301_8f.bin", 0x0400, 0x0100, CRC(c1c7cf58) SHA1(08452228bf13e43ce4a05806f79e9cd1542416f1) ) // sprites lookup ROM_END +} // anonymous namespace + + GAME( 1985, scotrsht, 0, scotrsht, scotrsht, scotrsht_state, empty_init, ROT90,"Konami", "Scooter Shooter", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/konami/scotrsht.h b/src/mame/konami/scotrsht.h deleted file mode 100644 index 99e69851160..00000000000 --- a/src/mame/konami/scotrsht.h +++ /dev/null @@ -1,69 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:David Haywood, Pierpaolo Prazzoli -#ifndef MAME_INCLUDES_SCOTRSHT_H -#define MAME_INCLUDES_SCOTRSHT_H - -#pragma once - -#include "machine/gen_latch.h" -#include "emupal.h" -#include "tilemap.h" - -class scotrsht_state : public driver_device -{ -public: - scotrsht_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_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"), - m_soundlatch(*this, "soundlatch"), - m_colorram(*this, "colorram"), - m_videoram(*this, "videoram"), - m_spriteram(*this, "spriteram"), - m_scroll(*this, "scroll") - { } - - void scotrsht(machine_config &config); - -private: - required_device m_maincpu; - required_device m_audiocpu; - required_device m_gfxdecode; - required_device m_palette; - required_device m_soundlatch; - - required_shared_ptr m_colorram; - required_shared_ptr m_videoram; - required_shared_ptr m_spriteram; - required_shared_ptr m_scroll; - - tilemap_t *m_bg_tilemap = nullptr; - - int m_irq_enable = 0; - int m_charbank = 0; - int m_palette_bank = 0; - - void ctrl_w(uint8_t data); - void soundlatch_w(uint8_t data); - void videoram_w(offs_t offset, uint8_t data); - void colorram_w(offs_t offset, uint8_t data); - void charbank_w(uint8_t data); - void palettebank_w(uint8_t data); - - TILE_GET_INFO_MEMBER(get_bg_tile_info); - - DECLARE_WRITE_LINE_MEMBER(vblank_irq); - - virtual void video_start() override; - void scotrsht_palette(palette_device &palette) const; - - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ); - void scotrsht_map(address_map &map); - void scotrsht_sound_map(address_map &map); - void scotrsht_sound_port(address_map &map); -}; - -#endif // MAME_INCLUDES_SCOTRSHT_H diff --git a/src/mame/konami/scotrsht_v.cpp b/src/mame/konami/scotrsht_v.cpp deleted file mode 100644 index b1b2c269789..00000000000 --- a/src/mame/konami/scotrsht_v.cpp +++ /dev/null @@ -1,135 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:David Haywood, Pierpaolo Prazzoli -#include "emu.h" -#include "scotrsht.h" - - -// Similar as Iron Horse -void scotrsht_state::scotrsht_palette(palette_device &palette) const -{ - const uint8_t *color_prom = memregion("proms")->base(); - - // create a lookup table for the palette - for (int i = 0; i < 0x100; i++) - { - int const r = pal4bit(color_prom[i | 0x000]); - int const g = pal4bit(color_prom[i | 0x100]); - int const b = pal4bit(color_prom[i | 0x200]); - - palette.set_indirect_color(i, rgb_t(r, g, b)); - } - - // color_prom now points to the beginning of the lookup table - color_prom += 0x300; - - // characters use colors 0x80-0xff, sprites use colors 0-0x7f - for (int i = 0; i < 0x200; i++) - { - for (int j = 0; j < 8; j++) - { - uint8_t const ctabentry = ((~i & 0x100) >> 1) | (j << 4) | (color_prom[i] & 0x0f); - palette.set_pen_indirect(((i & 0x100) << 3) | (j << 8) | (i & 0xff), ctabentry); - } - } -} - -void scotrsht_state::videoram_w(offs_t offset, uint8_t data) -{ - m_videoram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset); -} - -void scotrsht_state::colorram_w(offs_t offset, uint8_t data) -{ - m_colorram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset); -} - -void scotrsht_state::charbank_w(uint8_t data) -{ - if (m_charbank != (data & 0x01)) - { - m_charbank = data & 0x01; - m_bg_tilemap->mark_all_dirty(); - } - - // other bits unknown -} - -void scotrsht_state::palettebank_w(uint8_t data) -{ - if (m_palette_bank != ((data & 0x70) >> 4)) - { - m_palette_bank = ((data & 0x70) >> 4); - m_bg_tilemap->mark_all_dirty(); - } - - machine().bookkeeping().coin_counter_w(0, data & 1); - machine().bookkeeping().coin_counter_w(1, data & 2); - - // data & 4 unknown -} - - -TILE_GET_INFO_MEMBER(scotrsht_state::get_bg_tile_info) -{ - int attr = m_colorram[tile_index]; - int code = m_videoram[tile_index] + (m_charbank << 9) + ((attr & 0x40) << 2); - int color = (attr & 0x0f) + m_palette_bank * 16; - int flag = 0; - - if(attr & 0x10) flag |= TILE_FLIPX; - if(attr & 0x20) flag |= TILE_FLIPY; - - // data & 0x80 -> tile priority? - - tileinfo.set(0, code, color, flag); -} - -/* Same as Jailbreak + palette bank */ -void scotrsht_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ) -{ - for (int i = 0; i < m_spriteram.bytes(); i += 4) - { - int attr = m_spriteram[i + 1]; // attributes = ?tyxcccc - int code = m_spriteram[i] + ((attr & 0x40) << 2); - int color = (attr & 0x0f) + m_palette_bank * 16; - int flipx = attr & 0x10; - int flipy = attr & 0x20; - int sx = m_spriteram[i + 2] - ((attr & 0x80) << 1); - int sy = m_spriteram[i + 3]; - - if (flip_screen()) - { - sx = 240 - sx; - sy = 240 - sy; - flipx = !flipx; - flipy = !flipy; - } - - m_gfxdecode->gfx(1)->transmask(bitmap,cliprect, code, color, flipx, flipy, - sx, sy, - m_palette->transpen_mask(*m_gfxdecode->gfx(1), color, m_palette_bank * 16)); - } -} - -void scotrsht_state::video_start() -{ - m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(scotrsht_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); - - m_bg_tilemap->set_scroll_cols(64); - - save_item(NAME(m_irq_enable)); - save_item(NAME(m_charbank)); - save_item(NAME(m_palette_bank)); -} - -uint32_t scotrsht_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - for (int col = 0; col < 32; col++) - m_bg_tilemap->set_scrolly(col, m_scroll[col]); - - m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - draw_sprites(bitmap, cliprect); - return 0; -} diff --git a/src/mame/konami/shaolins.cpp b/src/mame/konami/shaolins.cpp index eef0d6cb8fe..01fe47a0145 100644 --- a/src/mame/konami/shaolins.cpp +++ b/src/mame/konami/shaolins.cpp @@ -1,5 +1,6 @@ // license:BSD-3-Clause -// copyright-holders:Allard van der Bas +// copyright-holders: Allard van der Bas + /*************************************************************************** Shaolin's Road @@ -99,53 +100,274 @@ Konami games from this era with some pins not used. ****************************************************************************/ #include "emu.h" -#include "shaolins.h" #include "cpu/m6809/m6809.h" +#include "machine/timer.h" #include "machine/watchdog.h" #include "sound/sn76496.h" +#include "video/resnet.h" + +#include "emupal.h" #include "screen.h" #include "speaker.h" +#include "tilemap.h" + + +namespace { + +class shaolins_state : public driver_device +{ +public: + shaolins_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this,"maincpu"), + m_screen(*this,"screen"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette"), + m_spriteram(*this, "spriteram%u", 1U), + m_colorram(*this, "colorram"), + m_videoram(*this, "videoram") + { } + + void shaolins(machine_config &config); + +protected: + virtual void video_start() override; + +private: + required_device m_maincpu; + required_device m_screen; + required_device m_gfxdecode; + required_device m_palette; + + required_shared_ptr_array m_spriteram; + required_shared_ptr m_colorram; + required_shared_ptr m_videoram; + + uint8_t m_palettebank = 0; + tilemap_t *m_bg_tilemap = nullptr; + uint8_t m_nmi_enable = 0; + + void videoram_w(offs_t offset, uint8_t data); + void colorram_w(offs_t offset, uint8_t data); + void palettebank_w(uint8_t data); + void scroll_w(uint8_t data); + void nmi_w(uint8_t data); + + TILE_GET_INFO_MEMBER(get_bg_tile_info); + + void palette(palette_device &palette) const; + + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); + + TIMER_DEVICE_CALLBACK_MEMBER(interrupt); + void prg_map(address_map &map); +}; + + +// video + +/*************************************************************************** + + Convert the color PROMs into a more useable format. + + Shao-lin's Road has three 256x4 palette PROMs (one per gun) and two 256x4 + lookup table PROMs (one for characters, one for sprites). + I don't know for sure how the palette PROMs are connected to the RGB + output, but it's probably the usual: + + bit 3 -- 220 ohm resistor -- RED/GREEN/BLUE + -- 470 ohm resistor -- RED/GREEN/BLUE + -- 1 kohm resistor -- RED/GREEN/BLUE + bit 0 -- 2.2kohm resistor -- RED/GREEN/BLUE + +***************************************************************************/ +void shaolins_state::palette(palette_device &palette) const +{ + const uint8_t *color_prom = memregion("proms")->base(); + static constexpr int resistances[4] = { 2200, 1000, 470, 220 }; + + // compute the color output resistor weights + double rweights[4], gweights[4], bweights[4]; + compute_resistor_weights(0, 255, -1.0, + 4, resistances, rweights, 470, 0, + 4, resistances, gweights, 470, 0, + 4, resistances, bweights, 470, 0); + + // create a lookup table for the palette + for (int i = 0; i < 0x100; i++) + { + int bit0, bit1, bit2, bit3; + + // red component + bit0 = BIT(color_prom[i | 0x000], 0); + bit1 = BIT(color_prom[i | 0x000], 1); + bit2 = BIT(color_prom[i | 0x000], 2); + bit3 = BIT(color_prom[i | 0x000], 3); + int const r = combine_weights(rweights, bit0, bit1, bit2, bit3); + + // green component + bit0 = BIT(color_prom[i | 0x100], 0); + bit1 = BIT(color_prom[i | 0x100], 1); + bit2 = BIT(color_prom[i | 0x100], 2); + bit3 = BIT(color_prom[i | 0x100], 3); + int const g = combine_weights(gweights, bit0, bit1, bit2, bit3); + + // blue component + bit0 = BIT(color_prom[i | 0x200], 0); + bit1 = BIT(color_prom[i | 0x200], 1); + bit2 = BIT(color_prom[i | 0x200], 2); + bit3 = BIT(color_prom[i | 0x200], 3); + int const b = combine_weights(bweights, bit0, bit1, bit2, bit3); + + palette.set_indirect_color(i, rgb_t(r, g, b)); + } + + // color_prom now points to the beginning of the lookup table, + color_prom += 0x300; + + // characters use colors 0x10-0x1f of each 0x20 color bank, while sprites use colors 0-0x0f + for (int i = 0; i < 0x200; i++) + { + for (int j = 0; j < 8; j++) + { + uint8_t const ctabentry = (j << 5) | ((~i & 0x100) >> 4) | (color_prom[i] & 0x0f); + palette.set_pen_indirect(((i & 0x100) << 3) | (j << 8) | (i & 0xff), ctabentry); + } + } +} + +void shaolins_state::videoram_w(offs_t offset, uint8_t data) +{ + m_videoram[offset] = data; + m_bg_tilemap->mark_tile_dirty(offset); +} + +void shaolins_state::colorram_w(offs_t offset, uint8_t data) +{ + m_colorram[offset] = data; + m_bg_tilemap->mark_tile_dirty(offset); +} + +void shaolins_state::palettebank_w(uint8_t data) +{ + if (m_palettebank != (data & 0x07)) + { + m_palettebank = data & 0x07; + machine().tilemap().mark_all_dirty(); + } +} + +void shaolins_state::scroll_w(uint8_t data) +{ + for (int col = 4; col < 32; col++) + m_bg_tilemap->set_scrolly(col, data + 1); +} + +void shaolins_state::nmi_w(uint8_t data) +{ + m_nmi_enable = data; + + if (flip_screen() != (data & 0x01)) + { + flip_screen_set(data & 0x01); + machine().tilemap().mark_all_dirty(); + } + + machine().bookkeeping().coin_counter_w(0, data & 0x08); + machine().bookkeeping().coin_counter_w(1, data & 0x10); +} + +TILE_GET_INFO_MEMBER(shaolins_state::get_bg_tile_info) +{ + int const attr = m_colorram[tile_index]; + int const code = m_videoram[tile_index] + ((attr & 0x40) << 2); + int const color = (attr & 0x0f) + 16 * m_palettebank; + int const flags = (attr & 0x20) ? TILE_FLIPY : 0; + + tileinfo.set(0, code, color, flags); +} +void shaolins_state::video_start() +{ + m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(shaolins_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); + + m_bg_tilemap->set_scroll_cols(32); -#define MASTER_CLOCK XTAL(18'432'000) + save_item(NAME(m_palettebank)); + save_item(NAME(m_nmi_enable)); +} + +void shaolins_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + for (int offs = 23 * 2; offs >= 0; offs -= 2) // max 24 sprites + { + int const code = m_spriteram[1][offs + 1]; + int const color = (m_spriteram[0][offs] & 0x0f) | (m_palettebank << 4); + int const flipx = !(m_spriteram[0][offs] & 0x40); + int const flipy = m_spriteram[0][offs] & 0x80; + int const sx = m_spriteram[1][offs]; + int sy = 241 - m_spriteram[0][offs + 1]; + + if (flip_screen()) + sy--; + + m_gfxdecode->gfx(1)->transmask(bitmap, cliprect, + code, color, + flipx, flipy, + sx, sy, + m_palette->transpen_mask(*m_gfxdecode->gfx(1), color, m_palettebank << 5)); + } +} + +uint32_t shaolins_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + draw_sprites(bitmap, cliprect); + return 0; +} + + +// machine TIMER_DEVICE_CALLBACK_MEMBER(shaolins_state::interrupt) { - int scanline = param; + int const scanline = param; - if(scanline == 240) + if (scanline == 240) m_maincpu->set_input_line(0, HOLD_LINE); - else if((scanline % 32) == 0) - if (m_nmi_enable & 0x02) m_maincpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero); + else if ((scanline % 32) == 0) + if (m_nmi_enable & 0x02) + m_maincpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero); } -void shaolins_state::shaolins_map(address_map &map) +void shaolins_state::prg_map(address_map &map) { - map(0x0000, 0x0000).w(FUNC(shaolins_state::nmi_w)); /* bit 0 = flip screen, bit 1 = nmi enable, bit 2 = ? */ - /* bit 3, bit 4 = coin counters */ + map(0x0000, 0x0000).w(FUNC(shaolins_state::nmi_w)); // bit 0 = flip screen, bit 1 = nmi enable, bit 2 = ? + // bit 3, bit 4 = coin counters */ map(0x0100, 0x0100).w("watchdog", FUNC(watchdog_timer_device::reset_w)); map(0x0200, 0x02ff).lr8(NAME([this]() -> u8 { return m_screen->vpos(); })); - map(0x0300, 0x0300).w("sn1", FUNC(sn76489a_device::write)); /* trigger chip to read from latch. The program always */ - map(0x0400, 0x0400).w("sn2", FUNC(sn76489a_device::write)); /* writes the same number as the latch, so we don't */ - /* bother emulating them. */ + map(0x0300, 0x0300).w("sn1", FUNC(sn76489a_device::write)); // trigger chip to read from latch. The program always + map(0x0400, 0x0400).w("sn2", FUNC(sn76489a_device::write)); // writes the same number as the latch, so we don't + // bother emulating them. map(0x0500, 0x0500).portr("DSW2"); map(0x0600, 0x0600).portr("DSW3"); map(0x0700, 0x0700).portr("SYSTEM"); map(0x0701, 0x0701).portr("P1"); map(0x0702, 0x0702).portr("P2"); map(0x0703, 0x0703).portr("DSW1"); - map(0x0800, 0x0800).nopw(); /* latch for 76496 #0 */ - map(0x1000, 0x1000).nopw(); /* latch for 76496 #1 */ + map(0x0800, 0x0800).nopw(); // latch for 76496 #0 + map(0x1000, 0x1000).nopw(); // latch for 76496 #1 map(0x1800, 0x1800).w(FUNC(shaolins_state::palettebank_w)); map(0x2000, 0x2000).w(FUNC(shaolins_state::scroll_w)); - map(0x2800, 0x2bff).ram().share("spriteram"); /* RAM BANK 2 */ - map(0x3000, 0x33ff).ram().share("spriteram2"); /* RAM BANK 1 */ - map(0x3800, 0x3bff).ram().w(FUNC(shaolins_state::colorram_w)).share("colorram"); - map(0x3c00, 0x3fff).ram().w(FUNC(shaolins_state::videoram_w)).share("videoram"); - map(0x4000, 0x5fff).rom(); /* Machine checks for extra rom */ + map(0x2800, 0x2bff).ram().share(m_spriteram[0]); // RAM BANK 2 + map(0x3000, 0x33ff).ram().share(m_spriteram[1]); // RAM BANK 1 + map(0x3800, 0x3bff).ram().w(FUNC(shaolins_state::colorram_w)).share(m_colorram); + map(0x3c00, 0x3fff).ram().w(FUNC(shaolins_state::videoram_w)).share(m_videoram); + map(0x4000, 0x5fff).rom(); // Machine checks for extra ROM map(0x6000, 0xffff).rom(); } @@ -240,7 +462,7 @@ static INPUT_PORTS_START( shaolins ) PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - /* This bank only has four switches */ + // This bank only has four switches PORT_START("DSW3") PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("DIPSW3:1") PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) @@ -257,43 +479,45 @@ INPUT_PORTS_END static const gfx_layout charlayout = { - 8,8, /* 8*8 chars */ - 512, /* 512 characters */ - 4, /* 4 bits per pixel */ + 8,8, // 8*8 chars + 512, // 512 characters + 4, // 4 bits per pixel { 512*16*8+4, 512*16*8+0, 4, 0 }, { 0, 1, 2, 3, 8*8+0, 8*8+1, 8*8+2, 8*8+3 }, { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 16*8 /* every char takes 16 consecutive bytes */ + 16*8 // every char takes 16 consecutive bytes }; static const gfx_layout spritelayout = { - 16,16, /* 16*16 sprites */ - 256, /* 256 sprites */ - 4, /* 4 bits per pixel */ + 16,16, // 16*16 sprites + 256, // 256 sprites + 4, // 4 bits per pixel { 256*64*8+4, 256*64*8+0, 4, 0 }, { 0, 1, 2, 3, 8*8+0, 8*8+1, 8*8+2, 8*8+3, 16*8+0, 16*8+1, 16*8+2, 16*8+3, 24*8+0, 24*8+1, 24*8+2, 24*8+3 }, { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 32*8, 33*8, 34*8, 35*8, 36*8, 37*8, 38*8, 39*8 }, - 64*8 /* every sprite takes 64 consecutive bytes */ + 64*8 // every sprite takes 64 consecutive bytes }; static GFXDECODE_START( gfx_shaolins ) - GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 16*8 ) - GFXDECODE_ENTRY( "gfx2", 0, spritelayout, 16*8*16, 16*8 ) + GFXDECODE_ENTRY( "tiles", 0, charlayout, 0, 16*8 ) + GFXDECODE_ENTRY( "sprites", 0, spritelayout, 16*8*16, 16*8 ) GFXDECODE_END void shaolins_state::shaolins(machine_config &config) { - /* basic machine hardware */ - MC6809E(config, m_maincpu, MASTER_CLOCK/12); /* verified on pcb */ - m_maincpu->set_addrmap(AS_PROGRAM, &shaolins_state::shaolins_map); + static constexpr XTAL MASTER_CLOCK = XTAL(18'432'000); + + // basic machine hardware + MC6809E(config, m_maincpu, MASTER_CLOCK / 12); // verified on PCB + m_maincpu->set_addrmap(AS_PROGRAM, &shaolins_state::prg_map); TIMER(config, "scantimer").configure_scanline(FUNC(shaolins_state::interrupt), "screen", 0, 1); WATCHDOG_TIMER(config, "watchdog"); - /* video hardware */ + // video hardware SCREEN(config, m_screen, SCREEN_TYPE_RASTER); // m_screen->set_refresh_hz(60); // m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(0)); @@ -306,14 +530,14 @@ void shaolins_state::shaolins(machine_config &config) m_screen->set_palette(m_palette); GFXDECODE(config, m_gfxdecode, m_palette, gfx_shaolins); - PALETTE(config, m_palette, FUNC(shaolins_state::shaolins_palette), 16*8*16+16*8*16, 256); + PALETTE(config, m_palette, FUNC(shaolins_state::palette), 16*8*16+16*8*16, 256); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); - SN76489A(config, "sn1", MASTER_CLOCK/12).add_route(ALL_OUTPUTS, "mono", 1.0); /* verified on pcb */ + SN76489A(config, "sn1", MASTER_CLOCK / 12).add_route(ALL_OUTPUTS, "mono", 1.0); // verified on PCB - SN76489A(config, "sn2", MASTER_CLOCK/6).add_route(ALL_OUTPUTS, "mono", 1.0); /* verified on pcb */ + SN76489A(config, "sn2", MASTER_CLOCK / 6).add_route(ALL_OUTPUTS, "mono", 1.0); // verified on PCB } #if 0 // a bootleg board was found with downgraded sound hardware, but is otherwise the same @@ -321,9 +545,9 @@ void shaolins_state::shaolinb(machine_config &config) { shaolins(config); - SN76489(config.replace(), "sn1", MASTER_CLOCK/12).add_route(ALL_OUTPUTS, "mono", 1.0); /* only type verified on pcb */ + SN76489(config.replace(), "sn1", MASTER_CLOCK / 12).add_route(ALL_OUTPUTS, "mono", 1.0); // only type verified on PCB - SN76489(config.replace(), "sn2", MASTER_CLOCK/6).add_route(ALL_OUTPUTS, "mono", 1.0); + SN76489(config.replace(), "sn2", MASTER_CLOCK / 6).add_route(ALL_OUTPUTS, "mono", 1.0); } #endif @@ -339,20 +563,20 @@ ROM_START( kicker ) ROM_LOAD( "477l04.d10", 0x8000, 0x4000, CRC(0cf0351a) SHA1(a9da783b29a63a46912a29715e8d11dc4cd22265) ) ROM_LOAD( "477l05.d11", 0xC000, 0x4000, CRC(654037f8) SHA1(52d098386fe87ae97d4dfefab0bd3a902f66d70b) ) - ROM_REGION( 0x4000, "gfx1", 0 ) + ROM_REGION( 0x4000, "tiles", 0 ) ROM_LOAD( "477k06.a10", 0x0000, 0x2000, CRC(4d156afc) SHA1(29eb66e2ebcf2f1c1d5ece5413d1ebf54663f9cf) ) ROM_LOAD( "477k07.a11", 0x2000, 0x2000, CRC(ff6ca5df) SHA1(dfcd445c8b233a0a4168eb249472e53784eda25d) ) - ROM_REGION( 0x8000, "gfx2", 0 ) + ROM_REGION( 0x8000, "sprites", 0 ) ROM_LOAD( "477k02.h15", 0x0000, 0x4000, CRC(b94e645b) SHA1(65ae48134a0fe1e910a787714f7ae721734ded5b) ) ROM_LOAD( "477k01.h14", 0x4000, 0x4000, CRC(61bbf797) SHA1(97d276099172975499f646f381a6fc587c022435) ) ROM_REGION( 0x0500, "proms", 0 ) - ROM_LOAD( "477j10.a12", 0x0000, 0x0100, CRC(b09db4b4) SHA1(d21176cdc7def760da109083eb52e5b6a515021f) ) /* palette red component */ - ROM_LOAD( "477j11.a13", 0x0100, 0x0100, CRC(270a2bf3) SHA1(c0aec04bd3bceccddf5f5a814a560a893b29ef6b) ) /* palette green component */ - ROM_LOAD( "477j12.a14", 0x0200, 0x0100, CRC(83e95ea8) SHA1(e0bfa20600488f5c66233e13ea6ad857f62acb7c) ) /* palette blue component */ - ROM_LOAD( "477j09.b8", 0x0300, 0x0100, CRC(aa900724) SHA1(c5343273d0a7101b8ba6876c4f22e43d77610c75) ) /* character lookup table */ - ROM_LOAD( "477j08.f16", 0x0400, 0x0100, CRC(80009cf5) SHA1(a367f3f55d75a9d5bf4d43f9d77272eb910a1344) ) /* sprite lookup table */ + ROM_LOAD( "477j10.a12", 0x0000, 0x0100, CRC(b09db4b4) SHA1(d21176cdc7def760da109083eb52e5b6a515021f) ) // palette red component + ROM_LOAD( "477j11.a13", 0x0100, 0x0100, CRC(270a2bf3) SHA1(c0aec04bd3bceccddf5f5a814a560a893b29ef6b) ) // palette green component + ROM_LOAD( "477j12.a14", 0x0200, 0x0100, CRC(83e95ea8) SHA1(e0bfa20600488f5c66233e13ea6ad857f62acb7c) ) // palette blue component + ROM_LOAD( "477j09.b8", 0x0300, 0x0100, CRC(aa900724) SHA1(c5343273d0a7101b8ba6876c4f22e43d77610c75) ) // character lookup table + ROM_LOAD( "477j08.f16", 0x0400, 0x0100, CRC(80009cf5) SHA1(a367f3f55d75a9d5bf4d43f9d77272eb910a1344) ) // sprite lookup table ROM_END ROM_START( shaolins ) @@ -361,20 +585,20 @@ ROM_START( shaolins ) ROM_LOAD( "477l04.d10", 0x8000, 0x4000, CRC(0cf0351a) SHA1(a9da783b29a63a46912a29715e8d11dc4cd22265) ) ROM_LOAD( "477l05.d11", 0xC000, 0x4000, CRC(654037f8) SHA1(52d098386fe87ae97d4dfefab0bd3a902f66d70b) ) - ROM_REGION( 0x4000, "gfx1", 0 ) + ROM_REGION( 0x4000, "tiles", 0 ) ROM_LOAD( "477j06.a10", 0x0000, 0x2000, CRC(ff18a7ed) SHA1(f28bfeff84bb6a08a8bee999a0b7a19e09a8dfc3) ) ROM_LOAD( "477j07.a11", 0x2000, 0x2000, CRC(5f53ae61) SHA1(ad29e2255855c503295c6b63eb4cd6700a1e3f0e) ) - ROM_REGION( 0x8000, "gfx2", 0 ) + ROM_REGION( 0x8000, "sprites", 0 ) ROM_LOAD( "477j02.h15", 0x0000, 0x4000, CRC(b94e645b) SHA1(65ae48134a0fe1e910a787714f7ae721734ded5b) ) // actual labels are 477J02 but data matches Kicker 477K02 ROM_LOAD( "477j01.h14", 0x4000, 0x4000, CRC(61bbf797) SHA1(97d276099172975499f646f381a6fc587c022435) ) // actual labels are 477J01 but data matches Kicker 477K01 ROM_REGION( 0x0500, "proms", 0 ) - ROM_LOAD( "477j10.a12", 0x0000, 0x0100, CRC(b09db4b4) SHA1(d21176cdc7def760da109083eb52e5b6a515021f) ) /* palette red component */ - ROM_LOAD( "477j11.a13", 0x0100, 0x0100, CRC(270a2bf3) SHA1(c0aec04bd3bceccddf5f5a814a560a893b29ef6b) ) /* palette green component */ - ROM_LOAD( "477j12.a14", 0x0200, 0x0100, CRC(83e95ea8) SHA1(e0bfa20600488f5c66233e13ea6ad857f62acb7c) ) /* palette blue component */ - ROM_LOAD( "477j09.b8", 0x0300, 0x0100, CRC(aa900724) SHA1(c5343273d0a7101b8ba6876c4f22e43d77610c75) ) /* character lookup table */ - ROM_LOAD( "477j08.f16", 0x0400, 0x0100, CRC(80009cf5) SHA1(a367f3f55d75a9d5bf4d43f9d77272eb910a1344) ) /* sprite lookup table */ + ROM_LOAD( "477j10.a12", 0x0000, 0x0100, CRC(b09db4b4) SHA1(d21176cdc7def760da109083eb52e5b6a515021f) ) // palette red component + ROM_LOAD( "477j11.a13", 0x0100, 0x0100, CRC(270a2bf3) SHA1(c0aec04bd3bceccddf5f5a814a560a893b29ef6b) ) // palette green component + ROM_LOAD( "477j12.a14", 0x0200, 0x0100, CRC(83e95ea8) SHA1(e0bfa20600488f5c66233e13ea6ad857f62acb7c) ) // palette blue component + ROM_LOAD( "477j09.b8", 0x0300, 0x0100, CRC(aa900724) SHA1(c5343273d0a7101b8ba6876c4f22e43d77610c75) ) // character lookup table + ROM_LOAD( "477j08.f16", 0x0400, 0x0100, CRC(80009cf5) SHA1(a367f3f55d75a9d5bf4d43f9d77272eb910a1344) ) // sprite lookup table ROM_END /* @@ -384,10 +608,10 @@ ROM_END Daughterboard: QSTU (Replaces 3 custom Konami chips) Daughterboard: RSTU (Replaces 4 custom Konami chips) - All the roms/proms are located on the main board. + All the ROMs/PROMs are located on the main board. - Board Layout with edge connector on the left. ROM's/PROM's are marked too. - PROM's have an asterick suffix to distinguish them from the ROM's. + Board Layout with edge connector on the left. ROMs/PROMs are marked too. + PROM's have an asterisk suffix to distinguish them from the ROMs. A B C D E F G H I J K L M N O |-------------------------------------------------| @@ -413,28 +637,30 @@ ROM_END ROM_START( shaolinb ) ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "3.h4", 0x6000, 0x2000, CRC(2598dfdd) SHA1(70a9d81b73bbd4ff6b627a3e4102d5328a946d20) ) /* 2764 */ - ROM_LOAD( "4.i4", 0x8000, 0x4000, CRC(0cf0351a) SHA1(a9da783b29a63a46912a29715e8d11dc4cd22265) ) /* 27128 */ - ROM_LOAD( "5.j4", 0xC000, 0x4000, CRC(654037f8) SHA1(52d098386fe87ae97d4dfefab0bd3a902f66d70b) ) /* 27128 */ + ROM_LOAD( "3.h4", 0x6000, 0x2000, CRC(2598dfdd) SHA1(70a9d81b73bbd4ff6b627a3e4102d5328a946d20) ) // 2764 + ROM_LOAD( "4.i4", 0x8000, 0x4000, CRC(0cf0351a) SHA1(a9da783b29a63a46912a29715e8d11dc4cd22265) ) // 27128 + ROM_LOAD( "5.j4", 0xC000, 0x4000, CRC(654037f8) SHA1(52d098386fe87ae97d4dfefab0bd3a902f66d70b) ) // 27128 - ROM_REGION( 0x6000, "gfx1", 0 ) - ROM_LOAD( "6.i1", 0x0000, 0x2000, CRC(ff18a7ed) SHA1(f28bfeff84bb6a08a8bee999a0b7a19e09a8dfc3) ) /* 2764 */ - ROM_LOAD( "7.j1", 0x2000, 0x4000, CRC(d9a7cff6) SHA1(47244426b9a674326c5303347112aa9d33bcf1df) ) /* 27128 */ + ROM_REGION( 0x6000, "tiles", 0 ) + ROM_LOAD( "6.i1", 0x0000, 0x2000, CRC(ff18a7ed) SHA1(f28bfeff84bb6a08a8bee999a0b7a19e09a8dfc3) ) // 2764 + ROM_LOAD( "7.j1", 0x2000, 0x4000, CRC(d9a7cff6) SHA1(47244426b9a674326c5303347112aa9d33bcf1df) ) // 27128 - ROM_REGION( 0x8000, "gfx2", 0 ) /* All roms are 27128 */ + ROM_REGION( 0x8000, "sprites", 0 ) // All ROMs are 27128 ROM_LOAD( "2.m8", 0x0000, 0x4000, CRC(560521c7) SHA1(f8a50c66364995041e29ed7be2e4ea1ad16aa735) ) ROM_LOAD( "1.l8", 0x4000, 0x4000, CRC(a79959b2) SHA1(9c58975c55f7be32add0dccb259d9680410fa9bc) ) - ROM_REGION( 0x0500, "proms", 0 ) /* All proms are N82S129N */ - ROM_LOAD( "3.k1", 0x0000, 0x0100, CRC(b09db4b4) SHA1(d21176cdc7def760da109083eb52e5b6a515021f) ) /* palette red component */ - ROM_LOAD( "4.l1", 0x0100, 0x0100, CRC(270a2bf3) SHA1(c0aec04bd3bceccddf5f5a814a560a893b29ef6b) ) /* palette green component */ - ROM_LOAD( "5.m1", 0x0200, 0x0100, CRC(83e95ea8) SHA1(e0bfa20600488f5c66233e13ea6ad857f62acb7c) ) /* palette blue component */ - ROM_LOAD( "2.g2", 0x0300, 0x0100, CRC(aa900724) SHA1(c5343273d0a7101b8ba6876c4f22e43d77610c75) ) /* character lookup table */ - ROM_LOAD( "1.o6", 0x0400, 0x0100, CRC(80009cf5) SHA1(a367f3f55d75a9d5bf4d43f9d77272eb910a1344) ) /* sprite lookup table */ + ROM_REGION( 0x0500, "proms", 0 ) // All PROMs are N82S129N + ROM_LOAD( "3.k1", 0x0000, 0x0100, CRC(b09db4b4) SHA1(d21176cdc7def760da109083eb52e5b6a515021f) ) // palette red component + ROM_LOAD( "4.l1", 0x0100, 0x0100, CRC(270a2bf3) SHA1(c0aec04bd3bceccddf5f5a814a560a893b29ef6b) ) // palette green component + ROM_LOAD( "5.m1", 0x0200, 0x0100, CRC(83e95ea8) SHA1(e0bfa20600488f5c66233e13ea6ad857f62acb7c) ) // palette blue component + ROM_LOAD( "2.g2", 0x0300, 0x0100, CRC(aa900724) SHA1(c5343273d0a7101b8ba6876c4f22e43d77610c75) ) // character lookup table + ROM_LOAD( "1.o6", 0x0400, 0x0100, CRC(80009cf5) SHA1(a367f3f55d75a9d5bf4d43f9d77272eb910a1344) ) // sprite lookup table ROM_END +} // anonymous namespace + -/* YEAR, NAME, PARENT, MACHINE, INPUT, STATE, INIT, MONITOR, COMPANY, FULLNAME, FLAGS */ -GAME( 1985, kicker, 0, shaolins, shaolins, shaolins_state, empty_init, ROT90, "Konami", "Kicker", MACHINE_SUPPORTS_SAVE ) -GAME( 1985, shaolins, kicker, shaolins, shaolins, shaolins_state, empty_init, ROT90, "Konami", "Shao-lin's Road (set 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1985, shaolinb, kicker, shaolins, shaolins, shaolins_state, empty_init, ROT90, "Konami", "Shao-lin's Road (set 2)", MACHINE_SUPPORTS_SAVE ) +// YEAR, NAME, PARENT, MACHINE, INPUT, STATE, INIT, MONITOR, COMPANY, FULLNAME, FLAGS +GAME( 1985, kicker, 0, shaolins, shaolins, shaolins_state, empty_init, ROT90, "Konami", "Kicker", MACHINE_SUPPORTS_SAVE ) +GAME( 1985, shaolins, kicker, shaolins, shaolins, shaolins_state, empty_init, ROT90, "Konami", "Shao-lin's Road (set 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1985, shaolinb, kicker, shaolins, shaolins, shaolins_state, empty_init, ROT90, "Konami", "Shao-lin's Road (set 2)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/konami/shaolins.h b/src/mame/konami/shaolins.h deleted file mode 100644 index d3801279b7f..00000000000 --- a/src/mame/konami/shaolins.h +++ /dev/null @@ -1,62 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Allard van der Bas -#ifndef MAME_INCLUDES_SHAOLINS_H -#define MAME_INCLUDES_SHAOLINS_H - -#pragma once - -#include "machine/timer.h" -#include "emupal.h" -#include "tilemap.h" - -class shaolins_state : public driver_device -{ -public: - shaolins_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this,"maincpu"), - m_screen(*this,"screen"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"), - m_spriteram(*this, "spriteram"), - m_spriteram2(*this, "spriteram2"), - m_colorram(*this, "colorram"), - m_videoram(*this, "videoram") - { } - - void shaolins(machine_config &config); - -private: - required_device m_maincpu; - required_device m_screen; - required_device m_gfxdecode; - required_device m_palette; - - required_shared_ptr m_spriteram; - required_shared_ptr m_spriteram2; - required_shared_ptr m_colorram; - required_shared_ptr m_videoram; - - int m_palettebank = 0; - tilemap_t *m_bg_tilemap = nullptr; - uint8_t m_nmi_enable = 0; - - void videoram_w(offs_t offset, uint8_t data); - void colorram_w(offs_t offset, uint8_t data); - void palettebank_w(uint8_t data); - void scroll_w(uint8_t data); - void nmi_w(uint8_t data); - - TILE_GET_INFO_MEMBER(get_bg_tile_info); - - virtual void video_start() override; - void shaolins_palette(palette_device &palette) const; - - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); - - TIMER_DEVICE_CALLBACK_MEMBER(interrupt); - void shaolins_map(address_map &map); -}; - -#endif // MAME_INCLUDES_SHAOLINS_H diff --git a/src/mame/konami/shaolins_v.cpp b/src/mame/konami/shaolins_v.cpp deleted file mode 100644 index 952f2f61917..00000000000 --- a/src/mame/konami/shaolins_v.cpp +++ /dev/null @@ -1,175 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Allard van der Bas -/*************************************************************************** - - shaolins.c - - Functions to emulate the video hardware of the machine. - -***************************************************************************/ - -#include "emu.h" -#include "video/resnet.h" -#include "shaolins.h" - - -/*************************************************************************** - - Convert the color PROMs into a more useable format. - - Shao-lin's Road has three 256x4 palette PROMs (one per gun) and two 256x4 - lookup table PROMs (one for characters, one for sprites). - I don't know for sure how the palette PROMs are connected to the RGB - output, but it's probably the usual: - - bit 3 -- 220 ohm resistor -- RED/GREEN/BLUE - -- 470 ohm resistor -- RED/GREEN/BLUE - -- 1 kohm resistor -- RED/GREEN/BLUE - bit 0 -- 2.2kohm resistor -- RED/GREEN/BLUE - -***************************************************************************/ -void shaolins_state::shaolins_palette(palette_device &palette) const -{ - const uint8_t *color_prom = memregion("proms")->base(); - static constexpr int resistances[4] = { 2200, 1000, 470, 220 }; - - // compute the color output resistor weights - double rweights[4], gweights[4], bweights[4]; - compute_resistor_weights(0, 255, -1.0, - 4, resistances, rweights, 470, 0, - 4, resistances, gweights, 470, 0, - 4, resistances, bweights, 470, 0); - - // create a lookup table for the palette - for (int i = 0; i < 0x100; i++) - { - int bit0, bit1, bit2, bit3; - - // red component - bit0 = BIT(color_prom[i | 0x000], 0); - bit1 = BIT(color_prom[i | 0x000], 1); - bit2 = BIT(color_prom[i | 0x000], 2); - bit3 = BIT(color_prom[i | 0x000], 3); - int const r = combine_weights(rweights, bit0, bit1, bit2, bit3); - - // green component - bit0 = BIT(color_prom[i | 0x100], 0); - bit1 = BIT(color_prom[i | 0x100], 1); - bit2 = BIT(color_prom[i | 0x100], 2); - bit3 = BIT(color_prom[i | 0x100], 3); - int const g = combine_weights(gweights, bit0, bit1, bit2, bit3); - - // blue component - bit0 = BIT(color_prom[i | 0x200], 0); - bit1 = BIT(color_prom[i | 0x200], 1); - bit2 = BIT(color_prom[i | 0x200], 2); - bit3 = BIT(color_prom[i | 0x200], 3); - int const b = combine_weights(bweights, bit0, bit1, bit2, bit3); - - palette.set_indirect_color(i, rgb_t(r, g, b)); - } - - // color_prom now points to the beginning of the lookup table, - color_prom += 0x300; - - // characters use colors 0x10-0x1f of each 0x20 color bank, while sprites use colors 0-0x0f - for (int i = 0; i < 0x200; i++) - { - for (int j = 0; j < 8; j++) - { - uint8_t const ctabentry = (j << 5) | ((~i & 0x100) >> 4) | (color_prom[i] & 0x0f); - palette.set_pen_indirect(((i & 0x100) << 3) | (j << 8) | (i & 0xff), ctabentry); - } - } -} - -void shaolins_state::videoram_w(offs_t offset, uint8_t data) -{ - m_videoram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset); -} - -void shaolins_state::colorram_w(offs_t offset, uint8_t data) -{ - m_colorram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset); -} - -void shaolins_state::palettebank_w(uint8_t data) -{ - if (m_palettebank != (data & 0x07)) - { - m_palettebank = data & 0x07; - machine().tilemap().mark_all_dirty(); - } -} - -void shaolins_state::scroll_w(uint8_t data) -{ - for (int col = 4; col < 32; col++) - m_bg_tilemap->set_scrolly(col, data + 1); -} - -void shaolins_state::nmi_w(uint8_t data) -{ - m_nmi_enable = data; - - if (flip_screen() != (data & 0x01)) - { - flip_screen_set(data & 0x01); - machine().tilemap().mark_all_dirty(); - } - - machine().bookkeeping().coin_counter_w(0,data & 0x08); - machine().bookkeeping().coin_counter_w(1,data & 0x10); -} - -TILE_GET_INFO_MEMBER(shaolins_state::get_bg_tile_info) -{ - int attr = m_colorram[tile_index]; - int code = m_videoram[tile_index] + ((attr & 0x40) << 2); - int color = (attr & 0x0f) + 16 * m_palettebank; - int flags = (attr & 0x20) ? TILE_FLIPY : 0; - - tileinfo.set(0, code, color, flags); -} - -void shaolins_state::video_start() -{ - m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(shaolins_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, - 8, 8, 32, 32); - - m_bg_tilemap->set_scroll_cols(32); - - save_item(NAME(m_palettebank)); - save_item(NAME(m_nmi_enable)); -} - -void shaolins_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - for (int offs = 23 * 2; offs >= 0; offs -= 2) /* max 24 sprites */ - { - int code = m_spriteram2[offs + 1]; - int color = (m_spriteram[offs + 0] & 0x0f) | (m_palettebank << 4); - int flipx = !(m_spriteram[offs + 0] & 0x40); - int flipy = m_spriteram[offs + 0] & 0x80; - int sx = m_spriteram2[offs + 0]; - int sy = 241 - m_spriteram[offs + 1]; - - if (flip_screen()) - sy--; - - m_gfxdecode->gfx(1)->transmask(bitmap,cliprect, - code, color, - flipx, flipy, - sx, sy, - m_palette->transpen_mask(*m_gfxdecode->gfx(1), color, m_palettebank << 5)); - } -} - -uint32_t shaolins_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - draw_sprites(bitmap, cliprect); - return 0; -} diff --git a/src/mame/toaplan/toaplan2.cpp b/src/mame/toaplan/toaplan2.cpp index 85a64dde872..8c63b3c8935 100644 --- a/src/mame/toaplan/toaplan2.cpp +++ b/src/mame/toaplan/toaplan2.cpp @@ -6172,5 +6172,5 @@ GAME( 1999, bbakraidj, bbakraid, bbakraid, bbakraid, toaplan2_state, init_ GAME( 1999, bbakraidja, bbakraid, bbakraid, bbakraid, toaplan2_state, init_bbakraid, ROT270, "Eighting", "Battle Bakraid (Japan) (Wed Apr 7 1999)", MACHINE_SUPPORTS_SAVE ) // dedicated PCB -GAME( 1996, nprobowl, 0, nprobowl, nprobowl, toaplan2_state, empty_init, ROT0, "Zuck / Able Corp", "New Pro Bowl", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_MECHANICAL | MACHINE_SUPPORTS_SAVE ) // bad GFXs, no sound banking, controls, etc -GAME( 1996, probowl2, nprobowl, nprobowl, nprobowl, toaplan2_state, empty_init, ROT0, "Zuck / Able Corp", "Pro Bowl 2", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_MECHANICAL | MACHINE_SUPPORTS_SAVE ) // bad GFXs, no sound banking, controls, etc +GAME( 1996, nprobowl, 0, nprobowl, nprobowl, toaplan2_state, empty_init, ROT0, "Zuck / Able Corp", "New Pro Bowl", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND | MACHINE_MECHANICAL | MACHINE_SUPPORTS_SAVE ) // bad GFXs, no sound banking, controls, etc +GAME( 1996, probowl2, nprobowl, nprobowl, nprobowl, toaplan2_state, empty_init, ROT0, "Zuck / Able Corp", "Pro Bowl 2", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND | MACHINE_MECHANICAL | MACHINE_SUPPORTS_SAVE ) // bad GFXs, no sound banking, controls, etc -- cgit v1.2.3