summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Ivan Vangelista <mesgnet@yahoo.it>2020-02-09 14:19:17 +0100
committer Ivan Vangelista <mesgnet@yahoo.it>2020-02-09 14:19:17 +0100
commit2338fbd4fdd4e0f1e4649a7f96c560212d62a291 (patch)
treef8567e352eca44c1fe42daa9b3ca5f2be107afcc
parentee504a81eda6767298222c6ccb871a8f7b15d320 (diff)
pastelg.cpp: subclasses (nw)
-rw-r--r--src/mame/drivers/pastelg.cpp56
-rw-r--r--src/mame/includes/pastelg.h103
-rw-r--r--src/mame/video/pastelg.cpp105
3 files changed, 143 insertions, 121 deletions
diff --git a/src/mame/drivers/pastelg.cpp b/src/mame/drivers/pastelg.cpp
index bb112bea620..dd40f521a7f 100644
--- a/src/mame/drivers/pastelg.cpp
+++ b/src/mame/drivers/pastelg.cpp
@@ -33,29 +33,29 @@ Memo:
#include "speaker.h"
-void pastelg_state::machine_start()
+void threeds_state::machine_start()
{
save_item(NAME(m_mux_data));
}
-uint8_t pastelg_state::pastelg_sndrom_r()
+uint8_t pastelg_state::sndrom_r()
{
- return m_voice_rom[pastelg_blitter_src_addr_r() & 0x7fff];
+ return m_voice_rom[blitter_src_addr_r() & 0x7fff];
}
-void pastelg_state::prg_map(address_map &map)
+void pastelg_common_state::prg_map(address_map &map)
{
map(0x0000, 0xbfff).rom();
map(0xe000, 0xe7ff).ram().share("nvram");
}
-uint8_t pastelg_state::irq_ack_r()
+uint8_t pastelg_common_state::irq_ack_r()
{
m_maincpu->set_input_line(0, CLEAR_LINE);
return 0;
}
-void pastelg_state::pastelg_io_map(address_map &map)
+void pastelg_state::io_map(address_map &map)
{
map.global_mask(0xff);
// map(0x00, 0x00).nopw();
@@ -65,15 +65,15 @@ void pastelg_state::pastelg_io_map(address_map &map)
map(0x90, 0x90).portr("SYSTEM");
map(0x90, 0x96).w(FUNC(pastelg_state::blitter_w));
map(0xa0, 0xa0).rw(m_nb1413m3, FUNC(nb1413m3_device::inputport1_r), FUNC(nb1413m3_device::inputportsel_w));
- map(0xb0, 0xb0).r(m_nb1413m3, FUNC(nb1413m3_device::inputport2_r)).w(FUNC(pastelg_state::pastelg_romsel_w));
- map(0xc0, 0xc0).r(FUNC(pastelg_state::pastelg_sndrom_r));
+ map(0xb0, 0xb0).r(m_nb1413m3, FUNC(nb1413m3_device::inputport2_r)).w(FUNC(pastelg_state::romsel_w));
+ map(0xc0, 0xc0).r(FUNC(pastelg_state::sndrom_r));
map(0xc0, 0xcf).writeonly().share("clut");
map(0xd0, 0xd0).r(FUNC(pastelg_state::irq_ack_r)).w("dac", FUNC(dac_byte_interface::data_w));
map(0xe0, 0xe0).portr("DSWC");
}
-uint8_t pastelg_state::threeds_inputport1_r()
+uint8_t threeds_state::inputport1_r()
{
switch(m_mux_data)
{
@@ -87,7 +87,7 @@ uint8_t pastelg_state::threeds_inputport1_r()
return 0xff;
}
-uint8_t pastelg_state::threeds_inputport2_r()
+uint8_t threeds_state::inputport2_r()
{
switch(m_mux_data)
{
@@ -101,23 +101,23 @@ uint8_t pastelg_state::threeds_inputport2_r()
return 0xff;
}
-void pastelg_state::threeds_inputportsel_w(uint8_t data)
+void threeds_state::inputportsel_w(uint8_t data)
{
m_mux_data = ~data;
}
-void pastelg_state::threeds_io_map(address_map &map)
+void threeds_state::io_map(address_map &map)
{
map.global_mask(0xff);
map(0x81, 0x81).r("aysnd", FUNC(ay8910_device::data_r));
map(0x82, 0x83).w("aysnd", FUNC(ay8910_device::data_address_w));
- map(0x90, 0x90).portr("SYSTEM").w(FUNC(pastelg_state::threeds_romsel_w));
- map(0xf0, 0xf6).w(FUNC(pastelg_state::blitter_w));
- map(0xa0, 0xa0).rw(FUNC(pastelg_state::threeds_inputport1_r), FUNC(pastelg_state::threeds_inputportsel_w));
- map(0xb0, 0xb0).r(FUNC(pastelg_state::threeds_inputport2_r)).w(FUNC(pastelg_state::threeds_output_w)); //writes: bit 3 is coin lockout, bit 1 is coin counter
+ map(0x90, 0x90).portr("SYSTEM").w(FUNC(threeds_state::romsel_w));
+ map(0xf0, 0xf6).w(FUNC(threeds_state::blitter_w));
+ map(0xa0, 0xa0).rw(FUNC(threeds_state::inputport1_r), FUNC(threeds_state::inputportsel_w));
+ map(0xb0, 0xb0).r(FUNC(threeds_state::inputport2_r)).w(FUNC(threeds_state::output_w)); //writes: bit 3 is coin lockout, bit 1 is coin counter
map(0xc0, 0xcf).writeonly().share("clut");
- map(0xc0, 0xc0).r(FUNC(pastelg_state::threeds_rom_readback_r));
- map(0xd0, 0xd0).r(FUNC(pastelg_state::irq_ack_r)).w("dac", FUNC(dac_byte_interface::data_w));
+ map(0xc0, 0xc0).r(FUNC(threeds_state::rom_readback_r));
+ map(0xd0, 0xd0).r(FUNC(threeds_state::irq_ack_r)).w("dac", FUNC(dac_byte_interface::data_w));
}
static INPUT_PORTS_START( pastelg )
@@ -362,7 +362,7 @@ void pastelg_state::pastelg(machine_config &config)
/* basic machine hardware */
Z80(config, m_maincpu, 19968000/4); // unknown divider, galds definitely relies on this for correct voice pitch
m_maincpu->set_addrmap(AS_PROGRAM, &pastelg_state::prg_map);
- m_maincpu->set_addrmap(AS_IO, &pastelg_state::pastelg_io_map);
+ m_maincpu->set_addrmap(AS_IO, &pastelg_state::io_map);
m_maincpu->set_vblank_int("screen", FUNC(pastelg_state::irq0_line_assert)); // nmiclock not written, chip is 1411M1 instead of 1413M3
NB1413M3(config, m_nb1413m3, 0, NB1413M3_PASTELG);
@@ -417,13 +417,13 @@ Note
*/
-void pastelg_state::threeds(machine_config &config)
+void threeds_state::threeds(machine_config &config)
{
/* basic machine hardware */
Z80(config, m_maincpu, 19968000/4); // unknown divider, galds definitely relies on this for correct voice pitch
- m_maincpu->set_addrmap(AS_PROGRAM, &pastelg_state::prg_map);
- m_maincpu->set_addrmap(AS_IO, &pastelg_state::threeds_io_map);
- m_maincpu->set_vblank_int("screen", FUNC(pastelg_state::irq0_line_assert));
+ m_maincpu->set_addrmap(AS_PROGRAM, &threeds_state::prg_map);
+ m_maincpu->set_addrmap(AS_IO, &threeds_state::io_map);
+ m_maincpu->set_vblank_int("screen", FUNC(threeds_state::irq0_line_assert));
NB1413M3(config, m_nb1413m3, 0);
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
@@ -434,10 +434,10 @@ void pastelg_state::threeds(machine_config &config)
m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(0));
m_screen->set_size(256, 256);
m_screen->set_visarea(0, 256-1, 16, 240-1);
- m_screen->set_screen_update(FUNC(pastelg_state::screen_update));
+ m_screen->set_screen_update(FUNC(threeds_state::screen_update));
m_screen->set_palette("palette");
- PALETTE(config, "palette", FUNC(pastelg_state::palette), 32);
+ PALETTE(config, "palette", FUNC(threeds_state::palette), 32);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
@@ -541,6 +541,6 @@ ROM_END
GAME( 1985, pastelg, 0, pastelg, pastelg, pastelg_state, empty_init, ROT0, "Nichibutsu", "Pastel Gal (Japan 851224)", MACHINE_SUPPORTS_SAVE )
-GAME( 1985, threeds, 0, threeds, threeds, pastelg_state, empty_init, ROT0, "Nichibutsu", "Three Ds - Three Dealers Casino House (set 1)", MACHINE_SUPPORTS_SAVE )
-GAME( 1985, threedsa, threeds, threeds, threeds, pastelg_state, empty_init, ROT0, "Nichibutsu", "Three Ds - Three Dealers Casino House (set 2)", MACHINE_SUPPORTS_SAVE )
-GAME( 1985, galds, threeds, threeds, galds, pastelg_state, empty_init, ROT0, "Nihon System Corp.", "Gals Ds - Three Dealers Casino House (bootleg?)", MACHINE_SUPPORTS_SAVE )
+GAME( 1985, threeds, 0, threeds, threeds, threeds_state, empty_init, ROT0, "Nichibutsu", "Three Ds - Three Dealers Casino House (set 1)", MACHINE_SUPPORTS_SAVE )
+GAME( 1985, threedsa, threeds, threeds, threeds, threeds_state, empty_init, ROT0, "Nichibutsu", "Three Ds - Three Dealers Casino House (set 2)", MACHINE_SUPPORTS_SAVE )
+GAME( 1985, galds, threeds, threeds, galds, threeds_state, empty_init, ROT0, "Nihon System Corp.", "Gals Ds - Three Dealers Casino House (bootleg?)", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/includes/pastelg.h b/src/mame/includes/pastelg.h
index 0966868c6ab..7ccc1f1260d 100644
--- a/src/mame/includes/pastelg.h
+++ b/src/mame/includes/pastelg.h
@@ -9,77 +9,106 @@
#include "emupal.h"
#include "screen.h"
-class pastelg_state : public driver_device
+class pastelg_common_state : public driver_device
{
public:
- pastelg_state(const machine_config &mconfig, device_type type, const char *tag) :
- driver_device(mconfig, type, tag) ,
+ pastelg_common_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_nb1413m3(*this, "nb1413m3"),
m_screen(*this, "screen"),
- m_clut(*this, "clut"),
m_blitter_rom(*this, "blitter"),
- m_voice_rom(*this, "voice"),
- m_p1_keys(*this, "PL1_KEY%u", 0U),
- m_p2_keys(*this, "PL2_KEY%u", 0U)
+ m_clut(*this, "clut")
{ }
- void threeds(machine_config &config);
- void pastelg(machine_config &config);
+protected:
+ virtual void video_start() override;
-private:
required_device<cpu_device> m_maincpu;
required_device<nb1413m3_device> m_nb1413m3;
required_device<screen_device> m_screen;
- required_shared_ptr<uint8_t> m_clut;
required_region_ptr<uint8_t> m_blitter_rom;
- optional_region_ptr<uint8_t> m_voice_rom;
- optional_ioport_array<5> m_p1_keys;
- optional_ioport_array<5> m_p2_keys;
- uint8_t m_mux_data;
+ uint8_t m_gfxbank;
+ uint8_t m_palbank;
+ uint16_t m_blitter_src_addr;
+
+ uint8_t irq_ack_r();
+ void blitter_w(offs_t offset, uint8_t data);
+ void palette(palette_device &palette) const;
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+
+ void prg_map(address_map &map);
+
+private:
+ required_shared_ptr<uint8_t> m_clut;
+
uint8_t m_blitter_destx;
uint8_t m_blitter_desty;
uint8_t m_blitter_sizex;
uint8_t m_blitter_sizey;
- uint16_t m_blitter_src_addr;
- uint8_t m_gfxbank;
bool m_dispflag;
bool m_flipscreen;
bool m_blitter_direction_x;
bool m_blitter_direction_y;
- uint8_t m_palbank;
std::unique_ptr<uint8_t[]> m_videoram;
bool m_flipscreen_old;
emu_timer *m_blitter_timer;
- uint8_t irq_ack_r();
- void blitter_w(offs_t offset, uint8_t data);
void blitter_timer_callback(void *ptr, s32 param);
- uint8_t pastelg_sndrom_r();
- void pastelg_romsel_w(address_space &space, uint8_t data);
+ void vramflip();
+ void gfxdraw();
+};
+
+class pastelg_state : public pastelg_common_state
+{
+public:
+ pastelg_state(const machine_config &mconfig, device_type type, const char *tag) :
+ pastelg_common_state(mconfig, type, tag),
+ m_voice_rom(*this, "voice")
+ { }
- uint8_t threeds_inputport1_r();
- uint8_t threeds_inputport2_r();
- void threeds_inputportsel_w(uint8_t data);
- void threeds_romsel_w(uint8_t data);
- void threeds_output_w(uint8_t data);
- uint8_t threeds_rom_readback_r();
+ void pastelg(machine_config &config);
+private:
+ required_region_ptr<uint8_t> m_voice_rom;
+
+ uint8_t sndrom_r();
+ void romsel_w(address_space &space, uint8_t data);
+ uint16_t blitter_src_addr_r();
+
+ void io_map(address_map &map);
+};
+
+class threeds_state : public pastelg_common_state
+{
+public:
+ threeds_state(const machine_config &mconfig, device_type type, const char *tag) :
+ pastelg_common_state(mconfig, type, tag),
+ m_p1_keys(*this, "PL1_KEY%u", 0U),
+ m_p2_keys(*this, "PL2_KEY%u", 0U)
+ { }
+
+ void threeds(machine_config &config);
+
+protected:
virtual void machine_start() override;
- virtual void video_start() override;
- void palette(palette_device &palette) const;
- uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- void vramflip();
- void gfxdraw();
+private:
+ required_ioport_array<5> m_p1_keys;
+ required_ioport_array<5> m_p2_keys;
- uint16_t pastelg_blitter_src_addr_r();
+ uint8_t m_mux_data;
- void prg_map(address_map &map);
- void pastelg_io_map(address_map &map);
- void threeds_io_map(address_map &map);
+ uint8_t inputport1_r();
+ uint8_t inputport2_r();
+ void inputportsel_w(uint8_t data);
+ void romsel_w(uint8_t data);
+ void output_w(uint8_t data);
+ uint8_t rom_readback_r();
+
+ void io_map(address_map &map);
};
#endif // MAME_INCLUDES_PASTELG_H
diff --git a/src/mame/video/pastelg.cpp b/src/mame/video/pastelg.cpp
index 29b0b92f146..782c4494f56 100644
--- a/src/mame/video/pastelg.cpp
+++ b/src/mame/video/pastelg.cpp
@@ -11,11 +11,51 @@
#include "emu.h"
#include "includes/pastelg.h"
-/******************************************************************************
+// pastelg specific methods
-******************************************************************************/
-void pastelg_state::palette(palette_device &palette) const
+uint16_t pastelg_state::blitter_src_addr_r()
+{
+ return m_blitter_src_addr;
+}
+
+void pastelg_state::romsel_w(address_space &space, uint8_t data)
+{
+ m_gfxbank = ((data & 0xc0) >> 6);
+ m_palbank = ((data & 0x10) >> 4);
+ m_nb1413m3->sndrombank1_w(space, 0, data);
+
+ if ((m_gfxbank << 16) > m_blitter_rom.mask())
+ {
+#ifdef MAME_DEBUG
+ popmessage("GFXROM BANK OVER!!");
+#endif
+ m_gfxbank &= (m_blitter_rom.length() / 0x20000 - 1);
+ }
+}
+
+// threeds specific methods
+
+void threeds_state::romsel_w(uint8_t data)
+{
+ if (data & 0xfc) printf("%02x\n", data);
+ m_gfxbank = (data & 0x3);
+}
+
+void threeds_state::output_w(uint8_t data)
+{
+ m_palbank = ((data & 0x10) >> 4);
+
+}
+
+uint8_t threeds_state::rom_readback_r()
+{
+ return m_blitter_rom[(m_blitter_src_addr | (m_gfxbank << 16)) & 0x3ffff];
+}
+
+// common methods
+
+void pastelg_common_state::palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
@@ -44,16 +84,7 @@ void pastelg_state::palette(palette_device &palette) const
}
}
-/******************************************************************************
-
-
-******************************************************************************/
-uint16_t pastelg_state::pastelg_blitter_src_addr_r()
-{
- return m_blitter_src_addr;
-}
-
-void pastelg_state::blitter_w(offs_t offset, uint8_t data)
+void pastelg_common_state::blitter_w(offs_t offset, uint8_t data)
{
switch (offset)
{
@@ -75,45 +106,7 @@ void pastelg_state::blitter_w(offs_t offset, uint8_t data)
}
}
-
-void pastelg_state::threeds_romsel_w(uint8_t data)
-{
- if (data & 0xfc) printf("%02x\n", data);
- m_gfxbank = (data & 0x3);
-}
-
-void pastelg_state::threeds_output_w(uint8_t data)
-{
- m_palbank = ((data & 0x10) >> 4);
-
-}
-
-uint8_t pastelg_state::threeds_rom_readback_r()
-{
- return m_blitter_rom[(m_blitter_src_addr | (m_gfxbank << 16)) & 0x3ffff];
-}
-
-
-void pastelg_state::pastelg_romsel_w(address_space &space, uint8_t data)
-{
- m_gfxbank = ((data & 0xc0) >> 6);
- m_palbank = ((data & 0x10) >> 4);
- m_nb1413m3->sndrombank1_w(space, 0, data);
-
- if ((m_gfxbank << 16) > m_blitter_rom.mask())
- {
-#ifdef MAME_DEBUG
- popmessage("GFXROM BANK OVER!!");
-#endif
- m_gfxbank &= (m_blitter_rom.length() / 0x20000 - 1);
- }
-}
-
-/******************************************************************************
-
-
-******************************************************************************/
-void pastelg_state::vramflip()
+void pastelg_common_state::vramflip()
{
int width = m_screen->width();
int height = m_screen->height();
@@ -134,13 +127,13 @@ void pastelg_state::vramflip()
m_flipscreen_old = m_flipscreen;
}
-void pastelg_state::blitter_timer_callback(void *ptr, s32 param)
+void pastelg_common_state::blitter_timer_callback(void *ptr, s32 param)
{
m_nb1413m3->busyflag_w(1);
}
-void pastelg_state::gfxdraw()
+void pastelg_common_state::gfxdraw()
{
int width = m_screen->width();
@@ -257,7 +250,7 @@ void pastelg_state::gfxdraw()
******************************************************************************/
-void pastelg_state::video_start()
+void pastelg_common_state::video_start()
{
int width = m_screen->width();
int height = m_screen->height();
@@ -284,7 +277,7 @@ void pastelg_state::video_start()
******************************************************************************/
-uint32_t pastelg_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+uint32_t pastelg_common_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
if (m_dispflag)
{