summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatarGravatar Ivan Vangelista <mesgnet@yahoo.it>2019-05-09 17:50:39 +0200
committerGravatarGravatar Ivan Vangelista <mesgnet@yahoo.it>2019-05-09 17:50:39 +0200
commit98ab5a40fbd7f4c61add542143ea19f48d34c115 (patch) (github)
tree435f8ce9df4179e6f691f1c32a062f1525e0cbaa
parentbf2eb55b19c215e972a6c4aa30faee4120022fe9 (diff)
downloadmame-98ab5a40fbd7f4c61add542143ea19f48d34c115.tar.bz2
mame-98ab5a40fbd7f4c61add542143ea19f48d34c115.zip
homedata.cpp: ioport array for the mahjong keys, added 2nd player inputs for newer mahjong games, identified some dips for mjikaga, added dip locations according to test mode (nw)
-rw-r--r--src/mame/drivers/homedata.cpp126
-rw-r--r--src/mame/includes/homedata.h5
2 files changed, 92 insertions, 39 deletions
diff --git a/src/mame/drivers/homedata.cpp b/src/mame/drivers/homedata.cpp
index e8ff6e2ff67..1f4c4a9020e 100644
--- a/src/mame/drivers/homedata.cpp
+++ b/src/mame/drivers/homedata.cpp
@@ -15,7 +15,7 @@ driver by Phil Stroffolino and Nicola Salmoria
*1988 M81 Mahjong Rokumeikan
*1988 J82 Reikai Doushi / Chinese Exorcist
*1989 X83 Mahjong Kojin Kyouju (Private Teacher)
- 1989 Battle Cry (not released in Japan)
+ 1989 S88 Battle Cry (not released in Japan)
*1989 X90 Mahjong Vitamin C
*1989 X91 Mahjong Yougo no Kiso Tairyoku
*1990 X02 Mahjong Lemon Angel
@@ -63,8 +63,7 @@ TODO:
- Dip switches! They might be right for mjhokite, but I haven't verified the other
games.
-- I'm not sure service mode in the newer mahjong games is working as it's supposed to.
- dip switch changes are not reported, and keypresses only work after you insert a coin.
+- In the newer mahjong games, the second bank of dips is read in reverse order.
- In mjikaga bit 2 of bankswitch_w() and bit 7 of pteacher_blitter_bank_w() might
have some other function, since the ROMs are smaller.
@@ -262,7 +261,6 @@ INTERRUPT_GEN_MEMBER(homedata_state::homedata_irq)
READ8_MEMBER(homedata_state::mrokumei_keyboard_r)
{
int res = 0x3f,i;
- static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4" };
/* offset 0 is player 1, offset 1 player 2 (not supported) */
if (offset == 0)
@@ -271,7 +269,7 @@ READ8_MEMBER(homedata_state::mrokumei_keyboard_r)
{
if (m_keyb & (1 << i))
{
- res = ioport(keynames[i])->read() & 0x3f;
+ res = m_keys[i]->read() & 0x3f;
break;
}
}
@@ -405,7 +403,6 @@ READ8_MEMBER(homedata_state::pteacher_io_r)
READ8_MEMBER(homedata_state::pteacher_keyboard_r)
{
- static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", "KEY5" };
int dips = ioport("DSW")->read();
// logerror("%s: keyboard_r with port A = %02x\n",machine().describe_context(),upd7807_porta);
@@ -414,13 +411,13 @@ READ8_MEMBER(homedata_state::pteacher_keyboard_r)
{
/* player 1 + dip switches */
int row = (m_upd7807_porta & 0x07);
- return ioport(keynames[row])->read() | (((dips >> row) & 1) << 5); // 0-5
+ return m_keys[row]->read() | (((dips >> row) & 1) << 5); // 0-5
}
if (m_upd7807_porta & 0x08) // TODO: this works fine with dips 7-8 of the 1st bank, but then expects dips 1-4 of the 2nd bank in inverted order
{
- /* player 2 (not supported) + dip switches */
- int row = ((m_upd7807_porta >> 4) & 0x07);
- return 0xdf | (((dips >> (row + 6)) & 1) << 5); // 6-11
+ /* player 2 + dip switches */
+ int row = ((m_upd7807_porta >> 4) & 0x07) + 6;
+ return m_keys[row]->read() | (((dips >> row) & 1) << 5); // 6-11
}
return 0xff;
@@ -895,6 +892,60 @@ static INPUT_PORTS_START( mj_keyboard )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_CUSTOM ) /* dip switch (handled separately) */
PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
+
+ PORT_START("KEY6")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A ) PORT_PLAYER(2)
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_B ) PORT_PLAYER(2)
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_C ) PORT_PLAYER(2)
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_D ) PORT_PLAYER(2)
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_CUSTOM ) /* dip switch (handled separately) */
+ PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
+
+ PORT_START("KEY7")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_E ) PORT_PLAYER(2)
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F ) PORT_PLAYER(2)
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_G ) PORT_PLAYER(2)
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_H ) PORT_PLAYER(2)
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_CUSTOM ) /* dip switch (handled separately) */
+ PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
+
+ PORT_START("KEY8")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_I ) PORT_PLAYER(2)
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_J ) PORT_PLAYER(2)
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K ) PORT_PLAYER(2)
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_L ) PORT_PLAYER(2)
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_CUSTOM ) /* dip switch (handled separately) */
+ PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
+
+ PORT_START("KEY9")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_M ) PORT_PLAYER(2)
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_N ) PORT_PLAYER(2)
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_CHI ) PORT_PLAYER(2)
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_PON ) PORT_PLAYER(2)
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_FLIP_FLOP ) PORT_PLAYER(2)
+ PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_CUSTOM ) /* dip switch (handled separately) */
+ PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
+
+ PORT_START("KEY10")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_KAN ) PORT_PLAYER(2)
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_REACH ) PORT_PLAYER(2)
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_RON ) PORT_PLAYER(2)
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_CUSTOM ) /* dip switch (handled separately) */
+ PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
+
+ PORT_START("KEY11")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START2 )
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_BET ) PORT_PLAYER(2)
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_CUSTOM ) /* dip switch (handled separately) */
+ PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
INPUT_PORTS_END
static INPUT_PORTS_START( pteacher )
@@ -957,7 +1008,7 @@ INPUT_PORTS_END
static INPUT_PORTS_START( jogakuen )
PORT_START("DSW") /* dip switches (handled by pteacher_keyboard_r) */
- PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coinage ) )
+ PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:1,2,3")
PORT_DIPSETTING( 0x0000, DEF_STR( 5C_1C ) )
PORT_DIPSETTING( 0x0001, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x0002, DEF_STR( 3C_1C ) )
@@ -966,23 +1017,23 @@ static INPUT_PORTS_START( jogakuen )
PORT_DIPSETTING( 0x0006, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x0005, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x0004, DEF_STR( 1C_4C ) )
- PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Demo_Sounds ) )
+ PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:4")
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0008, DEF_STR( On ) )
- PORT_DIPNAME( 0x0010, 0x0010, "In-Game BGM" )
+ PORT_DIPNAME( 0x0010, 0x0010, "In-Game BGM" ) PORT_DIPLOCATION("SW1:5")
PORT_DIPSETTING( 0x0010, DEF_STR( On ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
- PORT_DIPNAME( 0x0020, 0x0020, "Gal Strip Voice" )
+ PORT_DIPNAME( 0x0020, 0x0020, "Gal Strip Voice" ) PORT_DIPLOCATION("SW1:6")
PORT_DIPSETTING( 0x0020, DEF_STR( On ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
- PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Flip_Screen ) )
+ PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:7")
PORT_DIPSETTING( 0x0040, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
- PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) )
+ PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:8")
PORT_DIPSETTING( 0x0080, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
- PORT_SERVICE( 0x0800, IP_ACTIVE_LOW )
- PORT_DIPNAME( 0x0700, 0x0700, DEF_STR( Difficulty ) ) // not sure about the sequence here
+ PORT_SERVICE( 0x0800, IP_ACTIVE_LOW ) PORT_DIPLOCATION("SW2:1")
+ PORT_DIPNAME( 0x0700, 0x0700, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:2,3,4") // not sure about the sequence here
PORT_DIPSETTING( 0x0300, DEF_STR( Easiest ) ) // 'Easy 4' in test mode
PORT_DIPSETTING( 0x0200, DEF_STR( Very_Easy ) ) // 'Easy 3' in test mode
PORT_DIPSETTING( 0x0100, DEF_STR( Easier ) ) // 'Easy 2' in test mode
@@ -1003,40 +1054,39 @@ INPUT_PORTS_END
static INPUT_PORTS_START( mjikaga )
PORT_START("DSW") /* dip switches (handled by pteacher_keyboard_r) */
- PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unknown ) )
+ PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:1")
PORT_DIPSETTING( 0x0001, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
- PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) )
+ PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:2")
PORT_DIPSETTING( 0x0002, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
- PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) )
+ PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:3")
PORT_DIPSETTING( 0x0004, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
- PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) )
- PORT_DIPSETTING( 0x0008, DEF_STR( Off ) )
- PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
- PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) )
+ PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:4")
+ PORT_DIPSETTING( 0x0008, DEF_STR( On ) )
+ PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
+ PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:5")
PORT_DIPSETTING( 0x0010, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
- PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) )
- PORT_DIPSETTING( 0x0020, DEF_STR( Off ) )
- PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
- PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) )
+ PORT_DIPNAME( 0x0020, 0x0020, "In-Game BGM" ) PORT_DIPLOCATION("SW1:6")
+ PORT_DIPSETTING( 0x0020, DEF_STR( On ) )
+ PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
+ PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:7")
PORT_DIPSETTING( 0x0040, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
- PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) )
+ PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:8")
PORT_DIPSETTING( 0x0080, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
- PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Unknown ) )
- PORT_DIPSETTING( 0x0800, DEF_STR( Off ) )
- PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
- PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) )
- PORT_DIPSETTING( 0x0400, DEF_STR( Off ) )
- PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
- PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Flip_Screen ) )
+ PORT_DIPNAME( 0x0c00, 0x0c00, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW2:1,2")
+ PORT_DIPSETTING( 0x0000, DEF_STR( 3C_1C ) )
+ PORT_DIPSETTING( 0x0800, DEF_STR( 2C_1C ) )
+ PORT_DIPSETTING( 0x0c00, DEF_STR( 1C_1C ) )
+ PORT_DIPSETTING( 0x0400, DEF_STR( 1C_2C ) )
+ PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:3")
PORT_DIPSETTING( 0x0200, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
- PORT_SERVICE( 0x0100, IP_ACTIVE_LOW )
+ PORT_SERVICE( 0x0100, IP_ACTIVE_LOW ) PORT_DIPLOCATION("SW2:4")
PORT_BIT( 0xf000, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("COIN")
diff --git a/src/mame/includes/homedata.h b/src/mame/includes/homedata.h
index 886b1341ff0..e767abe4bae 100644
--- a/src/mame/includes/homedata.h
+++ b/src/mame/includes/homedata.h
@@ -29,7 +29,8 @@ public:
m_soundlatch(*this, "soundlatch"),
m_mainlatch(*this, "mainlatch"),
m_sn(*this, "snsnd"),
- m_mrokumei_soundbank(*this, "mrokumei_soundbank")
+ m_mrokumei_soundbank(*this, "mrokumei_soundbank"),
+ m_keys(*this, "KEY%u", 0U)
{
}
@@ -85,6 +86,8 @@ private:
optional_device<sn76489a_device> m_sn; // mrokumei and pteacher
optional_device<address_map_bank_device> m_mrokumei_soundbank; // mrokumei
+ optional_ioport_array<12> m_keys;
+
uint8_t m_prot_data;
DECLARE_READ8_MEMBER(mrokumei_keyboard_r);
DECLARE_WRITE8_MEMBER(mrokumei_keyboard_select_w);