From b69e389299bcb22e500257fcec26120e411d430b Mon Sep 17 00:00:00 2001 From: hap Date: Sun, 8 Dec 2024 15:49:04 +0100 Subject: kyugo: merge driver files --- src/mame/orca/kyugo.cpp | 348 ++++++++++++++++++++++++++++++++++++++++++---- src/mame/orca/kyugo.h | 102 -------------- src/mame/orca/kyugo_v.cpp | 207 --------------------------- 3 files changed, 319 insertions(+), 338 deletions(-) delete mode 100644 src/mame/orca/kyugo.h delete mode 100644 src/mame/orca/kyugo_v.cpp diff --git a/src/mame/orca/kyugo.cpp b/src/mame/orca/kyugo.cpp index 867b9cc5588..12712522054 100644 --- a/src/mame/orca/kyugo.cpp +++ b/src/mame/orca/kyugo.cpp @@ -1,6 +1,6 @@ // license:BSD-3-Clause // copyright-holders:Ernesto Corvi -/*************************************************************************** +/******************************************************************************* Kyugo hardware games @@ -20,7 +20,8 @@ Known issues: * attract mode in Son of Phoenix doesn't work - *************************************************************************** + +******************************************************************************** Repulse bootleg Hardware Info By Guru @@ -121,17 +122,303 @@ Notes: 2764 like the bootleg was but possibly chopped in half for emulation, hence the 4k size of the original ROM compared to the 8k size of the bootleg ROM. -***************************************************************************/ +*******************************************************************************/ #include "emu.h" -#include "kyugo.h" #include "cpu/z80/z80.h" #include "machine/74259.h" #include "machine/watchdog.h" #include "sound/ay8910.h" + +#include "emupal.h" #include "screen.h" #include "speaker.h" +#include "tilemap.h" + +namespace { + +class kyugo_state : public driver_device +{ +public: + kyugo_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_fgvideoram(*this, "fgvideoram"), + m_bgvideoram(*this, "bgvideoram"), + m_bgattribram(*this, "bgattribram"), + m_spriteram(*this, "spriteram_%u", 1U), + m_shared_ram(*this, "shared_ram"), + m_maincpu(*this, "maincpu"), + m_subcpu(*this, "sub"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette") + { } + + void kyugo_base(machine_config &config); + void repulse(machine_config &config); + void flashgala(machine_config &config); + void srdmissn(machine_config &config); + void legend(machine_config &config); + void gyrodine(machine_config &config); + +protected: + virtual void machine_start() override ATTR_COLD; + virtual void machine_reset() override ATTR_COLD; + virtual void video_start() override ATTR_COLD; + +private: + void nmi_mask_w(int state); + void coin_counter_w(offs_t offset, uint8_t data); + void fgvideoram_w(offs_t offset, uint8_t data); + void bgvideoram_w(offs_t offset, uint8_t data); + void bgattribram_w(offs_t offset, uint8_t data); + uint8_t spriteram_2_r(offs_t offset); + void scroll_x_lo_w(uint8_t data); + void gfxctrl_w(uint8_t data); + void scroll_y_w(uint8_t data); + + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(vblank_irq); + + void flashgala_sub_map(address_map &map) ATTR_COLD; + void flashgala_sub_portmap(address_map &map) ATTR_COLD; + void gyrodine_main_map(address_map &map) ATTR_COLD; + void gyrodine_sub_map(address_map &map) ATTR_COLD; + void gyrodine_sub_portmap(address_map &map) ATTR_COLD; + void kyugo_main_map(address_map &map) ATTR_COLD; + void kyugo_main_portmap(address_map &map) ATTR_COLD; + void srdmissn_main_map(address_map &map) ATTR_COLD; + void legend_sub_map(address_map &map) ATTR_COLD; + void repulse_sub_map(address_map &map) ATTR_COLD; + void repulse_sub_portmap(address_map &map) ATTR_COLD; + void srdmissn_sub_map(address_map &map) ATTR_COLD; + void srdmissn_sub_portmap(address_map &map) ATTR_COLD; + + // memory pointers + required_shared_ptr m_fgvideoram; + required_shared_ptr m_bgvideoram; + required_shared_ptr m_bgattribram; + required_shared_ptr_array m_spriteram; + required_shared_ptr m_shared_ram; + + uint8_t m_nmi_mask = 0U; + + // video-related + tilemap_t *m_bg_tilemap = nullptr; + tilemap_t *m_fg_tilemap = nullptr; + uint8_t m_scroll_x_lo = 0U; + uint8_t m_scroll_x_hi = 0U; + uint8_t m_scroll_y = 0U; + uint8_t m_bgpalbank = 0U; + uint8_t m_fgcolor = 0U; + const uint8_t *m_color_codes = nullptr; + + // devices + required_device m_maincpu; + required_device m_subcpu; + required_device m_gfxdecode; + required_device m_palette; + + TILE_GET_INFO_MEMBER(get_fg_tile_info); + TILE_GET_INFO_MEMBER(get_bg_tile_info); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); +}; + + + +/*************************************************************************** + + Callbacks for the TileMap code + +***************************************************************************/ + +TILE_GET_INFO_MEMBER(kyugo_state::get_fg_tile_info) +{ + int code = m_fgvideoram[tile_index]; + int color = m_color_codes[code >> 3] << 1 | m_fgcolor; + + tileinfo.set(0, code, color, 0); +} + + +TILE_GET_INFO_MEMBER(kyugo_state::get_bg_tile_info) +{ + int attr = m_bgattribram[tile_index]; + int code = m_bgvideoram[tile_index] | ((attr & 0x03) << 8); + int color = (attr >> 4) | (m_bgpalbank << 4); + + tileinfo.set(1, code, color, TILE_FLIPYX((attr & 0x0c) >> 2)); +} + + + +/************************************* + * + * Video system start + * + *************************************/ + +void kyugo_state::video_start() +{ + m_color_codes = memregion("proms")->base() + 0x300; + + m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(kyugo_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); + m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(kyugo_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); + + m_fg_tilemap->set_transparent_pen(0); + + m_bg_tilemap->set_scrolldx(-32, 288+32); +} + + + +/************************************* + * + * Memory handlers + * + *************************************/ + +void kyugo_state::fgvideoram_w(offs_t offset, uint8_t data) +{ + m_fgvideoram[offset] = data; + m_fg_tilemap->mark_tile_dirty(offset); +} + + +void kyugo_state::bgvideoram_w(offs_t offset, uint8_t data) +{ + m_bgvideoram[offset] = data; + m_bg_tilemap->mark_tile_dirty(offset); +} + + +void kyugo_state::bgattribram_w(offs_t offset, uint8_t data) +{ + m_bgattribram[offset] = data; + m_bg_tilemap->mark_tile_dirty(offset); +} + + +uint8_t kyugo_state::spriteram_2_r(offs_t offset) +{ + // only the lower nibble is connected + return m_spriteram[1][offset] | 0xf0; +} + + +void kyugo_state::scroll_x_lo_w(uint8_t data) +{ + m_scroll_x_lo = data; +} + + +void kyugo_state::gfxctrl_w(uint8_t data) +{ + // bit 0 is scroll MSB + m_scroll_x_hi = data & 0x01; + + // bit 5 is front layer color (Son of Phoenix only) + if (m_fgcolor != ((data & 0x20) >> 5)) + { + m_fgcolor = (data & 0x20) >> 5; + m_fg_tilemap->mark_all_dirty(); + } + + // bit 6 is background palette bank + if (m_bgpalbank != ((data & 0x40) >> 6)) + { + m_bgpalbank = (data & 0x40) >> 6; + m_bg_tilemap->mark_all_dirty(); + } + + // other bits are unknown +} + + +void kyugo_state::scroll_y_w(uint8_t data) +{ + m_scroll_y = data; +} + + + +/************************************* + * + * Video update + * + *************************************/ + +void kyugo_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + // sprite information is scattered through memory + // and uses a portion of the text layer memory (outside the visible area) + uint8_t *spriteram_area1 = &m_spriteram[0][0x28]; + uint8_t *spriteram_area2 = &m_spriteram[1][0x28]; + uint8_t *spriteram_area3 = &m_fgvideoram[0x28]; + + int flip = flip_screen(); + + for (int n = 0; n < 12 * 2; n++) + { + int offs, sy, sx, color; + + offs = 2 * (n % 12) + 64 * (n / 12); + + sx = spriteram_area3[offs + 1] + 256 * (spriteram_area2[offs + 1] & 1); + if (sx > 320) + sx -= 512; + + sy = 255 - spriteram_area1[offs] + 2; + if (sy > 0xf0) + sy -= 256; + + if (flip) + sy = 240 - sy; + + color = spriteram_area1[offs + 1] & 0x1f; + + for (int y = 0; y < 16; y++) + { + int code = spriteram_area3[offs + 128 * y]; + int attr = spriteram_area2[offs + 128 * y]; + + code = code | ((attr & 0x01) << 9) | ((attr & 0x02) << 7); + + int flipx = attr & 0x08; + int flipy = attr & 0x04; + + if (flip) + { + flipx = !flipx; + flipy = !flipy; + } + + m_gfxdecode->gfx(2)->transpen(bitmap,cliprect, + code, + color, + flipx,flipy, + sx, flip ? sy - 16*y : sy + 16*y, 0 ); + } + } +} + + +uint32_t kyugo_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + if (flip_screen()) + m_bg_tilemap->set_scrollx(0, -(m_scroll_x_lo + (m_scroll_x_hi * 256))); + else + m_bg_tilemap->set_scrollx(0, m_scroll_x_lo + (m_scroll_x_hi * 256)); + + m_bg_tilemap->set_scrolly(0, m_scroll_y); + + m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + draw_sprites(bitmap, cliprect); + m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + + return 0; +} + /************************************* @@ -187,7 +474,6 @@ void kyugo_state::kyugo_main_portmap(address_map &map) - /************************************* * * Sub CPU memory handlers @@ -305,7 +591,7 @@ void kyugo_state::srdmissn_sub_portmap(address_map &map) static INPUT_PORTS_START( common ) PORT_START("DSW2") - PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("DSW2:1,2,3") + PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("DSW2:1,2,3") PORT_DIPSETTING( 0x02, DEF_STR( 2C_1C ) ) PORT_DIPSETTING( 0x01, DEF_STR( 3C_2C ) ) PORT_DIPSETTING( 0x07, DEF_STR( 1C_1C ) ) @@ -314,7 +600,7 @@ static INPUT_PORTS_START( common ) PORT_DIPSETTING( 0x04, DEF_STR( 1C_4C ) ) PORT_DIPSETTING( 0x03, DEF_STR( 1C_6C ) ) PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) ) - PORT_DIPNAME( 0x38, 0x38, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("DSW2:4,5,6") + PORT_DIPNAME( 0x38, 0x38, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("DSW2:4,5,6") PORT_DIPSETTING( 0x00, DEF_STR( 5C_1C ) ) PORT_DIPSETTING( 0x08, DEF_STR( 4C_1C ) ) PORT_DIPSETTING( 0x10, DEF_STR( 3C_1C ) ) @@ -323,8 +609,8 @@ static INPUT_PORTS_START( common ) PORT_DIPSETTING( 0x20, DEF_STR( 3C_4C ) ) PORT_DIPSETTING( 0x30, DEF_STR( 1C_2C ) ) PORT_DIPSETTING( 0x28, DEF_STR( 1C_3C ) ) - PORT_DIPUNUSED( 0x40, IP_ACTIVE_LOW ) PORT_DIPLOCATION("DSW2:7") - PORT_DIPUNUSED( 0x80, IP_ACTIVE_LOW ) PORT_DIPLOCATION("DSW2:8") + PORT_DIPUNUSED( 0x40, IP_ACTIVE_LOW ) PORT_DIPLOCATION("DSW2:7") + PORT_DIPUNUSED( 0x80, IP_ACTIVE_LOW ) PORT_DIPLOCATION("DSW2:8") PORT_START("SYSTEM") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) @@ -359,23 +645,23 @@ INPUT_PORTS_END static INPUT_PORTS_START( gyrodine ) PORT_START("DSW1") - PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) PORT_DIPLOCATION("DSW1:1,2") + PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) PORT_DIPLOCATION("DSW1:1,2") PORT_DIPSETTING( 0x03, "3" ) PORT_DIPSETTING( 0x02, "4" ) PORT_DIPSETTING( 0x01, "5" ) PORT_DIPSETTING( 0x00, "6" ) PORT_DIPUNUSED_DIPLOC( 0x04, IP_ACTIVE_LOW, "DSW1:3" ) PORT_DIPUNUSED_DIPLOC( 0x08, IP_ACTIVE_LOW, "DSW1:4" ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("DSW1:5") + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("DSW1:5") PORT_DIPSETTING( 0x10, DEF_STR( Easy ) ) PORT_DIPSETTING( 0x00, DEF_STR( Hard ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("DSW1:6") + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("DSW1:6") PORT_DIPSETTING( 0x20, "20000 50000" ) PORT_DIPSETTING( 0x00, "40000 70000" ) - PORT_DIPNAME( 0x40, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("DSW1:7") + PORT_DIPNAME( 0x40, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("DSW1:7") PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) PORT_DIPSETTING( 0x40, DEF_STR( Cocktail ) ) - PORT_DIPNAME( 0x80, 0x80, "Freeze" ) PORT_DIPLOCATION("DSW1:8") + PORT_DIPNAME( 0x80, 0x80, "Freeze" ) PORT_DIPLOCATION("DSW1:8") PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) @@ -384,7 +670,7 @@ INPUT_PORTS_END static INPUT_PORTS_START( repulse ) PORT_START("DSW1") - PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) PORT_DIPLOCATION("DSW1:1,2") + PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) PORT_DIPLOCATION("DSW1:1,2") PORT_DIPSETTING( 0x03, "3" ) PORT_DIPSETTING( 0x02, "4" ) PORT_DIPSETTING( 0x01, "5" ) @@ -404,14 +690,14 @@ static INPUT_PORTS_START( repulse ) PORT_DIPNAME( 0x40, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("DSW1:7") PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) PORT_DIPSETTING( 0x40, DEF_STR( Cocktail ) ) - PORT_DIPNAME( 0x80, 0x80, "Freeze" ) PORT_DIPLOCATION("DSW1:8") + PORT_DIPNAME( 0x80, 0x80, "Freeze" ) PORT_DIPLOCATION("DSW1:8") PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_INCLUDE( common ) PORT_MODIFY("DSW2") - PORT_DIPNAME( 0xc0, 0x80, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("DSW2:7,8") + PORT_DIPNAME( 0xc0, 0x80, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("DSW2:7,8") PORT_DIPSETTING( 0xc0, DEF_STR( Easy ) ) PORT_DIPSETTING( 0x80, DEF_STR( Normal ) ) PORT_DIPSETTING( 0x40, DEF_STR( Hard ) ) @@ -420,7 +706,7 @@ INPUT_PORTS_END static INPUT_PORTS_START( airwolf ) PORT_START("DSW1") - PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) PORT_DIPLOCATION("DSW1:1,2") + PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) PORT_DIPLOCATION("DSW1:1,2") PORT_DIPSETTING( 0x03, "4" ) PORT_DIPSETTING( 0x02, "5" ) PORT_DIPSETTING( 0x01, "6" ) @@ -452,7 +738,7 @@ static INPUT_PORTS_START( skywolf ) PORT_INCLUDE( airwolf ) PORT_MODIFY("DSW1") - PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) PORT_DIPLOCATION("DSW1:1,2") + PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) PORT_DIPLOCATION("DSW1:1,2") PORT_DIPSETTING( 0x03, "3" ) PORT_DIPSETTING( 0x02, "4" ) PORT_DIPSETTING( 0x01, "5" ) @@ -461,7 +747,7 @@ INPUT_PORTS_END static INPUT_PORTS_START( flashgal ) PORT_START("DSW1") - PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) PORT_DIPLOCATION("DSW1:1,2") + PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) PORT_DIPLOCATION("DSW1:1,2") PORT_DIPSETTING( 0x03, "3" ) PORT_DIPSETTING( 0x02, "4" ) PORT_DIPSETTING( 0x01, "5" ) @@ -490,7 +776,7 @@ INPUT_PORTS_END static INPUT_PORTS_START( srdmissn ) PORT_START("DSW1") - PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) PORT_DIPLOCATION("DSW1:1,2") + PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) PORT_DIPLOCATION("DSW1:1,2") PORT_DIPSETTING( 0x03, "3" ) PORT_DIPSETTING( 0x02, "4" ) PORT_DIPSETTING( 0x01, "5" ) @@ -519,7 +805,7 @@ INPUT_PORTS_END static INPUT_PORTS_START( legend ) PORT_START("DSW1") - PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) PORT_DIPLOCATION("DSW1:1,2") + PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) PORT_DIPLOCATION("DSW1:1,2") PORT_DIPSETTING( 0x03, "3" ) PORT_DIPSETTING( 0x02, "4" ) PORT_DIPSETTING( 0x01, "5" ) @@ -530,7 +816,7 @@ static INPUT_PORTS_START( legend ) PORT_DIPNAME( 0x08, 0x08, "Slow Motion" ) PORT_DIPLOCATION("DSW1:4") PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW1:5") // probably unused + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW1:5") // probably unused PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x20, 0x20, "Sound Test" ) PORT_DIPLOCATION("DSW1:6") @@ -547,6 +833,7 @@ static INPUT_PORTS_START( legend ) INPUT_PORTS_END + /************************************* * * Graphics definitions @@ -595,6 +882,7 @@ static GFXDECODE_START( gfx_kyugo ) GFXDECODE_END + /************************************* * * Machine drivers @@ -621,7 +909,7 @@ void kyugo_state::machine_reset() INTERRUPT_GEN_MEMBER(kyugo_state::vblank_irq) { - if(m_nmi_mask) + if (m_nmi_mask) device.execute().pulse_input_line(INPUT_LINE_NMI, attotime::zero); } @@ -629,12 +917,12 @@ INTERRUPT_GEN_MEMBER(kyugo_state::vblank_irq) void kyugo_state::kyugo_base(machine_config &config) { // basic machine hardware - Z80(config, m_maincpu, XTAL(18'432'000)/6); // verified on pcb + Z80(config, m_maincpu, 18.432_MHz_XTAL / 6); // verified on pcb m_maincpu->set_addrmap(AS_PROGRAM, &kyugo_state::kyugo_main_map); m_maincpu->set_addrmap(AS_IO, &kyugo_state::kyugo_main_portmap); m_maincpu->set_vblank_int("screen", FUNC(kyugo_state::vblank_irq)); - Z80(config, m_subcpu, XTAL(18'432'000)/6); // verified on pcb + Z80(config, m_subcpu, 18.432_MHz_XTAL / 6); // verified on pcb m_subcpu->set_addrmap(AS_PROGRAM, &kyugo_state::gyrodine_sub_map); m_subcpu->set_addrmap(AS_IO, &kyugo_state::gyrodine_sub_portmap); m_subcpu->set_periodic_int(FUNC(kyugo_state::irq0_line_hold), attotime::from_hz(4*60)); @@ -661,17 +949,18 @@ void kyugo_state::kyugo_base(machine_config &config) // sound hardware SPEAKER(config, "mono").front_center(); - ay8910_device &ay1(AY8910(config, "ay1", XTAL(18'432'000)/12)); // verified on pcb + ay8910_device &ay1(AY8910(config, "ay1", 18.432_MHz_XTAL / 12)); // verified on pcb ay1.port_a_read_callback().set_ioport("DSW1"); ay1.port_b_read_callback().set_ioport("DSW2"); ay1.add_route(ALL_OUTPUTS, "mono", 0.30); - AY8910(config, "ay2", XTAL(18'432'000)/12).add_route(ALL_OUTPUTS, "mono", 0.30); // verified on pcb + AY8910(config, "ay2", 18.432_MHz_XTAL / 12).add_route(ALL_OUTPUTS, "mono", 0.30); // verified on pcb } void kyugo_state::gyrodine(machine_config &config) { kyugo_base(config); + // add watchdog WATCHDOG_TIMER(config, "watchdog"); m_maincpu->set_addrmap(AS_PROGRAM, &kyugo_state::gyrodine_main_map); @@ -715,6 +1004,7 @@ void kyugo_state::legend(machine_config &config) } + /************************************* * * ROM definitions @@ -1578,7 +1868,7 @@ ROM_START( legendb ) ROM_LOAD( "epl12p6.9j", 0x0200, 0x0034, CRC(dcae870d) SHA1(2224724a3faf0608083f5d6ff76712adc7616a54) ) ROM_END - +} // anonymous namespace diff --git a/src/mame/orca/kyugo.h b/src/mame/orca/kyugo.h deleted file mode 100644 index 72261a255f2..00000000000 --- a/src/mame/orca/kyugo.h +++ /dev/null @@ -1,102 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ernesto Corvi -/*************************************************************************** - - Kyugo hardware games - -***************************************************************************/ -#ifndef MAME_ORCA_KYUGO_H -#define MAME_ORCA_KYUGO_H - -#pragma once - -#include "emupal.h" -#include "tilemap.h" - -class kyugo_state : public driver_device -{ -public: - kyugo_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_fgvideoram(*this, "fgvideoram"), - m_bgvideoram(*this, "bgvideoram"), - m_bgattribram(*this, "bgattribram"), - m_spriteram(*this, "spriteram_%u", 1U), - m_shared_ram(*this, "shared_ram"), - m_maincpu(*this, "maincpu"), - m_subcpu(*this, "sub"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") - { } - - void kyugo_base(machine_config &config); - void repulse(machine_config &config); - void flashgala(machine_config &config); - void srdmissn(machine_config &config); - void legend(machine_config &config); - void gyrodine(machine_config &config); - -protected: - virtual void machine_start() override ATTR_COLD; - virtual void machine_reset() override ATTR_COLD; - virtual void video_start() override ATTR_COLD; - -private: - void nmi_mask_w(int state); - void coin_counter_w(offs_t offset, uint8_t data); - void fgvideoram_w(offs_t offset, uint8_t data); - void bgvideoram_w(offs_t offset, uint8_t data); - void bgattribram_w(offs_t offset, uint8_t data); - uint8_t spriteram_2_r(offs_t offset); - void scroll_x_lo_w(uint8_t data); - void gfxctrl_w(uint8_t data); - void scroll_y_w(uint8_t data); - - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(vblank_irq); - - void flashgala_sub_map(address_map &map) ATTR_COLD; - void flashgala_sub_portmap(address_map &map) ATTR_COLD; - void gyrodine_main_map(address_map &map) ATTR_COLD; - void gyrodine_sub_map(address_map &map) ATTR_COLD; - void gyrodine_sub_portmap(address_map &map) ATTR_COLD; - void kyugo_main_map(address_map &map) ATTR_COLD; - void kyugo_main_portmap(address_map &map) ATTR_COLD; - void srdmissn_main_map(address_map &map) ATTR_COLD; - void legend_sub_map(address_map &map) ATTR_COLD; - void repulse_sub_map(address_map &map) ATTR_COLD; - void repulse_sub_portmap(address_map &map) ATTR_COLD; - void srdmissn_sub_map(address_map &map) ATTR_COLD; - void srdmissn_sub_portmap(address_map &map) ATTR_COLD; - - // memory pointers - required_shared_ptr m_fgvideoram; - required_shared_ptr m_bgvideoram; - required_shared_ptr m_bgattribram; - required_shared_ptr_array m_spriteram; - required_shared_ptr m_shared_ram; - - uint8_t m_nmi_mask = 0U; - - // video-related - tilemap_t *m_bg_tilemap = nullptr; - tilemap_t *m_fg_tilemap = nullptr; - uint8_t m_scroll_x_lo = 0U; - uint8_t m_scroll_x_hi = 0U; - uint8_t m_scroll_y = 0U; - uint8_t m_bgpalbank = 0U; - uint8_t m_fgcolor = 0U; - const uint8_t *m_color_codes = nullptr; - - // devices - required_device m_maincpu; - required_device m_subcpu; - required_device m_gfxdecode; - required_device m_palette; - - TILE_GET_INFO_MEMBER(get_fg_tile_info); - TILE_GET_INFO_MEMBER(get_bg_tile_info); - void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); -}; - -#endif // MAME_ORCA_KYUGO_H diff --git a/src/mame/orca/kyugo_v.cpp b/src/mame/orca/kyugo_v.cpp deleted file mode 100644 index c0b36d192f9..00000000000 --- a/src/mame/orca/kyugo_v.cpp +++ /dev/null @@ -1,207 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ernesto Corvi -/*************************************************************************** - - Kyugo hardware games - -***************************************************************************/ - -#include "emu.h" -#include "kyugo.h" - - -/*************************************************************************** - - Callbacks for the TileMap code - -***************************************************************************/ - -TILE_GET_INFO_MEMBER(kyugo_state::get_fg_tile_info) -{ - int code = m_fgvideoram[tile_index]; - tileinfo.set(0, - code, - 2 * m_color_codes[code >> 3] + m_fgcolor, - 0); -} - - -TILE_GET_INFO_MEMBER(kyugo_state::get_bg_tile_info) -{ - int code = m_bgvideoram[tile_index]; - int attr = m_bgattribram[tile_index]; - tileinfo.set(1, - code | ((attr & 0x03) << 8), - (attr >> 4) | (m_bgpalbank << 4), - TILE_FLIPYX((attr & 0x0c) >> 2)); -} - - -/************************************* - * - * Video system start - * - *************************************/ - -void kyugo_state::video_start() -{ - m_color_codes = memregion("proms")->base() + 0x300; - - m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(kyugo_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); - m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(kyugo_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); - - m_fg_tilemap->set_transparent_pen(0); - - m_bg_tilemap->set_scrolldx(-32, 288+32); -} - - -/************************************* - * - * Memory handlers - * - *************************************/ - -void kyugo_state::fgvideoram_w(offs_t offset, uint8_t data) -{ - m_fgvideoram[offset] = data; - m_fg_tilemap->mark_tile_dirty(offset); -} - - -void kyugo_state::bgvideoram_w(offs_t offset, uint8_t data) -{ - m_bgvideoram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset); -} - - -void kyugo_state::bgattribram_w(offs_t offset, uint8_t data) -{ - m_bgattribram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset); -} - - -uint8_t kyugo_state::spriteram_2_r(offs_t offset) -{ - // only the lower nibble is connected - return m_spriteram[1][offset] | 0xf0; -} - - -void kyugo_state::scroll_x_lo_w(uint8_t data) -{ - m_scroll_x_lo = data; -} - - -void kyugo_state::gfxctrl_w(uint8_t data) -{ - // bit 0 is scroll MSB - m_scroll_x_hi = data & 0x01; - - // bit 5 is front layer color (Son of Phoenix only) - if (m_fgcolor != ((data & 0x20) >> 5)) - { - m_fgcolor = (data & 0x20) >> 5; - - m_fg_tilemap->mark_all_dirty(); - } - - // bit 6 is background palette bank - if (m_bgpalbank != ((data & 0x40) >> 6)) - { - m_bgpalbank = (data & 0x40) >> 6; - m_bg_tilemap->mark_all_dirty(); - } - - if (data & 0x9e) - popmessage("%02x",data); -} - - -void kyugo_state::scroll_y_w(uint8_t data) -{ - m_scroll_y = data; -} - - -/************************************* - * - * Video update - * - *************************************/ - -void kyugo_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - // sprite information is scattered through memory - // and uses a portion of the text layer memory (outside the visible area) - uint8_t *spriteram_area1 = &m_spriteram[0][0x28]; - uint8_t *spriteram_area2 = &m_spriteram[1][0x28]; - uint8_t *spriteram_area3 = &m_fgvideoram[0x28]; - - int flip = flip_screen(); - - for (int n = 0; n < 12 * 2; n++) - { - int offs, sy, sx, color; - - offs = 2 * (n % 12) + 64 * (n / 12); - - sx = spriteram_area3[offs + 1] + 256 * (spriteram_area2[offs + 1] & 1); - if (sx > 320) - sx -= 512; - - sy = 255 - spriteram_area1[offs] + 2; - if (sy > 0xf0) - sy -= 256; - - if (flip) - sy = 240 - sy; - - color = spriteram_area1[offs + 1] & 0x1f; - - for (int y = 0; y < 16; y++) - { - int code, attr, flipx, flipy; - - code = spriteram_area3[offs + 128 * y]; - attr = spriteram_area2[offs + 128 * y]; - - code = code | ((attr & 0x01) << 9) | ((attr & 0x02) << 7); - - flipx = attr & 0x08; - flipy = attr & 0x04; - - if (flip) - { - flipx = !flipx; - flipy = !flipy; - } - - - m_gfxdecode->gfx(2)->transpen(bitmap,cliprect, - code, - color, - flipx,flipy, - sx,flip ? sy - 16*y : sy + 16*y, 0 ); - } - } -} - - -uint32_t kyugo_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - if (flip_screen()) - m_bg_tilemap->set_scrollx(0, -(m_scroll_x_lo + (m_scroll_x_hi * 256))); - else - m_bg_tilemap->set_scrollx(0, m_scroll_x_lo + (m_scroll_x_hi * 256)); - - m_bg_tilemap->set_scrolly(0, m_scroll_y); - - m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - draw_sprites(bitmap, cliprect); - m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - return 0; -} -- cgit v1.2.3