summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Ivan Vangelista <mesgnet@yahoo.it>2022-10-04 18:08:04 +0200
committer Ivan Vangelista <mesgnet@yahoo.it>2022-10-04 18:08:04 +0200
commite0cd6b82528c652fe7c2ef8e0eb600bb4def6f1c (patch)
treef804b7bc40a0b9d83c59156279a34d6722eb239d /src
parent49d421177c5d64f08428457cf4d3c5d271439eb4 (diff)
- irem/m119.cpp, sega/winclub.cpp: corrected copy paste errors / typos
- konami/mainevt.cpp, konami/mikie.cpp, konami/pandoras.cpp, konami/pingpong.cpp, konami/pooyan.cpp, konami/sbasketb.cpp, konami/tp84.cpp: consolidated drivers in single files, minor cleanups
Diffstat (limited to 'src')
-rw-r--r--src/mame/irem/m119.cpp2
-rw-r--r--src/mame/konami/mainevt.cpp533
-rw-r--r--src/mame/konami/mainevt.h84
-rw-r--r--src/mame/konami/mainevt_v.cpp100
-rw-r--r--src/mame/konami/mikie.cpp321
-rw-r--r--src/mame/konami/mikie.h70
-rw-r--r--src/mame/konami/mikie_v.cpp168
-rw-r--r--src/mame/konami/pandoras.cpp416
-rw-r--r--src/mame/konami/pandoras.h87
-rw-r--r--src/mame/konami/pandoras_v.cpp173
-rw-r--r--src/mame/konami/pingpong.cpp451
-rw-r--r--src/mame/konami/pingpong.h59
-rw-r--r--src/mame/konami/pingpong_v.cpp147
-rw-r--r--src/mame/konami/pooyan.cpp321
-rw-r--r--src/mame/konami/pooyan.h65
-rw-r--r--src/mame/konami/pooyan_v.cpp189
-rw-r--r--src/mame/konami/sbasketb.cpp452
-rw-r--r--src/mame/konami/sbasketb.h90
-rw-r--r--src/mame/konami/sbasketb_v.cpp178
-rw-r--r--src/mame/konami/tp84.cpp492
-rw-r--r--src/mame/konami/tp84.h88
-rw-r--r--src/mame/konami/tp84_v.cpp200
-rw-r--r--src/mame/sega/winclub.cpp4
23 files changed, 2299 insertions, 2391 deletions
diff --git a/src/mame/irem/m119.cpp b/src/mame/irem/m119.cpp
index 9edccd52959..27e09e9d834 100644
--- a/src/mame/irem/m119.cpp
+++ b/src/mame/irem/m119.cpp
@@ -117,7 +117,7 @@ ROM_START( scumimon )
ROM_LOAD16_BYTE( "scu1.b-c1.ic2", 0x000001, 0x200000, CRC(adff81ba) SHA1(a176b9ab5b2f47abb89e817699d742dbf876a4c7) )
ROM_REGION(0x200000, "ymz", 0)
- ROM_LOAD( "scu1.a-pr00-c.ic43", 0x000000, 0x100000, CRC(819e4bbd) SHA1(e0ca76a7b97b05bbffdb96866a8bdd460fc589b2) ) // FIXED BITS (xxxxxxxxxxxxx1xx)
+ ROM_LOAD( "scu1.a-v0-.ic35", 0x000000, 0x100000, CRC(819e4bbd) SHA1(e0ca76a7b97b05bbffdb96866a8bdd460fc589b2) ) // FIXED BITS (xxxxxxxxxxxxx1xx)
// TODO: 2x PLDs once identified
ROM_END
diff --git a/src/mame/konami/mainevt.cpp b/src/mame/konami/mainevt.cpp
index 2c314d8a2b9..c2e600b6630 100644
--- a/src/mame/konami/mainevt.cpp
+++ b/src/mame/konami/mainevt.cpp
@@ -2,8 +2,8 @@
// copyright-holders:Bryan McPhail
/***************************************************************************
- The Main Event, (c) 1988 Konami
- Devastators, (c) 1988 Konami
+ The Main Event, (c) 1988 Konami (GX799)
+ Devastators, (c) 1988 Konami (GX890)
Emulation by Bryan McPhail, mish@tendril.co.uk
@@ -17,7 +17,7 @@ Notes:
- Devastators: sprite zooming for the planes in level 2 is particularly bad.
- Devastators: title screen white backdrop is always supposed to flicker,
- it currently do that only from second/fourth attract cycles (supposed to always
+ it currently does that only from second/fourth attract cycles (supposed to always
flicker from PCB video);
Both games run on Konami's PWB351024A PCB
@@ -27,48 +27,259 @@ Both games run on Konami's PWB351024A PCB
***************************************************************************/
#include "emu.h"
-#include "mainevt.h"
+
+#include "k051733.h"
+#include "k051960.h"
+#include "k052109.h"
+#include "konami_helper.h"
#include "konamipt.h"
-#include "cpu/z80/z80.h"
#include "cpu/m6809/hd6309.h"
#include "cpu/m6809/m6809.h"
+#include "cpu/z80/z80.h"
#include "machine/gen_latch.h"
+#include "sound/k007232.h"
+#include "sound/upd7759.h"
#include "sound/ymopm.h"
+
#include "emupal.h"
#include "screen.h"
#include "speaker.h"
-void mainevt_state::dv_nmienable_w(uint8_t data)
+// configurable logging
+#define LOG_SHBANK (1U << 1)
+
+//#define VERBOSE (LOG_GENERAL | LOG_SHBANK)
+
+#include "logmacro.h"
+
+#define LOGSHBANK(...) LOGMASKED(LOG_SHBANK, __VA_ARGS__)
+
+
+namespace {
+
+class base_state : public driver_device
+{
+public:
+ base_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_k007232(*this, "k007232")
+ , m_k052109(*this, "k052109")
+ , m_k051960(*this, "k051960")
+ , m_rombank(*this, "rombank")
+ , m_leds(*this, "led%u", 0U)
+ { }
+
+ void devstors(machine_config &config);
+ void mainevt(machine_config &config);
+
+protected:
+ virtual void machine_start() override;
+
+ // devices
+ required_device<cpu_device> m_maincpu;
+ required_device<cpu_device> m_audiocpu;
+ required_device<k007232_device> m_k007232;
+ required_device<k052109_device> m_k052109;
+ required_device<k051960_device> m_k051960;
+
+ required_memory_bank m_rombank;
+ output_finder<4> m_leds;
+
+ // misc
+ uint8_t m_sound_irq_mask = 0;
+
+ void bankswitch_w(uint8_t data);
+ void coin_w(uint8_t data);
+ void sh_irqtrigger_w(uint8_t data);
+ uint8_t k052109_051960_r(offs_t offset);
+ void k052109_051960_w(offs_t offset, uint8_t data);
+ void volume_callback(uint8_t data);
+};
+
+class mainevt_state : public base_state
+{
+public:
+ mainevt_state(const machine_config &mconfig, device_type type, const char *tag)
+ : base_state(mconfig, type, tag)
+ , m_upd7759(*this, "upd")
+ { }
+
+ void mainevt(machine_config &config);
+
+private:
+ // devices
+ required_device<upd7759_device> m_upd7759;
+
+ void sh_irqcontrol_w(uint8_t data);
+ void sh_bankswitch_w(uint8_t data);
+ uint8_t sh_busy_r();
+ INTERRUPT_GEN_MEMBER(sound_timer_irq);
+
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ K052109_CB_MEMBER(tile_callback);
+ K051960_CB_MEMBER(sprite_callback);
+
+ void main_map(address_map &map);
+ void sound_map(address_map &map);
+};
+
+class devstors_state : public base_state
+{
+public:
+ devstors_state(const machine_config &mconfig, device_type type, const char *tag)
+ : base_state(mconfig, type, tag)
+ { }
+
+ void devstors(machine_config &config);
+
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
+private:
+ // misc
+ uint8_t m_nmi_enable = 0;
+
+ void nmienable_w(uint8_t data);
+ void sh_irqcontrol_w(uint8_t data);
+ void sh_bankswitch_w(uint8_t data);
+ INTERRUPT_GEN_MEMBER(sound_timer_irq);
+
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ DECLARE_WRITE_LINE_MEMBER(vblank_w);
+ K052109_CB_MEMBER(tile_callback);
+ K051960_CB_MEMBER(sprite_callback);
+
+ void main_map(address_map &map);
+ void sound_map(address_map &map);
+};
+
+
+// video
+
+/***************************************************************************
+
+ Callbacks for the K052109
+
+***************************************************************************/
+
+K052109_CB_MEMBER(mainevt_state::tile_callback)
+{
+ static const int layer_colorbase[] = { 0 / 16, 128 / 16, 64 / 16 };
+
+ *flags = (*color & 0x02) ? TILE_FLIPX : 0;
+
+ // priority relative to HALF priority sprites
+ *priority = (layer == 2) ? (*color & 0x20) >> 5 : 0;
+ *code |= ((*color & 0x01) << 8) | ((*color & 0x1c) << 7);
+ *color = layer_colorbase[layer] + ((*color & 0xc0) >> 6);
+}
+
+K052109_CB_MEMBER(devstors_state::tile_callback)
+{
+ static const int layer_colorbase[] = { 0 / 16, 0 / 16, 64 / 16 };
+
+ // (color & 0x02) is flip y handled internally by the 052109
+ *code |= ((*color & 0x01) << 8) | ((*color & 0x3c) << 7);
+ *color = layer_colorbase[layer] + ((*color & 0xc0) >> 6);
+}
+
+
+/***************************************************************************
+
+ Callbacks for the K051960
+
+***************************************************************************/
+
+K051960_CB_MEMBER(mainevt_state::sprite_callback)
+{
+ enum { sprite_colorbase = 192 / 16 };
+
+ // bit 5 = priority over layer B (has precedence)
+ // bit 6 = HALF priority over layer B (used for crowd when you get out of the ring)
+ if (*color & 0x20)
+ *priority = 0xff00;
+ else if (*color & 0x40)
+ *priority = 0xff00 | 0xf0f0;
+ else
+ *priority = 0xff00 | 0xf0f0 | 0xcccc;
+ // bit 7 is shadow, not used
+
+ *color = sprite_colorbase + (*color & 0x03);
+}
+
+K051960_CB_MEMBER(devstors_state::sprite_callback)
+{
+ enum { sprite_colorbase = 128 / 16 };
+
+ // TODO: the priority/shadow handling (bits 5-7) seems to be quite complex (see PROM)
+ *color = sprite_colorbase + (*color & 0x07);
+}
+
+
+/*****************************************************************************/
+
+uint32_t mainevt_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ m_k052109->tilemap_update();
+
+ screen.priority().fill(0, cliprect);
+ m_k052109->tilemap_draw(screen, bitmap, cliprect, 1, TILEMAP_DRAW_OPAQUE, 1);
+ m_k052109->tilemap_draw(screen, bitmap, cliprect, 2, 1, 2); // low priority part of layer
+ m_k052109->tilemap_draw(screen, bitmap, cliprect, 2, 0, 4); // high priority part of layer
+ m_k052109->tilemap_draw(screen, bitmap, cliprect, 0, 0, 8);
+
+ m_k051960->k051960_sprites_draw(bitmap, cliprect, screen.priority(), -1, -1);
+ return 0;
+}
+
+uint32_t devstors_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ m_k052109->tilemap_update();
+
+ m_k052109->tilemap_draw(screen, bitmap, cliprect, 1, TILEMAP_DRAW_OPAQUE, 0);
+ m_k052109->tilemap_draw(screen, bitmap, cliprect, 2, 0, 0);
+ m_k051960->k051960_sprites_draw(bitmap, cliprect, screen.priority(), 0, 0);
+ m_k052109->tilemap_draw(screen, bitmap, cliprect, 0, 0, 0);
+ return 0;
+}
+
+
+// machine
+
+void devstors_state::nmienable_w(uint8_t data)
{
m_nmi_enable = data;
}
-WRITE_LINE_MEMBER(mainevt_state::dv_vblank_w)
+WRITE_LINE_MEMBER(devstors_state::vblank_w)
{
if (state && m_nmi_enable)
m_maincpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero);
}
-void mainevt_state::mainevt_bankswitch_w(uint8_t data)
+void base_state::bankswitch_w(uint8_t data)
{
- /* bit 0-1 ROM bank select */
+ // bit 0-1 ROM bank select
m_rombank->set_entry(data & 0x03);
- /* TODO: bit 5 = select work RAM or palette? */
+ // TODO: bit 5 = select work RAM or palette?
//palette_selected = data & 0x20;
- /* bit 6 = enable char ROM reading through the video RAM */
+ // bit 6 = enable char ROM reading through the video RAM
m_k052109->set_rmrd_line((data & 0x40) ? ASSERT_LINE : CLEAR_LINE);
- /* bit 7 = NINITSET (unknown) */
+ // bit 7 = NINITSET (unknown)
- /* other bits unused */
+ // other bits unused
}
-void mainevt_state::mainevt_coin_w(uint8_t data)
+void base_state::coin_w(uint8_t data)
{
machine().bookkeeping().coin_counter_w(0, data & 0x10);
machine().bookkeeping().coin_counter_w(1, data & 0x20);
@@ -78,17 +289,17 @@ void mainevt_state::mainevt_coin_w(uint8_t data)
m_leds[3] = BIT(data, 3);
}
-void mainevt_state::mainevt_sh_irqtrigger_w(uint8_t data)
+void base_state::sh_irqtrigger_w(uint8_t data)
{
m_audiocpu->set_input_line_and_vector(0, HOLD_LINE, 0xff); // Z80
}
-uint8_t mainevt_state::mainevt_sh_busy_r()
+uint8_t mainevt_state::sh_busy_r()
{
return m_upd7759->busy_r();
}
-void mainevt_state::mainevt_sh_irqcontrol_w(uint8_t data)
+void mainevt_state::sh_irqcontrol_w(uint8_t data)
{
m_upd7759->reset_w(data & 2);
m_upd7759->start_w(data & 1);
@@ -96,39 +307,35 @@ void mainevt_state::mainevt_sh_irqcontrol_w(uint8_t data)
m_sound_irq_mask = data & 4;
}
-void mainevt_state::devstor_sh_irqcontrol_w(uint8_t data)
+void devstors_state::sh_irqcontrol_w(uint8_t data)
{
m_sound_irq_mask = data & 4;
}
-void mainevt_state::mainevt_sh_bankswitch_w(uint8_t data)
+void mainevt_state::sh_bankswitch_w(uint8_t data)
{
- int bank_A, bank_B;
-
-//logerror("CPU #1 PC: %04x bank switch = %02x\n", m_audiocpu->pc(),data);
+ LOGSHBANK("CPU #1 PC: %04x bank switch = %02x\n", m_audiocpu->pc(), data);
- /* bits 0-3 select the 007232 banks */
- bank_A = (data & 0x3);
- bank_B = ((data >> 2) & 0x3);
- m_k007232->set_bank(bank_A, bank_B);
+ // bits 0-3 select the 007232 banks
+ int const bank_a = (data & 0x3);
+ int const bank_b = ((data >> 2) & 0x3);
+ m_k007232->set_bank(bank_a, bank_b);
- /* bits 4-5 select the UPD7759 bank */
+ // bits 4-5 select the UPD7759 bank
m_upd7759->set_rom_bank((data >> 4) & 0x03);
}
-void mainevt_state::dv_sh_bankswitch_w(uint8_t data)
+void devstors_state::sh_bankswitch_w(uint8_t data)
{
- int bank_A, bank_B;
-
-//logerror("CPU #1 PC: %04x bank switch = %02x\n",m_audiocpu->pc(),data);
+ LOGSHBANK("CPU #1 PC: %04x bank switch = %02x\n", m_audiocpu->pc(), data);
- /* bits 0-3 select the 007232 banks */
- bank_A = (data & 0x3);
- bank_B = ((data >> 2) & 0x3);
- m_k007232->set_bank(bank_A, bank_B);
+ // bits 0-3 select the 007232 banks
+ int const bank_a = (data & 0x3);
+ int const bank_b = ((data >> 2) & 0x3);
+ m_k007232->set_bank(bank_a, bank_b);
}
-uint8_t mainevt_state::k052109_051960_r(offs_t offset)
+uint8_t base_state::k052109_051960_r(offs_t offset)
{
if (m_k052109->get_rmrd_line() == CLEAR_LINE)
{
@@ -143,7 +350,7 @@ uint8_t mainevt_state::k052109_051960_r(offs_t offset)
return m_k052109->read(offset);
}
-void mainevt_state::k052109_051960_w(offs_t offset, uint8_t data)
+void base_state::k052109_051960_w(offs_t offset, uint8_t data)
{
if (offset >= 0x3800 && offset < 0x3808)
m_k051960->k051937_w(offset - 0x3800, data);
@@ -154,15 +361,15 @@ void mainevt_state::k052109_051960_w(offs_t offset, uint8_t data)
}
-void mainevt_state::mainevt_map(address_map &map)
+void mainevt_state::main_map(address_map &map)
{
map(0x0000, 0x3fff).rw(FUNC(mainevt_state::k052109_051960_r), FUNC(mainevt_state::k052109_051960_w));
- map(0x1f80, 0x1f80).w(FUNC(mainevt_state::mainevt_bankswitch_w));
- map(0x1f84, 0x1f84).w("soundlatch", FUNC(generic_latch_8_device::write)); /* probably */
- map(0x1f88, 0x1f88).w(FUNC(mainevt_state::mainevt_sh_irqtrigger_w)); /* probably */
- map(0x1f8c, 0x1f8d).nopw(); /* ??? */
- map(0x1f90, 0x1f90).w(FUNC(mainevt_state::mainevt_coin_w)); /* coin counters + lamps */
+ map(0x1f80, 0x1f80).w(FUNC(mainevt_state::bankswitch_w));
+ map(0x1f84, 0x1f84).w("soundlatch", FUNC(generic_latch_8_device::write)); // probably
+ map(0x1f88, 0x1f88).w(FUNC(mainevt_state::sh_irqtrigger_w)); // probably
+ map(0x1f8c, 0x1f8d).nopw(); // ???
+ map(0x1f90, 0x1f90).w(FUNC(mainevt_state::coin_w)); // coin counters + lamps
map(0x1f94, 0x1f94).portr("SYSTEM");
map(0x1f95, 0x1f95).portr("P1");
@@ -175,19 +382,19 @@ void mainevt_state::mainevt_map(address_map &map)
map(0x4000, 0x5dff).ram();
map(0x5e00, 0x5fff).ram().w("palette", FUNC(palette_device::write8)).share("palette");
- map(0x6000, 0x7fff).bankr("rombank");
+ map(0x6000, 0x7fff).bankr(m_rombank);
map(0x8000, 0xffff).rom();
}
-void mainevt_state::devstors_map(address_map &map)
+void devstors_state::main_map(address_map &map)
{
- map(0x0000, 0x3fff).rw(FUNC(mainevt_state::k052109_051960_r), FUNC(mainevt_state::k052109_051960_w));
+ map(0x0000, 0x3fff).rw(FUNC(devstors_state::k052109_051960_r), FUNC(devstors_state::k052109_051960_w));
- map(0x1f80, 0x1f80).w(FUNC(mainevt_state::mainevt_bankswitch_w));
- map(0x1f84, 0x1f84).w("soundlatch", FUNC(generic_latch_8_device::write)); /* probably */
- map(0x1f88, 0x1f88).w(FUNC(mainevt_state::mainevt_sh_irqtrigger_w)); /* probably */
- map(0x1f90, 0x1f90).w(FUNC(mainevt_state::mainevt_coin_w)); /* coin counters + lamps */
+ map(0x1f80, 0x1f80).w(FUNC(devstors_state::bankswitch_w));
+ map(0x1f84, 0x1f84).w("soundlatch", FUNC(generic_latch_8_device::write)); // probably
+ map(0x1f88, 0x1f88).w(FUNC(devstors_state::sh_irqtrigger_w)); // probably
+ map(0x1f90, 0x1f90).w(FUNC(devstors_state::coin_w)); // coin counters + lamps
map(0x1f94, 0x1f94).portr("SYSTEM");
map(0x1f95, 0x1f95).portr("P1");
@@ -196,36 +403,36 @@ void mainevt_state::devstors_map(address_map &map)
map(0x1f98, 0x1f98).portr("DSW3");
map(0x1f9b, 0x1f9b).portr("DSW2");
map(0x1fa0, 0x1fbf).rw("k051733", FUNC(k051733_device::read), FUNC(k051733_device::write));
- map(0x1fb2, 0x1fb2).w(FUNC(mainevt_state::dv_nmienable_w));
+ map(0x1fb2, 0x1fb2).w(FUNC(devstors_state::nmienable_w));
map(0x4000, 0x5dff).ram();
map(0x5e00, 0x5fff).ram().w("palette", FUNC(palette_device::write8)).share("palette");
- map(0x6000, 0x7fff).bankr("rombank");
+ map(0x6000, 0x7fff).bankr(m_rombank);
map(0x8000, 0xffff).rom();
}
-void mainevt_state::mainevt_sound_map(address_map &map)
+void mainevt_state::sound_map(address_map &map)
{
map(0x0000, 0x7fff).rom();
map(0x8000, 0x83ff).ram();
map(0x9000, 0x9000).w(m_upd7759, FUNC(upd7759_device::port_w));
map(0xa000, 0xa000).r("soundlatch", FUNC(generic_latch_8_device::read));
map(0xb000, 0xb00d).rw(m_k007232, FUNC(k007232_device::read), FUNC(k007232_device::write));
- map(0xd000, 0xd000).r(FUNC(mainevt_state::mainevt_sh_busy_r));
- map(0xe000, 0xe000).w(FUNC(mainevt_state::mainevt_sh_irqcontrol_w));
- map(0xf000, 0xf000).w(FUNC(mainevt_state::mainevt_sh_bankswitch_w));
+ map(0xd000, 0xd000).r(FUNC(mainevt_state::sh_busy_r));
+ map(0xe000, 0xe000).w(FUNC(mainevt_state::sh_irqcontrol_w));
+ map(0xf000, 0xf000).w(FUNC(mainevt_state::sh_bankswitch_w));
}
-void mainevt_state::devstors_sound_map(address_map &map)
+void devstors_state::sound_map(address_map &map)
{
map(0x0000, 0x7fff).rom();
map(0x8000, 0x83ff).ram();
map(0xa000, 0xa000).r("soundlatch", FUNC(generic_latch_8_device::read));
map(0xb000, 0xb00d).rw(m_k007232, FUNC(k007232_device::read), FUNC(k007232_device::write));
map(0xc000, 0xc001).rw("ymsnd", FUNC(ym2151_device::read), FUNC(ym2151_device::write));
- map(0xe000, 0xe000).w(FUNC(mainevt_state::devstor_sh_irqcontrol_w));
- map(0xf000, 0xf000).w(FUNC(mainevt_state::dv_sh_bankswitch_w));
+ map(0xe000, 0xe000).w(FUNC(devstors_state::sh_irqcontrol_w));
+ map(0xf000, 0xf000).w(FUNC(devstors_state::sh_bankswitch_w));
}
@@ -272,15 +479,15 @@ static INPUT_PORTS_START( mainevt )
PORT_DIPSETTING( 0x0b, DEF_STR( 1C_5C ) )
PORT_DIPSETTING( 0x0a, DEF_STR( 1C_6C ) )
PORT_DIPSETTING( 0x09, DEF_STR( 1C_7C ) )
- PORT_DIPUNUSED_DIPLOC( 0x10, 0x10, "SW1:5" ) /* Listed as "Unused" */
- PORT_DIPUNUSED_DIPLOC( 0x20, 0x20, "SW1:6" ) /* Listed as "Unused" */
- PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "SW1:7" ) /* Listed as "Unused" */
- PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW1:8" ) /* Listed as "Unused" */
+ PORT_DIPUNUSED_DIPLOC( 0x10, 0x10, "SW1:5" ) // Listed as "Unused"
+ PORT_DIPUNUSED_DIPLOC( 0x20, 0x20, "SW1:6" ) // Listed as "Unused"
+ PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "SW1:7" ) // Listed as "Unused"
+ PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW1:8" ) // Listed as "Unused"
PORT_START("DSW2")
- PORT_DIPUNUSED_DIPLOC( 0x01, 0x01, "SW2:1" ) /* Listed as "Unused" */
- PORT_DIPUNUSED_DIPLOC( 0x02, 0x02, "SW2:2" ) /* Listed as "Unused" */
- PORT_DIPUNUSED_DIPLOC( 0x04, 0x04, "SW2:3" ) /* Listed as "Unused" */
+ PORT_DIPUNUSED_DIPLOC( 0x01, 0x01, "SW2:1" ) // Listed as "Unused"
+ PORT_DIPUNUSED_DIPLOC( 0x02, 0x02, "SW2:2" ) // Listed as "Unused"
+ PORT_DIPUNUSED_DIPLOC( 0x04, 0x04, "SW2:3" ) // Listed as "Unused"
PORT_DIPNAME( 0x18, 0x10, "Bonus Energy" ) PORT_DIPLOCATION("SW2:4,5") // Typo on US manual "SW2:1,2"
PORT_DIPSETTING( 0x00, "60" )
PORT_DIPSETTING( 0x08, "70" )
@@ -299,9 +506,9 @@ static INPUT_PORTS_START( mainevt )
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_DIPUNUSED_DIPLOC( 0x02, 0x02, "SW3:2" ) /* Listed as "Unused" */
+ PORT_DIPUNUSED_DIPLOC( 0x02, 0x02, "SW3:2" ) // Listed as "Unused"
PORT_SERVICE_DIPLOC( 0x04, IP_ACTIVE_LOW, "SW3:3" )
- PORT_DIPUNUSED_DIPLOC( 0x08, 0x08, "SW3:4" ) /* Listed as "Unused" */
+ PORT_DIPUNUSED_DIPLOC( 0x08, 0x08, "SW3:4" ) // Listed as "Unused"
PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
INPUT_PORTS_END
@@ -309,7 +516,7 @@ static INPUT_PORTS_START( mainev2p )
PORT_INCLUDE( mainevt )
PORT_MODIFY("SYSTEM")
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* no keys for P3 & P4 */
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) // no keys for P3 & P4
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
@@ -336,13 +543,13 @@ static INPUT_PORTS_START( devstors )
PORT_INCLUDE( mainev2p )
PORT_MODIFY("SYSTEM")
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* no service2 */
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) // no service2
PORT_MODIFY("P1")
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* no 3rd button */
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) // no 3rd button
PORT_MODIFY("P2")
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* no 3rd button */
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) // no 3rd button
PORT_MODIFY("P3")
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
@@ -350,9 +557,9 @@ static INPUT_PORTS_START( devstors )
PORT_MODIFY("P4")
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
- PORT_MODIFY("DSW1") /* like mainevt, but different 0x00 settings */
+ PORT_MODIFY("DSW1") // like mainevt, but different 0x00 settings
KONAMI_COINAGE_LOC(DEF_STR( Free_Play ), "Invalid", SW1)
- /* "Invalid" = both coin slots disabled */
+ // "Invalid" = both coin slots disabled
PORT_MODIFY("DSW2")
PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:1,2")
@@ -360,7 +567,7 @@ static INPUT_PORTS_START( devstors )
PORT_DIPSETTING( 0x02, "3" ) // factory default
PORT_DIPSETTING( 0x01, "5" )
PORT_DIPSETTING( 0x00, "7" )
- PORT_DIPUNUSED_DIPLOC( 0x04, 0x04, "SW2:3" ) /* Listed as "Unused" */
+ PORT_DIPUNUSED_DIPLOC( 0x04, 0x04, "SW2:3" ) // Listed as "Unused"
PORT_DIPNAME( 0x18, 0x10, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW2:4,5")
PORT_DIPSETTING( 0x18, "150 and every 200" )
PORT_DIPSETTING( 0x10, "150 and every 250" ) // factory default
@@ -368,7 +575,7 @@ static INPUT_PORTS_START( devstors )
PORT_DIPSETTING( 0x00, "200 Only" )
INPUT_PORTS_END
-/* Same as 'devstors', but additional "Cocktail" Dip Switch (even if I don't see the use) */
+// Same as 'devstors', but additional "Cocktail" Dip Switch (even if I don't see the use)
static INPUT_PORTS_START( devstors_ct )
PORT_INCLUDE( devstors )
@@ -380,55 +587,62 @@ INPUT_PORTS_END
/*****************************************************************************/
-void mainevt_state::volume_callback(uint8_t data)
+void base_state::volume_callback(uint8_t data)
{
m_k007232->set_volume(0, (data >> 4) * 0x11, 0);
m_k007232->set_volume(1, 0, (data & 0x0f) * 0x11);
}
-void mainevt_state::machine_start()
+void base_state::machine_start()
{
m_leds.resolve();
m_rombank->configure_entries(0, 4, memregion("maincpu")->base(), 0x2000);
+ save_item(NAME(m_sound_irq_mask));
+}
+
+void devstors_state::machine_start()
+{
+ base_state::machine_start();
+
save_item(NAME(m_nmi_enable));
}
-void mainevt_state::machine_reset()
+void devstors_state::machine_reset()
{
m_nmi_enable = 0;
}
-INTERRUPT_GEN_MEMBER(mainevt_state::mainevt_sound_timer_irq)
+INTERRUPT_GEN_MEMBER(mainevt_state::sound_timer_irq)
{
- if(m_sound_irq_mask)
+ if (m_sound_irq_mask)
m_audiocpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero);
}
-INTERRUPT_GEN_MEMBER(mainevt_state::devstors_sound_timer_irq)
+INTERRUPT_GEN_MEMBER(devstors_state::sound_timer_irq)
{
- if(m_sound_irq_mask)
+ if (m_sound_irq_mask)
m_audiocpu->set_input_line(0, HOLD_LINE);
}
void mainevt_state::mainevt(machine_config &config)
{
- /* basic machine hardware */
+ // basic machine hardware
HD6309E(config, m_maincpu, 24_MHz_XTAL / 8); // E & Q generated by 052109
- m_maincpu->set_addrmap(AS_PROGRAM, &mainevt_state::mainevt_map);
+ m_maincpu->set_addrmap(AS_PROGRAM, &mainevt_state::main_map);
Z80(config, m_audiocpu, 3.579545_MHz_XTAL); /* 3.579545 MHz */
- m_audiocpu->set_addrmap(AS_PROGRAM, &mainevt_state::mainevt_sound_map);
- m_audiocpu->set_periodic_int(FUNC(mainevt_state::mainevt_sound_timer_irq), attotime::from_hz(8*60)); /* ??? */
+ m_audiocpu->set_addrmap(AS_PROGRAM, &mainevt_state::sound_map);
+ m_audiocpu->set_periodic_int(FUNC(mainevt_state::sound_timer_irq), attotime::from_hz(8 * 60)); // ???
- /* 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(64*8, 32*8);
// screen.set_visarea(14*8, (64-14)*8-1, 2*8, 30*8-1);
- screen.set_raw(XTAL(24'000'000)/3, 528, 14*8, (64-14)*8, 256, 16, 240); // same hardware as Devastators so assume 59.17
- screen.set_screen_update(FUNC(mainevt_state::screen_update_mainevt));
+ screen.set_raw(XTAL(24'000'000) / 3, 528, 14 * 8, (64 - 14) * 8, 256, 16, 240); // same hardware as Devastators so assume 59.17
+ screen.set_screen_update(FUNC(mainevt_state::screen_update));
screen.set_palette("palette");
PALETTE(config, "palette").set_format(palette_device::xBGR_555, 256).enable_shadows();
@@ -436,15 +650,15 @@ void mainevt_state::mainevt(machine_config &config)
K052109(config, m_k052109, 24_MHz_XTAL);
m_k052109->set_palette("palette");
m_k052109->set_screen("screen");
- m_k052109->set_tile_callback(FUNC(mainevt_state::mainevt_tile_callback));
+ m_k052109->set_tile_callback(FUNC(mainevt_state::tile_callback));
m_k052109->irq_handler().set_inputline(m_maincpu, M6809_IRQ_LINE);
K051960(config, m_k051960, 24_MHz_XTAL);
m_k051960->set_palette("palette");
m_k051960->set_screen("screen");
- m_k051960->set_sprite_callback(FUNC(mainevt_state::mainevt_sprite_callback));
+ m_k051960->set_sprite_callback(FUNC(mainevt_state::sprite_callback));
- /* sound hardware */
+ // sound hardware
SPEAKER(config, "mono").front_center();
GENERIC_LATCH_8(config, "soundlatch");
@@ -459,43 +673,43 @@ void mainevt_state::mainevt(machine_config &config)
}
-void mainevt_state::devstors(machine_config &config)
+void devstors_state::devstors(machine_config &config)
{
- /* basic machine hardware */
+ // basic machine hardware
HD6309E(config, m_maincpu, 24_MHz_XTAL / 8); // E & Q generated by 052109
- m_maincpu->set_addrmap(AS_PROGRAM, &mainevt_state::devstors_map);
+ m_maincpu->set_addrmap(AS_PROGRAM, &devstors_state::main_map);
Z80(config, m_audiocpu, 3.579545_MHz_XTAL);
- m_audiocpu->set_addrmap(AS_PROGRAM, &mainevt_state::devstors_sound_map);
- m_audiocpu->set_periodic_int(FUNC(mainevt_state::devstors_sound_timer_irq), attotime::from_hz(4*60)); /* ??? */
+ m_audiocpu->set_addrmap(AS_PROGRAM, &devstors_state::sound_map);
+ m_audiocpu->set_periodic_int(FUNC(devstors_state::sound_timer_irq), attotime::from_hz(4 * 60)); // ???
- /* 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(64*8, 32*8);
// screen.set_visarea(13*8, (64-13)*8-1, 2*8, 30*8-1);
- screen.set_raw(XTAL(24'000'000)/3, 528, 13*8, (64-13)*8, 256, 16, 240); // measured 59.17
- screen.set_screen_update(FUNC(mainevt_state::screen_update_dv));
+ screen.set_raw(XTAL(24'000'000) / 3, 528, 13 * 8, (64 - 13) * 8, 256, 16, 240); // measured 59.17
+ screen.set_screen_update(FUNC(devstors_state::screen_update));
screen.set_palette("palette");
- screen.screen_vblank().set(FUNC(mainevt_state::dv_vblank_w));
+ screen.screen_vblank().set(FUNC(devstors_state::vblank_w));
PALETTE(config, "palette").set_format(palette_device::xBGR_555, 256).enable_shadows();
K052109(config, m_k052109, 24_MHz_XTAL);
m_k052109->set_palette("palette");
m_k052109->set_screen("screen");
- m_k052109->set_tile_callback(FUNC(mainevt_state::dv_tile_callback));
+ m_k052109->set_tile_callback(FUNC(devstors_state::tile_callback));
m_k052109->irq_handler().set_inputline(m_maincpu, M6809_IRQ_LINE);
K051960(config, m_k051960, 24_MHz_XTAL);
m_k051960->set_palette("palette");
m_k051960->set_screen("screen");
- m_k051960->set_sprite_callback(FUNC(mainevt_state::dv_sprite_callback));
+ m_k051960->set_sprite_callback(FUNC(devstors_state::sprite_callback));
K051733(config, "k051733", 0);
- /* sound hardware */
+ // sound hardware
SPEAKER(config, "mono").front_center();
GENERIC_LATCH_8(config, "soundlatch");
@@ -503,7 +717,7 @@ void mainevt_state::devstors(machine_config &config)
YM2151(config, "ymsnd", 3.579545_MHz_XTAL).add_route(0, "mono", 0.30).add_route(1, "mono", 0.30);
K007232(config, m_k007232, 3.579545_MHz_XTAL);
- m_k007232->port_write().set(FUNC(mainevt_state::volume_callback));
+ m_k007232->port_write().set(FUNC(devstors_state::volume_callback));
m_k007232->add_route(0, "mono", 0.20);
m_k007232->add_route(1, "mono", 0.20);
}
@@ -517,111 +731,111 @@ void mainevt_state::devstors(machine_config &config)
***************************************************************************/
-ROM_START( mainevt ) /* 4 players - English title screen - No "Warning" message in the ROM */
+ROM_START( mainevt ) // 4 players - English title screen - No "Warning" message in the ROM
ROM_REGION( 0x10000, "maincpu", 0 )
ROM_LOAD( "799y02.k11", 0x00000, 0x10000, CRC(e2e7dbd5) SHA1(80314cd42a9f47f7bb82a2160fb5ef2ddc6dff30) )
ROM_REGION( 0x8000, "audiocpu", 0 )
ROM_LOAD( "799c01.f7", 0x00000, 0x08000, CRC(447c4c5c) SHA1(86e42132793c59cc6feece143516f7ecd4ed14e8) )
- ROM_REGION( 0x20000, "k052109", 0 ) /* tiles */
+ ROM_REGION( 0x20000, "k052109", 0 ) // tiles
ROM_LOAD32_BYTE( "799c06.f22", 0x00000, 0x08000, CRC(f839cb58) SHA1(b36202ca2b68b6249c3f972ad09501e28a0162f7) )
ROM_LOAD32_BYTE( "799c07.h22", 0x00001, 0x08000, CRC(176df538) SHA1(379e1de81afb85b1559de170cd2ab9f4af2b137e) )
ROM_LOAD32_BYTE( "799c08.j22", 0x00002, 0x08000, CRC(d01e0078) SHA1(7ac242eb24271ac2783ec4d9e97ae051f1f3363a) )
ROM_LOAD32_BYTE( "799c09.k22", 0x00003, 0x08000, CRC(9baec75e) SHA1(a8f6102c8fd46f18678f336bc44be31458ca9256) )
- ROM_REGION( 0x100000, "k051960", 0 ) /* sprites */
+ ROM_REGION( 0x100000, "k051960", 0 ) // sprites
ROM_LOAD32_WORD( "799b04.h4", 0x00000, 0x80000, CRC(323e0c2b) SHA1(c108d656b6ceff13c910739e4ca760acbb640de3) )
ROM_LOAD32_WORD( "799b05.k4", 0x00002, 0x80000, CRC(571c5831) SHA1(2a18f0bcf6946ada6e0bde7edbd11afd4db1c170) )
ROM_REGION( 0x0100, "proms", 0 )
- ROM_LOAD( "63s141n.k14", 0x0000, 0x0100, CRC(61f6c8d1) SHA1(c70f1f8e434aaaffb89e30e2230a08374ef324ad) ) /* priority encoder (not used) */
+ ROM_LOAD( "63s141n.k14", 0x0000, 0x0100, CRC(61f6c8d1) SHA1(c70f1f8e434aaaffb89e30e2230a08374ef324ad) ) // priority encoder (not used)
- ROM_REGION( 0x80000, "k007232", 0 ) /* 512k for 007232 samples */
+ ROM_REGION( 0x80000, "k007232", 0 ) // samples
ROM_LOAD( "799b03.d4", 0x00000, 0x80000, CRC(f1cfd342) SHA1(079afc5c631de7f5b652d0ce6fd44b3aacd14a1b) )
- ROM_REGION( 0x80000, "upd", 0 ) /* 512k for the UPD7759C samples */
+ ROM_REGION( 0x80000, "upd", 0 ) // samples
ROM_LOAD( "799b06.c22", 0x00000, 0x80000, CRC(2c8c47d7) SHA1(18a899767177ddfd870df9ed156d8bbc04b58a19) )
ROM_END
-ROM_START( mainevto ) /* 4 players - English title screen - No "Warning" message in the ROM */
+ROM_START( mainevto ) // 4 players - English title screen - No "Warning" message in the ROM
ROM_REGION( 0x10000, "maincpu", 0 )
ROM_LOAD( "799f02.k11", 0x00000, 0x10000, CRC(c143596b) SHA1(5da7efaf0f7c7a493cc242eae115f278bc9c134b) )
ROM_REGION( 0x8000, "audiocpu", 0 )
ROM_LOAD( "799c01.f7", 0x00000, 0x08000, CRC(447c4c5c) SHA1(86e42132793c59cc6feece143516f7ecd4ed14e8) )
- ROM_REGION( 0x20000, "k052109", 0 ) /* tiles */
+ ROM_REGION( 0x20000, "k052109", 0 ) // tiles
ROM_LOAD32_BYTE( "799c06.f22", 0x00000, 0x08000, CRC(f839cb58) SHA1(b36202ca2b68b6249c3f972ad09501e28a0162f7) )
ROM_LOAD32_BYTE( "799c07.h22", 0x00001, 0x08000, CRC(176df538) SHA1(379e1de81afb85b1559de170cd2ab9f4af2b137e) )
ROM_LOAD32_BYTE( "799c08.j22", 0x00002, 0x08000, CRC(d01e0078) SHA1(7ac242eb24271ac2783ec4d9e97ae051f1f3363a) )
ROM_LOAD32_BYTE( "799c09.k22", 0x00003, 0x08000, CRC(9baec75e) SHA1(a8f6102c8fd46f18678f336bc44be31458ca9256) )
- ROM_REGION( 0x100000, "k051960", 0 ) /* sprites */
+ ROM_REGION( 0x100000, "k051960", 0 ) // sprites
ROM_LOAD32_WORD( "799b04.h4", 0x00000, 0x80000, CRC(323e0c2b) SHA1(c108d656b6ceff13c910739e4ca760acbb640de3) )
ROM_LOAD32_WORD( "799b05.k4", 0x00002, 0x80000, CRC(571c5831) SHA1(2a18f0bcf6946ada6e0bde7edbd11afd4db1c170) )
ROM_REGION( 0x0100, "proms", 0 )
- ROM_LOAD( "63s141n.k14", 0x0000, 0x0100, CRC(61f6c8d1) SHA1(c70f1f8e434aaaffb89e30e2230a08374ef324ad) ) /* priority encoder (not used) */
+ ROM_LOAD( "63s141n.k14", 0x0000, 0x0100, CRC(61f6c8d1) SHA1(c70f1f8e434aaaffb89e30e2230a08374ef324ad) ) // priority encoder (not used)
- ROM_REGION( 0x80000, "k007232", 0 ) /* 512k for 007232 samples */
+ ROM_REGION( 0x80000, "k007232", 0 ) // samples
ROM_LOAD( "799b03.d4", 0x00000, 0x80000, CRC(f1cfd342) SHA1(079afc5c631de7f5b652d0ce6fd44b3aacd14a1b) )
- ROM_REGION( 0x80000, "upd", 0 ) /* 512k for the UPD7759C samples */
+ ROM_REGION( 0x80000, "upd", 0 ) // samples
ROM_LOAD( "799b06.c22", 0x00000, 0x80000, CRC(2c8c47d7) SHA1(18a899767177ddfd870df9ed156d8bbc04b58a19) )
ROM_END
-ROM_START( mainevt2p ) /* 2 players - English title screen - "Warning" message in the ROM (not displayed) */
+ROM_START( mainevt2p ) // 2 players - English title screen - "Warning" message in the ROM (not displayed)
ROM_REGION( 0x10000, "maincpu", 0 )
ROM_LOAD( "799x02.k11", 0x00000, 0x10000, CRC(42cfc650) SHA1(2d1918ebc0d93a2356ad995a6854dbde7c3b8daf) )
ROM_REGION( 0x8000, "audiocpu", 0 )
ROM_LOAD( "799c01.f7", 0x00000, 0x08000, CRC(447c4c5c) SHA1(86e42132793c59cc6feece143516f7ecd4ed14e8) )
- ROM_REGION( 0x20000, "k052109", 0 ) /* tiles */
+ ROM_REGION( 0x20000, "k052109", 0 ) // tiles
ROM_LOAD32_BYTE( "799c06.f22", 0x00000, 0x08000, CRC(f839cb58) SHA1(b36202ca2b68b6249c3f972ad09501e28a0162f7) )
ROM_LOAD32_BYTE( "799c07.h22", 0x00001, 0x08000, CRC(176df538) SHA1(379e1de81afb85b1559de170cd2ab9f4af2b137e) )
ROM_LOAD32_BYTE( "799c08.j22", 0x00002, 0x08000, CRC(d01e0078) SHA1(7ac242eb24271ac2783ec4d9e97ae051f1f3363a) )
ROM_LOAD32_BYTE( "799c09.k22", 0x00003, 0x08000, CRC(9baec75e) SHA1(a8f6102c8fd46f18678f336bc44be31458ca9256) )
- ROM_REGION( 0x100000, "k051960", 0 ) /* sprites */
+ ROM_REGION( 0x100000, "k051960", 0 ) // sprites
ROM_LOAD32_WORD( "799b04.h4", 0x00000, 0x80000, CRC(323e0c2b) SHA1(c108d656b6ceff13c910739e4ca760acbb640de3) )
ROM_LOAD32_WORD( "799b05.k4", 0x00002, 0x80000, CRC(571c5831) SHA1(2a18f0bcf6946ada6e0bde7edbd11afd4db1c170) )
ROM_REGION( 0x0100, "proms", 0 )
- ROM_LOAD( "63s141n.k14", 0x0000, 0x0100, CRC(61f6c8d1) SHA1(c70f1f8e434aaaffb89e30e2230a08374ef324ad) ) /* priority encoder (not used) */
+ ROM_LOAD( "63s141n.k14", 0x0000, 0x0100, CRC(61f6c8d1) SHA1(c70f1f8e434aaaffb89e30e2230a08374ef324ad) ) // priority encoder (not used)
- ROM_REGION( 0x80000, "k007232", 0 ) /* 512k for 007232 samples */
+ ROM_REGION( 0x80000, "k007232", 0 ) // samples
ROM_LOAD( "799b03.d4", 0x00000, 0x80000, CRC(f1cfd342) SHA1(079afc5c631de7f5b652d0ce6fd44b3aacd14a1b) )
- ROM_REGION( 0x80000, "upd", 0 ) /* 512k for the UPD7759C samples */
+ ROM_REGION( 0x80000, "upd", 0 ) // samples
ROM_LOAD( "799b06.c22", 0x00000, 0x80000, CRC(2c8c47d7) SHA1(18a899767177ddfd870df9ed156d8bbc04b58a19) )
ROM_END
-ROM_START( ringohja ) /* 2 players - Japan title screen - "Warning" message in the ROM (displayed) */
+ROM_START( ringohja ) // 2 players - Japan title screen - "Warning" message in the ROM (displayed)
ROM_REGION( 0x10000, "maincpu", 0 )
ROM_LOAD( "799n02.k11", 0x00000, 0x10000, CRC(f9305dd0) SHA1(7135053be9d46ac9c09ab63eca1eb71825a71a13) )
ROM_REGION( 0x8000, "audiocpu", 0 )
ROM_LOAD( "799c01.f7", 0x00000, 0x08000, CRC(447c4c5c) SHA1(86e42132793c59cc6feece143516f7ecd4ed14e8) )
- ROM_REGION( 0x20000, "k052109", 0 ) /* tiles */
+ ROM_REGION( 0x20000, "k052109", 0 ) // tiles
ROM_LOAD32_BYTE( "799c06.f22", 0x00000, 0x08000, CRC(f839cb58) SHA1(b36202ca2b68b6249c3f972ad09501e28a0162f7) )
ROM_LOAD32_BYTE( "799c07.h22", 0x00001, 0x08000, CRC(176df538) SHA1(379e1de81afb85b1559de170cd2ab9f4af2b137e) )
ROM_LOAD32_BYTE( "799c08.j22", 0x00002, 0x08000, CRC(d01e0078) SHA1(7ac242eb24271ac2783ec4d9e97ae051f1f3363a) )
ROM_LOAD32_BYTE( "799c09.k22", 0x00003, 0x08000, CRC(9baec75e) SHA1(a8f6102c8fd46f18678f336bc44be31458ca9256) )
- ROM_REGION( 0x100000, "k051960", 0 ) /* sprites */
+ ROM_REGION( 0x100000, "k051960", 0 ) // sprites
ROM_LOAD32_WORD( "799b04.h4", 0x00000, 0x80000, CRC(323e0c2b) SHA1(c108d656b6ceff13c910739e4ca760acbb640de3) )
ROM_LOAD32_WORD( "799b05.k4", 0x00002, 0x80000, CRC(571c5831) SHA1(2a18f0bcf6946ada6e0bde7edbd11afd4db1c170) )
ROM_REGION( 0x0100, "proms", 0 )
- ROM_LOAD( "63s141n.k14", 0x0000, 0x0100, CRC(61f6c8d1) SHA1(c70f1f8e434aaaffb89e30e2230a08374ef324ad) ) /* priority encoder (not used) */
+ ROM_LOAD( "63s141n.k14", 0x0000, 0x0100, CRC(61f6c8d1) SHA1(c70f1f8e434aaaffb89e30e2230a08374ef324ad) ) // priority encoder (not used)
- ROM_REGION( 0x80000, "k007232", 0 ) /* 512k for 007232 samples */
+ ROM_REGION( 0x80000, "k007232", 0 ) // samples
ROM_LOAD( "799b03.d4", 0x00000, 0x80000, CRC(f1cfd342) SHA1(079afc5c631de7f5b652d0ce6fd44b3aacd14a1b) )
- ROM_REGION( 0x80000, "upd", 0 ) /* 512k for the UPD7759C samples */
+ ROM_REGION( 0x80000, "upd", 0 ) // samples
ROM_LOAD( "799b06.c22", 0x00000, 0x80000, CRC(2c8c47d7) SHA1(18a899767177ddfd870df9ed156d8bbc04b58a19) )
ROM_END
@@ -633,20 +847,20 @@ ROM_START( devstors )
ROM_REGION( 0x8000, "audiocpu", 0 )
ROM_LOAD( "890k01.f7", 0x00000, 0x08000, CRC(d44b3eb0) SHA1(26109fc56668b65f1a5aa6d8ec2c08fd70ca7c51) )
- ROM_REGION( 0x40000, "k052109", 0 ) /* tiles */
+ ROM_REGION( 0x40000, "k052109", 0 ) // tiles
ROM_LOAD32_BYTE( "890f06.f22", 0x00000, 0x10000, CRC(26592155) SHA1(aa1f8662f091ca1eb495223e41a35edd861ae9e9) )
ROM_LOAD32_BYTE( "890f07.h22", 0x00001, 0x10000, CRC(6c74fa2e) SHA1(419a2ad31d269fafe4c474bf512e935d5e018846) )
ROM_LOAD32_BYTE( "890f08.j22", 0x00002, 0x10000, CRC(29e12e80) SHA1(6d09e190055218e2dfd07838f1446dfb5f801206) )
ROM_LOAD32_BYTE( "890f09.k22", 0x00003, 0x10000, CRC(67ca40d5) SHA1(ff719f55d2534ff076fbdd2bcb7d12c683bfe958) )
- ROM_REGION( 0x100000, "k051960", 0 ) /* sprites */
+ ROM_REGION( 0x100000, "k051960", 0 ) // sprites
ROM_LOAD32_WORD( "890f04.h4", 0x00000, 0x80000, CRC(f16cd1fa) SHA1(60ea19c19918a71aded3c9ea398c956908e217f1) )
ROM_LOAD32_WORD( "890f05.k4", 0x00002, 0x80000, CRC(da37db05) SHA1(0b48d1021cf0dec78dae0ef183b4c61fea783533) )
ROM_REGION( 0x0100, "proms", 0 )
- ROM_LOAD( "63s141n.k14", 0x0000, 0x0100, CRC(d3620106) SHA1(528a0a34754902d0f262a9619c6105da6de99354) ) /* priority encoder (not used) */
+ ROM_LOAD( "63s141n.k14", 0x0000, 0x0100, CRC(d3620106) SHA1(528a0a34754902d0f262a9619c6105da6de99354) ) // priority encoder (not used)
- ROM_REGION( 0x80000, "k007232", 0 ) /* 512k for 007232 samples */
+ ROM_REGION( 0x80000, "k007232", 0 ) // samples
ROM_LOAD( "890f03.d4", 0x00000, 0x80000, CRC(19065031) SHA1(12c47fbe28f85fa2f901fe52601188a5e9633f22) )
ROM_END
@@ -657,20 +871,20 @@ ROM_START( devstorsx )
ROM_REGION( 0x8000, "audiocpu", 0 )
ROM_LOAD( "890k01.f7", 0x00000, 0x08000, CRC(d44b3eb0) SHA1(26109fc56668b65f1a5aa6d8ec2c08fd70ca7c51) )
- ROM_REGION( 0x40000, "k052109", 0 ) /* tiles */
+ ROM_REGION( 0x40000, "k052109", 0 ) // tiles
ROM_LOAD32_BYTE( "890f06.f22", 0x00000, 0x10000, CRC(26592155) SHA1(aa1f8662f091ca1eb495223e41a35edd861ae9e9) )
ROM_LOAD32_BYTE( "890f07.h22", 0x00001, 0x10000, CRC(6c74fa2e) SHA1(419a2ad31d269fafe4c474bf512e935d5e018846) )
ROM_LOAD32_BYTE( "890f08.j22", 0x00002, 0x10000, CRC(29e12e80) SHA1(6d09e190055218e2dfd07838f1446dfb5f801206) )
ROM_LOAD32_BYTE( "890f09.k22", 0x00003, 0x10000, CRC(67ca40d5) SHA1(ff719f55d2534ff076fbdd2bcb7d12c683bfe958) )
- ROM_REGION( 0x100000, "k051960", 0 ) /* sprites */
+ ROM_REGION( 0x100000, "k051960", 0 ) // sprites
ROM_LOAD32_WORD( "890f04.h4", 0x00000, 0x80000, CRC(f16cd1fa) SHA1(60ea19c19918a71aded3c9ea398c956908e217f1) )
ROM_LOAD32_WORD( "890f05.k4", 0x00002, 0x80000, CRC(da37db05) SHA1(0b48d1021cf0dec78dae0ef183b4c61fea783533) )
ROM_REGION( 0x0100, "proms", 0 )
- ROM_LOAD( "63s141n.k14", 0x0000, 0x0100, CRC(d3620106) SHA1(528a0a34754902d0f262a9619c6105da6de99354) ) /* priority encoder (not used) */
+ ROM_LOAD( "63s141n.k14", 0x0000, 0x0100, CRC(d3620106) SHA1(528a0a34754902d0f262a9619c6105da6de99354) ) // priority encoder (not used)
- ROM_REGION( 0x80000, "k007232", 0 ) /* 512k for 007232 samples */
+ ROM_REGION( 0x80000, "k007232", 0 ) // samples
ROM_LOAD( "890f03.d4", 0x00000, 0x80000, CRC(19065031) SHA1(12c47fbe28f85fa2f901fe52601188a5e9633f22) )
ROM_END
@@ -681,20 +895,20 @@ ROM_START( devstorsv )
ROM_REGION( 0x8000, "audiocpu", 0 )
ROM_LOAD( "890k01.f7", 0x00000, 0x08000, CRC(d44b3eb0) SHA1(26109fc56668b65f1a5aa6d8ec2c08fd70ca7c51) )
- ROM_REGION( 0x40000, "k052109", 0 ) /* tiles */
+ ROM_REGION( 0x40000, "k052109", 0 ) // tiles
ROM_LOAD32_BYTE( "890f06.f22", 0x00000, 0x10000, CRC(26592155) SHA1(aa1f8662f091ca1eb495223e41a35edd861ae9e9) )
ROM_LOAD32_BYTE( "890f07.h22", 0x00001, 0x10000, CRC(6c74fa2e) SHA1(419a2ad31d269fafe4c474bf512e935d5e018846) )
ROM_LOAD32_BYTE( "890f08.j22", 0x00002, 0x10000, CRC(29e12e80) SHA1(6d09e190055218e2dfd07838f1446dfb5f801206) )
ROM_LOAD32_BYTE( "890f09.k22", 0x00003, 0x10000, CRC(67ca40d5) SHA1(ff719f55d2534ff076fbdd2bcb7d12c683bfe958) )
- ROM_REGION( 0x100000, "k051960", 0 ) /* sprites */
+ ROM_REGION( 0x100000, "k051960", 0 ) // sprites
ROM_LOAD32_WORD( "890f04.h4", 0x00000, 0x80000, CRC(f16cd1fa) SHA1(60ea19c19918a71aded3c9ea398c956908e217f1) )
ROM_LOAD32_WORD( "890f05.k4", 0x00002, 0x80000, CRC(da37db05) SHA1(0b48d1021cf0dec78dae0ef183b4c61fea783533) )
ROM_REGION( 0x0100, "proms", 0 )
- ROM_LOAD( "63s141n.k14", 0x0000, 0x0100, CRC(d3620106) SHA1(528a0a34754902d0f262a9619c6105da6de99354) ) /* priority encoder (not used) */
+ ROM_LOAD( "63s141n.k14", 0x0000, 0x0100, CRC(d3620106) SHA1(528a0a34754902d0f262a9619c6105da6de99354) ) // priority encoder (not used)
- ROM_REGION( 0x80000, "k007232", 0 ) /* 512k for 007232 samples */
+ ROM_REGION( 0x80000, "k007232", 0 ) // samples
ROM_LOAD( "890f03.d4", 0x00000, 0x80000, CRC(19065031) SHA1(12c47fbe28f85fa2f901fe52601188a5e9633f22) )
ROM_END
@@ -705,20 +919,20 @@ ROM_START( devstors2 )
ROM_REGION( 0x8000, "audiocpu", 0 )
ROM_LOAD( "890k01.f7", 0x00000, 0x08000, CRC(d44b3eb0) SHA1(26109fc56668b65f1a5aa6d8ec2c08fd70ca7c51) )
- ROM_REGION( 0x40000, "k052109", 0 ) /* tiles */
+ ROM_REGION( 0x40000, "k052109", 0 ) // tiles
ROM_LOAD32_BYTE( "890f06.f22", 0x00000, 0x10000, CRC(26592155) SHA1(aa1f8662f091ca1eb495223e41a35edd861ae9e9) )
ROM_LOAD32_BYTE( "890f07.h22", 0x00001, 0x10000, CRC(6c74fa2e) SHA1(419a2ad31d269fafe4c474bf512e935d5e018846) )
ROM_LOAD32_BYTE( "890f08.j22", 0x00002, 0x10000, CRC(29e12e80) SHA1(6d09e190055218e2dfd07838f1446dfb5f801206) )
ROM_LOAD32_BYTE( "890f09.k22", 0x00003, 0x10000, CRC(67ca40d5) SHA1(ff719f55d2534ff076fbdd2bcb7d12c683bfe958) )
- ROM_REGION( 0x100000, "k051960", 0 ) /* sprites */
+ ROM_REGION( 0x100000, "k051960", 0 ) // sprites
ROM_LOAD32_WORD( "890f04.h4", 0x00000, 0x80000, CRC(f16cd1fa) SHA1(60ea19c19918a71aded3c9ea398c956908e217f1) )
ROM_LOAD32_WORD( "890f05.k4", 0x00002, 0x80000, CRC(da37db05) SHA1(0b48d1021cf0dec78dae0ef183b4c61fea783533) )
ROM_REGION( 0x0100, "proms", 0 )
- ROM_LOAD( "63s141n.k14", 0x0000, 0x0100, CRC(d3620106) SHA1(528a0a34754902d0f262a9619c6105da6de99354) ) /* priority encoder (not used) */
+ ROM_LOAD( "63s141n.k14", 0x0000, 0x0100, CRC(d3620106) SHA1(528a0a34754902d0f262a9619c6105da6de99354) ) // priority encoder (not used)
- ROM_REGION( 0x80000, "k007232", 0 ) /* 512k for 007232 samples */
+ ROM_REGION( 0x80000, "k007232", 0 ) // samples
ROM_LOAD( "890f03.d4", 0x00000, 0x80000, CRC(19065031) SHA1(12c47fbe28f85fa2f901fe52601188a5e9633f22) )
ROM_END
@@ -729,31 +943,32 @@ ROM_START( garuka )
ROM_REGION( 0x8000, "audiocpu", 0 )
ROM_LOAD( "890k01.f7", 0x00000, 0x08000, CRC(d44b3eb0) SHA1(26109fc56668b65f1a5aa6d8ec2c08fd70ca7c51) )
- ROM_REGION( 0x40000, "k052109", 0 ) /* tiles */
+ ROM_REGION( 0x40000, "k052109", 0 ) // tiles
ROM_LOAD32_BYTE( "890f06.f22", 0x00000, 0x10000, CRC(26592155) SHA1(aa1f8662f091ca1eb495223e41a35edd861ae9e9) )
ROM_LOAD32_BYTE( "890f07.h22", 0x00001, 0x10000, CRC(6c74fa2e) SHA1(419a2ad31d269fafe4c474bf512e935d5e018846) )
ROM_LOAD32_BYTE( "890f08.j22", 0x00002, 0x10000, CRC(29e12e80) SHA1(6d09e190055218e2dfd07838f1446dfb5f801206) )
ROM_LOAD32_BYTE( "890f09.k22", 0x00003, 0x10000, CRC(67ca40d5) SHA1(ff719f55d2534ff076fbdd2bcb7d12c683bfe958) )
- ROM_REGION( 0x100000, "k051960", 0 ) /* sprites */
+ ROM_REGION( 0x100000, "k051960", 0 ) // sprites
ROM_LOAD32_WORD( "890f04.h4", 0x00000, 0x80000, CRC(f16cd1fa) SHA1(60ea19c19918a71aded3c9ea398c956908e217f1) )
ROM_LOAD32_WORD( "890f05.k4", 0x00002, 0x80000, CRC(da37db05) SHA1(0b48d1021cf0dec78dae0ef183b4c61fea783533) )
ROM_REGION( 0x0100, "proms", 0 )
- ROM_LOAD( "63s141n.k14", 0x0000, 0x0100, CRC(d3620106) SHA1(528a0a34754902d0f262a9619c6105da6de99354) ) /* priority encoder (not used) */
+ ROM_LOAD( "63s141n.k14", 0x0000, 0x0100, CRC(d3620106) SHA1(528a0a34754902d0f262a9619c6105da6de99354) ) // priority encoder (not used)
- ROM_REGION( 0x80000, "k007232", 0 ) /* 512k for 007232 samples */
+ ROM_REGION( 0x80000, "k007232", 0 ) // samples
ROM_LOAD( "890f03.d4", 0x00000, 0x80000, CRC(19065031) SHA1(12c47fbe28f85fa2f901fe52601188a5e9633f22) )
ROM_END
+} // anonymous namespace
-GAME( 1988, mainevt, 0, mainevt, mainevt, mainevt_state, empty_init, ROT0, "Konami", "The Main Event (4 Players ver. Y)", MACHINE_SUPPORTS_SAVE )
-GAME( 1988, mainevto, mainevt, mainevt, mainevt, mainevt_state, empty_init, ROT0, "Konami", "The Main Event (4 Players ver. F)", MACHINE_SUPPORTS_SAVE )
-GAME( 1988, mainevt2p, mainevt, mainevt, mainev2p, mainevt_state, empty_init, ROT0, "Konami", "The Main Event (2 Players ver. X)", MACHINE_SUPPORTS_SAVE )
-GAME( 1988, ringohja, mainevt, mainevt, mainev2p, mainevt_state, empty_init, ROT0, "Konami", "Ring no Ohja (Japan 2 Players ver. N)", MACHINE_SUPPORTS_SAVE )
-GAME( 1988, devstors, 0, devstors, devstors, mainevt_state, empty_init, ROT90, "Konami", "Devastators (ver. Z)", MACHINE_SUPPORTS_SAVE | MACHINE_UNEMULATED_PROTECTION )
-GAME( 1988, devstorsx, devstors, devstors, devstors_ct, mainevt_state, empty_init, ROT90, "Konami", "Devastators (ver. X)", MACHINE_SUPPORTS_SAVE | MACHINE_UNEMULATED_PROTECTION )
-GAME( 1988, devstorsv, devstors, devstors, devstors, mainevt_state, empty_init, ROT90, "Konami", "Devastators (ver. V)", MACHINE_SUPPORTS_SAVE | MACHINE_UNEMULATED_PROTECTION )
-GAME( 1988, devstors2, devstors, devstors, devstors_ct, mainevt_state, empty_init, ROT90, "Konami", "Devastators (ver. 2)", MACHINE_SUPPORTS_SAVE | MACHINE_UNEMULATED_PROTECTION )
-GAME( 1988, garuka, devstors, devstors, devstors_ct, mainevt_state, empty_init, ROT90, "Konami", "Garuka (Japan ver. W)", MACHINE_SUPPORTS_SAVE | MACHINE_UNEMULATED_PROTECTION )
+GAME( 1988, mainevt, 0, mainevt, mainevt, mainevt_state, empty_init, ROT0, "Konami", "The Main Event (4 Players ver. Y)", MACHINE_SUPPORTS_SAVE )
+GAME( 1988, mainevto, mainevt, mainevt, mainevt, mainevt_state, empty_init, ROT0, "Konami", "The Main Event (4 Players ver. F)", MACHINE_SUPPORTS_SAVE )
+GAME( 1988, mainevt2p, mainevt, mainevt, mainev2p, mainevt_state, empty_init, ROT0, "Konami", "The Main Event (2 Players ver. X)", MACHINE_SUPPORTS_SAVE )
+GAME( 1988, ringohja, mainevt, mainevt, mainev2p, mainevt_state, empty_init, ROT0, "Konami", "Ring no Ohja (Japan 2 Players ver. N)", MACHINE_SUPPORTS_SAVE )
+GAME( 1988, devstors, 0, devstors, devstors, devstors_state, empty_init, ROT90, "Konami", "Devastators (ver. Z)", MACHINE_SUPPORTS_SAVE | MACHINE_UNEMULATED_PROTECTION )
+GAME( 1988, devstorsx, devstors, devstors, devstors_ct, devstors_state, empty_init, ROT90, "Konami", "Devastators (ver. X)", MACHINE_SUPPORTS_SAVE | MACHINE_UNEMULATED_PROTECTION )
+GAME( 1988, devstorsv, devstors, devstors, devstors, devstors_state, empty_init, ROT90, "Konami", "Devastators (ver. V)", MACHINE_SUPPORTS_SAVE | MACHINE_UNEMULATED_PROTECTION )
+GAME( 1988, devstors2, devstors, devstors, devstors_ct, devstors_state, empty_init, ROT90, "Konami", "Devastators (ver. 2)", MACHINE_SUPPORTS_SAVE | MACHINE_UNEMULATED_PROTECTION )
+GAME( 1988, garuka, devstors, devstors, devstors_ct, devstors_state, empty_init, ROT90, "Konami", "Garuka (Japan ver. W)", MACHINE_SUPPORTS_SAVE | MACHINE_UNEMULATED_PROTECTION )
diff --git a/src/mame/konami/mainevt.h b/src/mame/konami/mainevt.h
deleted file mode 100644
index 24ced743e00..00000000000
--- a/src/mame/konami/mainevt.h
+++ /dev/null
@@ -1,84 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Bryan McPhail
-/*************************************************************************
-
- The Main Event / Devastators
-
-*************************************************************************/
-#ifndef MAME_INCLUDES_MAINEVT_H
-#define MAME_INCLUDES_MAINEVT_H
-
-#pragma once
-
-#include "sound/upd7759.h"
-#include "sound/k007232.h"
-#include "k052109.h"
-#include "k051960.h"
-#include "k051733.h"
-#include "konami_helper.h"
-
-class mainevt_state : public driver_device
-{
-public:
- mainevt_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_upd7759(*this, "upd")
- , m_k007232(*this, "k007232")
- , m_k052109(*this, "k052109")
- , m_k051960(*this, "k051960")
- , m_rombank(*this, "rombank")
- , m_leds(*this, "led%u", 0U)
- { }
-
- void devstors(machine_config &config);
- void mainevt(machine_config &config);
-
-private:
- void dv_nmienable_w(uint8_t data);
- void mainevt_bankswitch_w(uint8_t data);
- void mainevt_coin_w(uint8_t data);
- void mainevt_sh_irqtrigger_w(uint8_t data);
- void mainevt_sh_irqcontrol_w(uint8_t data);
- void devstor_sh_irqcontrol_w(uint8_t data);
- void mainevt_sh_bankswitch_w(uint8_t data);
- uint8_t k052109_051960_r(offs_t offset);
- void k052109_051960_w(offs_t offset, uint8_t data);
- uint8_t mainevt_sh_busy_r();
- void dv_sh_bankswitch_w(uint8_t data);
- uint32_t screen_update_mainevt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- uint32_t screen_update_dv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- DECLARE_WRITE_LINE_MEMBER(dv_vblank_w);
- INTERRUPT_GEN_MEMBER(mainevt_sound_timer_irq);
- INTERRUPT_GEN_MEMBER(devstors_sound_timer_irq);
- void volume_callback(uint8_t data);
- K052109_CB_MEMBER(mainevt_tile_callback);
- K052109_CB_MEMBER(dv_tile_callback);
- K051960_CB_MEMBER(mainevt_sprite_callback);
- K051960_CB_MEMBER(dv_sprite_callback);
- void devstors_map(address_map &map);
- void devstors_sound_map(address_map &map);
- void mainevt_map(address_map &map);
- void mainevt_sound_map(address_map &map);
-
- virtual void machine_start() override;
- virtual void machine_reset() override;
-
- /* misc */
- int m_nmi_enable = 0;
- uint8_t m_sound_irq_mask = 0;
-
- /* devices */
- required_device<cpu_device> m_maincpu;
- required_device<cpu_device> m_audiocpu;
- optional_device<upd7759_device> m_upd7759;
- required_device<k007232_device> m_k007232;
- required_device<k052109_device> m_k052109;
- required_device<k051960_device> m_k051960;
-
- required_memory_bank m_rombank;
- output_finder<4> m_leds;
-};
-
-#endif // MAME_INCLUDES_MAINEVT_H
diff --git a/src/mame/konami/mainevt_v.cpp b/src/mame/konami/mainevt_v.cpp
deleted file mode 100644
index 49fa23122c0..00000000000
--- a/src/mame/konami/mainevt_v.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Bryan McPhail
-/***************************************************************************
-
- video.c
-
- Functions to emulate the video hardware of the machine.
-
-***************************************************************************/
-
-#include "emu.h"
-#include "mainevt.h"
-#include "screen.h"
-
-/***************************************************************************
-
- Callbacks for the K052109
-
-***************************************************************************/
-
-K052109_CB_MEMBER(mainevt_state::mainevt_tile_callback)
-{
- static const int layer_colorbase[] = { 0 / 16, 128 / 16, 64 / 16 };
-
- *flags = (*color & 0x02) ? TILE_FLIPX : 0;
-
- /* priority relative to HALF priority sprites */
- *priority = (layer == 2) ? (*color & 0x20) >> 5 : 0;
- *code |= ((*color & 0x01) << 8) | ((*color & 0x1c) << 7);
- *color = layer_colorbase[layer] + ((*color & 0xc0) >> 6);
-}
-
-K052109_CB_MEMBER(mainevt_state::dv_tile_callback)
-{
- static const int layer_colorbase[] = { 0 / 16, 0 / 16, 64 / 16 };
-
- /* (color & 0x02) is flip y handled internally by the 052109 */
- *code |= ((*color & 0x01) << 8) | ((*color & 0x3c) << 7);
- *color = layer_colorbase[layer] + ((*color & 0xc0) >> 6);
-}
-
-
-/***************************************************************************
-
- Callbacks for the K051960
-
-***************************************************************************/
-
-K051960_CB_MEMBER(mainevt_state::mainevt_sprite_callback)
-{
- enum { sprite_colorbase = 192 / 16 };
-
- /* bit 5 = priority over layer B (has precedence) */
- /* bit 6 = HALF priority over layer B (used for crowd when you get out of the ring) */
- if (*color & 0x20)
- *priority = 0xff00;
- else if (*color & 0x40)
- *priority = 0xff00 | 0xf0f0;
- else
- *priority = 0xff00 | 0xf0f0 | 0xcccc;
- /* bit 7 is shadow, not used */
-
- *color = sprite_colorbase + (*color & 0x03);
-}
-
-K051960_CB_MEMBER(mainevt_state::dv_sprite_callback)
-{
- enum { sprite_colorbase = 128 / 16 };
-
- /* TODO: the priority/shadow handling (bits 5-7) seems to be quite complex (see PROM) */
- *color = sprite_colorbase + (*color & 0x07);
-}
-
-
-/*****************************************************************************/
-
-uint32_t mainevt_state::screen_update_mainevt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
- m_k052109->tilemap_update();
-
- screen.priority().fill(0, cliprect);
- m_k052109->tilemap_draw(screen, bitmap, cliprect, 1, TILEMAP_DRAW_OPAQUE, 1);
- m_k052109->tilemap_draw(screen, bitmap, cliprect, 2, 1, 2); /* low priority part of layer */
- m_k052109->tilemap_draw(screen, bitmap, cliprect, 2, 0, 4); /* high priority part of layer */
- m_k052109->tilemap_draw(screen, bitmap, cliprect, 0, 0, 8);
-
- m_k051960->k051960_sprites_draw(bitmap, cliprect, screen.priority(), -1, -1);
- return 0;
-}
-
-uint32_t mainevt_state::screen_update_dv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
- m_k052109->tilemap_update();
-
- m_k052109->tilemap_draw(screen, bitmap, cliprect, 1, TILEMAP_DRAW_OPAQUE, 0);
- m_k052109->tilemap_draw(screen, bitmap, cliprect, 2, 0, 0);
- m_k051960->k051960_sprites_draw(bitmap, cliprect, screen.priority(), 0, 0);
- m_k052109->tilemap_draw(screen, bitmap, cliprect, 0, 0, 0);
- return 0;
-}
diff --git a/src/mame/konami/mikie.cpp b/src/mame/konami/mikie.cpp
index a5fe2c06797..88b5574b4c0 100644
--- a/src/mame/konami/mikie.cpp
+++ b/src/mame/konami/mikie.cpp
@@ -1,8 +1,10 @@
// license:BSD-3-Clause
-// copyright-holders:Allard van der Bas
+// copyright-holders: Allard van der Bas
+
/***************************************************************************
Mikie memory map (preliminary)
+ GX469
driver by Allard van der Bas
@@ -39,26 +41,235 @@ Stephh's notes (based on the games M6809 code and some tests) :
***************************************************************************/
#include "emu.h"
-#include "mikie.h"
+
#include "konamipt.h"
-#include "cpu/z80/z80.h"
#include "cpu/m6809/m6809.h"
+#include "cpu/z80/z80.h"
#include "machine/74259.h"
#include "machine/gen_latch.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 mikie_state : public driver_device
+{
+public:
+ mikie_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
+ m_spriteram(*this, "spriteram"),
+ m_colorram(*this, "colorram"),
+ m_videoram(*this, "videoram"),
+ m_maincpu(*this, "maincpu"),
+ m_audiocpu(*this, "audiocpu"),
+ m_gfxdecode(*this, "gfxdecode"),
+ m_palette(*this, "palette")
+ { }
+
+ void mikie(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<uint8_t> m_spriteram;
+ required_shared_ptr<uint8_t> m_colorram;
+ required_shared_ptr<uint8_t> m_videoram;
+
+ // devices
+ required_device<cpu_device> m_maincpu;
+ required_device<cpu_device> m_audiocpu;
+ required_device<gfxdecode_device> m_gfxdecode;
+ required_device<palette_device> m_palette;
+
+ // video-related
+ tilemap_t *m_bg_tilemap = nullptr;
+ uint8_t m_palettebank = 0;
+
+ uint8_t m_irq_mask = 0;
+
+ uint8_t sh_timer_r();
+ DECLARE_WRITE_LINE_MEMBER(sh_irqtrigger_w);
+ template <uint8_t Which> DECLARE_WRITE_LINE_MEMBER(coin_counter_w);
+ 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);
+ void palettebank_w(uint8_t data);
+ DECLARE_WRITE_LINE_MEMBER(flipscreen_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);
+ void sound_map(address_map &map);
+};
+
+
+// video
+
+/***************************************************************************
+
+ Convert the color PROMs into a more useable format.
+
+ Mikie 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 mikie_state::palette(palette_device &palette) const
+{
+ uint8_t const *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);
+ m_palette->set_pen_indirect(((i & 0x100) << 3) | (j << 8) | (i & 0xff), ctabentry);
+ }
+ }
+}
+
+void mikie_state::videoram_w(offs_t offset, uint8_t data)
+{
+ m_videoram[offset] = data;
+ m_bg_tilemap->mark_tile_dirty(offset);
+}
+
+void mikie_state::colorram_w(offs_t offset, uint8_t data)
+{
+ m_colorram[offset] = data;
+ m_bg_tilemap->mark_tile_dirty(offset);
+}
+void mikie_state::palettebank_w(uint8_t data)
+{
+ if (m_palettebank != (data & 0x07))
+ {
+ m_palettebank = data & 0x07;
+ machine().tilemap().mark_all_dirty();
+ }
+}
-#define MIKIE_TIMER_RATE 512
+WRITE_LINE_MEMBER(mikie_state::flipscreen_w)
+{
+ flip_screen_set(state);
+ machine().tilemap().mark_all_dirty();
+}
-#define XTAL 14318180
-#define OSC 18432000
-#define CLK XTAL/4
+TILE_GET_INFO_MEMBER(mikie_state::get_bg_tile_info)
+{
+ int const code = m_videoram[tile_index] + ((m_colorram[tile_index] & 0x20) << 3);
+ int const color = (m_colorram[tile_index] & 0x0f) + 16 * m_palettebank;
+ int const flags = ((m_colorram[tile_index] & 0x40) ? TILE_FLIPX : 0) | ((m_colorram[tile_index] & 0x80) ? TILE_FLIPY : 0);
+ if (m_colorram[tile_index] & 0x10)
+ tileinfo.category = 1;
+ else
+ tileinfo.category = 0;
+
+ tileinfo.set(0, code, color, flags);
+}
+void mikie_state::video_start()
+{
+ m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(mikie_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
+}
+
+void mikie_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ for (int offs = 0; offs < m_spriteram.bytes(); offs += 4)
+ {
+ int const gfxbank = (m_spriteram[offs + 2] & 0x40) ? 2 : 1;
+ int const code = (m_spriteram[offs + 2] & 0x3f) + ((m_spriteram[offs + 2] & 0x80) >> 1) + ((m_spriteram[offs] & 0x40) << 1);
+ int const color = (m_spriteram[offs] & 0x0f) + 16 * m_palettebank;
+ int const sx = m_spriteram[offs + 3];
+ int sy = 244 - m_spriteram[offs + 1];
+ int const flipx = ~m_spriteram[offs] & 0x10;
+ int flipy = m_spriteram[offs] & 0x20;
+
+ if (flip_screen())
+ {
+ sy = 242 - sy;
+ flipy = !flipy;
+ }
+
+
+ m_gfxdecode->gfx(gfxbank)->transpen(bitmap, cliprect,
+ code, color,
+ flipx, flipy,
+ sx, sy, 0);
+ }
+}
+
+uint32_t mikie_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_CATEGORY(0), 0);
+ draw_sprites(bitmap, cliprect);
+ m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_CATEGORY(1), 0);
+ return 0;
+}
+
+// machine
/*************************************
*
@@ -66,9 +277,11 @@ Stephh's notes (based on the games M6809 code and some tests) :
*
*************************************/
-uint8_t mikie_state::mikie_sh_timer_r()
+uint8_t mikie_state::sh_timer_r()
{
- int clock = m_audiocpu->total_cycles() / MIKIE_TIMER_RATE;
+ static constexpr int MIKIE_TIMER_RATE = 512;
+
+ int const clock = m_audiocpu->total_cycles() / MIKIE_TIMER_RATE;
return clock;
}
@@ -82,14 +295,10 @@ WRITE_LINE_MEMBER(mikie_state::sh_irqtrigger_w)
}
}
-WRITE_LINE_MEMBER(mikie_state::coin_counter_1_w)
+template <uint8_t Which>
+WRITE_LINE_MEMBER(mikie_state::coin_counter_w)
{
- machine().bookkeeping().coin_counter_w(0, state);
-}
-
-WRITE_LINE_MEMBER(mikie_state::coin_counter_2_w)
-{
- machine().bookkeeping().coin_counter_w(1, state);
+ machine().bookkeeping().coin_counter_w(Which, state);
}
WRITE_LINE_MEMBER(mikie_state::irq_mask_w)
@@ -105,12 +314,12 @@ WRITE_LINE_MEMBER(mikie_state::irq_mask_w)
*
*************************************/
-void mikie_state::mikie_map(address_map &map)
+void mikie_state::main_map(address_map &map)
{
map(0x0000, 0x00ff).ram();
map(0x2000, 0x2007).w("mainlatch", FUNC(ls259_device::write_d0));
map(0x2100, 0x2100).w("watchdog", FUNC(watchdog_timer_device::reset_w));
- map(0x2200, 0x2200).w(FUNC(mikie_state::mikie_palettebank_w));
+ map(0x2200, 0x2200).w(FUNC(mikie_state::palettebank_w));
map(0x2300, 0x2300).nopw(); // ???
map(0x2400, 0x2400).portr("SYSTEM").w("soundlatch", FUNC(generic_latch_8_device::write));
map(0x2401, 0x2401).portr("P1");
@@ -118,11 +327,11 @@ void mikie_state::mikie_map(address_map &map)
map(0x2403, 0x2403).portr("DSW3");
map(0x2500, 0x2500).portr("DSW1");
map(0x2501, 0x2501).portr("DSW2");
- map(0x2800, 0x288f).ram().share("spriteram");
+ map(0x2800, 0x288f).ram().share(m_spriteram);
map(0x2890, 0x37ff).ram();
- map(0x3800, 0x3bff).ram().w(FUNC(mikie_state::mikie_colorram_w)).share("colorram");
- map(0x3c00, 0x3fff).ram().w(FUNC(mikie_state::mikie_videoram_w)).share("videoram");
- map(0x4000, 0x5fff).rom(); // Machine checks for extra rom
+ map(0x3800, 0x3bff).ram().w(FUNC(mikie_state::colorram_w)).share(m_colorram);
+ map(0x3c00, 0x3fff).ram().w(FUNC(mikie_state::videoram_w)).share(m_videoram);
+ map(0x4000, 0x5fff).rom(); // Machine checks for extra ROM
map(0x6000, 0xffff).rom();
}
@@ -135,7 +344,7 @@ void mikie_state::sound_map(address_map &map)
map(0x8002, 0x8002).w("sn1", FUNC(sn76489a_device::write)); // trigger read of latch
map(0x8003, 0x8003).r("soundlatch", FUNC(generic_latch_8_device::read));
map(0x8004, 0x8004).w("sn2", FUNC(sn76489a_device::write)); // trigger read of latch
- map(0x8005, 0x8005).r(FUNC(mikie_state::mikie_sh_timer_r));
+ map(0x8005, 0x8005).r(FUNC(mikie_state::sh_timer_r));
map(0x8079, 0x8079).nopw(); // ???
map(0xa003, 0xa003).nopw(); // ???
}
@@ -146,7 +355,7 @@ void mikie_state::sound_map(address_map &map)
*
*************************************/
-/* verified from M6809 code */
+// verified from M6809 code
static INPUT_PORTS_START( mikie )
PORT_START("SYSTEM")
KONAMI8_SYSTEM_UNK
@@ -159,7 +368,7 @@ static INPUT_PORTS_START( mikie )
PORT_START("DSW1")
KONAMI_COINAGE_LOC(DEF_STR( Free_Play ), "No Coin B", SW1)
- /* "No Coin B" = coins produce sound, but no effect on coin counter */
+ // "No Coin B" = coins produce sound, but no effect on coin counter
PORT_START("DSW2")
PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:1,2")
@@ -184,7 +393,7 @@ static INPUT_PORTS_START( mikie )
PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- /* DSW3 is not mounted on PCB nor listed in manual */
+ // DSW3 is not mounted on PCB nor listed in manual
PORT_START("DSW3")
PORT_DIPNAME( 0x01, 0x00, DEF_STR( Flip_Screen ) )
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
@@ -204,17 +413,6 @@ 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 bitplanes are packed */
- { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4 },
- { 0*4*8, 1*4*8, 2*4*8, 3*4*8, 4*4*8, 5*4*8, 6*4*8, 7*4*8 },
- 8*4*8 /* every char takes 32 consecutive bytes */
-};
-
static const gfx_layout spritelayout =
{
16,16, /* 16*16 sprites */
@@ -229,9 +427,9 @@ static const gfx_layout spritelayout =
};
static GFXDECODE_START( gfx_mikie )
- GFXDECODE_ENTRY( "gfx1", 0x0000, charlayout, 0, 16*8 )
- GFXDECODE_ENTRY( "gfx2", 0x0000, spritelayout, 16*8*16, 16*8 )
- GFXDECODE_ENTRY( "gfx2", 0x0001, spritelayout, 16*8*16, 16*8 )
+ GFXDECODE_ENTRY( "tiles", 0x0000, gfx_8x8x4_packed_msb, 0, 16*8 )
+ GFXDECODE_ENTRY( "sprites", 0x0000, spritelayout, 16*8*16, 16*8 )
+ GFXDECODE_ENTRY( "sprites", 0x0001, spritelayout, 16*8*16, 16*8 )
GFXDECODE_END
@@ -260,16 +458,20 @@ WRITE_LINE_MEMBER(mikie_state::vblank_irq)
void mikie_state::mikie(machine_config &config)
{
- /* basic machine hardware */
- MC6809E(config, m_maincpu, OSC/12); // 9A (surface scratched)
- m_maincpu->set_addrmap(AS_PROGRAM, &mikie_state::mikie_map);
+ static constexpr XTAL AUDIO_XTAL = XTAL(14'318'181);
+ static constexpr XTAL OSC = XTAL(18'432'000);
+ static constexpr XTAL CLK = AUDIO_XTAL / 4;
+
+ // basic machine hardware
+ MC6809E(config, m_maincpu, OSC / 12); // 9A (surface scratched)
+ m_maincpu->set_addrmap(AS_PROGRAM, &mikie_state::main_map);
Z80(config, m_audiocpu, CLK); // 4E (surface scratched)
m_audiocpu->set_addrmap(AS_PROGRAM, &mikie_state::sound_map);
ls259_device &mainlatch(LS259(config, "mainlatch")); // 6I
- mainlatch.q_out_cb<0>().set(FUNC(mikie_state::coin_counter_1_w)); // COIN1
- mainlatch.q_out_cb<1>().set(FUNC(mikie_state::coin_counter_2_w)); // COIN2
+ mainlatch.q_out_cb<0>().set(FUNC(mikie_state::coin_counter_w<0>)); // COIN1
+ mainlatch.q_out_cb<1>().set(FUNC(mikie_state::coin_counter_w<1>)); // COIN2
mainlatch.q_out_cb<2>().set(FUNC(mikie_state::sh_irqtrigger_w)); // SOUNDON
mainlatch.q_out_cb<3>().set_nop(); // END (not used?)
mainlatch.q_out_cb<6>().set(FUNC(mikie_state::flipscreen_w)); // FLIP
@@ -277,25 +479,25 @@ void mikie_state::mikie(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.59);
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(mikie_state::screen_update_mikie));
+ screen.set_screen_update(FUNC(mikie_state::screen_update));
screen.set_palette(m_palette);
screen.screen_vblank().set(FUNC(mikie_state::vblank_irq));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_mikie);
- PALETTE(config, m_palette, FUNC(mikie_state::mikie_palette), 16*8*16+16*8*16, 256);
+ PALETTE(config, m_palette, FUNC(mikie_state::palette), 16*8*16+16*8*16, 256);
- /* sound hardware */
+ // sound hardware
SPEAKER(config, "mono").front_center();
GENERIC_LATCH_8(config, "soundlatch");
- SN76489A(config, "sn1", XTAL/8).add_route(ALL_OUTPUTS, "mono", 0.60);
+ SN76489A(config, "sn1", AUDIO_XTAL / 8).add_route(ALL_OUTPUTS, "mono", 0.60);
SN76489A(config, "sn2", CLK).add_route(ALL_OUTPUTS, "mono", 0.60);
}
@@ -315,10 +517,10 @@ ROM_START( mikie )
ROM_REGION( 0x10000, "audiocpu", 0 )
ROM_LOAD( "n10.6e", 0x0000, 0x2000, CRC(2cf9d670) SHA1(b324b92aff70d7878160128611dd5fdec6949659) )
- ROM_REGION( 0x4000, "gfx1", 0 )
+ ROM_REGION( 0x4000, "tiles", 0 )
ROM_LOAD( "o11.8i", 0x0000, 0x4000, CRC(3c82aaf3) SHA1(c84256ac5fd5e40b197651c56e303c69aae72950) )
- ROM_REGION( 0x10000, "gfx2", 0 )
+ ROM_REGION( 0x10000, "sprites", 0 )
ROM_LOAD( "001.f1", 0x0000, 0x4000, CRC(a2ba0df5) SHA1(873d49c1c2efbb222d1bf63396729d4b7d9477c3) )
ROM_LOAD( "003.f3", 0x4000, 0x4000, CRC(9775ab32) SHA1(0271567c5f5a6bb2eaffb9d5dc2af6b8142dc8a9) )
ROM_LOAD( "005.h1", 0x8000, 0x4000, CRC(ba44aeef) SHA1(410bfd9146242254a920092e280af87586709527) )
@@ -341,10 +543,10 @@ ROM_START( mikiej )
ROM_REGION( 0x10000, "audiocpu", 0 )
ROM_LOAD( "n10.6e", 0x0000, 0x2000, CRC(2cf9d670) SHA1(b324b92aff70d7878160128611dd5fdec6949659) )
- ROM_REGION( 0x4000, "gfx1", 0 )
+ ROM_REGION( 0x4000, "tiles", 0 )
ROM_LOAD( "q11.8i", 0x0000, 0x4000, CRC(c48b269b) SHA1(d7fcfa44fcda90f1a7df6c974210716ae82c47a3) )
- ROM_REGION( 0x10000, "gfx2", 0 )
+ ROM_REGION( 0x10000, "sprites", 0 )
ROM_LOAD( "q01.f1", 0x0000, 0x4000, CRC(31551987) SHA1(b6cbdb8b511d99b27546a6c4d01f2948d5ad3a42) )
ROM_LOAD( "q03.f3", 0x4000, 0x4000, CRC(34414df0) SHA1(0189deac6f19de386b4e49cfe6322b212e74264a) )
ROM_LOAD( "q05.h1", 0x8000, 0x4000, CRC(f9e1ebb1) SHA1(c88c1fc22f21b3e7d558c47de2716dac01fdd621) )
@@ -367,10 +569,10 @@ ROM_START( mikiek )
ROM_REGION( 0x10000, "audiocpu", 0 )
ROM_LOAD( "n10.6e", 0x0000, 0x2000, CRC(2cf9d670) SHA1(b324b92aff70d7878160128611dd5fdec6949659) )
- ROM_REGION( 0x4000, "gfx1", 0 )
+ ROM_REGION( 0x4000, "tiles", 0 )
ROM_LOAD( "q11.8i", 0x0000, 0x4000, CRC(29286fce) SHA1(699706cf7300c98352e355f81ba40635b4380d7a) )
- ROM_REGION( 0x10000, "gfx2", 0 )
+ ROM_REGION( 0x10000, "sprites", 0 )
ROM_LOAD( "q01.f1", 0x0000, 0x4000, CRC(31551987) SHA1(b6cbdb8b511d99b27546a6c4d01f2948d5ad3a42) )
ROM_LOAD( "q03.f3", 0x4000, 0x4000, CRC(707cc98e) SHA1(850c973053f3ae8a93e7c630d69298f25708941e) )
ROM_LOAD( "q05.h1", 0x8000, 0x4000, CRC(f9e1ebb1) SHA1(c88c1fc22f21b3e7d558c47de2716dac01fdd621) )
@@ -393,10 +595,10 @@ ROM_START( mikiehs )
ROM_REGION( 0x10000, "audiocpu", 0 )
ROM_LOAD( "h10.6e", 0x0000, 0x2000, CRC(4ed887d2) SHA1(953218a3b41019e2e52932dd3522741812c46c75) )
- ROM_REGION( 0x4000, "gfx1", 0 )
+ ROM_REGION( 0x4000, "tiles", 0 )
ROM_LOAD( "l11.8i", 0x0000, 0x4000, CRC(5ba9d86b) SHA1(2246795dd68a62efb2c70a9177ee97a58ccb2566) )
- ROM_REGION( 0x10000, "gfx2", 0 )
+ ROM_REGION( 0x10000, "sprites", 0 )
ROM_LOAD( "i01.f1", 0x0000, 0x4000, CRC(0c0cab5f) SHA1(c3eb4c3a432e86f4664329a0de5583cb5de7b6f5) )
ROM_LOAD( "i03.f3", 0x4000, 0x4000, CRC(694da32f) SHA1(02bd83d77f42822e42e48977856dfa0e3abfcab0) )
ROM_LOAD( "i05.h1", 0x8000, 0x4000, CRC(00e357e1) SHA1(d5b46709083d74950d0deedecb4fd631d0e74afb) )
@@ -410,6 +612,9 @@ ROM_START( mikiehs )
ROM_LOAD( "d18.f9", 0x0400, 0x0100, CRC(7396b374) SHA1(fedcc421a61d6623dc9c41b0a3e164efeb50ec7c) ) // sprite lookup table
ROM_END
+} // anonymous namespace
+
+
/*************************************
*
* Game driver(s)
diff --git a/src/mame/konami/mikie.h b/src/mame/konami/mikie.h
deleted file mode 100644
index 6e52f61d107..00000000000
--- a/src/mame/konami/mikie.h
+++ /dev/null
@@ -1,70 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Allard van der Bas
-/*************************************************************************
-
- Mikie
-
-*************************************************************************/
-#ifndef MAME_INCLUDES_MIKIE_H
-#define MAME_INCLUDES_MIKIE_H
-
-#pragma once
-
-#include "emupal.h"
-#include "tilemap.h"
-
-class mikie_state : public driver_device
-{
-public:
- mikie_state(const machine_config &mconfig, device_type type, const char *tag) :
- driver_device(mconfig, type, tag),
- m_spriteram(*this, "spriteram"),
- m_colorram(*this, "colorram"),
- m_videoram(*this, "videoram"),
- m_maincpu(*this, "maincpu"),
- m_audiocpu(*this, "audiocpu"),
- m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "palette")
- { }
-
- void mikie(machine_config &config);
-
-private:
- /* memory pointers */
- required_shared_ptr<uint8_t> m_spriteram;
- required_shared_ptr<uint8_t> m_colorram;
- required_shared_ptr<uint8_t> m_videoram;
-
- /* video-related */
- tilemap_t *m_bg_tilemap = nullptr;
- int m_palettebank = 0;
-
- /* devices */
- required_device<cpu_device> m_maincpu;
- required_device<cpu_device> m_audiocpu;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
-
- uint8_t m_irq_mask = 0;
- uint8_t mikie_sh_timer_r();
- DECLARE_WRITE_LINE_MEMBER(sh_irqtrigger_w);
- DECLARE_WRITE_LINE_MEMBER(coin_counter_1_w);
- DECLARE_WRITE_LINE_MEMBER(coin_counter_2_w);
- DECLARE_WRITE_LINE_MEMBER(irq_mask_w);
- void mikie_videoram_w(offs_t offset, uint8_t data);
- void mikie_colorram_w(offs_t offset, uint8_t data);
- void mikie_palettebank_w(uint8_t data);
- DECLARE_WRITE_LINE_MEMBER(flipscreen_w);
- TILE_GET_INFO_MEMBER(get_bg_tile_info);
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void video_start() override;
- void mikie_palette(palette_device &palette) const;
- uint32_t screen_update_mikie(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 mikie_map(address_map &map);
- void sound_map(address_map &map);
-};
-
-#endif // MAME_INCLUDES_MIKIE_H
diff --git a/src/mame/konami/mikie_v.cpp b/src/mame/konami/mikie_v.cpp
deleted file mode 100644
index 9d0262f5dbc..00000000000
--- a/src/mame/konami/mikie_v.cpp
+++ /dev/null
@@ -1,168 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Allard van der Bas
-/***************************************************************************
-
- video.c
-
- Functions to emulate the video hardware of the machine.
-
-***************************************************************************/
-
-#include "emu.h"
-#include "video/resnet.h"
-#include "mikie.h"
-
-/***************************************************************************
-
- Convert the color PROMs into a more useable format.
-
- Mikie 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 mikie_state::mikie_palette(palette_device &palette) const
-{
- uint8_t const *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);
- m_palette->set_pen_indirect(((i & 0x100) << 3) | (j << 8) | (i & 0xff), ctabentry);
- }
- }
-}
-
-void mikie_state::mikie_videoram_w(offs_t offset, uint8_t data)
-{
- m_videoram[offset] = data;
- m_bg_tilemap->mark_tile_dirty(offset);
-}
-
-void mikie_state::mikie_colorram_w(offs_t offset, uint8_t data)
-{
- m_colorram[offset] = data;
- m_bg_tilemap->mark_tile_dirty(offset);
-}
-
-void mikie_state::mikie_palettebank_w(uint8_t data)
-{
- if (m_palettebank != (data & 0x07))
- {
- m_palettebank = data & 0x07;
- machine().tilemap().mark_all_dirty();
- }
-}
-
-WRITE_LINE_MEMBER(mikie_state::flipscreen_w)
-{
- flip_screen_set(state);
- machine().tilemap().mark_all_dirty();
-}
-
-TILE_GET_INFO_MEMBER(mikie_state::get_bg_tile_info)
-{
- int code = m_videoram[tile_index] + ((m_colorram[tile_index] & 0x20) << 3);
- int color = (m_colorram[tile_index] & 0x0f) + 16 * m_palettebank;
- int flags = ((m_colorram[tile_index] & 0x40) ? TILE_FLIPX : 0) | ((m_colorram[tile_index] & 0x80) ? TILE_FLIPY : 0);
- if (m_colorram[tile_index] & 0x10)
- tileinfo.category = 1;
- else
- tileinfo.category = 0;
-
- tileinfo.set(0, code, color, flags);
-
-
-}
-
-void mikie_state::video_start()
-{
- m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(mikie_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
-}
-
-void mikie_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
- uint8_t *spriteram = m_spriteram;
- int offs;
-
- for (offs = 0; offs < m_spriteram.bytes(); offs += 4)
- {
- int gfxbank = (spriteram[offs + 2] & 0x40) ? 2 : 1;
- int code = (spriteram[offs + 2] & 0x3f) + ((spriteram[offs + 2] & 0x80) >> 1) + ((spriteram[offs] & 0x40) << 1);
- int color = (spriteram[offs] & 0x0f) + 16 * m_palettebank;
- int sx = spriteram[offs + 3];
- int sy = 244 - spriteram[offs + 1];
- int flipx = ~spriteram[offs] & 0x10;
- int flipy = spriteram[offs] & 0x20;
-
- if (flip_screen())
- {
- sy = 242 - sy;
- flipy = !flipy;
- }
-
-
- m_gfxdecode->gfx(gfxbank)->transpen(bitmap,cliprect,
- code, color,
- flipx,flipy,
- sx,sy, 0);
- }
-}
-
-uint32_t mikie_state::screen_update_mikie(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
- m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_CATEGORY(0), 0);
- draw_sprites(bitmap, cliprect);
- m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_CATEGORY(1), 0);
- return 0;
-}
diff --git a/src/mame/konami/pandoras.cpp b/src/mame/konami/pandoras.cpp
index 6429a9d8d8e..590b6400892 100644
--- a/src/mame/konami/pandoras.cpp
+++ b/src/mame/konami/pandoras.cpp
@@ -1,5 +1,6 @@
// license:BSD-3-Clause
-// copyright-holders:Manuel Abadia
+// copyright-holders: Manuel Abadia
+
/***************************************************************************
Pandora's Palace(GX328) (c) 1984 Konami/Interlogic
@@ -24,23 +25,263 @@ Boards:
***************************************************************************/
#include "emu.h"
-#include "pandoras.h"
+
#include "konamipt.h"
#include "cpu/m6809/m6809.h"
+#include "cpu/mcs48/mcs48.h"
#include "cpu/z80/z80.h"
#include "machine/74259.h"
#include "machine/gen_latch.h"
#include "machine/watchdog.h"
#include "sound/ay8910.h"
#include "sound/dac.h"
+#include "video/resnet.h"
+
+#include "emupal.h"
#include "screen.h"
#include "speaker.h"
+#include "tilemap.h"
+
+
+namespace {
+
+class pandoras_state : public driver_device
+{
+public:
+ pandoras_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
+ m_spriteram(*this, "spriteram"),
+ m_colorram(*this, "colorram"),
+ m_videoram(*this, "videoram"),
+ m_maincpu(*this, "maincpu"),
+ m_subcpu(*this, "sub"),
+ m_audiocpu(*this, "audiocpu"),
+ m_mcu(*this, "mcu"),
+ m_gfxdecode(*this, "gfxdecode"),
+ m_palette(*this, "palette")
+ { }
+
+ void pandoras(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<uint8_t> m_spriteram;
+ required_shared_ptr<uint8_t> m_colorram;
+ required_shared_ptr<uint8_t> m_videoram;
+
+ // devices
+ required_device<cpu_device> m_maincpu;
+ required_device<cpu_device> m_subcpu;
+ required_device<cpu_device> m_audiocpu;
+ required_device<i8039_device> m_mcu;
+ required_device<gfxdecode_device> m_gfxdecode;
+ required_device<palette_device> m_palette;
+
+ // video-related
+ tilemap_t *m_layer0 = nullptr;
+
+ uint8_t m_irq_enable_a = 0;
+ uint8_t m_irq_enable_b = 0;
+ uint8_t m_firq_old_data_a = 0;
+ uint8_t m_firq_old_data_b = 0;
+ uint8_t m_i8039_status = 0;
+
+ DECLARE_WRITE_LINE_MEMBER(cpua_irq_enable_w);
+ DECLARE_WRITE_LINE_MEMBER(cpub_irq_enable_w);
+ void cpua_irqtrigger_w(uint8_t data);
+ void cpub_irqtrigger_w(uint8_t data);
+ void i8039_irqtrigger_w(uint8_t data);
+ void i8039_irqen_and_status_w(uint8_t data);
+ void z80_irqtrigger_w(uint8_t data);
+ template <uint8_t Which> DECLARE_WRITE_LINE_MEMBER(coin_counter_w);
+ void vram_w(offs_t offset, uint8_t data);
+ void cram_w(offs_t offset, uint8_t data);
+ void scrolly_w(uint8_t data);
+ uint8_t porta_r();
+ uint8_t portb_r();
+ TILE_GET_INFO_MEMBER(get_tile_info0);
+ 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* sr);
+
+ void i8039_io_map(address_map &map);
+ void i8039_map(address_map &map);
+ void master_map(address_map &map);
+ void slave_map(address_map &map);
+ void sound_map(address_map &map);
+};
+
+// video
-#define MASTER_CLOCK XTAL(18'432'000)
-#define SOUND_CLOCK XTAL(14'318'181)
+/***********************************************************************
+ Convert the color PROMs into a more useable format.
+
+ Pandora's Palace 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 pandoras_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
+ for (int i = 0; i < 0x100; i++)
+ {
+ uint8_t const ctabentry = color_prom[i] & 0x0f;
+ palette.set_pen_indirect(i, ctabentry);
+ }
+
+ // characters
+ for (int i = 0x100; i < 0x200; i++)
+ {
+ uint8_t const ctabentry = (color_prom[i] & 0x0f) | 0x10;
+ palette.set_pen_indirect(i, ctabentry);
+ }
+}
+
+/***************************************************************************
+
+ Callbacks for the TileMap code
+
+***************************************************************************/
+
+TILE_GET_INFO_MEMBER(pandoras_state::get_tile_info0)
+{
+ uint8_t const attr = m_colorram[tile_index];
+ tileinfo.set(1,
+ m_videoram[tile_index] + ((attr & 0x10) << 4),
+ attr & 0x0f,
+ TILE_FLIPYX((attr & 0xc0) >> 6));
+ tileinfo.category = (attr & 0x20) >> 5;
+}
+
+/***************************************************************************
+
+ Start the video hardware emulation.
+
+***************************************************************************/
+
+void pandoras_state::video_start()
+{
+ m_layer0 = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(pandoras_state::get_tile_info0)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
+}
+
+/***************************************************************************
+
+ Memory Handlers
+
+***************************************************************************/
+
+void pandoras_state::vram_w(offs_t offset, uint8_t data)
+{
+ m_layer0->mark_tile_dirty(offset);
+ m_videoram[offset] = data;
+}
+
+void pandoras_state::cram_w(offs_t offset, uint8_t data)
+{
+ m_layer0->mark_tile_dirty(offset);
+ m_colorram[offset] = data;
+}
+
+void pandoras_state::scrolly_w(uint8_t data)
+{
+ m_layer0->set_scrolly(0, data);
+}
+
+
+/***************************************************************************
+
+ Screen Refresh
+
+***************************************************************************/
+
+void pandoras_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, uint8_t* sr)
+{
+ for (int offs = 0; offs < 0x100; offs += 4)
+ {
+ int const sx = sr[offs + 1];
+ int const sy = 240 - sr[offs];
+ int const color = sr[offs + 3] & 0x0f;
+ int const nflipx = sr[offs + 3] & 0x40;
+ int const nflipy = sr[offs + 3] & 0x80;
+
+ m_gfxdecode->gfx(0)->transmask(bitmap, cliprect,
+ sr[offs + 2],
+ color,
+ !nflipx, !nflipy,
+ sx, sy,
+ m_palette->transpen_mask(*m_gfxdecode->gfx(0), color, 0));
+ }
+}
+
+uint32_t pandoras_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ m_layer0->draw(screen, bitmap, cliprect, 1 ,0);
+ draw_sprites(bitmap, cliprect, &m_spriteram[0x800]);
+ m_layer0->draw(screen, bitmap, cliprect, 0 ,0);
+ return 0;
+}
+
+
+// machine
WRITE_LINE_MEMBER(pandoras_state::vblank_irq)
{
@@ -64,7 +305,7 @@ WRITE_LINE_MEMBER(pandoras_state::cpub_irq_enable_w)
m_irq_enable_b = state;
}
-void pandoras_state::pandoras_cpua_irqtrigger_w(uint8_t data)
+void pandoras_state::cpua_irqtrigger_w(uint8_t data)
{
if (!m_firq_old_data_a && data)
m_maincpu->set_input_line(M6809_FIRQ_LINE, HOLD_LINE);
@@ -72,7 +313,7 @@ void pandoras_state::pandoras_cpua_irqtrigger_w(uint8_t data)
m_firq_old_data_a = data;
}
-void pandoras_state::pandoras_cpub_irqtrigger_w(uint8_t data)
+void pandoras_state::cpub_irqtrigger_w(uint8_t data)
{
if (!m_firq_old_data_b && data)
m_subcpu->set_input_line(M6809_FIRQ_LINE, HOLD_LINE);
@@ -80,90 +321,86 @@ void pandoras_state::pandoras_cpub_irqtrigger_w(uint8_t data)
m_firq_old_data_b = data;
}
-void pandoras_state::pandoras_i8039_irqtrigger_w(uint8_t data)
+void pandoras_state::i8039_irqtrigger_w(uint8_t data)
{
m_mcu->set_input_line(0, ASSERT_LINE);
}
void pandoras_state::i8039_irqen_and_status_w(uint8_t data)
{
- /* bit 7 enables IRQ */
+ // bit 7 enables IRQ
if ((data & 0x80) == 0)
m_mcu->set_input_line(0, CLEAR_LINE);
- /* bit 5 goes to 8910 port A */
+ // bit 5 goes to 8910 port A
m_i8039_status = (data & 0x20) >> 5;
}
-void pandoras_state::pandoras_z80_irqtrigger_w(uint8_t data)
+void pandoras_state::z80_irqtrigger_w(uint8_t data)
{
m_audiocpu->set_input_line_and_vector(0, HOLD_LINE, 0xff); // Z80
}
-WRITE_LINE_MEMBER(pandoras_state::coin_counter_1_w)
-{
- machine().bookkeeping().coin_counter_w(0, state);
-}
-
-WRITE_LINE_MEMBER(pandoras_state::coin_counter_2_w)
+template <uint8_t Which>
+WRITE_LINE_MEMBER(pandoras_state::coin_counter_w)
{
- machine().bookkeeping().coin_counter_w(1, state);
+ machine().bookkeeping().coin_counter_w(Which, state);
}
-void pandoras_state::pandoras_master_map(address_map &map)
+void pandoras_state::master_map(address_map &map)
{
- map(0x0000, 0x0fff).ram().share("spriteram"); /* Work RAM (Shared with CPU B) */
- map(0x1000, 0x13ff).ram().w(FUNC(pandoras_state::pandoras_cram_w)).share("colorram"); /* Color RAM (shared with CPU B) */
- map(0x1400, 0x17ff).ram().w(FUNC(pandoras_state::pandoras_vram_w)).share("videoram"); /* Video RAM (shared with CPU B) */
- map(0x1800, 0x1807).w("mainlatch", FUNC(ls259_device::write_d0)); /* INT control */
- map(0x1a00, 0x1a00).w(FUNC(pandoras_state::pandoras_scrolly_w)); /* bg scroll */
- map(0x1c00, 0x1c00).w(FUNC(pandoras_state::pandoras_z80_irqtrigger_w)); /* cause INT on the Z80 */
- map(0x1e00, 0x1e00).w("soundlatch", FUNC(generic_latch_8_device::write)); /* sound command to the Z80 */
- map(0x2000, 0x2000).w(FUNC(pandoras_state::pandoras_cpub_irqtrigger_w)); /* cause FIRQ on CPU B */
- map(0x2001, 0x2001).w("watchdog", FUNC(watchdog_timer_device::reset_w)); /* watchdog reset */
- map(0x4000, 0x5fff).rom(); /* space for diagnostic ROM */
- map(0x6000, 0x67ff).ram().share("share4"); /* Shared RAM with CPU B */
- map(0x8000, 0xffff).rom(); /* ROM */
+ map(0x0000, 0x0fff).ram().share(m_spriteram); // shared with CPU B
+ map(0x1000, 0x13ff).ram().w(FUNC(pandoras_state::cram_w)).share(m_colorram); // shared with CPU B
+ map(0x1400, 0x17ff).ram().w(FUNC(pandoras_state::vram_w)).share(m_videoram); // shared with CPU B
+ map(0x1800, 0x1807).w("mainlatch", FUNC(ls259_device::write_d0)); // INT control
+ map(0x1a00, 0x1a00).w(FUNC(pandoras_state::scrolly_w));
+ map(0x1c00, 0x1c00).w(FUNC(pandoras_state::z80_irqtrigger_w));
+ map(0x1e00, 0x1e00).w("soundlatch", FUNC(generic_latch_8_device::write));
+ map(0x2000, 0x2000).w(FUNC(pandoras_state::cpub_irqtrigger_w));
+ map(0x2001, 0x2001).w("watchdog", FUNC(watchdog_timer_device::reset_w));
+ map(0x4000, 0x5fff).rom(); // space for diagnostic ROM
+ map(0x6000, 0x67ff).ram().share("cpua_cpub");
+ map(0x8000, 0xffff).rom();
}
-void pandoras_state::pandoras_slave_map(address_map &map)
+void pandoras_state::slave_map(address_map &map)
{
- map(0x0000, 0x0fff).ram().share("spriteram"); /* Work RAM (Shared with CPU A) */
- map(0x1000, 0x13ff).ram().w(FUNC(pandoras_state::pandoras_cram_w)).share("colorram"); /* Color RAM (shared with CPU A) */
- map(0x1400, 0x17ff).ram().w(FUNC(pandoras_state::pandoras_vram_w)).share("videoram"); /* Video RAM (shared with CPU A) */
+ map(0x0000, 0x0fff).ram().share(m_spriteram); // shared with CPU A
+ map(0x1000, 0x13ff).ram().w(FUNC(pandoras_state::cram_w)).share(m_colorram); // shared with CPU A
+ map(0x1400, 0x17ff).ram().w(FUNC(pandoras_state::vram_w)).share(m_videoram); // shared with CPU A
map(0x1800, 0x1800).portr("DSW1");
- map(0x1800, 0x1807).w("mainlatch", FUNC(ls259_device::write_d0)); /* INT control */
+ map(0x1800, 0x1807).w("mainlatch", FUNC(ls259_device::write_d0)); // INT control
map(0x1a00, 0x1a00).portr("SYSTEM");
map(0x1a01, 0x1a01).portr("P1");
map(0x1a02, 0x1a02).portr("P2");
map(0x1a03, 0x1a03).portr("DSW3");
map(0x1c00, 0x1c00).portr("DSW2");
-// map(0x1e00, 0x1e00).nopr(); /* ??? seems to be important */
- map(0x8000, 0x8000).w("watchdog", FUNC(watchdog_timer_device::reset_w)); /* watchdog reset */
- map(0xa000, 0xa000).w(FUNC(pandoras_state::pandoras_cpua_irqtrigger_w)); /* cause FIRQ on CPU A */
- map(0xc000, 0xc7ff).ram().share("share4"); /* Shared RAM with the CPU A */
- map(0xe000, 0xffff).rom(); /* ROM */
+// map(0x1e00, 0x1e00).nopr(); // ??? seems to be important
+ map(0x8000, 0x8000).w("watchdog", FUNC(watchdog_timer_device::reset_w));
+ map(0xa000, 0xa000).w(FUNC(pandoras_state::cpua_irqtrigger_w));
+ map(0xc000, 0xc7ff).ram().share("cpua_cpub");
+ map(0xe000, 0xffff).rom();
}
-void pandoras_state::pandoras_sound_map(address_map &map)
+void pandoras_state::sound_map(address_map &map)
{
- map(0x0000, 0x1fff).rom(); /* ROM */
- map(0x2000, 0x23ff).ram(); /* RAM */
+ map(0x0000, 0x1fff).rom();
+ map(0x2000, 0x23ff).ram();
map(0x4000, 0x4000).r("soundlatch", FUNC(generic_latch_8_device::read));
- map(0x6000, 0x6000).w("aysnd", FUNC(ay8910_device::address_w)); /* AY-8910 */
- map(0x6001, 0x6001).r("aysnd", FUNC(ay8910_device::data_r)); /* AY-8910 */
- map(0x6002, 0x6002).w("aysnd", FUNC(ay8910_device::data_w)); /* AY-8910 */
- map(0x8000, 0x8000).w(FUNC(pandoras_state::pandoras_i8039_irqtrigger_w)); /* cause INT on the 8039 */
- map(0xa000, 0xa000).w("soundlatch2", FUNC(generic_latch_8_device::write)); /* sound command to the 8039 */
+ map(0x6000, 0x6000).w("aysnd", FUNC(ay8910_device::address_w));
+ map(0x6001, 0x6001).r("aysnd", FUNC(ay8910_device::data_r));
+ map(0x6002, 0x6002).w("aysnd", FUNC(ay8910_device::data_w));
+ map(0x8000, 0x8000).w(FUNC(pandoras_state::i8039_irqtrigger_w));
+ map(0xa000, 0xa000).w("soundlatch2", FUNC(generic_latch_8_device::write));
}
-void pandoras_state::pandoras_i8039_map(address_map &map)
+void pandoras_state::i8039_map(address_map &map)
{
map(0x0000, 0x0fff).rom();
}
-void pandoras_state::pandoras_i8039_io_map(address_map &map)
+void pandoras_state::i8039_io_map(address_map &map)
{
map(0x00, 0xff).r("soundlatch2", FUNC(generic_latch_8_device::read));
}
@@ -178,7 +415,7 @@ void pandoras_state::pandoras_i8039_io_map(address_map &map)
static INPUT_PORTS_START( pandoras )
PORT_START("DSW1")
KONAMI_COINAGE_LOC(DEF_STR( Free_Play ), "No Coin B", SW1)
- /* "No Coin B" = coins produce sound, but no effect on coin counter */
+ // "No Coin B" = coins produce sound, but no effect on coin counter
PORT_START("DSW2")
PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:1,2")
@@ -257,8 +494,8 @@ static const gfx_layout spritelayout =
};
static GFXDECODE_START( gfx_pandoras )
- GFXDECODE_ENTRY( "gfx1", 0, spritelayout, 0, 16 )
- GFXDECODE_ENTRY( "gfx2", 0, gfx_8x8x4_packed_msb, 16*16, 16 )
+ GFXDECODE_ENTRY( "sprites", 0, spritelayout, 0, 16 )
+ GFXDECODE_ENTRY( "tiles", 0, gfx_8x8x4_packed_msb, 16*16, 16 )
GFXDECODE_END
/***************************************************************************
@@ -283,69 +520,72 @@ void pandoras_state::machine_reset()
m_i8039_status = 0;
}
-uint8_t pandoras_state::pandoras_portA_r()
+uint8_t pandoras_state::porta_r()
{
return m_i8039_status;
}
-uint8_t pandoras_state::pandoras_portB_r()
+uint8_t pandoras_state::portb_r()
{
return (m_audiocpu->total_cycles() / 512) & 0x0f;
}
void pandoras_state::pandoras(machine_config &config)
{
- /* basic machine hardware */
- MC6809E(config, m_maincpu, MASTER_CLOCK/6); /* CPU A */
- m_maincpu->set_addrmap(AS_PROGRAM, &pandoras_state::pandoras_master_map);
+ static constexpr XTAL MASTER_CLOCK = XTAL(18'432'000);
+ static constexpr XTAL SOUND_CLOCK = XTAL(14'318'181);
- MC6809E(config, m_subcpu, MASTER_CLOCK/6); /* CPU B */
- m_subcpu->set_addrmap(AS_PROGRAM, &pandoras_state::pandoras_slave_map);
+ // basic machine hardware
+ MC6809E(config, m_maincpu, MASTER_CLOCK / 6); // CPU A
+ m_maincpu->set_addrmap(AS_PROGRAM, &pandoras_state::master_map);
- Z80(config, m_audiocpu, SOUND_CLOCK/8);
- m_audiocpu->set_addrmap(AS_PROGRAM, &pandoras_state::pandoras_sound_map);
+ MC6809E(config, m_subcpu, MASTER_CLOCK / 6); // CPU B
+ m_subcpu->set_addrmap(AS_PROGRAM, &pandoras_state::slave_map);
- I8039(config, m_mcu, SOUND_CLOCK/2);
- m_mcu->set_addrmap(AS_PROGRAM, &pandoras_state::pandoras_i8039_map);
- m_mcu->set_addrmap(AS_IO, &pandoras_state::pandoras_i8039_io_map);
+ Z80(config, m_audiocpu, SOUND_CLOCK / 8);
+ m_audiocpu->set_addrmap(AS_PROGRAM, &pandoras_state::sound_map);
+
+ I8039(config, m_mcu, SOUND_CLOCK / 2);
+ m_mcu->set_addrmap(AS_PROGRAM, &pandoras_state::i8039_map);
+ m_mcu->set_addrmap(AS_IO, &pandoras_state::i8039_io_map);
m_mcu->p1_out_cb().set("dac", FUNC(dac_byte_interface::data_w));
m_mcu->p2_out_cb().set(FUNC(pandoras_state::i8039_irqen_and_status_w));
- config.set_maximum_quantum(attotime::from_hz(6000)); /* 100 CPU slices per frame - needed for correct synchronization of the sound CPUs */
+ config.set_maximum_quantum(attotime::from_hz(6000)); // 100 CPU slices per frame - needed for correct synchronization of the sound CPUs
ls259_device &mainlatch(LS259(config, "mainlatch")); // C3
mainlatch.q_out_cb<0>().set(FUNC(pandoras_state::cpua_irq_enable_w)); // ENA
mainlatch.q_out_cb<1>().set_nop(); // OFSET - unknown
- mainlatch.q_out_cb<2>().set(FUNC(pandoras_state::coin_counter_1_w));
- mainlatch.q_out_cb<3>().set(FUNC(pandoras_state::coin_counter_2_w));
- mainlatch.q_out_cb<5>().set(FUNC(pandoras_state::flipscreen_w)); // FLIP
+ mainlatch.q_out_cb<2>().set(FUNC(pandoras_state::coin_counter_w<0>));
+ mainlatch.q_out_cb<3>().set(FUNC(pandoras_state::coin_counter_w<1>));
+ mainlatch.q_out_cb<5>().set(FUNC(pandoras_state::flip_screen_set)); // FLIP
mainlatch.q_out_cb<6>().set(FUNC(pandoras_state::cpub_irq_enable_w)); // ENB
mainlatch.q_out_cb<7>().set_inputline(m_subcpu, INPUT_LINE_RESET).invert(); // RESETB
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(pandoras_state::screen_update_pandoras));
+ screen.set_screen_update(FUNC(pandoras_state::screen_update));
screen.set_palette(m_palette);
screen.screen_vblank().set(FUNC(pandoras_state::vblank_irq));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_pandoras);
- PALETTE(config, m_palette, FUNC(pandoras_state::pandoras_palette), 16*16+16*16, 32);
+ PALETTE(config, m_palette, FUNC(pandoras_state::palette), 16*16+16*16, 32);
- /* sound hardware */
+ // sound hardware
SPEAKER(config, "speaker").front_center();
GENERIC_LATCH_8(config, "soundlatch");
GENERIC_LATCH_8(config, "soundlatch2");
- ay8910_device &aysnd(AY8910(config, "aysnd", SOUND_CLOCK/8));
- aysnd.port_a_read_callback().set(FUNC(pandoras_state::pandoras_portA_r)); // not used
- aysnd.port_b_read_callback().set(FUNC(pandoras_state::pandoras_portB_r));
+ ay8910_device &aysnd(AY8910(config, "aysnd", SOUND_CLOCK / 8));
+ aysnd.port_a_read_callback().set(FUNC(pandoras_state::porta_r)); // not used
+ aysnd.port_b_read_callback().set(FUNC(pandoras_state::portb_r));
aysnd.add_route(ALL_OUTPUTS, "speaker", 0.4);
DAC_8BIT_R2R(config, "dac", 0).add_route(ALL_OUTPUTS, "speaker", 0.12); // unknown DAC
@@ -397,35 +637,37 @@ KOSUKA
*/
ROM_START( pandoras )
- ROM_REGION( 0x10000, "maincpu", 0 ) /* 64K for the CPU A */
+ ROM_REGION( 0x10000, "maincpu", 0 )
ROM_LOAD( "pand_j13.cpu", 0x08000, 0x02000, CRC(7a0fe9c5) SHA1(e68c8d76d1abb69ac72b0e2cd8c1dfc540064ee3) )
ROM_LOAD( "pand_j12.cpu", 0x0a000, 0x02000, CRC(7dc4bfe1) SHA1(359c3051e5d7a34d0e49578e4c168fd19c73e202) )
ROM_LOAD( "pand_j10.cpu", 0x0c000, 0x02000, CRC(be3af3b7) SHA1(91321b53e17e58b674104cb95b1c35ee8fecae22) )
ROM_LOAD( "pand_j9.cpu", 0x0e000, 0x02000, CRC(e674a17a) SHA1(a4b096dc455425dd60298acf2203659ef6f8d857) )
- ROM_REGION( 0x10000, "sub", 0 ) /* 64K for the CPU B */
+ ROM_REGION( 0x10000, "sub", 0 )
ROM_LOAD( "pand_j5.cpu", 0x0e000, 0x02000, CRC(4aab190b) SHA1(d2204953d6b6b34cea851bfc9c2b31426e75f90b) )
- ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64K for the Sound CPU */
+ ROM_REGION( 0x10000, "audiocpu", 0 )
ROM_LOAD( "pand_6c.snd", 0x00000, 0x02000, CRC(0c1f109d) SHA1(4e6cdee99261764bd2fea5abbd49d800baba0dc5) )
- ROM_REGION( 0x2000, "mcu", 0 ) /* 4K for the Sound CPU 2 (Data is mirrored to fit into an 8K rom) */
+ ROM_REGION( 0x2000, "mcu", 0 )
ROM_LOAD( "pand_7e.snd", 0x00000, 0x02000, CRC(1071c1ba) SHA1(3693be69f4b32fb3031bcdee8cac0d46ec8c2804) )
- ROM_REGION( 0x6000, "gfx1", 0 )
- ROM_LOAD( "pand_j18.cpu", 0x00000, 0x02000, CRC(99a696c5) SHA1(35a27cd5ecc51a9a1acf01eb8078a1028f03be32) ) /* sprites */
+ ROM_REGION( 0x6000, "sprites", 0 )
+ ROM_LOAD( "pand_j18.cpu", 0x00000, 0x02000, CRC(99a696c5) SHA1(35a27cd5ecc51a9a1acf01eb8078a1028f03be32) )
ROM_LOAD( "pand_j17.cpu", 0x02000, 0x02000, CRC(38a03c21) SHA1(b0c8f642787bab3cd1d76657e56f07f4f6f9073c) )
ROM_LOAD( "pand_j16.cpu", 0x04000, 0x02000, CRC(e0708a78) SHA1(9dbd08b6ca8a66a61e128d1806888696273de848) )
- ROM_REGION( 0x4000, "gfx2", 0 )
- ROM_LOAD( "pand_a18.cpu", 0x00000, 0x02000, CRC(23706d4a) SHA1(cca92e6ff90e3006a79a214f1211fd659771de53) ) /* tiles */
+ ROM_REGION( 0x4000, "tiles", 0 )
+ ROM_LOAD( "pand_a18.cpu", 0x00000, 0x02000, CRC(23706d4a) SHA1(cca92e6ff90e3006a79a214f1211fd659771de53) )
ROM_LOAD( "pand_a19.cpu", 0x02000, 0x02000, CRC(a463b3f9) SHA1(549b7ee6e47325b80186441da11879fb8b1b47be) )
ROM_REGION( 0x0220, "proms", 0 )
- ROM_LOAD( "pandora.2a", 0x0000, 0x020, CRC(4d56f939) SHA1(a8dac604bfdaf4b153b75dbf165de113152b6daa) ) /* palette */
- ROM_LOAD( "pandora.17g", 0x0020, 0x100, CRC(c1a90cfc) SHA1(c6581f2d543e38f1de399774183cf0698e61dab5) ) /* sprite lookup table */
- ROM_LOAD( "pandora.16b", 0x0120, 0x100, CRC(c89af0c3) SHA1(4072c8d61521b34ce4dbce1d48f546402e9539cd) ) /* character lookup table */
+ ROM_LOAD( "pandora.2a", 0x0000, 0x020, CRC(4d56f939) SHA1(a8dac604bfdaf4b153b75dbf165de113152b6daa) ) // palette
+ ROM_LOAD( "pandora.17g", 0x0020, 0x100, CRC(c1a90cfc) SHA1(c6581f2d543e38f1de399774183cf0698e61dab5) ) // sprite lookup table
+ ROM_LOAD( "pandora.16b", 0x0120, 0x100, CRC(c89af0c3) SHA1(4072c8d61521b34ce4dbce1d48f546402e9539cd) ) // character lookup table
ROM_END
+} // anonymous namespace
+
GAME( 1984, pandoras, 0, pandoras, pandoras, pandoras_state, empty_init, ROT90, "Konami / Interlogic", "Pandora's Palace", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/konami/pandoras.h b/src/mame/konami/pandoras.h
deleted file mode 100644
index 66bed6af80c..00000000000
--- a/src/mame/konami/pandoras.h
+++ /dev/null
@@ -1,87 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Manuel Abadia
-/*************************************************************************
-
- Pandora's Palace
-
-*************************************************************************/
-#ifndef MAME_INCLUDES_PANDORAS_H
-#define MAME_INCLUDES_PANDORAS_H
-
-#pragma once
-
-#include "cpu/mcs48/mcs48.h"
-#include "emupal.h"
-#include "tilemap.h"
-
-class pandoras_state : public driver_device
-{
-public:
- pandoras_state(const machine_config &mconfig, device_type type, const char *tag) :
- driver_device(mconfig, type, tag),
- m_spriteram(*this, "spriteram"),
- m_colorram(*this, "colorram"),
- m_videoram(*this, "videoram"),
- m_maincpu(*this, "maincpu"),
- m_subcpu(*this, "sub"),
- m_audiocpu(*this, "audiocpu"),
- m_mcu(*this, "mcu"),
- m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "palette")
- { }
-
- /* memory pointers */
- required_shared_ptr<uint8_t> m_spriteram;
- required_shared_ptr<uint8_t> m_colorram;
- required_shared_ptr<uint8_t> m_videoram;
-
- /* video-related */
- tilemap_t *m_layer0 = nullptr;
- int m_flipscreen = 0;
-
- int m_irq_enable_a = 0;
- int m_irq_enable_b = 0;
- int m_firq_old_data_a = 0;
- int m_firq_old_data_b = 0;
- int m_i8039_status = 0;
-
- /* devices */
- required_device<cpu_device> m_maincpu;
- required_device<cpu_device> m_subcpu;
- required_device<cpu_device> m_audiocpu;
- required_device<i8039_device> m_mcu;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
-
- DECLARE_WRITE_LINE_MEMBER(cpua_irq_enable_w);
- DECLARE_WRITE_LINE_MEMBER(cpub_irq_enable_w);
- void pandoras_cpua_irqtrigger_w(uint8_t data);
- void pandoras_cpub_irqtrigger_w(uint8_t data);
- void pandoras_i8039_irqtrigger_w(uint8_t data);
- void i8039_irqen_and_status_w(uint8_t data);
- void pandoras_z80_irqtrigger_w(uint8_t data);
- DECLARE_WRITE_LINE_MEMBER(coin_counter_1_w);
- DECLARE_WRITE_LINE_MEMBER(coin_counter_2_w);
- void pandoras_vram_w(offs_t offset, uint8_t data);
- void pandoras_cram_w(offs_t offset, uint8_t data);
- void pandoras_scrolly_w(uint8_t data);
- DECLARE_WRITE_LINE_MEMBER(flipscreen_w);
- uint8_t pandoras_portA_r();
- uint8_t pandoras_portB_r();
- TILE_GET_INFO_MEMBER(get_tile_info0);
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void video_start() override;
- void pandoras_palette(palette_device &palette) const;
- uint32_t screen_update_pandoras(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* sr );
- void pandoras(machine_config &config);
- void pandoras_i8039_io_map(address_map &map);
- void pandoras_i8039_map(address_map &map);
- void pandoras_master_map(address_map &map);
- void pandoras_slave_map(address_map &map);
- void pandoras_sound_map(address_map &map);
-};
-
-#endif // MAME_INCLUDES_PANDORAS_H
diff --git a/src/mame/konami/pandoras_v.cpp b/src/mame/konami/pandoras_v.cpp
deleted file mode 100644
index e64580cb292..00000000000
--- a/src/mame/konami/pandoras_v.cpp
+++ /dev/null
@@ -1,173 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Manuel Abadia
-#include "emu.h"
-#include "pandoras.h"
-#include "video/resnet.h"
-
-/***********************************************************************
-
- Convert the color PROMs into a more useable format.
-
- Pandora's Palace 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 pandoras_state::pandoras_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
- for (int i = 0; i < 0x100; i++)
- {
- uint8_t const ctabentry = color_prom[i] & 0x0f;
- palette.set_pen_indirect(i, ctabentry);
- }
-
- // characters
- for (int i = 0x100; i < 0x200; i++)
- {
- uint8_t const ctabentry = (color_prom[i] & 0x0f) | 0x10;
- palette.set_pen_indirect(i, ctabentry);
- }
-}
-
-/***************************************************************************
-
- Callbacks for the TileMap code
-
-***************************************************************************/
-
-TILE_GET_INFO_MEMBER(pandoras_state::get_tile_info0)
-{
- uint8_t attr = m_colorram[tile_index];
- tileinfo.set(1,
- m_videoram[tile_index] + ((attr & 0x10) << 4),
- attr & 0x0f,
- TILE_FLIPYX((attr & 0xc0) >> 6));
- tileinfo.category = (attr & 0x20) >> 5;
-}
-
-/***************************************************************************
-
- Start the video hardware emulation.
-
-***************************************************************************/
-
-void pandoras_state::video_start()
-{
- m_layer0 = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(pandoras_state::get_tile_info0)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
-
- save_item(NAME(m_flipscreen));
-}
-
-/***************************************************************************
-
- Memory Handlers
-
-***************************************************************************/
-
-void pandoras_state::pandoras_vram_w(offs_t offset, uint8_t data)
-{
- m_layer0->mark_tile_dirty(offset);
- m_videoram[offset] = data;
-}
-
-void pandoras_state::pandoras_cram_w(offs_t offset, uint8_t data)
-{
- m_layer0->mark_tile_dirty(offset);
- m_colorram[offset] = data;
-}
-
-void pandoras_state::pandoras_scrolly_w(uint8_t data)
-{
- m_layer0->set_scrolly(0, data);
-}
-
-WRITE_LINE_MEMBER(pandoras_state::flipscreen_w)
-{
- m_flipscreen = state;
- machine().tilemap().set_flip_all(m_flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
-}
-
-/***************************************************************************
-
- Screen Refresh
-
-***************************************************************************/
-
-void pandoras_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, uint8_t* sr )
-{
- int offs;
-
- for (offs = 0; offs < 0x100; offs += 4)
- {
- int sx = sr[offs + 1];
- int sy = 240 - sr[offs];
- int color = sr[offs + 3] & 0x0f;
- int nflipx = sr[offs + 3] & 0x40;
- int nflipy = sr[offs + 3] & 0x80;
-
- m_gfxdecode->gfx(0)->transmask(bitmap,cliprect,
- sr[offs + 2],
- color,
- !nflipx,!nflipy,
- sx,sy,
- m_palette->transpen_mask(*m_gfxdecode->gfx(0), color, 0));
- }
-}
-
-uint32_t pandoras_state::screen_update_pandoras(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
- m_layer0->draw(screen, bitmap, cliprect, 1 ,0);
- draw_sprites(bitmap, cliprect, &m_spriteram[0x800] );
- m_layer0->draw(screen, bitmap, cliprect, 0 ,0);
- return 0;
-}
diff --git a/src/mame/konami/pingpong.cpp b/src/mame/konami/pingpong.cpp
index 613ae0da3ab..78e5cd60afe 100644
--- a/src/mame/konami/pingpong.cpp
+++ b/src/mame/konami/pingpong.cpp
@@ -1,108 +1,333 @@
// license:BSD-3-Clause
-// copyright-holders:Jarek Parchanski
+// copyright-holders: Jarek Parchanski
+
/***************************************************************************
Ping Pong (c) 1985 Konami
+GX555
***************************************************************************/
#include "emu.h"
-#include "pingpong.h"
#include "cpu/z80/z80.h"
#include "sound/sn76496.h"
#include "machine/nvram.h"
+#include "machine/timer.h"
#include "machine/watchdog.h"
+
+#include "emupal.h"
#include "screen.h"
#include "speaker.h"
+#include "tilemap.h"
+
+namespace {
+class pingpong_state : public driver_device
+{
+public:
+ pingpong_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
+ m_maincpu(*this,"maincpu"),
+ m_colorram(*this, "colorram"),
+ m_videoram(*this, "videoram"),
+ m_spriteram(*this, "spriteram"),
+ m_gfxdecode(*this, "gfxdecode"),
+ m_palette(*this, "palette")
+ { }
+
+ void merlinmm(machine_config &config);
+ void pingpong(machine_config &config);
+
+ void init_merlinmm();
+
+protected:
+ virtual void video_start() override;
+
+ required_device<cpu_device> m_maincpu;
+
+ void merlinmm_map(address_map &map);
+
+private:
+ required_shared_ptr<uint8_t> m_colorram;
+ required_shared_ptr<uint8_t> m_videoram;
+ required_shared_ptr<uint8_t> m_spriteram;
+ required_device<gfxdecode_device> m_gfxdecode;
+ required_device<palette_device> m_palette;
+
+ tilemap_t *m_bg_tilemap = nullptr;
+ uint8_t m_int_enable = 0;
+
+ void coin_w(uint8_t data);
+ 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);
+ TIMER_DEVICE_CALLBACK_MEMBER(pingpong_interrupt);
+ TIMER_DEVICE_CALLBACK_MEMBER(merlinmm_interrupt);
+ void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
+
+ void pingpong_map(address_map &map);
+};
-void pingpong_state::cashquiz_question_bank_high_w(uint8_t data)
+class cashquiz_state : public pingpong_state
{
- if( data != 0xff )
+public:
+ cashquiz_state(const machine_config &mconfig, device_type type, const char *tag) :
+ pingpong_state(mconfig, type, tag),
+ m_banks(*this, "bank%d", 1U)
+ { }
+
+ void cashquiz(machine_config &config);
+
+ void init_cashquiz();
+
+protected:
+ virtual void machine_start() override;
+
+private:
+ required_memory_bank_array<8> m_banks;
+
+ uint32_t m_question_addr_high = 0;
+
+ void question_bank_high_w(uint8_t data);
+ void question_bank_low_w(uint8_t data);
+
+ void prg_map(address_map &map);
+};
+
+
+// video
+
+/***************************************************************************
+
+ Convert the color PROMs into a more useable format.
+
+ Ping Pong has a 32 bytes palette PROM and two 256 bytes color lookup table
+ PROMs (one for sprites, one for characters).
+ I don't know for sure how the palette PROM is connected to the RGB output,
+ but it's probably the usual:
+
+ 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 pingpong_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 < 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 = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ // blue component
+ bit0 = 0;
+ bit1 = BIT(color_prom[i], 6);
+ bit2 = BIT(color_prom[i], 7);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ palette.set_indirect_color(i, rgb_t(r, g, b));
+ }
+
+ // color_prom now points to the beginning of the lookup table
+ color_prom += 0x20;
+
+ // characters
+ for (int i = 0; i < 0x100; i++)
{
- int i;
+ uint8_t const ctabentry = (color_prom[i] & 0x0f) | 0x10;
+ palette.set_pen_indirect(i, ctabentry);
+ }
+
+ // sprites
+ for (int i = 0x100; i < 0x200; i++)
+ {
+ uint8_t const ctabentry = bitswap<8>(color_prom[i], 7, 6, 5, 4, 0, 1, 2, 3);
+ palette.set_pen_indirect(i, ctabentry);
+ }
+}
+
+void pingpong_state::videoram_w(offs_t offset, uint8_t data)
+{
+ m_videoram[offset] = data;
+ m_bg_tilemap->mark_tile_dirty(offset);
+}
- for(i=0;i<8;i++)
+void pingpong_state::colorram_w(offs_t offset, uint8_t data)
+{
+ m_colorram[offset] = data;
+ m_bg_tilemap->mark_tile_dirty(offset);
+}
+
+TILE_GET_INFO_MEMBER(pingpong_state::get_bg_tile_info)
+{
+ int const attr = m_colorram[tile_index];
+ int const code = m_videoram[tile_index] + ((attr & 0x20) << 3);
+ int const color = attr & 0x1f;
+ int const flags = ((attr & 0x40) ? TILE_FLIPX : 0) | ((attr & 0x80) ? TILE_FLIPY : 0);
+
+ tileinfo.set(0, code, color, flags);
+}
+
+void pingpong_state::video_start()
+{
+ m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(pingpong_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
+
+ save_item(NAME(m_int_enable));
+}
+
+void pingpong_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ /* This is strange; it's unlikely that the sprites actually have a hardware
+ clipping region, but I haven't found another way to have them masked by
+ the characters at the top and bottom of the screen. */
+ const rectangle spritevisiblearea(0*8, 32*8-1, 4*8, 29*8-1);
+
+ for (int offs = m_spriteram.bytes() - 4;offs >= 0;offs -= 4)
+ {
+ int const sx = m_spriteram[offs + 3];
+ int const sy = 241 - m_spriteram[offs + 1];
+
+ int const flipx = m_spriteram[offs] & 0x40;
+ int const flipy = m_spriteram[offs] & 0x80;
+ int const color = m_spriteram[offs] & 0x1f;
+ int const schar = m_spriteram[offs + 2] & 0x7f;
+
+ m_gfxdecode->gfx(1)->transmask(bitmap, spritevisiblearea,
+ schar,
+ color,
+ flipx, flipy,
+ sx, sy,
+ m_palette->transpen_mask(*m_gfxdecode->gfx(1), color, 0));
+ }
+}
+
+uint32_t pingpong_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 cashquiz_state::machine_start()
+{
+
+ // configure banks and setup defaults
+ for (int i = 0; i < 8; i++)
+ {
+ m_banks[i]->configure_entries(0, 1024, memregion("questions")->base(), 0x100);
+ m_banks[i]->set_entry(i);
+ }
+
+ save_item(NAME(m_question_addr_high));
+}
+
+void cashquiz_state::question_bank_high_w(uint8_t data)
+{
+ if (data != 0xff)
+ {
+ for (int i = 0; i < 8; i++)
{
- if((~data & 0xff) == 1 << i)
+ if ((~data & 0xff) == 1 << i)
{
- m_question_addr_high = i*0x8000;
+ m_question_addr_high = i;
return;
}
}
}
}
-void pingpong_state::cashquiz_question_bank_low_w(uint8_t data)
+void cashquiz_state::question_bank_low_w(uint8_t data)
{
- if(data >= 0x60 && data <= 0xdf)
+ if (data >= 0x60 && data <= 0xdf)
{
- int bankaddr = m_question_addr_high | ((data - 0x60) * 0x100);
- uint8_t *questions = memregion("user1")->base() + bankaddr;
- m_banks[data & 7]->set_base(questions);
-
+ int const bankaddr = (m_question_addr_high << 7) | (data - 0x60);
+ m_banks[data & 7]->set_entry(bankaddr);
}
}
void pingpong_state::coin_w(uint8_t data)
{
- /* bit 2 = irq enable, bit 3 = nmi enable */
- m_intenable = data & 0x0c;
+ // bit 2 = irq enable, bit 3 = nmi enable
+ m_int_enable = data & 0x0c;
- /* bit 0/1 = coin counters */
- machine().bookkeeping().coin_counter_w(0,data & 1);
- machine().bookkeeping().coin_counter_w(1,data & 2);
+ // bit 0/1 = coin counters
+ machine().bookkeeping().coin_counter_w(0, data & 1);
+ machine().bookkeeping().coin_counter_w(1, data & 2);
- /* other bits unknown */
+ // other bits unknown
}
TIMER_DEVICE_CALLBACK_MEMBER(pingpong_state::pingpong_interrupt)
{
- int scanline = param;
+ int const scanline = param;
if (scanline == 240)
{
- if (m_intenable & 0x04) m_maincpu->set_input_line(0, HOLD_LINE);
+ if (m_int_enable & 0x04) m_maincpu->set_input_line(0, HOLD_LINE);
}
else if ((scanline % 32) == 0)
{
- if (m_intenable & 0x08) m_maincpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero);
+ if (m_int_enable & 0x08) m_maincpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero);
}
}
TIMER_DEVICE_CALLBACK_MEMBER(pingpong_state::merlinmm_interrupt)
{
- int scanline = param;
+ int const scanline = param;
if (scanline == 240)
{
- if (m_intenable & 0x04) m_maincpu->set_input_line(0, HOLD_LINE);
+ if (m_int_enable & 0x04) m_maincpu->set_input_line(0, HOLD_LINE);
}
else if (scanline == 0)
{
- if (m_intenable & 0x08) m_maincpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero);
+ if (m_int_enable & 0x08) m_maincpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero);
}
}
void pingpong_state::pingpong_map(address_map &map)
{
map(0x0000, 0x7fff).rom();
- map(0x8000, 0x83ff).ram().w(FUNC(pingpong_state::pingpong_colorram_w)).share("colorram");
- map(0x8400, 0x87ff).ram().w(FUNC(pingpong_state::pingpong_videoram_w)).share("videoram");
+ map(0x8000, 0x83ff).ram().w(FUNC(pingpong_state::colorram_w)).share(m_colorram);
+ map(0x8400, 0x87ff).ram().w(FUNC(pingpong_state::videoram_w)).share(m_videoram);
map(0x9000, 0x9002).ram();
- map(0x9003, 0x9052).ram().share("spriteram");
+ map(0x9003, 0x9052).ram().share(m_spriteram);
map(0x9053, 0x97ff).ram();
+ map(0xa000, 0xa000).w(FUNC(pingpong_state::coin_w)); // coin counters + irq enables
+ map(0xa200, 0xa200).nopw(); // SN76496 data latch
+ map(0xa400, 0xa400).w("snsnd", FUNC(sn76496_device::write)); // trigger read
+ map(0xa600, 0xa600).w("watchdog", FUNC(watchdog_timer_device::reset_w));
map(0xa800, 0xa800).portr("SYSTEM");
map(0xa880, 0xa880).portr("INPUTS");
map(0xa900, 0xa900).portr("DSW1");
map(0xa980, 0xa980).portr("DSW2");
- map(0xa000, 0xa000).w(FUNC(pingpong_state::coin_w)); /* coin counters + irq enables */
- map(0xa200, 0xa200).nopw(); /* SN76496 data latch */
- map(0xa400, 0xa400).w("snsnd", FUNC(sn76496_device::write)); /* trigger read */
- map(0xa600, 0xa600).w("watchdog", FUNC(watchdog_timer_device::reset_w));
}
void pingpong_state::merlinmm_map(address_map &map)
@@ -110,39 +335,39 @@ void pingpong_state::merlinmm_map(address_map &map)
map(0x0000, 0x3fff).rom();
map(0x5000, 0x53ff).ram().share("nvram");
map(0x5400, 0x57ff).ram();
- map(0x6000, 0x6007).nopw(); /* solenoid writes */
+ map(0x6000, 0x6007).nopw(); // solenoid writes
map(0x7000, 0x7000).portr("IN4");
- map(0x8000, 0x83ff).ram().w(FUNC(pingpong_state::pingpong_colorram_w)).share("colorram");
- map(0x8400, 0x87ff).ram().w(FUNC(pingpong_state::pingpong_videoram_w)).share("videoram");
+ map(0x8000, 0x83ff).ram().w(FUNC(pingpong_state::colorram_w)).share(m_colorram);
+ map(0x8400, 0x87ff).ram().w(FUNC(pingpong_state::videoram_w)).share(m_videoram);
map(0x9000, 0x9002).ram();
- map(0x9003, 0x9052).ram().share("spriteram");
+ map(0x9003, 0x9052).ram().share(m_spriteram);
map(0x9053, 0x97ff).ram();
- map(0xa000, 0xa000).w(FUNC(pingpong_state::coin_w)); /* irq enables */
+ map(0xa000, 0xa000).w(FUNC(pingpong_state::coin_w)); // irq enables
map(0xa000, 0xa000).portr("IN0");
map(0xa080, 0xa080).portr("IN1");
map(0xa100, 0xa100).portr("IN2");
map(0xa180, 0xa180).portr("IN3");
- map(0xa200, 0xa200).nopw(); /* SN76496 data latch */
- map(0xa400, 0xa400).w("snsnd", FUNC(sn76496_device::write)); /* trigger read */
+ map(0xa200, 0xa200).nopw(); // SN76496 data latch
+ map(0xa400, 0xa400).w("snsnd", FUNC(sn76496_device::write)); // trigger read
map(0xa600, 0xa600).w("watchdog", FUNC(watchdog_timer_device::reset_w));
}
-void pingpong_state::cashquiz_map(address_map &map)
+void cashquiz_state::prg_map(address_map &map)
{
merlinmm_map(map);
map(0x5000, 0x57ff).unmaprw();
- map(0x4000, 0x4000).w(FUNC(pingpong_state::cashquiz_question_bank_high_w));
- map(0x4001, 0x4001).w(FUNC(pingpong_state::cashquiz_question_bank_low_w));
-
- map(0x5000, 0x50ff).bankr("bank1");
- map(0x5100, 0x51ff).bankr("bank2");
- map(0x5200, 0x52ff).bankr("bank3");
- map(0x5300, 0x53ff).bankr("bank4");
- map(0x5400, 0x54ff).bankr("bank5");
- map(0x5500, 0x55ff).bankr("bank6");
- map(0x5600, 0x56ff).bankr("bank7");
- map(0x5700, 0x57ff).bankr("bank8");
+ map(0x4000, 0x4000).w(FUNC(cashquiz_state::question_bank_high_w));
+ map(0x4001, 0x4001).w(FUNC(cashquiz_state::question_bank_low_w));
+
+ map(0x5000, 0x50ff).bankr(m_banks[0]);
+ map(0x5100, 0x51ff).bankr(m_banks[1]);
+ map(0x5200, 0x52ff).bankr(m_banks[2]);
+ map(0x5300, 0x53ff).bankr(m_banks[3]);
+ map(0x5400, 0x54ff).bankr(m_banks[4]);
+ map(0x5500, 0x55ff).bankr(m_banks[5]);
+ map(0x5600, 0x56ff).bankr(m_banks[6]);
+ map(0x5700, 0x57ff).bankr(m_banks[7]);
}
@@ -433,63 +658,63 @@ INPUT_PORTS_END
static const gfx_layout charlayout =
{
- 8,8, /* 8*8 characters */
- 512, /* 512 characters */
- 2, /* 2 bits per pixel */
- { 4, 0 }, /* the bitplanes are packed in one nibble */
- { 3, 2, 1, 0, 8*8+3, 8*8+2, 8*8+1, 8*8+0 }, /* x bit */
- { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, /* y bit */
- 16*8 /* every char takes 16 consecutive bytes */
+ 8,8, // 8*8 characters
+ 512, // 512 characters
+ 2, // 2 bits per pixel
+ { 4, 0 }, // the bitplanes are packed in one nibble
+ { 3, 2, 1, 0, 8*8+3, 8*8+2, 8*8+1, 8*8+0 }, // x bit
+ { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, // y bit
+ 16*8 // every char takes 16 consecutive bytes
};
static const gfx_layout spritelayout =
{
- 16,16, /* 16*16 sprites */
- 128, /* 128 sprites */
- 2, /* 2 bits per pixel */
- { 4, 0 }, /* the bitplanes are packed in one nibble */
+ 16,16, // 16*16 sprites */
+ 128, // 128 sprites */
+ 2, // 2 bits per pixel */
+ { 4, 0 }, // the bitplanes are packed in one nibble */
{ 12*16+3,12*16+2,12*16+1,12*16+0,
8*16+3, 8*16+2, 8*16+1, 8*16+0,
4*16+3, 4*16+2, 4*16+1, 4*16+0,
- 3, 2, 1, 0 }, /* x bit */
+ 3, 2, 1, 0 }, // x bit
{ 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 }, /* y bit */
- 64*8 /* every char takes 64 consecutive bytes */
+ 32*8, 33*8, 34*8, 35*8, 36*8, 37*8, 38*8, 39*8 }, // y bit
+ 64*8 // every char takes 64 consecutive bytes
};
static GFXDECODE_START( gfx_pingpong )
- GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 64 )
- GFXDECODE_ENTRY( "gfx2", 0, spritelayout, 64*4, 64 )
+ GFXDECODE_ENTRY( "tiles", 0, charlayout, 0, 64 )
+ GFXDECODE_ENTRY( "sprites", 0, spritelayout, 64*4, 64 )
GFXDECODE_END
void pingpong_state::pingpong(machine_config &config)
{
- /* basic machine hardware */
- Z80(config, m_maincpu,18432000/6); /* 3.072 MHz (probably) */
+ // basic machine hardware
+ Z80(config, m_maincpu,18'432'000 / 6); // 3.072 MHz (probably)
m_maincpu->set_addrmap(AS_PROGRAM, &pingpong_state::pingpong_map);
TIMER(config, "scantimer").configure_scanline(FUNC(pingpong_state::pingpong_interrupt), "screen", 0, 1);
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(456, 262);
screen.set_visarea(0*8, 32*8-1, 2*8, 30*8-1);
- screen.set_screen_update(FUNC(pingpong_state::screen_update_pingpong));
+ screen.set_screen_update(FUNC(pingpong_state::screen_update));
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_pingpong);
- PALETTE(config, m_palette, FUNC(pingpong_state::pingpong_palette), 64*4+64*4, 32);
+ PALETTE(config, m_palette, FUNC(pingpong_state::palette), 64*4+64*4, 32);
- /* sound hardware */
+ // sound hardware
SPEAKER(config, "mono").front_center();
- SN76496(config, "snsnd", 18432000/8).add_route(ALL_OUTPUTS, "mono", 1.0);
+ SN76496(config, "snsnd", 18'432'000 / 8).add_route(ALL_OUTPUTS, "mono", 1.0);
}
-/* too fast! */
+// too fast!
void pingpong_state::merlinmm(machine_config &config)
{
pingpong(config);
@@ -499,10 +724,10 @@ void pingpong_state::merlinmm(machine_config &config)
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
}
-void pingpong_state::cashquiz(machine_config &config)
+void cashquiz_state::cashquiz(machine_config &config)
{
merlinmm(config);
- m_maincpu->set_addrmap(AS_PROGRAM, &pingpong_state::cashquiz_map);
+ m_maincpu->set_addrmap(AS_PROGRAM, &cashquiz_state::prg_map);
}
@@ -512,45 +737,45 @@ void pingpong_state::cashquiz(machine_config &config)
***************************************************************************/
-ROM_START( pingpong ) /* GX555 - PWB200222A */
+ROM_START( pingpong ) // GX555 - PWB200222A
ROM_REGION( 0x10000, "maincpu", 0 )
ROM_LOAD( "555_e04.7a", 0x0000, 0x4000, CRC(18552f8f) SHA1(cb03659b5e8a68003e72182a20979384d829280f) )
ROM_LOAD( "555_e03.6a", 0x4000, 0x4000, CRC(ae5f01e8) SHA1(f0d6a2c64822f2662fed3f601e279db18246f894) )
- ROM_REGION( 0x2000, "gfx1", 0 )
+ ROM_REGION( 0x2000, "tiles", 0 )
ROM_LOAD( "555_e01.7h", 0x0000, 0x2000, CRC(d1d6f090) SHA1(7b7d7cb90bed746dda871227463145263e4b0c5a) )
- ROM_REGION( 0x2000, "gfx2", 0 )
+ ROM_REGION( 0x2000, "sprites", 0 )
ROM_LOAD( "555_e02.12c", 0x0000, 0x2000, CRC(33c687e0) SHA1(7c90de4d163d2ffad00c8cb6a194fa6125a4f4c1) )
ROM_REGION( 0x0220, "proms", 0 )
- ROM_LOAD( "555e06.3j", 0x0000, 0x0020, CRC(3e04f06e) SHA1(a642c350f148e062d56eb2a2fc53c470603000e3) ) /* palette (this might be bad) */
- ROM_LOAD( "555e05.5h", 0x0020, 0x0100, CRC(8456046a) SHA1(8226f1325c14eb8aed5cd3c3d6bad9f9fd88c5fa) ) /* characters */
- ROM_LOAD( "555e07.11j", 0x0120, 0x0100, CRC(09d96b08) SHA1(81405e33eacc47f91ea4c7221d122f7e6f5b1e5d) ) /* sprites */
+ ROM_LOAD( "555e06.3j", 0x0000, 0x0020, CRC(3e04f06e) SHA1(a642c350f148e062d56eb2a2fc53c470603000e3) ) // palette (this might be bad)
+ ROM_LOAD( "555e05.5h", 0x0020, 0x0100, CRC(8456046a) SHA1(8226f1325c14eb8aed5cd3c3d6bad9f9fd88c5fa) ) // characters
+ ROM_LOAD( "555e07.11j", 0x0120, 0x0100, CRC(09d96b08) SHA1(81405e33eacc47f91ea4c7221d122f7e6f5b1e5d) ) // sprites
ROM_END
ROM_START( merlinmm )
ROM_REGION( 0x10000, "maincpu", 0 )
ROM_LOAD( "merlinmm.ic2", 0x0000, 0x4000, CRC(ea5b6590) SHA1(fdd5873c67761955e33260743cc45075dea34fb4) )
- ROM_REGION( 0x2000, "gfx1", 0 )
+ ROM_REGION( 0x2000, "tiles", 0 )
ROM_LOAD( "merlinmm.7h", 0x0000, 0x2000, CRC(f7d535aa) SHA1(65f100c15b07ec3aa21f5ed132e2fbf6e9120dbe) )
- ROM_REGION( 0x2000, "gfx2", 0 )
+ ROM_REGION( 0x2000, "sprites", 0 )
ROM_LOAD( "merl_sp.12c", 0x0000, 0x2000, CRC(517ecd57) SHA1(b0d4e2d106cddd6d19acd0e10f2d32544c84a900) )
ROM_REGION( 0x0220, "proms", 0 )
- ROM_LOAD( "merlinmm.3j", 0x0000, 0x0020, CRC(d56e91f4) SHA1(152d88e4d168f697030d96c02ab9aeb220cc765d) ) /* palette */
- ROM_LOAD( "pingpong.5h", 0x0020, 0x0100, CRC(8456046a) SHA1(8226f1325c14eb8aed5cd3c3d6bad9f9fd88c5fa) ) /* characters */
- ROM_LOAD( "pingpong.11j", 0x0120, 0x0100, CRC(09d96b08) SHA1(81405e33eacc47f91ea4c7221d122f7e6f5b1e5d) ) /* sprites */
+ ROM_LOAD( "merlinmm.3j", 0x0000, 0x0020, CRC(d56e91f4) SHA1(152d88e4d168f697030d96c02ab9aeb220cc765d) ) // palette
+ ROM_LOAD( "pingpong.5h", 0x0020, 0x0100, CRC(8456046a) SHA1(8226f1325c14eb8aed5cd3c3d6bad9f9fd88c5fa) ) // characters
+ ROM_LOAD( "pingpong.11j", 0x0120, 0x0100, CRC(09d96b08) SHA1(81405e33eacc47f91ea4c7221d122f7e6f5b1e5d) ) // sprites
ROM_END
ROM_START( cashquiz )
ROM_REGION( 0x10000, "maincpu", 0 )
ROM_LOAD( "cashqcv5.ic3", 0x0000, 0x4000, CRC(8e9e2bed) SHA1(1894d40f89226a810c703ce5e49fdfd64d70287f) )
- /* 0x4000 - 0x7fff = extra hardware for question board */
+ // 0x4000 - 0x7fff = extra hardware for question board
- ROM_REGION( 0x40000, "user1", 0 ) /* Question roms */
+ ROM_REGION( 0x40000, "questions", 0 )
ROM_LOAD( "q30_soaps.ic1", 0x02000, 0x6000, CRC(b35a30ac) SHA1(5daf52a6d973f5a1b1ec3395962bcab690c54e43) )
ROM_CONTINUE( 0x00000, 0x2000 )
ROM_LOAD( "q10.ic2", 0x0a000, 0x6000, CRC(54962e11) SHA1(3c89ac26ebc002b2bc723f1424a7ba3db7a98e5f) )
@@ -568,46 +793,44 @@ ROM_START( cashquiz )
ROM_LOAD( "q19.ic8", 0x3a000, 0x6000, CRC(9f3f77e6) SHA1(aa1600215e774b090f379a0aae520027cd1795c1) )
ROM_CONTINUE( 0x38000, 0x2000 )
- ROM_REGION( 0x2000, "gfx1", 0 )
+ ROM_REGION( 0x2000, "tiles", 0 )
ROM_LOAD( "cashq.7h", 0x0000, 0x2000, CRC(44b72a4f) SHA1(a993f1570cf9d8f86d4229198e9b1a0d6a92e51f) )
- ROM_CONTINUE( 0x0000, 0x2000 ) /* rom is a 27128 in a 2764 socket */
+ ROM_CONTINUE( 0x0000, 0x2000 ) // ROM is a 27128 in a 2764 socket
- ROM_REGION( 0x2000, "gfx2", 0 )
+ ROM_REGION( 0x2000, "sprites", 0 )
ROM_LOAD( "cashq.12c", 0x0000, 0x2000, NO_DUMP ) // missing :-(
ROM_REGION( 0x0220, "proms", 0 )
- ROM_LOAD( "cashquiz.3j", 0x0000, 0x0020, CRC(dc70e23b) SHA1(90948f76d5c61eb57838e013aa93d733913a2d92) ) /* palette */
- ROM_LOAD( "pingpong.5h", 0x0020, 0x0100, CRC(8456046a) SHA1(8226f1325c14eb8aed5cd3c3d6bad9f9fd88c5fa) ) /* characters */
- ROM_LOAD( "pingpong.11j", 0x0120, 0x0100, CRC(09d96b08) SHA1(81405e33eacc47f91ea4c7221d122f7e6f5b1e5d) ) /* sprites */
+ ROM_LOAD( "cashquiz.3j", 0x0000, 0x0020, CRC(dc70e23b) SHA1(90948f76d5c61eb57838e013aa93d733913a2d92) ) // palette
+ ROM_LOAD( "pingpong.5h", 0x0020, 0x0100, CRC(8456046a) SHA1(8226f1325c14eb8aed5cd3c3d6bad9f9fd88c5fa) ) // characters
+ ROM_LOAD( "pingpong.11j", 0x0120, 0x0100, CRC(09d96b08) SHA1(81405e33eacc47f91ea4c7221d122f7e6f5b1e5d) ) // sprites
ROM_END
void pingpong_state::init_merlinmm()
{
- uint8_t *ROM = memregion("maincpu")->base();
+ uint8_t *rom = memregion("maincpu")->base();
- /* decrypt program code */
+ // decrypt program code
for (int i = 0; i < 0x4000; i++)
- ROM[i] = bitswap<8>(ROM[i],0,1,2,3,4,5,6,7);
+ rom[i] = bitswap<8>(rom[i], 0, 1, 2, 3, 4, 5, 6, 7);
}
-void pingpong_state::init_cashquiz()
+void cashquiz_state::init_cashquiz()
{
- /* decrypt program code */
- uint8_t *ROM = memregion("maincpu")->base();
+ // decrypt program code
+ uint8_t *rom = memregion("maincpu")->base();
for (int i = 0; i < 0x4000; i++)
- ROM[i] = bitswap<8>(ROM[i],0,1,2,3,4,5,6,7);
+ rom[i] = bitswap<8>(rom[i], 0, 1, 2, 3, 4, 5, 6, 7);
- /* decrypt questions */
- ROM = memregion("user1")->base();
+ // decrypt questions
+ rom = memregion("questions")->base();
for (int i = 0; i < 0x40000; i++)
- ROM[i] = bitswap<8>(ROM[i],0,1,2,3,4,5,6,7);
-
- // setup default banks
- for(int i=0; i<8; i++)
- m_banks[i]->set_base(memregion("user1")->base() + 0x100*i);
+ rom[i] = bitswap<8>(rom[i], 0, 1, 2, 3, 4, 5, 6, 7);
}
+} // anonymous namespace
+
-GAME( 1985, pingpong, 0, pingpong, pingpong, pingpong_state, empty_init, ROT0, "Konami", "Konami's Ping-Pong", 0 )
-GAME( 1986, merlinmm, 0, merlinmm, merlinmm, pingpong_state, init_merlinmm, ROT90, "Zilec-Zenitone", "Merlins Money Maze", 0 )
-GAME( 1986, cashquiz, 0, cashquiz, cashquiz, pingpong_state, init_cashquiz, ROT0, "Zilec-Zenitone", "Cash Quiz (Type B, Version 5)", MACHINE_IMPERFECT_GRAPHICS )
+GAME( 1985, pingpong, 0, pingpong, pingpong, pingpong_state, empty_init, ROT0, "Konami", "Konami's Ping-Pong", MACHINE_SUPPORTS_SAVE )
+GAME( 1986, merlinmm, 0, merlinmm, merlinmm, pingpong_state, init_merlinmm, ROT90, "Zilec-Zenitone", "Merlins Money Maze", MACHINE_SUPPORTS_SAVE )
+GAME( 1986, cashquiz, 0, cashquiz, cashquiz, cashquiz_state, init_cashquiz, ROT0, "Zilec-Zenitone", "Cash Quiz (Type B, Version 5)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/konami/pingpong.h b/src/mame/konami/pingpong.h
deleted file mode 100644
index 16bea94a9ab..00000000000
--- a/src/mame/konami/pingpong.h
+++ /dev/null
@@ -1,59 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Jarek Parchanski
-#ifndef MAME_INCLUDES_PINGPONG_H
-#define MAME_INCLUDES_PINGPONG_H
-
-#pragma once
-
-#include "machine/timer.h"
-#include "emupal.h"
-#include "tilemap.h"
-
-class pingpong_state : public driver_device
-{
-public:
- pingpong_state(const machine_config &mconfig, device_type type, const char *tag) :
- driver_device(mconfig, type, tag),
- m_maincpu(*this,"maincpu"),
- m_colorram(*this, "colorram"),
- m_videoram(*this, "videoram"),
- m_spriteram(*this, "spriteram"),
- m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "palette"),
- m_banks(*this, "bank%d", 1U)
- { }
-
- int m_intenable = 0;
- int m_question_addr_high = 0;
- required_device<cpu_device> m_maincpu;
- required_shared_ptr<uint8_t> m_colorram;
- required_shared_ptr<uint8_t> m_videoram;
- required_shared_ptr<uint8_t> m_spriteram;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
- optional_memory_bank_array<8> m_banks;
- tilemap_t *m_bg_tilemap = nullptr;
-
- void cashquiz_question_bank_high_w(uint8_t data);
- void cashquiz_question_bank_low_w(uint8_t data);
- void coin_w(uint8_t data);
- void pingpong_videoram_w(offs_t offset, uint8_t data);
- void pingpong_colorram_w(offs_t offset, uint8_t data);
- void init_cashquiz();
- void init_merlinmm();
- TILE_GET_INFO_MEMBER(get_bg_tile_info);
- virtual void video_start() override;
- void pingpong_palette(palette_device &palette) const;
- uint32_t screen_update_pingpong(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- TIMER_DEVICE_CALLBACK_MEMBER(pingpong_interrupt);
- TIMER_DEVICE_CALLBACK_MEMBER(merlinmm_interrupt);
- void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
- void merlinmm(machine_config &config);
- void pingpong(machine_config &config);
- void cashquiz(machine_config &config);
- void merlinmm_map(address_map &map);
- void pingpong_map(address_map &map);
- void cashquiz_map(address_map &map);
-};
-
-#endif // MAME_INCLUDES_PINGPONG_H
diff --git a/src/mame/konami/pingpong_v.cpp b/src/mame/konami/pingpong_v.cpp
deleted file mode 100644
index 60885fd2752..00000000000
--- a/src/mame/konami/pingpong_v.cpp
+++ /dev/null
@@ -1,147 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Jarek Parchanski
-/***************************************************************************
-
- video.c
-
- Functions to emulate the video hardware of the machine.
-
-***************************************************************************/
-
-#include "emu.h"
-#include "pingpong.h"
-
-
-
-/***************************************************************************
-
- Convert the color PROMs into a more useable format.
-
- Ping Pong has a 32 bytes palette PROM and two 256 bytes color lookup table
- PROMs (one for sprites, one for characters).
- I don't know for sure how the palette PROM is connected to the RGB output,
- but it's probably the usual:
-
- 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 pingpong_state::pingpong_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 < 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 = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- // green component
- bit0 = BIT(color_prom[i], 3);
- bit1 = BIT(color_prom[i], 4);
- bit2 = BIT(color_prom[i], 5);
- int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- // blue component
- bit0 = 0;
- bit1 = BIT(color_prom[i], 6);
- bit2 = BIT(color_prom[i], 7);
- int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- palette.set_indirect_color(i, rgb_t(r, g, b));
- }
-
- // color_prom now points to the beginning of the lookup table
- color_prom += 0x20;
-
- // characters
- for (int i = 0; i < 0x100; i++)
- {
- uint8_t const ctabentry = (color_prom[i] & 0x0f) | 0x10;
- palette.set_pen_indirect(i, ctabentry);
- }
-
- // sprites
- for (int i = 0x100; i < 0x200; i++)
- {
- uint8_t const ctabentry = bitswap<8>(color_prom[i],7,6,5,4,0,1,2,3);
- palette.set_pen_indirect(i, ctabentry);
- }
-}
-
-void pingpong_state::pingpong_videoram_w(offs_t offset, uint8_t data)
-{
- m_videoram[offset] = data;
- m_bg_tilemap->mark_tile_dirty(offset);
-}
-
-void pingpong_state::pingpong_colorram_w(offs_t offset, uint8_t data)
-{
- m_colorram[offset] = data;
- m_bg_tilemap->mark_tile_dirty(offset);
-}
-
-TILE_GET_INFO_MEMBER(pingpong_state::get_bg_tile_info)
-{
- int attr = m_colorram[tile_index];
- int code = m_videoram[tile_index] + ((attr & 0x20) << 3);
- int color = attr & 0x1f;
- int flags = ((attr & 0x40) ? TILE_FLIPX : 0) | ((attr & 0x80) ? TILE_FLIPY : 0);
-
- tileinfo.set(0, code, color, flags);
-}
-
-void pingpong_state::video_start()
-{
- m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(pingpong_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
-}
-
-void pingpong_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect )
-{
- /* This is strange; it's unlikely that the sprites actually have a hardware */
- /* clipping region, but I haven't found another way to have them masked by */
- /* the characters at the top and bottom of the screen. */
- const rectangle spritevisiblearea(0*8, 32*8-1, 4*8, 29*8-1);
-
- uint8_t *spriteram = m_spriteram;
- int offs;
-
- for (offs = m_spriteram.bytes() - 4;offs >= 0;offs -= 4)
- {
- int sx,sy,flipx,flipy,color,schar;
-
-
- sx = spriteram[offs + 3];
- sy = 241 - spriteram[offs + 1];
-
- flipx = spriteram[offs] & 0x40;
- flipy = spriteram[offs] & 0x80;
- color = spriteram[offs] & 0x1f;
- schar = spriteram[offs + 2] & 0x7f;
-
- m_gfxdecode->gfx(1)->transmask(bitmap,spritevisiblearea,
- schar,
- color,
- flipx,flipy,
- sx,sy,
- m_palette->transpen_mask(*m_gfxdecode->gfx(1), color, 0));
- }
-}
-
-uint32_t pingpong_state::screen_update_pingpong(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/pooyan.cpp b/src/mame/konami/pooyan.cpp
index 5d5b9e7a7b2..218b16fc386 100644
--- a/src/mame/konami/pooyan.cpp
+++ b/src/mame/konami/pooyan.cpp
@@ -1,8 +1,10 @@
// license:BSD-3-Clause
-// copyright-holders:Allard van der Bas
+// copyright-holders: Allard van der Bas
+
/***************************************************************************
Pooyan
+ GX320
Original driver by Allard van der Bas
@@ -11,22 +13,255 @@
***************************************************************************/
#include "emu.h"
-#include "pooyan.h"
+
#include "konamipt.h"
#include "timeplt_a.h"
#include "cpu/z80/z80.h"
#include "machine/74259.h"
#include "machine/watchdog.h"
+#include "video/resnet.h"
+
+#include "emupal.h"
#include "screen.h"
#include "speaker.h"
+#include "tilemap.h"
+
+
+namespace {
+
+class pooyan_state : public driver_device
+{
+public:
+ pooyan_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_colorram(*this, "colorram"),
+ m_videoram(*this, "videoram"),
+ m_spriteram(*this, "spriteram%u", 1U)
+ { }
+
+ void pooyan(machine_config &config);
+
+protected:
+ virtual void machine_start() override;
+ virtual void video_start() override;
+
+private:
+ // devices
+ required_device<cpu_device> m_maincpu;
+ required_device<gfxdecode_device> m_gfxdecode;
+ required_device<palette_device> m_palette;
+
+ // memory pointers
+ required_shared_ptr<uint8_t> m_colorram;
+ required_shared_ptr<uint8_t> m_videoram;
+ required_shared_ptr_array<uint8_t, 2> m_spriteram;
+
+ // video-related
+ tilemap_t *m_bg_tilemap = nullptr;
+
+ // misc
+ uint8_t m_irq_enable = 0;
+
+ DECLARE_WRITE_LINE_MEMBER(irq_enable_w);
+ template <uint8_t Which> 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);
+ void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
+
+ DECLARE_WRITE_LINE_MEMBER(vblank_irq);
+ void main_map(address_map &map);
+};
+
+
+// video
+
+/***************************************************************************
+
+ Convert the color PROMs into a more useable format.
+
+ Pooyan 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 pooyan_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, rweights, 1000, 0,
+ 3, resistances_rg, gweights, 1000, 0,
+ 2, resistances_b, 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;
+
+ // characters
+ for (int i = 0; i < 0x100; i++)
+ {
+ uint8_t const ctabentry = (color_prom[i] & 0x0f) | 0x10;
+ palette.set_pen_indirect(i, ctabentry);
+ }
+
+ // sprites
+ for (int i = 0x100; i < 0x200; i++)
+ {
+ uint8_t const ctabentry = color_prom[i] & 0x0f;
+ palette.set_pen_indirect(i, ctabentry);
+ }
+}
-#define MASTER_CLOCK XTAL(18'432'000)
+
+/*************************************
+ *
+ * Tilemap info callback
+ *
+ *************************************/
+
+TILE_GET_INFO_MEMBER(pooyan_state::get_bg_tile_info)
+{
+ int const attr = m_colorram[tile_index];
+ int const code = m_videoram[tile_index];
+ int const color = attr & 0x0f;
+ int const flags = TILE_FLIPYX(attr >> 6);
+
+ tileinfo.set(0, code, color, flags);
+}
+
+
+
+/*************************************
+ *
+ * Video startup
+ *
+ *************************************/
+
+void pooyan_state::video_start()
+{
+ m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(pooyan_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
+}
+
/*************************************
*
+ * Memory write handlers
+ *
+ *************************************/
+
+void pooyan_state::videoram_w(offs_t offset, uint8_t data)
+{
+ m_videoram[offset] = data;
+ m_bg_tilemap->mark_tile_dirty(offset);
+}
+
+
+void pooyan_state::colorram_w(offs_t offset, uint8_t data)
+{
+ m_colorram[offset] = data;
+ m_bg_tilemap->mark_tile_dirty(offset);
+}
+
+
+
+/*************************************
+ *
+ * Sprite rendering
+ *
+ *************************************/
+
+void pooyan_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ for (int offs = 0x10; offs < 0x40; offs += 2)
+ {
+ int const sx = m_spriteram[0][offs];
+ int const sy = 240 - m_spriteram[1][offs + 1];
+
+ int const code = m_spriteram[0][offs + 1];
+ int const color = m_spriteram[1][offs] & 0x0f;
+ int const flipx = ~m_spriteram[1][offs] & 0x40;
+ int const flipy = m_spriteram[1][offs] & 0x80;
+
+
+ m_gfxdecode->gfx(1)->transmask(bitmap, cliprect,
+ code,
+ color,
+ flipx, flipy,
+ sx, sy,
+ m_palette->transpen_mask(*m_gfxdecode->gfx(1), color, 0));
+ }
+}
+
+
+
+/*************************************
+ *
+ * Video update
+ *
+ *************************************/
+
+uint32_t pooyan_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
+
+/*************************************
+ *
* Interrupts
*
*************************************/
@@ -46,15 +281,10 @@ WRITE_LINE_MEMBER(pooyan_state::irq_enable_w)
}
-WRITE_LINE_MEMBER(pooyan_state::coin_counter_1_w)
+template <uint8_t Which>
+WRITE_LINE_MEMBER(pooyan_state::coin_counter_w)
{
- machine().bookkeeping().coin_counter_w(0, state);
-}
-
-
-WRITE_LINE_MEMBER(pooyan_state::coin_counter_2_w)
-{
- machine().bookkeeping().coin_counter_w(1, state);
+ machine().bookkeeping().coin_counter_w(Which, state);
}
@@ -67,11 +297,11 @@ WRITE_LINE_MEMBER(pooyan_state::coin_counter_2_w)
void pooyan_state::main_map(address_map &map)
{
map(0x0000, 0x7fff).rom();
- map(0x8000, 0x83ff).ram().w(FUNC(pooyan_state::colorram_w)).share("colorram");
- map(0x8400, 0x87ff).ram().w(FUNC(pooyan_state::videoram_w)).share("videoram");
+ map(0x8000, 0x83ff).ram().w(FUNC(pooyan_state::colorram_w)).share(m_colorram);
+ map(0x8400, 0x87ff).ram().w(FUNC(pooyan_state::videoram_w)).share(m_videoram);
map(0x8800, 0x8fff).ram();
- map(0x9000, 0x90ff).mirror(0x0b00).ram().share("spriteram");
- map(0x9400, 0x94ff).mirror(0x0b00).ram().share("spriteram2");
+ map(0x9000, 0x90ff).mirror(0x0b00).ram().share(m_spriteram[0]);
+ map(0x9400, 0x94ff).mirror(0x0b00).ram().share(m_spriteram[1]);
map(0xa000, 0xa000).mirror(0x5e7f).portr("DSW1");
map(0xa080, 0xa080).mirror(0x5e1f).portr("IN0");
map(0xa0a0, 0xa0a0).mirror(0x5e1f).portr("IN1");
@@ -115,7 +345,7 @@ static INPUT_PORTS_START( pooyan )
PORT_START("DSW0")
KONAMI_COINAGE_LOC(DEF_STR( Free_Play ), "Invalid", SW1)
- /* Invalid = both coin slots disabled */
+ // Invalid = both coin slots disabled
PORT_START("DSW1")
PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:1,2")
@@ -175,8 +405,8 @@ static const gfx_layout spritelayout =
static GFXDECODE_START( gfx_pooyan )
- GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 16 )
- GFXDECODE_ENTRY( "gfx2", 0, spritelayout, 16*16, 16 )
+ GFXDECODE_ENTRY( "tiles", 0, charlayout, 0, 16 )
+ GFXDECODE_ENTRY( "sprites", 0, spritelayout, 16*16, 16 )
GFXDECODE_END
@@ -195,22 +425,24 @@ void pooyan_state::machine_start()
void pooyan_state::pooyan(machine_config &config)
{
- /* basic machine hardware */
- Z80(config, m_maincpu, MASTER_CLOCK/3/2);
+ static constexpr XTAL MASTER_CLOCK = XTAL(18'432'000);
+
+ // basic machine hardware
+ Z80(config, m_maincpu, MASTER_CLOCK / 3 / 2);
m_maincpu->set_addrmap(AS_PROGRAM, &pooyan_state::main_map);
ls259_device &mainlatch(LS259(config, "mainlatch")); // B2
mainlatch.q_out_cb<0>().set(FUNC(pooyan_state::irq_enable_w));
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(pooyan_state::coin_counter_1_w));
- mainlatch.q_out_cb<4>().set(FUNC(pooyan_state::coin_counter_2_w));
+ mainlatch.q_out_cb<3>().set(FUNC(pooyan_state::coin_counter_w<0>));
+ mainlatch.q_out_cb<4>().set(FUNC(pooyan_state::coin_counter_w<1>));
mainlatch.q_out_cb<5>().set_nop(); // PAY OUT - not used
- mainlatch.q_out_cb<7>().set(FUNC(pooyan_state::flipscreen_w));
+ mainlatch.q_out_cb<7>().set(FUNC(pooyan_state::flip_screen_set)).invert();
WATCHDOG_TIMER(config, "watchdog");
- /* video hardware */
+ // video hardware
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_refresh_hz(60);
screen.set_size(32*8, 32*8);
@@ -220,9 +452,9 @@ void pooyan_state::pooyan(machine_config &config)
screen.screen_vblank().set(FUNC(pooyan_state::vblank_irq));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_pooyan);
- PALETTE(config, m_palette, FUNC(pooyan_state::pooyan_palette), 16*16+16*16, 32);
+ PALETTE(config, m_palette, FUNC(pooyan_state::palette), 16*16+16*16, 32);
- /* sound hardware */
+ // sound hardware
TIMEPLT_AUDIO(config, "timeplt_audio");
}
@@ -244,18 +476,18 @@ ROM_START( pooyan )
ROM_LOAD( "xx.7a", 0x0000, 0x1000, CRC(fbe2b368) SHA1(5689a84ef110bdc0039ad1a6c5778e0b8eccfce0) )
ROM_LOAD( "xx.8a", 0x1000, 0x1000, CRC(e1795b3d) SHA1(9ab4e5362f9f7d9b46b750e14b1d9d71c57be40f) )
- ROM_REGION( 0x2000, "gfx1", 0 )
+ ROM_REGION( 0x2000, "tiles", 0 )
ROM_LOAD( "8.10g", 0x0000, 0x1000, CRC(931b29eb) SHA1(0325c1c1fdb44e0044b82b7c79b5eeabf5c11ce7) )
ROM_LOAD( "7.9g", 0x1000, 0x1000, CRC(bbe6d6e4) SHA1(de5447d59a99c4c08c4f40c0b7dd3c3c609c11d4) )
- ROM_REGION( 0x2000, "gfx2", 0 )
+ ROM_REGION( 0x2000, "sprites", 0 )
ROM_LOAD( "6.9a", 0x0000, 0x1000, CRC(b2d8c121) SHA1(189ad488869f34d7a38b82ef70eb805acfe04312) )
ROM_LOAD( "5.8a", 0x1000, 0x1000, CRC(1097c2b6) SHA1(c815f0d27593efd23923511bdd13835456ef7f76) )
ROM_REGION( 0x0220, "proms", 0 )
- ROM_LOAD( "pooyan.pr1", 0x0000, 0x0020, CRC(a06a6d0e) SHA1(ae131320b66d76d4bc9108da6708f6f874b2e123) ) /* palette */
- ROM_LOAD( "pooyan.pr3", 0x0020, 0x0100, CRC(8cd4cd60) SHA1(e0188ecd5b53a8e6e28c1de80def676740772334) ) /* characters */
- ROM_LOAD( "pooyan.pr2", 0x0120, 0x0100, CRC(82748c0b) SHA1(9ce8eb92e482eba5a9077e9db99841d65b011346) ) /* sprites */
+ ROM_LOAD( "pooyan.pr1", 0x0000, 0x0020, CRC(a06a6d0e) SHA1(ae131320b66d76d4bc9108da6708f6f874b2e123) ) // palette
+ ROM_LOAD( "pooyan.pr3", 0x0020, 0x0100, CRC(8cd4cd60) SHA1(e0188ecd5b53a8e6e28c1de80def676740772334) ) // characters
+ ROM_LOAD( "pooyan.pr2", 0x0120, 0x0100, CRC(82748c0b) SHA1(9ce8eb92e482eba5a9077e9db99841d65b011346) ) // sprites
ROM_END
ROM_START( pooyans )
@@ -269,18 +501,18 @@ ROM_START( pooyans )
ROM_LOAD( "xx.7a", 0x0000, 0x1000, CRC(fbe2b368) SHA1(5689a84ef110bdc0039ad1a6c5778e0b8eccfce0) )
ROM_LOAD( "xx.8a", 0x1000, 0x1000, CRC(e1795b3d) SHA1(9ab4e5362f9f7d9b46b750e14b1d9d71c57be40f) )
- ROM_REGION( 0x2000, "gfx1", 0 )
+ ROM_REGION( 0x2000, "tiles", 0 )
ROM_LOAD( "ic13_g10.cpu", 0x0000, 0x1000, CRC(7433aea9) SHA1(a5ad6311f097fefb6e7b747ebe9d01d72d7755d0) )
ROM_LOAD( "ic14_g9.cpu", 0x1000, 0x1000, CRC(87c1789e) SHA1(7637a9604a3ad4f9a27105d87252de3d923672aa) )
- ROM_REGION( 0x2000, "gfx2", 0 )
+ ROM_REGION( 0x2000, "sprites", 0 )
ROM_LOAD( "6.9a", 0x0000, 0x1000, CRC(b2d8c121) SHA1(189ad488869f34d7a38b82ef70eb805acfe04312) )
ROM_LOAD( "5.8a", 0x1000, 0x1000, CRC(1097c2b6) SHA1(c815f0d27593efd23923511bdd13835456ef7f76) )
ROM_REGION( 0x0220, "proms", 0 )
- ROM_LOAD( "pooyan.pr1", 0x0000, 0x0020, CRC(a06a6d0e) SHA1(ae131320b66d76d4bc9108da6708f6f874b2e123) ) /* palette */
- ROM_LOAD( "pooyan.pr3", 0x0020, 0x0100, CRC(8cd4cd60) SHA1(e0188ecd5b53a8e6e28c1de80def676740772334) ) /* characters */
- ROM_LOAD( "pooyan.pr2", 0x0120, 0x0100, CRC(82748c0b) SHA1(9ce8eb92e482eba5a9077e9db99841d65b011346) ) /* sprites */
+ ROM_LOAD( "pooyan.pr1", 0x0000, 0x0020, CRC(a06a6d0e) SHA1(ae131320b66d76d4bc9108da6708f6f874b2e123) ) // palette
+ ROM_LOAD( "pooyan.pr3", 0x0020, 0x0100, CRC(8cd4cd60) SHA1(e0188ecd5b53a8e6e28c1de80def676740772334) ) // characters
+ ROM_LOAD( "pooyan.pr2", 0x0120, 0x0100, CRC(82748c0b) SHA1(9ce8eb92e482eba5a9077e9db99841d65b011346) ) // sprites
ROM_END
ROM_START( pootan )
@@ -294,20 +526,21 @@ ROM_START( pootan )
ROM_LOAD( "xx.7a", 0x0000, 0x1000, CRC(fbe2b368) SHA1(5689a84ef110bdc0039ad1a6c5778e0b8eccfce0) )
ROM_LOAD( "xx.8a", 0x1000, 0x1000, CRC(e1795b3d) SHA1(9ab4e5362f9f7d9b46b750e14b1d9d71c57be40f) )
- ROM_REGION( 0x2000, "gfx1", 0 )
+ ROM_REGION( 0x2000, "tiles", 0 )
ROM_LOAD( "poo_ic13.bin", 0x0000, 0x1000, CRC(0be802e4) SHA1(07adc17bcb7332ddc00b7c71bf4919eda80b0bdb) )
ROM_LOAD( "poo_ic14.bin", 0x1000, 0x1000, CRC(cba29096) SHA1(b5a4cf75089cf04f7361e00074816facd57452b2) )
- ROM_REGION( 0x2000, "gfx2", 0 )
+ ROM_REGION( 0x2000, "sprites", 0 )
ROM_LOAD( "6.9a", 0x0000, 0x1000, CRC(b2d8c121) SHA1(189ad488869f34d7a38b82ef70eb805acfe04312) )
ROM_LOAD( "5.8a", 0x1000, 0x1000, CRC(1097c2b6) SHA1(c815f0d27593efd23923511bdd13835456ef7f76) )
ROM_REGION( 0x0220, "proms", 0 )
- ROM_LOAD( "pooyan.pr1", 0x0000, 0x0020, CRC(a06a6d0e) SHA1(ae131320b66d76d4bc9108da6708f6f874b2e123) ) /* palette */
- ROM_LOAD( "pooyan.pr3", 0x0020, 0x0100, CRC(8cd4cd60) SHA1(e0188ecd5b53a8e6e28c1de80def676740772334) ) /* characters */
- ROM_LOAD( "pooyan.pr2", 0x0120, 0x0100, CRC(82748c0b) SHA1(9ce8eb92e482eba5a9077e9db99841d65b011346) ) /* sprites */
+ ROM_LOAD( "pooyan.pr1", 0x0000, 0x0020, CRC(a06a6d0e) SHA1(ae131320b66d76d4bc9108da6708f6f874b2e123) ) // palette
+ ROM_LOAD( "pooyan.pr3", 0x0020, 0x0100, CRC(8cd4cd60) SHA1(e0188ecd5b53a8e6e28c1de80def676740772334) ) // characters
+ ROM_LOAD( "pooyan.pr2", 0x0120, 0x0100, CRC(82748c0b) SHA1(9ce8eb92e482eba5a9077e9db99841d65b011346) ) // sprites
ROM_END
+} // anonymous namespace
/*************************************
@@ -316,7 +549,7 @@ ROM_END
*
*************************************/
-// YEAR, NAME, PARENT, MACHINE,INPUT, INIT,MONITOR,COMPANY,FULLNAME,FLAGS
-GAME( 1982, pooyan, 0, pooyan, pooyan, pooyan_state, empty_init, ROT90, "Konami", "Pooyan", MACHINE_SUPPORTS_SAVE )
+// YEAR, NAME, PARENT, MACHINE,INPUT, STATE, INIT, MONITOR,COMPANY, FULLNAME, FLAGS
+GAME( 1982, pooyan, 0, pooyan, pooyan, pooyan_state, empty_init, ROT90, "Konami", "Pooyan", MACHINE_SUPPORTS_SAVE )
GAME( 1982, pooyans, pooyan, pooyan, pooyan, pooyan_state, empty_init, ROT90, "Konami (Stern Electronics license)", "Pooyan (Stern Electronics)", MACHINE_SUPPORTS_SAVE )
-GAME( 1982, pootan, pooyan, pooyan, pooyan, pooyan_state, empty_init, ROT90, "bootleg", "Pootan", MACHINE_SUPPORTS_SAVE )
+GAME( 1982, pootan, pooyan, pooyan, pooyan, pooyan_state, empty_init, ROT90, "bootleg", "Pootan", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/konami/pooyan.h b/src/mame/konami/pooyan.h
deleted file mode 100644
index 55c46d6f088..00000000000
--- a/src/mame/konami/pooyan.h
+++ /dev/null
@@ -1,65 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Allard van der Bas
-#ifndef MAME_INCLUDES_POOYAN_H
-#define MAME_INCLUDES_POOYAN_H
-
-#pragma once
-
-#include "emupal.h"
-#include "tilemap.h"
-
-class pooyan_state : public driver_device
-{
-public:
- pooyan_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_colorram(*this, "colorram"),
- m_videoram(*this, "videoram"),
- m_spriteram(*this, "spriteram"),
- m_spriteram2(*this, "spriteram2")
- { }
-
- void pooyan(machine_config &config);
-
-private:
- /* devices */
- required_device<cpu_device> m_maincpu;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
-
- /* memory pointers */
- required_shared_ptr<uint8_t> m_colorram;
- required_shared_ptr<uint8_t> m_videoram;
- required_shared_ptr<uint8_t> m_spriteram;
- required_shared_ptr<uint8_t> m_spriteram2;
-
- /* video-related */
- tilemap_t *m_bg_tilemap = nullptr;
-
- /* misc */
- uint8_t m_irq_enable = 0;
-
- DECLARE_WRITE_LINE_MEMBER(irq_enable_w);
- DECLARE_WRITE_LINE_MEMBER(coin_counter_1_w);
- DECLARE_WRITE_LINE_MEMBER(coin_counter_2_w);
- void videoram_w(offs_t offset, uint8_t data);
- void colorram_w(offs_t offset, uint8_t data);
- DECLARE_WRITE_LINE_MEMBER(flipscreen_w);
-
- TILE_GET_INFO_MEMBER(get_bg_tile_info);
-
- virtual void machine_start() override;
- virtual void video_start() override;
- void pooyan_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 );
-
- DECLARE_WRITE_LINE_MEMBER(vblank_irq);
- void main_map(address_map &map);
-};
-
-#endif // MAME_INCLUDES_POOYAN_H
diff --git a/src/mame/konami/pooyan_v.cpp b/src/mame/konami/pooyan_v.cpp
deleted file mode 100644
index 2263b95c51c..00000000000
--- a/src/mame/konami/pooyan_v.cpp
+++ /dev/null
@@ -1,189 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Allard van der Bas
-/***************************************************************************
-
- Pooyan
-
-***************************************************************************/
-
-#include "emu.h"
-#include "video/resnet.h"
-#include "pooyan.h"
-
-/***************************************************************************
-
- Convert the color PROMs into a more useable format.
-
- Pooyan 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 pooyan_state::pooyan_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, rweights, 1000, 0,
- 3, resistances_rg, gweights, 1000, 0,
- 2, resistances_b, 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;
-
- // characters
- for (int i = 0; i < 0x100; i++)
- {
- uint8_t const ctabentry = (color_prom[i] & 0x0f) | 0x10;
- palette.set_pen_indirect(i, ctabentry);
- }
-
- // sprites
- for (int i = 0x100; i < 0x200; i++)
- {
- uint8_t const ctabentry = color_prom[i] & 0x0f;
- palette.set_pen_indirect(i, ctabentry);
- }
-}
-
-
-
-/*************************************
- *
- * Tilemap info callback
- *
- *************************************/
-
-TILE_GET_INFO_MEMBER(pooyan_state::get_bg_tile_info)
-{
- int attr = m_colorram[tile_index];
- int code = m_videoram[tile_index];
- int color = attr & 0x0f;
- int flags = TILE_FLIPYX(attr >> 6);
-
- tileinfo.set(0, code, color, flags);
-}
-
-
-
-/*************************************
- *
- * Video startup
- *
- *************************************/
-
-void pooyan_state::video_start()
-{
- m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(pooyan_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
-}
-
-
-
-/*************************************
- *
- * Memory write handlers
- *
- *************************************/
-
-void pooyan_state::videoram_w(offs_t offset, uint8_t data)
-{
- m_videoram[offset] = data;
- m_bg_tilemap->mark_tile_dirty(offset);
-}
-
-
-void pooyan_state::colorram_w(offs_t offset, uint8_t data)
-{
- m_colorram[offset] = data;
- m_bg_tilemap->mark_tile_dirty(offset);
-}
-
-
-WRITE_LINE_MEMBER(pooyan_state::flipscreen_w)
-{
- flip_screen_set(!state);
-}
-
-
-
-/*************************************
- *
- * Sprite rendering
- *
- *************************************/
-
-void pooyan_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
-{
- for (int offs = 0x10; offs < 0x40; offs += 2)
- {
- int sx = m_spriteram[offs];
- int sy = 240 - m_spriteram2[offs + 1];
-
- int code = m_spriteram[offs + 1];
- int color = m_spriteram2[offs] & 0x0f;
- int flipx = ~m_spriteram2[offs] & 0x40;
- int flipy = m_spriteram2[offs] & 0x80;
-
-
- m_gfxdecode->gfx(1)->transmask(bitmap,cliprect,
- code,
- color,
- flipx, flipy,
- sx, sy,
- m_palette->transpen_mask(*m_gfxdecode->gfx(1), color, 0));
- }
-}
-
-
-
-/*************************************
- *
- * Video update
- *
- *************************************/
-
-uint32_t pooyan_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/sbasketb.cpp b/src/mame/konami/sbasketb.cpp
index 127c4751bc3..0f16ff5ea1e 100644
--- a/src/mame/konami/sbasketb.cpp
+++ b/src/mame/konami/sbasketb.cpp
@@ -1,5 +1,6 @@
// license:BSD-3-Clause
-// copyright-holders:Zsolt Vasvari
+// copyright-holders: Zsolt Vasvari
+
/***************************************************************************
Super Basketball memory map (preliminary)
@@ -30,7 +31,7 @@ Sound Board Parts:
14.31818MHz @ x1
3.579545MHz @ x2
SN76489AN @ 8d (According to the schematics, part number scratched off)
- 4118 or 6116 @ 10a (According to the schematics pins match these two types of sram, part number scratched off)
+ 4118 or 6116 @ 10a (According to the schematics pins match these two types of SRAM, part number scratched off)
CPU/Video Board Parts:
@@ -41,32 +42,275 @@ CPU/Video Board Parts:
***************************************************************************/
#include "emu.h"
-#include "sbasketb.h"
+
+#include "konami1.h"
#include "konamipt.h"
+#include "trackfld_a.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/sn76496.h"
+#include "sound/vlm5030.h"
+#include "video/resnet.h"
+#include "emupal.h"
+#include "screen.h"
#include "speaker.h"
+#include "tilemap.h"
-void sbasketb_state::sbasketb_sh_irqtrigger_w(uint8_t data)
+namespace {
+
+class sbasketb_state : public driver_device
{
- m_audiocpu->set_input_line_and_vector(0, HOLD_LINE, 0xff); // Z80
+public:
+ sbasketb_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
+ m_colorram(*this, "colorram"),
+ m_videoram(*this, "videoram"),
+ m_spriteram(*this, "spriteram"),
+ m_palettebank(*this, "palettebank"),
+ m_scroll(*this, "scroll"),
+ m_maincpu(*this, "maincpu"),
+ m_audiocpu(*this, "audiocpu"),
+ m_sn(*this, "snsnd"),
+ m_vlm(*this, "vlm"),
+ m_screen(*this, "screen"),
+ m_gfxdecode(*this, "gfxdecode"),
+ m_palette(*this, "palette")
+ { }
+
+ void sbasketb(machine_config &config);
+ void sbasketbu(machine_config &config);
+
+protected:
+ virtual void video_start() override;
+
+private:
+ // memory pointers
+ required_shared_ptr<uint8_t> m_colorram;
+ required_shared_ptr<uint8_t> m_videoram;
+ required_shared_ptr<uint8_t> m_spriteram;
+ required_shared_ptr<uint8_t> m_palettebank;
+ required_shared_ptr<uint8_t> m_scroll;
+
+ // devices
+ required_device<cpu_device> m_maincpu;
+ required_device<cpu_device> m_audiocpu;
+ required_device<sn76489_device> m_sn;
+ required_device<vlm5030_device> m_vlm;
+ required_device<screen_device> m_screen;
+ required_device<gfxdecode_device> m_gfxdecode;
+ required_device<palette_device> m_palette;
+
+ // video-related
+ tilemap_t *m_bg_tilemap = nullptr;
+ bool m_spriteram_select = false;
+
+ bool m_irq_mask = false;
+ uint8_t m_sn76496_latch = 0;
+
+ void sh_irqtrigger_w(uint8_t data);
+ template <uint8_t Which> DECLARE_WRITE_LINE_MEMBER(coin_counter_w);
+ 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(flipscreen_w);
+ DECLARE_WRITE_LINE_MEMBER(spriteram_select_w);
+ 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);
+ 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.
+
+ Super Basketball 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 sbasketb_state::palette(palette_device &palette) const
+{
+ const uint8_t *color_prom = memregion("proms")->base();
+ 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, 1000, 0,
+ 4, resistances, gweights, 1000, 0,
+ 4, resistances, bweights, 1000, 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 0xf0-0xff
+ for (int i = 0; i < 0x100; i++)
+ {
+ uint8_t const ctabentry = (color_prom[i] & 0x0f) | 0xf0;
+ palette.set_pen_indirect(i, ctabentry);
+ }
+
+ // sprites use colors 0-256 (?) in 16 banks
+ for (int i = 0; i < 0x100; i++)
+ {
+ for (int j = 0; j < 0x10; j++)
+ {
+ uint8_t const ctabentry = (j << 4) | (color_prom[i + 0x100] & 0x0f);
+ palette.set_pen_indirect(0x100 + ((j << 8) | i), ctabentry);
+ }
+ }
+}
+
+void sbasketb_state::videoram_w(offs_t offset, uint8_t data)
+{
+ m_videoram[offset] = data;
+ m_bg_tilemap->mark_tile_dirty(offset);
+}
+
+void sbasketb_state::colorram_w(offs_t offset, uint8_t data)
+{
+ m_colorram[offset] = data;
+ m_bg_tilemap->mark_tile_dirty(offset);
+}
+
+WRITE_LINE_MEMBER(sbasketb_state::flipscreen_w)
+{
+ flip_screen_set(state);
+ machine().tilemap().mark_all_dirty();
+}
+
+WRITE_LINE_MEMBER(sbasketb_state::spriteram_select_w)
+{
+ m_spriteram_select = state;
+}
+
+TILE_GET_INFO_MEMBER(sbasketb_state::get_bg_tile_info)
+{
+ int const code = m_videoram[tile_index] + ((m_colorram[tile_index] & 0x20) << 3);
+ int const color = m_colorram[tile_index] & 0x0f;
+ int const flags = ((m_colorram[tile_index] & 0x40) ? TILE_FLIPX : 0) | ((m_colorram[tile_index] & 0x80) ? TILE_FLIPY : 0);
+
+ tileinfo.set(0, code, color, flags);
}
-WRITE_LINE_MEMBER(sbasketb_state::coin_counter_1_w)
+void sbasketb_state::video_start()
{
- machine().bookkeeping().coin_counter_w(0, state);
+ m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(sbasketb_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
+ m_bg_tilemap->set_scroll_cols(32);
+
+ save_item(NAME(m_spriteram_select));
+ save_item(NAME(m_irq_mask));
+ save_item(NAME(m_sn76496_latch));
}
-WRITE_LINE_MEMBER(sbasketb_state::coin_counter_2_w)
+void sbasketb_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- machine().bookkeeping().coin_counter_w(1, state);
+ int offs = m_spriteram_select ? 0x100 : 0;
+
+ for (int i = 0; i < 64; i++, offs += 4)
+ {
+ int sx = m_spriteram[offs + 2];
+ int sy = m_spriteram[offs + 3];
+
+ if (sx || sy)
+ {
+ int const code = m_spriteram[offs + 0] | ((m_spriteram[offs + 1] & 0x20) << 3);
+ int const color = (m_spriteram[offs + 1] & 0x0f) + 16 * *m_palettebank;
+ int flipx = m_spriteram[offs + 1] & 0x40;
+ int flipy = m_spriteram[offs + 1] & 0x80;
+
+ if (flip_screen())
+ {
+ sx = 240 - sx;
+ sy = 240 - sy;
+ flipx = !flipx;
+ flipy = !flipy;
+ }
+
+
+ m_gfxdecode->gfx(1)->transpen(bitmap, cliprect,
+ code, color,
+ flipx, flipy,
+ sx, sy, 0);
+ }
+ }
+}
+
+uint32_t sbasketb_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ for (int col = 6; col < 32; col++)
+ m_bg_tilemap->set_scrolly(col, *m_scroll);
+
+ m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
+ draw_sprites(bitmap, cliprect);
+ return 0;
+}
+
+
+// machine
+
+void sbasketb_state::sh_irqtrigger_w(uint8_t data)
+{
+ m_audiocpu->set_input_line_and_vector(0, HOLD_LINE, 0xff); // Z80
+}
+
+template <uint8_t Which>
+WRITE_LINE_MEMBER(sbasketb_state::coin_counter_w)
+{
+ machine().bookkeeping().coin_counter_w(Which, state);
}
WRITE_LINE_MEMBER(sbasketb_state::irq_mask_w)
@@ -76,19 +320,19 @@ WRITE_LINE_MEMBER(sbasketb_state::irq_mask_w)
m_maincpu->set_input_line(0, CLEAR_LINE);
}
-void sbasketb_state::sbasketb_map(address_map &map)
+void sbasketb_state::main_map(address_map &map)
{
map(0x2000, 0x2fff).ram();
- map(0x3000, 0x33ff).ram().w(FUNC(sbasketb_state::sbasketb_colorram_w)).share(m_colorram);
- map(0x3400, 0x37ff).ram().w(FUNC(sbasketb_state::sbasketb_videoram_w)).share(m_videoram);
+ map(0x3000, 0x33ff).ram().w(FUNC(sbasketb_state::colorram_w)).share(m_colorram);
+ map(0x3400, 0x37ff).ram().w(FUNC(sbasketb_state::videoram_w)).share(m_videoram);
map(0x3800, 0x39ff).ram().share(m_spriteram);
- map(0x3a00, 0x3bff).ram(); /* Probably unused, but initialized */
+ map(0x3a00, 0x3bff).ram(); // Probably unused, but initialized
map(0x3c00, 0x3c00).w("watchdog", FUNC(watchdog_timer_device::reset_w));
- map(0x3c10, 0x3c10).nopr(); /* ???? */
+ map(0x3c10, 0x3c10).nopr(); // ????
map(0x3c20, 0x3c20).writeonly().share(m_palettebank);
map(0x3c80, 0x3c87).w("mainlatch", FUNC(ls259_device::write_d0));
map(0x3d00, 0x3d00).w("soundlatch", FUNC(generic_latch_8_device::write));
- map(0x3d80, 0x3d80).w(FUNC(sbasketb_state::sbasketb_sh_irqtrigger_w));
+ map(0x3d80, 0x3d80).w(FUNC(sbasketb_state::sh_irqtrigger_w));
map(0x3e00, 0x3e00).portr("SYSTEM");
map(0x3e01, 0x3e01).portr("P1");
map(0x3e02, 0x3e02).portr("P2");
@@ -99,17 +343,17 @@ void sbasketb_state::sbasketb_map(address_map &map)
map(0x6000, 0xffff).rom();
}
-void sbasketb_state::sbasketb_sound_map(address_map &map)
+void sbasketb_state::sound_map(address_map &map)
{
map(0x0000, 0x1fff).rom();
map(0x4000, 0x43ff).ram();
map(0x6000, 0x6000).r("soundlatch", FUNC(generic_latch_8_device::read));
- map(0x8000, 0x8000).r(m_soundbrd, FUNC(trackfld_audio_device::hyperspt_sh_timer_r));
- map(0xa000, 0xa000).w(m_vlm, FUNC(vlm5030_device::data_w)); /* speech data */
- map(0xc000, 0xdfff).w(m_soundbrd, FUNC(trackfld_audio_device::hyperspt_sound_w)); /* speech and output control */
- map(0xe000, 0xe000).w(m_dac, FUNC(dac_byte_interface::data_w));
- map(0xe001, 0xe001).w(FUNC(sbasketb_state::konami_SN76496_latch_w)); /* Loads the snd command into the snd latch */
- map(0xe002, 0xe002).w(FUNC(sbasketb_state::konami_SN76496_w)); /* This address triggers the SN chip to read the data port. */
+ map(0x8000, 0x8000).r("soundbrd", FUNC(trackfld_audio_device::hyperspt_sh_timer_r));
+ map(0xa000, 0xa000).w(m_vlm, FUNC(vlm5030_device::data_w)); // speech
+ map(0xc000, 0xdfff).w("soundbrd", FUNC(trackfld_audio_device::hyperspt_sound_w)); // speech and output control
+ map(0xe000, 0xe000).w("dac", FUNC(dac_byte_interface::data_w));
+ map(0xe001, 0xe001).w(FUNC(sbasketb_state::konami_sn76496_latch_w)); // Loads the snd command into the snd latch
+ map(0xe002, 0xe002).w(FUNC(sbasketb_state::konami_sn76496_w)); // This address triggers the SN chip to read the data port.
}
@@ -154,35 +398,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 bitplanes are packed */
- { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4 },
- { 0*4*8, 1*4*8, 2*4*8, 3*4*8, 4*4*8, 5*4*8, 6*4*8, 7*4*8 },
- 8*4*8 /* every char takes 32 consecutive bytes */
-};
-
-static const gfx_layout spritelayout =
-{
- 16,16, /* 16*16 sprites */
- 128 * 3,/* 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_sbasketb )
- GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 16 )
- GFXDECODE_ENTRY( "gfx2", 0, spritelayout, 16*16, 16*16 )
+ GFXDECODE_ENTRY( "tiles", 0, gfx_8x8x4_packed_msb, 0, 16 )
+ GFXDECODE_ENTRY( "sprites", 0, gfx_16x16x4_packed_msb, 16*16, 16*16 )
GFXDECODE_END
WRITE_LINE_MEMBER(sbasketb_state::vblank_irq)
@@ -193,56 +411,56 @@ WRITE_LINE_MEMBER(sbasketb_state::vblank_irq)
void sbasketb_state::sbasketb(machine_config &config)
{
- /* basic machine hardware */
- KONAMI1(config, m_maincpu, 1400000); /* 1.400 MHz ??? */
- m_maincpu->set_addrmap(AS_PROGRAM, &sbasketb_state::sbasketb_map);
+ // basic machine hardware
+ KONAMI1(config, m_maincpu, 1'400'000); // 1.400 MHz ??? TODO: From a 18.432 MHz XTAL this doesn't seem probable
+ m_maincpu->set_addrmap(AS_PROGRAM, &sbasketb_state::main_map);
- Z80(config, m_audiocpu, XTAL(14'318'181) / 4); /* 3.5795 MHz */
- m_audiocpu->set_addrmap(AS_PROGRAM, &sbasketb_state::sbasketb_sound_map);
+ Z80(config, m_audiocpu, XTAL(14'318'181) / 4); // 3.5795 MHz
+ m_audiocpu->set_addrmap(AS_PROGRAM, &sbasketb_state::sound_map);
ls259_device &mainlatch(LS259(config, "mainlatch")); // B3
mainlatch.q_out_cb<0>().set(FUNC(sbasketb_state::flipscreen_w)); // FLIP
mainlatch.q_out_cb<1>().set(FUNC(sbasketb_state::irq_mask_w)); // INTST
mainlatch.q_out_cb<2>().set_nop(); // MUT - not used?
- mainlatch.q_out_cb<3>().set(FUNC(sbasketb_state::coin_counter_1_w)); // COIN 1
- mainlatch.q_out_cb<4>().set(FUNC(sbasketb_state::coin_counter_2_w)); // COIN 2
+ mainlatch.q_out_cb<3>().set(FUNC(sbasketb_state::coin_counter_w<0>)); // COIN 1
+ mainlatch.q_out_cb<4>().set(FUNC(sbasketb_state::coin_counter_w<1>)); // COIN 2
mainlatch.q_out_cb<5>().set(FUNC(sbasketb_state::spriteram_select_w)); // OBJ CHE
mainlatch.q_out_cb<6>().set_nop(); // END - not used
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));
m_screen->set_size(32*8, 32*8);
m_screen->set_visarea(0*8, 32*8-1, 2*8, 30*8-1);
- m_screen->set_screen_update(FUNC(sbasketb_state::screen_update_sbasketb));
+ m_screen->set_screen_update(FUNC(sbasketb_state::screen_update));
m_screen->set_palette(m_palette);
m_screen->screen_vblank().set(FUNC(sbasketb_state::vblank_irq));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_sbasketb);
- PALETTE(config, m_palette, FUNC(sbasketb_state::sbasketb_palette), 16*16+16*16*16, 256);
+ PALETTE(config, m_palette, FUNC(sbasketb_state::palette), 16*16+16*16*16, 256);
- /* sound hardware */
+ // sound hardware
SPEAKER(config, "speaker").front_center();
GENERIC_LATCH_8(config, "soundlatch");
- TRACKFLD_AUDIO(config, m_soundbrd, 0, m_audiocpu, m_vlm);
+ TRACKFLD_AUDIO(config, "soundbrd", 0, m_audiocpu, m_vlm);
- DAC_8BIT_R2R(config, m_dac, 0).add_route(ALL_OUTPUTS, "speaker", 0.4); // unknown DAC
+ DAC_8BIT_R2R(config, "dac", 0).add_route(ALL_OUTPUTS, "speaker", 0.4); // unknown DAC
SN76489(config, m_sn, XTAL(14'318'181) / 8).add_route(ALL_OUTPUTS, "speaker", 1.0);
- VLM5030(config, m_vlm, XTAL(3'579'545)).add_route(ALL_OUTPUTS, "speaker", 1.0); /* Schematics say 3.58MHz, but board uses 3.579545MHz xtal */
+ VLM5030(config, m_vlm, XTAL(3'579'545)).add_route(ALL_OUTPUTS, "speaker", 1.0); // Schematics say 3.58MHz, but board uses 3.579545MHz xtal
}
void sbasketb_state::sbasketbu(machine_config &config)
{
sbasketb(config);
- MC6809E(config.replace(), m_maincpu, 1400000); /* 6809E at 1.400 MHz ??? */
- m_maincpu->set_addrmap(AS_PROGRAM, &sbasketb_state::sbasketb_map);
+ MC6809E(config.replace(), m_maincpu, 1'400'000); // 6809E at 1.400 MHz ???
+ m_maincpu->set_addrmap(AS_PROGRAM, &sbasketb_state::main_map);
}
@@ -259,30 +477,30 @@ void sbasketb_state::sbasketbu(machine_config &config)
*/
ROM_START( sbasketb )
- ROM_REGION( 0x10000, "maincpu", 0 ) /* roms located on the CPU/Video board */
+ ROM_REGION( 0x10000, "maincpu", 0 ) // ROMs located on the CPU/Video board
ROM_LOAD( "405g05.14j", 0x6000, 0x2000, CRC(336dc0ab) SHA1(0fe47fdbf183683c569785fc6b980337a9cfde95) )
ROM_LOAD( "405i03.11j", 0x8000, 0x4000, CRC(d33b82dd) SHA1(9f0a1e2b0a43a2ec5029dd50dbd315291838fa39) )
ROM_LOAD( "405i01.9j", 0xc000, 0x4000, CRC(1c09cc3f) SHA1(881c0a9313f7f1ca17e1fa956a7b13e77d71957c) )
- ROM_REGION( 0x10000, "audiocpu", 0 ) /* roms located on Sound Board */
+ ROM_REGION( 0x10000, "audiocpu", 0 ) // ROMs located on Sound Board
ROM_LOAD( "405e13.7a", 0x0000, 0x2000, CRC(1ec7458b) SHA1(a015b982bff5f9e7ece33f2e69ff8c6c2174e710) )
- ROM_REGION( 0x04000, "gfx1", 0 ) /* roms located on the CPU/Video board */
+ ROM_REGION( 0x04000, "tiles", 0 ) // ROMs located on the CPU/Video board
ROM_LOAD( "405e12.22f", 0x0000, 0x4000, CRC(e02c54da) SHA1(2fa19f3bce894ef05820f95e0b88428e4f946a35) )
- ROM_REGION( 0x0c000, "gfx2", 0 ) /* roms located on the CPU/Video board */
+ ROM_REGION( 0x0c000, "sprites", 0 ) // ROMs located on the CPU/Video board
ROM_LOAD( "405h06.14g", 0x0000, 0x4000, CRC(cfbbff07) SHA1(39b19866b21372524933b5eef511bb5b7ad92556) )
ROM_LOAD( "405h08.17g", 0x4000, 0x4000, CRC(c75901b6) SHA1(4ff87123228da068f0c0ffffa4a3f03765eccd8d) )
ROM_LOAD( "405h10.20g", 0x8000, 0x4000, CRC(95bc5942) SHA1(55bf35283385d0ae768210706720a3b289ebd9a2) )
- ROM_REGION( 0x0500, "proms", 0 ) /* roms located on the CPU/Video board */
- ROM_LOAD( "405e17.5a", 0x0000, 0x0100, CRC(b4c36d57) SHA1(c4a63f57edce2b9588e2394ff54a28f91213d550) ) /* palette red component */
- ROM_LOAD( "405e16.4a", 0x0100, 0x0100, CRC(0b7b03b8) SHA1(81297cb2b0b28b0fc0939a37ff30844d69fb65ac) ) /* palette green component */
- ROM_LOAD( "405e18.6a", 0x0200, 0x0100, CRC(9e533bad) SHA1(611e7af6813caaf2bc36c311ae48a5efd30e6f0c) ) /* palette blue component */
- ROM_LOAD( "405e20.19d", 0x0300, 0x0100, CRC(8ca6de2f) SHA1(67d29708d1a07d17c5dc5793a3293e7ace3a4e19) ) /* character lookup table */
- ROM_LOAD( "405e19.16d", 0x0400, 0x0100, CRC(e0bc782f) SHA1(9f71e696d11a60f771535f6837ecad6132047b0a) ) /* sprite lookup table */
+ ROM_REGION( 0x0500, "proms", 0 ) // ROMs located on the CPU/Video board
+ ROM_LOAD( "405e17.5a", 0x0000, 0x0100, CRC(b4c36d57) SHA1(c4a63f57edce2b9588e2394ff54a28f91213d550) ) // palette red component
+ ROM_LOAD( "405e16.4a", 0x0100, 0x0100, CRC(0b7b03b8) SHA1(81297cb2b0b28b0fc0939a37ff30844d69fb65ac) ) // palette green component
+ ROM_LOAD( "405e18.6a", 0x0200, 0x0100, CRC(9e533bad) SHA1(611e7af6813caaf2bc36c311ae48a5efd30e6f0c) ) // palette blue component
+ ROM_LOAD( "405e20.19d", 0x0300, 0x0100, CRC(8ca6de2f) SHA1(67d29708d1a07d17c5dc5793a3293e7ace3a4e19) ) // character lookup table
+ ROM_LOAD( "405e19.16d", 0x0400, 0x0100, CRC(e0bc782f) SHA1(9f71e696d11a60f771535f6837ecad6132047b0a) ) // sprite lookup table
- ROM_REGION( 0x10000, "vlm", 0 ) /* 64k for speech rom, located on Sound Board */
+ ROM_REGION( 0x10000, "vlm", 0 ) // speech, located on Sound Board
ROM_LOAD( "405e15.11f", 0x0000, 0x2000, CRC(01bb5ce9) SHA1(f48477b4011befba13c8bcd83e0c9f7deb14a1e1) )
ROM_END
@@ -303,30 +521,30 @@ ROM_END
*/
ROM_START( sbasketh )
- ROM_REGION( 0x10000, "maincpu", 0 ) /* roms located on the CPU/Video board */
+ ROM_REGION( 0x10000, "maincpu", 0 ) // ROMs located on the CPU/Video board
ROM_LOAD( "405h05.14j", 0x6000, 0x2000, CRC(263ec36b) SHA1(b445b600726ba4935623311e1a178aeb4a356b0a) )
ROM_LOAD( "405h03.11j", 0x8000, 0x4000, CRC(0a4d7a82) SHA1(2e0153b41e23284427881258a44bd55be3570eb2) )
ROM_LOAD( "405h01.9j", 0xc000, 0x4000, CRC(4f9dd9a0) SHA1(97f4c208509d50a7ce4c1ebe8a3f643ad75e833b) )
- ROM_REGION( 0x10000, "audiocpu", 0 ) /* roms located on Sound Board */
+ ROM_REGION( 0x10000, "audiocpu", 0 ) // ROMs located on Sound Board
ROM_LOAD( "405e13.7a", 0x0000, 0x2000, CRC(1ec7458b) SHA1(a015b982bff5f9e7ece33f2e69ff8c6c2174e710) )
- ROM_REGION( 0x04000, "gfx1", 0 ) /* roms located on the CPU/Video board */
+ ROM_REGION( 0x04000, "tiles", 0 ) // ROMs located on the CPU/Video board
ROM_LOAD( "405e12.22f", 0x0000, 0x4000, CRC(e02c54da) SHA1(2fa19f3bce894ef05820f95e0b88428e4f946a35) )
- ROM_REGION( 0x0c000, "gfx2", 0 ) /* roms located on the CPU/Video board */
+ ROM_REGION( 0x0c000, "sprites", 0 ) // ROMs located on the CPU/Video board
ROM_LOAD( "405h06.14g", 0x0000, 0x4000, CRC(cfbbff07) SHA1(39b19866b21372524933b5eef511bb5b7ad92556) )
ROM_LOAD( "405h08.17g", 0x4000, 0x4000, CRC(c75901b6) SHA1(4ff87123228da068f0c0ffffa4a3f03765eccd8d) )
ROM_LOAD( "405h10.20g", 0x8000, 0x4000, CRC(95bc5942) SHA1(55bf35283385d0ae768210706720a3b289ebd9a2) )
- ROM_REGION( 0x0500, "proms", 0 ) /* roms located on the CPU/Video board */
- ROM_LOAD( "405e17.5a", 0x0000, 0x0100, CRC(b4c36d57) SHA1(c4a63f57edce2b9588e2394ff54a28f91213d550) ) /* palette red component */
- ROM_LOAD( "405e16.4a", 0x0100, 0x0100, CRC(0b7b03b8) SHA1(81297cb2b0b28b0fc0939a37ff30844d69fb65ac) ) /* palette green component */
- ROM_LOAD( "405e18.6a", 0x0200, 0x0100, CRC(9e533bad) SHA1(611e7af6813caaf2bc36c311ae48a5efd30e6f0c) ) /* palette blue component */
- ROM_LOAD( "405e20.19d", 0x0300, 0x0100, CRC(8ca6de2f) SHA1(67d29708d1a07d17c5dc5793a3293e7ace3a4e19) ) /* character lookup table */
- ROM_LOAD( "405e19.16d", 0x0400, 0x0100, CRC(e0bc782f) SHA1(9f71e696d11a60f771535f6837ecad6132047b0a) ) /* sprite lookup table */
+ ROM_REGION( 0x0500, "proms", 0 ) // ROMs located on the CPU/Video board
+ ROM_LOAD( "405e17.5a", 0x0000, 0x0100, CRC(b4c36d57) SHA1(c4a63f57edce2b9588e2394ff54a28f91213d550) ) // palette red component
+ ROM_LOAD( "405e16.4a", 0x0100, 0x0100, CRC(0b7b03b8) SHA1(81297cb2b0b28b0fc0939a37ff30844d69fb65ac) ) // palette green component
+ ROM_LOAD( "405e18.6a", 0x0200, 0x0100, CRC(9e533bad) SHA1(611e7af6813caaf2bc36c311ae48a5efd30e6f0c) ) // palette blue component
+ ROM_LOAD( "405e20.19d", 0x0300, 0x0100, CRC(8ca6de2f) SHA1(67d29708d1a07d17c5dc5793a3293e7ace3a4e19) ) // character lookup table
+ ROM_LOAD( "405e19.16d", 0x0400, 0x0100, CRC(e0bc782f) SHA1(9f71e696d11a60f771535f6837ecad6132047b0a) ) // sprite lookup table
- ROM_REGION( 0x10000, "vlm", 0 ) /* 64k for speech rom, located on Sound Board */
+ ROM_REGION( 0x10000, "vlm", 0 ) // speech, located on Sound Board
ROM_LOAD( "405e15.11f", 0x0000, 0x2000, CRC(01bb5ce9) SHA1(f48477b4011befba13c8bcd83e0c9f7deb14a1e1) )
ROM_END
@@ -348,20 +566,20 @@ ROM_END
*/
ROM_START( sbasketg )
- ROM_REGION( 0x10000, "maincpu", 0 ) /* roms located on the CPU/Video board */
+ ROM_REGION( 0x10000, "maincpu", 0 ) // ROMs located on the CPU/Video board
ROM_LOAD( "405g05.14j", 0x6000, 0x2000, CRC(336dc0ab) SHA1(0fe47fdbf183683c569785fc6b980337a9cfde95) )
ROM_LOAD( "405g04.13j", 0x8000, 0x2000, CRC(f064a9bc) SHA1(4f1b94a880385c6ba74cc0883b24f6fec934e35d) )
ROM_LOAD( "405g03.11j", 0xa000, 0x2000, CRC(b9de7d53) SHA1(5a4e5491ff3511992d949367fd7b5d383c2727db) )
ROM_LOAD( "405g02.10j", 0xc000, 0x2000, CRC(e98470a0) SHA1(79af25af941fe357a8c9f0a2f11e5558670b8027) )
ROM_LOAD( "405g01.9j", 0xe000, 0x2000, CRC(1bd0cd2e) SHA1(d162f9b989f718d9882a02a8c64743adf3d8e239) )
- ROM_REGION( 0x10000, "audiocpu", 0 ) /* roms located on Sound Board */
+ ROM_REGION( 0x10000, "audiocpu", 0 ) // ROMs located on Sound Board
ROM_LOAD( "405e13.7a", 0x0000, 0x2000, CRC(1ec7458b) SHA1(a015b982bff5f9e7ece33f2e69ff8c6c2174e710) )
- ROM_REGION( 0x04000, "gfx1", 0 ) /* roms located on the CPU/Video board */
+ ROM_REGION( 0x04000, "tiles", 0 ) // ROMs located on the CPU/Video board
ROM_LOAD( "405e12.22f", 0x0000, 0x4000, CRC(e02c54da) SHA1(2fa19f3bce894ef05820f95e0b88428e4f946a35) )
- ROM_REGION( 0x0c000, "gfx2", 0 ) /* roms located on the CPU/Video board */
+ ROM_REGION( 0x0c000, "sprites", 0 ) // ROMs located on the CPU/Video board
ROM_LOAD( "405e06.14g", 0x0000, 0x2000, CRC(7e2f5bb2) SHA1(e22008c0ef7ae000dcca7f43a386d43064aaea62) )
ROM_LOAD( "405e07.16g", 0x2000, 0x2000, CRC(963a44f9) SHA1(03cd7699668b010f27af025ba6bd44509526ec7b) )
ROM_LOAD( "405e08.17g", 0x4000, 0x2000, CRC(63901deb) SHA1(c65d896298846ed8b70a4d38b32820746214fa5c) )
@@ -369,14 +587,14 @@ ROM_START( sbasketg )
ROM_LOAD( "405e10.20g", 0x8000, 0x2000, CRC(824815e8) SHA1(470e9d74fa2c397605a74e0bf173a6d9db4cc721) )
ROM_LOAD( "405e11.22g", 0xa000, 0x2000, CRC(dca9b447) SHA1(12d7e85dc2fc6bd4ea7ad9035ae0b7487e4bc4bc) )
- ROM_REGION( 0x0500, "proms", 0 ) /* roms located on the CPU/Video board */
- ROM_LOAD( "405e17.5a", 0x0000, 0x0100, CRC(b4c36d57) SHA1(c4a63f57edce2b9588e2394ff54a28f91213d550) ) /* palette red component */
- ROM_LOAD( "405e16.4a", 0x0100, 0x0100, CRC(0b7b03b8) SHA1(81297cb2b0b28b0fc0939a37ff30844d69fb65ac) ) /* palette green component */
- ROM_LOAD( "405e18.6a", 0x0200, 0x0100, CRC(9e533bad) SHA1(611e7af6813caaf2bc36c311ae48a5efd30e6f0c) ) /* palette blue component */
- ROM_LOAD( "405e20.19d", 0x0300, 0x0100, CRC(8ca6de2f) SHA1(67d29708d1a07d17c5dc5793a3293e7ace3a4e19) ) /* character lookup table */
- ROM_LOAD( "405e19.16d", 0x0400, 0x0100, CRC(e0bc782f) SHA1(9f71e696d11a60f771535f6837ecad6132047b0a) ) /* sprite lookup table */
+ ROM_REGION( 0x0500, "proms", 0 ) // ROMs located on the CPU/Video board
+ ROM_LOAD( "405e17.5a", 0x0000, 0x0100, CRC(b4c36d57) SHA1(c4a63f57edce2b9588e2394ff54a28f91213d550) ) // palette red component
+ ROM_LOAD( "405e16.4a", 0x0100, 0x0100, CRC(0b7b03b8) SHA1(81297cb2b0b28b0fc0939a37ff30844d69fb65ac) ) // palette green component
+ ROM_LOAD( "405e18.6a", 0x0200, 0x0100, CRC(9e533bad) SHA1(611e7af6813caaf2bc36c311ae48a5efd30e6f0c) ) // palette blue component
+ ROM_LOAD( "405e20.19d", 0x0300, 0x0100, CRC(8ca6de2f) SHA1(67d29708d1a07d17c5dc5793a3293e7ace3a4e19) ) // character lookup table
+ ROM_LOAD( "405e19.16d", 0x0400, 0x0100, CRC(e0bc782f) SHA1(9f71e696d11a60f771535f6837ecad6132047b0a) ) // sprite lookup table
- ROM_REGION( 0x10000, "vlm", 0 ) /* 64k for speech rom, located on Sound Board */
+ ROM_REGION( 0x10000, "vlm", 0 ) // speech, located on Sound Board
ROM_LOAD( "405e15.11f", 0x0000, 0x2000, CRC(01bb5ce9) SHA1(f48477b4011befba13c8bcd83e0c9f7deb14a1e1) )
ROM_END
@@ -386,20 +604,20 @@ ROM_END
*/
ROM_START( sbaskete )
- ROM_REGION( 0x10000, "maincpu", 0 ) /* roms located on the CPU/Video board */
+ ROM_REGION( 0x10000, "maincpu", 0 ) // ROMs located on the CPU/Video board
ROM_LOAD( "405e05.14j", 0x6000, 0x2000, CRC(32ea5b71) SHA1(d917c31d2c9a7229396e4a930e8d27394329533a) )
ROM_LOAD( "405e04.13j", 0x8000, 0x2000, CRC(7abf3087) SHA1(fbaaaaae0b8bed1bc6ad7f2da267c2ef8bd75b15) )
ROM_LOAD( "405e03.11j", 0xa000, 0x2000, CRC(9c6fcdcd) SHA1(a644ec98f49f84311829149c181aba25e7681793) )
ROM_LOAD( "405e02.10j", 0xc000, 0x2000, CRC(0f145648) SHA1(2e238eb0663295887bf6b4905f1fd386db16d82a) )
ROM_LOAD( "405e01.9j", 0xe000, 0x2000, CRC(6a27f1b1) SHA1(38c0be98fb122a7a6ed833af011bda5663a06510) )
- ROM_REGION( 0x10000, "audiocpu", 0 ) /* roms located on Sound Board */
+ ROM_REGION( 0x10000, "audiocpu", 0 ) // ROMs located on Sound Board
ROM_LOAD( "405e13.7a", 0x0000, 0x2000, CRC(1ec7458b) SHA1(a015b982bff5f9e7ece33f2e69ff8c6c2174e710) )
- ROM_REGION( 0x04000, "gfx1", 0 ) /* roms located on the CPU/Video board */
+ ROM_REGION( 0x04000, "tiles", 0 ) // ROMs located on the CPU/Video board
ROM_LOAD( "405e12.22f", 0x0000, 0x4000, CRC(e02c54da) SHA1(2fa19f3bce894ef05820f95e0b88428e4f946a35) )
- ROM_REGION( 0x0c000, "gfx2", 0 ) /* roms located on the CPU/Video board */
+ ROM_REGION( 0x0c000, "sprites", 0 ) // ROMs located on the CPU/Video board
ROM_LOAD( "405e06.14g", 0x0000, 0x2000, CRC(7e2f5bb2) SHA1(e22008c0ef7ae000dcca7f43a386d43064aaea62) )
ROM_LOAD( "405e07.16g", 0x2000, 0x2000, CRC(963a44f9) SHA1(03cd7699668b010f27af025ba6bd44509526ec7b) )
ROM_LOAD( "405e08.17g", 0x4000, 0x2000, CRC(63901deb) SHA1(c65d896298846ed8b70a4d38b32820746214fa5c) )
@@ -407,23 +625,21 @@ ROM_START( sbaskete )
ROM_LOAD( "405e10.20g", 0x8000, 0x2000, CRC(824815e8) SHA1(470e9d74fa2c397605a74e0bf173a6d9db4cc721) )
ROM_LOAD( "405e11.22g", 0xa000, 0x2000, CRC(dca9b447) SHA1(12d7e85dc2fc6bd4ea7ad9035ae0b7487e4bc4bc) )
- ROM_REGION( 0x0500, "proms", 0 ) /* roms located on the CPU/Video board */
- ROM_LOAD( "405e17.5a", 0x0000, 0x0100, CRC(b4c36d57) SHA1(c4a63f57edce2b9588e2394ff54a28f91213d550) ) /* palette red component */
- ROM_LOAD( "405e16.4a", 0x0100, 0x0100, CRC(0b7b03b8) SHA1(81297cb2b0b28b0fc0939a37ff30844d69fb65ac) ) /* palette green component */
- ROM_LOAD( "405e18.6a", 0x0200, 0x0100, CRC(9e533bad) SHA1(611e7af6813caaf2bc36c311ae48a5efd30e6f0c) ) /* palette blue component */
- ROM_LOAD( "405e20.19d", 0x0300, 0x0100, CRC(8ca6de2f) SHA1(67d29708d1a07d17c5dc5793a3293e7ace3a4e19) ) /* character lookup table */
- ROM_LOAD( "405e19.16d", 0x0400, 0x0100, CRC(e0bc782f) SHA1(9f71e696d11a60f771535f6837ecad6132047b0a) ) /* sprite lookup table */
+ ROM_REGION( 0x0500, "proms", 0 ) // ROMs located on the CPU/Video board
+ ROM_LOAD( "405e17.5a", 0x0000, 0x0100, CRC(b4c36d57) SHA1(c4a63f57edce2b9588e2394ff54a28f91213d550) ) // palette red component
+ ROM_LOAD( "405e16.4a", 0x0100, 0x0100, CRC(0b7b03b8) SHA1(81297cb2b0b28b0fc0939a37ff30844d69fb65ac) ) // palette green component
+ ROM_LOAD( "405e18.6a", 0x0200, 0x0100, CRC(9e533bad) SHA1(611e7af6813caaf2bc36c311ae48a5efd30e6f0c) ) // palette blue component
+ ROM_LOAD( "405e20.19d", 0x0300, 0x0100, CRC(8ca6de2f) SHA1(67d29708d1a07d17c5dc5793a3293e7ace3a4e19) ) // character lookup table
+ ROM_LOAD( "405e19.16d", 0x0400, 0x0100, CRC(e0bc782f) SHA1(9f71e696d11a60f771535f6837ecad6132047b0a) ) // sprite lookup table
- ROM_REGION( 0x10000, "vlm", 0 ) /* 64k for speech rom, located on Sound Board */
+ ROM_REGION( 0x10000, "vlm", 0 ) // speech, located on Sound Board
ROM_LOAD( "405e15.11f", 0x0000, 0x2000, CRC(01bb5ce9) SHA1(f48477b4011befba13c8bcd83e0c9f7deb14a1e1) )
ROM_END
+} // anonymous namespace
-void sbasketb_state::init_sbasketb()
-{
-}
-GAME( 1984, sbasketb, 0, sbasketb, sbasketb, sbasketb_state, init_sbasketb, ROT90, "Konami", "Super Basketball (version I, encrypted)", MACHINE_SUPPORTS_SAVE )
-GAME( 1984, sbasketh, sbasketb, sbasketbu, sbasketb, sbasketb_state, empty_init, ROT90, "Konami", "Super Basketball (version H, unprotected)", MACHINE_SUPPORTS_SAVE )
-GAME( 1984, sbasketg, sbasketb, sbasketb, sbasketb, sbasketb_state, init_sbasketb, ROT90, "Konami", "Super Basketball (version G, encrypted)", MACHINE_SUPPORTS_SAVE )
-GAME( 1984, sbaskete, sbasketb, sbasketb, sbasketb, sbasketb_state, init_sbasketb, ROT90, "Konami", "Super Basketball (version E, encrypted)", MACHINE_SUPPORTS_SAVE )
+GAME( 1984, sbasketb, 0, sbasketb, sbasketb, sbasketb_state, empty_init, ROT90, "Konami", "Super Basketball (version I, encrypted)", MACHINE_SUPPORTS_SAVE )
+GAME( 1984, sbasketh, sbasketb, sbasketbu, sbasketb, sbasketb_state, empty_init, ROT90, "Konami", "Super Basketball (version H, unprotected)", MACHINE_SUPPORTS_SAVE )
+GAME( 1984, sbasketg, sbasketb, sbasketb, sbasketb, sbasketb_state, empty_init, ROT90, "Konami", "Super Basketball (version G, encrypted)", MACHINE_SUPPORTS_SAVE )
+GAME( 1984, sbaskete, sbasketb, sbasketb, sbasketb, sbasketb_state, empty_init, ROT90, "Konami", "Super Basketball (version E, encrypted)", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/konami/sbasketb.h b/src/mame/konami/sbasketb.h
deleted file mode 100644
index b058824faf4..00000000000
--- a/src/mame/konami/sbasketb.h
+++ /dev/null
@@ -1,90 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Zsolt Vasvari
-#ifndef MAME_INCLUDES_SBASKETB_H
-#define MAME_INCLUDES_SBASKETB_H
-
-#pragma once
-
-#include "trackfld_a.h"
-#include "sound/dac.h"
-#include "sound/sn76496.h"
-#include "sound/vlm5030.h"
-
-#include "emupal.h"
-#include "screen.h"
-#include "tilemap.h"
-
-class sbasketb_state : public driver_device
-{
-public:
- sbasketb_state(const machine_config &mconfig, device_type type, const char *tag) :
- driver_device(mconfig, type, tag),
- m_colorram(*this, "colorram"),
- m_videoram(*this, "videoram"),
- m_spriteram(*this, "spriteram"),
- m_palettebank(*this, "palettebank"),
- m_scroll(*this, "scroll"),
- m_maincpu(*this, "maincpu"),
- m_audiocpu(*this, "audiocpu"),
- m_soundbrd(*this, "trackfld_audio"),
- m_dac(*this, "dac"),
- m_sn(*this, "snsnd"),
- m_vlm(*this, "vlm"),
- m_screen(*this, "screen"),
- m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "palette")
- { }
-
- void sbasketb(machine_config &config);
- void sbasketbu(machine_config &config);
-
- void init_sbasketb();
-
-private:
- /* memory pointers */
- required_shared_ptr<uint8_t> m_colorram;
- required_shared_ptr<uint8_t> m_videoram;
- required_shared_ptr<uint8_t> m_spriteram;
- required_shared_ptr<uint8_t> m_palettebank;
- required_shared_ptr<uint8_t> m_scroll;
-
- /* devices */
- required_device<cpu_device> m_maincpu;
- required_device<cpu_device> m_audiocpu;
- required_device<trackfld_audio_device> m_soundbrd;
- required_device<dac_8bit_r2r_device> m_dac;
- required_device<sn76489_device> m_sn;
- required_device<vlm5030_device> m_vlm;
- required_device<screen_device> m_screen;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
-
- /* video-related */
- tilemap_t *m_bg_tilemap = nullptr;
- bool m_spriteram_select = false;
-
- bool m_irq_mask = false;
- void sbasketb_sh_irqtrigger_w(uint8_t data);
- DECLARE_WRITE_LINE_MEMBER(coin_counter_1_w);
- DECLARE_WRITE_LINE_MEMBER(coin_counter_2_w);
- DECLARE_WRITE_LINE_MEMBER(irq_mask_w);
- void sbasketb_videoram_w(offs_t offset, uint8_t data);
- void sbasketb_colorram_w(offs_t offset, uint8_t data);
- DECLARE_WRITE_LINE_MEMBER(flipscreen_w);
- DECLARE_WRITE_LINE_MEMBER(spriteram_select_w);
-
- 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 video_start() override;
- void sbasketb_palette(palette_device &palette) const;
- uint32_t screen_update_sbasketb(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 sbasketb_map(address_map &map);
- void sbasketb_sound_map(address_map &map);
-};
-
-#endif // MAME_INCLUDES_SBASKETB_H
diff --git a/src/mame/konami/sbasketb_v.cpp b/src/mame/konami/sbasketb_v.cpp
deleted file mode 100644
index 80095b808af..00000000000
--- a/src/mame/konami/sbasketb_v.cpp
+++ /dev/null
@@ -1,178 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Zsolt Vasvari
-/***************************************************************************
-
- video.c
-
- Functions to emulate the video hardware of the machine.
-
-***************************************************************************/
-
-#include "emu.h"
-#include "video/resnet.h"
-#include "sbasketb.h"
-
-/***************************************************************************
-
- Convert the color PROMs into a more useable format.
-
- Super Basketball 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 sbasketb_state::sbasketb_palette(palette_device &palette) const
-{
- const uint8_t *color_prom = memregion("proms")->base();
- 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, 1000, 0,
- 4, resistances, gweights, 1000, 0,
- 4, resistances, bweights, 1000, 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 0xf0-0xff
- for (int i = 0; i < 0x100; i++)
- {
- uint8_t const ctabentry = (color_prom[i] & 0x0f) | 0xf0;
- palette.set_pen_indirect(i, ctabentry);
- }
-
- // sprites use colors 0-256 (?) in 16 banks
- for (int i = 0; i < 0x100; i++)
- {
- for (int j = 0; j < 0x10; j++)
- {
- uint8_t const ctabentry = (j << 4) | (color_prom[i + 0x100] & 0x0f);
- palette.set_pen_indirect(0x100 + ((j << 8) | i), ctabentry);
- }
- }
-}
-
-void sbasketb_state::sbasketb_videoram_w(offs_t offset, uint8_t data)
-{
- m_videoram[offset] = data;
- m_bg_tilemap->mark_tile_dirty(offset);
-}
-
-void sbasketb_state::sbasketb_colorram_w(offs_t offset, uint8_t data)
-{
- m_colorram[offset] = data;
- m_bg_tilemap->mark_tile_dirty(offset);
-}
-
-WRITE_LINE_MEMBER(sbasketb_state::flipscreen_w)
-{
- flip_screen_set(state);
- machine().tilemap().mark_all_dirty();
-}
-
-WRITE_LINE_MEMBER(sbasketb_state::spriteram_select_w)
-{
- m_spriteram_select = state;
-}
-
-TILE_GET_INFO_MEMBER(sbasketb_state::get_bg_tile_info)
-{
- int code = m_videoram[tile_index] + ((m_colorram[tile_index] & 0x20) << 3);
- int color = m_colorram[tile_index] & 0x0f;
- int flags = ((m_colorram[tile_index] & 0x40) ? TILE_FLIPX : 0) | ((m_colorram[tile_index] & 0x80) ? TILE_FLIPY : 0);
-
- tileinfo.set(0, code, color, flags);
-}
-
-void sbasketb_state::video_start()
-{
- m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(sbasketb_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
- m_bg_tilemap->set_scroll_cols(32);
-
- save_item(NAME(m_spriteram_select));
-}
-
-void sbasketb_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
-{
- uint8_t *spriteram = m_spriteram;
- int offs = m_spriteram_select ? 0x100 : 0;
- int i;
-
- for (i = 0; i < 64; i++, offs += 4)
- {
- int sx = spriteram[offs + 2];
- int sy = spriteram[offs + 3];
-
- if (sx || sy)
- {
- int code = spriteram[offs + 0] | ((spriteram[offs + 1] & 0x20) << 3);
- int color = (spriteram[offs + 1] & 0x0f) + 16 * *m_palettebank;
- int flipx = spriteram[offs + 1] & 0x40;
- int flipy = spriteram[offs + 1] & 0x80;
-
- if (flip_screen())
- {
- sx = 240 - sx;
- sy = 240 - sy;
- flipx = !flipx;
- flipy = !flipy;
- }
-
-
- m_gfxdecode->gfx(1)->transpen(bitmap,cliprect,
- code, color,
- flipx, flipy,
- sx, sy, 0);
- }
- }
-}
-
-uint32_t sbasketb_state::screen_update_sbasketb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
- int col;
-
- for (col = 6; col < 32; col++)
- m_bg_tilemap->set_scrolly(col, *m_scroll);
-
- m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
- draw_sprites(bitmap, cliprect);
- return 0;
-}
diff --git a/src/mame/konami/tp84.cpp b/src/mame/konami/tp84.cpp
index c4646b050fb..a17f2a41e9b 100644
--- a/src/mame/konami/tp84.cpp
+++ b/src/mame/konami/tp84.cpp
@@ -1,5 +1,6 @@
// license:BSD-3-Clause
-// copyright-holders:Aaron Giles
+// copyright-holders: Aaron Giles
+
/***************************************************************************
Time Pilot 84 (c) 1984 Konami
@@ -64,7 +65,7 @@ C004 76489 #4 trigger
***************************************************************************/
#include "emu.h"
-#include "tp84.h"
+
#include "konamipt.h"
#include "cpu/m6809/m6809.h"
@@ -72,11 +73,285 @@ C004 76489 #4 trigger
#include "machine/74259.h"
#include "machine/gen_latch.h"
#include "machine/watchdog.h"
+#include "sound/flt_rc.h"
#include "sound/sn76496.h"
+#include "video/resnet.h"
+#include "emupal.h"
+#include "screen.h"
#include "speaker.h"
+#include "tilemap.h"
+
+
+namespace {
+
+class tp84_state : public driver_device
+{
+public:
+ tp84_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
+ m_maincpu(*this, "cpu1"),
+ m_subcpu(*this, "sub"),
+ m_audiocpu(*this, "audiocpu"),
+ m_gfxdecode(*this, "gfxdecode"),
+ m_screen(*this, "screen"),
+ m_palette(*this, "palette"),
+ m_filter(*this, "filter%u", 1U),
+ m_palette_bank(*this, "palette_bank"),
+ m_scroll_x(*this, "scroll_x"),
+ m_scroll_y(*this, "scroll_y"),
+ m_bg_videoram(*this, "bg_videoram"),
+ m_fg_videoram(*this, "fg_videoram"),
+ m_bg_colorram(*this, "bg_colorram"),
+ m_fg_colorram(*this, "fg_colorram"),
+ m_spriteram(*this, "spriteram")
+ { }
+
+ void tp84(machine_config &config);
+ void tp84b(machine_config &config);
+
+protected:
+ virtual void machine_start() override;
+ virtual void video_start() override;
+
+private:
+ required_device<cpu_device> m_maincpu;
+ required_device<cpu_device> m_subcpu;
+ required_device<cpu_device> m_audiocpu;
+ required_device<gfxdecode_device> m_gfxdecode;
+ required_device<screen_device> m_screen;
+ required_device<palette_device> m_palette;
+ required_device_array<filter_rc_device, 3> m_filter;
+
+ required_shared_ptr<uint8_t> m_palette_bank;
+ required_shared_ptr<uint8_t> m_scroll_x;
+ required_shared_ptr<uint8_t> m_scroll_y;
+ required_shared_ptr<uint8_t> m_bg_videoram;
+ required_shared_ptr<uint8_t> m_fg_videoram;
+ required_shared_ptr<uint8_t> m_bg_colorram;
+ required_shared_ptr<uint8_t> m_fg_colorram;
+ required_shared_ptr<uint8_t> m_spriteram;
+
+ tilemap_t *m_bg_tilemap = nullptr;
+ tilemap_t *m_fg_tilemap = nullptr;
+ bool m_flipscreen_x = false;
+ bool m_flipscreen_y = false;
+
+ bool m_irq_enable = false;
+ bool m_sub_irq_mask = false;
+
+ DECLARE_WRITE_LINE_MEMBER(irq_enable_w);
+ template <uint8_t Which> DECLARE_WRITE_LINE_MEMBER(coin_counter_w);
+ DECLARE_WRITE_LINE_MEMBER(flip_screen_x_w);
+ DECLARE_WRITE_LINE_MEMBER(flip_screen_y_w);
+ uint8_t sh_timer_r();
+ void filter_w(offs_t offset, uint8_t data);
+ void sh_irqtrigger_w(uint8_t data);
+ void sub_irq_mask_w(uint8_t data);
+ void spriteram_w(offs_t offset, uint8_t data);
+ uint8_t scanline_r();
+ TILE_GET_INFO_MEMBER(get_bg_tile_info);
+ TILE_GET_INFO_MEMBER(get_fg_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 audio_map(address_map &map);
+ void cpu2_map(address_map &map);
+ void tp84_cpu1_map(address_map &map);
+ void tp84b_cpu1_map(address_map &map);
+};
+
+
+// video
+
+/*
+-The colortable is divided in 2 part:
+ -The characters colors
+ -The sprites colors
+
+-The characters colors are indexed like this:
+ -2 bits from the characters
+ -4 bits from the attribute in m_bg_colorram
+ -2 bits from m_palette_bank (d3-d4)
+ -3 bits from m_palette_bank (d0-d1-d2)
+-So, there is 2048 bytes for the characters
+
+-The sprites colors are indexed like this:
+ -4 bits from the sprites (16 colors)
+ -4 bits from the attribute of the sprites
+ -3 bits from m_palette_bank (d0-d1-d2)
+-So, there is 2048 bytes for the sprites
+
+*/
+/*
+ The RGB signals are generated by 3 PROMs 256X4 (prom 2C, 2D and 1E)
+ The resistors values are:
+ 1K ohm
+ 470 ohm
+ 220 ohm
+ 100 ohm
+*/
+
+void tp84_state::palette(palette_device &palette) const
+{
+ const uint8_t *color_prom = memregion("proms")->base();
+ static constexpr int resistances[4] = { 1000, 470, 220, 100 };
+
+ // compute the color output resistor weights
+ double weights[4];
+ compute_resistor_weights(0, 255, -1.0,
+ 4, resistances, weights, 470, 0,
+ 0, nullptr, nullptr, 0, 0,
+ 0, nullptr, nullptr, 0, 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(weights, 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(weights, 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(weights, 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 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 tp84_state::spriteram_w(offs_t offset, uint8_t data)
+{
+ // the game multiplexes the sprites, so update now
+// m_screen->update_now();
+ m_screen->update_partial(m_screen->vpos());
+ m_spriteram[offset] = data;
+}
+uint8_t tp84_state::scanline_r()
+{
+ // reads 1V - 128V
+ return m_screen->vpos();
+}
+
+
+TILE_GET_INFO_MEMBER(tp84_state::get_bg_tile_info)
+{
+ int const code = ((m_bg_colorram[tile_index] & 0x30) << 4) | m_bg_videoram[tile_index];
+ int const color = ((*m_palette_bank & 0x07) << 6) |
+ ((*m_palette_bank & 0x18) << 1) |
+ (m_bg_colorram[tile_index] & 0x0f);
+ int const flags = TILE_FLIPYX(m_bg_colorram[tile_index] >> 6);
+
+ tileinfo.set(0, code, color, flags);
+}
+
+TILE_GET_INFO_MEMBER(tp84_state::get_fg_tile_info)
+{
+ int const code = ((m_fg_colorram[tile_index] & 0x30) << 4) | m_fg_videoram[tile_index];
+ int const color = ((*m_palette_bank & 0x07) << 6) |
+ ((*m_palette_bank & 0x18) << 1) |
+ (m_fg_colorram[tile_index] & 0x0f);
+ int const flags = TILE_FLIPYX(m_fg_colorram[tile_index] >> 6);
+
+ tileinfo.set(0, code, color, flags);
+}
+
+
+void tp84_state::video_start()
+{
+ m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(tp84_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
+ m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(tp84_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
+}
+
+
+void tp84_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ int const palette_base = ((*m_palette_bank & 0x07) << 4);
+
+ for (int offs = 0x5c; offs >= 0; offs -= 4)
+ {
+ int const x = m_spriteram[offs];
+ int const y = 240 - m_spriteram[offs + 3];
+
+ int const code = m_spriteram[offs + 1];
+ int const color = palette_base | (m_spriteram[offs + 2] & 0x0f);
+ int const flip_x = ~m_spriteram[offs + 2] & 0x40;
+ int const flip_y = m_spriteram[offs + 2] & 0x80;
+
+ m_gfxdecode->gfx(1)->transmask(bitmap, cliprect, code, color, flip_x, flip_y, x, y,
+ m_palette->transpen_mask(*m_gfxdecode->gfx(1), color, palette_base));
+
+ }
+}
+
+
+uint32_t tp84_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ rectangle clip = cliprect;
+ const rectangle &visarea = screen.visible_area();
+
+ if (cliprect.min_y == screen.visible_area().min_y)
+ {
+ machine().tilemap().mark_all_dirty();
+
+ m_bg_tilemap->set_scrollx(0, *m_scroll_x);
+ m_bg_tilemap->set_scrolly(0, *m_scroll_y);
+
+ machine().tilemap().set_flip_all((m_flipscreen_x ? TILEMAP_FLIPX : 0) |
+ (m_flipscreen_y ? TILEMAP_FLIPY : 0));
+ }
+
+ m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
+ draw_sprites(bitmap, cliprect);
+
+ // draw top status region
+ clip.min_x = visarea.min_x;
+ clip.max_x = visarea.min_x + 15;
+ m_fg_tilemap->draw(screen, bitmap, clip, 0, 0);
+
+ // draw bottom status region
+ clip.min_x = visarea.max_x - 15;
+ clip.max_x = visarea.max_x;
+ m_fg_tilemap->draw(screen, bitmap, clip, 0, 0);
+
+ return 0;
+}
+
+
+// machine
+
void tp84_state::machine_start()
{
save_item(NAME(m_irq_enable));
@@ -103,15 +378,10 @@ WRITE_LINE_MEMBER(tp84_state::irq_enable_w)
}
-WRITE_LINE_MEMBER(tp84_state::coin_counter_1_w)
+template <uint8_t Which>
+WRITE_LINE_MEMBER(tp84_state::coin_counter_w)
{
- machine().bookkeeping().coin_counter_w(0, state);
-}
-
-
-WRITE_LINE_MEMBER(tp84_state::coin_counter_2_w)
-{
- machine().bookkeeping().coin_counter_w(1, state);
+ machine().bookkeeping().coin_counter_w(Which, state);
}
@@ -127,46 +397,46 @@ WRITE_LINE_MEMBER(tp84_state::flip_screen_y_w)
}
-uint8_t tp84_state::tp84_sh_timer_r()
+uint8_t tp84_state::sh_timer_r()
{
- /* main xtal 14.318MHz, divided by 4 to get the CPU clock, further */
- /* divided by 2048 to get this timer */
- /* (divide by (2048/2), and not 1024, because the CPU cycle counter is */
- /* incremented every other state change of the clock) */
+ /* main xtal 14.318MHz, divided by 4 to get the CPU clock, further
+ divided by 2048 to get this timer
+ (divide by (2048/2), and not 1024, because the CPU cycle counter is
+ incremented every other state change of the clock) */
return (m_audiocpu->total_cycles() / (2048/2)) & 0x0f;
}
-void tp84_state::tp84_filter_w(offs_t offset, uint8_t data)
+void tp84_state::filter_w(offs_t offset, uint8_t data)
{
int C;
- /* 76489 #0 */
+ // 76489 #0
C = 0;
- if (offset & 0x008) C += 47000; /* 47000pF = 0.047uF */
- if (offset & 0x010) C += 470000; /* 470000pF = 0.47uF */
- m_filter[0]->filter_rc_set_RC(filter_rc_device::LOWPASS_3R,1000,2200,1000,CAP_P(C));
+ if (offset & 0x008) C += 47000; // 47000pF = 0.047uF
+ if (offset & 0x010) C += 470000; // 470000pF = 0.47uF
+ m_filter[0]->filter_rc_set_RC(filter_rc_device::LOWPASS_3R, 1000, 2200, 1000, CAP_P(C));
- /* 76489 #1 (optional) */
+ // 76489 #1 (optional)
C = 0;
- if (offset & 0x020) C += 47000; /* 47000pF = 0.047uF */
- if (offset & 0x040) C += 470000; /* 470000pF = 0.47uF */
- //m_filter[1]->filter_rc_set_RC(filter_rc_device::LOWPASS_3R,1000,2200,1000,CAP_P(C));
+ if (offset & 0x020) C += 47000; // 47000pF = 0.047uF
+ if (offset & 0x040) C += 470000; // 470000pF = 0.47uF
+ //m_filter[1]->filter_rc_set_RC(filter_rc_device::LOWPASS_3R, 1000, 2200, 1000, CAP_P(C));
- /* 76489 #2 */
+ // 76489 #2
C = 0;
- if (offset & 0x080) C += 470000; /* 470000pF = 0.47uF */
- m_filter[1]->filter_rc_set_RC(filter_rc_device::LOWPASS_3R,1000,2200,1000,CAP_P(C));
+ if (offset & 0x080) C += 470000; // 470000pF = 0.47uF
+ m_filter[1]->filter_rc_set_RC(filter_rc_device::LOWPASS_3R, 1000, 2200, 1000, CAP_P(C));
- /* 76489 #3 */
+ // 76489 #3
C = 0;
- if (offset & 0x100) C += 470000; /* 470000pF = 0.47uF */
- m_filter[2]->filter_rc_set_RC(filter_rc_device::LOWPASS_3R,1000,2200,1000,CAP_P(C));
+ if (offset & 0x100) C += 470000; // 470000pF = 0.47uF
+ m_filter[2]->filter_rc_set_RC(filter_rc_device::LOWPASS_3R, 1000, 2200, 1000, CAP_P(C));
}
-void tp84_state::tp84_sh_irqtrigger_w(uint8_t data)
+void tp84_state::sh_irqtrigger_w(uint8_t data)
{
- m_audiocpu->set_input_line_and_vector(0,HOLD_LINE,0xff); // Z80
+ m_audiocpu->set_input_line_and_vector(0, HOLD_LINE, 0xff); // Z80
}
@@ -174,42 +444,42 @@ void tp84_state::tp84_sh_irqtrigger_w(uint8_t data)
void tp84_state::tp84_cpu1_map(address_map &map)
{
map(0x2000, 0x2000).w("watchdog", FUNC(watchdog_timer_device::reset_w));
- map(0x2800, 0x2800).portr("SYSTEM").writeonly().share("palette_bank");
+ map(0x2800, 0x2800).portr("SYSTEM").writeonly().share(m_palette_bank);
map(0x2820, 0x2820).portr("P1");
map(0x2840, 0x2840).portr("P2");
map(0x2860, 0x2860).portr("DSW1");
map(0x3000, 0x3000).portr("DSW2");
map(0x3000, 0x3007).w("mainlatch", FUNC(ls259_device::write_d0));
- map(0x3800, 0x3800).w(FUNC(tp84_state::tp84_sh_irqtrigger_w));
+ map(0x3800, 0x3800).w(FUNC(tp84_state::sh_irqtrigger_w));
map(0x3a00, 0x3a00).w("soundlatch", FUNC(generic_latch_8_device::write));
- map(0x3c00, 0x3c00).writeonly().share("scroll_x");
- map(0x3e00, 0x3e00).writeonly().share("scroll_y");
- map(0x4000, 0x43ff).ram().share("bg_videoram");
- map(0x4400, 0x47ff).ram().share("fg_videoram");
- map(0x4800, 0x4bff).ram().share("bg_colorram");
- map(0x4c00, 0x4fff).ram().share("fg_colorram");
- map(0x5000, 0x57ff).ram().share("share1");
+ map(0x3c00, 0x3c00).writeonly().share(m_scroll_x);
+ map(0x3e00, 0x3e00).writeonly().share(m_scroll_y);
+ map(0x4000, 0x43ff).ram().share(m_bg_videoram);
+ map(0x4400, 0x47ff).ram().share(m_fg_videoram);
+ map(0x4800, 0x4bff).ram().share(m_bg_colorram);
+ map(0x4c00, 0x4fff).ram().share(m_fg_colorram);
+ map(0x5000, 0x57ff).ram().share("cpu1_2");
map(0x8000, 0xffff).rom();
}
void tp84_state::tp84b_cpu1_map(address_map &map)
{
- map(0x0000, 0x03ff).ram().share("bg_videoram");
- map(0x0400, 0x07ff).ram().share("fg_videoram");
- map(0x0800, 0x0bff).ram().share("bg_colorram");
- map(0x0c00, 0x0fff).ram().share("fg_colorram");
- map(0x1000, 0x17ff).ram().share("share1");
+ map(0x0000, 0x03ff).ram().share(m_bg_videoram);
+ map(0x0400, 0x07ff).ram().share(m_fg_videoram);
+ map(0x0800, 0x0bff).ram().share(m_bg_colorram);
+ map(0x0c00, 0x0fff).ram().share(m_fg_colorram);
+ map(0x1000, 0x17ff).ram().share("cpu1_2");
map(0x1800, 0x1800).w("watchdog", FUNC(watchdog_timer_device::reset_w));
- map(0x1a00, 0x1a00).portr("SYSTEM").writeonly().share("palette_bank");
+ map(0x1a00, 0x1a00).portr("SYSTEM").writeonly().share(m_palette_bank);
map(0x1a20, 0x1a20).portr("P1");
map(0x1a40, 0x1a40).portr("P2");
map(0x1a60, 0x1a60).portr("DSW1");
map(0x1c00, 0x1c00).portr("DSW2");
map(0x1c00, 0x1c07).w("mainlatch", FUNC(ls259_device::write_d0));
- map(0x1e00, 0x1e00).w(FUNC(tp84_state::tp84_sh_irqtrigger_w));
+ map(0x1e00, 0x1e00).w(FUNC(tp84_state::sh_irqtrigger_w));
map(0x1e80, 0x1e80).w("soundlatch", FUNC(generic_latch_8_device::write));
- map(0x1f00, 0x1f00).writeonly().share("scroll_x");
- map(0x1f80, 0x1f80).writeonly().share("scroll_y");
+ map(0x1f00, 0x1f00).writeonly().share(m_scroll_x);
+ map(0x1f80, 0x1f80).writeonly().share(m_scroll_y);
map(0x8000, 0xffff).rom();
}
@@ -224,12 +494,12 @@ void tp84_state::sub_irq_mask_w(uint8_t data)
void tp84_state::cpu2_map(address_map &map)
{
-// map(0x0000, 0x0000).ram(); /* Watch dog ?*/
- map(0x2000, 0x2000).r(FUNC(tp84_state::tp84_scanline_r)); /* beam position */
+// map(0x0000, 0x0000).ram(); // Watch dog ?
+ map(0x2000, 0x2000).r(FUNC(tp84_state::scanline_r)); // beam position
map(0x4000, 0x4000).w(FUNC(tp84_state::sub_irq_mask_w));
map(0x6000, 0x679f).ram();
- map(0x67a0, 0x67ff).ram().w(FUNC(tp84_state::tp84_spriteram_w)).share("spriteram");
- map(0x8000, 0x87ff).ram().share("share1");
+ map(0x67a0, 0x67ff).ram().w(FUNC(tp84_state::spriteram_w)).share(m_spriteram);
+ map(0x8000, 0x87ff).ram().share("cpu1_2");
map(0xe000, 0xffff).rom();
}
@@ -239,8 +509,8 @@ void tp84_state::audio_map(address_map &map)
map(0x0000, 0x3fff).rom();
map(0x4000, 0x43ff).ram();
map(0x6000, 0x6000).r("soundlatch", FUNC(generic_latch_8_device::read));
- map(0x8000, 0x8000).r(FUNC(tp84_state::tp84_sh_timer_r));
- map(0xa000, 0xa1ff).w(FUNC(tp84_state::tp84_filter_w));
+ map(0x8000, 0x8000).r(FUNC(tp84_state::sh_timer_r));
+ map(0xa000, 0xa1ff).w(FUNC(tp84_state::filter_w));
map(0xc000, 0xc000).nopw();
map(0xc001, 0xc001).w("y2404_1", FUNC(y2404_device::write));
map(0xc003, 0xc003).w("y2404_2", FUNC(y2404_device::write));
@@ -261,7 +531,7 @@ static INPUT_PORTS_START( tp84 )
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, 0x02, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:1,2")
@@ -324,58 +594,58 @@ static const gfx_layout spritelayout =
};
static GFXDECODE_START( gfx_tp84 )
- GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 64*8 )
- GFXDECODE_ENTRY( "gfx2", 0, spritelayout, 64*4*8, 16*8 )
+ GFXDECODE_ENTRY( "tiles", 0, charlayout, 0, 64*8 )
+ GFXDECODE_ENTRY( "sprites", 0, spritelayout, 64*4*8, 16*8 )
GFXDECODE_END
void tp84_state::tp84(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, &tp84_state::tp84_cpu1_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, &tp84_state::cpu2_map);
- Z80(config, m_audiocpu, XTAL(14'318'181)/4); /* verified on pcb */
+ Z80(config, m_audiocpu, XTAL(14'318'181) / 4); // verified on PCB
m_audiocpu->set_addrmap(AS_PROGRAM, &tp84_state::audio_map);
- config.set_maximum_quantum(attotime::from_hz(6000)); /* 100 CPU slices per frame - a high value to ensure proper */
- /* synchronization of the CPUs */
+ config.set_maximum_quantum(attotime::from_hz(6000)); /* 100 CPU slices per frame - a high value to ensure proper
+ synchronization of the CPUs */
ls259_device &mainlatch(LS259(config, "mainlatch", 0)); // 3B
mainlatch.q_out_cb<0>().set(FUNC(tp84_state::irq_enable_w));
- mainlatch.q_out_cb<1>().set(FUNC(tp84_state::coin_counter_2_w));
- mainlatch.q_out_cb<2>().set(FUNC(tp84_state::coin_counter_1_w));
+ mainlatch.q_out_cb<1>().set(FUNC(tp84_state::coin_counter_w<1>));
+ mainlatch.q_out_cb<2>().set(FUNC(tp84_state::coin_counter_w<0>));
mainlatch.q_out_cb<4>().set(FUNC(tp84_state::flip_screen_x_w));
mainlatch.q_out_cb<5>().set(FUNC(tp84_state::flip_screen_y_w));
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));
m_screen->set_size(32*8, 32*8);
m_screen->set_visarea(0*8, 32*8-1, 2*8, 30*8-1);
- m_screen->set_screen_update(FUNC(tp84_state::screen_update_tp84));
+ m_screen->set_screen_update(FUNC(tp84_state::screen_update));
m_screen->set_palette(m_palette);
m_screen->screen_vblank().set(FUNC(tp84_state::vblank_irq));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_tp84);
- PALETTE(config, m_palette, FUNC(tp84_state::tp84_palette), 4096, 256);
+ PALETTE(config, m_palette, FUNC(tp84_state::palette), 4096, 256);
- /* audio hardware */
+ // audio hardware
SPEAKER(config, "mono").front_center();
GENERIC_LATCH_8(config, "soundlatch");
- Y2404(config, "y2404_1", XTAL(14'318'181)/8).add_route(ALL_OUTPUTS, "filter1", 0.75); /* verified on pcb */
+ Y2404(config, "y2404_1", XTAL(14'318'181) / 8).add_route(ALL_OUTPUTS, "filter1", 0.75); // verified on PCB
- Y2404(config, "y2404_2", XTAL(14'318'181)/8).add_route(ALL_OUTPUTS, "filter2", 0.75); /* verified on pcb */
+ Y2404(config, "y2404_2", XTAL(14'318'181) / 8).add_route(ALL_OUTPUTS, "filter2", 0.75); // verified on PCB
- Y2404(config, "y2404_3", XTAL(14'318'181)/8).add_route(ALL_OUTPUTS, "filter3", 0.75); /* verified on pcb */
+ Y2404(config, "y2404_3", XTAL(14'318'181) / 8).add_route(ALL_OUTPUTS, "filter3", 0.75); // verified on PCB
for (auto &filter : m_filter)
FILTER_RC(config, filter).add_route(ALL_OUTPUTS, "mono", 1.0);
@@ -400,28 +670,28 @@ ROM_START( tp84 )
ROM_LOAD( "388_f06.9j", 0xc000, 0x2000, CRC(dbd5333b) SHA1(65dee1fd4c940a5423d57cb55a7f2ad89c59c5c6) )
ROM_LOAD( "388_07.10j", 0xe000, 0x2000, CRC(a45237c4) SHA1(896e31c59aedf1c7e73e6f30fbe78cc020b457ab) )
- ROM_REGION( 0x10000, "sub", 0 ) /* 64k for the second CPU */
- ROM_LOAD( "388_f08.10d", 0xe000, 0x2000, CRC(36462ff1) SHA1(118a1b46ee01a583e6cf39af59b073321c76dbff) ) /* E08? */
+ ROM_REGION( 0x10000, "sub", 0 )
+ ROM_LOAD( "388_f08.10d", 0xe000, 0x2000, CRC(36462ff1) SHA1(118a1b46ee01a583e6cf39af59b073321c76dbff) ) // E08?
- ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for code of sound cpu Z80 */
+ ROM_REGION( 0x10000, "audiocpu", 0 )
ROM_LOAD( "388j13.6a", 0x0000, 0x2000, CRC(c44414da) SHA1(981289f5bdf7dc1348f4ca547ac933ef503b6588) )
- ROM_REGION( 0x4000, "gfx1", 0 )
- ROM_LOAD( "388_h02.2j", 0x0000, 0x2000, CRC(05c7508f) SHA1(1a3c7cd47ad34e37a7b0f3014e10c055cbb2b559) ) /* chars */
+ ROM_REGION( 0x4000, "tiles", 0 )
+ ROM_LOAD( "388_h02.2j", 0x0000, 0x2000, CRC(05c7508f) SHA1(1a3c7cd47ad34e37a7b0f3014e10c055cbb2b559) )
ROM_LOAD( "388_d01.1j", 0x2000, 0x2000, CRC(498d90b7) SHA1(6975f3a1603b14132aab58329195a4845a6e28bb) )
- ROM_REGION( 0x8000, "gfx2", 0 )
- ROM_LOAD( "388_e09.12a", 0x0000, 0x2000, CRC(cd682f30) SHA1(6f48d3efc53d63171ec655e64b225412de1374e4) ) /* sprites */
+ ROM_REGION( 0x8000, "sprites", 0 )
+ ROM_LOAD( "388_e09.12a", 0x0000, 0x2000, CRC(cd682f30) SHA1(6f48d3efc53d63171ec655e64b225412de1374e4) )
ROM_LOAD( "388_e10.13a", 0x2000, 0x2000, CRC(888d4bd6) SHA1(7e2dde080bb614709561431a81b0490b2aaa42a9) )
ROM_LOAD( "388_e11.14a", 0x4000, 0x2000, CRC(9a220b39) SHA1(792aaa4daedc8eb807d5a66d87da4641739b1660) )
ROM_LOAD( "388_e12.15a", 0x6000, 0x2000, CRC(fac98397) SHA1(d90f99b19ab3cddfdfd37a273fb437be098088bc) )
ROM_REGION( 0x0500, "proms", 0 )
- ROM_LOAD( "388d14.2c", 0x0000, 0x0100, CRC(d737eaba) SHA1(e39026f87f5b995cf4a38b5d3d3fee7561762ae6) ) /* palette red component */
- ROM_LOAD( "388d15.2d", 0x0100, 0x0100, CRC(2f6a9a2a) SHA1(f09d8b92c7f9bf046cdd815c5282d0510e61b6e0) ) /* palette green component */
- ROM_LOAD( "388d16.1e", 0x0200, 0x0100, CRC(2e21329b) SHA1(9ba8af294dbd6f3a5d039c74a56e0605a913c037) ) /* palette blue component */
- ROM_LOAD( "388d18.1f", 0x0300, 0x0100, CRC(61d2d398) SHA1(3f74ad733b07b6a31cf9d4956d171eb9253dd6bf) ) /* char lookup table */
- ROM_LOAD( "388j17.16c", 0x0400, 0x0100, CRC(13c4e198) SHA1(42ab23206be99e840bd9c52cefa175c12fac8e5b) ) /* sprite lookup table */
+ ROM_LOAD( "388d14.2c", 0x0000, 0x0100, CRC(d737eaba) SHA1(e39026f87f5b995cf4a38b5d3d3fee7561762ae6) ) // palette red component
+ ROM_LOAD( "388d15.2d", 0x0100, 0x0100, CRC(2f6a9a2a) SHA1(f09d8b92c7f9bf046cdd815c5282d0510e61b6e0) ) // palette green component
+ ROM_LOAD( "388d16.1e", 0x0200, 0x0100, CRC(2e21329b) SHA1(9ba8af294dbd6f3a5d039c74a56e0605a913c037) ) // palette blue component
+ ROM_LOAD( "388d18.1f", 0x0300, 0x0100, CRC(61d2d398) SHA1(3f74ad733b07b6a31cf9d4956d171eb9253dd6bf) ) // char lookup table
+ ROM_LOAD( "388j17.16c", 0x0400, 0x0100, CRC(13c4e198) SHA1(42ab23206be99e840bd9c52cefa175c12fac8e5b) ) // sprite lookup table
ROM_END
ROM_START( tp84a )
@@ -431,57 +701,59 @@ ROM_START( tp84a )
ROM_LOAD( "388_f06.9j", 0xc000, 0x2000, CRC(dbd5333b) SHA1(65dee1fd4c940a5423d57cb55a7f2ad89c59c5c6) )
ROM_LOAD( "388_f07.10j", 0xe000, 0x2000, CRC(8fbdb4ef) SHA1(e615c4d9964ab00f6776147c54925b4b6100b360) )
- ROM_REGION( 0x10000, "sub", 0 ) /* 64k for the second CPU */
- ROM_LOAD( "388_f08.10d", 0xe000, 0x2000, CRC(36462ff1) SHA1(118a1b46ee01a583e6cf39af59b073321c76dbff) ) /* E08? */
+ ROM_REGION( 0x10000, "sub", 0 )
+ ROM_LOAD( "388_f08.10d", 0xe000, 0x2000, CRC(36462ff1) SHA1(118a1b46ee01a583e6cf39af59b073321c76dbff) ) // E08?
- ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for code of sound cpu Z80 */
+ ROM_REGION( 0x10000, "audiocpu", 0 )
ROM_LOAD( "388j13.6a", 0x0000, 0x2000, CRC(c44414da) SHA1(981289f5bdf7dc1348f4ca547ac933ef503b6588) )
- ROM_REGION( 0x4000, "gfx1", 0 )
- ROM_LOAD( "388_h02.2j", 0x0000, 0x2000, CRC(05c7508f) SHA1(1a3c7cd47ad34e37a7b0f3014e10c055cbb2b559) ) /* chars */
+ ROM_REGION( 0x4000, "tiles", 0 )
+ ROM_LOAD( "388_h02.2j", 0x0000, 0x2000, CRC(05c7508f) SHA1(1a3c7cd47ad34e37a7b0f3014e10c055cbb2b559) )
ROM_LOAD( "388_d01.1j", 0x2000, 0x2000, CRC(498d90b7) SHA1(6975f3a1603b14132aab58329195a4845a6e28bb) )
- ROM_REGION( 0x8000, "gfx2", 0 )
- ROM_LOAD( "388_e09.12a", 0x0000, 0x2000, CRC(cd682f30) SHA1(6f48d3efc53d63171ec655e64b225412de1374e4) ) /* sprites */
+ ROM_REGION( 0x8000, "sprites", 0 )
+ ROM_LOAD( "388_e09.12a", 0x0000, 0x2000, CRC(cd682f30) SHA1(6f48d3efc53d63171ec655e64b225412de1374e4) )
ROM_LOAD( "388_e10.13a", 0x2000, 0x2000, CRC(888d4bd6) SHA1(7e2dde080bb614709561431a81b0490b2aaa42a9) )
ROM_LOAD( "388_e11.14a", 0x4000, 0x2000, CRC(9a220b39) SHA1(792aaa4daedc8eb807d5a66d87da4641739b1660) )
ROM_LOAD( "388_e12.15a", 0x6000, 0x2000, CRC(fac98397) SHA1(d90f99b19ab3cddfdfd37a273fb437be098088bc) )
ROM_REGION( 0x0500, "proms", 0 )
- ROM_LOAD( "388d14.2c", 0x0000, 0x0100, CRC(d737eaba) SHA1(e39026f87f5b995cf4a38b5d3d3fee7561762ae6) ) /* palette red component */
- ROM_LOAD( "388d15.2d", 0x0100, 0x0100, CRC(2f6a9a2a) SHA1(f09d8b92c7f9bf046cdd815c5282d0510e61b6e0) ) /* palette green component */
- ROM_LOAD( "388d16.1e", 0x0200, 0x0100, CRC(2e21329b) SHA1(9ba8af294dbd6f3a5d039c74a56e0605a913c037) ) /* palette blue component */
- ROM_LOAD( "388d18.1f", 0x0300, 0x0100, CRC(61d2d398) SHA1(3f74ad733b07b6a31cf9d4956d171eb9253dd6bf) ) /* char lookup table */
- ROM_LOAD( "388d17.16c", 0x0400, 0x0100, CRC(af8f839c) SHA1(b469785a4153a221403fcf72c65c9c35ae75df5d) ) /* sprite lookup table (dump miss?)*/
+ ROM_LOAD( "388d14.2c", 0x0000, 0x0100, CRC(d737eaba) SHA1(e39026f87f5b995cf4a38b5d3d3fee7561762ae6) ) // palette red component
+ ROM_LOAD( "388d15.2d", 0x0100, 0x0100, CRC(2f6a9a2a) SHA1(f09d8b92c7f9bf046cdd815c5282d0510e61b6e0) ) // palette green component
+ ROM_LOAD( "388d16.1e", 0x0200, 0x0100, CRC(2e21329b) SHA1(9ba8af294dbd6f3a5d039c74a56e0605a913c037) ) // palette blue component
+ ROM_LOAD( "388d18.1f", 0x0300, 0x0100, CRC(61d2d398) SHA1(3f74ad733b07b6a31cf9d4956d171eb9253dd6bf) ) // char lookup table
+ ROM_LOAD( "388d17.16c", 0x0400, 0x0100, CRC(af8f839c) SHA1(b469785a4153a221403fcf72c65c9c35ae75df5d) ) // sprite lookup table (dump miss?)
ROM_END
ROM_START( tp84b )
ROM_REGION( 0x10000, "cpu1", 0 )
- /* 0x6000 - 0x7fff space for diagnostic rom */
+ // 0x6000 - 0x7fff space for diagnostic ROM
ROM_LOAD( "388j05.8j", 0x8000, 0x4000, CRC(a59e2fda) SHA1(7d776d5d3fcfbe81d42580cfe93614dc4618a440) )
ROM_LOAD( "388j07.10j", 0xc000, 0x4000, CRC(d25d18e6) SHA1(043f515cc66f6af004be81d6a6b5a92b553107ff) )
- ROM_REGION( 0x10000, "sub", 0 ) /* 64k for the second CPU */
+ ROM_REGION( 0x10000, "sub", 0 )
ROM_LOAD( "388j08.10d", 0xe000, 0x2000, CRC(2aea6b42) SHA1(58c3b4852f22a766f440b98904b73c00a31eae01) )
- ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for code of sound cpu Z80 */
+ ROM_REGION( 0x10000, "audiocpu", 0 )
ROM_LOAD( "388j13.6a", 0x0000, 0x2000, CRC(c44414da) SHA1(981289f5bdf7dc1348f4ca547ac933ef503b6588) )
- ROM_REGION( 0x4000, "gfx1", 0 )
- ROM_LOAD( "388j02.2j", 0x0000, 0x4000, CRC(e1225f53) SHA1(59d07dc4faafc82999e9716f0bba1cb7350c03e3) ) /* chars */
+ ROM_REGION( 0x4000, "tiles", 0 )
+ ROM_LOAD( "388j02.2j", 0x0000, 0x4000, CRC(e1225f53) SHA1(59d07dc4faafc82999e9716f0bba1cb7350c03e3) )
- ROM_REGION( 0x8000, "gfx2", 0 )
- ROM_LOAD( "388j09.12a", 0x0000, 0x4000, CRC(aec90936) SHA1(3420c24bbedb140cb20fdaf51acbe9493830b64a) ) /* sprites */
+ ROM_REGION( 0x8000, "sprites", 0 )
+ ROM_LOAD( "388j09.12a", 0x0000, 0x4000, CRC(aec90936) SHA1(3420c24bbedb140cb20fdaf51acbe9493830b64a) )
ROM_LOAD( "388j11.14a", 0x4000, 0x4000, CRC(29257f03) SHA1(ebbb980bd226e8ada7e517e92487a32bfbc82f91) )
ROM_REGION( 0x0500, "proms", 0 )
- ROM_LOAD( "388j14.2c", 0x0000, 0x0100, CRC(d737eaba) SHA1(e39026f87f5b995cf4a38b5d3d3fee7561762ae6) ) /* palette red component */
- ROM_LOAD( "388j15.2d", 0x0100, 0x0100, CRC(2f6a9a2a) SHA1(f09d8b92c7f9bf046cdd815c5282d0510e61b6e0) ) /* palette green component */
- ROM_LOAD( "388j16.1e", 0x0200, 0x0100, CRC(2e21329b) SHA1(9ba8af294dbd6f3a5d039c74a56e0605a913c037) ) /* palette blue component */
- ROM_LOAD( "388j18.1f", 0x0300, 0x0100, CRC(61d2d398) SHA1(3f74ad733b07b6a31cf9d4956d171eb9253dd6bf) ) /* char lookup table */
- ROM_LOAD( "388j17.16c", 0x0400, 0x0100, CRC(13c4e198) SHA1(42ab23206be99e840bd9c52cefa175c12fac8e5b) ) /* sprite lookup table */
+ ROM_LOAD( "388j14.2c", 0x0000, 0x0100, CRC(d737eaba) SHA1(e39026f87f5b995cf4a38b5d3d3fee7561762ae6) ) // palette red component
+ ROM_LOAD( "388j15.2d", 0x0100, 0x0100, CRC(2f6a9a2a) SHA1(f09d8b92c7f9bf046cdd815c5282d0510e61b6e0) ) // palette green component
+ ROM_LOAD( "388j16.1e", 0x0200, 0x0100, CRC(2e21329b) SHA1(9ba8af294dbd6f3a5d039c74a56e0605a913c037) ) // palette blue component
+ ROM_LOAD( "388j18.1f", 0x0300, 0x0100, CRC(61d2d398) SHA1(3f74ad733b07b6a31cf9d4956d171eb9253dd6bf) ) // char lookup table
+ ROM_LOAD( "388j17.16c", 0x0400, 0x0100, CRC(13c4e198) SHA1(42ab23206be99e840bd9c52cefa175c12fac8e5b) ) // sprite lookup table
ROM_END
+} // anonymous namespace
+
GAME( 1984, tp84, 0, tp84, tp84, tp84_state, empty_init, ROT90, "Konami", "Time Pilot '84 (set 1)", MACHINE_SUPPORTS_SAVE )
GAME( 1984, tp84a, tp84, tp84, tp84a, tp84_state, empty_init, ROT90, "Konami", "Time Pilot '84 (set 2)", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/konami/tp84.h b/src/mame/konami/tp84.h
deleted file mode 100644
index f1cad841584..00000000000
--- a/src/mame/konami/tp84.h
+++ /dev/null
@@ -1,88 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Aaron Giles
-#ifndef MAME_INCLUDES_TP84
-#define MAME_INCLUDES_TP84
-
-#pragma once
-
-#include "sound/flt_rc.h"
-#include "emupal.h"
-#include "screen.h"
-#include "tilemap.h"
-
-class tp84_state : public driver_device
-{
-public:
- tp84_state(const machine_config &mconfig, device_type type, const char *tag) :
- driver_device(mconfig, type, tag),
- m_maincpu(*this, "cpu1"),
- m_subcpu(*this, "sub"),
- m_audiocpu(*this, "audiocpu"),
- m_palette_bank(*this, "palette_bank"),
- m_scroll_x(*this, "scroll_x"),
- m_scroll_y(*this, "scroll_y"),
- m_bg_videoram(*this, "bg_videoram"),
- m_fg_videoram(*this, "fg_videoram"),
- m_bg_colorram(*this, "bg_colorram"),
- m_fg_colorram(*this, "fg_colorram"),
- m_spriteram(*this, "spriteram"),
- m_gfxdecode(*this, "gfxdecode"),
- m_screen(*this, "screen"),
- m_palette(*this, "palette"),
- m_filter(*this, "filter%u", 1U)
- { }
-
- void tp84(machine_config &config);
- void tp84b(machine_config &config);
-
-private:
- required_device<cpu_device> m_maincpu;
- required_device<cpu_device> m_subcpu;
- required_device<cpu_device> m_audiocpu;
- required_shared_ptr<uint8_t> m_palette_bank;
- required_shared_ptr<uint8_t> m_scroll_x;
- required_shared_ptr<uint8_t> m_scroll_y;
- required_shared_ptr<uint8_t> m_bg_videoram;
- required_shared_ptr<uint8_t> m_fg_videoram;
- required_shared_ptr<uint8_t> m_bg_colorram;
- required_shared_ptr<uint8_t> m_fg_colorram;
- required_shared_ptr<uint8_t> m_spriteram;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<screen_device> m_screen;
- required_device<palette_device> m_palette;
- required_device_array<filter_rc_device, 3> m_filter;
- tilemap_t *m_bg_tilemap = nullptr;
- tilemap_t *m_fg_tilemap = nullptr;
- bool m_flipscreen_x = false;
- bool m_flipscreen_y = false;
-
- bool m_irq_enable = false;
- bool m_sub_irq_mask = false;
-
- DECLARE_WRITE_LINE_MEMBER(irq_enable_w);
- DECLARE_WRITE_LINE_MEMBER(coin_counter_1_w);
- DECLARE_WRITE_LINE_MEMBER(coin_counter_2_w);
- DECLARE_WRITE_LINE_MEMBER(flip_screen_x_w);
- DECLARE_WRITE_LINE_MEMBER(flip_screen_y_w);
- uint8_t tp84_sh_timer_r();
- void tp84_filter_w(offs_t offset, uint8_t data);
- void tp84_sh_irqtrigger_w(uint8_t data);
- void sub_irq_mask_w(uint8_t data);
- void tp84_spriteram_w(offs_t offset, uint8_t data);
- uint8_t tp84_scanline_r();
- TILE_GET_INFO_MEMBER(get_bg_tile_info);
- TILE_GET_INFO_MEMBER(get_fg_tile_info);
- virtual void machine_start() override;
- virtual void video_start() override;
- void tp84_palette(palette_device &palette) const;
- uint32_t screen_update_tp84(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 audio_map(address_map &map);
- void cpu2_map(address_map &map);
- void tp84_cpu1_map(address_map &map);
- void tp84b_cpu1_map(address_map &map);
-};
-
-#endif // MAME_INCLUDES_TP84
diff --git a/src/mame/konami/tp84_v.cpp b/src/mame/konami/tp84_v.cpp
deleted file mode 100644
index 43bdca7691e..00000000000
--- a/src/mame/konami/tp84_v.cpp
+++ /dev/null
@@ -1,200 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Aaron Giles
-/***************************************************************************
-
- video.c
-
- Functions to emulate the video hardware of the machine.
-
-***************************************************************************/
-
-#include "emu.h"
-#include "video/resnet.h"
-#include "tp84.h"
-
-
-
-
-
-/*
--The colortable is divided in 2 part:
- -The characters colors
- -The sprites colors
-
--The characters colors are indexed like this:
- -2 bits from the characters
- -4 bits from the attribute in tp84_bg_colorram
- -2 bits from palette_bank (d3-d4)
- -3 bits from palette_bank (d0-d1-d2)
--So, there is 2048 bytes for the characters
-
--The sprites colors are indexed like this:
- -4 bits from the sprites (16 colors)
- -4 bits from the attribute of the sprites
- -3 bits from palette_bank (d0-d1-d2)
--So, there is 2048 bytes for the sprites
-
-*/
-/*
- The RGB signals are generated by 3 proms 256X4 (prom 2C, 2D and 1E)
- The resistors values are:
- 1K ohm
- 470 ohm
- 220 ohm
- 100 ohm
-*/
-void tp84_state::tp84_palette(palette_device &palette) const
-{
- const uint8_t *color_prom = memregion("proms")->base();
- static constexpr int resistances[4] = { 1000, 470, 220, 100 };
-
- // compute the color output resistor weights
- double weights[4];
- compute_resistor_weights(0, 255, -1.0,
- 4, resistances, weights, 470, 0,
- 0, nullptr, nullptr, 0, 0,
- 0, nullptr, nullptr, 0, 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(weights, 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(weights, 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(weights, 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 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 tp84_state::tp84_spriteram_w(offs_t offset, uint8_t data)
-{
- /* the game multiplexes the sprites, so update now */
-// m_screen->update_now();
- m_screen->update_partial(m_screen->vpos());
- m_spriteram[offset] = data;
-}
-
-
-uint8_t tp84_state::tp84_scanline_r()
-{
- /* reads 1V - 128V */
- return m_screen->vpos();
-}
-
-
-TILE_GET_INFO_MEMBER(tp84_state::get_bg_tile_info)
-{
- int code = ((m_bg_colorram[tile_index] & 0x30) << 4) | m_bg_videoram[tile_index];
- int color = ((*m_palette_bank & 0x07) << 6) |
- ((*m_palette_bank & 0x18) << 1) |
- (m_bg_colorram[tile_index] & 0x0f);
- int flags = TILE_FLIPYX(m_bg_colorram[tile_index] >> 6);
-
- tileinfo.set(0, code, color, flags);
-}
-
-TILE_GET_INFO_MEMBER(tp84_state::get_fg_tile_info)
-{
- int code = ((m_fg_colorram[tile_index] & 0x30) << 4) | m_fg_videoram[tile_index];
- int color = ((*m_palette_bank & 0x07) << 6) |
- ((*m_palette_bank & 0x18) << 1) |
- (m_fg_colorram[tile_index] & 0x0f);
- int flags = TILE_FLIPYX(m_fg_colorram[tile_index] >> 6);
-
- tileinfo.set(0, code, color, flags);
-}
-
-
-void tp84_state::video_start()
-{
- m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(tp84_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
- m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(tp84_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
-}
-
-
-void tp84_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
- int offs;
- int palette_base = ((*m_palette_bank & 0x07) << 4);
-
- for (offs = 0x5c; offs >= 0; offs -= 4)
- {
- int x = m_spriteram[offs];
- int y = 240 - m_spriteram[offs + 3];
-
- int code = m_spriteram[offs + 1];
- int color = palette_base | (m_spriteram[offs + 2] & 0x0f);
- int flip_x = ~m_spriteram[offs + 2] & 0x40;
- int flip_y = m_spriteram[offs + 2] & 0x80;
-
- m_gfxdecode->gfx(1)->transmask(bitmap,cliprect, code, color, flip_x, flip_y, x, y,
- m_palette->transpen_mask(*m_gfxdecode->gfx(1), color, palette_base));
-
- }
-}
-
-
-uint32_t tp84_state::screen_update_tp84(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
- rectangle clip = cliprect;
- const rectangle &visarea = screen.visible_area();
-
- if (cliprect.min_y == screen.visible_area().min_y)
- {
- machine().tilemap().mark_all_dirty();
-
- m_bg_tilemap->set_scrollx(0, *m_scroll_x);
- m_bg_tilemap->set_scrolly(0, *m_scroll_y);
-
- machine().tilemap().set_flip_all((m_flipscreen_x ? TILEMAP_FLIPX : 0) |
- (m_flipscreen_y ? TILEMAP_FLIPY : 0));
- }
-
- m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
- draw_sprites(bitmap, cliprect);
-
- /* draw top status region */
- clip.min_x = visarea.min_x;
- clip.max_x = visarea.min_x + 15;
- m_fg_tilemap->draw(screen, bitmap, clip, 0, 0);
-
- /* draw bottom status region */
- clip.min_x = visarea.max_x - 15;
- clip.max_x = visarea.max_x;
- m_fg_tilemap->draw(screen, bitmap, clip, 0, 0);
-
- return 0;
-}
diff --git a/src/mame/sega/winclub.cpp b/src/mame/sega/winclub.cpp
index a18db1b67a7..bd1cd8dbcd6 100644
--- a/src/mame/sega/winclub.cpp
+++ b/src/mame/sega/winclub.cpp
@@ -6,7 +6,7 @@ Winner's Club - Mighty 8 Liner
Many games in the series, only one dumped for now.
-Winner's Wheel - Magical Spot (2000)
+Winner's Wheel - Magical Spot (2005)
https://www.youtube.com/watch?v=k3REoIx7m-I
Hardware manufactured by Sammy
@@ -127,4 +127,4 @@ ROM_END
} // anonymous namespace
-GAME( 2005, wwmspot, 0, winclub, winclub, winclub_state, empty_init, ROT0, "Sega", "Winner's Wheel - Magical Spot", MACHINE_IS_SKELETON ) // year taken for instructions on cabinet (see YouTube video)
+GAME( 2005, wwmspot, 0, winclub, winclub, winclub_state, empty_init, ROT0, "Sega", "Winner's Wheel - Magical Spot", MACHINE_IS_SKELETON ) // year taken from instructions on cabinet (see YouTube video)