summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Ivan Vangelista <mesgnet@yahoo.it>2022-09-29 18:20:50 +0200
committer Ivan Vangelista <mesgnet@yahoo.it>2022-09-29 18:20:50 +0200
commit24932a53cc2a25ff943ac04773cbcf15d04e01d6 (patch)
tree1fc701ea6566eb59465f13c33d673b9dd9241e9d
parent9b99e307eb55b6b4cf3cdf43e98adff42b625b8f (diff)
konami\bladestl.cpp, konami\yiear.cpp: consolidated drivers in single files, minor cleanups
-rw-r--r--src/mame/konami/bladestl.cpp335
-rw-r--r--src/mame/konami/bladestl.h85
-rw-r--r--src/mame/konami/bladestl_v.cpp67
-rw-r--r--src/mame/konami/yiear.cpp302
-rw-r--r--src/mame/konami/yiear.h78
-rw-r--r--src/mame/konami/yiear_v.cpp143
6 files changed, 493 insertions, 517 deletions
diff --git a/src/mame/konami/bladestl.cpp b/src/mame/konami/bladestl.cpp
index bc415ce2fc3..2abbf426db2 100644
--- a/src/mame/konami/bladestl.cpp
+++ b/src/mame/konami/bladestl.cpp
@@ -1,5 +1,6 @@
// license:BSD-3-Clause
-// copyright-holders:Manuel Abadia
+// copyright-holders: Manuel Abadia
+
/***************************************************************************
Blades of Steel (GX797) (c) 1987 Konami
@@ -29,25 +30,167 @@
***************************************************************************/
#include "emu.h"
-#include "bladestl.h"
+
+#include "k007342.h"
+#include "k007420.h"
+#include "k051733.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/timer.h"
#include "machine/watchdog.h"
+#include "sound/flt_rc.h"
+#include "sound/upd7759.h"
#include "sound/ymopn.h"
+
+#include "emupal.h"
#include "screen.h"
#include "speaker.h"
-TIMER_DEVICE_CALLBACK_MEMBER(bladestl_state::bladestl_scanline)
+namespace {
+
+class bladestl_state : public driver_device
{
- int scanline = param;
+public:
+ bladestl_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_upd7759(*this, "upd"),
+ m_filter(*this, "filter%u", 1U),
+ m_gfxdecode(*this, "gfxdecode"),
+ m_soundlatch(*this, "soundlatch"),
+ m_trackball(*this, "TRACKBALL.%u", 0),
+ m_lamps(*this, "lamp%u", 0U),
+ m_rombank(*this, "rombank")
+ { }
+
+ void bladestl(machine_config &config);
+
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
+private:
+ // devices
+ required_device<cpu_device> m_maincpu;
+ required_device<cpu_device> m_audiocpu;
+ required_device<k007342_device> m_k007342;
+ required_device<k007420_device> m_k007420;
+ required_device<upd7759_device> m_upd7759;
+ required_device_array<filter_rc_device, 3> m_filter;
+ required_device<gfxdecode_device> m_gfxdecode;
+ required_device<generic_latch_8_device> m_soundlatch;
+
+ // I/O
+ required_ioport_array<4> m_trackball;
+ output_finder<2> m_lamps;
+
+ // memory pointers
+ required_memory_bank m_rombank;
+
+ // video-related
+ uint16_t m_spritebank = 0;
+
+ // misc
+ uint8_t m_last_track[4]{};
+
+ uint8_t trackball_r(offs_t offset);
+ void bankswitch_w(uint8_t data);
+ void port_b_w(uint8_t data);
+ uint8_t speech_busy_r();
+ void speech_ctrl_w(uint8_t data);
+ void palette(palette_device &palette) const;
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ TIMER_DEVICE_CALLBACK_MEMBER(scanline);
+ K007342_CALLBACK_MEMBER(tile_callback);
+ K007420_CALLBACK_MEMBER(sprite_callback);
+
+ void main_map(address_map &map);
+ void sound_map(address_map &map);
+};
+
+
+// video
+
+void bladestl_state::palette(palette_device &palette) const
+{
+ uint8_t const *const color_prom = memregion("proms")->base();
+
+ // characters use pens 0x00-0x1f, no look-up table
+ for (int i = 0; i < 0x20; i++)
+ palette.set_pen_indirect(i, i);
+
+ // sprites use pens 0x20-0x2f
+ for (int i = 0x20; i < 0x120; i++)
+ {
+ uint8_t const ctabentry = (color_prom[i - 0x20] & 0x0f) | 0x20;
+ palette.set_pen_indirect(i, ctabentry);
+ }
+}
- if(scanline == 240 && m_k007342->is_int_enabled()) // vblank-out irq
+
+
+/***************************************************************************
+
+ Callback for the K007342
+
+***************************************************************************/
+
+K007342_CALLBACK_MEMBER(bladestl_state::tile_callback)
+{
+ *code |= ((*color & 0x0f) << 8) | ((*color & 0x40) << 6);
+ *color = layer;
+}
+
+/***************************************************************************
+
+ Callback for the K007420
+
+***************************************************************************/
+
+K007420_CALLBACK_MEMBER(bladestl_state::sprite_callback)
+{
+ *code |= ((*color & 0xc0) << 2) + m_spritebank;
+ *code = (*code << 2) | ((*color & 0x30) >> 4);
+ *color = 0 + (*color & 0x0f);
+}
+
+
+/***************************************************************************
+
+ Screen Refresh
+
+***************************************************************************/
+
+uint32_t bladestl_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ m_k007342->tilemap_update();
+
+ m_k007342->tilemap_draw(screen, bitmap, cliprect, 1, TILEMAP_DRAW_OPAQUE, 0);
+ m_k007420->sprites_draw(bitmap, cliprect, m_gfxdecode->gfx(1));
+ m_k007342->tilemap_draw(screen, bitmap, cliprect, 1, 1 | TILEMAP_DRAW_OPAQUE, 0);
+ m_k007342->tilemap_draw(screen, bitmap, cliprect, 0, 0 ,0);
+ m_k007342->tilemap_draw(screen, bitmap, cliprect, 0, 1 ,0);
+ return 0;
+}
+
+
+// machine
+
+TIMER_DEVICE_CALLBACK_MEMBER(bladestl_state::scanline)
+{
+ int const scanline = param;
+
+ if (scanline == 240 && m_k007342->is_int_enabled()) // vblank-out irq
m_maincpu->set_input_line(HD6309_FIRQ_LINE, HOLD_LINE);
- if(scanline == 0) // vblank-in or timer irq
+ if (scanline == 0) // vblank-in or timer irq
m_maincpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero);
}
@@ -59,54 +202,54 @@ TIMER_DEVICE_CALLBACK_MEMBER(bladestl_state::bladestl_scanline)
uint8_t bladestl_state::trackball_r(offs_t offset)
{
- int curr = m_trackball[offset]->read();
- int delta = (curr - m_last_track[offset]) & 0xff;
+ int const curr = m_trackball[offset]->read();
+ int const delta = (curr - m_last_track[offset]) & 0xff;
m_last_track[offset] = curr;
return (delta & 0x80) | (curr >> 1);
}
-void bladestl_state::bladestl_bankswitch_w(uint8_t data)
+void bladestl_state::bankswitch_w(uint8_t data)
{
- /* bits 0 & 1 = coin counters */
+ // bits 0 & 1 = coin counters
machine().bookkeeping().coin_counter_w(0,data & 0x01);
machine().bookkeeping().coin_counter_w(1,data & 0x02);
- /* bits 2 & 3 = lamps */
+ // bits 2 & 3 = lamps
m_lamps[0] = BIT(data, 2);
m_lamps[1] = BIT(data, 3);
- /* bit 4 = relay (???) */
+ // bit 4 = relay (???)
- /* bits 5-6 = bank number */
+ // bits 5-6 = bank number
m_rombank->set_entry((data & 0x60) >> 5);
- /* bit 7 = select sprite bank */
+ // bit 7 = select sprite bank
m_spritebank = (data & 0x80) << 3;
}
-void bladestl_state::bladestl_port_B_w(uint8_t data)
+void bladestl_state::port_b_w(uint8_t data)
{
// bits 3-5 = ROM bank select
m_upd7759->set_rom_bank((data & 0x38) >> 3);
// bit 2 = SSG-C rc filter enable
- m_filter3->filter_rc_set_RC(filter_rc_device::LOWPASS_3R, 1000, 2200, 1000, data & 0x04 ? CAP_N(150) : 0); /* YM2203-SSG-C */
+ m_filter[2]->filter_rc_set_RC(filter_rc_device::LOWPASS_3R, 1000, 2200, 1000, data & 0x04 ? CAP_N(150) : 0); // YM2203-SSG-C
// bit 1 = SSG-B rc filter enable
- m_filter2->filter_rc_set_RC(filter_rc_device::LOWPASS_3R, 1000, 2200, 1000, data & 0x02 ? CAP_N(150) : 0); /* YM2203-SSG-B */
+ m_filter[1]->filter_rc_set_RC(filter_rc_device::LOWPASS_3R, 1000, 2200, 1000, data & 0x02 ? CAP_N(150) : 0); // YM2203-SSG-B
// bit 0 = SSG-A rc filter enable
- m_filter1->filter_rc_set_RC(filter_rc_device::LOWPASS_3R, 1000, 2200, 1000, data & 0x01 ? CAP_N(150) : 0); /* YM2203-SSG-A */
+ m_filter[2]->filter_rc_set_RC(filter_rc_device::LOWPASS_3R, 1000, 2200, 1000, data & 0x01 ? CAP_N(150) : 0); // YM2203-SSG-A
}
-uint8_t bladestl_state::bladestl_speech_busy_r()
+uint8_t bladestl_state::speech_busy_r()
{
return m_upd7759->busy_r() ? 1 : 0;
}
-void bladestl_state::bladestl_speech_ctrl_w(uint8_t data)
+void bladestl_state::speech_ctrl_w(uint8_t data)
{
m_upd7759->reset_w(data & 1);
m_upd7759->start_w(data & 2);
@@ -120,33 +263,33 @@ void bladestl_state::bladestl_speech_ctrl_w(uint8_t data)
void bladestl_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(0x2400, 0x245f).ram().w("palette", FUNC(palette_device::write_indirect)).share("palette"); /* palette */
- map(0x2600, 0x2607).w(m_k007342, FUNC(k007342_device::vreg_w)); /* Video Registers */
- map(0x2e00, 0x2e00).portr("COINSW"); /* DIPSW #3, coinsw, startsw */
- map(0x2e01, 0x2e01).portr("P1"); /* 1P controls */
- map(0x2e02, 0x2e02).portr("P2"); /* 2P controls */
- map(0x2e03, 0x2e03).portr("DSW2"); /* DISPW #2 */
- map(0x2e40, 0x2e40).portr("DSW1"); /* DIPSW #1 */
- map(0x2e80, 0x2e80).w("soundlatch", FUNC(generic_latch_8_device::write)); /* cause interrupt on audio CPU */
+ 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, 0x245f).ram().w("palette", FUNC(palette_device::write_indirect)).share("palette");
+ map(0x2600, 0x2607).w(m_k007342, FUNC(k007342_device::vreg_w));
+ map(0x2e00, 0x2e00).portr("COINSW"); // DIPSW #3, coinsw, startsw
+ map(0x2e01, 0x2e01).portr("P1");
+ map(0x2e02, 0x2e02).portr("P2");
+ map(0x2e03, 0x2e03).portr("DSW2");
+ map(0x2e40, 0x2e40).portr("DSW1");
+ 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, 0x2f03).r(FUNC(bladestl_state::trackball_r)); /* Trackballs */
- map(0x2f40, 0x2f40).w(FUNC(bladestl_state::bladestl_bankswitch_w)); /* bankswitch control */
- map(0x2f80, 0x2f9f).rw("k051733", FUNC(k051733_device::read), FUNC(k051733_device::write)); /* Protection: 051733 */
- map(0x2fc0, 0x2fc0).nopw(); /* ??? */
- map(0x4000, 0x5fff).ram(); /* Work RAM */
- map(0x6000, 0x7fff).bankr("rombank"); /* banked ROM */
+ map(0x2f00, 0x2f03).r(FUNC(bladestl_state::trackball_r));
+ map(0x2f40, 0x2f40).w(FUNC(bladestl_state::bankswitch_w));
+ map(0x2f80, 0x2f9f).rw("k051733", FUNC(k051733_device::read), FUNC(k051733_device::write)); // Protection
+ map(0x2fc0, 0x2fc0).nopw(); // ???
+ map(0x4000, 0x5fff).ram(); // Work RAM
+ map(0x6000, 0x7fff).bankr(m_rombank);
map(0x8000, 0xffff).rom();
}
void bladestl_state::sound_map(address_map &map)
{
map(0x0000, 0x07ff).ram();
- map(0x1000, 0x1001).rw("ymsnd", FUNC(ym2203_device::read), FUNC(ym2203_device::write)); /* YM2203 */
- map(0x3000, 0x3000).w(FUNC(bladestl_state::bladestl_speech_ctrl_w)); /* UPD7759 */
- map(0x4000, 0x4000).r(FUNC(bladestl_state::bladestl_speech_busy_r)); /* UPD7759 */
+ map(0x1000, 0x1001).rw("ymsnd", FUNC(ym2203_device::read), FUNC(ym2203_device::write));
+ map(0x3000, 0x3000).w(FUNC(bladestl_state::speech_ctrl_w)); // UPD7759
+ map(0x4000, 0x4000).r(FUNC(bladestl_state::speech_busy_r)); // UPD7759
map(0x5000, 0x5000).w("soundlatch", FUNC(generic_latch_8_device::acknowledge_w));
map(0x6000, 0x6000).r("soundlatch", FUNC(generic_latch_8_device::read));
map(0x8000, 0xffff).rom();
@@ -221,11 +364,11 @@ static INPUT_PORTS_START( bladestl_track ) // Joystick inputs are still read in
PORT_INCLUDE( bladestl_joy )
PORT_MODIFY("DSW2")
- PORT_DIPUNUSED_DIPLOC( 0x08, 0x08, "SW2:4" ) /* Listed as "Unused" */
- PORT_DIPUNUSED_DIPLOC( 0x10, 0x10, "SW2:5" ) /* Listed as "Unused" */
+ PORT_DIPUNUSED_DIPLOC( 0x08, 0x08, "SW2:4" ) // Listed as "Unused"
+ PORT_DIPUNUSED_DIPLOC( 0x10, 0x10, "SW2:5" ) // Listed as "Unused"
PORT_MODIFY("P1")
- PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW3:4" ) /* Listed as "Unused" */
+ PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW3:4" ) // Listed as "Unused"
PORT_MODIFY("TRACKBALL.0")
PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(63) PORT_REVERSE PORT_PLAYER(1)
@@ -250,29 +393,29 @@ 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 */
+ 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 */
+ 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 sprite takes 32 consecutive bytes
};
static GFXDECODE_START( gfx_bladestl )
- GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 2 ) /* colors 00..31 */
- GFXDECODE_ENTRY( "gfx2", 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, spritelayout, 32, 16 ) // colors 32..47 but using lookup table
GFXDECODE_END
@@ -293,11 +436,9 @@ void bladestl_state::machine_start()
void bladestl_state::machine_reset()
{
- int i;
-
m_spritebank = 0;
- for (i = 0; i < 4 ; i++)
+ for (int i = 0; i < 4 ; i++)
m_last_track[i] = 0;
m_soundlatch->acknowledge_w();
@@ -305,10 +446,10 @@ void bladestl_state::machine_reset()
void bladestl_state::bladestl(machine_config &config)
{
- /* basic machine hardware */
+ // basic machine hardware
HD6309E(config, m_maincpu, XTAL(24'000'000) / 8); // divider not verified (from 007342 custom)
m_maincpu->set_addrmap(AS_PROGRAM, &bladestl_state::main_map);
- TIMER(config, "scantimer").configure_scanline(FUNC(bladestl_state::bladestl_scanline), "screen", 0, 1);
+ TIMER(config, "scantimer").configure_scanline(FUNC(bladestl_state::scanline), "screen", 0, 1);
MC6809E(config, m_audiocpu, XTAL(24'000'000) / 16);
m_audiocpu->set_addrmap(AS_PROGRAM, &bladestl_state::sound_map);
@@ -317,31 +458,31 @@ void bladestl_state::bladestl(machine_config &config)
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(bladestl_state::screen_update_bladestl));
+ screen.set_screen_update(FUNC(bladestl_state::screen_update));
screen.set_palette("palette");
GFXDECODE(config, m_gfxdecode, "palette", gfx_bladestl);
- PALETTE(config, "palette", FUNC(bladestl_state::bladestl_palette)).set_format(palette_device::xBGR_555, 32 + 16*16, 32+16);
+ PALETTE(config, "palette", FUNC(bladestl_state::palette)).set_format(palette_device::xBGR_555, 32 + 16*16, 32+16);
K007342(config, m_k007342, 0);
m_k007342->set_gfxnum(0);
- m_k007342->set_tile_callback(FUNC(bladestl_state::bladestl_tile_callback));
+ m_k007342->set_tile_callback(FUNC(bladestl_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(bladestl_state::bladestl_sprite_callback));
+ m_k007420->set_sprite_callback(FUNC(bladestl_state::sprite_callback));
m_k007420->set_palette_tag("palette");
K051733(config, "k051733", 0);
- /* sound hardware */
+ // sound hardware
/* the initialization order is important, the port callbacks being
called at initialization time */
SPEAKER(config, "mono").front_center();
@@ -354,15 +495,15 @@ void bladestl_state::bladestl(machine_config &config)
ym2203_device &ymsnd(YM2203(config, "ymsnd", XTAL(24'000'000) / 8));
ymsnd.port_a_write_callback().set(m_upd7759, FUNC(upd775x_device::port_w));
- ymsnd.port_b_write_callback().set(FUNC(bladestl_state::bladestl_port_B_w));
+ ymsnd.port_b_write_callback().set(FUNC(bladestl_state::port_b_w));
ymsnd.add_route(0, "filter1", 0.45);
ymsnd.add_route(1, "filter2", 0.45);
ymsnd.add_route(2, "filter3", 0.45);
ymsnd.add_route(3, "mono", 0.45);
- FILTER_RC(config, m_filter1).add_route(ALL_OUTPUTS, "mono", 1.0);
- FILTER_RC(config, m_filter2).add_route(ALL_OUTPUTS, "mono", 1.0);
- FILTER_RC(config, m_filter3).add_route(ALL_OUTPUTS, "mono", 1.0);
+ FILTER_RC(config, m_filter[0]).add_route(ALL_OUTPUTS, "mono", 1.0);
+ FILTER_RC(config, m_filter[1]).add_route(ALL_OUTPUTS, "mono", 1.0);
+ FILTER_RC(config, m_filter[2]).add_route(ALL_OUTPUTS, "mono", 1.0);
}
@@ -373,68 +514,70 @@ void bladestl_state::bladestl(machine_config &config)
*************************************/
ROM_START( bladestl )
- ROM_REGION( 0x10000, "maincpu", 0 ) /* code + banked roms */
+ ROM_REGION( 0x10000, "maincpu", 0 )
ROM_LOAD( "797-t01.19c", 0x00000, 0x10000, CRC(89d7185d) SHA1(0d2f346d9515cab0389106c0e227fb0bd84a2c9c) )
- ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for the sound CPU */
+ ROM_REGION( 0x10000, "audiocpu", 0 )
ROM_LOAD( "797-c02.12d", 0x08000, 0x08000, CRC(65a331ea) SHA1(f206f6c5f0474542a5b7686b2f4d2cc7077dd5b9) )
- ROM_REGION( 0x40000, "gfx1", 0 )
- ROM_LOAD( "797a05.19h", 0x00000, 0x40000, CRC(5491ba28) SHA1(c807774827c55c211ab68f548e1e835289cc5744) ) /* tiles */
+ ROM_REGION( 0x40000, "tiles", 0 )
+ ROM_LOAD( "797a05.19h", 0x00000, 0x40000, CRC(5491ba28) SHA1(c807774827c55c211ab68f548e1e835289cc5744) )
- ROM_REGION( 0x40000, "gfx2", 0 )
- ROM_LOAD( "797a06.13h", 0x00000, 0x40000, CRC(d055f5cc) SHA1(3723b39b2a3e6dd8e7fc66bbfe1eef9f80818774) ) /* sprites */
+ ROM_REGION( 0x40000, "sprites", 0 )
+ ROM_LOAD( "797a06.13h", 0x00000, 0x40000, CRC(d055f5cc) SHA1(3723b39b2a3e6dd8e7fc66bbfe1eef9f80818774) )
ROM_REGION( 0x0100, "proms", 0 )
- ROM_LOAD( "797a07.16i", 0x0000, 0x0100, CRC(7aecad4e) SHA1(05150a8dd25bdd6ab0c5b350e6ffd272f040e46a) ) /* sprites lookup table, 63S141N BPROM */
+ ROM_LOAD( "797a07.16i", 0x0000, 0x0100, CRC(7aecad4e) SHA1(05150a8dd25bdd6ab0c5b350e6ffd272f040e46a) ) // sprites lookup table, 63S141N BPROM
- ROM_REGION( 0xc0000, "upd", 0 ) /* uPD7759 data (chip 1) */
+ ROM_REGION( 0xc0000, "upd", 0 )
ROM_LOAD( "797a03.11a", 0x00000, 0x80000, CRC(9ee1a542) SHA1(c9a142a326875a50f03e49e83a84af8bb423a467) )
ROM_LOAD( "797a04.9a", 0x80000, 0x40000, CRC(9ac8ea4e) SHA1(9f81eff970c9e8aea6f67d8a7d89805fae044ae1) )
ROM_END
ROM_START( bladestll )
- ROM_REGION( 0x10000, "maincpu", 0 ) /* code + banked roms */
+ ROM_REGION( 0x10000, "maincpu", 0 )
ROM_LOAD( "797-l01.19c", 0x00000, 0x10000, CRC(1ab14c40) SHA1(c566e31a666b467d75f5fc9fa427986c3ebc705c) )
- ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for the sound CPU */
+ ROM_REGION( 0x10000, "audiocpu", 0 )
ROM_LOAD( "797-c02.12d", 0x08000, 0x08000, CRC(65a331ea) SHA1(f206f6c5f0474542a5b7686b2f4d2cc7077dd5b9) )
- ROM_REGION( 0x40000, "gfx1", 0 )
- ROM_LOAD( "797a05.19h", 0x00000, 0x40000, CRC(5491ba28) SHA1(c807774827c55c211ab68f548e1e835289cc5744) ) /* tiles */
+ ROM_REGION( 0x40000, "tiles", 0 )
+ ROM_LOAD( "797a05.19h", 0x00000, 0x40000, CRC(5491ba28) SHA1(c807774827c55c211ab68f548e1e835289cc5744) )
- ROM_REGION( 0x40000, "gfx2", 0 )
- ROM_LOAD( "797a06.13h", 0x00000, 0x40000, CRC(d055f5cc) SHA1(3723b39b2a3e6dd8e7fc66bbfe1eef9f80818774) ) /* sprites */
+ ROM_REGION( 0x40000, "sprites", 0 )
+ ROM_LOAD( "797a06.13h", 0x00000, 0x40000, CRC(d055f5cc) SHA1(3723b39b2a3e6dd8e7fc66bbfe1eef9f80818774) )
ROM_REGION( 0x0100, "proms", 0 )
- ROM_LOAD( "797a07.16i", 0x0000, 0x0100, CRC(7aecad4e) SHA1(05150a8dd25bdd6ab0c5b350e6ffd272f040e46a) ) /* sprites lookup table, 63S141N BPROM */
+ ROM_LOAD( "797a07.16i", 0x0000, 0x0100, CRC(7aecad4e) SHA1(05150a8dd25bdd6ab0c5b350e6ffd272f040e46a) ) // sprites lookup table, 63S141N BPROM
- ROM_REGION( 0xc0000, "upd", 0 ) /* uPD7759 data (chip 1) */
+ ROM_REGION( 0xc0000, "upd", 0 )
ROM_LOAD( "797a03.11a", 0x00000, 0x80000, CRC(9ee1a542) SHA1(c9a142a326875a50f03e49e83a84af8bb423a467) )
ROM_LOAD( "797a04.9a", 0x80000, 0x40000, CRC(9ac8ea4e) SHA1(9f81eff970c9e8aea6f67d8a7d89805fae044ae1) )
ROM_END
ROM_START( bladestle )
- ROM_REGION( 0x10000, "maincpu", 0 ) /* code + banked roms */
+ ROM_REGION( 0x10000, "maincpu", 0 )
ROM_LOAD( "797-e01.19c", 0x00000, 0x10000, CRC(f8472e95) SHA1(8b6caa905fb1642300dd9da508871b00429872c3) )
- ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for the sound CPU */
+ ROM_REGION( 0x10000, "audiocpu", 0 )
ROM_LOAD( "797-c02.12d", 0x08000, 0x08000, CRC(65a331ea) SHA1(f206f6c5f0474542a5b7686b2f4d2cc7077dd5b9) )
- ROM_REGION( 0x40000, "gfx1", 0 )
- ROM_LOAD( "797a05.19h", 0x00000, 0x40000, CRC(5491ba28) SHA1(c807774827c55c211ab68f548e1e835289cc5744) ) /* tiles */
+ ROM_REGION( 0x40000, "tiles", 0 )
+ ROM_LOAD( "797a05.19h", 0x00000, 0x40000, CRC(5491ba28) SHA1(c807774827c55c211ab68f548e1e835289cc5744) )
- ROM_REGION( 0x40000, "gfx2", 0 )
- ROM_LOAD( "797a06.13h", 0x00000, 0x40000, CRC(d055f5cc) SHA1(3723b39b2a3e6dd8e7fc66bbfe1eef9f80818774) ) /* sprites */
+ ROM_REGION( 0x40000, "sprites", 0 )
+ ROM_LOAD( "797a06.13h", 0x00000, 0x40000, CRC(d055f5cc) SHA1(3723b39b2a3e6dd8e7fc66bbfe1eef9f80818774) )
ROM_REGION( 0x0100, "proms", 0 )
- ROM_LOAD( "797a07.16i", 0x0000, 0x0100, CRC(7aecad4e) SHA1(05150a8dd25bdd6ab0c5b350e6ffd272f040e46a) ) /* sprites lookup table, 63S141N BPROM */
+ ROM_LOAD( "797a07.16i", 0x0000, 0x0100, CRC(7aecad4e) SHA1(05150a8dd25bdd6ab0c5b350e6ffd272f040e46a) ) // sprites lookup table, 63S141N BPROM
- ROM_REGION( 0xc0000, "upd", 0 ) /* uPD7759 data (chip 1) */
+ ROM_REGION( 0xc0000, "upd", 0 )
ROM_LOAD( "797a03.11a", 0x00000, 0x80000, CRC(9ee1a542) SHA1(c9a142a326875a50f03e49e83a84af8bb423a467) )
ROM_LOAD( "797a04.9a", 0x80000, 0x40000, CRC(9ac8ea4e) SHA1(9f81eff970c9e8aea6f67d8a7d89805fae044ae1) )
ROM_END
+} // anonymous namespace
+
/*************************************
*
@@ -442,6 +585,6 @@ ROM_END
*
*************************************/
-GAME( 1987, bladestl, 0, bladestl, bladestl_joy, bladestl_state, empty_init, ROT90, "Konami", "Blades of Steel (version T, Joystick)", MACHINE_SUPPORTS_SAVE )
+GAME( 1987, bladestl, 0, bladestl, bladestl_joy, bladestl_state, empty_init, ROT90, "Konami", "Blades of Steel (version T, Joystick)", MACHINE_SUPPORTS_SAVE )
GAME( 1987, bladestll, bladestl, bladestl, bladestl_track, bladestl_state, empty_init, ROT90, "Konami", "Blades of Steel (version L, Trackball)", MACHINE_SUPPORTS_SAVE )
GAME( 1987, bladestle, bladestl, bladestl, bladestl_track, bladestl_state, empty_init, ROT90, "Konami", "Blades of Steel (version E, Trackball)", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/konami/bladestl.h b/src/mame/konami/bladestl.h
deleted file mode 100644
index dc65c6a0f60..00000000000
--- a/src/mame/konami/bladestl.h
+++ /dev/null
@@ -1,85 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Manuel Abadia
-/*************************************************************************
-
- Blades of Steel
-
-*************************************************************************/
-#ifndef MAME_INCLUDES_BLADESTL_H
-#define MAME_INCLUDES_BLADESTL_H
-
-#pragma once
-
-#include "machine/gen_latch.h"
-#include "machine/timer.h"
-#include "sound/flt_rc.h"
-#include "sound/upd7759.h"
-#include "k007342.h"
-#include "k007420.h"
-#include "k051733.h"
-#include "emupal.h"
-
-class bladestl_state : public driver_device
-{
-public:
- bladestl_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_upd7759(*this, "upd"),
- m_filter1(*this, "filter1"),
- m_filter2(*this, "filter2"),
- m_filter3(*this, "filter3"),
- m_gfxdecode(*this, "gfxdecode"),
- m_soundlatch(*this, "soundlatch"),
- m_trackball(*this, "TRACKBALL.%u", 0),
- m_rombank(*this, "rombank"),
- m_lamps(*this, "lamp%u", 0U)
- { }
-
- /* devices */
- uint8_t trackball_r(offs_t offset);
- void bladestl_bankswitch_w(uint8_t data);
- void bladestl_port_B_w(uint8_t data);
- uint8_t bladestl_speech_busy_r();
- void bladestl_speech_ctrl_w(uint8_t data);
- void bladestl_palette(palette_device &palette) const;
- uint32_t screen_update_bladestl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- TIMER_DEVICE_CALLBACK_MEMBER(bladestl_scanline);
- K007342_CALLBACK_MEMBER(bladestl_tile_callback);
- K007420_CALLBACK_MEMBER(bladestl_sprite_callback);
- void bladestl(machine_config &config);
- void main_map(address_map &map);
- void sound_map(address_map &map);
-
-protected:
- virtual void machine_start() override;
- virtual void machine_reset() override;
-
- required_device<cpu_device> m_maincpu;
- required_device<cpu_device> m_audiocpu;
- required_device<k007342_device> m_k007342;
- required_device<k007420_device> m_k007420;
- required_device<upd7759_device> m_upd7759;
- required_device<filter_rc_device> m_filter1;
- required_device<filter_rc_device> m_filter2;
- required_device<filter_rc_device> m_filter3;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<generic_latch_8_device> m_soundlatch;
- required_ioport_array<4> m_trackball;
-
- /* memory pointers */
- required_memory_bank m_rombank;
-
- /* video-related */
- int m_spritebank = 0;
-
- /* misc */
- int m_last_track[4]{};
-
- output_finder<2> m_lamps;
-};
-
-#endif // MAME_INCLUDES_BLADESTL_H
diff --git a/src/mame/konami/bladestl_v.cpp b/src/mame/konami/bladestl_v.cpp
deleted file mode 100644
index b6e05e9e85e..00000000000
--- a/src/mame/konami/bladestl_v.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Manuel Abadia
-#include "emu.h"
-#include "bladestl.h"
-
-
-void bladestl_state::bladestl_palette(palette_device &palette) const
-{
- uint8_t const *const color_prom = memregion("proms")->base();
-
- // characters use pens 0x00-0x1f, no look-up table
- for (int i = 0; i < 0x20; i++)
- palette.set_pen_indirect(i, i);
-
- // sprites use pens 0x20-0x2f
- for (int i = 0x20; i < 0x120; i++)
- {
- uint8_t const ctabentry = (color_prom[i - 0x20] & 0x0f) | 0x20;
- palette.set_pen_indirect(i, ctabentry);
- }
-}
-
-
-
-/***************************************************************************
-
- Callback for the K007342
-
-***************************************************************************/
-
-K007342_CALLBACK_MEMBER(bladestl_state::bladestl_tile_callback)
-{
- *code |= ((*color & 0x0f) << 8) | ((*color & 0x40) << 6);
- *color = layer;
-}
-
-/***************************************************************************
-
- Callback for the K007420
-
-***************************************************************************/
-
-K007420_CALLBACK_MEMBER(bladestl_state::bladestl_sprite_callback)
-{
- *code |= ((*color & 0xc0) << 2) + m_spritebank;
- *code = (*code << 2) | ((*color & 0x30) >> 4);
- *color = 0 + (*color & 0x0f);
-}
-
-
-/***************************************************************************
-
- Screen Refresh
-
-***************************************************************************/
-
-uint32_t bladestl_state::screen_update_bladestl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
- m_k007342->tilemap_update();
-
- m_k007342->tilemap_draw(screen, bitmap, cliprect, 1, TILEMAP_DRAW_OPAQUE ,0);
- m_k007420->sprites_draw(bitmap, cliprect, m_gfxdecode->gfx(1));
- m_k007342->tilemap_draw(screen, bitmap, cliprect, 1, 1 | TILEMAP_DRAW_OPAQUE ,0);
- m_k007342->tilemap_draw(screen, bitmap, cliprect, 0, 0 ,0);
- m_k007342->tilemap_draw(screen, bitmap, cliprect, 0, 1 ,0);
- return 0;
-}
diff --git a/src/mame/konami/yiear.cpp b/src/mame/konami/yiear.cpp
index 6e6a25a8c46..df2a11270f9 100644
--- a/src/mame/konami/yiear.cpp
+++ b/src/mame/konami/yiear.cpp
@@ -1,6 +1,7 @@
// license:BSD-3-Clause
-// copyright-holders:Phil Stroffolino
-// thanks-to:Enrique Sanchez
+// copyright-holders: Phil Stroffolino
+// thanks-to: Enrique Sanchez
+
/***************************************************************************
Yie Ar Kung-Fu memory map (preliminary)
@@ -97,15 +98,219 @@ Sound: VLM5030 at 7B
***************************************************************************/
#include "emu.h"
-#include "yiear.h"
+
#include "konamipt.h"
+#include "trackfld_a.h"
#include "cpu/m6809/m6809.h"
#include "machine/watchdog.h"
#include "sound/sn76496.h"
+#include "sound/vlm5030.h"
+
+#include "emupal.h"
+#include "screen.h"
#include "speaker.h"
+#include "tilemap.h"
+
+
+namespace {
+
+class yiear_state : public driver_device
+{
+public:
+ yiear_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
+ m_spriteram(*this, "spriteram%u", 1U),
+ m_videoram(*this, "videoram"),
+ m_maincpu(*this, "maincpu"),
+ m_audio(*this, "trackfld_audio"),
+ m_sn(*this, "snsnd"),
+ m_vlm(*this, "vlm"),
+ m_gfxdecode(*this, "gfxdecode"),
+ m_screen(*this, "screen"),
+ m_palette(*this, "palette")
+ { }
+
+ void yiear(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_array<uint8_t, 2> m_spriteram;
+ required_shared_ptr<uint8_t> m_videoram;
+
+ // devices
+ required_device<cpu_device> m_maincpu;
+ required_device<trackfld_audio_device> m_audio;
+ required_device<sn76489a_device> m_sn;
+ required_device<vlm5030_device> m_vlm;
+ required_device<gfxdecode_device> m_gfxdecode;
+ required_device<screen_device> m_screen;
+ required_device<palette_device> m_palette;
+
+ // video-related
+ tilemap_t *m_bg_tilemap = nullptr;
+
+ uint8_t m_nmi_enable = 0;
+ uint8_t m_irq_enable = 0;
+
+ uint8_t m_sn76496_latch = 0;
+
+ void videoram_w(offs_t offset, uint8_t data);
+ void control_w(uint8_t data);
+ uint8_t speech_r();
+ void vlm5030_control_w(uint8_t data);
+ void konami_sn76496_latch_w(uint8_t data) { m_sn76496_latch = data; }
+ void konami_sn76496_w(uint8_t data) { m_sn->write(m_sn76496_latch); }
+ 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);
+ INTERRUPT_GEN_MEMBER(nmi_interrupt);
+ void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
+
+ void main_map(address_map &map);
+ void vlm_map(address_map &map);
+};
+
+
+// video
+
+/***************************************************************************
+
+ Convert the color PROMs into a more useable format.
+
+ Yie Ar Kung-Fu has one 32x8 palette PROM, 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 yiear_state::palette(palette_device &palette) const
+{
+ uint8_t const *color_prom = memregion("proms")->base();
+
+ for (int i = 0; i < palette.entries(); i++)
+ {
+ int bit0, bit1, bit2;
+
+ // red component
+ bit0 = BIT(*color_prom, 0);
+ bit1 = BIT(*color_prom, 1);
+ bit2 = BIT(*color_prom, 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ // green component
+ bit0 = BIT(*color_prom, 3);
+ bit1 = BIT(*color_prom, 4);
+ bit2 = BIT(*color_prom, 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ // blue component
+ bit0 = 0;
+ bit1 = BIT(*color_prom, 6);
+ bit2 = BIT(*color_prom, 7);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ palette.set_pen_color(i, rgb_t(r,g,b));
+ color_prom++;
+ }
+}
+
+void yiear_state::videoram_w(offs_t offset, uint8_t data)
+{
+ m_videoram[offset] = data;
+ m_bg_tilemap->mark_tile_dirty(offset / 2);
+}
+
+void yiear_state::control_w(uint8_t data)
+{
+ // bit 0 flips screen
+ if (flip_screen() != (data & 0x01))
+ {
+ flip_screen_set(data & 0x01);
+ machine().tilemap().mark_all_dirty();
+ }
+
+ // bit 1 is NMI enable
+ m_nmi_enable = data & 0x02;
+
+ // bit 2 is IRQ enable
+ m_irq_enable = data & 0x04;
+
+ // bits 3 and 4 are coin counters
+ machine().bookkeeping().coin_counter_w(0, data & 0x08);
+ machine().bookkeeping().coin_counter_w(1, data & 0x10);
+}
+
+TILE_GET_INFO_MEMBER(yiear_state::get_bg_tile_info)
+{
+ int const offs = tile_index * 2;
+ int const attr = m_videoram[offs];
+ int const code = m_videoram[offs + 1] | ((attr & 0x10) << 4);
+// int const color = (attr & 0xf0) >> 4;
+ int const flags = ((attr & 0x80) ? TILE_FLIPX : 0) | ((attr & 0x40) ? TILE_FLIPY : 0);
+
+ tileinfo.set(0, code, 0, flags);
+}
+
+void yiear_state::video_start()
+{
+ m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(yiear_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
+}
+
+void yiear_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ for (int offs = m_spriteram[0].bytes() - 2; offs >= 0; offs -= 2)
+ {
+ int const attr = m_spriteram[0][offs];
+ int const code = m_spriteram[1][offs + 1] + 256 * (attr & 0x01);
+ int const color = 0;
+ int const flipx = ~attr & 0x40;
+ int flipy = attr & 0x80;
+ int sy = 240 - m_spriteram[0][offs + 1];
+ int const sx = m_spriteram[1][offs];
+
+ if (flip_screen())
+ {
+ sy = 240 - sy;
+ flipy = !flipy;
+ }
+
+ if (offs < 0x26)
+ {
+ sy++; // fix title screen & garbage at the bottom of the screen
+ }
+
+
+ m_gfxdecode->gfx(1)->transpen(bitmap, cliprect,
+ code, color,
+ flipx, flipy,
+ sx, sy, 0);
+ }
+}
+
+uint32_t yiear_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
uint8_t yiear_state::speech_r()
{
@@ -115,9 +320,9 @@ uint8_t yiear_state::speech_r()
return 0;
}
-void yiear_state::VLM5030_control_w(uint8_t data)
+void yiear_state::vlm5030_control_w(uint8_t data)
{
- /* bit 0 is latch direction */
+ // bit 0 is latch direction
m_vlm->st((data >> 1) & 1);
m_vlm->rst((data >> 2) & 1);
}
@@ -140,9 +345,9 @@ void yiear_state::main_map(address_map &map)
{
map(0x0000, 0x0000).r(FUNC(yiear_state::speech_r));
map(0x4000, 0x4000).w(FUNC(yiear_state::control_w));
- map(0x4800, 0x4800).w(FUNC(yiear_state::konami_SN76496_latch_w));
- map(0x4900, 0x4900).w(FUNC(yiear_state::konami_SN76496_w));
- map(0x4a00, 0x4a00).w(FUNC(yiear_state::VLM5030_control_w));
+ map(0x4800, 0x4800).w(FUNC(yiear_state::konami_sn76496_latch_w));
+ map(0x4900, 0x4900).w(FUNC(yiear_state::konami_sn76496_w));
+ map(0x4a00, 0x4a00).w(FUNC(yiear_state::vlm5030_control_w));
map(0x4b00, 0x4b00).w(m_vlm, FUNC(vlm5030_device::data_w));
map(0x4c00, 0x4c00).portr("DSW2");
map(0x4d00, 0x4d00).portr("DSW3");
@@ -151,11 +356,11 @@ void yiear_state::main_map(address_map &map)
map(0x4e02, 0x4e02).portr("P2");
map(0x4e03, 0x4e03).portr("DSW1");
map(0x4f00, 0x4f00).w("watchdog", FUNC(watchdog_timer_device::reset_w));
- map(0x5000, 0x502f).ram().share("spriteram");
+ map(0x5000, 0x502f).ram().share(m_spriteram[0]);
map(0x5030, 0x53ff).ram();
- map(0x5400, 0x542f).ram().share("spriteram2");
+ map(0x5400, 0x542f).ram().share(m_spriteram[1]);
map(0x5430, 0x57ff).ram();
- map(0x5800, 0x5fff).ram().w(FUNC(yiear_state::videoram_w)).share("videoram");
+ map(0x5800, 0x5fff).ram().w(FUNC(yiear_state::videoram_w)).share(m_videoram);
map(0x8000, 0xffff).rom();
}
@@ -185,7 +390,7 @@ static INPUT_PORTS_START( yiear )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) /*WTF? PORT_CODE("NONE")*/
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) // WTF? PORT_CODE("NONE")
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("P2")
@@ -195,12 +400,12 @@ static INPUT_PORTS_START( yiear )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL /*WTF? PORT_CODE("NONE")*/
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL // *WTF? PORT_CODE("NONE")
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
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, 0x03, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:1,2")
@@ -263,8 +468,8 @@ static const gfx_layout spritelayout =
};
static GFXDECODE_START( gfx_yiear )
- GFXDECODE_ENTRY( "gfx1", 0, charlayout, 16, 1 )
- GFXDECODE_ENTRY( "gfx2", 0, spritelayout, 0, 1 )
+ GFXDECODE_ENTRY( "tiles", 0, charlayout, 16, 1 )
+ GFXDECODE_ENTRY( "sprites", 0, spritelayout, 0, 1 )
GFXDECODE_END
@@ -281,16 +486,16 @@ void yiear_state::machine_reset()
void yiear_state::yiear(machine_config &config)
{
- /* basic machine hardware */
- MC6809E(config, m_maincpu, XTAL(18'432'000)/12); /* verified on pcb */
+ // basic machine hardware
+ MC6809E(config, m_maincpu, XTAL(18'432'000)/12); // verified on PCB
m_maincpu->set_addrmap(AS_PROGRAM, &yiear_state::main_map);
- m_maincpu->set_periodic_int(FUNC(yiear_state::nmi_interrupt), attotime::from_hz(480)); /* music tempo (correct frequency unknown) */
+ m_maincpu->set_periodic_int(FUNC(yiear_state::nmi_interrupt), attotime::from_hz(480)); // music tempo (correct frequency unknown)
WATCHDOG_TIMER(config, "watchdog");
- /* video hardware */
+ // video hardware
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
- m_screen->set_refresh_hz(60.58); /* verified on pcb */
+ m_screen->set_refresh_hz(60.58); // verified on PCB
m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(0));
m_screen->set_size(32*8, 32*8);
m_screen->set_visarea(0*8, 32*8-1, 2*8, 30*8-1);
@@ -301,14 +506,14 @@ void yiear_state::yiear(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_yiear);
PALETTE(config, m_palette, FUNC(yiear_state::palette), 32);
- /* sound hardware */
+ // sound hardware
SPEAKER(config, "mono").front_center();
TRACKFLD_AUDIO(config, m_audio, 0, finder_base::DUMMY_TAG, m_vlm);
- SN76489A(config, m_sn, XTAL(18'432'000)/12).add_route(ALL_OUTPUTS, "mono", 1.0); /* verified on pcb */
+ SN76489A(config, m_sn, XTAL(18'432'000)/12).add_route(ALL_OUTPUTS, "mono", 1.0); // verified on PCB
- VLM5030(config, m_vlm, XTAL(3'579'545)); /* verified on pcb */
+ VLM5030(config, m_vlm, XTAL(3'579'545)); // verified on PCB
m_vlm->set_addrmap(0, &yiear_state::vlm_map);
m_vlm->add_route(ALL_OUTPUTS, "mono", 1.0);
}
@@ -325,45 +530,46 @@ ROM_START( yiear )
ROM_LOAD( "407_i08.10d", 0x08000, 0x4000, CRC(e2d7458b) SHA1(1b192130b5cd879ab686a21aa2b518c90edd89aa) )
ROM_LOAD( "407_i07.8d", 0x0c000, 0x4000, CRC(7db7442e) SHA1(d604a995a5505251904447ad697fc9e7f94bf241) )
- ROM_REGION( 0x04000, "gfx1", 0 )
- ROM_LOAD( "407_c01.6h", 0x00000, 0x2000, CRC(b68fd91d) SHA1(c267931d69794c292b7ebae5bc35ad842194683a) ) /* was listed as g16_1 */
- ROM_LOAD( "407_c02.7h", 0x02000, 0x2000, CRC(d9b167c6) SHA1(a2fd10bddfa4e95e9d49892737ace146209bfa2b) ) /* was listed as g15_2 */
+ ROM_REGION( 0x04000, "tiles", 0 )
+ ROM_LOAD( "407_c01.6h", 0x00000, 0x2000, CRC(b68fd91d) SHA1(c267931d69794c292b7ebae5bc35ad842194683a) ) // was listed as g16_1
+ ROM_LOAD( "407_c02.7h", 0x02000, 0x2000, CRC(d9b167c6) SHA1(a2fd10bddfa4e95e9d49892737ace146209bfa2b) ) // was listed as g15_2
- ROM_REGION( 0x10000, "gfx2", 0 )
- ROM_LOAD( "407_d05.16h", 0x00000, 0x4000, CRC(45109b29) SHA1(0794935b490497b21b99045c90231b7bac151d42) ) /* was listed as g04_5 */
- ROM_LOAD( "407_d06.17h", 0x04000, 0x4000, CRC(1d650790) SHA1(5f2a4983b20251c712358547a7c62c0331c6cb6f) ) /* was listed as g03_6 */
- ROM_LOAD( "407_d03.14h", 0x08000, 0x4000, CRC(e6aa945b) SHA1(c5757d16c28f5966fd04675c0c640ef9b6b76ca5) ) /* was listed as g06_3 */
- ROM_LOAD( "407_d04.15h", 0x0c000, 0x4000, CRC(cc187c22) SHA1(555ba18a9648681e5140b3fd84af16959ee5296d) ) /* was listed as g05_4 */
+ ROM_REGION( 0x10000, "sprites", 0 )
+ ROM_LOAD( "407_d05.16h", 0x00000, 0x4000, CRC(45109b29) SHA1(0794935b490497b21b99045c90231b7bac151d42) ) // was listed as g04_5
+ ROM_LOAD( "407_d06.17h", 0x04000, 0x4000, CRC(1d650790) SHA1(5f2a4983b20251c712358547a7c62c0331c6cb6f) ) // was listed as g03_6
+ ROM_LOAD( "407_d03.14h", 0x08000, 0x4000, CRC(e6aa945b) SHA1(c5757d16c28f5966fd04675c0c640ef9b6b76ca5) ) // was listed as g06_3
+ ROM_LOAD( "407_d04.15h", 0x0c000, 0x4000, CRC(cc187c22) SHA1(555ba18a9648681e5140b3fd84af16959ee5296d) ) // was listed as g05_4
ROM_REGION( 0x0020, "proms", 0 )
- ROM_LOAD( "407c10.1g", 0x00000, 0x0020, CRC(c283d71f) SHA1(10cd39f4e951ba6ca5610081c8c1fcd9d68b34d2) ) /* Color BPROM type is TBP18S030N or compatible */
+ ROM_LOAD( "407c10.1g", 0x00000, 0x0020, CRC(c283d71f) SHA1(10cd39f4e951ba6ca5610081c8c1fcd9d68b34d2) ) // Color BPROM type is TBP18S030N or compatible
- ROM_REGION( 0x2000, "vlm", 0 ) /* 8k for the VLM5030 data */
- ROM_LOAD( "407_c09.8b", 0x00000, 0x2000, CRC(f75a1539) SHA1(f139f6cb41351eb81ee47d777db03012aa5fadb1) ) /* was listed as a12_9 */
+ ROM_REGION( 0x2000, "vlm", 0 )
+ ROM_LOAD( "407_c09.8b", 0x00000, 0x2000, CRC(f75a1539) SHA1(f139f6cb41351eb81ee47d777db03012aa5fadb1) ) // was listed as a12_9
ROM_END
ROM_START( yiear2 )
ROM_REGION( 0x10000, "maincpu", 0 )
- ROM_LOAD( "407_g08.10d", 0x08000, 0x4000, CRC(49ecd9dd) SHA1(15692029351e87837cc5a251947ff315fd723aa4) ) /* was listed as d12_8 */
- ROM_LOAD( "407_g07.8d", 0x0c000, 0x4000, CRC(bc2e1208) SHA1(a5a0c78ff4e02bd7da3eab3842dfe99956e74155) ) /* was listed as d14_7 */
+ ROM_LOAD( "407_g08.10d", 0x08000, 0x4000, CRC(49ecd9dd) SHA1(15692029351e87837cc5a251947ff315fd723aa4) ) // was listed as d12_8
+ ROM_LOAD( "407_g07.8d", 0x0c000, 0x4000, CRC(bc2e1208) SHA1(a5a0c78ff4e02bd7da3eab3842dfe99956e74155) ) // was listed as d14_7
- ROM_REGION( 0x04000, "gfx1", 0 )
- ROM_LOAD( "407_c01.6h", 0x00000, 0x2000, CRC(b68fd91d) SHA1(c267931d69794c292b7ebae5bc35ad842194683a) ) /* was listed as g16_1 */
- ROM_LOAD( "407_c02.7h", 0x02000, 0x2000, CRC(d9b167c6) SHA1(a2fd10bddfa4e95e9d49892737ace146209bfa2b) ) /* was listed as g15_2 */
+ ROM_REGION( 0x04000, "tiles", 0 )
+ ROM_LOAD( "407_c01.6h", 0x00000, 0x2000, CRC(b68fd91d) SHA1(c267931d69794c292b7ebae5bc35ad842194683a) ) // was listed as g16_1
+ ROM_LOAD( "407_c02.7h", 0x02000, 0x2000, CRC(d9b167c6) SHA1(a2fd10bddfa4e95e9d49892737ace146209bfa2b) ) // was listed as g15_2
- ROM_REGION( 0x10000, "gfx2", 0 )
- ROM_LOAD( "407_d05.16h", 0x00000, 0x4000, CRC(45109b29) SHA1(0794935b490497b21b99045c90231b7bac151d42) ) /* was listed as g04_5 */
- ROM_LOAD( "407_d06.17h", 0x04000, 0x4000, CRC(1d650790) SHA1(5f2a4983b20251c712358547a7c62c0331c6cb6f) ) /* was listed as g03_6 */
- ROM_LOAD( "407_d03.14h", 0x08000, 0x4000, CRC(e6aa945b) SHA1(c5757d16c28f5966fd04675c0c640ef9b6b76ca5) ) /* was listed as g06_3 */
- ROM_LOAD( "407_d04.15h", 0x0c000, 0x4000, CRC(cc187c22) SHA1(555ba18a9648681e5140b3fd84af16959ee5296d) ) /* was listed as g05_4 */
+ ROM_REGION( 0x10000, "sprites", 0 )
+ ROM_LOAD( "407_d05.16h", 0x00000, 0x4000, CRC(45109b29) SHA1(0794935b490497b21b99045c90231b7bac151d42) ) // was listed as g04_5
+ ROM_LOAD( "407_d06.17h", 0x04000, 0x4000, CRC(1d650790) SHA1(5f2a4983b20251c712358547a7c62c0331c6cb6f) ) // was listed as g03_6
+ ROM_LOAD( "407_d03.14h", 0x08000, 0x4000, CRC(e6aa945b) SHA1(c5757d16c28f5966fd04675c0c640ef9b6b76ca5) ) // was listed as g06_3
+ ROM_LOAD( "407_d04.15h", 0x0c000, 0x4000, CRC(cc187c22) SHA1(555ba18a9648681e5140b3fd84af16959ee5296d) ) // was listed as g05_4
ROM_REGION( 0x0020, "proms", 0 )
- ROM_LOAD( "407c10.1g", 0x00000, 0x0020, CRC(c283d71f) SHA1(10cd39f4e951ba6ca5610081c8c1fcd9d68b34d2) ) /* Color BPROM type is TBP18S030N or compatible */
+ ROM_LOAD( "407c10.1g", 0x00000, 0x0020, CRC(c283d71f) SHA1(10cd39f4e951ba6ca5610081c8c1fcd9d68b34d2) ) // Color BPROM type is TBP18S030N or compatible
- ROM_REGION( 0x2000, "vlm", 0 ) /* 8k for the VLM5030 data */
- ROM_LOAD( "407_c09.8b", 0x00000, 0x2000, CRC(f75a1539) SHA1(f139f6cb41351eb81ee47d777db03012aa5fadb1) ) /* was listed as a12_9 */
+ ROM_REGION( 0x2000, "vlm", 0 )
+ ROM_LOAD( "407_c09.8b", 0x00000, 0x2000, CRC(f75a1539) SHA1(f139f6cb41351eb81ee47d777db03012aa5fadb1) ) // was listed as a12_9
ROM_END
+} // anonymous namespace
GAME( 1985, yiear, 0, yiear, yiear, yiear_state, empty_init, ROT0, "Konami", "Yie Ar Kung-Fu (program code I)", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/konami/yiear.h b/src/mame/konami/yiear.h
deleted file mode 100644
index ec69092325b..00000000000
--- a/src/mame/konami/yiear.h
+++ /dev/null
@@ -1,78 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Phil Stroffolino
-// thanks-to:Enrique Sanchez
-#ifndef MAME_INCLUDES_YIEAR_H
-#define MAME_INCLUDES_YIEAR_H
-
-#pragma once
-
-#include "trackfld_a.h"
-#include "sound/sn76496.h"
-#include "sound/vlm5030.h"
-
-#include "emupal.h"
-#include "screen.h"
-#include "tilemap.h"
-
-class yiear_state : public driver_device
-{
-public:
- yiear_state(const machine_config &mconfig, device_type type, const char *tag) :
- driver_device(mconfig, type, tag),
- m_spriteram(*this, "spriteram"),
- m_spriteram2(*this, "spriteram2"),
- m_videoram(*this, "videoram"),
- m_maincpu(*this, "maincpu"),
- m_audio(*this, "trackfld_audio"),
- m_sn(*this, "snsnd"),
- m_vlm(*this, "vlm"),
- m_gfxdecode(*this, "gfxdecode"),
- m_screen(*this, "screen"),
- m_palette(*this, "palette")
- { }
-
- void yiear(machine_config &config);
-
-private:
- /* memory pointers */
- required_shared_ptr<uint8_t> m_spriteram;
- required_shared_ptr<uint8_t> m_spriteram2;
- required_shared_ptr<uint8_t> m_videoram;
-
- /* devices */
- required_device<cpu_device> m_maincpu;
- required_device<trackfld_audio_device> m_audio;
- required_device<sn76489a_device> m_sn;
- required_device<vlm5030_device> m_vlm;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<screen_device> m_screen;
- required_device<palette_device> m_palette;
-
- /* video-related */
- tilemap_t *m_bg_tilemap = nullptr;
-
- uint8_t m_nmi_enable = 0;
- uint8_t m_irq_enable = 0;
- void videoram_w(offs_t offset, uint8_t data);
- void control_w(uint8_t data);
- uint8_t speech_r();
- void VLM5030_control_w(uint8_t data);
-
- uint8_t m_SN76496_latch = 0;
- void konami_SN76496_latch_w(uint8_t data) { m_SN76496_latch = data; }
- void konami_SN76496_w(uint8_t data) { m_sn->write(m_SN76496_latch); }
- TILE_GET_INFO_MEMBER(get_bg_tile_info);
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void video_start() override;
- 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);
- INTERRUPT_GEN_MEMBER(nmi_interrupt);
- void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
-
- void main_map(address_map &map);
- void vlm_map(address_map &map);
-};
-
-#endif // MAME_INCLUDES_YIEAR_H
diff --git a/src/mame/konami/yiear_v.cpp b/src/mame/konami/yiear_v.cpp
deleted file mode 100644
index 878fe49192b..00000000000
--- a/src/mame/konami/yiear_v.cpp
+++ /dev/null
@@ -1,143 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Phil Stroffolino
-// thanks-to:Enrique Sanchez
-/***************************************************************************
-
- yiear.cpp
-
- Functions to emulate the video hardware of the machine.
-
-***************************************************************************/
-
-#include "emu.h"
-#include "yiear.h"
-
-
-/***************************************************************************
-
- Convert the color PROMs into a more useable format.
-
- Yie Ar Kung-Fu has one 32x8 palette PROM, 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 yiear_state::palette(palette_device &palette) const
-{
- uint8_t const *color_prom = memregion("proms")->base();
-
- for (int i = 0; i < palette.entries(); i++)
- {
- int bit0, bit1, bit2;
-
- // red component
- bit0 = BIT(*color_prom, 0);
- bit1 = BIT(*color_prom, 1);
- bit2 = BIT(*color_prom, 2);
- int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- // green component
- bit0 = BIT(*color_prom, 3);
- bit1 = BIT(*color_prom, 4);
- bit2 = BIT(*color_prom, 5);
- int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- // blue component
- bit0 = 0;
- bit1 = BIT(*color_prom, 6);
- bit2 = BIT(*color_prom, 7);
- int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- palette.set_pen_color(i, rgb_t(r,g,b));
- color_prom++;
- }
-}
-
-void yiear_state::videoram_w(offs_t offset, uint8_t data)
-{
- m_videoram[offset] = data;
- m_bg_tilemap->mark_tile_dirty(offset / 2);
-}
-
-void yiear_state::control_w(uint8_t data)
-{
- /* bit 0 flips screen */
- if (flip_screen() != (data & 0x01))
- {
- flip_screen_set(data & 0x01);
- machine().tilemap().mark_all_dirty();
- }
-
- /* bit 1 is NMI enable */
- m_nmi_enable = data & 0x02;
-
- /* bit 2 is IRQ enable */
- m_irq_enable = data & 0x04;
-
- /* bits 3 and 4 are coin counters */
- machine().bookkeeping().coin_counter_w(0, data & 0x08);
- machine().bookkeeping().coin_counter_w(1, data & 0x10);
-}
-
-TILE_GET_INFO_MEMBER(yiear_state::get_bg_tile_info)
-{
- int offs = tile_index * 2;
- int attr = m_videoram[offs];
- int code = m_videoram[offs + 1] | ((attr & 0x10) << 4);
-// int color = (attr & 0xf0) >> 4;
- int flags = ((attr & 0x80) ? TILE_FLIPX : 0) | ((attr & 0x40) ? TILE_FLIPY : 0);
-
- tileinfo.set(0, code, 0, flags);
-}
-
-void yiear_state::video_start()
-{
- m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(yiear_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
-}
-
-void yiear_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
-{
- for (int offs = m_spriteram.bytes() - 2; offs >= 0; offs -= 2)
- {
- int attr = m_spriteram[offs];
- int code = m_spriteram2[offs + 1] + 256 * (attr & 0x01);
- int color = 0;
- int flipx = ~attr & 0x40;
- int flipy = attr & 0x80;
- int sy = 240 - m_spriteram[offs + 1];
- int sx = m_spriteram2[offs];
-
- if (flip_screen())
- {
- sy = 240 - sy;
- flipy = !flipy;
- }
-
- if (offs < 0x26)
- {
- sy++; /* fix title screen & garbage at the bottom of the screen */
- }
-
-
- m_gfxdecode->gfx(1)->transpen(bitmap,cliprect,
- code, color,
- flipx, flipy,
- sx, sy, 0);
- }
-}
-
-uint32_t yiear_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;
-}