summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Ivan Vangelista <mesgnet@yahoo.it>2022-11-07 18:26:56 +0100
committer Ivan Vangelista <mesgnet@yahoo.it>2022-11-07 18:26:56 +0100
commit0e1c444a0d6ec3a1bffd7cdea4f0739487358402 (patch)
treef85d00653f11b30a4ed057615129654a36620979
parent09825827cac540b747d8817275d7fe301b10042a (diff)
excellent/aquarium.cpp, excellent/gcpinbal.cpp, excellent/witch.cpp, f32/crospang.cpp: consolidated drivers in single files
-rw-r--r--src/mame/excellent/aquarium.cpp313
-rw-r--r--src/mame/excellent/aquarium.h90
-rw-r--r--src/mame/excellent/aquarium_v.cpp101
-rw-r--r--src/mame/excellent/gcpinbal.cpp365
-rw-r--r--src/mame/excellent/gcpinbal.h93
-rw-r--r--src/mame/excellent/gcpinbal_v.cpp159
-rw-r--r--src/mame/excellent/witch.cpp602
-rw-r--r--src/mame/excellent/witch.h143
-rw-r--r--src/mame/f32/crospang.cpp413
-rw-r--r--src/mame/f32/crospang.h85
-rw-r--r--src/mame/f32/crospang_v.cpp141
11 files changed, 1249 insertions, 1256 deletions
diff --git a/src/mame/excellent/aquarium.cpp b/src/mame/excellent/aquarium.cpp
index e8bad570836..5a6e37609bb 100644
--- a/src/mame/excellent/aquarium.cpp
+++ b/src/mame/excellent/aquarium.cpp
@@ -1,6 +1,7 @@
// license:BSD-3-Clause
-// copyright-holders:David Haywood
-/* Aquarium (c)1996 Excellent Systems */
+// copyright-holders: David Haywood
+
+// Aquarium (c)1996 Excellent Systems
/*
@@ -49,15 +50,210 @@ Notes:
*/
-
#include "emu.h"
-#include "aquarium.h"
-#include "cpu/z80/z80.h"
+#include "excellent_spr.h"
+
#include "cpu/m68000/m68000.h"
+#include "cpu/z80/z80.h"
+#include "machine/gen_latch.h"
+#include "machine/mb3773.h"
+#include "sound/okim6295.h"
#include "sound/ymopm.h"
+
+#include "emupal.h"
+#include "screen.h"
#include "speaker.h"
+#include "tilemap.h"
+
+
+// configurable logging
+#define LOG_AUDIOBANK (1U << 1)
+#define LOG_OKI (1U << 2)
+
+//#define VERBOSE (LOG_GENERAL | LOG_AUDIOBANK | LOG_OKI)
+
+#include "logmacro.h"
+
+#define LOGAUDIOBANK(...) LOGMASKED(LOG_AUDIOBANK, __VA_ARGS__)
+#define LOGOKI(...) LOGMASKED(LOG_OKI, __VA_ARGS__)
+
+
+namespace {
+
+class aquarium_state : public driver_device
+{
+public:
+ aquarium_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
+ m_mid_videoram(*this, "mid_videoram"),
+ m_bak_videoram(*this, "bak_videoram"),
+ m_txt_videoram(*this, "txt_videoram"),
+ m_scroll(*this, "scroll"),
+ m_audiobank(*this, "audiobank"),
+ m_maincpu(*this, "maincpu"),
+ m_audiocpu(*this, "audiocpu"),
+ m_oki(*this, "oki"),
+ m_gfxdecode(*this, "gfxdecode"),
+ m_palette(*this, "palette"),
+ m_sprgen(*this, "spritegen"),
+ m_screen(*this, "screen"),
+ m_soundlatch(*this, "soundlatch"),
+ m_watchdog(*this, "watchdog")
+ { }
+
+ void init_aquarium();
+
+ void aquarium(machine_config &config);
+
+protected:
+ virtual void video_start() override;
+
+private:
+ // memory pointers
+ required_shared_ptr<u16> m_mid_videoram;
+ required_shared_ptr<u16> m_bak_videoram;
+ required_shared_ptr<u16> m_txt_videoram;
+ required_shared_ptr<u16> m_scroll;
+ required_memory_bank m_audiobank;
+
+ // video-related
+ tilemap_t *m_txt_tilemap = nullptr;
+ tilemap_t *m_mid_tilemap = nullptr;
+ tilemap_t *m_bak_tilemap = nullptr;
+ std::unique_ptr<u8[]> m_decoded_gfx[2];
+
+ // devices
+ required_device<cpu_device> m_maincpu;
+ required_device<cpu_device> m_audiocpu;
+ required_device<okim6295_device> m_oki;
+ required_device<gfxdecode_device> m_gfxdecode;
+ required_device<palette_device> m_palette;
+ required_device<excellent_spr_device> m_sprgen;
+ required_device<screen_device> m_screen;
+ required_device<generic_latch_8_device> m_soundlatch;
+ required_device<mb3773_device> m_watchdog;
+
+ void watchdog_w(u8 data);
+ void z80_bank_w(u8 data);
+ u8 oki_r();
+ void oki_w(u8 data);
+
+ std::unique_ptr<u8[]> expand_gfx(int low, int hi);
+ void txt_videoram_w(offs_t offset, u16 data, u16 mem_mask = ~0);
+ void mid_videoram_w(offs_t offset, u16 data, u16 mem_mask = ~0);
+ void bak_videoram_w(offs_t offset, u16 data, u16 mem_mask = ~0);
+ TILE_GET_INFO_MEMBER(get_txt_tile_info);
+ TILE_GET_INFO_MEMBER(get_mid_tile_info);
+ TILE_GET_INFO_MEMBER(get_bak_tile_info);
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ u8 snd_bitswap(u8 scrambled_data);
+ void aquarium_colpri_cb(u32 &colour, u32 &pri_mask);
+
+ void main_map(address_map &map);
+ void snd_map(address_map &map);
+ void snd_portmap(address_map &map);
+};
+
+
+// video
+
+// TXT Layer
+TILE_GET_INFO_MEMBER(aquarium_state::get_txt_tile_info)
+{
+ const u32 tileno = (m_txt_videoram[tile_index] & 0x0fff);
+ const u32 colour = (m_txt_videoram[tile_index] & 0xf000) >> 12;
+ tileinfo.set(0, tileno, colour, 0);
+
+ tileinfo.category = (m_txt_videoram[tile_index] & 0x8000) >> 15;
+}
+
+void aquarium_state::txt_videoram_w(offs_t offset, u16 data, u16 mem_mask)
+{
+ COMBINE_DATA(&m_txt_videoram[offset]);
+ m_txt_tilemap->mark_tile_dirty(offset);
+}
+
+// MID Layer
+TILE_GET_INFO_MEMBER(aquarium_state::get_mid_tile_info)
+{
+ const u32 tileno = (m_mid_videoram[tile_index * 2] & 0x0fff);
+ const u32 colour = (m_mid_videoram[tile_index * 2 + 1] & 0x001f);
+ const int flag = TILE_FLIPYX((m_mid_videoram[tile_index * 2 + 1] & 0x300) >> 8);
+ tileinfo.set(1, tileno, colour, flag);
+
+ tileinfo.category = (m_mid_videoram[tile_index * 2 + 1] & 0x20) >> 5;
+}
+
+void aquarium_state::mid_videoram_w(offs_t offset, u16 data, u16 mem_mask)
+{
+ COMBINE_DATA(&m_mid_videoram[offset]);
+ m_mid_tilemap->mark_tile_dirty(offset / 2);
+}
+
+// BAK Layer
+TILE_GET_INFO_MEMBER(aquarium_state::get_bak_tile_info)
+{
+ const u32 tileno = (m_bak_videoram[tile_index * 2] & 0x0fff);
+ const u32 colour = (m_bak_videoram[tile_index * 2 + 1] & 0x001f);
+ const int flag = TILE_FLIPYX((m_bak_videoram[tile_index * 2 + 1] & 0x300) >> 8);
+
+ tileinfo.set(2, tileno, colour, flag);
+
+ tileinfo.category = (m_bak_videoram[tile_index * 2 + 1] & 0x20) >> 5;
+}
+
+void aquarium_state::bak_videoram_w(offs_t offset, u16 data, u16 mem_mask)
+{
+ COMBINE_DATA(&m_bak_videoram[offset]);
+ m_bak_tilemap->mark_tile_dirty(offset / 2);
+}
+
+void aquarium_state::video_start()
+{
+ m_txt_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(aquarium_state::get_txt_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64, 64);
+ m_mid_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(aquarium_state::get_mid_tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
+ m_bak_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(aquarium_state::get_bak_tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
+
+ m_txt_tilemap->set_transparent_pen(0);
+ m_mid_tilemap->set_transparent_pen(0);
+ m_bak_tilemap->set_transparent_pen(0);
+}
+
+void aquarium_state::aquarium_colpri_cb(u32 &colour, u32 &pri_mask)
+{
+ pri_mask = 0;
+ if (colour & 8)
+ pri_mask |= (GFX_PMASK_2 | GFX_PMASK_4 | GFX_PMASK_8);
+}
+
+uint32_t aquarium_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ m_mid_tilemap->set_scrollx(0, m_scroll[0]);
+ m_mid_tilemap->set_scrolly(0, m_scroll[1]);
+ m_bak_tilemap->set_scrollx(0, m_scroll[2]);
+ m_bak_tilemap->set_scrolly(0, m_scroll[3]);
+ m_txt_tilemap->set_scrollx(0, m_scroll[4]);
+ m_txt_tilemap->set_scrolly(0, m_scroll[5]);
+
+ screen.priority().fill(0, cliprect);
+ bitmap.fill(0, cliprect); // WDUD logo suggests this
+
+ m_bak_tilemap->draw(screen, bitmap, cliprect, 0, 1);
+ m_mid_tilemap->draw(screen, bitmap, cliprect, 0, 2);
+ m_txt_tilemap->draw(screen, bitmap, cliprect, 1, 4);
+
+ m_bak_tilemap->draw(screen, bitmap, cliprect, 1, 8);
+ m_sprgen->aquarium_draw_sprites(screen, bitmap, cliprect, 16);
+ m_mid_tilemap->draw(screen, bitmap, cliprect, 1, 0);
+ m_txt_tilemap->draw(screen, bitmap, cliprect, 0, 0);
+
+ return 0;
+}
+
+
+// machine
void aquarium_state::watchdog_w(u8 data)
{
@@ -70,7 +266,7 @@ void aquarium_state::z80_bank_w(u8 data)
// uses bits ---x --xx
data = bitswap<8>(data, 7, 6, 5, 2, 3, 1, 4, 0);
- //printf("aquarium bank %04x %04x\n", data, mem_mask);
+ LOGAUDIOBANK("aquarium bank %04x\n", data);
// aquarium bank 0003 00ff - correct (title) 011
// aquarium bank 0006 00ff - correct (select) 110
// aquarium bank 0005 00ff - level 1 (correct)
@@ -91,7 +287,7 @@ u8 aquarium_state::oki_r()
void aquarium_state::oki_w(u8 data)
{
- logerror("%s:Writing %04x to the OKI M6295\n", machine().describe_context(), snd_bitswap(data));
+ LOGOKI("%s:Writing %04x to the OKI M6295\n", machine().describe_context(), snd_bitswap(data));
m_oki->write(snd_bitswap(data));
}
@@ -99,15 +295,15 @@ void aquarium_state::oki_w(u8 data)
void aquarium_state::main_map(address_map &map)
{
map(0x000000, 0x07ffff).rom();
- map(0xc00000, 0xc00fff).ram().w(FUNC(aquarium_state::mid_videoram_w)).share("mid_videoram");
- map(0xc01000, 0xc01fff).ram().w(FUNC(aquarium_state::bak_videoram_w)).share("bak_videoram");
- map(0xc02000, 0xc03fff).ram().w(FUNC(aquarium_state::txt_videoram_w)).share("txt_videoram");
+ map(0xc00000, 0xc00fff).ram().w(FUNC(aquarium_state::mid_videoram_w)).share(m_mid_videoram);
+ map(0xc01000, 0xc01fff).ram().w(FUNC(aquarium_state::bak_videoram_w)).share(m_bak_videoram);
+ map(0xc02000, 0xc03fff).ram().w(FUNC(aquarium_state::txt_videoram_w)).share(m_txt_videoram);
map(0xc80000, 0xc81fff).rw(m_sprgen, FUNC(excellent_spr_device::read), FUNC(excellent_spr_device::write)).umask16(0x00ff);
map(0xd00000, 0xd00fff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
- map(0xd80014, 0xd8001f).writeonly().share("scroll");
- map(0xd80068, 0xd80069).nopw(); /* probably not used */
+ map(0xd80014, 0xd8001f).writeonly().share(m_scroll);
+ map(0xd80068, 0xd80069).nopw(); // probably not used
map(0xd80080, 0xd80081).portr("DSW");
- map(0xd80082, 0xd80083).nopr(); /* stored but not read back ? check code at 0x01f440 */
+ map(0xd80082, 0xd80083).nopr(); // stored but not read back ? check code at 0x01f440
map(0xd80084, 0xd80085).portr("INPUTS");
map(0xd80086, 0xd80087).portr("SYSTEM");
map(0xd80088, 0xd80088).w(FUNC(aquarium_state::watchdog_w));
@@ -119,7 +315,7 @@ void aquarium_state::snd_map(address_map &map)
{
map(0x0000, 0x3fff).rom();
map(0x7800, 0x7fff).ram();
- map(0x8000, 0xffff).bankr("bank1");
+ map(0x8000, 0xffff).bankr(m_audiobank);
}
void aquarium_state::snd_portmap(address_map &map)
@@ -141,16 +337,16 @@ static INPUT_PORTS_START( aquarium )
PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) )
PORT_DIPNAME( 0x000c, 0x000c, "Winning Rounds (Player VS CPU)" ) PORT_DIPLOCATION("SW1:3,4")
PORT_DIPSETTING( 0x000c, "1/1" )
+ PORT_DIPSETTING( 0x0000, "1/1" ) // Not used or listed in manual
PORT_DIPSETTING( 0x0008, "2/3" )
PORT_DIPSETTING( 0x0004, "3/5" )
-// PORT_DIPSETTING( 0x0000, "1/1" ) /* Not used or listed in manual */
PORT_DIPNAME( 0x0030, 0x0030, "Winning Rounds (Player VS Player)" ) PORT_DIPLOCATION("SW1:5,6")
PORT_DIPSETTING( 0x0030, "1/1" )
+ PORT_DIPSETTING( 0x0000, "1/1" ) // Not used or listed in manual
PORT_DIPSETTING( 0x0020, "2/3" )
PORT_DIPSETTING( 0x0010, "3/5" )
-// PORT_DIPSETTING( 0x0000, "1/1" ) /* Not used or listed in manual */
- PORT_DIPUNUSED_DIPLOC( 0x0040, 0x0040, "SW1:7" ) /* Listed in the manual as always OFF */
- PORT_DIPUNUSED_DIPLOC( 0x0080, 0x0080, "SW1:8" ) /* Listed in the manual as always OFF */
+ PORT_DIPUNUSED_DIPLOC( 0x0040, 0x0040, "SW1:7" ) // Listed in the manual as always OFF
+ PORT_DIPUNUSED_DIPLOC( 0x0080, 0x0080, "SW1:8" ) // Listed in the manual as always OFF
PORT_DIPNAME( 0x0700, 0x0700, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW2:1,2,3")
PORT_DIPSETTING( 0x0000, DEF_STR( 5C_1C ) )
PORT_DIPSETTING( 0x0100, DEF_STR( 4C_1C ) )
@@ -160,15 +356,15 @@ static INPUT_PORTS_START( aquarium )
PORT_DIPSETTING( 0x0600, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x0500, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x0400, DEF_STR( 1C_4C ) )
- PORT_DIPUNUSED_DIPLOC( 0x0800, 0x0800, "SW2:4" ) /* Listed in the manual as always OFF */
+ PORT_DIPUNUSED_DIPLOC( 0x0800, 0x0800, "SW2:4" ) // Listed in the manual as always OFF
PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:5")
PORT_DIPSETTING( 0x1000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:6")
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x2000, DEF_STR( On ) )
- PORT_DIPUNUSED_DIPLOC( 0x4000, 0x4000, "SW2:7" ) /* Listed in the manual as always OFF */
- PORT_DIPUNUSED_DIPLOC( 0x8000, 0x8000, "SW2:8" ) /* Listed in the manual as always OFF */
+ PORT_DIPUNUSED_DIPLOC( 0x4000, 0x4000, "SW2:7" ) // Listed in the manual as always OFF
+ PORT_DIPUNUSED_DIPLOC( 0x8000, 0x8000, "SW2:8" ) // Listed in the manual as always OFF
PORT_START("INPUTS")
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
@@ -177,7 +373,7 @@ static INPUT_PORTS_START( aquarium )
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
- PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* used in testmode, but not in game? */
+ PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN ) // used in testmode, but not in game?
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
@@ -185,7 +381,7 @@ static INPUT_PORTS_START( aquarium )
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
- PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* used in testmode, but not in game? */
+ PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN ) // used in testmode, but not in game?
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START1 )
PORT_START("SYSTEM")
@@ -221,19 +417,19 @@ GFXDECODE_END
void aquarium_state::aquarium(machine_config &config)
{
- /* basic machine hardware */
- M68000(config, m_maincpu, XTAL(32'000'000)/2); // clock not verified on pcb
+ // basic machine hardware
+ M68000(config, m_maincpu, XTAL(32'000'000) / 2); // clock not verified on PCB
m_maincpu->set_addrmap(AS_PROGRAM, &aquarium_state::main_map);
m_maincpu->set_vblank_int("screen", FUNC(aquarium_state::irq1_line_hold));
- Z80(config, m_audiocpu, XTAL(32'000'000)/6); // clock not verified on pcb
+ Z80(config, m_audiocpu, XTAL(32'000'000) / 6); // clock not verified on PCB
m_audiocpu->set_addrmap(AS_PROGRAM, &aquarium_state::snd_map);
m_audiocpu->set_addrmap(AS_IO, &aquarium_state::snd_portmap);
- // Is this the actual IC type? Some other Excellent games from this period use a MAX693.
+ // Confirmed IC type, even though some other Excellent games from this period use a MAX693.
MB3773(config, m_watchdog, 0);
- /* 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));
@@ -243,14 +439,14 @@ void aquarium_state::aquarium(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_aquarium);
- PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 0x1000/2);
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 0x1000 / 2);
EXCELLENT_SPRITE(config, m_sprgen, 0);
m_sprgen->set_palette(m_palette);
m_sprgen->set_color_base(0x300);
m_sprgen->set_colpri_callback(FUNC(aquarium_state::aquarium_colpri_cb));
- /* sound hardware */
+ // sound hardware
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();
@@ -258,7 +454,7 @@ void aquarium_state::aquarium(machine_config &config)
m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI);
m_soundlatch->set_separate_acknowledge(true);
- ym2151_device &ymsnd(YM2151(config, "ymsnd", XTAL(14'318'181)/4)); // clock not verified on pcb
+ ym2151_device &ymsnd(YM2151(config, "ymsnd", XTAL(14'318'181) / 4)); // clock not verified on PCB
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
ymsnd.add_route(0, "lspeaker", 0.45);
ymsnd.add_route(1, "rspeaker", 0.45);
@@ -269,67 +465,67 @@ void aquarium_state::aquarium(machine_config &config)
}
ROM_START( aquarium )
- ROM_REGION( 0x080000, "maincpu", 0 ) /* 68000 code */
+ ROM_REGION( 0x080000, "maincpu", 0 ) // 68000
ROM_LOAD16_WORD_SWAP( "aquar3.13h", 0x000000, 0x080000, CRC(f197991e) SHA1(0a217d735e2643605dbfd6ee20f98f46b37d4838) )
- ROM_REGION( 0x40000, "audiocpu", 0 ) /* z80 (sound) code */
+ ROM_REGION( 0x40000, "audiocpu", 0 ) // Z80
ROM_LOAD( "excellent_5.10c", 0x000000, 0x40000, CRC(fa555be1) SHA1(07236f2b2ba67e92984b9ddf4a8154221d535245) )
- ROM_REGION( 0x080000, "mid", 0 ) /* BG Tiles */
+ ROM_REGION( 0x080000, "mid", 0 ) // BG Tiles
ROM_LOAD16_WORD_SWAP( "excellent_1.15b", 0x000000, 0x080000, CRC(575df6ac) SHA1(071394273e512666fe124facdd8591a767ad0819) ) // 4bpp
- /* data is expanded here from mid_hi */
- ROM_REGION( 0x020000, "mid_hi", 0 ) /* BG Tiles */
+ // data is expanded here from mid_hi
+ ROM_REGION( 0x020000, "mid_hi", 0 ) // BG Tiles
ROM_LOAD( "excellent_6.15d", 0x000000, 0x020000, CRC(9065b146) SHA1(befc218bbcd63453ea7eb8f976796d36f2b2d552) ) // 1bpp
- ROM_REGION( 0x080000, "bak", 0 ) /* BG Tiles */
+ ROM_REGION( 0x080000, "bak", 0 ) // BG Tiles
ROM_LOAD16_WORD_SWAP( "excellent_8.14g", 0x000000, 0x080000, CRC(915520c4) SHA1(308207cb20f1ed6df365710c808644a6e4f07614) ) // 4bpp
- /* data is expanded here from bak_hi */
- ROM_REGION( 0x020000, "bak_hi", 0 ) /* BG Tiles */
+ // data is expanded here from bak_hi
+ ROM_REGION( 0x020000, "bak_hi", 0 ) // BG Tiles
ROM_LOAD( "excellent_7.17g", 0x000000, 0x020000, CRC(b96b2b82) SHA1(2b719d0c185d1eca4cd9ea66bed7842b74062288) ) // 1bpp
- ROM_REGION( 0x060000, "txt", 0 ) /* FG Tiles */
+ ROM_REGION( 0x060000, "txt", 0 ) // FG Tiles
ROM_LOAD16_WORD_SWAP( "excellent_2.17e", 0x000000, 0x020000, CRC(aa071b05) SHA1(517415bfd8e4dd51c6eb03a25c706f8613d34a09) )
- ROM_REGION( 0x200000, "spritegen", 0 ) /* Sprites? */
+ ROM_REGION( 0x200000, "spritegen", 0 )
ROM_LOAD16_WORD_SWAP( "d23c8000.1f", 0x000000, 0x0100000, CRC(14758b3c) SHA1(b372ccb42acb55a3dd15352a9d4ed576878a6731) ) // PCB denotes 23C16000 but a 23C8000 MASK is used
- ROM_REGION( 0x100000, "oki", 0 ) /* Samples */
+ ROM_REGION( 0x100000, "oki", 0 ) // Samples
ROM_LOAD( "excellent_4.7d", 0x000000, 0x80000, CRC(9a4af531) SHA1(bb201b7a6c9fd5924a0d79090257efffd8d4aba1) )
ROM_END
ROM_START( aquariumj )
- ROM_REGION( 0x080000, "maincpu", 0 ) /* 68000 code */
+ ROM_REGION( 0x080000, "maincpu", 0 ) // 68000
ROM_LOAD16_WORD_SWAP( "excellent_3.13h", 0x000000, 0x080000, CRC(344509a1) SHA1(9deb610732dee5066b3225cd7b1929b767579235) )
- ROM_REGION( 0x40000, "audiocpu", 0 ) /* z80 (sound) code */
+ ROM_REGION( 0x40000, "audiocpu", 0 ) // Z80
ROM_LOAD( "excellent_5.10c", 0x000000, 0x40000, CRC(fa555be1) SHA1(07236f2b2ba67e92984b9ddf4a8154221d535245) )
- ROM_REGION( 0x080000, "mid", 0 ) /* BG Tiles */
+ ROM_REGION( 0x080000, "mid", 0 ) // BG Tiles
ROM_LOAD16_WORD_SWAP( "excellent_1.15b", 0x000000, 0x080000, CRC(575df6ac) SHA1(071394273e512666fe124facdd8591a767ad0819) ) // 4bpp
- /* data is expanded here from mid_hi */
- ROM_REGION( 0x020000, "mid_hi", 0 ) /* BG Tiles */
+ // data is expanded here from mid_hi
+ ROM_REGION( 0x020000, "mid_hi", 0 ) // BG Tiles
ROM_LOAD( "excellent_6.15d", 0x000000, 0x020000, CRC(9065b146) SHA1(befc218bbcd63453ea7eb8f976796d36f2b2d552) ) // 1bpp
- ROM_REGION( 0x080000, "bak", 0 ) /* BG Tiles */
+ ROM_REGION( 0x080000, "bak", 0 ) // BG Tiles
ROM_LOAD16_WORD_SWAP( "excellent_8.14g", 0x000000, 0x080000, CRC(915520c4) SHA1(308207cb20f1ed6df365710c808644a6e4f07614) ) // 4bpp
- /* data is expanded here from bak_hi */
- ROM_REGION( 0x020000, "bak_hi", 0 ) /* BG Tiles */
+ // data is expanded here from bak_hi
+ ROM_REGION( 0x020000, "bak_hi", 0 ) // BG Tiles
ROM_LOAD( "excellent_7.17g", 0x000000, 0x020000, CRC(b96b2b82) SHA1(2b719d0c185d1eca4cd9ea66bed7842b74062288) ) // 1bpp
- ROM_REGION( 0x060000, "txt", 0 ) /* FG Tiles */
+ ROM_REGION( 0x060000, "txt", 0 ) // FG Tiles
ROM_LOAD16_WORD_SWAP( "excellent_2.17e", 0x000000, 0x020000, CRC(aa071b05) SHA1(517415bfd8e4dd51c6eb03a25c706f8613d34a09) )
- ROM_REGION( 0x200000, "spritegen", 0 ) /* Sprites? */
+ ROM_REGION( 0x200000, "spritegen", 0 )
ROM_LOAD16_WORD_SWAP( "d23c8000.1f", 0x000000, 0x0100000, CRC(14758b3c) SHA1(b372ccb42acb55a3dd15352a9d4ed576878a6731) ) // PCB denotes 23C16000 but a 23C8000 MASK is used
- ROM_REGION( 0x100000, "oki", 0 ) /* Samples */
+ ROM_REGION( 0x100000, "oki", 0 ) // Samples
ROM_LOAD( "excellent_4.7d", 0x000000, 0x80000, CRC(9a4af531) SHA1(bb201b7a6c9fd5924a0d79090257efffd8d4aba1) )
ROM_END
std::unique_ptr<u8[]> aquarium_state::expand_gfx(int low, int hi)
{
/* The BG tiles are 5bpp, this rearranges the data from
- the roms containing the 1bpp data so we can decode it
+ the ROMs containing the 1bpp data so we can decode it
correctly */
gfx_element *gfx_l = m_gfxdecode->gfx(low);
gfx_element *gfx_h = m_gfxdecode->gfx(hi);
@@ -371,12 +567,15 @@ void aquarium_state::init_aquarium()
m_decoded_gfx[0] = expand_gfx(1, 4);
m_decoded_gfx[1] = expand_gfx(2, 3);
- u8 *Z80 = memregion("audiocpu")->base();
+ u8 *z80 = memregion("audiocpu")->base();
- /* configure and set up the sound bank */
- m_audiobank->configure_entries(0, 0x8, &Z80[0x00000], 0x8000);
+ // configure and set up the sound bank
+ m_audiobank->configure_entries(0, 0x8, &z80[0x00000], 0x8000);
m_audiobank->set_entry(0x00);
}
+} // anonymous namespace
+
+
GAME( 1996, aquarium, 0, aquarium, aquarium, aquarium_state, init_aquarium, ROT0, "Excellent System", "Aquarium (US)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL )
GAME( 1996, aquariumj, aquarium, aquarium, aquarium, aquarium_state, init_aquarium, ROT0, "Excellent System", "Aquarium (Japan)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL )
diff --git a/src/mame/excellent/aquarium.h b/src/mame/excellent/aquarium.h
deleted file mode 100644
index 4457a028792..00000000000
--- a/src/mame/excellent/aquarium.h
+++ /dev/null
@@ -1,90 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:David Haywood
-#ifndef MAME_INCLUDES_AQUARIUM_H
-#define MAME_INCLUDES_AQUARIUM_H
-
-#pragma once
-
-#include "machine/gen_latch.h"
-#include "machine/mb3773.h"
-#include "sound/okim6295.h"
-#include "excellent_spr.h"
-#include "emupal.h"
-#include "screen.h"
-#include "tilemap.h"
-
-class aquarium_state : public driver_device
-{
-public:
- aquarium_state(const machine_config &mconfig, device_type type, const char *tag) :
- driver_device(mconfig, type, tag),
- m_mid_videoram(*this, "mid_videoram"),
- m_bak_videoram(*this, "bak_videoram"),
- m_txt_videoram(*this, "txt_videoram"),
- m_scroll(*this, "scroll"),
- m_audiobank(*this, "bank1"),
- m_maincpu(*this, "maincpu"),
- m_audiocpu(*this, "audiocpu"),
- m_oki(*this, "oki"),
- m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "palette"),
- m_sprgen(*this, "spritegen"),
- m_screen(*this, "screen"),
- m_soundlatch(*this, "soundlatch"),
- m_watchdog(*this, "watchdog")
- { }
-
- void init_aquarium();
-
- void aquarium(machine_config &config);
-
-protected:
- virtual void video_start() override;
-
-private:
- /* memory pointers */
- required_shared_ptr<u16> m_mid_videoram;
- required_shared_ptr<u16> m_bak_videoram;
- required_shared_ptr<u16> m_txt_videoram;
- required_shared_ptr<u16> m_scroll;
- required_memory_bank m_audiobank;
-
- /* video-related */
- tilemap_t *m_txt_tilemap = nullptr;
- tilemap_t *m_mid_tilemap = nullptr;
- tilemap_t *m_bak_tilemap = nullptr;
- std::unique_ptr<u8[]> m_decoded_gfx[2];
-
- /* devices */
- required_device<cpu_device> m_maincpu;
- required_device<cpu_device> m_audiocpu;
- required_device<okim6295_device> m_oki;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
- required_device<excellent_spr_device> m_sprgen;
- required_device<screen_device> m_screen;
- required_device<generic_latch_8_device> m_soundlatch;
- required_device<mb3773_device> m_watchdog;
-
- void watchdog_w(u8 data);
- void z80_bank_w(u8 data);
- u8 oki_r();
- void oki_w(u8 data);
-
- std::unique_ptr<u8[]> expand_gfx(int low, int hi);
- void txt_videoram_w(offs_t offset, u16 data, u16 mem_mask = ~0);
- void mid_videoram_w(offs_t offset, u16 data, u16 mem_mask = ~0);
- void bak_videoram_w(offs_t offset, u16 data, u16 mem_mask = ~0);
- TILE_GET_INFO_MEMBER(get_txt_tile_info);
- TILE_GET_INFO_MEMBER(get_mid_tile_info);
- TILE_GET_INFO_MEMBER(get_bak_tile_info);
- uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- u8 snd_bitswap(u8 scrambled_data);
- void aquarium_colpri_cb(u32 &colour, u32 &pri_mask);
-
- void main_map(address_map &map);
- void snd_map(address_map &map);
- void snd_portmap(address_map &map);
-};
-
-#endif // MAME_INCLUDES_AQUARIUM_H
diff --git a/src/mame/excellent/aquarium_v.cpp b/src/mame/excellent/aquarium_v.cpp
deleted file mode 100644
index 1ef063f643f..00000000000
--- a/src/mame/excellent/aquarium_v.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:David Haywood
-/* Aquarium */
-
-#include "emu.h"
-#include "aquarium.h"
-
-
-/* TXT Layer */
-TILE_GET_INFO_MEMBER(aquarium_state::get_txt_tile_info)
-{
- const u32 tileno = (m_txt_videoram[tile_index] & 0x0fff);
- const u32 colour = (m_txt_videoram[tile_index] & 0xf000) >> 12;
- tileinfo.set(0, tileno, colour, 0);
-
- tileinfo.category = (m_txt_videoram[tile_index] & 0x8000) >> 15;
-}
-
-void aquarium_state::txt_videoram_w(offs_t offset, u16 data, u16 mem_mask)
-{
- COMBINE_DATA(&m_txt_videoram[offset]);
- m_txt_tilemap->mark_tile_dirty(offset);
-}
-
-/* MID Layer */
-TILE_GET_INFO_MEMBER(aquarium_state::get_mid_tile_info)
-{
- const u32 tileno = (m_mid_videoram[tile_index * 2] & 0x0fff);
- const u32 colour = (m_mid_videoram[tile_index * 2 + 1] & 0x001f);
- const int flag = TILE_FLIPYX((m_mid_videoram[tile_index * 2 + 1] & 0x300) >> 8);
-
- tileinfo.set(1, tileno, colour, flag);
-
- tileinfo.category = (m_mid_videoram[tile_index * 2 + 1] & 0x20) >> 5;
-}
-
-void aquarium_state::mid_videoram_w(offs_t offset, u16 data, u16 mem_mask)
-{
- COMBINE_DATA(&m_mid_videoram[offset]);
- m_mid_tilemap->mark_tile_dirty(offset / 2);
-}
-
-/* BAK Layer */
-TILE_GET_INFO_MEMBER(aquarium_state::get_bak_tile_info)
-{
- const u32 tileno = (m_bak_videoram[tile_index * 2] & 0x0fff);
- const u32 colour = (m_bak_videoram[tile_index * 2 + 1] & 0x001f);
- const int flag = TILE_FLIPYX((m_bak_videoram[tile_index * 2 + 1] & 0x300) >> 8);
-
- tileinfo.set(2, tileno, colour, flag);
-
- tileinfo.category = (m_bak_videoram[tile_index * 2 + 1] & 0x20) >> 5;
-}
-
-void aquarium_state::bak_videoram_w(offs_t offset, u16 data, u16 mem_mask)
-{
- COMBINE_DATA(&m_bak_videoram[offset]);
- m_bak_tilemap->mark_tile_dirty(offset / 2);
-}
-
-void aquarium_state::video_start()
-{
- m_txt_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(aquarium_state::get_txt_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64, 64);
- m_mid_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(aquarium_state::get_mid_tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
- m_bak_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(aquarium_state::get_bak_tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
-
- m_txt_tilemap->set_transparent_pen(0);
- m_mid_tilemap->set_transparent_pen(0);
- m_bak_tilemap->set_transparent_pen(0);
-}
-
-void aquarium_state::aquarium_colpri_cb(u32 &colour, u32 &pri_mask)
-{
- pri_mask = 0;
- if (colour & 8)
- pri_mask |= (GFX_PMASK_2 | GFX_PMASK_4 | GFX_PMASK_8);
-}
-
-uint32_t aquarium_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
- m_mid_tilemap->set_scrollx(0, m_scroll[0]);
- m_mid_tilemap->set_scrolly(0, m_scroll[1]);
- m_bak_tilemap->set_scrollx(0, m_scroll[2]);
- m_bak_tilemap->set_scrolly(0, m_scroll[3]);
- m_txt_tilemap->set_scrollx(0, m_scroll[4]);
- m_txt_tilemap->set_scrolly(0, m_scroll[5]);
-
- screen.priority().fill(0, cliprect);
- bitmap.fill(0, cliprect); // WDUD logo suggests this
-
- m_bak_tilemap->draw(screen, bitmap, cliprect, 0, 1);
- m_mid_tilemap->draw(screen, bitmap, cliprect, 0, 2);
- m_txt_tilemap->draw(screen, bitmap, cliprect, 1, 4);
-
- m_bak_tilemap->draw(screen, bitmap, cliprect, 1, 8);
- m_sprgen->aquarium_draw_sprites(screen, bitmap, cliprect, 16);
- m_mid_tilemap->draw(screen, bitmap, cliprect, 1, 0);
- m_txt_tilemap->draw(screen, bitmap, cliprect, 0, 0);
-
- return 0;
-}
diff --git a/src/mame/excellent/gcpinbal.cpp b/src/mame/excellent/gcpinbal.cpp
index e20f64c3e30..a2deedd8ea9 100644
--- a/src/mame/excellent/gcpinbal.cpp
+++ b/src/mame/excellent/gcpinbal.cpp
@@ -1,5 +1,6 @@
// license:BSD-3-Clause
-// copyright-holders:David Graves, R. Belmont, David Haywood
+// copyright-holders: David Graves, R. Belmont, David Haywood
+
/***************************************************************************
Excellent System's ES-9209B Hardware
@@ -23,7 +24,6 @@ TODO
----
- Screen flipping support
- - Modernize ES-8712 and hook up to MSM6585 and HCT157
- Figure out which customs use D80010-D80077 and merge implementation with Aquarium
- Is SW3 actually used?
- Power Flipper reference video: https://www.youtube.com/watch?v=zBGjncVsSf4 (seems to have been recorded with 'flipscreen' dipswitch on, because it causes a jumping glitch before the raster effect, same in MAME)
@@ -81,12 +81,260 @@ NOTE: Mask ROMs from Power Flipper Pinball Shooting have not been dumped, but as
***************************************************************************/
#include "emu.h"
-#include "gcpinbal.h"
+
+#include "excellent_spr.h"
#include "cpu/m68000/m68000.h"
+#include "machine/eepromser.h"
+#include "machine/mb3773.h"
+#include "machine/timer.h"
+#include "sound/es8712.h"
+#include "sound/okim6295.h"
+
+#include "emupal.h"
#include "screen.h"
#include "speaker.h"
+#include "tilemap.h"
+
+
+// configurable logging
+#define LOG_IOC (1U << 1)
+#define LOG_ESBANKSW (1U << 2)
+
+//#define VERBOSE (LOG_GENERAL | LOG_IOC | LOG_ESBANKSW)
+
+#include "logmacro.h"
+
+#define LOGIOC(...) LOGMASKED(LOG_IOC, __VA_ARGS__)
+#define LOGESBANKSW(...) LOGMASKED(LOG_ESBANKSW, __VA_ARGS__)
+
+
+namespace {
+
+class gcpinbal_state : public driver_device
+{
+public:
+ gcpinbal_state(const machine_config &mconfig, device_type type, const char *tag)
+ : driver_device(mconfig, type, tag)
+ , m_tilemapram(*this, "tilemapram")
+ , m_d80010_ram(*this, "d80010")
+ , m_d80060_ram(*this, "d80060")
+ , m_maincpu(*this, "maincpu")
+ , m_eeprom(*this, "eeprom")
+ , m_watchdog(*this, "watchdog")
+ , m_oki(*this, "oki")
+ , m_essnd(*this, "essnd")
+ , m_sprgen(*this, "spritegen")
+ , m_screen(*this, "screen")
+ , m_gfxdecode(*this, "gfxdecode")
+ , m_palette(*this, "palette")
+ { }
+
+ void gcpinbal(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<u16> m_tilemapram;
+ required_shared_ptr<u16> m_d80010_ram;
+ required_shared_ptr<u16> m_d80060_ram;
+
+ // video-related
+ tilemap_t *m_tilemap[3]{};
+ u16 m_scrollx[3]{};
+ u16 m_scrolly[3]{};
+ u16 m_bg_gfxset[2]{};
+#ifdef MAME_DEBUG
+ u8 m_dislayer[4]{};
+#endif
+
+ // sound-related
+ u8 m_msm_bank = 0U;
+
+ // devices
+ required_device<cpu_device> m_maincpu;
+ required_device<eeprom_serial_93cxx_device> m_eeprom;
+ required_device<mb3773_device> m_watchdog;
+ required_device<okim6295_device> m_oki;
+ required_device<es8712_device> m_essnd;
+ required_device<excellent_spr_device> m_sprgen;
+ required_device<screen_device> m_screen;
+ required_device<gfxdecode_device> m_gfxdecode;
+ required_device<palette_device> m_palette;
+
+ void d80010_w(offs_t offset, u16 data, u16 mem_mask = ~0);
+ void d80040_w(offs_t offset, u8 data);
+ void d80060_w(offs_t offset, u16 data, u16 mem_mask = ~0);
+ void bank_w(u8 data);
+ void eeprom_w(u8 data);
+ void es8712_reset_w(u8 data);
+ void tilemaps_word_w(offs_t offset, u16 data, u16 mem_mask = ~0);
+
+ TILE_GET_INFO_MEMBER(get_bg0_tile_info);
+ TILE_GET_INFO_MEMBER(get_bg1_tile_info);
+ TILE_GET_INFO_MEMBER(get_fg_tile_info);
+
+ void colpri_cb(u32 &colour, u32 &pri_mask);
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ TIMER_DEVICE_CALLBACK_MEMBER(scanline_cb);
+
+ void program_map(address_map &map);
+};
+
+
+// video
+
+/*******************************************************************/
+
+
+TILE_GET_INFO_MEMBER(gcpinbal_state::get_bg0_tile_info)
+{
+ const u16 tile = m_tilemapram[0 + tile_index * 2];
+ const u16 attr = m_tilemapram[1 + tile_index * 2];
+
+ tileinfo.set(0,
+ (tile & 0xfff) + m_bg_gfxset[0],
+ (attr & 0x1f),
+ TILE_FLIPYX((attr & 0x300) >> 8));
+}
+
+TILE_GET_INFO_MEMBER(gcpinbal_state::get_bg1_tile_info)
+{
+ const u16 tile = m_tilemapram[0x800 + tile_index * 2];
+ const u16 attr = m_tilemapram[0x801 + tile_index * 2];
+
+ tileinfo.set(0,
+ (tile & 0xfff) + 0x2000 + m_bg_gfxset[1],
+ (attr & 0x1f) + 0x30,
+ TILE_FLIPYX((attr & 0x300) >> 8));
+}
+
+TILE_GET_INFO_MEMBER(gcpinbal_state::get_fg_tile_info)
+{
+ const u16 tile = m_tilemapram[0x1000 + tile_index];
+ tileinfo.set(1, (tile & 0xfff), (tile >> 12), 0);
+}
+
+void gcpinbal_state::video_start()
+{
+ int xoffs = 0;
+ int yoffs = 0;
+
+ m_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(gcpinbal_state::get_bg0_tile_info)),TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
+ m_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(gcpinbal_state::get_bg1_tile_info)),TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
+ m_tilemap[2] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(gcpinbal_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64, 64);
+
+ m_tilemap[0]->set_transparent_pen(0);
+ m_tilemap[1]->set_transparent_pen(0);
+ m_tilemap[2]->set_transparent_pen(0);
+
+ // flipscreen n/a
+ m_tilemap[0]->set_scrolldx(-xoffs, 0);
+ m_tilemap[1]->set_scrolldx(-xoffs, 0);
+ m_tilemap[2]->set_scrolldx(-xoffs, 0);
+ m_tilemap[0]->set_scrolldy(-yoffs, 0);
+ m_tilemap[1]->set_scrolldy(-yoffs, 0);
+ m_tilemap[2]->set_scrolldy(-yoffs, 0);
+}
+
+void gcpinbal_state::colpri_cb(u32 &colour, u32 &pri_mask)
+{
+ pri_mask = (m_d80060_ram[0x8 / 2] & 0x8800) ? 0xf0 : 0xfc;
+}
+
+
+/******************************************************************
+ TILEMAP READ AND WRITE HANDLERS
+*******************************************************************/
+
+void gcpinbal_state::tilemaps_word_w(offs_t offset, u16 data, u16 mem_mask)
+{
+ COMBINE_DATA(&m_tilemapram[offset]);
+
+ if (offset < 0x800) // BG0
+ m_tilemap[0]->mark_tile_dirty(offset / 2);
+ else if ((offset < 0x1000)) // BG1
+ m_tilemap[1]->mark_tile_dirty((offset % 0x800) / 2);
+ else if ((offset < 0x1800)) // FG
+ m_tilemap[2]->mark_tile_dirty((offset % 0x800));
+}
+
+
+/**************************************************************
+ SCREEN REFRESH
+**************************************************************/
+
+uint32_t gcpinbal_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ uint8_t layer[3];
+
+#ifdef MAME_DEBUG
+ if (machine().input().code_pressed_once(KEYCODE_V))
+ {
+ m_dislayer[0] ^= 1;
+ popmessage("bg0: %01x", m_dislayer[0]);
+ }
+
+ if (machine().input().code_pressed_once(KEYCODE_B))
+ {
+ m_dislayer[1] ^= 1;
+ popmessage("bg1: %01x", m_dislayer[1]);
+ }
+
+ if (machine().input().code_pressed_once(KEYCODE_N))
+ {
+ m_dislayer[2] ^= 1;
+ popmessage("fg: %01x", m_dislayer[2]);
+ }
+#endif
+ m_scrollx[0] = m_d80010_ram[0x4 / 2];
+ m_scrolly[0] = m_d80010_ram[0x6 / 2];
+ m_scrollx[1] = m_d80010_ram[0x8 / 2];
+ m_scrolly[1] = m_d80010_ram[0xa / 2];
+ m_scrollx[2] = m_d80010_ram[0xc / 2];
+ m_scrolly[2] = m_d80010_ram[0xe / 2];
+
+ for (int i = 0; i < 3; i++)
+ {
+ m_tilemap[i]->set_scrollx(0, m_scrollx[i]);
+ m_tilemap[i]->set_scrolly(0, m_scrolly[i]);
+ }
+
+ screen.priority().fill(0, cliprect);
+ bitmap.fill(0, cliprect);
+
+ layer[0] = 0;
+ layer[1] = 1;
+ layer[2] = 2;
+
+
+#ifdef MAME_DEBUG
+ if (m_dislayer[layer[0]] == 0)
+#endif
+ m_tilemap[layer[0]]->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 1);
+
+#ifdef MAME_DEBUG
+ if (m_dislayer[layer[1]] == 0)
+#endif
+ m_tilemap[layer[1]]->draw(screen, bitmap, cliprect, 0, 2);
+
+#ifdef MAME_DEBUG
+ if (m_dislayer[layer[2]] == 0)
+#endif
+ m_tilemap[layer[2]]->draw(screen, bitmap, cliprect, 0, 4);
+
+ m_sprgen->gcpinbal_draw_sprites(screen, bitmap, cliprect, 16);
+
+ return 0;
+}
+
+
+// machine
/***********************************************************
INTERRUPTS
@@ -111,18 +359,18 @@ TIMER_DEVICE_CALLBACK_MEMBER(gcpinbal_state::scanline_cb)
void gcpinbal_state::d80010_w(offs_t offset, u16 data, u16 mem_mask)
{
- //logerror("CPU #0 PC %06x: warning - write ioc offset %06x with %04x\n", m_maincpu->pc(), offset, data);
+ LOGIOC("CPU #0 PC %06x: warning - write ioc offset %06x with %04x\n", m_maincpu->pc(), offset, data);
COMBINE_DATA(&m_d80010_ram[offset]);
}
void gcpinbal_state::d80040_w(offs_t offset, u8 data)
{
- logerror("Writing byte value %02X to offset %X\n", data, offset);
+ LOGIOC("Writing byte value %02X to offset %X\n", data, offset);
}
void gcpinbal_state::d80060_w(offs_t offset, u16 data, u16 mem_mask)
{
- //logerror("CPU #0 PC %06x: warning - write ioc offset %06x with %04x\n", m_maincpu->pc(), offset, data);
+ LOGIOC("CPU #0 PC %06x: warning - write ioc offset %06x with %04x\n", m_maincpu->pc(), offset, data);
COMBINE_DATA(&m_d80060_ram[offset]);
}
@@ -133,23 +381,23 @@ void gcpinbal_state::bank_w(u8 data)
{
m_msm_bank = ((data & 0x10) >> 4);
m_essnd->set_rom_bank(m_msm_bank);
- logerror("Bankswitching ES8712 ROM %02x\n", m_msm_bank);
+ LOGESBANKSW("Bankswitching ES8712 ROM %02x\n", m_msm_bank);
}
m_oki->set_rom_bank((data & 0x20) >> 5);
- u32 old = m_bg0_gfxset;
+ u32 old = m_bg_gfxset[0];
u32 newbank = (data & 0x04) ? 0x1000 : 0;
if (old != newbank)
{
- m_bg0_gfxset = (data & 0x04) ? 0x1000 : 0;
+ m_bg_gfxset[0] = (data & 0x04) ? 0x1000 : 0;
m_tilemap[0]->mark_all_dirty();
}
- old = m_bg1_gfxset;
+ old = m_bg_gfxset[1];
newbank = (data & 0x08) ? 0x1000 : 0;
if (old != newbank)
{
- m_bg1_gfxset = (data & 0x04) ? 0x1000 : 0;
+ m_bg_gfxset[1] = (data & 0x04) ? 0x1000 : 0;
m_tilemap[1]->mark_all_dirty();
}
@@ -178,15 +426,15 @@ void gcpinbal_state::es8712_reset_w(u8 data)
MEMORY STRUCTURES
***********************************************************/
-void gcpinbal_state::gcpinbal_map(address_map &map)
+void gcpinbal_state::program_map(address_map &map)
{
map(0x000000, 0x1fffff).rom();
- map(0xc00000, 0xc03fff).ram().w(FUNC(gcpinbal_state::tilemaps_word_w)).share("tilemapram");
+ map(0xc00000, 0xc03fff).ram().w(FUNC(gcpinbal_state::tilemaps_word_w)).share(m_tilemapram);
map(0xc80000, 0xc81fff).rw(m_sprgen, FUNC(excellent_spr_device::read), FUNC(excellent_spr_device::write)).umask16(0x00ff);
map(0xd00000, 0xd00fff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
- map(0xd80010, 0xd8002f).ram().w(FUNC(gcpinbal_state::d80010_w)).share("d80010");
+ map(0xd80010, 0xd8002f).ram().w(FUNC(gcpinbal_state::d80010_w)).share(m_d80010_ram);
map(0xd80040, 0xd8005b).w(FUNC(gcpinbal_state::d80040_w)).umask16(0x00ff);
- map(0xd80060, 0xd80077).ram().w(FUNC(gcpinbal_state::d80060_w)).share("d80060");
+ map(0xd80060, 0xd80077).ram().w(FUNC(gcpinbal_state::d80060_w)).share(m_d80060_ram);
map(0xd80080, 0xd80081).portr("DSW");
map(0xd80084, 0xd80085).portr("IN0");
map(0xd80086, 0xd80087).portr("IN1");
@@ -195,7 +443,7 @@ void gcpinbal_state::gcpinbal_map(address_map &map)
map(0xd8008e, 0xd8008e).w(FUNC(gcpinbal_state::es8712_reset_w));
map(0xd800a0, 0xd800a0).mirror(0x2).rw(m_oki, FUNC(okim6295_device::read), FUNC(okim6295_device::write));
map(0xd800c0, 0xd800cd).w(m_essnd, FUNC(es8712_device::write)).umask16(0xff00);
- map(0xff0000, 0xffffff).ram(); /* RAM */
+ map(0xff0000, 0xffffff).ram();
}
@@ -309,8 +557,7 @@ void gcpinbal_state::machine_start()
{
save_item(NAME(m_scrollx));
save_item(NAME(m_scrolly));
- save_item(NAME(m_bg0_gfxset));
- save_item(NAME(m_bg1_gfxset));
+ save_item(NAME(m_bg_gfxset));
save_item(NAME(m_msm_bank));
}
@@ -322,16 +569,16 @@ void gcpinbal_state::machine_reset()
m_scrolly[i] = 0;
}
- m_bg0_gfxset = 0;
- m_bg1_gfxset = 0;
+ m_bg_gfxset[0] = 0;
+ m_bg_gfxset[1] = 0;
m_msm_bank = 0;
}
void gcpinbal_state::gcpinbal(machine_config &config)
{
- /* basic machine hardware */
- M68000(config, m_maincpu, 32_MHz_XTAL/2); /* 16 MHz */
- m_maincpu->set_addrmap(AS_PROGRAM, &gcpinbal_state::gcpinbal_map);
+ // basic machine hardware
+ M68000(config, m_maincpu, 32_MHz_XTAL / 2); // 16 MHz
+ m_maincpu->set_addrmap(AS_PROGRAM, &gcpinbal_state::program_map);
TIMER(config, "scantimer").configure_scanline(FUNC(gcpinbal_state::scanline_cb), "screen", 0, 1);
@@ -339,24 +586,24 @@ void gcpinbal_state::gcpinbal(machine_config &config)
MB3773(config, m_watchdog, 0);
- /* 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) /* frames per second, vblank duration */);
+ m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(0)); // frames per second, vblank duration
m_screen->set_size(40*8, 32*8);
m_screen->set_visarea(0*8, 40*8-1, 2*8, 30*8-1);
m_screen->set_screen_update(FUNC(gcpinbal_state::screen_update));
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_gcpinbal);
- PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 0x1000/2);
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 0x1000 / 2);
EXCELLENT_SPRITE(config, m_sprgen, 0);
m_sprgen->set_palette(m_palette);
m_sprgen->set_color_base(0x600);
- m_sprgen->set_colpri_callback(FUNC(gcpinbal_state::gcpinbal_colpri_cb));
+ m_sprgen->set_colpri_callback(FUNC(gcpinbal_state::colpri_cb));
- /* sound hardware */
+ // sound hardware
SPEAKER(config, "mono").front_center();
OKIM6295(config, m_oki, 1.056_MHz_XTAL, okim6295_device::PIN7_HIGH).add_route(ALL_OUTPUTS, "mono", 0.30);
@@ -368,7 +615,7 @@ void gcpinbal_state::gcpinbal(machine_config &config)
msm6585_device &msm(MSM6585(config, "msm", 640_kHz_XTAL));
msm.vck_legacy_callback().set("essnd", FUNC(es8712_device::msm_int));
- msm.set_prescaler_selector(msm6585_device::S40); /* 16 kHz */
+ msm.set_prescaler_selector(msm6585_device::S40); // 16 kHz
msm.add_route(ALL_OUTPUTS, "mono", 1.0);
}
@@ -378,62 +625,64 @@ void gcpinbal_state::gcpinbal(machine_config &config)
DRIVERS
***************************************************************************/
-ROM_START( pwrflip ) /* Updated version of Grand Cross Pinball or semi-sequel? */
- ROM_REGION( 0x200000, "maincpu", 0 ) /* 512k for 68000 program */
- ROM_LOAD16_WORD_SWAP( "p.f_1.33.u43", 0x000000, 0x80000, CRC(d760c987) SHA1(9200604377542193afc866c84733f2d3b5aa1c80) ) /* hand written labels on genuine EXCELLENT labels */
- ROM_FILL ( 0x80000, 0x080000, 0x00 ) /* unpopulated 27C4096 socket at U44 */
+ROM_START( pwrflip ) // Updated version of Grand Cross Pinball or semi-sequel?
+ ROM_REGION( 0x200000, "maincpu", 0 ) // 68000
+ ROM_LOAD16_WORD_SWAP( "p.f_1.33.u43", 0x000000, 0x80000, CRC(d760c987) SHA1(9200604377542193afc866c84733f2d3b5aa1c80) ) // hand written labels on genuine EXCELLENT labels
+ ROM_FILL ( 0x80000, 0x080000, 0x00 ) // unpopulated 27C4096 socket at U44
ROM_LOAD16_WORD_SWAP( "p.f.u45", 0x100000, 0x80000, CRC(6ad1a457) SHA1(8746c38efa05e3318e9b1a371470d149803fb6bb) )
ROM_LOAD16_WORD_SWAP( "p.f.u46", 0x180000, 0x80000, CRC(e0f3a1b4) SHA1(761dddf374a92c1a1e4a211ead215d5be461a082) )
- ROM_REGION( 0x200000, "bg0", 0 ) /* BG0 (16 x 16) */
- ROM_LOAD16_WORD_SWAP( "u1", 0x000000, 0x100000, CRC(afa459bb) SHA1(7a7c64bcb80d71b8cf3fdd3209ef109997b6417c) ) /* 23C8000 mask ROMs */
+ ROM_REGION( 0x200000, "bg0", 0 ) // 16 x 16
+ ROM_LOAD16_WORD_SWAP( "u1", 0x000000, 0x100000, CRC(afa459bb) SHA1(7a7c64bcb80d71b8cf3fdd3209ef109997b6417c) ) // 23C8000 mask ROMs
ROM_LOAD16_WORD_SWAP( "u6", 0x100000, 0x100000, CRC(c3f024e5) SHA1(d197e2b715b154fc64ff9a61f8c6df111d6fd446) )
- ROM_REGION( 0x020000, "fg0", 0 ) /* FG0 (8 x 8) */
+ ROM_REGION( 0x020000, "fg0", 0 ) // 8 x 8
ROM_LOAD16_WORD_SWAP( "p.f.u10", 0x000000, 0x020000, CRC(50e34549) SHA1(ca1808513ff3feb8bcd34d9aafd7b374e4244732) )
- ROM_REGION( 0x200000, "spritegen", 0 ) /* Sprites (16 x 16) */
- ROM_LOAD16_WORD_SWAP( "u13", 0x000000, 0x200000, CRC(62f3952f) SHA1(7dc9ccb753d46b6aaa791bcbf6e18e6d872f6b79) ) /* 23C16000 mask ROM */
+ ROM_REGION( 0x200000, "spritegen", 0 ) // 16 x 16
+ ROM_LOAD16_WORD_SWAP( "u13", 0x000000, 0x200000, CRC(62f3952f) SHA1(7dc9ccb753d46b6aaa791bcbf6e18e6d872f6b79) ) // 23C16000 mask ROM
- ROM_REGION( 0x080000, "oki", 0 ) /* M6295 acc to Raine */
- ROM_LOAD( "u55", 0x000000, 0x080000, CRC(b3063351) SHA1(825e63e8a824d67d235178897528e5b0b41e4485) ) /* OKI M534001B mask ROM */
+ ROM_REGION( 0x080000, "oki", 0 )
+ ROM_LOAD( "u55", 0x000000, 0x080000, CRC(b3063351) SHA1(825e63e8a824d67d235178897528e5b0b41e4485) ) // OKI M534001B mask ROM
- ROM_REGION( 0x200000, "essnd", 0 ) /* M6585 acc to Raine but should be for ES-8712??? */
- ROM_LOAD( "u56", 0x000000, 0x200000, CRC(092b2c0f) SHA1(2ec1904e473ddddb50dbeaa0b561642064d45336) ) /* 23C16000 mask ROM */
+ ROM_REGION( 0x200000, "essnd", 0 )
+ ROM_LOAD( "u56", 0x000000, 0x200000, CRC(092b2c0f) SHA1(2ec1904e473ddddb50dbeaa0b561642064d45336) ) // 23C16000 mask ROM
- ROM_REGION( 0x000400, "plds", 0 ) /* 2x TIBPAL16L8-15CN */
+ ROM_REGION( 0x000400, "plds", 0 ) // 2x TIBPAL16L8-15CN
ROM_LOAD( "a.u72", 0x000, 0x104, NO_DUMP )
ROM_LOAD( "b.u73", 0x200, 0x104, NO_DUMP )
ROM_END
ROM_START( gcpinbal )
- ROM_REGION( 0x200000, "maincpu", 0 ) /* 512k for 68000 program */
- ROM_LOAD16_WORD_SWAP( "2_excellent.u43", 0x000000, 0x80000, CRC(d174bd7f) SHA1(0e6c17265e1400de941e3e2ca3be835aaaff6695) ) /* Red line across label */
- ROM_FILL ( 0x80000, 0x080000, 0x00 ) /* unpopulated 27C4096 socket at U44 */
+ ROM_REGION( 0x200000, "maincpu", 0 ) // 68000
+ ROM_LOAD16_WORD_SWAP( "2_excellent.u43", 0x000000, 0x80000, CRC(d174bd7f) SHA1(0e6c17265e1400de941e3e2ca3be835aaaff6695) ) // Red line across label
+ ROM_FILL ( 0x80000, 0x080000, 0x00 ) // unpopulated 27C4096 socket at U44
ROM_LOAD16_WORD_SWAP( "3_excellent.u45", 0x100000, 0x80000, CRC(0511ad56) SHA1(e0602ece514126ce719ebc9de6649ebe907be904) )
ROM_LOAD16_WORD_SWAP( "4_excellent.u46", 0x180000, 0x80000, CRC(e0f3a1b4) SHA1(761dddf374a92c1a1e4a211ead215d5be461a082) )
- ROM_REGION( 0x200000, "bg0", 0 ) /* BG0 (16 x 16) */
- ROM_LOAD16_WORD_SWAP( "u1", 0x000000, 0x100000, CRC(afa459bb) SHA1(7a7c64bcb80d71b8cf3fdd3209ef109997b6417c) ) /* 23C8000 mask ROMs */
+ ROM_REGION( 0x200000, "bg0", 0 ) // 16 x 16
+ ROM_LOAD16_WORD_SWAP( "u1", 0x000000, 0x100000, CRC(afa459bb) SHA1(7a7c64bcb80d71b8cf3fdd3209ef109997b6417c) ) // 23C8000 mask ROMs
ROM_LOAD16_WORD_SWAP( "u6", 0x100000, 0x100000, CRC(c3f024e5) SHA1(d197e2b715b154fc64ff9a61f8c6df111d6fd446) )
- ROM_REGION( 0x020000, "fg0", 0 ) /* FG0 (8 x 8) */
+ ROM_REGION( 0x020000, "fg0", 0 ) // 8 x 8
ROM_LOAD16_WORD_SWAP( "1_excellent.u10", 0x000000, 0x020000, CRC(79321550) SHA1(61f1b772ed8cf95bfee9df8394b0c3ff727e8702) )
- ROM_REGION( 0x200000, "spritegen", 0 ) /* Sprites (16 x 16) */
- ROM_LOAD16_WORD_SWAP( "u13", 0x000000, 0x200000, CRC(62f3952f) SHA1(7dc9ccb753d46b6aaa791bcbf6e18e6d872f6b79) ) /* 23C16000 mask ROM */
+ ROM_REGION( 0x200000, "spritegen", 0 ) // 16 x 16
+ ROM_LOAD16_WORD_SWAP( "u13", 0x000000, 0x200000, CRC(62f3952f) SHA1(7dc9ccb753d46b6aaa791bcbf6e18e6d872f6b79) ) // 23C16000 mask ROM
- ROM_REGION( 0x080000, "oki", 0 ) /* M6295 acc to Raine */
- ROM_LOAD( "u55", 0x000000, 0x080000, CRC(b3063351) SHA1(825e63e8a824d67d235178897528e5b0b41e4485) ) /* OKI M534001B mask ROM */
+ ROM_REGION( 0x080000, "oki", 0 )
+ ROM_LOAD( "u55", 0x000000, 0x080000, CRC(b3063351) SHA1(825e63e8a824d67d235178897528e5b0b41e4485) ) // OKI M534001B mask ROM
- ROM_REGION( 0x200000, "essnd", 0 ) /* M6585 acc to Raine but should be for ES-8712??? */
- ROM_LOAD( "u56", 0x000000, 0x200000, CRC(092b2c0f) SHA1(2ec1904e473ddddb50dbeaa0b561642064d45336) ) /* 23C16000 mask ROM */
+ ROM_REGION( 0x200000, "essnd", 0 )
+ ROM_LOAD( "u56", 0x000000, 0x200000, CRC(092b2c0f) SHA1(2ec1904e473ddddb50dbeaa0b561642064d45336) ) // 23C16000 mask ROM
- ROM_REGION( 0x000400, "plds", 0 ) /* 2x TIBPAL16L8-15CN */
+ ROM_REGION( 0x000400, "plds", 0 ) // 2x TIBPAL16L8-15CN
ROM_LOAD( "a.u72", 0x000, 0x104, NO_DUMP )
ROM_LOAD( "b.u73", 0x200, 0x104, NO_DUMP )
ROM_END
+} // anonymous namespace
+
-GAME( 1994, pwrflip, 0, gcpinbal, gcpinbal, gcpinbal_state, empty_init, ROT270, "Excellent System", "Power Flipper Pinball Shooting v1.33", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE )
-GAME( 1994, gcpinbal, 0, gcpinbal, gcpinbal, gcpinbal_state, empty_init, ROT270, "Excellent System", "Grand Cross v1.02F", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE )
+GAME( 1994, pwrflip, 0, gcpinbal, gcpinbal, gcpinbal_state, empty_init, ROT270, "Excellent System", "Power Flipper Pinball Shooting (v1.33)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE )
+GAME( 1994, gcpinbal, 0, gcpinbal, gcpinbal, gcpinbal_state, empty_init, ROT270, "Excellent System", "Grand Cross (v1.02F)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/excellent/gcpinbal.h b/src/mame/excellent/gcpinbal.h
deleted file mode 100644
index 72c5799f55d..00000000000
--- a/src/mame/excellent/gcpinbal.h
+++ /dev/null
@@ -1,93 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:David Graves, R. Belmont
-#ifndef MAME_INCLUDES_GCPINBAL_H
-#define MAME_INCLUDES_GCPINBAL_H
-
-#pragma once
-
-#include "machine/eepromser.h"
-#include "machine/mb3773.h"
-#include "sound/es8712.h"
-#include "sound/okim6295.h"
-#include "excellent_spr.h"
-#include "emupal.h"
-#include "machine/timer.h"
-#include "screen.h"
-#include "tilemap.h"
-
-class gcpinbal_state : public driver_device
-{
-public:
- gcpinbal_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag)
- , m_tilemapram(*this, "tilemapram")
- , m_d80010_ram(*this, "d80010")
- , m_d80060_ram(*this, "d80060")
- , m_maincpu(*this, "maincpu")
- , m_eeprom(*this, "eeprom")
- , m_watchdog(*this, "watchdog")
- , m_oki(*this, "oki")
- , m_essnd(*this, "essnd")
- , m_sprgen(*this, "spritegen")
- , m_screen(*this, "screen")
- , m_gfxdecode(*this, "gfxdecode")
- , m_palette(*this, "palette")
- { }
-
- void gcpinbal(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<u16> m_tilemapram;
- required_shared_ptr<u16> m_d80010_ram;
- required_shared_ptr<u16> m_d80060_ram;
-
- /* video-related */
- tilemap_t *m_tilemap[3]{};
- u16 m_scrollx[3]{};
- u16 m_scrolly[3]{};
- u16 m_bg0_gfxset = 0U;
- u16 m_bg1_gfxset = 0U;
-#ifdef MAME_DEBUG
- u8 m_dislayer[4] = { 0, 0, 0, 0 };
-#endif
-
- /* sound-related */
- u32 m_msm_bank = 0U;
-
- /* devices */
- required_device<cpu_device> m_maincpu;
- required_device<eeprom_serial_93cxx_device> m_eeprom;
- required_device<mb3773_device> m_watchdog;
- required_device<okim6295_device> m_oki;
- required_device<es8712_device> m_essnd;
- required_device<excellent_spr_device> m_sprgen;
- required_device<screen_device> m_screen;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
-
- void d80010_w(offs_t offset, u16 data, u16 mem_mask = ~0);
- void d80040_w(offs_t offset, u8 data);
- void d80060_w(offs_t offset, u16 data, u16 mem_mask = ~0);
- void bank_w(u8 data);
- void eeprom_w(u8 data);
- void es8712_reset_w(u8 data);
- void tilemaps_word_w(offs_t offset, u16 data, u16 mem_mask = ~0);
-
- TILE_GET_INFO_MEMBER(get_bg0_tile_info);
- TILE_GET_INFO_MEMBER(get_bg1_tile_info);
- TILE_GET_INFO_MEMBER(get_fg_tile_info);
-
- void gcpinbal_colpri_cb(u32 &colour, u32 &pri_mask);
- uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- TIMER_DEVICE_CALLBACK_MEMBER(scanline_cb);
-
- void gcpinbal_map(address_map &map);
-};
-
-#endif // MAME_INCLUDES_GCPINBAL_H
diff --git a/src/mame/excellent/gcpinbal_v.cpp b/src/mame/excellent/gcpinbal_v.cpp
deleted file mode 100644
index 2809f34e7a2..00000000000
--- a/src/mame/excellent/gcpinbal_v.cpp
+++ /dev/null
@@ -1,159 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:David Graves, R. Belmont, David Haywood
-#include "emu.h"
-#include "gcpinbal.h"
-#include "screen.h"
-
-
-/*******************************************************************/
-
-
-TILE_GET_INFO_MEMBER(gcpinbal_state::get_bg0_tile_info)
-{
- const u16 tile = m_tilemapram[0 + tile_index * 2];
- const u16 attr = m_tilemapram[1 + tile_index * 2];
-
- tileinfo.set(0,
- (tile & 0xfff) + m_bg0_gfxset,
- (attr & 0x1f),
- TILE_FLIPYX((attr & 0x300) >> 8));
-}
-
-TILE_GET_INFO_MEMBER(gcpinbal_state::get_bg1_tile_info)
-{
- const u16 tile = m_tilemapram[0x800 + tile_index * 2];
- const u16 attr = m_tilemapram[0x801 + tile_index * 2];
-
- tileinfo.set(0,
- (tile & 0xfff) + 0x2000 + m_bg1_gfxset,
- (attr & 0x1f) + 0x30,
- TILE_FLIPYX((attr & 0x300) >> 8));
-}
-
-TILE_GET_INFO_MEMBER(gcpinbal_state::get_fg_tile_info)
-{
- const u16 tile = m_tilemapram[0x1000 + tile_index];
- tileinfo.set(1, (tile & 0xfff), (tile >> 12), 0);
-}
-
-void gcpinbal_state::video_start()
-{
- int xoffs = 0;
- int yoffs = 0;
-
- m_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(gcpinbal_state::get_bg0_tile_info)),TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
- m_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(gcpinbal_state::get_bg1_tile_info)),TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
- m_tilemap[2] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(gcpinbal_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64, 64);
-
- m_tilemap[0]->set_transparent_pen(0);
- m_tilemap[1]->set_transparent_pen(0);
- m_tilemap[2]->set_transparent_pen(0);
-
- /* flipscreen n/a */
- m_tilemap[0]->set_scrolldx(-xoffs, 0);
- m_tilemap[1]->set_scrolldx(-xoffs, 0);
- m_tilemap[2]->set_scrolldx(-xoffs, 0);
- m_tilemap[0]->set_scrolldy(-yoffs, 0);
- m_tilemap[1]->set_scrolldy(-yoffs, 0);
- m_tilemap[2]->set_scrolldy(-yoffs, 0);
-}
-
-void gcpinbal_state::gcpinbal_colpri_cb(u32 &colour, u32 &pri_mask)
-{
- pri_mask = (m_d80060_ram[0x8 / 2] & 0x8800) ? 0xf0 : 0xfc;
-}
-
-
-/******************************************************************
- TILEMAP READ AND WRITE HANDLERS
-*******************************************************************/
-
-void gcpinbal_state::tilemaps_word_w(offs_t offset, u16 data, u16 mem_mask)
-{
- COMBINE_DATA(&m_tilemapram[offset]);
-
- if (offset < 0x800) /* BG0 */
- m_tilemap[0]->mark_tile_dirty(offset / 2);
- else if ((offset < 0x1000)) /* BG1 */
- m_tilemap[1]->mark_tile_dirty((offset % 0x800) / 2);
- else if ((offset < 0x1800)) /* FG */
- m_tilemap[2]->mark_tile_dirty((offset % 0x800));
-}
-
-
-/**************************************************************
- SCREEN REFRESH
-**************************************************************/
-
-uint32_t gcpinbal_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
- uint8_t layer[3];
-
-#ifdef MAME_DEBUG
- if (machine().input().code_pressed_once(KEYCODE_V))
- {
- m_dislayer[0] ^= 1;
- popmessage("bg0: %01x", m_dislayer[0]);
- }
-
- if (machine().input().code_pressed_once(KEYCODE_B))
- {
- m_dislayer[1] ^= 1;
- popmessage("bg1: %01x", m_dislayer[1]);
- }
-
- if (machine().input().code_pressed_once(KEYCODE_N))
- {
- m_dislayer[2] ^= 1;
- popmessage("fg: %01x", m_dislayer[2]);
- }
-#endif
-
- m_scrollx[0] = m_d80010_ram[0x4 / 2];
- m_scrolly[0] = m_d80010_ram[0x6 / 2];
- m_scrollx[1] = m_d80010_ram[0x8 / 2];
- m_scrolly[1] = m_d80010_ram[0xa / 2];
- m_scrollx[2] = m_d80010_ram[0xc / 2];
- m_scrolly[2] = m_d80010_ram[0xe / 2];
-
- for (int i = 0; i < 3; i++)
- {
- m_tilemap[i]->set_scrollx(0, m_scrollx[i]);
- m_tilemap[i]->set_scrolly(0, m_scrolly[i]);
- }
-
- screen.priority().fill(0, cliprect);
- bitmap.fill(0, cliprect);
-
- layer[0] = 0;
- layer[1] = 1;
- layer[2] = 2;
-
-
-#ifdef MAME_DEBUG
- if (m_dislayer[layer[0]] == 0)
-#endif
- m_tilemap[layer[0]]->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 1);
-
-#ifdef MAME_DEBUG
- if (m_dislayer[layer[1]] == 0)
-#endif
- m_tilemap[layer[1]]->draw(screen, bitmap, cliprect, 0, 2);
-
-#ifdef MAME_DEBUG
- if (m_dislayer[layer[2]] == 0)
-#endif
- m_tilemap[layer[2]]->draw(screen, bitmap, cliprect, 0, 4);
-
- m_sprgen->gcpinbal_draw_sprites(screen, bitmap, cliprect, 16);
-
-#if 0
- {
-// char buf[80];
- sprintf(buf,"bg0_gfx: %04x bg1_gfx: %04x ", m_bg0_gfxset, m_bg1_gfxset);
- popmessage(buf);
- }
-#endif
-
- return 0;
-}
diff --git a/src/mame/excellent/witch.cpp b/src/mame/excellent/witch.cpp
index b053a61bcf0..31e9534b4ab 100644
--- a/src/mame/excellent/witch.cpp
+++ b/src/mame/excellent/witch.cpp
@@ -1,5 +1,6 @@
// license:BSD-3-Clause
-// copyright-holders:Tomasz Slanina
+// copyright-holders: Tomasz Slanina
+
/*
Witch / Pinball Champ '95
@@ -215,24 +216,167 @@ Interesting memory locations
TODO :
- - Figure out the ports for the "PayOut" stuff (a006/a00c?);
- - Hook up the OKI M5202;
- lagging sprites on witch (especially noticeable when game scrolls up/down)
*/
#include "emu.h"
-#include "witch.h"
+#include "cpu/z80/z80.h"
+#include "machine/i8255.h"
+#include "machine/nvram.h"
+#include "machine/ticket.h"
+#include "sound/ay8910.h"
+#include "sound/es8712.h"
+#include "sound/ymopn.h"
+
+#include "emupal.h"
+#include "screen.h"
+#include "speaker.h"
+#include "tilemap.h"
+
+
+// configurable logging
+#define LOG_INPUTS (1U << 1)
+
+//#define VERBOSE (LOG_GENERAL | LOG_INPUTS)
+
+#include "logmacro.h"
+
+#define LOGINPUTS(...) LOGMASKED(LOG_INPUTS, __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_subcpu(*this, "sub")
+ , m_ppi(*this, "ppi%u", 1U)
+ , m_gfxdecode(*this, "gfxdecode")
+ , m_palette(*this, "palette")
+ , m_hopper(*this, "hopper")
+ , m_gfx_vram(*this, "gfx%u_vram", 0U)
+ , m_gfx_cram(*this, "gfx%u_cram", 0U)
+ , m_sprite_ram(*this, "sprite_ram")
+ , m_inputs(*this, { "UNK", "INPUTS", "A005" })
+ { }
+
+protected:
+ virtual void machine_reset() override;
+
+ required_device<cpu_device> m_maincpu;
+ required_device<cpu_device> m_subcpu;
+ required_device_array<i8255_device, 2> m_ppi;
+ required_device<gfxdecode_device> m_gfxdecode;
+ required_device<palette_device> m_palette;
+ required_device<ticket_dispenser_device> m_hopper;
+
+ required_shared_ptr_array<uint8_t, 2> m_gfx_vram;
+ required_shared_ptr_array<uint8_t, 2> m_gfx_cram;
+ required_shared_ptr<uint8_t> m_sprite_ram;
+
+ required_ioport_array<3> m_inputs;
+
+ uint8_t m_scrollx = 0;
+ uint8_t m_scrolly = 0;
+ uint8_t m_reg_a002 = 0;
+ uint8_t m_motor_active = 0;
+ tilemap_t *m_gfx_tilemap[2]{};
+ bool m_has_spr_rom_bank = false;
+ uint8_t m_spr_bank = 0;
+
+ void base(machine_config &config);
+
+ template <uint8_t Which> void gfx_vram_w(offs_t offset, uint8_t data);
+ template <uint8_t Which> void gfx_cram_w(offs_t offset, uint8_t data);
+ uint8_t gfx1_vram_r(offs_t offset);
+ uint8_t gfx1_cram_r(offs_t offset);
+ uint8_t a000_r();
+ void a006_w(uint8_t data);
+ void main_a008_w(uint8_t data);
+ void sub_a008_w(uint8_t data);
+ void xscroll_w(uint8_t data);
+ void yscroll_w(uint8_t data);
+
+ void common_map(address_map &map);
+
+ TILE_GET_INFO_MEMBER(get_gfx0_tile_info);
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
+
+ void video_common_init();
+};
-TILE_GET_INFO_MEMBER(witch_state::get_gfx0_tile_info)
+class witch_state : public base_state
{
- int code = m_gfx0_vram[tile_index];
- int color = m_gfx0_cram[tile_index];
+public:
+ witch_state(const machine_config &mconfig, device_type type, const char *tag)
+ : base_state(mconfig, type, tag)
+ , m_mainbank(*this, "mainbank")
+ , m_sub_rom(*this, "sub")
+ { }
+
+ void witch(machine_config &config);
+
+protected:
+ virtual void machine_start() override;
+ virtual void video_start() override;
+
+private:
+ required_memory_bank m_mainbank;
+ required_region_ptr<uint8_t> m_sub_rom;
- code=code | ((color & 0xe0) << 3);
+ static constexpr uint16_t UNBANKED_SIZE = 0x800;
+
+ void a002_w(uint8_t data);
+ uint8_t prot_read_700x(offs_t offset);
+ TILE_GET_INFO_MEMBER(get_gfx1_tile_info);
+
+ void common_map(address_map &map);
+ void main_map(address_map &map);
+ void sub_map(address_map &map);
+};
+
+class keirinou_state : public base_state
+{
+public:
+ keirinou_state(const machine_config &mconfig, device_type type, const char *tag)
+ : base_state(mconfig, type, tag),
+ m_paletteram(*this, "paletteram")
+ { }
+
+ void keirinou(machine_config &config);
+
+protected:
+ virtual void video_start() override;
+
+private:
+ required_shared_ptr<uint8_t> m_paletteram;
+
+ uint8_t m_bg_bank = 0;
+
+ void common_map(address_map &map);
+ void main_map(address_map &map);
+ void sub_map(address_map &map);
+
+ void a002_w(uint8_t data);
+ void palette_w(offs_t offset, uint8_t data);
+ TILE_GET_INFO_MEMBER(get_gfx1_tile_info);
+};
+
+
+TILE_GET_INFO_MEMBER(base_state::get_gfx0_tile_info)
+{
+ int code = m_gfx_vram[0][tile_index];
+ int const color = m_gfx_cram[0][tile_index];
+
+ code |= ((color & 0xe0) << 3);
tileinfo.set(1,
- code, //tiles beyond 0x7ff only for sprites?
+ code, // tiles beyond 0x7ff only for sprites?
color & 0x0f,
0);
@@ -241,31 +385,31 @@ TILE_GET_INFO_MEMBER(witch_state::get_gfx0_tile_info)
TILE_GET_INFO_MEMBER(witch_state::get_gfx1_tile_info)
{
- int code = m_gfx1_vram[tile_index];
- int color = m_gfx1_cram[tile_index];
+ int const code = m_gfx_vram[1][tile_index];
+ int const color = m_gfx_cram[1][tile_index];
tileinfo.set(0,
code | ((color & 0xf0) << 4),
- (color>>0) & 0x0f,
+ (color >> 0) & 0x0f,
0);
}
-TILE_GET_INFO_MEMBER(keirinou_state::get_keirinou_gfx1_tile_info)
+TILE_GET_INFO_MEMBER(keirinou_state::get_gfx1_tile_info)
{
- int code = m_gfx1_vram[tile_index];
- int color = m_gfx1_cram[tile_index];
+ int const code = m_gfx_vram[1][tile_index];
+ int const color = m_gfx_cram[1][tile_index];
tileinfo.set(0,
code | ((color & 0xc0) << 2) | (m_bg_bank << 10),
- (color>>0) & 0xf,
+ (color >> 0) & 0xf,
0);
}
-void witch_state::video_common_init()
+void base_state::video_common_init()
{
- m_gfx0_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(witch_state::get_gfx0_tile_info)), TILEMAP_SCAN_ROWS, 8,8, 32,32);
+ m_gfx_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(base_state::get_gfx0_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
- m_gfx0_tilemap->set_transparent_pen(0);
+ m_gfx_tilemap[0]->set_transparent_pen(0);
save_item(NAME(m_scrollx));
save_item(NAME(m_scrolly));
@@ -276,144 +420,135 @@ void witch_state::video_common_init()
void witch_state::video_start()
{
video_common_init();
- m_gfx1_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(witch_state::get_gfx1_tile_info)), TILEMAP_SCAN_ROWS, 8,8, 32,32);
+ m_gfx_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(witch_state::get_gfx1_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
- m_gfx0_tilemap->set_palette_offset(0x100);
- m_gfx1_tilemap->set_palette_offset(0x200);
+ m_gfx_tilemap[0]->set_palette_offset(0x100);
+ m_gfx_tilemap[1]->set_palette_offset(0x200);
- has_spr_rom_bank = false;
+ m_has_spr_rom_bank = false;
}
void keirinou_state::video_start()
{
- //witch_state::video_start();
video_common_init();
- m_gfx1_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(keirinou_state::get_keirinou_gfx1_tile_info)), TILEMAP_SCAN_ROWS, 8,8, 32,32);
+ m_gfx_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(keirinou_state::get_gfx1_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
- m_gfx0_tilemap->set_palette_offset(0x000);
- m_gfx1_tilemap->set_palette_offset(0x100);
+ m_gfx_tilemap[0]->set_palette_offset(0x000);
+ m_gfx_tilemap[1]->set_palette_offset(0x100);
save_item(NAME(m_spr_bank));
save_item(NAME(m_bg_bank));
- has_spr_rom_bank = true;
+ m_has_spr_rom_bank = true;
}
-void witch_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
+void base_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- int i,sx,sy,tileno,flags,color;
- int flipx=0;
- int flipy=0;
- int region = has_spr_rom_bank == true ? 2 : 1;
-
- for(i=0;i<0x800;i+=0x20) {
- sx = m_sprite_ram[i+1];
- if(sx!=0xF8) {
- tileno = (m_sprite_ram[i]<<2);
- tileno+= (has_spr_rom_bank == true ? m_spr_bank : ( m_sprite_ram[i+0x800] & 0x07 )) << 10;
+ int const region = m_has_spr_rom_bank == true ? 2 : 1;
- sy = m_sprite_ram[i+2];
- flags = m_sprite_ram[i+3];
+ for (int i = 0; i < 0x800; i += 0x20)
+ {
+ int const sx = m_sprite_ram[i + 1];
+ if (sx != 0xf8)
+ {
+ int tileno = (m_sprite_ram[i] << 2);
+ tileno += (m_has_spr_rom_bank == true ? m_spr_bank : (m_sprite_ram[i + 0x800] & 0x07)) << 10;
- flipx = (flags & 0x10 ) ? 1 : 0;
- flipy = (flags & 0x20 ) ? 1 : 0;
+ int const sy = m_sprite_ram[i + 2];
+ int const flags = m_sprite_ram[i + 3];
- color = (flags & 0x0f);
+ int const flipx = BIT(flags, 4);
+ int const flipy = BIT(flags, 5);
+ int const color = (flags & 0x0f);
- m_gfxdecode->gfx(region)->transpen(bitmap,cliprect,
+ m_gfxdecode->gfx(region)->transpen(bitmap, cliprect,
tileno, color,
flipx, flipy,
- sx+8*flipx,sy+8*flipy,0);
+ sx + 8 * flipx, sy + 8 * flipy, 0);
- m_gfxdecode->gfx(region)->transpen(bitmap,cliprect,
- tileno+1, color,
+ m_gfxdecode->gfx(region)->transpen(bitmap, cliprect,
+ tileno + 1, color,
flipx, flipy,
- sx+8-8*flipx,sy+8*flipy,0);
+ sx + 8 - 8 * flipx, sy + 8 * flipy, 0);
- m_gfxdecode->gfx(region)->transpen(bitmap,cliprect,
- tileno+2, color,
+ m_gfxdecode->gfx(region)->transpen(bitmap, cliprect,
+ tileno + 2, color,
flipx, flipy,
- sx+8*flipx,sy+8-8*flipy,0);
+ sx + 8 * flipx, sy + 8 - 8 * flipy, 0);
- m_gfxdecode->gfx(region)->transpen(bitmap,cliprect,
- tileno+3, color,
+ m_gfxdecode->gfx(region)->transpen(bitmap, cliprect,
+ tileno + 3, color,
flipx, flipy,
- sx+8-8*flipx,sy+8-8*flipy,0);
+ sx + 8 - 8 * flipx, sy + 8 - 8 * flipy, 0);
}
}
}
-uint32_t witch_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+uint32_t base_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- m_gfx1_tilemap->set_scrollx(0, m_scrollx-7 ); //offset to have it aligned with the sprites
- m_gfx1_tilemap->set_scrolly(0, m_scrolly+8 );
+ m_gfx_tilemap[1]->set_scrollx(0, m_scrollx - 7); //offset to have it aligned with the sprites
+ m_gfx_tilemap[1]->set_scrolly(0, m_scrolly + 8);
- m_gfx1_tilemap->draw(screen, bitmap, cliprect, 0,0);
- m_gfx0_tilemap->draw(screen, bitmap, cliprect, 1,0);
+ m_gfx_tilemap[1]->draw(screen, bitmap, cliprect, 0, 0);
+ m_gfx_tilemap[0]->draw(screen, bitmap, cliprect, 1, 0);
draw_sprites(bitmap, cliprect);
- m_gfx0_tilemap->draw(screen, bitmap, cliprect, 0,0);
+ m_gfx_tilemap[0]->draw(screen, bitmap, cliprect, 0, 0);
return 0;
}
-void witch_state::gfx0_vram_w(offs_t offset, uint8_t data)
-{
- m_gfx0_vram[offset] = data;
- m_gfx0_tilemap->mark_tile_dirty(offset);
-}
-
-void witch_state::gfx0_cram_w(offs_t offset, uint8_t data)
-{
- m_gfx0_cram[offset] = data;
- m_gfx0_tilemap->mark_tile_dirty(offset);
-}
-
#define FIX_OFFSET() do { \
- offset=(((offset + ((m_scrolly & 0xf8) << 2) ) & 0x3e0)+((offset + (m_scrollx >> 3) ) & 0x1f)+32)&0x3ff; } while(0)
+ offset = (((offset + ((m_scrolly & 0xf8) << 2)) & 0x3e0) + ((offset + (m_scrollx >> 3)) & 0x1f) + 32) & 0x3ff; } while(0)
-void witch_state::gfx1_vram_w(offs_t offset, uint8_t data)
+template <uint8_t Which>
+void base_state::gfx_vram_w(offs_t offset, uint8_t data)
{
- FIX_OFFSET();
- m_gfx1_vram[offset] = data;
- m_gfx1_tilemap->mark_tile_dirty(offset);
+ if (Which)
+ FIX_OFFSET();
+
+ m_gfx_vram[Which][offset] = data;
+ m_gfx_tilemap[Which]->mark_tile_dirty(offset);
}
-void witch_state::gfx1_cram_w(offs_t offset, uint8_t data)
+template <uint8_t Which>
+void base_state::gfx_cram_w(offs_t offset, uint8_t data)
{
- FIX_OFFSET();
- m_gfx1_cram[offset] = data;
- m_gfx1_tilemap->mark_tile_dirty(offset);
+ if (Which)
+ FIX_OFFSET();
+
+ m_gfx_cram[Which][offset] = data;
+ m_gfx_tilemap[Which]->mark_tile_dirty(offset);
}
-uint8_t witch_state::gfx1_vram_r(offs_t offset)
+uint8_t base_state::gfx1_vram_r(offs_t offset)
{
FIX_OFFSET();
- return m_gfx1_vram[offset];
+ return m_gfx_vram[1][offset];
}
-uint8_t witch_state::gfx1_cram_r(offs_t offset)
+uint8_t base_state::gfx1_cram_r(offs_t offset)
{
FIX_OFFSET();
- return m_gfx1_cram[offset];
+ return m_gfx_cram[1][offset];
}
-uint8_t witch_state::read_a000()
+uint8_t base_state::a000_r()
{
switch (m_reg_a002 & 0x3f)
{
case 0x3b:
- return ioport("UNK")->read(); //bet10 / pay out
+ return m_inputs[0]->read(); //bet10 / pay out
case 0x3e:
- return ioport("INPUTS")->read(); //TODO : trace f564
+ return m_inputs[1]->read(); //TODO : trace f564
case 0x3d:
- return ioport("A005")->read();
+ return m_inputs[2]->read();
default:
- logerror("A000 read with mux=0x%02x\n", m_reg_a002 & 0x3f);
+ LOGINPUTS("A000 read with mux = 0x%02x\n", m_reg_a002 & 0x3f);
return 0xff;
}
}
-void witch_state::write_a002(uint8_t data)
+void witch_state::a002_w(uint8_t data)
{
//A002 bit 7&6 = m_bank ????
m_reg_a002 = data;
@@ -421,23 +556,22 @@ void witch_state::write_a002(uint8_t data)
m_mainbank->set_entry((data >> 6) & 3);
}
-void keirinou_state::write_keirinou_a002(uint8_t data)
+void keirinou_state::a002_w(uint8_t data)
{
- uint8_t new_bg_bank;
m_reg_a002 = data;
- m_spr_bank = BIT(data,7);
- new_bg_bank = BIT(data,6);
+ m_spr_bank = BIT(data, 7);
+ uint8_t new_bg_bank = BIT(data, 6);
- if(m_bg_bank != new_bg_bank)
+ if (m_bg_bank != new_bg_bank)
{
m_bg_bank = new_bg_bank;
- m_gfx1_tilemap->mark_all_dirty();
+ m_gfx_tilemap[1]->mark_all_dirty();
}
// m_mainbank->set_entry((data >> 6) & 3);
}
-void witch_state::write_a006(uint8_t data)
+void base_state::a006_w(uint8_t data)
{
// don't write when zeroed on reset
if (data == 0)
@@ -451,12 +585,12 @@ void witch_state::write_a006(uint8_t data)
machine().bookkeeping().coin_counter_w(0, !BIT(data, 6)); // coin in counter
}
-void witch_state::main_write_a008(uint8_t data)
+void base_state::main_a008_w(uint8_t data)
{
m_maincpu->set_input_line(0, CLEAR_LINE);
}
-void witch_state::sub_write_a008(uint8_t data)
+void base_state::sub_a008_w(uint8_t data)
{
m_subcpu->set_input_line(0, CLEAR_LINE);
}
@@ -464,12 +598,12 @@ void witch_state::sub_write_a008(uint8_t data)
uint8_t witch_state::prot_read_700x(offs_t offset)
{
/*
- Code @$21a looks like simple protection check.
+ Code @$21a looks like a simple protection check.
- write 7,6,0 to $700f
- - read 5 bytes from $7000-$7004 ( bit 1 of $700d is data "READY" status)
+ - read 5 bytes from $7000-$7004 (bit 1 of $700d is data "READY" status)
- Data @ $7000 must differs from data @$7001-04.
+ Data @ $7000 must differ from data @$7001-04.
Otherwise later in game some I/O (controls) reads are skipped.
*/
@@ -481,56 +615,52 @@ uint8_t witch_state::prot_read_700x(offs_t offset)
case 0x252:
case 0x258:
case 0x25e:
- return offset;//enough to pass...
+ return offset; //enough to pass...
}
- return memregion("sub")->base()[0x7000+offset];
+ return m_sub_rom[0x7000 + offset];
}
-void witch_state::xscroll_w(uint8_t data)
+void base_state::xscroll_w(uint8_t data)
{
m_scrollx = data;
// need to mark tiles dirty here, as the tilemap writes are affected by scrollx, see FIX_OFFSET macro.
// without it keirin ou can seldomly draw garbage after a big/small bonus game
// TODO: rewrite tilemap code so that it doesn't need FIX_OFFSET at all!
- m_gfx1_tilemap->mark_all_dirty();
+ m_gfx_tilemap[1]->mark_all_dirty();
}
-void witch_state::yscroll_w(uint8_t data)
+void base_state::yscroll_w(uint8_t data)
{
m_scrolly = data;
}
void keirinou_state::palette_w(offs_t offset, uint8_t data)
{
- int r,g,b;
-
m_paletteram[offset] = data;
// TODO: bit 0?
- r = ((m_paletteram[offset] & 0xe)>>1);
- g = ((m_paletteram[offset] & 0x30)>>4);
- b = ((m_paletteram[offset] & 0xc0)>>6);
+ int const r = ((m_paletteram[offset] & 0x0e) >> 1);
+ int const g = ((m_paletteram[offset] & 0x30) >> 4);
+ int const b = ((m_paletteram[offset] & 0xc0) >> 6);
m_palette->set_pen_color(offset, pal3bit(r), pal2bit(g), pal2bit(b));
// sprite palette uses an indirect table
// sprites are only used to draw cyclists, and pens 0x01-0x05 are directly tied to a specific sprite entry.
- // this probably translates in HW by selecting a specific pen for the lowest bit in GFX roms instead of the typical color entry offset.
+ // this probably translates in HW by selecting a specific pen for the lowest bit in GFX ROMs instead of the typical color entry offset.
// we do some massaging of the data here, the alternative is to use custom drawing code but that quite doesn't fit with witch
- if((offset & 0x1f0) == 0x00)
+ if ((offset & 0x1f0) == 0x00)
{
- int i;
-
- if(offset > 5)
+ if (offset > 5)
{
- for(i=0;i<0x80;i+=0x10)
- m_palette->set_pen_color(offset+0x200+i, pal3bit(r), pal2bit(g), pal2bit(b));
+ for (int i = 0; i < 0x80; i += 0x10)
+ m_palette->set_pen_color(offset + 0x200 + i, pal3bit(r), pal2bit(g), pal2bit(b));
}
else
{
- for(i=(offset & 7) * 0x10;i<((offset & 7) * 0x10)+8;i++)
- m_palette->set_pen_color(0x200+i, pal3bit(r), pal2bit(g), pal2bit(b));
+ for (int i = (offset & 7) * 0x10; i < ((offset & 7) * 0x10) + 8; i++)
+ m_palette->set_pen_color(0x200 + i, pal3bit(r), pal2bit(g), pal2bit(b));
}
}
}
@@ -541,16 +671,16 @@ void keirinou_state::palette_w(offs_t offset, uint8_t data)
*
*********************************************/
-void witch_state::common_map(address_map &map)
+void base_state::common_map(address_map &map)
{
map(0xa000, 0xa003).rw(m_ppi[0], FUNC(i8255_device::read), FUNC(i8255_device::write));
map(0xa004, 0xa007).rw(m_ppi[1], FUNC(i8255_device::read), FUNC(i8255_device::write));
map(0xa00c, 0xa00c).portr("SERVICE"); // stats / reset
map(0xa00e, 0xa00e).portr("COINS"); // coins/attendant keys
- map(0xc000, 0xc3ff).ram().w(FUNC(witch_state::gfx0_vram_w)).share("gfx0_vram");
- map(0xc400, 0xc7ff).ram().w(FUNC(witch_state::gfx0_cram_w)).share("gfx0_cram");
- map(0xc800, 0xcbff).rw(FUNC(witch_state::gfx1_vram_r), FUNC(witch_state::gfx1_vram_w)).share("gfx1_vram");
- map(0xcc00, 0xcfff).rw(FUNC(witch_state::gfx1_cram_r), FUNC(witch_state::gfx1_cram_w)).share("gfx1_cram");
+ map(0xc000, 0xc3ff).ram().w(FUNC(base_state::gfx_vram_w<0>)).share(m_gfx_vram[0]);
+ map(0xc400, 0xc7ff).ram().w(FUNC(base_state::gfx_cram_w<0>)).share(m_gfx_cram[0]);
+ map(0xc800, 0xcbff).rw(FUNC(base_state::gfx1_vram_r), FUNC(base_state::gfx_vram_w<1>)).share(m_gfx_vram[1]);
+ map(0xcc00, 0xcfff).rw(FUNC(base_state::gfx1_cram_r), FUNC(base_state::gfx_cram_w<1>)).share(m_gfx_cram[1]);
}
/************************************
@@ -559,13 +689,13 @@ void witch_state::common_map(address_map &map)
*
***********************************/
-void witch_state::witch_common_map(address_map &map)
+void witch_state::common_map(address_map &map)
{
- common_map(map);
+ base_state::common_map(map);
map(0x8000, 0x8001).rw("ym1", FUNC(ym2203_device::read), FUNC(ym2203_device::write));
map(0x8008, 0x8009).rw("ym2", FUNC(ym2203_device::read), FUNC(ym2203_device::write));
map(0x8010, 0x8016).rw("essnd", FUNC(es8712_device::read), FUNC(es8712_device::write));
- map(0xd000, 0xdfff).ram().share("sprite_ram");
+ map(0xd000, 0xdfff).ram().share(m_sprite_ram);
map(0xe000, 0xe7ff).ram().w(m_palette, FUNC(palette_device::write8)).share("palette");
map(0xe800, 0xefff).ram().w(m_palette, FUNC(palette_device::write8_ext)).share("palette_ext");
map(0xf000, 0xf0ff).ram().share("share1");
@@ -573,20 +703,21 @@ void witch_state::witch_common_map(address_map &map)
map(0xf200, 0xffff).ram().share("share2");
}
-void witch_state::witch_main_map(address_map &map)
+void witch_state::main_map(address_map &map)
{
- witch_common_map(map);
- map(0x0000, UNBANKED_SIZE-1).rom();
- map(UNBANKED_SIZE, 0x7fff).bankr("mainbank");
- map(0xa008, 0xa008).w(FUNC(witch_state::main_write_a008));
+ common_map(map);
+ map(0x0000, UNBANKED_SIZE - 1).rom();
+ map(UNBANKED_SIZE, 0x7fff).bankr(m_mainbank);
+ map(0xa008, 0xa008).w(FUNC(witch_state::main_a008_w));
}
-void witch_state::witch_sub_map(address_map &map)
+void witch_state::sub_map(address_map &map)
{
- witch_common_map(map);
+ common_map(map);
map(0x0000, 0x7fff).rom();
- map(0xa008, 0xa008).w(FUNC(witch_state::sub_write_a008));
+ map(0x7000, 0x700f).r(FUNC(witch_state::prot_read_700x));
+ map(0xa008, 0xa008).w(FUNC(witch_state::sub_a008_w));
}
/************************************
@@ -595,29 +726,29 @@ void witch_state::witch_sub_map(address_map &map)
*
***********************************/
-void keirinou_state::keirinou_common_map(address_map &map)
+void keirinou_state::common_map(address_map &map)
{
- common_map(map);
+ base_state::common_map(map);
map(0x8000, 0x8001).rw("ay1", FUNC(ay8910_device::data_r), FUNC(ay8910_device::address_data_w));
map(0x8002, 0x8003).rw("ay2", FUNC(ay8910_device::data_r), FUNC(ay8910_device::address_data_w));
- map(0xd000, 0xd7ff).ram().share("sprite_ram");
- map(0xd800, 0xd9ff).ram().w(FUNC(keirinou_state::palette_w)).share("paletteram");
+ map(0xd000, 0xd7ff).ram().share(m_sprite_ram);
+ map(0xd800, 0xd9ff).ram().w(FUNC(keirinou_state::palette_w)).share(m_paletteram);
map(0xe000, 0xe7ff).ram();
map(0xe800, 0xefff).ram().share("nvram"); // shared with sub
}
-void keirinou_state::keirinou_main_map(address_map &map)
+void keirinou_state::main_map(address_map &map)
{
- keirinou_common_map(map);
+ common_map(map);
map(0x0000, 0x7fff).rom();
- map(0xa008, 0xa008).w(FUNC(witch_state::main_write_a008));
+ map(0xa008, 0xa008).w(FUNC(keirinou_state::main_a008_w));
}
-void keirinou_state::keirinou_sub_map(address_map &map)
+void keirinou_state::sub_map(address_map &map)
{
- keirinou_common_map(map);
+ common_map(map);
map(0x0000, 0x7fff).rom();
- map(0xa008, 0xa008).w(FUNC(witch_state::sub_write_a008));
+ map(0xa008, 0xa008).w(FUNC(keirinou_state::sub_a008_w));
}
static INPUT_PORTS_START( witch )
@@ -636,12 +767,12 @@ static INPUT_PORTS_START( witch )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
- PORT_START("UNK") /* Not a DSW */
+ PORT_START("UNK") // Not a DSW
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Payout 2")
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT )
PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
- PORT_START("INPUTS") /* Inputs */
+ PORT_START("INPUTS")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Left Flipper")
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_GAMBLE_HIGH ) PORT_NAME("Big")
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_GAMBLE_LOW ) PORT_NAME("Small")
@@ -657,7 +788,7 @@ F180 kkkbbppp ; Read onPORT 0xA005
bb = MAX BET | 20 ; 30 ; 40 ; 60
kkk = KEY IN | 1-10 ; 1-20 ; 1-40 ; 1-50 ; 1-100 ; 1-200 ; 1-250 ; 1-500
*/
- PORT_START("A005") /* DSW "SW2" */
+ PORT_START("A005") // DSW "SW2"
PORT_DIPNAME( 0x07, 0x07, "Pay Out" ) PORT_DIPLOCATION("SW2:1,2,3")
PORT_DIPSETTING( 0x07, "60" )
PORT_DIPSETTING( 0x06, "65" )
@@ -686,7 +817,7 @@ F180 kkkbbppp ; Read onPORT 0xA005
d = DOUBLE UP | ON ; OFF
cccc = COIN IN1 | 1-1 ; 1-2 ; 1-3 ; 1-4 ; 1-5 ; 1-6 ; 1-7 ; 1-8 ; 1-9 ; 1-10 ; 1-15 ; 1-20 ; 1-25 ; 1-30 ; 1-40 ; 1-50
*/
- PORT_START("A004") /* DSW "SW3" Switches 2-4 not defined in manual */
+ PORT_START("A004") // DSW "SW3" Switches 2-4 not defined in manual
PORT_DIPNAME( 0x01, 0x00, "Double Up" ) PORT_DIPLOCATION("SW3:1")
PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
@@ -718,7 +849,7 @@ F180 kkkbbppp ; Read onPORT 0xA005
tt = TIME | 40 ; 45 ; 50 ; 55
s = DEMO SOUND | ON ; OFF
*/
- PORT_START("YM_PortA") /* DSW "SW4" */
+ PORT_START("YM_PortA") // DSW "SW4"
PORT_DIPNAME( 0x0f, 0x0f, "Coin In 2" ) PORT_DIPLOCATION("SW4:1,2,3,4")
PORT_DIPSETTING( 0x0f, "1-1" )
PORT_DIPSETTING( 0x0e, "1-2" )
@@ -754,7 +885,7 @@ F180 kkkbbppp ; Read onPORT 0xA005
ll = GAME LIMIT | 500 ; 1000 ; 5000 ; 990000
h = HOPPER ACTIVE | LOW ; HIGH
*/
- PORT_START("YM_PortB") /* DSW "SW5" Switches 5, 6 & 8 undefined in manual */
+ PORT_START("YM_PortB") // DSW "SW5" Switches 5, 6 & 8 undefined in manual
PORT_DIPNAME( 0x01, 0x01, "Auto Bet" ) PORT_DIPLOCATION("SW5:1")
PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
@@ -762,13 +893,13 @@ F180 kkkbbppp ; Read onPORT 0xA005
PORT_DIPSETTING( 0x06, "500" )
PORT_DIPSETTING( 0x04, "1000" )
PORT_DIPSETTING( 0x02, "5000" )
- PORT_DIPSETTING( 0x00, "990000" ) /* 10000 as defined in the Excellent System version manual */
+ PORT_DIPSETTING( 0x00, "990000" ) // 10000 as defined in the Excellent System version manual
PORT_DIPNAME( 0x08, 0x08, "Hopper Active" ) PORT_DIPLOCATION("SW5:4")
PORT_DIPSETTING( 0x08, DEF_STR(Low) )
PORT_DIPSETTING( 0x00, DEF_STR(High) )
PORT_DIPUNUSED_DIPLOC( 0x10, 0x10, "SW5:5" )
PORT_DIPUNUSED_DIPLOC( 0x20, 0x20, "SW5:6" )
- PORT_DIPNAME( 0x40, 0x00, "Unknown Use" ) PORT_DIPLOCATION("SW5:7") /* As defined in the Excellent System version manual */
+ PORT_DIPNAME( 0x40, 0x00, "Unknown Use" ) PORT_DIPLOCATION("SW5:7") // As defined in the Excellent System version manual
PORT_DIPSETTING( 0x40, "Matrix" )
PORT_DIPSETTING( 0x00, "Straight (Normal)" )
PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW5:8" )
@@ -777,7 +908,7 @@ INPUT_PORTS_END
static INPUT_PORTS_START( keirinou )
PORT_INCLUDE( witch )
- PORT_MODIFY("INPUTS") /* Inputs */
+ PORT_MODIFY("INPUTS")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("1P 1-2") PORT_CODE(KEYCODE_A)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("1P 1-3") PORT_CODE(KEYCODE_S)
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("1P 1-4") PORT_CODE(KEYCODE_D)
@@ -823,12 +954,12 @@ static INPUT_PORTS_START( keirinou )
PORT_DIPNAME( 0x07, 0x07, "Game Rate" )
PORT_DIPSETTING( 0x02, "70%" )
PORT_DIPSETTING( 0x07, "80%" )
+ PORT_DIPSETTING( 0x01, "80%" )
PORT_DIPSETTING( 0x06, "85%" )
PORT_DIPSETTING( 0x05, "90%" )
+ PORT_DIPSETTING( 0x00, "90%" )
PORT_DIPSETTING( 0x04, "95%" )
PORT_DIPSETTING( 0x03, "100%" )
-// PORT_DIPSETTING( 0x01, "80%" )
-// PORT_DIPSETTING( 0x00, "90%" )
PORT_DIPNAME( 0x08, 0x08, "Double-Up Rate" )
PORT_DIPSETTING( 0x08, "90%" )
PORT_DIPSETTING( 0x00, "100%" )
@@ -921,71 +1052,91 @@ static GFXDECODE_START( gfx_keirinou )
GFXDECODE_ENTRY( "gfx2", 0, tiles8x8_layout, 0x200, 8 )
GFXDECODE_END
-void witch_state::machine_reset()
+void witch_state::machine_start()
+{
+ m_mainbank->configure_entries(0, 4, memregion("maincpu")->base() + UNBANKED_SIZE, 0x8000);
+ m_mainbank->set_entry(0);
+}
+
+void base_state::machine_reset()
{
// Keep track of the "Hopper Active" DSW value because the program will use it
m_motor_active = (ioport("YM_PortB")->read() & 0x08) ? 0 : 1;
}
-void witch_state::witch(machine_config &config)
+void base_state::base(machine_config &config)
{
- /* basic machine hardware */
- Z80(config, m_maincpu, CPU_CLOCK); /* 3 MHz */
- m_maincpu->set_addrmap(AS_PROGRAM, &witch_state::witch_main_map);
- m_maincpu->set_vblank_int("screen", FUNC(witch_state::irq0_line_assert));
+ static constexpr XTAL MAIN_CLOCK = XTAL(12'000'000);
+ static constexpr XTAL CPU_CLOCK = MAIN_CLOCK / 4;
+
+ // basic machine hardware
+ Z80(config, m_maincpu, CPU_CLOCK); // 3 MHz
+ m_maincpu->set_vblank_int("screen", FUNC(base_state::irq0_line_assert));
- /* 2nd z80 */
- Z80(config, m_subcpu, CPU_CLOCK); /* 3 MHz */
- m_subcpu->set_addrmap(AS_PROGRAM, &witch_state::witch_sub_map);
- m_subcpu->set_vblank_int("screen", FUNC(witch_state::irq0_line_assert));
+ Z80(config, m_subcpu, CPU_CLOCK); // 3 MHz
+ m_subcpu->set_vblank_int("screen", FUNC(base_state::irq0_line_assert));
config.set_maximum_quantum(attotime::from_hz(6000));
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
- TICKET_DISPENSER(config, m_hopper, attotime::from_msec(HOPPER_PULSE), TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_HIGH);
+ TICKET_DISPENSER(config, m_hopper, attotime::from_msec(50), TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_HIGH); // time between hopper pulses in milliseconds (not right for attendant pay)
// 82C255 (actual chip on PCB) is equivalent to two 8255s
I8255(config, m_ppi[0]);
- m_ppi[0]->in_pa_callback().set(FUNC(witch_state::read_a000));
+ m_ppi[0]->in_pa_callback().set(FUNC(base_state::a000_r));
m_ppi[0]->in_pb_callback().set_ioport("UNK");
- m_ppi[0]->out_pc_callback().set(FUNC(witch_state::write_a002));
I8255(config, m_ppi[1]);
m_ppi[1]->in_pa_callback().set_ioport("A004");
m_ppi[1]->in_pb_callback().set_ioport("A005");
- m_ppi[1]->out_pc_callback().set(FUNC(witch_state::write_a006));
+ m_ppi[1]->out_pc_callback().set(FUNC(base_state::a006_w));
- /* video hardware */
+ // video hardware
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_refresh_hz(60);
screen.set_vblank_time(ATTOSECONDS_IN_USEC(0));
screen.set_size(256, 256);
screen.set_visarea(8, 256-1-8, 8*4, 256-8*4-1);
- screen.set_screen_update(FUNC(witch_state::screen_update));
+ screen.set_screen_update(FUNC(base_state::screen_update));
screen.set_palette(m_palette);
+ // sound hardware
+ SPEAKER(config, "mono").front_center();
+}
+
+void witch_state::witch(machine_config &config)
+{
+ base(config);
+
+ m_maincpu->set_addrmap(AS_PROGRAM, &witch_state::main_map);
+
+ m_subcpu->set_addrmap(AS_PROGRAM, &witch_state::sub_map);
+
+ m_ppi[0]->out_pc_callback().set(FUNC(witch_state::a002_w));
+
GFXDECODE(config, m_gfxdecode, m_palette, gfx_witch);
PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x800);
- /* sound hardware */
- SPEAKER(config, "mono").front_center();
+ static constexpr XTAL MAIN_CLOCK = XTAL(12'000'000);
+ static constexpr XTAL YM2203_CLOCK = MAIN_CLOCK / 4;
+ static constexpr XTAL MSM5202_CLOCK = 384_kHz_XTAL;
es8712_device &essnd(ES8712(config, "essnd", 0));
essnd.msm_write_handler().set("msm", FUNC(msm5205_device::data_w));
essnd.set_msm_tag("msm");
- msm5205_device &msm(MSM5205(config, "msm", MSM5202_CLOCK)); /* actually MSM5202 */
+ msm5205_device &msm(MSM5205(config, "msm", MSM5202_CLOCK)); // actually MSM5202
msm.vck_legacy_callback().set("essnd", FUNC(es8712_device::msm_int));
- msm.set_prescaler_selector(msm5205_device::S48_4B); /* 8 kHz */
+ msm.set_prescaler_selector(msm5205_device::S48_4B); // 8 kHz
msm.add_route(ALL_OUTPUTS, "mono", 1.0);
- ym2203_device &ym1(YM2203(config, "ym1", YM2203_CLOCK)); /* 3 MHz */
+ ym2203_device &ym1(YM2203(config, "ym1", YM2203_CLOCK)); // 3 MHz
ym1.port_a_read_callback().set_ioport("YM_PortA");
ym1.port_b_read_callback().set_ioport("YM_PortB");
ym1.add_route(ALL_OUTPUTS, "mono", 0.5);
- ym2203_device &ym2(YM2203(config, "ym2", YM2203_CLOCK)); /* 3 MHz */
+ ym2203_device &ym2(YM2203(config, "ym2", YM2203_CLOCK)); // 3 MHz
ym2.port_a_write_callback().set(FUNC(witch_state::xscroll_w));
ym2.port_b_write_callback().set(FUNC(witch_state::yscroll_w));
ym2.add_route(ALL_OUTPUTS, "mono", 0.5);
@@ -993,19 +1144,22 @@ void witch_state::witch(machine_config &config)
void keirinou_state::keirinou(machine_config &config)
{
- witch(config);
+ base(config);
- m_maincpu->set_addrmap(AS_PROGRAM, &keirinou_state::keirinou_main_map);
+ m_maincpu->set_addrmap(AS_PROGRAM, &keirinou_state::main_map);
- m_subcpu->set_addrmap(AS_PROGRAM, &keirinou_state::keirinou_sub_map);
+ m_subcpu->set_addrmap(AS_PROGRAM, &keirinou_state::sub_map);
- PALETTE(config.replace(), m_palette).set_entries(0x200+0x80);
- m_gfxdecode->set_info(gfx_keirinou);
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_keirinou);
+ PALETTE(config, m_palette).set_entries(0x200 + 0x80);
-// m_palette->set_format(palette_device::IIBBGGRR, 0x200+0x80);
+// m_palette->set_format(palette_device::IIBBGGRR, 0x200 + 0x80);
// Keirin Ou does have two individual PPIs (NEC D8255AC-2)
- m_ppi[0]->out_pc_callback().set(FUNC(keirinou_state::write_keirinou_a002));
+ m_ppi[0]->out_pc_callback().set(FUNC(keirinou_state::a002_w));
+
+ static constexpr XTAL MAIN_CLOCK = XTAL(12'000'000);
+ static constexpr XTAL AY8910_CLOCK = MAIN_CLOCK / 8;
ay8910_device &ay1(AY8910(config, "ay1", AY8910_CLOCK));
ay1.port_a_read_callback().set_ioport("YM_PortA");
@@ -1013,14 +1167,9 @@ void keirinou_state::keirinou(machine_config &config)
ay1.add_route(ALL_OUTPUTS, "mono", 0.5);
ay8910_device &ay2(AY8910(config, "ay2", AY8910_CLOCK));
- ay2.port_a_write_callback().set(FUNC(witch_state::xscroll_w));
- ay2.port_b_write_callback().set(FUNC(witch_state::yscroll_w));
+ ay2.port_a_write_callback().set(FUNC(keirinou_state::xscroll_w));
+ ay2.port_b_write_callback().set(FUNC(keirinou_state::yscroll_w));
ay2.add_route(ALL_OUTPUTS, "mono", 0.5);
-
- config.device_remove("essnd");
- config.device_remove("msm");
- config.device_remove("ym1");
- config.device_remove("ym2");
}
ROM_START( witch )
@@ -1040,11 +1189,11 @@ ROM_START( witch )
ROM_LOAD( "1.v10", 0x00000, 0x40000, CRC(62e42371) SHA1(5042abc2176d0c35fd6b698eca4145f93b0a3944) )
ROM_REGION( 0x100, "prom", 0 )
- ROM_LOAD( "tbp24s10n.10k", 0x000, 0x100, CRC(ee7b9d8f) SHA1(3a7b75befab83bc37e4e403ad3632841c2d37707) ) /* Currently unused, unknown use */
+ ROM_LOAD( "tbp24s10n.10k", 0x000, 0x100, CRC(ee7b9d8f) SHA1(3a7b75befab83bc37e4e403ad3632841c2d37707) ) // Currently unused, unknown use
ROM_END
-ROM_START( witchb ) /* Witch (With ranking) */
+ROM_START( witchb ) // Witch (with ranking)
ROM_REGION( 0x20000, "maincpu", 0 )
ROM_LOAD( "x.u5", 0x00000, 0x20000, CRC(d0818777) SHA1(a6232fef84bec3cfb4a6122a48e96e7b7950e013) )
@@ -1061,74 +1210,74 @@ ROM_START( witchb ) /* Witch (With ranking) */
ROM_LOAD( "1.v10", 0x00000, 0x40000, CRC(62e42371) SHA1(5042abc2176d0c35fd6b698eca4145f93b0a3944) )
ROM_REGION( 0x100, "prom", 0 )
- ROM_LOAD( "tbp24s10n.10k", 0x000, 0x100, CRC(ee7b9d8f) SHA1(3a7b75befab83bc37e4e403ad3632841c2d37707) ) /* Currently unused, unknown use */
+ ROM_LOAD( "tbp24s10n.10k", 0x000, 0x100, CRC(ee7b9d8f) SHA1(3a7b75befab83bc37e4e403ad3632841c2d37707) ) // Currently unused, unknown use
ROM_END
-ROM_START( witchs ) /* this set has (c)1992 Sega / Vic Tokai in the roms */
+ROM_START( witchs ) // this set has (c)1992 Sega / Vic Tokai in the ROMs
ROM_REGION( 0x20000, "maincpu", 0 )
ROM_LOAD( "rom.u5", 0x00000, 0x20000, CRC(348fccb8) SHA1(947defd86c4a597fbfb9327eec4903aa779b3788) )
ROM_REGION( 0x10000, "sub", 0 )
- ROM_LOAD( "6.s6", 0x00000, 0x08000, CRC(82460b82) SHA1(d85a9d77edaa67dfab8ff6ac4cb6273f0904b3c0) ) /* Same data as the Witch set */
+ ROM_LOAD( "6.s6", 0x00000, 0x08000, CRC(82460b82) SHA1(d85a9d77edaa67dfab8ff6ac4cb6273f0904b3c0) ) // Same data as the Witch set
ROM_REGION( 0x20000, "gfx1", 0 )
- ROM_LOAD( "3.u3", 0x00000, 0x20000, CRC(7007ced4) SHA1(6a0aac3ff9a4d5360c8ba1142f010add1b430ada) ) /* Same data as the Witch set */
+ ROM_LOAD( "3.u3", 0x00000, 0x20000, CRC(7007ced4) SHA1(6a0aac3ff9a4d5360c8ba1142f010add1b430ada) ) // Same data as the Witch set
ROM_REGION( 0x40000, "gfx2", 0 )
ROM_LOAD( "rom.a1", 0x00000, 0x40000, CRC(512300a5) SHA1(1e9ba58d1ddbfb8276c68f6d5c3591e6b77abf21) )
ROM_REGION( 0x40000, "essnd", 0 )
- ROM_LOAD( "1.v10", 0x00000, 0x40000, CRC(62e42371) SHA1(5042abc2176d0c35fd6b698eca4145f93b0a3944) ) /* Same data as the Witch set */
+ ROM_LOAD( "1.v10", 0x00000, 0x40000, CRC(62e42371) SHA1(5042abc2176d0c35fd6b698eca4145f93b0a3944) ) // Same data as the Witch set
ROM_REGION( 0x100, "prom", 0 )
- ROM_LOAD( "tbp24s10n.10k", 0x000, 0x100, CRC(ee7b9d8f) SHA1(3a7b75befab83bc37e4e403ad3632841c2d37707) ) /* Currently unused, unknown use */
+ ROM_LOAD( "tbp24s10n.10k", 0x000, 0x100, CRC(ee7b9d8f) SHA1(3a7b75befab83bc37e4e403ad3632841c2d37707) ) // Currently unused, unknown use
ROM_END
-ROM_START( witchstar ) /* Licensed for Korea */
+ROM_START( witchstar ) // Licensed for Korea
ROM_REGION( 0x20000, "maincpu", 0 )
ROM_LOAD( "7_excellent.u5", 0x00000, 0x20000, CRC(303c3a6d) SHA1(38983b0925d2a018b6718b3af5e95cf91b1850d6) )
ROM_REGION( 0x10000, "sub", 0 )
- ROM_LOAD( "8_excellent.s6", 0x00000, 0x08000, CRC(82460b82) SHA1(d85a9d77edaa67dfab8ff6ac4cb6273f0904b3c0) ) /* Same data as the Witch set */
+ ROM_LOAD( "8_excellent.s6", 0x00000, 0x08000, CRC(82460b82) SHA1(d85a9d77edaa67dfab8ff6ac4cb6273f0904b3c0) ) // Same data as the Witch set
ROM_REGION( 0x20000, "gfx1", 0 )
- ROM_LOAD( "6_excellent.u3", 0x00000, 0x20000, CRC(7007ced4) SHA1(6a0aac3ff9a4d5360c8ba1142f010add1b430ada) ) /* Same data as the Witch set */
+ ROM_LOAD( "6_excellent.u3", 0x00000, 0x20000, CRC(7007ced4) SHA1(6a0aac3ff9a4d5360c8ba1142f010add1b430ada) ) // Same data as the Witch set
ROM_REGION( 0x40000, "gfx2", 0 )
ROM_LOAD( "5_excellent.a1", 0x00000, 0x40000, CRC(257dc030) SHA1(ada08c3f8e93fd00d4ec7d152cdcf49c130be08e) )
ROM_REGION( 0x40000, "essnd", 0 )
- ROM_LOAD( "9_excellent.v10", 0x00000, 0x40000, CRC(62e42371) SHA1(5042abc2176d0c35fd6b698eca4145f93b0a3944) ) /* Same data as the Witch set */
+ ROM_LOAD( "9_excellent.v10", 0x00000, 0x40000, CRC(62e42371) SHA1(5042abc2176d0c35fd6b698eca4145f93b0a3944) ) // Same data as the Witch set
ROM_REGION( 0x100, "prom", 0 )
- ROM_LOAD( "tbp24s10n.10k", 0x000, 0x100, CRC(ee7b9d8f) SHA1(3a7b75befab83bc37e4e403ad3632841c2d37707) ) /* Currently unused, unknown use */
+ ROM_LOAD( "tbp24s10n.10k", 0x000, 0x100, CRC(ee7b9d8f) SHA1(3a7b75befab83bc37e4e403ad3632841c2d37707) ) // Currently unused, unknown use
ROM_END
-ROM_START( pbchmp95 ) /* Licensed for Germany? */
+ROM_START( pbchmp95 ) // Licensed for Germany?
ROM_REGION( 0x20000, "maincpu", 0 )
ROM_LOAD( "3.bin", 0x00000, 0x20000, CRC(e881aa05) SHA1(10d259396cac4b9a1b72c262c11ffa5efbdac433) )
ROM_REGION( 0x10000, "sub", 0 )
- ROM_LOAD( "4.bin", 0x00000, 0x08000, CRC(82460b82) SHA1(d85a9d77edaa67dfab8ff6ac4cb6273f0904b3c0) ) /* Same data as the Witch set */
+ ROM_LOAD( "4.bin", 0x00000, 0x08000, CRC(82460b82) SHA1(d85a9d77edaa67dfab8ff6ac4cb6273f0904b3c0) ) // Same data as the Witch set
ROM_REGION( 0x20000, "gfx1", 0 )
- ROM_LOAD( "2.bin", 0x00000, 0x20000, CRC(7007ced4) SHA1(6a0aac3ff9a4d5360c8ba1142f010add1b430ada) ) /* Same data as the Witch set */
+ ROM_LOAD( "2.bin", 0x00000, 0x20000, CRC(7007ced4) SHA1(6a0aac3ff9a4d5360c8ba1142f010add1b430ada) ) // Same data as the Witch set
ROM_REGION( 0x40000, "gfx2", 0 )
ROM_LOAD( "1.bin", 0x00000, 0x40000, CRC(f6cf7ed6) SHA1(327580a17eb2740fad974a01d97dad0a4bef9881) )
ROM_REGION( 0x40000, "essnd", 0 )
- ROM_LOAD( "5.bin", 0x00000, 0x40000, CRC(62e42371) SHA1(5042abc2176d0c35fd6b698eca4145f93b0a3944) ) /* Same data as the Witch set */
+ ROM_LOAD( "5.bin", 0x00000, 0x40000, CRC(62e42371) SHA1(5042abc2176d0c35fd6b698eca4145f93b0a3944) ) // Same data as the Witch set
ROM_REGION( 0x100, "prom", 0 )
- ROM_LOAD( "tbp24s10n.10k", 0x000, 0x100, CRC(ee7b9d8f) SHA1(3a7b75befab83bc37e4e403ad3632841c2d37707) ) /* Currently unused, unknown use */
+ ROM_LOAD( "tbp24s10n.10k", 0x000, 0x100, CRC(ee7b9d8f) SHA1(3a7b75befab83bc37e4e403ad3632841c2d37707) ) // Currently unused, unknown use
ROM_END
-ROM_START( keirinou ) /* ES8611 PCB */
+ROM_START( keirinou ) // ES8611 PCB
ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASE00 )
ROM_LOAD( "y5-03.y5", 0x000000, 0x008000, CRC(df2acc37) SHA1(9ad953843ba7859a55888fb87591cc8d322136ad) )
@@ -1148,21 +1297,16 @@ ROM_START( keirinou ) /* ES8611 PCB */
ROM_CONTINUE( 0x4000, 0x04000 )
ROM_CONTINUE( 0xc000, 0x04000 )
- ROM_REGION( 0x100, "prom", 0 ) /* Same data as the Witch set, currently unused, unknown use */
- ROM_LOAD( "n82s129an.r8", 0x000000, 0x000100, CRC(ee7b9d8f) SHA1(3a7b75befab83bc37e4e403ad3632841c2d37707) ) /* N82S129AN BPROM stamped K */
+ ROM_REGION( 0x100, "prom", 0 ) // Same data as the Witch set, currently unused, unknown use
+ ROM_LOAD( "n82s129an.r8", 0x000000, 0x000100, CRC(ee7b9d8f) SHA1(3a7b75befab83bc37e4e403ad3632841c2d37707) ) // N82S129AN BPROM stamped K
ROM_END
-void witch_state::init_witch()
-{
- m_mainbank->configure_entries(0, 4, memregion("maincpu")->base() + UNBANKED_SIZE, 0x8000);
- m_mainbank->set_entry(0);
+} // anonymous namespace
- m_subcpu->space(AS_PROGRAM).install_read_handler(0x7000, 0x700f, read8sm_delegate(*this, FUNC(witch_state::prot_read_700x)));
-}
-GAME( 1987, keirinou, 0, keirinou, keirinou, keirinou_state, empty_init, ROT0, "Excellent System", "Keirin Ou", MACHINE_SUPPORTS_SAVE )
-GAME( 1992, witch, 0, witch, witch, witch_state, init_witch, ROT0, "Vic Tokai (Excellent System license)", "Witch", MACHINE_SUPPORTS_SAVE )
-GAME( 1992, witchb, witch, witch, witch, witch_state, init_witch, ROT0, "Vic Tokai (Excellent System license)", "Witch (with ranking)", MACHINE_SUPPORTS_SAVE )
-GAME( 1992, witchs, witch, witch, witch, witch_state, init_witch, ROT0, "Vic Tokai (Sega license)", "Witch (Sega license)", MACHINE_SUPPORTS_SAVE )
-GAME( 1994, witchstar, witch, witch, witch, witch_state, init_witch, ROT0, "Fovis Korea Co. Ltd.", "Witch Star", MACHINE_SUPPORTS_SAVE )
-GAME( 1995, pbchmp95, witch, witch, witch, witch_state, init_witch, ROT0, "Veltmeijer Automaten", "Pinball Champ '95", MACHINE_SUPPORTS_SAVE )
+GAME( 1987, keirinou, 0, keirinou, keirinou, keirinou_state, empty_init, ROT0, "Excellent System", "Keirin Ou", MACHINE_SUPPORTS_SAVE )
+GAME( 1992, witch, 0, witch, witch, witch_state, empty_init, ROT0, "Vic Tokai (Excellent System license)", "Witch", MACHINE_SUPPORTS_SAVE )
+GAME( 1992, witchb, witch, witch, witch, witch_state, empty_init, ROT0, "Vic Tokai (Excellent System license)", "Witch (with ranking)", MACHINE_SUPPORTS_SAVE )
+GAME( 1992, witchs, witch, witch, witch, witch_state, empty_init, ROT0, "Vic Tokai (Sega license)", "Witch (Sega license)", MACHINE_SUPPORTS_SAVE )
+GAME( 1994, witchstar, witch, witch, witch, witch_state, empty_init, ROT0, "Fovis Korea Co. Ltd.", "Witch Star", MACHINE_SUPPORTS_SAVE )
+GAME( 1995, pbchmp95, witch, witch, witch, witch_state, empty_init, ROT0, "Veltmeijer Automaten", "Pinball Champ '95", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/excellent/witch.h b/src/mame/excellent/witch.h
deleted file mode 100644
index 91808cb2acb..00000000000
--- a/src/mame/excellent/witch.h
+++ /dev/null
@@ -1,143 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Tomasz Slanina
-/*
-
-Witch / Pinball Champ '95 / Keirin Ou
-
-*/
-
-#ifndef MAME_INCLUDES_WITCH_H
-#define MAME_INCLUDES_WITCH_H
-
-#pragma once
-
-#include "cpu/z80/z80.h"
-#include "machine/i8255.h"
-#include "machine/nvram.h"
-#include "machine/ticket.h"
-#include "sound/ay8910.h"
-#include "sound/es8712.h"
-#include "sound/ymopn.h"
-#include "emupal.h"
-#include "screen.h"
-#include "speaker.h"
-#include "tilemap.h"
-
-#define MAIN_CLOCK XTAL(12'000'000)
-#define CPU_CLOCK MAIN_CLOCK / 4
-#define YM2203_CLOCK MAIN_CLOCK / 4
-#define AY8910_CLOCK MAIN_CLOCK / 8
-#define MSM5202_CLOCK 384_kHz_XTAL
-
-#define HOPPER_PULSE 50 // time between hopper pulses in milliseconds (not right for attendant pay)
-#define UNBANKED_SIZE 0x800
-
-
-class witch_state : public driver_device
-{
-public:
- witch_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag)
- , m_maincpu(*this, "maincpu")
- , m_subcpu(*this, "sub")
- , m_ppi(*this, "ppi%u", 1U)
- , m_gfxdecode(*this, "gfxdecode")
- , m_gfx0_vram(*this, "gfx0_vram")
- , m_gfx0_cram(*this, "gfx0_cram")
- , m_gfx1_vram(*this, "gfx1_vram")
- , m_gfx1_cram(*this, "gfx1_cram")
- , m_sprite_ram(*this, "sprite_ram")
- , m_palette(*this, "palette")
- , m_hopper(*this, "hopper")
- , m_mainbank(*this, "mainbank")
- { }
-
- void witch(machine_config &config);
-
- void init_witch();
-
- void gfx0_vram_w(offs_t offset, uint8_t data);
- void gfx0_cram_w(offs_t offset, uint8_t data);
- void gfx1_vram_w(offs_t offset, uint8_t data);
- void gfx1_cram_w(offs_t offset, uint8_t data);
- uint8_t gfx1_vram_r(offs_t offset);
- uint8_t gfx1_cram_r(offs_t offset);
- uint8_t read_a000();
- void write_a002(uint8_t data);
- void write_a006(uint8_t data);
- void main_write_a008(uint8_t data);
- void sub_write_a008(uint8_t data);
- uint8_t prot_read_700x(offs_t offset);
- void xscroll_w(uint8_t data);
- void yscroll_w(uint8_t data);
-
-protected:
- void common_map(address_map &map);
-
- tilemap_t *m_gfx0_tilemap = nullptr;
- tilemap_t *m_gfx1_tilemap = nullptr;
-
- required_device<cpu_device> m_maincpu;
- required_device<cpu_device> m_subcpu;
- required_device_array<i8255_device, 2> m_ppi;
- required_device<gfxdecode_device> m_gfxdecode;
-
- required_shared_ptr<uint8_t> m_gfx0_vram;
- required_shared_ptr<uint8_t> m_gfx0_cram;
- required_shared_ptr<uint8_t> m_gfx1_vram;
- required_shared_ptr<uint8_t> m_gfx1_cram;
- required_shared_ptr<uint8_t> m_sprite_ram;
- required_device<palette_device> m_palette;
-
- required_device<ticket_dispenser_device> m_hopper;
-
- optional_memory_bank m_mainbank;
-
- int m_scrollx = 0;
- int m_scrolly = 0;
- uint8_t m_reg_a002 = 0;
- uint8_t m_motor_active = 0;
-
- TILE_GET_INFO_MEMBER(get_gfx0_tile_info);
- TILE_GET_INFO_MEMBER(get_gfx1_tile_info);
- virtual void video_start() override;
- uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
- virtual void machine_reset() override;
-
- void witch_common_map(address_map &map);
- void witch_main_map(address_map &map);
- void witch_sub_map(address_map &map);
-
- void video_common_init();
- bool has_spr_rom_bank = false;
- uint8_t m_spr_bank = 0;
-};
-
-class keirinou_state : public witch_state
-{
-public:
- keirinou_state(const machine_config &mconfig, device_type type, const char *tag)
- : witch_state(mconfig, type, tag),
- m_paletteram(*this, "paletteram")
- { }
-
- void keirinou(machine_config &config);
-
-private:
- void keirinou_common_map(address_map &map);
- void keirinou_main_map(address_map &map);
- void keirinou_sub_map(address_map &map);
-
- void write_keirinou_a002(uint8_t data);
- void palette_w(offs_t offset, uint8_t data);
- TILE_GET_INFO_MEMBER(get_keirinou_gfx1_tile_info);
-
- virtual void video_start() override;
-
- uint8_t m_bg_bank = 0;
- required_shared_ptr<uint8_t> m_paletteram;
-};
-
-
-#endif
diff --git a/src/mame/f32/crospang.cpp b/src/mame/f32/crospang.cpp
index 4ffd084f693..4cab6e71be4 100644
--- a/src/mame/f32/crospang.cpp
+++ b/src/mame/f32/crospang.cpp
@@ -15,43 +15,257 @@
No Copyright Notice is displayed for Cross Pang however http://www.f2.co.kr
at one time did list it as being by F2 System, Released April 1998
+ Video seems to be the same as the tumblepop bootleg based hardware
+ in dataeast/tumbleb.cpp
+
Cross Pang:
Audio Test isn't correct when a sound is tested, instead musics are right.
- The sample rom says 'Oksan' (Oksan made Pass, its unclear how they are
+ The sample ROM says 'Oksan' (Oksan made Pass, it's unclear how they are
related to Cross Pang)
Bestri:
- Bestri includes Heuk San Baek Sa as one of it's three sub games.
+ Bestri includes Heuk San Baek Sa as one of its three sub games.
2008-08
Added Service dipswitch and dip locations based on Service Mode.
*/
#include "emu.h"
-#include "crospang.h"
-#include "cpu/z80/z80.h"
+#include "decospr.h"
+
#include "cpu/m68000/m68000.h"
+#include "cpu/z80/z80.h"
+#include "machine/gen_latch.h"
#include "sound/okim6295.h"
#include "sound/ymopl.h"
+
#include "emupal.h"
#include "screen.h"
#include "speaker.h"
+#include "tilemap.h"
+
+
+// configurable logging
+#define LOG_TILEBANK (1U << 1)
+
+//#define VERBOSE (LOG_GENERAL | LOG_TILEBANK)
+
+#include "logmacro.h"
+
+#define LOGTILEBANK(...) LOGMASKED(LOG_TILEBANK, __VA_ARGS__)
+
+
+namespace {
+
+class crospang_state : public driver_device
+{
+public:
+ crospang_state(const machine_config &mconfig, device_type type, const char *tag)
+ : driver_device(mconfig, type, tag)
+ , m_fg_videoram(*this, "fg_videoram")
+ , m_bg_videoram(*this, "bg_videoram")
+ , m_spriteram(*this, "spriteram")
+ , m_maincpu(*this, "maincpu")
+ , m_sprgen(*this, "spritegen")
+ , m_gfxdecode(*this, "gfxdecode")
+ { }
+
+ void crospang(machine_config &config);
+ void bestri(machine_config &config);
+ void bestria(machine_config &config);
+ void pitapat(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<u16> m_fg_videoram;
+ required_shared_ptr<u16> m_bg_videoram;
+ required_shared_ptr<u16> m_spriteram;
+
+ // video-related
+ tilemap_t *m_bg_layer = nullptr;
+ tilemap_t *m_fg_layer = nullptr;
+ u8 m_tilebank[4]{};
+ u8 m_tilebankselect = 0U;
+
+ // devices
+ required_device<cpu_device> m_maincpu;
+ required_device<decospr_device> m_sprgen;
+ required_device<gfxdecode_device> m_gfxdecode;
+
+ void tilebank_data_w(u16 data);
+ void tilebank_select_w(u16 data);
+ void bestri_bg_scrolly_w(u16 data);
+ void bestri_fg_scrolly_w(u16 data);
+ void bestri_fg_scrollx_w(u16 data);
+ void bestri_bg_scrollx_w(u16 data);
+ void fg_scrolly_w(u16 data);
+ void bg_scrolly_w(u16 data);
+ void fg_scrollx_w(u16 data);
+ void bg_scrollx_w(u16 data);
+ void fg_videoram_w(offs_t offset, u16 data, u16 mem_mask = ~0);
+ void bg_videoram_w(offs_t offset, u16 data, u16 mem_mask = ~0);
+ TILE_GET_INFO_MEMBER(get_bg_tile_info);
+ TILE_GET_INFO_MEMBER(get_fg_tile_info);
+ u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ void base_map(address_map &map);
+ void bestri_map(address_map &map);
+ void bestria_map(address_map &map);
+ void crospang_map(address_map &map);
+ void pitapat_map(address_map &map);
+ void sound_io_map(address_map &map);
+ void sound_map(address_map &map);
+};
+
+
+// video
+
+void crospang_state::tilebank_select_w(u16 data)
+{
+ LOGTILEBANK("tilebank_select_w %04x\n", data);
+
+ m_tilebankselect = (data >> 8) & 3;
+}
+
+
+void crospang_state::tilebank_data_w(u16 data)
+{
+ LOGTILEBANK("tilebank_data_w %04x\n", data);
+
+ m_tilebank[m_tilebankselect] = data >> 8;
+
+ m_fg_layer->mark_all_dirty();
+ m_bg_layer->mark_all_dirty();
+}
+
+
+// Bestri performs some unusual operations on the scroll values before writing them
+void crospang_state::bestri_bg_scrolly_w(u16 data)
+{
+ // addi.w #$1f8, D0
+ // eori.w #$154, D0
+ int const scroll = (data & 0x3ff) ^ 0x0155;
+ m_bg_layer->set_scrolly(0, -scroll + 7);
+}
+
+void crospang_state::bestri_fg_scrolly_w(u16 data)
+{
+ // addi.w #$1f8, D0
+ // eori.w #$aa, D0
+ int const scroll = (data & 0x3ff) ^ 0x00ab;
+ m_fg_layer->set_scrolly(0, -scroll + 7);
+}
+
+void crospang_state::bestri_fg_scrollx_w(u16 data)
+{
+ // addi.w #$400, D1
+ // eori.w #$1e0, D1
+ int const scroll = (data & 0x3ff) ^ 0x1e1;
+ m_fg_layer->set_scrollx(0, scroll - 1);
+}
+
+void crospang_state::bestri_bg_scrollx_w(u16 data)
+{
+ // addi.w #$3fc, D1
+ // eori.w #$3c0, D1
+ int const scroll = (data & 0x3ff) ^ 0x3c1;
+ m_bg_layer->set_scrollx(0, scroll + 3);
+}
-/* main cpu */
+void crospang_state::fg_scrolly_w(u16 data)
+{
+ m_fg_layer->set_scrolly(0, data + 8);
+}
+
+void crospang_state::bg_scrolly_w(u16 data)
+{
+ m_bg_layer->set_scrolly(0, data + 8);
+}
+
+void crospang_state::fg_scrollx_w(u16 data)
+{
+ m_fg_layer->set_scrollx(0, data);
+}
+
+void crospang_state::bg_scrollx_w(u16 data)
+{
+ m_bg_layer->set_scrollx(0, data + 4);
+}
+
+
+void crospang_state::fg_videoram_w(offs_t offset, u16 data, u16 mem_mask)
+{
+ COMBINE_DATA(&m_fg_videoram[offset]);
+ m_fg_layer->mark_tile_dirty(offset);
+}
+
+void crospang_state::bg_videoram_w(offs_t offset, u16 data, u16 mem_mask)
+{
+ COMBINE_DATA(&m_bg_videoram[offset]);
+ m_bg_layer->mark_tile_dirty(offset);
+}
+
+TILE_GET_INFO_MEMBER(crospang_state::get_bg_tile_info)
+{
+ int const data = m_bg_videoram[tile_index];
+ int tile = data & 0x03ff;
+ int const tilebank = (data & 0x0c00) >> 10;
+ tile = tile + (m_tilebank[tilebank] << 10);
+ int const color = (data >> 12) & 0x0f;
+
+ tileinfo.set(1, tile, color + 0x20, 0);
+}
+
+TILE_GET_INFO_MEMBER(crospang_state::get_fg_tile_info)
+{
+ int const data = m_fg_videoram[tile_index];
+ int tile = data & 0x03ff;
+ int const tilebank = (data & 0x0c00) >> 10;
+ tile = tile + (m_tilebank[tilebank] << 10);
+ int const color = (data >> 12) & 0x0f;
+
+ tileinfo.set(1, tile, color + 0x10, 0);
+}
+
+
+void crospang_state::video_start()
+{
+ m_bg_layer = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(crospang_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
+ m_fg_layer = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(crospang_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
+
+ m_fg_layer->set_transparent_pen(0);
+}
+
+u32 crospang_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ m_bg_layer->draw(screen, bitmap, cliprect, 0, 0);
+ m_fg_layer->draw(screen, bitmap, cliprect, 0, 0);
+ m_sprgen->draw_sprites(bitmap, cliprect, m_spriteram, 0x400);
+ return 0;
+}
+
+
+// machine
+
+// main COU
void crospang_state::base_map(address_map &map)
{
- map(0x000000, 0x0fffff).rom().nopw(); // writes to rom quite often
+ map(0x000000, 0x0fffff).rom().nopw(); // writes to ROM quite often
map(0x100000, 0x100001).w(FUNC(crospang_state::tilebank_select_w));
map(0x10000e, 0x10000f).w(FUNC(crospang_state::tilebank_data_w));
- map(0x120000, 0x1207ff).ram().w(FUNC(crospang_state::fg_videoram_w)).share("fg_videoram");
- map(0x122000, 0x1227ff).ram().w(FUNC(crospang_state::bg_videoram_w)).share("bg_videoram");
+ map(0x120000, 0x1207ff).ram().w(FUNC(crospang_state::fg_videoram_w)).share(m_fg_videoram);
+ map(0x122000, 0x1227ff).ram().w(FUNC(crospang_state::bg_videoram_w)).share(m_bg_videoram);
map(0x200000, 0x2005ff).ram().w("palette", FUNC(palette_device::write16)).share("palette");
- map(0x210000, 0x2107ff).ram().share("spriteram");
- map(0x270001, 0x270001).w(m_soundlatch, FUNC(generic_latch_8_device::write));
+ map(0x210000, 0x2107ff).ram().share(m_spriteram);
+ map(0x270001, 0x270001).w("soundlatch", FUNC(generic_latch_8_device::write));
map(0x270004, 0x270007).nopw(); // ??
map(0x280000, 0x280001).portr("P1_P2");
map(0x280002, 0x280003).portr("COIN");
@@ -108,7 +322,7 @@ void crospang_state::bestria_map(address_map &map)
map(0x340000, 0x34ffff).ram();
}
-/* sound cpu */
+// sound CPU
void crospang_state::sound_map(address_map &map)
{
@@ -121,11 +335,11 @@ void crospang_state::sound_io_map(address_map &map)
map.global_mask(0xff);
map(0x00, 0x01).rw("ymsnd", FUNC(ym3812_device::read), FUNC(ym3812_device::write));
map(0x02, 0x02).rw("oki", FUNC(okim6295_device::read), FUNC(okim6295_device::write));
- map(0x06, 0x06).r(m_soundlatch, FUNC(generic_latch_8_device::read));
+ map(0x06, 0x06).r("soundlatch", FUNC(generic_latch_8_device::read));
}
-/* verified from M68000 code */
+// verified from M68000 code
static INPUT_PORTS_START( crospang )
PORT_START("P1_P2")
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(1)
@@ -157,11 +371,11 @@ static INPUT_PORTS_START( crospang )
PORT_DIPSETTING( 0x0001, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x0002, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x0003, DEF_STR( 1C_2C ) )
- PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:3,4") /* to be confirmed */
- PORT_DIPSETTING( 0x0008, DEF_STR( Easy ) ) /* table at 0x02ee2c */
- PORT_DIPSETTING( 0x000c, DEF_STR( Medium ) ) /* table at 0x02e88c */
- PORT_DIPSETTING( 0x0000, DEF_STR( Hard ) ) /* table at 0x02f96c */
- PORT_DIPSETTING( 0x0004, DEF_STR( Hardest ) ) /* table at 0x02f3cc */
+ PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:3,4") // to be confirmed
+ PORT_DIPSETTING( 0x0008, DEF_STR( Easy ) ) // table at 0x02ee2c
+ PORT_DIPSETTING( 0x000c, DEF_STR( Medium ) ) // table at 0x02e88c
+ PORT_DIPSETTING( 0x0000, DEF_STR( Hard ) ) // table at 0x02f96c
+ PORT_DIPSETTING( 0x0004, DEF_STR( Hardest ) ) // table at 0x02f3cc
PORT_DIPNAME( 0x0010, 0x0010, "Bonus Power (Points)" ) PORT_DIPLOCATION("SW1:5")
PORT_DIPSETTING( 0x0010, "5k 20k 15k+" )
PORT_DIPSETTING( 0x0000, "8k 23k 15k+" )
@@ -173,7 +387,7 @@ static INPUT_PORTS_START( crospang )
PORT_DIPSETTING( 0x0080, "2" )
PORT_DIPSETTING( 0x0040, "3" )
PORT_DIPSETTING( 0x0000, "4" )
- PORT_DIPNAME( 0x0300, 0x0300, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:1,2") /* code at 0x021672 - occurs after level 6 */
+ PORT_DIPNAME( 0x0300, 0x0300, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:1,2") // code at 0x021672 - occurs after level 6
PORT_DIPSETTING( 0x0300, "6/7" )
PORT_DIPSETTING( 0x0200, "7/8" )
PORT_DIPSETTING( 0x0100, "8/9" )
@@ -186,12 +400,12 @@ static INPUT_PORTS_START( crospang )
PORT_DIPSETTING( 0x1000, "4" )
PORT_DIPSETTING( 0x0800, "5" )
PORT_DIPSETTING( 0x0000, "6" )
- PORT_DIPUNUSED_DIPLOC( 0x2000, 0x2000, "SW2:6" ) /* stored at 0x325414.w but not read back */
+ PORT_DIPUNUSED_DIPLOC( 0x2000, 0x2000, "SW2:6" ) // stored at 0x325414.w but not read back
PORT_SERVICE_DIPLOC( 0x4000, IP_ACTIVE_LOW, "SW2:7" )
- PORT_DIPUNUSED_DIPLOC( 0x8000, 0x8000, "SW2:8" ) /* stored at 0x325418.w but not read back */
+ PORT_DIPUNUSED_DIPLOC( 0x8000, 0x8000, "SW2:8" ) // stored at 0x325418.w but not read back
INPUT_PORTS_END
-/* verified from M68000 code */
+// verified from M68000 code
static INPUT_PORTS_START( heuksun )
PORT_START("P1_P2")
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(1)
@@ -223,19 +437,19 @@ static INPUT_PORTS_START( heuksun )
PORT_DIPSETTING( 0x0001, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x0002, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x0003, DEF_STR( 1C_2C ) )
- PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:3,4") /* stored at 0x324632.w */
- PORT_DIPSETTING( 0x000c, DEF_STR( Easy ) ) /* 1 */
- PORT_DIPSETTING( 0x0008, DEF_STR( Medium ) ) /* 2 */
- PORT_DIPSETTING( 0x0004, DEF_STR( Hard ) ) /* 3 */
- PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) ) /* 4 */
- PORT_DIPNAME( 0x0010, 0x0010, "Help Penalty (Heuk Sun)" ) PORT_DIPLOCATION("SW1:5") /* code at 0x01878e and 0x0187f6 */
+ PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:3,4") // stored at 0x324632.w
+ PORT_DIPSETTING( 0x000c, DEF_STR( Easy ) ) // 1
+ PORT_DIPSETTING( 0x0008, DEF_STR( Medium ) ) // 2
+ PORT_DIPSETTING( 0x0004, DEF_STR( Hard ) ) // 3
+ PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) ) // 4
+ PORT_DIPNAME( 0x0010, 0x0010, "Help Penalty (Heuk Sun)" ) PORT_DIPLOCATION("SW1:5") // code at 0x01878e and 0x0187f6
PORT_DIPSETTING( 0x0010, "Constant" )
- PORT_DIPSETTING( 0x0000, "Variable" ) /* based on "Difficulty" Dip Switch */
- PORT_DIPUNUSED_DIPLOC( 0x0020, 0x0020, "SW1:6" ) /* read once during initialisation but not even stored */
- PORT_DIPUNKNOWN_DIPLOC( 0x0040, 0x0040, "SW1:7" ) /* stored at 0x32463a.w but not read back ? */
+ PORT_DIPSETTING( 0x0000, "Variable" ) // based on "Difficulty" Dip Switch
+ PORT_DIPUNUSED_DIPLOC( 0x0020, 0x0020, "SW1:6" ) // read once during initialisation but not even stored
+ PORT_DIPUNKNOWN_DIPLOC( 0x0040, 0x0040, "SW1:7" ) // stored at 0x32463a.w but not read back ?
PORT_SERVICE_DIPLOC( 0x0080, IP_ACTIVE_LOW, "SW1:8" )
- /* bits are tested from most to less significant - code at 0x01023e */
- PORT_DIPNAME( 0xff00, 0xff00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:1,2,3,4,5,6,7,8") /* stored at 0x324662.w but not read back ? */
+ // bits are tested from most to less significant - code at 0x01023e
+ PORT_DIPNAME( 0xff00, 0xff00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:1,2,3,4,5,6,7,8") // stored at 0x324662.w but not read back ?
PORT_DIPSETTING( 0xff00, "0" )
PORT_DIPSETTING( 0xfe00, "1" )
PORT_DIPSETTING( 0xfd00, "2" )
@@ -247,7 +461,7 @@ static INPUT_PORTS_START( heuksun )
PORT_DIPSETTING( 0x7f00, "8" )
INPUT_PORTS_END
-/* verified from M68000 code */
+// verified from M68000 code
static INPUT_PORTS_START( bestri )
PORT_START("P1_P2")
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(1)
@@ -280,20 +494,20 @@ static INPUT_PORTS_START( bestri )
PORT_DIPSETTING( 0x0004, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x0002, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x0006, DEF_STR( 1C_2C ) )
- PORT_DIPNAME( 0x0018, 0x0018, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:4,5") /* stored at 0x3a6f78.w */
- PORT_DIPSETTING( 0x0018, DEF_STR( Easy ) ) /* 1 */
- PORT_DIPSETTING( 0x0008, DEF_STR( Medium ) ) /* 2 */
- PORT_DIPSETTING( 0x0010, DEF_STR( Hard ) ) /* 3 */
- PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) ) /* 4 */
- PORT_DIPNAME( 0x0020, 0x0020, "Help Penalty (Heuk Sun)" ) PORT_DIPLOCATION("SW1:6") /* code at 0x0b7152 and 0x07b1ba */
+ PORT_DIPNAME( 0x0018, 0x0018, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:4,5") // stored at 0x3a6f78.w
+ PORT_DIPSETTING( 0x0018, DEF_STR( Easy ) ) // 1
+ PORT_DIPSETTING( 0x0008, DEF_STR( Medium ) ) // 2
+ PORT_DIPSETTING( 0x0010, DEF_STR( Hard ) ) // 3
+ PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) ) // 4
+ PORT_DIPNAME( 0x0020, 0x0020, "Help Penalty (Heuk Sun)" ) PORT_DIPLOCATION("SW1:6") // code at 0x0b7152 and 0x07b1ba
PORT_DIPSETTING( 0x0020, "Constant" )
- PORT_DIPSETTING( 0x0000, "Variable" ) /* based on "Difficulty" Dip Switch */
- PORT_DIPNAME( 0x00c0, 0x00c0, "Girls" ) PORT_DIPLOCATION("SW1:7,8") /* stored at 0x3a6faa.w */
+ PORT_DIPSETTING( 0x0000, "Variable" ) // based on "Difficulty" Dip Switch
+ PORT_DIPNAME( 0x00c0, 0x00c0, "Girls" ) PORT_DIPLOCATION("SW1:7,8") // stored at 0x3a6faa.w
PORT_DIPSETTING( 0x00c0, DEF_STR( No ) )
PORT_DIPSETTING( 0x0080, DEF_STR( Yes ) )
PORT_DIPSETTING( 0x0040, "No (duplicate 1)" )
PORT_DIPSETTING( 0x0000, "No (duplicate 2)" )
- PORT_DIPNAME( 0x0700, 0x0700, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:1,2,3") /* stored at 0x3a6fa6.w but not read back ? */
+ PORT_DIPNAME( 0x0700, 0x0700, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:1,2,3") // stored at 0x3a6fa6.w but not read back ?
PORT_DIPSETTING( 0x0700, "0" )
PORT_DIPSETTING( 0x0300, "1" )
PORT_DIPSETTING( 0x0500, "2" )
@@ -302,16 +516,16 @@ static INPUT_PORTS_START( bestri )
PORT_DIPSETTING( 0x0200, "5" )
PORT_DIPSETTING( 0x0400, "6" )
PORT_DIPSETTING( 0x0000, "7" )
- PORT_DIPNAME( 0x1800, 0x1800, "Unknown (Die Break)" ) PORT_DIPLOCATION("SW2:4,5") /* stored at 0x3a6fa8.w */
+ PORT_DIPNAME( 0x1800, 0x1800, "Unknown (Die Break)" ) PORT_DIPLOCATION("SW2:4,5") // stored at 0x3a6fa8.w
PORT_DIPSETTING( 0x1800, "0" )
PORT_DIPSETTING( 0x0800, "1" )
PORT_DIPSETTING( 0x1000, "2" )
PORT_DIPSETTING( 0x0000, "3" )
- PORT_DIPNAME( 0x2000, 0x2000, "Time (Penta)" ) PORT_DIPLOCATION("SW2:6") /* stored at 0x3a6fac.w */
+ PORT_DIPNAME( 0x2000, 0x2000, "Time (Penta)" ) PORT_DIPLOCATION("SW2:6") // stored at 0x3a6fac.w
PORT_DIPSETTING( 0x0000, "60" )
PORT_DIPSETTING( 0x2000, "90" )
- PORT_DIPUNUSED_DIPLOC( 0x4000, 0x4000, "SW2:7" ) /* read once during initialisation but not even stored */
- PORT_DIPUNUSED_DIPLOC( 0x8000, 0x8000, "SW2:8" ) /* read once during initialisation but not even stored */
+ PORT_DIPUNUSED_DIPLOC( 0x4000, 0x4000, "SW2:7" ) // read once during initialisation but not even stored
+ PORT_DIPUNUSED_DIPLOC( 0x8000, 0x8000, "SW2:8" ) // read once during initialisation but not even stored
INPUT_PORTS_END
static INPUT_PORTS_START( pitapat )
@@ -411,8 +625,8 @@ static const gfx_layout tlayout_alt =
static GFXDECODE_START( gfx_crospang )
- GFXDECODE_ENTRY( "gfx2", 0, tlayout, 0, 64 ) /* Sprites 16x16 */
- GFXDECODE_ENTRY( "gfx1", 0, tlayout_alt, 0, 64 ) /* Tiles 16x16 */
+ GFXDECODE_ENTRY( "sprites", 0, tlayout, 0, 64 ) // 16x16
+ GFXDECODE_ENTRY( "tiles", 0, tlayout_alt, 0, 64 ) // 16x16
GFXDECODE_END
void crospang_state::machine_start()
@@ -433,16 +647,16 @@ void crospang_state::machine_reset()
void crospang_state::crospang(machine_config &config)
{
- /* basic machine hardware */
- M68000(config, m_maincpu, XTAL(14'318'181)/2); /* 68000P10 @ 7.15909MHz */
+ // basic machine hardware
+ M68000(config, m_maincpu, XTAL(14'318'181) / 2); // 68000P10 @ 7.15909MHz
m_maincpu->set_addrmap(AS_PROGRAM, &crospang_state::crospang_map);
m_maincpu->set_vblank_int("screen", FUNC(crospang_state::irq6_line_hold));
- z80_device &audiocpu(Z80(config, "audiocpu", XTAL(14'318'181)/4)); /* 3.579545MHz */
+ z80_device &audiocpu(Z80(config, "audiocpu", XTAL(14'318'181) / 4)); // 3.579545MHz
audiocpu.set_addrmap(AS_PROGRAM, &crospang_state::sound_map);
audiocpu.set_addrmap(AS_IO, &crospang_state::sound_io_map);
- /* video hardware */
+ // video hardware
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_refresh_hz(60);
screen.set_vblank_time(ATTOSECONDS_IN_USEC(0));
@@ -460,16 +674,16 @@ void crospang_state::crospang(machine_config &config)
m_sprgen->set_offsets(5, 7);
m_sprgen->set_gfxdecode_tag(m_gfxdecode);
- /* sound hardware */
+ // sound hardware
SPEAKER(config, "mono").front_center();
- GENERIC_LATCH_8(config, m_soundlatch);
+ GENERIC_LATCH_8(config, "soundlatch");
- ym3812_device &ymsnd(YM3812(config, "ymsnd", XTAL(14'318'181)/4)); /* 3.579545MHz */
+ ym3812_device &ymsnd(YM3812(config, "ymsnd", XTAL(14'318'181) / 4)); // 3.579545MHz
ymsnd.irq_handler().set_inputline("audiocpu", 0);
ymsnd.add_route(ALL_OUTPUTS, "mono", 1.0);
- okim6295_device &oki(OKIM6295(config, "oki", XTAL(14'318'181)/16, okim6295_device::PIN7_HIGH)); // 1.789772MHz or 0.894886MHz?? & pin 7 not verified
+ okim6295_device &oki(OKIM6295(config, "oki", XTAL(14'318'181) / 16, okim6295_device::PIN7_HIGH)); // 1.789772MHz or 0.894886MHz?? & pin 7 not verified
oki.add_route(ALL_OUTPUTS, "mono", 1.0);
}
@@ -477,7 +691,7 @@ void crospang_state::bestri(machine_config &config)
{
crospang(config);
- /* basic machine hardware */
+ // basic machine hardware
m_maincpu->set_addrmap(AS_PROGRAM, &crospang_state::bestri_map);
}
@@ -485,7 +699,7 @@ void crospang_state::bestria(machine_config &config)
{
crospang(config);
- /* basic machine hardware */
+ // basic machine hardware
m_maincpu->set_addrmap(AS_PROGRAM, &crospang_state::bestria_map);
}
@@ -493,31 +707,28 @@ void crospang_state::pitapat(machine_config &config)
{
crospang(config);
- // can't be 14'318'181 / 2 as the inputs barely respond and the background graphics glitch badly when the screen fills, doesn't appear to be a vblank bit anywhere to negate this either, P12 reated part
+ // can't be 14'318'181 / 2 as the inputs barely respond and the background graphics glitch badly when the screen fills, doesn't appear to be a vblank bit anywhere to negate this either, P12 rated part
M68000(config.replace(), m_maincpu, XTAL(14'318'181));
m_maincpu->set_addrmap(AS_PROGRAM, &crospang_state::pitapat_map);
m_maincpu->set_vblank_int("screen", FUNC(crospang_state::irq6_line_hold));
-
- /* basic machine hardware */
- m_maincpu->set_addrmap(AS_PROGRAM, &crospang_state::pitapat_map);
}
-ROM_START( crospang ) /* Developed April 1998 */
- ROM_REGION( 0x100000, "maincpu", 0 ) /* 68k */
+ROM_START( crospang ) // Developed April 1998
+ ROM_REGION( 0x100000, "maincpu", 0 ) // 68000
ROM_LOAD16_BYTE( "p1.bin", 0x00001, 0x20000, CRC(0bcbbaad) SHA1(807f07be340d7af0aad8d49461b5a7f0221ea3b7) )
ROM_LOAD16_BYTE( "p2.bin", 0x00000, 0x20000, CRC(0947d204) SHA1(35e7e277c51888a66d305994bf05c3f6bfc3c29e) )
- ROM_REGION( 0x10000, "audiocpu", 0 ) /* z80 */
+ ROM_REGION( 0x10000, "audiocpu", 0 ) // Z80
ROM_LOAD( "s1.bin", 0x00000, 0x10000, CRC(d61a224c) SHA1(5cd1b2d136ad58ab550c7ba135558d6c8a4cd8f6) )
- ROM_REGION( 0x40000, "oki", 0 ) /* samples */
- ROM_LOAD( "s2.bin", 0x00000, 0x20000, CRC(9f9ecd22) SHA1(631ffe14018ba39658c435b8ecb23b19a14569ee) ) // sample rom contains oksan
+ ROM_REGION( 0x40000, "oki", 0 ) // samples
+ ROM_LOAD( "s2.bin", 0x00000, 0x20000, CRC(9f9ecd22) SHA1(631ffe14018ba39658c435b8ecb23b19a14569ee) ) // sample ROM contains oksan
- ROM_REGION( 0x80000, "gfx1", 0 ) /* bg tiles */
+ ROM_REGION( 0x80000, "tiles", 0 )
ROM_LOAD16_BYTE( "rom1.bin", 0x00000, 0x40000, CRC(905042bb) SHA1(ed5b97e88d24e55f8fcfaaa34251582976cb2527) )
ROM_LOAD16_BYTE( "rom2.bin", 0x00001, 0x40000, CRC(bc4381e9) SHA1(af0690c253bead3448db5ec8fb258d8284646e89) )
- ROM_REGION( 0x200000, "gfx2", 0 ) /* sprites */
+ ROM_REGION( 0x200000, "sprites", 0 )
ROM_LOAD16_BYTE( "rom3.bin", 0x000000, 0x80000, CRC(cc6e1fce) SHA1(eb5b3ca7222f48916dc6206f987b2669fe7e7c6b) )
ROM_LOAD16_BYTE( "rom4.bin", 0x000001, 0x80000, CRC(9a91d494) SHA1(1c6280f662f1cf53f7f6defb7e215da75b573fdf) )
ROM_LOAD16_BYTE( "rom5.bin", 0x100000, 0x80000, CRC(53a34dc5) SHA1(2e5cf8093bf507e81d7447736b7727c3fd20c471) )
@@ -551,17 +762,17 @@ OKI M6295
*/
ROM_START( heuksun )
- ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 Code */
+ ROM_REGION( 0x100000, "maincpu", 0 ) // 68000
ROM_LOAD16_BYTE( "ua02.j3", 0x00001, 0x80000, CRC(db2b9c8e) SHA1(aa37e3a056957a12888e2e3112fe78a6bff7d76f) )
ROM_LOAD16_BYTE( "ua03.j5", 0x00000, 0x80000, CRC(de9f01e8) SHA1(3ee9206e7c3c7bebd7cde6f201c2fa7f9f6553b7) )
- ROM_REGION( 0x040000, "audiocpu", 0 ) /* Z80 */
+ ROM_REGION( 0x040000, "audiocpu", 0 ) // Z80
ROM_LOAD( "us02.r4", 0x00000, 0x10000, CRC(c7cc05fa) SHA1(5fbf479be98f618c63e4c74a250d51279c2f5e3b) )
- ROM_REGION( 0x040000, "oki", 0 ) /* Samples */
+ ROM_REGION( 0x040000, "oki", 0 ) // samples
ROM_LOAD( "us08.u7", 0x00000, 0x40000, CRC(ae177589) SHA1(9a1e2b848046f3506ede4f218a9175cc8e984ad8) )
- ROM_REGION( 0x200000, "gfx1", 0 ) // tiles
+ ROM_REGION( 0x200000, "tiles", 0 )
ROM_LOAD16_BYTE( "uc08.r11", 0x00001, 0x20000, CRC(242cee69) SHA1(71112ea6aac4db9b923315656f12d2f72173d9cd) )
ROM_CONTINUE ( 0x100001,0x20000)
ROM_CONTINUE ( 0x040001,0x20000)
@@ -571,7 +782,7 @@ ROM_START( heuksun )
ROM_CONTINUE ( 0x040000,0x20000)
ROM_CONTINUE ( 0x140000,0x20000)
- ROM_REGION( 0x100000, "gfx2", 0 ) // sprites
+ ROM_REGION( 0x100000, "sprites", 0 )
ROM_LOAD16_BYTE( "ud14.p11", 0x00000, 0x40000, CRC(4fc2b574) SHA1(f3330d9cc3065b5a96e222300c2ae01e57241632) )
ROM_LOAD16_BYTE( "ud15.m11", 0x00001, 0x40000, CRC(1d6187a6) SHA1(51f1ac086d67e8b35081ddc14e28b218d3153779) )
ROM_LOAD16_BYTE( "ud16.l11", 0x80000, 0x40000, CRC(eabec43e) SHA1(fa0a7886ccaf90e9ed59dc283e27f9e8e9aa7d29) )
@@ -609,7 +820,7 @@ OKI M6295
ua02.i3 (Odd)
ua03.i5 (even)
-Numbers/letters to right of rom name denotes
+Numbers/letters to right of ROM name denotes
numbers/letters silkscreened under socket
uc07.p12 0
@@ -623,18 +834,18 @@ ud17.e12 D
*/
-ROM_START( bestri ) /* Developed March 1998 */
- ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 Code */
+ROM_START( bestri ) // Developed March 1998
+ ROM_REGION( 0x100000, "maincpu", 0 ) // 68000
ROM_LOAD16_BYTE( "ua02.i3", 0x00001, 0x80000, CRC(9e94023d) SHA1(61a07eb835d324cb4fe7e3d366dd3907838b2554) )
ROM_LOAD16_BYTE( "ua03.i5", 0x00000, 0x80000, CRC(08cfa8d8) SHA1(684729887bf2dd2fe22e5bd2e32073169d426e02) )
- ROM_REGION( 0x040000, "audiocpu", 0 ) /* Z80 */
- ROM_LOAD( "us02.p3", 0x00000, 0x10000, CRC(c7cc05fa) SHA1(5fbf479be98f618c63e4c74a250d51279c2f5e3b) ) // same as huek
+ ROM_REGION( 0x040000, "audiocpu", 0 ) // Z80
+ ROM_LOAD( "us02.p3", 0x00000, 0x10000, CRC(c7cc05fa) SHA1(5fbf479be98f618c63e4c74a250d51279c2f5e3b) ) // same as heuksun
- ROM_REGION( 0x040000, "oki", 0 ) /* Samples */
+ ROM_REGION( 0x040000, "oki", 0 ) // samples
ROM_LOAD( "us08.q7", 0x00000, 0x40000, CRC(85d8f3de) SHA1(af55678bbe2c187cfee063c6f74cdd568307a7a2) )
- ROM_REGION( 0x200000, "gfx1", 0 ) // tiles
+ ROM_REGION( 0x200000, "tiles", 0 )
ROM_LOAD16_BYTE( "uc08.m12", 0x00001, 0x20000, CRC(2fc0c30e) SHA1(0c50efd20340f10961e872b3cd63c36aefed26f0) )
ROM_CONTINUE ( 0x100001,0x20000)
@@ -653,25 +864,25 @@ ROM_START( bestri ) /* Developed March 1998 */
ROM_CONTINUE ( 0x0c0000,0x20000)
ROM_CONTINUE ( 0x1c0000,0x20000)
- ROM_REGION( 0x200000, "gfx2", 0 ) // sprites
+ ROM_REGION( 0x200000, "sprites", 0 )
ROM_LOAD16_BYTE( "ud14.j12", 0x000000, 0x80000, CRC(141c696e) SHA1(3d35a20f7c12a8d8a9f6d351f06fb9df0c673354) )
ROM_LOAD16_BYTE( "ud15.h12", 0x000001, 0x80000, CRC(7c04adc0) SHA1(9883565d6556ce8ae3da6c91cbf04894e87e6923) )
ROM_LOAD16_BYTE( "ud16.g12", 0x100000, 0x80000, CRC(3282ea76) SHA1(cc21cac35f47ba299823c2cfe6b4946f8483b821) )
ROM_LOAD16_BYTE( "ud17.e12", 0x100001, 0x80000, CRC(3a3a3f1a) SHA1(48843140cd63c9387e09b84bd41b13dba35f48ad) )
ROM_END
-ROM_START( bestria ) /* Developed March 1998 */
- ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 Code */
+ROM_START( bestria ) // Developed March 1998
+ ROM_REGION( 0x100000, "maincpu", 0 ) // 68000
ROM_LOAD16_BYTE( "o_ua02.i3", 0x00001, 0x80000, CRC(035c86f6) SHA1(d501553ed7fdb462c9c26fff6473cefe71424e26) )
ROM_LOAD16_BYTE( "e_ua03.i5", 0x00000, 0x80000, CRC(7c53d9f8) SHA1(92dc92471497292d3ba90f3f2fb35f7b4fba240c) )
- ROM_REGION( 0x040000, "audiocpu", 0 ) /* Z80 */
- ROM_LOAD( "us02.p3", 0x00000, 0x10000, CRC(c7cc05fa) SHA1(5fbf479be98f618c63e4c74a250d51279c2f5e3b)) // same as huek
+ ROM_REGION( 0x040000, "audiocpu", 0 ) // Z80
+ ROM_LOAD( "us02.p3", 0x00000, 0x10000, CRC(c7cc05fa) SHA1(5fbf479be98f618c63e4c74a250d51279c2f5e3b)) // same as heuksun
- ROM_REGION( 0x040000, "oki", 0 ) /* Samples */
+ ROM_REGION( 0x040000, "oki", 0 ) // samples
ROM_LOAD( "us08.q7", 0x00000, 0x40000, CRC(85d8f3de) SHA1(af55678bbe2c187cfee063c6f74cdd568307a7a2) )
- ROM_REGION( 0x200000, "gfx1", 0 ) // tiles
+ ROM_REGION( 0x200000, "tiles", 0 )
ROM_LOAD16_BYTE( "2_uc08.m12", 0x00001, 0x20000, CRC(23778472) SHA1(00f54aefe52f2f76ab2f2628bf2e860d468e4a02) )
ROM_CONTINUE ( 0x100001,0x20000)
@@ -690,7 +901,7 @@ ROM_START( bestria ) /* Developed March 1998 */
ROM_CONTINUE ( 0x0c0000,0x20000)
ROM_CONTINUE ( 0x1c0000,0x20000)
- ROM_REGION( 0x200000, "gfx2", 0 ) // sprites
+ ROM_REGION( 0x200000, "sprites", 0 )
ROM_LOAD16_BYTE( "a_ud14.j12", 0x000000, 0x80000, CRC(3502f71b) SHA1(ec012c414ace560ab67d60ce407bd67a4640c217) )
ROM_LOAD16_BYTE( "b_ud15.h12", 0x000001, 0x80000, CRC(2636b837) SHA1(692987bd8ace452ee40a253437f1e3672f737f98) )
ROM_LOAD16_BYTE( "c_ud16.g12", 0x100000, 0x80000, CRC(68b0ff81) SHA1(969579c2a29b577b9077e70a03c0ec92997ddcc0) )
@@ -725,17 +936,17 @@ Sound CPU: NEC D780C
*/
ROM_START( pitapat )
- ROM_REGION( 0x100000, "maincpu", 0 ) /* 68k */
+ ROM_REGION( 0x100000, "maincpu", 0 ) // 68000
ROM_LOAD16_BYTE( "ua02", 0x00001, 0x40000, CRC(b3d3ac7e) SHA1(7ff894cb6bcb724834de95bdefdb6a6c0ae1d39b) )
ROM_LOAD16_BYTE( "ua03", 0x00000, 0x40000, CRC(eda85635) SHA1(b6723f5c196c4a531e411fc0d1f2632f514050ac) )
- ROM_REGION( 0x10000, "audiocpu", 0 ) /* z80 */
+ ROM_REGION( 0x10000, "audiocpu", 0 ) // Z80
ROM_LOAD( "us02", 0x00000, 0x10000, CRC(c7cc05fa) SHA1(5fbf479be98f618c63e4c74a250d51279c2f5e3b) )
- ROM_REGION( 0x40000, "oki", 0 ) /* samples */
- ROM_LOAD( "us08", 0x00000, 0x40000, CRC(dab99a43) SHA1(32d329f9423ec91eb83ea42ee04de70d92568328) ) // sample rom contains oksan?
+ ROM_REGION( 0x40000, "oki", 0 ) // samples
+ ROM_LOAD( "us08", 0x00000, 0x40000, CRC(dab99a43) SHA1(32d329f9423ec91eb83ea42ee04de70d92568328) ) // sample ROM contains oksan?
- ROM_REGION( 0x200000, "gfx1", 0 ) /* bg tiles */
+ ROM_REGION( 0x200000, "tiles", 0 )
ROM_LOAD16_BYTE( "uc08", 0x00001, 0x20000, CRC(3f827218) SHA1(38a3f427fad1850776a21a6486251fe33d7af498) )
ROM_CONTINUE ( 0x100001,0x20000)
ROM_CONTINUE ( 0x040001,0x20000)
@@ -745,16 +956,18 @@ ROM_START( pitapat )
ROM_CONTINUE ( 0x040000,0x20000)
ROM_CONTINUE ( 0x140000,0x20000)
- ROM_REGION( 0x100000, "gfx2", 0 ) /* sprites */
+ ROM_REGION( 0x100000, "sprites", 0 )
ROM_LOAD16_BYTE( "ud14", 0x000000, 0x40000, CRC(92e23e92) SHA1(4e1b85cef2a55a54ca571bf948809715dd789f30) )
ROM_LOAD16_BYTE( "ud15", 0x000001, 0x40000, CRC(7d3d6dba) SHA1(d543613fa22407bc8570e9e388c35620850ecd15) )
ROM_LOAD16_BYTE( "ud16", 0x080000, 0x40000, CRC(5c09dff8) SHA1(412260784e45c6d742e02a285e3adc7361034268) )
ROM_LOAD16_BYTE( "ud17", 0x080001, 0x40000, CRC(d4c67e2e) SHA1(e684b58333d64f5961983b42f56c61bb0bea2e5c) )
ROM_END
+} // anonymous namespace
+
-GAME( 1998, crospang, 0, crospang, crospang, crospang_state, empty_init, ROT0, "F2 System", "Cross Pang", MACHINE_SUPPORTS_SAVE )
+GAME( 1998, crospang, 0, crospang, crospang, crospang_state, empty_init, ROT0, "F2 System", "Cross Pang", MACHINE_SUPPORTS_SAVE )
GAME( 1997, heuksun, 0, crospang, heuksun, crospang_state, empty_init, ROT0, "Oksan / F2 System", "Heuk Sun Baek Sa (Korea)", MACHINE_SUPPORTS_SAVE )
-GAME( 1998, bestri, 0, bestri, bestri, crospang_state, empty_init, ROT0, "F2 System", "Bestri (Korea, set 1)", MACHINE_SUPPORTS_SAVE )
-GAME( 1998, bestria, bestri, bestria, bestri, crospang_state, empty_init, ROT0, "F2 System", "Bestri (Korea, set 2)", MACHINE_SUPPORTS_SAVE )
-GAME( 1997, pitapat, 0, pitapat, pitapat, crospang_state, empty_init, ROT0, "F2 System", "Pitapat Puzzle", MACHINE_SUPPORTS_SAVE ) // Test Mode calls it 'Puzzle Ball'
+GAME( 1998, bestri, 0, bestri, bestri, crospang_state, empty_init, ROT0, "F2 System", "Bestri (Korea, set 1)", MACHINE_SUPPORTS_SAVE )
+GAME( 1998, bestria, bestri, bestria, bestri, crospang_state, empty_init, ROT0, "F2 System", "Bestri (Korea, set 2)", MACHINE_SUPPORTS_SAVE )
+GAME( 1997, pitapat, 0, pitapat, pitapat, crospang_state, empty_init, ROT0, "F2 System", "Pitapat Puzzle", MACHINE_SUPPORTS_SAVE ) // Test Mode calls it 'Puzzle Ball'
diff --git a/src/mame/f32/crospang.h b/src/mame/f32/crospang.h
deleted file mode 100644
index 4f57a59e68e..00000000000
--- a/src/mame/f32/crospang.h
+++ /dev/null
@@ -1,85 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Pierpaolo Prazzoli, David Haywood
-/*************************************************************************
-
- Cross Pang
-
-*************************************************************************/
-#ifndef MAME_INCLUDES_CROSPANG_H
-#define MAME_INCLUDES_CROSPANG_H
-
-#pragma once
-
-#include "decospr.h"
-
-#include "machine/gen_latch.h"
-
-#include "tilemap.h"
-
-class crospang_state : public driver_device
-{
-public:
- crospang_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag)
- , m_fg_videoram(*this, "fg_videoram")
- , m_bg_videoram(*this, "bg_videoram")
- , m_spriteram(*this, "spriteram")
- , m_maincpu(*this, "maincpu")
- , m_sprgen(*this, "spritegen")
- , m_gfxdecode(*this, "gfxdecode")
- , m_soundlatch(*this, "soundlatch")
- { }
-
- void crospang(machine_config &config);
- void bestri(machine_config &config);
- void bestria(machine_config &config);
- void pitapat(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<u16> m_fg_videoram;
- required_shared_ptr<u16> m_bg_videoram;
- required_shared_ptr<u16> m_spriteram;
-
- /* video-related */
- tilemap_t *m_bg_layer = nullptr;
- tilemap_t *m_fg_layer = nullptr;
- u8 m_tilebank[4]{};
- u8 m_tilebankselect = 0U;
-
- /* devices */
- required_device<cpu_device> m_maincpu;
- required_device<decospr_device> m_sprgen;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<generic_latch_8_device> m_soundlatch;
-
- void tilebank_data_w(u16 data);
- void tilebank_select_w(u16 data);
- void bestri_bg_scrolly_w(u16 data);
- void bestri_fg_scrolly_w(u16 data);
- void bestri_fg_scrollx_w(u16 data);
- void bestri_bg_scrollx_w(u16 data);
- void fg_scrolly_w(u16 data);
- void bg_scrolly_w(u16 data);
- void fg_scrollx_w(u16 data);
- void bg_scrollx_w(u16 data);
- void fg_videoram_w(offs_t offset, u16 data, u16 mem_mask = ~0);
- void bg_videoram_w(offs_t offset, u16 data, u16 mem_mask = ~0);
- TILE_GET_INFO_MEMBER(get_bg_tile_info);
- TILE_GET_INFO_MEMBER(get_fg_tile_info);
- u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- void base_map(address_map &map);
- void bestri_map(address_map &map);
- void bestria_map(address_map &map);
- void crospang_map(address_map &map);
- void pitapat_map(address_map &map);
- void sound_io_map(address_map &map);
- void sound_map(address_map &map);
-};
-
-#endif // MAME_INCLUDES_CROSPANG_H
diff --git a/src/mame/f32/crospang_v.cpp b/src/mame/f32/crospang_v.cpp
deleted file mode 100644
index 86c08a7e62c..00000000000
--- a/src/mame/f32/crospang_v.cpp
+++ /dev/null
@@ -1,141 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Pierpaolo Prazzoli, David Haywood
-/*
-
- Cross Pang
- video hardware emulation
-
- -- this seems to be the same as the tumblepop bootleg based hardware
- in tumbleb.cpp
-
-
-*/
-
-#include "emu.h"
-#include "crospang.h"
-
-
-void crospang_state::tilebank_select_w(u16 data)
-{
- logerror("tilebank_select_w %04x\n", data);
-
- m_tilebankselect = (data >> 8) & 3;
-}
-
-
-void crospang_state::tilebank_data_w(u16 data)
-{
- logerror("tilebank_data_w %04x\n", data);
-
- m_tilebank[m_tilebankselect] = data >> 8;
-
- m_fg_layer->mark_all_dirty();
- m_bg_layer->mark_all_dirty();
-}
-
-
-// Bestri performs some unusual operations on the scroll values before writing them
-void crospang_state::bestri_bg_scrolly_w(u16 data)
-{
- // addi.w #$1f8, D0
- // eori.w #$154, D0
- int scroll = (data & 0x3ff) ^ 0x0155;
- m_bg_layer->set_scrolly(0, -scroll + 7);
-}
-
-void crospang_state::bestri_fg_scrolly_w(u16 data)
-{
- // addi.w #$1f8, D0
- // eori.w #$aa, D0
- int scroll = (data & 0x3ff) ^ 0x00ab;
- m_fg_layer->set_scrolly(0, -scroll + 7);
-}
-
-void crospang_state::bestri_fg_scrollx_w(u16 data)
-{
- // addi.w #$400, D1
- // eori.w #$1e0, D1
- int scroll = (data & 0x3ff) ^ 0x1e1;
- m_fg_layer->set_scrollx(0, scroll - 1);
-}
-
-void crospang_state::bestri_bg_scrollx_w(u16 data)
-{
- // addi.w #$3fc, D1
- // eori.w #$3c0, D1
- int scroll = (data & 0x3ff) ^ 0x3c1;
- m_bg_layer->set_scrollx(0, scroll + 3);
-}
-
-
-void crospang_state::fg_scrolly_w(u16 data)
-{
- m_fg_layer->set_scrolly(0, data + 8);
-}
-
-void crospang_state::bg_scrolly_w(u16 data)
-{
- m_bg_layer->set_scrolly(0, data + 8);
-}
-
-void crospang_state::fg_scrollx_w(u16 data)
-{
- m_fg_layer->set_scrollx(0, data);
-}
-
-void crospang_state::bg_scrollx_w(u16 data)
-{
- m_bg_layer->set_scrollx(0, data + 4);
-}
-
-
-void crospang_state::fg_videoram_w(offs_t offset, u16 data, u16 mem_mask)
-{
- COMBINE_DATA(&m_fg_videoram[offset]);
- m_fg_layer->mark_tile_dirty(offset);
-}
-
-void crospang_state::bg_videoram_w(offs_t offset, u16 data, u16 mem_mask)
-{
- COMBINE_DATA(&m_bg_videoram[offset]);
- m_bg_layer->mark_tile_dirty(offset);
-}
-
-TILE_GET_INFO_MEMBER(crospang_state::get_bg_tile_info)
-{
- int data = m_bg_videoram[tile_index];
- int tile = data & 0x03ff;
- int tilebank = (data & 0x0c00) >> 10;
- tile = tile + (m_tilebank[tilebank] << 10);
- int color = (data >> 12) & 0x0f;
-
- tileinfo.set(1, tile, color + 0x20, 0);
-}
-
-TILE_GET_INFO_MEMBER(crospang_state::get_fg_tile_info)
-{
- int data = m_fg_videoram[tile_index];
- int tile = data & 0x03ff;
- int tilebank = (data & 0x0c00) >> 10;
- tile = tile + (m_tilebank[tilebank] << 10);
- int color = (data >> 12) & 0x0f;
-
- tileinfo.set(1, tile, color + 0x10, 0);
-}
-
-
-void crospang_state::video_start()
-{
- m_bg_layer = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(crospang_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
- m_fg_layer = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(crospang_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
-
- m_fg_layer->set_transparent_pen(0);
-}
-
-u32 crospang_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
- m_bg_layer->draw(screen, bitmap, cliprect, 0, 0);
- m_fg_layer->draw(screen, bitmap, cliprect, 0, 0);
- m_sprgen->draw_sprites(bitmap, cliprect, m_spriteram, 0x400);
- return 0;
-}